Commit 5360ac70 authored by 吴俊凯's avatar 吴俊凯

1.4.0.2版本修改代码提交

parent 27aead40
...@@ -15,8 +15,9 @@ public enum AlarmPointEnum { ...@@ -15,8 +15,9 @@ public enum AlarmPointEnum {
未确认已清除("未确认已清除", "未确认已清除"), 未确认已清除("未确认已清除", "未确认已清除"),
已确认未清除("已确认未清除", "已确认未清除"), 已确认未清除("已确认未清除", "已确认未清除"),
已确认已清除("已确认已清除", "已确认已清除"), 已确认已清除("已确认已清除", "已确认已清除"),
正常("正常", "正常"),
异常("异常", "异常"), 异常("异常", "异常"),
正常("正常", "正常"); 告警("告警", "告警"),;
/** /**
* 名称,描述 * 名称,描述
......
...@@ -67,6 +67,16 @@ public class AlarmPoint { ...@@ -67,6 +67,16 @@ public class AlarmPoint {
@Column(name = "point_attrs") @Column(name = "point_attrs")
private String pointAttrs;//告警点信息 private String pointAttrs;//告警点信息
@Column(name = "cpbl_id")
private Long cpblId;//告警指标ID
public Long getTarget() {
return cpblId;
}
public void setTarget(Long target) {
this.cpblId = target;
}
public Date getUpdateDate() { public Date getUpdateDate() {
return updateDate; return updateDate;
......
...@@ -109,13 +109,13 @@ public class DeviceListener extends EmqxListener implements InitializingBean { ...@@ -109,13 +109,13 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
List<Long> riskFactorId = equipmentMapper.judgeEquipmentExists(equipmentsPointId); List<Long> riskFactorId = equipmentMapper.judgeEquipmentExists(equipmentsPointId);
Integer value = 0; Integer value = 0;
if (Double.valueOf(statusName) >= CRITICAL_TEMPERATURE) { // if (Double.valueOf(statusName) >= CRITICAL_TEMPERATURE) {
value = DevicePointEnum.getValue("异常"); // value = DevicePointEnum.getValue("异常");
equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId()); // equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId());
} else { // } else {
value = DevicePointEnum.getValue("正常"); // value = DevicePointEnum.getValue("正常");
equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId()); // equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId());
} // }
System.out.println("----shudu riskFactorId : "+ riskFactorId); System.out.println("----shudu riskFactorId : "+ riskFactorId);
...@@ -131,7 +131,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean { ...@@ -131,7 +131,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
} }
} }
if (remark.equals("temperatureAlarm") || remark.equals("humidityAlarm")) { if ("告警".equals(statusName)||"异常".equals(statusName)||"正常".equals(statusName)) {
System.out.println("----start chuli device temperatureAlarm : "+ remark); System.out.println("----start chuli device temperatureAlarm : "+ remark);
EquipmentQualityVo queryEquipmentPoint = equipmentMapper.queryEquipmentPoint(eqpId, remark); EquipmentQualityVo queryEquipmentPoint = equipmentMapper.queryEquipmentPoint(eqpId, remark);
System.out.println("----update device queryEquipmentPoint :"+ queryEquipmentPoint); System.out.println("----update device queryEquipmentPoint :"+ queryEquipmentPoint);
...@@ -156,6 +156,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean { ...@@ -156,6 +156,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
System.out.println("----update device state fail : "+ riskFactorId); System.out.println("----update device state fail : "+ riskFactorId);
} }
} }
} }
}); });
......
...@@ -14,6 +14,8 @@ public class AlarmConstant { ...@@ -14,6 +14,8 @@ public class AlarmConstant {
public static String ALARM_NORMAL_STATUS = "清除"; public static String ALARM_NORMAL_STATUS = "清除";
public static String ALARM_ABNORMAL_STATUS = "告警"; public static String ALARM_ABNORMAL_STATUS = "告警";
public static String ALARM_DEVICE = "警告告警"; public static String ALARM_DEVICE = "警告告警";
public static String ALARM_DEVICE_TYPE = "监测设备告警"; public static String ALARM_DEVICE_TYPE = "动环告警";
public static String ALARM_DEVICE_AlARAM = "监测异常"; public static String ALARM_DEVICE_AlARAM = "监测异常";
public static String ALARM_DEVICE_MAJOR = "重要告警";
} }
package com.yeejoin.amos.bank.controller; package com.yeejoin.amos.bank.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonArray;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint; import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.bank.dao.repository.ITopographyNodeDetailRepository;
import com.yeejoin.amos.bank.param.DepartmentBo; import com.yeejoin.amos.bank.param.DepartmentBo;
import com.yeejoin.amos.bank.service.IAlarmPointService; import com.yeejoin.amos.bank.service.IAlarmPointService;
import com.yeejoin.amos.bank.service.IAlarmService; import com.yeejoin.amos.bank.service.IAlarmService;
...@@ -19,12 +23,15 @@ import org.apache.log4j.Logger; ...@@ -19,12 +23,15 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -47,7 +54,8 @@ public class AlarmPointController extends BaseController { ...@@ -47,7 +54,8 @@ public class AlarmPointController extends BaseController {
private IAlarmService iAlarmService; private IAlarmService iAlarmService;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
@Autowired
private ITopographyNodeDetailRepository iTopographyNodeDetailDao;
/** /**
* 获取告警数据 * 获取告警数据
* *
...@@ -312,8 +320,103 @@ public class AlarmPointController extends BaseController { ...@@ -312,8 +320,103 @@ public class AlarmPointController extends BaseController {
return departmentBos; return departmentBos;
} }
/**
* 获取七天告警数据统计
*
* @return 告警数据
*/
@GetMapping(value = "/statistics", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "七天告警数据统计", notes = "七天告警数据统计")
public CommonResponse getStatisticsAlarms() throws ParseException {
Map<String,Object> result = alarmPointService.getSevenDayscount();
return CommonResponseUtil.success(result);
}
/**
* 首页动环信息展示
*
* @return 告警数据
*/
@GetMapping(value = "/mobile/show", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "首页动环信息展示", notes = "首页动环信息展示")
public CommonResponse getMobileShow() {
List<Map<String,Object>> detailList = iTopographyNodeDetailDao.HomePageDetail();
List<Map<String,String>> changeList = new ArrayList<>();
for (int i = 0; i <detailList.size() ; i++) {
Map<String,String > map = new HashMap<>();
if(StringUtils.isEmpty(detailList.get(i).get("nodeid"))){
break;
}
map.put("nodeid",detailList.get(i).get("nodeid").toString());
map.put("text",detailList.get(i).get("text").toString());
JSONArray array = JSONArray.parseArray(detailList.get(i).get("node_detail").toString());
if(StringUtils.isEmpty(array)){
break;
}
if("3-0025".equals(detailList.get(i).get("nodeid").toString())||"3-0026".equals(detailList.get(i).get("nodeid").toString())){
map.put("area","西安");
for (int j = 0; j <array.size() ; j++) {
JSONObject detail = JSONObject.parseObject(array.get(j).toString());
if(detail.get("name").toString().equals("烟感探测器报警")){
map.put("value",detail.get("value").toString());
}
if(detail.get("name").toString().equals("漏水监测报警")){
map.put("value",detail.get("value").toString());
}
}
}else if("3-0044".equals(detailList.get(i).get("nodeid").toString())||"3-0045".equals(detailList.get(i).get("nodeid").toString())){
map.put("area","咸阳");
for (int j = 0; j <array.size() ; j++) {
JSONObject detail = JSONObject.parseObject(array.get(j).toString());
if(detail.get("name").toString().equals("烟感探测器报警")){
map.put("value",detail.get("value").toString());
}
if(detail.get("name").toString().equals("漏水监测报警")){
map.put("value",detail.get("value").toString());
}
}
}else{
for (int j = 0; j <array.size() ; j++) {
JSONObject detail = JSONObject.parseObject(array.get(j).toString());
if(detail.get("name").toString().equals("温度")||detail.get("name").toString().equals("室内温度")){
map.put("value",detail.get("value").toString());
}
}
}
changeList.add(map);
}
Map<String,Object> result = new HashMap<>();
List<Map<String,String>> QSZXList = new ArrayList<>();
List<Map<String,String>> SBJXList = new ArrayList<>();
List<Map<String,String>> HBList = new ArrayList<>();
List<Map<String,String>> XFJCList = new ArrayList<>();
List<Map<String,String>> LSJCList = new ArrayList<>();
for (int i = 0; i <changeList.size() ; i++) {
if ("1#温湿度".equals(changeList.get(i).get("text")) || "2#温湿度".equals(changeList.get(i).get("text"))) {
QSZXList.add(changeList.get(i));
}
if ("3#温湿度".equals(changeList.get(i).get("text")) || "4#温湿度".equals(changeList.get(i).get("text"))) {
SBJXList.add(changeList.get(i));
}
if ("1温湿度".equals(changeList.get(i).get("text")) || "5温湿度".equals(changeList.get(i).get("text"))) {
HBList.add(changeList.get(i));
}
if ("3-0044".equals(changeList.get(i).get("nodeid")) || "3-0025".equals(changeList.get(i).get("nodeid"))) {
XFJCList.add(changeList.get(i));
}
if ("3-0026".equals(changeList.get(i).get("nodeid")) || "3-0045".equals(changeList.get(i).get("nodeid"))) {
LSJCList.add(changeList.get(i));
}
}
result.put("QSZX",QSZXList);
result.put("SBJ",SBJXList);
result.put("HB",HBList);
result.put("XFJC",XFJCList);
result.put("LSJC",LSJCList);
return CommonResponseUtil.success(result);
}
} }
package com.yeejoin.amos.bank.controller; package com.yeejoin.amos.bank.controller;
import java.util.Date; import java.util.Date;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint; import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.bank.service.IAlarmPointService; import com.yeejoin.amos.bank.service.IAlarmPointService;
...@@ -47,4 +45,10 @@ public class DynamicRingDataController extends BaseController{ ...@@ -47,4 +45,10 @@ public class DynamicRingDataController extends BaseController{
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
@PutMapping (value = "/update", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "动环修改坐标位置", notes = "动环修改坐标位置")
public CommonResponse updatePosition(@ApiParam(value = "动环修改坐标位置", required = true) @RequestBody Map<String,Object> param) {
String result = dynamicRingDataService.updatePosition(param);
return CommonResponseUtil.success(result);
}
} }
...@@ -19,4 +19,7 @@ public interface IAlarmPointRepository extends IBaseRepository<AlarmPoint, Strin ...@@ -19,4 +19,7 @@ public interface IAlarmPointRepository extends IBaseRepository<AlarmPoint, Strin
@Query(value="select * from p_alarm_point where point_type IN ('4','5') and point_id =?1 and content = ?2 ",nativeQuery=true ) @Query(value="select * from p_alarm_point where point_type IN ('4','5') and point_id =?1 and content = ?2 ",nativeQuery=true )
public List<AlarmPoint> selectPointTypeAndPointId(String pointId,String content); public List<AlarmPoint> selectPointTypeAndPointId(String pointId,String content);
@Query(value="select * from p_alarm_point where point_type =?1 and point_id =?2 and cpbl_id =?3 ",nativeQuery=true )
public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId,Long cpblId);
} }
...@@ -20,6 +20,10 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> { ...@@ -20,6 +20,10 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> {
@Query(value="select COUNT(*) value,sa.alarm_level name, sa.org_code orgCode from spc_alarm sa where sa.org_code like CONCAT('%', ?1, '%' ) and sa.current_state in ('未确认未清除','已确认未清除','异常','告警') GROUP BY sa.alarm_level",nativeQuery=true ) @Query(value="select COUNT(*) value,sa.alarm_level name, sa.org_code orgCode from spc_alarm sa where sa.org_code like CONCAT('%', ?1, '%' ) and sa.current_state in ('未确认未清除','已确认未清除','异常','告警') GROUP BY sa.alarm_level",nativeQuery=true )
public List<Map<String, Object>> countnum(String code); public List<Map<String, Object>> countnum(String code);
@Query(value="select * from spc_alarm where source_id =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true )
public List<Alarm> selectByQuerySourceId(String sourceId);
} }
package com.yeejoin.amos.bank.dao.repository; package com.yeejoin.amos.bank.dao.repository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.yeejoin.amos.bank.TopographyNodeDetail; import com.yeejoin.amos.bank.TopographyNodeDetail;
import com.yeejoin.amos.op.core.jpa.IBaseRepository; import com.yeejoin.amos.op.core.jpa.IBaseRepository;
import java.util.List;
import java.util.Map;
@Repository("iTopographyNodeDetailDao") @Repository("iTopographyNodeDetailDao")
public interface ITopographyNodeDetailRepository extends IBaseRepository<TopographyNodeDetail, String> { public interface ITopographyNodeDetailRepository extends IBaseRepository<TopographyNodeDetail, String> {
TopographyNodeDetail findByNodeid(String nodeid); TopographyNodeDetail findByNodeid(String nodeid);
@Query(value="SELECT\n" +
"\tb.nodeid,b.node_detail,a.state,a.text,a.treeid \n" +
"FROM\n" +
"( SELECT id ,state ,text,treeid FROM b_topography_node WHERE text IN ( '1#温湿度', '2#温湿度', '3#温湿度', '4#温湿度', '1温湿度', '5温湿度', '消防监测', '漏水监测' ) ) AS a\n" +
"\tLEFT JOIN b_topography_node_detail b ON a.id = b.nodeid",nativeQuery=true )
List<Map<String,Object>> HomePageDetail();
} }
package com.yeejoin.amos.bank.dao.repository; package com.yeejoin.amos.bank.dao.repository;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -25,4 +26,7 @@ public interface ITopographyNodeRepository extends IBaseRepository<TopographyNod ...@@ -25,4 +26,7 @@ public interface ITopographyNodeRepository extends IBaseRepository<TopographyNod
TopographyNode findBySourceIdAndTreeidAndGroup(String toSourceId, String treeIdStr, String groupKey); TopographyNode findBySourceIdAndTreeidAndGroup(String toSourceId, String treeIdStr, String groupKey);
TopographyNode findBySourceIdAndType(String sourceId, int type); TopographyNode findBySourceIdAndType(String sourceId, int type);
@Query(value = "SELECT node.id,detail.node_detail FROM b_topography_node node LEFT JOIN b_topography_node_detail detail ON node.id = detail.nodeid WHERE node.source_id =?1", nativeQuery=true )
Map<String,Object> findNodeDetailBySourceId(String sourceId);
} }
...@@ -79,4 +79,14 @@ public class RemoteDeviceService { ...@@ -79,4 +79,14 @@ public class RemoteDeviceService {
} }
return null; return null;
} }
public String updatePosition(String jsonDate) {
try {
Object result = deviceRemoteClient.updatePosition(jsonDate);
return JSON.toJSONString(result);
} catch (InnerInvokException e) {
log.error("updatePosition fail " + e.getMessage());
}
return null;
}
} }
...@@ -50,5 +50,9 @@ public interface DeviceRemoteClient { ...@@ -50,5 +50,9 @@ public interface DeviceRemoteClient {
*/ */
@RequestMapping(value = "/device/cpbl/attr", method = RequestMethod.GET) @RequestMapping(value = "/device/cpbl/attr", method = RequestMethod.GET)
CommonResponse listDeviceAndDeviceCpblAttr(@RequestParam(value = "equipmentId",required = false) Long equipmentId) throws InnerInvokException; CommonResponse listDeviceAndDeviceCpblAttr(@RequestParam(value = "equipmentId",required = false) Long equipmentId) throws InnerInvokException;
/**
* 修改动环设备坐标点(暂时不启用)
*/
@RequestMapping(value = "/xml/updatePosition", method = RequestMethod.POST)
Object updatePosition(@RequestParam(value = "xmlData", required = false) String xmlData) throws InnerInvokException;
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.bank.remote.client; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.bank.remote.client;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
...@@ -12,12 +13,12 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -12,12 +13,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
* @Description: * @Description:
* @Date: 2020-02-18 14:52 * @Date: 2020-02-18 14:52
*/ */
@FeignClient(name = "YEEAMOSPATROL-237") @FeignClient(name = "${gateway.fegin.name}")
public interface PatrolRemoteClient { public interface PatrolRemoteClient {
/** /**
* 发送告警信息 * 发送告警信息
*/ */
@RequestMapping(value = "api/msgSubscribe/alarmNotification", method = RequestMethod.POST, consumes="application/json" ) @RequestMapping(value = "api/msgSubscribe/alarmNotification", method = RequestMethod.POST, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse sendAlarmNotification(@RequestBody String input) throws InnerInvokException; CommonResponse sendAlarmNotification(@RequestBody String input) throws InnerInvokException;
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.bank.remote.client; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.bank.remote.client;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -12,13 +13,13 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -12,13 +13,13 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author DELL * @author DELL
* *
*/ */
@FeignClient(name = "${Risk.fegin.name}") @FeignClient(name = "${gateway.fegin.name}")
public interface RiskModelRemoteClient { public interface RiskModelRemoteClient {
/** /**
* 修改rpn值 * 修改rpn值
*/ */
@RequestMapping(value = "api/risksource/update/fireqeuiment/sod", method = RequestMethod.GET, consumes = "application/json") @RequestMapping(value = "api/risksource/update/fireqeuiment/sod", method = RequestMethod.GET, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse updateEquipmentAlarmData(@RequestParam(value = "riskFactorID") Long riskFactorID, CommonResponse updateEquipmentAlarmData(@RequestParam(value = "riskFactorID") Long riskFactorID,
@RequestParam("equipmentName") String equipmentName,@RequestParam("state") Integer state) @RequestParam("equipmentName") String equipmentName,@RequestParam("state") Integer state)
throws InnerInvokException; throws InnerInvokException;
...@@ -26,13 +27,13 @@ public interface RiskModelRemoteClient { ...@@ -26,13 +27,13 @@ public interface RiskModelRemoteClient {
/** /**
* 根据风险因素id查询巡检点和指标项目列表 * 根据风险因素id查询巡检点和指标项目列表
*/ */
@RequestMapping(value = "/api/risksource/getEquiments/points", method = RequestMethod.GET, consumes="application/json" ) @RequestMapping(value = "/api/risksource/getEquiments/points", method = RequestMethod.GET, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse listPointInputitemByFactorId(@RequestParam(value = "factorId") Long factorId) throws InnerInvokException; CommonResponse listPointInputitemByFactorId(@RequestParam(value = "factorId") Long factorId) throws InnerInvokException;
/** /**
* 根据风险因素id查询设备和指标项列表 * 根据风险因素id查询设备和指标项列表
*/ */
@RequestMapping(value = "/api/risksource/getFactorBindPoints", method = RequestMethod.GET, consumes="application/json" ) @RequestMapping(value = "/api/risksource/getFactorBindPoints", method = RequestMethod.GET, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse queryBoundByFactroId(@RequestParam(value = "factorId") Long factorId) throws InnerInvokException; CommonResponse queryBoundByFactroId(@RequestParam(value = "factorId") Long factorId) throws InnerInvokException;
} }
package com.yeejoin.amos.bank.service; package com.yeejoin.amos.bank.service;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint; import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.op.core.jpa.IGenericManager; import com.yeejoin.amos.op.core.jpa.IGenericManager;
...@@ -18,4 +20,9 @@ public interface IAlarmPointService extends IGenericManager<AlarmPoint, String> ...@@ -18,4 +20,9 @@ public interface IAlarmPointService extends IGenericManager<AlarmPoint, String>
public void alarmTigger(String xmlData,String token); public void alarmTigger(String xmlData,String token);
public List<AlarmPoint> queryAutoInspection(String pointId, String content); public List<AlarmPoint> queryAutoInspection(String pointId, String content);
public Map<String,Object> getSevenDayscount() throws ParseException;
public List<AlarmPoint> selectPointTypeAndPointId(String type,Long pointId,Long cpblId);
} }
...@@ -26,4 +26,6 @@ List<HashMap<String, Object>> getcountnum(String code); ...@@ -26,4 +26,6 @@ List<HashMap<String, Object>> getcountnum(String code);
List<HashMap<String, Object>> getcountyc( String code); List<HashMap<String, Object>> getcountyc( String code);
List<HashMap<String, Object>> getxuncount( String code); List<HashMap<String, Object>> getxuncount( String code);
public List<Alarm> selectByQuerySourceId(String sourceId);
} }
package com.yeejoin.amos.bank.service; package com.yeejoin.amos.bank.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.spc.core.common.response.Node3DVoResponse; import com.yeejoin.amos.spc.core.common.response.Node3DVoResponse;
...@@ -15,4 +16,5 @@ public interface IDynamicRingDataService { ...@@ -15,4 +16,5 @@ public interface IDynamicRingDataService {
ArrayList<Node3DVoResponse> query3dData(String token,String orgCode); ArrayList<Node3DVoResponse> query3dData(String token,String orgCode);
String updatePosition (Map<String,Object> param);
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
package com.yeejoin.amos.bank.service.impl; package com.yeejoin.amos.bank.service.impl;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.bank.common.enums.AbnormalStateEnum;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint; import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.bank.dao.repository.IAlarmPointRepository; import com.yeejoin.amos.bank.dao.repository.IAlarmPointRepository;
import com.yeejoin.amos.bank.remote.RemoteAlarmTiggerService; import com.yeejoin.amos.bank.remote.RemoteAlarmTiggerService;
...@@ -11,9 +12,9 @@ import com.yeejoin.amos.spc.business.dao.mapper.InputItemMapper; ...@@ -11,9 +12,9 @@ import com.yeejoin.amos.spc.business.dao.mapper.InputItemMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.text.ParseException;
import java.util.List; import java.text.SimpleDateFormat;
import java.util.Map; import java.util.*;
@Service @Service
public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> implements IAlarmPointService { public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> implements IAlarmPointService {
...@@ -64,6 +65,12 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im ...@@ -64,6 +65,12 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im
} }
@Override
public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId,Long cpblId) {
return iAlarmPointDao.selectPointTypeAndPointId( type,pointId,cpblId);
}
@Override @Override
public void alarmTigger(String xmlData,String token) { public void alarmTigger(String xmlData,String token) {
...@@ -78,4 +85,33 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im ...@@ -78,4 +85,33 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im
public List<AlarmPoint> queryAutoInspection(String pointId,String content) { public List<AlarmPoint> queryAutoInspection(String pointId,String content) {
return iAlarmPointDao.selectPointTypeAndPointId(pointId,content); return iAlarmPointDao.selectPointTypeAndPointId(pointId,content);
} }
@Override
public Map<String,Object> getSevenDayscount() throws ParseException {
Map<String,Object> result = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, -6);
//紧急告警
List<Long> urgent = inputMapper.getSevenDayscount(AbnormalStateEnum.E.getName());
result.put("urgent",urgent);
//重要告警
List<Long> important = inputMapper.getSevenDayscount(AbnormalStateEnum.M.getName());
result.put("important",important);
//次要告警
List<Long> secondary = inputMapper.getSevenDayscount(AbnormalStateEnum.S.getName());
result.put("secondary",secondary);
//警告告警
List<Long> warning = inputMapper.getSevenDayscount(AbnormalStateEnum.W.getName());
result.put("warning",warning);
List<String> xAxis = new ArrayList<>();
for (int i = 0; i < 7; i++) {
xAxis.add(sdf.format(c.getTime()).substring(5,sdf.format(c.getTime()).length()));
c.add(Calendar.DATE, 1);
}
//时间轴
result.put("xAxis",xAxis);
return result;
}
} }
...@@ -74,6 +74,22 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService { ...@@ -74,6 +74,22 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService {
return list; return list;
} }
@Override
public String updatePosition(Map<String, Object> param) {
String params1 = "{\"eqpTempAttr\":{\"name\":\"affiliatedSystem\",\"value\":\"动环系统\"},\"pageNumber\":0,\"pageSize\":1000000000,\"needAttr\":[\"position\",\"storey\",\"storey\"]}";
String resStr = deviceService.selectEquipments(params1);
//String resStr = deviceService.dynamicRingData(DeviceUriEnum.查询三维设备点, token, params1);
JSONObject updateObject =new JSONObject();
JSONArray resJson = JSONArray.parseArray(JSONObject.parseObject(resStr).get("content").toString());
for (int i = 0; i <resJson.size() ; i++) {
if(resJson.getJSONObject(i).get("id").equals(param.get("id"))){
resJson.getJSONObject(i).getJSONObject("equipmentAttrs").put("position",param.get("position3d"));
updateObject = resJson.getJSONObject(i);
}
}
return deviceService.updatePosition(updateObject.toJSONString());
}
private void convertNode3DVoResponse(ArrayList<Node3DVoResponse> list, JSONObject json, String type,String orgCode) { private void convertNode3DVoResponse(ArrayList<Node3DVoResponse> list, JSONObject json, String type,String orgCode) {
List<JSONObject> dataArray = (List<JSONObject>) json.get("content"); List<JSONObject> dataArray = (List<JSONObject>) json.get("content");
dataArray.forEach(e -> { dataArray.forEach(e -> {
...@@ -134,4 +150,6 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService { ...@@ -134,4 +150,6 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService {
} }
public static void main(String[] args) {
}
} }
...@@ -326,8 +326,9 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -326,8 +326,9 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
public Object getNodeDetail(String id) { public Object getNodeDetail(String id) {
TopographyNode node = iTopographyNodeDao.findById(id).get(); TopographyNode node = iTopographyNodeDao.findById(id).get();
TopographyNodeDetail detail = iTopographyNodeDetailDao.findByNodeid(id); TopographyNodeDetail detail = iTopographyNodeDetailDao.findByNodeid(id);
List<Map> list = new ArrayList<>();
if (detail != null) { if (detail != null) {
List<Map> list = JSON.parseArray(detail.getNodeDetail(), Map.class); list = JSON.parseArray(detail.getNodeDetail(), Map.class);
for (Map map : list) { for (Map map : list) {
if (map.get("name").equals("监测状态") || map.get("name").equals("健康状态")) { if (map.get("name").equals("监测状态") || map.get("name").equals("健康状态")) {
if (node.getState() == 0) { if (node.getState() == 0) {
...@@ -342,10 +343,12 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -342,10 +343,12 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
return list; return list;
} else { } else {
return null; return list;
} }
} }
@Override @Override
public List<Map> getDeviceNodes(String orgcode) { public List<Map> getDeviceNodes(String orgcode) {
List<TopographyNode> nodes = iTopographyNodeDao.findByOrgCodeAndType(orgcode, 4); List<TopographyNode> nodes = iTopographyNodeDao.findByOrgCodeAndType(orgcode, 4);
......
...@@ -74,4 +74,9 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl ...@@ -74,4 +74,9 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
// TODO Auto-generated method stub // TODO Auto-generated method stub
return inputMapper.getxuncount(code); return inputMapper.getxuncount(code);
} }
@Override
public List<Alarm> selectByQuerySourceId(String sourceId) {
return iAlarmDao.selectByQuerySourceId(sourceId);
}
} }
...@@ -73,4 +73,14 @@ public interface EquipmentMapper extends BaseMapper { ...@@ -73,4 +73,14 @@ public interface EquipmentMapper extends BaseMapper {
void updateNodeDetail(@Param("nodeid")String nodeid,@Param("nodeDetail")String nodeDetail); void updateNodeDetail(@Param("nodeid")String nodeid,@Param("nodeDetail")String nodeDetail);
void deleteOneHourNormal(); void deleteOneHourNormal();
/**
* 装备同步的时候先删除f_fire_equipment表的所有信息
* @return
*/
void deleteAllEquipmentInfo();
/**
* 装备同步的时候先删除f_fire_equipment_point表装备参数信息
* @return
*/
void deleteAllEquipmentPoint();
} }
...@@ -21,4 +21,9 @@ public interface InputItemMapper extends BaseMapper { ...@@ -21,4 +21,9 @@ public interface InputItemMapper extends BaseMapper {
List<HashMap<String, Object>> getcountyc(@Param("code") String code); List<HashMap<String, Object>> getcountyc(@Param("code") String code);
List<HashMap<String, Object>> getcountnum(@Param("code")String code); List<HashMap<String, Object>> getcountnum(@Param("code")String code);
List<HashMap<String, Object>> getxuncount(@Param("code") String code); List<HashMap<String, Object>> getxuncount(@Param("code") String code);
/**
* 统计七天之前每天的告警数量
* @return
*/
List<Long> getSevenDayscount (@Param("alarmLevel") String alarmLevel);
} }
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
<artifactId>AmosBankService</artifactId> <artifactId>AmosBankService</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.yeejoin.amos</groupId>
<artifactId>AmosBankService</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<!-- maven打包时将lib提取到jar同目录,将配置文件提取到jar目录/config/下 --> <!-- maven打包时将lib提取到jar同目录,将配置文件提取到jar目录/config/下 -->
......
...@@ -93,5 +93,7 @@ param.remoteurl=http://localhost:8080 ...@@ -93,5 +93,7 @@ param.remoteurl=http://localhost:8080
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.20:1883 emqx.broker=tcp://172.16.10.85:1883
emqx.password=0 emqx.password=0
gateway.fegin.name=AMOS-BANK-SERVER-GATEWAY-WJK
\ No newline at end of file
...@@ -93,7 +93,7 @@ spring.rabbitmq.connection-timeout=1000 ...@@ -93,7 +93,7 @@ spring.rabbitmq.connection-timeout=1000
spring.redis.jedis.pool.min-idle=0 spring.redis.jedis.pool.min-idle=0
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
gateway.fegin.name=AMOS-BANK-SERVER-GATEWAY
param.remoteurl=http://localhost:8080 param.remoteurl=http://localhost:8080
#tcp.host=172.16.3.42 #tcp.host=172.16.3.42
#tcp.port=8888 #tcp.port=8888
......
...@@ -93,7 +93,7 @@ spring.rabbitmq.connection-timeout=1000 ...@@ -93,7 +93,7 @@ spring.rabbitmq.connection-timeout=1000
spring.redis.jedis.pool.min-idle=0 spring.redis.jedis.pool.min-idle=0
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
gateway.fegin.name=AMOS-BANK-SERVER-GATEWAY
param.remoteurl=http://localhost:8080 param.remoteurl=http://localhost:8080
#tcp.host=172.16.3.42 #tcp.host=172.16.3.42
#tcp.port=8888 #tcp.port=8888
\ No newline at end of file
...@@ -350,4 +350,11 @@ ...@@ -350,4 +350,11 @@
) )
</delete> </delete>
<delete id="deleteAllEquipmentInfo">
DELETE FROM f_fire_equipment
</delete>
<delete id="deleteAllEquipmentPoint">
DELETE FROM f_fire_equipment_point
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -164,9 +164,34 @@ from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num, r_risk_le ...@@ -164,9 +164,34 @@ from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num, r_risk_le
<select id="getxuncount" parameterType="java.lang.String" resultType="java.util.HashMap"> <select id="getxuncount" resultType="java.util.HashMap">
select status ,count(id) num from p_point where p_point.is_delete=0 and p_point.org_code LIKE concat( #{code}, "%") GROUP BY status select status ,count(id) num from p_point where p_point.is_delete=0 and p_point.org_code LIKE concat( #{code}, "%") GROUP BY status
</select> </select>
<select id="getSevenDayscount" parameterType="java.lang.String" resultType="java.lang.Long">
SELECT
ifnull( b.count, 0 ) AS count
FROM
(
SELECT
date_sub( curdate( ), INTERVAL 1 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 2 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 3 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 4 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 5 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 6 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 7 DAY ) AS click_date
) a
LEFT JOIN (
SELECT date( happen_date ) AS happen_date, count( * ) AS count FROM spc_alarm
WHERE alarm_level = #{alarmLevel} GROUP BY date( happen_date )
) b ON a.click_date = b.happen_date
ORDER BY a.click_date ASC
</select>
</mapper> </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