From 1f9f1f3f29805171e4dd645cc25e45a0abc17052 Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Sat, 23 Dec 2023 14:36:53 +0800
Subject: [PATCH] 候选人
---
src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.xml | 8
src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateController.java | 151 ++++++++++
src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateWrapper.java | 50 +++
src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateEntity.java | 68 ++++
src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.xml | 34 ++
src/main/java/org/springblade/modules/evaluate/service/IEvaluateCandidateService.java | 52 +++
src/main/java/org/springblade/modules/evaluate/service/IEvaluateResultService.java | 2
src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java | 22
src/main/java/org/springblade/modules/evaluate/vo/EvaluateCandidateVO.java | 35 ++
src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateCandidateServiceImpl.java | 54 +++
src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.java | 2
src/main/java/org/springblade/modules/evaluate/dto/EvaluateCandidateDTO.java | 34 ++
src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.xml | 14
src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.java | 54 +++
src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateResultServiceImpl.java | 118 ++++++++
src/main/java/org/springblade/modules/evaluate/excel/EvaluateCandidateExcel.java | 87 ++++++
src/main/java/org/springblade/modules/evaluate/entity/EvaluateResultEntity.java | 4
17 files changed, 778 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java b/src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java
index 9028fa6..f4329d2 100644
--- a/src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java
+++ b/src/main/java/org/springblade/modules/assessment/wrapper/AssessmentSetDeptWrapper.java
@@ -94,15 +94,19 @@
else
vo.setAssessmentTaskVO(null);
- QueryWrapper<AssessmentScoreEntity> setEntityQueryWrapper = new QueryWrapper<>();
- setEntityQueryWrapper.eq("score_user_id", vo.getToUserId()); //考核人id
- setEntityQueryWrapper.eq("be_id", vo.getDeptId()); //被考核人id
- setEntityQueryWrapper.eq("assessment_task_id", vo.getAssessmentTaskVO().getId());//考核任务
- List<AssessmentScoreEntity> assessmentScoreEntityList = assessmentScoreService.list(setEntityQueryWrapper);
- if (assessmentScoreEntityList.size() > 0)
- vo.setAssessmentScoreVO(AssessmentScoreWrapper.build().entityVO(assessmentScoreEntityList.get(0)));
- else
- vo.setAssessmentScoreVO(null);
+ //拿考核成绩
+ if (null != vo.getAssessmentTaskVO()) {
+ QueryWrapper<AssessmentScoreEntity> setEntityQueryWrapper = new QueryWrapper<>();
+ setEntityQueryWrapper.eq("score_user_id", vo.getToUserId()); //考核人id
+ setEntityQueryWrapper.eq("be_id", vo.getDeptId()); //被考核人id
+ setEntityQueryWrapper.eq("assessment_task_id", vo.getAssessmentTaskVO().getId());//考核任务
+ List<AssessmentScoreEntity> assessmentScoreEntityList = assessmentScoreService.list(setEntityQueryWrapper);
+ if (assessmentScoreEntityList.size() > 0)
+ vo.setAssessmentScoreVO(AssessmentScoreWrapper.build().entityVO(assessmentScoreEntityList.get(0)));
+ else
+ vo.setAssessmentScoreVO(null);
+ }
+
}
IPage<AssessmentSetDeptVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
pageVo.setRecords(records);
diff --git a/src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateController.java b/src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateController.java
new file mode 100644
index 0000000..7dd18b5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateController.java
@@ -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.EvaluateCandidateEntity;
+import org.springblade.modules.evaluate.vo.EvaluateCandidateVO;
+import org.springblade.modules.evaluate.excel.EvaluateCandidateExcel;
+import org.springblade.modules.evaluate.wrapper.EvaluateCandidateWrapper;
+import org.springblade.modules.evaluate.service.IEvaluateCandidateService;
+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-23
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("evaluate/evaluateCandidate")
+@Api(value = "评优候选人", tags = "评优候选人接口")
+public class EvaluateCandidateController extends BladeController {
+
+ private final IEvaluateCandidateService evaluateCandidateService;
+
+ /**
+ * 评优候选人 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入evaluateCandidate")
+ public R<EvaluateCandidateVO> detail(EvaluateCandidateEntity evaluateCandidate) {
+ EvaluateCandidateEntity detail = evaluateCandidateService.getOne(Condition.getQueryWrapper(evaluateCandidate));
+ return R.data(EvaluateCandidateWrapper.build().entityVO(detail));
+ }
+ /**
+ * 评优候选人 分页
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入evaluateCandidate")
+ public R<IPage<EvaluateCandidateVO>> list(@ApiIgnore @RequestParam Map<String, Object> evaluateCandidate, Query query) {
+ IPage<EvaluateCandidateEntity> pages = evaluateCandidateService.page(Condition.getPage(query), Condition.getQueryWrapper(evaluateCandidate, EvaluateCandidateEntity.class));
+ return R.data(EvaluateCandidateWrapper.build().pageVO(pages));
+ }
+
+ /**
+ * 评优候选人 自定义分页
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入evaluateCandidate")
+ public R<IPage<EvaluateCandidateVO>> page(EvaluateCandidateVO evaluateCandidate, Query query) {
+ IPage<EvaluateCandidateVO> pages = evaluateCandidateService.selectEvaluateCandidatePage(Condition.getPage(query), evaluateCandidate);
+ return R.data(pages);
+ }
+
+ /**
+ * 评优候选人 新增
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入evaluateCandidate")
+ public R save(@Valid @RequestBody EvaluateCandidateEntity evaluateCandidate) {
+ return R.status(evaluateCandidateService.save(evaluateCandidate));
+ }
+
+ /**
+ * 评优候选人 修改
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入evaluateCandidate")
+ public R update(@Valid @RequestBody EvaluateCandidateEntity evaluateCandidate) {
+ return R.status(evaluateCandidateService.updateById(evaluateCandidate));
+ }
+
+ /**
+ * 评优候选人 新增或修改
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入evaluateCandidate")
+ public R submit(@Valid @RequestBody EvaluateCandidateEntity evaluateCandidate) {
+ return R.status(evaluateCandidateService.saveOrUpdate(evaluateCandidate));
+ }
+
+ /**
+ * 评优候选人 删除
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 7)
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(evaluateCandidateService.deleteLogic(Func.toLongList(ids)));
+ }
+
+
+ /**
+ * 导出数据
+ */
+ @GetMapping("/export-evaluateCandidate")
+ @ApiOperationSupport(order = 9)
+ @ApiOperation(value = "导出数据", notes = "传入evaluateCandidate")
+ public void exportEvaluateCandidate(@ApiIgnore @RequestParam Map<String, Object> evaluateCandidate, BladeUser bladeUser, HttpServletResponse response) {
+ QueryWrapper<EvaluateCandidateEntity> queryWrapper = Condition.getQueryWrapper(evaluateCandidate, EvaluateCandidateEntity.class);
+ //if (!AuthUtil.isAdministrator()) {
+ // queryWrapper.lambda().eq(EvaluateCandidate::getTenantId, bladeUser.getTenantId());
+ //}
+ queryWrapper.lambda().eq(EvaluateCandidateEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
+ List<EvaluateCandidateExcel> list = evaluateCandidateService.exportEvaluateCandidate(queryWrapper);
+ ExcelUtil.export(response, "评优候选人数据" + DateUtil.time(), "评优候选人数据表", list, EvaluateCandidateExcel.class);
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/dto/EvaluateCandidateDTO.java b/src/main/java/org/springblade/modules/evaluate/dto/EvaluateCandidateDTO.java
new file mode 100644
index 0000000..535191f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/dto/EvaluateCandidateDTO.java
@@ -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.EvaluateCandidateEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 评优候选人 数据传输对象实体类
+ *
+ * @author aix
+ * @since 2023-12-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class EvaluateCandidateDTO extends EvaluateCandidateEntity {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateEntity.java b/src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateEntity.java
new file mode 100644
index 0000000..98b8dc3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/entity/EvaluateCandidateEntity.java
@@ -0,0 +1,68 @@
+/*
+ * 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-23
+ */
+@Data
+@TableName("yw_evaluate_candidate")
+@ApiModel(value = "EvaluateCandidate对象", description = "评优候选人")
+@EqualsAndHashCode(callSuper = true)
+public class EvaluateCandidateEntity extends TenantEntity {
+
+ /**
+ * 评优任务
+ */
+ @ApiModelProperty(value = "评优任务")
+ private Long evaluateTaskId;
+
+ @ApiModelProperty(value = "评优任务名称")
+ private String evaluateTaskName;
+ /**
+ * 候选人id
+ */
+ @ApiModelProperty(value = "候选人id")
+ private Long userId;
+ /**
+ * 员工名称
+ */
+ @ApiModelProperty(value = "员工名称")
+ private String userName;
+ /**
+ * 部门名称
+ */
+ @ApiModelProperty(value = "部门名称")
+ private String deptName;
+ /**
+ * 职位名称
+ */
+ @ApiModelProperty(value = "职位名称")
+ private String postName;
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/entity/EvaluateResultEntity.java b/src/main/java/org/springblade/modules/evaluate/entity/EvaluateResultEntity.java
index 2b8f66d..46cc418 100644
--- a/src/main/java/org/springblade/modules/evaluate/entity/EvaluateResultEntity.java
+++ b/src/main/java/org/springblade/modules/evaluate/entity/EvaluateResultEntity.java
@@ -16,6 +16,7 @@
*/
package org.springblade.modules.evaluate.entity;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import io.swagger.annotations.ApiModel;
@@ -62,4 +63,7 @@
@ApiModelProperty(value = "类型(0:员工评优,1:部门评优,2:公司评优)")
private Integer type;
+ @TableField(exist = false)
+ private String tempCount;
+
}
diff --git a/src/main/java/org/springblade/modules/evaluate/excel/EvaluateCandidateExcel.java b/src/main/java/org/springblade/modules/evaluate/excel/EvaluateCandidateExcel.java
new file mode 100644
index 0000000..b9c750c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/excel/EvaluateCandidateExcel.java
@@ -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-23
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class EvaluateCandidateExcel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 租户ID
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("租户ID")
+ private String tenantId;
+ /**
+ * 评优任务
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("评优任务")
+ private Long evaluateTaskId;
+ /**
+ * 候选人id
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("候选人id")
+ private Long userId;
+ /**
+ * 员工名称
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("员工名称")
+ private String userName;
+ /**
+ * 部门名称
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("部门名称")
+ private String deptName;
+ /**
+ * 职位名称
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("职位名称")
+ private String postName;
+ /**
+ * 是否已删除
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("是否已删除")
+ private Integer isDeleted;
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.java b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.java
new file mode 100644
index 0000000..5a8ce4a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.java
@@ -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.EvaluateCandidateEntity;
+import org.springblade.modules.evaluate.vo.EvaluateCandidateVO;
+import org.springblade.modules.evaluate.excel.EvaluateCandidateExcel;
+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-23
+ */
+public interface EvaluateCandidateMapper extends BaseMapper<EvaluateCandidateEntity> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param evaluateCandidate
+ * @return
+ */
+ List<EvaluateCandidateVO> selectEvaluateCandidatePage(IPage page, EvaluateCandidateVO evaluateCandidate);
+
+
+ /**
+ * 获取导出数据
+ *
+ * @param queryWrapper
+ * @return
+ */
+ List<EvaluateCandidateExcel> exportEvaluateCandidate(@Param("ew") Wrapper<EvaluateCandidateEntity> queryWrapper);
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.xml b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.xml
new file mode 100644
index 0000000..6bd6589
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateCandidateMapper.xml
@@ -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.EvaluateCandidateMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="evaluateCandidateResultMap" type="org.springblade.modules.evaluate.entity.EvaluateCandidateEntity">
+ <result column="id" property="id"/>
+ <result column="tenant_id" property="tenantId"/>
+ <result column="evaluate_task_id" property="evaluateTaskId"/>
+ <result column="evaluate_task_name" property="evaluateTaskName"/>
+ <result column="user_id" property="userId"/>
+ <result column="user_name" property="userName"/>
+ <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="selectEvaluateCandidatePage" resultMap="evaluateCandidateResultMap">
+ select * from yw_evaluate_candidate where is_deleted = 0
+ </select>
+
+
+ <select id="exportEvaluateCandidate" resultType="org.springblade.modules.evaluate.excel.EvaluateCandidateExcel">
+ SELECT * FROM yw_evaluate_candidate ${ew.customSqlSegment}
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.java b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.java
index ea86ac5..b87d7ec 100644
--- a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.java
+++ b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.java
@@ -42,6 +42,8 @@
*/
List<EvaluateResultVO> selectEvaluateResultPage(IPage page, EvaluateResultVO evaluateResult);
+ List<EvaluateResultEntity> selectEvaluateResultGroupBeId(IPage page,EvaluateResultVO evaluateResult);
+
/**
* 获取导出数据
diff --git a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.xml b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.xml
index fbb3dfd..3ac169a 100644
--- a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.xml
+++ b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateResultMapper.xml
@@ -6,7 +6,7 @@
<resultMap id="evaluateResultResultMap" type="org.springblade.modules.evaluate.entity.EvaluateResultEntity">
<result column="id" property="id"/>
<result column="tenant_id" property="tenantId"/>
- <result column="assessment_task_id" property="assessmentTaskId"/>
+ <result column="assessment_task_id" property="evaluateTaskId"/>
<result column="be_id" property="beId"/>
<result column="score_user_id" property="scoreUserId"/>
<result column="remark" property="remark"/>
@@ -18,6 +18,7 @@
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
+ <result column="temp_count" property="tempCount"/>
</resultMap>
@@ -25,6 +26,17 @@
select * from yw_evaluate_result where is_deleted = 0
</select>
+ <select id="selectEvaluateResultGroupBeId" resultMap="evaluateResultResultMap">
+ select be_id,count(*) as temp_count from yw_evaluate_result where is_deleted = 0 AND type = 0
+ <if test="evaluateResult.type !=null">
+ AND type = #{evaluateResult.type}
+ </if>
+ <if test="evaluateResult.evaluateTaskId !=null and evaluateResult.evaluateTaskId!=''">
+ AND evaluate_task_id = #{evaluateResult.evaluateTaskId}
+ </if>
+ GROUP BY be_id
+ </select>
+
<select id="exportEvaluateResult" resultType="org.springblade.modules.evaluate.excel.EvaluateResultExcel">
SELECT * FROM yw_evaluate_result ${ew.customSqlSegment}
diff --git a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.xml b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.xml
index 4c5c6c8..5ab4637 100644
--- a/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.xml
+++ b/src/main/java/org/springblade/modules/evaluate/mapper/EvaluateTaskSetMapper.xml
@@ -32,9 +32,15 @@
WHEN 1 THEN ( select count(*) from yw_evaluate_result b where b.evaluate_task_id = a.evaluate_task_id and a.dept_id = b.be_id )
END as vote_num
from yw_evaluate_task_set a where is_deleted = 0
- <if test="evaluateTaskSet.type !=null and evaluateTaskSet.type!=''">
+ <if test="evaluateTaskSet.type !=null">
AND type = #{evaluateTaskSet.type}
</if>
+ <if test="evaluateTaskSet.evaluateTaskName !=null and evaluateTaskSet.evaluateTaskName !=''">
+ AND evaluate_task_name like concat('%', #{evaluateTaskSet.evaluateTaskName},'%')
+ </if>
+ <if test="evaluateTaskSet.deptName !=null and evaluateTaskSet.deptName !=''">
+ AND dept_name like concat('%', #{evaluateTaskSet.deptName},'%')
+ </if>
</select>
diff --git a/src/main/java/org/springblade/modules/evaluate/service/IEvaluateCandidateService.java b/src/main/java/org/springblade/modules/evaluate/service/IEvaluateCandidateService.java
new file mode 100644
index 0000000..333f488
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/service/IEvaluateCandidateService.java
@@ -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.EvaluateCandidateEntity;
+import org.springblade.modules.evaluate.vo.EvaluateCandidateVO;
+import org.springblade.modules.evaluate.excel.EvaluateCandidateExcel;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import java.util.List;
+
+/**
+ * 评优候选人 服务类
+ *
+ * @author aix
+ * @since 2023-12-23
+ */
+public interface IEvaluateCandidateService extends BaseService<EvaluateCandidateEntity> {
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param evaluateCandidate
+ * @return
+ */
+ IPage<EvaluateCandidateVO> selectEvaluateCandidatePage(IPage<EvaluateCandidateVO> page, EvaluateCandidateVO evaluateCandidate);
+
+
+ /**
+ * 导出数据
+ *
+ * @param queryWrapper
+ * @return
+ */
+ List<EvaluateCandidateExcel> exportEvaluateCandidate(Wrapper<EvaluateCandidateEntity> queryWrapper);
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/service/IEvaluateResultService.java b/src/main/java/org/springblade/modules/evaluate/service/IEvaluateResultService.java
index 83ea368..0035f3d 100644
--- a/src/main/java/org/springblade/modules/evaluate/service/IEvaluateResultService.java
+++ b/src/main/java/org/springblade/modules/evaluate/service/IEvaluateResultService.java
@@ -40,6 +40,8 @@
*/
IPage<EvaluateResultVO> selectEvaluateResultPage(IPage<EvaluateResultVO> page, EvaluateResultVO evaluateResult);
+ IPage<EvaluateResultVO> selectEvaluateResultGroupBeId(IPage<EvaluateResultVO> page, EvaluateResultVO evaluateResult);
+
/**
* 导出数据
diff --git a/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateCandidateServiceImpl.java b/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateCandidateServiceImpl.java
new file mode 100644
index 0000000..fb2af9b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateCandidateServiceImpl.java
@@ -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.EvaluateCandidateEntity;
+import org.springblade.modules.evaluate.vo.EvaluateCandidateVO;
+import org.springblade.modules.evaluate.excel.EvaluateCandidateExcel;
+import org.springblade.modules.evaluate.mapper.EvaluateCandidateMapper;
+import org.springblade.modules.evaluate.service.IEvaluateCandidateService;
+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-23
+ */
+@Service
+public class EvaluateCandidateServiceImpl extends BaseServiceImpl<EvaluateCandidateMapper, EvaluateCandidateEntity> implements IEvaluateCandidateService {
+
+ @Override
+ public IPage<EvaluateCandidateVO> selectEvaluateCandidatePage(IPage<EvaluateCandidateVO> page, EvaluateCandidateVO evaluateCandidate) {
+ return page.setRecords(baseMapper.selectEvaluateCandidatePage(page, evaluateCandidate));
+ }
+
+
+ @Override
+ public List<EvaluateCandidateExcel> exportEvaluateCandidate(Wrapper<EvaluateCandidateEntity> queryWrapper) {
+ List<EvaluateCandidateExcel> evaluateCandidateList = baseMapper.exportEvaluateCandidate(queryWrapper);
+ //evaluateCandidateList.forEach(evaluateCandidate -> {
+ // evaluateCandidate.setTypeName(DictCache.getValue(DictEnum.YES_NO, EvaluateCandidate.getType()));
+ //});
+ return evaluateCandidateList;
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateResultServiceImpl.java b/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateResultServiceImpl.java
index 420625b..376bd25 100644
--- a/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateResultServiceImpl.java
+++ b/src/main/java/org/springblade/modules/evaluate/service/impl/EvaluateResultServiceImpl.java
@@ -16,15 +16,35 @@
*/
package org.springblade.modules.evaluate.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.AllArgsConstructor;
+import org.springblade.common.cache.SysCache;
+import org.springblade.common.cache.UserCache;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.modules.assessment.wrapper.CandidateJsonObj;
+import org.springblade.modules.evaluate.entity.EvaluateCandidateEntity;
import org.springblade.modules.evaluate.entity.EvaluateResultEntity;
+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.IEvaluateTaskService;
+import org.springblade.modules.evaluate.service.IEvaluateTaskSetService;
import org.springblade.modules.evaluate.vo.EvaluateResultVO;
import org.springblade.modules.evaluate.excel.EvaluateResultExcel;
import org.springblade.modules.evaluate.mapper.EvaluateResultMapper;
import org.springblade.modules.evaluate.service.IEvaluateResultService;
+import org.springblade.modules.evaluate.wrapper.EvaluateResultWrapper;
+import org.springblade.modules.system.entity.User;
+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 java.util.List;
/**
@@ -34,13 +54,24 @@
* @since 2023-12-18
*/
@Service
+@AllArgsConstructor
public class EvaluateResultServiceImpl extends BaseServiceImpl<EvaluateResultMapper, EvaluateResultEntity> implements IEvaluateResultService {
+
+ private final IEvaluateTaskService evaluateTaskService;
+
+ private final IUserService userService;
+
+ private final IEvaluateCandidateService evaluateCandidateService;
@Override
public IPage<EvaluateResultVO> selectEvaluateResultPage(IPage<EvaluateResultVO> page, EvaluateResultVO evaluateResult) {
return page.setRecords(baseMapper.selectEvaluateResultPage(page, evaluateResult));
}
+ @Override
+ public IPage<EvaluateResultVO> selectEvaluateResultGroupBeId(IPage<EvaluateResultVO> page, EvaluateResultVO evaluateResult) {
+ return page.setRecords(EvaluateResultWrapper.build().listVO(baseMapper.selectEvaluateResultGroupBeId(page, evaluateResult)));
+ }
@Override
public List<EvaluateResultExcel> exportEvaluateResult(Wrapper<EvaluateResultEntity> queryWrapper) {
@@ -51,4 +82,91 @@
return evaluateResultList;
}
+ @Override
+ @Transactional
+ public boolean saveOrUpdate(EvaluateResultEntity evaluateResult) {
+ boolean ret = super.saveOrUpdate(evaluateResult);
+
+ // 是否评分完成判断此操作
+ if (ret) {
+ EvaluateTaskEntity taskPO = evaluateTaskService.getById(evaluateResult.getEvaluateTaskId());
+
+ //判断评分是否完成 0:type 判断设置的部门员工是否完成评分 1:type 判断设置的部门是否完成评分
+ if (evaluateResult.getType() == 0) {
+ List<CandidateJsonObj> candidateJsonObjs = JSONArray.parseArray(JSON.toJSONString(taskPO.getCandidateNum()),CandidateJsonObj.class);
+ String deptIdsStr = "";
+
+ for (CandidateJsonObj obj:candidateJsonObjs) {
+ if (StringUtil.isNotBlank(deptIdsStr)) {
+ deptIdsStr += "," + obj.getDeptId();
+ } else {
+ deptIdsStr = obj.getDeptId() + "";
+ }
+ }
+
+ //根据部门获取所有用户数量
+ QueryWrapper<User> queryWrapper = new QueryWrapper();
+ queryWrapper.in("dept_id", deptIdsStr);
+ // 拿到设置部门所有用户数量
+ Long userByDeptIdsCount = userService.count(queryWrapper);
+
+ //用户数量和评优数据进行匹配 相同需要设置任务状态为已完成
+ QueryWrapper<EvaluateResultEntity> resultEntityQueryWrapper = new QueryWrapper<>();
+ resultEntityQueryWrapper.eq("evaluate_task_id", evaluateResult.getEvaluateTaskId());
+ Long evaluateResultCount = count(resultEntityQueryWrapper);
+
+ // 相同需要设置任务状态为已完成 不同不处理
+ if (userByDeptIdsCount == evaluateResultCount) {
+ taskPO.setCandidateState(2);//结束
+ evaluateTaskService.updateById(taskPO);
+
+ //保存候选人信息
+ for (CandidateJsonObj obj:candidateJsonObjs) {
+ Integer val = obj.getVal();
+
+ Page<EvaluateResultVO> page = new Page<>();
+ page.setCurrent(1);
+ page.setSize(val);
+ EvaluateResultVO vo = new EvaluateResultVO();
+ vo.setType(0);
+ vo.setEvaluateTaskId(evaluateResult.getEvaluateTaskId());
+ IPage<EvaluateResultVO> evaluateResultVOIPage = selectEvaluateResultGroupBeId(page,vo);
+
+ for (EvaluateResultVO resultVO:evaluateResultVOIPage.getRecords()) {
+ EvaluateCandidateEntity evaluateCandidate = new EvaluateCandidateEntity();
+ evaluateCandidate.setEvaluateTaskId(evaluateResult.getEvaluateTaskId());
+ evaluateCandidate.setEvaluateTaskName(taskPO.getTaskName());
+ User user = UserCache.getUser(resultVO.getBeId());
+ evaluateCandidate.setUserId(user.getId());
+ evaluateCandidate.setUserName(user.getName());
+ evaluateCandidate.setDeptName(SysCache.getDeptName(Long.valueOf(user.getDeptId())));
+ evaluateCandidate.setPostName(SysCache.getPostName(Long.valueOf(user.getPostId())));
+ evaluateCandidateService.save(evaluateCandidate);
+ }
+ }
+
+ }
+
+ } else if (evaluateResult.getType() == 1) {
+ QueryWrapper<EvaluateResultEntity> resultEntityQueryWrapper = new QueryWrapper<>();
+ resultEntityQueryWrapper.eq("evaluate_task_id", evaluateResult.getEvaluateTaskId());
+ Long evaluateResultCount = count(resultEntityQueryWrapper);
+
+ //部门评优数量和所有用户匹配
+ QueryWrapper<User> queryWrapper = new QueryWrapper();
+ queryWrapper.in("user_type", 2);//员工用户
+ // 拿到设置部门所有用户数量
+ Long userByDeptIdsCount = userService.count(queryWrapper);
+
+ // 相同需要设置任务状态为已完成 不同不处理
+ if (userByDeptIdsCount == evaluateResultCount) {
+ taskPO.setCandidateState(2);//结束
+ evaluateTaskService.updateById(taskPO);
+ }
+ }
+ }
+
+ return ret;
+ }
+
}
diff --git a/src/main/java/org/springblade/modules/evaluate/vo/EvaluateCandidateVO.java b/src/main/java/org/springblade/modules/evaluate/vo/EvaluateCandidateVO.java
new file mode 100644
index 0000000..89fbb42
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/vo/EvaluateCandidateVO.java
@@ -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.EvaluateCandidateEntity;
+import org.springblade.core.tool.node.INode;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 评优候选人 视图实体类
+ *
+ * @author aix
+ * @since 2023-12-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class EvaluateCandidateVO extends EvaluateCandidateEntity {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateWrapper.java b/src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateWrapper.java
new file mode 100644
index 0000000..b50cc7e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/evaluate/wrapper/EvaluateCandidateWrapper.java
@@ -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.EvaluateCandidateEntity;
+import org.springblade.modules.evaluate.vo.EvaluateCandidateVO;
+import java.util.Objects;
+
+/**
+ * 评优候选人 包装类,返回视图层所需的字段
+ *
+ * @author aix
+ * @since 2023-12-23
+ */
+public class EvaluateCandidateWrapper extends BaseEntityWrapper<EvaluateCandidateEntity, EvaluateCandidateVO> {
+
+ public static EvaluateCandidateWrapper build() {
+ return new EvaluateCandidateWrapper();
+ }
+
+ @Override
+ public EvaluateCandidateVO entityVO(EvaluateCandidateEntity evaluateCandidate) {
+ EvaluateCandidateVO evaluateCandidateVO = Objects.requireNonNull(BeanUtil.copy(evaluateCandidate, EvaluateCandidateVO.class));
+
+ //User createUser = UserCache.getUser(evaluateCandidate.getCreateUser());
+ //User updateUser = UserCache.getUser(evaluateCandidate.getUpdateUser());
+ //evaluateCandidateVO.setCreateUserName(createUser.getName());
+ //evaluateCandidateVO.setUpdateUserName(updateUser.getName());
+
+ return evaluateCandidateVO;
+ }
+
+
+}
--
Gitblit v1.9.3