From 329e03ed69e419f7b598af77cc6c1b8aeb81f620 Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 17 Nov 2020 10:21:22 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lz/modules/app/controller/ResultRecordController.java | 1 + .../com/lz/modules/flow/service/impl/FlowStartServiceImpl.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 0b23aaa7..5a2e87c6 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -712,6 +712,7 @@ public class ResultRecordController extends AbstractController { resultDetail.setStaffId(resultRecord.getStaffId()); resultDetail.setRecordId(resultRecord.getId()); resultDetail.setType(model.getType()); + resultDetail.setModelId(model.getId()); inserts.add(resultDetail); } if(resultDetail.getIsDelete() == null || resultDetail.getIsDelete().intValue() == 0){ diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index 70a38a8c..7dc9aa82 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -362,7 +362,7 @@ public class FlowStartServiceImpl extends ServiceImpl libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId()); dto.setTagetLibs(libDtos); for (ResultTagetLibDto libDto: libDtos @@ -374,6 +374,7 @@ public class FlowStartServiceImpl extends ServiceImpl 0){ //插入备份的考评组指标信息 From e3de3fa4cd0e83ad5b96098fb1a5e83890849b67 Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 17 Nov 2020 11:29:37 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EvaluationGroupServiceImpl.java | 23 +++++----- .../service/impl/FlowStartServiceImpl.java | 20 +++------ .../job/business/DingtalkBusiness.java | 42 ++++++++++--------- 3 files changed, 40 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java index d8966a2f..3aa63b51 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java @@ -138,7 +138,7 @@ public class EvaluationGroupServiceImpl extends ServiceImpl staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId()); + List staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());//一个人只会有一个 if(staffRoles.size() == 0){ log.info("非绩效管理员登录查询"); return null; @@ -149,17 +149,20 @@ public class EvaluationGroupServiceImpl extends ServiceImpl(); - for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups - ) { - if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组 - gIds = null; - log.info("管理所有组"); - break; - } - gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组 + if(staffRoleEvaluationGroups.get(0).getEvaluationGroupId().longValue() != 0L){//管理指定考评组的 + gIds = new ArrayList<>(); + for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups + ) { + if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组 + gIds = null; + log.info("管理所有组"); + break; + } + gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组 + } } + } List finalGIds = gIds; PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index 7dc9aa82..de58bfbc 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -248,7 +248,7 @@ public class FlowStartServiceImpl extends ServiceImpl> mustRole = new HashMap<>(); Map> selfMustRole = new HashMap<>(); - + List noticeStaff = new ArrayList<>(); for (int n = 0; n < evaluationGroups.size(); n++ ) { EvaluationGroup evaluationGroup = evaluationGroups.get(n); @@ -293,9 +293,12 @@ public class FlowStartServiceImpl extends ServiceImpl 0){ // resultDetailService.insertResultDetails(resultDetails); - } - - } evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs); return 0; @@ -507,7 +507,6 @@ public class FlowStartServiceImpl extends ServiceImpl 0){//模板里面有添加指标 for (ResultTagetLibDto libDto: modelDto.getTagetLibs()) { - - ResultDetail resultDetail = new ResultDetail(); resultDetail.setRecordId(resultRecord.getId()); resultDetail.setTarget(libDto.getName()); @@ -735,12 +729,8 @@ public class FlowStartServiceImpl extends ServiceImpl 0){ // resultDetailService.insertResultDetails(resultDetails); - } evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs); - //下面通知所有参与考核人员 - - //如果有下面通知所有管理人员 }else{ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚 log.info("初始化考核流程失败"); diff --git a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java index 593d8ae1..01b724e6 100644 --- a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java +++ b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java @@ -237,29 +237,31 @@ public class DingtalkBusiness { public String sendWorkMSGWithAsyn(StaffSimpleInfo fromStaff, List toStaffids, int type) { - - if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) { - //查询第三方id - List ids = toStaffids.stream().map(new Function() { - @Override - public Long apply(StaffSimpleInfo staffSimpleInfo) { - return staffSimpleInfo.getId(); + if(toStaffids.size() > 0){ + if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) { + //查询第三方id + List ids = toStaffids.stream().map(new Function() { + @Override + public Long apply(StaffSimpleInfo staffSimpleInfo) { + return staffSimpleInfo.getId(); + } + }).collect(Collectors.toList()); + List staffSimpleInfos = staffService.selectStaffSimpleInfos(ids); + Map map = toStaffids.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, e -> e)); + for (StaffSimpleInfo staff : staffSimpleInfos + ) { + StaffSimpleInfo staff1 = map.get(staff.getId()); + staff1.setEmployeeId(staff1.getEmployeeId()); } - }).collect(Collectors.toList()); - List staffSimpleInfos = staffService.selectStaffSimpleInfos(ids); - Map map = toStaffids.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, e -> e)); - for (StaffSimpleInfo staff : staffSimpleInfos - ) { - StaffSimpleInfo staff1 = map.get(staff.getId()); - staff1.setEmployeeId(staff1.getEmployeeId()); } - } - WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type); + WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type); - ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid); - Thread thread = new Thread(threadSendMessage); - thread.start(); - return "OK"; + ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid); + Thread thread = new Thread(threadSendMessage); + thread.start(); + return "OK"; + } + return "error"; } From 1d07f2098f90e534a9442eb23383a9a515733ed9 Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 17 Nov 2020 11:36:09 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EvaluationGroupServiceImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java index 3aa63b51..941867bb 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java @@ -143,13 +143,14 @@ public class EvaluationGroupServiceImpl extends ServiceImpl staffRoleEvaluationGroups = - staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles); - if(staffRoleEvaluationGroups.size() == 0){ - log.info("查询的管理组为空"); - return null; - } - if(staffRoleEvaluationGroups.get(0).getEvaluationGroupId().longValue() != 0L){//管理指定考评组的 + if(staffRoles.get(0).getEvaluationGroupId().longValue() != 0L){//管理指定考评组的 + List staffRoleEvaluationGroups = + staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles); + if(staffRoleEvaluationGroups.size() == 0){ + log.info("查询的管理组为空"); + return null; + } + gIds = new ArrayList<>(); for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups ) { From 4fa8416e78e53004b26a286567b46fc27539ac6c Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 17 Nov 2020 14:17:44 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lz/modules/flow/service/impl/FlowStartServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index de58bfbc..bd08647b 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -414,6 +414,7 @@ public class FlowStartServiceImpl extends ServiceImpl evaluationStartStaffs = new ArrayList<>(); List resultDetails = new ArrayList(); + List resultRecords = new ArrayList<>(); //下面初始化参与人员 for (StaffSimpleInfo staffInfo:staffIds ) { @@ -445,10 +446,10 @@ public class FlowStartServiceImpl extends ServiceImpl Date: Tue, 17 Nov 2020 14:25:16 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flow/service/impl/FlowStartServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index bd08647b..27ed584f 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -447,10 +447,15 @@ public class FlowStartServiceImpl extends ServiceImpl Date: Tue, 17 Nov 2020 14:40:53 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FlowStartServiceImpl.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index 27ed584f..97010a8e 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -414,7 +414,7 @@ public class FlowStartServiceImpl extends ServiceImpl evaluationStartStaffs = new ArrayList<>(); List resultDetails = new ArrayList(); - List resultRecords = new ArrayList<>(); + //下面初始化参与人员 for (StaffSimpleInfo staffInfo:staffIds ) { @@ -446,16 +446,14 @@ public class FlowStartServiceImpl extends ServiceImpl resultDetails = new ArrayList<>(); List evaluationStartStaffs = new ArrayList<>(); - + List resultRecords = new ArrayList<>(); //下面初始化参与人员 for (StaffSimpleInfo staffInfo:staffIds ) { @@ -628,6 +626,9 @@ public class FlowStartServiceImpl extends ServiceImpl Date: Tue, 17 Nov 2020 14:45:49 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lz/modules/flow/service/impl/FlowStartServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index 97010a8e..fd5b5a91 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -716,7 +716,7 @@ public class FlowStartServiceImpl extends ServiceImpl Date: Tue, 17 Nov 2020 14:50:30 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/flow/service/impl/FlowStartServiceImpl.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index fd5b5a91..1c932b8e 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -708,12 +708,8 @@ public class FlowStartServiceImpl extends ServiceImpl Date: Tue, 17 Nov 2020 15:08:24 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FlowStartServiceImpl.java | 143 +++++++++++++++++- 1 file changed, 142 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index 1c932b8e..0a2bc155 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -1,13 +1,20 @@ package com.lz.modules.flow.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; import com.lz.common.emun.ChartOptType; import com.lz.common.emun.CheckStaffType; import com.lz.common.emun.WorkMsgTypeEnum; import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; +import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.entity.StaffSimpleInfo; +import com.lz.modules.app.enums.FlowApprovalRoleTypeEnums; +import com.lz.modules.app.enums.FlowRecordStatusEnums; +import com.lz.modules.app.enums.RoleEnums; +import com.lz.modules.app.service.DepartmentsService; +import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.dao.EvaluationStartStaffMapper; import com.lz.modules.flow.dao.FlowStartMapper; @@ -21,6 +28,7 @@ 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 lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.map.HashedMap; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -29,6 +37,9 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.function.Function; import java.util.stream.Collectors; @@ -88,6 +99,20 @@ public class FlowStartServiceImpl extends ServiceImpl flows = flowService.selectByFlowId(resultRecord.getEvaluationId(),resultRecord.getStartId()); + List flowIds = new ArrayList<>(); + for(Flow flow:flows){ + flowIds.add(flow.getId()); + } + + int i = 0; + for (FlowApprovalRole flowApprovalRole : flowApprovalRoles) { + FlowRecord flowRecord = new FlowRecord(); + flowRecord.setRecordId(resultRecord.getId()); + StaffEntity approvalStaff = new StaffEntity(); + if (FlowApprovalRoleTypeEnums.ME.getType().equals(flowApprovalRole.getType())) { + approvalStaff = staffService.selectStaffById(resultRecord.getStaffId()); + } else if (FlowApprovalRoleTypeEnums.STAFF.getType().equals(flowApprovalRole.getType())) { + approvalStaff = staffService.selectStaffById(flowApprovalRole.getApprovalId()); + } else if (FlowApprovalRoleTypeEnums.ONE_SUPPER.getType().equals(flowApprovalRole.getType())) { + approvalStaff = getDepartmentStaff(resultRecord.getStaffId(), 1); + } else if (FlowApprovalRoleTypeEnums.TWO_SUPPER.getType().equals(flowApprovalRole.getType())) { + approvalStaff = getDepartmentStaff(resultRecord.getStaffId(), 2); + } else if (FlowApprovalRoleTypeEnums.THREE_SUPPER.getType().equals(flowApprovalRole.getType())) { + approvalStaff = getDepartmentStaff(resultRecord.getStaffId(), 3); + } else if (FlowApprovalRoleTypeEnums.FOUR_SUPPER.getType().equals(flowApprovalRole.getType())) { + approvalStaff = getDepartmentStaff(resultRecord.getStaffId(), 4); + } else if (FlowApprovalRoleTypeEnums.FOUR_SUPPER.getType().equals(flowApprovalRole.getType())) { + approvalStaff = getDepartmentStaff(resultRecord.getStaffId(), 5); + } + if(approvalStaff !=null && StringUtil.isNotBlank(approvalStaff.getName())){ + insertFlowRecord(flowRecord,approvalStaff,flows,flowApprovalRole,resultRecord,i,null); + }else{ + List staffRoles= staffRoleService.selectAllStaffRoleByDepartmentLevel(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName(),RoleEnums.CHILD_PM.getName()})); + for(StaffRole staffRole:staffRoles){ + approvalStaff = staffService.selectStaffById(staffRole.getStaffId()); + if(staffRole.getDepartmentId() ==0){ //如果是管理所有部门 + insertFlowRecord(flowRecord,approvalStaff,flows,flowApprovalRole,resultRecord,i,1); + }else{ + DepartmentsStaffRelateEntity relateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(resultRecord.getStaffId()); + Map map = departmentsService.selectUserAllDepartmentIds(relateEntity.getDepartmentId()); + List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); + boolean flag = false; + for(StaffRoleDepartment staffRoleDepartment: staffRoleDepartments){ + String departmentName = map.get(staffRoleDepartment.getDepartmentId()); + if(StringUtil.isNotBlank(departmentName)){ + flag = true; + break; + } + } + if(flag){ //如果管理员是管理特定部门 + insertFlowRecord(flowRecord,approvalStaff,flows,flowApprovalRole,resultRecord,i,1); + } + } + } + } + i++; + } + resultRecordService.updateResultRecordById(resultRecord); + + /*ExecutorService executor = Executors.newFixedThreadPool(10); + List resultRecords = Lists.newArrayList(); + CompletableFuture> listCompletableFuture = CompletableFuture.supplyAsync(() -> resultRecordService.list(), executor); + try { + resultRecords = listCompletableFuture.get(); + } catch (Exception e) { + e.printStackTrace(); + }*/ + //resultRecordService.initFlowRecord(resultRecord.getId()); //下面生成ResultDetail对象 for (ResultModelDto modelDto:resultModelDtos @@ -747,6 +837,57 @@ public class FlowStartServiceImpl extends ServiceImpl flows,FlowApprovalRole flowApprovalRole ,ResultRecord resultRecord,int i,Integer stepType ){ + flowRecord.setApprovalStaffName(approvalStaff.getName()); + flowRecord.setApprovalStaffId(approvalStaff.getId()); + flowRecord.setFlowName(getFlow(flows, flowApprovalRole.getFlowId()).getOptDesc()); + flowRecord.setRecordStaffId(resultRecord.getStaffId()); + flowRecord.setFlowId(flowApprovalRole.getFlowId()); + FlowChart flowChart = flowService.selectFlowChartByChartId(flowApprovalRole.getFlowId()); + flowRecord.setProcessId(flowChart.getProcessId()); + flowRecord.setFlowProcess(flowChart.getFlowProcess()); + String staffRole = StaffRoles.getStaffRole(approvalStaff.getId(), StringUtil.strToLongs(flowApprovalRole.getRoleId())); + if (i == 0) { + flowRecord.setStatus(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus()); + resultRecord.setFlowStaffIdRole(staffRole); + resultRecord.setFlowProcess(flowChart.getFlowProcess()); + } else { + flowRecord.setStatus(FlowRecordStatusEnums.UN_TO_STATUS.getStatus()); + if(new Integer(4).equals(flowChart.getFlowProcess())){ + EvaluationStartStaff evaluationStartStaff = evaluationStartStaffService.selectEvaluationStartById(resultRecord.getEvaluationId(),resultRecord.getStartId()); + if(evaluationStartStaff !=null && new Integer(1).equals(evaluationStartStaff.getScore())){ + flowRecord.setStatus(FlowRecordStatusEnums.SKIP_STATUS.getStatus()); + }else{ + log.info("evaluationStartStaff is null evaluationId :" + resultRecord.getEvaluationId() + ", startId : " + resultRecord.getStartId()); + } + } + } + flowRecord.setFlowStaffIdRole(staffRole); + flowRecord.setFlowIndex(flowApprovalRole.getStepIndex()); + flowRecord.setType(stepType !=null ? stepType :flowApprovalRole.getStepType()); //步骤类型0:依次,1:或签(同时通知,一人通过或拒绝即可),2会签(同时通知,所有人同意才可) + flowRecordService.insertFlowRecord(flowRecord); + + } + + public Flow getFlow(List flows,Long flowId){ + for(Flow flow : flows){ + if(flow.getId().equals(flowId)){ + return flow; + } + } + return new Flow(); + } + + public StaffEntity getDepartmentStaff(Long staffId, int level) { + DepartManagers departManagers = staffService.findLeader( staffId, level); + List staffEntities = departManagers.getManagers(); + if(CollectionUtils.isNotEmpty(staffEntities)){ + return staffEntities.get(0); + } + return new StaffEntity(); + + } + @Override public R getModelById(Long id, int type){ /*EvaluationGroup evaluationGroup = evaluationGroupService.selectEvaluationGroupById(id);