提交修改

This commit is contained in:
quyixiao 2020-11-18 16:08:24 +08:00
commit 6011564fa2
10 changed files with 58 additions and 51 deletions

View File

@ -43,4 +43,6 @@ public interface FlowChartDetailRecordMapper extends BaseMapper<FlowChartDetailR
int updateCoverFlowChartDetailRecordByIds(@Param("list") List<FlowChartDetailRecord> updaes); int updateCoverFlowChartDetailRecordByIds(@Param("list") List<FlowChartDetailRecord> updaes);
List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(@Param("groupId") Long groupId, @Param("flowProcess") int flowProcess); List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(@Param("groupId") Long groupId, @Param("flowProcess") int flowProcess);
List<FlowChartDetailRecord> selectOpenFlowChartDetailRecordByGroupIdAndChartId(@Param("groupId") Long groupId, @Param("chartId") Long chartId);
} }

View File

@ -42,4 +42,7 @@ public interface FlowChartDetailRecordService extends IService<FlowChartDetailRe
int updateCoverFlowChartDetailRecordByIds(List<FlowChartDetailRecord> updaes); int updateCoverFlowChartDetailRecordByIds(List<FlowChartDetailRecord> updaes);
List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(Long groupId, int flowProcess); List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(Long groupId, int flowProcess);
//获取开启节点的
List<FlowChartDetailRecord> selectOpenFlowChartDetailRecordByGroupIdAndChartId(Long groupId, Long chartId);
} }

View File

@ -86,6 +86,11 @@ public class FlowChartDetailRecordServiceImpl extends ServiceImpl<FlowChartDetai
return flowChartDetailRecordMapper.selectFlowChartDetailRecordsByFlowProcess(groupId, flowProcess); return flowChartDetailRecordMapper.selectFlowChartDetailRecordsByFlowProcess(groupId, flowProcess);
} }
@Override
public List<FlowChartDetailRecord> selectOpenFlowChartDetailRecordByGroupIdAndChartId(Long groupId, Long chartId){
return flowChartDetailRecordMapper.selectOpenFlowChartDetailRecordByGroupIdAndChartId(groupId, chartId);
}

View File

@ -103,6 +103,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
@Autowired @Autowired
private DingtalkBusiness dingtalkBusiness; private DingtalkBusiness dingtalkBusiness;
List<ThreadInitFlowRecord> threadInitFlowRecords = new ArrayList<>();
@ -192,8 +194,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
} }
initFlowRecordAnsy(resultRecords); initFlowRecordAnsy(resultRecords, noticeStaff);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart); return R.ok("发起成功").put("data", flowStart);
} }
@ -326,8 +328,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
break; break;
} }
} }
initFlowRecordAnsy(resultRecords); initFlowRecordAnsy(resultRecords, noticeStaff);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType()); //dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart); return R.ok("发起成功").put("data", flowStart);
} }
//isInsert表示是否中途加人 //isInsert表示是否中途加人
@ -355,7 +357,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
for (FlowChart chart:flowCharts for (FlowChart chart:flowCharts
) {//按照节点顺序获取正确的流程 ) {//按照节点顺序获取正确的流程
List<FlowChartDetailRecord> flowChartDetailRecords1 List<FlowChartDetailRecord> flowChartDetailRecords1
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId()); = flowChartDetailRecordService.selectOpenFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId());
flowChartDetailRecords.addAll(flowChartDetailRecords1); flowChartDetailRecords.addAll(flowChartDetailRecords1);
} }
@ -695,7 +697,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
staffManages.put(key, departManagers.getManagers()); staffManages.put(key, departManagers.getManagers());
} }
if(staffLeader.size() == 0){ if(staffLeader == null || staffLeader.size() == 0){
//没有领导通知到组设置的绩效管理人员 //没有领导通知到组设置的绩效管理人员
for (StaffEntity entity:staffManagers for (StaffEntity entity:staffManagers
) { ) {
@ -806,33 +808,41 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.ok().put("data",staffEntity); return R.ok().put("data",staffEntity);
} }
private void initFlowRecordAnsy(List<ResultRecord> resultRecords){ private void initFlowRecordAnsy(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords); if(resultRecords.size() > 0){
Thread thread = new Thread(threadInitFlowRecord); ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords, noticeStaff);
thread.start(); threadInitFlowRecords.add(threadInitFlowRecord);//防止提前回收
Thread thread = new Thread(threadInitFlowRecord);
thread.start();
}
} }
public class ThreadInitFlowRecord implements Runnable{ public class ThreadInitFlowRecord implements Runnable{
List<ResultRecord> resultRecords; List<ResultRecord> resultRecords;
List<StaffSimpleInfo> noticeStaff;
public ThreadInitFlowRecord(List<ResultRecord> resultRecords){ public ThreadInitFlowRecord(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
this.resultRecords = resultRecords; this.resultRecords = resultRecords;
this.noticeStaff = noticeStaff;
} }
@Override @Override
public void run() { public void run() {
//String oldNo = Logger.inheritableThreadLocalNo.get();//.threadLocalNo.get();
//String newNo = oldNo + "_initFlowRecord" ;//+ resultRecord.getStaffId() + "_" + resultRecord.getId();
//ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
log.info("开始批量初始化流程,数量{}", resultRecords.size()); log.info("开始批量初始化流程,数量{}", resultRecords.size());
for (ResultRecord resultRecord:resultRecords for (ResultRecord resultRecord:resultRecords
) { ) {
String oldNo = Logger.inheritableThreadLocalNo.get();//.threadLocalNo.get();
String newNo = oldNo + "_" + resultRecord.getId() + "_" + resultRecord.getStaffId();
ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
resultRecordService.initFlowRecord(resultRecord.getId()); resultRecordService.initFlowRecord(resultRecord.getId());
ch.qos.logback.classic.Logger.threadLocalNo.set(oldNo);
} }
//ch.qos.logback.classic.Logger.threadLocalNo.set(oldNo);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
threadInitFlowRecords.remove(this);
} }
} }
} }

View File

@ -77,6 +77,8 @@ public class DingtalkBusiness {
@Resource @Resource
StaffDao staffDao; StaffDao staffDao;
List<ThreadSendMessage> threadSendMessages = new ArrayList<>();
@Value("${dingtalk.appid}") @Value("${dingtalk.appid}")
private String appid; private String appid;
@ -257,8 +259,10 @@ public class DingtalkBusiness {
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type); WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid); ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid);
threadSendMessages.add(threadSendMessage);//防止提前回收
Thread thread = new Thread(threadSendMessage); Thread thread = new Thread(threadSendMessage);
thread.start(); thread.start();
return "OK"; return "OK";
} }
return "error"; return "error";
@ -391,6 +395,7 @@ public class DingtalkBusiness {
logger.info("ThreadSendMessage token无效"); ; logger.info("ThreadSendMessage token无效"); ;
} }
} }
threadSendMessages.remove(this);
} }
} }
} }

View File

@ -51,13 +51,14 @@ public class AssessManagerController extends AbstractController{
@ApiOperation("获取考核列表") @ApiOperation("获取考核列表")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerListRes.class)}) @ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerListRes.class)})
public R assessList(@RequestBody AssessListReq req){ public R assessList(@RequestBody AssessListReq req){
Long userId = null;
try { try {
Long userId = getUserId(); userId = getUserId();
req.setLoginUserId(userId); req.setLoginUserId(userId);
PageUtils pageUtils = assessManagerService.assessList(req); PageUtils pageUtils = assessManagerService.assessList(req);
return R.ok().put("data",pageUtils); return R.ok().put("data",pageUtils);
} catch (Exception e) { } catch (Exception e) {
log.error("获取考核列表异常,",e); log.error("获取考核列表异常,userId: " + userId,e);
return R.error(e.getMessage()); return R.error(e.getMessage());
} }
} }
@ -67,12 +68,13 @@ public class AssessManagerController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerDetailRes.class)}) @ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerDetailRes.class)})
public R assessDetail(@RequestBody AssessDetailReq req){ public R assessDetail(@RequestBody AssessDetailReq req){
PageUtils pageUtils; PageUtils pageUtils;
Long userId = null;
try { try {
Long userId = getUserId(); userId = getUserId();
req.setLoginUserId(userId); req.setLoginUserId(userId);
pageUtils = assessManagerService.assessDetail(req); pageUtils = assessManagerService.assessDetail(req);
} catch (Exception e) { } catch (Exception e) {
log.error("获取考核详情列表异常" ,e); log.error("获取考核详情列表异常userId: " + userId,e);
return R.error(e.getMessage()); return R.error(e.getMessage());
} }
return R.ok().put("data",pageUtils); return R.ok().put("data",pageUtils);
@ -86,12 +88,13 @@ public class AssessManagerController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatistical.class)}) @ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatistical.class)})
public R assessChart(@RequestBody AssessDetailReq req){ public R assessChart(@RequestBody AssessDetailReq req){
List<ChartStatistical> process; List<ChartStatistical> process;
Long userId = null;
try { try {
Long userId = getUserId(); userId = getUserId();
req.setLoginUserId(userId); req.setLoginUserId(userId);
process = chartResultService.countAssessNumByFlowProcess(req); process = chartResultService.countAssessNumByFlowProcess(req);
} catch (Exception e) { } catch (Exception e) {
log.error("获取详情顶部人数统计异常" ,e); log.error("获取详情顶部人数统计异常userId: " + userId,e);
return R.error(e.getMessage()); return R.error(e.getMessage());
} }
return R.ok().put("data",process); return R.ok().put("data",process);

View File

@ -19,13 +19,11 @@ import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
import com.lz.modules.flow.dao.FlowRecordMapper; import com.lz.modules.flow.dao.FlowRecordMapper;
import com.lz.modules.flow.dao.FlowStartMapper; import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.EvaluationGroup; import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.EvaluationStartStaff;
import com.lz.modules.flow.entity.FlowStart; import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.model.GroupStaffs; import com.lz.modules.flow.model.GroupStaffs;
import com.lz.modules.flow.model.StartGroups; import com.lz.modules.flow.model.StartGroups;
import com.lz.modules.flow.service.EvaluationGroupService; import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.EvaluationStartStaffService; import com.lz.modules.flow.service.EvaluationStartStaffService;
import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.FlowStartService; import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.job.business.DingtalkBusiness; import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.dto.ToScoreDingTalkDto; import com.lz.modules.performance.dto.ToScoreDingTalkDto;
@ -40,21 +38,12 @@ import com.lz.modules.performance.service.AssessService;
import com.lz.modules.sys.dao.app.ResultRecordMapper; import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService; import com.lz.modules.sys.service.app.ResultRecordService;
import com.sun.org.apache.regexp.internal.RE;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toList;
@ -291,7 +280,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
Long evaluation = group.getId(); Long evaluation = group.getId();
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), group.getId()); int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), group.getId());
log.info("更新evaluationStartStaff 数据 为已评分 " + i); log.info("更新evaluationStartStaff 数据 为已评分 " + i);
List<ToScoreDingTalkDto> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation); List<ToScoreDingTalkDto> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
if(CollectionUtils.isNotEmpty(dtos)){ if(CollectionUtils.isNotEmpty(dtos)){
log.info("本次评分更新操作 num: " + dtos.size()); log.info("本次评分更新操作 num: " + dtos.size());
@ -347,17 +335,4 @@ public class AssessManagerServiceImpl implements AssessManagerService {
} }
/* public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(10);
CompletableFuture<List<Long>> future = CompletableFuture.supplyAsync(()-> Arrays.asList(1L,2L),executorService);
try {
List<Long> longs = future.get();
System.out.println();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}*/
} }

View File

@ -588,7 +588,7 @@
</select> </select>
<select id="selectLastResultRecordByUserId" resultType="ResultRecord" > <select id="selectLastResultRecordByUserId" resultType="ResultRecord" >
select * from lz_result_record where staff_id=#{userId} and is_delete = 0 order by id desc limit 1 select * from lz_result_record where staff_id=#{userId} and is_delete = 0 and evaluation_id is not null order by id desc limit 1
</select> </select>
<select id="selectResultRecordByStaffIdAndStartId" resultType="ResultRecord" > <select id="selectResultRecordByStaffIdAndStartId" resultType="ResultRecord" >

View File

@ -175,5 +175,9 @@
and chart_id = (select id from lz_flow_chart where flow_process = #{flowProcess}) and is_delete = 0 order by step_index asc and chart_id = (select id from lz_flow_chart where flow_process = #{flowProcess}) and is_delete = 0 order by step_index asc
</select> </select>
<select id="selectOpenFlowChartDetailRecordByGroupIdAndChartId" resultType="FlowChartDetailRecord" >
select * from lz_flow_chart_detail_record where evaluation_group_id=#{groupId} and chart_id = #{chartId} and is_delete = 0 and status = 1 order by step_index asc
</select>
</mapper> </mapper>

View File

@ -122,7 +122,7 @@
<select id="selectCanSetChartRoleByChartId" resultType="com.lz.modules.flow.model.FlowChartRoleDto" > <select id="selectCanSetChartRoleByChartId" resultType="com.lz.modules.flow.model.FlowChartRoleDto" >
SELECT crole.id as id, crole.chart_id as chart_id, crole.role_id as role_id, role.name as role_name, SELECT crole.id as id, crole.chart_id as chart_id, crole.role_id as role_id, role.name as role_name,
crole.type as type FROM lz_flow_chart_role crole left join lz_record_role role on role.id=crole.role_id crole.type as type FROM lz_flow_chart_role crole left join lz_record_role role on role.id=crole.role_id
where crole.chart_id=#{id} and crole.type = 0 where crole.chart_id=#{id} and crole.type = 0 and crole.is_delete=0
</select> </select>
</mapper> </mapper>