|
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* ExamineServiceImpl class
|
|
@@ -41,6 +42,8 @@ public class ExamineServiceImpl implements ExamineService {
|
|
|
private JtYcpfhzServiceImpl jtYcpfhzService;
|
|
|
@Autowired
|
|
|
private JtFjglxmServiceImpl jtFjglxmService;
|
|
|
+ @Autowired
|
|
|
+ private JtYcpfhzDetailServiceImpl jtYcpfhzDetailService;
|
|
|
|
|
|
/**
|
|
|
* 部门考核
|
|
@@ -58,9 +61,12 @@ public class ExamineServiceImpl implements ExamineService {
|
|
|
if (jtYcpfhz == null) {
|
|
|
throw new CustomException("无法获取预测评分汇总!");
|
|
|
}
|
|
|
+
|
|
|
+ List<JtYcpfhzDetail> oldData = jtYcpfhzDetailService.list(new LambdaQueryWrapper<JtYcpfhzDetail>()
|
|
|
+ .eq(JtYcpfhzDetail::getDataid, "0")
|
|
|
+ .eq(JtYcpfhzDetail::getYcpfhzid, id));
|
|
|
// 根据管理单位获取 考核部门信息
|
|
|
List<String> list = Arrays.asList(khzbNum.split(","));
|
|
|
-
|
|
|
// 获取考核规则
|
|
|
List<JkAssessmentRules> jkAssessmentRules = jkAssessmentRulesService.list(new LambdaQueryWrapper<JkAssessmentRules>()
|
|
|
.eq(BaseDo::getDeleted, "0")
|
|
@@ -89,9 +95,15 @@ public class ExamineServiceImpl implements ExamineService {
|
|
|
SysUserVo currentUser = JXKHUtils.getCurrentUser();
|
|
|
jkAssessmentRules.forEach(rule -> {
|
|
|
ScoreCalculationService scoreCalculationService = SpringContextUtils.getBean("scoreCalculationServiceNum" + rule.getNum());
|
|
|
- saveData.add(scoreCalculationService.soreCalculation(jtYcpfhz,khbmList, jtKhxmList, jtGsjtbsj, rule, currentUser));
|
|
|
+ saveData.add(scoreCalculationService.soreCalculation(jtYcpfhz, khbmList, jtKhxmList, jtGsjtbsj, rule, currentUser));
|
|
|
});
|
|
|
-
|
|
|
+ // 不为空 先删除旧数据 在新增
|
|
|
+ if (!oldData.isEmpty()) {
|
|
|
+ List<Integer> sortNoList = saveData.stream().map(JtYcpfhzDetail::getSortno).collect(Collectors.toList());
|
|
|
+ List<String> removeIds = oldData.stream().filter(info -> sortNoList.contains(info.getSortno())).map(JtYcpfhzDetail::getId).collect(Collectors.toList());
|
|
|
+ jtYcpfhzDetailService.removeByIds(removeIds);
|
|
|
+ }
|
|
|
+ jtYcpfhzDetailService.saveBatch(saveData, 10);
|
|
|
return R.ok();
|
|
|
}
|
|
|
}
|