diff --git a/src/main/java/com/sztzjy/linkCommerce/controller/stu/ScoreController.java b/src/main/java/com/sztzjy/linkCommerce/controller/stu/ScoreController.java index 5d640c5..953ed18 100644 --- a/src/main/java/com/sztzjy/linkCommerce/controller/stu/ScoreController.java +++ b/src/main/java/com/sztzjy/linkCommerce/controller/stu/ScoreController.java @@ -109,20 +109,21 @@ public class ScoreController { } } - //设置各模块总成绩到DTO - dto.setOneScore(oneScore); - dto.setTwoScore(twoScore); - dto.setThreeScore(threeScore); - dto.setFourScore(fourScore); - dto.setFiveScore(fiveScore); - - BigDecimal oneScoreWeight = oneScore.multiply(weight.getMarketResearchWeight()); - BigDecimal twoScoreWeight = twoScore.multiply(weight.getProductPlanningWeight()); - BigDecimal threeScoreWeight = twoScore.multiply(weight.getProductLaunchTestWeight()); - BigDecimal fourScoreWeight = twoScore.multiply(weight.getSupplyChannelWeight()); - BigDecimal fiveScoreWeight = twoScore.multiply(weight.getProductEvaluationWeight()); + BigDecimal oneScoreWeight = oneScore.multiply(weight.getMarketResearchWeight()).divide(BigDecimal.valueOf(6),2,BigDecimal.ROUND_HALF_UP); + BigDecimal twoScoreWeight = twoScore.multiply(weight.getProductPlanningWeight()).divide(BigDecimal.valueOf(4),2,BigDecimal.ROUND_HALF_UP); + BigDecimal threeScoreWeight = threeScore.multiply(weight.getProductLaunchTestWeight()).divide(BigDecimal.valueOf(4),2,BigDecimal.ROUND_HALF_UP); + BigDecimal fourScoreWeight = fourScore.multiply(weight.getSupplyChannelWeight()).divide(BigDecimal.valueOf(3),2,BigDecimal.ROUND_HALF_UP); + BigDecimal fiveScoreWeight = fiveScore.multiply(weight.getProductEvaluationWeight()).divide(BigDecimal.valueOf(8),2,BigDecimal.ROUND_HALF_UP); + //设置总分 dto.setTotalScore(oneScoreWeight.add(twoScoreWeight).add(threeScoreWeight).add(fourScoreWeight).add(fiveScoreWeight)); + //设置每个项目分数 + //设置各模块总成绩到DTO + dto.setOneScore(oneScoreWeight); + dto.setTwoScore(twoScoreWeight); + dto.setThreeScore(threeScoreWeight); + dto.setFourScore(fourScoreWeight); + dto.setFiveScore(fiveScoreWeight); StuRankExample stuRankExample = new StuRankExample(); stuRankExample.createCriteria().andUpdateTimeEqualTo(scoreRankService.getNowDate()).andUserIdEqualTo(userId); List stuRanks = stuRankMapper.selectByExample(stuRankExample); diff --git a/src/main/java/com/sztzjy/linkCommerce/controller/stu/StudyTimeAndCountController.java b/src/main/java/com/sztzjy/linkCommerce/controller/stu/StudyTimeAndCountController.java index 5fe0b10..cd50bea 100644 --- a/src/main/java/com/sztzjy/linkCommerce/controller/stu/StudyTimeAndCountController.java +++ b/src/main/java/com/sztzjy/linkCommerce/controller/stu/StudyTimeAndCountController.java @@ -88,7 +88,7 @@ public class StudyTimeAndCountController { } else { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "更新学习时间失败"); } - } +} @PostMapping("/selectStudyTime") @ApiOperation("查看学习时间") diff --git a/src/main/java/com/sztzjy/linkCommerce/service/impl/ScoreRankServiceImpl.java b/src/main/java/com/sztzjy/linkCommerce/service/impl/ScoreRankServiceImpl.java index 23115a2..941ecbb 100644 --- a/src/main/java/com/sztzjy/linkCommerce/service/impl/ScoreRankServiceImpl.java +++ b/src/main/java/com/sztzjy/linkCommerce/service/impl/ScoreRankServiceImpl.java @@ -100,11 +100,11 @@ public class ScoreRankServiceImpl implements ScoreRankService { fiveScore = fiveScore.add(score); } } - BigDecimal oneScoreWeight = oneScore.multiply(weight.getMarketResearchWeight()); - BigDecimal twoScoreWeight = twoScore.multiply(weight.getProductPlanningWeight()); - BigDecimal threeScoreWeight = twoScore.multiply(weight.getProductLaunchTestWeight()); - BigDecimal fourScoreWeight = twoScore.multiply(weight.getSupplyChannelWeight()); - BigDecimal fiveScoreWeight = twoScore.multiply(weight.getProductEvaluationWeight()); + BigDecimal oneScoreWeight = oneScore.multiply(weight.getMarketResearchWeight()).divide(BigDecimal.valueOf(6),2,BigDecimal.ROUND_HALF_UP); + BigDecimal twoScoreWeight = twoScore.multiply(weight.getProductPlanningWeight()).divide(BigDecimal.valueOf(4),2,BigDecimal.ROUND_HALF_UP); + BigDecimal threeScoreWeight = threeScore.multiply(weight.getProductLaunchTestWeight()).divide(BigDecimal.valueOf(4),2,BigDecimal.ROUND_HALF_UP); + BigDecimal fourScoreWeight = fourScore.multiply(weight.getSupplyChannelWeight()).divide(BigDecimal.valueOf(3),2,BigDecimal.ROUND_HALF_UP); + BigDecimal fiveScoreWeight = fiveScore.multiply(weight.getProductEvaluationWeight()).divide(BigDecimal.valueOf(8),2,BigDecimal.ROUND_HALF_UP); dto.setTotalScore(oneScoreWeight.add(twoScoreWeight).add(threeScoreWeight).add(fourScoreWeight).add(fiveScoreWeight)); scoreRank.setScore(dto.getTotalScore()); @@ -209,11 +209,11 @@ public class ScoreRankServiceImpl implements ScoreRankService { fiveScore = fiveScore.add(score); } } - BigDecimal oneScoreWeight = oneScore.multiply(weight.getMarketResearchWeight()); - BigDecimal twoScoreWeight = twoScore.multiply(weight.getProductPlanningWeight()); - BigDecimal threeScoreWeight = twoScore.multiply(weight.getProductLaunchTestWeight()); - BigDecimal fourScoreWeight = twoScore.multiply(weight.getSupplyChannelWeight()); - BigDecimal fiveScoreWeight = twoScore.multiply(weight.getProductEvaluationWeight()); + BigDecimal oneScoreWeight = oneScore.multiply(weight.getMarketResearchWeight()).divide(BigDecimal.valueOf(6),2,BigDecimal.ROUND_HALF_UP); + BigDecimal twoScoreWeight = twoScore.multiply(weight.getProductPlanningWeight()).divide(BigDecimal.valueOf(4),2,BigDecimal.ROUND_HALF_UP); + BigDecimal threeScoreWeight = threeScore.multiply(weight.getProductLaunchTestWeight()).divide(BigDecimal.valueOf(4),2,BigDecimal.ROUND_HALF_UP); + BigDecimal fourScoreWeight = fourScore.multiply(weight.getSupplyChannelWeight()).divide(BigDecimal.valueOf(3),2,BigDecimal.ROUND_HALF_UP); + BigDecimal fiveScoreWeight = fiveScore.multiply(weight.getProductEvaluationWeight()).divide(BigDecimal.valueOf(8),2,BigDecimal.ROUND_HALF_UP); dto.setTotalScore(oneScoreWeight.add(twoScoreWeight).add(threeScoreWeight).add(fourScoreWeight).add(fiveScoreWeight)); scoreRank.setScore(dto.getTotalScore()); scoreRank.setScqxwjWeight(weight.getMarketResearchWeight());