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
38decf8e91
@ -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){
|
||||
|
||||
@ -138,28 +138,32 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
.collect(Collectors.toList());
|
||||
}else{
|
||||
//考评组管理
|
||||
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());
|
||||
List<StaffRole> staffRoles = staffRoleService.selectAllByStaffId(sysUserEntity.getUserId());//一个人只会有一个
|
||||
if(staffRoles.size() == 0){
|
||||
log.info("非绩效管理员登录查询");
|
||||
return null;
|
||||
}
|
||||
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups =
|
||||
staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
|
||||
if(staffRoleEvaluationGroups.size() == 0){
|
||||
log.info("查询的管理组为空");
|
||||
return null;
|
||||
}
|
||||
gIds = new ArrayList<>();
|
||||
for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups
|
||||
) {
|
||||
if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组
|
||||
gIds = null;
|
||||
log.info("管理所有组");
|
||||
break;
|
||||
if(staffRoles.get(0).getEvaluationGroupId().longValue() != 0L){//管理指定考评组的
|
||||
List<StaffRoleEvaluationGroup> staffRoleEvaluationGroups =
|
||||
staffRoleEvaluationGroupService.selectStaffRoleEvaluationsGroupByStaffRoles(staffRoles);
|
||||
if(staffRoleEvaluationGroups.size() == 0){
|
||||
log.info("查询的管理组为空");
|
||||
return null;
|
||||
}
|
||||
gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组
|
||||
|
||||
gIds = new ArrayList<>();
|
||||
for (StaffRoleEvaluationGroup staffRoleEvaluationGroup:staffRoleEvaluationGroups
|
||||
) {
|
||||
if(staffRoleEvaluationGroup.getEvaluationGroupId().longValue() == 0l){//管理所有组
|
||||
gIds = null;
|
||||
log.info("管理所有组");
|
||||
break;
|
||||
}
|
||||
gIds.add(staffRoleEvaluationGroup.getEvaluationGroupId());//管理特定组
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
List<Long> finalGIds = gIds;
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize())
|
||||
|
||||
@ -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<FlowStartMapper, FlowStart
|
||||
@Autowired
|
||||
private DingtalkBusiness dingtalkBusiness;
|
||||
|
||||
@Autowired
|
||||
private FlowRecordService flowRecordService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentsService departmentsService;
|
||||
@Autowired
|
||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -248,7 +273,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
|
||||
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
|
||||
|
||||
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
|
||||
for (int n = 0; n < evaluationGroups.size(); n++
|
||||
) {
|
||||
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
||||
@ -293,9 +318,12 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
||||
case 5:
|
||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
||||
case 0:
|
||||
noticeStaff.addAll(staffIds);
|
||||
break;
|
||||
}
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(staffIds, WorkMsgTypeEnum.START_WORK.getType());
|
||||
}
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
|
||||
return R.ok("发起成功").put("data", flowStart);
|
||||
}
|
||||
//isInsert表示是否中途加人
|
||||
@ -362,7 +390,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
BeanUtils.copyProperties(dto, resultModel);
|
||||
resultModel.setId(null);
|
||||
resultModelService.insertResultModel(resultModel);
|
||||
dto.setId(resultModel.getId());
|
||||
|
||||
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
|
||||
dto.setTagetLibs(libDtos);
|
||||
for (ResultTagetLibDto libDto: libDtos
|
||||
@ -374,6 +402,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
resultTagetLib.setId(null);
|
||||
resultTagetLibs.add(resultTagetLib);
|
||||
}
|
||||
dto.setId(resultModel.getId());
|
||||
}
|
||||
if(resultTagetLibs.size() > 0){
|
||||
//插入备份的考评组指标信息
|
||||
@ -410,6 +439,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
|
||||
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
||||
List<ResultDetail> resultDetails = new ArrayList();
|
||||
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
@ -443,8 +473,11 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
|
||||
|
||||
resultRecordService.insertResultRecord(resultRecord);
|
||||
//下面生成实际的考核流程
|
||||
|
||||
|
||||
resultRecordService.initFlowRecord(resultRecord.getId());
|
||||
|
||||
//下面生成实际的考核流程
|
||||
staffInfo.setRecordId(resultRecord.getId());
|
||||
|
||||
for (ResultModelDto modelDto:resultModelDtos
|
||||
@ -461,7 +494,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
resultDetail.setType(modelDto.getType());
|
||||
resultDetail.setKeyResult(libDto.getKeyResult());
|
||||
resultDetail.setCheckWeight(libDto.getWeight());
|
||||
resultDetail.setStaffId(staffInfo.getId());
|
||||
resultDetail.setStaffId(resultRecord.getStaffId());
|
||||
resultDetail.setPriority(libDto.getOrderBy());
|
||||
resultDetail.setModelId(modelDto.getId());
|
||||
resultDetails.add(resultDetail);
|
||||
@ -473,10 +506,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
if(resultDetails.size() > 0){
|
||||
//
|
||||
resultDetailService.insertResultDetails(resultDetails);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
return 0;
|
||||
@ -506,7 +536,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
mustRole.put(flow.getChartId(), flowChartRoles);
|
||||
}
|
||||
|
||||
|
||||
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
|
||||
|
||||
String roles = null;
|
||||
@ -521,8 +550,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
|
||||
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
|
||||
|
||||
|
||||
for (String id:optIds
|
||||
) {
|
||||
|
||||
@ -597,7 +624,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
List<ResultDetail> resultDetails = new ArrayList<>();
|
||||
|
||||
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
||||
|
||||
List<ResultRecord> resultRecords = new ArrayList<>();
|
||||
//下面初始化参与人员
|
||||
for (StaffSimpleInfo staffInfo:staffIds
|
||||
) {
|
||||
@ -612,7 +639,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
|
||||
evaluationStartStaffs.add(evaluationStartStaff);
|
||||
|
||||
|
||||
//初始化lz_result_records数据
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
|
||||
@ -625,6 +651,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
resultRecord.setEvaluationId(evaluationGroup.getId());
|
||||
resultRecord.setFlowProcess(0);//设置为目标制定
|
||||
|
||||
|
||||
|
||||
|
||||
//下面初始化flow_staff_id_role字段,步骤为0的
|
||||
String roleJSON = "[";
|
||||
for (int i = 0; i < flowApprovalRoles.size() ;i++){
|
||||
@ -704,25 +733,89 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
roleJSON += "]";
|
||||
roleJSON = roleJSON.replace(",]", "]");
|
||||
resultRecord.setFlowStaffIdRole(roleJSON);
|
||||
|
||||
resultRecordService.insertResultRecord(resultRecord);
|
||||
staffInfo.setRecordId(resultRecord.getId());
|
||||
//下面生成实际的考核流程
|
||||
resultRecordService.initFlowRecord(resultRecord.getId());
|
||||
List<Flow> flows = flowService.selectByFlowId(resultRecord.getEvaluationId(),resultRecord.getStartId());
|
||||
List<Long> 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<StaffRole> 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<String, String> map = departmentsService.selectUserAllDepartmentIds(relateEntity.getDepartmentId());
|
||||
List<StaffRoleDepartment> 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<ResultRecord> resultRecords = Lists.newArrayList();
|
||||
CompletableFuture<List<ResultRecord>> listCompletableFuture = CompletableFuture.supplyAsync(() -> resultRecordService.list(), executor);
|
||||
try {
|
||||
resultRecords = listCompletableFuture.get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
//resultRecordService.initFlowRecord(resultRecord.getId());
|
||||
//下面生成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.setStaffId(resultRecord.getId());
|
||||
resultDetail.setPriority(libDto.getOrderBy());
|
||||
resultDetail.setModelId(modelDto.getId());
|
||||
resultDetails.add(resultDetail);
|
||||
@ -734,12 +827,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
if(resultDetails.size() > 0){
|
||||
//
|
||||
resultDetailService.insertResultDetails(resultDetails);
|
||||
|
||||
}
|
||||
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
|
||||
//下面通知所有参与考核人员
|
||||
|
||||
//如果有下面通知所有管理人员
|
||||
}else{
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||
log.info("初始化考核流程失败");
|
||||
@ -748,6 +837,57 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void insertFlowRecord(FlowRecord flowRecord,StaffEntity approvalStaff,List<Flow> 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<Flow> 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<StaffEntity> 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);
|
||||
|
||||
@ -237,29 +237,31 @@ public class DingtalkBusiness {
|
||||
|
||||
|
||||
public String sendWorkMSGWithAsyn(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, int type) {
|
||||
|
||||
if (toStaffids.get(0).getEmployeeId() == null || toStaffids.get(0).getEmployeeId().length() == 0) {
|
||||
//查询第三方id
|
||||
List<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
|
||||
@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<Long> ids = toStaffids.stream().map(new Function<StaffSimpleInfo, Long>() {
|
||||
@Override
|
||||
public Long apply(StaffSimpleInfo staffSimpleInfo) {
|
||||
return staffSimpleInfo.getId();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
|
||||
Map<Long, StaffSimpleInfo> 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<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(ids);
|
||||
Map<Long, StaffSimpleInfo> 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";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user