bug:评分计算修改

This commit is contained in:
wxyclub
2023-11-07 22:39:05 +08:00
parent 66fdd6b761
commit fe7e71962d
7 changed files with 57 additions and 49 deletions
@@ -238,11 +238,11 @@ public class EsRevisePlanController extends BaseController<EsRevisePlan> {
return Result.success(iEsRevisePlanService.modPlanByState(esRevisePlan));
}
@ApiOperation(value = "编辑企标计划-企标技术更新计划状态-计算质量评分")
@PostMapping("modPlanByStateAndScore")
public ResponseMessage<Object> modPlanByStateAndScore(EsRevisePlan esRevisePlan){
return Result.success(iEsRevisePlanService.modPlanByStateAndScore(esRevisePlan));
}
// @ApiOperation(value = "编辑企标计划-企标技术更新计划状态-计算质量评分")
// @PostMapping("modPlanByStateAndScore")
// public ResponseMessage<Object> modPlanByStateAndScore(EsRevisePlan esRevisePlan){
// return Result.success(iEsRevisePlanService.modPlanByStateAndScore(esRevisePlan));
// }
@ApiOperation(value = "编辑企标计划-流程")
@PostMapping("modPlanByProcess")
@@ -292,9 +292,4 @@ public class EsRevisePlanController extends BaseController<EsRevisePlan> {
return Result.success(iEsRevisePlanService.oaUpdatePlans(esId,date,s));
}
@GetMapping("/updateScore")
public ResponseMessage<String> updateScore(){
return iEsRevisePlanService.updateScore();
}
}
@@ -37,7 +37,5 @@ public interface IEsRevisePlanService extends IService<EsRevisePlan> {
List<EsRevisePlan> batchToDoTasks(String json);
String modPlanByStateAndScore(EsRevisePlan esRevisePlan);
ResponseMessage<String> updateScore();
// String modPlanByStateAndScore(EsRevisePlan esRevisePlan);
}
@@ -82,15 +82,14 @@ public class EsRevisePlanServiceImpl extends ServiceImpl<EsRevisePlanDao, EsRevi
esRevisePlan.getPager().setRowCount(count);
List<EsRevisePlan> esRevisePlans = esRevisePlanDao.queryAll(esRevisePlan);
// 获取质量评分
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
nf.setRoundingMode(RoundingMode.UP);
// NumberFormat nf = NumberFormat.getNumberInstance();
// nf.setMaximumFractionDigits(2);
// nf.setRoundingMode(RoundingMode.UP);
if (esRevisePlan.getScore() == null){
for (EsRevisePlan revisePlan : esRevisePlans) {
if (StringUtils.isNotBlank(revisePlan.getStandId())) {
Map<String, Double> scoreMap = qualityEvaluationService.getScore(revisePlan.getStandId());
String quality = nf.format(scoreMap.get("quality"));
revisePlan.setScore(Double.valueOf(quality));
String finalScore = qualityEvaluationService.getScore(revisePlan.getStandId());
revisePlan.setScore(Double.valueOf(finalScore));
}
}
}
@@ -284,29 +283,17 @@ public class EsRevisePlanServiceImpl extends ServiceImpl<EsRevisePlanDao, EsRevi
return esRevisePlans;
}
@Override
public String modPlanByStateAndScore(EsRevisePlan esRevisePlan) {
if (StringUtils.isBlank(esRevisePlan.getStandId())) {
return "失败";
}
modPlanByState(esRevisePlan);
Map<String, Double> score = qualityEvaluationService.getScore(esRevisePlan.getStandId());
LambdaUpdateWrapper<EsRevisePlan> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(EsRevisePlan::getStandId, esRevisePlan.getStandId());
wrapper.set(EsRevisePlan::getScore, score.get("quality"));
update(wrapper);
return "修改成功";
}
@Override
public ResponseMessage<String> updateScore() {
LambdaQueryWrapper<EsRevisePlan> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EsRevisePlan::getPlanStatus, "4");
wrapper.isNotNull(EsRevisePlan::getStandId);
List<EsRevisePlan> esRevisePlans = esRevisePlanDao.selectList(wrapper);
for (EsRevisePlan esRevisePlan : esRevisePlans) {
esRevisePlan.setScore(qualityEvaluationService.getScore(esRevisePlan.getStandId()).get("quality"));
}
return Result.success("更新成功");
}
// @Override
// public String modPlanByStateAndScore(EsRevisePlan esRevisePlan) {
// if (StringUtils.isBlank(esRevisePlan.getStandId())) {
// return "失败";
// }
// modPlanByState(esRevisePlan);
// String score = qualityEvaluationService.getScore(esRevisePlan.getStandId());
// LambdaUpdateWrapper<EsRevisePlan> wrapper = new LambdaUpdateWrapper<>();
// wrapper.eq(EsRevisePlan::getStandId, esRevisePlan.getStandId());
// wrapper.set(EsRevisePlan::getScore, score.get("quality"));
// update(wrapper);
// return "修改成功";
// }
}
@@ -37,6 +37,8 @@ public interface QualityEvaluationDao extends BaseMapper<QualityEvaluation> {
List<Integer> selectBZSH(@Param("node") String node,@Param("lawId") String lawId);
List<Integer> selectDTPJ(String processNode,@Param("lawId") String lawId);
void updateByProcessNode(@Param("lawId") String lawId);
@Select("select * from quality_evaluation")
@@ -27,7 +27,7 @@ public interface IQualityEvaluationService extends IService<QualityEvaluation> {
public List<QualityEvaluation> getEvaluationForm(QualityEvaluation query);
Map<String, Double> getScore(String lawId);
String getScore(String lawId);
ResponseMessage<QualityEvaluation> updateQualityEvaluation();
}
@@ -20,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.PipedReader;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@@ -170,7 +172,7 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
private IEvaluationIndexService iEvaluationIndexService;
@Override
public Map<String, Double> getScore(String lawId) {
public String getScore(String lawId) {
QueryWrapper<QualityEvaluation> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("law_id",lawId)
@@ -194,6 +196,7 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
Integer countCXJSWYStr = null;
Integer countBZHFSStr = null;
Integer countBZSHStr = null;
Integer countDTPJStr = null;
if(!list.isEmpty()){
for (QualityEvaluation qualityEvaluations :list){
if("征求意见".equals(qualityEvaluations.getProcessNode())) {
@@ -227,6 +230,12 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
countBZSHStr = countBZSHList.size();
}
}
if ("动态评价".equals(qualityEvaluations.getProcessNode())) {
List<Integer> countDTPJList = qualityEvaluationDao.selectDTPJ(qualityEvaluations.getProcessNode(), qualityEvaluations.getLawId());
if(!countDTPJList.isEmpty()){
countDTPJStr = countDTPJList.size();
}
}
}
}
final Integer countZQYJ = countZQYJStr;
@@ -234,6 +243,7 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
final Integer countCXJSWY = countCXJSWYStr;
final Integer countBZHFS = countBZHFSStr;
final Integer countBZSH = countBZSHStr;
final Integer countDTPJ = countDTPJStr;
HashMap<String, Double> result = new HashMap<>();
result.put("dynamic",0.0);
@@ -282,13 +292,20 @@ public class QualityEvaluationServiceImpl extends ServiceImpl<QualityEvaluationD
case "标准法规部高级经理审核":
score=Double.valueOf(item.getScore()) / countBZSH * 0.15;
break;
default: score=Double.valueOf(item.getScore());
case "动态评价":
score=Double.valueOf(item.getScore()) / (countDTPJ*4);
break;
default:
score=Double.valueOf(item.getScore());
}
return score;
} ))));
return result;
Double finalScore = result.get("quality") * 0.9 + result.get("dynamic");
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
nf.setRoundingMode(RoundingMode.UP);
return nf.format(finalScore);
}
@@ -124,4 +124,13 @@
and process_node = '标准法规部高级经理审核'
group by user_id
</select>
<select id="selectDTPJ" resultType="java.lang.Integer">
select
count(1)
from
quality_evaluation
where
law_id = #{lawId}
and process_node = '动态评价'
</select>
</mapper>