修改再制定目标是可能的提示修改指标

This commit is contained in:
wulin 2020-12-08 10:34:16 +08:00
parent c333fc78a4
commit c029461eee

View File

@ -882,73 +882,83 @@ public class ResultRecordController extends AbstractController {
//去重 //去重
mapDetails = updateResultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e)); mapDetails = updateResultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
updateResultDetails = mapDetails.values().stream().collect(Collectors.toList()); updateResultDetails = mapDetails.values().stream().collect(Collectors.toList());
log.info("实际需要写入评论的内容条数{}", updateResultDetails.size()); if(!isSetKeyResult){
if(updateResultDetails.size() > 0){ log.info("实际需要写入评论的内容条数{}", updateResultDetails.size());
updates.addAll(inserts); if(updateResultDetails.size() > 0){
updates.addAll(inserts);
mapDetails = updates.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e)); mapDetails = updates.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
String commandValue = ""; String commandValue = "";
int commandIndex = 1; int commandIndex = 1;
for (ResultDetail resultDetail1:updateResultDetails for (ResultDetail resultDetail1:updateResultDetails
) { ) {
log.info("修改的对象为{}", resultDetail1); log.info("修改的对象为{}", resultDetail1);
if(resultDetail1.getIsDelete().intValue() == 1){ if(resultDetail1.getIsDelete().intValue() == 1){
commandValue += (commandIndex + "(删除) 指标" + resultDetail1.getTarget() + "\n"); commandValue += (commandIndex + "(删除) 指标" + resultDetail1.getTarget() + "\n");
commandIndex++; commandIndex++;
resultDetail1.setIsBack(1); resultDetail1.setIsBack(1);
}else if(resultDetail1.getIsBack().intValue() == 3){ }else if(resultDetail1.getIsBack().intValue() == 3){
commandValue += (commandIndex + "(新增) 指标" + resultDetail1.getTarget() + "\n"); commandValue += (commandIndex + "(新增) 指标" + resultDetail1.getTarget() + "\n");
commandIndex++; commandIndex++;
resultDetail1.setIsBack(0); resultDetail1.setIsBack(0);
}else{ }else{
ResultDetail resultDetail = mapDetails.get(resultDetail1.getBackId()); ResultDetail resultDetail = mapDetails.get(resultDetail1.getBackId());
if(resultDetail != null){ if(resultDetail != null){
log.info("修改后的对象为{}", resultDetail1); log.info("修改后的对象为{}", resultDetail1);
boolean isUp = false; boolean isUp = false;
String value = ""; String value = "";
String heard = ""; String heard = "";
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){ if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
//打上标识 //打上标识
value += ("(修改) 名称:" + value += ("(修改) 名称:" +
resultDetail1.getTarget()+ " \n(为)\n" + resultDetail.getTarget() + "\n"); resultDetail1.getTarget()+ " \n(为)\n" + resultDetail.getTarget() + "\n");
isUp = true; isUp = true;
}else{ }else{
heard = "指标:" + resultDetail1.getTarget() + "\n"; heard = "指标:" + resultDetail1.getTarget() + "\n";
} }
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){ if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
//打上标识 //打上标识
value += ("(修改) 考核标准:" + value += ("(修改) 考核标准:" +
resultDetail1.getKeyResult() + "\n(为)\n" + resultDetail.getKeyResult() + "\n"); resultDetail1.getKeyResult() + "\n(为)\n" + resultDetail.getKeyResult() + "\n");
isUp = true; isUp = true;
} }
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){ if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
//打上标识 //打上标识
value += ("(修改) 权重:" + value += ("(修改) 权重:" +
resultDetail1.getCheckWeight().multiply(new BigDecimal(100)).intValue() + "%\n(为)\n" resultDetail1.getCheckWeight().multiply(new BigDecimal(100)).intValue() + "%\n(为)\n"
+ resultDetail.getCheckWeight().multiply(new BigDecimal(100)).intValue() + + resultDetail.getCheckWeight().multiply(new BigDecimal(100)).intValue() +
"%\n"); "%\n");
isUp = true; isUp = true;
} }
if(isUp){ if(isUp){
commandValue += (commandIndex + "" + heard + value); commandValue += (commandIndex + "" + heard + value);
commandIndex++; commandIndex++;
resultDetail1.setIsBack(1); resultDetail1.setIsBack(1);
}
} }
} }
}
if(commandValue.length() > 0){
log.info("需要写入评论,具体呢容为{}", commandValue);
resultCommentService.updateResultCommentCommentById(dto.getCommentId(), commandValue);
} }
} }
if(commandValue.length() > 0){ }else{
log.info("需要写入评论,具体呢容为{}", commandValue); for (ResultDetail resultDetail1:updateResultDetails
resultDetailService.updateBatchById(updateResultDetails); ) {
resultCommentService.updateResultCommentCommentById(dto.getCommentId(), commandValue); if(resultDetail1.getIsBack().intValue() == 3){
resultDetail1.setIsBack(0);
}else{
resultDetail1.setIsBack(1);
}
} }
} }
resultDetailService.updateBatchById(updateResultDetails);
} }
return R.ok(); return R.ok();