Commit 5c2c5271 authored by xixinzhao's avatar xixinzhao

防火监督联调

parent 45f1a14d
......@@ -11,8 +11,9 @@ public enum CheckTypeSuEnum {
/**
* 检查类型枚举
*/
SUPERVISED("日常检查", "1", "supervised"),
DAILY("专项检查", "2", "daily");
DAILY("日常检查", "1", "daily"),
SPECIAL_RQ("燃气专项", "2", "special"),
SPECIAL_GW("高温专项", "3", "special");
/**
* 名字
......@@ -37,7 +38,8 @@ public enum CheckTypeSuEnum {
public static List<Map<String, Object>> getEnumList() {
return Arrays.stream(CheckTypeSuEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put(e.getCode(), e.getName());
map.put("code", e.getCode());
map.put("name", e.getName());
return map;
}).collect(Collectors.toList());
}
......
package com.yeejoin.amos.supervision.common.enums;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author DELL
*/
public enum DangerCheckTypeLevelEnum {
DEPARTMENT("单位级", "1", "department"),
COMPANY("公司级", "2", "company"),
EXTERNAL("外部消防单位", "3", "external"),
OTHER("其他", "4", "external");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 执行控制条件
*/
private String condition;
DangerCheckTypeLevelEnum(String name, String code, String condition) {
this.name = name;
this.code = code;
this.condition = condition;
}
/**
* 获取枚举
* @param code 编号
* @return DangerCheckTypeLevelEnum
* @throws Exception
*/
public static DangerCheckTypeLevelEnum getEumByCode(String code) throws Exception {
Optional<DangerCheckTypeLevelEnum> op = Arrays.stream(DangerCheckTypeLevelEnum.values()).filter(e->e.code.equals(code)).findFirst();
return op.orElseThrow(()->new Exception("不存在"));
}
public static List<Map<String, Object>> getEnumList() {
return Arrays.stream(DangerCheckTypeLevelEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put("code", e.getCode());
map.put("name", e.getName());
return map;
}).collect(Collectors.toList());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCondition(String condition) {
this.condition = condition;
}
public String getCondition() {
return condition;
}
}
package com.yeejoin.amos.supervision.common.enums;
/**
* @author DELL
*/
public enum DangerHandleTypeEnum {
SUPERVISION("防火监督检查", "2"),
SELF("自行检查", "1");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
DangerHandleTypeEnum(String name, String code) {
this.name = name;
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.yeejoin.amos.supervision.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author DELL
*/
public enum WorkFlowBranchEnum {
DAILY("日常检查", "company", "daily", "daily"),
SPECIAL_C("专项检查", "company", "special", "special"),
SPECIAL_E("专项检查", "external", "special", "special"),
SUPERVISED_DW("单位级审核", "department", "special-daily", "supervised");
/**
* 名称,描述
*/
private String name;
/**
* 隐患类型级别
*/
private String dangerCheckTypeLevel;
/**
* 计划检查类型
*/
private String checkType;
/**
* 工作流分支
*/
private String workFlowBranch;
public String getName() {
return name;
}
public String getDangerCheckTypeLevel() {
return dangerCheckTypeLevel;
}
public String getCheckType() {
return checkType;
}
public String getWorkFlowBranch() {
return workFlowBranch;
}
WorkFlowBranchEnum(String name, String dangerCheckTypeLevel, String checkType, String workFlowBranch) {
this.name = name;
this.dangerCheckTypeLevel = dangerCheckTypeLevel;
this.checkType = checkType;
this.workFlowBranch = workFlowBranch;
}
public static List<Map<String,String>> getEnumList() {
List<Map<String,String>> list = new ArrayList<>();
for(WorkFlowBranchEnum e : WorkFlowBranchEnum.values()) {
Map<String, String> map = new HashMap<String, String>();
map.put("dangerCheckTypeLevel", e.getDangerCheckTypeLevel());
map.put("name", e.getName());
map.put("checkType", e.getCheckType());
map.put("workFlowBranch", e.getWorkFlowBranch());
list.add(map);
}
return list;
}
}
package com.yeejoin.amos.supervision.core.common.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
......@@ -56,6 +57,7 @@ public class DangerDto implements Serializable {
/**
* 整改期限
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date reformLimitDate;
......
......@@ -56,7 +56,7 @@ public class PlanAuditLog extends BasicEntity {
@Column(name = "excute_user_name")
private String excuteUserName;
/**
* 执行状态(1:不通过;2:通过)
* 执行状态(1:不通过;0:通过)
*/
@Column(name = "excute_state")
private Integer excuteState;
......
......@@ -430,9 +430,9 @@ public class OrgUsrController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getLoginUserDetails/{userId}", method = RequestMethod.GET)
@RequestMapping(value = {"/getLoginUserDetails/{userId}", "/getLoginUserDetails"}, method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取登陆人绑定的人员关系", notes = "获取登陆人绑定的人员关系")
public ResponseModel<List<Map<String, Object>>> getLoginUserDetails(@PathVariable String userId) {
public ResponseModel<List<Map<String, Object>>> getLoginUserDetails(@PathVariable(required=false) String userId) {
AgencyUserModel user = getUserInfo();
String userIds = userId;
if (StringUtils.isEmpty(userIds)) {
......
......@@ -32,7 +32,7 @@ public class PlanAuditController extends AbstractBaseController {
@RequestMapping(value = "/auditWorkFlow", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public ResponseModel auditWorkFlow(
@ApiParam(value = "工作流流水实例", required = true) @RequestBody PlanAuditLog planAuditLog,
@ApiParam(value = "工作流流水实例", required = true) @RequestBody Integer status,
@ApiParam(value = "当前计划状态", required = true) @RequestParam Integer status,
@ApiParam(value = "执行控制条件", required = true) @RequestParam String condition) {
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(planAuditService.auditWorkFlow(planAuditLog, status, condition, reginParams));
......
......@@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.List;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest;
import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone;
......@@ -227,4 +229,17 @@ public class PlanController extends AbstractBaseController {
return ResponseHelper.buildResponse(PlanStatusEnum.getEnumList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "计划检查类型", notes = "计划检查类型")
@RequestMapping(value = "/checkTypeSuEnum/list", method = RequestMethod.GET)
public ResponseModel getCheckTypeSuEnumList() {
return ResponseHelper.buildResponse(CheckTypeSuEnum.getEnumList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "检查级别", notes = "检查级别")
@RequestMapping(value = "/checkTypeLevelEnum/list", method = RequestMethod.GET)
public ResponseModel getCheckTypeLevelEnumList() {
return ResponseHelper.buildResponse(DangerCheckTypeLevelEnum.getEnumList());
}
}
......@@ -811,8 +811,9 @@ public class PointController extends AbstractBaseController {
@GetMapping(value = "/detail/item", produces = "application/json;charset=UTF-8")
public ResponseModel queryItemDetailByPointId(
@ApiParam(value = "路线id", required = true) @RequestParam(name = "routeId") Long routeId,
@ApiParam(value = "巡检点id", required = true) @RequestParam(name = "pointId") Long id) {
return ResponseHelper.buildResponse(iPointService.queryItemDetailByPointId(id, routeId));
@ApiParam(value = "巡检点id", required = true) @RequestParam(name = "pointId") Long id,
@ApiParam(value = "计划id", required = true) @RequestParam(name = "planId") Long planId) {
return ResponseHelper.buildResponse(iPointService.queryItemDetailByPointId(id, routeId, planId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.supervision.business.dao.repository;
import com.yeejoin.amos.supervision.dao.entity.HiddenDanger;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
......@@ -21,4 +24,21 @@ public interface IHiddenDangerDao extends BaseDao<HiddenDanger, Long> {
* @return List<HiddenDanger>
*/
List<HiddenDanger> findByLatentDangerIdIn(List<Long> ids);
/**
* 根据ids删除
* @param ids
*/
@Modifying
@Transactional
@Query(value="DELETE FROM p_hidden_danger WHERE latent_danger_id IN (?1)", nativeQuery = true)
void deleteByDangerIdIn(List<Long> ids);
/**
* 根据计划id获取列表
* @param planId 计划id
* @return 隐患关系列表
*/
List<HiddenDanger> findByPlanId(Long planId);
}
......@@ -60,7 +60,7 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
//1.查询指定计划和公司的关联隐患数据
List<HiddenDangerDto> hiddenDangers = hiddenDangerMapper.listByCondition(planId, pointId);
List<Long> dangerIds = Lists.transform(hiddenDangers, HiddenDangerDto::getLatentDangerId);
String dangerIdsStr = Joiner.on(",").join(dangerIds);
String dangerIdsStr = "".equals(Joiner.on(",").join(dangerIds)) ? "-1" : Joiner.on(",").join(dangerIds);
//2.调用隐患模块查询关联隐患的具体数据(业务系统直落关系,具体隐患数据再隐患服务进行储存)
Map<String, Object> param = new HashMap<>();
param.put("dangerIds", dangerIdsStr);
......@@ -114,7 +114,7 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
public IPage pageList(Page page, String planId, Long pointId, String level, String status) {
List<HiddenDangerDto> dangers = hiddenDangerMapper.listByCondition(planId, pointId);
List<Long> dangerIds = Lists.transform(dangers, HiddenDangerDto::getLatentDangerId);
String dangerIdsStr = Joiner.on(",").join(dangerIds);
String dangerIdsStr = "".equals(Joiner.on(",").join(dangerIds)) ? "-1" : Joiner.on(",").join(dangerIds);
Map<String, Object> param = buildRequestBody(page, level, status, dangerIdsStr);
FeignClientResult<Page<DangerDto>> feignClientResult = feignClient.pageList(param);
Page<DangerDto> dangerDtoIPage = feignClientResult.getResult();
......
......@@ -12,7 +12,9 @@ import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.param.PlanInfoPageParam;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanService;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum;
import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest;
import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone;
import com.yeejoin.amos.supervision.core.util.DateUtil;
......@@ -150,13 +152,15 @@ public class PlanServiceImpl implements IPlanService {
Integer status = param.getStatus();
if (status != null && status == 1) {
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(param.getCheckTypeId());
DangerCheckTypeLevelEnum levelEnum = DangerCheckTypeLevelEnum.getEumByCode(param.getCheckLevel());
String branch = workFlowExcuteBranch(levelEnum.getCondition(), checkTypeSuEnum.getCondition());
try {
String processInstanceId;
PlanAudit audit = planAuditDao.findByPlanId(param.getId());
if (audit != null) {
//执行一步
processInstanceId = audit.getProcessInstanceId();
workflowExcuteService.excuteTask(processInstanceId, checkTypeSuEnum.getCondition());
workflowExcuteService.excuteTask(processInstanceId, branch);
//更新时间
audit.setUpdateDate(new Date());
planAuditDao.save(audit);
......@@ -164,7 +168,7 @@ public class PlanServiceImpl implements IPlanService {
insertAuditLog(reginParams, param, personIdentity, audit);
} else {
//启动
processInstanceId = workflowExcuteService.startAndComplete(processDefinitionKey, checkTypeSuEnum.getCondition());
processInstanceId = workflowExcuteService.startAndComplete(processDefinitionKey, branch);
audit = new PlanAudit();
audit.setPlanId(param.getId());
audit.setBusinessKey(String.valueOf(sequence.nextId()));
......@@ -195,6 +199,24 @@ public class PlanServiceImpl implements IPlanService {
}
/**
* 判断走哪一种工作流WorkFlowBranchEnum
*/
public String workFlowExcuteBranch (String dangerCheckTypeLevel, String checkType) {
String branch = "";
List<Map<String, String>> enumList = WorkFlowBranchEnum.getEnumList();
if (!ObjectUtils.isEmpty(enumList)){
List<Map<String, String>> list = enumList.stream().filter(map ->
(dangerCheckTypeLevel.equals(map.get("dangerCheckTypeLevel")) && map.get("checkType").contains(checkType)
)).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(list)) {
branch = list.get(0).get("workFlowBranch");
}
}
return branch;
}
/**
* 默认新增路线
*/
public Route save(AddPlanRequest addPlanRequest) {
......
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.safety.common.cache.PointStatusCache;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
......@@ -17,12 +18,14 @@ import com.yeejoin.amos.supervision.business.dto.FormValue;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import com.yeejoin.amos.supervision.business.dto.PointDto;
import com.yeejoin.amos.supervision.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.business.feign.EquipFeign;
import com.yeejoin.amos.supervision.business.param.*;
import com.yeejoin.amos.supervision.business.service.intfc.IPointService;
import com.yeejoin.amos.supervision.business.util.DaoCriteria;
import com.yeejoin.amos.supervision.business.vo.*;
import com.yeejoin.amos.supervision.common.enums.PointStatusEnum;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.PointResponse;
import com.yeejoin.amos.supervision.core.util.StringUtil;
......@@ -102,6 +105,14 @@ public class PointServiceImpl implements IPointService {
@Value("${file.url}")
private String fileUrl;
@Autowired
private IHiddenDangerDao hiddenDangerDao;
@Autowired
private DangerFeignClient dangerFeignClient;
private final int HTTP_OK_STATUS = 200;
@Override
@Transactional
public Point addPoint(PointParam pointParam) {
......@@ -249,8 +260,9 @@ public class PointServiceImpl implements IPointService {
iPointClassifyDao.deleteByPointId(idList); // 物理删除点的分类
List<PointInputItem> pointInputItem = iPointInputItemDao.findAllById(idList);
List<Long> pointInputItemIds = Lists.transform(pointInputItem, PointInputItem::getId);
if (pointInputItemIds.size() > 0)
if (pointInputItemIds.size() > 0) {
iPointInputItemDao.deleteFmeaRelationByPointInputItemIds(pointInputItemIds);//物理删除fmea关联巡检点项
}
iPointInputItemDao.deleteByPointId(idList); // 物理删除p_point_inputitem表对应行
iPointPhotoDao.deleteByPointId(idList); // 物理删除点的图片信息
// iRoutePointDao.delRoutePointByPointId(idList); //
......@@ -1183,13 +1195,39 @@ public class PointServiceImpl implements IPointService {
}
@Override
public List<Map<String, Object>> queryItemDetailByPointId(Long id, Long routeId) {
public List<Map<String, Object>> queryItemDetailByPointId(Long id, Long routeId, Long planId) {
// 获取所有检查项
List<Map<String, Object>> list = pointMapper.queryItemsByPointId(id, routeId);
Map<Long, List<DangerDto>> collect = new HashMap<>();
// 根据计划id获取隐患关系
List<HiddenDanger> hiddenDangerList = hiddenDangerDao.findByPlanId(planId);
if (!ObjectUtils.isEmpty(hiddenDangerList)) {
String ids = Joiner.on(",").join(hiddenDangerList.stream().map(HiddenDanger::getLatentDangerId).collect(Collectors.toList()));
Map<String, String> map = new HashMap<>();
map.put("ids", ids);
FeignClientResult<List<DangerDto>> listFeignClientResult = dangerFeignClient.listAll(map);
if (ObjectUtils.isEmpty(listFeignClientResult.getResult()) || listFeignClientResult.getStatus() != HTTP_OK_STATUS) {
throw new RuntimeException(listFeignClientResult.getDevMessage());
}
List<DangerDto> dangerDtoList = listFeignClientResult.getResult();
if (!ObjectUtils.isEmpty(dangerDtoList)) {
collect = dangerDtoList.stream().collect(Collectors.groupingBy(DangerDto::getBizId, Collectors.toList()));
}
}
if (0 < list.size()) {
for (Map<String, Object> map : list) {
if (map.containsKey("picJson") && !ObjectUtils.isEmpty(map.get("picJson"))) {
map.put("remark", fileUrl + map.get("remark"));
}
if (map.containsKey("inputId") && !ObjectUtils.isEmpty(map.get("inputId"))) {
String inputId = map.get("inputId").toString();
if (!"0".equals(inputId) && !ObjectUtils.isEmpty(collect)) {
List<DangerDto> dangerDtoList = collect.get(Long.parseLong(inputId));
map.put("dangerList", dangerDtoList);
}
}
}
}
return list;
......
......@@ -327,7 +327,7 @@ public interface IPointService {
*/
void delPointByPointNo(Long id);
List<Map<String, Object>> queryItemDetailByPointId(Long id, Long routeId);
List<Map<String, Object>> queryItemDetailByPointId(Long id, Long routeId, Long planId);
List<Map<String, Object>> getPlanExecuteTeams();
......
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