master
王家东 2 weeks ago
parent eec23d218f
commit c988d487db
  1. 10
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expproject/controller/ExpprojectController.java

@ -2,7 +2,9 @@ package org.jeecg.modules.demo.expproject.controller;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.io.IOException; import java.io.IOException;
import java.math.BigInteger;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.security.SecureRandom;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -141,12 +143,17 @@ public class ExpprojectController {
public Result<String> add(@RequestBody ExpprojectPage expprojectPage) { public Result<String> add(@RequestBody ExpprojectPage expprojectPage) {
Expproject expproject = new Expproject(); Expproject expproject = new Expproject();
BeanUtils.copyProperties(expprojectPage, expproject); BeanUtils.copyProperties(expprojectPage, expproject);
if (!expprojectPage.getExpandproList().isEmpty()) {
if (expproject.getNeedexp() >= expprojectPage.getExpandproList().size()) { if (expproject.getNeedexp() >= expprojectPage.getExpandproList().size()) {
expprojectService.saveMain(expproject, expprojectPage.getExpandproList()); expprojectService.saveMain(expproject, expprojectPage.getExpandproList());
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} else { } else {
return Result.error("确定项目专家数量"); return Result.error("确定项目专家数量");
} }
}else {
expprojectService.saveMain(expproject, expprojectPage.getExpandproList());
return Result.OK("添加成功!");
}
} }
/** /**
@ -241,9 +248,10 @@ public class ExpprojectController {
List<String> usernamelist = expandproService.getusernamelist(); List<String> usernamelist = expandproService.getusernamelist();
Collections.shuffle(usernamelist); Collections.shuffle(usernamelist);
List<String> randomUsers = getRandomUsers(usernamelist, a); List<String> randomUsers = getRandomUsers(usernamelist, a);
Expandpro expandpro =new Expandpro();
List<Expert> expertList = expertService.query().in("seusername",randomUsers).list(); List<Expert> expertList = expertService.query().in("seusername",randomUsers).list();
for (int i=0;i<expertList.size();i++){ for (int i=0;i<expertList.size();i++){
Expandpro expandpro =new Expandpro();
SysUser sysUser = sysUserService.query().eq("username",expertList.get(i).getSeusername()).one(); SysUser sysUser = sysUserService.query().eq("username",expertList.get(i).getSeusername()).one();
expandpro.setExpid(expertList.get(i).getSeusername()); expandpro.setExpid(expertList.get(i).getSeusername());
expandpro.setExpprojectid(id); expandpro.setExpprojectid(id);

Loading…
Cancel
Save