Commit e8184a75 authored by KeYong's avatar KeYong

修复bug

parent 8480ae78
...@@ -31,14 +31,13 @@ import org.springframework.beans.BeanUtils; ...@@ -31,14 +31,13 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -185,6 +184,14 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -185,6 +184,14 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
} }
//数字换流站使用 //数字换流站使用
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), ""); mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), "");
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase());
// mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
// }
// });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("确认失败"); throw new BadRequest("确认失败");
......
...@@ -7,7 +7,10 @@ import java.net.SocketException; ...@@ -7,7 +7,10 @@ import java.net.SocketException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
...@@ -194,7 +197,10 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -194,7 +197,10 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
mybatisResult.getRecords().forEach(x -> { mybatisResult.getRecords().forEach(x -> {
AlarmListDataVO dataVO = new AlarmListDataVO(); AlarmListDataVO dataVO = new AlarmListDataVO();
try { try {
dataVO.setAlarmTime(DateUtils.dateParse(String.valueOf(x.get("createDate")),DateUtils.DATE_TIME_T_PATTERN)); DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtils.DATE_TIME_PATTERN);
String time = df.format((TemporalAccessor)x.get("createDate"));
Date date = DateUtils.dateParse(time, DateUtils.DATE_TIME_PATTERN);
dataVO.setAlarmTime(date);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -11,6 +11,7 @@ import java.util.UUID; ...@@ -11,6 +11,7 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//import net.sf.json.JSONObject; //import net.sf.json.JSONObject;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -212,6 +213,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -212,6 +213,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private final static Map staticMap = new HashMap(); private final static Map staticMap = new HashMap();
private static Boolean bool = Boolean.FALSE;
static { static {
staticMap.put("FireCar_GDLongitude", "0"); staticMap.put("FireCar_GDLongitude", "0");
staticMap.put("FireCar_GDLatitude", "0"); staticMap.put("FireCar_GDLatitude", "0");
...@@ -450,6 +453,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -450,6 +453,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString()); mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
} else { } else {
upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), equipmentSpecificAlarmLogService); upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), equipmentSpecificAlarmLogService);
mqttSendGateway.sendToMqtt(TopicEnum.EQYQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.TRUE;
} }
specificAlarmIds.add(action.getId()); specificAlarmIds.add(action.getId());
equipIndexIds.add(action.getEquipmentIndexId()); equipIndexIds.add(action.getEquipmentIndexId());
...@@ -496,7 +501,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -496,7 +501,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
iEquipmentSpecificSerivce.updateEquipmentSpecIndexRealtimeData(equipmentSpecificIndexList); iEquipmentSpecificSerivce.updateEquipmentSpecIndexRealtimeData(equipmentSpecificIndexList);
//数字换流站站使用 //数字换流站站使用
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), ""); mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), "");
if (!equipmentAlarmLogs.isEmpty()) { if (!equipmentAlarmLogs.isEmpty() || bool) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase()); jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase());
mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString()); mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
......
...@@ -329,8 +329,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -329,8 +329,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
} }
} }
//插入模板信息 //插入模板信息
EquipmentDetail equipmentDetail = new EquipmentDetail(); EquipmentDetail equipmentDetail = new EquipmentDetail();
equipmentDetail.setCode(equipmentDetailDownloadVOS.get(i).getCode()); equipmentDetail.setCode(equipmentDetailDownloadVOS.get(i).getCode());
...@@ -344,6 +342,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -344,6 +342,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
equipmentDetail.setManufacturerName(equipmentDetailDownloadVOS.get(i).getManufacturerName()); equipmentDetail.setManufacturerName(equipmentDetailDownloadVOS.get(i).getManufacturerName());
} }
equipmentDetail.setEquipmentId(equipment.getId()); equipmentDetail.setEquipmentId(equipment.getId());
equipmentDetail.setEquipmentName(equipment.getName());
equipmentDetail.setName(equipmentDetailDownloadVOS.get(i).getName()); equipmentDetail.setName(equipmentDetailDownloadVOS.get(i).getName());
equipmentDetail.setArea(equipmentDetailDownloadVOS.get(i).getDescription()); equipmentDetail.setArea(equipmentDetailDownloadVOS.get(i).getDescription());
...@@ -354,7 +353,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -354,7 +353,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
equipmentDetail.setCompanyName(company[0]); equipmentDetail.setCompanyName(company[0]);
} }
equipmentDetailMapper.insert(equipmentDetail); equipmentDetailMapper.insert(equipmentDetail);
//生成单件设备信息 //生成单件设备信息
......
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