Commit 3e986dc4 authored by tianbo's avatar tianbo

隐患流程调试

parent 8d8aae60
......@@ -35,51 +35,51 @@ public interface LatentDangerState {
/**
* 提交隐患
*/
提交隐患("提交隐患", "dangerSubmit", null, null),
提交隐患("提交隐患", "dangerSubmit", null, null, "未审核"),
/**
* 现场确认
*/
现场确认("现场确认", "onSiteConfirm", "leaderConfirm","onSiteConfirm"),
现场确认("现场确认", "onSiteConfirm", "leaderConfirm","onSiteConfirm", "审核中"),
/**
* 检查组长确认
*/
检查组长确认("检查组长确认", "leaderConfirm", "secondConfirm","onSiteConfirm"),
检查组长确认("检查组长确认", "leaderConfirm", "secondConfirm","onSiteConfirm", "审核中"),
/**
* 隐患二次审核确认
*/
隐患二次审核确认("隐患二次审核确认", "secondConfirm", "taskDispatch","onSiteConfirm"),
隐患二次审核确认("隐患二次审核确认", "secondConfirm", "taskDispatch","onSiteConfirm", "审核中"),
/**
* 整改任务分配
*/
整改任务分配("整改任务分配", "taskDispatch", "governFileSubmit",""),
整改任务分配("整改任务分配", "taskDispatch", "governFileSubmit","", "整改中"),
/**
* 提交整改资料
*/
提交整改资料("提交整改资料", "governFileSubmit", "governChargerConfirm",""),
提交整改资料("提交整改资料", "governFileSubmit", "governChargerConfirm","", "整改中"),
/**
* 整改检查组长确认
*/
整改检查组长确认("整改检查组长确认", "governLeaderConfirm", "governChargerConfirm","governFileSubmit"),
整改检查组长确认("整改检查组长确认", "governLeaderConfirm", "governChargerConfirm","governFileSubmit", "整改中"),
/**
* 整改检查负责人确认
*/
整改检查负责人确认("整改检查负责人确认", "governChargerConfirm", "governLeadershipConfirm","governFileSubmit"),
整改检查负责人确认("整改检查负责人确认", "governChargerConfirm", "governLeadershipConfirm","governFileSubmit", "整改中"),
/**
* 整改检查分管领导确认(根据计划类型不同,分管领导确认完流程不同)
*/
整改检查分管领导确认("整改检查分管领导确认", "governLeadershipConfirm", "governLeaderReviewConfirm","governFileSubmit"),
整改检查分管领导确认("整改检查分管领导确认", "governLeadershipConfirm", "governLeaderReviewConfirm","governFileSubmit", "整改中"),
/**
* 整改检查组长复查确认
*/
整改检查组长复查确认("整改检查组长复查确认", "governLeaderReviewConfirm", "governSecondReviewConfirm","governFileSubmit"),
整改检查组长复查确认("整改检查组长复查确认", "governLeaderReviewConfirm", "governSecondReviewConfirm","governFileSubmit", "整改中"),
/**
* 整改二次审核确认
*/
整改二次审核确认("整改二次审核确认", "governSecondReviewConfirm", "endOfGovernance","governFileSubmit"),
整改二次审核确认("整改二次审核确认", "governSecondReviewConfirm", "endOfGovernance","governFileSubmit", "整改中"),
/**
* 整改完毕
*/
整改完毕("整改完毕", "endOfGovernance", "","");
整改完毕("整改完毕", "endOfGovernance", "","", "整改完毕");
/**
* 名称,描述
......@@ -101,11 +101,17 @@ public interface LatentDangerState {
*/
private String rejectNext;
SupervisionDangerStateEnum(String name, String code, String next, String rejectNext) {
/**
* 流程状态
*/
private String processState;
SupervisionDangerStateEnum(String name, String code, String next, String rejectNext, String processState) {
this.name = name;
this.code = code;
this.next = next;
this.rejectNext = rejectNext;
this.processState = processState;
}
public String getName() {
......@@ -139,6 +145,14 @@ public interface LatentDangerState {
this.rejectNext = rejectNext;
}
public String getProcessState() {
return processState;
}
public void setProcessState(String processState) {
this.processState = processState;
}
public static SupervisionDangerStateEnum getEnumByCode(String code) {
for (SupervisionDangerStateEnum _enum : SupervisionDangerStateEnum.values()) {
if (code.equals(_enum.getCode())) {
......@@ -169,6 +183,16 @@ public interface LatentDangerState {
}
return enumList;
}
public static List<SupervisionDangerStateEnum> getEnumListByProcessState(String processState) {
List<SupervisionDangerStateEnum> enumList = Lists.newArrayList();
for(SupervisionDangerStateEnum type: SupervisionDangerStateEnum.values()) {
if (type.getProcessState().equals(processState)) {
enumList.add(type);
}
}
return enumList;
}
}
enum PatrolDangerLevelEnum implements LatentDangerState {
......
package com.yeejoin.amos.latentdanger.common.enums;
/**
* 拥有者枚举
* @author WJK
*
*/
public enum OwerEnum {
/**
* 我的
*/
MY("我的","0"),
ALL("全部","1" );
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private OwerEnum(String name, String code){
this.name = name;
this.code = code;
}
public static OwerEnum getEnum(String code) {
OwerEnum jPushTypeEnum = null;
for(OwerEnum type: OwerEnum.values()) {
if (type.getCode().equals(code)) {
jPushTypeEnum = type;
break;
}
}
return jPushTypeEnum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
......@@ -199,4 +199,10 @@ public class LatentDanger extends BasicEntity {
}
return false;
}
/**
* 提交信息
*/
@TableField(exist = false)
private JSONObject flowJson;
}
......@@ -16,6 +16,16 @@ public class Constants {
public static final String DANGER_BIZ_TYPE_KEY= "danger_biz_type_key";
/**
* 降序排列
*/
public static final String DESC = "desc";
/**
* 升序排列
*/
public static final String ASC = "asc";
/**
* 构造方法
*/
private Constants() {
......
......@@ -7,10 +7,10 @@ import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.latentdanger.business.dto.DangerExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.dto.ExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerListParam;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerNormalParam;
import com.yeejoin.amos.latentdanger.business.param.PageParam;
import com.yeejoin.amos.latentdanger.business.service.intfc.ILatentDangerService;
import com.yeejoin.amos.latentdanger.business.util.CommonResponse;
......@@ -27,6 +27,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -35,7 +36,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -58,6 +58,9 @@ public class LatentDangerController extends BaseController {
@Autowired
private ILatentDangerService iLatentDangerService;
@Value("${danger.biz.type}")
private static final String bizType = "patrol";
@ApiOperation(value = "创建无码无计划隐患", notes = "创建无码无计划隐患")
@PostMapping(value = "/normal/save")
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -236,7 +239,7 @@ public class LatentDangerController extends BaseController {
@PostMapping(value = "/page/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel listDanger(@ApiParam(value = "查询条件", required = true) @RequestBody PageParam pageParam) throws Exception {
IPage<LatentDanger> result = iLatentDangerService.listDanger(pageParam);
IPage<LatentDanger> result = iLatentDangerService.pageListDanger(pageParam);
return ResponseHelper.buildResponse(result);
}
......@@ -317,8 +320,12 @@ public class LatentDangerController extends BaseController {
String departmentName = getDepartmentName(reginParams);
String userRealName = user.getRealName();
String userId = user.getUserId();
return ResponseHelper.buildResponse(iLatentDangerService.dangerAudit(latentDangerDto, executeType, userId,
userRealName, deptId, departmentName, reginParams));
ExecuteSubmitDto executeSubmitDto = iLatentDangerService.dangerAudit(latentDangerDto, executeType, userId,
userRealName, deptId, departmentName, reginParams);
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
return ResponseHelper.buildResponse(executeSubmitDto);
}
/**
......
......@@ -141,4 +141,8 @@ public class LatentDangerDto {
*/
private Boolean unReviewed;
/**
* 提交信息
*/
private JSONObject flowJson;
}
......@@ -79,7 +79,7 @@ public class LatentDangerExecuteParam {
/**
* 整改责任人
*/
private String reformUserId;
private String reformLeaderId;
}
......@@ -28,6 +28,7 @@ import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerFlowRecordM
import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerMapper;
import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerPatrolMapper;
import com.yeejoin.amos.latentdanger.business.dto.DangerExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.dto.ExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.DangerResultBo;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.DictBo;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerBo;
......@@ -59,6 +60,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerReformTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerStateEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.OwerEnum;
import com.yeejoin.amos.latentdanger.common.remote.RemoteSpcService;
import com.yeejoin.amos.latentdanger.common.remote.RemoteWebSocketServer;
import com.yeejoin.amos.latentdanger.common.remote.RemoteWorkFlowService;
......@@ -68,6 +70,7 @@ import com.yeejoin.amos.latentdanger.core.common.response.DangerListResponse;
import com.yeejoin.amos.latentdanger.core.util.StringUtil;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDangerFlowRecord;
import com.yeejoin.amos.latentdanger.exception.YeeException;
import com.yeejoin.amos.latentdanger.feign.RemoteSecurityService;
import com.yeejoin.amos.latentdanger.mqtt.WebMqttComponent;
import org.apache.commons.lang3.ObjectUtils;
......@@ -94,6 +97,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
......@@ -136,47 +140,32 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
private RemoteSpcService remoteSpcService;
@Autowired
private AsyncTask asyncTask;
// @Autowired
// private Business business;
@Autowired
private RemoteWebSocketServer remoteWebSocketServer;
@Autowired
private LatentDangerFlowRecordServiceImpl latentDangerFlowRecordService;
// @Autowired
// private Business business;
@Value("${file.url}")
private String fileServerAddress;
@Value("${params.work.flow.processDefinitionKey}")
private String processDefinitionKey;
@Value("${amosRefresh.danger.topic}")
private String dangerTopic;
@Autowired
private WebMqttComponent webMqttComponent;
@Value("${danger.biz.type}")
private String dangerBizType;
private String bizType;
@Value("${workflow.process.definition.key}")
private String workflowProcessDefinitionKey;
@Autowired
private RedisUtils redisUtils;
@Autowired
private WorkflowExcuteServiceImpl workflowExecuteService;
@Autowired
private WorkflowFeignService workflowFeignService;
// 降序排列
private static String DESC = "desc";
// 升序排列
private static String ASC = "desc";
private String onSiteConfirmRole = "Person_charge_unit_fire_protection_supervision_inspection";
@Transactional(rollbackFor = Exception.class)
@Override
......@@ -237,7 +226,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
// 获取业务类型枚举
String bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
LatentDangerBizTypeEnum bizTypeEnum =
LatentDangerBizTypeEnum.getByCode(bizType);
if (ValidationUtil.isEmpty(bizTypeEnum)) {
......@@ -370,7 +358,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
public LatentDanger saveLatentDanger(LatentDangerDto dangerDto, String userId,
String departmentId, String businessKey, String orgCode,
LatentDangerTypeEnum dangerTypeEnum) {
String bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
LatentDanger latentDanger = new LatentDanger();
Bean.copyExistPropertis(dangerDto, latentDanger);
if (ValidationUtil.isEmpty(dangerDto.getId())) {
......@@ -666,7 +653,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
@Override
public ResponseModel<LatentDangerDetailVo> detail(Long dangerId, String userId, boolean isFinish){
public ResponseModel<LatentDangerDetailVo> detail(Long dangerId, String userId, boolean isFinish) {
LatentDanger latentDanger = this.baseMapper.selectById(dangerId);
// JSONObject jsonObject;
// if (isFinish) {
......@@ -715,9 +702,6 @@ 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)) {
......@@ -727,7 +711,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
detailVo.setRecords(records);
}
if (dangerBizType.equals(LatentDangerBizTypeEnum.巡检.getCode())) {
if (bizType.equals(LatentDangerBizTypeEnum.巡检.getCode())) {
// buildOfDifferentDangerType(latentDangerBo, detailVo);
}
......@@ -1004,7 +988,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override
public void updateDangerStateOfOvertime() {
logger.info("修改治理过期隐患的逾期状态");
String bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
String dangerState = "2,3,4";
if (LatentDangerBizTypeEnum.巡检.getCode().equals(bizType)) {
dangerState = "2,3,4";
......@@ -1134,11 +1117,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
DangerExecuteSubmitDto executeSubmitDto,
ReginParams reginParams) throws Exception {
// 根据业务类型不同执行不同逻辑
if (LatentDangerBizTypeEnum.防火监督.getCode().equals(redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY))) {
if (LatentDangerBizTypeEnum.防火监督.getCode().equals(bizType)) {
// 防火监督业务
executeSupervisionBiz(param, latentDanger, userId, userRealName, departmentId, departmentName,
executeSubmitDto, reginParams);
} else if (LatentDangerBizTypeEnum.巡检.getCode().equals(redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY))) {
} else if (LatentDangerBizTypeEnum.巡检.getCode().equals(bizType)) {
// 巡检业务
executePatrolBiz(param, latentDanger, userId, userRealName, departmentId, departmentName,
executeSubmitDto, reginParams);
......@@ -1160,7 +1143,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return executeSubmitDto;
}
String planType = bizInfo.get("planType").toString();
String taskUserId = bizInfo.get("accompanyingUserId").toString();
String checkLeaderId = "3400882"; //bizInfo.get("accompanyingUserId").toString();
String processInstanceId = latentDanger.getInstanceId();
String currentDangerState = latentDanger.getDangerState();
......@@ -1174,7 +1157,14 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// 第一次处于待现场确认时,启动工作流
if (ValidationUtil.isEmpty(processInstanceId)) {
// 1、开启工作流
// 1、校验是否有启动后执行现场确认的权限
RoleBo roleBo = reginParams.getRole();
if (!onSiteConfirmRole.equals(roleBo.getRoleName())) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("没有权限执行");
return executeSubmitDto;
}
// 2、开启工作流
JSONObject body = new JSONObject();
body.put("businessKey", latentDanger.getBusinessKey());
body.put("processDefinitionKey", workflowProcessDefinitionKey);
......@@ -1189,21 +1179,43 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setUpdateDate(new Date());
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.现场确认.getName());
// 保存日志信息
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null,
latentDanger.getId(), reginParams.getRole(),
latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName(), "",
userRealName, departmentName, latentDanger.getDangerState());
// 3、执行一步
boolean executeResult = workflowExecuteService.excuteTask(latentDanger.getInstanceId(), planType);
if (!executeResult) {
this.updateById(latentDanger);
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("任务执行失败");
return executeSubmitDto;
}
// 4、在执行完节点后需要将检查组长id设置为下个节点执行人
Object resultObj = workflowExecuteService.setTaskAssign(latentDanger.getInstanceId(), checkLeaderId);
if (!(Boolean) resultObj) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("设置节点执行人失败");
return executeSubmitDto;
}
// 5、保存日志信息
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, latentDanger.getFlowJson(),
latentDanger.getId(), reginParams.getRole(), executeResultMsg, "", userRealName, departmentName,
latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(record.getId());
this.updateById(latentDanger);
executeSubmitDto.setIsOk(true);
executeSubmitDto.setMsg(latentDanger.getDangerStateName());
executeSubmitDto.setMsg(executeResultMsg);
return executeSubmitDto;
}
// 工作流条件执行
if (LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode().equals(latentDanger.getDangerState())) {
// 查询上一步流程信息,如果为拒绝,则又回到了现场确认,此时需要重新设置condition为计划类型
List<LatentDangerFlowRecord> recordList =
latentDangerFlowRecordService.list(new LambdaQueryWrapper<LatentDangerFlowRecord>().eq(LatentDangerFlowRecord::getDangerId, latentDanger.getId()).orderByDesc(LatentDangerFlowRecord::getCreateDate));
LatentDangerFlowRecord preRecord = recordList.get(0);
if (LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode().equals(latentDanger.getDangerState()) &&
!ValidationUtil.isEmpty(latentDanger.getInstanceId()) && ExecuteTypeEnum.驳回.getCode().equals(preRecord.getExecuteState())) {
condition = planType;
} else {
condition = param.getExecuteType().toString();
......@@ -1255,26 +1267,26 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setDangerState(nextState);
latentDanger.setDangerStateName(nextStateName);
// 当隐患状态是现场确认时,在执行完节点后需要将检查组长id设置为下个节点执行人
if (LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode().equals(currentDangerState)) {
Object result = workflowExecuteService.setTaskAssign(processInstanceId, taskUserId);
// 当隐患状态是整改任务分配时,在执行完节点后需要将整改分配责任人id设置为下个节点执行人
if (LatentDangerState.SupervisionDangerStateEnum.整改任务分配.getCode().equals(currentDangerState)) {
checkLeaderId = param.getReformLeaderId();
Object result = workflowExecuteService.setTaskAssign(processInstanceId, checkLeaderId);
if (!(Boolean) result) {
executeSubmitDto.setIsOk(false);
executeResultMsg = "设置节点执行人失败";
}
}
// 整改分配责任人
if (LatentDangerState.SupervisionDangerStateEnum.整改任务分配.getCode().equals(currentDangerState)) {
taskUserId = param.getReformUserId();
Object result = workflowExecuteService.setTaskAssign(processInstanceId, taskUserId);
// 当隐患状态是提交整改资料时,在执行完节点后需要将整改资料审核人id(检查组长)设置为下个节点执行人
if (LatentDangerState.SupervisionDangerStateEnum.提交整改资料.getCode().equals(currentDangerState)) {
Object result = workflowExecuteService.setTaskAssign(processInstanceId, checkLeaderId);
if (!(Boolean) result) {
executeSubmitDto.setIsOk(false);
executeResultMsg = "设置节点执行人失败";
}
}
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null,
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, latentDanger.getFlowJson(),
latentDanger.getId(), reginParams.getRole(), executeResultMsg, "", userRealName, departmentName,
latentDanger.getDangerState());
latentDanger.setCurrentFlowRecordId(record.getId());
......@@ -1288,7 +1300,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
private DangerExecuteSubmitDto executePatrolBiz(LatentDangerExecuteParam param, LatentDanger latentDanger,
String userId, String userRealName, String departmentId,
String departmentName,DangerExecuteSubmitDto executeSubmitDto,
String departmentName, DangerExecuteSubmitDto executeSubmitDto,
ReginParams reginParams) {
if (StringUtil.isNotEmpty(param.getReformLimitDate())) {
param.setReformLimitDate(param.getReformLimitDate() + " 23:59:59");
......@@ -1600,8 +1612,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override
public List<DictionarieValueModel> getDangerLevel() {
String dictCode = LatentDangerLevelEnum.dictCode;
if (!ValidationUtil.isEmpty(dangerBizType)) {
dictCode = dangerBizType + dictCode;
if (!ValidationUtil.isEmpty(bizType)) {
dictCode = bizType + dictCode;
}
FeignClientResult<List<DictionarieValueModel>> result = Systemctl.dictionarieClient.dictValues(dictCode);
return result.getResult();
......@@ -1610,8 +1622,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override
public List<DictionarieValueModel> getDangerGovernance() {
String dictCode = LatentDangerReformTypeEnum.dictCode;
if (!ValidationUtil.isEmpty(dangerBizType)) {
dictCode = dangerBizType + dictCode;
if (!ValidationUtil.isEmpty(bizType)) {
dictCode = bizType + dictCode;
}
FeignClientResult<List<DictionarieValueModel>> result = Systemctl.dictionarieClient.dictValues(dictCode);
......@@ -1674,26 +1686,24 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
@Override
public IPage<LatentDanger> listDanger(PageParam pageParam) throws Exception {
String bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
LatentDangerBizTypeEnum bizTypeEnum = LatentDangerBizTypeEnum.getByCode(bizType);
public IPage<LatentDanger> pageListDanger(PageParam pageParam) throws Exception {
IPage<LatentDanger> page = new Page<>(Integer.parseInt((String) pageParam.get("current")),
Integer.parseInt((String) pageParam.get("size")));
List allTaskList;
String order = ASC;
String order = Constants.ASC;
String idsStr = (String) pageParam.get("dangerIds");
List<String> dangerIdList = Lists.newArrayList();
if (StringUtil.isNotEmpty(idsStr)) {
// 查询指定隐患
dangerIdList = Lists.newArrayList(idsStr.split(","));
} else if ("0".equals(pageParam.get("my"))) {
} else if (OwerEnum.MY.getCode().equals(pageParam.get("my"))) {
// 不指定隐患id-我的任务
JSONObject allTaskResult = workflowFeignService.getCurrentUserAllTaskList(workflowProcessDefinitionKey);
allTaskList = (List) allTaskResult.get("data");
List<String> instanceIdList = Lists.newArrayList();
List<LatentDanger> dangers;
if (!ValidationUtil.isEmpty(allTaskList)) {
allTaskList.forEach(m -> instanceIdList.add(((Map)m).get("processInstanceId").toString()));
allTaskList.forEach(m -> instanceIdList.add(((Map) m).get("processInstanceId").toString()));
dangers =
this.baseMapper.selectList(new LambdaQueryWrapper<LatentDanger>().in(LatentDanger::getInstanceId, instanceIdList));
List<String> finalDangerIdList = dangerIdList;
......@@ -1726,37 +1736,34 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
LambdaQueryWrapper<LatentDanger> queryWrapper = new LambdaQueryWrapper();
queryWrapper.like(!ValidationUtil.isEmpty(pageParam.get("name")),
queryWrapper.eq(LatentDanger::getBizType, bizType)
.eq(LatentDanger::getDeleted, false)
.like(!ValidationUtil.isEmpty(pageParam.get("name")),
LatentDanger::getDangerName, pageParam.get("name"))
.eq(!ValidationUtil.isEmpty(pageParam.get("dangerLevel")), LatentDanger::getDangerLevel,
pageParam.get("dangerLevel"))
.eq(!ValidationUtil.isEmpty(pageParam.get("dangerState")), LatentDanger::getDangerState,
.in(!ValidationUtil.isEmpty(pageParam.get("dangerState")), LatentDanger::getDangerState,
pageParam.get("dangerState"))
.eq(LatentDanger::getDeleted, false)
.in(!ValidationUtil.isEmpty(dangerIdList), LatentDanger::getId, dangerIdList)
.in(!ValidationUtil.isEmpty(structureIdList), LatentDanger::getStructureId, structureIdList)
.orderByDesc(DESC == order, LatentDanger::getUpdateDate);
return latentDangerMapper.selectPage(page, queryWrapper);
.orderByDesc(Constants.DESC.equals(order), LatentDanger::getUpdateDate);
// List<DangerListResponse> dangerListResponseList = latentDangerMapper.dangerListByMap(pageParam);
// Map<Long, String> buildingAbsolutePositionMap = new HashMap<>();
// try {
// LinkedHashMap<String, Object> buildingAbsolutePosition = (LinkedHashMap<String, Object>) equipFeign.getBuildingAbsolutePosition().getResult();
// if (buildingAbsolutePosition == null || !"200".equals(buildingAbsolutePosition.get("status").toString())) {
// throw new YeeException("获取建筑树出错");
// }
// buildingAbsolutePositionMap = (Map<Long, String>) buildingAbsolutePosition.get("result");
// } catch (Exception e) {
// }
// if (!dangerListResponseList.isEmpty()) {
// Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap;
// dangerListResponseList.forEach(danger -> danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId())));
// }
// Long count = latentDangerMapper.countDangerListByMap(pageParam);
// if (CollectionUtils.isEmpty(dangerListResponseList)) {
// return new PageImpl<>(dangerListResponseList, pageParam, 0L);
// }
// return new PageImpl<>(dangerList(dangerListResponseList), pageParam, count);
IPage<LatentDanger> iPage = latentDangerMapper.selectPage(page, queryWrapper);
Map<Long, String> buildingAbsolutePositionMap = new HashMap<>();
try {
LinkedHashMap<String, Object> buildingAbsolutePosition = (LinkedHashMap<String, Object>) equipFeign.getBuildingAbsolutePosition().getResult();
if (buildingAbsolutePosition == null || !"200".equals(buildingAbsolutePosition.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
buildingAbsolutePositionMap = (Map<Long, String>) buildingAbsolutePosition.get("result");
} catch (Exception e) {
}
if (!iPage.getRecords().isEmpty()) {
Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap;
iPage.getRecords().forEach(danger -> danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId())));
}
return latentDangerMapper.selectPage(page, queryWrapper);
}
private List<Map<String, Object>> getAllNodes(List<Map<String, Object>> buildingTree) {
......@@ -1853,7 +1860,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override
public List<LatentDanger> listAllDanger(LatentDangerListParam searchParam) {
String bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
LambdaQueryWrapper<LatentDanger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(LatentDanger::getBizType, bizType);
lambdaQueryWrapper.eq(LatentDanger::getDeleted, false);
......@@ -1902,7 +1908,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override
public List<Map<String, String>> getDangerState() {
String bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
if (LatentDangerBizTypeEnum.防火监督.getCode().equals(bizType)) {
return LatentDangerState.SupervisionDangerStateEnum.getEnumList();
} else {
......@@ -1910,16 +1915,18 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
}
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public Object dangerAudit(LatentDangerDto latentDangerDto, Integer executeType, String userId, String userName,
public ExecuteSubmitDto dangerAudit(LatentDangerDto latentDangerDto, Integer executeType, String userId, String userName,
String deptId, String deptName, ReginParams reginParams) throws Exception {
LatentDanger latentDanger = this.baseMapper.selectById(latentDangerDto.getId());
Bean.copyExistPropertis(latentDangerDto, latentDanger);
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
if (ValidationUtil.isEmpty(latentDanger)) {
throw new Exception("隐患不存");
}
Bean.copyExistPropertis(latentDangerDto, latentDanger);
if (!ValidationUtil.isEmpty(latentDangerDto.getPhotoUrl())) {
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
}
this.updateById(latentDanger);
DangerExecuteSubmitDto executeSubmitDto = new DangerExecuteSubmitDto();
......@@ -1928,20 +1935,25 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
executeSubmit(executeParam, latentDanger, userId, userName, deptId, deptName, executeSubmitDto, reginParams);
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
return true;
return executeSubmitDto;
}
@Override
public IPage<LatentDanger> reviewListDanger(PageParam pageParam) throws Exception {
String type = pageParam.get("type").toString();
if ("audit".equals(type)) {
pageParam.put("dangerState", LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode());
List<LatentDangerState.SupervisionDangerStateEnum> stateEnums =
LatentDangerState.SupervisionDangerStateEnum.getEnumListByProcessState("审核中");
String dangerState = Joiner.on(",").join(stateEnums.stream().map(stateEnum -> stateEnum != null ? stateEnum.getCode() : null).collect(Collectors.toList()));
// 审核状态
pageParam.put("dangerState", dangerState);
} else if ("review".equals(type)) {
pageParam.put("dangerState", LatentDangerState.SupervisionDangerStateEnum.提交整改资料.getCode());
List<LatentDangerState.SupervisionDangerStateEnum> stateEnums =
LatentDangerState.SupervisionDangerStateEnum.getEnumListByProcessState("整改中");
String dangerState = Joiner.on(",").join(stateEnums.stream().map(stateEnum -> stateEnum != null ? stateEnum.getCode() : null).collect(Collectors.toList()));
// 复核状态
pageParam.put("dangerState", dangerState);
}
return listDanger(pageParam);
return pageListDanger(pageParam);
}
}
......@@ -6,6 +6,7 @@ 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.dto.ExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam;
import com.yeejoin.amos.latentdanger.business.param.PageParam;
......@@ -99,7 +100,7 @@ public interface ILatentDangerService {
*/
JSONObject getReviewInfo(Long dangerId);
IPage<LatentDanger> listDanger(PageParam pageParam) throws Exception;
IPage<LatentDanger> pageListDanger(PageParam pageParam) throws Exception;
List<DangerListResponse> export(PageParam pageParam);
......@@ -136,7 +137,7 @@ public interface ILatentDangerService {
* @param executeType 执行类型(通过0、驳回1)
* @exception Exception
*/
Object dangerAudit(LatentDangerDto latentDangerDto, Integer executeType, String userId, String userName,
ExecuteSubmitDto dangerAudit(LatentDangerDto latentDangerDto, Integer executeType, String userId, String userName,
String deptId, String deptName, ReginParams reginParams) throws Exception;
/**
......
package com.yeejoin.amos.latentdanger.business.vo;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerFlowRecordBo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.checkerframework.checker.units.qual.A;
import java.util.Date;
import java.util.List;
......@@ -13,44 +16,61 @@ import java.util.List;
@Data
public class LatentDangerDetailVo {
@ApiModelProperty(value = "隐患主键")
private Long id;
@ApiModelProperty(value = "隐患编号")
private String businessKey;
@ApiModelProperty(value = "隐患名称")
private String dangerName;
@ApiModelProperty(value = "业务id")
private Long bizId;
@ApiModelProperty(value = "隐患等级")
private String dangerLevel;
@ApiModelProperty(value = "隐患等级名称")
private String dangerLevelName;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "隐患地点")
private String dangerPosition;
@ApiModelProperty(value = "整改类型")
private String reformTypeName;
@ApiModelProperty(value = "整改限制时间")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reformLimitDate;
private String reformLimitDateStr;
@ApiModelProperty(value = "整改对象")
private JSONObject reformJson;
@ApiModelProperty(value = "当前流程节点记录id")
private Long currentFlowRecordId;
@ApiModelProperty(value = "隐患状态名称")
private String dangerState;
@ApiModelProperty(value = "隐患状态名称")
private String dangerStateName;
private String dangerType;
private String dangerTypeName;
@ApiModelProperty(value = "检查类型")
private String checkMode;
public String getCheckMode() {
return this.dangerType;
}
@ApiModelProperty(value = "检查类型名称")
private String checkModeName;
public String getCheckModeName() {
......@@ -59,16 +79,21 @@ public class LatentDangerDetailVo {
private Boolean currentUserCanExecute;
@ApiModelProperty(value = "隐患图片信息")
private List<String> photoUrl;
private LatentDangerDetailRiskVo riskInfo;
@ApiModelProperty(value = "复审信息")
private JSONObject reviewInfo;
@ApiModelProperty(value = "整改信息")
private JSONObject reformInfo;
@ApiModelProperty(value = "复查信息")
private JSONObject recheckInfo;
@ApiModelProperty(value = "流程信息")
private List<LatentDangerFlowRecordBo> records;
private Date delayLimitDate;
......@@ -81,5 +106,19 @@ public class LatentDangerDetailVo {
private String taskId;
@ApiModelProperty(value = "业务信息")
private JSONObject bizInfo;
@ApiModelProperty(value = "提交时间")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "审核信息")
private JSONObject flowJson;
}
......@@ -11,6 +11,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -29,6 +30,9 @@ public class EnumFillAop {
@Autowired
RedisUtils redisUtils;
@Value("${danger.biz.type}")
private String bizType;
@Pointcut("execution(public * com.yeejoin.amos.latentdanger.business.controller..*(..))")
public void fillEnum() {
......@@ -37,19 +41,6 @@ public class EnumFillAop {
@Before("fillEnum()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
String bizType = request.getHeader("bizType");
if (bizType == null) {
bizType = request.getParameter("bizType");
}
if (!redisUtils.hasKey(Constants.DANGER_BIZ_TYPE_KEY)) {
redisUtils.set(Constants.DANGER_BIZ_TYPE_KEY, bizType);
}
if (bizType == null) {
bizType = redisUtils.get(Constants.DANGER_BIZ_TYPE_KEY).toString();
}
// 获取隐患等级枚举
if (ValidationUtil.isEmpty(LatentDangerLevelEnum.enumMap)) {
List<DictionarieValueModel> dicResult =
......
......@@ -182,7 +182,7 @@
from
cb_latent_danger_flow_record
where
deleted = 0
1 = 1
and
danger_id = #{dangerId}
</select>
......
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