修改实务认知得分和智能评分规则

master
xiaoCJ 9 months ago
parent 260bca4af4
commit cf5c7adaf3

@ -22,7 +22,6 @@ import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import javax.annotation.Resource;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;

@ -9,7 +9,6 @@ import com.sztzjy.fund_investment.entity.dto.*;
import com.sztzjy.fund_investment.mapper.*; import com.sztzjy.fund_investment.mapper.*;
import com.sztzjy.fund_investment.service.PerformanceScoreService; import com.sztzjy.fund_investment.service.PerformanceScoreService;
import com.sztzjy.fund_investment.service.tea.ClassScoreService; import com.sztzjy.fund_investment.service.tea.ClassScoreService;
import com.sztzjy.fund_investment.util.PageUtil;
import com.sztzjy.fund_investment.util.ResultEntity; import com.sztzjy.fund_investment.util.ResultEntity;
import com.sztzjy.fund_investment.util.excel.FilePortUtil; import com.sztzjy.fund_investment.util.excel.FilePortUtil;
import com.sztzjy.fund_investment.util.file.IFileUtil; import com.sztzjy.fund_investment.util.file.IFileUtil;
@ -24,8 +23,6 @@ import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* @Author xcj * @Author xcj
@ -225,11 +222,6 @@ public class ClassScoreServiceImpl implements ClassScoreService {
} }
/* /*
* @author xcj * @author xcj
* @Date 2023/11/27 * @Date 2023/11/27
@ -281,6 +273,156 @@ public class ClassScoreServiceImpl implements ClassScoreService {
} }
} }
// /* 智能评分
// * @author xcj
// * @Date 2023/11/28
// */
// @Override
// public ResultEntity<HttpStatus> autoScore(String schoolId) {
// //根据flowId查出所有页面的结论报告
// PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample();
// performanceScoreExample.createCriteria().andSchoolIdEqualTo(schoolId);
// List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
// List<String> list = new ArrayList();
//
// if (!performanceScores.isEmpty()) {
// for (PerformanceScore performanceScore : performanceScores) {
// String flowId = performanceScore.getFlowId();
// list.add(flowId);
// FoundProject foundProject = foundProjectMapper.selectByPrimaryKey(flowId);
// if (foundProject == null) {
// continue;
// }
// String serviceDueDiligence = "";
// String financialDueDiligence = "";
// String projectValuationRelative = "";
// String projectValuationAbsolute = "";
// String foundProjectConclusion = "";
// if (StringUtils.isBlank(foundProject.getFoundProjectConclusion())) {
// performanceScoreService.updateScore("projectSearchReportScore", 0, flowId);
// } else {
// foundProjectConclusion = foundProject.getFoundProjectConclusion(); // 寻找项目结论
// }
// if (StringUtils.isBlank(foundProject.getServiceDueDiligence())) {
// performanceScoreService.updateScore("projectDueDiligenceBusinessReportScore", 0, flowId);
// } else {
// serviceDueDiligence = foundProject.getServiceDueDiligence(); // 业务尽调结论
// }
// if (StringUtils.isBlank(foundProject.getFinancialDueDiligence())) {
// performanceScoreService.updateScore("projectDueDiligenceFinanceReportScore", 0, flowId);
// } else {
// financialDueDiligence = foundProject.getFinancialDueDiligence(); //财务尽调结论
// }
// if (StringUtils.isBlank(foundProject.getProjectValuationRelative())) {
// performanceScoreService.updateScore("projectValuationRelativeScore", 0, flowId);
// } else {
// projectValuationRelative = foundProject.getProjectValuationRelative();//相对估值结论得分
// }
// if (StringUtils.isBlank(foundProject.getProjectValuationAbsolute())) {
// performanceScoreService.updateScore("projectValuationAbsoluteScore", 0, flowId);
// } else {
// projectValuationAbsolute = foundProject.getProjectValuationAbsolute();//绝对估值结论得分
// }
// foundProjectConclusion = foundProjectConclusion.replaceAll("[^\\u4E00-\\u9FA5]", "");
// serviceDueDiligence = serviceDueDiligence.replaceAll("[^\\u4E00-\\u9FA5]", "");
// financialDueDiligence = financialDueDiligence.replaceAll("[^\\u4E00-\\u9FA5]", "");
// projectValuationRelative = projectValuationRelative.replaceAll("[^\\u4E00-\\u9FA5]", "");
// projectValuationAbsolute = projectValuationAbsolute.replaceAll("[^\\u4E00-\\u9FA5]", "");
// PerformanceScoreExample performanceScoreExample2 = new PerformanceScoreExample();
// performanceScoreExample2.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowId);
//
// // 寻找项目结论
// if (performanceScore.getProjectSearchReportScore() == null) {
// if (foundProjectConclusion.length() >= 30) {
// // 字符串长度超过30
// performanceScoreService.updateScore("projectSearchReportScore", 2, flowId);
// } else {
// //未超过30结论报告是必填项到这里就给1分没有0
// performanceScoreService.updateScore("projectSearchReportScore", 1, flowId);
// }
// }
// // 业务尽调结论
// if (performanceScore.getProjectDueDiligenceBusinessReportScore() == null) {
//
// if (serviceDueDiligence.length() >= 30) {
// performanceScoreService.updateScore("projectDueDiligenceBusinessReportScore", 2, flowId);
// } else {
// performanceScoreService.updateScore("projectDueDiligenceBusinessReportScore", 1, flowId);
// }
// }
// //财务尽调结论
// if (performanceScore.getProjectDueDiligenceFinanceReportScore() == null) {
//
// if (financialDueDiligence.length() >= 30) {
// performanceScoreService.updateScore("projectDueDiligenceFinanceReportScore", 2, flowId);
// } else {
// performanceScoreService.updateScore("projectDueDiligenceFinanceReportScore", 1, flowId);
// }
// }
// //项目相对估值结论
// if (performanceScore.getProjectValuationRelativeScore() == null) {
//
// if (projectValuationRelative.length() >= 30) {
// performanceScoreService.updateScore("projectValuationRelativeScore", 2, flowId);
// } else {
// performanceScoreService.updateScore("projectValuationRelativeScore", 1, flowId);
// }
// }
// //项目绝对估值结论
// if (performanceScore.getProjectValuationAbsoluteScore() == null) {
//
// if (projectValuationAbsolute.length() >= 30) {
// performanceScoreService.updateScore("projectValuationAbsoluteScore", 2, flowId);
// } else {
// performanceScoreService.updateScore("projectValuationAbsoluteScore", 1, flowId);
// }
// }
// }
// for (String flowIdByList : list) {
// TrainingReportExample trainingReportExample = new TrainingReportExample();
// trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowIdByList).andStepEqualTo("投资报告");
// PerformanceScore scoreByFlowId = performanceScoreService.getByFlowId(flowIdByList);
// List<TrainingReport> trainingReports = trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample);
// if (trainingReports.isEmpty()) {
// continue;
// }
// TrainingReport trainingReport = trainingReports.get(0);
// if (scoreByFlowId.getExperienceScore() == null && StringUtils.isBlank(trainingReport.getExperience())) {
// performanceScoreService.updateScore("experienceScore", 0, flowIdByList);
// trainingReport.setExperienceScore(BigDecimal.ZERO);
// }
// //实训心得
// if (scoreByFlowId.getExperienceScore() == null && StringUtils.isNotBlank(trainingReport.getExperience())) {
// String experience = trainingReport.getExperience();
// if (experience.length() < 100) {
// performanceScoreService.updateScore("experienceScore", 1, flowIdByList);
// trainingReport.setExperienceScore(BigDecimal.ONE);
// } else if (experience.length() < 300) {
// performanceScoreService.updateScore("experienceScore", 2, flowIdByList);
// trainingReport.setExperienceScore(BigDecimal.valueOf(2));
// } else {
// performanceScoreService.updateScore("experienceScore", 3, flowIdByList);
// trainingReport.setExperienceScore(BigDecimal.valueOf(3));
// }
// }
// //实验报告,未上传 0 分 上传得两分
// if (scoreByFlowId.getInvestmentReportScore() == null) {
// if (trainingReport.getUrl() == null && trainingReport.getReportName() == null) {
// performanceScoreService.updateScore("investmentReportScore", 0, flowIdByList);//todo 需要修改
// trainingReport.setReportScore(BigDecimal.ZERO);
// } else if (!(trainingReport.getUrl().isEmpty()) && !(trainingReport.getReportName().isEmpty())) {
// performanceScoreService.updateScore("investmentReportScore", 2, flowIdByList);//todo 需要修改
// trainingReport.setReportScore(BigDecimal.valueOf(2));
// }
// }
// trainingReportMapper.updateByPrimaryKey(trainingReport);
// }
// return new ResultEntity<>(HttpStatus.OK);
// }
// return new ResultEntity<>(HttpStatus.NOT_FOUND);
// }
/* /*
* @author xcj * @author xcj
* @Date 2023/11/28 * @Date 2023/11/28
@ -291,12 +433,26 @@ public class ClassScoreServiceImpl implements ClassScoreService {
PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample(); PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample();
performanceScoreExample.createCriteria().andSchoolIdEqualTo(schoolId); performanceScoreExample.createCriteria().andSchoolIdEqualTo(schoolId);
List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample); List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
List<String> list = new ArrayList(); List<String> list = new ArrayList();
if (!performanceScores.isEmpty()) {
for (PerformanceScore performanceScore : performanceScores) { for (PerformanceScore performanceScore : performanceScores) {
String flowId = performanceScore.getFlowId(); String flowId = performanceScore.getFlowId();
list.add(flowId); list.add(flowId);
FoundProject foundProject = foundProjectMapper.selectByPrimaryKey(flowId); }
FoundProjectExample example = new FoundProjectExample();
example.createCriteria().andFlowIdIn(list);
List<FoundProject> foundProjects = foundProjectMapper.selectByExample(example);
Map<String, FoundProject> map = new HashMap<>();
for (FoundProject foundProject : foundProjects) {
map.put(foundProject.getFlowId(), foundProject);
}
if (!performanceScores.isEmpty()) {
for (PerformanceScore performanceScore : performanceScores) {
String flowId = performanceScore.getFlowId();
FoundProject foundProject = map.get(flowId);
if (foundProject == null) { if (foundProject == null) {
continue; continue;
} }
@ -385,15 +541,31 @@ public class ClassScoreServiceImpl implements ClassScoreService {
} }
} }
} }
for (String flowIdByList : list) {
// 一次性从数据库中查询所有符合条件的 TrainingReport
TrainingReportExample trainingReportExample = new TrainingReportExample(); TrainingReportExample trainingReportExample = new TrainingReportExample();
trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowIdByList).andStepEqualTo("投资报告"); trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdIn(list).andStepEqualTo("投资报告");
List<TrainingReport> allTrainingReports = trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample);
// 构建一个以 flowId 为 key 的 TrainingReport 的 Map方便后续根据 flowId 查找对应的 TrainingReport
Map<String, TrainingReport> trainingReportMap = new HashMap<>();
for (TrainingReport trainingReport : allTrainingReports) {
trainingReportMap.put(trainingReport.getFlowId(), trainingReport);
}
Map<String, PerformanceScore> performanceScoreMap = new HashMap<>();
// 循环外执行一次查询并存储结果
for (String flowIdByList : list) {
PerformanceScore scoreByFlowId = performanceScoreService.getByFlowId(flowIdByList); PerformanceScore scoreByFlowId = performanceScoreService.getByFlowId(flowIdByList);
List<TrainingReport> trainingReports = trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample); performanceScoreMap.put(flowIdByList, scoreByFlowId);
if (trainingReports.isEmpty()) { }
// 遍历 list根据内存中的数据处理流程
for (String flowIdByList : list) {
TrainingReport trainingReport = trainingReportMap.get(flowIdByList);
if (trainingReport == null) {
continue; continue;
} }
TrainingReport trainingReport = trainingReports.get(0); PerformanceScore scoreByFlowId = performanceScoreMap.get(flowIdByList);
if (scoreByFlowId.getExperienceScore() == null && StringUtils.isBlank(trainingReport.getExperience())) { if (scoreByFlowId.getExperienceScore() == null && StringUtils.isBlank(trainingReport.getExperience())) {
performanceScoreService.updateScore("experienceScore", 0, flowIdByList); performanceScoreService.updateScore("experienceScore", 0, flowIdByList);
trainingReport.setExperienceScore(BigDecimal.ZERO); trainingReport.setExperienceScore(BigDecimal.ZERO);
@ -429,6 +601,7 @@ public class ClassScoreServiceImpl implements ClassScoreService {
return new ResultEntity<>(HttpStatus.NOT_FOUND); return new ResultEntity<>(HttpStatus.NOT_FOUND);
} }
public static void main(String[] args) { public static void main(String[] args) {
String projectValuationAbsolute = "12312,./,/@#$好好好好好好好好好好好好好好好好AFGGGS好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好"; String projectValuationAbsolute = "12312,./,/@#$好好好好好好好好好好好好好好好好AFGGGS好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好";
projectValuationAbsolute = projectValuationAbsolute.replaceAll("[^\\u4E00-\\u9FA5]", ""); projectValuationAbsolute = projectValuationAbsolute.replaceAll("[^\\u4E00-\\u9FA5]", "");

@ -33,7 +33,7 @@ public class Task {
* @Date 2023/11/23 * @Date 2023/11/23
*/ */
//todo 重新实训需要把performance_score表的数据删掉计算班级平均分时只取最新的数据 //todo 重新实训需要把performance_score表的数据删掉计算班级平均分时只取最新的数据
@Scheduled(cron = "0 0 0 * * ?") // @Scheduled(cron = "0 0 0 * * ?")
public void getClassScore() { public void getClassScore() {
// 查到单个班级下所有的已经在投资报告页面提交过的学生的总成绩 // 查到单个班级下所有的已经在投资报告页面提交过的学生的总成绩
// 算平均值,存表 // 算平均值,存表

@ -72,6 +72,7 @@ public class RsaUtil {
return new String(result); return new String(result);
} }
public static String decryptByPublicKey(String text) throws Exception { public static String decryptByPublicKey(String text) throws Exception {
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKey)); X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); KeyFactory keyFactory = KeyFactory.getInstance("RSA");

@ -2,9 +2,9 @@ spring:
datasource: datasource:
druid: druid:
db-type: mysql db-type: mysql
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:fund_investment}?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true url: jdbc:mysql://${DB_HOST:211.70.163.178}:${DB_PORT:3306}/${DB_NAME:fund_investment}?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:Sztzjy506} password: ${DB_PWD:WxxyDB@2023}
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver

Loading…
Cancel
Save