喻忠伟 4 months ago
commit b8dc79923d
  1. 586
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java
  2. 88
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java
  3. 330
      jeecgboot-vue3-master/src/views/awardpersion/components/AwardPersionForm.vue
  4. 1
      jeecgboot-vue3-master/src/views/awardpersion/components/AwardPersionModal.vue

@ -18,6 +18,8 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.annual.service.IAnnualService; import org.jeecg.modules.demo.annual.service.IAnnualService;
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.annualScore.entity.PersonalCompScore;
import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService;
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; import org.jeecg.modules.demo.annualcomp.entity.AnnualComp;
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration; import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration;
@ -92,6 +94,8 @@ public class AnnualCompetitionProjectRegistrationController {
private ICompService compService; private ICompService compService;
@Autowired @Autowired
private IAwardPersionService awardPersionService; private IAwardPersionService awardPersionService;
@Autowired
private IPersonalCompScoreService personalCompScoreService;
/** /**
@ -983,223 +987,453 @@ public class AnnualCompetitionProjectRegistrationController {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Comp comp = new Comp(); Comp comp = new Comp();
QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, req.getParameterMap());
queryWrappercomp.like("comp_admin",user.getUsername()); queryWrappercomp.like("comp_admin", user.getUsername());
List<Comp> list = compService.list(queryWrappercomp); List<Comp> list = compService.list(queryWrappercomp);
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList());
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>();
queryWrapperAnnual.in(ids.size()!=0,"compid",ids);
queryWrapperAnnual.orderByDesc("create_time");
List<AnnualComp> annualCompList = annualCompService.list(queryWrapperAnnual);
//List<AnnualComp> annualCompList = getZXAnnualComp(req);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
//年度比赛名称 if (list.size() > 0) {
map.put("annualCompName",annualCompList.get(0).getName()); List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList());
//共多少届以及当前第几届 QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>();
map.put("sum",annualCompList.size()); queryWrapperAnnual.in(ids.size() != 0, "compid", ids);
queryWrapperAnnual.orderByDesc("create_time");
AnnualCompPoint annualCompPoint = new AnnualCompPoint(); List<AnnualComp> annualCompList = annualCompService.list(queryWrapperAnnual);
QueryWrapper<AnnualCompPoint> queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap()); if (annualCompList.size() > 0) {
queryWrapperacp.eq("annual_comp_id",annualCompList.get(0).getId()); //年度比赛名称
queryWrapperacp.eq("annual_comp_switch","Y"); // 比赛必须是开启的 map.put("annualCompName", annualCompList.get(0).getName());
//queryWrapperacp.orderByDesc("create_time"); //共多少届以及当前第几届
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp); map.put("sum", annualCompList.size());
//比赛项目数
map.put("bsxmSum",listacp.size()); AnnualCompPoint annualCompPoint = new AnnualCompPoint();
//前五条项目名称数据以及对应的报名数 QueryWrapper<AnnualCompPoint> queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap());
List<Map<String,Object>> xmListMap = new ArrayList<>(); queryWrapperacp.eq("annual_comp_id", annualCompList.get(0).getId());
if(listacp.size()>5){ queryWrapperacp.eq("annual_comp_switch", "Y"); // 比赛必须是开启的
for (int i = 0 ; i <5;i++){ //queryWrapperacp.orderByDesc("create_time");
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp);
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); //比赛项目数
queryWrapperbm.eq("annual_compid",listacp.get(i).getId()); map.put("bsxmSum", listacp.size());
queryWrapperbm.eq("enroll_static", "2"); //前五条项目名称数据以及对应的报名数
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); List<Map<String, Object>> xmListMap = new ArrayList<>();
Map<String, Object> map1 = new HashMap<>(); if (listacp.size() > 5) {
map1.put("xmname",listacp.get(i).getObjName()); for (int i = 0; i < 5; i++) {
map1.put("xmbmrs",listbm.size()); AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration();
xmListMap.add(map1); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
queryWrapperbm.eq("annual_compid", listacp.get(i).getId());
queryWrapperbm.eq("enroll_static", "2");
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm);
Map<String, Object> map1 = new HashMap<>();
map1.put("xmname", listacp.get(i).getObjName());
map1.put("xmbmrs", listbm.size());
xmListMap.add(map1);
}
} else {
for (int m = 0; m < listacp.size(); m++) {
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration();
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
queryWrapperbm.eq("annual_compid", listacp.get(m).getId());
queryWrapperbm.eq("enroll_static", "2");
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm);
Map<String, Object> map1 = new HashMap<>();
map1.put("xmname", listacp.get(m).getObjName());
map1.put("xmbmrs", listbm.size());
xmListMap.add(map1);
}
}
map.put("qwtxmList", xmListMap);
//参加比赛队伍数(报名数)
if(listacp.size()>0){
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList());
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration();
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
queryWrapperbm.in(acpIds.size() != 0, "annual_compid", acpIds);
queryWrapperbm.eq("enroll_static", "2");
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm);
map.put("bmNumber", listbm.size());
//参数人数
if (listbm.size() == 0) {
map.put("csNumber", 0);
map.put("ydjNumber", 0);
map.put("edjNumber", 0);
map.put("sdjNumber", 0);
map.put("sidjNumber", 0);
map.put("wdjNumber", 0);
} else {
TeamManagement teamManagement = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
List<String> bmbhs = listbm.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList());
queryWrappertm.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
map.put("csNumber", listtm.size());
//一等奖人数
AwardPersion awardPersion1 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap1 = QueryGenerator.initQueryWrapper(awardPersion1, req.getParameterMap());
queryWrapperap1.eq("awardsort", 1);
queryWrapperap1.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<AwardPersion> list1 = awardPersionService.list(queryWrapperap1);
map.put("ydjNumber", list1.size());
//二等奖人数
AwardPersion awardPersion2 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap2 = QueryGenerator.initQueryWrapper(awardPersion2, req.getParameterMap());
queryWrapperap2.eq("awardsort", 2);
queryWrapperap2.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<AwardPersion> list2 = awardPersionService.list(queryWrapperap2);
map.put("edjNumber", list2.size());
//三等奖人数
AwardPersion awardPersion3 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap3 = QueryGenerator.initQueryWrapper(awardPersion3, req.getParameterMap());
queryWrapperap3.eq("awardsort", 3);
queryWrapperap3.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<AwardPersion> list3 = awardPersionService.list(queryWrapperap3);
map.put("sdjNumber", list3.size());
//四等奖人数
AwardPersion awardPersion4 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap4 = QueryGenerator.initQueryWrapper(awardPersion4, req.getParameterMap());
queryWrapperap4.eq("awardsort", 4);
queryWrapperap4.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<AwardPersion> list4 = awardPersionService.list(queryWrapperap4);
map.put("sidjNumber", list4.size());
//五等奖人数
AwardPersion awardPersion5 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap5 = QueryGenerator.initQueryWrapper(awardPersion5, req.getParameterMap());
queryWrapperap5.eq("awardsort", 5);
queryWrapperap5.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<AwardPersion> list5 = awardPersionService.list(queryWrapperap5);
map.put("wdjNumber", list5.size());
} }
}else{ //参赛院系用到的list
for (int m = 0 ; m <listacp.size();m++){ List<TeamManagement> listcs = new ArrayList<>();
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); //个人赛人数
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration1 = new AnnualCompetitionProjectRegistration();
queryWrapperbm.eq("annual_compid",listacp.get(m).getId()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm1 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration1, req.getParameterMap());
queryWrapperbm.eq("enroll_static", "2"); queryWrapperbm1.in(acpIds.size() != 0, "annual_compid", acpIds);
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); queryWrapperbm1.eq("enroll_static", "2");
Map<String, Object> map1 = new HashMap<>(); queryWrapperbm1.eq("entry_format", "0");
map1.put("xmname",listacp.get(m).getObjName()); List<AnnualCompetitionProjectRegistration> listbm1 = annualCompetitionProjectRegistrationService.list(queryWrapperbm1);
map1.put("xmbmrs",listbm.size()); if (listbm1.size() == 0) {
xmListMap.add(map1); map.put("grsNumber", 0);
} else {
TeamManagement teamManagement = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
List<String> bmbhs = listbm1.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList());
queryWrappertm.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
map.put("grsNumber", listtm.size());
listcs.addAll(listtm);
}
//团队赛人数
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration2 = new AnnualCompetitionProjectRegistration();
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm2 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration2, req.getParameterMap());
queryWrapperbm2.in(acpIds.size() != 0, "annual_compid", acpIds);
queryWrapperbm2.eq("enroll_static", "2");
queryWrapperbm2.eq("entry_format", "1");
List<AnnualCompetitionProjectRegistration> listbm2 = annualCompetitionProjectRegistrationService.list(queryWrapperbm2);
if (listbm2.size() == 0) {
map.put("tdsNumber", 0);
} else {
TeamManagement teamManagement = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
List<String> bmbhs = listbm2.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList());
queryWrappertm.in(bmbhs.size() != 0, "enroll_code", bmbhs);
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
map.put("tdsNumber", listtm.size());
//查只是队长的用户id
queryWrappertm.eq("captain", "1");
List<TeamManagement> listdz = teamManagementService.list(queryWrappertm);
listcs.addAll(listdz);
}
//参赛院系人数排名(只取前六条)
if (listcs.size() == 0) {
map.put("csyxbmpm", new ArrayList<>());
map.put("bmxsxxList", new ArrayList<>());
} else {
//拿到所有的userid
List<String> userIds = listcs.stream().map(TeamManagement::getUserId).collect(Collectors.toList());
QueryWrapper<SysUserDepart> queryWrappersud = new QueryWrapper<>();
queryWrappersud.select("dep_id,COUNT(*) as user_id");
queryWrappersud.in("user_id", userIds);
queryWrappersud.groupBy("dep_id");
queryWrappersud.orderByDesc("COUNT(*)");
List<SysUserDepart> listsud = sysUserDepartService.list(queryWrappersud);
List<Map<String, Object>> csyxpmListMap = new ArrayList<>();
if (listsud.size() > 6) {
for (int o = 0; o < 6; o++) {
Map<String, Object> map2 = new HashMap<>();
map2.put("pm", o + 1);
map2.put("csyxid", listsud.get(o).getDepId());
SysDepart depart = sysDepartService.query().eq("id", listsud.get(o).getDepId()).one();
map2.put("csyxname", depart.getDepartName());
map2.put("bms", listsud.get(o).getUserId());
csyxpmListMap.add(map2);
}
map.put("csyxbmpm", csyxpmListMap);
} else {
for (int u = 0; u < listsud.size(); u++) {
Map<String, Object> map3 = new HashMap<>();
map3.put("pm", u + 1);
map3.put("csyxid", listsud.get(u).getDepId());
SysDepart depart = sysDepartService.query().eq("id", listsud.get(u).getDepId()).one();
map3.put("csyxname", depart.getDepartName());
map3.put("bms", listsud.get(u).getUserId());
csyxpmListMap.add(map3);
}
map.put("csyxbmpm", csyxpmListMap);
}
//报名学生列表(只取前六条)
//根据userIds查询出六个学生信息
List<Map<String, Object>> bmxsxxListMap = new ArrayList<>();
if (userIds.size() > 6) {
for (int p = 0; p < 6; p++) {
List<SysUserDepart> userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(p)).list();
SysUser sysUser = sysUserService.query().eq("id", userIds.get(p)).one();
SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one();
Map<String, Object> map4 = new HashMap<>();
map4.put("name", sysUser.getRealname());
map4.put("xh", sysUser.getUsername());
map4.put("szyx", depart.getDepartName());
bmxsxxListMap.add(map4);
}
map.put("bmxsxxList", bmxsxxListMap);
} else {
for (int a = 0; a < userIds.size(); a++) {
List<SysUserDepart> userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(a)).list();
SysUser sysUser = sysUserService.query().eq("id", userIds.get(a)).one();
SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one();
Map<String, Object> map5 = new HashMap<>();
map5.put("name", sysUser.getRealname());
map5.put("xh", sysUser.getUsername());
map5.put("szyx", depart.getDepartName());
bmxsxxListMap.add(map5);
}
map.put("bmxsxxList", bmxsxxListMap);
}
}
} }
} }
}
return Result.OK(map);
}
map.put("qwtxmList",xmListMap);
//参加比赛队伍数(报名数) /**
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList()); * 学生角色首页比赛数据接口
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); *
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); * @param req
queryWrapperbm.in(acpIds.size()!=0,"annual_compid",acpIds); * @return
queryWrapperbm.eq("enroll_static", "2"); */
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm); @ApiOperation(value="学生角色首页比赛数据接口", notes="学生角色首页比赛数据接口")
map.put("bmNumber",listbm.size()); @GetMapping(value = "/xssybsjs")
//参数人数 public Result<?> xssybsjs( HttpServletRequest req) {
if(listbm.size()==0){ //获取当前登录用户
map.put("csNumber",0); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
}else { TeamManagement teamManagement = new TeamManagement();
TeamManagement teamManagement = new TeamManagement(); QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); queryWrappertm.eq("user_id",user.getId());
List<String> bmbhs = listbm.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
queryWrappertm.in(bmbhs.size()!=0,"enroll_code",bmbhs); Map<String, Object> map = new HashMap<>();
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); if(listtm.size()!=0){
map.put("csNumber",listtm.size()); //学生参加比赛的所有报名编号
//一等奖人数 List<String> bmbhs = listtm.stream().map(TeamManagement::getEnrollCode).collect(Collectors.toList());
//查询报名表报名编号对应的所有年度比赛项目id
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration();
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
queryWrapperbm.in("enroll_code",bmbhs);
queryWrapperbm.eq("enroll_static", "2");
List<AnnualCompetitionProjectRegistration> listbm = annualCompetitionProjectRegistrationService.list(queryWrapperbm);
//参加比赛项目数量
map.put("cjbsxmsl",listbm.size());
if(listbm.size()!=0){
//年度比赛项目ids
List<String> ndbsxmids = listbm.stream().map(AnnualCompetitionProjectRegistration::getAnnualCompid).collect(Collectors.toList());
AnnualCompPoint annualCompPoint = new AnnualCompPoint();
QueryWrapper<AnnualCompPoint> queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, req.getParameterMap());
queryWrapperacp.in("id",ndbsxmids);
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp);
//报名比赛项目
List<Map<String,Object>> xmListMap = new ArrayList<>();
if(listacp.size()>6){
for (int k = 0 ; k < 6 ; k++){
Map<String, Object> map2 = new HashMap<>();
//项目名称
map2.put("xmname",listacp.get(k).getObjName());
//参与形式
map2.put("cyxs",listacp.get(k).getEntryForm().equals("N") ? "个人":"团队");
//项目id
map2.put("xmid",listacp.get(k).getId());
//状态
Date date = new Date();
if(date.getTime()>=listacp.get(k).getApplyStartTime().getTime()&&date.getTime()<=listacp.get(k).getApplyEndTime().getTime()){
map2.put("zt","报名");
}
if(date.getTime()>=listacp.get(k).getTopicStartTime().getTime()&&date.getTime()<=listacp.get(k).getTopicEndTime().getTime()){
map2.put("zt","选题");
}
if(date.getTime()>=listacp.get(k).getUploadStartTime().getTime()&&date.getTime()<=listacp.get(k).getUploadEndTime().getTime()){
map2.put("zt","上传作品");
}
if(date.getTime()>=listacp.get(k).getScoreStartTime().getTime()&&date.getTime()<=listacp.get(k).getScoreEndTime().getTime()){
map2.put("zt","评分");
}
if(date.getTime()>listacp.get(k).getScoreEndTime().getTime()){
map2.put("zt","已结束");
}
xmListMap.add(map2);
}
}else {
for (int o = 0 ; o < listacp.size() ; o++){
Map<String, Object> map3 = new HashMap<>();
//项目名称
map3.put("xmname",listacp.get(o).getObjName());
//参与形式
map3.put("cyxs",listacp.get(o).getEntryForm().equals("N") ? "个人":"团队");
//项目id
map3.put("xmid",listacp.get(o).getId());
//状态
Date date = new Date();
if(date.getTime()>=listacp.get(o).getApplyStartTime().getTime()&&date.getTime()<=listacp.get(o).getApplyEndTime().getTime()){
map3.put("zt","报名");
}
if(date.getTime()>=listacp.get(o).getTopicStartTime().getTime()&&date.getTime()<=listacp.get(o).getTopicEndTime().getTime()){
map3.put("zt","选题");
}
if(date.getTime()>=listacp.get(o).getUploadStartTime().getTime()&&date.getTime()<=listacp.get(o).getUploadEndTime().getTime()){
map3.put("zt","上传作品");
}
if(date.getTime()>=listacp.get(o).getScoreStartTime().getTime()&&date.getTime()<=listacp.get(o).getScoreEndTime().getTime()){
map3.put("zt","评分");
}
if(date.getTime()>listacp.get(o).getScoreEndTime().getTime()){
map3.put("zt","已结束");
}
xmListMap.add(map3);
}
}
map.put("bmbsxm",xmListMap);
int gjj = 0;
int shengj = 0;
int shij = 0;
int xj = 0;
for (int i = 0 ; i < listacp.size() ; i++){
if(listacp.get(i).getObjLevel().equals("1809121223401168898")){
//国家
gjj = gjj+1;
}
if(listacp.get(i).getObjLevel().equals("1809121301201313793")){
//省
shengj = shengj+1;
}
if(listacp.get(i).getObjLevel().equals("1809121356582903809")){
//市
shij = shij+1;
}
if(listacp.get(i).getObjLevel().equals("1809121454654119937")){
//校
xj = xj+1;
}
}
map.put("gjj",gjj);
map.put("shengj",shengj);
map.put("shij",shij);
map.put("xj",xj);
}else{
map.put("gjj",0);
map.put("shengj",0);
map.put("shij",0);
map.put("xj",0);
}
//获奖数
//一等奖数
AwardPersion awardPersion1 = new AwardPersion(); AwardPersion awardPersion1 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap1 = QueryGenerator.initQueryWrapper(awardPersion1, req.getParameterMap()); QueryWrapper<AwardPersion> queryWrapperap1 = QueryGenerator.initQueryWrapper(awardPersion1, req.getParameterMap());
queryWrapperap1.eq("awardsort",1); queryWrapperap1.eq("awardsort",1);
queryWrapperap1.eq("studentcode",user.getUsername());
queryWrapperap1.in(bmbhs.size()!=0,"enroll_code",bmbhs); queryWrapperap1.in(bmbhs.size()!=0,"enroll_code",bmbhs);
List<AwardPersion> list1 = awardPersionService.list(queryWrapperap1); List<AwardPersion> list1 = awardPersionService.list(queryWrapperap1);
map.put("ydjNumber",list1.size()); map.put("ydjNumber",list1.size());
//二等奖人数 //二等奖数
AwardPersion awardPersion2 = new AwardPersion(); AwardPersion awardPersion2 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap2 = QueryGenerator.initQueryWrapper(awardPersion2, req.getParameterMap()); QueryWrapper<AwardPersion> queryWrapperap2 = QueryGenerator.initQueryWrapper(awardPersion2, req.getParameterMap());
queryWrapperap2.eq("awardsort",2); queryWrapperap2.eq("awardsort",2);
queryWrapperap2.eq("studentcode",user.getUsername());
queryWrapperap2.in(bmbhs.size()!=0,"enroll_code",bmbhs); queryWrapperap2.in(bmbhs.size()!=0,"enroll_code",bmbhs);
List<AwardPersion> list2 = awardPersionService.list(queryWrapperap2); List<AwardPersion> list2 = awardPersionService.list(queryWrapperap2);
map.put("edjNumber",list2.size()); map.put("edjNumber",list2.size());
//三等奖人数 //三等奖数
AwardPersion awardPersion3 = new AwardPersion(); AwardPersion awardPersion3 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap3 = QueryGenerator.initQueryWrapper(awardPersion3, req.getParameterMap()); QueryWrapper<AwardPersion> queryWrapperap3 = QueryGenerator.initQueryWrapper(awardPersion3, req.getParameterMap());
queryWrapperap3.eq("awardsort",3); queryWrapperap3.eq("awardsort",3);
queryWrapperap3.eq("studentcode",user.getUsername());
queryWrapperap3.in(bmbhs.size()!=0,"enroll_code",bmbhs); queryWrapperap3.in(bmbhs.size()!=0,"enroll_code",bmbhs);
List<AwardPersion> list3 = awardPersionService.list(queryWrapperap3); List<AwardPersion> list3 = awardPersionService.list(queryWrapperap3);
map.put("sdjNumber",list3.size()); map.put("sdjNumber",list3.size());
//四等奖人数 //四等奖数
AwardPersion awardPersion4 = new AwardPersion(); AwardPersion awardPersion4 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap4 = QueryGenerator.initQueryWrapper(awardPersion4, req.getParameterMap()); QueryWrapper<AwardPersion> queryWrapperap4 = QueryGenerator.initQueryWrapper(awardPersion4, req.getParameterMap());
queryWrapperap4.eq("awardsort",4); queryWrapperap4.eq("awardsort",4);
queryWrapperap4.eq("studentcode",user.getUsername());
queryWrapperap4.in(bmbhs.size()!=0,"enroll_code",bmbhs); queryWrapperap4.in(bmbhs.size()!=0,"enroll_code",bmbhs);
List<AwardPersion> list4 = awardPersionService.list(queryWrapperap4); List<AwardPersion> list4 = awardPersionService.list(queryWrapperap4);
map.put("sidjNumber",list4.size()); map.put("sidjNumber",list4.size());
//五等奖人数 //五等奖数
AwardPersion awardPersion5 = new AwardPersion(); AwardPersion awardPersion5 = new AwardPersion();
QueryWrapper<AwardPersion> queryWrapperap5 = QueryGenerator.initQueryWrapper(awardPersion5, req.getParameterMap()); QueryWrapper<AwardPersion> queryWrapperap5 = QueryGenerator.initQueryWrapper(awardPersion5, req.getParameterMap());
queryWrapperap5.eq("awardsort",5); queryWrapperap5.eq("awardsort",5);
queryWrapperap5.eq("studentcode",user.getUsername());
queryWrapperap5.in(bmbhs.size()!=0,"enroll_code",bmbhs); queryWrapperap5.in(bmbhs.size()!=0,"enroll_code",bmbhs);
List<AwardPersion> list5 = awardPersionService.list(queryWrapperap5); List<AwardPersion> list5 = awardPersionService.list(queryWrapperap5);
map.put("wdjNumber",list5.size()); map.put("wdjNumber",list5.size());
} //所有奖项(前六条)
//参赛院系用到的list AwardPersion awardPersionAll = new AwardPersion();
List<TeamManagement> listcs= new ArrayList<>(); QueryWrapper<AwardPersion> queryWrapperapAll = QueryGenerator.initQueryWrapper(awardPersionAll, req.getParameterMap());
//个人赛人数 queryWrapperapAll.eq("studentcode",user.getUsername());
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration1 = new AnnualCompetitionProjectRegistration(); queryWrapperapAll.in(bmbhs.size()!=0,"enroll_code",bmbhs);
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm1 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration1, req.getParameterMap()); List<AwardPersion> listAll = awardPersionService.list(queryWrapperapAll);
queryWrapperbm1.in(acpIds.size()!=0,"annual_compid",acpIds); List<Map<String,Object>> allApListMap = new ArrayList<>();
queryWrapperbm1.eq("enroll_static", "2"); if(listAll.size()>6){
queryWrapperbm1.eq("entry_format", "0"); for (int y = 0 ; y < 6; y++){
List<AnnualCompetitionProjectRegistration> listbm1 = annualCompetitionProjectRegistrationService.list(queryWrapperbm1); Map<String, Object> mapall1 = new HashMap<>();
if(listbm1.size()==0){ mapall1.put("jxname",listAll.get(y).getAwardname());
map.put("grsNumber",0); mapall1.put("ndbs",annualCompService.getById(listAll.get(y).getAnnalComp()).getName());
}else { mapall1.put("ndbsxm",annualCompPointService.getById(listAll.get(y).getAnnualCompP()).getObjName());
TeamManagement teamManagement = new TeamManagement(); QueryWrapper<PersonalCompScore> queryWrapperpcs = new QueryWrapper<>();
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap()); queryWrapperpcs.eq("annual_comp_id",listAll.get(y).getAnnalComp());
List<String> bmbhs = listbm1.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList()); queryWrapperpcs.eq("annual_comp_p",listAll.get(y).getAnnualCompP());
queryWrappertm.in(bmbhs.size()!=0,"enroll_code",bmbhs); queryWrapperpcs.eq("work_on",user.getUsername());
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm); List<PersonalCompScore> listpcs = personalCompScoreService.list(queryWrapperpcs);
map.put("grsNumber",listtm.size()); if(listpcs.size()==0){
listcs.addAll(listtm); mapall1.put("jf",0);
} }else {
//团队赛人数 mapall1.put("jf",listpcs.get(0).getScore());
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration2 = new AnnualCompetitionProjectRegistration(); }
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapperbm2 = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration2, req.getParameterMap()); allApListMap.add(mapall1);
queryWrapperbm2.in(acpIds.size()!=0,"annual_compid",acpIds);
queryWrapperbm2.eq("enroll_static", "2");
queryWrapperbm2.eq("entry_format", "1");
List<AnnualCompetitionProjectRegistration> listbm2 = annualCompetitionProjectRegistrationService.list(queryWrapperbm2);
if(listbm2.size()==0){
map.put("tdsNumber",0);
}else {
TeamManagement teamManagement = new TeamManagement();
QueryWrapper<TeamManagement> queryWrappertm = QueryGenerator.initQueryWrapper(teamManagement, req.getParameterMap());
List<String> bmbhs = listbm2.stream().map(AnnualCompetitionProjectRegistration::getEnrollCode).collect(Collectors.toList());
queryWrappertm.in(bmbhs.size()!=0,"enroll_code",bmbhs);
List<TeamManagement> listtm = teamManagementService.list(queryWrappertm);
map.put("tdsNumber",listtm.size());
//查只是队长的用户id
queryWrappertm.eq("captain","1");
List<TeamManagement> listdz = teamManagementService.list(queryWrappertm);
listcs.addAll(listdz);
}
//参赛院系人数排名(只取前六条)
if(listcs.size()==0){
map.put("csyxbmpm",new ArrayList<>());
map.put("bmxsxxList",new ArrayList<>());
}else {
//拿到所有的userid
List<String> userIds = listcs.stream().map(TeamManagement::getUserId).collect(Collectors.toList());
QueryWrapper<SysUserDepart> queryWrappersud = new QueryWrapper<>();
queryWrappersud.select("dep_id,COUNT(*) as user_id");
queryWrappersud.in("user_id",userIds);
queryWrappersud.groupBy("dep_id");
queryWrappersud.orderByDesc("COUNT(*)");
List<SysUserDepart> listsud = sysUserDepartService.list(queryWrappersud);
List<Map<String,Object>> csyxpmListMap = new ArrayList<>();
if(listsud.size()>6){
for (int o = 0 ; o < 6 ; o++){
Map<String, Object> map2 = new HashMap<>();
map2.put("pm",o+1);
map2.put("csyxid",listsud.get(o).getDepId());
SysDepart depart = sysDepartService.query().eq("id", listsud.get(o).getDepId()).one();
map2.put("csyxname",depart.getDepartName());
map2.put("bms",listsud.get(o).getUserId());
csyxpmListMap.add(map2);
}
map.put("csyxbmpm",csyxpmListMap);
}else {
for (int u = 0 ; u <listsud.size() ; u++){
Map<String, Object> map3 = new HashMap<>();
map3.put("pm",u+1);
map3.put("csyxid",listsud.get(u).getDepId());
SysDepart depart = sysDepartService.query().eq("id", listsud.get(u).getDepId()).one();
map3.put("csyxname",depart.getDepartName());
map3.put("bms",listsud.get(u).getUserId());
csyxpmListMap.add(map3);
}
map.put("csyxbmpm",csyxpmListMap);
}
//报名学生列表(只取前六条)
//根据userIds查询出六个学生信息
List<Map<String,Object>> bmxsxxListMap = new ArrayList<>();
if(userIds.size()>6){
for (int p = 0 ; p < 6 ; p++){
List<SysUserDepart> userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(p)).list();
SysUser sysUser = sysUserService.query().eq("id", userIds.get(p)).one();
SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one();
Map<String, Object> map4 = new HashMap<>();
map4.put("name",sysUser.getRealname());
map4.put("xh",sysUser.getUsername());
map4.put("szyx",depart.getDepartName());
bmxsxxListMap.add(map4);
} }
map.put("bmxsxxList",bmxsxxListMap); }else{
}else { for (int n = 0 ; n < listAll.size(); n++){
for (int a = 0 ; a < userIds.size() ; a++){ Map<String, Object> mapall2 = new HashMap<>();
List<SysUserDepart> userDeparts = sysUserDepartService.query().eq("user_id", userIds.get(a)).list(); mapall2.put("jxname",listAll.get(n).getAwardname());
SysUser sysUser = sysUserService.query().eq("id", userIds.get(a)).one(); mapall2.put("ndbs",annualCompService.getById(listAll.get(n).getAnnalComp()).getName());
SysDepart depart = sysDepartService.query().eq("id", userDeparts.get(0).getDepId()).one(); mapall2.put("ndbsxm",annualCompPointService.getById(listAll.get(n).getAnnualCompP()).getObjName());
Map<String, Object> map5 = new HashMap<>(); QueryWrapper<PersonalCompScore> queryWrapperpcs = new QueryWrapper<>();
map5.put("name",sysUser.getRealname()); queryWrapperpcs.eq("annual_comp_id",listAll.get(n).getAnnalComp());
map5.put("xh",sysUser.getUsername()); queryWrapperpcs.eq("annual_comp_p",listAll.get(n).getAnnualCompP());
map5.put("szyx",depart.getDepartName()); queryWrapperpcs.eq("work_on",user.getUsername());
bmxsxxListMap.add(map5); List<PersonalCompScore> listpcs = personalCompScoreService.list(queryWrapperpcs);
if(listpcs.size()==0){
mapall2.put("jf",0);
}else {
mapall2.put("jf",listpcs.get(0).getScore());
}
allApListMap.add(mapall2);
} }
map.put("bmxsxxList",bmxsxxListMap);
} }
map.put("allApList",allApListMap);
}
if(map.isEmpty()){
return Result.error("无可用的比赛项目");
} }
return Result.OK(map); return Result.OK(map);
} }

@ -221,37 +221,17 @@ 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){ for (int l = 0 ; l < listtm.size() ; l++){
TeamManagement teamManagement1 = new TeamManagement(); SysUser sysUser = sysUserService.getById(listtm.get(l).getUserId());
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());
awardPersion.setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode());
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());
awardPersion.setStudentname(sysUser.getRealname()); awardPersion.setStudentname(sysUser.getRealname());
awardPersion.setStudentcode(sysUser.getUsername()); awardPersion.setStudentcode(sysUser.getUsername());
awardPersion.setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode()); awardPersion.setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode());
awardPersionService.save(awardPersion); awardPersionService.save(awardPersion);
AnnualCompPoint annualCompPoint = annualCompPointService.getById(awardPersion.getAnnualCompP());
annualCompPoint.setIsPj(1);
annualCompPointService.updateById(annualCompPoint);
return Result.OK("添加成功!");
/* SysUserDepart sysUserDepart = new SysUserDepart(null,null);
QueryWrapper<SysUserDepart> queryWrappersud = QueryGenerator.initQueryWrapper(sysUserDepart, req.getParameterMap());
queryWrappersud.eq("user_id",sysUser.getId());
awardPersion.setStudentorg(sysDepartService.getById(sysUserDepartService.getOne(queryWrappersud).getDepId()).getOrgCode());*/
} }
AnnualCompPoint annualCompPoint = annualCompPointService.getById(awardPersion.getAnnualCompP());
annualCompPoint.setIsPj(1);
annualCompPointService.updateById(annualCompPoint);
return Result.OK("添加成功!");
} }
} }
@ -267,7 +247,7 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
//@RequiresPermissions("awardpersion:award_persion:edit") //@RequiresPermissions("awardpersion:award_persion:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody AwardPersion awardPersion,HttpServletRequest req) { public Result<String> edit(@RequestBody AwardPersion awardPersion,HttpServletRequest req) {
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); /* AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration();
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrappera = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrappera = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
queryWrappera.eq("annual_compid",awardPersion.getAnnualCompP()); queryWrappera.eq("annual_compid",awardPersion.getAnnualCompP());
queryWrappera.eq("enroll_static","2"); queryWrappera.eq("enroll_static","2");
@ -306,7 +286,10 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
} }*/
awardPersionService.updateById(awardPersion);
return Result.OK("编辑成功!");
} }
@ -500,6 +483,7 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
params.setNeedSave(true); params.setNeedSave(true);
try { try {
List<AwardPersion> list = ExcelImportUtil.importExcel(file.getInputStream(), AwardPersion.class, params); List<AwardPersion> list = ExcelImportUtil.importExcel(file.getInputStream(), AwardPersion.class, params);
List<AwardPersion> listsave = new ArrayList<>();
for(int i = 0 ; i < list.size() ; i++){ for(int i = 0 ; i < list.size() ; i++){
AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration(); AnnualCompetitionProjectRegistration annualCompetitionProjectRegistration = new AnnualCompetitionProjectRegistration();
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrappera = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, request.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrappera = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, request.getParameterMap());
@ -525,71 +509,39 @@ 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);
if(listtm.size()>1){ for (int l = 0 ; l < listtm.size() ; l++){
TeamManagement teamManagement1 = new TeamManagement(); SysUser sysUser = sysUserService.getById(listtm.get(l).getUserId());
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());
list.get(i).setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode());
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)+"行奖项名称不存在");
}
}else {
SysUser sysUser = sysUserService.getById(listtm.get(0).getUserId());
list.get(i).setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode()); list.get(i).setStudentorg(sysDepartService.queryDepartsByUsername(sysUser.getUsername()).get(0).getOrgCode());
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());
list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname()); list.get(i).setStudentname(sysUser.getRealname());
listsave.add(list.get(i));
}else if(listaca.get(0).getSecondPrize().equals(list.get(i).getAwardname())){ }else if(listaca.get(0).getSecondPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(2); list.get(i).setAwardsort(2);
list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname()); list.get(i).setStudentname(sysUser.getRealname());
listsave.add(list.get(i));
}else if(listaca.get(0).getThirdPrize().equals(list.get(i).getAwardname())){ }else if(listaca.get(0).getThirdPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(3); list.get(i).setAwardsort(3);
list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname()); list.get(i).setStudentname(sysUser.getRealname());
listsave.add(list.get(i));
}else if(listaca.get(0).getFourthPrize().equals(list.get(i).getAwardname())){ }else if(listaca.get(0).getFourthPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(4); list.get(i).setAwardsort(4);
list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname()); list.get(i).setStudentname(sysUser.getRealname());
listsave.add(list.get(i));
}else if(listaca.get(0).getFifthPrize().equals(list.get(i).getAwardname())){ }else if(listaca.get(0).getFifthPrize().equals(list.get(i).getAwardname())){
list.get(i).setAwardsort(5); list.get(i).setAwardsort(5);
list.get(i).setAwardid(listaca.get(0).getId()); list.get(i).setAwardid(listaca.get(0).getId());
list.get(i).setStudentcode(sysUser.getUsername()); list.get(i).setStudentcode(sysUser.getUsername());
list.get(i).setStudentname(sysUser.getRealname()); list.get(i).setStudentname(sysUser.getRealname());
listsave.add(list.get(i));
}else { }else {
return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在"); return Result.error("文件导入失败:第"+(i+1)+"行奖项名称不存在");
} }
@ -597,7 +549,7 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
} }
//update-begin-author:taoyan date:20190528 for:批量插入数据 //update-begin-author:taoyan date:20190528 for:批量插入数据
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
awardPersionService.saveBatch(list); awardPersionService.saveBatch(listsave);
for (int k = 0 ; k < list.size() ; k++){ for (int k = 0 ; k < list.size() ; k++){
AnnualCompPoint annualCompPoint = annualCompPointService.getById(list.get(k).getAnnualCompP()); AnnualCompPoint annualCompPoint = annualCompPointService.getById(list.get(k).getAnnualCompP());
annualCompPoint.setIsPj(1); annualCompPoint.setIsPj(1);

@ -4,36 +4,38 @@
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="年度" v-bind="validateInfos.annualid"> <a-form-item label="年度" v-bind="validateInfos.annualid">
<j-dict-select-tag v-model:value="formData.annualid" dictCode="annual,annual_name,id" placeholder="请选择年度" :disabled="disabled"/> <j-dict-select-tag v-model:value="formData.annualid" dictCode="annual,annual_name,id" placeholder="请选择年度"
:disabled="disabled || isT" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="年度比赛" v-bind="validateInfos.annalComp"> <a-form-item label="年度比赛" v-bind="validateInfos.annalComp">
<j-search-select v-model:value="formData.annalComp" :dict="strst" :disabled="disabled" /> <j-search-select v-model:value="formData.annalComp" :dict="strst" :disabled="disabled || isT" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="年度比赛项目" v-bind="validateInfos.annualCompP"> <a-form-item label="年度比赛项目" v-bind="validateInfos.annualCompP">
<j-search-select v-model:value="formData.annualCompP" :dict="ndbsxm" :disabled="disabled" /> <j-search-select v-model:value="formData.annualCompP" :dict="ndbsxm" :disabled="disabled || isT" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="报名编号" v-bind="validateInfos.enrollCode"> <a-form-item label="报名编号" v-bind="validateInfos.enrollCode">
<a-input v-model:value="formData.enrollCode" placeholder="请输入报名编号" :disabled="disabled"></a-input> <a-input v-model:value="formData.enrollCode" placeholder="请输入报名编号" :disabled="disabled || isT"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="奖项名称" v-bind="validateInfos.awardname"> <a-form-item label="奖项名称" v-bind="validateInfos.awardname">
<j-dict-select-tag v-model:value="formData.awardname" dictCode="" :options="options" placeholder="请选择奖项名称" :disabled="disabled"/> <j-dict-select-tag v-model:value="formData.awardname" dictCode="" :options="options" placeholder="请选择奖项名称"
:disabled="disabled" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<!-- <a-col :span="24"> <!-- <a-col :span="24">
<a-form-item label="状态" v-bind="validateInfos.status"> <a-form-item label="状态" v-bind="validateInfos.status">
<j-dict-select-tag v-model:value="formData.status" dictCode="sh_status" placeholder="请选择状态" :disabled="disabled"/> <j-dict-select-tag v-model:value="formData.status" dictCode="sh_status" placeholder="请选择状态" :disabled="disabled"/>
</a-form-item> </a-form-item>
</a-col>--> </a-col>-->
<a-input v-model:value="formData.awardsort" hidden/> <a-input v-model:value="formData.awardsort" hidden />
<!-- <a-col :span="24"> <!-- <a-col :span="24">
<a-form-item label="奖项" v-bind="validateInfos.awardid"> <a-form-item label="奖项" v-bind="validateInfos.awardid">
<a-input v-model:value="formData.awardid" placeholder="请输入奖项" :disabled="disabled"></a-input> <a-input v-model:value="formData.awardid" placeholder="请输入奖项" :disabled="disabled"></a-input>
</a-form-item> </a-form-item>
@ -44,174 +46,182 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted,watch } from 'vue'; import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, watch } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
import { getValueType } from '/@/utils'; import { getValueType } from '/@/utils';
import { saveOrUpdate,queryCompId,queryOptions } from '../AwardPersion.api'; import { saveOrUpdate, queryCompId, queryOptions } from '../AwardPersion.api';
import { Form } from 'ant-design-vue'; import { Form } from 'ant-design-vue';
import { duplicateValidate } from '/@/utils/helper/validator' import { duplicateValidate } from '/@/utils/helper/validator'
let strst = ref(); let strst = ref();
let ndbsxm = ref(); let ndbsxm = ref();
let options= ref(); let options = ref();
const props = defineProps({ const props = defineProps({
formDisabled: { type: Boolean, default: false }, formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: ()=>{} }, formData: { type: Object, default: () => { } },
formBpm: { type: Boolean, default: true } formBpm: { type: Boolean, default: true }
}); });
const formRef = ref(); const formRef = ref();
const useForm = Form.useForm; const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']); const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({
id: '', id: '',
annualid: '', annualid: '',
annalComp: '', annalComp: '',
annualCompP: '', annualCompP: '',
enrollCode: '', enrollCode: '',
awardname: '', awardname: '',
status: undefined, status: undefined,
awardsort: undefined, awardsort: undefined,
awardid: '', awardid: '',
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false); const confirmLoading = ref<boolean>(false);
// //
const validatorRules = { const validatorRules = {
annualid: [{ required: true, message: '请输入年度!'},], annualid: [{ required: true, message: '请输入年度!' },],
annalComp: [{ required: true, message: '请输入年度比赛!'},], annalComp: [{ required: true, message: '请输入年度比赛!' },],
annualCompP: [{ required: true, message: '请输入年度比赛项目!'},], annualCompP: [{ required: true, message: '请输入年度比赛项目!' },],
enrollCode: [{ required: true, message: '请输入报名编号!'}, { validator: enrollCodeDuplicatevalidate }], enrollCode: [{ required: true, message: '请输入报名编号!' }, { validator: enrollCodeDuplicatevalidate }],
awardname: [{ required: true, message: '请输入奖项名称!'},], awardname: [{ required: true, message: '请输入奖项名称!' },],
}; };
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
// //
const disabled = computed(()=>{ const disabled = computed(() => {
if(props.formBpm === true){ if (props.formBpm === true) {
if(props.formData.disabled === false){ if (props.formData.disabled === false) {
return false; return false;
}else{ } else {
return true; return true;
}
} }
return props.formDisabled; }
}); return props.formDisabled;
watch(formData, (newVal) => { });
if(formData.annualid==null||formData.annualid==""){ watch(formData, (newVal) => {
if (formData.annualid == null || formData.annualid == "") {
}else{ } else {
queryCompId("").then((result)=>{ queryCompId("").then((result) => {
//console.log(result); //console.log(result);
const str = result; const str = result;
if (str!=null&&str!="") { if (str != null && str != "") {
//const ndbs = "annual_comp,name,id,annualid='1691982939857920001' and (compid='1696134761153875969' or compid='1697137689830363138')"; //const ndbs = "annual_comp,name,id,annualid='1691982939857920001' and (compid='1696134761153875969' or compid='1697137689830363138')";
var ndbsstr="annual_comp,name,id,annualid='"+formData.annualid+"' and "+"("+str+")"; var ndbsstr = "annual_comp,name,id,annualid='" + formData.annualid + "' and " + "(" + str + ")";
strst.value=ndbsstr; strst.value = ndbsstr;
} }
}); });
} }
if(formData.annalComp!=""){ if (formData.annalComp != "") {
ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='"+formData.annalComp+"'"; ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='" + formData.annalComp + "'";
} }
if(formData.annualCompP!=""&&formData.annualCompP!=null&&formData.annualCompP!=undefined){ if (formData.annualCompP != "" && formData.annualCompP != null && formData.annualCompP != undefined) {
queryOptions({annucompid:formData.annualCompP}).then((result)=>{ queryOptions({ annucompid: formData.annualCompP }).then((result) => {
//console.log(result); //console.log(result);
if (result!=null&&result!=""&&result!=undefined) { if (result != null && result != "" && result != undefined) {
options.value = result; options.value = result;
if(formData.awardname!=""&&formData.awardname!=null&&formData.awardname!=undefined){ if (formData.awardname != "" && formData.awardname != null && formData.awardname != undefined) {
if(formData.awardname==1||formData.awardname==2||formData.awardname==3||formData.awardname==4||formData.awardname==5){ if (formData.awardname == 1 || formData.awardname == 2 || formData.awardname == 3 || formData.awardname == 4 || formData.awardname == 5) {
formData.awardsort = result[formData.awardname-1].label; formData.awardsort = result[formData.awardname - 1].label;
}
}
} }
}); }
} }
}); });
}
});
/**
* 特定的禁用
*/
let isT = ref(false)
function setIsT(bool=false){
isT.value=bool
}
/** /**
* 新增 * 新增
*/ */
function add() { function add() {
edit({}); edit({});
} }
/** /**
* 编辑 * 编辑
*/ */
function edit(record) { function edit(record) {
nextTick(() => { nextTick(() => {
resetFields(); resetFields();
// //
Object.assign(formData, record); Object.assign(formData, record);
}); });
} }
/** /**
* 提交数据 * 提交数据
*/ */
async function submitForm() { async function submitForm() {
// //
await validate(); await validate();
confirmLoading.value = true; confirmLoading.value = true;
const isUpdate = ref<boolean>(false); const isUpdate = ref<boolean>(false);
// //
let model = formData; let model = formData;
if(model.awardname==1||model.awardname==2||model.awardname==3||model.awardname==4||model.awardname==5){ if (model.awardname == 1 || model.awardname == 2 || model.awardname == 3 || model.awardname == 4 || model.awardname == 5) {
let awardsort = model.awardname; let awardsort = model.awardname;
let awardname = model.awardsort; let awardname = model.awardsort;
model.awardname = awardname; model.awardname = awardname;
model.awardsort = awardsort; model.awardsort = awardsort;
} }
if (model.id) { if (model.id) {
isUpdate.value = true; isUpdate.value = true;
} }
// //
for (let data in model) { for (let data in model) {
// //
if (model[data] instanceof Array) { if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data); let valueType = getValueType(formRef.value.getProps, data);
// //
if (valueType === 'string') { if (valueType === 'string') {
model[data] = model[data].join(','); model[data] = model[data].join(',');
}
} }
} }
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
} }
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
async function enrollCodeDuplicatevalidate(_r, value) { async function enrollCodeDuplicatevalidate(_r, value) {
return duplicateValidate('award_persion', 'enroll_code', value, formData.id || '') return duplicateValidate('award_persion', 'enroll_code', value, formData.id || '')
} }
defineExpose({ defineExpose({
add, add,
edit, edit,
submitForm, submitForm,
}); setIsT
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.antd-modal-form { .antd-modal-form {
min-height: 500px !important; min-height: 500px !important;
overflow-y: auto; overflow-y: auto;
padding: 24px 24px 24px 24px; padding: 24px 24px 24px 24px;
} }
</style> </style>

@ -35,6 +35,7 @@
visible.value = true; visible.value = true;
nextTick(() => { nextTick(() => {
registerForm.value.edit(record); registerForm.value.edit(record);
registerForm.value.setIsT(true);
}); });
} }

Loading…
Cancel
Save