From 4ec9286a22c5d9794b79f98c239befd0eacf1f8f Mon Sep 17 00:00:00 2001
From: xiaoCJ <406612557@qq.com>
Date: Mon, 18 Mar 2024 18:07:39 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9IPO=E5=BE=97=E5=88=86?=
 =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=92=8C=E6=94=B6=E7=9B=8A=E5=88=86=E9=85=8D?=
 =?UTF-8?q?=E5=BE=97=E5=88=86=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../service/PerformanceScoreService.java      |  1 +
 .../PerformanceScoreServiceImpl.java          | 13 +++++++
 .../ProfitDistributionServiceImpl.java        |  2 +-
 .../service/serviceImpl/TopicServiceImpl.java | 36 +++++++++----------
 4 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/sztzjy/fund_investment/service/PerformanceScoreService.java b/src/main/java/com/sztzjy/fund_investment/service/PerformanceScoreService.java
index d4efca0..128609c 100644
--- a/src/main/java/com/sztzjy/fund_investment/service/PerformanceScoreService.java
+++ b/src/main/java/com/sztzjy/fund_investment/service/PerformanceScoreService.java
@@ -11,4 +11,5 @@ public interface PerformanceScoreService {
     void calculateScoreByModule2(String methodName, Integer score, String flowId);
     PerformanceScore getByFlowId(String flowId);
     void updateScore(String methodName, Integer score, String flowId);
+    void ipoUpdateScore(String methodName, Integer score, String flowId);
 }
diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/PerformanceScoreServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/PerformanceScoreServiceImpl.java
index a55da1e..cad9a4f 100644
--- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/PerformanceScoreServiceImpl.java
+++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/PerformanceScoreServiceImpl.java
@@ -57,6 +57,19 @@ public class PerformanceScoreServiceImpl implements PerformanceScoreService {
         performanceScoreMapper.updateByPrimaryKey(performanceScore);
     }
 
+    @Override //ipo接口算分
+    public void ipoUpdateScore(String methodName, Integer score, String flowId) {
+        PerformanceScore performanceScore = getByFlowId(flowId);
+        BigDecimal oldScore = (BigDecimal) performanceScore.get(methodName);
+        if (oldScore==null){
+            oldScore = BigDecimal.ZERO;
+        }
+        performanceScore.set(methodName, BigDecimal.valueOf(score).add(oldScore));
+        BigDecimal add = performanceScore.getTotalScore().add(BigDecimal.valueOf(score));
+        performanceScore.setTotalScore(add);
+        performanceScoreMapper.updateByPrimaryKey(performanceScore);
+    }
+
     @Override     //                          实体类字段名          分数           流程ID
     public void calculateScoreByModule2(String methodName, Integer score, String flowId) {
         PerformanceScore performanceScore = getByFlowId(flowId);
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 fdc501e..e598591 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
@@ -278,7 +278,7 @@ public class ProfitDistributionServiceImpl implements ProfitDistributionService
                 profitDistribution.setRoundSubordinatedLp(subtract);
                 profitDistributionMapper.insert(profitDistribution);
                 //判断算分
-                if (rightOwnFunds.compareTo(userRoundOwnFunds) == 0 && rightFundraisingAmount.compareTo(userRoundPreferredLp) == 0 &&
+                if (BigDecimal.ZERO.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) {
                     performanceScoreService.calculateScoreByModule("profitDistributionScore", 4, flowId);
diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java
index 2a0d568..35abd80 100644
--- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java
+++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/TopicServiceImpl.java
@@ -154,8 +154,6 @@ public class TopicServiceImpl implements TopicService {
             return new ResultEntity<List<String>>(HttpStatus.BAD_REQUEST, "请勿重复提交!");
         }
         int score = 0;
-        int ipoListedSectorScore = 0; //上市版块得分
-        int ipoListedConditionScore = 0; // 上市条件得分
         String module = "";
         for (TopicsWithBLOBs topic : topics) {
             String userAnswer = topic.getUserAnswer();
@@ -190,20 +188,32 @@ public class TopicServiceImpl implements TopicService {
                     // 答案正确
                     score = score + 1; // 设置得分为1或其他适当的值
                     if (module.equals(Constant.IPOTJ)) {
-                        ipoListedConditionScore = ipoListedConditionScore + 1;
+                        performanceScoreService.ipoUpdateScore("ipoListedConditionScore", 1, flowId);
+                        PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
+                        byFlowId.setIpoTime(new Date());
+                        performanceScoreMapper.updateByPrimaryKey(byFlowId);
                     }
                     if (module.equals(Constant.IPOBK)) {
-                        ipoListedSectorScore = ipoListedConditionScore + 1;
+                        performanceScoreService.ipoUpdateScore("ipoListedSectorScore", 1, flowId);
+                        PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
+                        byFlowId.setIpoTime(new Date());
+                        performanceScoreMapper.updateByPrimaryKey(byFlowId);
                     }
                 }
             } else {
                 if (userAnswer.equals(rightAnswer)) {
                     score = score + 1;
                     if (module.equals(Constant.IPOTJ)) {
-                        ipoListedConditionScore = ipoListedConditionScore + 1;
+                        performanceScoreService.ipoUpdateScore("ipoListedConditionScore", 1, flowId);
+                        PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
+                        byFlowId.setIpoTime(new Date());
+                        performanceScoreMapper.updateByPrimaryKey(byFlowId);
                     }
                     if (module.equals(Constant.IPOBK)) {
-                        ipoListedSectorScore = ipoListedSectorScore + 1;
+                        performanceScoreService.ipoUpdateScore("ipoListedSectorScore", 1, flowId);
+                        PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
+                        byFlowId.setIpoTime(new Date());
+                        performanceScoreMapper.updateByPrimaryKey(byFlowId);
                     }
                 }
             }
@@ -225,6 +235,7 @@ public class TopicServiceImpl implements TopicService {
             topicRecord.setModule(module);
             topicRecord.setTopicType(topicType);
             topicRecordMapper.insert(topicRecord);
+
         }
 
         if (score >= 5) {
@@ -244,18 +255,7 @@ public class TopicServiceImpl implements TopicService {
         if (module.equals(Constant.XMGZTK)) {
             performanceScoreService.calculateScoreByModule("projectValuationScore", score, flowId);
         }
-        if (module.equals(Constant.IPOBK)) {
-            performanceScoreService.calculateScoreByModule("ipoListedSectorScore", ipoListedSectorScore, flowId);
-            PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
-            byFlowId.setIpoTime(new Date());
-            performanceScoreMapper.updateByPrimaryKey(byFlowId);
-        }
-        if (module.equals(Constant.IPOTJ)) {
-            performanceScoreService.calculateScoreByModule("ipoListedConditionScore", ipoListedConditionScore, flowId);
-            PerformanceScore byFlowId = performanceScoreService.getByFlowId(flowId);
-            byFlowId.setIpoTime(new Date());
-            performanceScoreMapper.updateByPrimaryKey(byFlowId);
-        }
+
         return new ResultEntity<>(HttpStatus.OK, "提交成功!");
     }
 

From 08cc5079cf31f780f088dc2754b0b7b58561314a Mon Sep 17 00:00:00 2001
From: xiaoCJ <406612557@qq.com>
Date: Mon, 18 Mar 2024 19:53:00 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9IPO=E5=BE=97=E5=88=86?=
 =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=92=8C=E6=94=B6=E7=9B=8A=E5=88=86=E9=85=8D?=
 =?UTF-8?q?=E5=BE=97=E5=88=86=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../controller/tea/ClassScoreController.java  | 56 ++++++++++++++-----
 1 file changed, 42 insertions(+), 14 deletions(-)

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 b462f9d..d225610 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
@@ -141,30 +141,58 @@ public class ClassScoreController {
     }
 
 
+//    @AnonymousAccess
+//    @PostMapping("/updateExperienceScore")
+//    @ApiOperation("成绩详情/实训心得/修改心得或报告分数")
+//    public void updateScoreByFlowId(@RequestParam String reportId,
+//                                    @RequestParam Integer score,
+//                                    @ApiParam("0为心得,1为报告") @RequestParam Integer type) {
+//        TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
+//
+//        if (type == 0) {
+//            trainingReport.setExperienceScore(BigDecimal.valueOf(score));
+//            performanceScoreService.updateScore("experienceScore", score, trainingReport.getFlowId());
+//        }
+//        if (type == 1) {
+//            trainingReport.setReportScore(BigDecimal.valueOf(score));
+//            performanceScoreService.updateScore("investmentReportScore", score, trainingReport.getFlowId());
+//        }
+//        trainingReportMapper.updateByPrimaryKey(trainingReport);
+//    }
+
+
     @AnonymousAccess
     @PostMapping("/updateExperienceScore")
     @ApiOperation("成绩详情/实训心得/修改心得或报告分数")
-    public void updateScoreByFlowId(@RequestParam String reportId,
-                                    @RequestParam Integer score,
-                                    @ApiParam("0为心得,1为报告") @RequestParam Integer type) {
-        TrainingReport trainingReport = trainingReportMapper.selectByPrimaryKey(reportId);
-
-        if (type == 0) {
-            trainingReport.setExperienceScore(BigDecimal.valueOf(score));
-            performanceScoreService.updateScore("experienceScore", score, trainingReport.getFlowId());
+    public void updateExperienceScore(@RequestParam String flowId,
+                                      @ApiParam("传Map的json字符串,例:{\"心得\": 分数,\"报告\": 分数}") @RequestParam String json) {
+        Map<String, Integer> map;
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            map = objectMapper.readValue(json, new TypeReference<Map<String, Integer>>() {
+            });
+        } catch (Exception e) {
+            throw new ClassCastException("类型转换错误");
         }
-        if (type == 1) {
-            trainingReport.setReportScore(BigDecimal.valueOf(score));
-            performanceScoreService.updateScore("investmentReportScore", score, trainingReport.getFlowId());
+        for (Map.Entry<String, Integer> entry : map.entrySet()) {
+            String key = entry.getKey();
+            Integer score = entry.getValue();
+            if (key.equals("心得")) {
+                performanceScoreService.updateScore("experienceScore", score, flowId);
+            }
+            if (key.equals("报告")) {
+                performanceScoreService.updateScore("investmentReportScore", score, flowId);
+            }
         }
-        trainingReportMapper.updateByPrimaryKey(trainingReport);
     }
 
+
+
     @AnonymousAccess
     @GetMapping("/getClassNameBySchoolId")
     @ApiOperation("成绩管理&互动答疑/班级下拉框")
-    public ResultEntity<List<Map<String,String>>> getClassNameBySchoolId(@RequestParam String schoolId) {
-        List<Map<String,String>> nameAndId = userMapper.selectClassNameBySchoolId(schoolId);
+    public ResultEntity<List<Map<String, String>>> getClassNameBySchoolId(@RequestParam String schoolId) {
+        List<Map<String, String>> nameAndId = userMapper.selectClassNameBySchoolId(schoolId);
         return new ResultEntity<>(nameAndId);
     }
 

From 91ebdb6be712181c94e5156d8447a6324121f23e Mon Sep 17 00:00:00 2001
From: xiaoCJ <406612557@qq.com>
Date: Tue, 19 Mar 2024 18:15:57 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?=
 =?UTF-8?q?=E5=BE=97=E5=88=86=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../serviceImpl/tea/ClassScoreServiceImpl.java | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

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 5450b12..2a4455e 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
@@ -308,11 +308,11 @@ public class ClassScoreServiceImpl implements ClassScoreService {
                 } else {
                     projectValuationAbsolute = foundProject.getProjectValuationAbsolute();//绝对估值结论得分
                 }
-                foundProjectConclusion = foundProjectConclusion.replaceAll("[^a-zA-Z0-9]", "");
-                serviceDueDiligence = serviceDueDiligence.replaceAll("[^a-zA-Z0-9]", "");
-                financialDueDiligence = financialDueDiligence.replaceAll("[^a-zA-Z0-9]", "");
-                projectValuationRelative = projectValuationRelative.replaceAll("[^a-zA-Z0-9]", "");
-                projectValuationAbsolute = projectValuationAbsolute.replaceAll("[^a-zA-Z0-9]", "");
+                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);
 
@@ -409,6 +409,14 @@ public class ClassScoreServiceImpl implements ClassScoreService {
         return new ResultEntity<>(HttpStatus.NOT_FOUND);
     }
 
+    public static void main(String[] args) {
+        String projectValuationAbsolute = "12312,./,/@#$好好好好好好好好好好好好好好好好AFGGGS好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好";
+        projectValuationAbsolute = projectValuationAbsolute.replaceAll("[^\\u4E00-\\u9FA5]", "");
+        System.out.println(projectValuationAbsolute);
+        int length = projectValuationAbsolute.length();
+        System.out.println(length);
+    }
+
     /* 用户成绩详情展示
      * @author xcj
      * @Date 2023/11/29

From 2e8178720717bd7d3865ed2493f9cab324f961cf Mon Sep 17 00:00:00 2001
From: xiaoCJ <406612557@qq.com>
Date: Wed, 27 Mar 2024 14:06:49 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E5=8A=A1?=
 =?UTF-8?q?=E8=AE=A4=E7=9F=A5=E5=BE=97=E5=88=86=E5=92=8C=E6=99=BA=E8=83=BD?=
 =?UTF-8?q?=E8=AF=84=E5=88=86=E8=A7=84=E5=88=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../fund_investment/controller/TopicController.java |  1 +
 .../serviceImpl/tea/ClassScoreServiceImpl.java      | 13 ++++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/sztzjy/fund_investment/controller/TopicController.java b/src/main/java/com/sztzjy/fund_investment/controller/TopicController.java
index dfb0618..3d7c3c4 100644
--- a/src/main/java/com/sztzjy/fund_investment/controller/TopicController.java
+++ b/src/main/java/com/sztzjy/fund_investment/controller/TopicController.java
@@ -155,6 +155,7 @@ public class TopicController {
         if (time >= 120) {
             score = BigDecimal.valueOf(5);
             performanceScore.setPracticalCognitionScore(score);
+            performanceScore.setTotalScore(score);
         } else {
             performanceScore.setPracticalCognitionScore(BigDecimal.ZERO);
         }
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 2a4455e..c7b1dfa 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
@@ -365,22 +365,20 @@ public class ClassScoreServiceImpl implements ClassScoreService {
             }
             for (String flowIdByList : list) {
                 TrainingReportExample trainingReportExample = new TrainingReportExample();
-                trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowIdByList);
+                trainingReportExample.createCriteria().andSchoolIdEqualTo(schoolId).andFlowIdEqualTo(flowIdByList).andStepEqualTo("投资报告");
                 PerformanceScore scoreByFlowId = performanceScoreService.getByFlowId(flowIdByList);
-                List<TrainingReport> trainingReports = trainingReportMapper.selectByExample(trainingReportExample);
+                List<TrainingReport> trainingReports = trainingReportMapper.selectByExampleWithBLOBs(trainingReportExample);
                 if (trainingReports.isEmpty()) {
                     continue;
                 }
-                String experience = "";
                 TrainingReport trainingReport = trainingReports.get(0);
-                if (trainingReport.getExperience() == null) {
+                if (scoreByFlowId.getExperienceScore() == null && StringUtils.isBlank(trainingReport.getExperience())) {
                     performanceScoreService.updateScore("experienceScore", 0, flowIdByList);
                     trainingReport.setExperienceScore(BigDecimal.ZERO);
-                } else {
-                    experience = trainingReport.getExperience();
                 }
                 //实训心得
-                if (scoreByFlowId.getExperienceScore() == null) {
+                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);
@@ -417,6 +415,7 @@ public class ClassScoreServiceImpl implements ClassScoreService {
         System.out.println(length);
     }
 
+
     /* 用户成绩详情展示
      * @author xcj
      * @Date 2023/11/29

From ac2c8228c50657b84c52f57e84fd299c6a5d952f Mon Sep 17 00:00:00 2001
From: whb <17803890193@163.com>
Date: Wed, 27 Mar 2024 14:07:45 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=A2=E4=BB=B7?=
 =?UTF-8?q?=E5=8F=91=E8=A1=8C=E5=AE=8C=E6=88=90=E6=97=B6=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../serviceImpl/ContractInvestmentServiceImpl.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java
index c08cf8f..100bb65 100644
--- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java
+++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/ContractInvestmentServiceImpl.java
@@ -64,6 +64,8 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
     @Autowired
     private PerformanceScoreService performanceScoreService;
 
+
+
     /**
      * 上传尽调报告
      */
@@ -513,8 +515,20 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
         else {
             issuanceParameterInput.setId(IdUtil.fastSimpleUUID());
 
+
             issuanceParameterInputMapper.insertSelective(issuanceParameterInput);
             performanceScoreService.calculateScoreByModule("pricingIssuanceEnteringScore", 2, issuanceParameterInput.getFlowId());
+            //添加询价发行完成时间
+            PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample();
+            performanceScoreExample.createCriteria().andFlowIdEqualTo(issuanceParameterInput.getFlowId());
+            List<PerformanceScore> performanceScoreList = performanceScoreMapper.selectByExample(performanceScoreExample);
+            if (!performanceScoreList.isEmpty()){
+
+                performanceScoreList.get(0).setPricingIssuanceTime(new Date());
+
+                performanceScoreMapper.updateByPrimaryKey(performanceScoreList.get(0));
+            }
+
             return new ResultEntity<>(HttpStatus.OK);
         }
 

From 7b22b9cf8a712fe6bc2d4f8c589bfd6c8742f125 Mon Sep 17 00:00:00 2001
From: xiaoCJ <406612557@qq.com>
Date: Tue, 16 Apr 2024 10:01:59 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E5=8A=A1?=
 =?UTF-8?q?=E8=AE=A4=E7=9F=A5=E5=BE=97=E5=88=86=E5=92=8C=E6=99=BA=E8=83=BD?=
 =?UTF-8?q?=E8=AF=84=E5=88=86=E8=A7=84=E5=88=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../fund_investment/mapper/UserMapper.java    |   5 +
 .../InquiryIssuanceServiceImpl.java           |   2 +-
 .../tea/ClassScoreServiceImpl.java            | 116 +++++++++++-------
 src/main/resources/mappers/UserMapper.xml     |  41 +++++++
 4 files changed, 116 insertions(+), 48 deletions(-)

diff --git a/src/main/java/com/sztzjy/fund_investment/mapper/UserMapper.java b/src/main/java/com/sztzjy/fund_investment/mapper/UserMapper.java
index bcf943b..47a399a 100644
--- a/src/main/java/com/sztzjy/fund_investment/mapper/UserMapper.java
+++ b/src/main/java/com/sztzjy/fund_investment/mapper/UserMapper.java
@@ -1,10 +1,12 @@
 package com.sztzjy.fund_investment.mapper;
 
+import com.github.pagehelper.PageInfo;
 import com.sztzjy.fund_investment.entity.User;
 import com.sztzjy.fund_investment.entity.UserExample;
 import java.util.List;
 import java.util.Map;
 
+import com.sztzjy.fund_investment.entity.dto.UserDto;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -36,4 +38,7 @@ public interface UserMapper {
 
     @Select("select distinct(class_id),class_name from wx_user where school_id = #{schoolId}")
     List<Map<String,String>> selectClassNameBySchoolId(@Param("schoolId") String schoolId);
+
+    List<UserDto>getStudentScoreDetails(@Param("schoolId") String schoolId, @Param("classId")String classId, @Param("studentIdOrName")String studentIdOrName);
+
 }
\ No newline at end of file
diff --git a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InquiryIssuanceServiceImpl.java b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InquiryIssuanceServiceImpl.java
index 73aec06..d8efac5 100644
--- a/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InquiryIssuanceServiceImpl.java
+++ b/src/main/java/com/sztzjy/fund_investment/service/serviceImpl/InquiryIssuanceServiceImpl.java
@@ -344,7 +344,7 @@ public class InquiryIssuanceServiceImpl implements InquiryIssuanceService {
             inquiryParticipation1.setSecuritiesAccount(inquiryParticipation.getSecuritiesAccount());
             inquiryParticipation1.setCustodianSeat(inquiryParticipation.getCustodianSeat());
             inquiryParticipation1.setVoluntaryLockup(inquiryParticipation.getVoluntaryLockup());
-            inquiryParticipation.setRemark(inquiryParticipation.getRemark());
+            inquiryParticipation1.setRemark(inquiryParticipation.getRemark());
             inquiryParticipation1.setDeclarationPrice(inquiryParticipation.getDeclarationPrice());
             inquiryParticipation1.setIntendedSubscriptionQuantity(inquiryParticipation.getIntendedSubscriptionQuantity());
             inquiryParticipation1.setStatus("1");
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 c7b1dfa..1dc1f48 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
@@ -1,6 +1,7 @@
 package com.sztzjy.fund_investment.service.serviceImpl.tea;
 
 import cn.hutool.core.util.IdUtil;
+import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sztzjy.fund_investment.config.Constant;
 import com.sztzjy.fund_investment.entity.*;
@@ -23,6 +24,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * @Author xcj
@@ -152,62 +155,81 @@ public class ClassScoreServiceImpl implements ClassScoreService {
     }
 
 
+//    /* 成绩详情页面
+//     * @author xcj
+//     * @Date 2023/11/27
+//     */
+//    @Override
+//    public PageInfo<UserDto> getStudentScoreDetails(Integer index, Integer size, String schoolId, String classId, String studentIdOrName) {
+//        UserExample userTableExample = new UserExample();
+//        UserExample.Criteria criteria = userTableExample.createCriteria();
+//        UserExample.Criteria orCriteria = userTableExample.createCriteria();
+//        criteria.andRoleIdEqualTo(4);
+//        if (StringUtils.isNotBlank(classId)) {
+//            criteria.andClassIdEqualTo(classId);
+//        } else {
+//            criteria.andSchoolIdEqualTo(schoolId);
+//        }
+//        if (StringUtils.isNotBlank(studentIdOrName)) {
+//            criteria.andNameEqualTo(studentIdOrName);
+//            orCriteria.andStudentIdEqualTo(studentIdOrName);
+//        }
+//        userTableExample.or(orCriteria);
+//        List<User> userTables = userMapper.selectByExample(userTableExample);
+//
+//        List<UserDto> userDtoList = new ArrayList<>();
+//        for (User userTable : userTables) {
+//            UserDto userDto = new UserDto();
+//            BeanUtils.copyProperties(userTable, userDto);
+//            Flow flow = flowMapper.selectByPrimaryKey(userTable.getUserid());
+//            String flowId = flow.getFlowId();
+//            TrainingReportExample trainingReportExample = new TrainingReportExample();
+//            trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG);
+//            List<TrainingReport> trainingReports = reportMapper.selectByExample(trainingReportExample);
+//            PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample();
+//            performanceScoreExample.createCriteria().andFlowIdEqualTo(flowId);
+//            List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
+//            if (!performanceScores.isEmpty()) {
+//                PerformanceScore performanceScore = performanceScores.get(0);
+//                if (trainingReports.isEmpty()) {
+//                    continue;
+//                }
+//                for (TrainingReport trainingReport : trainingReports) {
+//                    userDto.setReportId(trainingReport.getId());
+//                    userDto.setReportName(trainingReport.getReportName());
+//                }
+//                userDto.setFlowId(flowId);
+//                userDto.setScore(performanceScore.getTotalScore());
+//                userDto.setPerformanceScoreId(performanceScore.getId());
+//                userDtoList.add(userDto);
+//            }
+//        }
+//        if (userDtoList.size() <= 0) {
+//            return null;
+//        }
+//        userDtoList.sort(new StuUserDtoComparator()); //比较器按得分排序
+//        return PageUtil.pageHelper(userDtoList, index, size); //分页
+//    }
+
+
     /* 成绩详情页面
      * @author xcj
      * @Date 2023/11/27
      */
     @Override
     public PageInfo<UserDto> getStudentScoreDetails(Integer index, Integer size, String schoolId, String classId, String studentIdOrName) {
-        UserExample userTableExample = new UserExample();
-        UserExample.Criteria criteria = userTableExample.createCriteria();
-        UserExample.Criteria orCriteria = userTableExample.createCriteria();
-        criteria.andRoleIdEqualTo(4);
-        if (StringUtils.isNotBlank(classId)) {
-            criteria.andClassIdEqualTo(classId);
-        } else {
-            criteria.andSchoolIdEqualTo(schoolId);
-        }
-        if (StringUtils.isNotBlank(studentIdOrName)) {
-            criteria.andNameEqualTo(studentIdOrName);
-            orCriteria.andStudentIdEqualTo(studentIdOrName);
-        }
-        userTableExample.or(orCriteria);
-        List<User> userTables = userMapper.selectByExample(userTableExample);
-        List<UserDto> userDtoList = new ArrayList<>();
-        for (User userTable : userTables) {
-            UserDto userDto = new UserDto();
-            BeanUtils.copyProperties(userTable, userDto);
-            Flow flow = flowMapper.selectByPrimaryKey(userTable.getUserid());
-            String flowId = flow.getFlowId();
-            TrainingReportExample trainingReportExample = new TrainingReportExample();
-            trainingReportExample.createCriteria().andFlowIdEqualTo(flowId).andStepEqualTo(Constant.TZBG);
-            List<TrainingReport> trainingReports = reportMapper.selectByExample(trainingReportExample);
-            PerformanceScoreExample performanceScoreExample = new PerformanceScoreExample();
-            performanceScoreExample.createCriteria().andFlowIdEqualTo(flowId);
-            List<PerformanceScore> performanceScores = performanceScoreMapper.selectByExample(performanceScoreExample);
-            if (!performanceScores.isEmpty()) {
-                PerformanceScore performanceScore = performanceScores.get(0);
-                if (trainingReports.isEmpty()) {
-                    continue;
-                }
-                for (TrainingReport trainingReport : trainingReports) {
-                    userDto.setReportId(trainingReport.getId());
-                    userDto.setReportName(trainingReport.getReportName());
-                }
-                userDto.setFlowId(flowId);
-                userDto.setScore(performanceScore.getTotalScore());
-                userDto.setPerformanceScoreId(performanceScore.getId());
-                userDtoList.add(userDto);
-            }
-        }
-        if (userDtoList.size() <= 0) {
-            return null;
-        }
-        userDtoList.sort(new StuUserDtoComparator()); //比较器按得分排序
-        return PageUtil.pageHelper(userDtoList, index, size); //分页
+        PageHelper.startPage(index,size);
+        List<UserDto> studentScoreDetails = userMapper.getStudentScoreDetails(schoolId, classId, studentIdOrName);
+        PageInfo <UserDto>pageInfo =new PageInfo(studentScoreDetails);
+        return pageInfo;
     }
 
 
+
+
+
+
+
     /* 成绩详情导出功能
      * @author xcj
      * @Date 2023/11/27
diff --git a/src/main/resources/mappers/UserMapper.xml b/src/main/resources/mappers/UserMapper.xml
index 7132d3f..0a23aac 100644
--- a/src/main/resources/mappers/UserMapper.xml
+++ b/src/main/resources/mappers/UserMapper.xml
@@ -390,4 +390,45 @@
       login_type = #{loginType,jdbcType=INTEGER}
     where userid = #{userid,jdbcType=VARCHAR}
   </update>
+
+  <resultMap id="UserDtoMap" type="com.sztzjy.fund_investment.entity.dto.UserDto">
+    <id column="userid" jdbcType="VARCHAR" property="userid"/>
+    <result column="school_name" jdbcType="VARCHAR" property="schoolName"/>
+    <result column="class_name" jdbcType="VARCHAR" property="className"/>
+    <result column="name" jdbcType="VARCHAR" property="name"/>
+    <result column="student_id" jdbcType="VARCHAR" property="studentId"/>
+    <result column="class_id" jdbcType="VARCHAR" property="classId"/>
+    <result column="school_id" jdbcType="VARCHAR" property="schoolId"/>
+    <result column="report_name" jdbcType="VARCHAR" property="reportName"/>
+    <result column="total_score" jdbcType="DECIMAL" property="score"/>
+    <result column="flow_id" jdbcType="VARCHAR" property="flowId"/>
+    <result column="id" jdbcType="VARCHAR" property="performanceScoreId"/>
+    <result column="report_id" jdbcType="VARCHAR" property="reportId"/>
+  </resultMap>
+
+
+  <select id="getStudentScoreDetails" resultMap="UserDtoMap">
+    SELECT u.class_id,u.class_name,u.school_id,u.school_name,u.`name`,u.student_id,
+           u.userid,
+           tr.report_name,tr.id report_id,
+           ps.total_score,ps.id,
+           f.flow_id
+    FROM  wx_user u
+            JOIN flow f on u.userid = f.userid
+            LEFT JOIN training_report  tr ON tr.flow_id = f.flow_id AND tr.step = '投资报告'
+            LEFT JOIN performance_score	ps on ps.flow_id = f.flow_id
+    WHERE u.role_id = 4
+    <if test="schoolId != null">
+      AND u.school_id = #{schoolId}
+    </if>
+    <if test="classId != null">
+      AND u.class_id = #{classId}
+    </if>
+    <if test="studentIdOrName != null">
+      AND  u.name like '%${studentIdOrName}%'  OR  u.student_id like '%${studentIdOrName}%'
+    </if>
+    ORDER BY ps.total_score DESC
+  </select>
+
+
 </mapper>
\ No newline at end of file