src/main/java/org/springblade/modules/evaluate/controller/EvaluateTaskSetController.java
New file @@ -0,0 +1,155 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.core.secure.BladeUser; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.vo.EvaluateTaskSetVO; import org.springblade.modules.evaluate.excel.EvaluateTaskSetExcel; import org.springblade.modules.evaluate.wrapper.EvaluateTaskSetWrapper; import org.springblade.modules.evaluate.service.IEvaluateTaskSetService; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.tool.constant.BladeConstant; import springfox.documentation.annotations.ApiIgnore; import java.util.Map; import java.util.List; import javax.servlet.http.HttpServletResponse; /** * 评优任务配置 控制器 * * @author aix * @since 2023-12-21 */ @RestController @AllArgsConstructor @RequestMapping("evaluate/evaluateTaskSet") @Api(value = "评优任务配置", tags = "评优任务配置接口") public class EvaluateTaskSetController extends BladeController { private final IEvaluateTaskSetService evaluateTaskSetService; /** * 评优任务配置 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入evaluateTaskSet") public R<EvaluateTaskSetVO> detail(EvaluateTaskSetEntity evaluateTaskSet) { EvaluateTaskSetEntity detail = evaluateTaskSetService.getOne(Condition.getQueryWrapper(evaluateTaskSet)); return R.data(EvaluateTaskSetWrapper.build().entityVO(detail)); } /** * 个人评优任务配置 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入evaluateTaskSet") public R<IPage<EvaluateTaskSetVO>> list(@ApiIgnore @RequestParam Map<String, Object> evaluateTaskSet, Query query) { IPage<EvaluateTaskSetEntity> pages = evaluateTaskSetService.page(Condition.getPage(query), Condition.getQueryWrapper(evaluateTaskSet, EvaluateTaskSetEntity.class)); return R.data(EvaluateTaskSetWrapper.build().pageVO(pages)); } /** * 部门评优 分页 */ /** * 评优任务配置 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入evaluateTaskSet") public R<IPage<EvaluateTaskSetVO>> page(EvaluateTaskSetVO evaluateTaskSet, Query query) { IPage<EvaluateTaskSetVO> pages = evaluateTaskSetService.selectEvaluateTaskSetPage(Condition.getPage(query), evaluateTaskSet); return R.data(pages); } /** * 评优任务配置 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入evaluateTaskSet") public R save(@Valid @RequestBody EvaluateTaskSetEntity evaluateTaskSet) { return R.status(evaluateTaskSetService.save(evaluateTaskSet)); } /** * 评优任务配置 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入evaluateTaskSet") public R update(@Valid @RequestBody EvaluateTaskSetEntity evaluateTaskSet) { return R.status(evaluateTaskSetService.updateById(evaluateTaskSet)); } /** * 评优任务配置 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入evaluateTaskSet") public R submit(@Valid @RequestBody EvaluateTaskSetEntity evaluateTaskSet) { return R.status(evaluateTaskSetService.saveOrUpdate(evaluateTaskSet)); } /** * 评优任务配置 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(evaluateTaskSetService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 */ @GetMapping("/export-evaluateTaskSet") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入evaluateTaskSet") public void exportEvaluateTaskSet(@ApiIgnore @RequestParam Map<String, Object> evaluateTaskSet, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<EvaluateTaskSetEntity> queryWrapper = Condition.getQueryWrapper(evaluateTaskSet, EvaluateTaskSetEntity.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(EvaluateTaskSet::getTenantId, bladeUser.getTenantId()); //} queryWrapper.lambda().eq(EvaluateTaskSetEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); List<EvaluateTaskSetExcel> list = evaluateTaskSetService.exportEvaluateTaskSet(queryWrapper); ExcelUtil.export(response, "评优任务配置数据" + DateUtil.time(), "评优任务配置数据表", list, EvaluateTaskSetExcel.class); } } src/main/java/org/springblade/modules/evaluate/dto/EvaluateTaskSetDTO.java
New file @@ -0,0 +1,34 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.dto; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * 评优任务配置 数据传输对象实体类 * * @author aix * @since 2023-12-21 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateTaskSetDTO extends EvaluateTaskSetEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/evaluate/entity/EvaluateTaskSetEntity.java
New file @@ -0,0 +1,71 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; /** * 评优任务配置 实体类 * * @author aix * @since 2023-12-21 */ @Data @TableName("yw_evaluate_task_set") @ApiModel(value = "EvaluateTaskSet对象", description = "评优任务配置") @EqualsAndHashCode(callSuper = true) public class EvaluateTaskSetEntity extends TenantEntity { @ApiModelProperty(value = "评优任务id") private Long evaluateTaskId; @ApiModelProperty(value = "评优任务名称") private String evaluateTaskName; /** * 评优类型(0:员工评优,1:部门评优) */ @ApiModelProperty(value = "评优类型(0:员工评优,1:部门评优)") private Integer type; /** * 部门id */ @ApiModelProperty(value = "部门id") private Long deptId; /** * 部门名称 */ @ApiModelProperty(value = "部门名称") private String deptName; /** * 用户id */ @ApiModelProperty(value = "用户id") private Long userId; /** * 用户名称 */ @ApiModelProperty(value = "用户名称") private String userName; } src/main/java/org/springblade/modules/evaluate/excel/EvaluateTaskSetExcel.java
New file @@ -0,0 +1,87 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.excel; import lombok.Data; import java.util.Date; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight; import java.io.Serializable; /** * 评优任务配置 Excel实体类 * * @author aix * @since 2023-12-21 */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class EvaluateTaskSetExcel implements Serializable { private static final long serialVersionUID = 1L; /** * 租户ID */ @ColumnWidth(20) @ExcelProperty("租户ID") private String tenantId; /** * 评优类型(0:员工评优,1:部门评优) */ @ColumnWidth(20) @ExcelProperty("评优类型(0:员工评优,1:部门评优)") private Integer type; /** * 部门id */ @ColumnWidth(20) @ExcelProperty("部门id") private Long deptId; /** * 部门名称 */ @ColumnWidth(20) @ExcelProperty("部门名称") private String deptName; /** * 用户id */ @ColumnWidth(20) @ExcelProperty("用户id") private Long userId; /** * 用户名称 */ @ColumnWidth(20) @ExcelProperty("用户名称") private String userName; /** * 是否已删除 */ @ColumnWidth(20) @ExcelProperty("是否已删除") private Integer isDeleted; } src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.java
New file @@ -0,0 +1,54 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.mapper; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.vo.EvaluateTaskSetVO; import org.springblade.modules.evaluate.excel.EvaluateTaskSetExcel; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Param; import java.util.List; /** * 评优任务配置 Mapper 接口 * * @author aix * @since 2023-12-21 */ public interface EvaluateTaskSetMapper extends BaseMapper<EvaluateTaskSetEntity> { /** * 自定义分页 * * @param page * @param evaluateTaskSet * @return */ List<EvaluateTaskSetVO> selectEvaluateTaskSetPage(IPage page, EvaluateTaskSetVO evaluateTaskSet); /** * 获取导出数据 * * @param queryWrapper * @return */ List<EvaluateTaskSetExcel> exportEvaluateTaskSet(@Param("ew") Wrapper<EvaluateTaskSetEntity> queryWrapper); } src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.xml
New file @@ -0,0 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.springblade.modules.evaluate.mapper.EvaluateTaskSetMapper"> <!-- 通用查询映射结果 --> <resultMap id="evaluateTaskSetResultMap" type="org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity"> <result column="id" property="id"/> <result column="tenant_id" property="tenantId"/> <result column="type" property="type"/> <result column="dept_id" property="deptId"/> <result column="dept_name" property="deptName"/> <result column="user_id" property="userId"/> <result column="user_name" property="userName"/> <result column="create_user" property="createUser"/> <result column="create_dept" property="createDept"/> <result column="create_time" property="createTime"/> <result column="update_user" property="updateUser"/> <result column="update_time" property="updateTime"/> <result column="status" property="status"/> <result column="is_deleted" property="isDeleted"/> </resultMap> <select id="selectEvaluateTaskSetPage" resultMap="evaluateTaskSetResultMap"> select * from yw_evaluate_task_set where is_deleted = 0 </select> <select id="exportEvaluateTaskSet" resultType="org.springblade.modules.evaluate.excel.EvaluateTaskSetExcel"> SELECT * FROM yw_evaluate_task_set ${ew.customSqlSegment} </select> </mapper> src/main/java/org/springblade/modules/evaluate/service/IEvaluateTaskSetService.java
New file @@ -0,0 +1,52 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.vo.EvaluateTaskSetVO; import org.springblade.modules.evaluate.excel.EvaluateTaskSetExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import java.util.List; /** * 评优任务配置 服务类 * * @author aix * @since 2023-12-21 */ public interface IEvaluateTaskSetService extends BaseService<EvaluateTaskSetEntity> { /** * 自定义分页 * * @param page * @param evaluateTaskSet * @return */ IPage<EvaluateTaskSetVO> selectEvaluateTaskSetPage(IPage<EvaluateTaskSetVO> page, EvaluateTaskSetVO evaluateTaskSet); /** * 导出数据 * * @param queryWrapper * @return */ List<EvaluateTaskSetExcel> exportEvaluateTaskSet(Wrapper<EvaluateTaskSetEntity> queryWrapper); } src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateTaskServiceImpl.java
@@ -16,15 +16,28 @@ */ package org.springblade.modules.evaluate.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.AllArgsConstructor; import org.springblade.modules.evaluate.entity.EvaluateTaskEntity; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.service.IEvaluateTaskSetService; import org.springblade.modules.evaluate.vo.EvaluateTaskVO; import org.springblade.modules.evaluate.excel.EvaluateTaskExcel; import org.springblade.modules.evaluate.mapper.EvaluateTaskMapper; import org.springblade.modules.evaluate.service.IEvaluateTaskService; import org.springblade.modules.system.entity.Dept; import org.springblade.modules.system.entity.User; import org.springblade.modules.system.service.IDeptService; import org.springblade.modules.system.service.IUserService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.transaction.annotation.Transactional; import javax.validation.constraints.NotEmpty; import java.util.List; /** @@ -34,7 +47,13 @@ * @since 2023-12-08 */ @Service @AllArgsConstructor public class EvaluateTaskServiceImpl extends BaseServiceImpl<EvaluateTaskMapper, EvaluateTaskEntity> implements IEvaluateTaskService { private final IEvaluateTaskSetService evaluateTaskSetService; private final IUserService userService; private final IDeptService deptService; @Override public IPage<EvaluateTaskVO> selectEvaluateTaskPage(IPage<EvaluateTaskVO> page, EvaluateTaskVO evaluateTask) { @@ -51,4 +70,81 @@ return evaluateTaskList; } @Override @Transactional public boolean saveOrUpdate(EvaluateTaskEntity evaluateTask) { boolean ret = super.saveOrUpdate(evaluateTask); if (ret) { //先删除 QueryWrapper<EvaluateTaskSetEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("evaluate_task_id", evaluateTask.getId()); evaluateTaskSetService.remove(queryWrapper); if (evaluateTask.getType() == 0) { //个人评优处理 //保存 JSONArray jsonArray = JSONArray.parseArray(JSONObject.toJSONString(evaluateTask.getCandidateNum())); for (int i = 0; i < jsonArray.size(); i++) { JSONObject obj = jsonArray.getJSONObject(i);//{"deptId":"1737282385453543425","deptName":"中国铜业","val":3,"users":[{"id":"1737304543567310850","name":"张二瑶"} Long deptId = obj.getLong("deptId"); String deptName = obj.getString("deptName"); String val = obj.getString("val"); JSONArray userJson = JSONArray.parseArray(JSONObject.toJSONString(obj.get("users"))); for (int j = 0; j < userJson.size(); j++) { EvaluateTaskSetEntity entityPO = new EvaluateTaskSetEntity(); entityPO.setEvaluateTaskId(evaluateTask.getId()); entityPO.setDeptId(deptId); entityPO.setDeptName(deptName); entityPO.setUserId(userJson.getJSONObject(j).getLong("id")); entityPO.setUserName(userJson.getJSONObject(j).getString("name")); entityPO.setEvaluateTaskName(evaluateTask.getTaskName()); evaluateTaskSetService.save(entityPO); } if (userJson.size() == 0) { QueryWrapper<User> userQueryWrapper = new QueryWrapper<>(); userQueryWrapper.eq("dept_id", deptId); List<User> userList = userService.list(userQueryWrapper); for (User po: userList) { EvaluateTaskSetEntity entityPO = new EvaluateTaskSetEntity(); entityPO.setEvaluateTaskId(evaluateTask.getId()); entityPO.setDeptId(deptId); entityPO.setDeptName(deptName); entityPO.setUserId(po.getId()); entityPO.setUserName(po.getName()); entityPO.setEvaluateTaskName(evaluateTask.getTaskName()); evaluateTaskSetService.save(entityPO); } } } } else if (evaluateTask.getType() == 1){ //部门评优 //获取所有部门保存 List<Dept> list = deptService.list(); for (Dept dept: list) { EvaluateTaskSetEntity entityPO = new EvaluateTaskSetEntity(); entityPO.setEvaluateTaskId(evaluateTask.getId()); entityPO.setDeptId(dept.getId()); entityPO.setDeptName(dept.getDeptName()); entityPO.setType(1); entityPO.setEvaluateTaskName(evaluateTask.getTaskName()); evaluateTaskSetService.save(entityPO); } } } return ret; } @Override @Transactional public boolean deleteLogic(List<Long> ids) { boolean ret = super.deleteLogic(ids); if (ret) { for (Long id:ids) { //先删除 QueryWrapper<EvaluateTaskSetEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("evaluate_task_id", id); evaluateTaskSetService.remove(queryWrapper); } } return ret; } } src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateTaskSetServiceImpl.java
New file @@ -0,0 +1,54 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.service.impl; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.vo.EvaluateTaskSetVO; import org.springblade.modules.evaluate.excel.EvaluateTaskSetExcel; import org.springblade.modules.evaluate.mapper.EvaluateTaskSetMapper; import org.springblade.modules.evaluate.service.IEvaluateTaskSetService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseServiceImpl; import java.util.List; /** * 评优任务配置 服务实现类 * * @author aix * @since 2023-12-21 */ @Service public class EvaluateTaskSetServiceImpl extends BaseServiceImpl<EvaluateTaskSetMapper, EvaluateTaskSetEntity> implements IEvaluateTaskSetService { @Override public IPage<EvaluateTaskSetVO> selectEvaluateTaskSetPage(IPage<EvaluateTaskSetVO> page, EvaluateTaskSetVO evaluateTaskSet) { return page.setRecords(baseMapper.selectEvaluateTaskSetPage(page, evaluateTaskSet)); } @Override public List<EvaluateTaskSetExcel> exportEvaluateTaskSet(Wrapper<EvaluateTaskSetEntity> queryWrapper) { List<EvaluateTaskSetExcel> evaluateTaskSetList = baseMapper.exportEvaluateTaskSet(queryWrapper); //evaluateTaskSetList.forEach(evaluateTaskSet -> { // evaluateTaskSet.setTypeName(DictCache.getValue(DictEnum.YES_NO, EvaluateTaskSet.getType())); //}); return evaluateTaskSetList; } } src/main/java/org/springblade/modules/evaluate/vo/EvaluateTaskSetVO.java
New file @@ -0,0 +1,38 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.vo; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * 评优任务配置 视图实体类 * * @author aix * @since 2023-12-21 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateTaskSetVO extends EvaluateTaskSetEntity { private static final long serialVersionUID = 1L; private Long voteNum; } src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateTaskSetWrapper.java
New file @@ -0,0 +1,82 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.evaluate.wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.SpringUtil; import org.springblade.modules.evaluate.entity.EvaluateResultEntity; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.service.IEvaluateResultService; import org.springblade.modules.evaluate.service.IEvaluateTaskService; import org.springblade.modules.evaluate.service.IEvaluateTaskSetService; import org.springblade.modules.evaluate.vo.EvaluateTaskSetVO; import java.util.List; import java.util.Objects; /** * 评优任务配置 包装类,返回视图层所需的字段 * * @author aix * @since 2023-12-21 */ public class EvaluateTaskSetWrapper extends BaseEntityWrapper<EvaluateTaskSetEntity, EvaluateTaskSetVO> { private static final IEvaluateResultService evaluateResultService; static { evaluateResultService = SpringUtil.getBean(IEvaluateResultService.class); } public static EvaluateTaskSetWrapper build() { return new EvaluateTaskSetWrapper(); } @Override public EvaluateTaskSetVO entityVO(EvaluateTaskSetEntity evaluateTaskSet) { EvaluateTaskSetVO evaluateTaskSetVO = Objects.requireNonNull(BeanUtil.copy(evaluateTaskSet, EvaluateTaskSetVO.class)); //User createUser = UserCache.getUser(evaluateTaskSet.getCreateUser()); //User updateUser = UserCache.getUser(evaluateTaskSet.getUpdateUser()); //evaluateTaskSetVO.setCreateUserName(createUser.getName()); //evaluateTaskSetVO.setUpdateUserName(updateUser.getName()); return evaluateTaskSetVO; } @Override public IPage<EvaluateTaskSetVO> pageVO(IPage<EvaluateTaskSetEntity> pages) { List<EvaluateTaskSetVO> records = listVO(pages.getRecords()); for (EvaluateTaskSetVO vo : records) { QueryWrapper<EvaluateResultEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("be_id",vo.getUserId()); queryWrapper.eq("evaluate_task_id",vo.getEvaluateTaskId()); vo.setVoteNum(evaluateResultService.count(queryWrapper)); } IPage<EvaluateTaskSetVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal()); pageVo.setRecords(records); return pageVo; } } src/main/java/org/springblade/modules/leave/controller/LeaveWordsController.java
@@ -118,7 +118,7 @@ /** * 留言板块 新增或修改 */ @PostMapping("/submit") @PostMapping(value = "/submit", produces = "application/json;charset=UTF-8") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入leaveWords") public R submit(@Valid @RequestBody LeaveWordsEntity leaveWords) {