|
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.MsgCode;
|
|
|
import com.fdkankan.common.exception.BaseRuntimeException;
|
|
|
-import com.fdkankan.common.util.Base64Converter;
|
|
|
-import com.fdkankan.common.util.PasswordUtils;
|
|
|
-import com.fdkankan.common.util.RandomValidateCodeUtil;
|
|
|
-import com.fdkankan.common.util.Result;
|
|
|
+import com.fdkankan.common.util.*;
|
|
|
import com.fdkankan.domain.backend.DepartmentEntity;
|
|
|
import com.fdkankan.domain.backend.RoleEntity;
|
|
|
import com.fdkankan.domain.backend.UserEntity;
|
|
@@ -31,10 +28,12 @@ import org.apache.commons.codec.binary.Base64;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -69,6 +68,7 @@ public class IndexController {
|
|
|
private OperatorFeign operatorFeign;
|
|
|
|
|
|
|
|
|
+
|
|
|
@ApiOperation("用户登陆")
|
|
|
@PostMapping(value = "/login")
|
|
|
@ApiImplicitParams({
|
|
@@ -266,12 +266,13 @@ public class IndexController {
|
|
|
@ApiOperation("返回url base64编码")
|
|
|
@GetMapping("/getEncodeUrl")
|
|
|
public Result getEncodeUrl(HttpServletRequest request, HttpServletResponse response) {
|
|
|
- String url = request.getParameter("url");
|
|
|
- byte[] b = url.getBytes();
|
|
|
- org.apache.commons.codec.binary.Base64 base64 = new Base64();
|
|
|
- b = base64.encode(b);
|
|
|
- String base64Url = new String(b);
|
|
|
- return Result.success("success", base64Url);
|
|
|
+ String fileUrl = request.getParameter("url");
|
|
|
+ try {
|
|
|
+ return Result.success("success", FileUtils.getBase64ContentFromUrl(fileUrl));
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error("base64编码转码报错", e);
|
|
|
+ return Result.failure(1, "转码异常");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|