Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-11-18 17:51:25 +08:00
commit 22d597c36b
9 changed files with 51 additions and 21 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

@ -201,7 +201,8 @@ public class SysLoginController extends AbstractController {
}
}
//测试环境将不进行短信验证码
if (!StringUtil.equals(environment, Constant.INVELOMENT_TYPE_TEST)) {
// if (!StringUtil.equals(environment, Constant.INVELOMENT_TYPE_TEST)) {
if (false) {
//账号不存在密码错误
if (!user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
return R.error("密码不正确!");

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>