修改奖项新增编辑导入逻辑:如果是团队则获取队长的信息作为代表

main
Gitea 5 months ago
parent e3ca1cf887
commit 5138b41ec3
  1. 70
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java

@ -188,6 +188,21 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
queryWrappertm.eq("enroll_code",awardPersion.getEnrollCode()); queryWrappertm.eq("enroll_code",awardPersion.getEnrollCode());
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
if(listtm.size()>1){
TeamManagement teamManagement1 = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm1 = QueryGenerator.initQueryWrapper(teamManagement1, req.getParameterMap());
queryWrappertm1.eq("enroll_code",awardPersion.getEnrollCode());
queryWrappertm1.eq("captain","1");
List<TeamManagement> listtm1 = teamManagementService.list(queryWrappertm1);
SysUser sysUser = sysUserService.getById(listtm1.get(0).getUserId());
awardPersion.setStudentname(sysUser.getRealname());
awardPersion.setStudentcode(sysUser.getUsername());
awardPersionService.save(awardPersion);
AnnualCompPoint annualCompPoint = annualCompPointService.getById(awardPersion.getAnnualCompP());
annualCompPoint.setIsPj(1);
annualCompPointService.updateById(annualCompPoint);
return Result.OK("添加成功!");
}else {
SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId()); SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId());
awardPersion.setStudentname(sysUser.getRealname()); awardPersion.setStudentname(sysUser.getRealname());
awardPersion.setStudentcode(sysUser.getUsername()); awardPersion.setStudentcode(sysUser.getUsername());
@ -200,6 +215,8 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
} }
}
/** /**
* 编辑 * 编辑
* *
@ -229,6 +246,18 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
queryWrappertm.eq("enroll_code",awardPersion.getEnrollCode()); queryWrappertm.eq("enroll_code",awardPersion.getEnrollCode());
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
if(listtm.size()>1){
TeamManagement teamManagement1 = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm1 = QueryGenerator.initQueryWrapper(teamManagement1, req.getParameterMap());
queryWrappertm1.eq("enroll_code",awardPersion.getEnrollCode());
queryWrappertm1.eq("captain","1");
List<TeamManagement> listtm1 = teamManagementService.list(queryWrappertm1);
SysUser sysUser = sysUserService.getById(listtm1.get(0).getUserId());
awardPersion.setStudentname(sysUser.getRealname());
awardPersion.setStudentcode(sysUser.getUsername());
awardPersionService.updateById(awardPersion);
return Result.OK("编辑成功!");
}else {
SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId()); SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId());
awardPersion.setStudentname(sysUser.getRealname()); awardPersion.setStudentname(sysUser.getRealname());
awardPersion.setStudentcode(sysUser.getUsername()); awardPersion.setStudentcode(sysUser.getUsername());
@ -238,6 +267,8 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
} }
}
/** /**
* 通过id删除 * 通过id删除
* *
@ -421,7 +452,13 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, request.getParameterMap()); QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, request.getParameterMap());
queryWrappertm.eq("enroll_code",list.get(i).getEnrollCode()); queryWrappertm.eq("enroll_code",list.get(i).getEnrollCode());
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId()); if(listtm.size()>1){
TeamManagement teamManagement1 = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm1 = QueryGenerator.initQueryWrapper(teamManagement1, request.getParameterMap());
queryWrappertm1.eq("enroll_code",list.get(i).getEnrollCode());
queryWrappertm1.eq("captain","1");
List<TeamManagement> listtm1 = teamManagementService.list(queryWrappertm1);
SysUser sysUser = sysUserService.getById(listtm1.get(0).getUserId());
if(listaca.get(0).getFirstPrize().equals(list.get(i).getAwardname())){ if(listaca.get(0).getFirstPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(1); list.get(i).setAwardsort(1);
list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setAwardid(listaca.get(0).getId());
@ -451,6 +488,37 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在"); return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在");
} }
}else {
SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId());
if(listaca.get(0).getFirstPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(1);
list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname());
}else if(listaca.get(0).getSecondPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(2);
list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname());
}else if(listaca.get(0).getThirdPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(3);
list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname());
}else if(listaca.get(0).getFourthPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(4);
list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname());
}else if(listaca.get(0).getFifthPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(5);
list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname());
}else {
return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在");
}
}
} }
//update-begin-author:taoyan date:20190528 for:批量插入数据 //update-begin-author:taoyan date:20190528 for:批量插入数据
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();

Loading…
Cancel
Save