src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateAssessorController.java
New file @@ -0,0 +1,151 @@ /* * 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.EvaluateCandidateAssessorEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateAssessorVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateAssessorExcel; import org.springblade.modules.evaluate.wrapper.EvaluateCandidateAssessorWrapper; import org.springblade.modules.evaluate.service.IEvaluateCandidateAssessorService; 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-29 */ @RestController @AllArgsConstructor @RequestMapping("evaluate/evaluateCandidateAssessor") @Api(value = "候选人评定表", tags = "候选人评定表接口") public class EvaluateCandidateAssessorController extends BladeController { private final IEvaluateCandidateAssessorService evaluateCandidateAssessorService; /** * 候选人评定表 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入evaluateCandidateAssessor") public R<EvaluateCandidateAssessorVO> detail(EvaluateCandidateAssessorEntity evaluateCandidateAssessor) { EvaluateCandidateAssessorEntity detail = evaluateCandidateAssessorService.getOne(Condition.getQueryWrapper(evaluateCandidateAssessor)); return R.data(EvaluateCandidateAssessorWrapper.build().entityVO(detail)); } /** * 候选人评定表 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入evaluateCandidateAssessor") public R<IPage<EvaluateCandidateAssessorVO>> list(@ApiIgnore @RequestParam Map<String, Object> evaluateCandidateAssessor, Query query) { IPage<EvaluateCandidateAssessorEntity> pages = evaluateCandidateAssessorService.page(Condition.getPage(query), Condition.getQueryWrapper(evaluateCandidateAssessor, EvaluateCandidateAssessorEntity.class)); return R.data(EvaluateCandidateAssessorWrapper.build().pageVO(pages)); } /** * 候选人评定表 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入evaluateCandidateAssessor") public R<IPage<EvaluateCandidateAssessorVO>> page(EvaluateCandidateAssessorVO evaluateCandidateAssessor, Query query) { IPage<EvaluateCandidateAssessorVO> pages = evaluateCandidateAssessorService.selectEvaluateCandidateAssessorPage(Condition.getPage(query), evaluateCandidateAssessor); return R.data(pages); } /** * 候选人评定表 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入evaluateCandidateAssessor") public R save(@Valid @RequestBody EvaluateCandidateAssessorEntity evaluateCandidateAssessor) { return R.status(evaluateCandidateAssessorService.save(evaluateCandidateAssessor)); } /** * 候选人评定表 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入evaluateCandidateAssessor") public R update(@Valid @RequestBody EvaluateCandidateAssessorEntity evaluateCandidateAssessor) { return R.status(evaluateCandidateAssessorService.updateById(evaluateCandidateAssessor)); } /** * 候选人评定表 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入evaluateCandidateAssessor") public R submit(@Valid @RequestBody EvaluateCandidateAssessorEntity evaluateCandidateAssessor) { return R.status(evaluateCandidateAssessorService.saveOrUpdate(evaluateCandidateAssessor)); } /** * 候选人评定表 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(evaluateCandidateAssessorService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 */ @GetMapping("/export-evaluateCandidateAssessor") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入evaluateCandidateAssessor") public void exportEvaluateCandidateAssessor(@ApiIgnore @RequestParam Map<String, Object> evaluateCandidateAssessor, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<EvaluateCandidateAssessorEntity> queryWrapper = Condition.getQueryWrapper(evaluateCandidateAssessor, EvaluateCandidateAssessorEntity.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(EvaluateCandidateAssessor::getTenantId, bladeUser.getTenantId()); //} queryWrapper.lambda().eq(EvaluateCandidateAssessorEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); List<EvaluateCandidateAssessorExcel> list = evaluateCandidateAssessorService.exportEvaluateCandidateAssessor(queryWrapper); ExcelUtil.export(response, "候选人评定表数据" + DateUtil.time(), "候选人评定表数据表", list, EvaluateCandidateAssessorExcel.class); } } src/main/java/org/springblade/modules/evaluate/controller/EvaluateTaskController.java
@@ -195,8 +195,8 @@ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入evaluateTask") public R save(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { return R.status(evaluateTaskService.save(evaluateTask)); public R save(@Valid @RequestBody EvaluateTaskVO vo) { return R.status(evaluateTaskService.save(vo)); } /** @@ -205,8 +205,8 @@ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入evaluateTask") public R update(@Valid @RequestBody EvaluateTaskEntity evaluateTask) { return R.status(evaluateTaskService.updateById(evaluateTask)); public R update(@Valid @RequestBody EvaluateTaskVO vo) { return R.status(evaluateTaskService.updateById(vo)); } /** src/main/java/org/springblade/modules/evaluate/dto/EvaluateCandidateAssessorDTO.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.EvaluateCandidateAssessorEntity; import lombok.Data; import lombok.EqualsAndHashCode; /** * 候选人评定表 数据传输对象实体类 * * @author Aix * @since 2023-12-29 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateCandidateAssessorDTO extends EvaluateCandidateAssessorEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateAssessorEntity.java
New file @@ -0,0 +1,70 @@ /* * 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-29 */ @Data @TableName("yw_evaluate_candidate_assessor") @ApiModel(value = "EvaluateCandidateAssessor对象", description = "候选人评定表") @EqualsAndHashCode(callSuper = true) public class EvaluateCandidateAssessorEntity extends TenantEntity { /** * 候选人表id */ @ApiModelProperty(value = "候选人表id") private Long evaluateCandidateId; /** * 评定人id */ @ApiModelProperty(value = "评定人id") private Long userId; /** * 评定人名称 */ @ApiModelProperty(value = "评定人名称") private String userName; /** * 评定人部门id */ @ApiModelProperty(value = "评定人部门id") private Long deptId; /** * 评定人部门名称 */ @ApiModelProperty(value = "评定人部门名称") private String deptName; /** * 评定人职位名称 */ @ApiModelProperty(value = "评定人职位名称") private String postName; } src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateEntity.java
@@ -55,6 +55,11 @@ @ApiModelProperty(value = "员工名称") private String userName; /** * 部门id */ @ApiModelProperty(value = "部门id") private Long deptId; /** * 部门名称 */ @ApiModelProperty(value = "部门名称") @@ -64,6 +69,7 @@ */ @ApiModelProperty(value = "职位名称") private String postName; @ApiModelProperty(value = "数据来源") private Integer dataSource; src/main/java/org/springblade/modules/evaluate/entity/EvaluateTaskEntity.java
@@ -16,14 +16,13 @@ */ package org.springblade.modules.evaluate.entity; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; 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; @@ -64,18 +63,23 @@ * 候选人数量 */ @ApiModelProperty(value = "候选人数量") @TableField(value = "candidate_num", typeHandler = JacksonTypeHandler.class) private Object candidateNum; private Integer candidateNum; /** * 候选人截止日期 */ @ApiModelProperty(value = "候选人截止日期") private Date candidateCutoffTime; @ApiModelProperty(value = "候选人评选开始日期") private Date candidateCutoffTimeStart; @ApiModelProperty(value = "候选人评选开始截止日期") private Date candidateCutoffTimeEnd; /** * 候选人状态 */ @ApiModelProperty(value = "候选人状态") private Integer candidateState; @ApiModelProperty(value = "是否第二波") private Integer isAgain; /** * 评优数量 */ @@ -84,8 +88,11 @@ /** * 最终截止日期 */ @ApiModelProperty(value = "最终截止日期") private Date evaluateCutoffTime; @ApiModelProperty(value = "最终评选开始日期") private Date evaluateCutoffTimeStart; @ApiModelProperty(value = "最终评选结束日期") private Date evaluateCutoffTimeEnd; /** * 评优评选状态 */ src/main/java/org/springblade/modules/evaluate/excel/EvaluateCandidateAssessorExcel.java
New file @@ -0,0 +1,93 @@ /* * 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-29 */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class EvaluateCandidateAssessorExcel implements Serializable { private static final long serialVersionUID = 1L; /** * 租户ID */ @ColumnWidth(20) @ExcelProperty("租户ID") private String tenantId; /** * 候选人表id */ @ColumnWidth(20) @ExcelProperty("候选人表id") private Long evaluateCandidateId; /** * 评定人id */ @ColumnWidth(20) @ExcelProperty("评定人id") private Long userId; /** * 评定人名称 */ @ColumnWidth(20) @ExcelProperty("评定人名称") private String userName; /** * 评定人部门id */ @ColumnWidth(20) @ExcelProperty("评定人部门id") private Long deptId; /** * 评定人部门名称 */ @ColumnWidth(20) @ExcelProperty("评定人部门名称") private String deptName; /** * 评定人职位名称 */ @ColumnWidth(20) @ExcelProperty("评定人职位名称") private String postName; /** * 是否已删除 */ @ColumnWidth(20) @ExcelProperty("是否已删除") private Integer isDeleted; } src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateAssessorMapper.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.EvaluateCandidateAssessorEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateAssessorVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateAssessorExcel; 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-29 */ public interface EvaluateCandidateAssessorMapper extends BaseMapper<EvaluateCandidateAssessorEntity> { /** * 自定义分页 * * @param page * @param evaluateCandidateAssessor * @return */ List<EvaluateCandidateAssessorVO> selectEvaluateCandidateAssessorPage(IPage page, EvaluateCandidateAssessorVO evaluateCandidateAssessor); /** * 获取导出数据 * * @param queryWrapper * @return */ List<EvaluateCandidateAssessorExcel> exportEvaluateCandidateAssessor(@Param("ew") Wrapper<EvaluateCandidateAssessorEntity> queryWrapper); } src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateAssessorMapper.xml
New file @@ -0,0 +1,34 @@ <?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.EvaluateCandidateAssessorMapper"> <!-- 通用查询映射结果 --> <resultMap id="evaluateCandidateAssessorResultMap" type="org.springblade.modules.evaluate.entity.EvaluateCandidateAssessorEntity"> <result column="id" property="id"/> <result column="tenant_id" property="tenantId"/> <result column="evaluate_candidate_id" property="evaluateCandidateId"/> <result column="user_id" property="userId"/> <result column="user_name" property="userName"/> <result column="dept_id" property="deptId"/> <result column="dept_name" property="deptName"/> <result column="post_name" property="postName"/> <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="selectEvaluateCandidateAssessorPage" resultMap="evaluateCandidateAssessorResultMap"> select * from yw_evaluate_candidate_assessor where is_deleted = 0 </select> <select id="exportEvaluateCandidateAssessor" resultType="org.springblade.modules.evaluate.excel.EvaluateCandidateAssessorExcel"> SELECT * FROM yw_evaluate_candidate_assessor ${ew.customSqlSegment} </select> </mapper> src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.xml
@@ -10,6 +10,7 @@ <result column="evaluate_task_name" property="evaluateTaskName"/> <result column="user_id" property="userId"/> <result column="user_name" property="userName"/> <result column="dept_id" property="deptId"/> <result column="dept_name" property="deptName"/> <result column="post_name" property="postName"/> <result column="data_source" property="dataSource"/> src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskMapper.xml
@@ -10,10 +10,13 @@ <result column="task_type" property="taskType"/> <result column="remark" property="remark"/> <result column="candidate_num" property="candidateNum"/> <result column="candidate_cutoff_time" property="candidateCutoffTime"/> <result column="candidate_cutoff_time_start" property="candidateCutoffTimeStart"/> <result column="candidate_cutoff_time_end" property="candidateCutoffTimeEnd"/> <result column="candidate_state" property="candidateState"/> <result column="is_again" property="isAgain"/> <result column="evaluate_num" property="evaluateNum"/> <result column="evaluate_cutoff_time" property="evaluateCutoffTime"/> <result column="evaluate_cutoff_time_start" property="evaluateCutoffTimeStart"/> <result column="evaluate_cutoff_time_end" property="evaluateCutoffTimeEnd"/> <result column="evaluate_state" property="evaluateState"/> <result column="create_user" property="createUser"/> <result column="create_dept" property="createDept"/> src/main/java/org/springblade/modules/evaluate/service/IEvaluateCandidateAssessorService.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.EvaluateCandidateAssessorEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateAssessorVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateAssessorExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import java.util.List; /** * 候选人评定表 服务类 * * @author Aix * @since 2023-12-29 */ public interface IEvaluateCandidateAssessorService extends BaseService<EvaluateCandidateAssessorEntity> { /** * 自定义分页 * * @param page * @param evaluateCandidateAssessor * @return */ IPage<EvaluateCandidateAssessorVO> selectEvaluateCandidateAssessorPage(IPage<EvaluateCandidateAssessorVO> page, EvaluateCandidateAssessorVO evaluateCandidateAssessor); /** * 导出数据 * * @param queryWrapper * @return */ List<EvaluateCandidateAssessorExcel> exportEvaluateCandidateAssessor(Wrapper<EvaluateCandidateAssessorEntity> queryWrapper); } src/main/java/org/springblade/modules/evaluate/service/IEvaluateTaskService.java
@@ -31,6 +31,11 @@ * @since 2023-12-08 */ public interface IEvaluateTaskService extends BaseService<EvaluateTaskEntity> { boolean save(EvaluateTaskVO vo); boolean updateById(EvaluateTaskVO vo); /** * 自定义分页 * src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateCandidateAssessorServiceImpl.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.EvaluateCandidateAssessorEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateAssessorVO; import org.springblade.modules.evaluate.excel.EvaluateCandidateAssessorExcel; import org.springblade.modules.evaluate.mapper.EvaluateCandidateAssessorMapper; import org.springblade.modules.evaluate.service.IEvaluateCandidateAssessorService; 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-29 */ @Service public class EvaluateCandidateAssessorServiceImpl extends BaseServiceImpl<EvaluateCandidateAssessorMapper, EvaluateCandidateAssessorEntity> implements IEvaluateCandidateAssessorService { @Override public IPage<EvaluateCandidateAssessorVO> selectEvaluateCandidateAssessorPage(IPage<EvaluateCandidateAssessorVO> page, EvaluateCandidateAssessorVO evaluateCandidateAssessor) { return page.setRecords(baseMapper.selectEvaluateCandidateAssessorPage(page, evaluateCandidateAssessor)); } @Override public List<EvaluateCandidateAssessorExcel> exportEvaluateCandidateAssessor(Wrapper<EvaluateCandidateAssessorEntity> queryWrapper) { List<EvaluateCandidateAssessorExcel> evaluateCandidateAssessorList = baseMapper.exportEvaluateCandidateAssessor(queryWrapper); //evaluateCandidateAssessorList.forEach(evaluateCandidateAssessor -> { // evaluateCandidateAssessor.setTypeName(DictCache.getValue(DictEnum.YES_NO, EvaluateCandidateAssessor.getType())); //}); return evaluateCandidateAssessorList; } } src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateTaskServiceImpl.java
@@ -20,13 +20,17 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.AllArgsConstructor; import org.springblade.core.tool.utils.StringUtil; import org.springblade.modules.evaluate.entity.EvaluateTaskEntity; import org.springblade.modules.evaluate.entity.EvaluateTaskSetEntity; import org.springblade.modules.evaluate.service.IEvaluateCandidateService; 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.evaluate.wrapper.EvaluateCandidateWrapper; import org.springblade.modules.evaluate.wrapper.EvaluateTaskWrapper; import org.springblade.modules.system.entity.Dept; import org.springblade.modules.system.entity.User; import org.springblade.modules.system.service.IDeptService; @@ -55,6 +59,31 @@ private final IDeptService deptService; private final IEvaluateCandidateService evaluateCandidateService; @Override @Transactional public boolean save(EvaluateTaskVO vo) { Boolean ret = super.save(EvaluateTaskWrapper.build().entityPO(vo)); if (ret) { ret = evaluateCandidateService.saveBatch(vo.getCandidateEntities()); } return ret; } @Override @Transactional public boolean updateById(EvaluateTaskVO vo) { if (null == vo.getId()) return false; Boolean ret = super.updateById(EvaluateTaskWrapper.build().entityPO(vo)); if (ret) { ret = evaluateCandidateService.saveOrUpdateBatch(vo.getCandidateEntities()); } return ret; } @Override public IPage<EvaluateTaskVO> selectEvaluateTaskPage(IPage<EvaluateTaskVO> page, EvaluateTaskVO evaluateTask) { return page.setRecords(baseMapper.selectEvaluateTaskPage(page, evaluateTask)); @@ -70,71 +99,71 @@ return evaluateTaskList; } @Override @Transactional public boolean saveOrUpdate(EvaluateTaskEntity evaluateTask) { boolean ret = super.saveOrUpdate(evaluateTask); if (null == evaluateTask.getType()) // return ret; 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 saveOrUpdate(EvaluateTaskEntity evaluateTask) { // boolean ret = super.saveOrUpdate(evaluateTask); // if (null == evaluateTask.getType()) // // return ret; // 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) { src/main/java/org/springblade/modules/evaluate/vo/EvaluateCandidateAssessorVO.java
New file @@ -0,0 +1,35 @@ /* * 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.EvaluateCandidateAssessorEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; /** * 候选人评定表 视图实体类 * * @author Aix * @since 2023-12-29 */ @Data @EqualsAndHashCode(callSuper = true) public class EvaluateCandidateAssessorVO extends EvaluateCandidateAssessorEntity { private static final long serialVersionUID = 1L; } src/main/java/org/springblade/modules/evaluate/vo/EvaluateTaskVO.java
@@ -16,9 +16,12 @@ */ package org.springblade.modules.evaluate.vo; import org.springblade.modules.evaluate.entity.EvaluateCandidateEntity; import org.springblade.modules.evaluate.entity.EvaluateTaskEntity; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List; /** * 评优任务表 视图实体类 @@ -37,4 +40,6 @@ private EvaluateResultVO evaluateResultVO;//评论结果 private List<EvaluateCandidateEntity> candidateEntities; } src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateAssessorWrapper.java
New file @@ -0,0 +1,50 @@ /* * 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 org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.evaluate.entity.EvaluateCandidateAssessorEntity; import org.springblade.modules.evaluate.vo.EvaluateCandidateAssessorVO; import java.util.Objects; /** * 候选人评定表 包装类,返回视图层所需的字段 * * @author Aix * @since 2023-12-29 */ public class EvaluateCandidateAssessorWrapper extends BaseEntityWrapper<EvaluateCandidateAssessorEntity, EvaluateCandidateAssessorVO> { public static EvaluateCandidateAssessorWrapper build() { return new EvaluateCandidateAssessorWrapper(); } @Override public EvaluateCandidateAssessorVO entityVO(EvaluateCandidateAssessorEntity evaluateCandidateAssessor) { EvaluateCandidateAssessorVO evaluateCandidateAssessorVO = Objects.requireNonNull(BeanUtil.copy(evaluateCandidateAssessor, EvaluateCandidateAssessorVO.class)); //User createUser = UserCache.getUser(evaluateCandidateAssessor.getCreateUser()); //User updateUser = UserCache.getUser(evaluateCandidateAssessor.getUpdateUser()); //evaluateCandidateAssessorVO.setCreateUserName(createUser.getName()); //evaluateCandidateAssessorVO.setUpdateUserName(updateUser.getName()); return evaluateCandidateAssessorVO; } } src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateWrapper.java
@@ -29,6 +29,7 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; /** * 评优候选人 包装类,返回视图层所需的字段 @@ -64,13 +65,13 @@ public IPage<EvaluateCandidateVO> pageVO(IPage<EvaluateCandidateEntity> pages) { List<EvaluateCandidateVO> records = listVO(pages.getRecords()); for (EvaluateCandidateVO vo : records) { QueryWrapper<EvaluateResultEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("be_id",vo.getUserId()); queryWrapper.eq("evaluate_task_id",vo.getEvaluateTaskId()); queryWrapper.eq("type", 2); vo.setVoteNum(evaluateResultService.count(queryWrapper)); } // for (EvaluateCandidateVO vo : records) { // QueryWrapper<EvaluateResultEntity> queryWrapper = new QueryWrapper<>(); // queryWrapper.eq("be_id",vo.getUserId()); // queryWrapper.eq("evaluate_task_id",vo.getEvaluateTaskId()); // queryWrapper.eq("type", 2); // vo.setVoteNum(evaluateResultService.count(queryWrapper)); // } IPage<EvaluateCandidateVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal()); pageVo.setRecords(records); src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateTaskWrapper.java
@@ -63,6 +63,11 @@ return evaluateTaskVO; } public EvaluateTaskEntity entityPO(EvaluateTaskVO vo) { EvaluateTaskEntity po = Objects.requireNonNull(BeanUtil.copy(vo, EvaluateTaskEntity.class)); return po; } public IPage<EvaluateTaskVO> companyListPageVO(IPage pages,Long userId) { List<EvaluateTaskVO> records = listVO(pages.getRecords());