1、比赛项目问题修改 11.22

dev
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;
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.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.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
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.service.IAnnualService;
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp;
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.comp.entity.Comp;
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.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 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: 年度比赛管理
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Date: 2023-08-17
* @Version: V1.0
*/
@Api(tags="年度比赛管理")
@Api(tags = "年度比赛管理")
@RestController
@RequestMapping("/annualcomp/annualComp")
@Slf4j
public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCompService> {
@Autowired
private IAnnualCompService annualCompService;
@Autowired
private IAnnualService annualService;
@Autowired
private ICompService compService;
@Autowired
private IAnnualCompService annualCompService;
@Autowired
private IAnnualService annualService;
@Autowired
private ICompService compService;
/**
* 分页列表查询
*
* @param annualComp
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "年度比赛管理-分页列表查询")
@ApiOperation(value="年度比赛管理-分页列表查询", notes="年度比赛管理-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AnnualCompVo>> queryPageList(AnnualCompVo annualComp,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
/**
* 分页列表查询
*
* @param annualComp
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "年度比赛管理-分页列表查询")
@ApiOperation(value = "年度比赛管理-分页列表查询", notes = "年度比赛管理-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AnnualCompVo>> queryPageList(AnnualCompVo annualComp,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
// QueryWrapper<AnnualComp> queryWrapper = QueryGenerator.initQueryWrapper(annualComp, req.getParameterMap());
// Page<AnnualComp> page = new Page<AnnualComp>(pageNo, pageSize);
// 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);
}
/**
* 添加
*
* @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("添加成功!");
}
Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有
String realname = loginUser.getRealname();
/**
* 编辑
*
* @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("编辑成功!");
}
}
String compname = annualComp.getCompname();
String compId = null;
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(compname)) {
queryWrapper1.eq(Comp::getCompName, compname);
}
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) {
} else {
queryWrapper1.eq(Comp::getCompAdmin, loginUser.getUsername());
}
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);
}
@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("驳回成功!");
}
@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);
}
/**
* 通过
*
* @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("已驳回!");
}
/**
* 提交
*
* @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 = "年度比赛管理-已审核-分页列表查询")
@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);
}
/**
* 通过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("删除成功!");
}
@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);
}
/**
* 批量删除
*
* @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("批量删除成功!");
}
@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);
}
/**
* 添加
*
* @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
* @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);
}
/**
* 提交
*
* @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("已停用!");
}
/**
* 通过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
*
* @param request
* @param annualComp
*/
* 导出excel
*
* @param request
* @param annualComp
*/
@RequiresPermissions("annualcomp:annual_comp:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AnnualComp annualComp) {
@ -452,12 +468,12 @@ public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCom
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("annualcomp:annual_comp:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

@ -1,122 +1,161 @@
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.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
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.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
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: 年度比赛管理
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Date: 2023-08-17
* @Version: V1.0
*/
@Data
@TableName("annual_comp")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="annual_comp对象", description="年度比赛管理")
@ApiModel(value = "annual_comp对象", description = "年度比赛管理")
public class AnnualComp implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
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 = "创建日期")
private Date createTime;
/**更新人*/
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
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 = "更新日期")
private Date updateTime;
/**所属部门*/
/**
* 所属部门
*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**比赛id*/
@Excel(name = "比赛id", width = 15)
/**
* 比赛id
*/
@Excel(name = "比赛id", width = 15)
@ApiModelProperty(value = "比赛id")
private String compid;
/**年度id*/
@Excel(name = "年度id", width = 15)
/**
* 年度id
*/
@Excel(name = "年度id", width = 15)
@ApiModelProperty(value = "年度id")
private String annualid;
/**赛次*/
@Excel(name = "赛次", width = 15)
/**
* 赛次
*/
@Excel(name = "赛次", width = 15)
@ApiModelProperty(value = "赛次")
private String games;
/**名称*/
@Excel(name = "名称", width = 15)
/**
* 名称
*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String name;
/**年度比赛简介*/
@Excel(name = "年度比赛简介", width = 15)
/**
* 年度比赛简介
*/
@Excel(name = "年度比赛简介", width = 15)
@ApiModelProperty(value = "年度比赛简介")
private String introduction;
/**年度比赛介绍*/
@Excel(name = "年度比赛介绍", width = 15)
/**
* 年度比赛介绍
*/
@Excel(name = "年度比赛介绍", width = 15)
@ApiModelProperty(value = "年度比赛介绍")
private String introduce;
/**比赛图片*/
@Excel(name = "比赛图片", width = 15)
/**
* 比赛图片
*/
@Excel(name = "比赛图片", width = 15)
@ApiModelProperty(value = "比赛图片")
private String image;
/**年度比赛介绍文件*/
@Excel(name = "年度比赛介绍文件", width = 15)
/**
* 年度比赛介绍文件
*/
@Excel(name = "年度比赛介绍文件", width = 15)
@ApiModelProperty(value = "年度比赛介绍文件")
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 = "开始时间")
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 = "结束时间")
private Date endtime;
/**主办方*/
@Excel(name = "主办方", width = 15)
/**
* 主办方
*/
@Excel(name = "主办方", width = 15)
@ApiModelProperty(value = "主办方")
private String organizer;
/**协办方*/
@Excel(name = "协办方", width = 15)
/**
* 协办方
*/
@Excel(name = "协办方", width = 15)
@ApiModelProperty(value = "协办方")
private String coorganizer;
/**年度比赛状态*/
@Excel(name = "年度比赛状态", width = 15)
/**
* 年度比赛状态
*/
@Excel(name = "年度比赛状态", width = 15)
@ApiModelProperty(value = "年度比赛状态")
private String state;
/**开关*/
@Excel(name = "开关", width = 15)
/**
* 开关
*/
@Excel(name = "开关", width = 15)
@ApiModelProperty(value = "开关")
private String isopen;
/**驳回信息*/
@Excel(name = "驳回信息", width = 15)
/**
* 驳回信息
*/
@Excel(name = "驳回信息", width = 15)
@ApiModelProperty(value = "驳回信息")
private String backinfo;
}

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

@ -1,143 +1,208 @@
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.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
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.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
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: 年度比赛奖项设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Date: 2023-08-17
* @Version: V1.0
*/
@Data
@TableName("annual_comp_award")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="annual_comp_award对象", description="年度比赛奖项设置")
@ApiModel(value = "annual_comp_award对象", description = "年度比赛奖项设置")
public class AnnualCompAward implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
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 = "创建日期")
private Date createTime;
/**更新人*/
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
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 = "更新日期")
private Date updateTime;
/**所属部门*/
/**
* 所属部门
*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**年度比赛项目id*/
@Excel(name = "年度比赛项目id", width = 15)
/**
* 年度比赛项目id
*/
@Dict(dictTable = "annual_comp_point",dicCode = "id",dicText = "obj_name")
@ApiModelProperty(value = "年度比赛项目id")
private String annucompid;
/**是否启用奖项1*/
@Excel(name = "是否启用奖项1", width = 15)
/**
* 是否启用奖项1
*/
@Excel(name = "是否启用奖项1", width = 15)
@ApiModelProperty(value = "是否启用奖项1")
private String isFirstPrize;
/**第一名奖项名称*/
@Excel(name = "第一名奖项名称", width = 15)
/**
* 第一名奖项名称
*/
@Excel(name = "第一名奖项名称", width = 15)
@ApiModelProperty(value = "第一名奖项名称")
private String firstPrize;
/**数量*/
@Excel(name = "数量", width = 15)
/**
* 数量
*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private String firstNum;
/**第一名权重*/
@Excel(name = "第一名权重", width = 15)
/**
* 第一名权重
*/
@Excel(name = "第一名权重", width = 15)
@ApiModelProperty(value = "第一名权重")
private String firstWeight;
/**是否启用奖项2*/
@Excel(name = "是否启用奖项2", width = 15)
/**
* 是否启用奖项2
*/
@Excel(name = "是否启用奖项2", width = 15)
@ApiModelProperty(value = "是否启用奖项2")
private String isSecondPrize;
/**第二名奖项名称*/
@Excel(name = "第二名奖项名称", width = 15)
/**
* 第二名奖项名称
*/
@Excel(name = "第二名奖项名称", width = 15)
@ApiModelProperty(value = "第二名奖项名称")
private String secondPrize;
/**奖项2数量*/
@Excel(name = "奖项2数量", width = 15)
/**
* 奖项2数量
*/
@Excel(name = "奖项2数量", width = 15)
@ApiModelProperty(value = "奖项2数量")
private String secondNum;
/**第二名权重*/
@Excel(name = "第二名权重", width = 15)
/**
* 第二名权重
*/
@Excel(name = "第二名权重", width = 15)
@ApiModelProperty(value = "第二名权重")
private String secondWeight;
/**是否启用奖项3*/
@Excel(name = "是否启用奖项3", width = 15)
/**
* 是否启用奖项3
*/
@Excel(name = "是否启用奖项3", width = 15)
@ApiModelProperty(value = "是否启用奖项3")
private String isThirdPrize;
/**第三名奖项名称*/
@Excel(name = "第三名奖项名称", width = 15)
/**
* 第三名奖项名称
*/
@Excel(name = "第三名奖项名称", width = 15)
@ApiModelProperty(value = "第三名奖项名称")
private String thirdPrize;
/**奖项3数量*/
@Excel(name = "奖项3数量", width = 15)
/**
* 奖项3数量
*/
@Excel(name = "奖项3数量", width = 15)
@ApiModelProperty(value = "奖项3数量")
private String thirdNum;
/**第三名权重*/
@Excel(name = "第三名权重", width = 15)
/**
* 第三名权重
*/
@Excel(name = "第三名权重", width = 15)
@ApiModelProperty(value = "第三名权重")
private String thirdWeight;
/**是否启用奖项4*/
@Excel(name = "是否启用奖项4", width = 15)
/**
* 是否启用奖项4
*/
@Excel(name = "是否启用奖项4", width = 15)
@ApiModelProperty(value = "是否启用奖项4")
private String isFourthPrize;
/**第四名奖项名称*/
@Excel(name = "第四名奖项名称", width = 15)
/**
* 第四名奖项名称
*/
@Excel(name = "第四名奖项名称", width = 15)
@ApiModelProperty(value = "第四名奖项名称")
private String fourthPrize;
/**奖项4数量*/
@Excel(name = "奖项4数量", width = 15)
/**
* 奖项4数量
*/
@Excel(name = "奖项4数量", width = 15)
@ApiModelProperty(value = "奖项4数量")
private String fourthNum;
/**第四名权重*/
@Excel(name = "第四名权重", width = 15)
/**
* 第四名权重
*/
@Excel(name = "第四名权重", width = 15)
@ApiModelProperty(value = "第四名权重")
private String fourthWeight;
/**是否启用奖项5*/
@Excel(name = "是否启用奖项5", width = 15)
/**
* 是否启用奖项5
*/
@Excel(name = "是否启用奖项5", width = 15)
@ApiModelProperty(value = "是否启用奖项5")
private String isFifthPrize;
/**第五名奖项名称*/
@Excel(name = "第五名奖项名称", width = 15)
/**
* 第五名奖项名称
*/
@Excel(name = "第五名奖项名称", width = 15)
@ApiModelProperty(value = "第五名奖项名称")
private String fifthPrize;
/**奖项5数量*/
@Excel(name = "奖项5数量", width = 15)
/**
* 奖项5数量
*/
@Excel(name = "奖项5数量", width = 15)
@ApiModelProperty(value = "奖项5数量")
private String fifthNum;
/**第五名权重*/
@Excel(name = "第五名权重", width = 15)
/**
* 第五名权重
*/
@Excel(name = "第五名权重", width = 15)
@ApiModelProperty(value = "第五名权重")
private String fifthWeight;
/**同分*/
@Excel(name = "同分", width = 15)
/**
* 同分
*/
@Excel(name = "同分", width = 15)
@ApiModelProperty(value = "同分")
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();
//对驳回信息添加默认信息
if (!enrollStatic.equals("3")){
record.setBackinfo("无驳回信息");
}
// 学生端年度比赛项目之后在驳回状态下才显示驳回原因 modify by zhc 11.21
// if (!enrollStatic.equals("3")){
// record.setBackinfo("无驳回信息");
// }
record.setAnnual(record.getEnrollCode().substring(0, 4));
}
}
/**
* 2添加
*
@ -556,7 +557,7 @@ public class AnnualCompetitionProjectRegistrationController {
else
return getEnrollCode(type);
}
/**
* 编辑
*
@ -610,7 +611,7 @@ public class AnnualCompetitionProjectRegistrationController {
annualCompetitionProjectRegistrationService.updateMain(annualCompetitionProjectRegistration, annualCompetitionProjectRegistrationPage.getTeamManagementList(),annualCompetitionProjectRegistrationPage.getInstructorSheetList());
return Result.OK("编辑成功!");
}
/**
* 改造后申请驳回/驳回申请
* @param id
@ -738,7 +739,7 @@ public class AnnualCompetitionProjectRegistrationController {
this.annualCompetitionProjectRegistrationService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
@ -756,7 +757,7 @@ public class AnnualCompetitionProjectRegistrationController {
return Result.OK(annualCompetitionProjectRegistration);
}
/**
* 通过id查询
*

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

@ -1,111 +1,149 @@
package org.jeecg.modules.demo.comp.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
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.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
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: 比赛
* @Author: jeecg-boot
* @Date: 2023-08-19
* @Date: 2023-08-19
* @Version: V1.0
*/
@Data
@TableName("comp")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="comp对象", description="比赛")
@ApiModel(value = "comp对象", description = "比赛")
public class Comp implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**创建人*/
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
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 = "创建日期")
private Date createTime;
/**更新人*/
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
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 = "更新日期")
private Date updateTime;
/**所属部门*/
/**
* 所属部门
*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**比赛名称*/
@Excel(name = "比赛名称", width = 15)
/**
* 比赛名称
*/
@Excel(name = "比赛名称", width = 15)
@ApiModelProperty(value = "比赛名称")
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 = "比赛负责人")
private String compAdmin;
/**比赛简介*/
@Excel(name = "比赛简介", width = 15)
/**
* 比赛简介
*/
@Excel(name = "比赛简介", width = 15)
@ApiModelProperty(value = "比赛简介")
private String compInfo;
/**比赛logo*/
@Excel(name = "比赛logo", width = 15)
/**
* 比赛logo
*/
@Excel(name = "比赛logo", width = 15)
@ApiModelProperty(value = "比赛logo")
private String compLogo;
/**比赛图片*/
@Excel(name = "比赛图片", width = 15)
/**
* 比赛图片
*/
@Excel(name = "比赛图片", width = 15)
@ApiModelProperty(value = "比赛图片")
private String compImg;
/**比赛详情*/
@Excel(name = "比赛详情", width = 15)
/**
* 比赛详情
*/
@Excel(name = "比赛详情", width = 15)
@ApiModelProperty(value = "比赛详情")
private String compDetail;
/**比赛介绍文件*/
@Excel(name = "比赛介绍文件", width = 15)
/**
* 比赛介绍文件
*/
@Excel(name = "比赛介绍文件", width = 15)
@ApiModelProperty(value = "比赛介绍文件")
private String compFile;
/**比赛类型*/
/**
* 比赛类型
*/
@Dict(dictTable = "comp_type", dicText = "type_name", dicCode = "id")
@Excel(name = "比赛类型", width = 15)
@ApiModelProperty(value = "比赛类型")
private String compTypeId;
/**排名*/
@Excel(name = "排名", width = 15)
/**
* 排名
*/
@Excel(name = "排名", width = 15)
@ApiModelProperty(value = "排名")
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 = "负责部门")
private String compOrgan;
/**负责部门*/
/**
* 负责部门
*/
/*@Excel(name = "负责部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "负责部门")*/
private Integer compweight;
/**比赛类型*/
/**
* 比赛类型
*/
@TableField(exist = false)
private String compTypeName;

@ -1,218 +1,236 @@
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.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.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
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.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.service.IAnnualCompPointService;
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp;
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.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.Compskillvo;
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.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
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 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: 项目能力设置
* @Author: jeecg-boot
* @Date: 2023-08-17
* @Date: 2023-08-17
* @Version: V1.0
*/
@Api(tags="项目能力设置")
@Api(tags = "项目能力设置")
@RestController
@RequestMapping("/compskill/compskill")
@Slf4j
public class CompskillController extends JeecgController<Compskill, ICompskillService> {
@Autowired
private ICompskillService compskillService;
@Autowired
private IAnnualCompPointService annualCompPointService;
@Autowired
private IBasicsskillService basicsskillService;
@Autowired
private IAnnualService annualService;
@Autowired
private IAnnualCompService annualCompService;
/**
* 分页列表查询
*
* @param compskill
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "项目能力设置-分页列表查询")
@ApiOperation(value="项目能力设置-分页列表查询", notes="项目能力设置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<Compskillvo>> queryPageList(Compskill compskill,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Compskill> queryWrapper = QueryGenerator.initQueryWrapper(compskill, req.getParameterMap());
Page<Compskill> page = new Page<Compskill>(pageNo, pageSize);
Page<Compskillvo> page1 = new Page<>();
compskillService.page(page, queryWrapper);
BeanUtils.copyProperties(page, page1,"records");
List<Compskillvo> list=page.getRecords().stream().map((item)->{
Compskillvo compskill1=new Compskillvo();
BeanUtils.copyProperties(item,compskill1);
AnnualCompPoint annualCompPoint=annualCompPointService.query().eq("id",compskill1.getAnnucompid()).one();
AnnualComp annualComp=null;
Annual annual=null;
if(annualCompPoint!=null){
annualComp=annualCompService.query().eq("id",annualCompPoint.getAnnualCompId()).one();
}
if(annualComp!=null){
annual=annualService.query().eq("id",annualComp.getAnnualid()).one();
}
Basicsskill basicsskill=basicsskillService.query().eq("id",compskill1.getCapacityid()).one();
if(annualCompPoint!=null&&basicsskill!=null&&annualComp!=null&&annual!=null){
compskill1.setAnnucompid(annualCompPoint.getObjName());
compskill1.setCapacityid(basicsskill.getName());
compskill1.setComp(annualComp.getName());
compskill1.setAnnual(annual.getAnnualName());
}
return compskill1;
}).collect(Collectors.toList());
page1.setRecords(list);
return Result.OK(page1);
}
/**
* 添加
*
* @param compskill
* @return
*/
@AutoLog(value = "项目能力设置-添加")
@ApiOperation(value="项目能力设置-添加", notes="项目能力设置-添加")
//@RequiresPermissions("compskill:compskill:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody Compskill compskill) {
if(compskill!=null){
AnnualCompPoint annualCompPoint=annualCompPointService.query().eq("obj_name",compskill.getAnnucompid()).one();
Basicsskill basicsskill=basicsskillService.query().eq("name",compskill.getCapacityid()).one();
if(annualCompPoint!=null&&basicsskill!=null){
compskill.setAnnucompid(annualCompPoint.getId());
compskill.setCapacityid(basicsskill.getId());
}
}
compskillService.save(compskill);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param compskill
* @return
*/
@AutoLog(value = "项目能力设置-编辑")
@ApiOperation(value="项目能力设置-编辑", notes="项目能力设置-编辑")
//@RequiresPermissions("compskill:compskill:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody Compskill compskill) {
compskillService.updateById(compskill);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "项目能力设置-通过id删除")
@ApiOperation(value="项目能力设置-通过id删除", notes="项目能力设置-通过id删除")
//@RequiresPermissions("compskill:compskill:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
compskillService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @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);
}
@Autowired
private ICompskillService compskillService;
@Autowired
private IAnnualCompPointService annualCompPointService;
@Autowired
private IBasicsskillService basicsskillService;
@Autowired
private IAnnualService annualService;
@Autowired
private IAnnualCompService annualCompService;
@Autowired
private ICompService iCompService;
/**
* 分页列表查询
*
* @param compskill
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "项目能力设置-分页列表查询")
@ApiOperation(value = "项目能力设置-分页列表查询", notes = "项目能力设置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<Compskillvo>> queryPageList(Compskill compskill,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有
String realname = loginUser.getRealname();
Set<String> annualCompPointIds = new TreeSet<>();
// QueryWrapper<Compskill> queryWrapper = QueryGenerator.initQueryWrapper(compskill, req.getParameterMap());
LambdaQueryWrapper<Compskill> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) {
} else {
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername()));
if (!ObjectUtils.isEmpty(compList)) {
Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet());
List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds));
if (!ObjectUtils.isEmpty(annualCompList)) {
Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet());
List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
if (!ObjectUtils.isEmpty(annualCompPointList)) {
annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet());
}
}
}
queryWrapper.in(Compskill::getAnnucompid, annualCompPointIds);
}
Page<Compskill> page = new Page<Compskill>(pageNo, pageSize);
Page<Compskillvo> page1 = new Page<>();
compskillService.page(page, queryWrapper);
BeanUtils.copyProperties(page, page1, "records");
List<Compskillvo> list = page.getRecords().stream().map((item) -> {
Compskillvo compskill1 = new Compskillvo();
BeanUtils.copyProperties(item, compskill1);
AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("id", compskill1.getAnnucompid()).one();
AnnualComp annualComp = null;
Annual annual = null;
if (annualCompPoint != null) {
annualComp = annualCompService.query().eq("id", annualCompPoint.getAnnualCompId()).one();
}
if (annualComp != null) {
annual = annualService.query().eq("id", annualComp.getAnnualid()).one();
}
Basicsskill basicsskill = basicsskillService.query().eq("id", compskill1.getCapacityid()).one();
if (annualCompPoint != null && basicsskill != null && annualComp != null && annual != null) {
compskill1.setAnnucompid(annualCompPoint.getObjName());
compskill1.setCapacityid(basicsskill.getName());
compskill1.setComp(annualComp.getName());
compskill1.setAnnual(annual.getAnnualName());
}
return compskill1;
}).collect(Collectors.toList());
page1.setRecords(list);
return Result.OK(page1);
}
/**
* 添加
*
* @param compskill
* @return
*/
@AutoLog(value = "项目能力设置-添加")
@ApiOperation(value = "项目能力设置-添加", notes = "项目能力设置-添加")
//@RequiresPermissions("compskill:compskill:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody Compskill compskill) {
if (compskill != null) {
AnnualCompPoint annualCompPoint = annualCompPointService.query().eq("obj_name", compskill.getAnnucompid()).one();
Basicsskill basicsskill = basicsskillService.query().eq("name", compskill.getCapacityid()).one();
if (annualCompPoint != null && basicsskill != null) {
compskill.setAnnucompid(annualCompPoint.getId());
compskill.setCapacityid(basicsskill.getId());
}
}
compskillService.save(compskill);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param compskill
* @return
*/
@AutoLog(value = "项目能力设置-编辑")
@ApiOperation(value = "项目能力设置-编辑", notes = "项目能力设置-编辑")
//@RequiresPermissions("compskill:compskill:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody Compskill compskill) {
compskillService.updateById(compskill);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "项目能力设置-通过id删除")
@ApiOperation(value = "项目能力设置-通过id删除", notes = "项目能力设置-通过id删除")
//@RequiresPermissions("compskill:compskill:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
compskillService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @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
*
* @param request
* @param compskill
*/
* 导出excel
*
* @param request
* @param compskill
*/
@RequiresPermissions("compskill:compskill:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Compskill compskill) {
@ -220,12 +238,12 @@ public class CompskillController extends JeecgController<Compskill, ICompskillSe
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("compskill:compskill:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

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

Loading…
Cancel
Save