|
@ -3,6 +3,7 @@ package com.easy.admin.modules.huzhou.service.impl; |
|
|
import cn.afterturn.easypoi.excel.ExcelImportUtil; |
|
|
import cn.afterturn.easypoi.excel.ExcelImportUtil; |
|
|
import cn.afterturn.easypoi.excel.entity.ImportParams; |
|
|
import cn.afterturn.easypoi.excel.entity.ImportParams; |
|
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
|
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
@ -2747,7 +2748,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
return projectInfoList; |
|
|
return projectInfoList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 获取所有项目信息
|
|
|
// 1.获取所有项目信息
|
|
|
List<HuzhouProjectinfo> projectInfoList = this.list(); |
|
|
List<HuzhouProjectinfo> projectInfoList = this.list(); |
|
|
projectInfoList= projectInfoList.stream() |
|
|
projectInfoList= projectInfoList.stream() |
|
|
.filter(project -> !"-1".equals(project.getStage())) |
|
|
.filter(project -> !"-1".equals(project.getStage())) |
|
@ -2761,7 +2762,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
// 创建一个存放Future对象的列表
|
|
|
// 创建一个存放Future对象的列表
|
|
|
List<Future<HuzhouProjectinfo>> futures = new ArrayList<>(); |
|
|
List<Future<HuzhouProjectinfo>> futures = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// 提交任务给线程池
|
|
|
// 2.封装信息提交任务给线程池
|
|
|
for (final HuzhouProjectinfo projectInfo : projectInfoList) { |
|
|
for (final HuzhouProjectinfo projectInfo : projectInfoList) { |
|
|
futures.add(executorService.submit(() -> { |
|
|
futures.add(executorService.submit(() -> { |
|
|
String projectId = projectInfo.getId(); |
|
|
String projectId = projectInfo.getId(); |
|
@ -2798,7 +2799,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
})); |
|
|
})); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 收集结果
|
|
|
// 3.收集结果
|
|
|
for (int i = 0; i < futures.size(); i++) { |
|
|
for (int i = 0; i < futures.size(); i++) { |
|
|
try { |
|
|
try { |
|
|
projectInfoList.set(i, futures.get(i).get()); |
|
|
projectInfoList.set(i, futures.get(i).get()); |
|
@ -2808,10 +2809,10 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 关闭线程池
|
|
|
// 4.关闭线程池
|
|
|
executorService.shutdown(); |
|
|
executorService.shutdown(); |
|
|
|
|
|
|
|
|
// 按照责任工作地点排序
|
|
|
// 5.按照责任工作地点排序
|
|
|
projectInfoList = projectInfoList.stream() |
|
|
projectInfoList = projectInfoList.stream() |
|
|
.filter(Objects::nonNull) // 确保stream中的元素非null
|
|
|
.filter(Objects::nonNull) // 确保stream中的元素非null
|
|
|
.sorted(Comparator.comparing((HuzhouProjectinfo p) -> Optional.ofNullable(p.getReformName()).orElse("")) |
|
|
.sorted(Comparator.comparing((HuzhouProjectinfo p) -> Optional.ofNullable(p.getReformName()).orElse("")) |
|
@ -2879,10 +2880,19 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
projectInfo.setTimeOutPayCount(tmp.getTimeOutPayCount()); |
|
|
projectInfo.setTimeOutPayCount(tmp.getTimeOutPayCount()); |
|
|
// 5.设置文件上传占用率
|
|
|
// 5.设置文件上传占用率
|
|
|
projectInfo.setUploadFileRate(planinfofileService.getUploadFileRate(projectId)); |
|
|
projectInfo.setUploadFileRate(planinfofileService.getUploadFileRate(projectId)); |
|
|
// 6设置变更次数
|
|
|
// 6.设置变更次数
|
|
|
projectInfo.setUpdateCount(fieldchangehistoryService.queryUpdateCount(projectId)); |
|
|
projectInfo.setUpdateCount(fieldchangehistoryService.queryUpdateCount(projectId)); |
|
|
log.info("项目:{}->超时支付次数为:{}", projectInfo.getProjectName(),projectInfo.getUpdateCount()); |
|
|
log.info("项目:{}->超时支付次数为:{}", projectInfo.getProjectName(),projectInfo.getUpdateCount()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 7.评分
|
|
|
|
|
|
fillScore(projectInfo); |
|
|
|
|
|
String timeOutPaySituation = tmp.getTimeOutPaySituation(); |
|
|
|
|
|
if (containsTimeoutGreaterThanDays(timeOutPaySituation, 7)) { |
|
|
|
|
|
projectInfo.setTimeOutPayCountScore(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// 按照责任工作地点排序
|
|
|
// 按照责任工作地点排序
|
|
|
projectInfoList = projectInfoList.stream() |
|
|
projectInfoList = projectInfoList.stream() |
|
@ -2899,7 +2909,25 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
throw new EasyException("导出异常:"+e); |
|
|
throw new EasyException("导出异常:"+e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
private static boolean containsTimeoutGreaterThanDays(String message, int threshold) { |
|
|
|
|
|
if ("未出现超时".equals(message)) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String[] lines = message.split("\n"); |
|
|
|
|
|
for (String line : lines) { |
|
|
|
|
|
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("超时:\\s*(\\d+)\\s*天"); |
|
|
|
|
|
java.util.regex.Matcher matcher = pattern.matcher(line); |
|
|
|
|
|
|
|
|
|
|
|
if (matcher.find()) { |
|
|
|
|
|
int days = Integer.parseInt(matcher.group(1)); |
|
|
|
|
|
if (days > threshold) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
public ProjectResultExportDTO queryProjectResultCount() { |
|
|
public ProjectResultExportDTO queryProjectResultCount() { |
|
|
ProjectResultExportDTO result = new ProjectResultExportDTO(); |
|
|
ProjectResultExportDTO result = new ProjectResultExportDTO(); |
|
@ -2966,6 +2994,127 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//TODO 设计评分
|
|
|
|
|
|
private void fillScore(HuzhouProjectinfo projectInfo) { |
|
|
|
|
|
Double uploadFileRate = projectInfo.getUploadFileRate(); |
|
|
|
|
|
// 初始化分数
|
|
|
|
|
|
Double uploadFileRateScore = 0.0; |
|
|
|
|
|
|
|
|
|
|
|
if (uploadFileRate != null) { |
|
|
|
|
|
if (uploadFileRate.equals(100.0)) { |
|
|
|
|
|
uploadFileRateScore = 5.0; |
|
|
|
|
|
} else if (uploadFileRate > 90 && uploadFileRate < 100) { |
|
|
|
|
|
uploadFileRateScore = 4.0; |
|
|
|
|
|
} else if (uploadFileRate > 80 && uploadFileRate <= 90) { |
|
|
|
|
|
uploadFileRateScore = 3.0; |
|
|
|
|
|
} else if (uploadFileRate <= 80) { |
|
|
|
|
|
uploadFileRateScore = 1.0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//1.文件上传率得分
|
|
|
|
|
|
projectInfo.setUploadFileRateScore(uploadFileRateScore); |
|
|
|
|
|
log.info("文件上传率:{}-->文件上传率得分为:{}", uploadFileRate, uploadFileRateScore); |
|
|
|
|
|
|
|
|
|
|
|
int updateCount = projectInfo.getUpdateCount(); |
|
|
|
|
|
Double updateCountScore = 0.0; |
|
|
|
|
|
if (updateCount == 0) { |
|
|
|
|
|
updateCountScore = 5.0; |
|
|
|
|
|
} else if (updateCount == 1) { |
|
|
|
|
|
updateCountScore = 4.0; |
|
|
|
|
|
} else if (updateCount == 2) { |
|
|
|
|
|
updateCountScore = 3.0; |
|
|
|
|
|
} else { |
|
|
|
|
|
updateCountScore = 0.0; |
|
|
|
|
|
} |
|
|
|
|
|
//2.修改次数得分
|
|
|
|
|
|
projectInfo.setUpdateCountScore(updateCountScore); |
|
|
|
|
|
log.info("修改次数:{}-->得分为:{}", updateCount, updateCountScore); |
|
|
|
|
|
|
|
|
|
|
|
//超时支付情况(天数)
|
|
|
|
|
|
String projectTimeOutSituation = projectInfo.getProjectTimeOutSituation(); |
|
|
|
|
|
Double projectTimeOutSituationScore = 0.0; |
|
|
|
|
|
if (StrUtil.isNotEmpty(projectTimeOutSituation)) { |
|
|
|
|
|
if (projectTimeOutSituation.equals("未超时")) { |
|
|
|
|
|
projectTimeOutSituationScore = 12.0; |
|
|
|
|
|
} else { |
|
|
|
|
|
try { |
|
|
|
|
|
int days = Integer.parseInt(projectTimeOutSituation); |
|
|
|
|
|
if (days >= 1 && days <= 15) { |
|
|
|
|
|
projectTimeOutSituationScore = 8.0; |
|
|
|
|
|
} else if (days >= 16 && days <= 30) { |
|
|
|
|
|
projectTimeOutSituationScore = 4.0; |
|
|
|
|
|
} else if (days > 30) { |
|
|
|
|
|
projectTimeOutSituationScore = 0.0; |
|
|
|
|
|
} |
|
|
|
|
|
// 如果是 0 或负数,可以按"未超时"处理或视为非法数据,默认保持为 0 分
|
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
// 非法输入,不是数字也不是“未超时”,可记录日志或默认得分为 0
|
|
|
|
|
|
projectTimeOutSituationScore = 0.0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 3.超时支付情况(天数)得分
|
|
|
|
|
|
projectInfo.setProjectTimeOutSituationScore(projectTimeOutSituationScore); |
|
|
|
|
|
log.info("超时支付情况(天数):{}-->得分为:{}", projectTimeOutSituation, projectTimeOutSituationScore); |
|
|
|
|
|
|
|
|
|
|
|
// 4.超时支付次数评分 timeOutPayCountScore
|
|
|
|
|
|
int timeOutPayCount = projectInfo.getTimeOutPayCount(); |
|
|
|
|
|
Double timeOutPayCountScore = 0.0; |
|
|
|
|
|
if (timeOutPayCount == 0) { |
|
|
|
|
|
timeOutPayCountScore = 12.0; |
|
|
|
|
|
} else if (timeOutPayCount == 1) { |
|
|
|
|
|
timeOutPayCountScore = 8.0; |
|
|
|
|
|
} else if (timeOutPayCount == 2) { |
|
|
|
|
|
timeOutPayCountScore = 4.0; |
|
|
|
|
|
} else { |
|
|
|
|
|
timeOutPayCountScore = 0.0; |
|
|
|
|
|
} |
|
|
|
|
|
projectInfo.setTimeOutPayCountScore(timeOutPayCountScore); |
|
|
|
|
|
log.info("超时支付次数:{}-->得分为:{}", timeOutPayCount, timeOutPayCountScore); |
|
|
|
|
|
} |
|
|
|
|
|
int currentMonth = java.time.LocalDate.now().getMonthValue(); |
|
|
|
|
|
projectInfo.setSuperiorFundPayRateScore(calculateSuperiorFundPayRateScore(projectInfo.getSuperiorFundPayRate(),currentMonth)); |
|
|
|
|
|
log.info("整体资金支付情况(%):{}-->得分为:{}", projectInfo.getSuperiorFundPayRate(), projectInfo.getSuperiorFundPayRateScore()); |
|
|
|
|
|
// 设置总分
|
|
|
|
|
|
double score = Optional.ofNullable(projectInfo.getUploadFileRateScore()) .orElse(0.0) |
|
|
|
|
|
+ Optional.ofNullable(projectInfo.getUpdateCountScore()) .orElse(0.0) |
|
|
|
|
|
+ Optional.ofNullable(projectInfo.getProjectTimeOutSituationScore()).orElse(0.0) |
|
|
|
|
|
+ Optional.ofNullable(projectInfo.getTimeOutPayCountScore()) .orElse(0.0) |
|
|
|
|
|
+ Optional.ofNullable(projectInfo.getSuperiorFundPayRateScore()) .orElse(0.0); |
|
|
|
|
|
projectInfo.setScore( Double.toString(score)); |
|
|
|
|
|
log.info("总分:{}", score); |
|
|
|
|
|
} |
|
|
|
|
|
private Double calculateSuperiorFundPayRateScore(Double x, int currentMonth) { |
|
|
|
|
|
if (x == null) return 0.0; |
|
|
|
|
|
|
|
|
|
|
|
double y; |
|
|
|
|
|
if (currentMonth >= 5 && currentMonth <= 6) { |
|
|
|
|
|
y = 40.0; |
|
|
|
|
|
} else if (currentMonth >= 7 && currentMonth <= 10) { |
|
|
|
|
|
y = 80.0; |
|
|
|
|
|
} else if (currentMonth >= 11 && currentMonth <= 12) { |
|
|
|
|
|
y = 100.0; |
|
|
|
|
|
} else { |
|
|
|
|
|
return 0.0; // 非评分周期,默认不得分
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (x >= y) { |
|
|
|
|
|
return 12.0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int diff = (int) Math.abs(x - y); |
|
|
|
|
|
|
|
|
|
|
|
if (diff <= 5) { |
|
|
|
|
|
return 12.0; |
|
|
|
|
|
} else if (diff <= 10) { |
|
|
|
|
|
return 8.0; |
|
|
|
|
|
} else if (diff <= 20) { |
|
|
|
|
|
return 4.0; |
|
|
|
|
|
} else { |
|
|
|
|
|
return 0.0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean hasActualContracts(String projectId) { |
|
|
private boolean hasActualContracts(String projectId) { |
|
|
LambdaQueryWrapper<HuzhouContractinfo> qw = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<HuzhouContractinfo> qw = new LambdaQueryWrapper<>(); |
|
|
qw.eq(HuzhouContractinfo::getProjectId, projectId).eq(HuzhouContractinfo::getFlag, "实际"); |
|
|
qw.eq(HuzhouContractinfo::getProjectId, projectId).eq(HuzhouContractinfo::getFlag, "实际"); |
|
|