diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/DepartAbilityEvaluationController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/DepartAbilityEvaluationController.java new file mode 100644 index 00000000..01d32acf --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/DepartAbilityEvaluationController.java @@ -0,0 +1,177 @@ +package org.jeecg.modules.demo.abilityEvaluation.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 院系年度能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +@Api(tags = "院系年度能力评价") +@RestController +@RequestMapping("/abilityEvaluation/departAbilityEvaluation") +@Slf4j +public class DepartAbilityEvaluationController extends JeecgController { + @Autowired + private IDepartAbilityEvaluationService departAbilityEvaluationService; + + /** + * 分页列表查询 + * + * @param departAbilityEvaluation + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "院系年度能力评价-分页列表查询") + @ApiOperation(value = "院系年度能力评价-分页列表查询", notes = "院系年度能力评价-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(DepartAbilityEvaluation departAbilityEvaluation, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(departAbilityEvaluation, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = departAbilityEvaluationService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param departAbilityEvaluation + * @return + */ + @ApiOperation(value = "院系年度能力评价-添加", notes = "院系年度能力评价-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody DepartAbilityEvaluation departAbilityEvaluation) { + departAbilityEvaluationService.collectAbilityEvaluation(departAbilityEvaluation); + return Result.OK("添加成功!"); + } + + /** + * @Title: collectAllDepart + * @Description: 部门为空时汇总所有部门, 不为空时汇总该部门 + * @Params: [departAbilityEvaluation] + * @Return: org.jeecg.common.api.vo.Result + * @Author: z.h.c + * @Date: 2024/7/30 23:03 + */ + @ApiOperation(value = "院系年度能力评价-汇总所有部门", notes = "院系年度能力评价-汇总所有部门") + @PostMapping(value = "/collectAllDepart") + public Result collectAllDepart(@RequestBody DepartAbilityEvaluation departAbilityEvaluation) { + if (StrUtil.isNotBlank(departAbilityEvaluation.getDepetId())) {//部门不为空时汇总该部门 + departAbilityEvaluationService.collectAbilityEvaluation(departAbilityEvaluation); + } else { + departAbilityEvaluationService.collectAllDepart(departAbilityEvaluation); + } + return Result.OK("添加成功!"); + } + + @ApiOperation(value = "院系年度能力评价-重新汇算", notes = "院系年度能力评价-重新汇算") + @PostMapping(value = "/reCollectAbilityEvaluation") + public Result reCollectAbilityEvaluation(@RequestBody DepartAbilityEvaluation departAbilityEvaluation) { + departAbilityEvaluationService.collectAbilityEvaluation(departAbilityEvaluation); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param departAbilityEvaluation + * @return + */ + @ApiOperation(value = "院系年度能力评价-编辑", notes = "院系年度能力评价-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody DepartAbilityEvaluation departAbilityEvaluation) { + departAbilityEvaluationService.updateById(departAbilityEvaluation); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "院系年度能力评价-通过id删除", notes = "院系年度能力评价-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + departAbilityEvaluationService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "院系年度能力评价-批量删除", notes = "院系年度能力评价-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.departAbilityEvaluationService.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 queryById(@RequestParam(name = "id", required = true) String id) { + DepartAbilityEvaluation departAbilityEvaluation = departAbilityEvaluationService.getById(id); + if (departAbilityEvaluation == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(departAbilityEvaluation); + } + + /** + * 导出excel + * + * @param request + * @param departAbilityEvaluation + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, DepartAbilityEvaluation departAbilityEvaluation) { + return super.exportXls(request, departAbilityEvaluation, DepartAbilityEvaluation.class, "院系年度能力评价"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, DepartAbilityEvaluation.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationCollectController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationCollectController.java new file mode 100644 index 00000000..03aa9923 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationCollectController.java @@ -0,0 +1,183 @@ +package org.jeecg.modules.demo.abilityEvaluation.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationCollectService; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 个人能力评价 汇总 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +@Api(tags = "个人能力评价 汇总") +@RestController +@RequestMapping("/abilityEvaluation/personalAbilityEvaluationCollect") +@Slf4j +public class PersonalAbilityEvaluationCollectController extends JeecgController { + @Autowired + private IPersonalAbilityEvaluationCollectService personalAbilityEvaluationCollectService; + + @Autowired + private ISysUserService iSysUserService; + + /** + * 分页列表查询 + * + * @param personalAbilityEvaluationCollect + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人能力评价 汇总-分页列表查询") + @ApiOperation(value = "个人能力评价 汇总-分页列表查询", notes = "个人能力评价 汇总-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(PersonalAbilityEvaluationCollect personalAbilityEvaluationCollect, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalAbilityEvaluationCollect, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalAbilityEvaluationCollectService.page(page, queryWrapper); + return Result.OK(pageList); + } + + + /** + * 分页列表查询(学生端) + * + * @param personalAbilityEvaluationCollect + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人能力评价 汇总-分页列表查询") + @ApiOperation(value = "个人能力评价 汇总-分页列表查询", notes = "个人能力评价 汇总-分页列表查询") + @GetMapping(value = "/liststu") + public Result> liststu(PersonalAbilityEvaluationCollect personalAbilityEvaluationCollect, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalAbilityEvaluationCollect, req.getParameterMap()); + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + SysUser user1 = iSysUserService.getById(user.getId()); + queryWrapper.eq("work_on",user1.getWorkNo()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalAbilityEvaluationCollectService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param personalAbilityEvaluationCollect + * @return + */ + @ApiOperation(value = "个人能力评价 汇总-添加", notes = "个人能力评价 汇总-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody PersonalAbilityEvaluationCollect personalAbilityEvaluationCollect) { + personalAbilityEvaluationCollectService.save(personalAbilityEvaluationCollect); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param personalAbilityEvaluationCollect + * @return + */ + @ApiOperation(value = "个人能力评价 汇总-编辑", notes = "个人能力评价 汇总-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody PersonalAbilityEvaluationCollect personalAbilityEvaluationCollect) { + personalAbilityEvaluationCollectService.updateById(personalAbilityEvaluationCollect); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "个人能力评价 汇总-通过id删除", notes = "个人能力评价 汇总-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + personalAbilityEvaluationCollectService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "个人能力评价 汇总-批量删除", notes = "个人能力评价 汇总-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.personalAbilityEvaluationCollectService.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 queryById(@RequestParam(name = "id", required = true) String id) { + PersonalAbilityEvaluationCollect personalAbilityEvaluationCollect = personalAbilityEvaluationCollectService.getById(id); + if (personalAbilityEvaluationCollect == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(personalAbilityEvaluationCollect); + } + + /** + * 导出excel + * + * @param request + * @param personalAbilityEvaluationCollect + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, PersonalAbilityEvaluationCollect personalAbilityEvaluationCollect) { + return super.exportXls(request, personalAbilityEvaluationCollect, PersonalAbilityEvaluationCollect.class, "个人能力评价 汇总"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, PersonalAbilityEvaluationCollect.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java new file mode 100644 index 00000000..7c8b6905 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java @@ -0,0 +1,190 @@ +package org.jeecg.modules.demo.abilityEvaluation.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 个人能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-07 + * @Version: V1.0 + */ +@Api(tags = "个人能力评价") +@RestController +@RequestMapping("/abilityEvaluation/personalAbilityEvaluation") +@Slf4j +public class PersonalAbilityEvaluationController extends JeecgController { + @Autowired + private IPersonalAbilityEvaluationService personalAbilityEvaluationService; + + /** + * 分页列表查询 + * + * @param personalAbilityEvaluation + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人能力评价-分页列表查询") + @ApiOperation(value = "个人能力评价-分页列表查询", notes = "个人能力评价-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(PersonalAbilityEvaluation personalAbilityEvaluation, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalAbilityEvaluation, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalAbilityEvaluationService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 分页列表查询(学生端) + * + * @param personalAbilityEvaluation + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人能力评价-分页列表查询") + @ApiOperation(value = "个人能力评价-分页列表查询", notes = "个人能力评价-分页列表查询") + @GetMapping(value = "/liststu") + public Result> liststu(PersonalAbilityEvaluation personalAbilityEvaluation, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalAbilityEvaluation, req.getParameterMap()); + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + queryWrapper.eq("work_on",user.getUsername()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalAbilityEvaluationService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param personalAbilityEvaluation + * @return + */ + @ApiOperation(value = "个人能力评价-添加", notes = "个人能力评价-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody PersonalAbilityEvaluation personalAbilityEvaluation) { + personalAbilityEvaluationService.save(personalAbilityEvaluation); + return Result.OK("添加成功!"); + } + +// @ApiOperation(value = "个人能力评价", notes = "个人能力评价") +// @PostMapping(value = "/personalAbilityEvaluation") +// public Result personalAbilityEvaluation(@RequestBody PersonalAbilityEvaluation personalAbilityEvaluation) { +// personalAbilityEvaluationService.personalAbilityEvaluation(personalAbilityEvaluation); +// return Result.OK("操作成功!"); +// } + + @ApiOperation(value = "个人能力评价", notes = "个人能力评价") + @PostMapping(value = "/personalAbilityEvaluation2") + public Result personalAbilityEvaluation2(@RequestBody PersonalAbilityEvaluation personalAbilityEvaluation) { + personalAbilityEvaluationService.personalAbilityEvaluation2(personalAbilityEvaluation); + return Result.OK("操作成功!"); + } + + /** + * 编辑 + * + * @param personalAbilityEvaluation + * @return + */ + @ApiOperation(value = "个人能力评价-编辑", notes = "个人能力评价-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody PersonalAbilityEvaluation personalAbilityEvaluation) { + personalAbilityEvaluationService.updateById(personalAbilityEvaluation); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "个人能力评价-通过id删除", notes = "个人能力评价-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + personalAbilityEvaluationService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "个人能力评价-批量删除", notes = "个人能力评价-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.personalAbilityEvaluationService.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 queryById(@RequestParam(name = "id", required = true) String id) { + PersonalAbilityEvaluation personalAbilityEvaluation = personalAbilityEvaluationService.getById(id); + if (personalAbilityEvaluation == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(personalAbilityEvaluation); + } + + /** + * 导出excel + * + * @param request + * @param personalAbilityEvaluation + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, PersonalAbilityEvaluation personalAbilityEvaluation) { + return super.exportXls(request, personalAbilityEvaluation, PersonalAbilityEvaluation.class, "个人能力评价"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, PersonalAbilityEvaluation.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/DepartAbilityEvaluation.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/DepartAbilityEvaluation.java new file mode 100644 index 00000000..52696cf9 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/DepartAbilityEvaluation.java @@ -0,0 +1,98 @@ +package org.jeecg.modules.demo.abilityEvaluation.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +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-11-09 + * @Version: V1.0 + */ +@Data +@TableName("depart_ability_evaluation") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "depart_ability_evaluation对象", description = "院系年度能力评价") +public class DepartAbilityEvaluation implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @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") + @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") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /** + * 所属部门 + */ + @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 depetId; + /** + * 年度 + */ + @Excel(name = "年度", width = 15, dictTable = "annual", dicText = "annual_name", dicCode = "id") + @Dict(dictTable = "annual", dicText = "annual_name", dicCode = "id") + @ApiModelProperty(value = "年度") + private String annualId; + + /** + * 基础能力id + */ + @Excel(name = "基础能力id", width = 15) + @ApiModelProperty(value = "基础能力id") + private String capacityId; + + /** + * 基础能力名称 + */ + @Excel(name = "基础能力名称", width = 15) + @ApiModelProperty(value = "基础能力名称") + private String capacityName; + + /** + * 能力值 + */ + @Excel(name = "能力值", width = 15) + @ApiModelProperty(value = "能力值") + private Double value; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java new file mode 100644 index 00000000..1501cb35 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java @@ -0,0 +1,206 @@ +package org.jeecg.modules.demo.abilityEvaluation.entity; + +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 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-11-07 + * @Version: V1.0 + */ +@Data +@TableName("personal_ability_evaluation") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "personal_ability_evaluation对象", description = "个人能力评价") +public class PersonalAbilityEvaluation implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @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") + @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") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /** + * 所属部门 + */ + @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 depetId; + /** + * 年度 + */ + @Excel(name = "年度", width = 15, dictTable = "annual", dicText = "annual_name", dicCode = "id") + @Dict(dictTable = "annual", dicText = "annual_name", dicCode = "id") + @ApiModelProperty(value = "年度") + private String annualId; + /** + * 年度比赛 + */ + @Excel(name = "年度比赛", width = 15) + @ApiModelProperty(value = "年度比赛") + @Dict(dictTable = "annual_comp", dicCode = "id", dicText = "name") + private String annualCompId; + /** + * 年度比赛项目 + */ + @Excel(name = "年度比赛项目", width = 15, dictTable = "annual_comp_point", dicText = "obj_name", dicCode = "id") + @Dict(dictTable = "annual_comp_point", dicText = "obj_name", dicCode = "id") + @ApiModelProperty(value = "年度比赛项目") + private String annualCompP; + + + /** + * 报名编号 + */ + @TableField(exist = false) + private String enrollCode; + + + /** + * 学号 + */ + @Excel(name = "学号", width = 15) + @ApiModelProperty(value = "学号") + private String workOn; + /** + * 姓名 + */ + @Excel(name = "姓名", width = 15) + @ApiModelProperty(value = "姓名") + private String name; +// /** +// * 能力1 +// */ +// @Excel(name = "能力1", width = 15) +// @ApiModelProperty(value = "能力1") +// private Double soc1; +// /** +// * 能力2 +// */ +// @Excel(name = "能力2", width = 15) +// @ApiModelProperty(value = "能力2") +// private Double soc2; +// /** +// * 能力3 +// */ +// @Excel(name = "能力3", width = 15) +// @ApiModelProperty(value = "能力3") +// private Double soc3; +// /** +// * 能力4 +// */ +// @Excel(name = "能力4", width = 15) +// @ApiModelProperty(value = "能力4") +// private Double soc4; +// /** +// * 能力5 +// */ +// @Excel(name = "能力5", width = 15) +// @ApiModelProperty(value = "能力5") +// private Double soc5; +// /** +// * 能力6 +// */ +// @Excel(name = "能力6", width = 15) +// @ApiModelProperty(value = "能力6") +// private Double soc6; +// /** +// * 能力7 +// */ +// @Excel(name = "能力7", width = 15) +// @ApiModelProperty(value = "能力7") +// private Double soc7; +// /** +// * 能力8 +// */ +// @Excel(name = "能力8", width = 15) +// @ApiModelProperty(value = "能力8") +// private Double soc8; +// /** +// * 能力9 +// */ +// @Excel(name = "能力9", width = 15) +// @ApiModelProperty(value = "能力9") +// private Double soc9; +// /** +// * 能力10 +// */ +// @Excel(name = "能力10", width = 15) +// @ApiModelProperty(value = "能力10") +// private Double soc10; +// /** +// * 能力11 +// */ +// @Excel(name = "能力11", width = 15) +// @ApiModelProperty(value = "能力11") +// private Double soc11; +// /** +// * 能力12 +// */ +// @Excel(name = "能力12", width = 15) +// @ApiModelProperty(value = "能力12") +// private Double soc12; + + /** + * 基础能力id + */ + @Excel(name = "基础能力id", width = 15) + @ApiModelProperty(value = "基础能力id") + private String capacityId; + + /** + * 基础能力名称 + */ + @Excel(name = "基础能力名称", width = 15) + @ApiModelProperty(value = "基础能力名称") + private String capacityName; + + /** + * 能力值 + */ + @Excel(name = "能力值", width = 15) + @ApiModelProperty(value = "能力值") + private Double value; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluationCollect.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluationCollect.java new file mode 100644 index 00000000..739f91a2 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluationCollect.java @@ -0,0 +1,110 @@ +package org.jeecg.modules.demo.abilityEvaluation.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +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-11-09 + * @Version: V1.0 + */ +@Data +@TableName("personal_ability_evaluation_collect") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "personal_ability_evaluation_collect对象", description = "个人能力评价 汇总") +public class PersonalAbilityEvaluationCollect implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @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") + @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") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + + /** + * 年度比赛项目id + */ + private String annualCompP; + + + /** + * 所属部门 + */ + @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 depetId; + /** + * 学号 + */ + @Excel(name = "学号", width = 15) + @ApiModelProperty(value = "学号") + private String workOn; + /** + * 姓名 + */ + @Excel(name = "姓名", width = 15) + @ApiModelProperty(value = "姓名") + private String name; + + /** + * 基础能力id + */ + @Excel(name = "基础能力id", width = 15) + @ApiModelProperty(value = "基础能力id") + private String capacityId; + + /** + * 基础能力名称 + */ + @Excel(name = "基础能力名称", width = 15) + @ApiModelProperty(value = "基础能力名称") + private String capacityName; + + /** + * 能力值 + */ + @Excel(name = "能力值", width = 15) + @ApiModelProperty(value = "能力值") + private Double value; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/DepartAbilityEvaluationMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/DepartAbilityEvaluationMapper.java new file mode 100644 index 00000000..ebfaa9c5 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/DepartAbilityEvaluationMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.abilityEvaluation.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 院系年度能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +public interface DepartAbilityEvaluationMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/PersonalAbilityEvaluationCollectMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/PersonalAbilityEvaluationCollectMapper.java new file mode 100644 index 00000000..23a8529a --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/PersonalAbilityEvaluationCollectMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.abilityEvaluation.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 个人能力评价 汇总 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +public interface PersonalAbilityEvaluationCollectMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/PersonalAbilityEvaluationMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/PersonalAbilityEvaluationMapper.java new file mode 100644 index 00000000..5b3c99a6 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/PersonalAbilityEvaluationMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.abilityEvaluation.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 个人能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-07 + * @Version: V1.0 + */ +public interface PersonalAbilityEvaluationMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/xml/PersonalAbilityEvaluationMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/xml/PersonalAbilityEvaluationMapper.xml new file mode 100644 index 00000000..3e7eb3c9 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/mapper/xml/PersonalAbilityEvaluationMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IDepartAbilityEvaluationService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IDepartAbilityEvaluationService.java new file mode 100644 index 00000000..4fe739d8 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IDepartAbilityEvaluationService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.abilityEvaluation.service; + +import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 院系年度能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +public interface IDepartAbilityEvaluationService extends IService { + + void collectAbilityEvaluation(DepartAbilityEvaluation departAbilityEvaluation); + + void collectAllDepart(DepartAbilityEvaluation departAbilityEvaluation); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationCollectService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationCollectService.java new file mode 100644 index 00000000..d007f9ef --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationCollectService.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.demo.abilityEvaluation.service; + +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * @Description: 个人能力评价 汇总 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +public interface IPersonalAbilityEvaluationCollectService extends IService { + + void batchSave(String projectId); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java new file mode 100644 index 00000000..5dcde5c7 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.demo.abilityEvaluation.service; + +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 个人能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-07 + * @Version: V1.0 + */ +public interface IPersonalAbilityEvaluationService extends IService { + + void personalAbilityEvaluation2(PersonalAbilityEvaluation personalAbilityEvaluation); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/DepartAbilityEvaluationServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/DepartAbilityEvaluationServiceImpl.java new file mode 100644 index 00000000..4d62b2bf --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/DepartAbilityEvaluationServiceImpl.java @@ -0,0 +1,83 @@ +package org.jeecg.modules.demo.abilityEvaluation.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.mapper.DepartAbilityEvaluationMapper; +import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService; +import org.jeecg.modules.system.entity.SysDepart; +import org.jeecg.modules.system.service.ISysDepartService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description: 院系年度能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +@Service +public class DepartAbilityEvaluationServiceImpl extends ServiceImpl implements IDepartAbilityEvaluationService { + + @Autowired + private IPersonalAbilityEvaluationService iPersonalAbilityEvaluationService; + + @Autowired + private ISysDepartService iSysDepartService; + + private final static String PARENT_ID = "1693446350597038081"; + + @Override + public void collectAbilityEvaluation(DepartAbilityEvaluation departAbilityEvaluation) { + + //id不为空时,为重新汇总,删除该学院年度下的所有数据,重新汇总 + if (StringUtils.isNotBlank(departAbilityEvaluation.getId())) { + DepartAbilityEvaluation evaluation = this.getById(departAbilityEvaluation.getId()); + this.remove(new LambdaQueryWrapper() + .eq(DepartAbilityEvaluation::getAnnualId, evaluation.getAnnualId()) + .eq(DepartAbilityEvaluation::getDepetId, evaluation.getDepetId()) + ); + } + + List abilityEvaluationList4Depet = iPersonalAbilityEvaluationService.list(new LambdaQueryWrapper() + .eq(PersonalAbilityEvaluation::getAnnualId, departAbilityEvaluation.getAnnualId()) + .eq(PersonalAbilityEvaluation::getDepetId, departAbilityEvaluation.getDepetId()) + ); + + Map> depetListMap = abilityEvaluationList4Depet.stream() + .collect(Collectors.groupingBy(PersonalAbilityEvaluation::getCapacityId)); + + List saveList = new LinkedList<>(); + Optional.ofNullable(depetListMap).orElse(new LinkedHashMap<>()).keySet().stream().forEach(k -> { + List evaluationList = depetListMap.get(k); + DepartAbilityEvaluation bean = new DepartAbilityEvaluation(); + bean.setAnnualId(departAbilityEvaluation.getAnnualId()); + bean.setDepetId(departAbilityEvaluation.getDepetId()); + bean.setCapacityId(evaluationList.get(0).getCapacityId()); + bean.setCapacityName(evaluationList.get(0).getCapacityName()); + bean.setValue(evaluationList.stream().mapToDouble(b -> b.getValue()).sum()); + bean.setCreateTime(new Date()); + saveList.add(bean); + }); + this.saveBatch(saveList); + } + + @Override + public void collectAllDepart(DepartAbilityEvaluation param) { + + this.remove(new LambdaQueryWrapper().eq(DepartAbilityEvaluation::getAnnualId, param.getAnnualId())); + List departList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, PARENT_ID)); + Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(e -> { + DepartAbilityEvaluation depart = new DepartAbilityEvaluation(); + depart.setAnnualId(param.getAnnualId()); + depart.setDepetId(e.getId()); + this.collectAbilityEvaluation(depart); + }); + } +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationCollectServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationCollectServiceImpl.java new file mode 100644 index 00000000..f94b3c01 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationCollectServiceImpl.java @@ -0,0 +1,107 @@ +package org.jeecg.modules.demo.abilityEvaluation.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect; +import org.jeecg.modules.demo.abilityEvaluation.mapper.PersonalAbilityEvaluationCollectMapper; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationCollectService; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; + +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description: 个人能力评价 汇总 + * @Author: jeecg-boot + * @Date: 2023-11-09 + * @Version: V1.0 + */ +@Service +public class PersonalAbilityEvaluationCollectServiceImpl extends ServiceImpl implements IPersonalAbilityEvaluationCollectService { + + + @Autowired + private IPersonalAbilityEvaluationService iPersonalAbilityEvaluationService; + + @Autowired + private ISysUserService iSysUserService; + + @Autowired + private ISysDepartService iSysDepartService; + + /** + * @Title: batchSave + * @Description: + * @Params: [projectId] + * @Return: void + * @Author: z.h.c + * @Date: 2023/11/17 15:49 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void batchSave(String projectId) { + + List evaluations = iPersonalAbilityEvaluationService.list(new LambdaQueryWrapper() + .eq(PersonalAbilityEvaluation::getAnnualCompP, projectId)); + + //该项目下参赛者们学号列表 + Set workNoSet = evaluations.stream().map(en -> en.getWorkOn()).collect(Collectors.toSet()); + + if (!ObjectUtils.isEmpty(workNoSet)) { + //删除该项目下参赛者们的能力量化汇总数据,用于重新汇总 + this.remove(new LambdaQueryWrapper() + .in(PersonalAbilityEvaluationCollect::getWorkOn, workNoSet)); + } + + List saveList = new LinkedList<>(); + + DecimalFormat decimalFormat = new DecimalFormat(); + decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 + decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 + + + //根据学号重新汇总 + Optional.ofNullable(workNoSet).orElse(new LinkedHashSet<>()).stream().forEach(workNo -> { + SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper().eq(SysUser::getWorkNo, workNo)); + + //每个学生同一类型能力指标分组查询 + List evaluationList4User = iPersonalAbilityEvaluationService.list(new LambdaQueryWrapper() + .eq(PersonalAbilityEvaluation::getWorkOn, workNo)); + + Map> capacityListMap = evaluationList4User.stream() + .collect(Collectors.groupingBy(PersonalAbilityEvaluation::getCapacityId)); + + capacityListMap.keySet().stream().forEach(k -> { + List list = capacityListMap.get(k); + PersonalAbilityEvaluationCollect person = new PersonalAbilityEvaluationCollect(); + person.setAnnualCompP(projectId); + SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode,sysUser.getOrgCode())); +// bean.setDepet(sysDepart.getId()); + person.setDepetId(sysDepart.getId()); + person.setWorkOn(workNo); + person.setName(sysUser.getRealname()); + person.setCapacityId(list.get(0).getCapacityId()); + person.setCapacityName(list.get(0).getCapacityName()); + double sum = list.stream().mapToDouble(e -> e.getValue()).sum(); + Double aDouble = Double.valueOf(decimalFormat.format(sum)); + + person.setValue(aDouble); + saveList.add(person); + }); + }); + + this.saveBatch(saveList); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java new file mode 100644 index 00000000..58ec2db4 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java @@ -0,0 +1,157 @@ +package org.jeecg.modules.demo.abilityEvaluation.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.util.ComputeUtils; +import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; +import org.jeecg.modules.demo.abilityEvaluation.mapper.PersonalAbilityEvaluationMapper; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationCollectService; +import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService; +import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; +import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; +import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; +import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; +import org.jeecg.modules.demo.basicsskill.entity.Basicsskill; +import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService; +import org.jeecg.modules.demo.compskill.entity.Compskill; +import org.jeecg.modules.demo.compskill.service.ICompskillService; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; + +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + +/** + * @Description: 个人能力评价 + * @Author: jeecg-boot + * @Date: 2023-11-07 + * @Version: V1.0 + */ +@Service +public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl implements IPersonalAbilityEvaluationService { + + @Autowired + private IAnnualCompPointService iAnnualCompPointService; + +// @Autowired +// private IAwardPersionService iAwardPersionService; +// +// @Autowired +// private IScorePersionService iScorePersionService; + + @Autowired + private ICompskillService iCompskillService; + + @Autowired + private IBasicsskillService iBasicsskillService; + + @Autowired + private IPersonalCompScoreService iPersonalCompScoreService; + + @Autowired + private ISysUserService iSysUserService; + +// @Autowired +// private ITeamManagementService iTeamManagementService; + + @Autowired + private IAnnualCompService iAnnualCompService; + + @Autowired + private IPersonalAbilityEvaluationCollectService iPersonalAbilityEvaluationCollectService; + + private static final Integer ONE_HUNDRED = 100; + + /** + * @description: 1、在年度项目管理操作列,添加“个人能力评价”操作, + * 2、个人能力评价可以重复操作 + * 3、在个人能力评价中自动完成个人能力汇总功能, + * 4、实现方法:每次操作个人能力评价都删除该项目下的个人能力评价数据和个人能力评价汇总数据,再重新增加 + * @param: [param] + * @return: void + * @author: z.h.c + * @date: 23/11/9 16:45 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void personalAbilityEvaluation2(PersonalAbilityEvaluation param) { + + //年度比赛id + String annualCompId = param.getAnnualCompId(); + //年度比赛项目id + String projectId = param.getId(); + + //年度比赛 + AnnualComp annualComp = iAnnualCompService.getById(annualCompId); + if (ObjectUtils.isEmpty(annualComp)) return; + + //年度比赛项目,状态为已评奖时才能进行能力评价 + AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(projectId); + if (ObjectUtils.isEmpty(annualCompPoint)) return; + + //查询项目各能力权值 + List compskillList = iCompskillService.list(new LambdaQueryWrapper().eq(Compskill::getAnnucompid, projectId)); + if (ObjectUtils.isEmpty(compskillList)) return; + + List personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper().eq(PersonalCompScore::getAnnualCompP, projectId)); + + List saveList = new LinkedList<>(); + Optional.ofNullable(personalCompScoreList).orElse(new LinkedList<>()).stream().forEach(en -> { + + //在lambda中,使用return时并不会直接返回,而是进行相当于普通for里的continue操作。所以直接使用return即可。 + //分数为空时,继续下一条 + if (ObjectUtils.isEmpty(en.getScore())) return; + + SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper().eq(SysUser::getWorkNo, en.getWorkOn())); + //遍历每一类能力指标 + compskillList.forEach(compskill -> { + PersonalAbilityEvaluation person = new PersonalAbilityEvaluation(); + person.setAnnualId(annualComp.getAnnualid()); + person.setAnnualCompId(annualCompPoint.getAnnualCompId()); + person.setAnnualCompP(projectId); + person.setWorkOn(en.getWorkOn()); + person.setName(sysUser.getRealname()); + person.setDepetId(en.getDepet()); + + Basicsskill basicsskill = iBasicsskillService.getById(compskill.getCapacityid()); + person.setCapacityId(compskill.getCapacityid()); + person.setCapacityName(basicsskill.getName()); + + //计算能力量化各类指标 能力量化值 = 直接按项目的能力权值和项目奖项得分算 + //能力量化值 = 个人积分*项目的能力权值/100 + this.convertScore(compskill.getWeight(), person, en.getScore()); + saveList.add(person); + }); + + }); + + //删除该项目下所有人的能力量化数据 + this.remove(new LambdaQueryWrapper() + .eq(PersonalAbilityEvaluation::getAnnualCompP, projectId)); + + //新增个人能力量化 + this.saveBatch(saveList); + + //新增个人能力量化汇总 + iPersonalAbilityEvaluationCollectService.batchSave(projectId); + } + + + PersonalAbilityEvaluation convertScore(double weight, PersonalAbilityEvaluation person, final double score_d) { + DecimalFormat decimalFormat = new DecimalFormat(); + decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 + decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 + double val = ComputeUtils.mul2(score_d, ComputeUtils.div2(weight, ONE_HUNDRED)); + person.setValue(Double.valueOf(decimalFormat.format(val))); + return person; + } +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/DepartCompTotalScoreController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/DepartCompTotalScoreController.java new file mode 100644 index 00000000..4d2fcc5c --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/DepartCompTotalScoreController.java @@ -0,0 +1,188 @@ +package org.jeecg.modules.demo.annualScore.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.demo.annualScore.entity.DepartCompTotalScore; +import org.jeecg.modules.demo.annualScore.service.IDepartCompTotalScoreService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 院系总积分 + * @Author: jeecg-boot + * @Date: 2023-11-02 + * @Version: V1.0 + */ +@Api(tags = "院系总积分") +@RestController +@RequestMapping("/annualScore/departCompTotalScore") +@Slf4j +public class DepartCompTotalScoreController extends JeecgController { + @Autowired + private IDepartCompTotalScoreService departCompTotalScoreService; + + @ApiOperation(value = "院系总积分-重新汇算", notes = "院系总积分-重新汇算") + @PostMapping(value = "/reCollectScore") + public Result reCollectScore(@RequestBody DepartCompTotalScore departCompTotalScore) { + log.info("院系总积分-重新汇算 params:{}--", departCompTotalScore); + departCompTotalScoreService.collectScore(departCompTotalScore); + return Result.OK("操作成功!"); + } + + /** + * 添加 + * + * @param departCompTotalScore + * @return + */ +// @AutoLog(value = "院系总积分-添加") + @ApiOperation(value = "院系总积分-汇总", notes = "院系总积分-汇总") + @PostMapping(value = "/add") + public Result add(@RequestBody DepartCompTotalScore departCompTotalScore) { + departCompTotalScoreService.collectScore(departCompTotalScore); + return Result.OK("添加成功!"); + } + + /** + * @Title: add + * @Description: 部门为空时汇总所有部门, 不为空时汇总该部门 + * @Params: [departCompTotalScore] + * @Return: org.jeecg.common.api.vo.Result + * @Author: z.h.c + * @Date: 2024/7/30 22:26 + */ + @ApiOperation(value = "院系总积分-汇总所有部门", notes = "院系总积分-汇总所有部门") + @PostMapping(value = "/collectAllDepart") + public Result collectAllDepart(@RequestBody DepartCompTotalScore departCompTotalScore) { + if (StrUtil.isNotBlank(departCompTotalScore.getDepet())) {//部门不为空时汇总该部门 + departCompTotalScoreService.collectScore(departCompTotalScore); + } else { + departCompTotalScoreService.collectAllDepart(departCompTotalScore); + } + return Result.OK("添加成功!"); + } + + /** + * 分页列表查询 + * + * @param departCompTotalScore + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "院系总积分-分页列表查询") + @ApiOperation(value = "院系总积分-分页列表查询", notes = "院系总积分-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(DepartCompTotalScore departCompTotalScore, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(departCompTotalScore, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = departCompTotalScoreService.page(page, queryWrapper); + return Result.OK(pageList); + } + + + /** + * 编辑 + * + * @param departCompTotalScore + * @return + */ +// @AutoLog(value = "院系总积分-编辑") + @ApiOperation(value = "院系总积分-编辑", notes = "院系总积分-编辑") +// @RequiresPermissions("annualScore:depart_comp_total_score:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody DepartCompTotalScore departCompTotalScore) { + departCompTotalScoreService.updateById(departCompTotalScore); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ +// @AutoLog(value = "院系总积分-通过id删除") + @ApiOperation(value = "院系总积分-通过id删除", notes = "院系总积分-通过id删除") +// @RequiresPermissions("annualScore:depart_comp_total_score:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + departCompTotalScoreService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ +// @AutoLog(value = "院系总积分-批量删除") + @ApiOperation(value = "院系总积分-批量删除", notes = "院系总积分-批量删除") +// @RequiresPermissions("annualScore:depart_comp_total_score:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.departCompTotalScoreService.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 queryById(@RequestParam(name = "id", required = true) String id) { + DepartCompTotalScore departCompTotalScore = departCompTotalScoreService.getById(id); + if (departCompTotalScore == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(departCompTotalScore); + } + + /** + * 导出excel + * + * @param request + * @param departCompTotalScore + */ +// @RequiresPermissions("annualScore:depart_comp_total_score:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, DepartCompTotalScore departCompTotalScore) { + return super.exportXls(request, departCompTotalScore, DepartCompTotalScore.class, "院系总积分"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ +// @RequiresPermissions("annualScore:depart_comp_total_score:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, DepartCompTotalScore.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompScoreController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompScoreController.java new file mode 100644 index 00000000..17c3cae0 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompScoreController.java @@ -0,0 +1,201 @@ +package org.jeecg.modules.demo.annualScore.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 个人比赛积分 + * @Author: jeecg-boot + * @Date: 2023-10-30 + * @Version: V1.0 + */ +@Api(tags = "个人比赛积分") +@RestController +@RequestMapping("/annualScore/personalCompScore") +@Slf4j +public class PersonalCompScoreController extends JeecgController { + @Autowired + private IPersonalCompScoreService personalCompScoreService; + + + /** + * @description: 统计汇总-个人比赛积分 + * @param: [personalCompScore] + * @return: org.jeecg.common.api.vo.Result + * @author: z.h.c + * @date: 23/10/30 17:26 + */ + @ApiOperation(value = "个人比赛积分-统计汇总", notes = "个人比赛积分-统计汇总") + @PostMapping(value = "/collectScore") + public Result collectScore4Person(@RequestBody PersonalCompScore personalCompScore) { + log.info("个人积分汇总 params:{}--", personalCompScore); + personalCompScoreService.collectScore(personalCompScore); + return Result.OK("操作成功!"); + } + + + /** + * 分页列表查询 + * + * @param personalCompScore + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人比赛积分-分页列表查询") + @ApiOperation(value = "个人比赛积分-分页列表查询", notes = "个人比赛积分-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(PersonalCompScore personalCompScore, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalCompScore, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalCompScoreService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 分页列表查询(学生端) + * + * @param personalCompScore + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人比赛积分-分页列表查询") + @ApiOperation(value = "个人比赛积分-分页列表查询", notes = "个人比赛积分-分页列表查询") + @GetMapping(value = "/liststu") + public Result> liststu(PersonalCompScore personalCompScore, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalCompScore, req.getParameterMap()); + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + queryWrapper.eq("work_on",user.getUsername()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalCompScoreService.page(page, queryWrapper); + return Result.OK(pageList); + } + + + /** + * 添加 + * + * @param personalCompScore + * @return + */ + @ApiOperation(value = "个人比赛积分-添加", notes = "个人比赛积分-添加") +// @RequiresPermissions("annualScore:personal_comp_score:add") + @PostMapping(value = "/add") + public Result add(@RequestBody PersonalCompScore personalCompScore) { + personalCompScoreService.save(personalCompScore); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param personalCompScore + * @return + */ + @ApiOperation(value = "个人比赛积分-编辑", notes = "个人比赛积分-编辑") +// @RequiresPermissions("annualScore:personal_comp_score:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody PersonalCompScore personalCompScore) { + personalCompScoreService.updateById(personalCompScore); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "个人比赛积分-通过id删除", notes = "个人比赛积分-通过id删除") +// @RequiresPermissions("annualScore:personal_comp_score:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + personalCompScoreService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "个人比赛积分-批量删除", notes = "个人比赛积分-批量删除") +// @RequiresPermissions("annualScore:personal_comp_score:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.personalCompScoreService.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 queryById(@RequestParam(name = "id", required = true) String id) { + PersonalCompScore personalCompScore = personalCompScoreService.getById(id); + if (personalCompScore == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(personalCompScore); + } + + /** + * 导出excel + * + * @param request + * @param personalCompScore + */ +// @RequiresPermissions("annualScore:personal_comp_score:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, PersonalCompScore personalCompScore) { + return super.exportXls(request, personalCompScore, PersonalCompScore.class, "个人比赛积分"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequiresPermissions("annualScore:personal_comp_score:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, PersonalCompScore.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompTotalScoreController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompTotalScoreController.java new file mode 100644 index 00000000..5b142d59 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/controller/PersonalCompTotalScoreController.java @@ -0,0 +1,186 @@ +package org.jeecg.modules.demo.annualScore.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 个人总积分 + * @Author: jeecg-boot + * @Date: 2023-11-01 + * @Version: V1.0 + */ +@Api(tags = "个人总积分") +@RestController +@RequestMapping("/annualScore/personalCompTotalScore") +@Slf4j +public class PersonalCompTotalScoreController extends JeecgController { + @Autowired + private IPersonalCompTotalScoreService personalCompTotalScoreService; + + @Autowired + private ISysUserService iSysUserService; + + /** + * 分页列表查询 + * + * @param personalCompTotalScore + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人总积分-分页列表查询") + @ApiOperation(value = "个人总积分-分页列表查询", notes = "个人总积分-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(PersonalCompTotalScore personalCompTotalScore, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalCompTotalScore, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalCompTotalScoreService.page(page, queryWrapper); + return Result.OK(pageList); + } + + + + /** + * 分页列表查询(学生端) + * + * @param personalCompTotalScore + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "个人总积分-分页列表查询") + @ApiOperation(value = "个人总积分-分页列表查询", notes = "个人总积分-分页列表查询") + @GetMapping(value = "/liststu") + public Result> liststu(PersonalCompTotalScore personalCompTotalScore, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(personalCompTotalScore, req.getParameterMap()); + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + SysUser user1 = iSysUserService.getById(user.getId()); + queryWrapper.eq("work_on",user1.getWorkNo()); + Page page = new Page(pageNo, pageSize); + IPage pageList = personalCompTotalScoreService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param personalCompTotalScore + * @return + */ + @ApiOperation(value = "个人总积分-添加", notes = "个人总积分-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody PersonalCompTotalScore personalCompTotalScore) { + personalCompTotalScoreService.save(personalCompTotalScore); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param personalCompTotalScore + * @return + */ + @ApiOperation(value = "个人总积分-编辑", notes = "个人总积分-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody PersonalCompTotalScore personalCompTotalScore) { + personalCompTotalScoreService.updateById(personalCompTotalScore); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "个人总积分-通过id删除", notes = "个人总积分-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + personalCompTotalScoreService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "个人总积分-批量删除", notes = "个人总积分-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.personalCompTotalScoreService.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 queryById(@RequestParam(name = "id", required = true) String id) { + PersonalCompTotalScore personalCompTotalScore = personalCompTotalScoreService.getById(id); + if (personalCompTotalScore == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(personalCompTotalScore); + } + + /** + * 导出excel + * + * @param request + * @param personalCompTotalScore + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, PersonalCompTotalScore personalCompTotalScore) { + return super.exportXls(request, personalCompTotalScore, PersonalCompTotalScore.class, "个人总积分"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, PersonalCompTotalScore.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/DepartCompTotalScore.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/DepartCompTotalScore.java new file mode 100644 index 00000000..34ed18d8 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/DepartCompTotalScore.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.demo.annualScore.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.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 院系总积分 + * @Author: jeecg-boot + * @Date: 2023-11-02 + * @Version: V1.0 + */ +@Data +@TableName("depart_comp_total_score") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="depart_comp_total_score对象", description="院系总积分") +public class DepartCompTotalScore implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @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") + @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") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**所属部门*/ + @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 depet; + /**年度*/ + @Excel(name = "年度", width = 15, dictTable = "annual", dicText = "annual_name", dicCode = "id") + @Dict(dictTable = "annual", dicText = "annual_name", dicCode = "id") + @ApiModelProperty(value = "年度") + private String annualId; + /**积分*/ + @Excel(name = "积分", width = 15) + @ApiModelProperty(value = "积分") + private Double score; + /**备注*/ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompScore.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompScore.java new file mode 100644 index 00000000..fc49ce87 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompScore.java @@ -0,0 +1,115 @@ +package org.jeecg.modules.demo.annualScore.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +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-10-30 + * @Version: V1.0 + */ +@Data +@TableName("personal_comp_score") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "personal_comp_score对象", description = "个人比赛积分") +public class PersonalCompScore implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @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") + @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") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /** + * 所属院系 + */ + @Excel(name = "所属院系", width = 15) + @ApiModelProperty(value = "所属院系") + @Dict(dictTable = "sys_depart",dicCode = "id",dicText = "depart_name") + private String depet; + /** + * 学号 + */ + @Excel(name = "学号", width = 15) + @ApiModelProperty(value = "学号") + private String workOn; + /** + * 姓名 + */ + @Excel(name = "姓名", width = 15) + @ApiModelProperty(value = "姓名") + private String name; + /** + * 年度 + */ + @Excel(name = "年度", width = 15) + @ApiModelProperty(value = "年度") + @Dict(dictTable = "annual",dicCode = "id",dicText = "annual_name") + private String annualId; + /** + * 年度比赛 + */ + @Excel(name = "年度比赛", width = 15) + @ApiModelProperty(value = "年度比赛") + @Dict(dictTable = "annual_comp",dicCode = "id",dicText = "name") + private String annualCompId; + /** + * 年度比赛项目 + */ + @Excel(name = "年度比赛项目", width = 15) + @Dict(dictTable = "annual_comp_point",dicCode = "id",dicText = "obj_name") + @ApiModelProperty(value = "年度比赛项目") + private String annualCompP; + /** + * 个人积分 + */ + @Excel(name = "个人积分", width = 15) + @ApiModelProperty(value = "个人积分") + private Double score; + /** + * 备注 + */ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompTotalScore.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompTotalScore.java new file mode 100644 index 00000000..d16cbc7b --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/entity/PersonalCompTotalScore.java @@ -0,0 +1,94 @@ +package org.jeecg.modules.demo.annualScore.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +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-11-01 + * @Version: V1.0 + */ +@Data +@TableName("personal_comp_total_score") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "personal_comp_total_score对象", description = "个人总积分") +public class PersonalCompTotalScore implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @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") + @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") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /** + * 院系 + */ + @Excel(name = "院系", width = 15) + @ApiModelProperty(value = "院系") + @Dict(dictTable = "sys_depart",dicCode = "id",dicText = "depart_name") + private String depet; + /** + * 学号 + */ + @Excel(name = "学号", width = 15) + @ApiModelProperty(value = "学号") + private String workOn; + /** + * 姓名 + */ + @Excel(name = "姓名", width = 15) + @ApiModelProperty(value = "姓名") + private String name; + /** + * 总积分 + */ + @Excel(name = "总积分", width = 15) + @ApiModelProperty(value = "总积分") + private Double score; + /** + * 描述 + */ + @Excel(name = "描述", width = 15) + @ApiModelProperty(value = "描述") + private String remark; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/DepartCompTotalScoreMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/DepartCompTotalScoreMapper.java new file mode 100644 index 00000000..1fedf1db --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/DepartCompTotalScoreMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.annualScore.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.annualScore.entity.DepartCompTotalScore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 院系总积分 + * @Author: jeecg-boot + * @Date: 2023-11-02 + * @Version: V1.0 + */ +public interface DepartCompTotalScoreMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompScoreMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompScoreMapper.java new file mode 100644 index 00000000..c28e3a36 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompScoreMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.annualScore.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 个人比赛积分 + * @Author: jeecg-boot + * @Date: 2023-10-30 + * @Version: V1.0 + */ +public interface PersonalCompScoreMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompTotalScoreMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompTotalScoreMapper.java new file mode 100644 index 00000000..d1162335 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/PersonalCompTotalScoreMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.annualScore.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 个人总积分 + * @Author: jeecg-boot + * @Date: 2023-11-01 + * @Version: V1.0 + */ +public interface PersonalCompTotalScoreMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/DepartCompTotalScoreMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/DepartCompTotalScoreMapper.xml new file mode 100644 index 00000000..a91cd5b4 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/DepartCompTotalScoreMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompScoreMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompScoreMapper.xml new file mode 100644 index 00000000..a75e5ec2 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompScoreMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompTotalScoreMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompTotalScoreMapper.xml new file mode 100644 index 00000000..aa58f91b --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/mapper/xml/PersonalCompTotalScoreMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IDepartCompTotalScoreService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IDepartCompTotalScoreService.java new file mode 100644 index 00000000..32302cee --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IDepartCompTotalScoreService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.annualScore.service; + +import org.jeecg.modules.demo.annualScore.entity.DepartCompTotalScore; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 院系总积分 + * @Author: jeecg-boot + * @Date: 2023-11-02 + * @Version: V1.0 + */ +public interface IDepartCompTotalScoreService extends IService { + + void collectScore(DepartCompTotalScore departCompTotalScore); + + void collectAllDepart(DepartCompTotalScore departCompTotalScore); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompScoreService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompScoreService.java new file mode 100644 index 00000000..a0445d18 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompScoreService.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.demo.annualScore.service; + +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 个人比赛积分 + * @Author: jeecg-boot + * @Date: 2023-10-30 + * @Version: V1.0 + */ +public interface IPersonalCompScoreService extends IService { + + void collectScore(PersonalCompScore personalCompScore); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompTotalScoreService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompTotalScoreService.java new file mode 100644 index 00000000..795a426d --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/IPersonalCompTotalScoreService.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.demo.annualScore.service; + +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * @Description: 个人总积分 + * @Author: jeecg-boot + * @Date: 2023-11-01 + * @Version: V1.0 + */ +public interface IPersonalCompTotalScoreService extends IService { + + void saveOrUpdateTotalScore(List saveList); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/DepartCompTotalScoreServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/DepartCompTotalScoreServiceImpl.java new file mode 100644 index 00000000..95f0b06d --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/DepartCompTotalScoreServiceImpl.java @@ -0,0 +1,91 @@ +package org.jeecg.modules.demo.annualScore.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.modules.demo.annualScore.entity.DepartCompTotalScore; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.mapper.DepartCompTotalScoreMapper; +import org.jeecg.modules.demo.annualScore.service.IDepartCompTotalScoreService; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; +import org.jeecg.modules.system.entity.SysDepart; +import org.jeecg.modules.system.service.ISysDepartService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; + +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + +/** + * @Description: 院系总积分 + * @Author: jeecg-boot + * @Date: 2023-11-02 + * @Version: V1.0 + */ +@Service +public class DepartCompTotalScoreServiceImpl extends ServiceImpl implements IDepartCompTotalScoreService { + + @Autowired + private IPersonalCompScoreService iPersonalCompScoreService; + + @Autowired + private ISysDepartService iSysDepartService; + + private final static String PARENT_ID = "1693446350597038081"; + + + /** + * @description: 根据院系和年度,统计个人比赛积分表数据 + * @param: [departCompTotalScore] + * @return: void + * @author: z.h.c + * @date: 23/11/2 15:45 + */ + @Override + public void collectScore(DepartCompTotalScore departCompTotalScore) { + + List personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper() + .eq(PersonalCompScore::getAnnualId, departCompTotalScore.getAnnualId()) + .eq(PersonalCompScore::getDepet, departCompTotalScore.getDepet()) + ); + + double totalScore = 0; + DecimalFormat decimalFormat = new DecimalFormat(totalScore + ""); + decimalFormat.setMaximumFractionDigits(2); // 保留两位小数 + decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制 + if (!ObjectUtils.isEmpty(personalCompScoreList)) { + totalScore = personalCompScoreList.stream().mapToDouble(PersonalCompScore::getScore).sum(); + } + departCompTotalScore.setScore(new Double(decimalFormat.format(totalScore))); + + + //id不为空,院系的某一年度已汇总过,重新汇算 + if (StringUtils.isNotEmpty(departCompTotalScore.getId())) { + departCompTotalScore.setUpdateTime(new Date()); + this.updateById(departCompTotalScore); + } else { + //首次汇总 + departCompTotalScore.setCreateTime(new Date()); + this.save(departCompTotalScore); + } + + } + + @Override + public void collectAllDepart(DepartCompTotalScore param) { + + this.remove(new LambdaQueryWrapper().eq(DepartCompTotalScore::getAnnualId, param.getAnnualId())); + List departList = iSysDepartService.list(new LambdaQueryWrapper().eq(SysDepart::getParentId, PARENT_ID)); + Optional.ofNullable(departList).orElse(new LinkedList<>()).stream().forEach(e -> { + DepartCompTotalScore depart = new DepartCompTotalScore(); + depart.setAnnualId(param.getAnnualId()); + depart.setDepet(e.getId()); + this.collectScore(depart); + }); + } +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java new file mode 100644 index 00000000..16c7f1cf --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java @@ -0,0 +1,242 @@ +package org.jeecg.modules.demo.annualScore.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.util.ComputeUtils; +import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; +import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.mapper.PersonalCompScoreMapper; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService; +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.service.IAnnualCompAwardService; +import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.TeamManagement; +import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.ITeamManagementService; +import org.jeecg.modules.demo.awardpersion.entity.AwardPersion; +import org.jeecg.modules.demo.awardpersion.service.IAwardPersionService; +import org.jeecg.modules.demo.comp.entity.Comp; +import org.jeecg.modules.demo.comp.service.ICompService; +import org.jeecg.modules.demo.projectlevel.entity.Projectlevel; +import org.jeecg.modules.demo.projectlevel.service.IProjectlevelService; +import org.jeecg.modules.demo.teamseq.entity.TeamSeq; +import org.jeecg.modules.demo.teamseq.service.ITeamSeqService; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +/** + * @Description: 个人比赛积分 + * @Author: jeecg-boot + * @Date: 2023-10-30 + * @Version: V1.0 + */ +@Service +@Slf4j +public class PersonalCompScoreServiceImpl extends ServiceImpl implements IPersonalCompScoreService { + + @Autowired + private IAnnualCompService iAnnualCompService; + @Autowired + private IAnnualCompPointService iAnnualCompPointService; + @Autowired + private ICompService iCompService; + @Autowired + private IAnnualCompAwardService iAnnualCompAwardService; + @Autowired + private ITeamManagementService iTeamManagementService; + + @Autowired + private IProjectlevelService iProjectlevelService; + + @Autowired + private ISysUserService iSysUserService; + + @Autowired + private IPersonalCompTotalScoreService iPersonalCompTotalScoreService; + + @Autowired + private IAwardPersionService iAwardPersionService; + + @Autowired + private ISysDepartService iSysDepartService; + + private static final Integer ONE_HUNDRED = 100; + private static final Double ZERO_POINT_FIVE = 0.5; + private static final Double ZERO_POINT_TWO = 0.2; + + + @Override + @Transactional(rollbackFor = Exception.class) + public void collectScore(PersonalCompScore personalCompScore) { + + //年度比赛id + String annualCompId = personalCompScore.getAnnualCompId(); + + //年度比赛 + AnnualComp annualComp = iAnnualCompService.getById(annualCompId); + if (ObjectUtils.isEmpty(annualComp)) return; + + //比赛 + Comp comp = iCompService.getById(annualComp.getCompid()); + if (ObjectUtils.isEmpty(comp)) return; + //项目分值 + Integer compweight = comp.getCompweight(); + double compweight_val = compweight.doubleValue(); + + //年度比赛项目,只有isPj为1时才能触发个人比赛积分汇总 + AnnualCompPoint annualCompPoint = iAnnualCompPointService.getOne(new LambdaQueryWrapper() +// .eq(AnnualCompPoint::getAnnualCompId, annualCompId) + .eq(AnnualCompPoint::getId, personalCompScore.getAnnualCompP()) + .eq(AnnualCompPoint::getIsPj, new Integer(1)) + ); + + List saveList = new LinkedList<>(); + if (!ObjectUtils.isEmpty(annualCompPoint)) { + //年度比赛项目 奖项设置 + AnnualCompAward annualCompAward = iAnnualCompAwardService.getOne(new LambdaQueryWrapper() + .eq(AnnualCompAward::getAnnucompid, annualCompPoint.getId())); + if (ObjectUtils.isEmpty(annualCompAward)) return; + + //1、根据年度比赛项目id,查询获取管理(award_persion)列表,即参赛人员及获取奖项顺序号 + List awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper() + .eq(AwardPersion::getAnnualCompP, annualCompPoint.getId())); + + //2、遍历获奖管理(award_persion)列表,根据奖项id查询比赛奖项设置表(annual_comp_award) + Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).forEach(en -> { + + //2.1、比赛奖项设置 根据awardsort奖项顺序,获取对应的奖项权重值 + //奖项顺序与奖项权重值映射关系: wardsort(1:first_weight,2:second_weight,3:third_weight,4:fourth_weight,5:fifth_weight + //奖项权重值 百分比 + String weightVal; + switch (en.getAwardsort()) { + case 1: + weightVal = annualCompAward.getFirstWeight(); + break; + case 2: + weightVal = annualCompAward.getSecondWeight(); + break; + case 3: + weightVal = annualCompAward.getThirdWeight(); + break; + case 4: + weightVal = annualCompAward.getFourthWeight(); + break; + case 5: + weightVal = annualCompAward.getFifthWeight(); + break; + default: + weightVal = "100"; + } + //参与形式 个人、团队,键值对 N-个人 Y-团队 + String entryForm = annualCompPoint.getEntryForm(); + + //2.2 根据报名编号查询参赛者信息 + List managementList = iTeamManagementService.list(new LambdaQueryWrapper() + .eq(TeamManagement::getEnrollCode, en.getEnrollCode()) + ); + if (ObjectUtils.isEmpty(managementList)) return; + + //modify 7.12 新需求 + //3、计算积分 项目分值*项目层次权得百分比*获奖奖项权重百分比 +// log.info("***************年度比赛项目-{},项目分值:{},奖项权重值:{}", annualCompPoint.getObjName(), compweight_val, weightVal); + Projectlevel projectlevel = iProjectlevelService.getById(annualCompPoint.getObjLevel()); + double scale_ratio = ComputeUtils.div2(new Double(projectlevel.getScale()), ONE_HUNDRED); + double baseScore = ComputeUtils.mul2(ComputeUtils.mul2(compweight_val, ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED)), scale_ratio); + log.info("***************年度比赛项目-{},项目分值:{}", annualCompPoint.getObjName(), compweight_val); + log.info("***************年度比赛项目-层次权重比值:{}", scale_ratio); + log.info("***************获奖奖项权重百分比:{}", weightVal); + log.info("***************基础积分:{}", baseScore); + AtomicReference score = new AtomicReference<>((double) 0); + if (StringUtils.equals("Y", entryForm)) { //团队赛 + Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> { + /*// 参与形式是团队时,队长积分*0.5,职员积分*0.2 + //captain 是否队长 + if (StringUtils.equals("0", e.getCaptain())) { + score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_FIVE)); + } else { + score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_TWO)); + }*/ + + //modify by zhc 8.23 + List seqList = iTeamSeqService.list(new LambdaQueryWrapper().eq(TeamSeq::getPointId, annualCompPoint.getId())); + score.set(ComputeUtils.mul2(baseScore, this.covertVal(seqList, e))); + PersonalCompScore bean = new PersonalCompScore(); + bean.setAnnualCompId(annualCompId); + bean.setAnnualCompP(annualCompPoint.getId()); + bean.setAnnualId(annualComp.getAnnualid()); + SysUser sysUser = iSysUserService.getById(e.getUserId()); + bean.setWorkOn(sysUser.getWorkNo()); + bean.setName(sysUser.getRealname()); + SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode, sysUser.getOrgCode())); + bean.setDepet(sysDepart.getId()); + bean.setScore(score.get()); + saveList.add(bean); + }); + } else { //个人赛 + score.set(baseScore); + TeamManagement teamManagement = managementList.get(0); + PersonalCompScore bean = new PersonalCompScore(); + bean.setAnnualCompId(annualCompId); + bean.setAnnualCompP(annualCompPoint.getId()); + bean.setAnnualId(annualComp.getAnnualid()); + SysUser sysUser = iSysUserService.getById(teamManagement.getUserId()); + bean.setWorkOn(sysUser.getWorkNo()); + bean.setName(sysUser.getRealname()); + SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode, sysUser.getOrgCode())); + bean.setDepet(sysDepart.getId()); + bean.setScore(score.get()); + saveList.add(bean); + } + }); + } + + this.saveBatch(saveList); + + //个人比赛积分汇总完成后,汇总个人总积分 + this.iPersonalCompTotalScoreService.saveOrUpdateTotalScore(saveList); + + //更新状态为积分已汇总 + iAnnualCompPointService.lambdaUpdate() + .eq(AnnualCompPoint::getId, personalCompScore.getId()) + .eq(AnnualCompPoint::getIsPj, 1) + .set(AnnualCompPoint::getAnnualCompState, 10) + .update(); + } + + @Autowired + private ITeamSeqService iTeamSeqService; + + /** + * @description: 根据队员在团队中报名先后顺序计算比率 + * @param: [annualCompPoint, en] + * @return: double + * @author: z.h.c + * @date: 24/8/23 10:00 + */ + double covertVal(List teamSeq, TeamManagement en) { + Integer weightVal = 100; + if (!ObjectUtils.isEmpty(teamSeq) && !ObjectUtils.isEmpty(en.getTeamSeq())) { + List seqSet = teamSeq.stream().filter(b -> b.getTeamSeq() == en.getTeamSeq()).collect(Collectors.toList()); + weightVal = seqSet.get(0).getTeamSeqVal(); + } + double val = ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED); + return val; + } +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java new file mode 100644 index 00000000..286069a0 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java @@ -0,0 +1,51 @@ +package org.jeecg.modules.demo.annualScore.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.util.ComputeUtils; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore; +import org.jeecg.modules.demo.annualScore.entity.PersonalCompTotalScore; +import org.jeecg.modules.demo.annualScore.mapper.PersonalCompTotalScoreMapper; +import org.jeecg.modules.demo.annualScore.service.IPersonalCompTotalScoreService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; + +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + +/** + * @Description: 个人总积分 + * @Author: jeecg-boot + * @Date: 2023-11-01 + * @Version: V1.0 + */ +@Service +public class PersonalCompTotalScoreServiceImpl extends ServiceImpl implements IPersonalCompTotalScoreService { + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveOrUpdateTotalScore(List list) { + + List updateList = new LinkedList<>(); + Optional.ofNullable(list).orElse(new LinkedList<>()).forEach(e -> { + PersonalCompTotalScore p = this.getOne(new LambdaQueryWrapper() + .eq(PersonalCompTotalScore::getWorkOn, e.getWorkOn()) + .last("limit 1")); + //为空则为首次累计,新增操作 + if ((ObjectUtils.isEmpty(p))) { + PersonalCompTotalScore p2 = new PersonalCompTotalScore(); + BeanUtils.copyProperties(e, p2); + updateList.add(p2); + } else { //更新操作 + p.setScore(ComputeUtils.add(p.getScore(), e.getScore())); + p.setUpdateTime(new Date()); + updateList.add(p); + } + }); + this.saveOrUpdateBatch(updateList); + } +}