|
@@ -50,6 +50,7 @@ import com.qunzhixinxi.hnqz.common.ding.entity.EmployCheckResultItem;
|
|
|
import com.qunzhixinxi.hnqz.common.ding.enums.DingEnum;
|
|
|
import com.qunzhixinxi.hnqz.common.ding.service.DingService;
|
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
|
+import com.qunzhixinxi.hnqz.common.oss.service.OssTemplate;
|
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
|
import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
@@ -59,6 +60,7 @@ import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperAddMemberRe
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.response.TaxHelperResponse;
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.enums.TaxHelperCertStatus;
|
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.service.TaxHelperService;
|
|
|
+import io.opentracing.log.Fields;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -80,8 +82,11 @@ import javax.imageio.ImageIO;
|
|
|
import javax.imageio.stream.ImageOutputStream;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
+import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
+import java.net.URI;
|
|
|
+import java.net.URISyntaxException;
|
|
|
import java.security.MessageDigest;
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
import java.text.DateFormat;
|
|
@@ -130,6 +135,7 @@ public class ApiController {
|
|
|
private final WmFeedbackService wmFeedbackService;
|
|
|
private final WmDaPharmacyService wmDaPharmacyService;
|
|
|
private final RedisTemplate redisTemplate;
|
|
|
+ private final OssTemplate minioTemplate;
|
|
|
private final DingService dingService;
|
|
|
private final UpmsConfig upmsConfig;
|
|
|
private final TaxHelperService taxHelperService;
|
|
@@ -813,10 +819,21 @@ public class ApiController {
|
|
|
@SysLog("新增任务内容表")
|
|
|
@PostMapping("/saveTaskContent")
|
|
|
public R saveTaskContent(@RequestBody WmTaskContent wmTaskContent) {
|
|
|
+
|
|
|
+ Set<String> errorHash = new HashSet<>();
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+
|
|
|
+ // 校验是否重复
|
|
|
+ WmTaskContent.Fields[] fields = WmTaskContent.Fields.values();
|
|
|
+ for (WmTaskContent.Fields f : fields){
|
|
|
+ String s = BeanUtil.copyProperties(wmTaskContent, String.class, f.name());
|
|
|
+ duplicateImage(s, user.getId(), errorHash);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
R r = wmTaskContentService.saveTaskContent(wmTaskContent);
|
|
|
|
|
|
if (r.getCode() == CommonConstants.SUCCESS) {
|
|
|
- HnqzUser user = SecurityUtils.getUser();
|
|
|
String key = String.format(CacheConstants.TASK_CONTENT_DRAFT, wmTaskContent.getTemp30(), user.getId());
|
|
|
redisTemplate.delete(key);
|
|
|
}
|
|
@@ -824,6 +841,48 @@ public class ApiController {
|
|
|
return r;
|
|
|
}
|
|
|
|
|
|
+ private void duplicateImage(String contentValue, Integer userId, Set<String> errorHash) {
|
|
|
+
|
|
|
+ if (contentValue.startsWith("/admin/sys-file/wmkj")) {
|
|
|
+
|
|
|
+ List<String> split = StrUtil.split(contentValue, StrUtil.COMMA);
|
|
|
+
|
|
|
+ List<String> IMG_EXT_NAME = Arrays.asList("png", "jpg", "gif", "jpeg", "tif", "bmp");
|
|
|
+
|
|
|
+ split.forEach(item -> {
|
|
|
+ List<String> temp = StrUtil.split(item, StrUtil.DOT);
|
|
|
+ String extName = temp.get(temp.size() - 1);
|
|
|
+
|
|
|
+ if (IMG_EXT_NAME.contains(extName)) {
|
|
|
+
|
|
|
+ // 文件md5
|
|
|
+ try {
|
|
|
+ log.info("图片地址:{}", upmsConfig.getClientUrl() + item);
|
|
|
+ byte[] bytes = IOUtils.toByteArray(new URI(upmsConfig.getClientUrl() + item));
|
|
|
+ MessageDigest md5 = MessageDigest.getInstance("MD5");
|
|
|
+ byte[] digest = md5.digest(bytes);
|
|
|
+ String hash = new BigInteger(1, digest).toString(16);
|
|
|
+ log.info("图片md5:{}", hash);
|
|
|
+ Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(String.format("%s:%s", userId, hash), item, 7, TimeUnit.DAYS);
|
|
|
+ if (aBoolean != null && !aBoolean) {
|
|
|
+ log.error("上传了重复的图片");
|
|
|
+ errorHash.add(hash);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (IOException | URISyntaxException | NoSuchAlgorithmException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存任务内容
|
|
|
*
|
|
@@ -3528,6 +3587,7 @@ public class ApiController {
|
|
|
|
|
|
/**
|
|
|
* 小程序上传
|
|
|
+ *
|
|
|
* @param file 资源
|
|
|
* @return R(/ admin / bucketName / filename)
|
|
|
*/
|
|
@@ -3538,14 +3598,14 @@ public class ApiController {
|
|
|
|
|
|
String extName = FileUtil.extName(originalFilename);
|
|
|
|
|
|
- List<String> IMG_EXT_NAME= Arrays.asList("png", "jpg", "gif","jpeg","tif","bmp");
|
|
|
+ List<String> IMG_EXT_NAME = Arrays.asList("png", "jpg", "gif", "jpeg", "tif", "bmp");
|
|
|
|
|
|
log.info("源文件名称:{}", originalFilename);
|
|
|
log.info("源文件后缀:{}", extName);
|
|
|
- if (IMG_EXT_NAME.contains(extName)){
|
|
|
+ if (IMG_EXT_NAME.contains(extName)) {
|
|
|
HnqzUser user = SecurityUtils.getUser();
|
|
|
- log.info("用户:{}",user);
|
|
|
- if (user == null){
|
|
|
+ log.info("用户:{}", user);
|
|
|
+ if (user == null) {
|
|
|
return R.failed("无法获取用户id");
|
|
|
}
|
|
|
Integer id = user.getId();
|