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