master
王家东 2 weeks ago
parent eec23d218f
commit c988d487db
  1. 16
      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.IOException;
import java.math.BigInteger;
import java.net.URLDecoder;
import java.security.SecureRandom;
import java.util.*;
import java.util.stream.Collectors;
@ -141,11 +143,16 @@ public class ExpprojectController {
public Result<String> add(@RequestBody ExpprojectPage expprojectPage) {
Expproject expproject = new Expproject();
BeanUtils.copyProperties(expprojectPage, expproject);
if (expproject.getNeedexp()>=expprojectPage.getExpandproList().size()) {
if (!expprojectPage.getExpandproList().isEmpty()) {
if (expproject.getNeedexp() >= expprojectPage.getExpandproList().size()) {
expprojectService.saveMain(expproject, expprojectPage.getExpandproList());
return Result.OK("添加成功!");
} else {
return Result.error("确定项目专家数量");
}
}else {
expprojectService.saveMain(expproject, expprojectPage.getExpandproList());
return Result.OK("添加成功!");
}else {
return Result.error("确定项目专家数量");
}
}
@ -241,9 +248,10 @@ public class ExpprojectController {
List<String> usernamelist = expandproService.getusernamelist();
Collections.shuffle(usernamelist);
List<String> randomUsers = getRandomUsers(usernamelist, a);
Expandpro expandpro =new Expandpro();
List<Expert> expertList = expertService.query().in("seusername",randomUsers).list();
for (int i=0;i<expertList.size();i++){
Expandpro expandpro =new Expandpro();
SysUser sysUser = sysUserService.query().eq("username",expertList.get(i).getSeusername()).one();
expandpro.setExpid(expertList.get(i).getSeusername());
expandpro.setExpprojectid(id);

Loading…
Cancel
Save