Commit c034016311b444944023f55bc4bd951312dea80e

Authored by yiming
1 parent 9058e6ea

生成排班改多线程

src/main/java/com/bsth/service/ddexam/impl/DdexamServiceImpl.java
... ... @@ -246,7 +246,9 @@ public class DdexamServiceImpl implements DdexamService {
246 246 if (userList.size() > 0) {
247 247 //已有的人检查分配线路
248 248 List<SysUser> finalUserList = userList;
249   - snt(finalUserList,false);
  249 + if (snt(finalUserList,false)) {
  250 + kk();
  251 + }
250 252 }
251 253 }catch (Exception e){
252 254 log.error("-----考试初始化失败------",e);
... ... @@ -330,18 +332,13 @@ public class DdexamServiceImpl implements DdexamService {
330 332 }
331 333 //已创建好的用户分配排班
332 334  
333   - public Boolean snt(List<SysUser> userList,boolean type) throws Exception{
  335 + public Boolean snt(List<SysUser> userList,boolean type){
334 336 for (int i = 0 ; i < userList.size() ; i++ ){ //已rs人数为准
335 337 SysUser user = userList.get(i);
336 338 if (realControAuthorityRepository.findByUserId(user.getId()) != null) {
337   - new Thread() {
338   - public synchronized void run() {
339   - useryType(user,type);
340   - System.out.println("分配班次...");
341   - sysUserRepository.changeKsStatus(user.getId()); ////状态 表示今日账户已用
342   - kk();
343   - }
344   - }.start();
  339 + useryType(user,type);
  340 + System.out.println("分配班次...");
  341 + sysUserRepository.changeKsStatus(user.getId()); ////状态 表示今日账户已用
345 342 }
346 343 }
347 344 return true;
... ...
src/main/java/com/bsth/service/subject/impl/SubjectUserServiceImpl.java
... ... @@ -254,6 +254,12 @@ public class SubjectUserServiceImpl extends BaseServiceImpl&lt;SubjectUser, Integer
254 254 }
255 255 }
256 256 //初始化考生排班 只初始化A线
257   - ddexamService.snt(userList,true);
  257 + new Thread() {
  258 + public synchronized void run() {
  259 + if (ddexamService.snt(userList,true)) {
  260 + ddexamService.kk();
  261 + }
  262 + }
  263 + }.start();
258 264 }
259 265 }
... ...