From b8e88687474377b25b61dd88032d1d368df57843 Mon Sep 17 00:00:00 2001 From: pd <2776455882@qq.com> Date: Tue, 28 Jul 2020 11:10:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=9D=87=E5=88=86=E9=85=8D=E5=88=86?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Project_ManagementController.java | 4 +- .../com/yipin/liuwanr/helper/UserUtil.java | 67 +++++++++++-------- .../mapper/Project_ManagementMapper.java | 2 +- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/Project_ManagementController.java b/src/main/java/com/yipin/liuwanr/controller/Project_ManagementController.java index 8b46a12..14afad3 100644 --- a/src/main/java/com/yipin/liuwanr/controller/Project_ManagementController.java +++ b/src/main/java/com/yipin/liuwanr/controller/Project_ManagementController.java @@ -198,8 +198,8 @@ public class Project_ManagementController { @ApiOperation(value = "实验任务列表", notes = "实验任务列表") @GetMapping("/getByjudgmentPointsId") Response getByjudgmentPointsId(@ApiParam(name = "judgmentPointsIds", value = "判分点主键id", required = true) @RequestParam List judgmentPointsIds, - @ApiParam(name = "projectId", value = "项目主键ID", required = false) @RequestParam(required = false) Integer projectId, - @ApiParam(name = "userId", value = "用户主键ID", required = false) @RequestParam(required = false) Integer userId) { + @ApiParam(name = "projectId", value = "项目主键ID", required = false) @RequestParam(required = false) Integer projectId, + @ApiParam(name = "userId", value = "用户主键ID", required = false) @RequestParam(required = false) Integer userId) { Response resp = new Response(); HashMap ret = service.getByjudgmentPointsId(judgmentPointsIds, projectId, userId); int status = (int) ret.get("retcode"); diff --git a/src/main/java/com/yipin/liuwanr/helper/UserUtil.java b/src/main/java/com/yipin/liuwanr/helper/UserUtil.java index 8aeea8d..06292e2 100644 --- a/src/main/java/com/yipin/liuwanr/helper/UserUtil.java +++ b/src/main/java/com/yipin/liuwanr/helper/UserUtil.java @@ -5,34 +5,45 @@ import java.util.List; public class UserUtil { - /** - * 平均分配分值 - * @param number 判分点数量 - * @return - */ - public static List averageValue(Integer number) { - Integer score=100/number; - Integer lastScore=score+100%number; - List list=new ArrayList(); - for (int i = 0; i < number-1; i++) { - list.add(score); - } - list.add(lastScore); - return list; - } + /** + * 平均分配分值 + * + * @param number 判分点数量 + * @return + */ + public static List averageValue(Integer number) { + Integer score = 100 / number; + List list = new ArrayList(); + if (100 % number == 0) { + for (int i = 0; i < number; i++) { + list.add(score); + } + } else { + int n = 0; + for (int i = 0; i < number; i++) { + list.add(score); + } + for (int i = 100 % number; i > 0; i--) { + n = score + 1; + list.set(i, n); + } + } + return list; + } - /** - * 将string类型转成list集合 - * @param str - * @return - */ - public static List strToInteger(String str){ - String[] strs = str.split(","); - List list=new ArrayList(); - for (int i = 0; i < strs.length; i++) { - list.add(Integer.parseInt(strs[i])); - } - return list; - } + /** + * 将string类型转成list集合 + * + * @param str + * @return + */ + public static List strToInteger(String str) { + String[] strs = str.split(","); + List list = new ArrayList(); + for (int i = 0; i < strs.length; i++) { + list.add(Integer.parseInt(strs[i])); + } + return list; + } } diff --git a/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java b/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java index 4116477..211047a 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java @@ -131,7 +131,7 @@ public interface Project_ManagementMapper { * @return */ @Select({ "" }) List queryAllJudgmentPoints(Judgment_Points points);