Commit 6ff26b6d authored by 田涛's avatar 田涛

Merge remote-tracking branch 'origin/dev_upgrade-1225' into dev_upgrade-1225

parents 80051abe 665c7783
......@@ -86,11 +86,6 @@
<artifactId>amos-component-feign</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
<!-- <dependency>
<groupId>com.yeejoin.amos</groupId>
......
package com.yeejoin.amos.fas.business.action;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -18,7 +44,6 @@ import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.action.util.StepComparator;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
......@@ -41,25 +66,6 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//import com.yeejoin.amos.fas.business.service.intfc.FireStengthService;
......@@ -183,51 +189,89 @@ public class ContingencyAction implements CustomerAction {
return returnMap;
}
/**
* @param stepCode 当前步骤编号
* @param stepName 当前步骤名称
* @param nextStepCode 下一步编号
* @param nextStepName 下一步名称
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "步骤更新", project = "换流站消防专项预案")
public void stepInfo(@MethodParam(paramLabel = "当前编号") String stepCode,
// @MethodParam(paramLabel = "步骤类型") String stepType,
@MethodParam(paramLabel = "对象") Object paramObj) {
@RuleMethod(methodLabel = "步骤更新(新)", project = "换流站消防专项预案")
public void stepInfoNew(@MethodParam(paramLabel = "当前步骤编号") String stepCode,
@MethodParam(paramLabel = "当前步骤名称") String stepName,
@MethodParam(paramLabel = "下一步编号") String nextStepCode,
@MethodParam(paramLabel = "下一步名称") String nextStepName,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
SetpEnum[] stepArr = SetpEnum.values();
ArrayList list = new ArrayList();
HashMap preStep = new HashMap();
StepComparator comparator = new StepComparator();
Arrays.sort(stepArr, comparator);
boolean flage = false;
SetpEnum pstep = null;
for (SetpEnum step : stepArr) {
if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
if (!ObjectUtils.isEmpty(pstep)) {
preStep.put("stepCode", pstep.getValue());
preStep.put("stepName", pstep.getTitle());
}
flage = true;
}
if (flage) {
HashMap map = new HashMap();
map.put("stepCode", step.getValue());
map.put("stepName", step.getTitle());
list.add(map);
}
pstep = step;
}
HashMap step = new HashMap();
step.put("stepCode", stepCode);
step.put("stepName", stepName);
HashMap nextmap = new HashMap();
nextmap.put("stepCode", nextStepCode);
nextmap.put("stepName", nextStepName);
list.add(step);
list.add(nextmap);
tempmap1.put("step", list);
tempmap1.put("preStep", preStep);
tempmap1.put("preStep", new HashMap());
result.add(tempmap1);
log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
log.info("步骤更新(new)" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result);
}
/**
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "步骤更新", project = "换流站消防专项预案")
public void stepInfo(@MethodParam(paramLabel = "当前编号") String stepCode,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult();
// Map<String, Object> tempmap1 = new HashMap<>();
// SetpEnum[] stepArr = SetpEnum.values();
// ArrayList list = new ArrayList();
// HashMap preStep = new HashMap();
// StepComparator comparator = new StepComparator();
// Arrays.sort(stepArr, comparator);
//
// boolean flage = false;
// SetpEnum pstep = null;
// for (SetpEnum step : stepArr) {
// if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
// if (!ObjectUtils.isEmpty(pstep)) {
// preStep.put("stepCode", pstep.getValue());
// preStep.put("stepName", pstep.getTitle());
// }
// flage = true;
// }
// if (flage) {
// HashMap map = new HashMap();
// map.put("stepCode", step.getValue());
// map.put("stepName", step.getTitle());
// list.add(map);
// }
// pstep = step;
// }
//
// tempmap1.put("step", list);
// tempmap1.put("preStep", preStep);
// result.add(tempmap1);
// log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result);
}
public void sendcmd(String msgType, Object contingency, SafteyPlanResult result) {
ContingencyRo ro = (ContingencyRo)contingency;
......@@ -716,12 +760,6 @@ public class ContingencyAction implements CustomerAction {
ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", "");
Toke toke = remoteSecurityService.getServerToken();
// Toke toke = cacheMap.getValue(TOKE);
// if (toke == null) {
// toke = remoteSecurityService.come();
// Long times = (long) (20 * 24 * 60 * 60);
// cacheMap.setex(TOKE, toke, times);
// }
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
try {
......@@ -794,7 +832,7 @@ public class ContingencyAction implements CustomerAction {
Map<String, Object> equipemtnPoints = pointCache.get(contingencyRo.getEquipmentId());
tempmap1.put("type", "buttonCache");
tempmap1.put("content", equipemtnPoints.values());
tempmap1.put("content", ObjectUtils.isEmpty(equipemtnPoints) ? new ArrayList<>() : equipemtnPoints.values());
result.add(tempmap1);
this.sendcmd("message", paramObj, result);
......
......@@ -45,7 +45,7 @@ public class ProtalDataRo extends BasicsRo {
* 任务编号,如果无任务,则填充0
*/
@Label("任务id")
private Long taskId=0l;
private Long taskId= 0L;
/**
* 任务状态
*/
......
package com.yeejoin.amos.fas.business.action.util;
import java.util.Comparator;
import com.yeejoin.amos.fas.business.action.model.SetpEnum;
public class StepComparator implements Comparator<SetpEnum>{
@Override
public int compare(SetpEnum o1, SetpEnum o2) {
//对日期字段进行升序,如果欲降序可采用before方法
if(o1.getOrder() > o2.getOrder()) return 1;
return -1;
}
}
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.controller
* @ClassName: EquipmentSpecificIndexController
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexController
* @Date: 2021/1/18 16:32
* @Version: 1.0
*/
@RestController
@RequestMapping(value = "/api/equipSpecificIndex")
@Api(tags = "装备性能指标Api")
public class EquipmentSpecificIndexController extends BaseController {
@Value("${autoSys.alarm.nameKeys}")
private String nameKeys;
@Value("${autoSys.alarm.status}")
private String status;
@Value("${autoSys.alarm.value}")
private String value;
@Autowired
private EquipmentSpecificIndexService equipmentSpecificIndexService;
@Permission
@ApiOperation(httpMethod = "GET", value = "获取最新告警状态", notes = "获取最新告警状态")
@RequestMapping(value = "/queryInitAlarm", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryInitAlerm(@ApiParam(value = "物联采集属性值", required = true) @RequestParam String value,
@ApiParam(value = "多nameKey,中间英文逗号隔开", required = true) @RequestParam String nameKeys,
@ApiParam(value = "多status,中间英文逗号隔开", required = true) @RequestParam String status) {
return CommonResponseUtil.success(equipmentSpecificIndexService.queryInitAlarm(value, nameKeys, status));
}
@Permission
@ApiOperation(httpMethod = "GET", value = "获取三维初始化告警信息", notes = "获取三维初始化告警信息")
@RequestMapping(value = "/getInitAlarm", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse getInitAlarm(@ApiParam(value = "物联采集属性值") @RequestParam(required = false) String value,
@ApiParam(value = "多nameKey,中间英文逗号隔开") @RequestParam(required = false) String nameKeys,
@ApiParam(value = "多status,中间英文逗号隔开") @RequestParam(required = false) String status) {
if (!StringUtils.isNotBlank(value) && !StringUtils.isNotBlank(nameKeys) && !StringUtils.isNotBlank(status)) {
value = this.value;
nameKeys = this.nameKeys;
status = this.status;
}
return CommonResponseUtil.success(equipmentSpecificIndexService.getInitAlarm(value, nameKeys, status));
}
}
\ No newline at end of file
......@@ -636,7 +636,7 @@ public class RiskSourceController extends BaseController {
}
// @Permission
@Permission
// @Authorization(ingore = true)
@ApiOperation(httpMethod = "PUT", value = "上传巡检数据", notes = "上传巡检数据")
@RequestMapping(value = "/data/patroldata", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
......
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 装备性能指标 Mapper 接口
*
* @author Jianqiang Gao
* @date 2021-01-18
*/
public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecificIndexVo> {
List<EquipmentSpecificIndexVo> findByDetailIdInAndNameKey(@Param("list") List<Object> equipDetailIdList, @Param("nameKey") String nameKey);
List<EquipmentSpecificIndexVo> queryInitAlarm(@Param("value") String value, @Param("list") String[] nameKeys);
List<EquipmentSpecificIndexVo> getInitAlarm(@Param("value") String value, @Param("list") String[] nameKeys);
}
......@@ -20,5 +20,5 @@ public interface ImpEquipMapper extends BaseMapper {
Long reservePageCount();
List<EquipmentDTO> reservePage(long start, int length);
List<EquipmentDTO> reservePage(@Param("start") long start,@Param("length") int length);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.business.vo.PollPointVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.dao.mapper
* @ClassName: PollPointMapper
* @Author: Jianqiang Gao
* @Description: 巡检点Mapper
* @Date: 2021/1/18 17:36
* @Version: 1.0
*/
public interface PollPointMapper extends BaseMapper<PollPointVo> {
List<PollPointVo> queryInitAlarm(@Param("list") String[] status);
List<EquipmentSpecificIndexVo> getInitAlarm(@Param("list") String[] status);
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.feign;
import java.util.HashMap;
import java.util.Map;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.yeejoin.amos.fas.business.util.Constants;
@Service("remoteWebSocketServer")
public class RemoteWebSocketServer {
/*@Autowired
private ApplicationConfig applicationConfig;*/
@Value("${params.remoteWebsocketUrl}")
private String remoteWebsocketUrl;
private final RestTemplate restTemplate;
private ObjectMapper objectMapper = new ObjectMapper();
public RemoteWebSocketServer()
{
this.restTemplate = new RestTemplate();
}
public Object sendMessage(String path, String message) throws Exception
{
Map<String, String> map = new HashMap<String, String>();
map.put("filter", null);
map.put("message", message);
map.put("path", path);
String url =remoteWebsocketUrl;
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType
.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers);
ResponseEntity responseEntity = restTemplate.exchange(url + "/generic/sendMessage",
HttpMethod.POST, formEntity, String.class);
responseEntity.getBody();
Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(),Map.class);
if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS) )
{
return commonResponse.get("dataList");
}
return null;
}
}
//package com.yeejoin.amos.fas.business.feign;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import org.codehaus.jackson.map.ObjectMapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpMethod;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Service;
//import org.springframework.web.client.RestTemplate;
//
//import com.yeejoin.amos.fas.business.util.Constants;
//
//
//
//@Service("remoteWebSocketServer")
//public class RemoteWebSocketServer {
// /*@Autowired
// private ApplicationConfig applicationConfig;*/
//
// @Value("${params.remoteWebsocketUrl}")
// private String remoteWebsocketUrl;
//
// private final RestTemplate restTemplate;
//
// private ObjectMapper objectMapper = new ObjectMapper();
// public RemoteWebSocketServer()
// {
// this.restTemplate = new RestTemplate();
// }
//
//
// public Object sendMessage(String path, String message) throws Exception
// {
// Map<String, String> map = new HashMap<String, String>();
// map.put("filter", null);
// map.put("message", message);
// map.put("path", path);
// String url =remoteWebsocketUrl;
// HttpHeaders headers = new HttpHeaders();
// MediaType type = MediaType
// .parseMediaType("application/json; charset=UTF-8");
// headers.setContentType(type);
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
// HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers);
// ResponseEntity responseEntity = restTemplate.exchange(url + "/generic/sendMessage",
// HttpMethod.POST, formEntity, String.class);
//
// responseEntity.getBody();
// Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(),Map.class);
// if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS) )
// {
// return commonResponse.get("dataList");
// }
// return null;
// }
//}
......@@ -5,7 +5,6 @@ import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.ContingencyAction;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.model.SetpEnum;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
......@@ -169,8 +168,8 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
contingencyRo.setButtonCode(buttonCode);
contingencyRo.setButtonState(buttonState);
BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
SetpEnum step = SetpEnum.getStepByCode(stepCode);
contingencyRo.setStep(step.getValue());
// SetpEnum step = SetpEnum.getStepByCode(stepCode);
contingencyRo.setStep(stepCode);
contingencyRo.setStepState(stepMap.get(stepKey));
// contingencyRo.setStep(stepCode);
log.info("stepstate:" + contingencyRo.getStepState());
......
package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
......@@ -21,8 +19,8 @@ public class DataRefreshServiceImpl implements IDataRefreshService {
private final Logger log = LoggerFactory.getLogger(DataRefreshServiceImpl.class);
@Autowired
private RemoteWebSocketServer remoteWebSocketServer;
// @Autowired
// private RemoteWebSocketServer remoteWebSocketServer;
@Override
public void refreshViewData(String dataType) {
......@@ -51,7 +49,7 @@ public class DataRefreshServiceImpl implements IDataRefreshService {
private void notifyDataRefresh(Map<String, Object> param) {
try {
remoteWebSocketServer.sendMessage("3dViewMessage", JSON.toJSONString(param));
// remoteWebSocketServer.sendMessage("3dViewMessage", JSON.toJSONString(param));
} catch (Exception e) {
log.error("通知前端数据刷新失败-->"+JSON.toJSONString(param));
log.error("通知前端数据刷新失败-->"+e.getMessage());
......
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PollPointMapper;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.business.vo.PollPointVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.service.impl
* @ClassName: EquipmentSpecificIndexServiceImpl
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexServiceImpl
* @Date: 2021/1/18 16:35
* @Version: 1.0
*/
@Service
public class EquipmentSpecificIndexServiceImpl implements EquipmentSpecificIndexService {
@Autowired
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private PollPointMapper pollPointMapper;
@Override
public Map<String, Object> queryInitAlarm(String value, String nameKeys, String status) {
Map<String, Object> map = new HashMap<>(16);
// 查询设备告警
List<EquipmentSpecificIndexVo> equipmentSpecificAlarmVoList = equipmentSpecificIndexMapper.queryInitAlarm(value, nameKeys.split(","));
map.put("equip", equipmentSpecificAlarmVoList);
// 查询巡检告警
List<PollPointVo> pollPointVoList = pollPointMapper.queryInitAlarm(status.split(","));
map.put("poll", pollPointVoList);
return map;
}
@Override
public List<EquipmentSpecificIndexVo> getInitAlarm(String value, String nameKeys, String status) {
// 查询设备告警
List<EquipmentSpecificIndexVo> equipmentSpecificAlarmVoList = equipmentSpecificIndexMapper.getInitAlarm(value, nameKeys.split(","));
// 查询巡检告警
List<EquipmentSpecificIndexVo> pollPointVoList = pollPointMapper.getInitAlarm(status.split(","));
pollPointVoList.stream().sequential().collect(Collectors.toCollection(() -> equipmentSpecificAlarmVoList));
return equipmentSpecificAlarmVoList;
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......@@ -10,6 +11,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import com.yeejoin.amos.fas.business.bo.FireEquipmentBo;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
......@@ -22,6 +24,11 @@ import com.yeejoin.amos.fas.core.common.response.CommonPage;
@Service("fireEquipService")
public class FireEquipServiceImpl implements IFireEquipService {
/**
* 液位
*/
private final static String NAME_KEY = "liquidLevel";
@Autowired
FireEquipMapper fireEquipMapper;
......@@ -30,32 +37,35 @@ public class FireEquipServiceImpl implements IFireEquipService {
// @Autowired
// IWaterResourceDao iWaterResourceDao;
//
// @Autowired
// IFireStationDao iFireStationDao;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
// public FireEquipment save(FireEquipment fireEquipment) {
// Long id = fireEquipment.getId();
// iFireEquipmentDao.save(fireEquipment);
// return fireEquipment;
// Long id = fireEquipment.getId();
// iFireEquipmentDao.save(fireEquipment);
// return fireEquipment;
// }
//
//
// public FireEquipment queryOne(Long id) {
// Optional<FireEquipment> fireEquipment1=iFireEquipmentDao.findById(id);
// if(fireEquipment1.isPresent()){
// return fireEquipment1.get();
// }
// return null;
// Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(id);
// if (fireEquipment1.isPresent()) {
// return fireEquipment1.get();
// }
// return null;
// }
public String[] delete(String[] idArray) throws Exception {
// for (String id : idArray) {
// Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(Long.parseLong(id));
// FireEquipment fireEquipment=null;
// if(fireEquipment1.isPresent()){
// fireEquipment= fireEquipment1.get();
// }
// FireEquipment fireEquipment = null;
// if (fireEquipment1.isPresent()) {
// fireEquipment = fireEquipment1.get();
// }
//
// if (fireEquipment != null) {
// this.iFireEquipmentDao.deleteById(Long.parseLong(id));
......@@ -63,7 +73,6 @@ public class FireEquipServiceImpl implements IFireEquipService {
// throw new Exception("找不到指定的对象:" + id);
// }
// }
return idArray;
}
......@@ -93,48 +102,47 @@ public class FireEquipServiceImpl implements IFireEquipService {
//查询 消防设备历史数据
public Page queryForFireEquipmentHistory(String fireEquipmentName,
String equipmentName,
String startTime,
String endTime,
CommonPageable commonPageable) {
String equipmentName,
String startTime,
String endTime,
CommonPageable commonPageable) {
long total = fireEquipMapper.queryForFireEquipmentHistoryCount( fireEquipmentName,equipmentName,
long total = fireEquipMapper.queryForFireEquipmentHistoryCount(fireEquipmentName, equipmentName,
startTime,
endTime);
List<Map> content = fireEquipMapper.queryForFireEquipmentHistory(fireEquipmentName,
List<Map> content = fireEquipMapper.queryForFireEquipmentHistory(fireEquipmentName,
equipmentName,
startTime,
endTime,
commonPageable.getOffset(),
commonPageable.getPageSize());
Page result = new CommonPage(content, commonPageable, total);
Page result = new CommonPage(content, commonPageable, total);
return result;
}
public Page queryForEquipmentList(String name, String code,String equipClassify,CommonPageable commonPageable,String bindStation) {
long total = fireEquipMapper.queryForEquipmentPageCount( name, code,equipClassify,bindStation);
List<Map> content = this.fireEquipMapper.queryForEquipmentPage(name, code,equipClassify,commonPageable.getOffset(),commonPageable.getPageSize(),bindStation);
Page result = new CommonPage(content, commonPageable, total);
return result;
public Page queryForEquipmentList(String name, String code, String equipClassify, CommonPageable commonPageable, String bindStation) {
long total = fireEquipMapper.queryForEquipmentPageCount(name, code, equipClassify, bindStation);
List<Map> content = this.fireEquipMapper.queryForEquipmentPage(name, code, equipClassify, commonPageable.getOffset(), commonPageable.getPageSize(), bindStation);
Page result = new CommonPage(content, commonPageable, total);
return result;
}
/**
* 查询设备信息明细
*
* @param type
* @param id
* @return
* @throws Exception
*/
public Object queryForDetail(String type, Long id) throws Exception
{
public Object queryForDetail(String type, Long id) throws Exception {
Object returnEntity = null;
FireEquipmentType fireEquipmentType = FireEquipmentType.valueOf(type);
switch (fireEquipmentType)
{
// case pool:
......@@ -172,6 +180,7 @@ public class FireEquipServiceImpl implements IFireEquipService {
FireEquipmentBo fireDetection=fireEquipMapper.findFireEquipById(id);
fireDetection.setProtectObjNames(this.impEquipMapper.queryProtectObjNames(fireDetection.getId()));
returnEntity = fireDetection;
break;
default:
......@@ -187,9 +196,11 @@ public class FireEquipServiceImpl implements IFireEquipService {
// }
// @Override
// public Boolean isExistByCode(String code) {
// Optional<FireEquipment> optional = iFireEquipmentDao.findByCode(code);
// return optional.isPresent();
// }
// @Override
// public Boolean isExistByCode(String code) {
// Optional<FireEquipment> optional = iFireEquipmentDao.findByCode(code);
// return optional.isPresent();
// }
}
......@@ -6,7 +6,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.model.SetpEnum;
import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.dao.mapper.*;
......@@ -28,6 +28,7 @@ import com.yeejoin.amos.fas.business.vo.TopicEntityVo;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
......@@ -41,7 +42,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -112,6 +113,10 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Autowired
private IEvaluationModelDao iEvaluationModelDao;
@Autowired
private FmeaMapper fmeaMapper;
@Value("${station.name}")
private String stationName;
......@@ -120,6 +125,10 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
private String serviceName;
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
@Value("${autoSys.alarm.nameKeys}")
private String nameKeys;
@Override
public void handlerMqttMessage(String topic, String data) {
......@@ -127,8 +136,21 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
log.info("iotCode 性能指标属于: " + topicEntity.getType());
EquipmentSpecificIndexVo equipmentSpecificIndex = JSONObject.parseObject(topicEntity.getMessage(), EquipmentSpecificIndexVo.class);
long eqSpecId = equipmentSpecificIndex.getEquipmentSpecificId();
String nameKey = equipmentSpecificIndex.getNameKey();
EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId);
Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId);
// 三维屏指标状态推送
String specificIndexType = equipmentSpecificIndex.getType();
if (nameKey !=null && nameKeys.contains(nameKey)) {
if (equipmentSpecific != null) {
equipmentSpecificIndex.setId(equipmentSpecific.getId());
equipmentSpecificIndex.setName(equipmentSpecific.getName());
equipmentSpecificIndex.setCode(equipmentSpecific.getCode());
}
equipmentSpecificIndex.setType("equip");
String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus");
webMqttComponent.publish(title, JSON.toJSONString(equipmentSpecificIndex));
}
Equipment equipment = topicEntity.getEquipment()==null?impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId):topicEntity.getEquipment();
Toke toke = remoteSecurityService.getServerToken();
AlarmParam deviceData = new AlarmParam();
deviceData.setMonitor(equipment != null ? equipment.getName() : "");
......@@ -137,6 +159,12 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
//设备告警处理逻辑
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(equipmentSpecificIndex.getType())) {
log.info("(报警)Message type is: " + equipmentSpecificIndex.getType());
/**
* 推送告警数据
* 影响区域:消防安全=>火灾告警
*/
String title = String.format("/%s/%s/%s/%s", serviceName, stationName,"data/refresh","fireSafety");
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("fire", equipmentSpecific.getOrgCode())));
// 报警触发调用规则服务
//注释自动触发预案
//executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke,topicEntity.getRecordId());
......@@ -153,23 +181,81 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
//故障恢复
notifyAlarm(equipmentSpecificIndex, 0);
}
//三维页面消息推送
fireEquipRuleMessagePush(deviceData, toke);
long equipId = 0;
if(StringUtil.isNotEmpty(equipment)) {
equipId = equipment.getId();
// 是否关联风险点
List<FmeaEquipmentPoint> list = fmeaEquipmentPointMapper.listFmeaByEquipIndexIdAndEquipId(equipmentSpecificIndex.getId(), equipId);
if(list.size() > 0) {
// 关联风险点进行rpn,rpni值的修改
list.forEach(fmeaEqPoint -> {
long fmeaId = fmeaEqPoint.getFmeaId();
updateFmeaRpn(fmeaId);
});
} else {
// 没有关联风险点,三维页面消息推送
fireEquipRuleMessagePush(deviceData, toke);
}
}
} else {
// 监测数据逻辑
log.info("(监测)Message type is: " + equipmentSpecificIndex.getType());
Map<String, Object> content = new HashMap<>();
content.put("id", "id");
content.put("label", "eqPointName");
content.put("id", equipmentSpecific.getId());
content.put("label", equipmentSpecific.getName()+" "+equipmentSpecificIndex.getEquipmentIndexName());
content.put("code", equipmentSpecific.getCode());
content.put("changeDate", new Date());
content.put("orgCode", equipmentSpecific.getOrgCode());
content.put("indexKey", equipmentSpecificIndex.getNameKey());
content.put("status", equipmentSpecificIndex.getValue());
iDataRefreshService.sendRefreshDataWithArea(View3dRefreshAreaEum.monitor_data.getCode(), content);
String title = String.format("/%s/%s/%s", serviceName, stationName,"data/refresh/monitorData");
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode())));
}
}
/**
* <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() {
// 若登录系统则订阅装备数据
......@@ -291,7 +377,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
contingencyRo.setEquipmentName(equipment.getName());
contingencyRo.setFireEquipmentId(String.valueOf(equipmentSpecific.getId()));
contingencyRo.setFireEquipmentName(equipmentSpecific.getName());
contingencyRo.setStep(SetpEnum.STEP0.getValue());
contingencyRo.setStep("0");
contingencyRo.setConfirm("NONE");
contingencyRo.setFireTruckRoute(equipment.getFireTruckRoute());
contingencyRo.setRunstep(false);
......
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import java.util.List;
import java.util.Map;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.service.intfc
* @ClassName: EquipmentSpecificIndexService
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexService
* @Date: 2021/1/18 16:34
* @Version: 1.0
*/
public interface EquipmentSpecificIndexService {
Map<String, Object> queryInitAlarm(String value, String nameKeys, String status);
List<EquipmentSpecificIndexVo> getInitAlarm(String value, String nameKeys, String status);
}
\ No newline at end of file
......@@ -24,7 +24,9 @@ public class EquipmentSpecificIndexVo {
// 性能指标id
private Long equipmentIndexId;
private String name;
private String equipmentIndexName;
private String equipmentIndexUnitName;
......@@ -105,16 +107,45 @@ public class EquipmentSpecificIndexVo {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEquipmentIndexName() {
return equipmentIndexName;
}
public void setEquipmentIndexName(String equipmentIndexName) {
this.equipmentIndexName = equipmentIndexName;
}
public String getEquipmentIndexUnitName() {
return equipmentIndexUnitName;
}
public void setEquipmentIndexUnitName(String equipmentIndexUnitName) {
this.equipmentIndexUnitName = equipmentIndexUnitName;
}
public EquipmentSpecificIndexVo() {
}
public EquipmentSpecificIndexVo(Long equipmentSpecificId, String value, Long equipmentIndexId, String nameKey, String code, String iotCode, String type) {
public EquipmentSpecificIndexVo(long id, Long equipmentSpecificId, String value, Long equipmentIndexId, String name, String equipmentIndexName, String equipmentIndexUnitName, String nameKey, String code, String iotCode, String type) {
this.id = id;
this.equipmentSpecificId = equipmentSpecificId;
this.value = value;
this.equipmentIndexId = equipmentIndexId;
this.name = name;
this.equipmentIndexName = equipmentIndexName;
this.equipmentIndexUnitName = equipmentIndexUnitName;
this.nameKey = nameKey;
this.code = code;
this.iotCode = iotCode;
this.type = type;
}
}
package com.yeejoin.amos.fas.business.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.vo
* @ClassName: EquipmentSpecificAlarm
* @Author: Jianqiang Gao
* @Description: 巡检点Vo
* @Date: 2021/1/18 15:54
* @Version: 1.0
*/
@Data
@Api("巡检点Vo")
public class PollPointVo {
@ApiModelProperty("巡检点名称")
private String name;
@ApiModelProperty("巡检点编码")
private String code;
@ApiModelProperty("巡检点状态:0 未纳入巡检,1 合格;2 不合格;3 漏检")
private String status;
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.vo;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import io.swagger.annotations.ApiModel;
import lombok.Data;
......@@ -24,4 +26,6 @@ public class TopicEntityVo {
private String type;
private Long recordId;
private Equipment equipment;
}
......@@ -83,38 +83,39 @@ public class PermissionAspect {
try {
feignClientResult = Privilege.agencyUserClient.getme();
userModel = (AgencyUserModel) feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
String userId = null;
ReginParams regionParam = new ReginParams();
if(userModel != null){
userId = userModel.getUserId();
ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
if(reginParams == null && userModel.getCompanys().size() > 0){
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam.setCompany(companyBo);
regionParam.setDepartment(departmentBo);
}
Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
List<RoleModel> roleModels = null;
if(!ObjectUtils.isEmpty(orgRoles)) {
for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
roleModels = entry.getValue();
break;
String userId = null;
ReginParams regionParam = new ReginParams();
if(userModel != null){
userId = userModel.getUserId();
ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
if(reginParams == null && userModel.getCompanys().size() > 0){
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam.setCompany(companyBo);
regionParam.setDepartment(departmentBo);
}
Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
List<RoleModel> roleModels = null;
if(!ObjectUtils.isEmpty(orgRoles)) {
for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
roleModels = entry.getValue();
break;
}
}
if(!ObjectUtils.isEmpty(roleModels)){
regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
}
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
}
if(!ObjectUtils.isEmpty(roleModels)){
regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
}
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
}
} catch (InnerInvokException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
......
......@@ -3,14 +3,14 @@ security.password=a1234560
security.loginId=fas_autosys
#environment
#spring.profiles.active = dev
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://172.16.3.100:10001/eureka/
eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true
eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties:
spring.datasource.url=jdbc:mysql://172.16.10.66:3306/safety-business-2.1.4?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.10.66:3306/safety-business-3.0.0?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root_123
......@@ -19,13 +19,11 @@ spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
#ws
params.remoteWebsocketUrl=http://172.16.11.36:10600/
#redis
spring.redis.database=0
spring.redis.host=172.16.10.85
spring.redis.host=172.16.3.100
spring.redis.port=6379
spring.redis.password=amos2019Redis
spring.redis.password=1234560
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
......@@ -41,9 +39,9 @@ params.isPush=true
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
emqx.broker=tcp://172.16.3.100:1883
emqx.user-name=admin
emqx.password=admin
#�����
file.downLoad.url=http://39.98.246.31:8888/
#站端名称使用全拼
......
......@@ -19,9 +19,7 @@ spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
#rule
params.remoteWebsocketUrl=http://station-websocket:10600/
#redis
spring.redis.database=1
spring.redis.host=amos-redis
spring.redis.port=6379
......
......@@ -17,8 +17,7 @@ spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
#ws
params.remoteWebsocketUrl=http://172.16.10.91:10600/
#redis
spring.redis.database=1
spring.redis.host=127.0.0.1
......
spring.application.name = AMOS-AUTOSYS-1225
spring.application.name = AMOS-AUTOSYS
server.servlet.context-path=/fireAutoSys
server.port = 8083
spring.profiles.active=dev
......@@ -50,16 +50,13 @@ visual.fegin.name=maas-visual
#值班系统
dutyMode.fegin.name=AMOS-DUTYMODE
#队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统
equipManage.fegin.name=AMOS-EQUIPMANAGE-1225
equipManage.fegin.name=AMOS-EQUIPMANAGE
#feginName
number.plan.projectName=换流站消防专项预案
#jpush 服务名称
Push.fegin.name=AMOS-JPUSH
spring.http.multipart.maxFileSize = 10480000
spring.http.multipart.MaxRequestSize = 50480000
param.safetyIndexChange.cron = 0 0 2 * * ?
param.weather.url = http://wthrcdn.etouch.cn/weather_mini?citykey=
......@@ -76,6 +73,11 @@ amos.feign.gennerator.use-gateway=true
# 消息推送类型
autoSys.push.type=mqtt
# 3D告警初始化
autoSys.alarm.nameKeys=fireAlarm,fault,shield
autoSys.alarm.status=2,3
autoSys.alarm.value=true
#查询装备分类
#消防视频:xfsp
......
......@@ -52,7 +52,7 @@
left join f_fire_fighting_system as manage on spe.system_id = manage.id
where sto.amount <![CDATA[>]]> 0
<if test="name != null and name!='null' ">
and det.name like CONCAT('%',#{name},'%' )
and (det.name like CONCAT('%',#{name},'%') or ware.full_name like CONCAT('%',#{name},'%') or spe.iot_code like CONCAT('%',#{name},'%') or spe.code like CONCAT('%',#{name},'%'))
</if>
<if test="code != null and code!='null' ">
and cate.code like CONCAT('%',#{code},'%' )
......@@ -78,7 +78,7 @@
left join f_fire_fighting_system as manage on spe.system_id = manage.id
where sto.amount <![CDATA[>]]> 0
<if test="name != null and name!='null' ">
and det.name like CONCAT('%',#{name},'%' )
and (det.name like CONCAT('%',#{name},'%') or ware.full_name like CONCAT('%',#{name},'%') or spe.iot_code like CONCAT('%',#{name},'%') or spe.code like CONCAT('%',#{name},'%'))
</if>
<if test="code != null and code!='null' ">
and cate.code like CONCAT('%',#{code},'%' )
......
<?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.EquipmentSpecificIndexMapper">
<select id="findByDetailIdInAndNameKey"
resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">
SELECT
wsi.`value`,
wei.unit AS equipmentIndexUnitName
FROM
`wl_equipment_index` wei
RIGHT JOIN wl_equipment_specific_index wsi ON wei.id = wsi.equipment_index_id
LEFT JOIN wl_equipment_specific wes ON wsi.equipment_specific_id = wes.id
WHERE
wsi.`value` != ''
<if test="nameKey != null and nameKey !=''">
AND wei.name_key = #{nameKey}
</if>
<if test="list != null and list.size() > 0">
AND wes.equipment_detail_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY
wsi.id
ORDER BY
wsi.update_date DESC
</select>
<select id="queryInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">
SELECT
concat(wes.id) as id,
concat(wes.id) as equipmentSpecificId,
wed.`name`,
wes.`code`,
wei.name_key,
wei.`name` AS equipmentIndexName,
wsi.`value`
FROM
`wl_equipment_specific_index` wsi
LEFT JOIN wl_equipment_index wei ON wsi.equipment_index_id = wei.id
LEFT JOIN wl_equipment_specific wes ON wsi.equipment_specific_id = wes.id
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
<where>
<if test="value != null and value != ''">
AND wsi.`value` = #{value}
</if>
<if test="list != null and list.length > 0">
AND
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wei.name_key = #{item}
</foreach>
</if>
</where>
GROUP BY
wsi.equipment_specific_id
ORDER BY
wsi.update_date DESC
</select>
<select id="getInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">
SELECT
concat(wes.id) as id,
concat(wes.id) as equipmentSpecificId,
wed.`name`,
wes.`code`,
wei.name_key,
wei.`name` AS equipmentIndexName,
wsi.`value`,
'equip' AS type
FROM
`wl_equipment_specific_index` wsi
LEFT JOIN wl_equipment_index wei ON wsi.equipment_index_id = wei.id
LEFT JOIN wl_equipment_specific wes ON wsi.equipment_specific_id = wes.id
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
where
wei.is_iot = 1
<if test="value != null and value != ''">
AND wsi.`value` = #{value}
</if>
<if test="list != null and list.length > 0">
AND
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wei.name_key = #{item}
</foreach>
</if>
GROUP BY
wsi.equipment_specific_id
ORDER BY
wsi.update_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -113,10 +113,9 @@
</choose>
</select>
<select id="queryForFireEquipmentHistoryCount" resultType="long">
SELECT
count(1)
COUNT(1)
FROM
(
SELECT
......@@ -133,22 +132,22 @@
) equipmentName,
ind.update_date
FROM
wl_equipment_specific_index ind
wl_equipment_specific_index as ind
left join wl_equipment_specific as spe on spe.id = ind.equipment_specific_id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
WHERE 1=1 AND ind.value IS NOT NULL
WHERE ind.`value` IS NOT NULL AND ind.`value` != ''
) d
WHERE
1 = 1
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
</if>
<if test="startTime!=null">
AND d.update_date BETWEEN '${startTime}' AND '${endTime}'
</if>
<where>
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
</if>
<if test="startTime!=null">
AND d.update_date BETWEEN '${startTime}' AND '${endTime}'
</if>
</where>
</select>
......@@ -158,15 +157,14 @@
FROM
(
SELECT
det.`name` as fireEquipmentName,
spe.`code` as fireEquipmentCode,
det.`name` as fireEquipmentName,
spe.`code` as fireEquipmentCode,
ein.name as eq_point_name,
CASE ind.value WHEN 'true' THEN '是'
WHEN 'false' THEN '否'
ELSE ind.value END 'e_value',
ein.unit as eq_point_unit,
str.full_name as source_name,
-- sce.name as source_name,
(
SELECT
group_concat(DISTINCT f.`name`)
......@@ -179,25 +177,24 @@
ind.update_date as create_date
FROM
wl_equipment_specific_index as ind
left join wl_equipment_specific as spe on spe.id = ind.equipment_specific_id
left join wl_equipment_specific as spe on spe.id = ind.equipment_specific_id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment_index as ein on ind.equipment_index_id = ein.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_stock_detail as sto on sto.equipment_specific_id = spe.id
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
-- left join f_risk_source as sce on str.source_id = sce.source_id
WHERE ind.`value` IS NOT NULL AND ind.`value` != ''
) d
WHERE
1 = 1
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
</if>
<if test="startTime!=null">
AND d.create_date BETWEEN '${startTime}' AND '${endTime}'
</if>
AND e_value IS NOT NULL AND e_value != ''
<where>
<if test="fireEquipmentName!=null">
AND d.fireEquipmentName LIKE '%${fireEquipmentName}%'
</if>
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
</if>
<if test="startTime!=null">
AND d.create_date BETWEEN '${startTime}' AND '${endTime}'
</if>
</where>
ORDER BY d.create_date desc
LIMIT ${start},${length}
</select>
......@@ -288,24 +285,42 @@
<!-- )-->
<!-- </select>-->
<select id="queryStorageEquips" resultType="map">
SELECT
wed.`name`,
u.`name` AS unit,
sum(wsd.amount) fireEquipmentCount
FROM
wl_stock_detail wsd
LEFT JOIN wl_equipment_detail wed ON wed.id = wsd.equipment_detail_id
LEFT JOIN wl_equipment we ON we.id = wed.equipment_id
LEFT JOIN wl_unit u ON u.id = we.unit_id
LEFT JOIN wl_warehouse_structure ws ON ws.source_id = wsd.warehouse_structure_id
left join f_risk_source as sce on sce.source_id = ws.source_id
<!-- <select id="findEquipDetailsById" resultType="com.yeejoin.amos.fas.core.common.response.EquipDetailsResponse">-->
<!-- SELECT-->
<!-- eq.`name`,-->
<!-- eq.`code`,-->
<!-- eq.address,-->
<!-- fs.`name` stationName,-->
<!-- eq.charge_user_id userId-->
<!-- FROM-->
<!-- f_equipment eq-->
<!-- LEFT JOIN f_fire_station fs ON fs.id = eq.fire_station_id-->
<!-- <where>-->
<!-- <if test="id!=null">AND eq.id = #{id}</if>-->
<!-- </where>-->
<!-- </select>-->
<select id="queryStorageEquips" resultType="map">
SELECT
wed.id,
wed.`name`,
u.`name` AS unit,
sum(wsd.amount) fireEquipmentCount
FROM
wl_stock_detail wsd
LEFT JOIN wl_equipment_detail wed ON wed.id = wsd.equipment_detail_id
LEFT JOIN wl_equipment we ON we.id = wed.equipment_id
LEFT JOIN wl_unit u ON u.id = we.unit_id
LEFT JOIN wl_warehouse_structure ws ON ws.id = wsd.warehouse_structure_id
LEFT JOIN f_risk_source as sce on sce.source_id = ws.source_id
WHERE
sce.id = #{riskSourceId}
GROUP BY
wsd.equipment_detail_id,
wed.`name`
</select>
</select>
<!-- <select id="findEquipDetailsById" resultType="com.yeejoin.amos.fas.core.common.response.EquipDetailsResponse">-->
<!-- SELECT-->
......@@ -341,26 +356,26 @@
<!-- </select>-->
<select id="listByCodes" resultType="com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity">
select
id,
code,
name
from
f_fire_equipment
where
code in
select
id,
code,
name
from
f_fire_equipment
where
code in
<foreach collection="codes" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</select>
<select id="listByType" resultType="com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity">
select
id,
code,
name
id,
code,
name
from
f_fire_equipment
f_fire_equipment
<where>
<if test="type!=null">
equip_classify = #{type}
......@@ -373,26 +388,26 @@
useGeneratedKeys="true">
insert into f_fire_equipment
(
org_code,
code,
equip_classify,
equip_type,
position3d,
floor3d,
is_indoor,
name,
maintenance_cycle,
manufacturer,
number,
unit,
room,
equip_status,
weight,
risk_source_id
org_code,
code,
equip_classify,
equip_type,
position3d,
floor3d,
is_indoor,
name,
maintenance_cycle,
manufacturer,
number,
unit,
room,
equip_status,
weight,
risk_source_id
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
(
#{item.orgCode},
#{item.code},
#{item.equipClassify},
......@@ -409,7 +424,7 @@
#{item.equipStatus},
#{item.weight},
#{item.riskSourceId}
)
)
</foreach>
</insert>
......@@ -507,7 +522,7 @@
select name from f_fire_equipment where id= #{id}
</select>
<select id="removeIfmeaPointByFireEquipIdAndEquipId" resultType="long">
<select id="removeIfmeaPointByFireEquipIdAndEquipId" resultType="long">
DELETE fmep FROM `f_fmea_equipment_point` fmep
LEFT JOIN wl_equipment_specific_index esi ON esi.id = fmep.equipment_point_id
WHERE esi.equipment_specific_id = #{fireEquipmentId} AND fmep.important_equipment_id = #{importantEquipmentId}
......@@ -522,7 +537,7 @@
detail.NAME AS NAME,
detail.standard AS model,
detail.maintenance_cycle AS maintenance_cycle,
manufatcturer.NAME AS manufatcturer,
manufatcturer.NAME AS manufacturer,
detail.brand AS detail,
detail.production_date AS production_date,
sd.amount AS number,
......@@ -596,7 +611,7 @@
ffe.video_id = video.id
) protectObjNames
FROM wl_video video
LEFT JOIN wl_video_source source ON source.video_id =video.id
LEFT JOIN wl_video_source source ON source.video_id =video.id
LEFT JOIN f_risk_source risk ON risk.id = source.source_id
WHERE
<if test="id != null">
......@@ -639,4 +654,19 @@
<!-- f_risk_source r-->
<!-- where s.id = r.source_id and s.id = #{id}-->
<!-- </select>-->
<!-- <select id="findFireStationById" resultType="java.util.Map">
SELECT
wb.`name`,
wb.`code`,
wb.address,
wb.region_id AS riskSourceId,
wb.height,
wb.low,
wb.design_capacity
FROM
wl_building wb
WHERE
wb.id = #{id}
</select> -->
</mapper>
\ No newline at end of file
......@@ -62,7 +62,7 @@
</trim>
</select>
<select id="reservePage" resultMap="resultMap">
<select id="reservePage" resultType="com.yeejoin.amos.fas.dao.dto.EquipmentDTO">
SELECT
a.id,
a.`name`,
......
<?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.PollPointMapper">
<select id="queryInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.PollPointVo">
SELECT
p.`name`,
p.point_no AS `code`,
p.`status`
FROM
`p_point` p
<where>
<if test="list != null and list.length > 0">
AND
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
p.`status` = #{item}
</foreach>
</if>
</where>
</select>
<select id="getInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">
SELECT
concat(p.id) as id,
p.`name`,
p.point_no AS `code`,
'patrol' AS type,
'patrol' AS nameKey,
CASE
WHEN p.`status` = '2' THEN
'true'
WHEN p.`status` = '3' THEN
'true' ELSE 'false'
END AS `value`
FROM
`p_point` p
<where>
<if test="list != null and list.length > 0">
AND
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
p.`status` = #{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
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