Commit 18393dae authored by tianbo's avatar tianbo

隐患修改

parent 6ae99059
package com.yeejoin.amos.boot.module.common.api.feign; package com.yeejoin.amos.boot.module.common.api.feign;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -30,4 +31,21 @@ public interface SupervisionFeignClient { ...@@ -30,4 +31,21 @@ public interface SupervisionFeignClient {
@RequestMapping(value = "/patrol/danger/info", method = RequestMethod.GET) @RequestMapping(value = "/patrol/danger/info", method = RequestMethod.GET)
ResponseModel<Object> getPatrolDangerInfo(@RequestBody Object param); ResponseModel<Object> getPatrolDangerInfo(@RequestBody Object param);
/**
* 修改巡检检查项
*
* @param param
* @return
*/
@RequestMapping(value = "/patrol/danger/check", method = RequestMethod.GET)
ResponseModel<Object> setPatrolDangerCheck(@RequestBody JSONObject param);
/**
* 查询隐患巡检信息
*
* @param latentDangerId
* @return
*/
@RequestMapping(value = "/{latentDangerId}", method = RequestMethod.GET)
ResponseModel<Object> getLatentDangerPatrolInfo(@PathVariable Long latentDangerId);
} }
package com.yeejoin.amos.latentdanger.business.controller; package com.yeejoin.amos.latentdanger.business.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo; import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...@@ -17,6 +18,7 @@ import com.yeejoin.amos.latentdanger.business.util.CommonResponseUtil; ...@@ -17,6 +18,7 @@ import com.yeejoin.amos.latentdanger.business.util.CommonResponseUtil;
import com.yeejoin.amos.latentdanger.business.util.FileHelper; import com.yeejoin.amos.latentdanger.business.util.FileHelper;
import com.yeejoin.amos.latentdanger.business.vo.DangerTimeAxisVo; import com.yeejoin.amos.latentdanger.business.vo.DangerTimeAxisVo;
import com.yeejoin.amos.latentdanger.core.common.response.DangerListResponse; import com.yeejoin.amos.latentdanger.core.common.response.DangerListResponse;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -126,7 +128,7 @@ public class LatentDangerController extends BaseController { ...@@ -126,7 +128,7 @@ public class LatentDangerController extends BaseController {
@GetMapping(value = "/detail") @GetMapping(value = "/detail")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
public CommonResponse detail(@ApiParam(value = "任务Id", required = true) @RequestParam String id, public CommonResponse detail(@ApiParam(value = "任务Id", required = true) @RequestParam String id,
@ApiParam(value = "是否完成", required = true) @RequestParam boolean isFinish) { @ApiParam(value = "是否完成") @RequestParam(required = false) boolean isFinish) {
try { try {
AgencyUserModel user = getUserInfo(); AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) { if (ObjectUtils.isEmpty(user)) {
...@@ -142,7 +144,7 @@ public class LatentDangerController extends BaseController { ...@@ -142,7 +144,7 @@ public class LatentDangerController extends BaseController {
@ApiOperation(value = "隐患执行记录", notes = "隐患执行记录") @ApiOperation(value = "隐患执行记录", notes = "隐患执行记录")
@GetMapping(value = "/listFlowRecord") @GetMapping(value = "/listFlowRecord")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
public CommonResponse listFlowRecord(@ApiParam(value = "隐患编号", required = true) @RequestParam Long id) { public CommonResponse listFlowRecord(@ApiParam(value = "隐患id", required = true) @RequestParam Long id) {
try { try {
AgencyUserModel user = getUserInfo(); AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) { if (ObjectUtils.isEmpty(user)) {
...@@ -267,7 +269,7 @@ public class LatentDangerController extends BaseController { ...@@ -267,7 +269,7 @@ public class LatentDangerController extends BaseController {
if (ObjectUtils.isEmpty(user)) { if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("登录过期,请重新登录"); return CommonResponseUtil.failure("登录过期,请重新登录");
} }
Page<DangerListResponse> result = iLatentDangerService.listDanger(pageParam); IPage<LatentDanger> result = iLatentDangerService.listDanger(pageParam);
return CommonResponseUtil.success(result); return CommonResponseUtil.success(result);
} }
......
...@@ -68,5 +68,5 @@ public interface LatentDangerMapper extends BaseMapper<LatentDanger> { ...@@ -68,5 +68,5 @@ public interface LatentDangerMapper extends BaseMapper<LatentDanger> {
void updateCheckInputDangerState(@Param("id") Long id, @Param("code") int code); void updateCheckInputDangerState(@Param("id") Long id, @Param("code") int code);
LatentDangerBo getbyBusinessKey(@Param("businessKey") String businessKey); LatentDangerBo getByBusinessKey(@Param("businessKey") String businessKey);
} }
...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,8 @@ 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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
...@@ -17,7 +19,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult; ...@@ -17,7 +19,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
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.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.latentdanger.business.constants.Constants; import com.yeejoin.amos.latentdanger.business.constants.Constants;
import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerFlowRecordMapper; import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerFlowRecordMapper;
...@@ -72,7 +73,6 @@ import org.slf4j.Logger; ...@@ -72,7 +73,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -102,6 +102,9 @@ import java.util.stream.Collectors; ...@@ -102,6 +102,9 @@ import java.util.stream.Collectors;
import static com.yeejoin.amos.latentdanger.business.util.RandomUtil.buildOrderNo; import static com.yeejoin.amos.latentdanger.business.util.RandomUtil.buildOrderNo;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct; import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.PageImpl;
//import com.yeejoin.amos.latentdanger.business.feign.Business; //import com.yeejoin.amos.latentdanger.business.feign.Business;
//import com.yeejoin.amos.latentdanger.business.feign.EquipFeign; //import com.yeejoin.amos.latentdanger.business.feign.EquipFeign;
...@@ -158,6 +161,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -158,6 +161,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Value("${workflow.process.definition.key}") @Value("${workflow.process.definition.key}")
private String workflowProcessDefinitionKey; private String workflowProcessDefinitionKey;
@Autowired
private RedisUtils redisUtils;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public CommonResponse saveNormal(LatentDangerNormalParam latentDangerDto, String userId, String userRealName, String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) { public CommonResponse saveNormal(LatentDangerNormalParam latentDangerDto, String userId, String userRealName, String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) {
...@@ -223,8 +229,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -223,8 +229,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (ValidationUtil.isEmpty(bizTypeEnum)) { if (ValidationUtil.isEmpty(bizTypeEnum)) {
return CommonResponseUtil.failure("业务类型有误"); return CommonResponseUtil.failure("业务类型有误");
} }
// 根据业务类型填充隐患等级枚举 TODO aop
// fillLatentDangerLevelEnum(bizTypeEnum);
List<LatentDanger> dangerList = Lists.newArrayList(); List<LatentDanger> dangerList = Lists.newArrayList();
for (LatentDangerDto param : latentDangerDtoList) { for (LatentDangerDto param : latentDangerDtoList) {
...@@ -267,11 +271,15 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -267,11 +271,15 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
JSONObject flowJson = new JSONObject(); JSONObject flowJson = new JSONObject();
flowJson.put("photoUrls", Joiner.on(",").join(param.getPhotoUrl())); flowJson.put("photoUrls", Joiner.on(",").join(param.getPhotoUrl()));
// 第一次保存隐患提交记录 if (ValidationUtil.isEmpty(param.getId())) {
LatentDangerFlowRecord inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId, // 第一次保存隐患提交记录
flowJson, latentDanger.getId(), role, LatentDangerExecuteTypeEnum.填写隐患完成.getName(), LatentDangerFlowRecord inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId,
latentDanger.getRemark()); flowJson, latentDanger.getId(), role, LatentDangerExecuteTypeEnum.填写隐患完成.getName(),
latentDanger.getRemark());
latentDanger.setCurrentFlowRecordId(inputRecord.getId());
latentDanger.setInstanceId(instance.getString("id"));
latentDangerMapper.updateById(latentDanger);
}
// TODO 业务自己保存 // TODO 业务自己保存
// if (LatentDangerTypeEnum.计划检查.getCode().equals(latentDangerBo.getDangerType()) // if (LatentDangerTypeEnum.计划检查.getCode().equals(latentDangerBo.getDangerType())
// || LatentDangerTypeEnum.无计划检查.getCode().equals(latentDangerBo.getDangerType())) { // || LatentDangerTypeEnum.无计划检查.getCode().equals(latentDangerBo.getDangerType())) {
...@@ -287,13 +295,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -287,13 +295,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// latentDangerPatrolMapper.save(latentDangerPatrolBo); // latentDangerPatrolMapper.save(latentDangerPatrolBo);
// } // }
latentDanger.setCurrentFlowRecordId(inputRecord.getId());
latentDanger.setInstanceId(instance.getString("id"));
latentDangerMapper.updateById(latentDanger);
// TODO 使用远程调用替换 // TODO 使用远程调用替换
// LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDanger.getId()); // LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDanger.getId());
// LatentDangerPatrolBo patrolBo = new LatentDangerPatrolBo();
// sendMessage(latentDanger, LatentDangerExecuteTypeEnum.填写隐患完成, patrolBo, // sendMessage(latentDanger, LatentDangerExecuteTypeEnum.填写隐患完成, patrolBo,
// "巡检隐患排查与治理", this.getNextExecuteUsers(latentDanger.getInstanceId()), userRealName, departmentName); // "巡检隐患排查与治理", this.getNextExecuteUsers(latentDanger.getInstanceId()), userRealName, departmentName);
try { try {
...@@ -645,6 +648,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -645,6 +648,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override @Override
public CommonResponse detail(String id, String userId, boolean isFinish) { public CommonResponse detail(String id, String userId, boolean isFinish) {
LatentDanger danger = this.baseMapper.selectById(id);
// danger.getDangerState()
JSONObject jsonObject; JSONObject jsonObject;
if (isFinish) { if (isFinish) {
jsonObject = remoteWorkFlowService.queryFinishTaskDetail(id); jsonObject = remoteWorkFlowService.queryFinishTaskDetail(id);
...@@ -653,16 +658,23 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -653,16 +658,23 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
} }
JSONObject task = jsonObject.getJSONObject("data"); JSONObject task = jsonObject.getJSONObject("data");
LatentDangerBo latentDangerBo = latentDangerMapper.getbyBusinessKey(task.getString("businessKey")); LatentDangerBo latentDangerBo = latentDangerMapper.getByBusinessKey(task.getString("businessKey"));
// LatentDangerBo latentDangerBo = latentDangerMapper.getByBusinessKey("20210923163838164");
LatentDangerDetailVo detailVo = new LatentDangerDetailVo(); LatentDangerDetailVo detailVo = new LatentDangerDetailVo();
if (latentDangerBo != null) { if (latentDangerBo != null) {
detailVo.setDangerId(latentDangerBo.getId()); detailVo.setId(latentDangerBo.getId());
detailVo.setBizId(latentDangerBo.getBizId());
detailVo.setDangerType(latentDangerBo.getDangerType()); detailVo.setDangerType(latentDangerBo.getDangerType());
LatentDangerTypeEnum dangerTypeEnum = LatentDangerTypeEnum.getByCode(latentDangerBo.getDangerType());
if (dangerTypeEnum != null) {
detailVo.setDangerTypeName(dangerTypeEnum.getName());
}
if (StringUtils.isEmpty(latentDangerBo.getDangerPosition())) { if (StringUtils.isEmpty(latentDangerBo.getDangerPosition())) {
detailVo.setPosition(latentDangerBo.getStructureName()); detailVo.setDangerPosition(latentDangerBo.getStructureName());
} else { } else {
detailVo.setPosition(latentDangerBo.getStructureName() + "·" + latentDangerBo.getDangerPosition()); detailVo.setDangerPosition(latentDangerBo.getStructureName() + "·" + latentDangerBo.getDangerPosition());
} }
detailVo.setDangerState(latentDangerBo.getDangerState()); detailVo.setDangerState(latentDangerBo.getDangerState());
...@@ -672,19 +684,19 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -672,19 +684,19 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
detailVo.setProblemDescription(latentDangerBo.getProblemDescription()); detailVo.setProblemDescription(latentDangerBo.getProblemDescription());
LatentDangerStateEnum dangerStateEnum = LatentDangerStateEnum.getByCode(latentDangerBo.getDangerState()); LatentDangerStateEnum dangerStateEnum = LatentDangerStateEnum.getByCode(latentDangerBo.getDangerState());
if (dangerStateEnum != null) { if (dangerStateEnum != null) {
detailVo.setDangerStateDesc(dangerStateEnum.getName()); detailVo.setDangerStateName(dangerStateEnum.getName());
} }
detailVo.setDangerName(latentDangerBo.getDangerName()); detailVo.setName(latentDangerBo.getDangerName());
detailVo.setLevel(latentDangerBo.getDangerLevel()); detailVo.setDangerLevel(latentDangerBo.getDangerLevel());
LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getEnumByCode(latentDangerBo.getDangerLevel()); LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getEnumByCode(latentDangerBo.getDangerLevel());
if (levelEnum != null) { if (levelEnum != null) {
detailVo.setLevelDesc(levelEnum.getName()); detailVo.setDangerLevelName(levelEnum.getName());
} }
detailVo.setRemark(latentDangerBo.getRemark()); detailVo.setRemark(latentDangerBo.getRemark());
if (latentDangerBo.getReformType() != null) { if (latentDangerBo.getReformType() != null) {
LatentDangerReformTypeEnum typeEnum = LatentDangerReformTypeEnum.getEnumByCode(latentDangerBo.getReformType()); LatentDangerReformTypeEnum typeEnum = LatentDangerReformTypeEnum.getEnumByCode(latentDangerBo.getReformType());
if (typeEnum != null) { if (typeEnum != null) {
detailVo.setReformTypeDesc(typeEnum.getName()); detailVo.setReformTypeName(typeEnum.getName());
} }
} }
if (latentDangerBo.getReformLimitDate() != null) { if (latentDangerBo.getReformLimitDate() != null) {
...@@ -702,7 +714,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -702,7 +714,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
List<String> photoUrls = Lists.newArrayList(latentDangerBo.getPhotoUrls().split(",")); List<String> photoUrls = Lists.newArrayList(latentDangerBo.getPhotoUrls().split(","));
detailVo.setPhotoUrls(photoUrls); detailVo.setPhotoUrls(photoUrls);
} }
buildOfDifferentDangerType(latentDangerBo, detailVo);
if (dangerBizType.equals(LatentDangerBizTypeEnum.巡检.getCode())) {
buildOfDifferentDangerType(latentDangerBo, detailVo);
}
detailVo.setTaskId(task.getString("id")); detailVo.setTaskId(task.getString("id"));
} }
return CommonResponseUtil.success(detailVo); return CommonResponseUtil.success(detailVo);
...@@ -717,6 +733,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -717,6 +733,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
private void buildOfDifferentDangerType(LatentDangerBo latentDangerBo, LatentDangerDetailVo detailVo) { private void buildOfDifferentDangerType(LatentDangerBo latentDangerBo, LatentDangerDetailVo detailVo) {
if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode()) if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode())
|| latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.无计划检查.getCode())) { || latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.无计划检查.getCode())) {
// TODO 使用远程调用替换
LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId()); LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
if (patrolBo != null) { if (patrolBo != null) {
LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo(); LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo();
...@@ -1031,12 +1048,12 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1031,12 +1048,12 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return CommonResponseUtil.failure("隐患不存在"); return CommonResponseUtil.failure("隐患不存在");
} }
LatentDangerDetailVo detailVo = new LatentDangerDetailVo(); LatentDangerDetailVo detailVo = new LatentDangerDetailVo();
detailVo.setDangerName(latentDangerBo.getDangerName()); detailVo.setName(latentDangerBo.getDangerName());
detailVo.setLevel(latentDangerBo.getDangerLevel()); detailVo.setDangerLevel(latentDangerBo.getDangerLevel());
detailVo.setPosition(latentDangerBo.getStructureName()); detailVo.setDangerPosition(latentDangerBo.getStructureName());
LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getEnumByCode(latentDangerBo.getDangerLevel()); LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getEnumByCode(latentDangerBo.getDangerLevel());
if (levelEnum != null) { if (levelEnum != null) {
detailVo.setLevelDesc(levelEnum.getName()); detailVo.setDangerLevelName(levelEnum.getName());
} }
List<LatentDangerFlowRecordBo> records = latentDangerFlowRecordMapper.listByDangerId(latentDangerBo.getId()); List<LatentDangerFlowRecordBo> records = latentDangerFlowRecordMapper.listByDangerId(latentDangerBo.getId());
if (!CollectionUtils.isEmpty(records)) { if (!CollectionUtils.isEmpty(records)) {
...@@ -1475,7 +1492,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1475,7 +1492,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
} }
@Override @Override
public Page<DangerListResponse> listDanger(PageParam pageParam) { public IPage<LatentDanger> listDanger(PageParam pageParam) {
String idsStr = (String) pageParam.get("dangerIds"); String idsStr = (String) pageParam.get("dangerIds");
if (StringUtil.isNotEmpty(idsStr)) { if (StringUtil.isNotEmpty(idsStr)) {
List<String> dangerIdList = Lists.newArrayList(idsStr.split(",")); List<String> dangerIdList = Lists.newArrayList(idsStr.split(","));
...@@ -1489,11 +1506,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1489,11 +1506,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
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();
ResponseModel<Object> response = equipFeign.getBuildingTree(); ResponseModel<Object> response = equipFeign.getBuildingTree();
// if (o == null || !"200".equals(o.get("status").toString())) {
// throw new YeeException("获取建筑树出错");
// }
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) response.getResult(); List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) response.getResult();
Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> structureId.equals(map.get("id"))).findFirst().orElse(null); Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> structureId.equals(map.get("id"))).findFirst().orElse(null);
if (node != null) { if (node != null) {
...@@ -1501,25 +1514,38 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1501,25 +1514,38 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
} }
} }
pageParam.put("structureId", structureIdList); pageParam.put("structureId", structureIdList);
List<DangerListResponse> dangerListResponseList = latentDangerMapper.dangerListByMap(pageParam);
Map<Long, String> buildingAbsolutePositionMap = new HashMap<>(); IPage<LatentDanger> page = new Page<>((Integer) pageParam.get("pageNumber"),
try { (Integer) pageParam.get("pageSize"));
LinkedHashMap<String, Object> buildingAbsolutePosition = (LinkedHashMap<String, Object>) equipFeign.getBuildingAbsolutePosition().getResult(); page = latentDangerMapper.selectPage(page,
if (buildingAbsolutePosition == null || !"200".equals(buildingAbsolutePosition.get("status").toString())) { new LambdaQueryWrapper<LatentDanger>().like(ValidationUtil.isEmpty(pageParam.get("name")),
throw new YeeException("获取建筑树出错"); LatentDanger::getDangerName,
} pageParam.get("name")).eq(ValidationUtil.isEmpty(pageParam.get("dangerLevel")),
buildingAbsolutePositionMap = (Map<Long, String>) buildingAbsolutePosition.get("result"); LatentDanger::getDangerLevel,
} catch (Exception e) { pageParam.get("dangerLevel")).eq(ValidationUtil.isEmpty(pageParam.get("dangerState")),
} LatentDanger
if (!dangerListResponseList.isEmpty()) { ::getDangerState, pageParam.get("dangerState")));
Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap; return page;
dangerListResponseList.forEach(danger -> danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId())));
} // List<DangerListResponse> dangerListResponseList = latentDangerMapper.dangerListByMap(pageParam);
Long count = latentDangerMapper.countDangerListByMap(pageParam); // Map<Long, String> buildingAbsolutePositionMap = new HashMap<>();
if (CollectionUtils.isEmpty(dangerListResponseList)) { // try {
return new PageImpl<>(dangerListResponseList, pageParam, 0L); // LinkedHashMap<String, Object> buildingAbsolutePosition = (LinkedHashMap<String, Object>) equipFeign.getBuildingAbsolutePosition().getResult();
} // if (buildingAbsolutePosition == null || !"200".equals(buildingAbsolutePosition.get("status").toString())) {
return new PageImpl<>(dangerList(dangerListResponseList), pageParam, count); // 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);
} }
private List<Map<String, Object>> getAllNodes(List<Map<String, Object>> buildingTree) { private List<Map<String, Object>> getAllNodes(List<Map<String, Object>> buildingTree) {
...@@ -1536,7 +1562,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1536,7 +1562,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
private List<Long> findBuildChildrenIds(Map<String, Object> building) { private List<Long> findBuildChildrenIds(Map<String, Object> building) {
List<Map<String, Object>> buildingTree = getAllNodes(Collections.singletonList(building)); List<Map<String, Object>> buildingTree = getAllNodes(Collections.singletonList(building));
return buildingTree.stream().map(building123 -> Long.valueOf(building123.get("id").toString())).collect(Collectors.toList()); return buildingTree.stream().map(build -> Long.valueOf(build.get("id").toString())).collect(Collectors.toList());
} }
@Override @Override
......
...@@ -3,11 +3,13 @@ package com.yeejoin.amos.latentdanger.business.service.intfc; ...@@ -3,11 +3,13 @@ package com.yeejoin.amos.latentdanger.business.service.intfc;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto; import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam; import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam;
import com.yeejoin.amos.latentdanger.business.param.PageParam; import com.yeejoin.amos.latentdanger.business.param.PageParam;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerLevelEnum; import com.yeejoin.amos.latentdanger.common.enums.LatentDangerLevelEnum;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -98,7 +100,7 @@ public interface ILatentDangerService { ...@@ -98,7 +100,7 @@ public interface ILatentDangerService {
*/ */
JSONObject getReviewInfo(Long dangerId); JSONObject getReviewInfo(Long dangerId);
Page<DangerListResponse> listDanger(PageParam pageParam); IPage<LatentDanger> listDanger(PageParam pageParam);
List<DangerListResponse> export(PageParam pageParam); List<DangerListResponse> export(PageParam pageParam);
......
...@@ -6,22 +6,27 @@ import lombok.Data; ...@@ -6,22 +6,27 @@ import lombok.Data;
import java.util.List; import java.util.List;
/**
* @author DELL
*/
@Data @Data
public class LatentDangerDetailVo { public class LatentDangerDetailVo {
private Long dangerId; private Long id;
private String dangerName; private String name;
private String level; private Long bizId;
private String levelDesc; private String dangerLevel;
private String dangerLevelName;
private String remark; private String remark;
private String position; private String dangerPosition;
private String reformTypeDesc; private String reformTypeName;
private String reformLimitDate; private String reformLimitDate;
...@@ -31,9 +36,11 @@ public class LatentDangerDetailVo { ...@@ -31,9 +36,11 @@ public class LatentDangerDetailVo {
private String dangerState; private String dangerState;
private String dangerStateName;
private String dangerType; private String dangerType;
private String dangerStateDesc; private String dangerTypeName;
private Boolean currentUserCanExcute; private Boolean currentUserCanExcute;
......
...@@ -26,6 +26,10 @@ import java.util.List; ...@@ -26,6 +26,10 @@ import java.util.List;
@Aspect @Aspect
@Component @Component
public class EnumFillAop { public class EnumFillAop {
@Autowired
RedisUtils redisUtils;
@Pointcut("execution(public * com.yeejoin.amos.latentdanger.business.controller..*(..))") @Pointcut("execution(public * com.yeejoin.amos.latentdanger.business.controller..*(..))")
public void fillEnum() { public void fillEnum() {
...@@ -40,6 +44,10 @@ public class EnumFillAop { ...@@ -40,6 +44,10 @@ public class EnumFillAop {
bizType = request.getParameter("bizType"); bizType = request.getParameter("bizType");
} }
if (!redisUtils.hasKey(Constants.DANGER_BIZ_TYPE_KEY)) {
redisUtils.set(Constants.DANGER_BIZ_TYPE_KEY, bizType);
}
// 获取隐患等级枚举 // 获取隐患等级枚举
if (ValidationUtil.isEmpty(LatentDangerLevelEnum.enumMap)) { if (ValidationUtil.isEmpty(LatentDangerLevelEnum.enumMap)) {
List<DictionarieValueModel> dicResult = List<DictionarieValueModel> dicResult =
......
...@@ -311,7 +311,7 @@ public class LatentDangerController extends AbstractBaseController { ...@@ -311,7 +311,7 @@ public class LatentDangerController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询隐患信息", notes = "查询隐患信息") @ApiOperation(value = "查询隐患巡检信息", notes = "查询隐患信息")
@GetMapping(value = "/{latentDangerId}") @GetMapping(value = "/{latentDangerId}")
public CommonResponse getLatentDanger(@PathVariable(required = true) Long latentDangerId) { public CommonResponse getLatentDanger(@PathVariable(required = true) Long latentDangerId) {
return CommonResponseUtil.success(iLatentDangerService.getLatentDanger(latentDangerId)); return CommonResponseUtil.success(iLatentDangerService.getLatentDanger(latentDangerId));
......
...@@ -935,7 +935,7 @@ ...@@ -935,7 +935,7 @@
where id = #{id}; where id = #{id};
</update> </update>
<select id="getbyBusinessKey" resultType="com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerBo"> <select id="getByBusinessKey" resultType="com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerBo">
SELECT SELECT
* *
FROM FROM
......
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