Commit 7c37c4c4 authored by xinglei's avatar xinglei

*)增加查询巡检接口

parent 32e7af7c
...@@ -224,7 +224,6 @@ public class InputItem extends BasicEntity { ...@@ -224,7 +224,6 @@ public class InputItem extends BasicEntity {
/** /**
* 扩展属性 * 扩展属性
*/ */
@Transient
private String ext; private String ext;
public Integer getItemStart() { public Integer getItemStart() {
...@@ -515,6 +514,7 @@ public class InputItem extends BasicEntity { ...@@ -515,6 +514,7 @@ public class InputItem extends BasicEntity {
this.checkTypeId = checkTypeId; this.checkTypeId = checkTypeId;
} }
@Transient
public String getExt() { public String getExt() {
return ext; return ext;
} }
......
...@@ -302,9 +302,9 @@ public class LatentDangerController extends AbstractBaseController { ...@@ -302,9 +302,9 @@ public class LatentDangerController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检隐患信息", notes = "查询巡检隐患信息") @ApiOperation(value = "查询巡检信息", notes = "查询巡检信息")
@GetMapping(value = "/patrol/danger/info") @PostMapping(value = "/patrol/danger/info")
public CommonResponse getPatrolDangerInfo(@RequestParam JSONObject param) { public CommonResponse getPatrolDangerInfo(@RequestBody(required = false) JSONObject param) {
return CommonResponseUtil.success(iLatentDangerService.getPatrolDangerInfo(param)); return CommonResponseUtil.success(iLatentDangerService.getPatrolDangerInfo(param));
} }
} }
package com.yeejoin.amos.supervision.business.service.impl; package com.yeejoin.amos.supervision.business.service.impl;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct;
import java.net.InetAddress;
import java.util.ArrayList;
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;
import java.util.Set;
import java.util.stream.Collectors;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.service.intfc.ILatentDangerService;
import com.yeejoin.amos.supervision.business.service.intfc.IRiskJudgmentTaskService;
import com.yeejoin.amos.supervision.business.vo.DangerTimeAxisVo;
import com.yeejoin.amos.supervision.business.vo.LatentDangerDetailRiskVo;
import com.yeejoin.amos.supervision.business.vo.LatentDangerDetailVo;
import com.yeejoin.amos.supervision.business.vo.LatentDangerListVo;
import com.yeejoin.amos.supervision.common.remote.RemoteSpcService;
import com.yeejoin.amos.supervision.common.remote.RemoteWebSocketServer;
import com.yeejoin.amos.supervision.common.remote.RemoteWorkFlowService;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.core.util.StringUtil;
import com.yeejoin.amos.supervision.exception.YeeException;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import com.yeejoin.amos.supervision.mqtt.WebMqttComponent;
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.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -55,13 +11,8 @@ import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo; ...@@ -55,13 +11,8 @@ import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo; import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.supervision.business.dao.mapper.CheckInputMapper; import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.LatentDangerFlowRecordMapper; import com.yeejoin.amos.supervision.business.dao.mapper.*;
import com.yeejoin.amos.supervision.business.dao.mapper.LatentDangerMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.LatentDangerPatrolMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.RiskFactorCmMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.RiskFactorMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.RiskSourceMapper;
import com.yeejoin.amos.supervision.business.dao.repository.ICheckDao; import com.yeejoin.amos.supervision.business.dao.repository.ICheckDao;
import com.yeejoin.amos.supervision.business.dao.repository.ICheckShotDao; import com.yeejoin.amos.supervision.business.dao.repository.ICheckShotDao;
import com.yeejoin.amos.supervision.business.dao.repository.IInputItemDao; import com.yeejoin.amos.supervision.business.dao.repository.IInputItemDao;
...@@ -78,36 +29,54 @@ import com.yeejoin.amos.supervision.business.entity.mybatis.extend.LatentDangerN ...@@ -78,36 +29,54 @@ import com.yeejoin.amos.supervision.business.entity.mybatis.extend.LatentDangerN
import com.yeejoin.amos.supervision.business.entity.mybatis.extend.LatentDangerPatrolBo; import com.yeejoin.amos.supervision.business.entity.mybatis.extend.LatentDangerPatrolBo;
import com.yeejoin.amos.supervision.business.feign.Business; import com.yeejoin.amos.supervision.business.feign.Business;
import com.yeejoin.amos.supervision.business.feign.EquipFeign; import com.yeejoin.amos.supervision.business.feign.EquipFeign;
import com.yeejoin.amos.supervision.business.param.LatentDangerExcuteParam; import com.yeejoin.amos.supervision.business.param.*;
import com.yeejoin.amos.supervision.business.param.LatentDangerListParam; import com.yeejoin.amos.supervision.business.service.intfc.ILatentDangerService;
import com.yeejoin.amos.supervision.business.param.LatentDangerNormalParam; import com.yeejoin.amos.supervision.business.service.intfc.IRiskJudgmentTaskService;
import com.yeejoin.amos.supervision.business.param.LatentDangerPatrolItemParam;
import com.yeejoin.amos.supervision.business.param.LatentDangerPatrolParam;
import com.yeejoin.amos.supervision.business.param.PageParam;
import com.yeejoin.amos.supervision.business.util.CommonResponse; import com.yeejoin.amos.supervision.business.util.CommonResponse;
import com.yeejoin.amos.supervision.business.util.CommonResponseUtil; import com.yeejoin.amos.supervision.business.util.CommonResponseUtil;
import com.yeejoin.amos.supervision.business.util.DateUtil; import com.yeejoin.amos.supervision.business.util.DateUtil;
import com.yeejoin.amos.supervision.business.util.RandomUtil; import com.yeejoin.amos.supervision.business.util.RandomUtil;
import com.yeejoin.amos.supervision.common.enums.CheckModeEnum; import com.yeejoin.amos.supervision.business.vo.DangerTimeAxisVo;
import com.yeejoin.amos.supervision.common.enums.DangerHandleStateEnum; import com.yeejoin.amos.supervision.business.vo.LatentDangerDetailRiskVo;
import com.yeejoin.amos.supervision.common.enums.DictTypeEnum; import com.yeejoin.amos.supervision.business.vo.LatentDangerDetailVo;
import com.yeejoin.amos.supervision.common.enums.ExecuteStateEnum; import com.yeejoin.amos.supervision.business.vo.LatentDangerListVo;
import com.yeejoin.amos.supervision.common.enums.InstanceKeyEnum; import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.supervision.common.enums.LatentDangerExcuteTypeEnum; import com.yeejoin.amos.supervision.common.remote.RemoteSpcService;
import com.yeejoin.amos.supervision.common.enums.LatentDangerLevelEnum; import com.yeejoin.amos.supervision.common.remote.RemoteWebSocketServer;
import com.yeejoin.amos.supervision.common.enums.LatentDangerOvertimeStateEnum; import com.yeejoin.amos.supervision.common.remote.RemoteWorkFlowService;
import com.yeejoin.amos.supervision.common.enums.LatentDangerReformTypeEnum; import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.common.enums.LatentDangerStateEnum;
import com.yeejoin.amos.supervision.common.enums.LatentDangerTypeEnum;
import com.yeejoin.amos.supervision.common.enums.RiskFactorsCmStatusEnum;
import com.yeejoin.amos.supervision.core.common.request.LatentDangerResultPushSpcRequest; import com.yeejoin.amos.supervision.core.common.request.LatentDangerResultPushSpcRequest;
import com.yeejoin.amos.supervision.core.common.response.DangerListResponse; import com.yeejoin.amos.supervision.core.common.response.DangerListResponse;
import com.yeejoin.amos.supervision.core.util.StringUtil;
import com.yeejoin.amos.supervision.dao.entity.Check; import com.yeejoin.amos.supervision.dao.entity.Check;
import com.yeejoin.amos.supervision.dao.entity.CheckShot; import com.yeejoin.amos.supervision.dao.entity.CheckShot;
import com.yeejoin.amos.supervision.dao.entity.InputItem; import com.yeejoin.amos.supervision.dao.entity.InputItem;
import com.yeejoin.amos.supervision.dao.entity.PointClassify; import com.yeejoin.amos.supervision.dao.entity.PointClassify;
import com.yeejoin.amos.supervision.exception.YeeException;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import com.yeejoin.amos.supervision.mqtt.WebMqttComponent;
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.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.net.InetAddress;
import java.util.*;
import java.util.stream.Collectors;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct;
@Service("latentDangerService") @Service("latentDangerService")
public class LatentDangerServiceImpl implements ILatentDangerService { public class LatentDangerServiceImpl implements ILatentDangerService {
...@@ -179,11 +148,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -179,11 +148,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
@Value("${server.port}") @Value("${server.port}")
private String port; private String port;
// @Value("${LatentDanger.flow.photoUrls}") // @Value("${LatentDanger.flow.photoUrls}")
// private String photoUrlPre; // private String photoUrlPre;
@Value("${file.url}") @Value("${file.url}")
private String fileUrl; private String fileUrl;
@Value("${file.url}") @Value("${file.url}")
private String fileServerAddress; private String fileServerAddress;
...@@ -197,14 +166,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -197,14 +166,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
private String dangerTopic; private String dangerTopic;
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
@Transactional @Transactional
@Override @Override
public CommonResponse saveNormal(LatentDangerNormalParam latentDangerParam, String userId, String userRealName, String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) { public CommonResponse saveNormal(LatentDangerNormalParam latentDangerParam, String userId, String userRealName, String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) {
String businessKey = RandomUtil.buildOrderNo(); String businessKey = RandomUtil.buildOrderNo();
LatentDangerBo latentDangerBo = saveLatentDanger("", "", latentDangerParam.getRemark(), LatentDangerBo latentDangerBo = saveLatentDanger("", "", latentDangerParam.getRemark(),
userId, departmentId, businessKey, orgCode, latentDangerParam.getDangerName(), latentDangerParam.getDangerLevel() userId, departmentId, businessKey, orgCode, latentDangerParam.getDangerName(), latentDangerParam.getDangerLevel()
, latentDangerParam.getDangerPosition(), LatentDangerTypeEnum.随手拍, , latentDangerParam.getDangerPosition(), LatentDangerTypeEnum.随手拍,
latentDangerParam.getPhotoUrls(), 0L, latentDangerParam.getStructureId(), latentDangerParam.getStructureName(), InstanceKeyEnum.NORMAL.getCode()); latentDangerParam.getPhotoUrls(), 0L, latentDangerParam.getStructureId(), latentDangerParam.getStructureName(), InstanceKeyEnum.NORMAL.getCode());
// 更新p_check_input表state字段(非巡检隐患不需要更新该表) // 更新p_check_input表state字段(非巡检隐患不需要更新该表)
// updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode()); // updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode());
Long dangerId = latentDangerBo.getId(); Long dangerId = latentDangerBo.getId();
...@@ -214,13 +184,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -214,13 +184,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// return CommonResponseUtil.failure(jsonObject.getString("msg")); // return CommonResponseUtil.failure(jsonObject.getString("msg"));
// } // }
Date endDate = new Date(); Date endDate = new Date();
logger.info("-------------------------提交隐患时间" +(endDate.getTime()-startDate.getTime())); logger.info("-------------------------提交隐患时间" + (endDate.getTime() - startDate.getTime()));
if (jsonObject == null) { if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return CommonResponseUtil.failure("启动流程失败"); return CommonResponseUtil.failure("启动流程失败");
} }
JSONObject instance = jsonObject.getJSONObject("data"); JSONObject instance = jsonObject.getJSONObject("data");
if(instance==null){ if (instance == null) {
return CommonResponseUtil.failure("无提交隐患权限"); return CommonResponseUtil.failure("无提交隐患权限");
} }
//提交隐患 //提交隐患
...@@ -229,15 +199,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -229,15 +199,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setInstanceId(instance.getString("id")); latentDangerBo.setInstanceId(instance.getString("id"));
JSONObject flowJson = new JSONObject(); JSONObject flowJson = new JSONObject();
flowJson.put("photoUrls", latentDangerParam.getPhotoUrls()); flowJson.put("photoUrls", latentDangerParam.getPhotoUrls());
LatentDangerFlowRecordBo record = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId, flowJson, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(),latentDangerParam.getRemark()); LatentDangerFlowRecordBo record = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId, flowJson, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(), latentDangerParam.getRemark());
latentDangerBo.setCurrentFlowRecordId(record.getId()); latentDangerBo.setCurrentFlowRecordId(record.getId());
latentDangerMapper.update(latentDangerBo); latentDangerMapper.update(latentDangerBo);
sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, null, sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, null,
"隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName); "隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
try { try {
webMqttComponent.publish(dangerTopic, ""); webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){ } catch (Exception e) {
logger.error("隐患提交数字换流站页面推送失败-----------"+e.getMessage()); logger.error("隐患提交数字换流站页面推送失败-----------" + e.getMessage());
} }
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
...@@ -254,20 +224,20 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -254,20 +224,20 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// Set<String> inputUserIdsStr = getUserIdsStrByTypeAndDefKey("B_1"); // Set<String> inputUserIdsStr = getUserIdsStrByTypeAndDefKey("B_1");
// Set<String> reviewUserIdsStr = getUserIdsStrByTypeAndDefKey("B_2"); // Set<String> reviewUserIdsStr = getUserIdsStrByTypeAndDefKey("B_2");
//获取装备全路径 //获取装备全路径
LinkedHashMap<String,Object> positionAll = equipFeign.getBuildingAbsolutePosition(); LinkedHashMap<String, Object> positionAll = equipFeign.getBuildingAbsolutePosition();
LinkedHashMap<String,Object> position = new LinkedHashMap<>(); LinkedHashMap<String, Object> position = new LinkedHashMap<>();
if("200".equals(positionAll.get("status").toString())){ if ("200".equals(positionAll.get("status").toString())) {
position = (LinkedHashMap<String, Object>) positionAll.get("result"); position = (LinkedHashMap<String, Object>) positionAll.get("result");
} }
for (LatentDangerPatrolItemParam param : itemList) { for (LatentDangerPatrolItemParam param : itemList) {
InputCheckDto inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(checkId, InputCheckDto inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(checkId,
param.getItemId(), param.getRoutePointItemId(), null); param.getItemId(), param.getRoutePointItemId(), null);
if (CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) { if (CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
// 如果是外来检查,这里itemList里面无法区分InputCheckDto... // 如果是外来检查,这里itemList里面无法区分InputCheckDto...
// 在LatentDangerPatrolItemParam中增加checkInputId字段来区分 // 在LatentDangerPatrolItemParam中增加checkInputId字段来区分
inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(null, null, inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(null, null,
null, param.getCheckInputId()); null, param.getCheckInputId());
} }
if (inputCheckDto == null) { if (inputCheckDto == null) {
return CommonResponseUtil.failure("检查项不存在"); return CommonResponseUtil.failure("检查项不存在");
...@@ -284,7 +254,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -284,7 +254,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
String remark = param.getRemark(); String remark = param.getRemark();
String photoUrls = ""; String photoUrls = "";
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(inputCheckDto.getCheckId(), List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(inputCheckDto.getCheckId(),
inputCheckDto.getCheckInputId()); inputCheckDto.getCheckInputId());
if (!CollectionUtils.isEmpty(checkShots)) { if (!CollectionUtils.isEmpty(checkShots)) {
List<String> photos = checkShots.stream().map(e -> { List<String> photos = checkShots.stream().map(e -> {
if (e != null) { if (e != null) {
...@@ -304,37 +274,37 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -304,37 +274,37 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} else { } else {
dangerTypeEnum = LatentDangerTypeEnum.无计划检查; dangerTypeEnum = LatentDangerTypeEnum.无计划检查;
} }
if(org.apache.commons.lang3.StringUtils.isNotEmpty(param.getName())){ if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getName())) {
dangerName = param.getName(); dangerName = param.getName();
}else { } else {
dangerName = inputItem.getName(); dangerName = inputItem.getName();
} }
Long riskSourceId = null; Long riskSourceId = null;
if(org.apache.commons.lang3.StringUtils.isNotEmpty(inputCheckDto.getRiskSourceId())){ if (org.apache.commons.lang3.StringUtils.isNotEmpty(inputCheckDto.getRiskSourceId())) {
riskSourceId = Long.parseLong(inputCheckDto.getRiskSourceId()); riskSourceId = Long.parseLong(inputCheckDto.getRiskSourceId());
} }
LatentDangerBo latentDangerBo = saveLatentDanger("", param.getRemark(), remark, userId, departmentId, LatentDangerBo latentDangerBo = saveLatentDanger("", param.getRemark(), remark, userId, departmentId,
businessKey, orgCode, dangerName, levelEnum.getCode(), businessKey, orgCode, dangerName, levelEnum.getCode(),
null, dangerTypeEnum, photoUrls, inputCheckDto.getCheckInputId(), riskSourceId, null, dangerTypeEnum, photoUrls, inputCheckDto.getCheckInputId(), riskSourceId,
position.get(inputCheckDto.getRiskSourceId())==null?"":position.get(inputCheckDto.getRiskSourceId()).toString(), InstanceKeyEnum.PATROL.getCode()); position.get(inputCheckDto.getRiskSourceId()) == null ? "" : position.get(inputCheckDto.getRiskSourceId()).toString(), InstanceKeyEnum.PATROL.getCode());
// 更新p_check_input表state字段 // 更新p_check_input表state字段
updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode()); updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode());
Long dangerId = latentDangerBo.getId(); Long dangerId = latentDangerBo.getId();
Date startDate = new Date(); Date startDate = new Date();
JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey); JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey);
Date endDate = new Date(); Date endDate = new Date();
logger.info("-------------------------提交隐患时间" +(endDate.getTime()-startDate.getTime())); logger.info("-------------------------提交隐患时间" + (endDate.getTime() - startDate.getTime()));
if (jsonObject == null) { if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return CommonResponseUtil.failure("启动流程失败"); return CommonResponseUtil.failure("启动流程失败");
} }
JSONObject instance = jsonObject.getJSONObject("data"); JSONObject instance = jsonObject.getJSONObject("data");
if(instance==null){ if (instance == null) {
return CommonResponseUtil.failure("无提交隐患权限"); return CommonResponseUtil.failure("无提交隐患权限");
} }
LatentDangerFlowRecordBo inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId, LatentDangerFlowRecordBo inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId,
null, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(),latentDangerBo.getRemark()); null, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(), latentDangerBo.getRemark());
JSONObject flowJson = new JSONObject(); JSONObject flowJson = new JSONObject();
flowJson.put("photoUrls", photoUrls); flowJson.put("photoUrls", photoUrls);
...@@ -357,11 +327,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -357,11 +327,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
//修改管控措施的状态为失效 //修改管控措施的状态为失效
LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId()); LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, patrolBo, sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, patrolBo,
"巡检隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName); "巡检隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
try { try {
webMqttComponent.publish(dangerTopic, ""); webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){ } catch (Exception e) {
logger.error("巡检隐患提交数字换流站页面推送失败-----------"+e.getMessage()); logger.error("巡检隐患提交数字换流站页面推送失败-----------" + e.getMessage());
} }
} }
return CommonResponseUtil.success(); return CommonResponseUtil.success();
...@@ -416,11 +386,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -416,11 +386,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setDangerPosition(position); latentDangerBo.setDangerPosition(position);
latentDangerBo.setDangerType(dangerTypeEnum.getCode()); latentDangerBo.setDangerType(dangerTypeEnum.getCode());
StringBuilder photoUrlsB = new StringBuilder(); StringBuilder photoUrlsB = new StringBuilder();
if(org.apache.commons.lang3.StringUtils.isNotBlank(photoUrls)){ if (org.apache.commons.lang3.StringUtils.isNotBlank(photoUrls)) {
String[] photoUrlsList = photoUrls.split(","); String[] photoUrlsList = photoUrls.split(",");
for (String url : photoUrlsList) { for (String url : photoUrlsList) {
if (!"".equals(url)){ if (!"".equals(url)) {
photoUrlsB.append(fileUrl+url); photoUrlsB.append(fileUrl + url);
photoUrlsB.append(","); photoUrlsB.append(",");
} }
} }
...@@ -435,13 +405,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -435,13 +405,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
public LatentDangerFlowRecordBo saveFlowRecord(String taskId, String taskName, String userId, String departmentId, public LatentDangerFlowRecordBo 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) {
LatentDangerFlowRecordBo record = new LatentDangerFlowRecordBo(); LatentDangerFlowRecordBo record = new LatentDangerFlowRecordBo();
record.setFlowTaskId(taskId); record.setFlowTaskId(taskId);
record.setExcuteUserId(userId); record.setExcuteUserId(userId);
record.setExcuteDepartmentId(departmentId); record.setExcuteDepartmentId(departmentId);
if(flowJson != null && org.apache.commons.lang3.StringUtils.isNotBlank(flowJson.getString("photoUrls"))){ if (flowJson != null && org.apache.commons.lang3.StringUtils.isNotBlank(flowJson.getString("photoUrls"))) {
flowJson.put("photoUrls",fileUrl+flowJson.getString("photoUrls")); flowJson.put("photoUrls", fileUrl + flowJson.getString("photoUrls"));
} }
record.setFlowJson(flowJson != null ? flowJson.toJSONString() : null); record.setFlowJson(flowJson != null ? flowJson.toJSONString() : null);
record.setFlowTaskName(taskName); record.setFlowTaskName(taskName);
...@@ -539,16 +509,16 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -539,16 +509,16 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
@Override @Override
public CommonResponse list(String toke, String product, String appKey, LatentDangerListParam latentDangerListParam, AgencyUserModel user, String loginOrgCode, String deptId) { public CommonResponse list(String toke, String product, String appKey, LatentDangerListParam latentDangerListParam, AgencyUserModel user, String loginOrgCode, String deptId) {
JSONObject respBody; JSONObject respBody;
Date startDate = new Date(); Date startDate = new Date();
if (latentDangerListParam.getIsHandle()) { if (latentDangerListParam.getIsHandle()) {
respBody = remoteWorkFlowService.completedPageTask(user.getUserName(),latentDangerListParam.getBelongType()); respBody = remoteWorkFlowService.completedPageTask(user.getUserName(), latentDangerListParam.getBelongType());
} else { } else {
respBody = remoteWorkFlowService.pageTask(user.getUserId(),latentDangerListParam.getBelongType()); respBody = remoteWorkFlowService.pageTask(user.getUserId(), latentDangerListParam.getBelongType());
} }
Date endDate = new Date(); Date endDate = new Date();
logger.info("-------------------------工作流列表时间" +(endDate.getTime()-startDate.getTime())); logger.info("-------------------------工作流列表时间" + (endDate.getTime() - startDate.getTime()));
JSONArray taskJsonList = respBody.getJSONArray("data"); JSONArray taskJsonList = respBody.getJSONArray("data");
List<JSONObject> taskList = JSONObject.parseArray(taskJsonList.toJSONString(), JSONObject.class); List<JSONObject> taskList = JSONObject.parseArray(taskJsonList.toJSONString(), JSONObject.class);
List<String> bussinessKeys = new ArrayList<>(); List<String> bussinessKeys = new ArrayList<>();
...@@ -564,11 +534,12 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -564,11 +534,12 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (0 == latentDangerListParam.getDangerState()) { if (0 == latentDangerListParam.getDangerState()) {
latentDangerListParam.setDangerState(null); latentDangerListParam.setDangerState(null);
} }
Date startDate1 = new Date();; Date startDate1 = new Date();
;
int dangerListSize = latentDangerMapper.countByBathBusinessKeys(bussinessKeys, latentDangerListParam); int dangerListSize = latentDangerMapper.countByBathBusinessKeys(bussinessKeys, latentDangerListParam);
List<LatentDangerBo> dangerList = latentDangerMapper.getByBathBusinessKeys(bussinessKeys, latentDangerListParam); List<LatentDangerBo> dangerList = latentDangerMapper.getByBathBusinessKeys(bussinessKeys, latentDangerListParam);
Date endDate1 = new Date(); Date endDate1 = new Date();
logger.info("-------------------------sql时间" +(endDate1.getTime()-startDate1.getTime())); logger.info("-------------------------sql时间" + (endDate1.getTime() - startDate1.getTime()));
// Map<String, Object> map = buildQueryMapForList(latentDangerListParam, userId); // Map<String, Object> map = buildQueryMapForList(latentDangerListParam, userId);
// map.put("org_code", loginOrgCode); // map.put("org_code", loginOrgCode);
// map.put("discoverer_department_id", deptId); // map.put("discoverer_department_id", deptId);
...@@ -681,8 +652,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -681,8 +652,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (StringUtil.isNotEmpty(latentDangerExcuteParam.getDangerId())) { if (StringUtil.isNotEmpty(latentDangerExcuteParam.getDangerId())) {
latentDangerBo = latentDangerMapper.getById(latentDangerExcuteParam.getDangerId()); latentDangerBo = latentDangerMapper.getById(latentDangerExcuteParam.getDangerId());
} }
if(StringUtil.isNotEmpty(latentDangerExcuteParam.getReformLimitDate())){ if (StringUtil.isNotEmpty(latentDangerExcuteParam.getReformLimitDate())) {
latentDangerExcuteParam.setReformLimitDate(latentDangerExcuteParam.getReformLimitDate()+" 23:59:59"); latentDangerExcuteParam.setReformLimitDate(latentDangerExcuteParam.getReformLimitDate() + " 23:59:59");
} }
LatentDangerExcuteTypeEnum executeTypeEnum = LatentDangerExcuteTypeEnum.getByCode(latentDangerExcuteParam.getExcuteType()); LatentDangerExcuteTypeEnum executeTypeEnum = LatentDangerExcuteTypeEnum.getByCode(latentDangerExcuteParam.getExcuteType());
if (executeTypeEnum == null) { if (executeTypeEnum == null) {
...@@ -710,22 +681,22 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -710,22 +681,22 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
} }
DangerExecuteSubmitDto dangerExecuteSubmitDto= executeSubmit(latentDangerExcuteParam, executeTypeEnum, latentDangerBo, userId, userRealName, departmentId, departmentName, executeSubmitDto, role); DangerExecuteSubmitDto dangerExecuteSubmitDto = executeSubmit(latentDangerExcuteParam, executeTypeEnum, latentDangerBo, userId, userRealName, departmentId, departmentName, executeSubmitDto, role);
try { try {
webMqttComponent.publish(dangerTopic, ""); webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){ } catch (Exception e) {
logger.error("隐患执行提交数字换流站页面推送失败-----------"+e.getMessage()); logger.error("隐患执行提交数字换流站页面推送失败-----------" + e.getMessage());
} }
return dangerExecuteSubmitDto; return dangerExecuteSubmitDto;
} }
@Override @Override
public CommonResponse detail(String id, String userId,boolean isFinish) { public CommonResponse detail(String id, String userId, boolean isFinish) {
JSONObject jsonObject; JSONObject jsonObject;
if(isFinish==true){ if (isFinish == true) {
jsonObject = remoteWorkFlowService.queryFinishTaskDetail(id); jsonObject = remoteWorkFlowService.queryFinishTaskDetail(id);
}else{ } else {
jsonObject = remoteWorkFlowService.queryTaskDetail(id); jsonObject = remoteWorkFlowService.queryTaskDetail(id);
} }
...@@ -747,11 +718,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -747,11 +718,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// }else { // }else {
// detailVo.setPosition(latentDangerBo.getDangerPosition()); // detailVo.setPosition(latentDangerBo.getDangerPosition());
// } // }
if(StringUtils.isEmpty(latentDangerBo.getDangerPosition())){ if (StringUtils.isEmpty(latentDangerBo.getDangerPosition())) {
detailVo.setPosition(latentDangerBo.getStructureName()); detailVo.setPosition(latentDangerBo.getStructureName());
}else{ } else {
detailVo.setPosition(latentDangerBo.getStructureName()+"·"+latentDangerBo.getDangerPosition()); detailVo.setPosition(latentDangerBo.getStructureName() + "·" + latentDangerBo.getDangerPosition());
} }
detailVo.setDangerState(latentDangerBo.getDangerState()); detailVo.setDangerState(latentDangerBo.getDangerState());
detailVo.setProblemDescription(latentDangerBo.getProblemDescription()); detailVo.setProblemDescription(latentDangerBo.getProblemDescription());
...@@ -780,7 +751,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -780,7 +751,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
if (latentDangerBo.getDelayLimitDate() != null) { if (latentDangerBo.getDelayLimitDate() != null) {
detailVo.setDelayLimitDate(DateUtil.date2Str(latentDangerBo.getDelayLimitDate(), detailVo.setDelayLimitDate(DateUtil.date2Str(latentDangerBo.getDelayLimitDate(),
DateUtil.DATETIME_DEFAULT_FORMAT)); DateUtil.DATETIME_DEFAULT_FORMAT));
} }
// detailVo.setCurrentUserCanExcute(false); // detailVo.setCurrentUserCanExcute(false);
// if (!latentDangerBo.getCurrentFlowRecordId().equals(-1L)) { // if (!latentDangerBo.getCurrentFlowRecordId().equals(-1L)) {
...@@ -812,7 +783,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -812,7 +783,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (patrolBo != null) { if (patrolBo != null) {
LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo(); LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo();
List<String> basis = new ArrayList<>(); List<String> basis = new ArrayList<>();
if(!StringUtils.isEmpty(patrolBo.getItemBasis())){ if (!StringUtils.isEmpty(patrolBo.getItemBasis())) {
basis.add(patrolBo.getItemBasis()); basis.add(patrolBo.getItemBasis());
} }
riskVo.setBasis(basis); riskVo.setBasis(basis);
...@@ -821,19 +792,19 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -821,19 +792,19 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
riskVo.setPointLevel(StringUtil.isNotEmpty(patrolBo.getPointLevel()) ? patrolBo.getPointLevel() : ""); riskVo.setPointLevel(StringUtil.isNotEmpty(patrolBo.getPointLevel()) ? patrolBo.getPointLevel() : "");
riskVo.setPlanName(patrolBo.getPlanName()); riskVo.setPlanName(patrolBo.getPlanName());
riskVo.setCheckTime(patrolBo.getCheckTime()); riskVo.setCheckTime(patrolBo.getCheckTime());
AgencyUserModel checkUser = remoteSecurityService.getUserById(RequestContext.getToken(),RequestContext.getProduct(),RequestContext.getAppKey(), patrolBo.getCheckUserId()); AgencyUserModel checkUser = remoteSecurityService.getUserById(RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), patrolBo.getCheckUserId());
if (StringUtil.isNotEmpty(checkUser)) { if (StringUtil.isNotEmpty(checkUser)) {
riskVo.setCheckUser(checkUser.getRealName()); riskVo.setCheckUser(checkUser.getRealName());
} }
RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : null; RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : null;
if (riskFactorBo != null && riskFactorBo.getEquipmentDepartmentId() != null) { if (riskFactorBo != null && riskFactorBo.getEquipmentDepartmentId() != null) {
DepartmentModel department = remoteSecurityService.getDepartmentByDeptId(RequestContext.getToken(), getProduct(),RequestContext.getAppKey(),riskFactorBo.getEquipmentDepartmentId().toString()); DepartmentModel department = remoteSecurityService.getDepartmentByDeptId(RequestContext.getToken(), getProduct(), RequestContext.getAppKey(), riskFactorBo.getEquipmentDepartmentId().toString());
if (department != null) { if (department != null) {
riskVo.setBelongDepartmentName(department.getDepartmentName()); riskVo.setBelongDepartmentName(department.getDepartmentName());
} }
} }
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(patrolBo.getCheckId(), List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(patrolBo.getCheckId(),
latentDangerBo.getCheckInputId()); latentDangerBo.getCheckInputId());
if (!CollectionUtils.isEmpty(checkShots)) { if (!CollectionUtils.isEmpty(checkShots)) {
List<String> photos = Lists.transform(checkShots, e -> { List<String> photos = Lists.transform(checkShots, e -> {
if (e != null) { if (e != null) {
...@@ -865,7 +836,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -865,7 +836,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode())) { if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode())) {
patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId()); patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
JSONArray checkTypeArry = remoteSecurityService.listDictionaryByDictCode(RequestContext.getToken(), getProduct(), JSONArray checkTypeArry = remoteSecurityService.listDictionaryByDictCode(RequestContext.getToken(), getProduct(),
RequestContext.getAppKey(), XJConstant.CHECK_TYPE); RequestContext.getAppKey(), XJConstant.CHECK_TYPE);
Map<String, String> checkTypeMap = Maps.newHashMap(); Map<String, String> checkTypeMap = Maps.newHashMap();
for (int i = 0; i < checkTypeArry.size(); i++) { for (int i = 0; i < checkTypeArry.size(); i++) {
JSONObject categoryJson = checkTypeArry.getJSONObject(i); JSONObject categoryJson = checkTypeArry.getJSONObject(i);
...@@ -997,7 +968,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -997,7 +968,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
userIds = recordBo.getFlowTaskUserIds(); userIds = recordBo.getFlowTaskUserIds();
} }
LatentDangerFlowRecordBo record = saveFlowRecord(flowJson.getString("id"), userIds, LatentDangerFlowRecordBo record = saveFlowRecord(flowJson.getString("id"), userIds,
flowJson.getString("name"), flowJson.getString("taskDefinitionKey"), latentDangerBo.getId()); flowJson.getString("name"), flowJson.getString("taskDefinitionKey"), latentDangerBo.getId());
latentDangerBo.setCurrentFlowRecordId(record.getId()); latentDangerBo.setCurrentFlowRecordId(record.getId());
latentDangerBo.setDangerState(excuteTypeEnum.getNextState().getCode()); latentDangerBo.setDangerState(excuteTypeEnum.getNextState().getCode());
latentDangerMapper.update(latentDangerBo); latentDangerMapper.update(latentDangerBo);
...@@ -1014,7 +985,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1014,7 +985,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId()); LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
if (patrolBo.getClassifyOriginalId() != null && patrolBo.getItemOriginalId() != null) { if (patrolBo.getClassifyOriginalId() != null && patrolBo.getItemOriginalId() != null) {
updateMeasuresContentStatus(Long.valueOf(patrolBo.getClassifyOriginalId()), Long.valueOf(patrolBo.getItemOriginalId()), updateMeasuresContentStatus(Long.valueOf(patrolBo.getClassifyOriginalId()), Long.valueOf(patrolBo.getItemOriginalId()),
patrolBo.getRiskFactorFlowId(), RiskFactorsCmStatusEnum.Control); patrolBo.getRiskFactorFlowId(), RiskFactorsCmStatusEnum.Control);
} }
LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getByCode(latentDangerBo.getDangerLevel()); LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getByCode(latentDangerBo.getDangerLevel());
if (levelEnum != null) { if (levelEnum != null) {
...@@ -1045,7 +1016,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1045,7 +1016,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
userIds = recordBo.getFlowTaskUserIds(); userIds = recordBo.getFlowTaskUserIds();
} }
LatentDangerFlowRecordBo record = saveFlowRecord(flowJson.getString("id"), userIds, LatentDangerFlowRecordBo record = saveFlowRecord(flowJson.getString("id"), userIds,
flowJson.getString("name"), flowJson.getString("taskDefinitionKey"), latentDangerBo.getId()); flowJson.getString("name"), flowJson.getString("taskDefinitionKey"), latentDangerBo.getId());
latentDangerBo.setCurrentFlowRecordId(record.getId()); latentDangerBo.setCurrentFlowRecordId(record.getId());
latentDangerBo.setDangerState(excuteTypeEnum.getNextState().getCode()); latentDangerBo.setDangerState(excuteTypeEnum.getNextState().getCode());
latentDangerMapper.update(latentDangerBo); latentDangerMapper.update(latentDangerBo);
...@@ -1085,10 +1056,10 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1085,10 +1056,10 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
logger.info("隐患治理即将逾期通知》》》》"); logger.info("隐患治理即将逾期通知》》》》");
needNoticeDangerList.forEach(danger -> { needNoticeDangerList.forEach(danger -> {
asyncTask.pushLatentDangerReformLimitDateExpireMessage(this.getNextExecuteUsers(danger.getInstanceId()), asyncTask.pushLatentDangerReformLimitDateExpireMessage(this.getNextExecuteUsers(danger.getInstanceId()),
danger.getOrgCode(), danger.getOrgCode(),
danger.getDangerName(), DateUtil.date2Str(danger.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT), danger.getDangerName(), DateUtil.date2Str(danger.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT),
danger.getDangerId(), danger.getDangerId(),
danger.getDangerState(),""); danger.getDangerState(), "");
}); });
} }
} }
...@@ -1135,8 +1106,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1135,8 +1106,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
deptIds.add(e.getExcuteDepartmentId()); deptIds.add(e.getExcuteDepartmentId());
} }
}); });
List<DepartmentModel> departmentBos = remoteSecurityService.getlistDepartmentByDeptIds(token,product,appKey,Joiner.on(",").join(deptIds)); List<DepartmentModel> departmentBos = remoteSecurityService.getlistDepartmentByDeptIds(token, product, appKey, Joiner.on(",").join(deptIds));
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(token,product,appKey,Joiner.on(",").join(userIds)); List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(token, product, appKey, Joiner.on(",").join(userIds));
Map<String, AgencyUserModel> userMap = Maps.uniqueIndex(userModels, AgencyUserModel::getUserId); Map<String, AgencyUserModel> userMap = Maps.uniqueIndex(userModels, AgencyUserModel::getUserId);
Map<Long, DepartmentModel> departmentBoMap = Maps.uniqueIndex(departmentBos, DepartmentModel::getSequenceNbr); Map<Long, DepartmentModel> departmentBoMap = Maps.uniqueIndex(departmentBos, DepartmentModel::getSequenceNbr);
for (LatentDangerFlowRecordBo recordBo : records) { for (LatentDangerFlowRecordBo recordBo : records) {
...@@ -1187,14 +1158,14 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1187,14 +1158,14 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.已撤销)) { if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.已撤销)) {
latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode()); latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode());
saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId, saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(),param.getRemark()); param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
} else if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.治理完毕)) { } else if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.治理完毕)) {
latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode()); latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode());
saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId, saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(),param.getRemark()); param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
} else { } else {
LatentDangerFlowRecordBo flowRecord = saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId, LatentDangerFlowRecordBo flowRecord = saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(),param.getRemark()); param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
latentDangerBo.setCurrentFlowRecordId(flowRecord.getId()); latentDangerBo.setCurrentFlowRecordId(flowRecord.getId());
latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode()); latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode());
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患常规治理)) { if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患常规治理)) {
...@@ -1264,11 +1235,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1264,11 +1235,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
Set<String> sendUserIds = Sets.newHashSet(latentDangerBo.getDiscovererUserId()); Set<String> sendUserIds = Sets.newHashSet(latentDangerBo.getDiscovererUserId());
asyncTask.pushLatentDangerExecuteMessage(informerList, latentDangerBo.getOrgCode(), asyncTask.pushLatentDangerExecuteMessage(informerList, latentDangerBo.getOrgCode(),
latentDangerBo.getDangerName(), pointName, latentDangerBo.getDangerName(), pointName,
departmentName, latentDangerBo.getId(), userRealName, departmentName, latentDangerBo.getId(), userRealName,
flowTaskName, ExecuteStateEnum.驳回.getName(), flowTaskName, ExecuteStateEnum.驳回.getName(),
DateUtil.date2Str(new Date(), DateUtil.DATETIME_DEFAULT_FORMAT), DateUtil.date2Str(new Date(), DateUtil.DATETIME_DEFAULT_FORMAT),
latentDangerBo.getDangerState()); latentDangerBo.getDangerState());
} else if (excuteTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患验证通过)) { } else if (excuteTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患验证通过)) {
if (patrolBo != null) { if (patrolBo != null) {
// RiskFactorBo riskFactorBo = riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())); // RiskFactorBo riskFactorBo = riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId()));
...@@ -1297,20 +1268,20 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1297,20 +1268,20 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
pointName = patrolBo.getPointName(); pointName = patrolBo.getPointName();
} }
asyncTask.pushLatentDangerExecuteMessage(informerList, latentDangerBo.getOrgCode(), asyncTask.pushLatentDangerExecuteMessage(informerList, latentDangerBo.getOrgCode(),
latentDangerBo.getDangerName(), pointName, latentDangerBo.getDangerName(), pointName,
departmentName, latentDangerBo.getId(), userRealName, departmentName, latentDangerBo.getId(), userRealName,
flowTaskName, excuteTypeEnum.getExcuteState().getName(), flowTaskName, excuteTypeEnum.getExcuteState().getName(),
DateUtil.date2Str(new Date(), DateUtil.DATETIME_DEFAULT_FORMAT), DateUtil.date2Str(new Date(), DateUtil.DATETIME_DEFAULT_FORMAT),
latentDangerBo.getDangerState()); latentDangerBo.getDangerState());
if (excuteTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患评审通过)) { if (excuteTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患评审通过)) {
// 隐患治理到期时间为当天,则立即提示消息 // 隐患治理到期时间为当天,则立即提示消息
Date reformLimitDate = latentDangerBo.getReformLimitDate(); Date reformLimitDate = latentDangerBo.getReformLimitDate();
if (DateUtil.getDateFormat(new Date()).equals(DateUtil.getDateFormat(reformLimitDate))) { if (DateUtil.getDateFormat(new Date()).equals(DateUtil.getDateFormat(reformLimitDate))) {
asyncTask.pushLatentDangerReformLimitDateExpireMessage(informerList, asyncTask.pushLatentDangerReformLimitDateExpireMessage(informerList,
latentDangerBo.getOrgCode(), latentDangerBo.getDangerName(), latentDangerBo.getOrgCode(), latentDangerBo.getDangerName(),
DateUtil.date2Str(latentDangerBo.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT), DateUtil.date2Str(latentDangerBo.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT),
latentDangerBo.getId(), latentDangerBo.getId(),
latentDangerBo.getDangerState(),userRealName); latentDangerBo.getDangerState(), userRealName);
} }
} }
} }
...@@ -1322,7 +1293,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1322,7 +1293,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
private void updateSpcStateToControl(LatentDangerPatrolBo patrolBo, LatentDangerBo latentDangerBo) { private void updateSpcStateToControl(LatentDangerPatrolBo patrolBo, LatentDangerBo latentDangerBo) {
if (patrolBo.getClassifyOriginalId() != null && patrolBo.getItemOriginalId() != null) { if (patrolBo.getClassifyOriginalId() != null && patrolBo.getItemOriginalId() != null) {
updateMeasuresContentStatus(Long.valueOf(patrolBo.getClassifyOriginalId()), Long.valueOf(patrolBo.getItemOriginalId()), updateMeasuresContentStatus(Long.valueOf(patrolBo.getClassifyOriginalId()), Long.valueOf(patrolBo.getItemOriginalId()),
patrolBo.getRiskFactorFlowId(), RiskFactorsCmStatusEnum.Control); patrolBo.getRiskFactorFlowId(), RiskFactorsCmStatusEnum.Control);
} }
LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getByCode(latentDangerBo.getDangerLevel()); LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getByCode(latentDangerBo.getDangerLevel());
if (levelEnum != null) { if (levelEnum != null) {
...@@ -1530,8 +1501,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1530,8 +1501,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
Object structureId = pageParam.get("structureId"); Object structureId = pageParam.get("structureId");
List<Long> structureIdList = null; List<Long> structureIdList = null;
if (structureId != null && structureId.toString().trim().length() > 0) { if (structureId != null && structureId.toString().trim().length() > 0) {
LinkedHashMap<String,Object> o = equipFeign.getBuildingTree(); LinkedHashMap<String, Object> o = equipFeign.getBuildingTree();
if(o==null||!"200".equals(o.get("status").toString())) { if (o == null || !"200".equals(o.get("status").toString())) {
throw new YeeException("获取建筑树出错"); throw new YeeException("获取建筑树出错");
} }
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result"); List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
...@@ -1553,7 +1524,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1553,7 +1524,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
if (!dangerListResponseList.isEmpty()) { if (!dangerListResponseList.isEmpty()) {
Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap; Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap;
dangerListResponseList.forEach(danger->danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId()))); dangerListResponseList.forEach(danger -> danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId())));
} }
Long count = latentDangerMapper.countDangerListByMap(pageParam); Long count = latentDangerMapper.countDangerListByMap(pageParam);
if (CollectionUtils.isEmpty(dangerListResponseList)) { if (CollectionUtils.isEmpty(dangerListResponseList)) {
...@@ -1626,7 +1597,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1626,7 +1597,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
private List<DangerListResponse> dangerList(List<DangerListResponse> dangerListResponseList) { private List<DangerListResponse> dangerList(List<DangerListResponse> dangerListResponseList) {
JSONArray array = remoteSecurityService.listDictionaryByDictCode(RequestContext.getToken(), getProduct(), RequestContext.getAppKey(), JSONArray array = remoteSecurityService.listDictionaryByDictCode(RequestContext.getToken(), getProduct(), RequestContext.getAppKey(),
DictTypeEnum.DANGERLEVEL.getCode()); DictTypeEnum.DANGERLEVEL.getCode());
List<DictBo> dangerLevelList = JSONArray.parseArray(array.toJSONString(), DictBo.class); List<DictBo> dangerLevelList = JSONArray.parseArray(array.toJSONString(), DictBo.class);
for (DangerListResponse e : dangerListResponseList) { for (DangerListResponse e : dangerListResponseList) {
e.setDangerState(LatentDangerStateEnum.getEnumName(Integer.valueOf(e.getDangerState()))); e.setDangerState(LatentDangerStateEnum.getEnumName(Integer.valueOf(e.getDangerState())));
...@@ -1634,7 +1605,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1634,7 +1605,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
dangerLevelList.stream().filter(item -> item.getDictDataKey().equals(e.getDangerLevel())).collect(Collectors.toList()).get(0); dangerLevelList.stream().filter(item -> item.getDictDataKey().equals(e.getDangerLevel())).collect(Collectors.toList()).get(0);
e.setDangerLevel(dangerLevel.getDictDataValue()); e.setDangerLevel(dangerLevel.getDictDataValue());
e.setReformType(!StringUtil.isNotEmpty(e.getReformType()) ? "" : e.setReformType(!StringUtil.isNotEmpty(e.getReformType()) ? "" :
LatentDangerReformTypeEnum.getByCode(Integer.valueOf(e.getReformType())).getName()); LatentDangerReformTypeEnum.getByCode(Integer.valueOf(e.getReformType())).getName());
e.setOvertimeState("0".equals(e.getOvertimeState()) ? "否" : "是"); e.setOvertimeState("0".equals(e.getOvertimeState()) ? "否" : "是");
e.setDangerTypeName(LatentDangerTypeEnum.getEnumName(Integer.valueOf(e.getDangerType()))); e.setDangerTypeName(LatentDangerTypeEnum.getEnumName(Integer.valueOf(e.getDangerType())));
e.setDeadline(null == e.getDeadlineDate() ? "" : DateUtil.getLongDate(e.getDeadlineDate())); e.setDeadline(null == e.getDeadlineDate() ? "" : DateUtil.getLongDate(e.getDeadlineDate()));
...@@ -1643,14 +1614,14 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1643,14 +1614,14 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
//获取下一节点需要发消息的用户信息 //获取下一节点需要发消息的用户信息
public String getNextExecuteUsers(String instanceId) { public String getNextExecuteUsers(String instanceId) {
String informerList= ""; String informerList = "";
JSONObject object = remoteWorkFlowService.getChildNodeDetail(instanceId); JSONObject object = remoteWorkFlowService.getChildNodeDetail(instanceId);
if(object!=null){ if (object != null) {
JSONArray array = object.getJSONArray("data"); JSONArray array = object.getJSONArray("data");
if(array.size()>0){ if (array.size() > 0) {
JSONObject workFlowDetail = array.getJSONObject(0); JSONObject workFlowDetail = array.getJSONObject(0);
informerList = workFlowDetail.getString("informerList"); informerList = workFlowDetail.getString("informerList");
} }
} }
return informerList; return informerList;
...@@ -1662,15 +1633,58 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1662,15 +1633,58 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
return null; return null;
} }
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
String checkId = (String) param.get("checkId"); Long checkId = param.getLong("checkId");
String itemId = (String) param.get("itemId"); Long itemId = param.getLong("itemId");
String routePointItemId = (String) param.get("routePointItemId"); Long routePointItemId = param.getLong("routePointItemId");
result.put("inputCheck", null); Check check = getCheck(checkId);
result.put("inputItemName", null); InputCheckDto inputCheckDto = getInputCheckDto(checkId, itemId, routePointItemId);
result.put("photos", null); InputItem inputItem = getInputItem(itemId);
result.put("checkMode", null); String photoUrls = getPhotoUrls(inputCheckDto);
result.put("inputCheck", inputCheckDto);
result.put("inputItemName", !ValidationUtil.isEmpty(inputItem) ? inputItem.getName() : null);
result.put("photos", photoUrls);
result.put("checkMode", !ValidationUtil.isEmpty(check) ? check.getCheckMode() : null);
result.put("checkType", null); result.put("checkType", null);
return result; return result;
} }
private Check getCheck(Long checkId) {
Assert.notNull(checkId, "巡检ID不能为空!");
Check check = iCheckDao.getById(Long.valueOf(checkId));
return check;
}
private InputCheckDto getInputCheckDto(Long checkId, Long itemId, Long routePointItemId) {
if (ValidationUtil.isEmpty(itemId) || ValidationUtil.isEmpty(routePointItemId)) {
return null;
}
InputCheckDto inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(checkId,
itemId, routePointItemId, null);
return inputCheckDto;
}
private InputItem getInputItem(Long itemId) {
return ValidationUtil.isEmpty(itemId) ? iInputItemDao.getOne(itemId) : null;
}
private String getPhotoUrls(InputCheckDto inputCheckDto) {
String photoUrls = "";
if (!ValidationUtil.isEmpty(inputCheckDto)) {
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(inputCheckDto.getCheckId(),
inputCheckDto.getCheckInputId());
if (!CollectionUtils.isEmpty(checkShots)) {
List<String> photos = checkShots.stream().map(e -> {
if (e != null) {
return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
}).collect(Collectors.toList());
photoUrls = Joiner.on(",").join(photos);
}
}
return photoUrls;
}
} }
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