|
@@ -1,6 +1,7 @@
|
|
|
package thyyxxk.webserver.service.settings;
|
|
|
|
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -30,6 +31,7 @@ import thyyxxk.webserver.http.websocket.dto.WebSocketByListUserCode;
|
|
|
import thyyxxk.webserver.http.websocket.dto.WebSocketByUserCode;
|
|
|
import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.service.TokenService;
|
|
|
+import thyyxxk.webserver.service.archive.ArchiveServer;
|
|
|
import thyyxxk.webserver.service.externalhttp.CorpWxSrvc;
|
|
|
import thyyxxk.webserver.service.hutoolcache.CacheEnums;
|
|
|
import thyyxxk.webserver.service.hutoolcache.ExtraCache;
|
|
@@ -58,9 +60,8 @@ public class SettingsService {
|
|
|
private final SystemConfig systemConfig;
|
|
|
private final TokenService tokenService;
|
|
|
private final SocketV2 intergrationPlatformSocket;
|
|
|
+ private final ArchiveServer archiveServer;
|
|
|
|
|
|
- @Value("${is-prod}")
|
|
|
- private boolean isProd;
|
|
|
|
|
|
public ResultVo<UserInfo> getUserInfo() {
|
|
|
final String code = TokenUtil.getInstance().getTokenUserId();
|
|
@@ -299,39 +300,6 @@ public class SettingsService {
|
|
|
return dao.selectAllUsers(page, qw).getRecords().get(0);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param file 签名 code 人员编码
|
|
|
- * @return map
|
|
|
- * @Description 更新医生的签名
|
|
|
- * @Author hsh
|
|
|
- * @Date 2024/5/14 10:36
|
|
|
- */
|
|
|
- public ResultVo<Map<String, Object>> setAutographImage(MultipartFile file, String code) {
|
|
|
- if (StringUtil.isBlank(code)) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM);
|
|
|
- }
|
|
|
- String img = base64Encode(file);
|
|
|
- Map<String, Object> m = dao.selectAutographImageByCode(code);
|
|
|
- int count;
|
|
|
- if (null == m || m.isEmpty()) {
|
|
|
- EmployeeMi mi = dao.selectEmployeeMiByCode(code);
|
|
|
- if (null != mi) {
|
|
|
- count = dao.intoAutographImage(code, img, mi.getSexCode() == null ? "9" : mi.getSexCode());
|
|
|
- } else {
|
|
|
- count = dao.intoAutographImage(code, img, "9");
|
|
|
- }
|
|
|
- } else {
|
|
|
- count = dao.updateAutographImage(code, img);
|
|
|
- }
|
|
|
- if (count > 0) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- Map<String, Object> imgMap = dao.selectAutographImageByCode(code);
|
|
|
- map.put("data", imgMap);
|
|
|
- return ResultVoUtil.success(map);
|
|
|
- } else {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NEED_PROOFREAD);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* @param code 医生编码
|
|
@@ -344,19 +312,6 @@ public class SettingsService {
|
|
|
return ResultVoUtil.success(dao.selectAutographImageByCode(code));
|
|
|
}
|
|
|
|
|
|
- private String base64Encode(MultipartFile file) {
|
|
|
- String ret = null;
|
|
|
- if (file == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- try {
|
|
|
- Base64.Encoder encoder = Base64.getEncoder();
|
|
|
- ret = encoder.encodeToString(file.getBytes());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("将图片文件转base64出错", e);
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
|
|
|
public ResultVo<JSONObject> putAutographImage(MultipartFile file, String code) {
|
|
|
String codeRs = "";
|
|
@@ -370,26 +325,14 @@ public class SettingsService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String uploadDir = systemConfig.getDoctorSignFolder();
|
|
|
-
|
|
|
+ String createFilePath = StrUtil.format("/{}/doctorSignature/{}.png", "archive", code);
|
|
|
+ archiveServer.createFile(file, createFilePath);
|
|
|
JSONObject js = new JSONObject();
|
|
|
-
|
|
|
String name = FileNameUtil.extName(file.getOriginalFilename());
|
|
|
String fileName = code + "." + name;
|
|
|
- Path uploadPath = Paths.get(uploadDir);
|
|
|
- try {
|
|
|
- Files.createDirectories(uploadPath);
|
|
|
- Path filePath = uploadPath.resolve(fileName);
|
|
|
- Files.copy(file.getInputStream(), filePath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
- log.info("文件:{}, code:{}", file.getName(), code);
|
|
|
- String url = "/doctorSignatureImage/" + fileName;
|
|
|
- js.put("url", url);
|
|
|
- js.put("name", fileName);
|
|
|
- return ResultVoUtil.success(js);
|
|
|
- } catch (IOException e) {
|
|
|
- log.error("上传错误:{}", e.getMessage());
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "上传错误请重新上传。");
|
|
|
- }
|
|
|
+ js.put("url", StrUtil.format("/doctorSignatureImage/{}.png", "archive", code));
|
|
|
+ js.put("name", fileName);
|
|
|
+ return ResultVoUtil.success(js);
|
|
|
}
|
|
|
|
|
|
public void setUserConfig(String js) {
|