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] =?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>(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, "提交成功!"); }