Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
abd2eaa80c
@ -968,7 +968,7 @@ public class ResultRecordController extends AbstractController {
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
// 审批:http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=215&status=1&loginUserId=825&comment=xxx&menuName=bbb
|
||||
// 审批:http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=267&status=1&comment=xxx&menuName=bbb
|
||||
// 跳过:http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=215&status=4&menuName=bbb&flowRecordId=360
|
||||
// 转交:http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=215&status=8&menuName=bbb&flowRecordId=360&transferStaffId=294
|
||||
@RequestMapping("/new/approval")
|
||||
|
||||
@ -96,4 +96,6 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
||||
StaffSimpleInfo selectStaffSimpleInfo(@Param("staffId") Long staffId);
|
||||
|
||||
List<StaffEntity> selectNamesByIds(@Param("list") List<Long> sIds);
|
||||
|
||||
List<StaffEntity> selectStaffsByGroupId(@Param("copyId") Long copyId);
|
||||
}
|
||||
|
||||
@ -101,5 +101,7 @@ public interface StaffService extends IService<StaffEntity> {
|
||||
StaffSimpleInfo selectStaffSimpleInfo(Long staffId);
|
||||
|
||||
List<StaffEntity> selectNamesByIds(List<Long> sIds);
|
||||
//获取绩效考核管理员
|
||||
List<StaffEntity> selectStaffsByGroupId(Long copyId);
|
||||
}
|
||||
|
||||
|
||||
@ -524,5 +524,10 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
return staffDao.selectNamesByIds(sIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffEntity> selectStaffsByGroupId(Long copyId){
|
||||
return staffDao.selectStaffsByGroupId(copyId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.lz.modules.flow.model;
|
||||
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
//组,人员ids
|
||||
@Data
|
||||
public class GroupStaffs {
|
||||
private Long groupId;
|
||||
private EvaluationGroup evaluationGroup;
|
||||
private List<Long> staffIds;
|
||||
}
|
||||
|
||||
@ -7,5 +7,5 @@ import java.util.List;
|
||||
@Data
|
||||
public class StartGroups {
|
||||
private Long startId;
|
||||
private List<GroupStaffs> staffIds;
|
||||
private List<GroupStaffs> groups;
|
||||
}
|
||||
|
||||
@ -10,10 +10,7 @@ import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
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.model.StartGroups;
|
||||
import com.lz.modules.flow.model.*;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.performance.service.ResultTagetLibService;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
@ -131,11 +128,29 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
return R.error("发起任务不存在");
|
||||
}
|
||||
|
||||
/*List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(staffIds);
|
||||
if(staffSimpleInfos.size() == 0){
|
||||
return R.error("无有效考核人员,考核人员已离职");
|
||||
}*/
|
||||
return R.ok();
|
||||
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
||||
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
|
||||
) {
|
||||
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
|
||||
if(staffSimpleInfos.size() == 0){
|
||||
R.error(groupStaffs.getEvaluationGroup().getName() + "——无有效考核人员");
|
||||
}
|
||||
switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos)){
|
||||
|
||||
case 1:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核模板");
|
||||
case 2:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有绩效流程节点");
|
||||
case 3:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核流程");
|
||||
case 4:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置绩效管理人员");
|
||||
case 5:
|
||||
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok("发起成功").put("data", flowStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -166,7 +181,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
|
||||
|
||||
|
||||
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
||||
//下面开始初始化流程
|
||||
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
|
||||
@ -180,44 +194,45 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
switch (start(evaluationGroup, flowStart, staffManages)){
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
}
|
||||
switch (start(evaluationGroup, flowStart, staffManages, staffIds)){
|
||||
|
||||
case 1:
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
case 2:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
case 3:
|
||||
case 2:
|
||||
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
|
||||
case 4:
|
||||
case 3:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
||||
case 5:
|
||||
case 4:
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
case 6:
|
||||
case 5:
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
}
|
||||
}
|
||||
return R.ok("发起成功").put("data", flowStart);
|
||||
}
|
||||
|
||||
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart, Map<String, List<StaffEntity>> staffManages){
|
||||
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart,
|
||||
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds){
|
||||
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
|
||||
return 1;
|
||||
}
|
||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||
if(resultModelDtos.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
|
||||
if(flowCharts.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
|
||||
for (FlowChart chart:flowCharts
|
||||
@ -229,35 +244,28 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
if(flowChartDetailRecords.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 4;
|
||||
return 3;
|
||||
}
|
||||
Map<Long, String> chartNameMaps =
|
||||
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map,下面多次循环,减少数据库查找
|
||||
|
||||
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);
|
||||
//获取绩效考核管理员
|
||||
List<StaffEntity> staffManagers = staffService.selectStaffsByGroupId(evaluationGroup.getCopyId());
|
||||
|
||||
}
|
||||
if(staffManagers == null || staffManagers.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 5;
|
||||
return 4;
|
||||
}
|
||||
|
||||
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||
evaluationGroup.setId(null);
|
||||
evaluationGroup.setGmtCreate(null);
|
||||
evaluationGroup.setGmtModified(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
if(evaluationGroup.getCopyId() == null){
|
||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||
evaluationGroup.setId(null);
|
||||
evaluationGroup.setGmtCreate(null);
|
||||
evaluationGroup.setGmtModified(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
}
|
||||
|
||||
|
||||
//拷贝考评组的指标信息
|
||||
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
||||
@ -353,18 +361,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
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.setStartId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
//下面初始化参与人员
|
||||
@ -512,7 +509,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return 6;
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -861,7 +861,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
throw new RRException("transferStaffId 不能为空");
|
||||
}
|
||||
if(approvalDto.getFlowRecordId() == null){
|
||||
throw new RRException("currentStaffId 不能为空");
|
||||
throw new RRException("flowRecordId 不能为空");
|
||||
}
|
||||
return transfer(approvalDto);
|
||||
default:
|
||||
|
||||
@ -110,6 +110,9 @@
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectFlowChartDetailRecordByGroupIdAndChartId" resultType="FlowChartDetailRecord" >
|
||||
select * from lz_flow_chart_detail_record where evaluation_group_id=#{groupId} and chart_id = #{chartId} and is_delete = 0 order by step_index asc
|
||||
</select>
|
||||
|
||||
<select id="selectFlowChartDetailRecordByGroupId" resultType="FlowChartDetailRecord" >
|
||||
select * from lz_flow_chart_detail_record where evaluation_group_id=#{groupId} and is_delete = 0 order by step_index asc
|
||||
|
||||
@ -538,4 +538,11 @@
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectStaffsByGroupId" resultType="com.lz.modules.app.entity.StaffEntity">
|
||||
select staff.* from (select * from lz_staff where id in (
|
||||
select staff_id from lz_staff_role where is_delete = 0 and (evaluation_group_id = #{copyId} or evaluation_group_id = 0)
|
||||
) and is_delete=0) as staff join lz_staff_occupation as occupation on staff.id = occupation.staff_id where occupation.staff_status=0
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user