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

1.4.0.2版本修改代码提交

parent 27aead40
...@@ -15,9 +15,10 @@ public enum AlarmPointEnum { ...@@ -15,9 +15,10 @@ public enum AlarmPointEnum {
未确认已清除("未确认已清除", "未确认已清除"), 未确认已清除("未确认已清除", "未确认已清除"),
已确认未清除("已确认未清除", "已确认未清除"), 已确认未清除("已确认未清除", "已确认未清除"),
已确认已清除("已确认已清除", "已确认已清除"), 已确认已清除("已确认已清除", "已确认已清除"),
异常("异常", "异常"), 正常("正常", "正常"),
正常("正常", "正常"); 异常("异常", "异常"),
告警("告警", "告警"),;
/** /**
* 名称,描述 * 名称,描述
*/ */
......
...@@ -26,7 +26,7 @@ public enum DeviceUriEnum { ...@@ -26,7 +26,7 @@ public enum DeviceUriEnum {
this.desc = desc; this.desc = desc;
} }
public String getUri() { public String getUri() {
return uri; return uri;
} }
......
...@@ -16,12 +16,12 @@ import com.yeejoin.amos.spc.dao.entity.BasicEntity; ...@@ -16,12 +16,12 @@ import com.yeejoin.amos.spc.dao.entity.BasicEntity;
@Entity @Entity
@Table(name="p_alarm_point") @Table(name="p_alarm_point")
public class AlarmPoint { public class AlarmPoint {
/** /**
* *
*/ */
private static final long serialVersionUID = 5191299540189393188L; private static final long serialVersionUID = 5191299540189393188L;
@Id @Id
@GeneratedValue(strategy=GenerationType.IDENTITY) @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id",nullable=false,unique=true) @Column(name = "id",nullable=false,unique=true)
...@@ -29,30 +29,30 @@ public class AlarmPoint { ...@@ -29,30 +29,30 @@ public class AlarmPoint {
@Column(name = "point_id") @Column(name = "point_id")
private Long pointId; private Long pointId;
@Column(name = "update_date") @Column(name = "update_date")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateDate; private Date updateDate;
@Column(name = "is_alarm") @Column(name = "is_alarm")
private Integer isAlarm = 1;//0 正常|1 告警 private Integer isAlarm = 1;//0 正常|1 告警
@Column(name = "point_type") @Column(name = "point_type")
private String pointType; private String pointType;
@Column(name = "content") @Column(name = "content")
private String content;//告警内容 private String content;//告警内容
@Column(name = "code") @Column(name = "code")
private String code;//code private String code;//code
@Column(name = "point_name") @Column(name = "point_name")
private String pointName; private String pointName;
@Column(name = "source_id") @Column(name = "source_id")
private String sourceId; private String sourceId;
@Column(name = "auth_org") @Column(name = "auth_org")
private String authOrg; private String authOrg;
...@@ -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;
......
...@@ -30,7 +30,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean { ...@@ -30,7 +30,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
private static final Logger logger = Logger.getLogger(DeviceListener.class); private static final Logger logger = Logger.getLogger(DeviceListener.class);
private static ObjectMapper mapper = new ObjectMapper(); private static ObjectMapper mapper = new ObjectMapper();
//临界温度 //临界温度
private static final double CRITICAL_TEMPERATURE = 35; private static final double CRITICAL_TEMPERATURE = 35;
...@@ -108,19 +108,19 @@ public class DeviceListener extends EmqxListener implements InitializingBean { ...@@ -108,19 +108,19 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
System.out.println("----shudu equipmentsPointId : "+ equipmentsPointId); System.out.println("----shudu equipmentsPointId : "+ equipmentsPointId);
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);
for (int j = 0; j < riskFactorId.size(); j++) { for (int j = 0; j < riskFactorId.size(); j++) {
try { try {
riskModelRemoteClient.updateEquipmentAlarmData(riskFactorId.get(j),eqpName,value); riskModelRemoteClient.updateEquipmentAlarmData(riskFactorId.get(j),eqpName,value);
...@@ -130,8 +130,8 @@ public class DeviceListener extends EmqxListener implements InitializingBean { ...@@ -130,8 +130,8 @@ 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);
} }
} }
} }
}); });
......
...@@ -129,7 +129,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea ...@@ -129,7 +129,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
} }
//告警信息 //告警信息
String metricKey = ""; String metricKey = "";
//默认状态为正常 //默认状态为正常
int statusByName = 0; int statusByName = 0;
// jsonArray.forEach(e -> { // jsonArray.forEach(e -> {
for (Object e : jsonArray) { for (Object e : jsonArray) {
...@@ -204,7 +204,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea ...@@ -204,7 +204,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
// }); // });
//增加报警 //增加报警
List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.设备.getCode(), eqpId); List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.设备.getCode(), eqpId);
if (alarmPoint != null && alarmPoint.size() > 0) { if (alarmPoint != null && alarmPoint.size() > 0) {
//存在报警,判断当前状态是不是合格,合格则删除上次的报警 //存在报警,判断当前状态是不是合格,合格则删除上次的报警
...@@ -241,10 +241,10 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea ...@@ -241,10 +241,10 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
} }
} }
//增建告警记录表 //增建告警记录表
//告警记录 //告警记录
List<Alarm> curAlarmList = alarmService.findByQueryColumn(eqpId + metricKey); List<Alarm> curAlarmList = alarmService.findByQueryColumn(eqpId + metricKey);
if (curAlarmList != null && curAlarmList.size() > 0) { if (curAlarmList != null && curAlarmList.size() > 0) {
Alarm alarm = curAlarmList.get(0); Alarm alarm = curAlarmList.get(0);
alarm.setUpdateDate(DateTimeKit.now()); alarm.setUpdateDate(DateTimeKit.now());
if (!ObjectUtils.isEmpty(alarm.getHappenDate())) { if (!ObjectUtils.isEmpty(alarm.getHappenDate())) {
......
...@@ -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 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;
...@@ -23,17 +21,17 @@ import io.swagger.annotations.ApiParam; ...@@ -23,17 +21,17 @@ import io.swagger.annotations.ApiParam;
@RequestMapping(value = "/bank/dynamicRingData") @RequestMapping(value = "/bank/dynamicRingData")
@Api(value = "/bank/dynamicRingData", tags = {"动环数据API"}) @Api(value = "/bank/dynamicRingData", tags = {"动环数据API"})
public class DynamicRingDataController extends BaseController{ public class DynamicRingDataController extends BaseController{
@Autowired @Autowired
private IDynamicRingDataService dynamicRingDataService; private IDynamicRingDataService dynamicRingDataService;
@GetMapping(value = "/{id}", produces = "application/json;charset=UTF-8") @GetMapping(value = "/{id}", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "动环数据", notes = "动环数据") @ApiOperation(value = "动环数据", notes = "动环数据")
public CommonResponse detail(@ApiParam(value = "动环数据id", required = false) @PathVariable(value = "id")Long id) { public CommonResponse detail(@ApiParam(value = "动环数据id", required = false) @PathVariable(value = "id")Long id) {
String token = getToken(); String token = getToken();
return CommonResponseUtil.success(dynamicRingDataService.queryDynamicRingDataById(id,token)); return CommonResponseUtil.success(dynamicRingDataService.queryDynamicRingDataById(id,token));
} }
@Autowired @Autowired
private IAlarmPointService alar; private IAlarmPointService alar;
@GetMapping(value = "/test", produces = "application/json;charset=UTF-8") @GetMapping(value = "/test", produces = "application/json;charset=UTF-8")
...@@ -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);
} }
...@@ -17,9 +17,13 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> { ...@@ -17,9 +17,13 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> {
@Query(value="select * from spc_alarm where query_column =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true ) @Query(value="select * from spc_alarm where query_column =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true )
public List<Alarm> selectByQueryColumn(String type); public List<Alarm> selectByQueryColumn(String type);
@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;
...@@ -10,12 +11,12 @@ import com.yeejoin.amos.op.core.jpa.IBaseRepository; ...@@ -10,12 +11,12 @@ import com.yeejoin.amos.op.core.jpa.IBaseRepository;
@Repository("iTopographyNodeDao") @Repository("iTopographyNodeDao")
public interface ITopographyNodeRepository extends IBaseRepository<TopographyNode, String> { public interface ITopographyNodeRepository extends IBaseRepository<TopographyNode, String> {
@Query(value="select * from b_topography_node where org_code like concat(?1,'%') and treeid =?2 and type =?3",nativeQuery=true ) @Query(value="select * from b_topography_node where org_code like concat(?1,'%') and treeid =?2 and type =?3",nativeQuery=true )
List<TopographyNode> findByOrgCodeAndTreeidAndType(String orgcode,String treeid, int type); List<TopographyNode> findByOrgCodeAndTreeidAndType(String orgcode,String treeid, int type);
@Query(value="select * from b_topography_node where org_code like concat(?1,'%') and type =?2",nativeQuery=true ) @Query(value="select * from b_topography_node where org_code like concat(?1,'%') and type =?2",nativeQuery=true )
List<TopographyNode> findByOrgCodeAndType(String orgcode,int type); List<TopographyNode> findByOrgCodeAndType(String orgcode,int type);
TopographyNode findBySourceId(String sourceId); TopographyNode findBySourceId(String sourceId);
TopographyNode findBySourceIdAndTreeid(String fromSourceId, String treeId); TopographyNode findBySourceIdAndTreeid(String fromSourceId, String treeId);
...@@ -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;
}
} }
...@@ -41,7 +41,7 @@ public interface DeviceRemoteClient { ...@@ -41,7 +41,7 @@ public interface DeviceRemoteClient {
*/ */
@RequestMapping(value = "/xml/alarm", method = RequestMethod.GET) @RequestMapping(value = "/xml/alarm", method = RequestMethod.GET)
Object sendAlarm(@RequestParam(value = "xmlData", required = false) String xmlData) throws InnerInvokException; Object sendAlarm(@RequestParam(value = "xmlData", required = false) String xmlData) throws InnerInvokException;
/** /**
* 查询设备详情列表以及指标 * 查询设备详情列表以及指标
* @param equipmentId * @param equipmentId
...@@ -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;
public interface IAlarmPointService extends IGenericManager<AlarmPoint, String> { public interface IAlarmPointService extends IGenericManager<AlarmPoint, String> {
public void saveItem(AlarmPoint alarmPoint); public void saveItem(AlarmPoint alarmPoint);
public void deleteItem(List<AlarmPoint> alarmPointList); public void deleteItem(List<AlarmPoint> alarmPointList);
public void deleteItems(List<AlarmPoint> alarmPointList); public void deleteItems(List<AlarmPoint> alarmPointList);
public List<AlarmPoint> selectPointTypeAndPointId(String type,Long pointId); public List<AlarmPoint> selectPointTypeAndPointId(String type,Long pointId);
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);
} }
...@@ -12,18 +12,20 @@ import com.yeejoin.amos.op.core.jpa.IGenericManager; ...@@ -12,18 +12,20 @@ import com.yeejoin.amos.op.core.jpa.IGenericManager;
import com.yeejoin.amos.spc.core.common.request.CommonPageable; import com.yeejoin.amos.spc.core.common.request.CommonPageable;
public interface IAlarmService extends IGenericManager<Alarm, String> { public interface IAlarmService extends IGenericManager<Alarm, String> {
public Page<Alarm> list(List<DaoCriteria> criterias,CommonPageable commonPageable); public Page<Alarm> list(List<DaoCriteria> criterias,CommonPageable commonPageable);
public void saveBatch(List<Alarm> alarms); public void saveBatch(List<Alarm> alarms);
public List<Alarm> findByQueryColumn(String queryColumn); public List<Alarm> findByQueryColumn(String queryColumn);
public List<Map<String, Object>> countnum(String code); public List<Map<String, Object>> countnum(String code);
List<HashMap<String, Object>> getcountxd(String code); List<HashMap<String, Object>> getcountxd(String code);
List<HashMap<String, Object>> getcountnum(String code); 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,20 +12,20 @@ import com.yeejoin.amos.spc.business.dao.mapper.InputItemMapper; ...@@ -11,20 +12,20 @@ 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 {
@Autowired @Autowired
private IAlarmPointRepository iAlarmPointDao; private IAlarmPointRepository iAlarmPointDao;
@Autowired @Autowired
private InputItemMapper inputMapper; private InputItemMapper inputMapper;
@Autowired @Autowired
private RemoteAlarmTiggerService alarmTiggerService; private RemoteAlarmTiggerService alarmTiggerService;
...@@ -59,11 +60,17 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im ...@@ -59,11 +60,17 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im
@Override @Override
public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId) { public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId) {
return iAlarmPointDao.selectPointTypeAndPointId( type, pointId); return iAlarmPointDao.selectPointTypeAndPointId( type, pointId);
} }
@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,7 +74,23 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService { ...@@ -74,7 +74,23 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService {
return list; return list;
} }
private void convertNode3DVoResponse(ArrayList<Node3DVoResponse> list, JSONObject json, String type,String orgCode) { @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) {
List<JSONObject> dataArray = (List<JSONObject>) json.get("content"); List<JSONObject> dataArray = (List<JSONObject>) json.get("content");
dataArray.forEach(e -> { dataArray.forEach(e -> {
JSONArray authOrgs = e.getJSONArray("authOrg"); JSONArray authOrgs = e.getJSONArray("authOrg");
...@@ -132,6 +148,8 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService { ...@@ -132,6 +148,8 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService {
node3dVoResponse.setType("dynamicRingData"); node3dVoResponse.setType("dynamicRingData");
return node3dVoResponse; return node3dVoResponse;
} }
public static void main(String[] args) {
}
} }
...@@ -47,13 +47,13 @@ import fr.opensagres.xdocreport.template.velocity.internal.Foreach; ...@@ -47,13 +47,13 @@ import fr.opensagres.xdocreport.template.velocity.internal.Foreach;
*/ */
@Service @Service
public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, String> implements ITopographyService { public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, String> implements ITopographyService {
//平台字典管理中配置value为key值 //平台字典管理中配置value为key值
private static final String BNAK_ORG_KEY = "BANK_ORG"; private static final String BNAK_ORG_KEY = "BANK_ORG";
//平台字典管理中配置value为key值 //平台字典管理中配置value为key值
private static final String BNAK_XIAN_KEY = "xian"; private static final String BNAK_XIAN_KEY = "xian";
//平台字典管理中配置value为key值 //平台字典管理中配置value为key值
private static final String BNAK_KEJICHU_KEY = "科技处"; private static final String BNAK_KEJICHU_KEY = "科技处";
...@@ -74,7 +74,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -74,7 +74,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
@Autowired @Autowired
private RemoteWebSocketServer webSocketServer; private RemoteWebSocketServer webSocketServer;
@Autowired @Autowired
RemoteSecurityService remoteSecurityService; RemoteSecurityService remoteSecurityService;
...@@ -85,7 +85,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -85,7 +85,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
@Override @Override
public List<TopographyTreeDTO> getTree(String orgcode,int type) { public List<TopographyTreeDTO> getTree(String orgcode,int type) {
List<TopographyTreeDTO> list = iTopographyTreeDao.findByTypeAndOrgCode(type,orgcode).stream().map(t -> convert(t)).collect(Collectors.toList()); List<TopographyTreeDTO> list = iTopographyTreeDao.findByTypeAndOrgCode(type,orgcode).stream().map(t -> convert(t)).collect(Collectors.toList());
boolean judgeDeviceAuth = JudgeDeviceAuth(list,orgcode); boolean judgeDeviceAuth = JudgeDeviceAuth(list,orgcode);
if(false == judgeDeviceAuth) { if(false == judgeDeviceAuth) {
...@@ -159,7 +159,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -159,7 +159,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
iTopographyNodeDao.saveAll(list); iTopographyNodeDao.saveAll(list);
} }
@Override @Override
public String getSelfOrgCode() { public String getSelfOrgCode() {
List<DictionarieValueModel> listDictionaryByDictCode = remoteSecurityService.listDictionaryByDictCode(BNAK_ORG_KEY); List<DictionarieValueModel> listDictionaryByDictCode = remoteSecurityService.listDictionaryByDictCode(BNAK_ORG_KEY);
...@@ -170,7 +170,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -170,7 +170,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
}); });
return sb.toString(); return sb.toString();
} }
@Override @Override
...@@ -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);
...@@ -362,7 +365,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -362,7 +365,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
return results; return results;
} }
@Override @Override
public List<TopographyLineDTO> getDeviceLinks(String orgcode) { public List<TopographyLineDTO> getDeviceLinks(String orgcode) {
...@@ -393,7 +396,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -393,7 +396,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
} }
/** /**
* 判断该用户登选择公司有无查看该拓扑的权限 * 判断该用户登选择公司有无查看该拓扑的权限
* @param list * @param list
...@@ -401,15 +404,15 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -401,15 +404,15 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
* @return * @return
*/ */
private boolean JudgeDeviceAuth(List<TopographyTreeDTO> list, String orgCode) { private boolean JudgeDeviceAuth(List<TopographyTreeDTO> list, String orgCode) {
String userOrgCode = null; String userOrgCode = null;
if(orgCode.startsWith("%#")) { if(orgCode.startsWith("%#")) {
userOrgCode = truncateHeadString(orgCode,2); userOrgCode = truncateHeadString(orgCode,2);
}else { }else {
userOrgCode = orgCode; userOrgCode = orgCode;
} }
for (TopographyTreeDTO topographyTreeDTO : list) { for (TopographyTreeDTO topographyTreeDTO : list) {
if (!StringUtils.isEmpty(topographyTreeDTO.getOrgCode())) { if (!StringUtils.isEmpty(topographyTreeDTO.getOrgCode())) {
...@@ -430,7 +433,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -430,7 +433,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
} }
} }
} else { } else {
String[] arr = topographyTreeDTO.getOrgCode().split("-"); String[] arr = topographyTreeDTO.getOrgCode().split("-");
...@@ -443,11 +446,11 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -443,11 +446,11 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
} }
} }
return false; return false;
} }
/** /**
* 去除字符串前n个字符 * 去除字符串前n个字符
* @param origin 要操作的字符串 * @param origin 要操作的字符串
...@@ -465,5 +468,5 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St ...@@ -465,5 +468,5 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
} }
return String.copyValueOf(ret); return String.copyValueOf(ret);
} }
} }
...@@ -20,7 +20,7 @@ import com.yeejoin.amos.spc.core.util.query.BaseQuerySpecification; ...@@ -20,7 +20,7 @@ import com.yeejoin.amos.spc.core.util.query.BaseQuerySpecification;
@Service @Service
public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> implements IAlarmService { public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> implements IAlarmService {
@Autowired @Autowired
private IAlarmRepository iAlarmDao; private IAlarmRepository iAlarmDao;
@Autowired @Autowired
...@@ -33,7 +33,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl ...@@ -33,7 +33,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
@Override @Override
public Page<Alarm> list(List<DaoCriteria> criterias, CommonPageable commonPageable) { public Page<Alarm> list(List<DaoCriteria> criterias, CommonPageable commonPageable) {
BaseQuerySpecification<Alarm> spec = new BaseQuerySpecification<>(criterias); BaseQuerySpecification<Alarm> spec = new BaseQuerySpecification<>(criterias);
Page<Alarm> page = iAlarmDao.findAll(spec, commonPageable); Page<Alarm> page = iAlarmDao.findAll(spec, commonPageable);
return page; return page;
} }
...@@ -46,7 +46,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl ...@@ -46,7 +46,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
public List<Alarm> findByQueryColumn(String queryColumn) { public List<Alarm> findByQueryColumn(String queryColumn) {
return iAlarmDao.selectByQueryColumn(queryColumn); return iAlarmDao.selectByQueryColumn(queryColumn);
} }
public List<Map<String, Object>> countnum(String code) { public List<Map<String, Object>> countnum(String code) {
return iAlarmDao.countnum(code); return iAlarmDao.countnum(code);
} }
...@@ -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);
}
} }
...@@ -20,22 +20,22 @@ public interface EquipmentMapper extends BaseMapper { ...@@ -20,22 +20,22 @@ public interface EquipmentMapper extends BaseMapper {
Long countByMap(PageParam pageParam); Long countByMap(PageParam pageParam);
void insertEquipment(EquipmentVo vo); void insertEquipment(EquipmentVo vo);
//void updateEquipment(EquipmentVo vo); //void updateEquipment(EquipmentVo vo);
//void updateEquipmentAttrs(EquipmentQualityVo vo); //void updateEquipmentAttrs(EquipmentQualityVo vo);
void insertEquipmentAttrs( EquipmentQualityVo vo); void insertEquipmentAttrs( EquipmentQualityVo vo);
/** /**
* 更新指标关联表中指标的状态 * 更新指标关联表中指标的状态
* @param status * @param status
* @param id * @param id
*/ */
void updateEquipmentPointStatus(@Param("state")int state,@Param("equipmentsPointId") Long equipmentsPointId); void updateEquipmentPointStatus(@Param("state")int state,@Param("equipmentsPointId") Long equipmentsPointId);
/** /**
* 根据设备Id和指标名称查询指标详情 * 根据设备Id和指标名称查询指标详情
* @param equipmentId * @param equipmentId
...@@ -43,14 +43,14 @@ public interface EquipmentMapper extends BaseMapper { ...@@ -43,14 +43,14 @@ public interface EquipmentMapper extends BaseMapper {
* @return * @return
*/ */
EquipmentQualityVo queryEquipmentPoint(@Param("equipmentId") Long equipmentId,@Param("remark") String remark); EquipmentQualityVo queryEquipmentPoint(@Param("equipmentId") Long equipmentId,@Param("remark") String remark);
/** /**
* 判断关联关系表中该指标是否存在 * 判断关联关系表中该指标是否存在
* @param equipmentsPointId * @param equipmentsPointId
* @return * @return
*/ */
List<Long> judgeEquipmentExists(@Param("equipmentsPointId") Long equipmentsPointId); List<Long> judgeEquipmentExists(@Param("equipmentsPointId") Long equipmentsPointId);
/** /**
* 判断关联关系表中该指标是否存在 * 判断关联关系表中该指标是否存在
* @param equipmentsPointId * @param equipmentsPointId
...@@ -64,13 +64,23 @@ public interface EquipmentMapper extends BaseMapper { ...@@ -64,13 +64,23 @@ public interface EquipmentMapper extends BaseMapper {
Long querySelfDeviceCount( Long querySelfDeviceCount(
@Param("fname") String fname); @Param("fname") String fname);
TopographyNode queryNodeBySourceId( @Param("sourceId")String sourceId); TopographyNode queryNodeBySourceId( @Param("sourceId")String sourceId);
void updateNodeState(TopographyNode node); void updateNodeState(TopographyNode node);
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();
} }
...@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.bank.common.enums.PaymentEnum; import com.yeejoin.amos.bank.common.enums.PaymentEnum;
public interface InputItemMapper extends BaseMapper { public interface InputItemMapper extends BaseMapper {
void deleteInputItemByMeasureContentId(@Param("measureContentId") String id); void deleteInputItemByMeasureContentId(@Param("measureContentId") String id);
List<HashMap<String, Object>> queryPaymentByCode(@Param("itemNo") String itemNo,@Param("name") String name); List<HashMap<String, Object>> queryPaymentByCode(@Param("itemNo") String itemNo,@Param("name") String name);
...@@ -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
\ No newline at end of file
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
...@@ -128,8 +128,8 @@ ...@@ -128,8 +128,8 @@
</if> </if>
</where> </where>
</select> </select>
<insert id="insertEquipment" <insert id="insertEquipment"
parameterType="com.yeejoin.amos.bank.entity.EquipmentVo" parameterType="com.yeejoin.amos.bank.entity.EquipmentVo"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
</if> </if>
</trim> </trim>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
<trim suffixOverrides=","> <trim suffixOverrides=",">
<if test="id !=null">`id`=#{id},</if> <if test="id !=null">`id`=#{id},</if>
<if test="orgCode !=null">`org_code`=#{orgCode},</if> <if test="orgCode !=null">`org_code`=#{orgCode},</if>
...@@ -172,8 +172,8 @@ ...@@ -172,8 +172,8 @@
<if test="name !=null">name=#{name}</if> <if test="name !=null">name=#{name}</if>
</trim> </trim>
</insert> </insert>
<insert id="insertEquipmentAttrs" <insert id="insertEquipmentAttrs"
parameterType="com.yeejoin.amos.bank.entity.EquipmentQualityVo" parameterType="com.yeejoin.amos.bank.entity.EquipmentQualityVo"
useGeneratedKeys="true" keyProperty="id" > useGeneratedKeys="true" keyProperty="id" >
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</if> </if>
</trim> </trim>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
<trim suffixOverrides=","> <trim suffixOverrides=",">
<if test="id !=null">`id`=#{id},</if> <if test="id !=null">`id`=#{id},</if>
<if test="type !=null">`type`=#{type},</if> <if test="type !=null">`type`=#{type},</if>
...@@ -228,21 +228,21 @@ ...@@ -228,21 +228,21 @@
<if test="displayName !=null">`name`=#{displayName},</if> <if test="displayName !=null">`name`=#{displayName},</if>
<if test="code !=null">code=#{code},</if> <if test="code !=null">code=#{code},</if>
<if test="equipmentId !=null">fire_equipment_id=#{equipmentId}</if> <if test="equipmentId !=null">fire_equipment_id=#{equipmentId}</if>
</trim> </trim>
</insert> </insert>
<update id="updateEquipmentPointStatus" > <update id="updateEquipmentPointStatus" >
UPDATE UPDATE
r_risk_factor_equipment_index r_risk_factor_equipment_index
set set
state=#{state} state=#{state}
WHERE WHERE
equipment_point_id=#{equipmentsPointId} equipment_point_id=#{equipmentsPointId}
</update> </update>
<select id = "queryEquipmentPoint" resultType="com.yeejoin.amos.bank.entity.EquipmentQualityVo"> <select id = "queryEquipmentPoint" resultType="com.yeejoin.amos.bank.entity.EquipmentQualityVo">
SELECT SELECT
f.id as id, f.id as id,
...@@ -250,23 +250,23 @@ ...@@ -250,23 +250,23 @@
f.`code` as code, f.`code` as code,
f.fire_equipment_id as equipmentId, f.fire_equipment_id as equipmentId,
f.remark as remark f.remark as remark
FROM FROM
f_fire_equipment_point f f_fire_equipment_point f
WHERE WHERE
f.fire_equipment_id = #{equipmentId} f.fire_equipment_id = #{equipmentId}
AND AND
f.remark = #{remark} f.remark = #{remark}
</select> </select>
<select id = "judgeEquipmentExists" resultType="java.lang.Long"> <select id = "judgeEquipmentExists" resultType="java.lang.Long">
SELECT SELECT
f.risk_factor_id f.risk_factor_id
FROM FROM
r_risk_factor_equipment_index f r_risk_factor_equipment_index f
WHERE equipment_point_id=#{equipmentsPointId} WHERE equipment_point_id=#{equipmentsPointId}
</select> </select>
<select id="querySelfDeviceCount" resultType="long"> <select id="querySelfDeviceCount" resultType="long">
SELECT SELECT
count( DISTINCT fe.id) count( DISTINCT fe.id)
...@@ -276,11 +276,11 @@ ...@@ -276,11 +276,11 @@
<if test="fname != null" > <if test="fname != null" >
AND fe.`name` like concat('%',#{fname},'%') AND fe.`name` like concat('%',#{fname},'%')
</if> </if>
</select> </select>
<select id="querySelfDevice" resultType="com.yeejoin.amos.bank.entity.DeviceRecord"> <select id="querySelfDevice" resultType="com.yeejoin.amos.bank.entity.DeviceRecord">
SELECT SELECT
id, id,
...@@ -291,17 +291,17 @@ ...@@ -291,17 +291,17 @@
FROM FROM
b_device_record efe b_device_record efe
WHERE 1=1 WHERE 1=1
ORDER BY update_date DESC ORDER BY update_date DESC
<if test="fname != null"> <if test="fname != null">
AND efe.`name` like concat('%',#{fname},'%') AND efe.`name` like concat('%',#{fname},'%')
</if> </if>
<if test="length > 0"> <if test="length > 0">
LIMIT ${start},${length} ; LIMIT ${start},${length} ;
</if> </if>
</select> </select>
<select id="queryNodeBySourceId" resultType="com.yeejoin.amos.bank.TopographyNode"> <select id="queryNodeBySourceId" resultType="com.yeejoin.amos.bank.TopographyNode">
SELECT SELECT
* *
...@@ -311,9 +311,9 @@ ...@@ -311,9 +311,9 @@
<if test="sourceId != null"> <if test="sourceId != null">
AND efe.`source_id`= #{sourceId} AND efe.`source_id`= #{sourceId}
</if> </if>
</select> </select>
<update id="updateNodeState" parameterType="com.yeejoin.amos.bank.TopographyNode"> <update id="updateNodeState" parameterType="com.yeejoin.amos.bank.TopographyNode">
UPDATE b_topography_node UPDATE b_topography_node
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
...@@ -322,24 +322,24 @@ ...@@ -322,24 +322,24 @@
</trim> </trim>
WHERE source_id=#{sourceId} WHERE source_id=#{sourceId}
</update > </update >
<update id="updateNodeDetail" > <update id="updateNodeDetail" >
UPDATE b_topography_node_detail UPDATE b_topography_node_detail
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="nodeDetail != null">node_detail=#{nodeDetail},</if> <if test="nodeDetail != null">node_detail=#{nodeDetail},</if>
</trim> </trim>
WHERE nodeid=#{nodeid} WHERE nodeid=#{nodeid}
</update > </update >
<delete id="deleteOneHourNormal"> <delete id="deleteOneHourNormal">
DELETE DELETE
FROM FROM
b_device_record b_device_record
WHERE WHERE
id IN ( id IN (
SELECT a.id from( SELECT a.id from(
SELECT SELECT
`ID` `ID`
...@@ -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
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
WHERE WHERE
original_id = #{measureContentId} original_id = #{measureContentId}
</update> </update>
<select id="queryPaymentByCode" parameterType="java.lang.String" resultType="java.util.HashMap"> <select id="queryPaymentByCode" parameterType="java.lang.String" resultType="java.util.HashMap">
<!-- select <!-- select
SUM(IFNULL(I.input_value,0)) as score,I.point_classify_name as payName,#{name} as name SUM(IFNULL(I.input_value,0)) as score,I.point_classify_name as payName,#{name} as name
from p_check C from p_check C
left join p_check_input I on C.id=I.check_id left join p_check_input I on C.id=I.check_id
...@@ -49,12 +49,12 @@ ...@@ -49,12 +49,12 @@
group by I.point_classify_name,M.name,M.item_no group by I.point_classify_name,M.name,M.item_no
order by M.item_no order by M.item_no
</select>--> </select>-->
<select id="queryPaymentByCodes" resultType="java.util.HashMap" parameterType="java.util.List"> <select id="queryPaymentByCodes" resultType="java.util.HashMap" parameterType="java.util.List">
select I.input_value as score,I.point_classify_name as payName,M.name,M.item_no select I.input_value as score,I.point_classify_name as payName,M.name,M.item_no
from p_check_input I from p_check_input I
left join p_input_item M ON M.id = I.input_id left join p_input_item M ON M.id = I.input_id
where where
I.is_ok != 3 I.is_ok != 3
AND I.id in AND I.id in
( SELECT max(I.id) FROM ( SELECT max(I.id) FROM
...@@ -77,29 +77,29 @@ ...@@ -77,29 +77,29 @@
group by I.point_classify_name,M.name,M.item_no group by I.point_classify_name,M.name,M.item_no
order by M.item_no order by M.item_no
</select> </select>
<delete id="deletePointAlarmByIds"> <delete id="deletePointAlarmByIds">
delete from p_alarm_point delete from p_alarm_point
where id IN where id IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</delete> </delete>
<select id="getcountnum" parameterType="java.lang.String" resultType="java.util.HashMap"> <select id="getcountnum" parameterType="java.lang.String" resultType="java.util.HashMap">
select COUNT(id) num select COUNT(id) num
from r_risk_source from r_risk_source
where is_region='FALSE' where is_region='FALSE'
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and r_risk_source.org_code LIKE concat( #{code}, "%") and r_risk_source.org_code LIKE concat( #{code}, "%")
</if> </if>
</select> </select>
<select id="getcountxd" parameterType="java.lang.String" resultType="java.util.HashMap"> <select id="getcountxd" parameterType="java.lang.String" resultType="java.util.HashMap">
select select
CASE r_risk_level.`code` CASE r_risk_level.`code`
WHEN 1 THEN WHEN 1 THEN
'一级风险' '一级风险'
...@@ -111,26 +111,26 @@ ...@@ -111,26 +111,26 @@
'四级风险' '四级风险'
WHEN 5 THEN WHEN 5 THEN
'五级风险' '五级风险'
END END
name , name ,
r_risk_level.`code`, r_risk_level.`code`,
a.num a.num
from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num,r_risk_level.`code` from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num,r_risk_level.`code`
from r_risk_source RIGHT JOIN r_risk_level on r_risk_source.risk_level_id=r_risk_level.id from r_risk_source RIGHT JOIN r_risk_level on r_risk_source.risk_level_id=r_risk_level.id
where is_region='FALSE' where is_region='FALSE'
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and r_risk_source.org_code LIKE concat( #{code}, "%") and r_risk_source.org_code LIKE concat( #{code}, "%")
</if> </if>
GROUP BY r_risk_level.id) a on a.code= r_risk_level.`code` GROUP BY r_risk_level.id) a on a.code= r_risk_level.`code`
</select> </select>
<select id="getcountyc" parameterType="java.lang.String" resultType="java.util.HashMap"> <select id="getcountyc" parameterType="java.lang.String" resultType="java.util.HashMap">
select select
CASE r_risk_level.`code` CASE r_risk_level.`code`
WHEN 1 THEN WHEN 1 THEN
'一级风险' '一级风险'
...@@ -142,31 +142,56 @@ from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num,r_risk_leve ...@@ -142,31 +142,56 @@ from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num,r_risk_leve
'四级风险' '四级风险'
WHEN 5 THEN WHEN 5 THEN
'五级风险' '五级风险'
END END
name , name ,
r_risk_level.`code`, r_risk_level.`code`,
a.num a.num
from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num, r_risk_level.`code` from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num, r_risk_level.`code`
from r_risk_source RIGHT JOIN r_risk_level on r_risk_source.risk_level_id=r_risk_level.id from r_risk_source RIGHT JOIN r_risk_level on r_risk_source.risk_level_id=r_risk_level.id
where is_region='FALSE' and r_risk_source.flicker_frequency >0 where is_region='FALSE' and r_risk_source.flicker_frequency >0
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and r_risk_source.org_code LIKE concat( #{code}, "%") and r_risk_source.org_code LIKE concat( #{code}, "%")
</if> </if>
GROUP BY r_risk_level.id) a on a.code= r_risk_level.`code` GROUP BY r_risk_level.id) a on a.code= r_risk_level.`code`
</select> </select>
<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