Commit a44c3271 authored by tianbo's avatar tianbo

隐患流程修改

parent 25977a48
......@@ -13,7 +13,8 @@ import com.alibaba.fastjson.JSONObject;
import feign.Response;
@FeignClient(name = "AMOS-API-WORKFLOW", path = "workflow", configuration = { CommonMultipartSupportConfig.class })
@FeignClient(name = "AMOS-API-WORKFLOW-chenhao", path = "workflow", configuration =
{ CommonMultipartSupportConfig.class })
public interface WorkflowFeignService {
/**
* 发起流程
......
......@@ -50,6 +50,9 @@ public class LatentDangerFlowRecord extends BasicEntity {
@Column(name = "execute_user_id")
private String executeUserId;
@Column(name = "execute_user_name")
private String executeUserName;
@Column(name = "execute_result")
private String executeResult;
......@@ -74,4 +77,7 @@ public class LatentDangerFlowRecord extends BasicEntity {
@Column(name = "execute_department_id")
private String executeDepartmentId;
@Column(name = "execute_department_name")
private String executeDepartmentName;
}
......@@ -146,9 +146,8 @@ public class LatentDangerController extends BaseController {
String departmentName = getDepartmentName(reginParams);
String userRealName = user.getRealName();
String userId = user.getUserId();
RoleBo role = reginParams.getRole();
DangerExecuteSubmitDto executeSubmitDto = iLatentDangerService.execute(latentDangerExecuteParam, userId,
userRealName, deptId, departmentName, role);
userRealName, deptId, departmentName, reginParams);
// iLatentDangerService.freshRiskJudgmentLangerCount(latentDangerExecuteParam);//更新统计
// 执行通过,发送执行结果消息
// if (executeSubmitDto.getIsOk()) {
......
......@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner;
......@@ -12,6 +11,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -209,7 +209,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setInstanceId(instance.getString("id"));
JSONObject flowJson = new JSONObject();
flowJson.put("photoUrls", latentDangerDto.getPhotoUrl());
LatentDangerFlowRecord record = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId, flowJson, dangerId, role, LatentDangerExecuteTypeEnum.填写隐患完成.getName(), latentDangerDto.getRemark());
LatentDangerFlowRecord record = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId,
flowJson, dangerId, role, LatentDangerExecuteTypeEnum.填写隐患完成.getName(), latentDangerDto.getRemark(),
userRealName, departmentName, latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(record.getId());
latentDangerMapper.updateById(latentDanger);
sendMessage(latentDanger, LatentDangerExecuteTypeEnum.填写隐患完成, null,
......@@ -286,7 +288,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// 第一次保存隐患提交记录
LatentDangerFlowRecord inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId,
flowJson, latentDanger.getId(), role, LatentDangerExecuteTypeEnum.填写隐患完成.getName(),
latentDanger.getRemark());
latentDanger.getRemark(), userRealName, departmentName, latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(inputRecord.getId());
latentDanger.setInstanceId(instance.getString("id"));
latentDangerMapper.updateById(latentDanger);
......@@ -383,17 +385,22 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
public LatentDangerFlowRecord saveFlowRecord(String taskId, String taskName, String userId, String departmentId,
JSONObject flowJson, Long dangerId, RoleBo role, String executeResult, String remark) {
JSONObject flowJson, Long dangerId, RoleBo role,
String executeResult, String remark, String userName,
String departmentName, String dangerState) {
LatentDangerFlowRecord record = new LatentDangerFlowRecord();
record.setFlowTaskId(taskId);
record.setExecuteUserId(userId);
record.setExecuteUserName(userName);
record.setExecuteDepartmentId(departmentId);
record.setExecuteDepartmentName(departmentName);
record.setFlowJson(flowJson != null ? flowJson.toJSONString() : null);
record.setFlowTaskName(taskName);
record.setDangerId(dangerId);
record.setExecuteResult(executeResult);
record.setActionFlag(taskName);
record.setActionFlag(dangerState);
record.setRemark(remark);
record.setUpdateDate(new Date());
latentDangerFlowRecordService.saveOrUpdate(record);
return record;
}
......@@ -406,6 +413,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
record.setFlowTaskName(taskName);
record.setActionFlag(taskDefinitionKey);
record.setDangerId(dangerId);
record.setUpdateDate(new Date());
latentDangerFlowRecordMapper.save(record);
return record;
}
......@@ -618,7 +626,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Transactional(rollbackFor = Exception.class)
@Override
public DangerExecuteSubmitDto execute(LatentDangerExecuteParam latentDangerExecuteParam, String userId, String userRealName, String departmentId, String departmentName, RoleBo role) throws Exception {
public DangerExecuteSubmitDto execute(LatentDangerExecuteParam latentDangerExecuteParam, String userId, String userRealName, String departmentId, String departmentName, ReginParams reginParams) throws Exception {
DangerExecuteSubmitDto executeSubmitDto = new DangerExecuteSubmitDto();
LatentDanger latentDanger = latentDangerMapper.selectById(latentDangerExecuteParam.getDangerId());
if (ValidationUtil.isEmpty(latentDanger)) {
......@@ -627,7 +636,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return executeSubmitDto;
}
DangerExecuteSubmitDto dangerExecuteSubmitDto = executeSubmit(latentDangerExecuteParam, latentDanger, userId, userRealName, departmentId, departmentName, executeSubmitDto, role);
DangerExecuteSubmitDto dangerExecuteSubmitDto = executeSubmit(latentDangerExecuteParam, latentDanger, userId,
userRealName, departmentId, departmentName, executeSubmitDto, reginParams);
try {
if (dangerExecuteSubmitDto.getIsOk()) {
webMqttComponent.publish(dangerTopic, "");
......@@ -691,6 +701,17 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
List<String> photoUrls = Lists.newArrayList(latentDanger.getPhotoUrls().split(","));
detailVo.setPhotoUrl(photoUrls);
}
if (!ValidationUtil.isEmpty(detailVo.getReformLimitDate())) {
detailVo.setReformLimitDateStr(DateUtil.date2Str(detailVo.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT));
}
List<LatentDangerFlowRecordBo> records = latentDangerFlowRecordMapper.listByDangerId(latentDanger.getId());
if (!CollectionUtils.isEmpty(records)) {
for (LatentDangerFlowRecordBo recordBo : records) {
recordBo.setExecuteTime(DateUtil.date2Str(recordBo.getCreateDate(), DateUtil.DATETIME_DEFAULT_FORMAT));
}
detailVo.setRecords(records);
}
if (dangerBizType.equals(LatentDangerBizTypeEnum.巡检.getCode())) {
// buildOfDifferentDangerType(latentDangerBo, detailVo);
......@@ -1085,22 +1106,26 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
String departmentId,
String departmentName,
DangerExecuteSubmitDto executeSubmitDto,
RoleBo role) throws Exception {
ReginParams reginParams) throws Exception {
// 根据业务类型不同执行不同逻辑
if (LatentDangerBizTypeEnum.防火监督.getCode().equals(redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY))) {
// 防火监督业务
executeSupervisionBiz(param, latentDanger, userId, userRealName, departmentId, departmentName,
executeSubmitDto, role);
executeSubmitDto, reginParams);
} else if (LatentDangerBizTypeEnum.巡检.getCode().equals(redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY))) {
// 巡检业务
executePatrolBiz(param, latentDanger, userId, userRealName, departmentId, departmentName,
executeSubmitDto, role);
executeSubmitDto, reginParams);
}
return executeSubmitDto;
}
private DangerExecuteSubmitDto executeSupervisionBiz(LatentDangerExecuteParam param, LatentDanger latentDanger, String userId, String userRealName, String departmentId, String departmentName, DangerExecuteSubmitDto executeSubmitDto, RoleBo role) throws Exception {
private DangerExecuteSubmitDto executeSupervisionBiz(LatentDangerExecuteParam param, LatentDanger latentDanger,
String userId, String userRealName, String departmentId,
String departmentName,
DangerExecuteSubmitDto executeSubmitDto,
ReginParams reginParams) throws Exception {
// TODO 查询隐患的巡查信息
JSONObject bizInfo = JSONObject.parseObject(latentDanger.getBizInfo());
if (ValidationUtil.isEmpty(bizInfo)) {
......@@ -1141,7 +1166,10 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.现场确认.getName());
// 保存日志信息
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null, latentDanger.getId(), role, "", "");
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null,
latentDanger.getId(), reginParams.getRole(),
latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName(), "",
userRealName, departmentName, latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(record.getId());
this.updateById(latentDanger);
......@@ -1157,15 +1185,19 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
// 执行任务(带权限校验)
Boolean executeResult = workflowExecuteService.CompleteTask(processInstanceId, condition);
// Boolean executeResult = workflowExecuteService.CompleteTask(processInstanceId, condition, reginParams);
// 校验权限
Boolean executeResult = workflowExecuteService.excuteTask(processInstanceId, condition);
if (!executeResult) {
executeSubmitDto.setIsOk(false);
executeResultMsg = "任务执行失败";
}
String nextState = "";
String nextStateName = "";
if (ExecuteTypeEnum.通过.getCode() == param.getExecuteType()) {
if (ExecuteTypeEnum.通过.getCode().equals(param.getExecuteType())) {
// 执行成功更新隐患状态
LatentDangerState.SupervisionDangerStateEnum nextStateEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(currentStateEnum.getNext());
......@@ -1184,21 +1216,23 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(currentStateEnum.getRejectNext());
nextState = nextStateEnum.getCode();
nextStateName = nextStateEnum.getName();
executeResultMsg = nextStateName + "拒绝";
executeResultMsg = nextStateName + ExecuteTypeEnum.驳回.getName();
}
latentDanger.setDangerState(nextState);
latentDanger.setDangerStateName(nextStateName);
if (LatentDangerState.SupervisionDangerStateEnum.整改检查分管领导确认.getCode().equals(currentDangerState)
|| LatentDangerState.SupervisionDangerStateEnum.整改二次审核确认.getCode().equals(currentDangerState)) {
if (ExecuteTypeEnum.通过.getCode().equals(param.getExecuteType()) &&
(LatentDangerState.SupervisionDangerStateEnum.整改检查分管领导确认.getCode().equals(currentDangerState)
|| LatentDangerState.SupervisionDangerStateEnum.整改二次审核确认.getCode().equals(currentDangerState))) {
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.整改完毕.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.整改完毕.getName());
executeResultMsg = latentDanger.getDangerStateName();
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
}
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null, latentDanger.getId(), role,
executeResultMsg, "");
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null,
latentDanger.getId(), reginParams.getRole(), executeResultMsg, "", userRealName, departmentName,
latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(record.getId());
this.updateById(latentDanger);
......@@ -1208,7 +1242,10 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return executeSubmitDto;
}
private DangerExecuteSubmitDto executePatrolBiz(LatentDangerExecuteParam param, LatentDanger latentDanger, String userId, String userRealName, String departmentId, String departmentName, DangerExecuteSubmitDto executeSubmitDto, RoleBo role) {
private DangerExecuteSubmitDto executePatrolBiz(LatentDangerExecuteParam param, LatentDanger latentDanger,
String userId, String userRealName, String departmentId,
String departmentName,DangerExecuteSubmitDto executeSubmitDto,
ReginParams reginParams) {
if (StringUtil.isNotEmpty(param.getReformLimitDate())) {
param.setReformLimitDate(param.getReformLimitDate() + " 23:59:59");
}
......@@ -1253,14 +1290,17 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.已撤销)) {
latentDanger.setDangerState(executeTypeEnum.getNextState().getCode());
saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
param.getFlowJson(), param.getDangerId(), reginParams.getRole(), executeTypeEnum.getName(),
param.getRemark(), userRealName, departmentName, latentDanger.getDangerState());
} else if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.治理完毕)) {
latentDanger.setDangerState(executeTypeEnum.getNextState().getCode());
saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
param.getFlowJson(), param.getDangerId(), reginParams.getRole(), executeTypeEnum.getName(),
param.getRemark(), userRealName, departmentName, latentDanger.getDangerState());
} else {
LatentDangerFlowRecord flowRecord = saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
param.getFlowJson(), param.getDangerId(), reginParams.getRole(), executeTypeEnum.getName(),
param.getRemark(), userRealName, departmentName, latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(flowRecord.getId());
latentDanger.setDangerState(executeTypeEnum.getNextState().getCode());
if (executeTypeEnum.equals(LatentDangerExecuteTypeEnum.隐患常规治理)) {
......
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam;
......@@ -55,7 +56,7 @@ public interface ILatentDangerService {
* @return
*/
DangerExecuteSubmitDto execute(LatentDangerExecuteParam latentDangerExecuteParam, String userId,
String userRealName, String departmentId, String departmentName, RoleBo role) throws Exception;
String userRealName, String departmentId, String departmentName, ReginParams reginParams) throws Exception;
ResponseModel<LatentDangerDetailVo> detail(Long dangerId, String userId, boolean isFinish) throws Exception;
......
......@@ -31,6 +31,8 @@ public class LatentDangerDetailVo {
private Date reformLimitDate;
private String reformLimitDateStr;
private JSONObject reformJson;
private Long currentFlowRecordId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment