1、比赛项目问题修改 11.22

main
zhc077 1 year ago
parent c2371a16ec
commit 004424b230
  1. 844
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/controller/AnnualCompController.java
  2. 151
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/entity/AnnualComp.java
  3. 381
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompaward/controller/AnnualCompAwardController.java
  4. 191
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompaward/entity/AnnualCompAward.java
  5. 17
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java
  6. 504
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/comp/controller/CompController.java
  7. 132
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/comp/entity/Comp.java
  8. 400
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java
  9. 127
      jeecgboot-vue3-master/src/views/annualcompaward/AnnualCompAward.data.ts

@ -1,450 +1,466 @@
package org.jeecg.modules.demo.annualcomp.controller; package org.jeecg.modules.demo.annualcomp.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.demo.annual.entity.Annual; import org.jeecg.modules.demo.annual.entity.Annual;
import org.jeecg.modules.demo.annual.service.IAnnualService; import org.jeecg.modules.demo.annual.service.IAnnualService;
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.demo.annualcomp.vo.AnnualCompVo; import org.jeecg.modules.demo.annualcomp.vo.AnnualCompVo;
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.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/** import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description: 年度比赛管理 * @Description: 年度比赛管理
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-17 * @Date: 2023-08-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="年度比赛管理") @Api(tags = "年度比赛管理")
@RestController @RestController
@RequestMapping("/annualcomp/annualComp") @RequestMapping("/annualcomp/annualComp")
@Slf4j @Slf4j
public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCompService> { public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCompService> {
@Autowired @Autowired
private IAnnualCompService annualCompService; private IAnnualCompService annualCompService;
@Autowired @Autowired
private IAnnualService annualService; private IAnnualService annualService;
@Autowired @Autowired
private ICompService compService; private ICompService compService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param annualComp * @param annualComp
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @param req * @param req
* @return * @return
*/ */
//@AutoLog(value = "年度比赛管理-分页列表查询") //@AutoLog(value = "年度比赛管理-分页列表查询")
@ApiOperation(value="年度比赛管理-分页列表查询", notes="年度比赛管理-分页列表查询") @ApiOperation(value = "年度比赛管理-分页列表查询", notes = "年度比赛管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<IPage<AnnualCompVo>> queryPageList(AnnualCompVo annualComp, public Result<IPage<AnnualCompVo>> queryPageList(AnnualCompVo annualComp,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
// QueryWrapper<AnnualComp> queryWrapper = QueryGenerator.initQueryWrapper(annualComp, req.getParameterMap()); // QueryWrapper<AnnualComp> queryWrapper = QueryGenerator.initQueryWrapper(annualComp, req.getParameterMap());
// Page<AnnualComp> page = new Page<AnnualComp>(pageNo, pageSize); // Page<AnnualComp> page = new Page<AnnualComp>(pageNo, pageSize);
// IPage<AnnualComp> pageList = annualCompService.page(page, queryWrapper); // IPage<AnnualComp> pageList = annualCompService.page(page, queryWrapper);
String compname = annualComp.getCompname();
String compId = null;
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(Comp::getCompName,compname);
Comp serviceOne = compService.getOne(queryWrapper1);
if (serviceOne != null){
compId = serviceOne.getId();
}
Page<AnnualComp> page = new Page<>(pageNo, pageSize);
Page<AnnualCompVo> pageInfo = new Page<>();
LambdaQueryWrapper<AnnualComp> queryWrapper = new LambdaQueryWrapper();
if (compId != null){
queryWrapper.eq(AnnualComp::getCompid,compId);
}
if (annualComp.getAnnualid() != null){
queryWrapper.eq(AnnualComp::getAnnualid,annualComp.getAnnualid());
}
if (annualComp.getName() != null){
queryWrapper.eq(AnnualComp::getName,annualComp.getName());
}
queryWrapper.orderByDesc(AnnualComp::getCreateTime);
annualCompService.page(page,queryWrapper);
BeanUtils.copyProperties(page,pageInfo,"records");
List<AnnualComp> records = page.getRecords();
List<AnnualCompVo> list = records.stream().map((item)->{
AnnualCompVo annualCompVo = new AnnualCompVo();
BeanUtils.copyProperties(item,annualCompVo);
String state = item.getState();
switch (state){
case "0":annualCompVo.setState_dictText("待提交");break;
case "1":annualCompVo.setState_dictText("已提交");break;
case "2":annualCompVo.setState_dictText("已审核");break;
case "3":annualCompVo.setState_dictText("已驳回");break;
}
String compid = item.getCompid();
Comp comp = compService.getById(compid);
annualCompVo.setCompname(comp.getCompName());
String annualid = item.getAnnualid();
Annual annual = annualService.getById(annualid);
annualCompVo.setAnnualname(annual.getAnnualName());
return annualCompVo;
}).collect(Collectors.toList());
pageInfo.setRecords(list);
return Result.OK(pageInfo);
}
@ApiOperation(value="年度比赛管理-未审核-分页列表查询", notes="年度比赛管理-未审核-分页列表查询")
@GetMapping(value = "/submittedlist")
public Result<IPage<AnnualCompVo>> queryPagesubmittedList(AnnualCompVo annualCompVo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
String state = "1";
return getiPageResult(pageNo, pageSize,state,annualCompVo);
}
@ApiOperation(value="年度比赛管理-已审核-分页列表查询", notes="年度比赛管理-已审核-分页列表查询")
@GetMapping(value = "/auditedlist")
public Result<IPage<AnnualCompVo>> queryPageauditedList(AnnualCompVo annualCompVo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
String state = "2";
return getiPageResult(pageNo, pageSize,state,annualCompVo);
}
@ApiOperation(value="年度比赛管理-已驳回-分页列表查询", notes="年度比赛管理-已驳回-分页列表查询")
@GetMapping(value = "/rejectedlist")
public Result<IPage<AnnualCompVo>> queryPagerejectedList(AnnualCompVo annualCompVo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
String state = "3";
return getiPageResult(pageNo, pageSize,state,annualCompVo);
}
@ApiOperation(value="年度比赛管理-学校/学生-分页列表查询", notes="年度比赛管理-学校/学生-分页列表查询")
@GetMapping(value = "/schoollist")
public Result<IPage<AnnualCompVo>> queryPagereschoollist(AnnualCompVo annualComp,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
String compname = annualComp.getCompname();
String compId = null;
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(Comp::getCompName,compname);
Comp serviceOne = compService.getOne(queryWrapper1);
if (serviceOne != null){
compId = serviceOne.getId();
}
Page<AnnualComp> page = new Page<>(pageNo, pageSize);
Page<AnnualCompVo> pageInfo = new Page<>();
LambdaQueryWrapper<AnnualComp> queryWrapper = new LambdaQueryWrapper<>();
if (compId != null){
queryWrapper.eq(AnnualComp::getCompid,compId);
}
if (annualComp.getAnnualid() != null){
queryWrapper.eq(AnnualComp::getAnnualid,annualComp.getAnnualid());
}
if (annualComp.getName() != null){
queryWrapper.eq(AnnualComp::getName,annualComp.getName());
}
queryWrapper.orderByDesc(AnnualComp::getCreateTime);
queryWrapper.eq(AnnualComp::getState,"2");
queryWrapper.eq(AnnualComp::getIsopen,"1");
annualCompService.page(page, queryWrapper);
BeanUtils.copyProperties(page,pageInfo,"records");
List<AnnualComp> records = page.getRecords();
List<AnnualCompVo> list = records.stream().map((item)->{
AnnualCompVo annualCompVo = new AnnualCompVo();
BeanUtils.copyProperties(item,annualCompVo);
String compid = item.getCompid();
Comp comp = compService.getById(compid);
annualCompVo.setCompname(comp.getCompName());
String annualid = item.getAnnualid();
Annual annual = annualService.getById(annualid);
annualCompVo.setAnnualname(annual.getAnnualName());
return annualCompVo;
}).collect(Collectors.toList());
pageInfo.setRecords(list);
return Result.OK(pageInfo);
}
@NotNull
private Result<IPage<AnnualCompVo>> getiPageResult(Integer pageNo, Integer pageSize, String mystate,AnnualCompVo annualComp) {
String compname = annualComp.getCompname();
String compId = null;
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(Comp::getCompName,compname);
Comp serviceOne = compService.getOne(queryWrapper1);
if (serviceOne != null){
compId = serviceOne.getId();
}
Page<AnnualComp> page = new Page<>(pageNo, pageSize);
Page<AnnualCompVo> pageInfo = new Page<>();
LambdaQueryWrapper<AnnualComp> queryWrapper = new LambdaQueryWrapper<>();
if (compId != null){
queryWrapper.eq(AnnualComp::getCompid,compId);
}
if (annualComp.getAnnualid() != null){
queryWrapper.eq(AnnualComp::getAnnualid,annualComp.getAnnualid());
}
if (annualComp.getName() != null){
queryWrapper.eq(AnnualComp::getName,annualComp.getName());
}
queryWrapper.eq(AnnualComp::getState,mystate);
queryWrapper.orderByDesc(AnnualComp::getCreateTime);
annualCompService.page(page, queryWrapper);
BeanUtils.copyProperties(page,pageInfo,"records");
List<AnnualComp> records = page.getRecords();
List<AnnualCompVo> list = records.stream().map((item)->{
AnnualCompVo annualCompVo = new AnnualCompVo();
BeanUtils.copyProperties(item,annualCompVo);
String compid = item.getCompid();
Comp comp = compService.getById(compid);
annualCompVo.setCompname(comp.getCompName());
String annualid = item.getAnnualid();
Annual annual = annualService.getById(annualid);
annualCompVo.setAnnualname(annual.getAnnualName());
return annualCompVo;
}).collect(Collectors.toList());
pageInfo.setRecords(list);
return Result.OK(pageInfo);
}
/** Subject subject = SecurityUtils.getSubject();
* 添加 // 获取当前登录用户
* LoginUser loginUser = (LoginUser) subject.getPrincipal();
* @param annualCompVo //角色名称 管理员&教务处可以查看所有
* @return String realname = loginUser.getRealname();
*/
@AutoLog(value = "年度比赛管理-添加")
@ApiOperation(value="年度比赛管理-添加", notes="年度比赛管理-添加")
//@RequiresPermissions("annualcomp:annual_comp:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody AnnualCompVo annualCompVo) {
long start = 0,end = 0;
if (annualCompVo.getStarttime() != null){
start = annualCompVo.getStarttime().getTime();
}
if (annualCompVo.getEndtime() != null){
end = annualCompVo.getEndtime().getTime();
}
if (start < end){
Result.error("开始时间不能小于结束时间");
}
String compname = annualCompVo.getCompname();
String annualname = annualCompVo.getAnnualname();
annualCompVo.setState("0");
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(Comp::getCompName,compname);
Comp comp = compService.getOne(queryWrapper1);
String compId = comp.getId();
annualCompVo.setCompid(compId);
//LambdaQueryWrapper<Annual> queryWrapper2 = new LambdaQueryWrapper<>();
//queryWrapper2.eq(Annual::getAnnualName,annualname);
//Annual annual = annualService.getOne(queryWrapper2);
//String annualId = annual.getId();
annualCompVo.setAnnualid(annualCompVo.getAnnualid());
annualCompService.save(annualCompVo);
return Result.OK("添加成功!");
}
/** String compname = annualComp.getCompname();
* 编辑 String compId = null;
* LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
* @param annualComp if (StringUtils.isNotBlank(compname)) {
* @return queryWrapper1.eq(Comp::getCompName, compname);
*/ }
@AutoLog(value = "年度比赛管理-编辑") if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) {
@ApiOperation(value="年度比赛管理-编辑", notes="年度比赛管理-编辑") } else {
//@RequiresPermissions("annualcomp:annual_comp:edit") queryWrapper1.eq(Comp::getCompAdmin, loginUser.getUsername());
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) }
public Result<String> edit(@RequestBody AnnualComp annualComp) { Comp serviceOne = compService.getOne(queryWrapper1);
if (annualComp.getBackinfo() != null && annualComp.getBackinfo() != ""){ if (serviceOne != null) {
annualComp.setState("3"); compId = serviceOne.getId();
annualCompService.updateById(annualComp); }
return Result.OK("驳回成功!"); Page<AnnualComp> page = new Page<>(pageNo, pageSize);
}else { Page<AnnualCompVo> pageInfo = new Page<>();
annualCompService.updateById(annualComp); LambdaQueryWrapper<AnnualComp> queryWrapper = new LambdaQueryWrapper();
return Result.OK("编辑成功!"); if (compId != null) {
} queryWrapper.eq(AnnualComp::getCompid, compId);
} }
if (annualComp.getAnnualid() != null) {
queryWrapper.eq(AnnualComp::getAnnualid, annualComp.getAnnualid());
}
if (annualComp.getName() != null) {
queryWrapper.eq(AnnualComp::getName, annualComp.getName());
}
queryWrapper.orderByDesc(AnnualComp::getCreateTime);
annualCompService.page(page, queryWrapper);
BeanUtils.copyProperties(page, pageInfo, "records");
List<AnnualComp> records = page.getRecords();
List<AnnualCompVo> list = records.stream().map((item) -> {
AnnualCompVo annualCompVo = new AnnualCompVo();
BeanUtils.copyProperties(item, annualCompVo);
String state = item.getState();
switch (state) {
case "0":
annualCompVo.setState_dictText("待提交");
break;
case "1":
annualCompVo.setState_dictText("已提交");
break;
case "2":
annualCompVo.setState_dictText("已审核");
break;
case "3":
annualCompVo.setState_dictText("已驳回");
break;
}
String compid = item.getCompid();
Comp comp = compService.getById(compid);
annualCompVo.setCompname(comp.getCompName());
String annualid = item.getAnnualid();
Annual annual = annualService.getById(annualid);
annualCompVo.setAnnualname(annual.getAnnualName());
return annualCompVo;
}).collect(Collectors.toList());
pageInfo.setRecords(list);
return Result.OK(pageInfo);
}
@AutoLog(value = "年度比赛管理-驳回") @ApiOperation(value = "年度比赛管理-未审核-分页列表查询", notes = "年度比赛管理-未审核-分页列表查询")
@ApiOperation(value="年度比赛管理-驳回", notes="年度比赛管理-驳回") @GetMapping(value = "/submittedlist")
//@RequiresPermissions("annualcomp:annual_comp:bohui") public Result<IPage<AnnualCompVo>> queryPagesubmittedList(AnnualCompVo annualCompVo,
@RequestMapping(value = "/bohui", method = {RequestMethod.PUT,RequestMethod.POST}) @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
public Result<String> bohui(@RequestBody AnnualComp annualComp) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
annualComp.setState("3"); HttpServletRequest req) {
annualCompService.updateById(annualComp); String state = "1";
return Result.OK("驳回成功!"); return getiPageResult(pageNo, pageSize, state, annualCompVo);
} }
/** @ApiOperation(value = "年度比赛管理-已审核-分页列表查询", notes = "年度比赛管理-已审核-分页列表查询")
* 通过 @GetMapping(value = "/auditedlist")
* public Result<IPage<AnnualCompVo>> queryPageauditedList(AnnualCompVo annualCompVo,
* @param id @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
* @return @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
*/ HttpServletRequest req) {
@AutoLog(value = "年度比赛管理-通过") String state = "2";
@ApiOperation(value="年度比赛管理-通过", notes="年度比赛管理-通过") return getiPageResult(pageNo, pageSize, state, annualCompVo);
@GetMapping(value = "/pass") }
public Result<String> pass(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setState("2");
annualComp.setIsopen("0");
annualCompService.updateById(annualComp);
return Result.OK("已通过!");
}
/**
* 驳回
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-驳回")
@ApiOperation(value="年度比赛管理-驳回", notes="年度比赛管理-驳回")
@GetMapping(value = "/unpass")
public Result<String> unpass(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setState("3");
annualCompService.updateById(annualComp);
return Result.OK("已驳回!");
}
/**
* 提交
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-提交")
@ApiOperation(value="年度比赛管理-提交", notes="年度比赛管理-提交")
@GetMapping(value = "/submit")
public Result<String> submit(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setState("1");
annualComp.setBackinfo("");
annualCompService.updateById(annualComp);
return Result.OK("已提交!");
}
/**
* 启用
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-启用")
@ApiOperation(value="年度比赛管理-启用", notes="年度比赛管理-启用")
@GetMapping(value = "/enable")
public Result<String> enable(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setIsopen("1");
annualCompService.updateById(annualComp);
return Result.OK("已启用!");
}
/**
* 停用
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-停用")
@ApiOperation(value="年度比赛管理-停用", notes="年度比赛管理-停用")
@GetMapping(value = "/deactivate")
public Result<String> deactivate(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setIsopen("0");
annualCompService.updateById(annualComp);
return Result.OK("已停用!");
}
/** @ApiOperation(value = "年度比赛管理-已驳回-分页列表查询", notes = "年度比赛管理-已驳回-分页列表查询")
* 通过id删除 @GetMapping(value = "/rejectedlist")
* public Result<IPage<AnnualCompVo>> queryPagerejectedList(AnnualCompVo annualCompVo,
* @param id @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
* @return @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
*/ HttpServletRequest req) {
@AutoLog(value = "年度比赛管理-通过id删除") String state = "3";
@ApiOperation(value="年度比赛管理-通过id删除", notes="年度比赛管理-通过id删除") return getiPageResult(pageNo, pageSize, state, annualCompVo);
//@RequiresPermissions("annualcomp:annual_comp:delete") }
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
annualCompService.removeById(id);
return Result.OK("删除成功!");
}
/** @ApiOperation(value = "年度比赛管理-学校/学生-分页列表查询", notes = "年度比赛管理-学校/学生-分页列表查询")
* 批量删除 @GetMapping(value = "/schoollist")
* public Result<IPage<AnnualCompVo>> queryPagereschoollist(AnnualCompVo annualComp,
* @param ids @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
* @return @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
*/ HttpServletRequest req) {
@AutoLog(value = "年度比赛管理-批量删除") String compname = annualComp.getCompname();
@ApiOperation(value="年度比赛管理-批量删除", notes="年度比赛管理-批量删除") String compId = null;
@RequiresPermissions("annualcomp:annual_comp:deleteBatch") LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
@DeleteMapping(value = "/deleteBatch") queryWrapper1.eq(Comp::getCompName, compname);
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { Comp serviceOne = compService.getOne(queryWrapper1);
this.annualCompService.removeByIds(Arrays.asList(ids.split(","))); if (serviceOne != null) {
return Result.OK("批量删除成功!"); compId = serviceOne.getId();
} }
Page<AnnualComp> page = new Page<>(pageNo, pageSize);
Page<AnnualCompVo> pageInfo = new Page<>();
LambdaQueryWrapper<AnnualComp> queryWrapper = new LambdaQueryWrapper<>();
if (compId != null) {
queryWrapper.eq(AnnualComp::getCompid, compId);
}
if (annualComp.getAnnualid() != null) {
queryWrapper.eq(AnnualComp::getAnnualid, annualComp.getAnnualid());
}
if (annualComp.getName() != null) {
queryWrapper.eq(AnnualComp::getName, annualComp.getName());
}
queryWrapper.orderByDesc(AnnualComp::getCreateTime);
queryWrapper.eq(AnnualComp::getState, "2");
queryWrapper.eq(AnnualComp::getIsopen, "1");
annualCompService.page(page, queryWrapper);
BeanUtils.copyProperties(page, pageInfo, "records");
List<AnnualComp> records = page.getRecords();
List<AnnualCompVo> list = records.stream().map((item) -> {
AnnualCompVo annualCompVo = new AnnualCompVo();
BeanUtils.copyProperties(item, annualCompVo);
String compid = item.getCompid();
Comp comp = compService.getById(compid);
annualCompVo.setCompname(comp.getCompName());
String annualid = item.getAnnualid();
Annual annual = annualService.getById(annualid);
annualCompVo.setAnnualname(annual.getAnnualName());
return annualCompVo;
}).collect(Collectors.toList());
pageInfo.setRecords(list);
return Result.OK(pageInfo);
}
@NotNull
private Result<IPage<AnnualCompVo>> getiPageResult(Integer pageNo, Integer pageSize, String mystate, AnnualCompVo annualComp) {
String compname = annualComp.getCompname();
String compId = null;
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(Comp::getCompName, compname);
Comp serviceOne = compService.getOne(queryWrapper1);
if (serviceOne != null) {
compId = serviceOne.getId();
}
Page<AnnualComp> page = new Page<>(pageNo, pageSize);
Page<AnnualCompVo> pageInfo = new Page<>();
LambdaQueryWrapper<AnnualComp> queryWrapper = new LambdaQueryWrapper<>();
if (compId != null) {
queryWrapper.eq(AnnualComp::getCompid, compId);
}
if (annualComp.getAnnualid() != null) {
queryWrapper.eq(AnnualComp::getAnnualid, annualComp.getAnnualid());
}
if (annualComp.getName() != null) {
queryWrapper.eq(AnnualComp::getName, annualComp.getName());
}
queryWrapper.eq(AnnualComp::getState, mystate);
queryWrapper.orderByDesc(AnnualComp::getCreateTime);
annualCompService.page(page, queryWrapper);
BeanUtils.copyProperties(page, pageInfo, "records");
List<AnnualComp> records = page.getRecords();
List<AnnualCompVo> list = records.stream().map((item) -> {
AnnualCompVo annualCompVo = new AnnualCompVo();
BeanUtils.copyProperties(item, annualCompVo);
String compid = item.getCompid();
Comp comp = compService.getById(compid);
annualCompVo.setCompname(comp.getCompName());
String annualid = item.getAnnualid();
Annual annual = annualService.getById(annualid);
annualCompVo.setAnnualname(annual.getAnnualName());
return annualCompVo;
}).collect(Collectors.toList());
pageInfo.setRecords(list);
return Result.OK(pageInfo);
}
/**
* 添加
*
* @param annualCompVo
* @return
*/
@AutoLog(value = "年度比赛管理-添加")
@ApiOperation(value = "年度比赛管理-添加", notes = "年度比赛管理-添加")
//@RequiresPermissions("annualcomp:annual_comp:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody AnnualCompVo annualCompVo) {
long start = 0, end = 0;
if (annualCompVo.getStarttime() != null) {
start = annualCompVo.getStarttime().getTime();
}
if (annualCompVo.getEndtime() != null) {
end = annualCompVo.getEndtime().getTime();
}
if (start < end) {
Result.error("开始时间不能小于结束时间");
}
String compname = annualCompVo.getCompname();
String annualname = annualCompVo.getAnnualname();
annualCompVo.setState("0");
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(Comp::getCompName, compname);
Comp comp = compService.getOne(queryWrapper1);
String compId = comp.getId();
annualCompVo.setCompid(compId);
//LambdaQueryWrapper<Annual> queryWrapper2 = new LambdaQueryWrapper<>();
//queryWrapper2.eq(Annual::getAnnualName,annualname);
//Annual annual = annualService.getOne(queryWrapper2);
//String annualId = annual.getId();
annualCompVo.setAnnualid(annualCompVo.getAnnualid());
annualCompService.save(annualCompVo);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param annualComp
* @return
*/
@AutoLog(value = "年度比赛管理-编辑")
@ApiOperation(value = "年度比赛管理-编辑", notes = "年度比赛管理-编辑")
//@RequiresPermissions("annualcomp:annual_comp:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody AnnualComp annualComp) {
if (annualComp.getBackinfo() != null && annualComp.getBackinfo() != "") {
annualComp.setState("3");
annualCompService.updateById(annualComp);
return Result.OK("驳回成功!");
} else {
annualCompService.updateById(annualComp);
return Result.OK("编辑成功!");
}
}
@AutoLog(value = "年度比赛管理-驳回")
@ApiOperation(value = "年度比赛管理-驳回", notes = "年度比赛管理-驳回")
//@RequiresPermissions("annualcomp:annual_comp:bohui")
@RequestMapping(value = "/bohui", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> bohui(@RequestBody AnnualComp annualComp) {
annualComp.setState("3");
annualCompService.updateById(annualComp);
return Result.OK("驳回成功!");
}
/**
* 通过
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-通过")
@ApiOperation(value = "年度比赛管理-通过", notes = "年度比赛管理-通过")
@GetMapping(value = "/pass")
public Result<String> pass(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setState("2");
annualComp.setIsopen("0");
annualCompService.updateById(annualComp);
return Result.OK("已通过!");
}
/**
* 驳回
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-驳回")
@ApiOperation(value = "年度比赛管理-驳回", notes = "年度比赛管理-驳回")
@GetMapping(value = "/unpass")
public Result<String> unpass(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setState("3");
annualCompService.updateById(annualComp);
return Result.OK("已驳回!");
}
/** /**
* 通过id查询 * 提交
* *
* @param id * @param id
* @return * @return
*/ */
//@AutoLog(value = "年度比赛管理-通过id查询") @AutoLog(value = "年度比赛管理-提交")
@ApiOperation(value="年度比赛管理-通过id查询", notes="年度比赛管理-通过id查询") @ApiOperation(value = "年度比赛管理-提交", notes = "年度比赛管理-提交")
@GetMapping(value = "/queryById") @GetMapping(value = "/submit")
public Result<AnnualComp> queryById(@RequestParam(name="id",required=true) String id) { public Result<String> submit(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id); AnnualComp annualComp = annualCompService.getById(id);
if(annualComp==null) { annualComp.setState("1");
return Result.error("未找到对应数据"); annualComp.setBackinfo("");
} annualCompService.updateById(annualComp);
return Result.OK(annualComp); return Result.OK("已提交!");
} }
/**
* 启用
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-启用")
@ApiOperation(value = "年度比赛管理-启用", notes = "年度比赛管理-启用")
@GetMapping(value = "/enable")
public Result<String> enable(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setIsopen("1");
annualCompService.updateById(annualComp);
return Result.OK("已启用!");
}
/**
* 停用
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-停用")
@ApiOperation(value = "年度比赛管理-停用", notes = "年度比赛管理-停用")
@GetMapping(value = "/deactivate")
public Result<String> deactivate(@RequestParam String id) {
AnnualComp annualComp = annualCompService.getById(id);
annualComp.setIsopen("0");
annualCompService.updateById(annualComp);
return Result.OK("已停用!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛管理-通过id删除")
@ApiOperation(value = "年度比赛管理-通过id删除", notes = "年度比赛管理-通过id删除")
//@RequiresPermissions("annualcomp:annual_comp:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
annualCompService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "年度比赛管理-批量删除")
@ApiOperation(value = "年度比赛管理-批量删除", notes = "年度比赛管理-批量删除")
@RequiresPermissions("annualcomp:annual_comp:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.annualCompService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "年度比赛管理-通过id查询")
@ApiOperation(value = "年度比赛管理-通过id查询", notes = "年度比赛管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<AnnualComp> queryById(@RequestParam(name = "id", required = true) String id) {
AnnualComp annualComp = annualCompService.getById(id);
if (annualComp == null) {
return Result.error("未找到对应数据");
}
return Result.OK(annualComp);
}
/** /**
* 导出excel * 导出excel
* *
* @param request * @param request
* @param annualComp * @param annualComp
*/ */
@RequiresPermissions("annualcomp:annual_comp:exportXls") @RequiresPermissions("annualcomp:annual_comp:exportXls")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AnnualComp annualComp) { public ModelAndView exportXls(HttpServletRequest request, AnnualComp annualComp) {
@ -452,12 +468,12 @@ public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCom
} }
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
* @param request * @param request
* @param response * @param response
* @return * @return
*/ */
@RequiresPermissions("annualcomp:annual_comp:importExcel") @RequiresPermissions("annualcomp:annual_comp:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

@ -1,122 +1,161 @@
package org.jeecg.modules.demo.annualcomp.entity; package org.jeecg.modules.demo.annualcomp.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/** /**
* @Description: 年度比赛管理 * @Description: 年度比赛管理
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-17 * @Date: 2023-08-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@TableName("annual_comp") @TableName("annual_comp")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="annual_comp对象", description="年度比赛管理") @ApiModel(value = "annual_comp对象", description = "年度比赛管理")
public class AnnualComp implements Serializable { public class AnnualComp implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**
@TableId(type = IdType.ASSIGN_ID) * 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private String id; private String id;
/**创建人*/ /**
* 创建人
*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private String createBy;
/**创建日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 创建日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; private Date createTime;
/**更新人*/ /**
* 更新人
*/
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateBy; private String updateBy;
/**更新日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 更新日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期") @ApiModelProperty(value = "更新日期")
private Date updateTime; private Date updateTime;
/**所属部门*/ /**
* 所属部门
*/
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private String sysOrgCode; private String sysOrgCode;
/**比赛id*/ /**
@Excel(name = "比赛id", width = 15) * 比赛id
*/
@Excel(name = "比赛id", width = 15)
@ApiModelProperty(value = "比赛id") @ApiModelProperty(value = "比赛id")
private String compid; private String compid;
/**年度id*/ /**
@Excel(name = "年度id", width = 15) * 年度id
*/
@Excel(name = "年度id", width = 15)
@ApiModelProperty(value = "年度id") @ApiModelProperty(value = "年度id")
private String annualid; private String annualid;
/**赛次*/ /**
@Excel(name = "赛次", width = 15) * 赛次
*/
@Excel(name = "赛次", width = 15)
@ApiModelProperty(value = "赛次") @ApiModelProperty(value = "赛次")
private String games; private String games;
/**名称*/ /**
@Excel(name = "名称", width = 15) * 名称
*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称") @ApiModelProperty(value = "名称")
private String name; private String name;
/**年度比赛简介*/ /**
@Excel(name = "年度比赛简介", width = 15) * 年度比赛简介
*/
@Excel(name = "年度比赛简介", width = 15)
@ApiModelProperty(value = "年度比赛简介") @ApiModelProperty(value = "年度比赛简介")
private String introduction; private String introduction;
/**年度比赛介绍*/ /**
@Excel(name = "年度比赛介绍", width = 15) * 年度比赛介绍
*/
@Excel(name = "年度比赛介绍", width = 15)
@ApiModelProperty(value = "年度比赛介绍") @ApiModelProperty(value = "年度比赛介绍")
private String introduce; private String introduce;
/**比赛图片*/ /**
@Excel(name = "比赛图片", width = 15) * 比赛图片
*/
@Excel(name = "比赛图片", width = 15)
@ApiModelProperty(value = "比赛图片") @ApiModelProperty(value = "比赛图片")
private String image; private String image;
/**年度比赛介绍文件*/ /**
@Excel(name = "年度比赛介绍文件", width = 15) * 年度比赛介绍文件
*/
@Excel(name = "年度比赛介绍文件", width = 15)
@ApiModelProperty(value = "年度比赛介绍文件") @ApiModelProperty(value = "年度比赛介绍文件")
private String compfile; private String compfile;
/**开始时间*/ /**
@Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd") * 开始时间
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") */
@DateTimeFormat(pattern="yyyy-MM-dd") @Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
private Date starttime; private Date starttime;
/**结束时间*/ /**
@Excel(name = "结束时间", width = 15, format = "yyyy-MM-dd") * 结束时间
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") */
@DateTimeFormat(pattern="yyyy-MM-dd") @Excel(name = "结束时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "结束时间") @ApiModelProperty(value = "结束时间")
private Date endtime; private Date endtime;
/**主办方*/ /**
@Excel(name = "主办方", width = 15) * 主办方
*/
@Excel(name = "主办方", width = 15)
@ApiModelProperty(value = "主办方") @ApiModelProperty(value = "主办方")
private String organizer; private String organizer;
/**协办方*/ /**
@Excel(name = "协办方", width = 15) * 协办方
*/
@Excel(name = "协办方", width = 15)
@ApiModelProperty(value = "协办方") @ApiModelProperty(value = "协办方")
private String coorganizer; private String coorganizer;
/**年度比赛状态*/ /**
@Excel(name = "年度比赛状态", width = 15) * 年度比赛状态
*/
@Excel(name = "年度比赛状态", width = 15)
@ApiModelProperty(value = "年度比赛状态") @ApiModelProperty(value = "年度比赛状态")
private String state; private String state;
/**开关*/ /**
@Excel(name = "开关", width = 15) * 开关
*/
@Excel(name = "开关", width = 15)
@ApiModelProperty(value = "开关") @ApiModelProperty(value = "开关")
private String isopen; private String isopen;
/**驳回信息*/ /**
@Excel(name = "驳回信息", width = 15) * 驳回信息
*/
@Excel(name = "驳回信息", width = 15)
@ApiModelProperty(value = "驳回信息") @ApiModelProperty(value = "驳回信息")
private String backinfo; private String backinfo;
} }

@ -1,15 +1,19 @@
package org.jeecg.modules.demo.annualcompaward.controller; package org.jeecg.modules.demo.annualcompaward.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.demo.annual.entity.Annual; import org.jeecg.modules.demo.annual.entity.Annual;
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;
@ -17,176 +21,215 @@ import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService;
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.annualcompaward.entity.AnnualCompAward; import org.jeecg.modules.demo.annualcompaward.entity.AnnualCompAward;
import org.jeecg.modules.demo.annualcompaward.entity.AnnualCompAwardvo;
import org.jeecg.modules.demo.annualcompaward.service.IAnnualCompAwardService; import org.jeecg.modules.demo.annualcompaward.service.IAnnualCompAwardService;
import org.jeecg.modules.demo.comp.entity.Comp;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.jeecg.modules.demo.comp.service.ICompService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/** import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: 年度比赛奖项设置 * @Description: 年度比赛奖项设置
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-17 * @Date: 2023-08-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="年度比赛奖项设置") @Api(tags = "年度比赛奖项设置")
@RestController @RestController
@RequestMapping("/annualcompaward/annualCompAward") @RequestMapping("/annualcompaward/annualCompAward")
@Slf4j @Slf4j
public class AnnualCompAwardController extends JeecgController<AnnualCompAward, IAnnualCompAwardService> { public class AnnualCompAwardController extends JeecgController<AnnualCompAward, IAnnualCompAwardService> {
@Autowired @Autowired
private IAnnualCompAwardService annualCompAwardService; private IAnnualCompAwardService annualCompAwardService;
@Autowired @Autowired
private IAnnualCompPointService annualCompPointService; private IAnnualCompPointService annualCompPointService;
@Autowired @Autowired
private IAnnualService annualService; private IAnnualService annualService;
@Autowired @Autowired
private IAnnualCompService annualCompService; private IAnnualCompService annualCompService;
/** @Autowired
* 分页列表查询 private ICompService iCompService;
*
* @param annualCompAward /**
* @param pageNo * 分页列表查询
* @param pageSize *
* @param req * @param annualCompAward
* @return * @param pageNo
*/ * @param pageSize
//@AutoLog(value = "年度比赛奖项设置-分页列表查询") * @param req
@ApiOperation(value="年度比赛奖项设置-分页列表查询", notes="年度比赛奖项设置-分页列表查询") * @return
@GetMapping(value = "/list") */
public Result<IPage<AnnualCompAwardvo>> queryPageList(AnnualCompAward annualCompAward, //@AutoLog(value = "年度比赛奖项设置-分页列表查询")
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @ApiOperation(value = "年度比赛奖项设置-分页列表查询", notes = "年度比赛奖项设置-分页列表查询")
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @GetMapping(value = "/list")
HttpServletRequest req) { public Result<IPage<AnnualCompAward>> queryPageList(AnnualCompAward annualCompAward,
QueryWrapper<AnnualCompAward> queryWrapper = QueryGenerator.initQueryWrapper(annualCompAward, req.getParameterMap()); @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
Page<AnnualCompAward> page = new Page<AnnualCompAward>(pageNo, pageSize); @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
Page<AnnualCompAwardvo> page1 = new Page<>(); HttpServletRequest req) {
annualCompAwardService.page(page, queryWrapper);
BeanUtils.copyProperties(page, page1,"records"); Subject subject = SecurityUtils.getSubject();
List<AnnualCompAward> list=page.getRecords(); // 获取当前登录用户
List<AnnualCompAwardvo> list1=list.stream().map((item)->{ LoginUser loginUser = (LoginUser) subject.getPrincipal();
AnnualCompAwardvo annualCompAward1=new AnnualCompAwardvo(); //角色名称 管理员&教务处可以查看所有
BeanUtils.copyProperties(item,annualCompAward1); String realname = loginUser.getRealname();
AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("id", annualCompAward1.getAnnucompid()).one(); Set<String> annualCompPointIds = new TreeSet<>();
AnnualComp annualComp = null;
Annual annual = null; // QueryWrapper<AnnualCompAward> queryWrapper = QueryGenerator.initQueryWrapper(annualCompAward, req.getParameterMap());
if (annualCompPoint != null) { LambdaQueryWrapper<AnnualCompAward> queryWrapper = new LambdaQueryWrapper<>();
annualComp = annualCompService.query().eq("id", annualCompPoint.getAnnualCompId()).one(); if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) {
} } else {
if (annualComp != null) { List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername()));
annual = annualService.query().eq("id", annualComp.getAnnualid()).one(); if (!ObjectUtils.isEmpty(compList)) {
} Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet());
if (annualCompPoint != null && annualComp != null && annual != null) List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds));
annualCompAward1.setAnnucompid(annualCompPoint.getObjName()); if (!ObjectUtils.isEmpty(annualCompList)) {
annualCompAward1.setComp(annualComp.getName()); Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet());
annualCompAward1.setAnnual(annual.getAnnualName()); List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
return annualCompAward1; if (!ObjectUtils.isEmpty(annualCompPointList)) {
}).collect(Collectors.toList()); annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet());
page1.setRecords(list1); }
return Result.OK(page1); }
} }
queryWrapper.in(AnnualCompAward::getAnnucompid, annualCompPointIds);
/** }
* 添加
* Page<AnnualCompAward> page = new Page<AnnualCompAward>(pageNo, pageSize);
* @param annualCompAward annualCompAwardService.page(page, queryWrapper);
* @return
*/ // Page<AnnualCompAwardvo> page1 = new Page<>();
@AutoLog(value = "年度比赛奖项设置-添加") // BeanUtils.copyProperties(page, page1, "records");
@ApiOperation(value="年度比赛奖项设置-添加", notes="年度比赛奖项设置-添加") // List<AnnualCompAward> list = page.getRecords();
//@RequiresPermissions("annualcompaward:annual_comp_award:add") // List<AnnualCompAwardvo> list1 = list.stream().map((item) -> {
@PostMapping(value = "/add") // AnnualCompAwardvo annualCompAward1 = new AnnualCompAwardvo();
public Result<String> add(@RequestBody AnnualCompAward annualCompAward) { // BeanUtils.copyProperties(item, annualCompAward1);
if(annualCompAward!=null){ // AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("id", annualCompAward1.getAnnucompid()).one();
AnnualCompPoint annualCompPoint=annualCompPointService.query().eq("obj_name",annualCompAward.getAnnucompid()).one(); // AnnualComp annualComp = null;
annualCompAward.setAnnucompid(annualCompPoint.getId()); // Annual annual = null;
} // if (annualCompPoint != null) {
annualCompAwardService.save(annualCompAward); // annualComp = annualCompService.query().eq("id", annualCompPoint.getAnnualCompId()).one();
return Result.OK("添加成功!"); // }
} // if (annualComp != null) {
// annual = annualService.query().eq("id", annualComp.getAnnualid()).one();
/** // }
* 编辑 //// if (annualCompPoint != null && annualComp != null && annual != null)
* // annualCompAward1.setAnnucompid(annualCompPoint.getObjName());
* @param annualCompAward // annualCompAward1.setComp(annualComp.getName());
* @return // annualCompAward1.setAnnual(annual.getAnnualName());
*/ // return annualCompAward1;
@AutoLog(value = "年度比赛奖项设置-编辑") // }).collect(Collectors.toList());
@ApiOperation(value="年度比赛奖项设置-编辑", notes="年度比赛奖项设置-编辑") // page1.setRecords(list1);
//@RequiresPermissions("annualcompaward:annual_comp_award:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) List<AnnualCompAward> records = page.getRecords();
public Result<String> edit(@RequestBody AnnualCompAward annualCompAward) { Optional.ofNullable(records).orElse(new LinkedList<>()).stream().forEach(e -> {
annualCompAwardService.updateById(annualCompAward); AnnualCompPoint annualCompPoint = annualCompPointService.getById(e.getAnnucompid());
return Result.OK("编辑成功!"); if (!ObjectUtils.isEmpty(annualCompPoint)) {
} AnnualComp annualComp = annualCompService.getById(annualCompPoint.getAnnualCompId());
if (annualComp != null) {
/** e.setComp(annualComp.getName());
* 通过id删除 Annual annual = annualService.getById(annualComp.getAnnualid());
* if (annual != null) {
* @param id e.setAnnual(annual.getAnnualName());
* @return }
*/ }
@AutoLog(value = "年度比赛奖项设置-通过id删除") }
@ApiOperation(value="年度比赛奖项设置-通过id删除", notes="年度比赛奖项设置-通过id删除") });
//@RequiresPermissions("annualcompaward:annual_comp_award:delete") return Result.OK(page);
@DeleteMapping(value = "/delete") }
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
annualCompAwardService.removeById(id); /**
return Result.OK("删除成功!"); * 添加
} *
* @param annualCompAward
/** * @return
* 批量删除 */
* @AutoLog(value = "年度比赛奖项设置-添加")
* @param ids @ApiOperation(value = "年度比赛奖项设置-添加", notes = "年度比赛奖项设置-添加")
* @return //@RequiresPermissions("annualcompaward:annual_comp_award:add")
*/ @PostMapping(value = "/add")
@AutoLog(value = "年度比赛奖项设置-批量删除") public Result<String> add(@RequestBody AnnualCompAward annualCompAward) {
@ApiOperation(value="年度比赛奖项设置-批量删除", notes="年度比赛奖项设置-批量删除") if (annualCompAward != null) {
//@RequiresPermissions("annualcompaward:annual_comp_award:deleteBatch") AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("obj_name", annualCompAward.getAnnucompid()).one();
@DeleteMapping(value = "/deleteBatch") annualCompAward.setAnnucompid(annualCompPoint.getId());
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { }
this.annualCompAwardService.removeByIds(Arrays.asList(ids.split(","))); annualCompAwardService.save(annualCompAward);
return Result.OK("批量删除成功!"); return Result.OK("添加成功!");
} }
/** /**
* 通过id查询 * 编辑
* *
* @param id * @param annualCompAward
* @return * @return
*/ */
//@AutoLog(value = "年度比赛奖项设置-通过id查询") @AutoLog(value = "年度比赛奖项设置-编辑")
@ApiOperation(value="年度比赛奖项设置-通过id查询", notes="年度比赛奖项设置-通过id查询") @ApiOperation(value = "年度比赛奖项设置-编辑", notes = "年度比赛奖项设置-编辑")
@GetMapping(value = "/queryById") //@RequiresPermissions("annualcompaward:annual_comp_award:edit")
public Result<AnnualCompAward> queryById(@RequestParam(name="id",required=true) String id) { @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
AnnualCompAward annualCompAward = annualCompAwardService.getById(id); public Result<String> edit(@RequestBody AnnualCompAward annualCompAward) {
if(annualCompAward==null) { annualCompAwardService.updateById(annualCompAward);
return Result.error("未找到对应数据"); return Result.OK("编辑成功!");
} }
return Result.OK(annualCompAward);
} /**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "年度比赛奖项设置-通过id删除")
@ApiOperation(value = "年度比赛奖项设置-通过id删除", notes = "年度比赛奖项设置-通过id删除")
//@RequiresPermissions("annualcompaward:annual_comp_award:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
annualCompAwardService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "年度比赛奖项设置-批量删除")
@ApiOperation(value = "年度比赛奖项设置-批量删除", notes = "年度比赛奖项设置-批量删除")
//@RequiresPermissions("annualcompaward:annual_comp_award:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.annualCompAwardService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "年度比赛奖项设置-通过id查询")
@ApiOperation(value = "年度比赛奖项设置-通过id查询", notes = "年度比赛奖项设置-通过id查询")
@GetMapping(value = "/queryById")
public Result<AnnualCompAward> queryById(@RequestParam(name = "id", required = true) String id) {
AnnualCompAward annualCompAward = annualCompAwardService.getById(id);
if (annualCompAward == null) {
return Result.error("未找到对应数据");
}
return Result.OK(annualCompAward);
}
/** /**
* 导出excel * 导出excel
* *
* @param request * @param request
* @param annualCompAward * @param annualCompAward
*/ */
@RequiresPermissions("annualcompaward:annual_comp_award:exportXls") @RequiresPermissions("annualcompaward:annual_comp_award:exportXls")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AnnualCompAward annualCompAward) { public ModelAndView exportXls(HttpServletRequest request, AnnualCompAward annualCompAward) {
@ -194,12 +237,12 @@ public class AnnualCompAwardController extends JeecgController<AnnualCompAward,
} }
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
* @param request * @param request
* @param response * @param response
* @return * @return
*/ */
@RequiresPermissions("annualcompaward:annual_comp_award:importExcel") @RequiresPermissions("annualcompaward:annual_comp_award:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

@ -1,143 +1,208 @@
package org.jeecg.modules.demo.annualcompaward.entity; package org.jeecg.modules.demo.annualcompaward.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/** /**
* @Description: 年度比赛奖项设置 * @Description: 年度比赛奖项设置
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-17 * @Date: 2023-08-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@TableName("annual_comp_award") @TableName("annual_comp_award")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="annual_comp_award对象", description="年度比赛奖项设置") @ApiModel(value = "annual_comp_award对象", description = "年度比赛奖项设置")
public class AnnualCompAward implements Serializable { public class AnnualCompAward implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**
@TableId(type = IdType.ASSIGN_ID) * 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private String id; private String id;
/**创建人*/ /**
* 创建人
*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private String createBy;
/**创建日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 创建日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; private Date createTime;
/**更新人*/ /**
* 更新人
*/
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateBy; private String updateBy;
/**更新日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 更新日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期") @ApiModelProperty(value = "更新日期")
private Date updateTime; private Date updateTime;
/**所属部门*/ /**
* 所属部门
*/
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private String sysOrgCode; private String sysOrgCode;
/**年度比赛项目id*/ /**
@Excel(name = "年度比赛项目id", width = 15) * 年度比赛项目id
*/
@Dict(dictTable = "annual_comp_point",dicCode = "id",dicText = "obj_name")
@ApiModelProperty(value = "年度比赛项目id") @ApiModelProperty(value = "年度比赛项目id")
private String annucompid; private String annucompid;
/**是否启用奖项1*/ /**
@Excel(name = "是否启用奖项1", width = 15) * 是否启用奖项1
*/
@Excel(name = "是否启用奖项1", width = 15)
@ApiModelProperty(value = "是否启用奖项1") @ApiModelProperty(value = "是否启用奖项1")
private String isFirstPrize; private String isFirstPrize;
/**第一名奖项名称*/ /**
@Excel(name = "第一名奖项名称", width = 15) * 第一名奖项名称
*/
@Excel(name = "第一名奖项名称", width = 15)
@ApiModelProperty(value = "第一名奖项名称") @ApiModelProperty(value = "第一名奖项名称")
private String firstPrize; private String firstPrize;
/**数量*/ /**
@Excel(name = "数量", width = 15) * 数量
*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private String firstNum; private String firstNum;
/**第一名权重*/ /**
@Excel(name = "第一名权重", width = 15) * 第一名权重
*/
@Excel(name = "第一名权重", width = 15)
@ApiModelProperty(value = "第一名权重") @ApiModelProperty(value = "第一名权重")
private String firstWeight; private String firstWeight;
/**是否启用奖项2*/ /**
@Excel(name = "是否启用奖项2", width = 15) * 是否启用奖项2
*/
@Excel(name = "是否启用奖项2", width = 15)
@ApiModelProperty(value = "是否启用奖项2") @ApiModelProperty(value = "是否启用奖项2")
private String isSecondPrize; private String isSecondPrize;
/**第二名奖项名称*/ /**
@Excel(name = "第二名奖项名称", width = 15) * 第二名奖项名称
*/
@Excel(name = "第二名奖项名称", width = 15)
@ApiModelProperty(value = "第二名奖项名称") @ApiModelProperty(value = "第二名奖项名称")
private String secondPrize; private String secondPrize;
/**奖项2数量*/ /**
@Excel(name = "奖项2数量", width = 15) * 奖项2数量
*/
@Excel(name = "奖项2数量", width = 15)
@ApiModelProperty(value = "奖项2数量") @ApiModelProperty(value = "奖项2数量")
private String secondNum; private String secondNum;
/**第二名权重*/ /**
@Excel(name = "第二名权重", width = 15) * 第二名权重
*/
@Excel(name = "第二名权重", width = 15)
@ApiModelProperty(value = "第二名权重") @ApiModelProperty(value = "第二名权重")
private String secondWeight; private String secondWeight;
/**是否启用奖项3*/ /**
@Excel(name = "是否启用奖项3", width = 15) * 是否启用奖项3
*/
@Excel(name = "是否启用奖项3", width = 15)
@ApiModelProperty(value = "是否启用奖项3") @ApiModelProperty(value = "是否启用奖项3")
private String isThirdPrize; private String isThirdPrize;
/**第三名奖项名称*/ /**
@Excel(name = "第三名奖项名称", width = 15) * 第三名奖项名称
*/
@Excel(name = "第三名奖项名称", width = 15)
@ApiModelProperty(value = "第三名奖项名称") @ApiModelProperty(value = "第三名奖项名称")
private String thirdPrize; private String thirdPrize;
/**奖项3数量*/ /**
@Excel(name = "奖项3数量", width = 15) * 奖项3数量
*/
@Excel(name = "奖项3数量", width = 15)
@ApiModelProperty(value = "奖项3数量") @ApiModelProperty(value = "奖项3数量")
private String thirdNum; private String thirdNum;
/**第三名权重*/ /**
@Excel(name = "第三名权重", width = 15) * 第三名权重
*/
@Excel(name = "第三名权重", width = 15)
@ApiModelProperty(value = "第三名权重") @ApiModelProperty(value = "第三名权重")
private String thirdWeight; private String thirdWeight;
/**是否启用奖项4*/ /**
@Excel(name = "是否启用奖项4", width = 15) * 是否启用奖项4
*/
@Excel(name = "是否启用奖项4", width = 15)
@ApiModelProperty(value = "是否启用奖项4") @ApiModelProperty(value = "是否启用奖项4")
private String isFourthPrize; private String isFourthPrize;
/**第四名奖项名称*/ /**
@Excel(name = "第四名奖项名称", width = 15) * 第四名奖项名称
*/
@Excel(name = "第四名奖项名称", width = 15)
@ApiModelProperty(value = "第四名奖项名称") @ApiModelProperty(value = "第四名奖项名称")
private String fourthPrize; private String fourthPrize;
/**奖项4数量*/ /**
@Excel(name = "奖项4数量", width = 15) * 奖项4数量
*/
@Excel(name = "奖项4数量", width = 15)
@ApiModelProperty(value = "奖项4数量") @ApiModelProperty(value = "奖项4数量")
private String fourthNum; private String fourthNum;
/**第四名权重*/ /**
@Excel(name = "第四名权重", width = 15) * 第四名权重
*/
@Excel(name = "第四名权重", width = 15)
@ApiModelProperty(value = "第四名权重") @ApiModelProperty(value = "第四名权重")
private String fourthWeight; private String fourthWeight;
/**是否启用奖项5*/ /**
@Excel(name = "是否启用奖项5", width = 15) * 是否启用奖项5
*/
@Excel(name = "是否启用奖项5", width = 15)
@ApiModelProperty(value = "是否启用奖项5") @ApiModelProperty(value = "是否启用奖项5")
private String isFifthPrize; private String isFifthPrize;
/**第五名奖项名称*/ /**
@Excel(name = "第五名奖项名称", width = 15) * 第五名奖项名称
*/
@Excel(name = "第五名奖项名称", width = 15)
@ApiModelProperty(value = "第五名奖项名称") @ApiModelProperty(value = "第五名奖项名称")
private String fifthPrize; private String fifthPrize;
/**奖项5数量*/ /**
@Excel(name = "奖项5数量", width = 15) * 奖项5数量
*/
@Excel(name = "奖项5数量", width = 15)
@ApiModelProperty(value = "奖项5数量") @ApiModelProperty(value = "奖项5数量")
private String fifthNum; private String fifthNum;
/**第五名权重*/ /**
@Excel(name = "第五名权重", width = 15) * 第五名权重
*/
@Excel(name = "第五名权重", width = 15)
@ApiModelProperty(value = "第五名权重") @ApiModelProperty(value = "第五名权重")
private String fifthWeight; private String fifthWeight;
/**同分*/ /**
@Excel(name = "同分", width = 15) * 同分
*/
@Excel(name = "同分", width = 15)
@ApiModelProperty(value = "同分") @ApiModelProperty(value = "同分")
private String equalSocre; private String equalSocre;
@TableField(exist = false)
private String annual;
@TableField(exist = false)
private String comp;
} }

@ -354,14 +354,15 @@ public class AnnualCompetitionProjectRegistrationController {
String enrollStatic = record.getEnrollStatic(); String enrollStatic = record.getEnrollStatic();
//对驳回信息添加默认信息 //对驳回信息添加默认信息
if (!enrollStatic.equals("3")){ // 学生端年度比赛项目之后在驳回状态下才显示驳回原因 modify by zhc 11.21
record.setBackinfo("无驳回信息"); // if (!enrollStatic.equals("3")){
} // record.setBackinfo("无驳回信息");
// }
record.setAnnual(record.getEnrollCode().substring(0, 4)); record.setAnnual(record.getEnrollCode().substring(0, 4));
} }
} }
/** /**
* 2添加 * 2添加
* *
@ -556,7 +557,7 @@ public class AnnualCompetitionProjectRegistrationController {
else else
return getEnrollCode(type); return getEnrollCode(type);
} }
/** /**
* 编辑 * 编辑
* *
@ -610,7 +611,7 @@ public class AnnualCompetitionProjectRegistrationController {
annualCompetitionProjectRegistrationService.updateMain(annualCompetitionProjectRegistration, annualCompetitionProjectRegistrationPage.getTeamManagementList(),annualCompetitionProjectRegistrationPage.getInstructorSheetList()); annualCompetitionProjectRegistrationService.updateMain(annualCompetitionProjectRegistration, annualCompetitionProjectRegistrationPage.getTeamManagementList(),annualCompetitionProjectRegistrationPage.getInstructorSheetList());
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
/** /**
* 改造后申请驳回/驳回申请 * 改造后申请驳回/驳回申请
* @param id * @param id
@ -738,7 +739,7 @@ public class AnnualCompetitionProjectRegistrationController {
this.annualCompetitionProjectRegistrationService.delBatchMain(Arrays.asList(ids.split(","))); this.annualCompetitionProjectRegistrationService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
/** /**
* 通过id查询 * 通过id查询
* *
@ -756,7 +757,7 @@ public class AnnualCompetitionProjectRegistrationController {
return Result.OK(annualCompetitionProjectRegistration); return Result.OK(annualCompetitionProjectRegistration);
} }
/** /**
* 通过id查询 * 通过id查询
* *

@ -1,90 +1,96 @@
package org.jeecg.modules.demo.comp.controller; package org.jeecg.modules.demo.comp.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
//import org.apache.shiro.authz.annotation.RequiresPermissions; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.system.vo.LoginUser;
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.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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.demo.comptype.entity.CompType;
import org.jeecg.modules.demo.comptype.service.ICompTypeService; import org.jeecg.modules.demo.comptype.service.ICompTypeService;
import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import javax.servlet.http.HttpServletRequest;
import org.jeecg.common.aspect.annotation.AutoLog; import javax.servlet.http.HttpServletResponse;
/** import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @Description: 比赛 * @Description: 比赛
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-19 * @Date: 2023-08-19
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="比赛") @Api(tags = "比赛")
@RestController @RestController
@RequestMapping("/comp/comp") @RequestMapping("/comp/comp")
@Slf4j @Slf4j
public class CompController extends JeecgController<Comp, ICompService> { public class CompController extends JeecgController<Comp, ICompService> {
@Autowired @Autowired
private ICompService compService; private ICompService compService;
@Autowired @Autowired
private ICompTypeService compTypeService; private ICompTypeService compTypeService;
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
@Autowired @Autowired
private ISysDepartService iSysDepartService; private ISysDepartService iSysDepartService;
@Autowired @Autowired
private IAnnualCompService annualCompService; private IAnnualCompService annualCompService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param comp * @param comp
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @param req * @param req
* @return * @return
*/ */
//@AutoLog(value = "比赛-分页列表查询") //@AutoLog(value = "比赛-分页列表查询")
@ApiOperation(value="比赛-分页列表查询", notes="比赛-分页列表查询") @ApiOperation(value = "比赛-分页列表查询", notes = "比赛-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<IPage<Comp>> queryPageList(Comp comp, public Result<IPage<Comp>> queryPageList(Comp comp,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<Comp> queryWrapper = QueryGenerator.initQueryWrapper(comp, req.getParameterMap());
Page<Comp> page = new Page<Comp>(pageNo, pageSize); //只显示自己管理的比赛
IPage<Comp> pageList = compService.page(page, queryWrapper); Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有
String realname = loginUser.getRealname();
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) {
} else {
comp.setCompAdmin(loginUser.getUsername());
}
QueryWrapper<Comp> queryWrapper = QueryGenerator.initQueryWrapper(comp, req.getParameterMap());
Page<Comp> page = new Page<Comp>(pageNo, pageSize);
IPage<Comp> pageList = compService.page(page, queryWrapper);
// for (Comp record : pageList.getRecords()) { // for (Comp record : pageList.getRecords()) {
// String compTypeId = record.getCompTypeId(); // String compTypeId = record.getCompTypeId();
@ -97,194 +103,196 @@ public class CompController extends JeecgController<Comp, ICompService> {
// record.setCompTypeName(one.getTypeName()); // record.setCompTypeName(one.getTypeName());
// } // }
return Result.OK(pageList); return Result.OK(pageList);
} }
/** /**
* 添加 * 添加
* *
* @param comp * @param comp
* @return * @return
*/ */
@AutoLog(value = "比赛-添加") @AutoLog(value = "比赛-添加")
@ApiOperation(value="比赛-添加", notes="比赛-添加") @ApiOperation(value = "比赛-添加", notes = "比赛-添加")
//// @RequiresPermissions("comp::comp::add") //// @RequiresPermissions("comp::comp::add")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody Comp comp) { public Result<String> add(@RequestBody Comp comp) {
String departIdTwo = null; String departIdTwo = null;
String departIdThree = null; String departIdThree = null;
Integer compOrder = comp.getCompOrder(); Integer compOrder = comp.getCompOrder();
String departIds= comp.getCompOrgan(); String departIds = comp.getCompOrgan();
List<String> list = Arrays.asList(comp.getCompAdmin().split(",")); List<String> list = Arrays.asList(comp.getCompAdmin().split(","));
List list1 = new ArrayList<>(); /* List list1 = new ArrayList<>();
for (String s : list) { for (String s : list) {
LambdaQueryWrapper<SysUser> userLambdaQueryWrapper =new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysUser> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
userLambdaQueryWrapper.eq(SysUser::getUsername,s); userLambdaQueryWrapper.eq(SysUser::getUsername, s);
SysUser sysUser = sysUserService.getOne(userLambdaQueryWrapper); SysUser sysUser = sysUserService.getOne(userLambdaQueryWrapper);
String id = sysUser.getId(); String id = sysUser.getId();
List<String> departId=sysUserService.getDepartByuserId(id); List<String> departId = sysUserService.getDepartByuserId(id);
for (String departIdOne : departId) { for (String departIdOne : departId) {
//一个人只能属于一个部门,可以属于该部门上级部门 //一个人只能属于一个部门,可以属于该部门上级部门
//三级id departIdOne //三级id departIdOne
//二级id //二级id
if ( if (!StringUtils.isBlank(departIdOne)) {
!StringUtils.isBlank(departIdOne) SysDepart depart1 = iSysDepartService.getById(departIdOne);
){ departIdTwo = depart1.getParentId();
SysDepart depart1 = iSysDepartService.getById(departIdOne); }
departIdTwo = depart1.getParentId(); if (!StringUtils.isBlank(departIdTwo)) {
} SysDepart depart1 = iSysDepartService.getById(departIdTwo);
if ( departIdThree = depart1.getParentId();
!StringUtils.isBlank(departIdTwo) }
){ if (!StringUtils.isBlank(departIds)) {
SysDepart depart1 = iSysDepartService.getById(departIdTwo); if (!(departIds.equals(departIdOne) || departIds.equals(departIdTwo) || departIds.equals(departIdThree))) {
departIdThree = depart1.getParentId(); return Result.error("添加失败,请核对负责人所属部门!");
} }
if (!StringUtils.isBlank(departIds)){ }
if (!(departIds.equals(departIdOne)||departIds.equals(departIdTwo)||departIds.equals(departIdThree))){ }
return Result.error("添加失败,请核对负责人所属部门!");
} list1.add(id);
} }
} String join = Joiner.on(",").join(list1);
comp.setCompAdmin(join);*/
list1.add(id);
} //现业务只有一个有效负责人,值为 sys_user表username modify by zhc 11.21
String join = Joiner.on(",").join(list1); if(!ObjectUtils.isEmpty(list)){
comp.setCompAdmin(join); comp.setCompAdmin(list.get(0));
/*--------------------------王家东添加开始============================*/ }
//获取比赛类型
Double comptypeweight = compTypeService.getById(comp.getCompTypeId()).getScore(); /*--------------------------王家东添加开始============================*/
int comptyp = (int) Math.round(comptypeweight); //获取比赛类型
//得到排序排序加大一便将比赛类型数据减一,最大值是10 Double comptypeweight = compTypeService.getById(comp.getCompTypeId()).getScore();
int csort; int comptyp = (int) Math.round(comptypeweight);
if (comp.getCompOrder()==10 || comp.getCompOrder()>10){ //得到排序排序加大一便将比赛类型数据减一,最大值是10
csort = comptyp - 10; int csort;
} else { if (comp.getCompOrder() == 10 || comp.getCompOrder() > 10) {
csort =comptyp - comp.getCompOrder(); csort = comptyp - 10;
} } else {
csort = comptyp - comp.getCompOrder();
comp.setCompweight(csort); }
comp.setCompweight(csort);
/*--------------------------王家东添加开始============================*/
compService.save(comp);
return Result.OK("添加成功!"); /*--------------------------王家东添加开始============================*/
} compService.save(comp);
return Result.OK("添加成功!");
/** }
* 编辑
* /**
* @param comp * 编辑
* @return *
*/ * @param comp
@AutoLog(value = "比赛-编辑") * @return
@ApiOperation(value="比赛-编辑", notes="比赛-编辑") */
@AutoLog(value = "比赛-编辑")
@ApiOperation(value = "比赛-编辑", notes = "比赛-编辑")
// @RequiresPermissions("comp::comp::update") // @RequiresPermissions("comp::comp::update")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody Comp comp) { public Result<String> edit(@RequestBody Comp comp) {
/*--------------------------王家东添加开始============================*/ /*--------------------------王家东添加开始============================*/
//获取比赛类型 //获取比赛类型
Double comptypeweight = compTypeService.getById(comp.getCompTypeId()).getScore(); Double comptypeweight = compTypeService.getById(comp.getCompTypeId()).getScore();
int comptyp = (int) Math.round(comptypeweight); int comptyp = (int) Math.round(comptypeweight);
//得到排序排序加大一便将比赛类型数据减一,最大值是10 //得到排序排序加大一便将比赛类型数据减一,最大值是10
int csort; int csort;
if (comp.getCompOrder()==10 || comp.getCompOrder()>10){ if (comp.getCompOrder() == 10 || comp.getCompOrder() > 10) {
csort = comptyp - 10; csort = comptyp - 10;
} else { } else {
csort =comptyp - comp.getCompOrder(); csort = comptyp - comp.getCompOrder();
} }
comp.setCompweight(csort); comp.setCompweight(csort);
/*--------------------------王家东添加开始============================*/ /*--------------------------王家东添加开始============================*/
compService.updateById(comp); compService.updateById(comp);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
/** /**
* 通过id删除 * 通过id删除
* *
* @param id * @param id
* @return * @return
*/ */
@AutoLog(value = "比赛-通过id删除") @AutoLog(value = "比赛-通过id删除")
@ApiOperation(value="比赛-通过id删除", notes="比赛-通过id删除") @ApiOperation(value = "比赛-通过id删除", notes = "比赛-通过id删除")
// @RequiresPermissions("comp::comp::delete") // @RequiresPermissions("comp::comp::delete")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) { public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
LambdaQueryWrapper<AnnualComp> lambdaQueryWrapper =new LambdaQueryWrapper<AnnualComp>(); LambdaQueryWrapper<AnnualComp> lambdaQueryWrapper = new LambdaQueryWrapper<AnnualComp>();
lambdaQueryWrapper.eq(AnnualComp::getCompid,id); lambdaQueryWrapper.eq(AnnualComp::getCompid, id);
List<AnnualComp> list = annualCompService.list(lambdaQueryWrapper); List<AnnualComp> list = annualCompService.list(lambdaQueryWrapper);
if (list.size()>0) if (list.size() > 0)
return Result.error("该比赛与年度比赛绑定,不能删除!"); return Result.error("该比赛与年度比赛绑定,不能删除!");
compService.removeById(id); compService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
/** /**
* 批量删除 * 批量删除
* *
* @param ids * @param ids
* @return * @return
*/ */
@AutoLog(value = "比赛-批量删除") @AutoLog(value = "比赛-批量删除")
@ApiOperation(value="比赛-批量删除", notes="比赛-批量删除") @ApiOperation(value = "比赛-批量删除", notes = "比赛-批量删除")
// @RequiresPermissions("comp::comp::deleteBatch") // @RequiresPermissions("comp::comp::deleteBatch")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
LambdaQueryWrapper<AnnualComp> lambdaQueryWrapper =new LambdaQueryWrapper<AnnualComp>(); LambdaQueryWrapper<AnnualComp> lambdaQueryWrapper = new LambdaQueryWrapper<AnnualComp>();
List<String> list = Arrays.asList(ids.split(",")); List<String> list = Arrays.asList(ids.split(","));
for (String s : list) { for (String s : list) {
Comp comp = compService.getById(s); Comp comp = compService.getById(s);
lambdaQueryWrapper.eq(AnnualComp::getCompid,s); lambdaQueryWrapper.eq(AnnualComp::getCompid, s);
List<AnnualComp> annualCompList = annualCompService.list(lambdaQueryWrapper); List<AnnualComp> annualCompList = annualCompService.list(lambdaQueryWrapper);
if (annualCompList.size()>0) if (annualCompList.size() > 0)
return Result.error(comp.getCompName()+"与年度比赛绑定,不能删除!"); return Result.error(comp.getCompName() + "与年度比赛绑定,不能删除!");
} }
this.compService.removeByIds(list); this.compService.removeByIds(list);
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
/** /**
* 通过id查询 * 通过id查询
* *
* @param id * @param id
* @return * @return
*/ */
//@AutoLog(value = "比赛-通过id查询") //@AutoLog(value = "比赛-通过id查询")
@ApiOperation(value="比赛-通过id查询", notes="比赛-通过id查询") @ApiOperation(value = "比赛-通过id查询", notes = "比赛-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<Comp> queryById(@RequestParam(name="id",required=true) String id) { public Result<Comp> queryById(@RequestParam(name = "id", required = true) String id) {
Comp comp = compService.getById(id); Comp comp = compService.getById(id);
if(comp==null) { if (comp == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
String compAdmin = comp.getCompAdmin(); String compAdmin = comp.getCompAdmin();
List<String> list = Arrays.asList(compAdmin.split(",")); List<String> list = Arrays.asList(compAdmin.split(","));
List a = new ArrayList<>(); List a = new ArrayList<>();
for (String s : list) { for (String s : list) {
SysUser sysUser = sysUserService.getById(s); SysUser sysUser = sysUserService.getById(s);
a.add(sysUser.getRealname()); a.add(sysUser.getRealname());
} }
String join = Joiner.on(",").join(a); String join = Joiner.on(",").join(a);
comp.setCompAdmin(join); comp.setCompAdmin(join);
return Result.OK(comp); return Result.OK(comp);
} }
/** /**
* 导出excel * 导出excel
* *
* @param request * @param request
* @param comp * @param comp
*/ */
// @RequiresPermissions("comp::comp::exportXls") // @RequiresPermissions("comp::comp::exportXls")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Comp comp) { public ModelAndView exportXls(HttpServletRequest request, Comp comp) {
@ -292,12 +300,12 @@ List a = new ArrayList<>();
} }
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
* @param request * @param request
* @param response * @param response
* @return * @return
*/ */
//// @RequiresPermissions("comp:comp:importExcel") //// @RequiresPermissions("comp:comp:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

@ -1,111 +1,149 @@
package org.jeecg.modules.demo.comp.entity; package org.jeecg.modules.demo.comp.entity;
import java.io.Serializable; import com.baomidou.mybatisplus.annotation.IdType;
import java.io.UnsupportedEncodingException; import com.baomidou.mybatisplus.annotation.TableField;
import java.util.Date; import com.baomidou.mybatisplus.annotation.TableId;
import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/** /**
* @Description: 比赛 * @Description: 比赛
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-19 * @Date: 2023-08-19
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@TableName("comp") @TableName("comp")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="comp对象", description="比赛") @ApiModel(value = "comp对象", description = "比赛")
public class Comp implements Serializable { public class Comp implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**
@TableId(type = IdType.ASSIGN_ID) * 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private String id; private String id;
/**创建人*/ /**
* 创建人
*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private String createBy;
/**创建日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 创建日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; private Date createTime;
/**更新人*/ /**
* 更新人
*/
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateBy; private String updateBy;
/**更新日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 更新日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期") @ApiModelProperty(value = "更新日期")
private Date updateTime; private Date updateTime;
/**所属部门*/ /**
* 所属部门
*/
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private String sysOrgCode; private String sysOrgCode;
/**比赛名称*/ /**
@Excel(name = "比赛名称", width = 15) * 比赛名称
*/
@Excel(name = "比赛名称", width = 15)
@ApiModelProperty(value = "比赛名称") @ApiModelProperty(value = "比赛名称")
private String compName; private String compName;
/**比赛负责人*/
@Excel(name = "比赛负责人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") /**
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id") * 比赛负责人
*/
@Excel(name = "比赛负责人", width = 15)
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@ApiModelProperty(value = "比赛负责人") @ApiModelProperty(value = "比赛负责人")
private String compAdmin; private String compAdmin;
/**比赛简介*/
@Excel(name = "比赛简介", width = 15) /**
* 比赛简介
*/
@Excel(name = "比赛简介", width = 15)
@ApiModelProperty(value = "比赛简介") @ApiModelProperty(value = "比赛简介")
private String compInfo; private String compInfo;
/**比赛logo*/ /**
@Excel(name = "比赛logo", width = 15) * 比赛logo
*/
@Excel(name = "比赛logo", width = 15)
@ApiModelProperty(value = "比赛logo") @ApiModelProperty(value = "比赛logo")
private String compLogo; private String compLogo;
/**比赛图片*/ /**
@Excel(name = "比赛图片", width = 15) * 比赛图片
*/
@Excel(name = "比赛图片", width = 15)
@ApiModelProperty(value = "比赛图片") @ApiModelProperty(value = "比赛图片")
private String compImg; private String compImg;
/**比赛详情*/ /**
@Excel(name = "比赛详情", width = 15) * 比赛详情
*/
@Excel(name = "比赛详情", width = 15)
@ApiModelProperty(value = "比赛详情") @ApiModelProperty(value = "比赛详情")
private String compDetail; private String compDetail;
/**比赛介绍文件*/ /**
@Excel(name = "比赛介绍文件", width = 15) * 比赛介绍文件
*/
@Excel(name = "比赛介绍文件", width = 15)
@ApiModelProperty(value = "比赛介绍文件") @ApiModelProperty(value = "比赛介绍文件")
private String compFile; private String compFile;
/**比赛类型*/ /**
* 比赛类型
*/
@Dict(dictTable = "comp_type", dicText = "type_name", dicCode = "id") @Dict(dictTable = "comp_type", dicText = "type_name", dicCode = "id")
@Excel(name = "比赛类型", width = 15) @Excel(name = "比赛类型", width = 15)
@ApiModelProperty(value = "比赛类型") @ApiModelProperty(value = "比赛类型")
private String compTypeId; private String compTypeId;
/**排名*/ /**
@Excel(name = "排名", width = 15) * 排名
*/
@Excel(name = "排名", width = 15)
@ApiModelProperty(value = "排名") @ApiModelProperty(value = "排名")
private Integer compOrder; private Integer compOrder;
/**负责部门*/ /**
@Excel(name = "负责部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") * 负责部门
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") */
@Excel(name = "负责部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "负责部门") @ApiModelProperty(value = "负责部门")
private String compOrgan; private String compOrgan;
/**负责部门*/ /**
* 负责部门
*/
/*@Excel(name = "负责部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") /*@Excel(name = "负责部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "负责部门")*/ @ApiModelProperty(value = "负责部门")*/
private Integer compweight; private Integer compweight;
/**
/**比赛类型*/ * 比赛类型
*/
@TableField(exist = false) @TableField(exist = false)
private String compTypeName; private String compTypeName;

@ -1,218 +1,236 @@
package org.jeecg.modules.demo.compskill.controller; package org.jeecg.modules.demo.compskill.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.demo.annual.entity.Annual; import org.jeecg.modules.demo.annual.entity.Annual;
import org.jeecg.modules.demo.annual.service.IAnnualService; import org.jeecg.modules.demo.annual.service.IAnnualService;
import org.jeecg.modules.demo.annual.service.impl.AnnualServiceImpl;
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;
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
import org.jeecg.modules.demo.annualcomp.vo.AnnualCompVo;
import org.jeecg.modules.demo.annualcompaward.entity.AnnualCompAwardvo;
import org.jeecg.modules.demo.basicsskill.entity.Basicsskill; import org.jeecg.modules.demo.basicsskill.entity.Basicsskill;
import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService; import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService;
import org.jeecg.modules.demo.comp.entity.Comp;
import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.demo.compskill.entity.Compskill; import org.jeecg.modules.demo.compskill.entity.Compskill;
import org.jeecg.modules.demo.compskill.entity.Compskillvo; import org.jeecg.modules.demo.compskill.entity.Compskillvo;
import org.jeecg.modules.demo.compskill.service.ICompskillService; import org.jeecg.modules.demo.compskill.service.ICompskillService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/** import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
/**
* @Description: 项目能力设置 * @Description: 项目能力设置
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-08-17 * @Date: 2023-08-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="项目能力设置") @Api(tags = "项目能力设置")
@RestController @RestController
@RequestMapping("/compskill/compskill") @RequestMapping("/compskill/compskill")
@Slf4j @Slf4j
public class CompskillController extends JeecgController<Compskill, ICompskillService> { public class CompskillController extends JeecgController<Compskill, ICompskillService> {
@Autowired @Autowired
private ICompskillService compskillService; private ICompskillService compskillService;
@Autowired @Autowired
private IAnnualCompPointService annualCompPointService; private IAnnualCompPointService annualCompPointService;
@Autowired @Autowired
private IBasicsskillService basicsskillService; private IBasicsskillService basicsskillService;
@Autowired @Autowired
private IAnnualService annualService; private IAnnualService annualService;
@Autowired @Autowired
private IAnnualCompService annualCompService; private IAnnualCompService annualCompService;
@Autowired
/** private ICompService iCompService;
* 分页列表查询
*
* @param compskill /**
* @param pageNo * 分页列表查询
* @param pageSize *
* @param req * @param compskill
* @return * @param pageNo
*/ * @param pageSize
//@AutoLog(value = "项目能力设置-分页列表查询") * @param req
@ApiOperation(value="项目能力设置-分页列表查询", notes="项目能力设置-分页列表查询") * @return
@GetMapping(value = "/list") */
public Result<IPage<Compskillvo>> queryPageList(Compskill compskill, //@AutoLog(value = "项目能力设置-分页列表查询")
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @ApiOperation(value = "项目能力设置-分页列表查询", notes = "项目能力设置-分页列表查询")
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @GetMapping(value = "/list")
HttpServletRequest req) { public Result<IPage<Compskillvo>> queryPageList(Compskill compskill,
QueryWrapper<Compskill> queryWrapper = QueryGenerator.initQueryWrapper(compskill, req.getParameterMap()); @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
Page<Compskill> page = new Page<Compskill>(pageNo, pageSize); @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
Page<Compskillvo> page1 = new Page<>(); HttpServletRequest req) {
compskillService.page(page, queryWrapper);
BeanUtils.copyProperties(page, page1,"records"); Subject subject = SecurityUtils.getSubject();
List<Compskillvo> list=page.getRecords().stream().map((item)->{ // 获取当前登录用户
Compskillvo compskill1=new Compskillvo(); LoginUser loginUser = (LoginUser) subject.getPrincipal();
BeanUtils.copyProperties(item,compskill1); //角色名称 管理员&教务处可以查看所有
AnnualCompPoint annualCompPoint=annualCompPointService.query().eq("id",compskill1.getAnnucompid()).one(); String realname = loginUser.getRealname();
AnnualComp annualComp=null;
Annual annual=null; Set<String> annualCompPointIds = new TreeSet<>();
if(annualCompPoint!=null){ // QueryWrapper<Compskill> queryWrapper = QueryGenerator.initQueryWrapper(compskill, req.getParameterMap());
annualComp=annualCompService.query().eq("id",annualCompPoint.getAnnualCompId()).one(); LambdaQueryWrapper<Compskill> queryWrapper = new LambdaQueryWrapper<>();
} if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) {
if(annualComp!=null){ } else {
annual=annualService.query().eq("id",annualComp.getAnnualid()).one(); List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername()));
} if (!ObjectUtils.isEmpty(compList)) {
Basicsskill basicsskill=basicsskillService.query().eq("id",compskill1.getCapacityid()).one(); Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet());
if(annualCompPoint!=null&&basicsskill!=null&&annualComp!=null&&annual!=null){ List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds));
compskill1.setAnnucompid(annualCompPoint.getObjName()); if (!ObjectUtils.isEmpty(annualCompList)) {
compskill1.setCapacityid(basicsskill.getName()); Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet());
compskill1.setComp(annualComp.getName()); List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
compskill1.setAnnual(annual.getAnnualName()); if (!ObjectUtils.isEmpty(annualCompPointList)) {
} annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet());
return compskill1; }
}).collect(Collectors.toList()); }
page1.setRecords(list); }
return Result.OK(page1); queryWrapper.in(Compskill::getAnnucompid, annualCompPointIds);
} }
/**
* 添加 Page<Compskill> page = new Page<Compskill>(pageNo, pageSize);
* Page<Compskillvo> page1 = new Page<>();
* @param compskill compskillService.page(page, queryWrapper);
* @return BeanUtils.copyProperties(page, page1, "records");
*/ List<Compskillvo> list = page.getRecords().stream().map((item) -> {
@AutoLog(value = "项目能力设置-添加") Compskillvo compskill1 = new Compskillvo();
@ApiOperation(value="项目能力设置-添加", notes="项目能力设置-添加") BeanUtils.copyProperties(item, compskill1);
//@RequiresPermissions("compskill:compskill:add") AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("id", compskill1.getAnnucompid()).one();
@PostMapping(value = "/add") AnnualComp annualComp = null;
public Result<String> add(@RequestBody Compskill compskill) { Annual annual = null;
if(compskill!=null){ if (annualCompPoint != null) {
AnnualCompPoint annualCompPoint=annualCompPointService.query().eq("obj_name",compskill.getAnnucompid()).one(); annualComp = annualCompService.query().eq("id", annualCompPoint.getAnnualCompId()).one();
Basicsskill basicsskill=basicsskillService.query().eq("name",compskill.getCapacityid()).one(); }
if(annualCompPoint!=null&&basicsskill!=null){ if (annualComp != null) {
compskill.setAnnucompid(annualCompPoint.getId()); annual = annualService.query().eq("id", annualComp.getAnnualid()).one();
compskill.setCapacityid(basicsskill.getId()); }
} Basicsskill basicsskill = basicsskillService.query().eq("id", compskill1.getCapacityid()).one();
} if (annualCompPoint != null && basicsskill != null && annualComp != null && annual != null) {
compskillService.save(compskill); compskill1.setAnnucompid(annualCompPoint.getObjName());
return Result.OK("添加成功!"); compskill1.setCapacityid(basicsskill.getName());
} compskill1.setComp(annualComp.getName());
compskill1.setAnnual(annual.getAnnualName());
/** }
* 编辑 return compskill1;
* }).collect(Collectors.toList());
* @param compskill page1.setRecords(list);
* @return return Result.OK(page1);
*/ }
@AutoLog(value = "项目能力设置-编辑")
@ApiOperation(value="项目能力设置-编辑", notes="项目能力设置-编辑") /**
//@RequiresPermissions("compskill:compskill:edit") * 添加
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) *
public Result<String> edit(@RequestBody Compskill compskill) { * @param compskill
compskillService.updateById(compskill); * @return
return Result.OK("编辑成功!"); */
} @AutoLog(value = "项目能力设置-添加")
@ApiOperation(value = "项目能力设置-添加", notes = "项目能力设置-添加")
/** //@RequiresPermissions("compskill:compskill:add")
* 通过id删除 @PostMapping(value = "/add")
* public Result<String> add(@RequestBody Compskill compskill) {
* @param id if (compskill != null) {
* @return AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("obj_name", compskill.getAnnucompid()).one();
*/ Basicsskill basicsskill = basicsskillService.query().eq("name", compskill.getCapacityid()).one();
@AutoLog(value = "项目能力设置-通过id删除") if (annualCompPoint != null && basicsskill != null) {
@ApiOperation(value="项目能力设置-通过id删除", notes="项目能力设置-通过id删除") compskill.setAnnucompid(annualCompPoint.getId());
//@RequiresPermissions("compskill:compskill:delete") compskill.setCapacityid(basicsskill.getId());
@DeleteMapping(value = "/delete") }
public Result<String> delete(@RequestParam(name="id",required=true) String id) { }
compskillService.removeById(id); compskillService.save(compskill);
return Result.OK("删除成功!"); return Result.OK("添加成功!");
} }
/** /**
* 批量删除 * 编辑
* *
* @param ids * @param compskill
* @return * @return
*/ */
@AutoLog(value = "项目能力设置-批量删除") @AutoLog(value = "项目能力设置-编辑")
@ApiOperation(value="项目能力设置-批量删除", notes="项目能力设置-批量删除") @ApiOperation(value = "项目能力设置-编辑", notes = "项目能力设置-编辑")
//@RequiresPermissions("compskill:compskill:deleteBatch") //@RequiresPermissions("compskill:compskill:edit")
@DeleteMapping(value = "/deleteBatch") @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<String> edit(@RequestBody Compskill compskill) {
this.compskillService.removeByIds(Arrays.asList(ids.split(","))); compskillService.updateById(compskill);
return Result.OK("批量删除成功!"); return Result.OK("编辑成功!");
} }
/** /**
* 通过id查询 * 通过id删除
* *
* @param id * @param id
* @return * @return
*/ */
//@AutoLog(value = "项目能力设置-通过id查询") @AutoLog(value = "项目能力设置-通过id删除")
@ApiOperation(value="项目能力设置-通过id查询", notes="项目能力设置-通过id查询") @ApiOperation(value = "项目能力设置-通过id删除", notes = "项目能力设置-通过id删除")
@GetMapping(value = "/queryById") //@RequiresPermissions("compskill:compskill:delete")
public Result<Compskill> queryById(@RequestParam(name="id",required=true) String id) { @DeleteMapping(value = "/delete")
Compskill compskill = compskillService.getById(id); public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
if(compskill==null) { compskillService.removeById(id);
return Result.error("未找到对应数据"); return Result.OK("删除成功!");
} }
return Result.OK(compskill);
} /**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "项目能力设置-批量删除")
@ApiOperation(value = "项目能力设置-批量删除", notes = "项目能力设置-批量删除")
//@RequiresPermissions("compskill:compskill:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.compskillService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "项目能力设置-通过id查询")
@ApiOperation(value = "项目能力设置-通过id查询", notes = "项目能力设置-通过id查询")
@GetMapping(value = "/queryById")
public Result<Compskill> queryById(@RequestParam(name = "id", required = true) String id) {
Compskill compskill = compskillService.getById(id);
if (compskill == null) {
return Result.error("未找到对应数据");
}
return Result.OK(compskill);
}
/** /**
* 导出excel * 导出excel
* *
* @param request * @param request
* @param compskill * @param compskill
*/ */
@RequiresPermissions("compskill:compskill:exportXls") @RequiresPermissions("compskill:compskill:exportXls")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Compskill compskill) { public ModelAndView exportXls(HttpServletRequest request, Compskill compskill) {
@ -220,12 +238,12 @@ public class CompskillController extends JeecgController<Compskill, ICompskillSe
} }
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
* @param request * @param request
* @param response * @param response
* @return * @return
*/ */
@RequiresPermissions("compskill:compskill:importExcel") @RequiresPermissions("compskill:compskill:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

@ -1,7 +1,4 @@
import { BasicColumn } from '/@/components/Table'; import {BasicColumn, FormSchema} from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
let isFirstPrize = ''; let isFirstPrize = '';
let isSecondPrize = ''; let isSecondPrize = '';
@ -25,7 +22,8 @@ export const columns: BasicColumn[] = [
{ {
title: '年度比赛项目', title: '年度比赛项目',
align: 'center', align: 'center',
dataIndex: 'annucompid', // dataIndex: 'annucompid',
dataIndex: 'annucompid_dictText',
}, },
{ {
title: '第一等奖项名称', title: '第一等奖项名称',
@ -105,34 +103,52 @@ export const columns: BasicColumn[] = [
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = []; export const searchFormSchema: FormSchema[] = [];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
label: '年度比赛项目', label: '年度比赛项目',
field: 'annucompid', field: 'annucompid',
component: 'JPopup', component: 'JDictSelectTag',
componentProps: ({ formActionType }) => { componentProps: {
const { setFieldsValue } = formActionType; dictCode: "annual_comp_point,obj_name,id"
return {
setFieldsValue: setFieldsValue,
code: 'bsxm',
fieldConfig: [{ source: 'obj_name', target: 'annucompid' }],
multi: true,
};
}, },
dynamicRules: ({model, schema}) => {
dynamicRules: ({ model, schema }) => { return [
return [{ required: true, message: '请输入年度比赛项目id!' }]; {required: true, message: '请输入年度比赛项目!'},
];
}, },
}, },
// {
//
// label: '年度比赛项目88',
// field: 'annucompid',
// component: 'JPopup',
// componentProps: ({formActionType}) => {
// const {setFieldsValue} = formActionType;
// return {
// setFieldsValue: setFieldsValue,
// code: 'bsxm',
// fieldConfig: [
// {source: 'id', target: 'annucompid'},
// // { source: '名称', target: 'annucompid_dictText' }
// ],
// multi: true,
// };
// },
//
// dynamicRules: ({model, schema}) => {
// return [{required: true, message: '请输入年度比赛项目id!'}];
// },
// },
{ {
label: '是否启用奖项1', label: '是否启用奖项1',
field: 'isFirstPrize', field: 'isFirstPrize',
component: 'JSwitch', component: 'JSwitch',
defaultValue: 'Y', defaultValue: 'Y',
componentProps: {}, componentProps: {},
show:renderCallbackParams => { show: renderCallbackParams => {
isFirstPrize = renderCallbackParams.values.isFirstPrize; isFirstPrize = renderCallbackParams.values.isFirstPrize;
return true; return true;
}, },
@ -141,8 +157,8 @@ export const formSchema: FormSchema[] = [
label: '第一等奖项名称', label: '第一等奖项名称',
field: 'firstPrize', field: 'firstPrize',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFirstPrize==='N') return false if (isFirstPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -150,8 +166,8 @@ export const formSchema: FormSchema[] = [
label: '数量', label: '数量',
field: 'firstNum', field: 'firstNum',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFirstPrize==='N') return false if (isFirstPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -159,8 +175,8 @@ export const formSchema: FormSchema[] = [
label: '第一名权重', label: '第一名权重',
field: 'firstWeight', field: 'firstWeight',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFirstPrize==='N') return false if (isFirstPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -172,14 +188,13 @@ export const formSchema: FormSchema[] = [
componentProps: { componentProps: {
placeholder: '自定义placeholder', placeholder: '自定义placeholder',
onChange: (e) => { onChange: (e) => {
if(e=='Y') if (e == 'Y') {
{ isThirdPrize = 'N';
isThirdPrize='N';
} }
console.log(e); console.log(e);
}, },
}, },
show:renderCallbackParams => { show: renderCallbackParams => {
isSecondPrize = renderCallbackParams.values.isSecondPrize; isSecondPrize = renderCallbackParams.values.isSecondPrize;
return true; return true;
}, },
@ -188,8 +203,8 @@ export const formSchema: FormSchema[] = [
label: '第二等奖项名称', label: '第二等奖项名称',
field: 'secondPrize', field: 'secondPrize',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isSecondPrize==='N') return false if (isSecondPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -197,8 +212,8 @@ export const formSchema: FormSchema[] = [
label: '奖项2数量', label: '奖项2数量',
field: 'secondNum', field: 'secondNum',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isSecondPrize==='N') return false if (isSecondPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -206,8 +221,8 @@ export const formSchema: FormSchema[] = [
label: '第二名权重', label: '第二名权重',
field: 'secondWeight', field: 'secondWeight',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isSecondPrize==='N') return false if (isSecondPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -217,7 +232,7 @@ export const formSchema: FormSchema[] = [
component: 'JSwitch', component: 'JSwitch',
defaultValue: 'Y', defaultValue: 'Y',
componentProps: {}, componentProps: {},
show:renderCallbackParams => { show: renderCallbackParams => {
isThirdPrize = renderCallbackParams.values.isThirdPrize; isThirdPrize = renderCallbackParams.values.isThirdPrize;
return true; return true;
}, },
@ -226,8 +241,8 @@ export const formSchema: FormSchema[] = [
label: '第三等奖项名称', label: '第三等奖项名称',
field: 'thirdPrize', field: 'thirdPrize',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isThirdPrize==='N') return false if (isThirdPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -235,8 +250,8 @@ export const formSchema: FormSchema[] = [
label: '奖项3数量', label: '奖项3数量',
field: 'thirdNum', field: 'thirdNum',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isThirdPrize==='N') return false if (isThirdPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -244,8 +259,8 @@ export const formSchema: FormSchema[] = [
label: '第三名权重', label: '第三名权重',
field: 'thirdWeight', field: 'thirdWeight',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isThirdPrize==='N') return false if (isThirdPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -255,7 +270,7 @@ export const formSchema: FormSchema[] = [
component: 'JSwitch', component: 'JSwitch',
defaultValue: 'Y', defaultValue: 'Y',
componentProps: {}, componentProps: {},
show:renderCallbackParams => { show: renderCallbackParams => {
isFourthPrize = renderCallbackParams.values.isFourthPrize; isFourthPrize = renderCallbackParams.values.isFourthPrize;
return true; return true;
}, },
@ -264,8 +279,8 @@ export const formSchema: FormSchema[] = [
label: '第四等奖项名称', label: '第四等奖项名称',
field: 'fourthPrize', field: 'fourthPrize',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFourthPrize==='N') return false if (isFourthPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -273,8 +288,8 @@ export const formSchema: FormSchema[] = [
label: '奖项4数量', label: '奖项4数量',
field: 'fourthNum', field: 'fourthNum',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFourthPrize==='N') return false if (isFourthPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -282,8 +297,8 @@ export const formSchema: FormSchema[] = [
label: '第四名权重', label: '第四名权重',
field: 'fourthWeight', field: 'fourthWeight',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFourthPrize==='N') return false if (isFourthPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -293,7 +308,7 @@ export const formSchema: FormSchema[] = [
component: 'JSwitch', component: 'JSwitch',
defaultValue: 'Y', defaultValue: 'Y',
componentProps: {}, componentProps: {},
show:renderCallbackParams => { show: renderCallbackParams => {
isFifthPrize = renderCallbackParams.values.isFifthPrize; isFifthPrize = renderCallbackParams.values.isFifthPrize;
return true; return true;
}, },
@ -302,8 +317,8 @@ export const formSchema: FormSchema[] = [
label: '第五等奖项名称', label: '第五等奖项名称',
field: 'fifthPrize', field: 'fifthPrize',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFifthPrize==='N') return false if (isFifthPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -311,8 +326,8 @@ export const formSchema: FormSchema[] = [
label: '奖项5数量', label: '奖项5数量',
field: 'fifthNum', field: 'fifthNum',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFifthPrize==='N') return false if (isFifthPrize === 'N') return false
else return true; else return true;
}, },
}, },
@ -320,8 +335,8 @@ export const formSchema: FormSchema[] = [
label: '第五名权重', label: '第五名权重',
field: 'fifthWeight', field: 'fifthWeight',
component: 'Input', component: 'Input',
show:renderCallbackParams => { show: renderCallbackParams => {
if(isFifthPrize==='N') return false if (isFifthPrize === 'N') return false
else return true; else return true;
}, },
}, },

Loading…
Cancel
Save