fix
This commit is contained in:
commit
2f519074d3
@ -2,6 +2,7 @@ package com.lz.modules.app.controller;
|
||||
|
||||
import com.lz.common.emun.WorkMsgTypeEnum;
|
||||
import com.lz.common.utils.*;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
@ -17,6 +18,7 @@ import com.lz.modules.flow.entity.RecordAuth;
|
||||
import com.lz.modules.flow.entity.RecordFile;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.ResultRecordDto;
|
||||
import com.lz.modules.flow.req.ResultDetailReq;
|
||||
import com.lz.modules.flow.service.FlowRecordService;
|
||||
import com.lz.modules.flow.service.RecordAuthService;
|
||||
@ -645,6 +647,19 @@ public class ResultRecordController extends AbstractController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/new/approval")
|
||||
public R approval(ApprovalDto approvalDto) {
|
||||
return resultRecordService.newApproval(approvalDto);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ public class TestController {
|
||||
}
|
||||
}
|
||||
|
||||
// http://localhost:8080/lz_management/test/resultrecord?resultRecordId=157
|
||||
// http://localhost:8080/lz_management/test/resultrecord?resultRecordId=215
|
||||
@RequestMapping("/test/resultrecord")
|
||||
public void resultRecorcd(Long resultRecordId) throws Exception{
|
||||
R r = resultRecordService.initFlowRecord(resultRecordId);
|
||||
|
||||
10
src/main/java/com/lz/modules/app/dto/ApprovalDto.java
Normal file
10
src/main/java/com/lz/modules/app/dto/ApprovalDto.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.lz.modules.app.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApprovalDto {
|
||||
private Long resultRecordId;
|
||||
private Integer status; //1 提交审批,审批通过,2 撤回,3 催办,5 驳回,6 申述,7 流程终止
|
||||
private Long loginUserId;
|
||||
}
|
||||
@ -33,5 +33,5 @@ public interface FlowMapper extends BaseMapper<Flow> {
|
||||
int deleteFlowById(@Param("id")Long id);
|
||||
|
||||
|
||||
List<Flow> selectByFlowId(@Param("flowId") Long flowId);
|
||||
List<Flow> selectByFlowId(@Param("flowId") Long flowId, @Param("startId") Long startId);
|
||||
}
|
||||
@ -59,4 +59,7 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
|
||||
List<TaskListDto> selectFinishTasksByApprovalStaffId(@Param("approvalStaffId") Long approvalStaffId, @Param("page") IPage page);
|
||||
|
||||
void insertFlowRecords(@Param("flowRecords") List<FlowRecord> flowRecords);
|
||||
|
||||
|
||||
List<FlowRecord> selectFlowRecordByRecordIdStatus(@Param("resultRecordId") Long resultRecordId, @Param("status") Integer status);
|
||||
}
|
||||
@ -8,10 +8,9 @@ import lombok.Data;
|
||||
import java.util.Date;
|
||||
/**
|
||||
* <p>
|
||||
* 菜单权限表
|
||||
* </p>*流程图,lz_flow的父
|
||||
* @author quyixiao
|
||||
* @since 2020-10-14
|
||||
* @since 2020-10-26
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -39,12 +38,15 @@ public class FlowChart implements java.io.Serializable {
|
||||
//是否可允许不启用节点 0不可,1可以
|
||||
@ApiModelProperty(value = "是否可允许不启用节点 0不可,1可以", name = "status")
|
||||
private Integer status;
|
||||
//1可配置细节,0不可配置细节,一般线下操作。比如执行中
|
||||
@ApiModelProperty(value = "1可配置细节,0不可配置细节,一般线下操作。比如执行中", name = "type")
|
||||
//1可配置细节,0不可配置细节,一般线下操作。比如执行中,不可配置细节的允许自动跳过该节点。比如,还未到改节点时,人为设置该节点后面的操作,那么所有相关的都自动跳过
|
||||
@ApiModelProperty(value = "1可配置细节,0不可配置细节,一般线下操作。比如执行中,不可配置细节的允许自动跳过该节点。比如,还未到改节点时,人为设置该节点后面的操作,那么所有相关的都自动跳过", name = "type")
|
||||
private Integer type;
|
||||
//执行步骤,第几步,从0开始
|
||||
@ApiModelProperty(value = "执行步骤,第几步,从0开始", name = "stepIndex")
|
||||
private Integer stepIndex;
|
||||
//当前是目标确认还是评分,0,目标制定,1,目标确认,2执行中,3,结果值录入,4,评分,5考核结束
|
||||
@ApiModelProperty(value = "当前是目标确认还是评分,0,目标制定,1,目标确认,2执行中,3,结果值录入,4,评分,5考核结束", name = "flowProcess")
|
||||
private Integer flowProcess;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -136,14 +138,14 @@ public class FlowChart implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 0启用,1不启用
|
||||
* 是否可允许不启用节点 0不可,1可以
|
||||
* @return
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* 0启用,1不启用
|
||||
* 是否可允许不启用节点 0不可,1可以
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
@ -151,14 +153,14 @@ public class FlowChart implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 1可配置细节,0不可配置细节,一般线下操作。比如执行中
|
||||
* 1可配置细节,0不可配置细节,一般线下操作。比如执行中,不可配置细节的允许自动跳过该节点。比如,还未到改节点时,人为设置该节点后面的操作,那么所有相关的都自动跳过
|
||||
* @return
|
||||
*/
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* 1可配置细节,0不可配置细节,一般线下操作。比如执行中
|
||||
* 1可配置细节,0不可配置细节,一般线下操作。比如执行中,不可配置细节的允许自动跳过该节点。比如,还未到改节点时,人为设置该节点后面的操作,那么所有相关的都自动跳过
|
||||
* @param type
|
||||
*/
|
||||
public void setType(Integer type) {
|
||||
@ -180,6 +182,21 @@ public class FlowChart implements java.io.Serializable {
|
||||
this.stepIndex = stepIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是目标确认还是评分,0,目标制定,1,目标确认,2执行中,3,结果值录入,4,评分,5考核结束
|
||||
* @return
|
||||
*/
|
||||
public Integer getFlowProcess() {
|
||||
return flowProcess;
|
||||
}
|
||||
/**
|
||||
* 当前是目标确认还是评分,0,目标制定,1,目标确认,2执行中,3,结果值录入,4,评分,5考核结束
|
||||
* @param flowProcess
|
||||
*/
|
||||
public void setFlowProcess(Integer flowProcess) {
|
||||
this.flowProcess = flowProcess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FlowChart{" +
|
||||
@ -192,6 +209,7 @@ public class FlowChart implements java.io.Serializable {
|
||||
",status=" + status +
|
||||
",type=" + type +
|
||||
",stepIndex=" + stepIndex +
|
||||
",flowProcess=" + flowProcess +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -59,4 +59,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
|
||||
PageUtils selectTaskListByApprovalStaffId(AssessTaskReq req, Long approvalStaffId);
|
||||
|
||||
void insertFlowRecords(List<FlowRecord> flowRecords);
|
||||
|
||||
List<FlowRecord> selectFlowRecordByRecordIdStatus(Long resultRecordId,Integer status);
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.lz.modules.flow.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.flow.entity.Flow;
|
||||
import com.lz.modules.flow.entity.FlowChart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -32,5 +33,7 @@ public interface FlowService extends IService<Flow> {
|
||||
int deleteFlowById(Long id);
|
||||
|
||||
|
||||
List<Flow> selectByFlowId(Long flowId);
|
||||
List<Flow> selectByFlowId(Long flowId,Long startId);
|
||||
|
||||
FlowChart selectFlowChartByChartId(Long flowId);
|
||||
}
|
||||
@ -1,6 +1,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.FlowStart;
|
||||
|
||||
import java.util.List;
|
||||
@ -34,5 +35,5 @@ public interface FlowStartService extends IService<FlowStart> {
|
||||
|
||||
FlowStart selectFlowStartByName(String name);
|
||||
|
||||
|
||||
R saveStart(FlowStart flowStart);
|
||||
}
|
||||
@ -5,6 +5,7 @@ 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 com.lz.modules.flow.req.ResultModelDetailReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -41,4 +42,5 @@ public interface ResultModelService extends IService<ResultModel> {
|
||||
|
||||
R deleteResultModelByGroupId(Long id);
|
||||
|
||||
R saveDetail(ResultModelDetailReq resultModelDetailReq);
|
||||
}
|
||||
@ -163,4 +163,9 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
|
||||
public void insertFlowRecords(List<FlowRecord> flowRecords) {
|
||||
flowRecordMapper.insertFlowRecords(flowRecords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowRecord> selectFlowRecordByRecordIdStatus(Long resultRecordId,Integer status) {
|
||||
return flowRecordMapper.selectFlowRecordByRecordIdStatus(resultRecordId,status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package com.lz.modules.flow.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.modules.flow.dao.FlowMapper;
|
||||
import com.lz.modules.flow.entity.Flow;
|
||||
import com.lz.modules.flow.entity.FlowChart;
|
||||
import com.lz.modules.flow.service.FlowChartService;
|
||||
import com.lz.modules.flow.service.FlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -26,6 +28,9 @@ public class FlowServiceImpl extends ServiceImpl<FlowMapper, Flow> implements Fl
|
||||
private FlowMapper flowMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FlowChartService flowChartService;
|
||||
|
||||
|
||||
@Override
|
||||
public Flow selectFlowById(Long id){
|
||||
@ -61,9 +66,16 @@ public class FlowServiceImpl extends ServiceImpl<FlowMapper, Flow> implements Fl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Flow> selectByFlowId(Long flowId) {
|
||||
return flowMapper.selectByFlowId(flowId);
|
||||
public List<Flow> selectByFlowId(Long flowId,Long startId) {
|
||||
return flowMapper.selectByFlowId(flowId,startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowChart selectFlowChartByChartId(Long flowId) {
|
||||
Flow flow = flowMapper.selectFlowById(flowId);
|
||||
FlowChart flowChart = flowChartService.selectFlowChartById(flow.getChartId());
|
||||
return flowChart;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,37 @@
|
||||
package com.lz.modules.flow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.emun.ChartOptType;
|
||||
import com.lz.common.emun.CheckStaffType;
|
||||
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.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
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;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -23,6 +49,39 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
@Autowired
|
||||
private FlowStartMapper flowStartMapper;
|
||||
|
||||
@Autowired
|
||||
private EvaluationStartStaffService evaluationStartStaffService;
|
||||
|
||||
@Autowired
|
||||
private ResultModelService resultModelService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartDetailRecordService flowChartDetailRecordService;
|
||||
|
||||
@Autowired
|
||||
private FlowService flowService;
|
||||
|
||||
@Autowired
|
||||
private FlowApprovalRoleService flowApprovalRoleService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartService flowChartService;
|
||||
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
|
||||
@Autowired
|
||||
private ResultDetailService resultDetailService;
|
||||
|
||||
@Autowired
|
||||
private ResultTagetLibService resultTagetLibService;
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@ -63,5 +122,373 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
return flowStartMapper.selectFlowStartByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R saveStart(FlowStart flowStart){
|
||||
//下面生成或者合并发起绩效
|
||||
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 = selectFlowStartByName(flowStart.getName());
|
||||
if(flowStart1 == null){
|
||||
insertFlowStart(flowStart);
|
||||
}else{
|
||||
|
||||
flowStart.setId(flowStart1.getId());
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
public Long apply(String s) {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
if(staffIds.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
|
||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||
}
|
||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||
if(resultModelDtos.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
||||
}
|
||||
|
||||
|
||||
List<FlowChartDetailRecord> flowChartDetailRecords
|
||||
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupId(evaluationGroup.getId());
|
||||
if(flowChartDetailRecords.size() == 0){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
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){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
}
|
||||
|
||||
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||
evaluationGroup.setId(null);
|
||||
evaluationGroup.setGmtCreate(null);
|
||||
evaluationGroup.setGmtModified(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
|
||||
//拷贝考评组的指标信息
|
||||
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
||||
|
||||
for (ResultModelDto dto:resultModelDtos
|
||||
) {
|
||||
|
||||
|
||||
dto.setEvaluationGroupId(evaluationGroup.getId());//设置拷贝组的id
|
||||
//下面拷贝一份考评组信息的维度信息
|
||||
ResultModel resultModel = new ResultModel();
|
||||
BeanUtils.copyProperties(dto, resultModel);
|
||||
resultModel.setId(null);
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
|
||||
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
|
||||
dto.setTagetLibs(libDtos);
|
||||
for (ResultTagetLibDto libDto: libDtos
|
||||
) {
|
||||
//下面拷贝考评组里面的指标信息
|
||||
ResultTagetLib resultTagetLib = new ResultTagetLib();
|
||||
BeanUtils.copyProperties(libDto, resultTagetLib);
|
||||
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
|
||||
resultTagetLib.setId(null);
|
||||
resultTagetLibs.add(resultTagetLib);
|
||||
}
|
||||
}
|
||||
if(resultTagetLibs.size() > 0){
|
||||
//插入备份的考评组指标信息
|
||||
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
|
||||
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
|
||||
int stepIndex = 0;
|
||||
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
|
||||
) {
|
||||
Flow flow = new Flow();
|
||||
flow.setFlowId(evaluationGroup.getId());
|
||||
flow.setOpt("+");
|
||||
flow.setStartId(flowStart.getId());
|
||||
flow.setChartId(flowChartDetailRecord.getChartId());
|
||||
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();
|
||||
}
|
||||
flow.setOptDesc(optName);
|
||||
flowService.insertFlow(flow);
|
||||
|
||||
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
|
||||
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
|
||||
for (String id:optIds
|
||||
) {
|
||||
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
|
||||
for (String roleId:roleIds
|
||||
) {
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setApprovalId(Long.parseLong(id));
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(roleId);
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
}*/
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setApprovalId(Long.parseLong(id));
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
}
|
||||
stepIndex++;
|
||||
}else{
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
|
||||
for (String roleId:roleIds
|
||||
) {
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(roleId);
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
|
||||
|
||||
}*/
|
||||
stepIndex++;
|
||||
}
|
||||
|
||||
}
|
||||
//插入记录
|
||||
if(flowApprovalRoles.size() > 0){
|
||||
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
|
||||
|
||||
//初始化lz_result_details数据
|
||||
List<ResultDetail> resultDetails = 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.setStartId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
||||
evaluationStartStaff.setStaffId(staffInfo.getId());
|
||||
evaluationStartStaff.setStartId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
|
||||
//初始化lz_result_records数据
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
|
||||
resultRecord.setDepartmentName(staffInfo.getDepartmentName());
|
||||
resultRecord.setStaffId(staffInfo.getId());
|
||||
resultRecord.setStaffName(staffInfo.getName());
|
||||
resultRecord.setType(1);//设置为提交目标
|
||||
resultRecord.setStatus(0);//设置为新建
|
||||
resultRecord.setStartId(flowStart.getId());
|
||||
resultRecord.setEvaluationId(evaluationGroup.getId());
|
||||
resultRecord.setFlowProcess(0);//设置为目标制定
|
||||
|
||||
//下面初始化flow_staff_id_role字段,步骤为0的
|
||||
String roleJSON = "[";
|
||||
for (int i = 0; i < flowApprovalRoles.size() ;i++){
|
||||
FlowApprovalRole approvalRole = flowApprovalRoles.get(i);
|
||||
if(approvalRole.getStepIndex().intValue() == 0){//找到所有步骤为0的人员
|
||||
Long staffId = approvalRole.getApprovalId();//默认为指定人员。
|
||||
if(approvalRole.getType().intValue() == ChartOptType.SELF.getCode()){
|
||||
//制定人员为自己的
|
||||
staffId = staffInfo.getId();
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
|
||||
|
||||
}
|
||||
} 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的即为找不到领导
|
||||
|
||||
}
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staffManagers.get(0).getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName(staffManagers.get(0).getName());
|
||||
|
||||
}
|
||||
}else{
|
||||
for(int j = 0; j <staffLeader.size(); j++ ){
|
||||
StaffEntity staff = staffLeader.get(j);
|
||||
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + staff.getId() + "},");
|
||||
}
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staffLeader.get(0).getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName(staffLeader.get(0).getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}else{
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(approvalRole.getApprovalId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName("");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + staffId + "},");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
roleJSON += "]";
|
||||
roleJSON = roleJSON.replace(",]", "]");
|
||||
resultRecord.setFlowStaffIdRole(roleJSON);
|
||||
resultRecordService.insertResultRecord(resultRecord);
|
||||
//下面生成ResultDetail对象
|
||||
for (ResultModelDto modelDto:resultModelDtos
|
||||
) {
|
||||
|
||||
|
||||
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
|
||||
for (ResultTagetLibDto libDto:
|
||||
modelDto.getTagetLibs()) {
|
||||
|
||||
|
||||
ResultDetail resultDetail = new ResultDetail();
|
||||
resultDetail.setRecordId(resultRecord.getId());
|
||||
resultDetail.setTarget(libDto.getName());
|
||||
resultDetail.setType(modelDto.getType());
|
||||
resultDetail.setKeyResult(libDto.getKeyResult());
|
||||
resultDetail.setCheckWeight(libDto.getWeight());
|
||||
resultDetail.setStaffId(staffInfo.getId());
|
||||
resultDetail.setPriority(libDto.getOrderBy());
|
||||
resultDetails.add(resultDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果有数据插入lz_result_detail表
|
||||
if(resultDetails.size() > 0){
|
||||
//
|
||||
resultDetailService.insertResultDetails(resultDetails);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
//下面通知所有参与考核人员
|
||||
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok("发起成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,13 +6,19 @@ 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.req.ResultModelDetailReq;
|
||||
import com.lz.modules.flow.req.ResultModelItemReq;
|
||||
import com.lz.modules.flow.req.ResultTagetLibItemReq;
|
||||
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.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -35,6 +41,8 @@ public class ResultModelServiceImpl extends ServiceImpl<ResultModelMapper, Resul
|
||||
|
||||
@Autowired
|
||||
private ResultTagetLibService resultTargetLibService;
|
||||
|
||||
|
||||
private static int maxInsertSQL = 100;
|
||||
|
||||
|
||||
@ -95,6 +103,73 @@ public class ResultModelServiceImpl extends ServiceImpl<ResultModelMapper, Resul
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R saveDetail(ResultModelDetailReq resultModelDetailReq){
|
||||
BigDecimal modelWeight = BigDecimal.ZERO;
|
||||
int resultModelOrderBy = 0;
|
||||
for (ResultModelItemReq itemReq:
|
||||
resultModelDetailReq.getModelItems()) {
|
||||
modelWeight = modelWeight.add(itemReq.getWeight());
|
||||
if(modelWeight.compareTo(BigDecimal.ONE) == 1){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error("维度权重之和不能能超过100%");
|
||||
}
|
||||
ResultModel resultModel = new ResultModel();
|
||||
BeanUtils.copyProperties(itemReq, resultModel);
|
||||
resultModel.setCalculateId(resultModelDetailReq.getCalculateId());
|
||||
resultModel.setGradeGroupId(resultModelDetailReq.getGradeGroupId());
|
||||
resultModel.setGradeStatus(resultModelDetailReq.getGradeStatus());
|
||||
resultModel.setEvaluationGroupId(resultModelDetailReq.getEvaluationGroupId());
|
||||
resultModel.setOrderBy(resultModelOrderBy);
|
||||
if(resultModel.getId() == null){
|
||||
resultModelMapper.insertResultModel(resultModel);
|
||||
|
||||
}else{
|
||||
resultModelMapper.updateResultModelById(resultModel);
|
||||
}
|
||||
if(itemReq.getTagetLibItems() != null){
|
||||
int libOrderBy = 0;
|
||||
List<ResultTagetLib> inserts = new ArrayList<>();
|
||||
List<ResultTagetLib> updates = new ArrayList<>();
|
||||
BigDecimal tagLibWeight = BigDecimal.ZERO;
|
||||
for (ResultTagetLibItemReq req:itemReq.getTagetLibItems()
|
||||
) {
|
||||
ResultTagetLib resultTagetLib = new ResultTagetLib();
|
||||
BeanUtils.copyProperties(req, resultTagetLib);
|
||||
resultTagetLib.setModelId(resultModel.getId());
|
||||
resultTagetLib.setOrderBy(libOrderBy);
|
||||
tagLibWeight = tagLibWeight.add(req.getWeight());
|
||||
if(tagLibWeight.compareTo(resultModel.getWeight()) == 1){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
return R.error(resultModel.getName() +
|
||||
"维度的指标之和不能大于" + (resultModel.getWeight().multiply(BigDecimal.valueOf(100))) + "%");
|
||||
}
|
||||
if(resultTagetLib.getId() != null && resultTagetLib.getId().intValue() > 0){
|
||||
updates.add(resultTagetLib);
|
||||
}else{
|
||||
inserts.add(resultTagetLib);
|
||||
}
|
||||
if(resultTagetLib.getIsDelete() == null || resultTagetLib.getIsDelete().intValue() == 0){
|
||||
libOrderBy++;
|
||||
}
|
||||
|
||||
}
|
||||
if(inserts.size() > 0){
|
||||
resultTargetLibService.insertResultTagetLibs(inserts);
|
||||
}
|
||||
if(updates.size() > 0){
|
||||
resultTargetLibService.updateBatchById(updates);
|
||||
}
|
||||
|
||||
if(resultModel.getIsDelete() == null || resultModel.getIsDelete().intValue() == 0){
|
||||
resultModelOrderBy++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -49,35 +49,7 @@ public class FlowStartController {
|
||||
@Autowired
|
||||
private EvaluationGroupService evaluationGroupService;
|
||||
|
||||
@Autowired
|
||||
private EvaluationStartStaffService evaluationStartStaffService;
|
||||
|
||||
@Autowired
|
||||
private ResultModelService resultModelService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartDetailRecordService flowChartDetailRecordService;
|
||||
|
||||
@Autowired
|
||||
private FlowService flowService;
|
||||
|
||||
@Autowired
|
||||
private FlowApprovalRoleService flowApprovalRoleService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartService flowChartService;
|
||||
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
|
||||
@Autowired
|
||||
private ResultDetailService resultDetailService;
|
||||
|
||||
@Autowired
|
||||
private ResultTagetLibService resultTagetLibService;
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
|
||||
|
||||
@ -104,377 +76,7 @@ public class FlowStartController {
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("发起新的考核任务")
|
||||
public R save(@RequestBody @ApiParam FlowStart flowStart) {
|
||||
//下面生成或者合并发起绩效
|
||||
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.setId(flowStart1.getId());
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
public Long apply(String s) {
|
||||
return Long.parseLong(s);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
//下面初始化员工考核流程
|
||||
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
|
||||
|
||||
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);
|
||||
evaluationGroup.setGmtCreate(null);
|
||||
evaluationGroup.setGmtModified(null);
|
||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||
|
||||
//拷贝考评组的指标信息
|
||||
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
||||
|
||||
for (ResultModelDto dto:resultModelDtos
|
||||
) {
|
||||
|
||||
|
||||
dto.setEvaluationGroupId(evaluationGroup.getId());//设置拷贝组的id
|
||||
//下面拷贝一份考评组信息的维度信息
|
||||
ResultModel resultModel = new ResultModel();
|
||||
BeanUtils.copyProperties(dto, resultModel);
|
||||
resultModel.setId(null);
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
|
||||
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
|
||||
dto.setTagetLibs(libDtos);
|
||||
for (ResultTagetLibDto libDto: libDtos
|
||||
) {
|
||||
//下面拷贝考评组里面的指标信息
|
||||
ResultTagetLib resultTagetLib = new ResultTagetLib();
|
||||
BeanUtils.copyProperties(libDto, resultTagetLib);
|
||||
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
|
||||
resultTagetLib.setId(null);
|
||||
resultTagetLibs.add(resultTagetLib);
|
||||
}
|
||||
}
|
||||
if(resultTagetLibs.size() > 0){
|
||||
//插入备份的考评组指标信息
|
||||
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
|
||||
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
|
||||
int stepIndex = 0;
|
||||
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
|
||||
) {
|
||||
Flow flow = new Flow();
|
||||
flow.setFlowId(evaluationGroup.getId());
|
||||
flow.setOpt("+");
|
||||
flow.setStartId(flowStart.getId());
|
||||
flow.setChartId(flowChartDetailRecord.getChartId());
|
||||
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();
|
||||
}
|
||||
flow.setOptDesc(optName);
|
||||
flowService.insertFlow(flow);
|
||||
|
||||
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
|
||||
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
|
||||
for (String id:optIds
|
||||
) {
|
||||
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
|
||||
for (String roleId:roleIds
|
||||
) {
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setApprovalId(Long.parseLong(id));
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(roleId);
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
}*/
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setApprovalId(Long.parseLong(id));
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
}
|
||||
stepIndex++;
|
||||
}else{
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
|
||||
for (String roleId:roleIds
|
||||
) {
|
||||
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
|
||||
flowApprovalRole.setFlowId(flow.getId());
|
||||
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
|
||||
flowApprovalRole.setRoleId(roleId);
|
||||
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
|
||||
flowApprovalRoles.add(flowApprovalRole);
|
||||
flowApprovalRole.setStepIndex(stepIndex);
|
||||
|
||||
|
||||
}*/
|
||||
stepIndex++;
|
||||
}
|
||||
|
||||
}
|
||||
//插入记录
|
||||
if(flowApprovalRoles.size() > 0){
|
||||
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
|
||||
|
||||
//初始化lz_result_details数据
|
||||
List<ResultDetail> resultDetails = 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.setStartId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
||||
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
||||
evaluationStartStaff.setStaffId(staffInfo.getId());
|
||||
evaluationStartStaff.setStartId(flowStart.getId());
|
||||
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
|
||||
//初始化lz_result_records数据
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
|
||||
resultRecord.setDepartmentName(staffInfo.getDepartmentName());
|
||||
resultRecord.setStaffId(staffInfo.getId());
|
||||
resultRecord.setStaffName(staffInfo.getName());
|
||||
resultRecord.setType(1);//设置为提交目标
|
||||
resultRecord.setStatus(0);//设置为新建
|
||||
resultRecord.setStartId(flowStart.getId());
|
||||
resultRecord.setEvaluationId(evaluationGroup.getId());
|
||||
resultRecord.setFlowProcess(0);//设置为目标制定
|
||||
|
||||
//下面初始化flow_staff_id_role字段,步骤为0的
|
||||
String roleJSON = "[";
|
||||
for (int i = 0; i < flowApprovalRoles.size() ;i++){
|
||||
FlowApprovalRole approvalRole = flowApprovalRoles.get(i);
|
||||
if(approvalRole.getStepIndex().intValue() == 0){//找到所有步骤为0的人员
|
||||
Long staffId = approvalRole.getApprovalId();//默认为指定人员。
|
||||
if(approvalRole.getType().intValue() == ChartOptType.SELF.getCode()){
|
||||
//制定人员为自己的
|
||||
staffId = staffInfo.getId();
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
|
||||
|
||||
}
|
||||
} 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的即为找不到领导
|
||||
|
||||
}
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staffManagers.get(0).getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName(staffManagers.get(0).getName());
|
||||
|
||||
}
|
||||
}else{
|
||||
for(int j = 0; j <staffLeader.size(); j++ ){
|
||||
StaffEntity staff = staffLeader.get(j);
|
||||
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + staff.getId() + "},");
|
||||
}
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(staffLeader.get(0).getId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName(staffLeader.get(0).getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}else{
|
||||
if(i == 0){//目前只设置一个,多个不明确是否支持,roleJSON是支持多个的
|
||||
//设置当前审批员工id current_approval_staff_id
|
||||
resultRecord.setCurrentApprovalStaffId(approvalRole.getApprovalId());
|
||||
//设置当前审批员工姓名 current_approval_staff_name
|
||||
resultRecord.setCurrentApprovalStaffName("");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
|
||||
",\"staffId\":" + staffId + "},");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
roleJSON += "]";
|
||||
roleJSON = roleJSON.replace(",]", "]");
|
||||
resultRecord.setFlowStaffIdRole(roleJSON);
|
||||
resultRecordService.insertResultRecord(resultRecord);
|
||||
//下面生成ResultDetail对象
|
||||
for (ResultModelDto modelDto:resultModelDtos
|
||||
) {
|
||||
|
||||
|
||||
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
|
||||
for (ResultTagetLibDto libDto:
|
||||
modelDto.getTagetLibs()) {
|
||||
|
||||
|
||||
ResultDetail resultDetail = new ResultDetail();
|
||||
resultDetail.setRecordId(resultRecord.getId());
|
||||
resultDetail.setTarget(libDto.getName());
|
||||
resultDetail.setType(modelDto.getType());
|
||||
resultDetail.setKeyResult(libDto.getKeyResult());
|
||||
resultDetail.setCheckWeight(libDto.getWeight());
|
||||
resultDetail.setStaffId(staffInfo.getId());
|
||||
resultDetail.setPriority(libDto.getOrderBy());
|
||||
resultDetails.add(resultDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//如果有数据插入lz_result_detail表
|
||||
if(resultDetails.size() > 0){
|
||||
//
|
||||
resultDetailService.insertResultDetails(resultDetails);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
//下面通知所有参与考核人员
|
||||
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
return flowStartService.saveStart(flowStart);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,8 +14,10 @@ import com.lz.modules.performance.service.ResultTagetLibService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -88,56 +90,8 @@ public class ResultModelController {
|
||||
@PostMapping("/saveDetail")
|
||||
@ApiOperation("保存模板中的考核维度及指标")
|
||||
public R saveDetail(@RequestBody @ApiParam ResultModelDetailReq resultModelDetailReq) {
|
||||
int resultModelOrderBy = 0;
|
||||
for (ResultModelItemReq itemReq:
|
||||
resultModelDetailReq.getModelItems()) {
|
||||
ResultModel resultModel = new ResultModel();
|
||||
BeanUtils.copyProperties(itemReq, resultModel);
|
||||
resultModel.setCalculateId(resultModelDetailReq.getCalculateId());
|
||||
resultModel.setGradeGroupId(resultModelDetailReq.getGradeGroupId());
|
||||
resultModel.setGradeStatus(resultModelDetailReq.getGradeStatus());
|
||||
resultModel.setEvaluationGroupId(resultModelDetailReq.getEvaluationGroupId());
|
||||
resultModel.setOrderBy(resultModelOrderBy);
|
||||
if(resultModel.getId() != null && resultModel.getId().intValue() > 0){
|
||||
resultModelService.updateResultModelById(resultModel);
|
||||
}else{
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
}
|
||||
if(itemReq.getTagetLibItems() != null){
|
||||
int libOrderBy = 0;
|
||||
List<ResultTagetLib> inserts = new ArrayList<>();
|
||||
List<ResultTagetLib> updates = new ArrayList<>();
|
||||
for (ResultTagetLibItemReq req:itemReq.getTagetLibItems()
|
||||
) {
|
||||
ResultTagetLib resultTagetLib = new ResultTagetLib();
|
||||
BeanUtils.copyProperties(req, resultTagetLib);
|
||||
resultTagetLib.setModelId(resultModel.getId());
|
||||
resultTagetLib.setOrderBy(libOrderBy);
|
||||
if(resultTagetLib.getId() != null && resultTagetLib.getId().intValue() > 0){
|
||||
updates.add(resultTagetLib);
|
||||
}else{
|
||||
inserts.add(resultTagetLib);
|
||||
}
|
||||
if(resultTagetLib.getIsDelete() == null || resultTagetLib.getIsDelete().intValue() == 0){
|
||||
libOrderBy++;
|
||||
}
|
||||
return resultModelService.saveDetail(resultModelDetailReq);
|
||||
|
||||
}
|
||||
if(inserts.size() > 0){
|
||||
resultTagetLibService.insertResultTagetLibs(inserts);
|
||||
}
|
||||
if(updates.size() > 0){
|
||||
resultTagetLibService.updateBatchById(updates);
|
||||
}
|
||||
|
||||
if(resultModel.getIsDelete() == null || resultModel.getIsDelete().intValue() == 0){
|
||||
resultModelOrderBy++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.lz.modules.sys.service.app;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.emun.WorkMsgTypeEnum;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.GraphicsStatisticalDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
@ -108,4 +109,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
void batchDeleteByStaffIds(List<String> staffIds);
|
||||
|
||||
R initFlowRecord(Long resultRecordId);
|
||||
|
||||
R newApproval(ApprovalDto approvalDto);
|
||||
}
|
||||
@ -245,7 +245,7 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
|
||||
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
|
||||
|
||||
Long flowId = flowInfo.getFirst();
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId);
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId,0l);
|
||||
|
||||
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
|
||||
log.info("flowIndex = " + flowIndex);
|
||||
|
||||
@ -7,6 +7,7 @@ import com.lz.common.emun.WorkMsgTypeEnum;
|
||||
import com.lz.common.utils.*;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.EmployeesDto;
|
||||
import com.lz.modules.app.dto.GraphicsStatisticalDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
@ -120,6 +121,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
@Autowired
|
||||
private FlowApprovalRoleService flowApprovalRoleService;
|
||||
|
||||
@Autowired
|
||||
private FlowChartService flowChartService;
|
||||
|
||||
@Value("${dingtalk.appid}")
|
||||
private String appid;
|
||||
|
||||
@ -461,7 +465,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
}
|
||||
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) );
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId);
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId,0l);
|
||||
FlowRecord lastFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(resultRecordId);
|
||||
FlowRecord notFlowRecord = flowRecordService.selectNotApprovalStaffIdFlowRecords(resultRecord.getId());
|
||||
if (notFlowRecord != null) {
|
||||
@ -753,7 +757,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
@Override
|
||||
public R initFlowRecord(Long resultRecordId) {
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(resultRecordId);
|
||||
List<Flow> flows = flowService.selectByFlowId(resultRecord.getEvaluationId());
|
||||
List<Flow> flows = flowService.selectByFlowId(resultRecord.getEvaluationId(),resultRecord.getStartId());
|
||||
List<Long> flowIds = new ArrayList<>();
|
||||
for(Flow flow:flows){
|
||||
flowIds.add(flow.getId());
|
||||
@ -791,6 +795,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
if(i == 0 ){
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus());
|
||||
resultRecord.setFlowStaffIdRole(staffRole);
|
||||
FlowChart flowChart = flowService.selectFlowChartByChartId(flowRecord.getFlowId());
|
||||
resultRecord.setFlowProcess(flowChart.getFlowProcess());
|
||||
}else{
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.UN_TO_STATUS.getStatus());
|
||||
}
|
||||
@ -805,6 +811,100 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
//1 提交审批,审批通过,2 撤回,3 催办,5 驳回,6 申述,7 流程终止
|
||||
public R newApproval(ApprovalDto approvalDto) {
|
||||
switch (approvalDto.getStatus()) {
|
||||
case 1: //1 提交审批,审批通过
|
||||
return newSubmit(approvalDto);
|
||||
case 2: //2 撤回
|
||||
return newReject(approvalDto);
|
||||
case 3: //3 催办
|
||||
return urge(approvalDto);
|
||||
case 5: //4 驳回
|
||||
return newReject(approvalDto);
|
||||
case 6: //6 申述
|
||||
return explain(approvalDto);
|
||||
case 7: //7 终止流程
|
||||
return stop(approvalDto);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private R newSubmit(ApprovalDto approvalDto) {
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(approvalDto.getResultRecordId());
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(approvalDto.getResultRecordId());
|
||||
FlowRecord currentFlowRecord = null;
|
||||
for(FlowRecord flowRecord: flowRecords){
|
||||
if(flowRecord.getStatus().equals(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus())){
|
||||
log.info("flowRecordId:" + flowRecord.getId() + "更新为流程己走");
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.FINISHED_STATUS.getStatus());
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
} else if (flowRecord.getStatus().equals(FlowRecordStatusEnums.SKIP_STATUS.getStatus())){
|
||||
continue;
|
||||
} else if (flowRecord.getStatus().equals(FlowRecordStatusEnums.UN_TO_STATUS.getStatus())){
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus());
|
||||
log.info("flowRecordId:" + flowRecord.getId() + "更新为正在执行");
|
||||
currentFlowRecord = flowRecord;
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
FlowChart flowChart = flowService.selectFlowChartByChartId(currentFlowRecord.getFlowId());
|
||||
resultRecord.setFlowProcess(flowChart.getFlowProcess());
|
||||
resultRecord.setFlowStaffIdRole(currentFlowRecord.getFlowStaffIdRole());
|
||||
resultRecord.setCurrentApprovalStaffId(currentFlowRecord.getApprovalStaffId());
|
||||
resultRecord.setCurrentApprovalStaffName(currentFlowRecord.getApprovalStaffName());
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private R newReject(ApprovalDto approvalDto) {
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(),2);
|
||||
if(flowRecords !=null && flowRecords.size() > 0 ){
|
||||
FlowRecord currentFlowRecord = flowRecords.get(0);
|
||||
for(FlowRecord flowRecord : flowRecords){
|
||||
flowRecord.setStatus(0);
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
}
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(approvalDto.getResultRecordId());
|
||||
resultRecord.setCurrentApprovalStaffId(currentFlowRecord.getApprovalStaffId());
|
||||
resultRecord.setCurrentApprovalStaffName(currentFlowRecord.getApprovalStaffName());
|
||||
resultRecord.setFlowStaffIdRole(currentFlowRecord.getFlowStaffIdRole());
|
||||
|
||||
FlowChart flowChart = flowService.selectFlowChartByChartId(currentFlowRecord.getFlowId());
|
||||
resultRecord.setFlowProcess(flowChart.getFlowProcess());
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private R urge(ApprovalDto approvalDto) {
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(approvalDto.getResultRecordId());
|
||||
if(!resultRecord.getCurrentApprovalStaffId().equals(approvalDto.getLoginUserId())){
|
||||
log.info("催办" + resultRecord.getCurrentApprovalStaffId());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
private R stop(ApprovalDto approvalDto) {
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private R explain(ApprovalDto approvalDto) {
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public StaffEntity getDepartmentStaff(Map<String, String> map, int level) {
|
||||
for (int i = 1; i < 6; i++) {
|
||||
String deparment = map.get("dd" + i );
|
||||
|
||||
@ -13,12 +13,13 @@
|
||||
<result column="status" property="status"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="step_index" property="stepIndex"/>
|
||||
<result column="flow_process" property="flowProcess"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, process_id AS processId, status AS status, type AS type, step_index AS stepIndex
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, process_id AS processId, status AS status, type AS type, step_index AS stepIndex, flow_process AS flowProcess
|
||||
</sql>
|
||||
|
||||
|
||||
@ -31,30 +32,32 @@
|
||||
|
||||
<insert id="insertFlowChart" parameterType="FlowChart" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_flow_chart(
|
||||
<if test="name != null">name, </if>
|
||||
<if test="processId != null">process_id, </if>
|
||||
<if test="status != null">status, </if>
|
||||
<if test="type != null">type, </if>
|
||||
<if test="stepIndex != null">step_index, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
<if test="name != null">name, </if>
|
||||
<if test="processId != null">process_id, </if>
|
||||
<if test="status != null">status, </if>
|
||||
<if test="type != null">type, </if>
|
||||
<if test="stepIndex != null">step_index, </if>
|
||||
<if test="flowProcess != null">flow_process, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
)values(
|
||||
<if test="name != null">#{ name}, </if>
|
||||
<if test="processId != null">#{ processId}, </if>
|
||||
<if test="status != null">#{ status}, </if>
|
||||
<if test="type != null">#{ type}, </if>
|
||||
<if test="stepIndex != null">#{ stepIndex}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
<if test="name != null">#{ name}, </if>
|
||||
<if test="processId != null">#{ processId}, </if>
|
||||
<if test="status != null">#{ status}, </if>
|
||||
<if test="type != null">#{ type}, </if>
|
||||
<if test="stepIndex != null">#{ stepIndex}, </if>
|
||||
<if test="flowProcess != null">#{ flowProcess}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateFlowChartById" parameterType="FlowChart" >
|
||||
update
|
||||
lz_flow_chart
|
||||
lz_flow_chart
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
@ -62,7 +65,8 @@
|
||||
<if test="processId != null">process_id = #{processId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="stepIndex != null">step_index = #{stepIndex}</if>
|
||||
<if test="stepIndex != null">step_index = #{stepIndex},</if>
|
||||
<if test="flowProcess != null">flow_process = #{flowProcess}</if>
|
||||
</trim>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -71,15 +75,16 @@
|
||||
|
||||
<update id="updateCoverFlowChartById" parameterType="FlowChart" >
|
||||
update
|
||||
lz_flow_chart
|
||||
set
|
||||
lz_flow_chart
|
||||
set
|
||||
is_delete = #{isDelete},
|
||||
gmt_create = #{gmtCreate},
|
||||
name = #{name},
|
||||
process_id = #{processId},
|
||||
status = #{status},
|
||||
type = #{type},
|
||||
step_index = #{stepIndex}
|
||||
step_index = #{stepIndex},
|
||||
flow_process = #{flowProcess}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
</update>
|
||||
|
||||
<select id="selectByFlowId" resultType="com.lz.modules.flow.entity.Flow">
|
||||
select * from lz_flow where flow_id = #{flowId} and is_delete = 0
|
||||
select * from lz_flow where flow_id = #{flowId} and is_delete = 0 and start_id = #{startId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -222,7 +222,6 @@
|
||||
order by r.gmt_modified desc
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertFlowRecords">
|
||||
insert into lz_flow_record(
|
||||
department_level,
|
||||
@ -261,5 +260,14 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectFlowRecordByRecordIdStatus" resultType="com.lz.modules.flow.entity.FlowRecord">
|
||||
select * from lz_flow_record where is_delete = 0 and record_id = #{resultRecordId} and status = #{status}
|
||||
</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_flow_record"));
|
||||
list.add(new TablesBean("lz_flow_chart"));
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user