考核组相关的保存和编辑接口合并
This commit is contained in:
parent
302d4c744c
commit
379cb16def
32
src/main/java/com/lz/common/emun/CheckStaffType.java
Normal file
32
src/main/java/com/lz/common/emun/CheckStaffType.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.lz.common.emun;
|
||||
//考核人员类型
|
||||
public enum CheckStaffType {
|
||||
|
||||
STAFF(0, "考核人员"),
|
||||
MANAGER(1, "管理人员人员"),
|
||||
|
||||
;
|
||||
|
||||
CheckStaffType(int code, String name){
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
private int code;
|
||||
private String name;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@ -38,4 +38,6 @@ public interface EvaluationGroupMapper extends BaseMapper<EvaluationGroup> {
|
||||
List<EvaluationGroup> seleteEvaluationGroupByReq(@Param("page") IPage page, @Param("req") EvaluationGroupReq req);
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
EvaluationGroup selectEvaluationGroupByName(@Param("name") String name);
|
||||
}
|
||||
@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.flow.entity.EvaluationStartStaff;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EvaluationStartStaffMapper extends BaseMapper<EvaluationStartStaff> {
|
||||
|
||||
@ -30,4 +33,5 @@ public interface EvaluationStartStaffMapper extends BaseMapper<EvaluationStartSt
|
||||
int deleteEvaluationStartStaffById(@Param("id")Long id);
|
||||
|
||||
|
||||
Long insertEvaluationStartStaffs(@Param("list") List<EvaluationStartStaff> evaluationStartStaffs);
|
||||
}
|
||||
@ -35,4 +35,6 @@ public interface FlowChartDetailRecordMapper extends BaseMapper<FlowChartDetailR
|
||||
|
||||
|
||||
List<FlowChartDetailRecord> selectFlowChartDetailRecordByGroupIdAndChartId(@Param("groupId") Long groupId, @Param("chartId") Long chartId);
|
||||
|
||||
List<FlowChartDetailRecord> selectFlowChartDetailRecordByGroupId(Long groupId);
|
||||
}
|
||||
@ -22,6 +22,7 @@ import java.util.Date;
|
||||
public class EvaluationGroup implements java.io.Serializable {
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "如果不传,那么表示新建,否则更新", name = "id")
|
||||
private Long id;
|
||||
//
|
||||
@ApiModelProperty(value = "", name = "isDelete")
|
||||
|
||||
@ -41,4 +41,6 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
|
||||
PageUtils selectEvaluationGroupByReq(EvaluationGroupReq req);
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids);
|
||||
|
||||
EvaluationGroup selectEvaluationGroupByName(String name);
|
||||
}
|
||||
@ -3,6 +3,8 @@ package com.lz.modules.flow.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.flow.entity.EvaluationStartStaff;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发起考核考,核组人员对应关系表 服务类
|
||||
@ -30,4 +32,5 @@ public interface EvaluationStartStaffService extends IService<EvaluationStartSta
|
||||
int deleteEvaluationStartStaffById(Long id);
|
||||
|
||||
|
||||
Long insertEvaluationStartStaffs(List<EvaluationStartStaff> evaluationStartStaffs);
|
||||
}
|
||||
@ -34,4 +34,6 @@ public interface FlowChartDetailRecordService extends IService<FlowChartDetailRe
|
||||
|
||||
|
||||
List<FlowChartDetailRecord> selectFlowChartDetailRecordByGroupIdAndChartId(Long groupId, Long chartId);
|
||||
|
||||
List<FlowChartDetailRecord> selectFlowChartDetailRecordByGroupId(Long groupId);
|
||||
}
|
||||
@ -120,4 +120,9 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
public List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids){
|
||||
return evaluationGroupMapper.selectEvaluationGroupByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationGroup selectEvaluationGroupByName(String name){
|
||||
return evaluationGroupMapper.selectEvaluationGroupByName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,9 @@ import com.lz.modules.flow.service.EvaluationStartStaffService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发起考核考,核组人员对应关系表 服务类
|
||||
@ -23,7 +26,7 @@ public class EvaluationStartStaffServiceImpl extends ServiceImpl<EvaluationStart
|
||||
@Autowired
|
||||
private EvaluationStartStaffMapper evaluationStartStaffMapper;
|
||||
|
||||
|
||||
static int maxInsertSQL = 100;
|
||||
|
||||
@Override
|
||||
public EvaluationStartStaff selectEvaluationStartStaffById(Long id){
|
||||
@ -58,6 +61,34 @@ public class EvaluationStartStaffServiceImpl extends ServiceImpl<EvaluationStart
|
||||
return evaluationStartStaffMapper.deleteEvaluationStartStaffById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long insertEvaluationStartStaffs(List<EvaluationStartStaff> evaluationStartStaffs){
|
||||
if(evaluationStartStaffs.size() <= maxInsertSQL){
|
||||
return evaluationStartStaffMapper.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
}
|
||||
//下面防止sql语句过大
|
||||
Long count = Long.getLong("0");
|
||||
int insert = 0;
|
||||
List<EvaluationStartStaff> startStaffs = new ArrayList<>();
|
||||
for (EvaluationStartStaff startStaff:evaluationStartStaffs
|
||||
) {
|
||||
startStaffs.add(startStaff);
|
||||
insert++;
|
||||
if(insert >= maxInsertSQL){
|
||||
count += evaluationStartStaffMapper.insertEvaluationStartStaffs(startStaffs);
|
||||
startStaffs.clear();
|
||||
insert = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if(startStaffs.size() > 0){
|
||||
count += evaluationStartStaffMapper.insertEvaluationStartStaffs(startStaffs);
|
||||
}
|
||||
return count;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -66,6 +66,10 @@ public class FlowChartDetailRecordServiceImpl extends ServiceImpl<FlowChartDetai
|
||||
return flowChartDetailRecordMapper.selectFlowChartDetailRecordByGroupIdAndChartId(groupId, chartId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowChartDetailRecord> selectFlowChartDetailRecordByGroupId(Long groupId){
|
||||
return flowChartDetailRecordMapper.selectFlowChartDetailRecordByGroupId(groupId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -122,7 +122,6 @@ public class EvaluationGroupController {
|
||||
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("编辑考评组")
|
||||
public R update(@RequestBody @ApiParam EvaluationGroup evaluationGroup) {
|
||||
evaluationGroupService.updateEvaluationGroupById(evaluationGroup);
|
||||
return R.ok();
|
||||
@ -130,10 +129,25 @@ public class EvaluationGroupController {
|
||||
|
||||
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增考评组")
|
||||
@ApiOperation("保存考评组")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = EvaluationGroup.class)})
|
||||
public R save(@RequestBody @ApiParam EvaluationGroup evaluationGroup) {
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
if(evaluationGroup.getId() != null && evaluationGroup.getId().intValue() > 0){
|
||||
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
|
||||
if(evaluationGroup1 == null || evaluationGroup1.getId().equals(evaluationGroup.getId())){
|
||||
evaluationGroupService.updateEvaluationGroupById(evaluationGroup);
|
||||
}else {
|
||||
return R.error("已经存在相同名称考核组");
|
||||
}
|
||||
|
||||
}else{
|
||||
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
|
||||
if(evaluationGroup1 != null){
|
||||
return R.error("已经存在相同名称考核组");
|
||||
}
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
}
|
||||
|
||||
return R.ok().put("data", evaluationGroup);
|
||||
}
|
||||
|
||||
|
||||
@ -86,12 +86,14 @@ public class FlowChartController {
|
||||
@ApiOperation("保存流程节点小流程")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = FlowChartDetailRecord.class)})
|
||||
public R saveDetailProc(@RequestBody @ApiParam FlowChartDetailRecord flowChartDetailRecord) {
|
||||
if(flowChartDetailRecord.getId() != null && flowChartDetailRecord.getId().intValue() > 0){
|
||||
return updateDetailProc(flowChartDetailRecord);
|
||||
}
|
||||
flowChartDetailRecordService.insertFlowChartDetailRecord(flowChartDetailRecord);
|
||||
return R.ok().put("data", flowChartDetailRecord);
|
||||
}
|
||||
|
||||
@PostMapping("/updateDetailProc")
|
||||
@ApiOperation("编辑流程节点小流程")
|
||||
public R updateDetailProc(@RequestBody @ApiParam FlowChartDetailRecord flowChartDetailRecord) {
|
||||
flowChartDetailRecordService.updateFlowChartDetailRecordById(flowChartDetailRecord);
|
||||
return R.ok();
|
||||
|
||||
@ -2,13 +2,12 @@ package com.lz.modules.performance.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lz.common.emun.CheckStaffType;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
@ -19,10 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
@ -40,6 +36,17 @@ public class FlowStartController {
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
@Autowired
|
||||
private EvaluationStartStaffService evaluationStartStaffService;
|
||||
|
||||
@Autowired
|
||||
private ResultModelService resultModelService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartDetailRecordService flowChartDetailRecordService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/getById")
|
||||
@ -68,12 +75,57 @@ public class FlowStartController {
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
Map<String, Long> map = new HashedMap();
|
||||
|
||||
for (EvaluationGroup evaluationGroup:evaluationGroups
|
||||
) {
|
||||
//下面初始化部门的员工考核流程
|
||||
//下面初始化员工考核流程
|
||||
List<String> staffIds = evaluationGroupService.selectAllStaffIdsByGroupId(evaluationGroup.getId());
|
||||
if(staffIds.size() == 0){
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
}
|
||||
List<ResultModel> resultModels = resultModelService.selectResultModelByGroupId(evaluationGroup.getId());
|
||||
if(resultModels.size() == 0){
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
}
|
||||
|
||||
List<FlowChartDetailRecord> flowChartDetailRecords
|
||||
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupId(evaluationGroup.getId());
|
||||
if(flowChartDetailRecords.size() == 0){
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
||||
}
|
||||
|
||||
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
||||
|
||||
for (String staffId:staffIds
|
||||
) {
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setStaffId(Long.getLong(staffId));
|
||||
evaluationStartStaff.setStaffId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}
|
||||
//下面初始化管理人员
|
||||
if(evaluationGroup.getManagerIds() != null && evaluationGroup.getManagerIds().length() > 0){
|
||||
String[] managerIds = evaluationGroup.getManagerIds().split(",");
|
||||
for (String staffId:managerIds
|
||||
) {
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();resultTagetLib/save
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setStaffId(Long.getLong(staffId));
|
||||
evaluationStartStaff.setStaffId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}
|
||||
}
|
||||
if(evaluationStartStaffs.size() > 0){
|
||||
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
}
|
||||
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
|
||||
|
||||
|
||||
//下面初始化考核人员的考核流程
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ public class ResultModelController {
|
||||
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("编辑考核模板")
|
||||
public R update(@RequestBody @ApiParam ResultModel resultModel) {
|
||||
resultModelService.updateResultModelById(resultModel);
|
||||
return R.ok();
|
||||
@ -58,10 +57,13 @@ public class ResultModelController {
|
||||
|
||||
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增模板中的考核维度")
|
||||
@ApiOperation("保存模板中的考核维度")
|
||||
public R save(@RequestBody @ApiParam ResultModel resultModel) {
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
return R.ok().put("data",resultModel);
|
||||
if(resultModel.getId() != null && resultModel.getId().intValue() > 0){
|
||||
return update(resultModel);
|
||||
}
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
return R.ok().put("data",resultModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,9 +48,12 @@ public class ResultTagetLibController {
|
||||
|
||||
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增考核指标")
|
||||
@ApiOperation("保存考核指标")
|
||||
public R save(@RequestBody @ApiParam ResultTagetLib resultTagetLib) {
|
||||
|
||||
if(resultTagetLib.getId() != null && resultTagetLib.getId().intValue() > 0){
|
||||
return update(resultTagetLib);
|
||||
}
|
||||
return resultTagetLibService.insertResultTagetLib(resultTagetLib);
|
||||
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@
|
||||
<if test="req.name != null and req.name != ''">and name like concat('%', #{req.name} '%') </if>
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationGroupById" resultType="EvaluationGroup" >
|
||||
<select id="selectEvaluationGroupByIds" resultType="EvaluationGroup" >
|
||||
select * from lz_evaluation_group where is_delete = 0 and id in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
@ -104,6 +104,10 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationGroupByName" resultType="EvaluationGroup" >
|
||||
select * from lz_evaluation_group where name=#{name} and is_delete = 0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -83,6 +83,21 @@
|
||||
<update id="deleteEvaluationStartStaffById" parameterType="java.lang.Long">
|
||||
update lz_evaluation_start_staff set is_delete = 1 where id=#{id} limit 1
|
||||
</update>
|
||||
<insert id="insertEvaluationStartStaffs" parameterType="EvaluationStartStaff" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_evaluation_start_staff(
|
||||
evaluation_id,
|
||||
start_id,
|
||||
staff_id,
|
||||
type
|
||||
)values
|
||||
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||
#{ item.evaluationId},
|
||||
#{ item.startId},
|
||||
#{ item.staffId},
|
||||
#{ item.type}
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -108,5 +108,9 @@
|
||||
select * from lz_flow_chart_detail_record where evaluation_group_id=#{groupId} and chart_id = #{chartId} and is_delete = 0 order by step_index desc
|
||||
</select>
|
||||
|
||||
<select id="selectFlowChartDetailRecordByGroupIdAndChartId" resultType="FlowChartDetailRecord" >
|
||||
select * from lz_flow_chart_detail_record where evaluation_group_id=#{groupId} and is_delete = 0 order by step_index desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user