|
|
@ -15,6 +15,10 @@ import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.anncomgrotop.entity.AnnComGroTop; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.anncomgrotop.service.IAnnComGroTopService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.anncomgrotopp.entity.AnnComGroTopP; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.anncomgrotopp.service.IAnnComGroTopPService; |
|
|
|
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; |
|
|
|
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; |
|
|
|
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; |
|
|
|
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; |
|
|
|
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; |
|
|
|
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; |
|
|
@ -28,10 +32,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
|
|
import org.jeecg.modules.demo.awardpersion.entity.AwardPersion; |
|
|
|
import org.jeecg.modules.demo.awardpersion.entity.AwardPersion; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.chooseTopicPersion.entity.ChaoseTopicPersion; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.chooseTopicPersion.service.IChaoseTopicPersionService; |
|
|
|
import org.jeecg.modules.demo.comp.entity.Comp; |
|
|
|
import org.jeecg.modules.demo.comp.entity.Comp; |
|
|
|
import org.jeecg.modules.demo.comp.service.ICompService; |
|
|
|
import org.jeecg.modules.demo.comp.service.ICompService; |
|
|
|
import org.jeecg.modules.demo.scoresta.entity.ScoreSta; |
|
|
|
import org.jeecg.modules.demo.scoresta.entity.ScoreSta; |
|
|
|
import org.jeecg.modules.demo.scoresta.service.IScoreStaService; |
|
|
|
import org.jeecg.modules.demo.scoresta.service.IScoreStaService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.upfile_persion.entity.UpfilePersion; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.upfile_persion.service.IUpfilePersionService; |
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
@ -75,6 +83,18 @@ public class AnnualCompGroupController extends JeecgController<AnnualCompGroup, |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IAnnualCompPointService annualCompPointService; |
|
|
|
private IAnnualCompPointService annualCompPointService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IAnnComGroTopPService annComGroTopPService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IUpfilePersionService upfilePersionService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IChaoseTopicPersionService chaoseTopicPersionService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IAnnComGroTopService annComGroTopService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 分页列表查询 |
|
|
|
* 分页列表查询 |
|
|
@ -311,4 +331,114 @@ public class AnnualCompGroupController extends JeecgController<AnnualCompGroup, |
|
|
|
return super.importExcel(request, response, AnnualCompGroup.class); |
|
|
|
return super.importExcel(request, response, AnnualCompGroup.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 自动分配作品 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@ApiOperation(value="自动分配作品", notes="自动分配作品") |
|
|
|
|
|
|
|
@GetMapping(value = "/zdfpzp") |
|
|
|
|
|
|
|
public Result<?> zdfpzp(AnnualCompGroup annualCompGroup, HttpServletRequest req) { |
|
|
|
|
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
|
|
|
QueryWrapper<Comp> queryWrappercomp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrappercomp.eq("comp_admin", user.getUsername()); |
|
|
|
|
|
|
|
List<Comp> list = compService.list(queryWrappercomp); |
|
|
|
|
|
|
|
if (list.size() == 0) { |
|
|
|
|
|
|
|
return Result.error("分配失败,该用户无负责比赛"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperAnnual.in("compid", ids); |
|
|
|
|
|
|
|
List<AnnualComp> listAnnual = annualCompService.list(queryWrapperAnnual); |
|
|
|
|
|
|
|
if (listAnnual.size() == 0) { |
|
|
|
|
|
|
|
return Result.error("分配失败,该用户无负责年度比赛"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
QueryWrapper<AnnualCompGroup> queryWrapper = QueryGenerator.initQueryWrapper(annualCompGroup, req.getParameterMap()); |
|
|
|
|
|
|
|
queryWrapper.in(annualIds.size() != 0, "annal_comp", annualIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AnnualCompPoint> queryWrapperacp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperacp.in("annual_comp_id", annualIds); |
|
|
|
|
|
|
|
queryWrapperacp.eq("annual_comp_switch", "Y"); // 比赛必须是开启的
|
|
|
|
|
|
|
|
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp); |
|
|
|
|
|
|
|
if (listacp.size() == 0) { |
|
|
|
|
|
|
|
return Result.error("分配失败,该用户无负责年度比赛项目"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
queryWrapper.in(acpIds.size() != 0, "ann_comp_p", acpIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<AnnualCompGroup> pageList = annualCompGroupService.list(queryWrapper); |
|
|
|
|
|
|
|
if (pageList.size() == 0) { |
|
|
|
|
|
|
|
return Result.error("分配失败,无可分配的专家组"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> annualids = pageList.stream().map(AnnualCompGroup::getAnnal).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<String> annualcpids = pageList.stream().map(AnnualCompGroup::getAnnCompP).collect(Collectors.toList()); |
|
|
|
|
|
|
|
QueryWrapper<UpfilePersion> queryWrapperup = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperup.in("annual_id", annualids); |
|
|
|
|
|
|
|
queryWrapperup.in("annual_comp_point_id", annualcpids); |
|
|
|
|
|
|
|
queryWrapperup.eq("status", "0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AnnComGroTopP> queryWrapperagt = new QueryWrapper<>(); |
|
|
|
|
|
|
|
//queryWrapperagt.eq("ann_com_gro_topid",xmtmid);
|
|
|
|
|
|
|
|
queryWrapperagt.in("annid", annualids); |
|
|
|
|
|
|
|
queryWrapperagt.in("ann_com_p", annualcpids); |
|
|
|
|
|
|
|
List<AnnComGroTopP> listact = annComGroTopPService.list(queryWrapperagt); |
|
|
|
|
|
|
|
String str = ""; |
|
|
|
|
|
|
|
for (int i = 0; i < listact.size(); i++) { |
|
|
|
|
|
|
|
str = str + listact.get(i).getBmcode() + ","; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (str != "") { |
|
|
|
|
|
|
|
queryWrapperup.notIn("apply_code", str.split(",")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<UpfilePersion> listup = upfilePersionService.list(queryWrapperup); |
|
|
|
|
|
|
|
//作品的年度比赛项目必须和组的年度比赛项目相同才可以分配作品
|
|
|
|
|
|
|
|
for (int o = 0; o < listup.size(); o++) { |
|
|
|
|
|
|
|
QueryWrapper<ChaoseTopicPersion> queryWrapperctp1 = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperctp1.eq("bmcode", listup.get(o).getApplyCode()); |
|
|
|
|
|
|
|
List<ChaoseTopicPersion> listctp1 = chaoseTopicPersionService.list(queryWrapperctp1); |
|
|
|
|
|
|
|
if (listctp1.size() == 0) { |
|
|
|
|
|
|
|
return Result.error(listup.get(o).getTopicName() + "未选题,绑定失败!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//List<String> acgids = pageList.stream().map(AnnualCompGroup::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
int upsum = listup.size(); |
|
|
|
|
|
|
|
int acgsum = pageList.size(); |
|
|
|
|
|
|
|
int pjz = upsum / acgsum; |
|
|
|
|
|
|
|
int syz = upsum % acgsum; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int y = 0; y < pageList.size(); y++) { |
|
|
|
|
|
|
|
QueryWrapper<AnnComGroTop> queryWrapperatp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperatp.eq("ann_com_p_g", pageList.get(y).getId()); |
|
|
|
|
|
|
|
List<AnnComGroTop> listtop = annComGroTopService.list(queryWrapperatp); |
|
|
|
|
|
|
|
int upnum = 0; |
|
|
|
|
|
|
|
for (int i = 0; i < listup.size(); i++) { |
|
|
|
|
|
|
|
if(upnum==pjz&&pjz!=0&&listup.size()>syz){ |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int k = 0; k < listtop.size(); k++) { |
|
|
|
|
|
|
|
QueryWrapper<ChaoseTopicPersion> queryWrapperctp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperctp.eq("bmcode", listup.get(i).getApplyCode()); |
|
|
|
|
|
|
|
List<ChaoseTopicPersion> listctp = chaoseTopicPersionService.list(queryWrapperctp); |
|
|
|
|
|
|
|
if (listtop.get(k).getTopid().equals(listctp.get(0).getTimul())) { |
|
|
|
|
|
|
|
AnnComGroTopP annComGroTopP = new AnnComGroTopP(); |
|
|
|
|
|
|
|
annComGroTopP.setAnnComGroTopid(listtop.get(k).getId()); |
|
|
|
|
|
|
|
annComGroTopP.setBmcode(listup.get(i).getApplyCode()); |
|
|
|
|
|
|
|
annComGroTopP.setAnnid(listtop.get(k).getAnnid()); |
|
|
|
|
|
|
|
annComGroTopP.setAnnComP(listtop.get(k).getAnnComP()); |
|
|
|
|
|
|
|
annComGroTopP.setAnnComPG(listtop.get(k).getAnnComPG()); |
|
|
|
|
|
|
|
annComGroTopP.setTopicName(listup.get(i).getTopicName()); |
|
|
|
|
|
|
|
annComGroTopP.setTopid(listtop.get(k).getTopid()); |
|
|
|
|
|
|
|
annComGroTopPService.save(annComGroTopP); |
|
|
|
|
|
|
|
listup.remove(i); |
|
|
|
|
|
|
|
upnum++; |
|
|
|
|
|
|
|
i=-1; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Result.OK("自动分配作品成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|