发起考核功能基本完成
This commit is contained in:
parent
1fe86fda4c
commit
944846d7ec
@ -55,4 +55,6 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
|
||||
List<DepartmentsEntity> selectEntityByDepartmentIds(@Param("dIds") List<String> dIds);
|
||||
|
||||
List<DepartmentsEntity> selectEntityByParentDepartmentIds(@Param("dIds") List<DepartmentsEntity> dIds);
|
||||
|
||||
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
||||
}
|
||||
|
||||
@ -64,4 +64,6 @@ public interface DepartmentsStaffRelateDao extends BaseMapper<DepartmentsStaffRe
|
||||
List<ReportProgressListDto> getDepartmentNameByStaffIds(@Param("staffIds") List<String> staffIds);
|
||||
|
||||
List<String> selectStaffIdsByDepartments(@Param("deparmentIds")List<String> deparmentIds);
|
||||
|
||||
List<StaffEntity> selectLeadersByDepartmentId(@Param("depId") String depId);
|
||||
}
|
||||
|
||||
@ -90,4 +90,6 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
||||
List<StaffSimpleInfo> selectAllStaffSimpleInfos(@Param("depart") DepartmentsEntity depart);
|
||||
|
||||
List<StaffSimpleInfo> selectStaffSimpleInfos(@Param("sIds") List<Long> sIds);
|
||||
|
||||
List<StaffEntity> selectOnJobByIds(@Param("mIds") List<Long> mIds);
|
||||
}
|
||||
|
||||
@ -42,6 +42,8 @@ public class StaffSimpleInfo implements Serializable {
|
||||
private String departmentName;
|
||||
//部门id
|
||||
private String departmentId;
|
||||
//钉钉,飞书等第三方人员id
|
||||
private String employeeId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -54,5 +54,8 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
||||
List<DepartmentsDto> getDepartmentTreeByStaffId(String staffId,boolean containSelf);
|
||||
|
||||
List<DepartmentsEntity> selectAllDepartmentIds(List<String> dIds);
|
||||
|
||||
//查找父级部门
|
||||
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
||||
}
|
||||
|
||||
|
||||
@ -42,5 +42,7 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
|
||||
DepartmentsStaffRelateEntity selectByStaffId(Long staffId);
|
||||
|
||||
List<String> selectStaffIdsByDepartments(List<String> deparmentIds);
|
||||
|
||||
List<StaffEntity> selectLeadersByDepartmentId(String depId);
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import com.lz.modules.flow.model.DepartManagers;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
|
||||
@ -92,5 +93,9 @@ public interface StaffService extends IService<StaffEntity> {
|
||||
List<StaffSimpleInfo> selectAllStaffSimpleInfos(DepartmentsEntity depart);
|
||||
|
||||
List<StaffSimpleInfo> selectStaffSimpleInfos(List<Long> sIds);
|
||||
//查找第几及领导
|
||||
DepartManagers findLeader(Long id, Integer type);
|
||||
//查找在职的
|
||||
List<StaffEntity> selectOnJobByIds(List<Long> mIds);
|
||||
}
|
||||
|
||||
|
||||
@ -290,5 +290,10 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId){
|
||||
return departmentsDao.selectParentDepartmentByDepartmentId(departmentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.lz.modules.app.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -100,4 +101,9 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
|
||||
}
|
||||
return departmentsStaffRelateDao.selectStaffIdsByDepartments(deparmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffEntity> selectLeadersByDepartmentId(String depId){
|
||||
return departmentsStaffRelateDao.selectLeadersByDepartmentId(depId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,8 +13,10 @@ import com.lz.modules.app.dao.StaffDao;
|
||||
import com.lz.modules.app.entity.*;
|
||||
import com.lz.modules.app.service.*;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import com.lz.modules.flow.model.DepartManagers;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -32,6 +34,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service("staffService")
|
||||
@Slf4j
|
||||
public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> implements StaffService {
|
||||
|
||||
protected final static org.slf4j.Logger logger = LoggerFactory.getLogger(StaffServiceImpl.class);
|
||||
@ -463,5 +466,52 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
return staffDao.selectStaffSimpleInfos(sIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
//查找第几及领导
|
||||
public DepartManagers findLeader(Long id, Integer type){
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectByStaffId(id);
|
||||
DepartManagers departManagers = new DepartManagers();
|
||||
if(departmentsStaffRelateEntity != null){
|
||||
if(departmentsStaffRelateEntity.getIsLeader().intValue() == 1
|
||||
& departmentsStaffRelateEntity.getStaffId().longValue() == id.longValue()){
|
||||
//自己是部门领导
|
||||
type++;
|
||||
}
|
||||
String depId = departmentsStaffRelateEntity.getDepartmentId();
|
||||
departManagers.setDepartmentId(depId);
|
||||
while(type > 1){
|
||||
//查找父级部门
|
||||
DepartmentsEntity departmentsEntity =
|
||||
departmentsService.selectParentDepartmentByDepartmentId(depId);
|
||||
if(departmentsEntity != null){
|
||||
depId = departmentsEntity.getDepartmentId();
|
||||
}else{
|
||||
log.info("没有找到父级部门,部门id{}", depId);
|
||||
departManagers.setManagers(new ArrayList<>());
|
||||
}
|
||||
type--;
|
||||
}
|
||||
List<StaffEntity> staffEntities =
|
||||
departmentsStaffRelateService.selectLeadersByDepartmentId(depId);
|
||||
departManagers.setManagers(staffEntities);
|
||||
if(staffEntities.size() == 0){
|
||||
log.info("无法找到管理人员.部门id{}", depId);
|
||||
}
|
||||
|
||||
return departManagers;
|
||||
|
||||
|
||||
}
|
||||
log.info("没有找到部门信息,员工id{}", id);
|
||||
departManagers.setManagers(new ArrayList<>());
|
||||
return departManagers;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffEntity> selectOnJobByIds(List<Long> mIds){
|
||||
return staffDao.selectOnJobByIds(mIds);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -35,4 +35,5 @@ public interface FlowStartMapper extends BaseMapper<FlowStart> {
|
||||
|
||||
List<FlowStart> selectListByTime(@Param("page") IPage page, @Param("cycleType")Integer cycleType,@Param("name")String name);
|
||||
|
||||
FlowStart selectFlowStartByName(@Param("name") String name);
|
||||
}
|
||||
@ -9,6 +9,7 @@ package com.lz.modules.flow.dao;
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.flow.entity.ResultModel;
|
||||
import com.lz.modules.flow.entity.ResultTagetLib;
|
||||
import com.lz.modules.flow.model.ResultModelDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -39,4 +40,5 @@ public interface ResultModelMapper extends BaseMapper<ResultModel> {
|
||||
List<ResultModelDto> selectResultDtoByGroupId(Long id);
|
||||
|
||||
int deleteResultModelByGroupId(Long id);
|
||||
|
||||
}
|
||||
@ -49,6 +49,9 @@ public class EvaluationGroup implements java.io.Serializable {
|
||||
@ApiModelProperty(value = "排除人员ids,逗号隔开", name = "outIds")
|
||||
private String outIds;
|
||||
|
||||
@ApiModelProperty(value = "本记录被拷贝的id,每次发起绩效备份一份copy_id表示被复制的那份id。发起后所有相关逻辑表使用的是拷贝后新生成的ID。绩效考核流程中,如果原考评组有人员变动,该拷贝也将变动", name = "copyId")
|
||||
private Long copyId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "参与考核人数", name = "counts")
|
||||
private int counts;
|
||||
@ -201,6 +204,7 @@ public class EvaluationGroup implements java.io.Serializable {
|
||||
",depIds=" + depIds +
|
||||
",staffIds=" + staffIds +
|
||||
",outIds=" + outIds +
|
||||
",copyId=" + copyId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
12
src/main/java/com/lz/modules/flow/model/DepartManagers.java
Normal file
12
src/main/java/com/lz/modules/flow/model/DepartManagers.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.lz.modules.flow.model;
|
||||
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DepartManagers {
|
||||
private String departmentId;
|
||||
private List<StaffEntity> managers;
|
||||
}
|
||||
@ -32,5 +32,5 @@ public interface FlowStartService extends IService<FlowStart> {
|
||||
int deleteFlowStartById(Long id);
|
||||
|
||||
|
||||
|
||||
FlowStart selectFlowStartByName(String name);
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.lz.modules.flow.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.flow.entity.ResultModel;
|
||||
import com.lz.modules.flow.entity.ResultTagetLib;
|
||||
import com.lz.modules.flow.model.ResultModelDto;
|
||||
|
||||
import java.util.List;
|
||||
@ -39,4 +40,5 @@ public interface ResultModelService extends IService<ResultModel> {
|
||||
List<ResultModelDto> selectResultDtoByGroupId(Long id);
|
||||
|
||||
R deleteResultModelByGroupId(Long id);
|
||||
|
||||
}
|
||||
@ -144,6 +144,7 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
@Override
|
||||
public List<StaffSimpleInfo> selectAllStaffSimpleInfoByGroupId(EvaluationGroup evaluationGroup){
|
||||
List<StaffSimpleInfo> staffSimpleInfos = new ArrayList<>();
|
||||
//下面获取部门人员
|
||||
if(!StringUtil.isEmpty(evaluationGroup.getDepIds())){
|
||||
|
||||
|
||||
@ -167,6 +168,7 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
}
|
||||
}
|
||||
|
||||
//下面获取指定人员
|
||||
if(!StringUtil.isEmpty(evaluationGroup.getStaffIds())){
|
||||
|
||||
List<Long> sIds = Arrays.stream(evaluationGroup.getStaffIds()
|
||||
@ -200,6 +202,8 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
staffSimpleInfoMap.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
staffSimpleInfos = staffSimpleInfoMap.values().stream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
return flowStartMapper.deleteFlowStartById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowStart selectFlowStartByName(String name){
|
||||
return flowStartMapper.selectFlowStartByName(name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4,13 +4,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.flow.dao.ResultModelMapper;
|
||||
import com.lz.modules.flow.entity.ResultModel;
|
||||
import com.lz.modules.flow.entity.ResultTagetLib;
|
||||
import com.lz.modules.flow.model.ResultModelDto;
|
||||
import com.lz.modules.flow.service.ResultModelService;
|
||||
import com.lz.modules.performance.service.ResultTagetLibService;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -32,7 +35,7 @@ public class ResultModelServiceImpl extends ServiceImpl<ResultModelMapper, Resul
|
||||
|
||||
@Autowired
|
||||
private ResultTagetLibService resultTargetLibService;
|
||||
|
||||
private static int maxInsertSQL = 100;
|
||||
|
||||
|
||||
@Override
|
||||
@ -93,4 +96,5 @@ public class ResultModelServiceImpl extends ServiceImpl<ResultModelMapper, Resul
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -7,11 +7,15 @@ 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.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.DepartManagers;
|
||||
import com.lz.modules.flow.model.ResultModelDto;
|
||||
import com.lz.modules.flow.model.ResultTagetLibDto;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.performance.service.ResultTagetLibService;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
@ -20,9 +24,11 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
@ -65,16 +71,23 @@ public class FlowStartController {
|
||||
@Autowired
|
||||
private ResultDetailService resultDetailService;
|
||||
|
||||
@Autowired
|
||||
private ResultTagetLibService resultTagetLibService;
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/getById")
|
||||
public R getById(@RequestParam Long id) {
|
||||
public R getById(@RequestParam Long id, @RequestParam int type) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroupService.selectEvaluationGroupById(id);
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
//flowStart = flowStartService.selectFlowStartById(flowStart.getId());
|
||||
//List<StaffEntity> staffEntity = staffService.findLeader(id, type);
|
||||
return R.ok().put("data",staffIds);
|
||||
}
|
||||
|
||||
@ -89,8 +102,33 @@ public class FlowStartController {
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("发起新的考核任务")
|
||||
public R save(@RequestBody @ApiParam FlowStart flowStart) {
|
||||
flowStartService.insertFlowStart(flowStart);
|
||||
Map<Long, String> chartNameMaps = new HashedMap();
|
||||
//下面生成或者合并发起绩效
|
||||
if(flowStart.getStartTime() == null){
|
||||
return R.error("未设置有效考核月份");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月");
|
||||
String startDate = sdf.format(flowStart.getStartTime());
|
||||
|
||||
if(flowStart.getCycleType().intValue() != 0){
|
||||
//月份
|
||||
if(flowStart.getEndTime() == null){
|
||||
return R.error("未设置有效考核结束月份");
|
||||
}
|
||||
String endDate = sdf.format(flowStart.getStartTime());
|
||||
flowStart.setName(startDate + "-" + endDate + "绩效考核");
|
||||
}else{
|
||||
flowStart.setName(startDate + "绩效考核");
|
||||
}
|
||||
FlowStart flowStart1 = flowStartService.selectFlowStartByName(flowStart.getName());
|
||||
if(flowStart1 == null){
|
||||
flowStartService.insertFlowStart(flowStart);
|
||||
}else{
|
||||
flowStart = flowStart1;
|
||||
}
|
||||
|
||||
|
||||
Map<Long, String> chartNameMaps = new HashedMap();//流程节点与流程名称对应map,下面多次循环,减少数据库查找
|
||||
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
||||
//下面开始初始化流程
|
||||
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
|
||||
@Override
|
||||
@ -100,28 +138,61 @@ public class FlowStartController {
|
||||
}).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
|
||||
for (EvaluationGroup evaluationGroup:evaluationGroups
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
Map<Long, StaffSimpleInfo> staffSimpleInfoMap =
|
||||
staffIds.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, Function.identity(), (e, replacement) -> e));
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
if(n == 0){//如果一个组都没有添加,那么直接删除
|
||||
flowStartService.deleteFlowStartById(flowStart.getId());
|
||||
}
|
||||
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
}
|
||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||
if(resultModelDtos.size() == 0){
|
||||
if(n == 0){//如果一个组都没有添加,那么直接删除
|
||||
flowStartService.deleteFlowStartById(flowStart.getId());
|
||||
}
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
}
|
||||
|
||||
List<FlowChartDetailRecord> flowChartDetailRecords
|
||||
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupId(evaluationGroup.getId());
|
||||
if(flowChartDetailRecords.size() == 0){
|
||||
if(n == 0){//如果一个组都没有添加,那么直接删除
|
||||
flowStartService.deleteFlowStartById(flowStart.getId());
|
||||
}
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
||||
}
|
||||
|
||||
List<StaffEntity> staffManagers = null;
|
||||
if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
|
||||
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(","))
|
||||
.map(new Function<String, Long>() {
|
||||
@Override
|
||||
public Long apply(String s) {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
//查找在职的管理人员
|
||||
staffManagers = staffService.selectOnJobByIds(mIds);
|
||||
|
||||
}
|
||||
if(staffManagers == null || staffManagers.size() == 0){
|
||||
if(n == 0){//如果一个组都没有添加,那么直接删除
|
||||
flowStartService.deleteFlowStartById(flowStart.getId());
|
||||
}
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
}
|
||||
|
||||
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||
evaluationGroup.setId(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
|
||||
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
|
||||
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
|
||||
int stepIndex = 0;
|
||||
@ -132,8 +203,10 @@ public class FlowStartController {
|
||||
flow.setOpt("+");
|
||||
flow.setStartId(flowStart.getId());
|
||||
flow.setChartId(flowChartDetailRecord.getChartId());
|
||||
String optName = chartNameMaps.get(flowChartDetailRecord.getChartId());
|
||||
if(optName == null){
|
||||
String optName;
|
||||
if(chartNameMaps.containsKey(flowChartDetailRecord.getChartId())){//缓存
|
||||
optName = chartNameMaps.get(flowChartDetailRecord.getChartId());
|
||||
}else{//查找数据库
|
||||
FlowChart flowChart = flowChartService.selectFlowChartById(flowChartDetailRecord.getChartId());
|
||||
chartNameMaps.put(flowChart.getId(), flowChart.getName());
|
||||
optName = flowChart.getName();
|
||||
@ -182,8 +255,25 @@ public class FlowStartController {
|
||||
|
||||
//初始化lz_result_details数据
|
||||
List<ResultDetail> resultDetails = new ArrayList<>();
|
||||
//拷贝考评组的指标信息
|
||||
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
||||
|
||||
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
||||
|
||||
|
||||
for (StaffEntity entity:staffManagers
|
||||
) {
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
||||
evaluationStartStaff.setStaffId(entity.getId());
|
||||
evaluationStartStaff.setStaffId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
@ -212,29 +302,82 @@ public class FlowStartController {
|
||||
String roleJSON = "[";
|
||||
for (int i = 0; i < flowApprovalRoles.size() ;i++){
|
||||
FlowApprovalRole approvalRole = flowApprovalRoles.get(i);
|
||||
if(approvalRole.getStepIndex().intValue() == 0){
|
||||
if(i == 0){
|
||||
if(approvalRole.getStepIndex().intValue() == 0){//找到所有步骤为0的人员
|
||||
Long staffId = approvalRole.getApprovalId();//默认为指定人员。
|
||||
if(approvalRole.getType().intValue() == ChartOptType.SELF.getCode()){
|
||||
//制定人员为自己的
|
||||
staffId = staffInfo.getId();
|
||||
} else if(approvalRole.getType().intValue() > 0){//当设置为几级领导时
|
||||
///查找领导,如果不存在那么设置管理人员
|
||||
List<StaffEntity> staffLeader;
|
||||
String key = staffInfo.getDepartmentId() + approvalRole.getType();
|
||||
if(staffManages.containsKey(key)){
|
||||
staffLeader = staffManages.get(staffInfo.getDepartmentId());
|
||||
}else{
|
||||
DepartManagers departManagers =
|
||||
staffService.findLeader(staffInfo.getId(), approvalRole.getType());
|
||||
staffLeader = departManagers.getManagers();
|
||||
staffManages.put(key, departManagers.getManagers());
|
||||
}
|
||||
|
||||
if(staffLeader.size() == 0){
|
||||
//没有领导,通知到组设置的绩效管理人员
|
||||
for (StaffEntity entity:staffManagers
|
||||
) {
|
||||
roleJSON += ("{\"roleId\":0,\"staffId\":" + entity.getId() + "},");//这里写死了权限为0的即为找不到领导
|
||||
|
||||
}
|
||||
}else{
|
||||
for(int j = 0; j <staffLeader.size(); j++ ){
|
||||
StaffEntity staff = staffLeader.get(j);
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staff.getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName("");
|
||||
|
||||
}
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + staff.getId() + "},");
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(approvalRole.getApprovalId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName("");
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + approvalRole.getApprovalId() + "}");
|
||||
}else{
|
||||
roleJSON += (",{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + approvalRole.getApprovalId() + "}");
|
||||
|
||||
}
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + staffId + "},");
|
||||
}
|
||||
}
|
||||
roleJSON += "]";
|
||||
roleJSON = roleJSON.replace(",]", "]");
|
||||
resultRecord.setFlowStaffIdRole(roleJSON);
|
||||
resultRecordService.insertResultRecord(resultRecord);
|
||||
//下面生成ResultDetail对象
|
||||
for (ResultModelDto modelDto:resultModelDtos
|
||||
) {
|
||||
////下面拷贝一份考评组信息的维度信息
|
||||
ResultModel resultModel = new ResultModel();
|
||||
BeanUtils.copyProperties(modelDto, resultModel);
|
||||
modelDto.setGradeGroupId(evaluationGroup.getId());//设置拷贝组的id
|
||||
resultModel.setId(null);
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
|
||||
if(modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
|
||||
for (ResultTagetLibDto libDto:
|
||||
modelDto.getTagetLibs()) {
|
||||
//下面拷贝考评组里面的指标信息
|
||||
ResultTagetLib resultTagetLib = new ResultTagetLib();
|
||||
BeanUtils.copyProperties(libDto, resultTagetLib);
|
||||
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
|
||||
resultTagetLib.setId(null);
|
||||
resultTagetLibs.add(resultTagetLib);
|
||||
|
||||
ResultDetail resultDetail = new ResultDetail();
|
||||
resultDetail.setRecordId(resultRecord.getId());
|
||||
resultDetail.setTarget(libDto.getName());
|
||||
@ -252,38 +395,20 @@ public class FlowStartController {
|
||||
if(resultDetails.size() > 0){
|
||||
//
|
||||
resultDetailService.insertResultDetails(resultDetails);
|
||||
//插入备份的考评组指标信息
|
||||
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
|
||||
}
|
||||
|
||||
//下面初始化管理人员
|
||||
if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
|
||||
String[] managerIds = evaluationGroup.getManagerIds().split(",");
|
||||
for (String staffId:managerIds
|
||||
) {
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
||||
evaluationStartStaff.setStaffId(Long.parseLong(staffId));
|
||||
evaluationStartStaff.setStaffId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
//下面通知所有参与考核人员
|
||||
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//下面初始化lz_result_record表和lz_result_detail表
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -10,10 +10,7 @@ import com.lz.modules.app.resp.Step;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.app.utils.t.TwoTuple;
|
||||
import com.lz.modules.flow.entity.Flow;
|
||||
import com.lz.modules.flow.entity.FlowDepartment;
|
||||
import com.lz.modules.flow.entity.FlowRecord;
|
||||
import com.lz.modules.flow.entity.FlowRelation;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.flow.service.*;
|
||||
@ -313,6 +310,28 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
|
||||
if(resultDetails.size() <= maxInsertSQL){
|
||||
return resultDetailMapper.insertResultDetails(resultDetails);
|
||||
}
|
||||
//下面防止sql语句过大
|
||||
Long count = Long.parseLong("0");
|
||||
int insert = 0;
|
||||
List<ResultDetail> resultDetails1 = new ArrayList<>();
|
||||
for (ResultDetail detail:resultDetails
|
||||
) {
|
||||
resultDetails1.add(detail);
|
||||
insert++;
|
||||
if(insert >= maxInsertSQL){
|
||||
count += resultDetailMapper.insertResultDetails(resultDetails1);
|
||||
resultDetails1.clear();
|
||||
insert = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if(resultDetails1.size() > 0){
|
||||
count += resultDetailMapper.insertResultDetails(resultDetails1);
|
||||
}
|
||||
return count;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,12 +13,13 @@
|
||||
<result column="dep_ids" property="depIds"/>
|
||||
<result column="staff_ids" property="staffIds"/>
|
||||
<result column="out_ids" property="outIds"/>
|
||||
<result column="copy_id" property="copyId"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, manager_ids AS managerIds, dep_ids AS depIds, staff_ids AS staffIds, out_ids AS outIds
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, manager_ids AS managerIds, dep_ids AS depIds, staff_ids AS staffIds, out_ids AS outIds, copy_id AS copyId
|
||||
</sql>
|
||||
|
||||
|
||||
@ -36,6 +37,7 @@
|
||||
<if test="depIds != null">dep_ids, </if>
|
||||
<if test="staffIds != null">staff_ids, </if>
|
||||
<if test="outIds != null">out_ids, </if>
|
||||
<if test="copyId != null">copy_id, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
@ -45,6 +47,7 @@
|
||||
<if test="depIds != null">#{ depIds}, </if>
|
||||
<if test="staffIds != null">#{ staffIds}, </if>
|
||||
<if test="outIds != null">#{ outIds}, </if>
|
||||
<if test="copyId != null">#{ copyId}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
@ -62,7 +65,8 @@
|
||||
<if test="managerIds != null">manager_ids = #{managerIds},</if>
|
||||
<if test="depIds != null">dep_ids = #{depIds},</if>
|
||||
<if test="staffIds != null">staff_ids = #{staffIds},</if>
|
||||
<if test="outIds != null">out_ids = #{outIds}</if>
|
||||
<if test="outIds != null">out_ids = #{outIds},</if>
|
||||
<if test="copyId != null">copy_id = #{copyId}</if>
|
||||
</trim>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -79,18 +83,19 @@
|
||||
manager_ids = #{managerIds},
|
||||
dep_ids = #{depIds},
|
||||
staff_ids = #{staffIds},
|
||||
out_ids = #{outIds}
|
||||
out_ids = #{outIds},
|
||||
copy_id = #{copyId}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="deleteEvaluationGroupById" parameterType="java.lang.Long">
|
||||
update lz_evaluation_group set is_delete = 1 where id=#{id} limit 1
|
||||
update lz_evaluation_group set is_delete = 1 where id=#{id} limit 1
|
||||
</update>
|
||||
|
||||
<select id="seleteEvaluationGroupByReq" resultType="EvaluationGroup" >
|
||||
select * from lz_evaluation_group where is_delete = 0
|
||||
select * from lz_evaluation_group where is_delete = 0 and copy_id = 0
|
||||
<if test="req.startTime != null"><![CDATA[and gmt_create > #{req.startTime}]]></if>
|
||||
<if test="req.endTime != null"><![CDATA[and gmt_create < #{req.endTime}]]></if>
|
||||
<if test="req.name != null and req.name != ''">and name like concat('%', #{req.name} '%') </if>
|
||||
@ -108,6 +113,5 @@
|
||||
select * from lz_evaluation_group where name=#{name} and is_delete = 0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -97,5 +97,9 @@
|
||||
and name LIKE CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectFlowStartByName" resultType="FlowStart" >
|
||||
select * from lz_flow_start where name=#{name} and is_delete = 0 limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -121,5 +121,7 @@
|
||||
update lz_result_model set is_delete = 1 where evaluation_group_id=#{id}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -170,5 +170,14 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectParentDepartmentByDepartmentId" resultType="com.lz.modules.app.entity.DepartmentsEntity">
|
||||
select
|
||||
*
|
||||
from lz_departments
|
||||
where department_id =
|
||||
(select department_parent_id as department_id from lz_departments where department_id = #{departmentId} and is_delete=0 limit 1)
|
||||
and is_delete=0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -103,4 +103,10 @@
|
||||
#{department_id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectLeadersByDepartmentId"
|
||||
resultType="com.lz.modules.app.entity.StaffEntity">
|
||||
select staff.* from lz_staff as staff join lz_departments_staff_relate as relate on staff.id = relate.staff_id
|
||||
where relate.is_delete=0 and relate.department_id = #{depId} and relate.is_leader = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -481,24 +481,33 @@
|
||||
</select>
|
||||
|
||||
<select id="selectAllStaffSimpleInfos" resultType="com.lz.modules.app.entity.StaffSimpleInfo">
|
||||
select staff.id as id, staff.job_number as job_number, staff.name as name, occupation.position as position
|
||||
select staff.id as id, staff.job_number as job_number, staff.name as name, staff.employee_id as employee_id, occupation.position as position
|
||||
, #{depart.departmentId} as department_id, #{depart.departmentName} as department_name
|
||||
from lz_staff staff join lz_staff_occupation occupation on staff.id=occupation.staff_id where staff.id in (
|
||||
select staff_id from lz_departments_staff_relate where department_id = #{depart.departmentId}
|
||||
) and occupation.staff_status=0
|
||||
select staff_id from lz_departments_staff_relate where department_id = #{depart.departmentId} and is_delete=0
|
||||
) and occupation.staff_status=0 and staff.is_delete=0 and occupation.is_delete=0
|
||||
</select>
|
||||
<select id="selectStaffSimpleInfos" resultType="com.lz.modules.app.entity.StaffSimpleInfo">
|
||||
select info.id as id, info.job_number as job_number, info.name as name, info.position,
|
||||
info.department_id as department_id, dep.department_name as department_name from (
|
||||
info.department_id as department_id, info.employee_id as employee_id, dep.department_name as department_name from (
|
||||
select staffinfo.id as id, staffinfo.job_number as job_number, staffinfo.name as name,
|
||||
staffinfo.position, relate.department_id as department_id from (
|
||||
select staff.id as id, staff.job_number as job_number, staff.name as name, occupation.position as position
|
||||
staffinfo.position, staffinfo.employee_id as employee_id, relate.department_id as department_id from (
|
||||
select staff.id as id, staff.job_number as job_number, staff.name as name,staff.employee_id as employee_id, occupation.position as position
|
||||
from lz_staff staff join lz_staff_occupation occupation on staff.id=occupation.staff_id where staff.id in (
|
||||
<foreach collection="sIds" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
) and occupation.staff_status=0
|
||||
) and occupation.staff_status=0 and occupation.is_delete=0 and staff.is_delete=0
|
||||
) as staffinfo left join lz_departments_staff_relate relate on staffinfo.id = relate.staff_id
|
||||
) as info left join lz_departments dep on info.department_id = dep.department_id GROUP BY info.id
|
||||
</select>
|
||||
|
||||
<select id="selectOnJobByIds" resultType="com.lz.modules.app.entity.StaffEntity">
|
||||
select staff.*
|
||||
from lz_staff staff join lz_staff_occupation occupation on staff.id=occupation.staff_id where staff.id in (
|
||||
<foreach collection="mIds" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
) and occupation.staff_status=0 and staff.is_delete=0 and occupation.is_delete=0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -96,7 +96,7 @@ public class MysqlMain {
|
||||
//list.add(new TablesBean("lz_flow_chart_detail_record"));
|
||||
//list.add(new TablesBean("lz_flow_approval_role"));
|
||||
|
||||
list.add(new TablesBean("lz_evaluation_start_staff"));
|
||||
list.add(new TablesBean("lz_evaluation_group"));
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user