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);