Commit 4892d959 authored by xinglei's avatar xinglei

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

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