From 4e051073734c823793f2a45f1dc1bb3c0d755b8c Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 02 九月 2024 14:40:11 +0800
Subject: [PATCH] uy任务代码注释取消
---
ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java | 46 +++++++++++++++++-----------------------------
1 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
index 85ab0ec..bd7b72f 100644
--- a/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
+++ b/ycl-server/src/main/java/com/ycl/task/CheckScoreTask.java
@@ -13,6 +13,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
import java.lang.reflect.Field;
import java.math.BigDecimal;
@@ -32,8 +33,6 @@
private CheckTemplateRuleMapper checkTemplateRuleMapper;
@Autowired
private CheckScoreMapper scoreMapper;
- @Autowired
- private MongoTemplate mongoTemplate;
@Autowired
private ICheckIndexVideoService videoService;
@Autowired
@@ -66,7 +65,7 @@
//鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�瑙嗛鏁版嵁
List<CheckIndexVideo> checkIndexVideos = videoService.selectCheckIndexVideoList(checkIndexVideo);
for (CheckIndexVideo indexVideo : checkIndexVideos) {
- addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexVideo,CheckConstants.Rule_Category_Video);
+ addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexVideo, CheckConstants.Rule_Category_Video);
}
} else if (CheckConstants.Rule_Category_Car.equals(examineCategory)) {
CheckIndexCar checkIndexCar = new CheckIndexCar();
@@ -76,7 +75,7 @@
//鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�杞﹁締鏁版嵁
List<CheckIndexCar> checkIndexCars = carService.selectCheckIndexCarList(checkIndexCar);
for (CheckIndexCar indexCar : checkIndexCars) {
- addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexCar,CheckConstants.Rule_Category_Car);
+ addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexCar, CheckConstants.Rule_Category_Car);
}
} else if (CheckConstants.Rule_Category_Face.equals(examineCategory)) {
CheckIndexFace checkIndexFace = new CheckIndexFace();
@@ -86,18 +85,17 @@
//鏍规嵁妯℃澘鐨勮�冩牳鏍囩鏌ュ悇鍖哄幙瀵瑰簲鐪佸巺鎴栧競灞�浜鸿劯鏁版嵁
List<CheckIndexFace> checkIndexFaces = faceService.selectCheckIndexFaceList(checkIndexFace);
for (CheckIndexFace indexFace : checkIndexFaces) {
- addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace,CheckConstants.Rule_Category_Face);
+ addToList(templateId, checkTemplate, examineTag, templateRuleList, scoreList, indexFace, CheckConstants.Rule_Category_Face);
}
}
-
//鍌ㄥ瓨鍒嗘暟
- scoreMapper.saveBatch(scoreList);
- //TODO锛氭牴鎹姤璀﹀垎鏁伴槇鍊硷紝娣诲姞鎶ヨ淇℃伅
-
+ if(!CollectionUtils.isEmpty(scoreList)) {
+ scoreMapper.saveBatch(scoreList);
+ }
}
}
- private <T extends CheckIndex>void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject,Short checkCategory) {
+ private <T extends CheckIndex> void addToList(Integer templateId, CheckTemplate checkTemplate, Short examineTag, List<CheckTemplateRule> templateRuleList, List<CheckScore> scoreList, T indexObject, Short checkCategory) {
CheckScore checkScore = new CheckScore();
BigDecimal scoreFinal = BigDecimal.ZERO;
for (CheckTemplateRule templateRule : templateRuleList) {
@@ -105,12 +103,12 @@
scoreFinal = getScoreFinal(indexObject, scoreFinal, templateRule);
}
//琛ュ厖checkScore
- fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal,checkCategory);
+ fillCheckScore(templateId, checkTemplate, examineTag, indexObject, checkScore, scoreFinal, checkCategory);
scoreList.add(checkScore);
}
//閫氱敤鏂规硶璁$畻鍒嗘暟
- private <T>BigDecimal getScoreFinal(T object, BigDecimal scoreFinal, CheckTemplateRule templateRule) {
+ private <T> BigDecimal getScoreFinal(T object, BigDecimal scoreFinal, CheckTemplateRule templateRule) {
String ruleIndex = templateRule.getRuleIndex();
//灏哸_b_c杞崲涓篴BC
String camelRuleIndex = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, ruleIndex);
@@ -123,37 +121,27 @@
BigDecimal score = index.multiply(templateRule.getWeight());
scoreFinal = scoreFinal.add(score);
} catch (Exception e) {
- log.info("鍙嶅皠寮傚父",e);
+ log.info("鍙嶅皠寮傚父", e.getMessage());
}
return scoreFinal;
}
+
//璁剧疆checkScore瀵硅薄
- private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal,Short checkCategory) {
+ private void fillCheckScore(Integer templateId, CheckTemplate checkTemplate, Short examineTag, CheckIndex checkIndex, CheckScore checkScore, BigDecimal scoreFinal, Short checkCategory) {
//鏍规嵁璋冩暣绯绘暟璋冩暣鏈�缁堝垎鏁板ぇ灏�
String adjustWay = checkTemplate.getAdjustWay();
BigDecimal adjustCoefficient = checkTemplate.getAdjustCoefficient();
- if(CheckConstants.Multiply.equals(adjustWay)){
+ if (CheckConstants.Multiply.equals(adjustWay)) {
scoreFinal = adjustCoefficient.multiply(scoreFinal).multiply(new BigDecimal(100));
- }else if(CheckConstants.Divided.equals(adjustWay)){
+ } else if (CheckConstants.Divided.equals(adjustWay)) {
//鍥涜垗浜斿叆淇濈暀灏忔暟鍚庡洓浣�
- scoreFinal = scoreFinal.divide(adjustCoefficient,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
+ scoreFinal = scoreFinal.divide(adjustCoefficient, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
}
checkScore.setCreateTime(new Date());
- checkScore.setExamineTag(Integer.parseInt(examineTag +""));
+ checkScore.setExamineTag(Integer.parseInt(examineTag + ""));
checkScore.setExamineCategory(checkCategory);
checkScore.setDeptId(checkIndex.getDeptId());
checkScore.setTemplateId(templateId);
checkScore.setScore(scoreFinal);
- }
-
- //鏌ongo鏁版嵁褰掓。鍒癿ysql
- public void dataArchiving() {
- //TODO:褰掓。check_index_car,鍖哄垎鐪佸巺甯傚眬锛屾瘡涓尯鍘夸竴鏉℃暟鎹�
- CheckIndexCar checkIndexCar = new CheckIndexCar();
- //TODO:褰掓。check_index_face
- CheckIndexFace checkIndexFace = new CheckIndexFace();
- //TODO:褰掓。check_index_video
- CheckIndexVideo checkIndexVideo = new CheckIndexVideo();
-
}
}
--
Gitblit v1.8.0