平均分配分值

master
pd 4 years ago
parent 6eb88e4187
commit b8e8868747
  1. 4
      src/main/java/com/yipin/liuwanr/controller/Project_ManagementController.java
  2. 67
      src/main/java/com/yipin/liuwanr/helper/UserUtil.java
  3. 2
      src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.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<Integer> 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<String, Object> ret = service.getByjudgmentPointsId(judgmentPointsIds, projectId, userId);
int status = (int) ret.get("retcode");

@ -5,34 +5,45 @@ import java.util.List;
public class UserUtil {
/**
* 平均分配分值
* @param number 判分点数量
* @return
*/
public static List<Integer> averageValue(Integer number) {
Integer score=100/number;
Integer lastScore=score+100%number;
List<Integer> list=new ArrayList<Integer>();
for (int i = 0; i < number-1; i++) {
list.add(score);
}
list.add(lastScore);
return list;
}
/**
* 平均分配分值
*
* @param number 判分点数量
* @return
*/
public static List<Integer> averageValue(Integer number) {
Integer score = 100 / number;
List<Integer> list = new ArrayList<Integer>();
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<Integer> strToInteger(String str){
String[] strs = str.split(",");
List<Integer> list=new ArrayList<Integer>();
for (int i = 0; i < strs.length; i++) {
list.add(Integer.parseInt(strs[i]));
}
return list;
}
/**
* 将string类型转成list集合
*
* @param str
* @return
*/
public static List<Integer> strToInteger(String str) {
String[] strs = str.split(",");
List<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < strs.length; i++) {
list.add(Integer.parseInt(strs[i]));
}
return list;
}
}

@ -131,7 +131,7 @@ public interface Project_ManagementMapper {
* @return
*/
@Select({ "<script>",
"select judgmentPointsId,judgmentPointsName from hr_judgment_points where isdel=0 and systemId=#{systemId}",
"select judgmentPointsId,judgmentPointsName from hr_judgment_points where isdel=0 and systemId=#{systemId} and isopen=0",
" <if test='judgmentPointsName!=null'> and judgmentPointsName like concat('%','${judgmentPointsName}','%')</if>",
"</script>" })
List<Judgment_Points> queryAllJudgmentPoints(Judgment_Points points);

Loading…
Cancel
Save