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;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -17,22 +16,51 @@ import javax.persistence.Table;
public class EmergencyTaskContent extends BasicEntity {
private static final long serialVersionUID = 1L;
//分工内容id
//分工内容
@Column(name = "content")
private String content;
//人员名称
//编号
@Column(name = "code")
private String code;
//人员名称
//关联角色ID
@Column(name = "obligation_id")
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")
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 {
@Column(name="org_code")
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 @@
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId>
<version>1.8.8-DL</version>
</dependency>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>1.8.8-DL</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-feign</artifactId>
......
......@@ -29,6 +29,7 @@ import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
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.util.DateUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
......@@ -156,8 +157,9 @@ public class ContingencyAction implements CustomerAction {
private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger;
@Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@Autowired
private IPlanStepService iPlanStepService;
/**
* @param stepCode 当前步骤编号
......@@ -803,13 +805,7 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("content", content);
result.add(tempmap1);
String instanceId = iContingencyInstance.getInstanceIdByBatchNOAndCategory("OPERATE", stepName, batchNo);
String json;
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案节点信息失败!");
}
String json = iPlanStepService.getPlanStep();
List<PlanStepJsonVO> res = JSONObject.parseArray(json, PlanStepJsonVO.class);
PlanStepJsonVO vo = res.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList()).get(0);
Object obj = equipmentFireEquipmentService.automaticExecutePoint(vo.getIndex());
......
......@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/contingencyPlan")
......@@ -283,7 +284,8 @@ public class ContingencyPlanController extends BaseController {
@RequestParam(value = "batchNo", required = false) String batchNo,
@RequestParam(value = "runState", required = false) String runState,
@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) {
throw new YeeException("分页参数有误");
......@@ -293,7 +295,13 @@ public class ContingencyPlanController extends BaseController {
String[] ids = new String(roleName).split(",");
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;
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.service.intfc.IDictService;
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.PlanStepJsonVO;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.Dict;
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.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Controller
......@@ -42,25 +48,43 @@ public class EmergencyTaskController extends BaseController{
@Autowired
private IDictService dictService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Autowired
private EmergencyTaskMapper emergencyTaskMapper;
@Autowired
private IPlanStepService planStepService;
@ApiOperation(httpMethod = "GET",value = "岗位人员树", notes = "岗位人员树")
@RequestMapping(value = "/tree", method = RequestMethod.GET)
public CommonResponse tree(){
public CommonResponse tree(@RequestParam(value = "type", required = false) String type){
Dict dict = new Dict();
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> root = new ArrayList<>();
List<EmergencyRelationTree> treeNodes = iEmergencyTaskService.treeList();
//组装对应人员节点
dictList.forEach(e->{
emergencyTaskRoles.forEach(e->{
EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(e.getId());
tree.setName(e.getDictName());
tree.setName(e.getName());
tree.setType("0");
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()));
list.add(tree);
});
......@@ -81,7 +105,7 @@ public class EmergencyTaskController extends BaseController{
@ApiOperation(httpMethod = "GET",value = "分工内容列表", notes = "分工内容列表")
@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){
if (pageNumber >=1 ){
pageNumber = pageNumber -1 ;
......@@ -90,7 +114,11 @@ public class EmergencyTaskController extends BaseController{
obligationId = null;
}
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);
}
......@@ -139,6 +167,30 @@ public class EmergencyTaskController extends BaseController{
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 = "编辑树人员节点")
@PostMapping(value = "/editPerson", produces = "application/json;charset=UTF-8")
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;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
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 io.swagger.annotations.Api;
......@@ -31,6 +31,8 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
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 javax.servlet.http.HttpServletRequest;
......@@ -68,6 +70,8 @@ public class LoginController {
@Value("${amos.system.user.app-key}")
private String appKey;
private String aProduct = "AMOS_STUDIO_WEB";
@ApiOperation(value = "通过userId登录", notes = "查询设备指标")
......@@ -80,34 +84,39 @@ public class LoginController {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
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 = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, token)), ReginParams.class);
if(reginParams == null){
reginParams = getLogin(userId, token);
reginParams = getLogin(userId, token);
}else{
RequestContext.setProduct(product);
if (!TokenOperation.refresh(reginParams.getToken())) {
reginParams = getLogin(userId, token);
}
RequestContext.setProduct(product);
String cacheKey = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", aProduct, reginParams.getToken()});
boolean hasKey = Redis.getRedisTemplate().hasKey(cacheKey);
if (hasKey) {
return reginParams;
} else {
logger.info("Auto自动登陆=====:{}", JSON.toJSONString(reginParams));
reginParams = getLogin(userId, token);
}
}
return reginParams;
}
private ReginParams getLogin(String userId, String token) throws Exception{
ReginParams reginParams = new ReginParams();
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(userId);
dPasswordAuthModel.setPassword(PwdUtil.encode(password));
RequestContext.setProduct(product);
ReginParams reginParams = new ReginParams();
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(userId);
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
RequestContext.setProduct(product);
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
if (ObjectUtils.isEmpty(feignClientResult.getResult())){
throw new Exception("缺失登录信息");
}
// 调用平台授权接口
Map<String ,String > re = (Map<String, String>) feignClientResult.getResult();
String amosToken = re.get("token");
if (ObjectUtils.isEmpty(feignClientResult.getResult())){
throw new Exception("缺失登录信息");
}
// 调用平台授权接口
Map<String ,String > re = (Map<String, String>) feignClientResult.getResult();
String amosToken = re.get("token");
logger.info("应用授权开始======================================"+amosToken);
RequestContext.setToken(amosToken);
......@@ -119,23 +128,23 @@ public class LoginController {
logger.info("应用授权结束======================================"+JSON.toJSONString(fd)+amosToken);
AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(amosToken, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
reginParams.setDepartment(departmentBo);
reginParams.setCompany(companyBo);
}
reginParams.setToken(amosToken);
reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
// redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
return reginParams;
}
AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(amosToken, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
reginParams.setDepartment(departmentBo);
reginParams.setCompany(companyBo);
}
reginParams.setToken(amosToken);
reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
// redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
return reginParams;
}
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
DepartmentBo departmentBo = new DepartmentBo();
if(departmentModel != null) {
......
......@@ -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.core.util.CommonResponseUtil2;
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.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
......@@ -12,7 +13,10 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
@RestController
@RequestMapping("/api/planClassifyTree")
......@@ -30,6 +34,7 @@ public class PlanClassifyTreeController extends BaseController {
String compCode = getOrgCode(reginParams);
model.setOrgCode(compCode);
model.setCreator(user.getUserId());
model.setPlanType(UUID.randomUUID().toString());
return CommonResponseUtil2.success(planClassifyTreeService.create(model));
}
......@@ -62,4 +67,31 @@ public class PlanClassifyTreeController extends BaseController {
}
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;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
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.PlanStepTree;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -30,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "/api/visual")
......@@ -181,6 +184,30 @@ public class PlanVisual3dController extends BaseController {
}
@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 = "根据批次号更新预案的步骤")
@PostMapping(value = "/plan/updatePlanStep")
public ResponseModel updatePlanStep(@RequestBody PlanStepVo planStepVo) {
......
......@@ -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);
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;
import java.util.List;
public interface EmergencyTaskMapper extends BaseMapper {
List<EmergencyTaskContent> getEmergencyTaskList(Long obligationId,Long offset,int pageSize);
int getEmergencyTaskCount(Long obligationId);
List<EmergencyTaskContent> getEmergencyTaskList(@Param("obligationId") Long obligationId, @Param("offset")Long offset, @Param("pageSize")int pageSize, @Param("planType") String planType);
int getEmergencyTaskCount(@Param("obligationId") Long obligationId, @Param("planType") String planType);
List<EmergencyRelationTree> treeList();
void deleteTreeNode(Long obligationId , Long personId);
void deleteTask(@Param("id") Long id);
void save(EmergencyRelation emergencyRelation);
void saveTaskConfig(EmergencyTaskContent emergencyTaskContent);
List<String> roleCodes(String amosOrgId);
List<Long> getPersonIds(Long obligationId);
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 {
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 {
@Autowired
AmosRequestContext amosRequestContext;
@Value("${amos.system.user.password}")
private String password;
@Autowired
@Value("${amos.system.user.password}")
private String password;
@Autowired
private RedisTemplate<String, String> redisTemplate;
//根据公司名称获取公司人
public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> userModel=null;
FeignClientResult feignClientResult;
//根据公司名称获取公司人
public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> userModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.queryAgencyTree(companyName);
userModel = (List<CompanyModel>) feignClientResult.getResult();
userModel = (List<CompanyModel>) feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return userModel;
}
return userModel;
}
//部门id获取部门信息
public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) {
if (deparmentId == null || deparmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
DepartmentModel departmentModel=null;
FeignClientResult feignClientResult;
//部门id获取部门信息
public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) {
if (deparmentId == null || deparmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
DepartmentModel departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.seleteOne(Long.valueOf(deparmentId));
departmentModel = (DepartmentModel) feignClientResult.getResult();
......@@ -85,18 +85,18 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
}
//查询指定部门数
public List<DepartmentModel> listDepartmentsByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
return departmentModel;
}
//查询指定部门数
public List<DepartmentModel> listDepartmentsByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId));
departmentModel = ( List<DepartmentModel>) feignClientResult.getResult();
......@@ -104,19 +104,19 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
}
// * 根据公司id查询机构用户
public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> AgencyUserModel=null;
FeignClientResult feignClientResult;
return departmentModel;
}
// * 根据公司id查询机构用户
public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> AgencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByCompanyId(Long.valueOf(companyId),null,null,true);
AgencyUserModel = ( List<AgencyUserModel>) feignClientResult.getResult();
......@@ -152,8 +152,8 @@ public class RemoteSecurityService {
}
public Toke getServerToken() {
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
try {
dPasswordAuthModel.setPassword(PwdUtil.encode(password));
} catch (GeneralSecurityException e) {
......@@ -161,23 +161,24 @@ public class RemoteSecurityService {
} catch (IOException e) {
e.printStackTrace();
}
Toke toke = null;
Toke toke = null;
try {
toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class);
if(ObjectUtils.isEmpty(toke)){
toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class);
if(ObjectUtils.isEmpty(toke)){
toke = getLogin(dPasswordAuthModel);
}else{
RequestContext.setProduct(amosRequestContext.getProduct());
if (!TokenOperation.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel);
}
}
}else{
RequestContext.setProduct(amosRequestContext.getProduct());
if (!TokenOperation.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel);
}
}
} catch (InnerInvokException e) {
e.printStackTrace();
}
return toke;
}
return toke;
}
private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){
Toke toke = new Toke();
RequestContext.setProduct(amosRequestContext.getProduct());
......@@ -187,8 +188,8 @@ public class RemoteSecurityService {
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
return toke;
}
//redi缓存系统用户token信息
private String buildKey(String username) {
return "system_" + username;
......@@ -203,12 +204,12 @@ public class RemoteSecurityService {
* @param userIds
* @return
*/
public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByIds(userIds,true);
agencyUserModel = (List<AgencyUserModel> ) feignClientResult.getResult();
......@@ -216,75 +217,75 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
/**
* 根据用户ids获取用户实体列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
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));
Map<String, AgencyUserModel> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1));
}
return userMap;
}
/**
* 根据用户ids获取用户名称列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
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));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
return userMap;
}
/**
* 根据部门ids获取部门名称
* @param toke
* @param product
* @param appKey
* @param depIds
* @return
*/
public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(depIds)){
depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds));
}
Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
}
return agencyUserModel;
}
/**
* 根据用户ids获取用户实体列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
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));
Map<String, AgencyUserModel> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1));
}
return userMap;
}
/**
* 根据用户ids获取用户名称列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
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));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
return userMap;
}
/**
* 根据部门ids获取部门名称
* @param toke
* @param product
* @param appKey
* @param depIds
* @return
*/
public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(depIds)){
depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds));
}
Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
}
return deptMap;
}
//用户id获取用户信息
public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) {
if (userId == null || userId.equals("")) {
return null;
}
// CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId);
// return handleObj(commonResponse, UserModel.class);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null;
FeignClientResult feignClientResult;
}
//用户id获取用户信息
public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) {
if (userId == null || userId.equals("")) {
return null;
}
// CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId);
// return handleObj(commonResponse, UserModel.class);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByUserId(userId);
agencyUserModel = (AgencyUserModel)feignClientResult.getResult();
......@@ -292,8 +293,8 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
return agencyUserModel;
}
/**
* 根据orgCode查询机构用户
......@@ -303,22 +304,22 @@ public class RemoteSecurityService {
* @param orgCode orgCode
* @return List<AgencyUserModel>
*/
public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult = new FeignClientResult();
public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult = new FeignClientResult();
try {
feignClientResult = Privilege.agencyUserClient.queryByOrgCode(orgCode,null);
} catch (InnerInvokException e) {
e.printStackTrace();
}
return handleArray(feignClientResult,AgencyUserModel.class);
}
return handleArray(feignClientResult,AgencyUserModel.class);
}
/**
* 根据orgCode查询机构
......@@ -328,15 +329,15 @@ public class RemoteSecurityService {
* @param orgCode orgCode
* @return Map<String, Object>
*/
public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
Map<String, Object> agencyUserModel=null;
FeignClientResult feignClientResult;
public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
Map<String, Object> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.queryByOrgcode(orgCode);
agencyUserModel = (Map<String, Object>) feignClientResult.getResult();
......@@ -344,31 +345,31 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
// 根据部门id查询机构用户
public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) {
if (departmentId == null || departmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
return agencyUserModel;
}
// 根据部门id查询机构用户
public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) {
if (departmentId == null || departmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByDepartmentId(Long.valueOf(departmentId),null,null,true);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
......@@ -376,26 +377,26 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
/**
* 获取子公司信息树结构
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> companyModel=null;
FeignClientResult feignClientResult;
return agencyUserModel;
}
/**
* 获取子公司信息树结构
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> companyModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.querySubAgencyTree(Long.valueOf(companyId));
companyModel = (List<CompanyModel>)feignClientResult.getResult();
......@@ -403,26 +404,26 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return companyModel;
}
/**
* 查询指定公司的部门树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
return companyModel;
}
/**
* 查询指定公司的部门树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId));
departmentModel = (List<DepartmentModel>)feignClientResult.getResult();
......@@ -430,10 +431,10 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class);
}
return departmentModel;
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class);
}
/**
* 根据id批量获取部门信息
......@@ -443,44 +444,44 @@ public class RemoteSecurityService {
* @param "200".equals(feignClientResult.getStatus())departmentIds 部门ids
* @return List<DepartmentModel>
*/
public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
FeignClientResult feignClientResult = new FeignClientResult();
public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
FeignClientResult feignClientResult = new FeignClientResult();
try {
feignClientResult = Privilege.departmentClient.queryDeptByIds(departmentIds);
} catch (InnerInvokException e) {
e.printStackTrace();
}
return handleArray(feignClientResult,DepartmentModel.class);
}
return handleArray(feignClientResult,DepartmentModel.class);
}
private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) {
List<T> list = new ArrayList<>();
if (feignClientResult != null && feignClientResult.getStatus() == 200) {
String jsonStr = JSON.toJSONString(feignClientResult.getResult());
private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) {
List<T> list = new ArrayList<>();
if (feignClientResult != null && feignClientResult.getStatus() == 200) {
String jsonStr = JSON.toJSONString(feignClientResult.getResult());
list = JSONArray.parseArray(jsonStr, t);
}
return list;
}
}
return list;
}
private <T> T handleObj(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONObject.parseObject(jsonStr, t);
}
return null;
}
/**
* 基础平台全部菜单权限树,用于平台登录前端初始化路由
*/
public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<PermissionModel> dictionarieModel=null;
FeignClientResult feignClientResult;
private <T> T handleObj(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONObject.parseObject(jsonStr, t);
}
return null;
}
/**
* 基础平台全部菜单权限树,用于平台登录前端初始化路由
*/
public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<PermissionModel> dictionarieModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.permissionClient.queryPermissionTree(appType,null,null,null,appKey);
dictionarieModel = (List<PermissionModel>)feignClientResult.getResult();
......@@ -488,23 +489,23 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
CommonResponse commonResponse =new CommonResponse("SUCCESS",dictionarieModel);
return commonResponse ;
}
/**
* 根据Code查询指定的字典信息.
* @param toke
* @param product
* @param appKey
* @param dictCode
* @return
*/
public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DictionarieValueModel> dictionarieModel=null;
FeignClientResult feignClientResult;
CommonResponse commonResponse =new CommonResponse("SUCCESS",dictionarieModel);
return commonResponse ;
}
/**
* 根据Code查询指定的字典信息.
* @param toke
* @param product
* @param appKey
* @param dictCode
* @return
*/
public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DictionarieValueModel> dictionarieModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Systemctl.dictionarieClient.dictValues(dictCode);
dictionarieModel = (List<DictionarieValueModel>)feignClientResult.getResult();
......@@ -513,29 +514,29 @@ public class RemoteSecurityService {
e.printStackTrace();
}
if (dictionarieModel != null ) {
String jsonStr = JSON.toJSONString(dictionarieModel);
return JSONArray.parseArray(jsonStr);
}
return null;
}
/**
* 查询指定公司信息与其部门用户树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public CompanyModel listUserByCompanyId1(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
String jsonStr = JSON.toJSONString(dictionarieModel);
return JSONArray.parseArray(jsonStr);
}
return null;
}
/**
* 查询指定公司信息与其部门用户树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public CompanyModel listUserByCompanyId1(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult();
......@@ -543,34 +544,34 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return companyModel;
}
return companyModel;
}
public boolean loginOutFromApp(String toke,String product,String appKey) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
boolean flag=false;
FeignClientResult feignClientResult;
public boolean loginOutFromApp(String toke,String product,String appKey) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
boolean flag=false;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.authClient.removeToken();
flag=true;
} catch (InnerInvokException e) {
e.printStackTrace();
}
return flag;
}
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
return flag;
}
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult();
......@@ -578,29 +579,29 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
if (companyModel != 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) {
boolean flag=false;
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(oldPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(newPassword);
AgencyUserModel agencyUserModel2=null;
FeignClientResult feignClientResult;
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) {
boolean flag=false;
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(oldPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(newPassword);
AgencyUserModel agencyUserModel2=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.modifyPassword(userId,agencyUserModel);
......@@ -609,11 +610,11 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
if(agencyUserModel2!=null){
flag=true;
}
return false;
}
if(agencyUserModel2!=null){
flag=true;
}
return false;
}
}
......@@ -458,12 +458,19 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@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 {
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,
"FIRE_CONFIRM", buttonState, stepStateOnbutton, "true", "false", token,
product, appKey, startUserName);
}
ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(contingencyPlanId);
instance.setId(null);
instance.setRecordType("REPLYMESSAGE");
......@@ -471,8 +478,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
instance.setContent(instance.getCategory());
ContingencyPlanInstance res = repository.save(instance);
if (!ObjectUtils.isEmpty(res)) {
List<EmergencyTaskContentVo> mustTasks = emergencyTaskService.getMustTaskList(stepCode);
boolean flag = judgeIfConfirmed(mustTasks, batchNo);
if (!"-1".equals(stepCode) && flag) {
PlanExecuteVo vo = new PlanExecuteVo();
vo.setConfirm(buttonState);
......@@ -535,19 +540,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return Optional.empty();
}
private boolean judgeIfConfirmed(List<EmergencyTaskContentVo> mustTasks, String batchNo) {
if (0 == mustTasks.size()) {
return true;
}
EmergencyTaskContentVo vo = mustTasks.get(0);
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Integer count = contingencyPlanInstanceMapper.getPlanInstanceByRunState(vo.getStepCode(), batchNo);
if (0 == count) {
return true;
} else {
return false;
private boolean judgeIfConfirmed(List<EmergencyTaskContentVo> tasks, String batchNo) {
boolean flag = Boolean.TRUE;
if (!CollectionUtils.isEmpty(tasks)) {
EmergencyTaskContentVo contentVo = tasks.get(0);
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Integer count = contingencyPlanInstanceMapper.getPlanInstanceByRunState(contentVo.getStepCode(), batchNo);
if (0 != count) {
flag = Boolean.FALSE;
}
}
return flag;
}
@Autowired
......
......@@ -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.util.TreeUtil;
import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
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.common.enums.*;
import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.core.util.DateUtil;
......@@ -26,6 +23,7 @@ import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -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.ValidationUtil;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
......@@ -150,7 +149,13 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
logger.info("========状态校验===========");
ReserveEnum reserveEnum = this.runCheck(vo);
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())) {
List<PlanOperationRecord> recordList = planOperationRecordDao.findByPlanId1(Long.valueOf(vo.getPlanId()));
result.setMessage(ReserveEnum.THISRUNNING.getText());
......@@ -246,7 +251,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
instanceInfo.setName(detail.getPlanName());
instanceInfo.setOrgCode(detail.getOrgCode());
instanceInfo.setPosition(equipmentSpecific.getPosition());
contingencyInstanceInfoService.addDisposalDetails(instanceInfo);
result.setMessage(ReserveEnum.RUN.getText());
result.setBatchNo(batchNo);
......@@ -339,8 +344,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Override
public List<HashMap<String, Object>> getBatchNoByCode(String code) {
List<HashMap<String, Object>> list = new ArrayList<>();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
String idByCode = equipmentSpecificMapper.getIdByCode(code);
if (StringUtils.isEmpty(idByCode)) {
return list;
......@@ -871,11 +874,11 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
}
@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";
Page<ContingencyPlanInstanceVO> page = new Page<>(current, size);
int total = 0;
total = contingencyInstanceInfoMapper.countTaskPage(type, batchNo, roleList);
total = contingencyInstanceInfoMapper.countTaskPage(type, batchNo, roleList, steps);
long start = (page.getCurrent() - 1) * page.getSize();
if (total == 0) {
page.setCurrent(1);
......@@ -886,7 +889,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
}
// 权限处理
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->{
if(ObjectUtils.isEmpty(e.getCreateUser())) {
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;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
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.EmergencyTaskRoleMapper;
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.IPlanOperationRecordDao;
......@@ -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.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
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.dao.entity.*;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
......@@ -68,6 +66,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Autowired
private PlanOperationRecordMapper planOperationRecordMapper;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Value("${spring.application.name}")
private String serviceName;
......@@ -76,17 +77,20 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Value("${auth-key-auth-enabled:}")
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
public Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable) {
int total = emergencyTaskMapper.getEmergencyTaskCount(obligationId);
List<EmergencyTaskContent> emergencyTaskList = emergencyTaskMapper.getEmergencyTaskList(obligationId, pageable.getOffset(), pageable.getPageSize());
Page<EmergencyTaskContent> result = new PageImpl<>(emergencyTaskList, pageable, total);
public Page<EmergencyTaskContent> list(Long obligationId, String planType, CommonPageable pageable) {
int total = emergencyTaskMapper.getEmergencyTaskCount(obligationId, planType);
List<EmergencyTaskContent> emergencyTaskList = emergencyTaskMapper.getEmergencyTaskList(obligationId, pageable.getOffset(), pageable.getPageSize(), planType);
org.springframework.data.domain.Page<EmergencyTaskContent> result = new PageImpl<>(emergencyTaskList, pageable, total);
return result;
}
@Override
public List<EmergencyRelationTree> treeList() {
return emergencyTaskMapper.treeList();
}
......@@ -101,6 +105,26 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
}
@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) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
......@@ -125,7 +149,11 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Transactional
@Override
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()) {
String batchNo = StringUtil.isNotEmpty(batchId) ? batchId : planOperationRecordMapper.getLastBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
......@@ -147,7 +175,7 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
contingencyPlanInstance.setTaskSort(taskNum);
contingencyPlanInstance.setStepCode(stepCode);
contingencyPlanInstance.setContent(buttonJson);
contingencyPlanInstanceRepository.save(contingencyPlanInstance);
contingencyPlanInstanceRepository.saveAndFlush(contingencyPlanInstance);
if ("0".equals(stepCode)) {
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
......@@ -199,9 +227,9 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
}
@Override
public List<EmergencyTaskContentVo> getMustTaskList(String stepCode) {
public List<EmergencyTaskContentVo> getMustTaskList(String stepCode, String planType) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return emergencyTaskMapper.getMustTaskList(stepCode);
return emergencyTaskMapper.getMustTaskList(stepCode, planType);
}
}
......@@ -2,20 +2,16 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.mapper.*;
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.IPlanMessageDao;
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.IPlanStepService;
import com.yeejoin.amos.fas.business.vo.ConditionVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
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.PlanMessage;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
......@@ -24,15 +20,12 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -89,10 +82,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
private IPlanStepService iPlanStepService;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@Override
public List<EquipmentFireEquipment> findByEquipmentId(Long equipmentId) {
......@@ -181,13 +172,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
if (ObjectUtils.isEmpty(index)) {
return false;
}
String json;
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案节点信息失败!");
}
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
String planStep = iPlanStepService.getPlanStep();
List<PlanStepJsonVO> result = JSONObject.parseArray(planStep, PlanStepJsonVO.class);
if (!CollectionUtils.isEmpty(result)) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
......
......@@ -25,9 +25,11 @@ import com.yeejoin.amos.fas.business.util.RpnUtils;
import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
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.dao.entity.*;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import org.apache.commons.io.IOUtils;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
......@@ -45,6 +47,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.awt.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
......@@ -84,6 +87,12 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${plan.dynamic.execut.topic}")
private String planDynamicExecutTopic;
@Value("${plan.dynamic.execut.zb.topic}")
private String planDynamicExecutZBTopic;
@Value("${plan.dynamic.execut.gk.topic}")
private String planDynamicExecutGKTopic;
@Autowired
private WebMqttComponent webMqttComponent;
......@@ -202,15 +211,15 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
if ("false".equals(topicEntity.getSimulationDate()) && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)) {
log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode() + "-" + equipmentSpecificIndex.getNameKey() + ":" + equipmentSpecificIndex.getValue());
// 三维屏指标状态推送,没有绑定模型的设备不需要推送至三维
if("true".equals(equipmentSpecific.getPush3D())){
equipmentSpecificIndex.setId(equipmentSpecific.getId());
if ("true".equals(equipmentSpecific.getPush3D())) {
equipmentSpecificIndex.setId(equipmentSpecific.getId());
equipmentSpecificIndex.setName(equipmentSpecific.getName());
equipmentSpecificIndex.setCode(equipmentSpecific.getCode());
equipmentSpecificIndex.setType("equip");
String msg = JSON.toJSONString(equipmentSpecificIndex);
String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus");
webMqttComponent.publish(title, msg);
}
}
}
......@@ -290,16 +299,16 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode())));
}
//根据指标数据处理预案按钮
if(planIndex.contains(nameKey) && !ObjectUtils.isEmpty(equipment)){
DeviceRo deviceRo = new DeviceRo();
deviceRo.setEquipmentCode(equipment.getCode());
deviceRo.setEquipmentId(equipment.getId());
deviceRo.setEquipmentSpecificId(equipmentSpecific.getId());
deviceRo.setEquipmentSpecificCode(equipmentSpecific.getCode());
deviceRo.setIotCode(equipmentSpecific.getIotCode());
deviceRo.setValue(equipmentSpecificIndex.getValue());
deviceRo.setEquipmentIndexKey(equipmentSpecificIndex.getNameKey());
planAutoExec(equipment, toke, deviceRo);
if (planIndex.contains(nameKey) && !ObjectUtils.isEmpty(equipment)) {
DeviceRo deviceRo = new DeviceRo();
deviceRo.setEquipmentCode(equipment.getCode());
deviceRo.setEquipmentId(equipment.getId());
deviceRo.setEquipmentSpecificId(equipmentSpecific.getId());
deviceRo.setEquipmentSpecificCode(equipmentSpecific.getCode());
deviceRo.setIotCode(equipmentSpecific.getIotCode());
deviceRo.setValue(equipmentSpecificIndex.getValue());
deviceRo.setEquipmentIndexKey(equipmentSpecificIndex.getNameKey());
planAutoExec(equipment, toke, deviceRo);
}
}
......@@ -310,16 +319,25 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
* @param deviceRo
*/
private void planAutoExec(Equipment equipment, Toke toke, DeviceRo deviceRo) {
try {
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
ruleTrigger.publish(deviceRo, planDynamicExecutTopic, new String[] {});
} catch (Exception e) {
e.printStackTrace();
}
}
@Async
try {
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
if (redisTemplate.hasKey("planType")) {
String planType = redisTemplate.boundValueOps("planType").get(0, -1);
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[]{});
} else {
ruleTrigger.publish(deviceRo, planDynamicExecutTopic, new String[]{});
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Async
public void sendWaterLevel(FormInstanceVo formInstanceVo) {
try {
String topic = String.format("/%s/%s/%s", serviceName, stationName, "analogue");
......@@ -391,6 +409,47 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
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
public void subscribeTopic() {
// 若登录系统则订阅装备数据
......
......@@ -62,6 +62,7 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
for (PlanClassifyTree planClassifyTree : list) {
PlanClassifyTreeVo planClassifyTreeVo = new PlanClassifyTreeVo();
BeanUtils.copyProperties(planClassifyTree, planClassifyTreeVo);
planClassifyTreeVo.setParentId(0L);
voList.add(planClassifyTreeVo);
}
Map<Object, PlanClassifyTreeVo> map = Bean.listToMap(voList, "id", PlanClassifyTree.class);
......@@ -73,6 +74,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return TreeBuilder.buildByRecursive(completeList, ROOT);
}
@Override
public List<PlanClassifyTree> findAllInfo() {
return planClassifyTreeDao.findAll();
}
private List<PlanClassifyTreeVo> buildWithParent(PlanClassifyTreeVo groupModel, Map<Object, PlanClassifyTreeVo> map) {
List<PlanClassifyTreeVo> completeList = new ArrayList<>();
......@@ -137,6 +143,11 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return planClassifyTreeDao.save(model);
}
@Override
public PlanClassifyTree findById(Long id) {
return planClassifyTreeDao.findById(id).orElse(new PlanClassifyTree());
}
private boolean classifyNameExist(String classifyName, Long parentId) {
return 0 < planClassifyTreeDao.countByClassifyNameAndParentId(classifyName, parentId);
}
......
package com.yeejoin.amos.fas.business.service.impl;
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.vo.PlanStepJsonVO;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
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.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.stream.Collectors;
......@@ -23,8 +19,8 @@ public class PlanStepServiceImpl implements IPlanStepService {
@Autowired
private RedisTemplate redisTemplate;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@Autowired
private EmergencyTaskRoleMapper emergencyTaskRoleMapper;
@Override
public String getPlanStepRoleCodeByButtonCode(String buttonCode) {
......@@ -52,23 +48,26 @@ public class PlanStepServiceImpl implements IPlanStepService {
@Override
public List<PlanStepJsonVO> getPlanStepJsonVOS() {
String json = "";
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案相关角色信息失败!");
}
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
String planStepString = getPlanStep();
List<PlanStepJsonVO> result = JSONObject.parseArray(planStepString, PlanStepJsonVO.class);
return result;
}
@Override
public String getPlanStep() {
try {
return IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案初始化planStep信息失败!");
String planType = "";
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
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
......
......@@ -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.dao.entity.*;
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.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......@@ -283,6 +284,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
@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) {
// 根据批次号获取预案记录
List<Map<String, Object>> instancesList = contingencyPlanInstanceRepository.queryRecord(batchNo, "MESSAGE");
......
......@@ -142,5 +142,5 @@ public interface IContingencyPlanService {
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;
public interface IEmergencyTaskService {
Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable);
Page<EmergencyTaskContent> list(Long obligationId, String planType, CommonPageable pageable);
List<EmergencyRelationTree> treeList();
......@@ -20,6 +20,8 @@ public interface IEmergencyTaskService {
void save(EmergencyRelation emergencyRelation);
void saveTaskConfig(EmergencyTaskContent emergencyTaskContent);
String getRolesByUserId(String userId);
List<Long> getPersonIds(Long obligationId);
......@@ -28,5 +30,5 @@ public interface IEmergencyTaskService {
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;
import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree;
import java.util.Collection;
import java.util.List;
/**
* @author wjk
......@@ -28,4 +29,8 @@ public interface IPlanClassifyTreeService {
PlanClassifyTree create(PlanClassifyTree model);
PlanClassifyTree update(PlanClassifyTree model);
PlanClassifyTree findById(Long id);
List<PlanClassifyTree> findAllInfo();
}
......@@ -26,6 +26,8 @@ public interface IPlanStepService {
String getPlanStep();
List<PlanStepJsonVO> getPlanStepByParam(String planType);
void initPlanStep();
void initPlanTask();
......
......@@ -2,10 +2,8 @@ package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.dao.dto.PlanStepJsonVO;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
......@@ -142,4 +140,6 @@ public interface IPlanVisual3dService {
* @return
*/
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
eureka.instance.prefer-ip-address=true
management.security.enabled=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info
......@@ -55,12 +56,12 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in=
## emqx
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.client-user-name=admin
emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p)
emqx.max-inflight=1000
riskSourceService
#\u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
file.downLoad.url=http://172.16.11.201:9000/
......@@ -105,6 +106,9 @@ plan.web.isUpdatePlanStep=false
maparea.action.is-area=action1-2,action1-6
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
sso.client.id=dce
......
......@@ -967,4 +967,53 @@
</sql>
</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>
\ No newline at end of file
......@@ -321,6 +321,11 @@
role_code like concat('%',#{role},'%')
</foreach>
</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>
UNION ALL
select count(1) AS tmpcount from contingency_plan_instance
......@@ -337,6 +342,11 @@
role_code like concat('%',#{role},'%')
</foreach>
</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>
) a
</select>
......@@ -346,10 +356,10 @@
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.`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
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>
cpi.step_code != "-1"
<if test="batchNo != null and batchNo != ''">
......@@ -363,6 +373,11 @@
cpi.role_code like concat('%',#{role},'%')
</foreach>
</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>
UNION ALL
select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
......@@ -385,6 +400,11 @@
cpi.role_code like concat('%',#{role},'%')
</foreach>
</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>
) tmp
<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 @@
and d.is_delete = false
limit 1
</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 c_plan_detail SET `status` = 2;
......
......@@ -147,7 +147,7 @@
</select>
<select id="getArraysUserName" resultType="java.lang.String">
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>
</mapper>
\ No newline at end of file
......@@ -16,8 +16,11 @@
<if test="obligationId != null ">
obligation_id = #{obligationId}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
LIMIT #{offset}, #{pageSize}
LIMIT #{offset}, #{pageSize}
</select>
......@@ -28,11 +31,13 @@
FROM
c_emergency_task_content
<where>
<if test="_parameter != null ">
<if test="obligationId != null ">
obligation_id = #{obligationId}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
</select>
......@@ -50,9 +55,9 @@
<select id="roleCodes" resultType="string">
SELECT
f.dict_value
f.code
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>
<if test="_parameter != null ">
cer.amos_id = #{amosOrgId}
......@@ -62,9 +67,9 @@
<select id="roleNames" resultType="string">
SELECT
f.dict_name AS dictName
f.name AS dictName
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>
<if test="_parameter != null ">
cer.amos_id = #{amosOrgId}
......@@ -84,6 +89,17 @@
</where>
</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 from c_emergency_relation cer
......@@ -103,6 +119,11 @@
VALUES (#{id}, #{obligationId}, #{personId}, #{amosOrgId}, #{personName},#{createDate});
</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
*
......@@ -115,6 +136,9 @@
<if test="stepCode != null and stepCode != '' and stepCode == '-2'">
step_code = -1
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
</select>
......@@ -124,9 +148,11 @@
FROM
c_emergency_task_content
<where>
is_must = true
<if test="stepCode != null and stepCode != ''">
and step_code = #{stepCode}
step_code = #{stepCode}
</if>
<if test="planType != null ">
AND plan_type = #{planType}
</if>
</where>
</select>
......
......@@ -6,1059 +6,1036 @@
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<![CDATA[
SELECT distinct temp1.*,IFNULL(S.safety_index,0) as value
FROM (
SELECT @s :=@s + 1 as `index`, DATE(DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic,(SELECT @s := 0) temp
) temp1
left join f_safety_index_change_log S on S.collect_date = temp1.date
where temp1.index < 8
ORDER BY temp1.date
]]>
SELECT distinct temp1.*, IFNULL(S.safety_index, 0) as value
FROM (
SELECT @s := @s + 1 as `index`, DATE (DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic, (SELECT @s := 0) temp
) temp1
left join f_safety_index_change_log S
on S.collect_date = temp1.date
where temp1.index < 8
ORDER BY temp1.date
]]>
</select>
<select id="countUpperRiskPoint" resultType="long">
SELECT
count(DISTINCT frcl.risk_source_id)
FROM
(
SELECT
a.id,
a.risk_source_id
FROM
`f_rpn_change_log` a,
`f_risk_source` b
WHERE
a.type = #{type}
and a.risk_source_id = b.id
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 count(DISTINCT frcl.risk_source_id)
FROM (
SELECT a.id,
a.risk_source_id
FROM `f_rpn_change_log` a,
`f_risk_source` b
WHERE a.type = #{type}
and a.risk_source_id = b.id
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
count(distinct pc.point_id)
FROM
p_check pc
WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
</select>
SELECT count(distinct pc.point_id)
FROM p_check pc
WHERE DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
</select>
<select id="countFireException" resultType="long">
SELECT
count(1)
FROM
wl_equipment_specific_alarm a
WHERE
status = 1
AND org_code = #{orgCode}
AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
SELECT count(1)
FROM wl_equipment_specific_alarm a
WHERE status = 1
AND org_code = #{orgCode}
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
rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM
(
SELECT
risk_source_id,
MAX(create_date) create_date,
MAX(id) id
FROM
f_rpn_change_log
WHERE
type = '0'
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
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 rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM (
SELECT risk_source_id,
MAX(create_date) create_date,
MAX(id) id
FROM f_rpn_change_log
WHERE type = '0'
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
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
pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
FROM
p_check pc
WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
SELECT pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
FROM p_check pc
WHERE DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
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
ala.id,
ala.equipment_specific_name as name,
cate.name as status,
ala.update_date as changeDate
from
wl_equipment_specific_alarm as ala
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_category as cate on equ.category_id = cate.id
where ala.status = TRUE
AND ala.type = 'alarm_type_trouble'
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
select ala.id,
ala.equipment_specific_name as name,
cate.name as status,
ala.update_date as changeDate
from wl_equipment_specific_alarm as ala
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_category as cate on equ.category_id = cate.id
where ala.status = TRUE
AND ala.type = 'alarm_type_trouble'
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
</select>
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[
SELECT
(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
(
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' ))) AS `point_num`,(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
((
`p_plan_task`.`finish_status` = 3
)
AND (
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `miss_num`,(
SELECT
count( 1 ) AS `total_num`
FROM
(
SELECT
`b`.`id` AS `id`
FROM
`p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE
`b`.`is_finish` = 1 AND c.is_ok = 1 AND `a`.`check_date` = curdate()
ORDER BY
`b`.`id`
) `t` ) AS `ok_num`,(
SELECT
count( 1 ) AS `total_num`
FROM
(
SELECT
`b`.`id` AS `id`
FROM
`p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE
`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 ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%'))) AS `point_num`,
(
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE ((
`p_plan_task`.`finish_status` = 3
)
AND (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `miss_num`,
(
SELECT count(1) AS `total_num`
FROM (
SELECT `b`.`id` AS `id`
FROM `p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE `b`.`is_finish` = 1
AND c.is_ok = 1
AND `a`.`check_date` = curdate()
ORDER BY `b`.`id`
) `t`) AS `ok_num`,
(
SELECT count(1) AS `total_num`
FROM (
SELECT `b`.`id` AS `id`
FROM `p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE `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 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
FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0
ORDER BY n.create_date desc
limit 0,5
</select>
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
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0
ORDER BY n.create_date desc limit 0,5
</select>
<select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT p.id,I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name,' 不合格') ,CONCAT(I.name,' 漏检') ) as label,
p.point_id,'patrol' as type,p.check_time as changeDate
FROM p_check p
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
AND I.is_delete = 0
ORDER BY p.check_time desc
limit 0,5
</select>
SELECT p.id,
I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name, ' 不合格'), CONCAT(I.name, ' 漏检')) as label,
p.point_id,
'patrol' as type,
p.check_time as changeDate
FROM p_check p
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
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
ala.id,
ala.equipment_specific_id AS pointId,
'monitorEquipment' AS type,
spe.`code`,
ala.type AS alarmType,
ala.equipment_specific_index_name,
CONCAT(
ala.equipment_specific_index_name,
'(',
ala.equipment_specific_name,
')',
IF (
(
ISNULL(ws.full_name)
AND ISNULL(sd.description)
),
'',
CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
)
)
) AS label,
ala.update_date AS changeDate
FROM
wl_equipment_specific_alarm AS ala
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE
ala.`status` = 1
AND (
ala.type = 'FIREALARM'
)
ORDER BY
ala.update_date DESC
LIMIT 0,5
</select>
SELECT ala.id,
ala.equipment_specific_id AS pointId,
'monitorEquipment' AS type,
spe.`code`,
ala.type AS alarmType,
ala.equipment_specific_index_name,
CONCAT(
ala.equipment_specific_index_name,
'(',
ala.equipment_specific_name,
')',
IF(
(
ISNULL(ws.full_name)
AND ISNULL(sd.description)
),
'',
CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
)
)
) AS label,
ala.update_date AS changeDate
FROM wl_equipment_specific_alarm AS ala
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE ala.`status` = 1
AND (
ala.type = 'FIREALARM'
)
ORDER BY ala.update_date DESC LIMIT 0,5
</select>
<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 * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id,
0 as frequency,
case p.status
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 *
from (
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.type_code in
('Action', 'Reset', 'FeedBack', 'StartStop', 'Tripping', 'Control', 'Normal', 'WYStartStop')
ORDER BY wlesi.update_date DESC LIMIT 0,5
) a
where a.label is not null
</select>
<select id="retrieveAllCount" resultType="long">
SELECT
count(1)
FROM
(
SELECT
*
FROM
(
SELECT
r.`code`,
r.`name`,
r.org_code AS orgCode,
'riskSource' AS typeCode,
r.id AS riskSourceId
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test = "dataLevel != null and dataLevel != ''" >
AND rl. level = #{dataLevel}
</if>
UNION ALL
SELECT
p.point_no AS code,
p.`name`,
p.org_code AS orgCode,
'patrol' AS typeCode,
p.risk_source_id AS riskSourceId
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
WHERE
is_delete = FALSE
UNION ALL
SELECT
e.`code`,
e.`name`,
e.org_code AS orgCode,
'impEquipment' AS typeCode,
e.risk_source_id AS riskSourceId
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
m.`code` AS code,
m.`name`,
m.org_code AS orgCode,
'monitorEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific m
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(m.equipment_code, 1, 4) = '9204'
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
vi.`name`,
vi.org_code AS orgCode,
'video' AS typeCode,
vis.source_id AS riskSourceId
FROM
wl_video AS vi
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
GROUP BY
vi.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
str.source_id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHERE
substr(cat.`code`, 1, 4) = '3105'
AND str.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
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 ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION ALL
SELECT
car.car_num AS code,
car.`name`,
car.org_code AS orgCode,
'fireEquipment' AS typeCode,
'' as riskSourceId
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(cat.`code`, 1, 4) = '3104'
AND risk.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
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
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
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 ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
) AS tmp
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%#{inputText}%'
OR tmp.name LIKE '%#{inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null and riskSourceId!=''">
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
) t
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
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,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId,
'' as room
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
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,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId,
r.name as room
from p_point p
left join f_risk_source r on r.id = p.risk_source_id
WHERE is_delete = FALSE
UNION all
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,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
e.name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId,
r.name as room
from f_equipment e
left join f_risk_source r on r.id = e.risk_source_id
UNION all
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,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
(select
group_concat(fet.`name`)
from f_equipment_fire_equipment as fefe
left join f_equipment as fet on fet.id = fefe.equipment_id
where fefe.fire_equipment_id = m.id
) as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(m.equipment_code ,1,4) = '9204'
group By m.code
UNION all
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,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
ws.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId,
CONCAT(ws.full_name,vi.address) AS room
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
group by vi.id
UNION all
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,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId,
str.full_name as room
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
where substr(cat.code ,1,4)= '3105'
UNION all
select
concat('pool-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' 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('pool-',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('pool','r_pool')
GROUP BY
a.instance_id) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION all
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,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId,
'' as room
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
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,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('extinguisher-',spe.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4) = '3104'
UNION all
select
concat('fireChamber-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' 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('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
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
select * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id,
0 as frequency,
case p.status
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
count(1)
FROM
(
SELECT
*
FROM
(
SELECT
r.`code`,
r.`name`,
r.org_code AS orgCode,
'riskSource' AS typeCode,
r.id AS riskSourceId
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl. level = #{dataLevel}
</if>
UNION ALL
SELECT
p.point_no AS code,
p.`name`,
p.org_code AS orgCode,
'patrol' AS typeCode,
p.risk_source_id AS riskSourceId
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
WHERE
is_delete = FALSE
UNION ALL
SELECT
e.`code`,
e.`name`,
e.org_code AS orgCode,
'impEquipment' AS typeCode,
e.risk_source_id AS riskSourceId
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
m.`code` AS code,
m.`name`,
m.org_code AS orgCode,
'monitorEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific m
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(m.equipment_code, 1, 4) = '9204'
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
vi.`name`,
vi.org_code AS orgCode,
'video' AS typeCode,
vis.source_id AS riskSourceId
FROM
wl_video AS vi
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
GROUP BY
vi.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
str.source_id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHERE
substr(cat.`code`, 1, 4) = '3105'
AND str.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
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 ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION ALL
SELECT
car.car_num AS code,
car.`name`,
car.org_code AS orgCode,
'fireEquipment' AS typeCode,
'' as riskSourceId
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(cat.`code`, 1, 4) = '3104'
AND risk.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
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
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
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 ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
) AS tmp
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null and riskSourceId!=''">
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
) t
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
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,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId,
'' as room
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
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,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as
typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId,
r.name as room
from p_point p
left join f_risk_source r on r.id = p.risk_source_id
WHERE is_delete = FALSE
UNION all
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,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
e.name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId,
r.name as room
from f_equipment e
left join f_risk_source r on r.id = e.risk_source_id
UNION all
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,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as
typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
(select
group_concat(fet.`name`)
from f_equipment_fire_equipment as fefe
left join f_equipment as fet on fet.id = fefe.equipment_id
where fefe.fire_equipment_id = m.id
) as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(m.equipment_code ,1,4) = '9204'
group By m.code
UNION all
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,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
ws.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId,
CONCAT(ws.full_name,vi.address) AS room
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
group by vi.id
UNION all
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,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId,
str.full_name as room
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
where substr(cat.code ,1,4)= '3105'
UNION all
select
concat('pool-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' 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('pool-',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('pool','r_pool')
GROUP BY
a.instance_id) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION all
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,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId,
'' as room
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
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,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as
typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('extinguisher-',spe.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4) = '3104'
UNION all
select
concat('fireChamber-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' 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('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
`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 @@
"stepStatus": "0",
"buttonCode": "CALL_PHONE",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"roleCode": "Digital_Responsing_Plan_A",
"index": 1,
"checkYesOrNo": ""
},
......@@ -27,7 +27,8 @@
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 2,
"isAuto": 0
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "3",
......@@ -54,36 +55,49 @@
},
{
"stepCode": "4",
"stepName": "启动应急排油",
"stepName": "启动CAFS消防系统",
"stepStatus": "0",
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"roleCode": "Digital_Responsing_Plan_A",
"index": 4,
"checkYesOrNo": ""
"checkYesOrNo": "",
"condition": [
{
"equipName": "雨淋阀",
"equipCode": "92130300BH644",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0
},
{
"stepCode": "5",
"stepName": "CAFS喷淋系统已开启",
"stepName": "启动应急排油",
"stepStatus": "0",
"buttonCode": "VERIFY_EQUIP_STATUS",
"buttonCode": "DRAIN_OIL_CONFIRM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 5,
"checkYesOrNo": "",
"condition": [
{
"equipName": "雨淋阀",
"equipCode": "92130300BH644",
"equipName": "排油阀",
"equipCode": "92100400VWE44",
"equipSpeName": "",
"equipSpeCode": "",
"equipSpeIndexKey": "WSS_DelugeValve_Start",
"equipSpeIndexKey": "ONL_DrainOilValve_Open",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0
"isAuto": 0,
"checkYesOrNo": ""
},
{
"stepCode": "6",
......@@ -122,7 +136,7 @@
"stepStatus": "0",
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"roleCode": "Digital_Responsing_Plan_B",
"index": 9,
"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