Browse Source

fix: 去重日志

shc 3 năm trước cách đây
mục cha
commit
7606bdc723

+ 7 - 3
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/ApiController.java

@@ -842,7 +842,6 @@ public class ApiController {
 			try {
 				String fieldVal = (String) field.get(wmTaskContent);
 
-				log.info("key:{}, val:{}", field.getName(), fieldVal);
 				all = duplicateImage(fieldVal, id, errorHash, ducImgUrl);
 			} catch (Exception ignored) {
 			}
@@ -852,7 +851,11 @@ public class ApiController {
 		if (CollUtil.isNotEmpty(ducImgUrl)) {
 			// 保存图片
 			if (CollUtil.isNotEmpty(all)){
-				all.forEach(hash -> redisTemplate.delete(String.format("%s:%s", id, hash)));
+				all.forEach(hash -> {
+					String  key = String.format("%s:%s", id, hash);
+					log.info("key: {}", key);
+					redisTemplate.delete(key);
+				});
 			}
 			return R.failed(ducImgUrl, "提交重复的图片");
 		}
@@ -896,11 +899,12 @@ public class ApiController {
 						log.info("图片md5:{}", hash);
 						Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(String.format("%s:%s", userId, hash), item);
 						if (!aBoolean) {
-							log.error("上传了重复的图片");
+							log.error("上传了重复的图片, hash:{}", hash);
 							errorHash.add(hash);
 							duplicateImageUrl.add(upmsConfig.getClientUrl() + item);
 						} else {
 							all.add(hash);
+							log.info("hash:{}, size:{}", hash, all.size());
 						}
 					} catch (IOException | URISyntaxException | NoSuchAlgorithmException e) {
 						e.printStackTrace();