diff --git a/src/main/java/com/sztzjy/fund_investment/controller/InquiryIssuanceController.java b/src/main/java/com/sztzjy/fund_investment/controller/InquiryIssuanceController.java index 1cdf348..f803b36 100644 --- a/src/main/java/com/sztzjy/fund_investment/controller/InquiryIssuanceController.java +++ b/src/main/java/com/sztzjy/fund_investment/controller/InquiryIssuanceController.java @@ -44,6 +44,8 @@ public class InquiryIssuanceController { PerformanceScoreMapper performanceScoreMapper; @Resource PerformanceScoreService performanceScoreService; + @Resource + IssuanceParameterInput issuanceParameterInput; @AnonymousAccess @GetMapping("/queryInquiryInvestors") @ApiOperation("询价投资者查看") @@ -107,6 +109,8 @@ public class InquiryIssuanceController { } catch (Exception e) { e.printStackTrace(); } + //写入分数 + performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 1, issuanceParameterInput.getFlowId()); } @AnonymousAccess @GetMapping("/queryInitiatePreliminaryInquiry") @@ -196,6 +200,8 @@ public class InquiryIssuanceController { } catch (Exception e) { e.printStackTrace(); } + //写入分数 + performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 2, issuanceParameterInput.getFlowId()); } @AnonymousAccess @@ -221,7 +227,7 @@ public class InquiryIssuanceController { @AnonymousAccess @GetMapping("/exportInquiryResults") - @ApiOperation("投资者参与询价--询价结果") + @ApiOperation("投资者参与询价--询价结果导出") public void exportInquiryResults(HttpServletResponse response, @RequestParam String flowId) { //导出的表名 String title = IdUtil.simpleUUID(); @@ -238,6 +244,8 @@ public class InquiryIssuanceController { } catch (Exception e) { e.printStackTrace(); } + //写入分数 + performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 1, issuanceParameterInput.getFlowId()); } @AnonymousAccess diff --git a/src/main/java/com/sztzjy/fund_investment/controller/tea/ClassScoreController.java b/src/main/java/com/sztzjy/fund_investment/controller/tea/ClassScoreController.java index 2cb9606..2146eaf 100644 --- a/src/main/java/com/sztzjy/fund_investment/controller/tea/ClassScoreController.java +++ b/src/main/java/com/sztzjy/fund_investment/controller/tea/ClassScoreController.java @@ -75,8 +75,8 @@ public class ClassScoreController { @AnonymousAccess @GetMapping("/importExcel") @ApiOperation("成绩管理/导出") //目前只导出提交了报告的学生的数据 - public void importExcel(HttpServletResponse response, @RequestParam String schoolId) { - classScoreService.importExcel(response, schoolId); + public void importExcel(HttpServletResponse response, @RequestParam String classId) { + classScoreService.importExcel(response, classId); } @AnonymousAccess diff --git a/src/main/java/com/sztzjy/fund_investment/controller/tea/TeaTopicManageController.java b/src/main/java/com/sztzjy/fund_investment/controller/tea/TeaTopicManageController.java index 3f7cd6a..4d1c1f0 100644 --- a/src/main/java/com/sztzjy/fund_investment/controller/tea/TeaTopicManageController.java +++ b/src/main/java/com/sztzjy/fund_investment/controller/tea/TeaTopicManageController.java @@ -3,6 +3,7 @@ package com.sztzjy.fund_investment.controller.tea; import cn.hutool.core.util.IdUtil; import com.github.pagehelper.PageInfo; import com.sztzjy.fund_investment.annotation.AnonymousAccess; +import com.sztzjy.fund_investment.entity.QuestionAnswerExample; import com.sztzjy.fund_investment.entity.QuestionAnswerWithBLOBs; import com.sztzjy.fund_investment.entity.TopicsWithBLOBs; import com.sztzjy.fund_investment.entity.dto.QuestionAnswerDto; @@ -111,21 +112,30 @@ public class TeaTopicManageController { @GetMapping("/getQuestionById") @ApiOperation("互动答疑/获取单条互动数据") public ResultEntity getQuestionById(@ApiParam("展示接口中的id字段") @RequestParam String questionId) { - return new ResultEntity(questionAnswerMapper.selectByPrimaryKey(questionId)); +// QuestionAnswerWithBLOBs questionAnswerWithBLOBs = questionAnswerMapper.selectByPrimaryKey(questionId); + QuestionAnswerExample answerExample = new QuestionAnswerExample(); + answerExample.createCriteria().andIdEqualTo(questionId); + List questionAnswerWithBLOBs = questionAnswerMapper.selectByExampleWithBLOBs(answerExample); + if (!questionAnswerWithBLOBs.isEmpty()){ + QuestionAnswerWithBLOBs questionAnswerWithBLOBs1 = questionAnswerWithBLOBs.get(0); + return new ResultEntity<>(questionAnswerWithBLOBs1); + } + return new ResultEntity<>(new QuestionAnswerWithBLOBs()); } @AnonymousAccess @PostMapping("/addQuestion") @ApiOperation("互动答疑/学生提问") public ResultEntity getQuestionById(@ApiParam("传flowId,提问内容,学校ID") @RequestBody QuestionAnswerWithBLOBs questionAnswerWithBLOBs) { - questionAnswerWithBLOBs.setId(IdUtil.simpleUUID()); + String simpleUUID = IdUtil.simpleUUID(); + questionAnswerWithBLOBs.setId(simpleUUID); questionAnswerWithBLOBs.setQuestionTime(new Date()); try { questionAnswerMapper.insert(questionAnswerWithBLOBs); }catch (Exception e){ return new ResultEntity<>(HttpStatus.BAD_REQUEST,"提问失败,数据缺失!"); } - return new ResultEntity<>(HttpStatus.OK,"提问成功!"); + return new ResultEntity<>(HttpStatus.OK,"提问成功!",simpleUUID); } } diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java index bc148fd..b3750a9 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ProfitDistributionServiceImpl.java @@ -203,9 +203,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService //算分 if (BigDecimal.ZERO.compareTo(userRoundOwnFunds) == 0 && rightAvailableFunds.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } if (subtract.compareTo(rightOwnFunds) <= 0 && subtract.compareTo(BigDecimal.ZERO) >= 0) { //如果可用资金 - 优先级LP <= 需要分配的自有资金剩余金额全部给 自有资金,第二轮都为0 @@ -215,9 +215,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService //判断算分 if (subtract.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } profitDistribution.setRoundOwnFunds(rightOwnFunds); @@ -231,10 +231,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService //算分 共五分,可用资金1分,其他共4分,错一个不得分 if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); - performanceScoreMapper.updateByPrimaryKey(performanceScore); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } else if (type == 2) { //2:自有资金/优先级LP/劣后级LP if (profitDistribution.getUserRemainingEarningsSubordinatedLp() == null || profitDistribution.getUserRoundSubordinatedLp() == null) { @@ -260,9 +259,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (BigDecimal.ZERO.compareTo(userRoundOwnFunds) == 0 && rightAvailableFunds.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRoundSubordinatedLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsSubordinatedLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } profitDistribution.setRoundPreferredLp(rightFundraisingAmount); //下面的情况优先级LP都足够 @@ -274,9 +273,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0 && subtract.compareTo(userRoundSubordinatedLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsSubordinatedLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } //分配完优劣LP后剩余的钱 @@ -290,8 +289,8 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0 && subordinatedLp.compareTo(userRoundSubordinatedLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsSubordinatedLp) == 0) { performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); + performanceScore.setProfitDistributionTime(new Date()); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } // 第一轮归还劣后级LP本金 @@ -316,11 +315,10 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0 && userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 && userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } } - performanceScore.setProfitDistributionTime(new Date()); - performanceScoreMapper.updateByPrimaryKey(performanceScore); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } else if (type == 3) { //3:银行借款/自有资金/优先级LP if (profitDistribution.getUserRoundBankLoan() == null) { @@ -346,9 +344,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (BigDecimal.ZERO.compareTo(userRoundOwnFunds) == 0 && rightAvailableFunds.compareTo(userRoundBankLoan) == 0 && BigDecimal.ZERO.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } profitDistribution.setRoundBankLoan(rightBankLoan); //下面的情况优先级银行贷款都足够 @@ -360,9 +358,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (BigDecimal.ZERO.compareTo(userRoundOwnFunds) == 0 && rightBankLoan.compareTo(userRoundBankLoan) == 0 && subtractBankLoan.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } //分配完优先级LP后剩余的钱给自有资金 @@ -375,9 +373,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (subtractRoundOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightBankLoan.compareTo(userRoundBankLoan) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } profitDistribution.setRoundPreferredLp(rightFundraisingAmount); @@ -392,10 +390,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0 && rightBankLoan.compareTo(userRoundBankLoan) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); - performanceScoreMapper.updateByPrimaryKey(performanceScore); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } else { //4:银行借款/优先级LP/劣后级LP/自有资金 if (profitDistribution.getUserRemainingEarningsSubordinatedLp() == null || profitDistribution.getUserRoundSubordinatedLp() == null) { @@ -428,9 +425,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService BigDecimal.ZERO.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsSubordinatedLp) == 0 && BigDecimal.ZERO.compareTo(userRoundSubordinatedLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } profitDistribution.setRoundBankLoan(rightBankLoan); //下面的情况优先级银行贷款都足够 @@ -443,9 +440,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService subtractBankLoan.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRoundSubordinatedLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsSubordinatedLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } //分配完优先级LP后剩余的钱给劣后级LP @@ -458,9 +455,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService if (subtractSubordinatedLp.compareTo(userRoundOwnFunds) == 0 && rightBankLoan.compareTo(userRoundBankLoan) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } @@ -475,16 +472,17 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService subordinatedLp.compareTo(userRoundSubordinatedLp) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingOwnFunds) == 0 && subordinatedLp.compareTo(userRoundSubordinatedLp) == 0 && BigDecimal.ZERO.compareTo(userRemainingEarningsPreferredLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } // 第一轮归还劣后级LP本金和银行利息 profitDistribution.setRoundSubordinatedLp(subordinatedLp); + profitDistribution.setRoundOwnFunds(rightOwnFunds); profitDistribution.setRoundBankLoan(rightBankLoan); - residualIncome = residualIncome.subtract(subordinatedLp).subtract(rightBankLoan); //剩余收益 + residualIncome = residualIncome.subtract(subordinatedLp).subtract(rightBankLoan).subtract(rightOwnFunds); //剩余收益 //2.剩余收益分配比例为,自有资金25%,优先级LP 30%,劣后级LP 45% BigDecimal twoRightOwnFunds = residualIncome.multiply(BigDecimal.valueOf(0.25)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金 BigDecimal twoRightFundraisingAmount = residualIncome.multiply(BigDecimal.valueOf(0.3)).setScale(2, RoundingMode.HALF_UP);//剩余自有资金 @@ -497,10 +495,9 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService twoRightOwnFunds.compareTo(userRemainingOwnFunds) == 0 && twoRightFundraisingAmount.compareTo(userRemainingEarningsPreferredLp) == 0 && rightBankLoan.compareTo(userRoundBankLoan) == 0 && userRoundSubordinatedLp.compareTo(subordinatedLp) == 0 && userRemainingEarningsSubordinatedLp.compareTo(twoRightSubordinatedLp) == 0) { + performanceScore.setProfitDistributionTime(new Date()); performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId); } - performanceScore.setProfitDistributionTime(new Date()); - performanceScoreMapper.updateByPrimaryKey(performanceScore); return new ResultEntity<>(HttpStatus.OK, "分配完成!"); } } diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/tea/ClassScoreServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/tea/ClassScoreServiceImpl.java index 8b6d979..7885175 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/tea/ClassScoreServiceImpl.java +++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/tea/ClassScoreServiceImpl.java @@ -87,6 +87,7 @@ public class ClassScoreServiceImpl implements ClassScoreService { public TeaClassScoreDto getClassScoreCount(String schoolId, String classId, Date time) { TeaClassScoreExample teaClassScoreExample = new TeaClassScoreExample(); TeaClassScoreExample.Criteria criteria = teaClassScoreExample.createCriteria(); + Date startTime = null; //班级框为空 统计学校下的所有数据返回 if (classId == null && schoolId != null) { criteria.andSchoolIdEqualTo(schoolId).andStartTimeEqualTo(time); @@ -122,15 +123,19 @@ public class ClassScoreServiceImpl implements ClassScoreService { } //所有班级平均分累加 avgScoreBySchoolId = avgScoreBySchoolId.add(teaClassScore.getClassAverageScore()).setScale(2, RoundingMode.HALF_UP); + startTime = teaClassScore.getStartTime(); } TeaClassScoreDto teaClassScoreDto = new TeaClassScoreDto(); teaClassScoreDto.setSchoolExcellentCount(schoolExcellentCount); teaClassScoreDto.setSchoolGoodCount(schoolGoodCount); teaClassScoreDto.setSchoolGeneralCount(schoolGeneralCount); teaClassScoreDto.setSchoolFailCount(schoolFailCount); + teaClassScoreDto.setSchoolMaxScore(maxScoreBySchoolId); + teaClassScoreDto.setSchoolMinScore(minScoreBySchoolId); + teaClassScoreDto.setStartTime(startTime); if (teaClassScores.size() > 0) { BigDecimal finalAVGScore = avgScoreBySchoolId.divide(BigDecimal.valueOf(teaClassScores.size()), 2, RoundingMode.HALF_UP); - teaClassScoreDto.setClassAverageScore(finalAVGScore); + teaClassScoreDto.setSchoolAverageScore(finalAVGScore); } return teaClassScoreDto; } else { //选中某个班级返回 @@ -208,9 +213,9 @@ public class ClassScoreServiceImpl implements ClassScoreService { * @Date 2023/11/27 */ @Override - public void importExcel(HttpServletResponse response, String schoolId) { + public void importExcel(HttpServletResponse response, String classId) { UserExample userTableExample = new UserExample(); - userTableExample.createCriteria().andSchoolIdEqualTo(schoolId).andRoleIdEqualTo(4); + userTableExample.createCriteria().andClassIdEqualTo(classId).andRoleIdEqualTo(4); List userTables = userMapper.selectByExample(userTableExample); List userDtoList = new ArrayList<>(); for (User userTable : userTables) { @@ -219,10 +224,10 @@ public class ClassScoreServiceImpl implements ClassScoreService { Flow flow = flowMapper.selectByPrimaryKey(userTable.getUserid()); String flowId = flow.getFlowId(); TrainingReportExample trainingReportExample = new TrainingReportExample(); - trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andSchoolIdEqualTo(schoolId); + trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG); List trainingReports = reportMapper.selectByExample(trainingReportExample); PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample(); - performanceScoreExample.createCriteria().andFlowIdEqualTo(flowId).andSchoolIdEqualTo(schoolId); + performanceScoreExample.createCriteria().andFlowIdEqualTo(flowId).andClassIdEqualTo(classId); List performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample); if (performanceScores.isEmpty()) { continue; @@ -500,7 +505,11 @@ public class ClassScoreServiceImpl implements ClassScoreService { performanceTrainingScoreDto.setPracticalCognitionScore(Optional.ofNullable(performanceScore.getPracticalCognitionScore()).orElse(BigDecimal.ZERO)); performanceTrainingScoreDto.setKnowledgeAssessmentScore(Optional.ofNullable(performanceScore.getKnowledgeAssessmentScore()).orElse(BigDecimal.ZERO)); performanceTrainingScoreDto.setFundraisingScore(Optional.ofNullable(performanceScore.getFundraisingScore()).orElse(BigDecimal.ZERO)); - performanceTrainingScoreDto.setProjectSearchScore(Optional.ofNullable(performanceScore.getProjectSearchScore()).map(score -> score.add(Optional.ofNullable(performanceScore.getProjectSearchReportScore()).orElse(BigDecimal.ZERO))).orElse(BigDecimal.ZERO)); + performanceTrainingScoreDto.setProjectSearchScore( + (performanceScore.getProjectSearchScore() != null ? performanceScore.getProjectSearchScore() : BigDecimal.ZERO).add( + (performanceScore.getProjectSearchReportScore() != null ? performanceScore.getProjectSearchReportScore() : BigDecimal.ZERO) + ) + ); performanceTrainingScoreDto.setProjectDueDiligenceScore( Optional.ofNullable(performanceScore.getProjectDueDiligenceScore()).map(score -> score.add(Optional.ofNullable(performanceScore.getProjectDueDiligenceFinanceReportScore()).orElse(BigDecimal.ZERO)) diff --git a/src/main/java/com/sztzjy/fund_investment/service/tea/ClassScoreService.java b/src/main/java/com/sztzjy/fund_investment/service/tea/ClassScoreService.java index 4686e10..f9928dc 100644 --- a/src/main/java/com/sztzjy/fund_investment/service/tea/ClassScoreService.java +++ b/src/main/java/com/sztzjy/fund_investment/service/tea/ClassScoreService.java @@ -23,7 +23,7 @@ public interface ClassScoreService { PageInfo getStudentScoreDetails(Integer index, Integer size, String schoolId, String classId, String studentIdOrName); - void importExcel(HttpServletResponse response, String schoolId); + void importExcel(HttpServletResponse response, String classId); ResultEntity autoScore(String schoolId); diff --git a/src/main/java/com/sztzjy/fund_investment/task/Task.java b/src/main/java/com/sztzjy/fund_investment/task/Task.java index 5f32e6f..10e1431 100644 --- a/src/main/java/com/sztzjy/fund_investment/task/Task.java +++ b/src/main/java/com/sztzjy/fund_investment/task/Task.java @@ -38,7 +38,7 @@ public class Task { // 查到单个班级下所有的已经在投资报告页面提交过的学生的总成绩 // 算平均值,存表 //查出所有数据 - List classIdList = performanceScoreMapper.selectClassId(); + List classIdList = performanceScoreMapper.selectClassId(); for (String classId : classIdList) { BigDecimal avgScore = BigDecimal.ZERO; BigDecimal count = BigDecimal.ZERO; @@ -53,12 +53,12 @@ public class Task { gradeCounts.put("fail", 0); BigDecimal classMaxScore = BigDecimal.ZERO; // 最高分,默认为0 BigDecimal classMinScore = null; // 最低分,默认为null - String schoolId =""; + String schoolId = ""; for (PerformanceScore score : performanceScores2) { //第一个比较对象 BigDecimal totalScore = score.getTotalScore(); - if (totalScore==null){ - totalScore=BigDecimal.ZERO; + if (totalScore == null) { + totalScore = BigDecimal.ZERO; } schoolId = score.getSchoolId(); //没提交报告的 算0分跳过 @@ -105,14 +105,14 @@ public class Task { teaClassScore.setGeneralCount(gradeCounts.get("general")); teaClassScore.setFailCount(gradeCounts.get("fail")); teaClassScore.setClassId(classId); - UserExample userTableExample =new UserExample(); + UserExample userTableExample = new UserExample(); userTableExample.createCriteria().andSchoolIdEqualTo(schoolId).andClassIdEqualTo(classId).andRoleIdEqualTo(4); List userTables = userMapper.selectByExample(userTableExample); User userTable = userTables.get(0); teaClassScore.setClassName(userTable.getClassName()); - if (count.compareTo(BigDecimal.ZERO)==0){ + if (count.compareTo(BigDecimal.ZERO) == 0) { teaClassScore.setClassAverageScore(BigDecimal.ZERO); - }else { + } else { BigDecimal divideScore = avgScore.divide(count, 2, RoundingMode.HALF_UP); teaClassScore.setClassAverageScore(divideScore); }