Commit 7c37c4c4 authored by xinglei's avatar xinglei

*)增加查询巡检接口

parent 32e7af7c
......@@ -224,7 +224,6 @@ public class InputItem extends BasicEntity {
/**
* 扩展属性
*/
@Transient
private String ext;
public Integer getItemStart() {
......@@ -515,6 +514,7 @@ public class InputItem extends BasicEntity {
this.checkTypeId = checkTypeId;
}
@Transient
public String getExt() {
return ext;
}
......
......@@ -302,9 +302,9 @@ public class LatentDangerController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检隐患信息", notes = "查询巡检隐患信息")
@GetMapping(value = "/patrol/danger/info")
public CommonResponse getPatrolDangerInfo(@RequestParam JSONObject param) {
@ApiOperation(value = "查询巡检信息", notes = "查询巡检信息")
@PostMapping(value = "/patrol/danger/info")
public CommonResponse getPatrolDangerInfo(@RequestBody(required = false) JSONObject param) {
return CommonResponseUtil.success(iLatentDangerService.getPatrolDangerInfo(param));
}
}
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.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -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.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.supervision.business.dao.mapper.CheckInputMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.LatentDangerFlowRecordMapper;
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.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.*;
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.IInputItemDao;
......@@ -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.feign.Business;
import com.yeejoin.amos.supervision.business.feign.EquipFeign;
import com.yeejoin.amos.supervision.business.param.LatentDangerExcuteParam;
import com.yeejoin.amos.supervision.business.param.LatentDangerListParam;
import com.yeejoin.amos.supervision.business.param.LatentDangerNormalParam;
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.param.*;
import com.yeejoin.amos.supervision.business.service.intfc.ILatentDangerService;
import com.yeejoin.amos.supervision.business.service.intfc.IRiskJudgmentTaskService;
import com.yeejoin.amos.supervision.business.util.CommonResponse;
import com.yeejoin.amos.supervision.business.util.CommonResponseUtil;
import com.yeejoin.amos.supervision.business.util.DateUtil;
import com.yeejoin.amos.supervision.business.util.RandomUtil;
import com.yeejoin.amos.supervision.common.enums.CheckModeEnum;
import com.yeejoin.amos.supervision.common.enums.DangerHandleStateEnum;
import com.yeejoin.amos.supervision.common.enums.DictTypeEnum;
import com.yeejoin.amos.supervision.common.enums.ExecuteStateEnum;
import com.yeejoin.amos.supervision.common.enums.InstanceKeyEnum;
import com.yeejoin.amos.supervision.common.enums.LatentDangerExcuteTypeEnum;
import com.yeejoin.amos.supervision.common.enums.LatentDangerLevelEnum;
import com.yeejoin.amos.supervision.common.enums.LatentDangerOvertimeStateEnum;
import com.yeejoin.amos.supervision.common.enums.LatentDangerReformTypeEnum;
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.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.enums.*;
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.common.request.LatentDangerResultPushSpcRequest;
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.CheckShot;
import com.yeejoin.amos.supervision.dao.entity.InputItem;
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 java.net.InetAddress;
import java.util.*;
import java.util.stream.Collectors;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct;
@Service("latentDangerService")
public class LatentDangerServiceImpl implements ILatentDangerService {
......@@ -179,7 +148,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
@Value("${server.port}")
private String port;
// @Value("${LatentDanger.flow.photoUrls}")
// @Value("${LatentDanger.flow.photoUrls}")
// private String photoUrlPre;
@Value("${file.url}")
private String fileUrl;
......@@ -197,6 +166,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
private String dangerTopic;
@Autowired
private WebMqttComponent webMqttComponent;
@Transactional
@Override
public CommonResponse saveNormal(LatentDangerNormalParam latentDangerParam, String userId, String userRealName, String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) {
......@@ -214,13 +184,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// return CommonResponseUtil.failure(jsonObject.getString("msg"));
// }
Date endDate = new Date();
logger.info("-------------------------提交隐患时间" +(endDate.getTime()-startDate.getTime()));
logger.info("-------------------------提交隐患时间" + (endDate.getTime() - startDate.getTime()));
if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return CommonResponseUtil.failure("启动流程失败");
}
JSONObject instance = jsonObject.getJSONObject("data");
if(instance==null){
if (instance == null) {
return CommonResponseUtil.failure("无提交隐患权限");
}
//提交隐患
......@@ -229,15 +199,15 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setInstanceId(instance.getString("id"));
JSONObject flowJson = new JSONObject();
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());
latentDangerMapper.update(latentDangerBo);
sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, null,
"隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
try {
webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){
logger.error("隐患提交数字换流站页面推送失败-----------"+e.getMessage());
} catch (Exception e) {
logger.error("隐患提交数字换流站页面推送失败-----------" + e.getMessage());
}
return CommonResponseUtil.success();
}
......@@ -254,9 +224,9 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// Set<String> inputUserIdsStr = getUserIdsStrByTypeAndDefKey("B_1");
// Set<String> reviewUserIdsStr = getUserIdsStrByTypeAndDefKey("B_2");
//获取装备全路径
LinkedHashMap<String,Object> positionAll = equipFeign.getBuildingAbsolutePosition();
LinkedHashMap<String,Object> position = new LinkedHashMap<>();
if("200".equals(positionAll.get("status").toString())){
LinkedHashMap<String, Object> positionAll = equipFeign.getBuildingAbsolutePosition();
LinkedHashMap<String, Object> position = new LinkedHashMap<>();
if ("200".equals(positionAll.get("status").toString())) {
position = (LinkedHashMap<String, Object>) positionAll.get("result");
}
......@@ -304,37 +274,37 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} else {
dangerTypeEnum = LatentDangerTypeEnum.无计划检查;
}
if(org.apache.commons.lang3.StringUtils.isNotEmpty(param.getName())){
if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getName())) {
dangerName = param.getName();
}else {
} else {
dangerName = inputItem.getName();
}
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());
}
LatentDangerBo latentDangerBo = saveLatentDanger("", param.getRemark(), remark, userId, departmentId,
businessKey, orgCode, dangerName, levelEnum.getCode(),
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字段
updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode());
Long dangerId = latentDangerBo.getId();
Date startDate = new Date();
JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey);
Date endDate = new Date();
logger.info("-------------------------提交隐患时间" +(endDate.getTime()-startDate.getTime()));
logger.info("-------------------------提交隐患时间" + (endDate.getTime() - startDate.getTime()));
if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return CommonResponseUtil.failure("启动流程失败");
}
JSONObject instance = jsonObject.getJSONObject("data");
if(instance==null){
if (instance == null) {
return CommonResponseUtil.failure("无提交隐患权限");
}
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();
flowJson.put("photoUrls", photoUrls);
......@@ -360,8 +330,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
"巡检隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
try {
webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){
logger.error("巡检隐患提交数字换流站页面推送失败-----------"+e.getMessage());
} catch (Exception e) {
logger.error("巡检隐患提交数字换流站页面推送失败-----------" + e.getMessage());
}
}
return CommonResponseUtil.success();
......@@ -416,11 +386,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setDangerPosition(position);
latentDangerBo.setDangerType(dangerTypeEnum.getCode());
StringBuilder photoUrlsB = new StringBuilder();
if(org.apache.commons.lang3.StringUtils.isNotBlank(photoUrls)){
if (org.apache.commons.lang3.StringUtils.isNotBlank(photoUrls)) {
String[] photoUrlsList = photoUrls.split(",");
for (String url : photoUrlsList) {
if (!"".equals(url)){
photoUrlsB.append(fileUrl+url);
if (!"".equals(url)) {
photoUrlsB.append(fileUrl + url);
photoUrlsB.append(",");
}
}
......@@ -435,13 +405,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
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();
record.setFlowTaskId(taskId);
record.setExcuteUserId(userId);
record.setExcuteDepartmentId(departmentId);
if(flowJson != null && org.apache.commons.lang3.StringUtils.isNotBlank(flowJson.getString("photoUrls"))){
flowJson.put("photoUrls",fileUrl+flowJson.getString("photoUrls"));
if (flowJson != null && org.apache.commons.lang3.StringUtils.isNotBlank(flowJson.getString("photoUrls"))) {
flowJson.put("photoUrls", fileUrl + flowJson.getString("photoUrls"));
}
record.setFlowJson(flowJson != null ? flowJson.toJSONString() : null);
record.setFlowTaskName(taskName);
......@@ -543,12 +513,12 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
JSONObject respBody;
Date startDate = new Date();
if (latentDangerListParam.getIsHandle()) {
respBody = remoteWorkFlowService.completedPageTask(user.getUserName(),latentDangerListParam.getBelongType());
respBody = remoteWorkFlowService.completedPageTask(user.getUserName(), latentDangerListParam.getBelongType());
} else {
respBody = remoteWorkFlowService.pageTask(user.getUserId(),latentDangerListParam.getBelongType());
respBody = remoteWorkFlowService.pageTask(user.getUserId(), latentDangerListParam.getBelongType());
}
Date endDate = new Date();
logger.info("-------------------------工作流列表时间" +(endDate.getTime()-startDate.getTime()));
logger.info("-------------------------工作流列表时间" + (endDate.getTime() - startDate.getTime()));
JSONArray taskJsonList = respBody.getJSONArray("data");
List<JSONObject> taskList = JSONObject.parseArray(taskJsonList.toJSONString(), JSONObject.class);
List<String> bussinessKeys = new ArrayList<>();
......@@ -564,11 +534,12 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (0 == latentDangerListParam.getDangerState()) {
latentDangerListParam.setDangerState(null);
}
Date startDate1 = new Date();;
Date startDate1 = new Date();
;
int dangerListSize = latentDangerMapper.countByBathBusinessKeys(bussinessKeys, latentDangerListParam);
List<LatentDangerBo> dangerList = latentDangerMapper.getByBathBusinessKeys(bussinessKeys, latentDangerListParam);
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.put("org_code", loginOrgCode);
// map.put("discoverer_department_id", deptId);
......@@ -681,8 +652,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (StringUtil.isNotEmpty(latentDangerExcuteParam.getDangerId())) {
latentDangerBo = latentDangerMapper.getById(latentDangerExcuteParam.getDangerId());
}
if(StringUtil.isNotEmpty(latentDangerExcuteParam.getReformLimitDate())){
latentDangerExcuteParam.setReformLimitDate(latentDangerExcuteParam.getReformLimitDate()+" 23:59:59");
if (StringUtil.isNotEmpty(latentDangerExcuteParam.getReformLimitDate())) {
latentDangerExcuteParam.setReformLimitDate(latentDangerExcuteParam.getReformLimitDate() + " 23:59:59");
}
LatentDangerExcuteTypeEnum executeTypeEnum = LatentDangerExcuteTypeEnum.getByCode(latentDangerExcuteParam.getExcuteType());
if (executeTypeEnum == null) {
......@@ -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 {
webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){
logger.error("隐患执行提交数字换流站页面推送失败-----------"+e.getMessage());
} catch (Exception e) {
logger.error("隐患执行提交数字换流站页面推送失败-----------" + e.getMessage());
}
return dangerExecuteSubmitDto;
}
@Override
public CommonResponse detail(String id, String userId,boolean isFinish) {
public CommonResponse detail(String id, String userId, boolean isFinish) {
JSONObject jsonObject;
if(isFinish==true){
if (isFinish == true) {
jsonObject = remoteWorkFlowService.queryFinishTaskDetail(id);
}else{
} else {
jsonObject = remoteWorkFlowService.queryTaskDetail(id);
}
......@@ -747,10 +718,10 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// }else {
// detailVo.setPosition(latentDangerBo.getDangerPosition());
// }
if(StringUtils.isEmpty(latentDangerBo.getDangerPosition())){
if (StringUtils.isEmpty(latentDangerBo.getDangerPosition())) {
detailVo.setPosition(latentDangerBo.getStructureName());
}else{
detailVo.setPosition(latentDangerBo.getStructureName()+"·"+latentDangerBo.getDangerPosition());
} else {
detailVo.setPosition(latentDangerBo.getStructureName() + "·" + latentDangerBo.getDangerPosition());
}
detailVo.setDangerState(latentDangerBo.getDangerState());
......@@ -812,7 +783,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (patrolBo != null) {
LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo();
List<String> basis = new ArrayList<>();
if(!StringUtils.isEmpty(patrolBo.getItemBasis())){
if (!StringUtils.isEmpty(patrolBo.getItemBasis())) {
basis.add(patrolBo.getItemBasis());
}
riskVo.setBasis(basis);
......@@ -821,13 +792,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
riskVo.setPointLevel(StringUtil.isNotEmpty(patrolBo.getPointLevel()) ? patrolBo.getPointLevel() : "");
riskVo.setPlanName(patrolBo.getPlanName());
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)) {
riskVo.setCheckUser(checkUser.getRealName());
}
RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : 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) {
riskVo.setBelongDepartmentName(department.getDepartmentName());
}
......@@ -1088,7 +1059,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
danger.getOrgCode(),
danger.getDangerName(), DateUtil.date2Str(danger.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT),
danger.getDangerId(),
danger.getDangerState(),"");
danger.getDangerState(), "");
});
}
}
......@@ -1135,8 +1106,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
deptIds.add(e.getExcuteDepartmentId());
}
});
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<DepartmentModel> departmentBos = remoteSecurityService.getlistDepartmentByDeptIds(token, product, appKey, Joiner.on(",").join(deptIds));
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(token, product, appKey, Joiner.on(",").join(userIds));
Map<String, AgencyUserModel> userMap = Maps.uniqueIndex(userModels, AgencyUserModel::getUserId);
Map<Long, DepartmentModel> departmentBoMap = Maps.uniqueIndex(departmentBos, DepartmentModel::getSequenceNbr);
for (LatentDangerFlowRecordBo recordBo : records) {
......@@ -1187,14 +1158,14 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.已撤销)) {
latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode());
saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(),param.getRemark());
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
} else if (executeTypeEnum.getNextState().equals(LatentDangerStateEnum.治理完毕)) {
latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode());
saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(),param.getRemark());
param.getFlowJson(), param.getDangerId(), role, executeTypeEnum.getName(), param.getRemark());
} else {
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.setDangerState(executeTypeEnum.getNextState().getCode());
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患常规治理)) {
......@@ -1310,7 +1281,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.getOrgCode(), latentDangerBo.getDangerName(),
DateUtil.date2Str(latentDangerBo.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT),
latentDangerBo.getId(),
latentDangerBo.getDangerState(),userRealName);
latentDangerBo.getDangerState(), userRealName);
}
}
}
......@@ -1530,8 +1501,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
Object structureId = pageParam.get("structureId");
List<Long> structureIdList = null;
if (structureId != null && structureId.toString().trim().length() > 0) {
LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
if(o==null||!"200".equals(o.get("status").toString())) {
LinkedHashMap<String, Object> o = equipFeign.getBuildingTree();
if (o == null || !"200".equals(o.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
......@@ -1553,7 +1524,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
if (!dangerListResponseList.isEmpty()) {
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);
if (CollectionUtils.isEmpty(dangerListResponseList)) {
......@@ -1644,11 +1615,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
//获取下一节点需要发消息的用户信息
public String getNextExecuteUsers(String instanceId) {
String informerList= "";
String informerList = "";
JSONObject object = remoteWorkFlowService.getChildNodeDetail(instanceId);
if(object!=null){
if (object != null) {
JSONArray array = object.getJSONArray("data");
if(array.size()>0){
if (array.size() > 0) {
JSONObject workFlowDetail = array.getJSONObject(0);
informerList = workFlowDetail.getString("informerList");
}
......@@ -1662,15 +1633,58 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
return null;
}
JSONObject result = new JSONObject();
String checkId = (String) param.get("checkId");
String itemId = (String) param.get("itemId");
String routePointItemId = (String) param.get("routePointItemId");
result.put("inputCheck", null);
result.put("inputItemName", null);
result.put("photos", null);
result.put("checkMode", null);
Long checkId = param.getLong("checkId");
Long itemId = param.getLong("itemId");
Long routePointItemId = param.getLong("routePointItemId");
Check check = getCheck(checkId);
InputCheckDto inputCheckDto = getInputCheckDto(checkId, itemId, routePointItemId);
InputItem inputItem = getInputItem(itemId);
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);
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