|
|
|
@ -2,6 +2,7 @@ package com.glxp.api.controller.auth;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
|
|
import com.glxp.api.constant.FileConstant;
|
|
|
|
|
import com.glxp.api.res.basic.UserWorkResponse;
|
|
|
|
|
import com.glxp.api.res.basic.WorkBindWorkResponse;
|
|
|
|
|
import com.glxp.api.service.basic.BasicCollectUserService;
|
|
|
|
@ -32,14 +33,18 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -429,13 +434,62 @@ public class LoginController extends BaseController {
|
|
|
|
|
@Value("${WEB_SUB_TITLE}")
|
|
|
|
|
private String WEB_SUB_TITLE;
|
|
|
|
|
|
|
|
|
|
@Value("${WEB_VERSION}")
|
|
|
|
|
private String WEB_VERSION;
|
|
|
|
|
@Value("${WEB_LOGO}")
|
|
|
|
|
private String WEB_LOGO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/spms/getTitleConfig")
|
|
|
|
|
public BaseResponse getTitleConfig() {
|
|
|
|
|
WebTitleResponse webTitleResponse = new WebTitleResponse();
|
|
|
|
|
webTitleResponse.setTitle(WEB_TITLE);
|
|
|
|
|
webTitleResponse.setSubTitle(WEB_SUB_TITLE);
|
|
|
|
|
webTitleResponse.setWebVersion(WEB_VERSION);
|
|
|
|
|
webTitleResponse.setWebLogo(WEB_LOGO);
|
|
|
|
|
return ResultVOUtils.success(webTitleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/udiwms/image/getImage")
|
|
|
|
|
public void getImage(HttpServletResponse response,
|
|
|
|
|
@RequestParam String type,
|
|
|
|
|
@RequestParam String name) throws IOException {
|
|
|
|
|
File file = new File(filePath + "/register/" + type + "/" + name);
|
|
|
|
|
|
|
|
|
|
// 检查文件是否存在
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutputStream os = null;
|
|
|
|
|
try {
|
|
|
|
|
// 读取图片
|
|
|
|
|
BufferedImage image = ImageIO.read(new FileInputStream(file));
|
|
|
|
|
response.setContentType("image/png");
|
|
|
|
|
os = response.getOutputStream();
|
|
|
|
|
|
|
|
|
|
if (image != null) {
|
|
|
|
|
ImageIO.write(image, "png", os);
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
|
|
|
|
} finally {
|
|
|
|
|
if (os != null) {
|
|
|
|
|
try {
|
|
|
|
|
os.flush();
|
|
|
|
|
os.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|