|
|
|
@ -148,17 +148,24 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint, |
|
|
|
|
// 获取负责的比赛id
|
|
|
|
|
LambdaQueryWrapper<Comp> queryWrapperComp = new LambdaQueryWrapper<>(); |
|
|
|
|
// id位数相同,可用like模糊
|
|
|
|
|
queryWrapperComp.like(Comp::getCompAdmin, userId); |
|
|
|
|
queryWrapperComp.eq(Comp::getCompAdmin, userId); |
|
|
|
|
List<Comp> list = compService.list(queryWrapperComp); |
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
return Result.error("未绑定比赛"); |
|
|
|
|
} |
|
|
|
|
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList()); |
|
|
|
|
// 获取负责的年度比赛id
|
|
|
|
|
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>(); |
|
|
|
|
queryWrapperAnnual.in(ids.size()!=0,"compid",ids); |
|
|
|
|
/*queryWrapperAnnual.in(ids.size()!=0,"compid",ids);*/ |
|
|
|
|
queryWrapperAnnual.in("compid",ids); |
|
|
|
|
List<AnnualComp> listAnnual = annualCompService.list(queryWrapperAnnual); |
|
|
|
|
if(listAnnual.isEmpty()){ |
|
|
|
|
return Result.error("未创建年度比赛"); |
|
|
|
|
} |
|
|
|
|
List<String> annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
QueryWrapper<AnnualCompPoint> queryWrapper = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); |
|
|
|
|
queryWrapper.in(annualIds.size()!=0,"annual_comp_id",annualIds); |
|
|
|
|
queryWrapper.in("annual_comp_id",annualIds); |
|
|
|
|
queryWrapper.eq("annual_comp_switch","Y"); // 比赛必须是开启的
|
|
|
|
|
Page<AnnualCompPoint> page = new Page<AnnualCompPoint>(pageNo, pageSize); |
|
|
|
|
IPage<AnnualCompPoint> pageList = annualCompPointService.page(page, queryWrapper); |
|
|
|
@ -304,7 +311,12 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint, |
|
|
|
|
// @RequiresPermissions("annualCompPoint:annual_comp_point:edit")
|
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
|
public Result<String> edit(@RequestBody AnnualCompPoint annualCompPoint) { |
|
|
|
|
boolean isUpdate = annualCompPointService.updateById(annualCompPoint); |
|
|
|
|
boolean isUpdate ; |
|
|
|
|
if(annualCompPoint.getAnnualCompState().equals("0") && annualCompPoint.getAnnualCompState().equals("4") ){ |
|
|
|
|
isUpdate = annualCompPointService.updateById(annualCompPoint); |
|
|
|
|
} else { |
|
|
|
|
return Result.error("当前状态不可修改"); |
|
|
|
|
} |
|
|
|
|
if (!isUpdate){ |
|
|
|
|
return Result.error("编辑失败!"); |
|
|
|
|
} |
|
|
|
@ -322,7 +334,13 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint, |
|
|
|
|
// @RequiresPermissions("annualCompPoint:annual_comp_point:delete")
|
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
annualCompPointService.removeById(id); |
|
|
|
|
AnnualCompPoint annualCompPoint =annualCompPointService.getById(id); |
|
|
|
|
if(annualCompPoint.getAnnualCompState().equals("0") && annualCompPoint.getAnnualCompState().equals("4") ) { |
|
|
|
|
System.out.println(id); |
|
|
|
|
annualCompPointService.removeById(id); |
|
|
|
|
}else { |
|
|
|
|
return Result.error("当前状态不可删除"); |
|
|
|
|
} |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
@ -940,8 +958,11 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint, |
|
|
|
|
try { |
|
|
|
|
List<AnnualCompPointMb> list = ExcelImportUtil.importExcel(file.getInputStream(), AnnualCompPointMb.class, params); |
|
|
|
|
for (int i = 0 ; i < list.size();i++){ |
|
|
|
|
SysUser sysUser = sysUserService.getUserByName(list.get(i).getStudentcode()); |
|
|
|
|
if(sysUser==null){ |
|
|
|
|
QueryWrapper<SysUser> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("work_no",list.get(i).getStudentcode()); |
|
|
|
|
List<SysUser> listsys = sysUserService.list(qw); |
|
|
|
|
//SysUser sysUser = sysUserService.getUserByName(list.get(i).getStudentcode());
|
|
|
|
|
if(listsys.size()==0){ |
|
|
|
|
return Result.error("文件导入失败:第"+(i+1)+"行学生学号不存在"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -961,7 +982,10 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint, |
|
|
|
|
annualCompetitionProjectRegistrationService.save(ar); |
|
|
|
|
TeamManagement tm = new TeamManagement(); |
|
|
|
|
tm.setEnrollCode(enrollCode); |
|
|
|
|
tm.setUserId(sysUserService.getUserByName(list.get(k).getStudentcode()).getId()); |
|
|
|
|
QueryWrapper<SysUser> qw1 = new QueryWrapper<>(); |
|
|
|
|
qw1.eq("work_no",list.get(k).getStudentcode()); |
|
|
|
|
List<SysUser> listsys1 = sysUserService.list(qw1); |
|
|
|
|
tm.setUserId(listsys1.get(0).getId()); |
|
|
|
|
tm.setCaptain("0"); |
|
|
|
|
teamManagementService.save(tm); |
|
|
|
|
} |
|
|
|
|