From 6085628bf974d92d52bd7e909ca4aacd1744f2db Mon Sep 17 00:00:00 2001 From: Gitea Date: Mon, 26 Aug 2024 20:43:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=B9=B3=E5=9D=87=E5=88=86?= =?UTF-8?q?=E9=85=8D=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AnnualCompGroupController.java | 130 ++++++++++++++++++ .../controller/UpfileGroupController.java | 7 +- .../annualcompgroup/AnnualCompGroup.api.ts | 6 + .../annualcompgroup/AnnualCompGroupList1.vue | 16 ++- 4 files changed, 157 insertions(+), 2 deletions(-) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java index 4f72232e..edbb7b0b 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java @@ -15,6 +15,10 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; 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.service.IAnnualCompPointService; 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 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.service.ICompService; import org.jeecg.modules.demo.scoresta.entity.ScoreSta; 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.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -75,6 +83,18 @@ public class AnnualCompGroupController extends JeecgController zdfpzp(AnnualCompGroup annualCompGroup, HttpServletRequest req) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + QueryWrapper queryWrappercomp = new QueryWrapper<>(); + queryWrappercomp.eq("comp_admin", user.getUsername()); + List list = compService.list(queryWrappercomp); + if (list.size() == 0) { + return Result.error("分配失败,该用户无负责比赛"); + } + List ids = list.stream().map(Comp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapperAnnual = new QueryWrapper<>(); + queryWrapperAnnual.in("compid", ids); + List listAnnual = annualCompService.list(queryWrapperAnnual); + if (listAnnual.size() == 0) { + return Result.error("分配失败,该用户无负责年度比赛"); + } + List annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList()); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(annualCompGroup, req.getParameterMap()); + queryWrapper.in(annualIds.size() != 0, "annal_comp", annualIds); + + + QueryWrapper queryWrapperacp = new QueryWrapper<>(); + queryWrapperacp.in("annual_comp_id", annualIds); + queryWrapperacp.eq("annual_comp_switch", "Y"); // 比赛必须是开启的 + List listacp = annualCompPointService.list(queryWrapperacp); + if (listacp.size() == 0) { + return Result.error("分配失败,该用户无负责年度比赛项目"); + } + List acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); + queryWrapper.in(acpIds.size() != 0, "ann_comp_p", acpIds); + + List pageList = annualCompGroupService.list(queryWrapper); + if (pageList.size() == 0) { + return Result.error("分配失败,无可分配的专家组"); + } + List annualids = pageList.stream().map(AnnualCompGroup::getAnnal).collect(Collectors.toList()); + List annualcpids = pageList.stream().map(AnnualCompGroup::getAnnCompP).collect(Collectors.toList()); + QueryWrapper queryWrapperup = new QueryWrapper<>(); + queryWrapperup.in("annual_id", annualids); + queryWrapperup.in("annual_comp_point_id", annualcpids); + queryWrapperup.eq("status", "0"); + + QueryWrapper queryWrapperagt = new QueryWrapper<>(); + //queryWrapperagt.eq("ann_com_gro_topid",xmtmid); + queryWrapperagt.in("annid", annualids); + queryWrapperagt.in("ann_com_p", annualcpids); + List 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 listup = upfilePersionService.list(queryWrapperup); + //作品的年度比赛项目必须和组的年度比赛项目相同才可以分配作品 + for (int o = 0; o < listup.size(); o++) { + QueryWrapper queryWrapperctp1 = new QueryWrapper<>(); + queryWrapperctp1.eq("bmcode", listup.get(o).getApplyCode()); + List listctp1 = chaoseTopicPersionService.list(queryWrapperctp1); + if (listctp1.size() == 0) { + return Result.error(listup.get(o).getTopicName() + "未选题,绑定失败!"); + } + } + //List 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 queryWrapperatp = new QueryWrapper<>(); + queryWrapperatp.eq("ann_com_p_g", pageList.get(y).getId()); + List 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 queryWrapperctp = new QueryWrapper<>(); + queryWrapperctp.eq("bmcode", listup.get(i).getApplyCode()); + List 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("自动分配作品成功"); + } + } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/upfilegroup/controller/UpfileGroupController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/upfilegroup/controller/UpfileGroupController.java index 49a669a3..9ed2ed75 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/upfilegroup/controller/UpfileGroupController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/upfilegroup/controller/UpfileGroupController.java @@ -25,6 +25,7 @@ import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; import org.jeecg.modules.demo.annualcompgroup.entity.AnnualCompGroup; +import org.jeecg.modules.demo.annualcompgroup.service.IAnnualCompGroupService; import org.jeecg.modules.demo.chooseTopicPersion.entity.ChaoseTopicPersion; import org.jeecg.modules.demo.chooseTopicPersion.service.IChaoseTopicPersionService; import org.jeecg.modules.demo.comp.entity.Comp; @@ -96,6 +97,9 @@ public class UpfileGroupController extends JeecgController zpidslisttemp = new ArrayList<>(); zpidslisttemp.addAll(zpidslist); + String ndbsxmid = annualCompGroupService.getById(xmtmid).getAnnCompP(); for (int h = 0 ; h < zpidslisttemp.size() ; h++){ QueryWrapper queryWrappertpp = new QueryWrapper<>(); - queryWrappertpp.eq("ann_com_p_g",xmtmid); + queryWrappertpp.eq("ann_com_p",ndbsxmid); List listtopp = annComGroTopPService.list(queryWrappertpp); for (int r = 0 ; r < listtopp.size() ; r++){ if(listtopp.get(r).getBmcode().equals(upfilePersionService.getById(zpidslisttemp.get(h)).getApplyCode())){ diff --git a/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroup.api.ts b/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroup.api.ts index 677c1406..8616152f 100644 --- a/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroup.api.ts +++ b/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroup.api.ts @@ -13,6 +13,12 @@ enum Api { exportXls = '/annualcompgroup/annualCompGroup/exportXls', queryCompId = '/annualcompgroup/annualCompGroup/queryCompId', saveTop = '/topic/topic/szadd', + zdfpzp = '/annualcompgroup/annualCompGroup/zdfpzp', +} + +export const zdfpzp = () => { + let url = Api.zdfpzp; + return defHttp.get({ url: url}, { isTransformResponse: false }); } /** diff --git a/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroupList1.vue b/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroupList1.vue index 76289887..63812aa2 100644 --- a/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroupList1.vue +++ b/jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroupList1.vue @@ -36,6 +36,7 @@ + 自动分配作品