Commit c4b43c74 authored by 高建强's avatar 高建强

Merge branch 'dev_plan' into dev_upgrade

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
parents 2e1441a5 95688d2d
package com.yeejoin.amos.fas.business.action;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.component.rule.MethodParam;
......@@ -29,8 +27,6 @@ import com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl;
import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.CacheFactory;
import com.yeejoin.amos.fas.business.util.CacheMap;
import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.business.vo.Toke;
......@@ -38,7 +34,6 @@ import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail;
......@@ -53,8 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -179,52 +173,6 @@ public class ContingencyAction implements CustomerAction {
*/
/**
* 预案文件中值为和数据字典中的对应关系
* 消防
* F1 消防队长 fireLeader
* F2..F6 队员 firePerson 规则配置中队员1...6:firePerson1...firePerson6
* FD .... 司机 fireDriver 规则配置中司机 1..6:fireDriver1...fireDriver6
* 运维
* S1 值班长 dutyLeader
* S2 副值班长 deputyDutyLeader
* B1..B6 值班员 dutyCivilian 规则配置中值班员1...6:dutyCivilian1...dutyCivilian6
* A1...A6 副值班员 deputyDutyCivilian 规则配置中副值班员1...6:deputyDutyCivilian1...deputyDutyCivilian6
*/
public Map<String, String> getStrengthMap(ContingencyRo contingencyRo) {
String batchNo = contingencyRo.getBatchNo();
String orgCode = contingencyRo.getEquipmentOrgCode();
Map<String, String> returnMap = stringStringMap.get(contingencyRo.getBatchNo());
if (CollectionUtils.isEmpty(returnMap)) {
stringStringMap = new HashMap<>();
returnMap = new HashMap<>();
Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.product);
RequestContext.setAppKey(toke.appKey);
ResponseModel responseModel = jcsFeign.dutyPersonList();
if ("SUCCESS".equals(responseModel.getDevMessage())) {
String JSONStr = JSON.toJSONString(responseModel.getResult());
JSONArray dataList = JSONObject.parseArray(JSONStr);
if (!ObjectUtils.isEmpty(dataList)) {
Map<String, String> finalReturnMap = returnMap;
dataList.forEach(x -> {
Map<String, Object> resultMap = new HashMap<>();
JSONObject obj = (JSONObject) x;
finalReturnMap.put(obj.getString("postTypeName"), obj.getString("userName"));
});
}
}
stringStringMap.put(batchNo, returnMap);
}
log.info(String.format("returnMap:【 %s 】", returnMap));
return returnMap;
}
/**
* @param stepCode 当前步骤编号
* @param stepName 当前步骤名称
* @param nextStepCode 下一步编号
......@@ -365,6 +313,7 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "执行记录", project = "换流站消防专项预案")
@Transactional
public void messageRecord(@MethodParam(paramLabel = "消息内容") String content, @MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String batchNo = contingencyRo.getBatchNo();
......@@ -384,36 +333,30 @@ public class ContingencyAction implements CustomerAction {
content = instedParams(content, contingencyRo);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> {
HashMap map = new HashMap();
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------" + result);
sendcmd("recordarea", paramObj, result);
sendweb("recordarea", paramObj, result);
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> {
HashMap map = new HashMap();
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent());
records.add(map);
});
}
});
tempmap1.put("content", records);
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(tempmap1);
System.out.printf("=========recordarea=====396====%s=========%s=========%n", JSONObject.toJSONString(paramObj), JSONObject.toJSONString(result));
sendcmd("recordarea", paramObj, result);
sendweb("recordarea", paramObj, result);
}
}
......@@ -459,10 +402,6 @@ public class ContingencyAction implements CustomerAction {
private String instedParams(String content, ContingencyRo contingencyRo) {
Map<String, String> strengthMap = this.getStrengthMap(contingencyRo);
for (String key : strengthMap.keySet())
content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null;
try {
......@@ -997,6 +936,7 @@ public class ContingencyAction implements CustomerAction {
/**
* 通过batchNo获取预案的状态
*
* @param batchNo
* @return
*/
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.action.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.bo.DangerResultBo;
import com.yeejoin.amos.fas.business.bo.PlanFlagBo;
import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper;
import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService;
......@@ -16,10 +17,7 @@ import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.enums.ReserveEnum;
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.core.util.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -48,6 +46,9 @@ public class RiskSourceController extends BaseController {
@Autowired
IRiskSourceService riskSourceService;
@Autowired
ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Permission
//@Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "查询风险点子项", notes = "查询风险点子项")
......@@ -719,6 +720,27 @@ public class RiskSourceController extends BaseController {
return CommonResponseUtil.success(riskSourceService.queryContingencyWater());
}
@ApiOperation(value = "概览水源信息")
@GetMapping("/getWaterInfo")
@Permission
public CommonResponse getWaterInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
String bizOrgCode = null;
if (StringUtil.isNotEmpty(orgCode)) {
bizOrgCode = contingencyPlanInstanceMapper.getBizOrgCode(orgCode);
if (!StringUtil.isNotEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
} else {
return CommonResponseUtil.success(null);
}
return CommonResponseUtil.success(riskSourceService.getWaterInfo(commonPageable, bizOrgCode));
}
/**
* 获取危险因素树二级节点
*
......
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -33,4 +34,11 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla
* @return
*/
Boolean updateMessageById(@Param("dto") ContingencyPlanInstance contingencyPlanInstance);
String getBizOrgCode(@Param("amosOrgCode") String amosOrgCode);
List<Map<String, Object>> getWaterInfo(@Param("current") Integer current, @Param("size") Integer size, @Param("bizOrgCode") String bizOrgCode);
long countWater(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -120,6 +120,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Value("${plan.instance.playImg}")
private String playImg;
@Value("${aurora.push.switch}")
private Boolean auroraPushSwitch;
@Override
public List<TreeSubjectVo> getPlanTree() {
......@@ -518,10 +521,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override
public void sendMessage(String buttonCode, MessageVO messageVO) {
List<String> userIds = getUserIds(buttonCode);
if (!CollectionUtils.isEmpty(userIds)) {
// 添加极光推送开关
if (auroraPushSwitch) {
List<String> userIds = getUserIds(buttonCode);
if (!CollectionUtils.isEmpty(userIds)) {
messageVO.setRecivers(userIds);
sendMessage(messageVO);
}
}
}
......
......@@ -193,6 +193,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
private WebMqttComponent webMqttComponent;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Override
public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception {
RiskSource riskSource = (RiskSource) map.get("param");
......@@ -2010,6 +2013,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return riskSource;
}
@Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Override
public Page<Map<String, Object>> getWaterInfo(CommonPageable commonPageable, String bizOrgCode) {
List<Map<String, Object>> content = Lists.newArrayList();
long total = contingencyPlanInstanceMapper.countWater(bizOrgCode);
if (total <= 0) {
return new PageImpl<>(content, commonPageable, total);
}
Integer start = (commonPageable.getPageNumber() - 1) * commonPageable.getPageSize();
content = contingencyPlanInstanceMapper.getWaterInfo(start, commonPageable.getPageSize(), bizOrgCode);
return new PageImpl<>(content, commonPageable, total);
}
}
package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
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.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.web.bind.annotation.RequestParam;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import java.util.List;
......@@ -34,7 +26,8 @@ public interface IPlanVisual3dService {
/**
* 上传文字预案
* @param appId 预案ID
*
* @param appId 预案ID
* @param pathNameMap 文字预案文件路径:文件名称map
*/
void uploadTextPlan(String appId, Map<String, String> pathNameMap);
......@@ -49,22 +42,24 @@ public interface IPlanVisual3dService {
CommonResponse getResourceListByType(String type);
List<Map<String,Object>> getResourceById(String type,Long id);
List<Map<String, Object>> getResourceById(String type, Long id);
List<Map<String,Object>> getResourceTypeList();
List<Map<String, Object>> getResourceTypeList();
List<TreeSubjectVo> getTextPlanBySubjectId(String appId);
List<TreeSubjectVo> getTextPlanBySubjectId(String appId);
void deleteTextPlanFile(Long id);
void deleteTextPlanFile(Long id);
/**
* 查最新的批次号
*
* @return
*/
String getNewestBatchNo();
String getNewestBatchNo();
/**
* 根据批次号获取预案步骤
*
* @param batchNo 批次号
* @return 预案步骤
*/
......@@ -72,6 +67,7 @@ public interface IPlanVisual3dService {
/**
* 根据批次号获取预案记录
*
* @param batchNo 批次号
* @return 预案记录
*/
......@@ -79,6 +75,7 @@ public interface IPlanVisual3dService {
/**
* 根据批次号获取预案记录
*
* @param batchNo 批次号
* @return 预案记录
*/
......@@ -86,10 +83,11 @@ public interface IPlanVisual3dService {
PlanStepVo updatePlanStep(PlanStepVo planStepVo);
Page<ContingencyPlanInstanceVO> selectDisposalActionPage(int current, int size, String batchNo , List<RoleModel> roleModelList, int dataType);
Page<ContingencyPlanInstanceVO> selectDisposalActionPage(int current, int size, String batchNo, List<RoleModel> roleModelList, int dataType);
/**
* 根据批次号获取预案的消息等记录
*
* @param batchNo
* @return
*/
......@@ -97,30 +95,11 @@ public interface IPlanVisual3dService {
ContingencyPlanInstance replyMessage(AgencyUserModel user, ContingencyPlanInstance dto);
List<ContingencyPlanInstanceVO> selectDisposalActionList(String batchNo , List<RoleModel> roleModelList, int dataType);
// /**
// * 极光推送
// * @param json 消息体
// * @param buttonCode 按钮编码
// */
// void sendMessage(String json, String buttonCode);
//
// /**
// * 极光推送
// * @param buttonCode 按钮编码
// */
// void sendMessage(String buttonCode);
//
// /**
// * 极光推送
// * @param buttonCode 按钮编码
// * @param pushMsgParam 消息体
// */
// void sendMessage(String buttonCode, PushMsgParam pushMsgParam);
List<ContingencyPlanInstanceVO> selectDisposalActionList(String batchNo, List<RoleModel> roleModelList, int dataType);
/**
* 消息推送
* 极光推送消息
*
* @param buttonCode
* @param messageVO
*/
......@@ -129,6 +108,7 @@ public interface IPlanVisual3dService {
/**
* 修改动作执行状态
*
* @param id
* @return
*/
......
......@@ -220,4 +220,6 @@ public interface IRiskSourceService {
void processProtalDataFromDanger(DangerResultBo dangerResultBo) throws Exception;
RiskSource updateAreaSyn(String code, String compCode, RiskSourceSynBo synBo);
Page<Map<String, Object>> getWaterInfo(CommonPageable commonPageable, String bizOrgCode);
}
......@@ -62,6 +62,8 @@ number.plan.projectName=换流站消防专项预案
#站端名称使用全拼 与三维iotree 消息用到了,暂时统一设置为yinan
station.name = yinan
#极光推送开关
aurora.push.switch=false
param.safetyIndexChange.cron = 0 0 2 * * ?
......
......@@ -746,13 +746,13 @@
ALTER TABLE `toip_rm_snapshot` MODIFY COLUMN `method_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数' AFTER `equipment_id`;
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221017-01">
<changeSet author="gaojianqiang" id="20221028-01">
<preConditions onFail="MARK_RAN">
<columnExists tableName="c_plan_rule" columnName="plan_step"/>
</preConditions>
<comment>修改属性字段值 plan_step</comment>
<sql>
UPDATE c_plan_rule SET plan_step = '[{"stepCode": "0", "stepName": "确认灾情", "buttonCode": "FIRE_CONFIRM", "isParallel": "1", "stepStatus": "0"}, {"stepCode": "1", "stepName": "停运换流阀", "buttonCode": "STOP_COMMUTATION", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "2", "stepName": "拨打报警电话", "buttonCode": "CALL_PHONE", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "3", "stepName": "确认油枕排油系统已开启", "buttonCode": "DRAIN_OIL_CONFIRM", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "4", "stepName": "确认水喷雾系统已开启", "buttonCode": "OPEN_WATERSYSTEM", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "5", "stepName": "断开上级电源", "buttonCode": "OFF_POWER", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "6", "stepName": "停运阀厅空调系统", "buttonCode": "STOP_AIRCON", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "7", "stepName": "一键开启消防炮", "buttonCode": "MONITOR_START", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "8", "stepName": "驻站消防队指挥权交接", "buttonCode": "HANDOVER_COMMAND", "isParallel": "1", "stepStatus": "0"}, {"stepCode": "9", "stepName": "确认本体排油已开启", "buttonCode": "OWNER_DRAIN_OIL", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "10", "stepName": "启动阀厅应急预案", "buttonCode": "START_VALVE_HALL_CONTINGENCY", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "11", "stepName": "电缆沟封堵", "buttonCode": "PLUG_CABLETRENCH", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "12", "stepName": "政府消防队指挥权交接", "buttonCode": "HANDOVER_FIGTHHING", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "13", "stepName": "确认明火扑灭", "buttonCode": "FIRE_EXTINCT", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "14", "stepName": "应急处置结束", "buttonCode": "END_EMERGENCY", "isParallel": "1", "stepStatus": "0"}]';
UPDATE c_plan_rule SET plan_step = '[{"roleCode": "Digital_Responsing_Plan_A", "stepCode": "0", "stepName": "确认灾情", "buttonCode": "FIRE_CONFIRM", "isParallel": "1", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "1", "stepName": "停运换流阀", "buttonCode": "STOP_COMMUTATION", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "2", "stepName": "拨打报警电话", "buttonCode": "CALL_PHONE", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "3", "stepName": "确认油枕排油系统已开启", "buttonCode": "DRAIN_OIL_CONFIRM", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "4", "stepName": "确认水喷雾系统已开启", "buttonCode": "OPEN_WATERSYSTEM", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "5", "stepName": "断开上级电源", "buttonCode": "OFF_POWER", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "6", "stepName": "停运阀厅空调系统", "buttonCode": "STOP_AIRCON", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "7", "stepName": "一键开启消防炮", "buttonCode": "MONITOR_START", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "8", "stepName": "驻站消防队指挥权交接", "buttonCode": "HANDOVER_COMMAND", "isParallel": "1", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "9", "stepName": "确认本体排油已开启", "buttonCode": "OWNER_DRAIN_OIL", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "10", "stepName": "启动阀厅应急预案", "buttonCode": "START_VALVE_HALL_CONTINGENCY", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "11", "stepName": "电缆沟封堵", "buttonCode": "PLUG_CABLETRENCH", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "12", "stepName": "政府消防队指挥权交接", "buttonCode": "HANDOVER_FIGTHHING", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "13", "stepName": "确认明火扑灭", "buttonCode": "FIRE_EXTINCT", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "14", "stepName": "应急处置结束", "buttonCode": "END_EMERGENCY", "isParallel": "1", "stepStatus": "0"}]';
</sql>
</changeSet>
......
......@@ -71,4 +71,336 @@
<select id="getMessageById" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select * from contingency_plan_instance where id = #{id}
</select>
<select id="getBizOrgCode" resultType="java.lang.String">
select
biz_org_code
from cb_org_usr where amos_org_code = #{amosOrgCode} and is_delete = 0 limit 1
</select>
<select id="getWaterInfo" resultType="java.util.Map">
select * from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
a.nowLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume,
<!-- a.image,-->
a.resource_type,
a.sequence_nbr
<!-- ,a.`code` AS systemCode-->
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr,
rp.level_device_id
<!-- ,fs.`code` AS systemCode-->
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
ORDER BY
levelStatus DESC,sequence_nbr DESC
limit #{current},#{size}
</select>
<select id="countWater" resultType="long">
select count(1) from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
a.nowLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume,
<!-- a.image,-->
a.resource_type,
a.sequence_nbr
<!-- ,a.`code` AS systemCode-->
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr,
rp.level_device_id
<!-- ,fs.`code` AS systemCode-->
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
</select>
</mapper>
\ No newline at end of file
......@@ -44,7 +44,7 @@
<if test="name !=null and name != ''"> and (eq.name like concat(concat("%",#{name}),"%") or eq.code like concat(concat("%",#{name}),"%"))</if>
<if test="id != null and id != ''"> and eq.id = #{id}</if>
</trim>
order by eq.id
order by eq.id desc
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
......
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