Commit 4892d959 authored by xinglei's avatar xinglei

*)修改时间少8个小时问题

parent 841533df
package com.yeejoin.amos.bank.dao.entity; package com.yeejoin.amos.bank.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
...@@ -49,6 +51,7 @@ public class Alarm { ...@@ -49,6 +51,7 @@ public class Alarm {
private String orgCode;//'用于查询', private String orgCode;//'用于查询',
@Column(name = "update_date") @Column(name = "update_date")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String updateDate;//'用于查询', private String updateDate;//'用于查询',
......
...@@ -9,11 +9,13 @@ import javax.persistence.GenerationType; ...@@ -9,11 +9,13 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.bank.entity.BaseEntity;
import com.yeejoin.amos.spc.dao.entity.BasicEntity; 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 {
/** /**
* *
...@@ -29,6 +31,7 @@ public class AlarmPoint{ ...@@ -29,6 +31,7 @@ public class AlarmPoint{
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")
private Date updateDate; private Date updateDate;
@Column(name = "is_alarm") @Column(name = "is_alarm")
......
...@@ -236,7 +236,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient { ...@@ -236,7 +236,7 @@ public class MonitorAlarmWebSocketClient extends WebSocketClient {
client.connect(); client.connect();
while (!client.getReadyState().equals(WebSocket.READYSTATE.OPEN)) { while (!client.getReadyState().equals(WebSocket.READYSTATE.OPEN)) {
System.out.println("connecting...Dynamic ring alarm----" + client.getReadyState()); //System.out.println("connecting...Dynamic ring alarm----" + client.getReadyState());
} }
System.out.println("build " + monitorAlarmWebSocketClientUrl + "connected..."); System.out.println("build " + monitorAlarmWebSocketClientUrl + "connected...");
} catch (URISyntaxException | IOException e) { } catch (URISyntaxException | IOException e) {
......
...@@ -304,7 +304,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -304,7 +304,7 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
ShiduAlarmWebSocketClient client = new ShiduAlarmWebSocketClient(monitorAlarmWebSocketClientUrl); ShiduAlarmWebSocketClient client = new ShiduAlarmWebSocketClient(monitorAlarmWebSocketClientUrl);
client.connect(); client.connect();
while (!client.getReadyState().equals(WebSocket.READYSTATE.OPEN)) { while (!client.getReadyState().equals(WebSocket.READYSTATE.OPEN)) {
System.out.println("connecting... shidu Dynamic ring alarm----" + client.getReadyState()); log.info("connecting... shidu Dynamic ring alarm----" + client.getReadyState());
} }
System.out.println("build " + monitorAlarmWebSocketClientUrl + "connected..."); System.out.println("build " + monitorAlarmWebSocketClientUrl + "connected...");
} catch (URISyntaxException | IOException e) { } catch (URISyntaxException | IOException e) {
...@@ -312,5 +312,4 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient { ...@@ -312,5 +312,4 @@ public class ShiduAlarmWebSocketClient extends WebSocketClient {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
...@@ -58,21 +58,21 @@ public class ProtalDataController extends BaseController { ...@@ -58,21 +58,21 @@ public class ProtalDataController extends BaseController {
@ApiOperation(value = "上传巡检数据", notes = "上传巡检数据") @ApiOperation(value = "上传巡检数据", notes = "上传巡检数据")
@GetMapping(value = "/data") @GetMapping(value = "/data")
public CommonResponse updateProtalData(@RequestParam("date")String json) throws Exception { public CommonResponse updateProtalData(@RequestParam("date") String json) throws Exception {
// protalDataRo.setBatchNo(UUID.randomUUID().toString()); // protalDataRo.setBatchNo(UUID.randomUUID().toString());
// Object result = remoteRuleServer.fireRule(protalDataRo, "weihuaguize/ProtalData"); // Object result = remoteRuleServer.fireRule(protalDataRo, "weihuaguize/ProtalData");
// return CommonResponseUtil.success("SUCCESS"); // return CommonResponseUtil.success("SUCCESS");
// //
ProtalDataRo date= JSONObject.parseObject(json, ProtalDataRo.class); ProtalDataRo date = JSONObject.parseObject(json, ProtalDataRo.class);
//对巡检异常存入表 //对巡检异常存入表
//判断点是不是存在报警 type 默认为"point" //判断点是不是存在报警 type 默认为"point"
long pointid= Long.valueOf(date.getPointID()+""); long pointid = Long.valueOf(date.getPointID() + "");
List<AlarmPoint> alarmPoint= alarmPointService.selectPointTypeAndPointId("3", pointid); List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId("3", pointid);
if(alarmPoint!=null&&alarmPoint.size()>0){ if (alarmPoint != null && alarmPoint.size() > 0) {
//存在报警,判断当前状态是不是合格,合格则删除上次的报警 //存在报警,判断当前状态是不是合格,合格则删除上次的报警
if("1".equals(date.getExecuteStatus())){ if ("1".equals(date.getExecuteStatus())) {
//删除告警 //删除告警
//alarmPointService.delete(alarmPoint.get(0).getId()+""); //alarmPointService.delete(alarmPoint.get(0).getId()+"");
alarmPointService.delete(alarmPoint.get(0)); alarmPointService.delete(alarmPoint.get(0));
...@@ -81,31 +81,29 @@ public class ProtalDataController extends BaseController { ...@@ -81,31 +81,29 @@ public class ProtalDataController extends BaseController {
alarmPoint1.setUpdateDate(new Date()); alarmPoint1.setUpdateDate(new Date());
alarmPointService.save(alarmPoint1); alarmPointService.save(alarmPoint1);
} }
}else{ } else {
//不存在,判断当前状态是不是合格,不合格新增,合格不做任何操作 //不存在,判断当前状态是不是合格,不合格新增,合格不做任何操作
if(!"1".equals(date.getExecuteStatus())){ if (!"1".equals(date.getExecuteStatus())) {
//增加告警 //增加告警
AlarmPoint alarmPoint1=new AlarmPoint(); AlarmPoint alarmPoint1 = new AlarmPoint();
alarmPoint1.setPointId(pointid); alarmPoint1.setPointId(pointid);
alarmPoint1.setPointType("3"); alarmPoint1.setPointType("3");
alarmPoint1.setUpdateDate(new Date()); alarmPoint1.setUpdateDate(new Date());
alarmPoint1.setIsAlarm(1);//不合格 alarmPoint1.setIsAlarm(1);//不合格
alarmPoint1.setContent(date.getName()+"巡检出现异常!"); alarmPoint1.setContent(date.getName() + "巡检出现异常!");
alarmPoint1.setCode(date.getCode()); alarmPoint1.setCode(date.getCode());
alarmPoint1.setPointName(date.getName()); alarmPoint1.setPointName(date.getName());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("position", date.getCoordinates()); map.put("position", date.getCoordinates());
map.put("storey", ""+date.getNum()); map.put("storey", "" + date.getNum());
alarmPoint1.setPointAttrs(JSON.toJSONString(map)); alarmPoint1.setPointAttrs(JSON.toJSONString(map));
alarmPointService.save(alarmPoint1); alarmPointService.save(alarmPoint1);
} }
} }
List<AlarmPoint> list= alarmPointService.findAll(); List<AlarmPoint> list = alarmPointService.findAll();
WebsocketParam param=new WebsocketParam("alarmPoint", JSON.toJSONString(list)); WebsocketParam param = new WebsocketParam("alarmPoint", JSON.toJSONString(list));
//client.sendMessage(param); //client.sendMessage(param);
Properties props = PropertiesLoaderUtils.loadAllProperties("application.properties"); Properties props = PropertiesLoaderUtils.loadAllProperties("application.properties");
...@@ -119,8 +117,8 @@ public class ProtalDataController extends BaseController { ...@@ -119,8 +117,8 @@ public class ProtalDataController extends BaseController {
@ApiOperation(value = "上传隐患信息", notes = "上传隐患信息") @ApiOperation(value = "上传隐患信息", notes = "上传隐患信息")
@GetMapping(value = "/hiddentrouble") @GetMapping(value = "/hiddentrouble")
public CommonResponse hiddenTroubleInfo(@RequestParam("date")String json) throws Exception { public CommonResponse hiddenTroubleInfo(@RequestParam("date") String json) throws Exception {
HiddenTroubleRo hiddenTroubleRo= JSONObject.parseObject(json, HiddenTroubleRo.class); HiddenTroubleRo hiddenTroubleRo = JSONObject.parseObject(json, HiddenTroubleRo.class);
hiddenTroubleRo.setBatchNo(UUID.randomUUID().toString()); hiddenTroubleRo.setBatchNo(UUID.randomUUID().toString());
Object result = remoteRuleServer.fireRule(hiddenTroubleRo, "weihuaguize/HiddenTrouble"); Object result = remoteRuleServer.fireRule(hiddenTroubleRo, "weihuaguize/HiddenTrouble");
return CommonResponseUtil.success("SUCCESS"); return CommonResponseUtil.success("SUCCESS");
......
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