自动平均分配作品

main
Gitea 3 months ago
parent cec63755e6
commit 6085628bf9
  1. 130
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java
  2. 7
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/upfilegroup/controller/UpfileGroupController.java
  3. 6
      jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroup.api.ts
  4. 16
      jeecgboot-vue3-master/src/views/annualcompgroup/AnnualCompGroupList1.vue

@ -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<AnnualCompGroup,
@Autowired
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
*/
@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("自动分配作品成功");
}
}

@ -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<UpfileGroup, IUpfileG
@Autowired
private IAnnComGroTopPService annComGroTopPService;
@Autowired
private IAnnualCompGroupService annualCompGroupService;
/**
* 分页列表查询
*
@ -215,9 +219,10 @@ public class UpfileGroupController extends JeecgController<UpfileGroup, IUpfileG
//去除已绑定作品id
List<String> zpidslisttemp = new ArrayList<>();
zpidslisttemp.addAll(zpidslist);
String ndbsxmid = annualCompGroupService.getById(xmtmid).getAnnCompP();
for (int h = 0 ; h < zpidslisttemp.size() ; h++){
QueryWrapper<AnnComGroTopP> queryWrappertpp = new QueryWrapper<>();
queryWrappertpp.eq("ann_com_p_g",xmtmid);
queryWrappertpp.eq("ann_com_p",ndbsxmid);
List<AnnComGroTopP> listtopp = annComGroTopPService.list(queryWrappertpp);
for (int r = 0 ; r < listtopp.size() ; r++){
if(listtopp.get(r).getBmcode().equals(upfilePersionService.getById(zpidslisttemp.get(h)).getApplyCode())){

@ -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 });
}
/**

@ -36,6 +36,7 @@
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>-->
<a-button type="primary" @click="zdfpzpbu" preIcon="ant-design:plus-outlined"> 自动分配作品</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -78,18 +79,20 @@
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './AnnualCompGroup.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,saveOrUpdateTop } from './AnnualCompGroup.api';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,saveOrUpdateTop,zdfpzp } from './AnnualCompGroup.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import AnnualCompGroupModal from './components/AnnualCompGroupModal.vue'
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
import {saveOrUpdate} from "/@/views/anncomgrotop/components/Topic.api";
import {defHttp} from "/@/utils/http/axios";
import {useMessage} from "../../hooks/web/useMessage";
const router = useRouter();
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const { createMessage } = useMessage();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
@ -134,6 +137,17 @@
registerModal.value.add();
}
function zdfpzpbu() {
zdfpzp()
.then((res) => {
if (res.success) {
createMessage.success(res.message);
} else {
createMessage.warning(res.message);
}
});
}
/**
* 编辑事件
*/

Loading…
Cancel
Save