提交修改

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);
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);
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);
}
@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
private DingtalkBusiness dingtalkBusiness;
List<ThreadInitFlowRecord> threadInitFlowRecords = new ArrayList<>();
@ -192,8 +194,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
initFlowRecordAnsy(resultRecords);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
initFlowRecordAnsy(resultRecords, noticeStaff);
return R.ok("发起成功").put("data", flowStart);
}
@ -326,8 +328,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
break;
}
}
initFlowRecordAnsy(resultRecords);
dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
initFlowRecordAnsy(resultRecords, noticeStaff);
//dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart);
}
//isInsert表示是否中途加人
@ -355,7 +357,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
for (FlowChart chart:flowCharts
) {//按照节点顺序获取正确的流程
List<FlowChartDetailRecord> flowChartDetailRecords1
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId());
= flowChartDetailRecordService.selectOpenFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId());
flowChartDetailRecords.addAll(flowChartDetailRecords1);
}
@ -695,7 +697,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
staffManages.put(key, departManagers.getManagers());
}
if(staffLeader.size() == 0){
if(staffLeader == null || staffLeader.size() == 0){
//没有领导通知到组设置的绩效管理人员
for (StaffEntity entity:staffManagers
) {
@ -806,33 +808,41 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.ok().put("data",staffEntity);
}
private void initFlowRecordAnsy(List<ResultRecord> resultRecords){
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords);
Thread thread = new Thread(threadInitFlowRecord);
thread.start();
private void initFlowRecordAnsy(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
if(resultRecords.size() > 0){
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords, noticeStaff);
threadInitFlowRecords.add(threadInitFlowRecord);//防止提前回收
Thread thread = new Thread(threadInitFlowRecord);
thread.start();
}
}
public class ThreadInitFlowRecord implements Runnable{
List<ResultRecord> resultRecords;
List<StaffSimpleInfo> noticeStaff;
public ThreadInitFlowRecord(List<ResultRecord> resultRecords){
public ThreadInitFlowRecord(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
this.resultRecords = resultRecords;
this.noticeStaff = noticeStaff;
}
@Override
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());
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());
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
StaffDao staffDao;
List<ThreadSendMessage> threadSendMessages = new ArrayList<>();
@Value("${dingtalk.appid}")
private String appid;
@ -257,8 +259,10 @@ public class DingtalkBusiness {
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
ThreadSendMessage threadSendMessage = new ThreadSendMessage(fromStaff, toStaffids, workMsgTypeEnum, appid);
threadSendMessages.add(threadSendMessage);//防止提前回收
Thread thread = new Thread(threadSendMessage);
thread.start();
return "OK";
}
return "error";
@ -391,6 +395,7 @@ public class DingtalkBusiness {
logger.info("ThreadSendMessage token无效"); ;
}
}
threadSendMessages.remove(this);
}
}
}

View File

@ -51,13 +51,14 @@ public class AssessManagerController extends AbstractController{
@ApiOperation("获取考核列表")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerListRes.class)})
public R assessList(@RequestBody AssessListReq req){
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
req.setLoginUserId(userId);
PageUtils pageUtils = assessManagerService.assessList(req);
return R.ok().put("data",pageUtils);
} catch (Exception e) {
log.error("获取考核列表异常,",e);
log.error("获取考核列表异常,userId: " + userId,e);
return R.error(e.getMessage());
}
}
@ -67,12 +68,13 @@ public class AssessManagerController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerDetailRes.class)})
public R assessDetail(@RequestBody AssessDetailReq req){
PageUtils pageUtils;
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
req.setLoginUserId(userId);
pageUtils = assessManagerService.assessDetail(req);
} catch (Exception e) {
log.error("获取考核详情列表异常" ,e);
log.error("获取考核详情列表异常userId: " + userId,e);
return R.error(e.getMessage());
}
return R.ok().put("data",pageUtils);
@ -86,12 +88,13 @@ public class AssessManagerController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatistical.class)})
public R assessChart(@RequestBody AssessDetailReq req){
List<ChartStatistical> process;
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
req.setLoginUserId(userId);
process = chartResultService.countAssessNumByFlowProcess(req);
} catch (Exception e) {
log.error("获取详情顶部人数统计异常" ,e);
log.error("获取详情顶部人数统计异常userId: " + userId,e);
return R.error(e.getMessage());
}
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.FlowStartMapper;
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.model.GroupStaffs;
import com.lz.modules.flow.model.StartGroups;
import com.lz.modules.flow.service.EvaluationGroupService;
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.job.business.DingtalkBusiness;
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.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.sun.org.apache.regexp.internal.RE;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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;
@ -291,7 +280,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
Long evaluation = group.getId();
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), group.getId());
log.info("更新evaluationStartStaff 数据 为已评分 " + i);
List<ToScoreDingTalkDto> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
if(CollectionUtils.isNotEmpty(dtos)){
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 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 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
</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>

View File

@ -122,7 +122,7 @@
<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,
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>
</mapper>