Commit d4c3a5ef authored by 张森's avatar 张森

Merge remote-tracking branch 'origin/develop_dl' into develop_dl_bugfix

# Conflicts: # YeeAmosFireAutoSysService/pom.xml # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/LoginController.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteSecurityService.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/EmergencyTaskServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/EquipmentFireEquipmentServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/HandlerMqttMessageImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java # YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties # YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_view3d.xml
parents 70430423 afea7a8c
package com.yeejoin.amos.fas.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: JudgeSignEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/3/8 20:54
*/
@Getter
@AllArgsConstructor
public enum PlanTypeEnum {
MAINTRANSFORM("MAINTRANSFORM","主变"),
HIGHRESISTANCE("HIGHRESISTANCE","高抗"),
NORMAL("NORMAL","数字预案");
private String key;
private String describe;
}
package com.yeejoin.amos.fas.dao.dto;
import lombok.Data;
import java.util.List;
@Data
public class PlanStepJsonVO {
private String stepCode;
private String stepName;
private String stepStatus;
/**
* 是否并行,用于卡片展示;1:是,0:否
*/
private String isParallel;
private String roleCode;
private String buttonCode;
private String batchNo;
private String caseId;
private String buttonJson;
private String time = "";
/**
* 进度条标识
*/
private boolean showLine = false;
/**
* 1:是,0:否
*/
private String checkYesOrNo = "";
/**
* 进度索引
*/
private Integer index;
/**
* 节点物联设备指标之间关系
*/
private String inAndOr;
/**
* 节点物联设备之间关系
*/
private String outAndOr;
/**
* 是否自动执行;1自动,0非自动
*/
private Integer isAuto;
}
...@@ -2,10 +2,9 @@ package com.yeejoin.amos.fas.dao.entity; ...@@ -2,10 +2,9 @@ package com.yeejoin.amos.fas.dao.entity;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity; import java.util.ArrayList;
import javax.persistence.NamedQuery; import java.util.List;
import javax.persistence.Table;
/** /**
...@@ -17,22 +16,51 @@ import javax.persistence.Table; ...@@ -17,22 +16,51 @@ import javax.persistence.Table;
public class EmergencyTaskContent extends BasicEntity { public class EmergencyTaskContent extends BasicEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//分工内容
//分工内容id
@Column(name = "content") @Column(name = "content")
private String content; private String content;
//人员名称 //编号
@Column(name = "code") @Column(name = "code")
private String code; private String code;
//人员名称 //关联角色ID
@Column(name = "obligation_id") @Column(name = "obligation_id")
private Long obligationId; private Long obligationId;
//所属流程步骤编号
@Column(name = "step_code")
private String stepCode;
//角色code
@Column(name = "role_code")
private String roleCode;
//任务排序号
@Column(name = "task_num")
private String taskNum;
//是否必填项
@Column(name = "is_must")
private boolean isMust;
//人员名称 //所属流程步骤编号
@Column(name = "button_json")
private String buttonJson;
//预案类型
@Column(name = "plan_type")
private String planType;
//关联角色名称
@Column(name = "obligation_name") @Column(name = "obligation_name")
private String obligationName; private String obligationName;
//是否必填项
@Transient
private String isMustString;
//所属角色
@Transient
private ArrayList<String> roleCodeList;
} }
\ No newline at end of file
package com.yeejoin.amos.fas.dao.entity;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import javax.persistence.*;
import java.util.Date;
@Data
@Entity
@Table(name="c_emergency_task_role")
@NamedQuery(name="EmergencyTaskRole.findAll", query="SELECT e FROM EmergencyTaskRole e")
public class EmergencyTaskRole {
/**
* id
*/
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id",nullable=false,unique=true)
private Long id;
@CreatedDate
@Column(name="create_date")
private Date createDate = new Date();
/**
* 角色名称
*/
@Column(name="name")
private String name;
/**
* 角色编码
*/
@Column(name="code")
private String code;
/**
* 排序字段
*/
@Column(name="sort")
private Long sort;
/**
* 是否删除字段
*/
@Column(name="is_delete")
private Integer isDelete = 0;
/**
* 备注
*/
@Column(name="remark")
private String remark;
/**
* 版次
*/
@Column(name="creater")
private String creater;
/**
* 机构编码
*/
@Column(name="biz_org_code")
private String bizOrgCode;
/**
* 机构名称
*/
@Column(name="biz_org_name")
private String bizOrgName;
}
...@@ -42,4 +42,7 @@ public class PlanClassifyTree extends BasicEntity { ...@@ -42,4 +42,7 @@ public class PlanClassifyTree extends BasicEntity {
@Column(name="org_code") @Column(name="org_code")
private String orgCode; private String orgCode;
@Column(name="plan_type")
private String planType;
} }
\ No newline at end of file
package com.yeejoin.amos.fas.dao.entity;
import com.yeejoin.amos.fas.dao.dto.PlanStepJsonVO;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class PlanStepTree extends BasicEntity {
private static final long serialVersionUID = 1L;
private String sequenceNbr;
//职责id
private Long obligationId;
//人员名称
private String name;
private String stepName;
//子级
private List<PlanStepJsonVO> children = new ArrayList<>();
//树节点展示标识
private String type;
private String code;
private Integer index;
}
\ No newline at end of file
...@@ -74,13 +74,13 @@ ...@@ -74,13 +74,13 @@
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId> <artifactId>amos-feign-privilege</artifactId>
<version>1.8.8-DL</version> <version>1.8.8-DL</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId> <artifactId>amos-feign-systemctl</artifactId>
<version>1.8.8-DL</version> <version>1.8.8-DL</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-feign</artifactId> <artifactId>amos-component-feign</artifactId>
......
...@@ -29,6 +29,7 @@ import com.yeejoin.amos.fas.business.util.JSONUtil; ...@@ -29,6 +29,7 @@ import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.vo.*; import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum; import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum; import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanTypeEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum; import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.util.DateUtil; import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
...@@ -156,8 +157,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -156,8 +157,9 @@ public class ContingencyAction implements CustomerAction {
private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger; private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger;
@Autowired @Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService; private IEquipmentFireEquipmentService equipmentFireEquipmentService;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource; @Autowired
private IPlanStepService iPlanStepService;
/** /**
* @param stepCode 当前步骤编号 * @param stepCode 当前步骤编号
...@@ -803,13 +805,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -803,13 +805,7 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("content", content); tempmap1.put("content", content);
result.add(tempmap1); result.add(tempmap1);
String instanceId = iContingencyInstance.getInstanceIdByBatchNOAndCategory("OPERATE", stepName, batchNo); String instanceId = iContingencyInstance.getInstanceIdByBatchNOAndCategory("OPERATE", stepName, batchNo);
String json = iPlanStepService.getPlanStep();
String json;
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案节点信息失败!");
}
List<PlanStepJsonVO> res = JSONObject.parseArray(json, PlanStepJsonVO.class); List<PlanStepJsonVO> res = JSONObject.parseArray(json, PlanStepJsonVO.class);
PlanStepJsonVO vo = res.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList()).get(0); PlanStepJsonVO vo = res.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList()).get(0);
Object obj = equipmentFireEquipmentService.automaticExecutePoint(vo.getIndex()); Object obj = equipmentFireEquipmentService.automaticExecutePoint(vo.getIndex());
......
...@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/api/contingencyPlan") @RequestMapping("/api/contingencyPlan")
...@@ -283,7 +284,8 @@ public class ContingencyPlanController extends BaseController { ...@@ -283,7 +284,8 @@ public class ContingencyPlanController extends BaseController {
@RequestParam(value = "batchNo", required = false) String batchNo, @RequestParam(value = "batchNo", required = false) String batchNo,
@RequestParam(value = "runState", required = false) String runState, @RequestParam(value = "runState", required = false) String runState,
@RequestParam(value = "updateDate", required = false) String updateDate, @RequestParam(value = "updateDate", required = false) String updateDate,
@RequestParam(value = "roleName", required = false) String roleName @RequestParam(value = "roleName", required = false) String roleName,
@RequestParam(value = "stepCode", required = false) String stepCode
) { ) {
if (current < 1 || size < 1) { if (current < 1 || size < 1) {
throw new YeeException("分页参数有误"); throw new YeeException("分页参数有误");
...@@ -293,7 +295,13 @@ public class ContingencyPlanController extends BaseController { ...@@ -293,7 +295,13 @@ public class ContingencyPlanController extends BaseController {
String[] ids = new String(roleName).split(","); String[] ids = new String(roleName).split(",");
list = Arrays.asList(ids); list = Arrays.asList(ids);
} }
return CommonResponseUtil2.success(contingencyPlanService.selectTaskActionPage(current, size, batchNo, runState, updateDate, list)); List<String> steps = new ArrayList<>();
if (!StringUtils.isEmpty(stepCode)) {
String[] codes = new String(stepCode).split(",");
steps = Arrays.asList(codes);
steps = steps.stream().map(x -> String.valueOf(Integer.valueOf(x) - 1)).collect(Collectors.toList());
}
return CommonResponseUtil2.success(contingencyPlanService.selectTaskActionPage(current, size, batchNo, runState, updateDate, list, steps));
} }
} }
...@@ -2,29 +2,35 @@ package com.yeejoin.amos.fas.business.controller; ...@@ -2,29 +2,35 @@ package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.Page;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskMapper;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper;
import com.yeejoin.amos.fas.business.feign.JcsFeign; import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.service.intfc.IDictService; import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService; import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanStepService;
import com.yeejoin.amos.fas.business.vo.EmergencyRelationVo; import com.yeejoin.amos.fas.business.vo.EmergencyRelationVo;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.Dict; import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelation; import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.dao.entity.EmergencyTaskContent;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Controller @Controller
...@@ -42,25 +48,43 @@ public class EmergencyTaskController extends BaseController{ ...@@ -42,25 +48,43 @@ public class EmergencyTaskController extends BaseController{
@Autowired @Autowired
private IDictService dictService; private IDictService dictService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Autowired
private EmergencyTaskMapper emergencyTaskMapper;
@Autowired
private IPlanStepService planStepService;
@ApiOperation(httpMethod = "GET",value = "岗位人员树", notes = "岗位人员树") @ApiOperation(httpMethod = "GET",value = "岗位人员树", notes = "岗位人员树")
@RequestMapping(value = "/tree", method = RequestMethod.GET) @RequestMapping(value = "/tree", method = RequestMethod.GET)
public CommonResponse tree(){ public CommonResponse tree(@RequestParam(value = "type", required = false) String type){
Dict dict = new Dict(); Dict dict = new Dict();
dict.setDictCode("YJZC"); dict.setDictCode("YJZC");
//查询应急角色 //查询应急角色
List<Dict> dictList = dictService.getDictList(dict); // List<Dict> dictList = dictService.getDictList(dict);
List<EmergencyTaskRole> emergencyTaskRoles = new ArrayList<>();
if (StringUtils.isNotEmpty(type)) {
emergencyTaskRoles = emergencyTaskRoleMapper.selectListFilterEmptyTask();
} else {
emergencyTaskRoles = emergencyTaskRoleMapper.selectList();
}
List<EmergencyRelationTree> list = new ArrayList<>(); List<EmergencyRelationTree> list = new ArrayList<>();
List<EmergencyRelationTree> root = new ArrayList<>(); List<EmergencyRelationTree> root = new ArrayList<>();
List<EmergencyRelationTree> treeNodes = iEmergencyTaskService.treeList(); List<EmergencyRelationTree> treeNodes = iEmergencyTaskService.treeList();
//组装对应人员节点 //组装对应人员节点
dictList.forEach(e->{ emergencyTaskRoles.forEach(e->{
EmergencyRelationTree tree = new EmergencyRelationTree(); EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(e.getId()); tree.setId(e.getId());
tree.setName(e.getDictName()); tree.setName(e.getName());
tree.setType("0"); tree.setType("0");
tree.setSequenceNbr(String.valueOf(e.getId())); tree.setSequenceNbr(String.valueOf(e.getId()));
tree.setCode(e.getDictValue()); tree.setCode(e.getCode());
tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList())); tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList()));
list.add(tree); list.add(tree);
}); });
...@@ -81,7 +105,7 @@ public class EmergencyTaskController extends BaseController{ ...@@ -81,7 +105,7 @@ public class EmergencyTaskController extends BaseController{
@ApiOperation(httpMethod = "GET",value = "分工内容列表", notes = "分工内容列表") @ApiOperation(httpMethod = "GET",value = "分工内容列表", notes = "分工内容列表")
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
public CommonResponse list(Long obligationId ,@RequestParam int pageNumber, public CommonResponse list(Long obligationId , @RequestParam(required = false) String planType,@RequestParam int pageNumber,
@RequestParam int pageSize){ @RequestParam int pageSize){
if (pageNumber >=1 ){ if (pageNumber >=1 ){
pageNumber = pageNumber -1 ; pageNumber = pageNumber -1 ;
...@@ -90,7 +114,11 @@ public class EmergencyTaskController extends BaseController{ ...@@ -90,7 +114,11 @@ public class EmergencyTaskController extends BaseController{
obligationId = null; obligationId = null;
} }
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize); CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
Page<EmergencyTaskContent> list = iEmergencyTaskService.list(obligationId,commonPageable);
if (StringUtils.isNotEmpty(planType) && "0".equals(planType)) {
planType = null;
}
Page<EmergencyTaskContent> list = iEmergencyTaskService.list(obligationId, planType, commonPageable);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
...@@ -139,6 +167,30 @@ public class EmergencyTaskController extends BaseController{ ...@@ -139,6 +167,30 @@ public class EmergencyTaskController extends BaseController{
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
@ApiOperation(httpMethod = "POST",value = "新增应急任务配置", notes = "新增应急任务配置")
@PostMapping(value = "/saveTaskConfig", produces = "application/json;charset=UTF-8")
public ResponseModel saveTaskConfig(@RequestBody EmergencyTaskContent emergencyTaskContent){
iEmergencyTaskService.saveTaskConfig(emergencyTaskContent);
return CommonResponseUtil2.success();
}
@ApiOperation(httpMethod = "GET",value = "查询流程节点", notes = "查询流程节点")
@GetMapping(value = "/findStep")
public ResponseModel<List<PlanStepJsonVO>> findStep(@RequestParam String planType){
return CommonResponseUtil2.success(planStepService.getPlanStepByParam(planType));
}
@Permission
@ApiOperation(value = "根据ID删除数据", notes = "根据ID删除数据")
@DeleteMapping(value = "/deleteById", produces = "application/json;charset=UTF-8")
public ResponseModel deleteById(@RequestParam(value = "id") Long id) {
if (!Objects.isNull(id)) {
emergencyTaskMapper.deleteTask(id);
}
return CommonResponseUtil2.success();
}
@ApiOperation(httpMethod = "POST",value = "编辑树人员节点", notes = "编辑树人员节点") @ApiOperation(httpMethod = "POST",value = "编辑树人员节点", notes = "编辑树人员节点")
@PostMapping(value = "/editPerson", produces = "application/json;charset=UTF-8") @PostMapping(value = "/editPerson", produces = "application/json;charset=UTF-8")
public CommonResponse editPerson(@RequestBody EmergencyRelationVo vo){ public CommonResponse editPerson(@RequestBody EmergencyRelationVo vo){
......
package com.yeejoin.amos.fas.business.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskMapper;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/api/emergencyTaskRole")
@Api(tags = "应急任务角色API")
public class EmergencyTaskRoleController extends BaseController {
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Autowired
private EmergencyTaskMapper emergencyTaskMapper;
/**
* 创建数字预案
*/
@Permission
@ApiOperation(value = "新增", notes = "新增")
@PostMapping(value = "/save", produces = "application/json;charset=UTF-8")
public ResponseModel save(@RequestBody EmergencyTaskRole emergencyTaskRole) {
if (null == emergencyTaskRole) {
return CommonResponseUtil2.failure("参数有误");
}
int i = emergencyTaskRoleMapper.countByCode(emergencyTaskRole.getCode());
if (i > 0) {
return CommonResponseUtil2.failure("角色编码已存在");
}
AgencyUserModel curUser = getUserInfo();
emergencyTaskRole.setCreater(curUser.getUserId());
ReginParams reginParams = getSelectedOrgInfo();
emergencyTaskRole.setBizOrgCode(getOrgCode(reginParams));
emergencyTaskRole.setBizOrgName(!ObjectUtils.isEmpty(reginParams) && !ObjectUtils.isEmpty(reginParams.getCompany()) ? reginParams.getCompany().getCompanyName() : "");
emergencyTaskRole.setCreateDate(new Date());
emergencyTaskRoleMapper.save(emergencyTaskRole);
return CommonResponseUtil2.success();
}
/**
* 修改数字预案
*/
@Permission
@ApiOperation(value = "编辑", notes = "编辑")
@PutMapping(value = "/update", produces = "application/json;charset=UTF-8")
public ResponseModel update(@RequestBody EmergencyTaskRole emergencyTaskRole) {
if (null == emergencyTaskRole) {
return CommonResponseUtil2.failure("参数有误");
}
emergencyTaskRoleMapper.updateById(emergencyTaskRole);
return CommonResponseUtil2.success();
}
@Permission
@ApiOperation(value = "详情", notes = "详情")
@GetMapping(value = "/getById", produces = "application/json;charset=UTF-8")
public ResponseModel getById(@RequestParam(value = "id") Long id) {
EmergencyTaskRole emergencyTaskRole = emergencyTaskRoleMapper.selectById(id);
return CommonResponseUtil2.success(emergencyTaskRole);
}
@Permission
@ApiOperation(value = "根据角色编码查信息", notes = "根据角色编码查信息")
@GetMapping(value = "/getByCode", produces = "application/json;charset=UTF-8")
public ResponseModel getByCode(@RequestParam(value = "code") String code) {
EmergencyTaskRole emergencyTaskRole = emergencyTaskRoleMapper.selectByCode(code);
return CommonResponseUtil2.success(emergencyTaskRole);
}
@Permission
@ApiOperation(value = "分页查询", notes = "分页查询")
@PostMapping(value = "/getInfoByPage")
public ResponseModel<Page<EmergencyTaskRole>> getInfoByPage(@RequestBody EmergencyTaskRole emergencyTaskRole,
@RequestParam Integer pageNum,
@RequestParam Integer size) {
Page<EmergencyTaskRole> emergencyTaskRolePage = new Page<>(pageNum, size);
int infoCount = emergencyTaskRoleMapper.getInfoCount(emergencyTaskRole);
emergencyTaskRolePage.setTotal(infoCount);
List<EmergencyTaskRole> infoByPage = emergencyTaskRoleMapper.getInfoByPage((pageNum - 1) * size, size, emergencyTaskRole);
emergencyTaskRolePage.setRecords(infoByPage);
return CommonResponseUtil2.success(emergencyTaskRolePage);
}
@Permission
@ApiOperation(value = "根据ID删除数据", notes = "根据ID删除数据")
@DeleteMapping(value = "/deleteById", produces = "application/json;charset=UTF-8")
public ResponseModel deleteById(@RequestParam(value = "id") Long id) {
int total = emergencyTaskMapper.getEmergencyTaskCount(id, null);
if (total > 0) {
return CommonResponseUtil2.failure("已有应急任务,不能删除!");
}
emergencyTaskRoleMapper.deleteRelationByRoleId(id);
emergencyTaskRoleMapper.deleteById(id);
return CommonResponseUtil2.success();
}
@Permission
@ApiOperation(value = "下拉列表", notes = "下拉列表")
@GetMapping(value = "/getList")
public ResponseModel<List<EmergencyTaskRole>> getList() {
List<EmergencyTaskRole> emergencyTaskRoles = emergencyTaskRoleMapper.selectList();
return CommonResponseUtil2.success(emergencyTaskRoles);
}
}
...@@ -17,7 +17,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -17,7 +17,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel; import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.privilege.util.AesUtil; import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.privilege.util.PwdUtil; import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -31,6 +31,8 @@ import org.springframework.util.ObjectUtils; ...@@ -31,6 +31,8 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.cache.enumeration.CacheType;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -68,6 +70,8 @@ public class LoginController { ...@@ -68,6 +70,8 @@ public class LoginController {
@Value("${amos.system.user.app-key}") @Value("${amos.system.user.app-key}")
private String appKey; private String appKey;
private String aProduct = "AMOS_STUDIO_WEB";
@ApiOperation(value = "通过userId登录", notes = "查询设备指标") @ApiOperation(value = "通过userId登录", notes = "查询设备指标")
...@@ -80,34 +84,39 @@ public class LoginController { ...@@ -80,34 +84,39 @@ public class LoginController {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest(); .getRequestAttributes()).getRequest();
String token = "szhlz"; String token = "szhlz";
//ObjectUtils.isEmpty(request.getHeader("token"))?"szhlz":request.getHeader("token").toString() ; //ObjectUtils.isEmpty(request.getHeader("token"))?"szhlz":request.getHeader("token").toString() ;
ReginParams reginParams; ReginParams reginParams;
reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, token)), ReginParams.class); reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, token)), ReginParams.class);
if(reginParams == null){ if(reginParams == null){
reginParams = getLogin(userId, token); reginParams = getLogin(userId, token);
}else{ }else{
RequestContext.setProduct(product); RequestContext.setProduct(product);
if (!TokenOperation.refresh(reginParams.getToken())) { String cacheKey = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", aProduct, reginParams.getToken()});
reginParams = getLogin(userId, token); boolean hasKey = Redis.getRedisTemplate().hasKey(cacheKey);
} if (hasKey) {
return reginParams;
} else {
logger.info("Auto自动登陆=====:{}", JSON.toJSONString(reginParams));
reginParams = getLogin(userId, token);
}
} }
return reginParams; return reginParams;
} }
private ReginParams getLogin(String userId, String token) throws Exception{ private ReginParams getLogin(String userId, String token) throws Exception{
ReginParams reginParams = new ReginParams(); ReginParams reginParams = new ReginParams();
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel(); IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(userId); dPasswordAuthModel.setLoginId(userId);
dPasswordAuthModel.setPassword(PwdUtil.encode(password)); dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
RequestContext.setProduct(product); RequestContext.setProduct(product);
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel); FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
if (ObjectUtils.isEmpty(feignClientResult.getResult())){ if (ObjectUtils.isEmpty(feignClientResult.getResult())){
throw new Exception("缺失登录信息"); throw new Exception("缺失登录信息");
} }
// 调用平台授权接口 // 调用平台授权接口
Map<String ,String > re = (Map<String, String>) feignClientResult.getResult(); Map<String ,String > re = (Map<String, String>) feignClientResult.getResult();
String amosToken = re.get("token"); String amosToken = re.get("token");
logger.info("应用授权开始======================================"+amosToken); logger.info("应用授权开始======================================"+amosToken);
RequestContext.setToken(amosToken); RequestContext.setToken(amosToken);
...@@ -119,23 +128,23 @@ public class LoginController { ...@@ -119,23 +128,23 @@ public class LoginController {
logger.info("应用授权结束======================================"+JSON.toJSONString(fd)+amosToken); logger.info("应用授权结束======================================"+JSON.toJSONString(fd)+amosToken);
AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult(); AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
CompanyModel companyModel = userModel.getCompanys().get(0); CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(amosToken, product, appKey, companyModel.getSequenceNbr().toString()); List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(amosToken, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){ if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel); CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0)); DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
reginParams.setDepartment(departmentBo); reginParams.setDepartment(departmentBo);
reginParams.setCompany(companyBo); reginParams.setCompany(companyBo);
} }
reginParams.setToken(amosToken); reginParams.setToken(amosToken);
reginParams.setUserModel(userModel); reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS); redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
// redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS); // redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
return reginParams; return reginParams;
} }
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){ private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
DepartmentBo departmentBo = new DepartmentBo(); DepartmentBo departmentBo = new DepartmentBo();
if(departmentModel != null) { if(departmentModel != null) {
......
...@@ -5,6 +5,7 @@ import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo; ...@@ -5,6 +5,7 @@ import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo;
import com.yeejoin.amos.fas.business.vo.ReginParams; import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2; import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel; import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree;
import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree; import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -12,7 +13,10 @@ import io.swagger.annotations.ApiOperation; ...@@ -12,7 +13,10 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.UUID;
@RestController @RestController
@RequestMapping("/api/planClassifyTree") @RequestMapping("/api/planClassifyTree")
...@@ -30,6 +34,7 @@ public class PlanClassifyTreeController extends BaseController { ...@@ -30,6 +34,7 @@ public class PlanClassifyTreeController extends BaseController {
String compCode = getOrgCode(reginParams); String compCode = getOrgCode(reginParams);
model.setOrgCode(compCode); model.setOrgCode(compCode);
model.setCreator(user.getUserId()); model.setCreator(user.getUserId());
model.setPlanType(UUID.randomUUID().toString());
return CommonResponseUtil2.success(planClassifyTreeService.create(model)); return CommonResponseUtil2.success(planClassifyTreeService.create(model));
} }
...@@ -62,4 +67,31 @@ public class PlanClassifyTreeController extends BaseController { ...@@ -62,4 +67,31 @@ public class PlanClassifyTreeController extends BaseController {
} }
return CommonResponseUtil2.success(list); return CommonResponseUtil2.success(list);
} }
@ApiOperation(value = "查询分类树 - 新页面使用")
@RequestMapping(value = "/treeNew", method = RequestMethod.GET)
public ResponseModel getTreeNew() {
Collection<PlanClassifyTreeVo> list = null;
try {
list = planClassifyTreeService.getTree();
}catch (Exception e){
e.printStackTrace();
System.out.println(e.getStackTrace().toString());
}
//增加根节点
PlanClassifyTreeVo tree = new PlanClassifyTreeVo();
tree.setId(0);
tree.setClassifyName("全部");
tree.setPlanType("0");
tree.setChildren(list);
List<PlanClassifyTreeVo> root = new ArrayList<>();
root.add(tree);
return CommonResponseUtil2.success(root);
}
@ApiOperation(value = "查询分类信息 - 新页面使用")
@RequestMapping(value = "/getPlanClassifyInfo", method = RequestMethod.GET)
public ResponseModel getPlanClassifyInfo() {
return CommonResponseUtil2.success(planClassifyTreeService.findAllInfo());
}
} }
...@@ -10,7 +10,9 @@ import com.yeejoin.amos.fas.core.util.CommonResponse; ...@@ -10,7 +10,9 @@ import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2; import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel; import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.dto.PlanStepJsonVO;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.PlanStepTree;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -30,6 +32,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -30,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping(value = "/api/visual") @RequestMapping(value = "/api/visual")
...@@ -181,6 +184,30 @@ public class PlanVisual3dController extends BaseController { ...@@ -181,6 +184,30 @@ public class PlanVisual3dController extends BaseController {
} }
@Permission @Permission
@ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤")
@GetMapping(value = "/plan/step/tree")
public ResponseModel getPlanStepTree(@RequestParam(value = "batchNo", required = false) String batchNo) {
if (StringUtils.isEmpty(batchNo)) {
batchNo = planVisual3dService.getNewestBatchNo();
}
List<PlanStepTree> root = new ArrayList<>();
List<PlanStepJsonVO> list = planVisual3dService.getPlanStepList(batchNo);
list.stream().map(x -> {x.setIndex(x.getIndex() + 1); return x;}).collect(Collectors.toList());
//增加根节点
PlanStepTree tree = new PlanStepTree();
tree.setId(0);
tree.setIndex(0);
tree.setSequenceNbr("0");
tree.setName("全部");
tree.setStepName("全部");
tree.setType("3");
tree.setCode("0");
tree.setChildren(list);
root.add(tree);
return CommonResponseUtil.successNew(root);
}
@Permission
@ApiOperation(value = "根据批次号更新预案的步骤", notes = "根据批次号更新预案的步骤") @ApiOperation(value = "根据批次号更新预案的步骤", notes = "根据批次号更新预案的步骤")
@PostMapping(value = "/plan/updatePlanStep") @PostMapping(value = "/plan/updatePlanStep")
public ResponseModel updatePlanStep(@RequestBody PlanStepVo planStepVo) { public ResponseModel updatePlanStep(@RequestBody PlanStepVo planStepVo) {
......
...@@ -38,8 +38,8 @@ public interface ContingencyInstanceInfoMapper extends BaseMapper<ContingencyIns ...@@ -38,8 +38,8 @@ public interface ContingencyInstanceInfoMapper extends BaseMapper<ContingencyIns
List<ContingencyPlanInstanceVO> getTaskActionList(@Param("type") String type, @Param("status") String status, @Param("batchNo") String batchNo); List<ContingencyPlanInstanceVO> getTaskActionList(@Param("type") String type, @Param("status") String status, @Param("batchNo") String batchNo);
int countTaskPage(@Param("type") String type, @Param("batchNo") String batchNo, @Param("list") List<String> roles); int countTaskPage(@Param("type") String type, @Param("batchNo") String batchNo, @Param("list") List<String> roles, @Param("steps") List<String> steps);
List<ContingencyPlanInstanceVO> getTaskActionPage(@Param("current") int current, @Param("size") int size, @Param("batchNo") String batchNo, @Param("type") String type, @Param("runState") String runState, @Param("updateDate") String updateDate, @Param("list") List<String> roles); List<ContingencyPlanInstanceVO> getTaskActionPage(@Param("current") int current, @Param("size") int size, @Param("batchNo") String batchNo, @Param("type") String type, @Param("runState") String runState, @Param("updateDate") String updateDate, @Param("list") List<String> roles, @Param("steps") List<String> steps);
} }
...@@ -9,23 +9,29 @@ import org.apache.ibatis.annotations.Param; ...@@ -9,23 +9,29 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface EmergencyTaskMapper extends BaseMapper { public interface EmergencyTaskMapper extends BaseMapper {
List<EmergencyTaskContent> getEmergencyTaskList(Long obligationId,Long offset,int pageSize); List<EmergencyTaskContent> getEmergencyTaskList(@Param("obligationId") Long obligationId, @Param("offset")Long offset, @Param("pageSize")int pageSize, @Param("planType") String planType);
int getEmergencyTaskCount(Long obligationId); int getEmergencyTaskCount(@Param("obligationId") Long obligationId, @Param("planType") String planType);
List<EmergencyRelationTree> treeList(); List<EmergencyRelationTree> treeList();
void deleteTreeNode(Long obligationId , Long personId); void deleteTreeNode(Long obligationId , Long personId);
void deleteTask(@Param("id") Long id);
void save(EmergencyRelation emergencyRelation); void save(EmergencyRelation emergencyRelation);
void saveTaskConfig(EmergencyTaskContent emergencyTaskContent);
List<String> roleCodes(String amosOrgId); List<String> roleCodes(String amosOrgId);
List<Long> getPersonIds(Long obligationId); List<Long> getPersonIds(Long obligationId);
List<String> roleNames(String amosOrgId); List<String> roleNames(String amosOrgId);
List<EmergencyTaskContentVo> getContentList(@Param("stepCode") String stepCode); List<EmergencyTaskContentVo> getContentList(@Param("stepCode") String stepCode, @Param("planType") String planType);
List<EmergencyTaskContentVo> getMustTaskList(@Param("stepCode") String stepCode); List<EmergencyTaskContentVo> getMustTaskList(@Param("stepCode") String stepCode, @Param("planType") String planType);
} }
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
void save(EmergencyTaskRole emergencyTaskRole);
int countByCode(String code);
int updateById(EmergencyTaskRole emergencyTaskRole);
EmergencyTaskRole selectById(Long id);
int getInfoCount(EmergencyTaskRole emergencyTaskRole);
List<EmergencyTaskRole> getInfoByPage(Integer pageNum,
Integer size,
EmergencyTaskRole emergencyTaskRole);
int deleteById(Long id);
int deleteRelationByRoleId(Long roleId);
EmergencyTaskRole selectByCode(String code);
List<EmergencyTaskRole> selectList();
List<EmergencyTaskRole> selectListFilterEmptyTask();
String getPlanStepInfoByType(@Param("planType") String planType);
}
...@@ -57,4 +57,6 @@ public interface PlanDetailMapper { ...@@ -57,4 +57,6 @@ public interface PlanDetailMapper {
String queryBatchNoByFireEquipmentId(@Param("fireEquipmentId") String fireEquipmentId); String queryBatchNoByFireEquipmentId(@Param("fireEquipmentId") String fireEquipmentId);
PlanDetailVo getPlanDetailById(@Param("id") String id);
} }
package com.yeejoin.amos.fas.business.dao.repository;
import com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole;
import org.springframework.stereotype.Repository;
@Repository
public interface EmergencyTaskRoleDao extends BaseDao<EmergencyTaskRole, Long> {
}
...@@ -45,39 +45,39 @@ public class RemoteSecurityService { ...@@ -45,39 +45,39 @@ public class RemoteSecurityService {
@Autowired @Autowired
AmosRequestContext amosRequestContext; AmosRequestContext amosRequestContext;
@Value("${amos.system.user.password}") @Value("${amos.system.user.password}")
private String password; private String password;
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
//根据公司名称获取公司人 //根据公司名称获取公司人
public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) { public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<CompanyModel> userModel=null; List<CompanyModel> userModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.companyClient.queryAgencyTree(companyName); feignClientResult = Privilege.companyClient.queryAgencyTree(companyName);
userModel = (List<CompanyModel>) feignClientResult.getResult(); userModel = (List<CompanyModel>) feignClientResult.getResult();
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return userModel; return userModel;
} }
//部门id获取部门信息 //部门id获取部门信息
public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) { public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) {
if (deparmentId == null || deparmentId.equals("")) { if (deparmentId == null || deparmentId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
DepartmentModel departmentModel=null; DepartmentModel departmentModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.departmentClient.seleteOne(Long.valueOf(deparmentId)); feignClientResult = Privilege.departmentClient.seleteOne(Long.valueOf(deparmentId));
departmentModel = (DepartmentModel) feignClientResult.getResult(); departmentModel = (DepartmentModel) feignClientResult.getResult();
...@@ -85,18 +85,18 @@ public class RemoteSecurityService { ...@@ -85,18 +85,18 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return departmentModel; return departmentModel;
} }
//查询指定部门数 //查询指定部门数
public List<DepartmentModel> listDepartmentsByCompanyId(String toke,String product,String appKey,String companyId) { public List<DepartmentModel> listDepartmentsByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) { if (companyId == null || companyId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null; List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId)); feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId));
departmentModel = ( List<DepartmentModel>) feignClientResult.getResult(); departmentModel = ( List<DepartmentModel>) feignClientResult.getResult();
...@@ -104,19 +104,19 @@ public class RemoteSecurityService { ...@@ -104,19 +104,19 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return departmentModel; return departmentModel;
} }
// * 根据公司id查询机构用户 // * 根据公司id查询机构用户
public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) { public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) { if (companyId == null || companyId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<AgencyUserModel> AgencyUserModel=null; List<AgencyUserModel> AgencyUserModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByCompanyId(Long.valueOf(companyId),null,null,true); feignClientResult = Privilege.agencyUserClient.queryByCompanyId(Long.valueOf(companyId),null,null,true);
AgencyUserModel = ( List<AgencyUserModel>) feignClientResult.getResult(); AgencyUserModel = ( List<AgencyUserModel>) feignClientResult.getResult();
...@@ -152,8 +152,8 @@ public class RemoteSecurityService { ...@@ -152,8 +152,8 @@ public class RemoteSecurityService {
} }
public Toke getServerToken() { public Toke getServerToken() {
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel(); IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName()); dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
try { try {
dPasswordAuthModel.setPassword(PwdUtil.encode(password)); dPasswordAuthModel.setPassword(PwdUtil.encode(password));
} catch (GeneralSecurityException e) { } catch (GeneralSecurityException e) {
...@@ -161,23 +161,24 @@ public class RemoteSecurityService { ...@@ -161,23 +161,24 @@ public class RemoteSecurityService {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
Toke toke = null;
Toke toke = null;
try { try {
toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class); toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class);
if(ObjectUtils.isEmpty(toke)){ if(ObjectUtils.isEmpty(toke)){
toke = getLogin(dPasswordAuthModel); toke = getLogin(dPasswordAuthModel);
}else{ }else{
RequestContext.setProduct(amosRequestContext.getProduct()); RequestContext.setProduct(amosRequestContext.getProduct());
if (!TokenOperation.refresh(toke.getToke())) { if (!TokenOperation.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel); toke = getLogin(dPasswordAuthModel);
} }
} }
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return toke; return toke;
} }
private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){ private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){
Toke toke = new Toke(); Toke toke = new Toke();
RequestContext.setProduct(amosRequestContext.getProduct()); RequestContext.setProduct(amosRequestContext.getProduct());
...@@ -187,8 +188,8 @@ public class RemoteSecurityService { ...@@ -187,8 +188,8 @@ public class RemoteSecurityService {
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS); redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
return toke; return toke;
} }
//redi缓存系统用户token信息 //redi缓存系统用户token信息
private String buildKey(String username) { private String buildKey(String username) {
return "system_" + username; return "system_" + username;
...@@ -203,12 +204,12 @@ public class RemoteSecurityService { ...@@ -203,12 +204,12 @@ public class RemoteSecurityService {
* @param userIds * @param userIds
* @return * @return
*/ */
public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) { public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null; List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByIds(userIds,true); feignClientResult = Privilege.agencyUserClient.queryByIds(userIds,true);
agencyUserModel = (List<AgencyUserModel> ) feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel> ) feignClientResult.getResult();
...@@ -216,75 +217,75 @@ public class RemoteSecurityService { ...@@ -216,75 +217,75 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return agencyUserModel; return agencyUserModel;
} }
/** /**
* 根据用户ids获取用户实体列表 * 根据用户ids获取用户实体列表
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param userIds * @param userIds
* @return * @return
*/ */
public Map<String,AgencyUserModel> getUsersMap(String toke,String product,String appKey,Set<Object> userIds){ public Map<String,AgencyUserModel> getUsersMap(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds)); List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, AgencyUserModel> userMap = new HashMap<>(); Map<String, AgencyUserModel> userMap = new HashMap<>();
if(users!=null){ if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1)); userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1));
} }
return userMap; return userMap;
} }
/** /**
* 根据用户ids获取用户名称列表 * 根据用户ids获取用户名称列表
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param userIds * @param userIds
* @return * @return
*/ */
public Map<String,String> getUserRealName(String toke,String product,String appKey,Set<Object> userIds){ public Map<String,String> getUserRealName(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds)); List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userMap = new HashMap<>(); Map<String, String> userMap = new HashMap<>();
if(users!=null){ if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName)); userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
} }
return userMap; return userMap;
} }
/** /**
* 根据部门ids获取部门名称 * 根据部门ids获取部门名称
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param depIds * @param depIds
* @return * @return
*/ */
public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){ public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){
List<DepartmentModel> depts = new ArrayList<>(); List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(depIds)){ if(!CollectionUtils.isEmpty(depIds)){
depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds)); depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds));
} }
Map<Long, String> deptMap = new HashMap<>(); Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){ if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName)); deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
} }
return deptMap; return deptMap;
} }
//用户id获取用户信息 //用户id获取用户信息
public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) { public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) {
if (userId == null || userId.equals("")) { if (userId == null || userId.equals("")) {
return null; return null;
} }
// CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId); // CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId);
// return handleObj(commonResponse, UserModel.class); // return handleObj(commonResponse, UserModel.class);
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null; AgencyUserModel agencyUserModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByUserId(userId); feignClientResult = Privilege.agencyUserClient.queryByUserId(userId);
agencyUserModel = (AgencyUserModel)feignClientResult.getResult(); agencyUserModel = (AgencyUserModel)feignClientResult.getResult();
...@@ -292,8 +293,8 @@ public class RemoteSecurityService { ...@@ -292,8 +293,8 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return agencyUserModel; return agencyUserModel;
} }
/** /**
* 根据orgCode查询机构用户 * 根据orgCode查询机构用户
...@@ -303,22 +304,22 @@ public class RemoteSecurityService { ...@@ -303,22 +304,22 @@ public class RemoteSecurityService {
* @param orgCode orgCode * @param orgCode orgCode
* @return List<AgencyUserModel> * @return List<AgencyUserModel>
*/ */
public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) { public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) { if (orgCode == null || orgCode.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null; List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult = new FeignClientResult(); FeignClientResult feignClientResult = new FeignClientResult();
try { try {
feignClientResult = Privilege.agencyUserClient.queryByOrgCode(orgCode,null); feignClientResult = Privilege.agencyUserClient.queryByOrgCode(orgCode,null);
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return handleArray(feignClientResult,AgencyUserModel.class); return handleArray(feignClientResult,AgencyUserModel.class);
} }
/** /**
* 根据orgCode查询机构 * 根据orgCode查询机构
...@@ -328,15 +329,15 @@ public class RemoteSecurityService { ...@@ -328,15 +329,15 @@ public class RemoteSecurityService {
* @param orgCode orgCode * @param orgCode orgCode
* @return Map<String, Object> * @return Map<String, Object>
*/ */
public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) { public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) { if (orgCode == null || orgCode.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
Map<String, Object> agencyUserModel=null; Map<String, Object> agencyUserModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.companyClient.queryByOrgcode(orgCode); feignClientResult = Privilege.companyClient.queryByOrgcode(orgCode);
agencyUserModel = (Map<String, Object>) feignClientResult.getResult(); agencyUserModel = (Map<String, Object>) feignClientResult.getResult();
...@@ -344,31 +345,31 @@ public class RemoteSecurityService { ...@@ -344,31 +345,31 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return agencyUserModel; return agencyUserModel;
} }
// 根据部门id查询机构用户 // 根据部门id查询机构用户
public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) { public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) {
if (departmentId == null || departmentId.equals("")) { if (departmentId == null || departmentId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null; List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByDepartmentId(Long.valueOf(departmentId),null,null,true); feignClientResult = Privilege.agencyUserClient.queryByDepartmentId(Long.valueOf(departmentId),null,null,true);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
...@@ -376,26 +377,26 @@ public class RemoteSecurityService { ...@@ -376,26 +377,26 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return agencyUserModel; return agencyUserModel;
} }
/** /**
* 获取子公司信息树结构 * 获取子公司信息树结构
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param companyId * @param companyId
* @return * @return
*/ */
public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) { public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) { if (companyId == null || companyId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<CompanyModel> companyModel=null; List<CompanyModel> companyModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.companyClient.querySubAgencyTree(Long.valueOf(companyId)); feignClientResult = Privilege.companyClient.querySubAgencyTree(Long.valueOf(companyId));
companyModel = (List<CompanyModel>)feignClientResult.getResult(); companyModel = (List<CompanyModel>)feignClientResult.getResult();
...@@ -403,26 +404,26 @@ public class RemoteSecurityService { ...@@ -403,26 +404,26 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return companyModel; return companyModel;
} }
/** /**
* 查询指定公司的部门树 * 查询指定公司的部门树
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param companyId * @param companyId
* @return * @return
*/ */
public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) { public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) { if (companyId == null || companyId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null; List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId)); feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId));
departmentModel = (List<DepartmentModel>)feignClientResult.getResult(); departmentModel = (List<DepartmentModel>)feignClientResult.getResult();
...@@ -430,10 +431,10 @@ public class RemoteSecurityService { ...@@ -430,10 +431,10 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return departmentModel; return departmentModel;
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId); // CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class); // return handleArray(commonResponse, DepartmentBo.class);
} }
/** /**
* 根据id批量获取部门信息 * 根据id批量获取部门信息
...@@ -443,44 +444,44 @@ public class RemoteSecurityService { ...@@ -443,44 +444,44 @@ public class RemoteSecurityService {
* @param "200".equals(feignClientResult.getStatus())departmentIds 部门ids * @param "200".equals(feignClientResult.getStatus())departmentIds 部门ids
* @return List<DepartmentModel> * @return List<DepartmentModel>
*/ */
public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) { public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
FeignClientResult feignClientResult = new FeignClientResult(); FeignClientResult feignClientResult = new FeignClientResult();
try { try {
feignClientResult = Privilege.departmentClient.queryDeptByIds(departmentIds); feignClientResult = Privilege.departmentClient.queryDeptByIds(departmentIds);
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return handleArray(feignClientResult,DepartmentModel.class); return handleArray(feignClientResult,DepartmentModel.class);
} }
private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) { private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) {
List<T> list = new ArrayList<>(); List<T> list = new ArrayList<>();
if (feignClientResult != null && feignClientResult.getStatus() == 200) { if (feignClientResult != null && feignClientResult.getStatus() == 200) {
String jsonStr = JSON.toJSONString(feignClientResult.getResult()); String jsonStr = JSON.toJSONString(feignClientResult.getResult());
list = JSONArray.parseArray(jsonStr, t); list = JSONArray.parseArray(jsonStr, t);
} }
return list; return list;
} }
private <T> T handleObj(CommonResponse commonResponse, Class<T> t) { private <T> T handleObj(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) { if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList()); String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONObject.parseObject(jsonStr, t); return JSONObject.parseObject(jsonStr, t);
} }
return null; return null;
} }
/** /**
* 基础平台全部菜单权限树,用于平台登录前端初始化路由 * 基础平台全部菜单权限树,用于平台登录前端初始化路由
*/ */
public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) { public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<PermissionModel> dictionarieModel=null; List<PermissionModel> dictionarieModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.permissionClient.queryPermissionTree(appType,null,null,null,appKey); feignClientResult = Privilege.permissionClient.queryPermissionTree(appType,null,null,null,appKey);
dictionarieModel = (List<PermissionModel>)feignClientResult.getResult(); dictionarieModel = (List<PermissionModel>)feignClientResult.getResult();
...@@ -488,23 +489,23 @@ public class RemoteSecurityService { ...@@ -488,23 +489,23 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
CommonResponse commonResponse =new CommonResponse("SUCCESS",dictionarieModel); CommonResponse commonResponse =new CommonResponse("SUCCESS",dictionarieModel);
return commonResponse ; return commonResponse ;
} }
/** /**
* 根据Code查询指定的字典信息. * 根据Code查询指定的字典信息.
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param dictCode * @param dictCode
* @return * @return
*/ */
public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) { public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
List<DictionarieValueModel> dictionarieModel=null; List<DictionarieValueModel> dictionarieModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Systemctl.dictionarieClient.dictValues(dictCode); feignClientResult = Systemctl.dictionarieClient.dictValues(dictCode);
dictionarieModel = (List<DictionarieValueModel>)feignClientResult.getResult(); dictionarieModel = (List<DictionarieValueModel>)feignClientResult.getResult();
...@@ -513,29 +514,29 @@ public class RemoteSecurityService { ...@@ -513,29 +514,29 @@ public class RemoteSecurityService {
e.printStackTrace(); e.printStackTrace();
} }
if (dictionarieModel != null ) { if (dictionarieModel != null ) {
String jsonStr = JSON.toJSONString(dictionarieModel); String jsonStr = JSON.toJSONString(dictionarieModel);
return JSONArray.parseArray(jsonStr); return JSONArray.parseArray(jsonStr);
} }
return null; return null;
} }
/** /**
* 查询指定公司信息与其部门用户树 * 查询指定公司信息与其部门用户树
* @param toke * @param toke
* @param product * @param product
* @param appKey * @param appKey
* @param companyId * @param companyId
* @return * @return
*/ */
public CompanyModel listUserByCompanyId1(String toke,String product,String appKey,String companyId) { public CompanyModel listUserByCompanyId1(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) { if (companyId == null || companyId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
CompanyModel companyModel=null; CompanyModel companyModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId)); feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult(); companyModel = (CompanyModel)feignClientResult.getResult();
...@@ -543,34 +544,34 @@ public class RemoteSecurityService { ...@@ -543,34 +544,34 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return companyModel; return companyModel;
} }
public boolean loginOutFromApp(String toke,String product,String appKey) { public boolean loginOutFromApp(String toke,String product,String appKey) {
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
boolean flag=false; boolean flag=false;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.authClient.removeToken(); feignClientResult = Privilege.authClient.removeToken();
flag=true; flag=true;
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
return flag;
}
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) { return flag;
RequestContext.setToken(toke); }
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
CompanyModel companyModel=null; RequestContext.setToken(toke);
FeignClientResult feignClientResult; RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId)); feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult(); companyModel = (CompanyModel)feignClientResult.getResult();
...@@ -578,29 +579,29 @@ public class RemoteSecurityService { ...@@ -578,29 +579,29 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (companyModel != null ) { if (companyModel != null ) {
String jsonStr =null; String jsonStr =null;
jsonStr = JSON.toJSONString(companyModel.getChildren());
return JSONArray.parseArray(jsonStr);
}
return null;
}
public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) { jsonStr = JSON.toJSONString(companyModel.getChildren());
boolean flag=false;
RequestContext.setToken(toke); return JSONArray.parseArray(jsonStr);
RequestContext.setProduct(product); }
RequestContext.setAppKey(appKey); return null;
AgencyUserModel agencyUserModel=new AgencyUserModel(); }
agencyUserModel.setPassword(oldPassword);
agencyUserModel.setRePassword(newPassword); public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) {
agencyUserModel.setOriginalPassword(newPassword); boolean flag=false;
RequestContext.setToken(toke);
AgencyUserModel agencyUserModel2=null; RequestContext.setProduct(product);
FeignClientResult feignClientResult; RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(oldPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(newPassword);
AgencyUserModel agencyUserModel2=null;
FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.modifyPassword(userId,agencyUserModel); feignClientResult = Privilege.agencyUserClient.modifyPassword(userId,agencyUserModel);
...@@ -609,11 +610,11 @@ public class RemoteSecurityService { ...@@ -609,11 +610,11 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(agencyUserModel2!=null){ if(agencyUserModel2!=null){
flag=true; flag=true;
} }
return false; return false;
} }
} }
...@@ -458,12 +458,19 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -458,12 +458,19 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@Override @Override
public Optional<Equipment> clickButton(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String isExecute, String isAuto, String token, String product, String appKey,String startUserName) throws Exception { public Optional<Equipment> clickButton(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String isExecute, String isAuto, String token, String product, String appKey,String startUserName) throws Exception {
if ("0".equals(stepCode)) { String planType = null;
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
// 此处逻辑修改为所有任务执行完成才会点亮节点
List<EmergencyTaskContentVo> tasks = emergencyTaskService.getMustTaskList(stepCode, planType);
boolean flag = judgeIfConfirmed(tasks, batchNo);
if ("0".equals(stepCode) && flag) {
contingencyInstance.fire(batchNo, stepCode, buttonJson, contingencyPlanId, contingencyInstance.fire(batchNo, stepCode, buttonJson, contingencyPlanId,
"FIRE_CONFIRM", buttonState, stepStateOnbutton, "true", "false", token, "FIRE_CONFIRM", buttonState, stepStateOnbutton, "true", "false", token,
product, appKey, startUserName); product, appKey, startUserName);
} }
ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(contingencyPlanId); ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(contingencyPlanId);
instance.setId(null); instance.setId(null);
instance.setRecordType("REPLYMESSAGE"); instance.setRecordType("REPLYMESSAGE");
...@@ -471,8 +478,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -471,8 +478,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
instance.setContent(instance.getCategory()); instance.setContent(instance.getCategory());
ContingencyPlanInstance res = repository.save(instance); ContingencyPlanInstance res = repository.save(instance);
if (!ObjectUtils.isEmpty(res)) { if (!ObjectUtils.isEmpty(res)) {
List<EmergencyTaskContentVo> mustTasks = emergencyTaskService.getMustTaskList(stepCode);
boolean flag = judgeIfConfirmed(mustTasks, batchNo);
if (!"-1".equals(stepCode) && flag) { if (!"-1".equals(stepCode) && flag) {
PlanExecuteVo vo = new PlanExecuteVo(); PlanExecuteVo vo = new PlanExecuteVo();
vo.setConfirm(buttonState); vo.setConfirm(buttonState);
...@@ -535,19 +540,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -535,19 +540,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return Optional.empty(); return Optional.empty();
} }
private boolean judgeIfConfirmed(List<EmergencyTaskContentVo> mustTasks, String batchNo) { private boolean judgeIfConfirmed(List<EmergencyTaskContentVo> tasks, String batchNo) {
if (0 == mustTasks.size()) { boolean flag = Boolean.TRUE;
return true; if (!CollectionUtils.isEmpty(tasks)) {
} EmergencyTaskContentVo contentVo = tasks.get(0);
EmergencyTaskContentVo vo = mustTasks.get(0); // 权限处理
// 权限处理 PermissionInterceptorContext.setDataAuthRule(authKey);
PermissionInterceptorContext.setDataAuthRule(authKey); Integer count = contingencyPlanInstanceMapper.getPlanInstanceByRunState(contentVo.getStepCode(), batchNo);
Integer count = contingencyPlanInstanceMapper.getPlanInstanceByRunState(vo.getStepCode(), batchNo); if (0 != count) {
if (0 == count) { flag = Boolean.FALSE;
return true; }
} else {
return false;
} }
return flag;
} }
@Autowired @Autowired
......
...@@ -13,10 +13,7 @@ import com.yeejoin.amos.fas.business.param.AlarmParam; ...@@ -13,10 +13,7 @@ import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.service.intfc.*; import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.util.TreeUtil; import com.yeejoin.amos.fas.business.util.TreeUtil;
import com.yeejoin.amos.fas.business.vo.*; import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum; import com.yeejoin.amos.fas.common.enums.*;
import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.common.enums.ExecutionTypeEnum;
import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum; import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum; import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.core.util.DateUtil; import com.yeejoin.amos.fas.core.util.DateUtil;
...@@ -26,6 +23,7 @@ import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; ...@@ -26,6 +23,7 @@ import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext; import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -47,6 +45,7 @@ import org.typroject.tyboot.component.emq.EmqxListener; ...@@ -47,6 +45,7 @@ import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
...@@ -150,7 +149,13 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -150,7 +149,13 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
logger.info("========状态校验==========="); logger.info("========状态校验===========");
ReserveEnum reserveEnum = this.runCheck(vo); ReserveEnum reserveEnum = this.runCheck(vo);
result.setMessage(reserveEnum.getText()); result.setMessage(reserveEnum.getText());
planStepService.initPlanStep(); PlanDetailVo detailVo = planDetailMapper.getPlanDetailById(vo.getPlanId());
Optional<PlanClassifyTree> tree = classifyTreeDao.findById(detailVo.getClassifyId());
if (tree.isPresent()) {
PlanClassifyTree entity = tree.get();
redisTemplate.opsForValue().set("planType", entity.getPlanType());
planStepService.initPlanStep();
}
if (ReserveEnum.THISRUNNING.getStatus().equals(reserveEnum.getStatus())) { if (ReserveEnum.THISRUNNING.getStatus().equals(reserveEnum.getStatus())) {
List<PlanOperationRecord> recordList = planOperationRecordDao.findByPlanId1(Long.valueOf(vo.getPlanId())); List<PlanOperationRecord> recordList = planOperationRecordDao.findByPlanId1(Long.valueOf(vo.getPlanId()));
result.setMessage(ReserveEnum.THISRUNNING.getText()); result.setMessage(ReserveEnum.THISRUNNING.getText());
...@@ -246,7 +251,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -246,7 +251,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
instanceInfo.setName(detail.getPlanName()); instanceInfo.setName(detail.getPlanName());
instanceInfo.setOrgCode(detail.getOrgCode()); instanceInfo.setOrgCode(detail.getOrgCode());
instanceInfo.setPosition(equipmentSpecific.getPosition()); instanceInfo.setPosition(equipmentSpecific.getPosition());
contingencyInstanceInfoService.addDisposalDetails(instanceInfo); contingencyInstanceInfoService.addDisposalDetails(instanceInfo);
result.setMessage(ReserveEnum.RUN.getText()); result.setMessage(ReserveEnum.RUN.getText());
result.setBatchNo(batchNo); result.setBatchNo(batchNo);
...@@ -339,8 +344,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -339,8 +344,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Override @Override
public List<HashMap<String, Object>> getBatchNoByCode(String code) { public List<HashMap<String, Object>> getBatchNoByCode(String code) {
List<HashMap<String, Object>> list = new ArrayList<>(); List<HashMap<String, Object>> list = new ArrayList<>();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
String idByCode = equipmentSpecificMapper.getIdByCode(code); String idByCode = equipmentSpecificMapper.getIdByCode(code);
if (StringUtils.isEmpty(idByCode)) { if (StringUtils.isEmpty(idByCode)) {
return list; return list;
...@@ -871,11 +874,11 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -871,11 +874,11 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
} }
@Override @Override
public Page<ContingencyPlanInstanceVO> selectTaskActionPage(int current, int size, String batchNo, String runState, String updateDate, List<String> roleList) { public Page<ContingencyPlanInstanceVO> selectTaskActionPage(int current, int size, String batchNo, String runState, String updateDate, List<String> roleList, List<String> steps) {
String type = "TASKOPERATE"; String type = "TASKOPERATE";
Page<ContingencyPlanInstanceVO> page = new Page<>(current, size); Page<ContingencyPlanInstanceVO> page = new Page<>(current, size);
int total = 0; int total = 0;
total = contingencyInstanceInfoMapper.countTaskPage(type, batchNo, roleList); total = contingencyInstanceInfoMapper.countTaskPage(type, batchNo, roleList, steps);
long start = (page.getCurrent() - 1) * page.getSize(); long start = (page.getCurrent() - 1) * page.getSize();
if (total == 0) { if (total == 0) {
page.setCurrent(1); page.setCurrent(1);
...@@ -886,7 +889,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -886,7 +889,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
} }
// 权限处理 // 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey); PermissionInterceptorContext.setDataAuthRule(authKey);
List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.getTaskActionPage((int) start, size, batchNo, type, runState, updateDate, roleList); List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.getTaskActionPage((int) start, size, batchNo, type, runState, updateDate, roleList, steps);
list.stream().forEach(e->{ list.stream().forEach(e->{
if(ObjectUtils.isEmpty(e.getCreateUser())) { if(ObjectUtils.isEmpty(e.getCreateUser())) {
List<String> userName = planVisual3dService.getUserName(e.getRoleCode()); List<String> userName = planVisual3dService.getUserName(e.getRoleCode());
......
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskRoleService;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class EmergencyTaskRoleServiceImpl implements IEmergencyTaskRoleService {
}
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo; import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent; import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskMapper; import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskMapper;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository; import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
...@@ -17,10 +18,7 @@ import com.yeejoin.amos.fas.business.vo.EmergencyTaskContentVo; ...@@ -17,10 +18,7 @@ import com.yeejoin.amos.fas.business.vo.EmergencyTaskContentVo;
import com.yeejoin.amos.fas.business.vo.MessageVO; import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelation;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree;
import com.yeejoin.amos.fas.dao.entity.EmergencyTaskContent;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext; import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
...@@ -68,6 +66,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -68,6 +66,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Autowired @Autowired
private PlanOperationRecordMapper planOperationRecordMapper; private PlanOperationRecordMapper planOperationRecordMapper;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
...@@ -76,17 +77,20 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -76,17 +77,20 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Value("${auth-key-auth-enabled:}") @Value("${auth-key-auth-enabled:}")
private String authKey; private String authKey;
String taskJson = "{\"type\":\"button\",\"operate\":[{\"code\":\"STOP_OIL_CONSERVATOR_DRAIN\",\"icon\":\"yellow\",\"state\":\"wait\",\"title\":\"已执行\",\"confirm\":false,\"content\":\"_content\",\"delayed\":[0],\"stepState\":\"A\",\"requestUrl\":\"/fireAutoSys/api/timeline/click\"}],\"stepCode\":\"_stepCode\"}";
@Override @Override
public Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable) { public Page<EmergencyTaskContent> list(Long obligationId, String planType, CommonPageable pageable) {
int total = emergencyTaskMapper.getEmergencyTaskCount(obligationId); int total = emergencyTaskMapper.getEmergencyTaskCount(obligationId, planType);
List<EmergencyTaskContent> emergencyTaskList = emergencyTaskMapper.getEmergencyTaskList(obligationId, pageable.getOffset(), pageable.getPageSize()); List<EmergencyTaskContent> emergencyTaskList = emergencyTaskMapper.getEmergencyTaskList(obligationId, pageable.getOffset(), pageable.getPageSize(), planType);
Page<EmergencyTaskContent> result = new PageImpl<>(emergencyTaskList, pageable, total); org.springframework.data.domain.Page<EmergencyTaskContent> result = new PageImpl<>(emergencyTaskList, pageable, total);
return result; return result;
} }
@Override @Override
public List<EmergencyRelationTree> treeList() { public List<EmergencyRelationTree> treeList() {
return emergencyTaskMapper.treeList(); return emergencyTaskMapper.treeList();
} }
...@@ -101,6 +105,26 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -101,6 +105,26 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
} }
@Override @Override
public void saveTaskConfig(EmergencyTaskContent emergencyTaskContent) {
List<String> roleList = emergencyTaskContent.getRoleCodeList();
for (String role : roleList
) {
String json = taskJson.replace("_content", emergencyTaskContent.getContent()).replace("_stepCode", emergencyTaskContent.getStepCode());
emergencyTaskContent.setButtonJson(json);
EmergencyTaskRole emergencyTaskRole = emergencyTaskRoleMapper.selectById(Long.valueOf(role));
emergencyTaskContent.setRoleCode(emergencyTaskRole.getCode());
emergencyTaskContent.setObligationName(emergencyTaskRole.getName());
if("1".equals(emergencyTaskContent.getIsMustString())) {
emergencyTaskContent.setMust(true);
} else {
emergencyTaskContent.setMust(false);
}
emergencyTaskContent.setObligationId(emergencyTaskRole.getId());
emergencyTaskMapper.saveTaskConfig(emergencyTaskContent);
}
}
@Override
public String getRolesByUserId(String userId) { public String getRolesByUserId(String userId) {
// 权限处理 // 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey); PermissionInterceptorContext.setDataAuthRule(authKey);
...@@ -125,7 +149,11 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -125,7 +149,11 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Transactional @Transactional
@Override @Override
public void saveTask(String stepCode, String batchId) { public void saveTask(String stepCode, String batchId) {
List<EmergencyTaskContentVo> list = emergencyTaskMapper.getContentList(stepCode); String planType = null;
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
List<EmergencyTaskContentVo> list = emergencyTaskMapper.getContentList(stepCode, planType);
if (0 < list.size()) { if (0 < list.size()) {
String batchNo = StringUtil.isNotEmpty(batchId) ? batchId : planOperationRecordMapper.getLastBatchNo(); String batchNo = StringUtil.isNotEmpty(batchId) ? batchId : planOperationRecordMapper.getLastBatchNo();
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
...@@ -147,7 +175,7 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -147,7 +175,7 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
contingencyPlanInstance.setTaskSort(taskNum); contingencyPlanInstance.setTaskSort(taskNum);
contingencyPlanInstance.setStepCode(stepCode); contingencyPlanInstance.setStepCode(stepCode);
contingencyPlanInstance.setContent(buttonJson); contingencyPlanInstance.setContent(buttonJson);
contingencyPlanInstanceRepository.save(contingencyPlanInstance); contingencyPlanInstanceRepository.saveAndFlush(contingencyPlanInstance);
if ("0".equals(stepCode)) { if ("0".equals(stepCode)) {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
...@@ -199,9 +227,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -199,9 +227,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
} }
@Override @Override
public List<EmergencyTaskContentVo> getMustTaskList(String stepCode) { public List<EmergencyTaskContentVo> getMustTaskList(String stepCode, String planType) {
// 权限处理 // 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey); PermissionInterceptorContext.setDataAuthRule(authKey);
return emergencyTaskMapper.getMustTaskList(stepCode); return emergencyTaskMapper.getMustTaskList(stepCode, planType);
} }
} }
...@@ -2,20 +2,16 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,20 +2,16 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanMessageMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanMessageDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanMessageDao;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService; import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService; import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanStepService;
import com.yeejoin.amos.fas.business.vo.ConditionVO; import com.yeejoin.amos.fas.business.vo.ConditionVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO; import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum; import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.PlanMessage; import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext; import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
...@@ -24,15 +20,12 @@ import org.apache.commons.lang3.StringUtils; ...@@ -24,15 +20,12 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; 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.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -89,10 +82,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -89,10 +82,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired @Autowired
private EquipmentSpecificMapper equipmentSpecificMapper; private IPlanStepService iPlanStepService;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@Override @Override
public List<EquipmentFireEquipment> findByEquipmentId(Long equipmentId) { public List<EquipmentFireEquipment> findByEquipmentId(Long equipmentId) {
...@@ -181,13 +172,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -181,13 +172,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
if (ObjectUtils.isEmpty(index)) { if (ObjectUtils.isEmpty(index)) {
return false; return false;
} }
String json; String planStep = iPlanStepService.getPlanStep();
try { List<PlanStepJsonVO> result = JSONObject.parseArray(planStep, PlanStepJsonVO.class);
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案节点信息失败!");
}
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(result)) {
// 权限处理 // 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey); PermissionInterceptorContext.setDataAuthRule(authKey);
......
...@@ -25,9 +25,11 @@ import com.yeejoin.amos.fas.business.util.RpnUtils; ...@@ -25,9 +25,11 @@ import com.yeejoin.amos.fas.business.util.RpnUtils;
import com.yeejoin.amos.fas.business.vo.*; import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue; import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum; import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.common.enums.PlanTypeEnum;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import org.apache.commons.io.IOUtils;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext; import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -45,6 +47,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -45,6 +47,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.awt.*; import java.awt.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
...@@ -84,6 +87,12 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -84,6 +87,12 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${plan.dynamic.execut.topic}") @Value("${plan.dynamic.execut.topic}")
private String planDynamicExecutTopic; private String planDynamicExecutTopic;
@Value("${plan.dynamic.execut.zb.topic}")
private String planDynamicExecutZBTopic;
@Value("${plan.dynamic.execut.gk.topic}")
private String planDynamicExecutGKTopic;
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
...@@ -202,15 +211,15 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -202,15 +211,15 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
if ("false".equals(topicEntity.getSimulationDate()) && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)) { if ("false".equals(topicEntity.getSimulationDate()) && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)) {
log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode() + "-" + equipmentSpecificIndex.getNameKey() + ":" + equipmentSpecificIndex.getValue()); log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode() + "-" + equipmentSpecificIndex.getNameKey() + ":" + equipmentSpecificIndex.getValue());
// 三维屏指标状态推送,没有绑定模型的设备不需要推送至三维 // 三维屏指标状态推送,没有绑定模型的设备不需要推送至三维
if("true".equals(equipmentSpecific.getPush3D())){ if ("true".equals(equipmentSpecific.getPush3D())) {
equipmentSpecificIndex.setId(equipmentSpecific.getId()); equipmentSpecificIndex.setId(equipmentSpecific.getId());
equipmentSpecificIndex.setName(equipmentSpecific.getName()); equipmentSpecificIndex.setName(equipmentSpecific.getName());
equipmentSpecificIndex.setCode(equipmentSpecific.getCode()); equipmentSpecificIndex.setCode(equipmentSpecific.getCode());
equipmentSpecificIndex.setType("equip"); equipmentSpecificIndex.setType("equip");
String msg = JSON.toJSONString(equipmentSpecificIndex); String msg = JSON.toJSONString(equipmentSpecificIndex);
String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus"); String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus");
webMqttComponent.publish(title, msg); webMqttComponent.publish(title, msg);
} }
} }
...@@ -290,16 +299,16 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -290,16 +299,16 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode()))); webMqttComponent.publish(title, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode())));
} }
//根据指标数据处理预案按钮 //根据指标数据处理预案按钮
if(planIndex.contains(nameKey) && !ObjectUtils.isEmpty(equipment)){ if (planIndex.contains(nameKey) && !ObjectUtils.isEmpty(equipment)) {
DeviceRo deviceRo = new DeviceRo(); DeviceRo deviceRo = new DeviceRo();
deviceRo.setEquipmentCode(equipment.getCode()); deviceRo.setEquipmentCode(equipment.getCode());
deviceRo.setEquipmentId(equipment.getId()); deviceRo.setEquipmentId(equipment.getId());
deviceRo.setEquipmentSpecificId(equipmentSpecific.getId()); deviceRo.setEquipmentSpecificId(equipmentSpecific.getId());
deviceRo.setEquipmentSpecificCode(equipmentSpecific.getCode()); deviceRo.setEquipmentSpecificCode(equipmentSpecific.getCode());
deviceRo.setIotCode(equipmentSpecific.getIotCode()); deviceRo.setIotCode(equipmentSpecific.getIotCode());
deviceRo.setValue(equipmentSpecificIndex.getValue()); deviceRo.setValue(equipmentSpecificIndex.getValue());
deviceRo.setEquipmentIndexKey(equipmentSpecificIndex.getNameKey()); deviceRo.setEquipmentIndexKey(equipmentSpecificIndex.getNameKey());
planAutoExec(equipment, toke, deviceRo); planAutoExec(equipment, toke, deviceRo);
} }
} }
...@@ -310,16 +319,25 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -310,16 +319,25 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
* @param deviceRo * @param deviceRo
*/ */
private void planAutoExec(Equipment equipment, Toke toke, DeviceRo deviceRo) { private void planAutoExec(Equipment equipment, Toke toke, DeviceRo deviceRo) {
try { try {
RequestContext.setToken(toke.getToke()); RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct()); RequestContext.setProduct(toke.getProduct());
ruleTrigger.publish(deviceRo, planDynamicExecutTopic, new String[] {}); if (redisTemplate.hasKey("planType")) {
} catch (Exception e) { String planType = redisTemplate.boundValueOps("planType").get(0, -1);
e.printStackTrace(); if (PlanTypeEnum.MAINTRANSFORM.getKey().equalsIgnoreCase(planType)) {
} ruleTrigger.publish(deviceRo, planDynamicExecutZBTopic, new String[]{});
} } else if (PlanTypeEnum.HIGHRESISTANCE.getKey().equalsIgnoreCase(planType)) {
ruleTrigger.publish(deviceRo, planDynamicExecutGKTopic, new String[]{});
@Async } else {
ruleTrigger.publish(deviceRo, planDynamicExecutTopic, new String[]{});
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Async
public void sendWaterLevel(FormInstanceVo formInstanceVo) { public void sendWaterLevel(FormInstanceVo formInstanceVo) {
try { try {
String topic = String.format("/%s/%s/%s", serviceName, stationName, "analogue"); String topic = String.format("/%s/%s/%s", serviceName, stationName, "analogue");
...@@ -391,6 +409,47 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -391,6 +409,47 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
return true; return true;
} }
/**
* <pre>
* @Description: rpn, rpni值修改
* </pre>
*
* @MethodName:
* @Param: [fmeaId]
* @Return: void
* @Throws
* @Author keyong
* @Date 2020/11/16 18:26
*/
public void updateFmeaRpn(long fmeaId) {
Fmea fmea = fmeaMapper.getById(fmeaId);
BigDecimal oidValue = new BigDecimal(fmea.getOidValue());
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
// 计算rpni
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpn;
if (fmea.getNewEvaluationOid() == null) {
EvaluationModel evaluationModel = this.getEvaluationModel(fmeaId);
if (evaluationModel != null) { // 已经绑定点位或者巡检点项且匹配到风险模型,则更新为计算后的结果
BigDecimal newOidValue = new BigDecimal(evaluationModel.getCoefficient());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
fmea.setNewEvaluationOid(evaluationModel.getId());
} else { // 未绑定点位或者巡检点项或者匹配不到风险模型,则更新为rpn与rpni一致
fmea.setNewEvaluationOid(fmea.getEvaluationOid());
rpn = rpni;
}
} else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
}
fmea.setRpni(rpni);
fmea.setRpn(rpn);
// 更新fmea
fmeaMapper.updateRpn(fmea);
}
@Override @Override
public void subscribeTopic() { public void subscribeTopic() {
// 若登录系统则订阅装备数据 // 若登录系统则订阅装备数据
......
...@@ -62,6 +62,7 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService { ...@@ -62,6 +62,7 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
for (PlanClassifyTree planClassifyTree : list) { for (PlanClassifyTree planClassifyTree : list) {
PlanClassifyTreeVo planClassifyTreeVo = new PlanClassifyTreeVo(); PlanClassifyTreeVo planClassifyTreeVo = new PlanClassifyTreeVo();
BeanUtils.copyProperties(planClassifyTree, planClassifyTreeVo); BeanUtils.copyProperties(planClassifyTree, planClassifyTreeVo);
planClassifyTreeVo.setParentId(0L);
voList.add(planClassifyTreeVo); voList.add(planClassifyTreeVo);
} }
Map<Object, PlanClassifyTreeVo> map = Bean.listToMap(voList, "id", PlanClassifyTree.class); Map<Object, PlanClassifyTreeVo> map = Bean.listToMap(voList, "id", PlanClassifyTree.class);
...@@ -73,6 +74,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService { ...@@ -73,6 +74,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return TreeBuilder.buildByRecursive(completeList, ROOT); return TreeBuilder.buildByRecursive(completeList, ROOT);
} }
@Override
public List<PlanClassifyTree> findAllInfo() {
return planClassifyTreeDao.findAll();
}
private List<PlanClassifyTreeVo> buildWithParent(PlanClassifyTreeVo groupModel, Map<Object, PlanClassifyTreeVo> map) { private List<PlanClassifyTreeVo> buildWithParent(PlanClassifyTreeVo groupModel, Map<Object, PlanClassifyTreeVo> map) {
List<PlanClassifyTreeVo> completeList = new ArrayList<>(); List<PlanClassifyTreeVo> completeList = new ArrayList<>();
...@@ -137,6 +143,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService { ...@@ -137,6 +143,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return planClassifyTreeDao.save(model); return planClassifyTreeDao.save(model);
} }
@Override
public PlanClassifyTree findById(Long id) {
return planClassifyTreeDao.findById(id).orElse(new PlanClassifyTree());
}
private boolean classifyNameExist(String classifyName, Long parentId) { private boolean classifyNameExist(String classifyName, Long parentId) {
return 0 < planClassifyTreeDao.countByClassifyNameAndParentId(classifyName, parentId); return 0 < planClassifyTreeDao.countByClassifyNameAndParentId(classifyName, parentId);
} }
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper;
import com.yeejoin.amos.fas.business.service.intfc.IPlanStepService; import com.yeejoin.amos.fas.business.service.intfc.IPlanStepService;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO; import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -23,8 +19,8 @@ public class PlanStepServiceImpl implements IPlanStepService { ...@@ -23,8 +19,8 @@ public class PlanStepServiceImpl implements IPlanStepService {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Value("classpath:/json/plan-step.json") @Autowired
private Resource planStepResource; private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Override @Override
public String getPlanStepRoleCodeByButtonCode(String buttonCode) { public String getPlanStepRoleCodeByButtonCode(String buttonCode) {
...@@ -52,23 +48,26 @@ public class PlanStepServiceImpl implements IPlanStepService { ...@@ -52,23 +48,26 @@ public class PlanStepServiceImpl implements IPlanStepService {
@Override @Override
public List<PlanStepJsonVO> getPlanStepJsonVOS() { public List<PlanStepJsonVO> getPlanStepJsonVOS() {
String json = ""; String planStepString = getPlanStep();
try { List<PlanStepJsonVO> result = JSONObject.parseArray(planStepString, PlanStepJsonVO.class);
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案相关角色信息失败!");
}
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
return result; return result;
} }
@Override @Override
public String getPlanStep() { public String getPlanStep() {
try { String planType = "";
return IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8)); if (redisTemplate.hasKey("planType")) {
} catch (IOException e) { planType = redisTemplate.boundValueOps("planType").get(0, -1);
throw new RuntimeException("获取预案初始化planStep信息失败!");
} }
String json = emergencyTaskRoleMapper.getPlanStepInfoByType(planType);
return json;
}
@Override
public List<PlanStepJsonVO> getPlanStepByParam(String planType) {
String json = emergencyTaskRoleMapper.getPlanStepInfoByType(planType);
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
return result;
} }
@Override @Override
......
...@@ -26,6 +26,7 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil; ...@@ -26,6 +26,7 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel; import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext; import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.fas.dao.dto.PlanStepJsonVO;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
...@@ -283,6 +284,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -283,6 +284,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
@Override @Override
public List<PlanStepJsonVO> getPlanStepList(String batchNo) {
String json = planStepService.getPlanStep();
List<PlanStepJsonVO> res = JSONObject.parseArray(json, PlanStepJsonVO.class);
return res;
}
@Override
public ToipResponse getPlaneRecordByBatchNo(String batchNo) { public ToipResponse getPlaneRecordByBatchNo(String batchNo) {
// 根据批次号获取预案记录 // 根据批次号获取预案记录
List<Map<String, Object>> instancesList = contingencyPlanInstanceRepository.queryRecord(batchNo, "MESSAGE"); List<Map<String, Object>> instancesList = contingencyPlanInstanceRepository.queryRecord(batchNo, "MESSAGE");
......
...@@ -142,5 +142,5 @@ public interface IContingencyPlanService { ...@@ -142,5 +142,5 @@ public interface IContingencyPlanService {
String getPlanBatchNo(); String getPlanBatchNo();
Page<ContingencyPlanInstanceVO> selectTaskActionPage(int current, int size, String batchNo, String runState, String updateDate, List<String> roleList); Page<ContingencyPlanInstanceVO> selectTaskActionPage(int current, int size, String batchNo, String runState, String updateDate, List<String> roleList, List<String> steps);
} }
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.exception.YeeException;
import org.springframework.transaction.annotation.Transactional;
public interface IEmergencyTaskRoleService {
}
...@@ -12,7 +12,7 @@ import java.util.List; ...@@ -12,7 +12,7 @@ import java.util.List;
public interface IEmergencyTaskService { public interface IEmergencyTaskService {
Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable); Page<EmergencyTaskContent> list(Long obligationId, String planType, CommonPageable pageable);
List<EmergencyRelationTree> treeList(); List<EmergencyRelationTree> treeList();
...@@ -20,6 +20,8 @@ public interface IEmergencyTaskService { ...@@ -20,6 +20,8 @@ public interface IEmergencyTaskService {
void save(EmergencyRelation emergencyRelation); void save(EmergencyRelation emergencyRelation);
void saveTaskConfig(EmergencyTaskContent emergencyTaskContent);
String getRolesByUserId(String userId); String getRolesByUserId(String userId);
List<Long> getPersonIds(Long obligationId); List<Long> getPersonIds(Long obligationId);
...@@ -28,5 +30,5 @@ public interface IEmergencyTaskService { ...@@ -28,5 +30,5 @@ public interface IEmergencyTaskService {
void saveTask(String stepCode, String batchNo); void saveTask(String stepCode, String batchNo);
List<EmergencyTaskContentVo> getMustTaskList(String stepCode); List<EmergencyTaskContentVo> getMustTaskList(String stepCode, String planType);
} }
...@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo; ...@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo;
import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree; import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree;
import java.util.Collection; import java.util.Collection;
import java.util.List;
/** /**
* @author wjk * @author wjk
...@@ -28,4 +29,8 @@ public interface IPlanClassifyTreeService { ...@@ -28,4 +29,8 @@ public interface IPlanClassifyTreeService {
PlanClassifyTree create(PlanClassifyTree model); PlanClassifyTree create(PlanClassifyTree model);
PlanClassifyTree update(PlanClassifyTree model); PlanClassifyTree update(PlanClassifyTree model);
PlanClassifyTree findById(Long id);
List<PlanClassifyTree> findAllInfo();
} }
...@@ -26,6 +26,8 @@ public interface IPlanStepService { ...@@ -26,6 +26,8 @@ public interface IPlanStepService {
String getPlanStep(); String getPlanStep();
List<PlanStepJsonVO> getPlanStepByParam(String planType);
void initPlanStep(); void initPlanStep();
void initPlanTask(); void initPlanTask();
......
...@@ -2,10 +2,8 @@ package com.yeejoin.amos.fas.business.service.intfc; ...@@ -2,10 +2,8 @@ package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.service.model.ToipResponse; import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO; import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.business.vo.MessageVO; import com.yeejoin.amos.fas.dao.dto.PlanStepJsonVO;
import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
...@@ -142,4 +140,6 @@ public interface IPlanVisual3dService { ...@@ -142,4 +140,6 @@ public interface IPlanVisual3dService {
* @return * @return
*/ */
ContingencyPlanInstance updateStatusByIdWeb(ContingencyPlanInstance contingencyPlanInstance, Boolean runStatus); ContingencyPlanInstance updateStatusByIdWeb(ContingencyPlanInstance contingencyPlanInstance, Boolean runStatus);
List<PlanStepJsonVO> getPlanStepList(String batchNo);
} }
...@@ -23,6 +23,7 @@ eureka.client.serviceUrl.defaultZone: http://${spring.security.user.name}:${spri ...@@ -23,6 +23,7 @@ eureka.client.serviceUrl.defaultZone: http://${spring.security.user.name}:${spri
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.security.enabled=true management.security.enabled=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info eureka.instance.status-page-url-path=/actuator/info
...@@ -55,12 +56,12 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in= ...@@ -55,12 +56,12 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in=
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${security-random-int} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin emqx.client-user-name=admin
emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p) emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p)
emqx.max-inflight=1000 emqx.max-inflight=1000
riskSourceService
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740 #\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
file.downLoad.url=http://172.16.11.201:9000/ file.downLoad.url=http://172.16.11.201:9000/
...@@ -105,6 +106,9 @@ plan.web.isUpdatePlanStep=false ...@@ -105,6 +106,9 @@ plan.web.isUpdatePlanStep=false
maparea.action.is-area=action1-2,action1-6 maparea.action.is-area=action1-2,action1-6
plan.dynamic.execut.topic=\u6362\u6D41\u7AD9\u6D88\u9632\u4E13\u9879\u9884\u6848/autoExec plan.dynamic.execut.topic=\u6362\u6D41\u7AD9\u6D88\u9632\u4E13\u9879\u9884\u6848/autoExec
# \u65B0\u589E\u4E3B\u53D8\u548C\u9AD8\u6297\u81EA\u52A8\u6267\u884C\u4E3B\u9898\u914D\u7F6E
plan.dynamic.execut.zb.topic=\u6362\u6D41\u7AD9\u6D88\u9632\u4E13\u9879\u9884\u6848/autoExec-ZB
plan.dynamic.execut.gk.topic=\u6362\u6D41\u7AD9\u6D88\u9632\u4E13\u9879\u9884\u6848/autoExec-GK
#\u670D\u52A1\u7AEF\u83B7\u53D6isdp\u7684token\u7528 #\u670D\u52A1\u7AEF\u83B7\u53D6isdp\u7684token\u7528
sso.client.id=dce sso.client.id=dce
......
...@@ -967,4 +967,53 @@ ...@@ -967,4 +967,53 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="zs" id="20240418-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="c_emergency_task_role" />
</not>
</preConditions>
<comment>create table c_emergency_task_role</comment>
<sql>
CREATE TABLE `c_emergency_task_role` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL COMMENT '角色名称',
`code` varchar(255) DEFAULT NULL COMMENT '角色编码',
`sort` varchar(255) DEFAULT NULL COMMENT '排序字段',
`is_delete` int DEFAULT NULL COMMENT '是否删除',
`remark` text COMMENT '备注',
`creater` varchar(255) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`biz_org_code` varchar(255) DEFAULT NULL COMMENT '机构编码',
`biz_org_name` varchar(255) DEFAULT NULL COMMENT '机构名称',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
</sql>
</changeSet>
<changeSet author="zs" id="20240419-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="c_plan_step_config" />
</not>
</preConditions>
<comment>create table c_plan_step_config</comment>
<sql>
CREATE TABLE `c_plan_step_config` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`type` varchar(255) DEFAULT NULL COMMENT '类型',
`data` longtext COMMENT 'json数据',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
</sql>
</changeSet>
<changeSet author="litengwei" id="20240425-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="c_plan_classify_tree" columnName="plan_type" />
</preConditions>
<comment>c_plan_classify_tree</comment>
<sql>
ALTER TABLE `c_plan_classify_tree` MODIFY COLUMN plan_type varchar(100) NULL COMMENT '分类TYPE';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -321,6 +321,11 @@ ...@@ -321,6 +321,11 @@
role_code like concat('%',#{role},'%') role_code like concat('%',#{role},'%')
</foreach> </foreach>
</if> </if>
<if test="steps != null and steps.size() >0">
<foreach collection="steps" item="code" index="index" open="and (" close=") " separator="or">
step_code = #{code}
</foreach>
</if>
</where> </where>
UNION ALL UNION ALL
select count(1) AS tmpcount from contingency_plan_instance select count(1) AS tmpcount from contingency_plan_instance
...@@ -337,6 +342,11 @@ ...@@ -337,6 +342,11 @@
role_code like concat('%',#{role},'%') role_code like concat('%',#{role},'%')
</foreach> </foreach>
</if> </if>
<if test="steps != null and steps.size() >0">
<foreach collection="steps" item="code" index="index" open="and (" close=") " separator="or">
step_code = #{code}
</foreach>
</if>
</where> </where>
) a ) a
</select> </select>
...@@ -346,10 +356,10 @@ ...@@ -346,10 +356,10 @@
select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num` select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
, cpi.`batch_no`, cpi.`create_date`, cpi.`create_user`, cpi.`update_date` , cpi.`batch_no`, cpi.`create_date`, cpi.`create_user`, cpi.`update_date`
, cpi.`update_user`, cpi.`is_delete`, cpi.`tips`, IFNULL(cpi.`runstate`, 0) AS runstate, cpi.`file_path` , cpi.`update_user`, cpi.`is_delete`, cpi.`tips`, IFNULL(cpi.`runstate`, 0) AS runstate, cpi.`file_path`
, `file_type`, `role_name`, `role_code`, `start_user_name` , `file_type`, `role_code`, ro.name AS role_name, `start_user_name`
, cpi.`start_user_id`, cpi.`person_img`,cii.name , cpi.`start_user_id`, cpi.`person_img`,cii.name
from contingency_plan_instance cpi left join contingency_instance_info cii from contingency_plan_instance cpi left join contingency_instance_info cii
on cpi.batch_no = cii.id on cpi.batch_no = cii.id left join c_emergency_task_role ro on ro.`code` = cpi.role_code
<where> <where>
cpi.step_code != "-1" cpi.step_code != "-1"
<if test="batchNo != null and batchNo != ''"> <if test="batchNo != null and batchNo != ''">
...@@ -363,6 +373,11 @@ ...@@ -363,6 +373,11 @@
cpi.role_code like concat('%',#{role},'%') cpi.role_code like concat('%',#{role},'%')
</foreach> </foreach>
</if> </if>
<if test="steps != null and steps.size() >0">
<foreach collection="steps" item="code" index="index" open="and (" close=") " separator="or">
step_code = #{code}
</foreach>
</if>
</where> </where>
UNION ALL UNION ALL
select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num` select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
...@@ -385,6 +400,11 @@ ...@@ -385,6 +400,11 @@
cpi.role_code like concat('%',#{role},'%') cpi.role_code like concat('%',#{role},'%')
</foreach> </foreach>
</if> </if>
<if test="steps != null and steps.size() >0">
<foreach collection="steps" item="code" index="index" open="and (" close=") " separator="or">
step_code = #{code}
</foreach>
</if>
</where> </where>
) tmp ) tmp
<if test="updateDate != null and updateDate != '' and updateDate == 0"> <if test="updateDate != null and updateDate != '' and updateDate == 0">
......
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper">
<insert id="save" parameterType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole">
INSERT INTO `c_emergency_task_role`(`name`, `code`, `sort`, `is_delete`, `remark`, `creater`, `create_date`, `biz_org_code`, `biz_org_name` )
VALUES (#{name}, #{code}, #{sort}, #{isDelete},#{remark},#{creater},#{createDate},#{bizOrgCode},#{bizOrgName});
</insert>
<update id="updateById">
UPDATE
c_emergency_task_role
SET `name` = #{name},
`code` = #{code},
`sort` = #{sort},
`remark` = #{remark},
`creater` = #{creater}
WHERE
`id` = #{id}
</update>
<select id="selectById" resultType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole">
select * from c_emergency_task_role where id = #{id}
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole">
select * from
c_emergency_task_role
where 1 = 1
and is_delete = 0
order by create_date DESC
limit #{pageNum}, #{size}
</select>
<select id="getInfoCount" resultType="java.lang.Integer">
select count(1) from
c_emergency_task_role
where 1 = 1
and is_delete = 0
</select>
<delete id="deleteById">
delete from
c_emergency_task_role
WHERE
`id` = #{id}
</delete>
<select id="countByCode" resultType="int">
select count(1) from c_emergency_task_role where is_delete = 0 and code = #{code}
</select>
<select id="selectByCode" resultType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole">
select * from c_emergency_task_role where is_delete = 0 and code = #{code}
</select>
<select id="selectList" resultType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole">
select * from c_emergency_task_role where is_delete = 0 order by sort desc
</select>
<select id="selectListFilterEmptyTask" resultType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole">
SELECT
*
FROM
c_emergency_task_role cet
JOIN c_emergency_task_content cetc ON cetc.obligation_id = cet.id
WHERE
is_delete = 0
GROUP BY
cet.`code`
ORDER BY
cet.sort DESC
</select>
<select id="getPlanStepInfoByType" resultType="java.lang.String">
select `data` from c_plan_step_config
<where>
1 = 1
<if test="planType != null and planType != ''">
AND type = #{planType}
</if>
</where>
order by id ASC
limit 1
</select>
<delete id="deleteRelationByRoleId">
delete from
c_emergency_relation
WHERE
`obligationId` = #{roleId}
</delete>
</mapper>
\ No newline at end of file
...@@ -134,6 +134,16 @@ ...@@ -134,6 +134,16 @@
and d.is_delete = false and d.is_delete = false
limit 1 limit 1
</select> </select>
<select id="getPlanDetailById" resultType="com.yeejoin.amos.fas.business.vo.PlanDetailVo">
select
d.classify_id AS classifyId
from
c_plan_detail d
LEFT JOIN c_plan_classify_tree ct ON d.classify_id = ct.id
where d.id = #{id}
and d.is_delete = false
limit 1
</select>
<update id="planReset"> <update id="planReset">
UPDATE c_plan_detail SET `status` = 2; UPDATE c_plan_detail SET `status` = 2;
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
</select> </select>
<select id="getArraysUserName" resultType="java.lang.String"> <select id="getArraysUserName" resultType="java.lang.String">
SELECT person_name from c_emergency_relation cer where obligationId in ( SELECT person_name from c_emergency_relation cer where obligationId in (
select id from f_dict fd where dict_value = #{roleCode} select id from c_emergency_task_role where code = #{roleCode}
) )
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -16,8 +16,11 @@ ...@@ -16,8 +16,11 @@
<if test="obligationId != null "> <if test="obligationId != null ">
obligation_id = #{obligationId} obligation_id = #{obligationId}
</if> </if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where> </where>
LIMIT #{offset}, #{pageSize} LIMIT #{offset}, #{pageSize}
</select> </select>
...@@ -28,11 +31,13 @@ ...@@ -28,11 +31,13 @@
FROM FROM
c_emergency_task_content c_emergency_task_content
<where> <where>
<if test="_parameter != null "> <if test="obligationId != null ">
obligation_id = #{obligationId} obligation_id = #{obligationId}
</if> </if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where> </where>
</select> </select>
...@@ -50,9 +55,9 @@ ...@@ -50,9 +55,9 @@
<select id="roleCodes" resultType="string"> <select id="roleCodes" resultType="string">
SELECT SELECT
f.dict_value f.code
FROM FROM
c_emergency_relation cer LEFT JOIN f_dict f ON cer.obligationId = f.id c_emergency_relation cer LEFT JOIN c_emergency_task_role f ON cer.obligationId = f.id
<where> <where>
<if test="_parameter != null "> <if test="_parameter != null ">
cer.amos_id = #{amosOrgId} cer.amos_id = #{amosOrgId}
...@@ -62,9 +67,9 @@ ...@@ -62,9 +67,9 @@
<select id="roleNames" resultType="string"> <select id="roleNames" resultType="string">
SELECT SELECT
f.dict_name AS dictName f.name AS dictName
FROM FROM
c_emergency_relation cer LEFT JOIN f_dict f ON cer.obligationId = f.id c_emergency_relation cer LEFT JOIN c_emergency_task_role f ON cer.obligationId = f.id
<where> <where>
<if test="_parameter != null "> <if test="_parameter != null ">
cer.amos_id = #{amosOrgId} cer.amos_id = #{amosOrgId}
...@@ -84,6 +89,17 @@ ...@@ -84,6 +89,17 @@
</where> </where>
</select> </select>
<delete id="deleteTask">
delete from c_emergency_task_content cer
<where>
<if test="id != null ">
cer.id = #{id}
</if>
</where>
</delete>
<delete id="deleteTreeNode"> <delete id="deleteTreeNode">
delete from c_emergency_relation cer delete from c_emergency_relation cer
...@@ -103,6 +119,11 @@ ...@@ -103,6 +119,11 @@
VALUES (#{id}, #{obligationId}, #{personId}, #{amosOrgId}, #{personName},#{createDate}); VALUES (#{id}, #{obligationId}, #{personId}, #{amosOrgId}, #{personName},#{createDate});
</insert> </insert>
<insert id="saveTaskConfig" parameterType="com.yeejoin.amos.fas.dao.entity.EmergencyTaskContent">
INSERT INTO `c_emergency_task_content`(`content`, `code`, `obligation_id`, `create_date`, `obligation_name`, `step_code`, `role_code`,`button_json`, `task_num`,`is_must`, `plan_type`)
VALUES (#{content}, #{code}, #{obligationId}, #{createDate},#{obligationName}, #{stepCode}, #{roleCode}, #{buttonJson},#{taskNum}, #{isMust} ,#{planType} );
</insert>
<select id="getContentList" resultType="com.yeejoin.amos.fas.business.vo.EmergencyTaskContentVo"> <select id="getContentList" resultType="com.yeejoin.amos.fas.business.vo.EmergencyTaskContentVo">
SELECT SELECT
* *
...@@ -115,6 +136,9 @@ ...@@ -115,6 +136,9 @@
<if test="stepCode != null and stepCode != '' and stepCode == '-2'"> <if test="stepCode != null and stepCode != '' and stepCode == '-2'">
step_code = -1 step_code = -1
</if> </if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where> </where>
</select> </select>
...@@ -124,9 +148,11 @@ ...@@ -124,9 +148,11 @@
FROM FROM
c_emergency_task_content c_emergency_task_content
<where> <where>
is_must = true
<if test="stepCode != null and stepCode != ''"> <if test="stepCode != null and stepCode != ''">
and step_code = #{stepCode} step_code = #{stepCode}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if> </if>
</where> </where>
</select> </select>
......
...@@ -6,1059 +6,1036 @@ ...@@ -6,1059 +6,1036 @@
<select id="getSafetyIndexWeek" resultType="java.util.HashMap"> <select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<![CDATA[ <![CDATA[
SELECT distinct temp1.*,IFNULL(S.safety_index,0) as value SELECT distinct temp1.*, IFNULL(S.safety_index, 0) as value
FROM ( FROM (
SELECT @s :=@s + 1 as `index`, DATE(DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date SELECT @s := @s + 1 as `index`, DATE (DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic,(SELECT @s := 0) temp FROM mysql.help_topic, (SELECT @s := 0) temp
) temp1 ) temp1
left join f_safety_index_change_log S on S.collect_date = temp1.date left join f_safety_index_change_log S
where temp1.index < 8 on S.collect_date = temp1.date
ORDER BY temp1.date where temp1.index < 8
]]> ORDER BY temp1.date
]]>
</select> </select>
<select id="countUpperRiskPoint" resultType="long"> <select id="countUpperRiskPoint" resultType="long">
SELECT SELECT count(DISTINCT frcl.risk_source_id)
count(DISTINCT frcl.risk_source_id) FROM (
FROM SELECT a.id,
( a.risk_source_id
SELECT FROM `f_rpn_change_log` a,
a.id, `f_risk_source` b
a.risk_source_id WHERE a.type = #{type}
FROM and a.risk_source_id = b.id
`f_rpn_change_log` a, and b.org_code = #{orgCode}
`f_risk_source` b and date_format(a.create_date, '%Y-%m-%d') = #{date}
WHERE and b.risk_level_id is not NULL
a.type = #{type} ) as frcl
and a.risk_source_id = b.id </select>
and b.org_code = #{orgCode}
and date_format(a.create_date, '%Y-%m-%d') = #{date}
and b.risk_level_id is not NULL
) as frcl
</select>
<select id="countCheckException" resultType="long"> <select id="countCheckException" resultType="long">
SELECT SELECT count(distinct pc.point_id)
count(distinct pc.point_id) FROM p_check pc
FROM WHERE DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
p_check pc AND (
WHERE pc.org_code = #{orgCode}
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date} OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
AND ( )
pc.org_code = #{orgCode} AND pc.`is_ok` = '2'
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%') </select>
)
AND pc.`is_ok` = '2'
</select>
<select id="countFireException" resultType="long"> <select id="countFireException" resultType="long">
SELECT SELECT count(1)
count(1) FROM wl_equipment_specific_alarm a
FROM WHERE status = 1
wl_equipment_specific_alarm a AND org_code = #{orgCode}
WHERE AND type = 'BREAKDOWN'
status = 1 AND date_format(a.update_date, '%Y-%m-%d') = #{date}
AND org_code = #{orgCode} </select>
AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo"> <select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo">
SELECT SELECT rcl.id,
rcl.id, rcl.create_date AS changeDate,
rcl.create_date AS changeDate, rs.risk_level_id AS riskLevelId,
rs.risk_level_id AS riskLevelId, rs.`name`
rs.`name` FROM (
FROM SELECT risk_source_id,
( MAX(create_date) create_date,
SELECT MAX(id) id
risk_source_id, FROM f_rpn_change_log
MAX(create_date) create_date, WHERE type = '0'
MAX(id) id AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
FROM group by risk_source_id
f_rpn_change_log ) rcl
WHERE LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
type = '0' WHERE rs.risk_level_id is not NULL
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date} AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode}, '-%'))
group by risk_source_id
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE rs.risk_level_id is not NULL
AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode},'-%'))
</select> </select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo"> <select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT SELECT pc.point_id id,
pc.point_id id, pc.point_name 'name',
pc.point_name 'name', pc.`is_ok` as status,
pc.`is_ok` as status, max(pc.check_time) as changeDate
max(pc.check_time) as changeDate FROM p_check pc
FROM WHERE DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
p_check pc AND (
WHERE pc.org_code = #{orgCode}
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date} OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
AND ( )
pc.org_code = #{orgCode} AND pc.`is_ok` = '2'
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%') GROUP BY pc.point_id, pc.`is_ok`, pc.point_name
) </select>
AND pc.`is_ok` = '2'
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo"> <select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
select select ala.id,
ala.id, ala.equipment_specific_name as name,
ala.equipment_specific_name as name, cate.name as status,
cate.name as status, ala.update_date as changeDate
ala.update_date as changeDate from wl_equipment_specific_alarm as ala
from left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
wl_equipment_specific_alarm as ala left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id left join wl_equipment_category as cate on equ.category_id = cate.id
left join wl_equipment as equ on equ.id = det.equipment_id where ala.status = TRUE
left join wl_equipment_category as cate on equ.category_id = cate.id AND ala.type = 'alarm_type_trouble'
where ala.status = TRUE AND ala.org_code = #{orgCode}
AND ala.type = 'alarm_type_trouble' AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
</select> </select>
<select id="getStatisticsCheck" resultType="java.util.HashMap"> <select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[ <![CDATA[
SELECT SELECT (
( SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
SELECT FROM `p_plan_task`
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) WHERE (
FROM `p_plan_task`.`check_date` LIKE concat(curdate(), '%'))) AS `point_num`,
`p_plan_task` (
WHERE SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
( FROM `p_plan_task`
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' ))) AS `point_num`,( WHERE ((
SELECT `p_plan_task`.`finish_status` = 3
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) )
FROM AND (
`p_plan_task` `p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `miss_num`,
WHERE (
(( SELECT count(1) AS `total_num`
`p_plan_task`.`finish_status` = 3 FROM (
) SELECT `b`.`id` AS `id`
AND ( FROM `p_plan_task_detail` `b`
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `miss_num`,( LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
SELECT LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
count( 1 ) AS `total_num` LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
FROM WHERE `b`.`is_finish` = 1
( AND c.is_ok = 1
SELECT AND `a`.`check_date` = curdate()
`b`.`id` AS `id` ORDER BY `b`.`id`
FROM ) `t`) AS `ok_num`,
`p_plan_task_detail` `b` (
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no` SELECT count(1) AS `total_num`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id` FROM (
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id SELECT `b`.`id` AS `id`
WHERE FROM `p_plan_task_detail` `b`
`b`.`is_finish` = 1 AND c.is_ok = 1 AND `a`.`check_date` = curdate() LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
ORDER BY LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
`b`.`id` LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
) `t` ) AS `ok_num`,( WHERE `b`.`is_finish` = 1
SELECT AND c.is_ok = 2
count( 1 ) AS `total_num` AND `a`.`check_date` = curdate()
FROM ORDER BY `b`.`id`
( ) `t`) AS `notOk_num`,
SELECT (
`b`.`id` AS `id` SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM FROM `p_plan_task`
`p_plan_task_detail` `b` WHERE ((
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no` `p_plan_task`.`finish_status` = 0
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id` )
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id AND (
WHERE `p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `notStart_num`
`b`.`is_finish` = 1 AND c.is_ok = 2 AND `a`.`check_date` = curdate() ]]>
ORDER BY
`b`.`id`
) `t` ) AS `notOk_num`,(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
((
`p_plan_task`.`finish_status` = 0
)
AND (
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `notStart_num`
]]>
</select> </select>
<select id="getRiskErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo"> <select id="getRiskErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT n.id,r.code,r.name as label,r.id as pointId,'risk' as type,n.create_date as changeDate SELECT n.id, r.code, r.name as label, r.id as pointId, 'risk' as type, n.create_date as changeDate
FROM f_rpn_change_log n FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0 WHERE n.type = 0
ORDER BY n.create_date desc ORDER BY n.create_date desc limit 0,5
limit 0,5 </select>
</select>
<select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo"> <select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT p.id,I.point_no as code, SELECT p.id,
IF(p.is_ok = '2', CONCAT(I.name,' 不合格') ,CONCAT(I.name,' 漏检') ) as label, I.point_no as code,
p.point_id,'patrol' as type,p.check_time as changeDate IF(p.is_ok = '2', CONCAT(I.name, ' 不合格'), CONCAT(I.name, ' 漏检')) as label,
FROM p_check p p.point_id,
left join p_point I ON I.id = p.point_id 'patrol' as type,
where p.is_ok IN ('2', '3') p.check_time as changeDate
AND I.is_delete = 0 FROM p_check p
ORDER BY p.check_time desc left join p_point I ON I.id = p.point_id
limit 0,5 where p.is_ok IN ('2', '3')
</select> AND I.is_delete = 0
ORDER BY p.check_time desc limit 0,5
</select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo"> <select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT SELECT ala.id,
ala.id, ala.equipment_specific_id AS pointId,
ala.equipment_specific_id AS pointId, 'monitorEquipment' AS type,
'monitorEquipment' AS type, spe.`code`,
spe.`code`, ala.type AS alarmType,
ala.type AS alarmType, ala.equipment_specific_index_name,
ala.equipment_specific_index_name, CONCAT(
CONCAT( ala.equipment_specific_index_name,
ala.equipment_specific_index_name, '(',
'(', ala.equipment_specific_name,
ala.equipment_specific_name, ')',
')', IF(
IF ( (
( ISNULL(ws.full_name)
ISNULL(ws.full_name) AND ISNULL(sd.description)
AND ISNULL(sd.description) ),
), '',
'', CONCAT(
CONCAT( '【',
'【', IFNULL(ws.full_name, ''),
IFNULL(ws.full_name, ''), ' ',
' ', IFNULL(sd.description, ''),
IFNULL(sd.description, ''), '】'
'】' )
) )
) ) AS label,
) AS label, ala.update_date AS changeDate
ala.update_date AS changeDate FROM wl_equipment_specific_alarm AS ala
FROM LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
wl_equipment_specific_alarm AS ala LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id WHERE ala.`status` = 1
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id AND (
WHERE ala.type = 'FIREALARM'
ala.`status` = 1 )
AND ( ORDER BY ala.update_date DESC LIMIT 0,5
ala.type = 'FIREALARM' </select>
)
ORDER BY
ala.update_date DESC
LIMIT 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo"> <select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
wlesi.id,
wlesi.`value` `status`,
wles.code,
wlesi.update_date changeDate,
CONCAT(ed.NAME, ' ', wlei.NAME,IF((ISNULL(ws.full_name) AND ISNULL(sd.description)),'',CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
))) label
FROM
wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
LEFT JOIN wl_equipment_specific wles ON wlesi.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail ed ON ed.id = wles.equipment_detail_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE
wlei.is_alarm = false
ORDER BY
wlesi.update_date DESC
LIMIT 0,5
</select>
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo"> SELECT *
select * from ( from (
select SELECT wlesi.id,
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation, wlesi.`value` `status`,
'riskSource' as type, wles.code,
rl.level, wlesi.update_date changeDate,
CONCAT('level_',rl.level) as level_str, CONCAT(ed.NAME, ' ', wlei.NAME,
R.id as risk_source_id, IF((ISNULL(ws.full_name) AND ISNULL(sd.description)), '', CONCAT(
r.flicker_frequency as frequency, '【',
true as 'showInfo', IFNULL(ws.full_name, ''),
r.rpn as title ' ',
from f_risk_source R ,f_risk_level rl IFNULL(sd.description, ''),
where '】'
r.is_region <![CDATA[<>]]> 'TRUE' ))) label
AND R.status = 'ANOMALY' FROM wl_equipment_specific_index wlesi
AND rl.id = r.risk_level_id LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%')) LEFT JOIN wl_equipment_specific wles ON wlesi.equipment_specific_id = wles.id
UNION ALL LEFT JOIN wl_equipment_detail ed ON ed.id = wles.equipment_detail_id
select LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wles.id
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation, LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
'patrol' as type, WHERE wlei.type_code in
p.status as level, ('Action', 'Reset', 'FeedBack', 'StartStop', 'Tripping', 'Control', 'Normal', 'WYStartStop')
CONCAT('level_',p.status) as level_str, ORDER BY wlesi.update_date DESC LIMIT 0,5
p.risk_source_id, ) a
0 as frequency, where a.label is not null
case p.status </select>
when '0'
then false
else
true
end as `showInfo`,
case p.status
when '0'
then '未计划'
when '2'
then '不合格'
when '3'
then '漏检'
end as title
from p_point p
where status in ('0','2','3')
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
where 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
</if>
<if test="type != null">
AND tmp.type = #{type}
</if>
</select>
<select id="retrieveAllCount" resultType="long"> <select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
SELECT select * from (
count(1) select
FROM R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
( 'riskSource' as type,
SELECT rl.level,
* CONCAT('level_',rl.level) as level_str,
FROM R.id as risk_source_id,
( r.flicker_frequency as frequency,
SELECT true as 'showInfo',
r.`code`, r.rpn as title
r.`name`, from f_risk_source R ,f_risk_level rl
r.org_code AS orgCode, where
'riskSource' AS typeCode, r.is_region <![CDATA[<>]]> 'TRUE'
r.id AS riskSourceId AND R.status = 'ANOMALY'
FROM AND rl.id = r.risk_level_id
f_risk_source r AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id UNION ALL
WHERE select
r.is_region = 'FALSE' p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
<if test = "dataLevel != null and dataLevel != ''" > 'patrol' as type,
AND rl. level = #{dataLevel} p.status as level,
</if> CONCAT('level_',p.status) as level_str,
UNION ALL p.risk_source_id,
SELECT 0 as frequency,
p.point_no AS code, case p.status
p.`name`, when '0'
p.org_code AS orgCode, then false
'patrol' AS typeCode, else
p.risk_source_id AS riskSourceId true
FROM end as `showInfo`,
p_point p case p.status
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id when '0'
WHERE then '未计划'
is_delete = FALSE when '2'
UNION ALL then '不合格'
SELECT when '3'
e.`code`, then '漏检'
e.`name`, end as title
e.org_code AS orgCode, from p_point p
'impEquipment' AS typeCode, where status in ('0','2','3')
e.risk_source_id AS riskSourceId AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
FROM UNION ALL
f_equipment e select
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
UNION ALL 'impEquipment' as type,
SELECT 0 as level,
m.`code` AS code, 'level_0' as kevek_str,
m.`name`, e.risk_source_id,
m.org_code AS orgCode, 0 as frequency,
'monitorEquipment' AS typeCode, false as 'showInfo',
risk.id AS riskSourceId '' as title
FROM from
wl_equipment_specific m f_equipment e
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
WHERE ) tmp
substr(m.equipment_code, 1, 4) = '9204' where 1=1
GROUP BY <if test="riskSourceId != null">
m.`code` AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
UNION ALL </if>
SELECT <if test="type != null">
vi.`code`, AND tmp.type = #{type}
vi.`name`, </if>
vi.org_code AS orgCode, </select>
'video' AS typeCode,
vis.source_id AS riskSourceId <select id="retrieveAllCount" resultType="long">
FROM SELECT
wl_video AS vi count(1)
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id FROM
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id (
GROUP BY SELECT
vi.id *
UNION ALL FROM
SELECT (
spe.`code` AS code, SELECT
spe.`name`, r.`code`,
spe.org_code AS orgCode, r.`name`,
'fireEquipment' AS typeCode, r.org_code AS orgCode,
str.source_id AS riskSourceId 'riskSource' AS typeCode,
FROM r.id AS riskSourceId
wl_equipment_specific AS spe FROM
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id f_risk_source r
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id WHERE
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code r.is_region = 'FALSE'
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id <if test="dataLevel != null and dataLevel != ''">
WHERE AND rl. level = #{dataLevel}
substr(cat.`code`, 1, 4) = '3105' </if>
AND str.source_id IS NOT NULL UNION ALL
UNION ALL SELECT
SELECT p.point_no AS code,
s.`code`, p.`name`,
s.`name`, p.org_code AS orgCode,
s.orgCode, 'patrol' AS typeCode,
'fireEquipment' AS typeCode, p.risk_source_id AS riskSourceId
r.id AS riskSourceId FROM
FROM p_point p
( LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
SELECT WHERE
a.instance_id AS instanceId, is_delete = FALSE
a.group_code AS groupCode, UNION ALL
MAX( SELECT
CASE e.`code`,
WHEN a.field_name = 'name' THEN e.`name`,
a.field_value e.org_code AS orgCode,
END 'impEquipment' AS typeCode,
) AS NAME, e.risk_source_id AS riskSourceId
MAX( FROM
CASE f_equipment e
WHEN a.field_name = 'code' THEN LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
a.field_value UNION ALL
END SELECT
) AS CODE, m.`code` AS code,
MAX( m.`name`,
CASE m.org_code AS orgCode,
WHEN a.field_name = 'address' THEN 'monitorEquipment' AS typeCode,
a.field_value risk.id AS riskSourceId
END FROM
) AS address, wl_equipment_specific m
MAX( LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
CASE LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHEN a.field_name = 'orgCode' THEN LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
a.field_value WHERE
END substr(m.equipment_code, 1, 4) = '9204'
) AS orgCode GROUP BY
FROM m.`code`
`wl_form_instance` a UNION ALL
WHERE SELECT
a.group_code IN ('pool', 'r_pool') vi.`code`,
GROUP BY vi.`name`,
a.instance_id vi.org_code AS orgCode,
) s 'video' AS typeCode,
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id vis.source_id AS riskSourceId
UNION ALL FROM
SELECT wl_video AS vi
car.car_num AS code, LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
car.`name`, LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
car.org_code AS orgCode, GROUP BY
'fireEquipment' AS typeCode, vi.id
'' as riskSourceId UNION ALL
FROM SELECT
wl_car AS car spe.`code` AS code,
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id spe.`name`,
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id spe.org_code AS orgCode,
UNION ALL 'fireEquipment' AS typeCode,
SELECT str.source_id AS riskSourceId
spe.`code` AS code, FROM
spe.`name`, wl_equipment_specific AS spe
spe.org_code AS orgCode, LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
'fireEquipment' AS typeCode, LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
risk.id AS riskSourceId LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
FROM LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
wl_equipment_specific AS spe LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id WHERE
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id substr(cat.`code`, 1, 4) = '3105'
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id AND str.source_id IS NOT NULL
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code UNION ALL
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id SELECT
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id s.`code`,
WHERE s.`name`,
substr(cat.`code`, 1, 4) = '3104' s.orgCode,
AND risk.source_id IS NOT NULL 'fireEquipment' AS typeCode,
UNION ALL r.id AS riskSourceId
SELECT FROM
s.`code`, (
s.`name`, SELECT
s.orgCode, a.instance_id AS instanceId,
'fireEquipment' AS typeCode, a.group_code AS groupCode,
r.id AS riskSourceId MAX(
FROM CASE
( WHEN a.field_name = 'name' THEN
SELECT a.field_value
a.instance_id AS instanceId, END
a.group_code AS groupCode, ) AS NAME,
MAX( MAX(
CASE CASE
WHEN a.field_name = 'name' THEN WHEN a.field_name = 'code' THEN
a.field_value a.field_value
END END
) AS NAME, ) AS CODE,
MAX( MAX(
CASE CASE
WHEN a.field_name = 'code' THEN WHEN a.field_name = 'address' THEN
a.field_value a.field_value
END END
) AS CODE, ) AS address,
MAX( MAX(
CASE CASE
WHEN a.field_name = 'address' THEN WHEN a.field_name = 'orgCode' THEN
a.field_value a.field_value
END END
) AS address, ) AS orgCode
MAX( FROM
CASE `wl_form_instance` a
WHEN a.field_name = 'orgCode' THEN WHERE
a.field_value a.group_code IN ('pool', 'r_pool')
END GROUP BY
) AS orgCode a.instance_id
FROM ) s
`wl_form_instance` a LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
WHERE UNION ALL
a.group_code IN ( SELECT
'fireFoamRoom', car.car_num AS code,
'r_fireFoamRoom' car.`name`,
) car.org_code AS orgCode,
GROUP BY 'fireEquipment' AS typeCode,
a.instance_id '' as riskSourceId
) s, FROM
f_risk_source r wl_car AS car
WHERE LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
s.instanceId = r.source_id LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL UNION ALL
SELECT SELECT
s.`code`, spe.`code` AS code,
s.`name`, spe.`name`,
s.orgCode, spe.org_code AS orgCode,
'fireEquipment' AS typeCode, 'fireEquipment' AS typeCode,
r.id AS riskSourceId risk.id AS riskSourceId
FROM FROM
( wl_equipment_specific AS spe
SELECT LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
a.instance_id AS instanceId, LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
a.group_code AS groupCode, LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
MAX( LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
CASE LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHEN a.field_name = 'name' THEN LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
a.field_value WHERE
END substr(cat.`code`, 1, 4) = '3104'
) AS NAME, AND risk.source_id IS NOT NULL
MAX( UNION ALL
CASE SELECT
WHEN a.field_name = 'code' THEN s.`code`,
a.field_value s.`name`,
END s.orgCode,
) AS CODE, 'fireEquipment' AS typeCode,
MAX( r.id AS riskSourceId
CASE FROM
WHEN a.field_name = 'address' THEN (
a.field_value SELECT
END a.instance_id AS instanceId,
) AS address, a.group_code AS groupCode,
MAX( MAX(
CASE CASE
WHEN a.field_name = 'orgCode' THEN WHEN a.field_name = 'name' THEN
a.field_value a.field_value
END END
) AS orgCode ) AS NAME,
FROM MAX(
`wl_form_instance` a CASE
WHERE WHEN a.field_name = 'code' THEN
a.group_code IN ('fireRoom', 'r_fireRoom') a.field_value
GROUP BY END
a.instance_id ) AS CODE,
) s, MAX(
f_risk_source r CASE
WHERE WHEN a.field_name = 'address' THEN
s.instanceId = r.source_id a.field_value
) AS tmp END
<where> ) AS address,
<if test="inputText!=null and inputText != ''"> MAX(
( CASE
tmp.code LIKE '%#{inputText}%' WHEN a.field_name = 'orgCode' THEN
OR tmp.name LIKE '%#{inputText}%' a.field_value
) END
</if> ) AS orgCode
<if test="type!=null and type!=''"> FROM
AND tmp.typeCode = #{type} `wl_form_instance` a
</if> WHERE
<if test="riskSourceId != null and riskSourceId!=''"> a.group_code IN (
AND tmp.riskSourceId = #{riskSourceId} 'fireFoamRoom',
</if> 'r_fireFoamRoom'
</where> )
) t GROUP BY
</select> a.instance_id
<select id="retrieveAll" resultType="java.util.HashMap"> ) s,
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO f_risk_source r
from (select concat('riskSource-',r.id) as id,concat(r.id) as originId,r.name,r.code,r.ue4_location as ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode, WHERE
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode, s.instanceId = r.source_id
CASE UNION ALL
WHEN ( SELECT
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1 s.`code`,
) THEN s.`name`,
NULL s.orgCode,
ELSE 'fireEquipment' AS typeCode,
CONCAT( r.id AS riskSourceId
'{"x":', FROM
substring_index(r.position3d, ',', 1), (
',"y":', SELECT
substring_index( a.instance_id AS instanceId,
substring_index(r.position3d, ',', - 2), a.group_code AS groupCode,
',', MAX(
1 CASE
), WHEN a.field_name = 'name' THEN
',"z":', a.field_value
substring_index(r.position3d, ',', - 1), END
'}' ) AS NAME,
) MAX(
END positionDTO, CASE
r.name as label, WHEN a.field_name = 'code' THEN
r.name as protectObjName, a.field_value
'' as routeName, END
'' as person, ) AS CODE,
r.rpn as title, MAX(
CONCAT('riskSource-',r.id) as `key`, CASE
r.id as riskSourceId, WHEN a.field_name = 'address' THEN
'' as room a.field_value
from f_risk_source r END
left join f_risk_level rl ON rl.id = r.risk_level_id ) AS address,
where r.is_region = 'FALSE' MAX(
<if test="dataLevel != null and dataLevel != ''"> CASE
AND rl.level = #{dataLevel} WHEN a.field_name = 'orgCode' THEN
</if> a.field_value
UNION all END
select concat('patrol-',p.id) as id,concat(p.id) as originId,p.name,p.point_no as code,p.ue4_location as ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode, ) AS orgCode
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as typeCode, FROM
CASE `wl_form_instance` a
WHEN ( WHERE
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1 a.group_code IN ('fireRoom', 'r_fireRoom')
) THEN GROUP BY
NULL a.instance_id
ELSE ) s,
CONCAT( f_risk_source r
'{"x":', WHERE
substring_index(p.coordinates, ',', 1), s.instanceId = r.source_id
',"y":', ) AS tmp
substring_index( <where>
substring_index(p.coordinates, ',', - 2), <if test="inputText!=null and inputText != ''">
',', (
1 tmp.code LIKE '%${inputText}%'
), OR tmp.name LIKE '%${inputText}%'
',"z":', )
substring_index(p.coordinates, ',', - 1), </if>
'}' <if test="type!=null and type!=''">
) AND tmp.typeCode = #{type}
END positionDTO, </if>
p.name as label, <if test="riskSourceId != null and riskSourceId!=''">
p.name as protectObjName, AND tmp.riskSourceId = #{riskSourceId}
p.route_name as routeName, </if>
p.charge_person_id as person, </where>
case ) t
when p.status = '0' then '未执行' </select>
when p.status = '1' then '合格' <select id="retrieveAll" resultType="java.util.HashMap">
when p.status = '2' then '不合格' select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
when p.status = '3' then '漏检' from (select concat('riskSource-',r.id) as id,concat(r.id) as originId,r.name,r.code,r.ue4_location as
end as title, ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
concat('patrol-',p.id) as `key`, rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
p.risk_source_id as riskSourceId, CASE
r.name as room WHEN (
from p_point p ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
left join f_risk_source r on r.id = p.risk_source_id ) THEN
WHERE is_delete = FALSE NULL
UNION all ELSE
select concat('impEquipment-',e.id) as id,concat(e.id) as originId,e.name,e.code,e.ue4_location as ue4Location,e.ue4_rotation as ue4Rotation ,'impEquipment' as type,e.org_code as orgCode, CONCAT(
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode, '{"x":',
CASE substring_index(r.position3d, ',', 1),
WHEN ( ',"y":',
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1 substring_index(
) THEN substring_index(r.position3d, ',', - 2),
NULL ',',
ELSE 1
CONCAT( ),
'{"x":', ',"z":',
substring_index(e.position3d, ',', 1), substring_index(r.position3d, ',', - 1),
',"y":', '}'
substring_index( )
substring_index(e.position3d, ',', - 2), END positionDTO,
',', r.name as label,
1 r.name as protectObjName,
), '' as routeName,
',"z":', '' as person,
substring_index(e.position3d, ',', - 1), r.rpn as title,
'}' CONCAT('riskSource-',r.id) as `key`,
) r.id as riskSourceId,
END positionDTO, '' as room
e.name as label, from f_risk_source r
e.name as protectObjName, left join f_risk_level rl ON rl.id = r.risk_level_id
'' as routeName, where r.is_region = 'FALSE'
'' as person, <if test="dataLevel != null and dataLevel != ''">
e.name as title, AND rl.level = #{dataLevel}
concat('impEquipment-',e.id) as `key`, </if>
e.risk_source_id as riskSourceId, UNION all
r.name as room select concat('patrol-',p.id) as id,concat(p.id) as originId,p.name,p.point_no as code,p.ue4_location as
from f_equipment e ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode,
left join f_risk_source r on r.id = e.risk_source_id p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as
UNION all typeCode,
select concat('monitorEquipment-',m.id) as id,concat(m.id) as originId,det.name,m.code as code,'' as ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode, CASE
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode, WHEN (
CASE ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
WHEN ( ) THEN
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1 NULL
) THEN ELSE
NULL CONCAT(
ELSE '{"x":',
CONCAT( substring_index(p.coordinates, ',', 1),
'{"x":', ',"y":',
substring_index(null, ',', 1), substring_index(
',"y":', substring_index(p.coordinates, ',', - 2),
substring_index( ',',
substring_index(null, ',', - 2), 1
',', ),
1 ',"z":',
), substring_index(p.coordinates, ',', - 1),
',"z":', '}'
substring_index(null, ',', - 1), )
'}' END positionDTO,
) p.name as label,
END positionDTO, p.name as protectObjName,
det.name as label, p.route_name as routeName,
(select p.charge_person_id as person,
group_concat(fet.`name`) case
from f_equipment_fire_equipment as fefe when p.status = '0' then '未执行'
left join f_equipment as fet on fet.id = fefe.equipment_id when p.status = '1' then '合格'
where fefe.fire_equipment_id = m.id when p.status = '2' then '不合格'
) as protectObjName, when p.status = '3' then '漏检'
'' as routeName, end as title,
'' as person, concat('patrol-',p.id) as `key`,
det.name as title, p.risk_source_id as riskSourceId,
concat('monitorEquipment-',m.id) as `key`, r.name as room
risk.id as riskSourceId, from p_point p
str.full_name as room left join f_risk_source r on r.id = p.risk_source_id
from wl_equipment_specific m WHERE is_delete = FALSE
left join wl_equipment_detail as det on m.equipment_detail_id = det.id UNION all
left join wl_stock_detail as sto on sto.qr_code = m.qr_code select concat('impEquipment-',e.id) as id,concat(e.id) as originId,e.name,e.code,e.ue4_location as
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id ue4Location,e.ue4_rotation as ue4Rotation ,'impEquipment' as type,e.org_code as orgCode,
left join f_risk_source as risk on str.source_id = risk.source_id 0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
where substr(m.equipment_code ,1,4) = '9204' CASE
group By m.code WHEN (
UNION all ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
select concat('video-',vi.id) as id,concat(vi.id) as originId,vi.name,vi.code,null as ue4Location,null as ue4Rotation ,'video' as type,vi.org_code as orgCode, ) THEN
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode, NULL
CASE ELSE
WHEN ( CONCAT(
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1 '{"x":',
) THEN substring_index(e.position3d, ',', 1),
NULL ',"y":',
ELSE substring_index(
CONCAT( substring_index(e.position3d, ',', - 2),
'{"x":', ',',
substring_index(null, ',', 1), 1
',"y":', ),
substring_index( ',"z":',
substring_index(null, ',', - 2), substring_index(e.position3d, ',', - 1),
',', '}'
1 )
), END positionDTO,
',"z":', e.name as label,
substring_index(null, ',', - 1), e.name as protectObjName,
'}' '' as routeName,
) '' as person,
END positionDTO, e.name as title,
vi.name as label, concat('impEquipment-',e.id) as `key`,
ws.name as protectObjName, e.risk_source_id as riskSourceId,
'' as routeName, r.name as room
'' as person, from f_equipment e
vi.name as title, left join f_risk_source r on r.id = e.risk_source_id
concat('video-',vi.id) as `key`, UNION all
vis.source_id as riskSourceId, select concat('monitorEquipment-',m.id) as id,concat(m.id) as originId,det.name,m.code as code,'' as
CONCAT(ws.full_name,vi.address) AS room ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
from wl_video as vi null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as
left join wl_video_source as vis on vi.id = vis.video_id typeCode,
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id CASE
group by vi.id WHEN (
UNION all ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
select concat('hydrant-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode, ) THEN
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode, NULL
CASE ELSE
WHEN ( CONCAT(
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1 '{"x":',
) THEN substring_index(null, ',', 1),
NULL ',"y":',
ELSE substring_index(
CONCAT( substring_index(null, ',', - 2),
'{"x":', ',',
substring_index(null, ',', 1), 1
',"y":', ),
substring_index( ',"z":',
substring_index(null, ',', - 2), substring_index(null, ',', - 1),
',', '}'
1 )
), END positionDTO,
',"z":', det.name as label,
substring_index(null, ',', - 1), (select
'}' group_concat(fet.`name`)
) from f_equipment_fire_equipment as fefe
END positionDTO, left join f_equipment as fet on fet.id = fefe.equipment_id
det.name as label, where fefe.fire_equipment_id = m.id
det.name as protectObjName, ) as protectObjName,
'' as routeName, '' as routeName,
'' as person, '' as person,
det.name as title, det.name as title,
concat('hydrant-',spe.id) as `key`, concat('monitorEquipment-',m.id) as `key`,
str.source_id as riskSourceId, risk.id as riskSourceId,
str.full_name as room str.full_name as room
from from wl_equipment_specific m
wl_equipment_specific as spe left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_equipment as equ on det.equipment_id = equ.id left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join wl_equipment_category as cat on equ.category_id = cat.id left join f_risk_source as risk on str.source_id = risk.source_id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code where substr(m.equipment_code ,1,4) = '9204'
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id group By m.code
where substr(cat.code ,1,4)= '3105' UNION all
UNION all select concat('video-',vi.id) as id,concat(vi.id) as originId,vi.name,vi.code,null as ue4Location,null as
select ue4Rotation ,'video' as type,vi.org_code as orgCode,
concat('pool-',s.instanceId) as id, null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' as type,s.orgCode, CASE
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode, WHEN (
null as positionDTO, ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
s.name as label, ) THEN
s.name as protectObjName, NULL
'' as routeName, ELSE
'' as person, CONCAT(
s.name as title, '{"x":',
concat('pool-',s.instanceId) as `key`, substring_index(null, ',', 1),
r.id as riskSourceId, ',"y":',
s.address as room substring_index(
from (SELECT substring_index(null, ',', - 2),
a.instance_id AS instanceId, ',',
a.group_code AS groupCode, 1
MAX( ),
CASE ',"z":',
WHEN a.field_name = 'name' THEN substring_index(null, ',', - 1),
a.field_value '}'
END )
) AS name, END positionDTO,
MAX( vi.name as label,
CASE ws.name as protectObjName,
WHEN a.field_name = 'code' THEN '' as routeName,
a.field_value '' as person,
END vi.name as title,
) AS code, concat('video-',vi.id) as `key`,
MAX( vis.source_id as riskSourceId,
CASE CONCAT(ws.full_name,vi.address) AS room
WHEN a.field_name = 'address' THEN from wl_video as vi
a.field_value left join wl_video_source as vis on vi.id = vis.video_id
END LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
) AS address, group by vi.id
MAX( UNION all
CASE select concat('hydrant-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as
WHEN a.field_name = 'orgCode' THEN ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode,
a.field_value 0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
END CASE
) AS orgCode WHEN (
FROM ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
`wl_form_instance` a where a.group_code in('pool','r_pool') ) THEN
GROUP BY NULL
a.instance_id) s ELSE
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id CONCAT(
UNION all '{"x":',
select concat('fireCar-',car.id) as id,concat(car.id) as originId,car.name,car.car_num as code,null as ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode, substring_index(null, ',', 1),
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode, ',"y":',
CASE substring_index(
WHEN ( substring_index(null, ',', - 2),
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1 ',',
) THEN 1
NULL ),
ELSE ',"z":',
CONCAT( substring_index(null, ',', - 1),
'{"x":', '}'
substring_index(null, ',', 1), )
',"y":', END positionDTO,
substring_index( det.name as label,
substring_index(null, ',', - 2), det.name as protectObjName,
',', '' as routeName,
1 '' as person,
), det.name as title,
',"z":', concat('hydrant-',spe.id) as `key`,
substring_index(null, ',', - 1), str.source_id as riskSourceId,
'}' str.full_name as room
) from
END positionDTO, wl_equipment_specific as spe
car.name as label, left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
car.name as protectObjName, left join wl_equipment as equ on det.equipment_id = equ.id
'' as routeName, left join wl_equipment_category as cat on equ.category_id = cat.id
'' as person, left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
car.name as title, left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
concat('fireCar-',car.id) as `key`, where substr(cat.code ,1,4)= '3105'
#{riskSourceId} as riskSourceId, UNION all
'' as room select
from wl_car as car concat('pool-',s.instanceId) as id,
left join wl_equipment as equ on car.equipment_id = equ.id concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' as type,s.orgCode,
left join wl_equipment_category as cat on equ.category_id = cat.id 0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
UNION all null as positionDTO,
select concat('extinguisher-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as ue4Location,null as ue4Rotation,'extinguisher' as type,spe.org_code as orgCode, s.name as label,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode, s.name as protectObjName,
CASE '' as routeName,
WHEN ( '' as person,
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1 s.name as title,
) THEN concat('pool-',s.instanceId) as `key`,
NULL r.id as riskSourceId,
ELSE s.address as room
CONCAT( from (SELECT
'{"x":', a.instance_id AS instanceId,
substring_index(null, ',', 1), a.group_code AS groupCode,
',"y":', MAX(
substring_index( CASE
substring_index(null, ',', - 2), WHEN a.field_name = 'name' THEN
',', a.field_value
1 END
), ) AS name,
',"z":', MAX(
substring_index(null, ',', - 1), CASE
'}' WHEN a.field_name = 'code' THEN
) a.field_value
END positionDTO, END
det.name as label, ) AS code,
det.name as protectObjName, MAX(
'' as routeName, CASE
'' as person, WHEN a.field_name = 'address' THEN
det.name as title, a.field_value
concat('extinguisher-',spe.id) as `key`, END
risk.id as riskSourceId, ) AS address,
str.full_name as room MAX(
from wl_equipment_specific as spe CASE
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id WHEN a.field_name = 'orgCode' THEN
left join wl_equipment as equ on det.equipment_id = equ.id a.field_value
left join wl_equipment_category as cat on equ.category_id = cat.id END
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code ) AS orgCode
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id FROM
left join f_risk_source as risk on str.source_id = risk.source_id `wl_form_instance` a where a.group_code in('pool','r_pool')
where substr(cat.code ,1,4) = '3104' GROUP BY
UNION all a.instance_id) s
select LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
concat('fireChamber-',s.instanceId) as id, UNION all
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' as type,s.orgCode, select concat('fireCar-',car.id) as id,concat(car.id) as originId,car.name,car.car_num as code,null as
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode, ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode,
null as positionDTO, 0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
s.name as label, CASE
s.name as protectObjName, WHEN (
'' as routeName, ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
'' as person, ) THEN
s.name as title, NULL
concat('fireChamber-',s.instanceId) as `key`, ELSE
r.id as riskSourceId, CONCAT(
s.address as room '{"x":',
from (SELECT substring_index(null, ',', 1),
a.instance_id AS instanceId, ',"y":',
a.group_code AS groupCode, substring_index(
MAX( substring_index(null, ',', - 2),
CASE ',',
WHEN a.field_name = 'name' THEN 1
a.field_value ),
END ',"z":',
) AS name, substring_index(null, ',', - 1),
MAX( '}'
CASE )
WHEN a.field_name = 'code' THEN END positionDTO,
a.field_value car.name as label,
END car.name as protectObjName,
) AS code, '' as routeName,
MAX( '' as person,
CASE car.name as title,
WHEN a.field_name = 'address' THEN concat('fireCar-',car.id) as `key`,
a.field_value #{riskSourceId} as riskSourceId,
END '' as room
) AS address, from wl_car as car
MAX( left join wl_equipment as equ on car.equipment_id = equ.id
CASE left join wl_equipment_category as cat on equ.category_id = cat.id
WHEN a.field_name = 'orgCode' THEN UNION all
a.field_value select concat('extinguisher-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as
END ue4Location,null as ue4Rotation,'extinguisher' as type,spe.org_code as orgCode,
) AS orgCode null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as
FROM typeCode,
`wl_form_instance` a where a.group_code in('fireFoamRoom','r_fireFoamRoom') CASE
GROUP BY WHEN (
a.instance_id) s, ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
f_risk_source r ) THEN
where s.instanceId = r.source_id NULL
UNION all ELSE
select CONCAT(
concat('fireFoamRoom-',s.instanceId) as id, '{"x":',
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireFoamRoom' as type,s.orgCode, substring_index(null, ',', 1),
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode, ',"y":',
null as positionDTO, substring_index(
s.name as label, substring_index(null, ',', - 2),
s.name as protectObjName, ',',
'' as routeName, 1
'' as person, ),
s.name as title, ',"z":',
concat('fireFoamRoom-',s.instanceId) as `key`, substring_index(null, ',', - 1),
r.id as riskSourceId, '}'
s.address as room )
from (SELECT END positionDTO,
a.instance_id AS instanceId, det.name as label,
a.group_code AS groupCode, det.name as protectObjName,
MAX( '' as routeName,
CASE '' as person,
WHEN a.field_name = 'name' THEN det.name as title,
a.field_value concat('extinguisher-',spe.id) as `key`,
END risk.id as riskSourceId,
) AS name, str.full_name as room
MAX( from wl_equipment_specific as spe
CASE left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
WHEN a.field_name = 'code' THEN left join wl_equipment as equ on det.equipment_id = equ.id
a.field_value left join wl_equipment_category as cat on equ.category_id = cat.id
END left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
) AS code, left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
MAX( left join f_risk_source as risk on str.source_id = risk.source_id
CASE where substr(cat.code ,1,4) = '3104'
WHEN a.field_name = 'address' THEN UNION all
a.field_value select
END concat('fireChamber-',s.instanceId) as id,
) AS address, concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' as
MAX( type,s.orgCode,
CASE 0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
WHEN a.field_name = 'orgCode' THEN null as positionDTO,
a.field_value s.name as label,
END s.name as protectObjName,
) AS orgCode '' as routeName,
'' as person,
s.name as title,
concat('fireChamber-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireFoamRoom','r_fireFoamRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
UNION all
select
concat('fireFoamRoom-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireFoamRoom' as
type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireFoamRoom-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM FROM
`wl_form_instance` a where a.group_code in('fireRoom','r_fireRoom') `wl_form_instance` a where a.group_code in('fireRoom','r_fireRoom')
......
[
{
"stepCode": "0",
"stepName": "确认火情",
"stepStatus": "0",
"buttonCode": "FIRE_CONFIRM",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 0,
"checkYesOrNo": ""
},
{
"stepCode": "1",
"stepName": "汇报,通知,报警",
"stepStatus": "0",
"buttonCode": "CALL_PHONE",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 1,
"checkYesOrNo": ""
},
{
"stepCode": "2",
"stepName": "确认开关跳闸",
"stepStatus": "0",
"buttonCode": "OPEN_THREE_SIDE_SWITCHES",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 2,
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "3",
"stepName": "检查固定喷雾灭火设施启动",
"stepStatus": "0",
"buttonCode": "OPEN_SPRAYINGSYSTEM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 3,
"condition": [
{
"equipName": "主机",
"equipCode": "92030100TGX44",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "CAFS_CompAirFoamHost_Outfire",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "4",
"stepName": "启动CAFS消防系统",
"stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 4,
"checkYesOrNo": "",
"condition": [
{
"equipName": "雨淋阀",
"equipCode": "92130300BH644",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0
},
{
"stepCode": "5",
"stepName": "启动CAFS举高灭火机器人",
"stepStatus": "0",
"buttonCode": "START_TURBOFAN_ROBOT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 5,
"checkYesOrNo": ""
},
{
"stepCode": "6",
"stepName": "申请调检修",
"stepStatus": "0",
"buttonCode": "APPLY_FOR_OVERHAUL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 6,
"checkYesOrNo": ""
},
{
"stepCode": "7",
"stepName": "断开交、直流电源",
"stepStatus": "0",
"buttonCode": "OFF_POWER",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 7,
"checkYesOrNo": ""
},
{
"stepCode": "8",
"stepName": "执行转检修操作",
"stepStatus": "0",
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 8,
"checkYesOrNo": ""
},
{
"stepCode": "9",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 9,
"checkYesOrNo": ""
},
{
"stepCode": "10",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_FIGTHHING",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 10,
"checkYesOrNo": ""
},
{
"stepCode": "11",
"stepName": "确认明火扑灭,确认着火设备温度降为环境温度",
"stepStatus": "0",
"buttonCode": "FIRE_EXTINCT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 11,
"checkYesOrNo": ""
},
{
"stepCode": "12",
"stepName": "检查现场情况,汇报调度",
"stepStatus": "0",
"buttonCode": "ACCIDENT_REPORT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 12,
"checkYesOrNo": ""
},
{
"stepCode": "13",
"stepName": "退出预案",
"stepStatus": "0",
"buttonCode": "END_EMERGENCY",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"index": 13,
"checkYesOrNo": ""
}
]
\ No newline at end of file
[
{
"stepCode": "0",
"stepName": "确认火情",
"stepStatus": "0",
"buttonCode": "FIRE_CONFIRM",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 0,
"checkYesOrNo": ""
},
{
"stepCode": "1",
"stepName": "汇报,通知,报警",
"stepStatus": "0",
"buttonCode": "CALL_PHONE",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 1,
"checkYesOrNo": ""
},
{
"stepCode": "2",
"stepName": "确认开关跳闸",
"stepStatus": "0",
"buttonCode": "OPEN_THREE_SIDE_SWITCHES",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 2,
"isAuto": 0
},
{
"stepCode": "3",
"stepName": "检查固定喷雾灭火设施启动",
"stepStatus": "0",
"buttonCode": "OPEN_SPRAYINGSYSTEM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 3,
"condition": [
{
"equipName": "主机",
"equipCode": "92030100TGX44",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "CAFS_CompAirFoamHost_Outfire",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "4",
"stepName": "启动CAFS消防系统",
"stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 4,
"checkYesOrNo": "",
"condition": [
{
"equipName": "雨淋阀",
"equipCode": "92130300BH644",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0
},
{
"stepCode": "5",
"stepName": "启动应急排油",
"stepStatus": "0",
"buttonCode": "DRAIN_OIL_CONFIRM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 5,
"condition": [
{
"equipName": "排油阀",
"equipCode": "92100400VWE44",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "ONL_DrainOilValve_Open",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "6",
"stepName": "启动CAFS举高灭火机器人",
"stepStatus": "0",
"buttonCode": "START_TURBOFAN_ROBOT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 6,
"checkYesOrNo": ""
},
{
"stepCode": "7",
"stepName": "申请调检修",
"stepStatus": "0",
"buttonCode": "APPLY_FOR_OVERHAUL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 7,
"checkYesOrNo": ""
},
{
"stepCode": "8",
"stepName": "断开交、直流电源",
"stepStatus": "0",
"buttonCode": "OFF_POWER",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 8,
"checkYesOrNo": ""
},
{
"stepCode": "9",
"stepName": "执行转检修操作",
"stepStatus": "0",
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 9,
"checkYesOrNo": ""
},
{
"stepCode": "10",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 10,
"checkYesOrNo": ""
},
{
"stepCode": "11",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_FIGTHHING",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 11,
"checkYesOrNo": ""
},
{
"stepCode": "12",
"stepName": "确认明火扑灭,确认着火设备温度降为环境温度",
"stepStatus": "0",
"buttonCode": "FIRE_EXTINCT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 12,
"checkYesOrNo": ""
},
{
"stepCode": "13",
"stepName": "检查现场情况,汇报调度",
"stepStatus": "0",
"buttonCode": "ACCIDENT_REPORT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 13,
"checkYesOrNo": ""
},
{
"stepCode": "14",
"stepName": "退出预案",
"stepStatus": "0",
"buttonCode": "END_EMERGENCY",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"index": 14,
"checkYesOrNo": ""
}
]
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "CALL_PHONE", "buttonCode": "CALL_PHONE",
"isParallel": "1", "isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B", "roleCode": "Digital_Responsing_Plan_A",
"index": 1, "index": 1,
"checkYesOrNo": "" "checkYesOrNo": ""
}, },
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A", "roleCode": "Digital_Responsing_Plan_A",
"index": 2, "index": 2,
"isAuto": 0 "isAuto": 0,
"checkYesOrNo": ""
}, },
{ {
"stepCode": "3", "stepCode": "3",
...@@ -54,36 +55,49 @@ ...@@ -54,36 +55,49 @@
}, },
{ {
"stepCode": "4", "stepCode": "4",
"stepName": "启动应急排油", "stepName": "启动CAFS消防系统",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL", "buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B", "roleCode": "Digital_Responsing_Plan_A",
"index": 4, "index": 4,
"checkYesOrNo": "" "checkYesOrNo": "",
"condition": [
{
"equipName": "雨淋阀",
"equipCode": "92130300BH644",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0
}, },
{ {
"stepCode": "5", "stepCode": "5",
"stepName": "CAFS喷淋系统已开启", "stepName": "启动应急排油",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "VERIFY_EQUIP_STATUS", "buttonCode": "DRAIN_OIL_CONFIRM",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A", "roleCode": "Digital_Responsing_Plan_A",
"index": 5, "index": 5,
"checkYesOrNo": "",
"condition": [ "condition": [
{ {
"equipName": "雨淋阀", "equipName": "排油阀",
"equipCode": "92130300BH644", "equipCode": "92100400VWE44",
"equipSpeName": "", "equipSpeName": "",
"equipSpeCode": "", "equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start", "equipSpeIndexKey": "ONL_DrainOilValve_Open",
"standardValue": "true", "standardValue": "true",
"inAndOr": "and" "inAndOr": "and"
} }
], ],
"outAndOr": "and", "outAndOr": "and",
"isAuto": 0 "isAuto": 0,
"checkYesOrNo": ""
}, },
{ {
"stepCode": "6", "stepCode": "6",
...@@ -122,7 +136,7 @@ ...@@ -122,7 +136,7 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL", "buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A", "roleCode": "Digital_Responsing_Plan_B",
"index": 9, "index": 9,
"checkYesOrNo": "" "checkYesOrNo": ""
}, },
......
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