|
@@ -4,6 +4,7 @@ import com.welampiot.common.BaseResult;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
+import com.welampiot.service.impl.WifiServiceImpl;
|
|
|
import com.welampiot.utils.ExcelUtil;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
import com.welampiot.vo.*;
|
|
@@ -70,6 +71,18 @@ public class AlarmController {
|
|
|
private VideoMonitorService videoMonitorService;
|
|
|
@Autowired
|
|
|
private EmergencyVideoService emergencyVideoService;
|
|
|
+ @Autowired
|
|
|
+ private WifiServiceImpl WifiService;
|
|
|
+ @Autowired
|
|
|
+ private RfidService rfidService;
|
|
|
+ @Autowired
|
|
|
+ private ScreenService screenService;
|
|
|
+ @Autowired
|
|
|
+ private ChargeService chargeService;
|
|
|
+ @Autowired
|
|
|
+ private EnvmonitorService envmonitorService;
|
|
|
+ @Autowired
|
|
|
+ private AirSwitchInfoService airSwitchInfoService;
|
|
|
|
|
|
/**
|
|
|
* 获取告警列表
|
|
@@ -545,17 +558,43 @@ public class AlarmController {
|
|
|
public BaseResult<?> sendUserList(HttpServletRequest request) {
|
|
|
Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
- int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
|
|
|
- int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
|
|
|
- SendStatusVO sendStatusVO = new SendStatusVO();
|
|
|
- sendStatusVO.setPage(count * (page - 1));
|
|
|
- sendStatusVO.setCount(count);
|
|
|
- sendStatusVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
- sendStatusVO.setSectionId(sectionId);
|
|
|
- List<SendStatusDTO> sendPersonList = sendStatusService.getSendPersonList(sendStatusVO);
|
|
|
- SendStatusVO vo = new SendStatusVO();
|
|
|
- vo.setList(sendPersonList);
|
|
|
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
|
|
|
+ if (sectionId == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+
|
|
|
+ RepairPersonnelDTO repairPersonnel = new RepairPersonnelDTO();
|
|
|
+
|
|
|
+ SectionDTO sectionDTO = new SectionDTO();
|
|
|
+ sectionDTO.setId(sectionId);
|
|
|
+ SectionDTO dataByVO = sectionService.getDataByVO(sectionDTO);
|
|
|
+ if (dataByVO == null || dataByVO.getAlarmUser() == null){
|
|
|
+ List<RepairPersonnelDTO>list = new ArrayList<>();
|
|
|
+ repairPersonnel.setList(list);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,repairPersonnel);
|
|
|
+ }
|
|
|
+ String[] userIdList = dataByVO.getAlarmUser().split(",");
|
|
|
+ List<RepairPersonnelDTO>list = repairPersonnelService.getRepairPersonnelByIds(userIdList);
|
|
|
+ SendStatusDTO dto = new SendStatusDTO();
|
|
|
+ dto.setSectionId(sectionId);
|
|
|
+ List<SendStatusDTO> sectionUsers = sendStatusService.getSectionUsers(dto);
|
|
|
+ for (RepairPersonnelDTO item:list) {
|
|
|
+ Integer isset = 0;
|
|
|
+ for (SendStatusDTO statusDTO:sectionUsers) {
|
|
|
+ if (item.getId().equals(statusDTO.getRepairUserId())){
|
|
|
+ isset = 1;
|
|
|
+ item.setIsPhone(statusDTO.getIsPhone());
|
|
|
+ item.setIsEmail(statusDTO.getIsEmail());
|
|
|
+ item.setStatus(statusDTO.getStatus());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isset == 0){
|
|
|
+ item.setIsPhone(0);
|
|
|
+ item.setIsEmail(0);
|
|
|
+ item.setStatus(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ repairPersonnel.setList(list);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,repairPersonnel);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -570,6 +609,29 @@ public class AlarmController {
|
|
|
Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
if (id == 0 || sectionId == 0)
|
|
|
return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+
|
|
|
+ SectionDTO sectionDTO = new SectionDTO();
|
|
|
+ sectionDTO.setId(sectionId);
|
|
|
+ SectionDTO dataByVO = sectionService.getDataByVO(sectionDTO);
|
|
|
+ if (dataByVO == null){
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+ String[] userIdList = dataByVO.getAlarmUser().split(",");
|
|
|
+ if (userIdList == null) return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version);
|
|
|
+
|
|
|
+ ArrayList<String> newList = new ArrayList<>();
|
|
|
+ for (String userId:userIdList) {
|
|
|
+ if (!userId.isEmpty() && !id.equals(Integer.parseInt(userId))){
|
|
|
+ newList.add(userId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //更新section
|
|
|
+ String userJoin = "";
|
|
|
+ if (newList != null){
|
|
|
+ userJoin = String.join(",", newList);
|
|
|
+ }
|
|
|
+ sectionDTO.setAlarmUser(userJoin);
|
|
|
+ sectionService.updateSectionById(sectionDTO);
|
|
|
sendStatusService.deleteSendStatusData(sectionId,id);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
@@ -586,10 +648,36 @@ public class AlarmController {
|
|
|
Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
if (id == 0 || sectionId == 0)
|
|
|
return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
- SendStatusDTO sendStatusDTO = new SendStatusDTO();
|
|
|
- sendStatusDTO.setSectionId(sectionId);
|
|
|
- sendStatusDTO.setRepairUserid(id);
|
|
|
- sendStatusService.addSendStatusData(sendStatusDTO);
|
|
|
+
|
|
|
+ SectionDTO sectionDTO = new SectionDTO();
|
|
|
+ sectionDTO.setId(sectionId);
|
|
|
+ SectionDTO dataByVO = sectionService.getDataByVO(sectionDTO);
|
|
|
+ ArrayList<String> newList = new ArrayList<>();
|
|
|
+ Integer personCount = 0;
|
|
|
+ if (dataByVO != null && dataByVO.getAlarmUser() != null){
|
|
|
+ String[] userIdList = dataByVO.getAlarmUser().split(",");
|
|
|
+ newList.addAll(Arrays.asList(userIdList));
|
|
|
+ boolean contains = newList.contains(id);
|
|
|
+ if (contains == true) return toolUtils.response(InterfaceResultEnum.PERSON_BIND_ERROR, version);
|
|
|
+ personCount = repairPersonnelService.getCountRepairPersonnel(userIdList);
|
|
|
+ }
|
|
|
+ if (personCount >= 10) return toolUtils.response(InterfaceResultEnum.PERSON_OVER_ERROR, version);
|
|
|
+ newList.add(id.toString());
|
|
|
+ //更新section
|
|
|
+ String userJoin = "";
|
|
|
+ if (newList != null){
|
|
|
+ userJoin = String.join(",", newList);
|
|
|
+ }
|
|
|
+ sectionDTO.setAlarmUser(userJoin);
|
|
|
+ sectionService.updateSectionById(sectionDTO);
|
|
|
+ SendStatusDTO statusDTO = new SendStatusDTO();
|
|
|
+ statusDTO.setSectionId(sectionId);
|
|
|
+ statusDTO.setRepairUserId(id);
|
|
|
+ statusDTO.setIsPhone(1);
|
|
|
+ statusDTO.setIsEmail(1);
|
|
|
+ statusDTO.setType(version);
|
|
|
+
|
|
|
+ sendStatusService.addSendStatusData(statusDTO);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
|
|
@@ -607,12 +695,20 @@ public class AlarmController {
|
|
|
Integer isEmail = (Integer) toolUtils.getRequestContent(request,"isEmail",1);
|
|
|
if (id == 0 || sectionId == 0)
|
|
|
return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
- SendStatusDTO sendStatusDTO = new SendStatusDTO();
|
|
|
- sendStatusDTO.setSectionId(sectionId);
|
|
|
- sendStatusDTO.setRepairUserid(id);
|
|
|
- sendStatusDTO.setIsPhone(isPhone);
|
|
|
- sendStatusDTO.setIsEmail(isEmail);
|
|
|
- sendStatusService.updateSendStatusData(sendStatusDTO);
|
|
|
+ SendStatusDTO statusDTO = new SendStatusDTO();
|
|
|
+ statusDTO.setSectionId(sectionId);
|
|
|
+ statusDTO.setRepairUserId(id);
|
|
|
+ statusDTO.setIsPhone(isPhone);
|
|
|
+ statusDTO.setIsEmail(isEmail);
|
|
|
+ statusDTO.setType(version);
|
|
|
+ List<SendStatusDTO>list = sendStatusService.getSectionUsers(statusDTO);
|
|
|
+ if (list == null || list.get(0).getId() == null){
|
|
|
+ //添加
|
|
|
+ sendStatusService.addSendStatusData(statusDTO);
|
|
|
+ }else {
|
|
|
+ //更新
|
|
|
+ sendStatusService.updateSendStatusData(statusDTO);
|
|
|
+ }
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
|
|
@@ -631,9 +727,16 @@ public class AlarmController {
|
|
|
return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
SendStatusDTO sendStatusDTO = new SendStatusDTO();
|
|
|
sendStatusDTO.setSectionId(sectionId);
|
|
|
- sendStatusDTO.setRepairUserid(id);
|
|
|
+ sendStatusDTO.setRepairUserId(id);
|
|
|
+ List<SendStatusDTO>list = sendStatusService.getSectionUsers(sendStatusDTO);
|
|
|
sendStatusDTO.setStatus(status);
|
|
|
- sendStatusService.updateCloseStatus(sendStatusDTO);
|
|
|
+ if (list == null || list.get(0).getId() == null){
|
|
|
+ //添加
|
|
|
+ sendStatusService.addCloseStatus(sendStatusDTO);
|
|
|
+ }else {
|
|
|
+ //更新
|
|
|
+ sendStatusService.updateCloseStatus(sendStatusDTO);
|
|
|
+ }
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
|
|
@@ -645,11 +748,24 @@ public class AlarmController {
|
|
|
@RequestMapping(value = "/emAlarmHistory", method = RequestMethod.POST)
|
|
|
public BaseResult<?> emAlarmHistory(HttpServletRequest request) {
|
|
|
Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
- List<Integer> sectionList = toolUtils.getSectionList(request);
|
|
|
- List<EmergencyInfoLogDTO> list = emergencyInfoLogService.getEmergencyInfoLogListBySectionList(sectionList);
|
|
|
- EmergencyInfoLogVO emergencyInfoLogVO = new EmergencyInfoLogVO();
|
|
|
- emergencyInfoLogVO.setList(list);
|
|
|
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,emergencyInfoLogVO);
|
|
|
+ UserDTO user = toolUtils.getUser(request);
|
|
|
+ List<String> sectionList = null;
|
|
|
+ EmergencyVO emergencyVO = new EmergencyVO();
|
|
|
+
|
|
|
+ if (user.getRole() != ToolUtils.SYSTEM_ADMIN){
|
|
|
+ List<EmergencyDTO>list = new ArrayList<>();
|
|
|
+ emergencyVO.setList(list);
|
|
|
+ sectionList = toolUtils.getSectionList(request);
|
|
|
+ if (sectionList == null) return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,emergencyVO);
|
|
|
+ }
|
|
|
+ emergencyVO.setSectionList(sectionList);
|
|
|
+ List<EmergencyDTO> joinList = emergencyService.getEmergencyJoinList(emergencyVO);
|
|
|
+ for (EmergencyDTO dto:joinList) {
|
|
|
+ dto.setName(dto.getSection()+" "+dto.getModel());
|
|
|
+ }
|
|
|
+ emergencyVO.setSectionList(null);
|
|
|
+ emergencyVO.setList(joinList);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,emergencyVO);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -663,27 +779,34 @@ public class AlarmController {
|
|
|
Integer version = detailsVO.getVersion();
|
|
|
Integer id = detailsVO.getId();
|
|
|
if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
- Integer sectionId = emergencyService.getEmergencySectionIdById(id);
|
|
|
- List<EmergencyVideoDTO> emergencyVideoList = emergencyVideoService.getVideoIdByEmergencyId(id);
|
|
|
- List<VideoMonitorDTO> videoList = videoMonitorService.getVideoListBySectionId(sectionId);
|
|
|
- List<Integer> ids = new ArrayList<>();
|
|
|
- emergencyVideoList.forEach(dto -> ids.add(dto.getVideoId()));
|
|
|
- for (VideoMonitorDTO dto : videoList) {
|
|
|
- boolean isFlag = false;
|
|
|
- for (Integer integer : ids) {
|
|
|
- if (dto.getId().equals(integer)) {
|
|
|
- dto.setSelect(1);
|
|
|
- isFlag = true;
|
|
|
- break;
|
|
|
+ List<EmergencyVideoDTO> videoIdList = emergencyVideoService.getVideoIdByEmergencyId(id);
|
|
|
+ EmergencyDTO sectionOne = emergencyService.getSectionOne(id);
|
|
|
+
|
|
|
+ VideoMonitorVO videoMonitor = new VideoMonitorVO();
|
|
|
+ ArrayList<VideoMonitorDTO> list = new ArrayList<>();
|
|
|
+ videoMonitor.setList(list);
|
|
|
+
|
|
|
+ if (sectionOne != null && sectionOne.getSectionId() != null){
|
|
|
+ List<VideoMonitorDTO> dataList = videoMonitorService.getDataList(sectionOne);
|
|
|
+ //取出videoIdList的videoId值再去重
|
|
|
+ HashSet<Integer> videoIds = new HashSet<>();
|
|
|
+ if (videoIdList != null){
|
|
|
+ for (EmergencyVideoDTO dto:videoIdList) {
|
|
|
+ videoIds.add(dto.getVideoId());
|
|
|
}
|
|
|
}
|
|
|
- if (!isFlag) {
|
|
|
- dto.setSelect(0);
|
|
|
+
|
|
|
+ for (VideoMonitorDTO dto:dataList) {
|
|
|
+ dto.setStatus(0);
|
|
|
+ if (videoIdList != null){
|
|
|
+ if (videoIds.contains(dto.getId())){
|
|
|
+ dto.setStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ videoMonitor.setList(dataList);
|
|
|
}
|
|
|
- VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
|
|
|
- videoMonitorVO.setList(videoList);
|
|
|
- return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitorVO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,videoMonitor);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -708,4 +831,165 @@ public class AlarmController {
|
|
|
}
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
+ @RequestMapping(value = "/saveAlarmData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> saveAlarmData(HttpServletRequest request) {
|
|
|
+ String number = request.getParameter("number");
|
|
|
+ String name = request.getParameter("name");
|
|
|
+ Integer areaId = request.getParameter("areaId") == null ? 0 : Integer.parseInt(request.getParameter("areaId"));
|
|
|
+ Integer sectionId = request.getParameter("sectionId") == null ? 0 : Integer.parseInt(request.getParameter("sectionId"));
|
|
|
+ String createTime = request.getParameter("createTime");
|
|
|
+ Integer devType = request.getParameter("devType") == null ? 0 : Integer.parseInt(request.getParameter("devType"));
|
|
|
+ Integer dType = request.getParameter("dType") == null ? 0 : Integer.parseInt(request.getParameter("dType"));
|
|
|
+ String alarmType = request.getParameter("alarmType");
|
|
|
+ Integer source = request.getParameter("source") == null ? 1 : Integer.parseInt(request.getParameter("source"));
|
|
|
+ Integer level = request.getParameter("level") == null ? 0 : Integer.parseInt(request.getParameter("level"));
|
|
|
+ Integer alarmStatus = request.getParameter("alarmStatus") == null ? 0 : Integer.parseInt(request.getParameter("alarmStatus"));
|
|
|
+ Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
|
|
|
+
|
|
|
+ if (areaId == 0 || sectionId == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ if (number == null && name == null) return toolUtils.response(InterfaceResultEnum.REPAIR_PARAM_EMPTY_ERROR,version);
|
|
|
+ SectionDTO sectionDTO = new SectionDTO();
|
|
|
+ sectionDTO.setPid(areaId);
|
|
|
+ sectionDTO.setId(sectionId);
|
|
|
+ GlobalLocationDTO timeZoneData = globalLocationService.getTimeZoneData(sectionDTO);
|
|
|
+
|
|
|
+ HashMap<String,Object> where = new HashMap<>();
|
|
|
+ //HashMap<String,Object> where1 = new HashMap<>();
|
|
|
+ where.put("areaId",areaId);
|
|
|
+ where.put("sectionId",sectionId);
|
|
|
+ if (number != null){
|
|
|
+ String[] numberArr = number.split("_");
|
|
|
+ if (numberArr.length == 1 || (numberArr.length == 2 && numberArr[1].equals("1"))){
|
|
|
+ where.put("number",numberArr[0]);
|
|
|
+ where.put("mode",0);
|
|
|
+ }else {
|
|
|
+ where.put("number",numberArr[0]);
|
|
|
+ where.put("mode",1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (name != null){
|
|
|
+ where.put("name",name);
|
|
|
+ }
|
|
|
+ //设备类型(0 路灯,1 灯杆,2 井盖, 3 水浸,4配电柜)
|
|
|
+ Integer id = 0;
|
|
|
+ if (devType == 0){
|
|
|
+ //灯
|
|
|
+ LampInfoDTO oneLamp = lampService.getOneData(where);
|
|
|
+ if (oneLamp == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneLamp.getId();
|
|
|
+ }else if (devType == 1){
|
|
|
+ //灯杆
|
|
|
+ //灯杆上的设备类型(0 路灯,1 摄像头,2 WIFI,3 RFID,4 LED屏,5 一键报警,6 充电桩,7 气象站,8 微基站,9 气象站)
|
|
|
+ if (dType == 0){
|
|
|
+ //灯
|
|
|
+ LampInfoDTO oneLamp = lampService.getOneData(where);
|
|
|
+ if (oneLamp == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneLamp.getId();
|
|
|
+ } else if (dType == 1) {
|
|
|
+ //1 摄像头
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("name",name);
|
|
|
+
|
|
|
+ VideoMonitorDTO oneMonitor = videoMonitorService.getOneMonitor(where);
|
|
|
+ if (oneMonitor == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneMonitor.getId();
|
|
|
+ } else if (dType == 2) {
|
|
|
+ //2 WIFI num
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("name",name);
|
|
|
+ WifiDTO oneWifi = WifiService.getOneWifi(where);
|
|
|
+ if (oneWifi == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneWifi.getId();
|
|
|
+ } else if (dType == 3) {
|
|
|
+ //3 RFID num
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("name",name);
|
|
|
+ RfidDTO oneRifd = rfidService.getOneRifd(where);
|
|
|
+ if (oneRifd == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneRifd.getId();
|
|
|
+ } else if (dType == 4) {
|
|
|
+ //4 LED屏
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("model",name);
|
|
|
+ ScreenDTO oneScreen = screenService.getOneScreen(where);
|
|
|
+ if (oneScreen == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneScreen.getId();
|
|
|
+ } else if (dType == 5) {
|
|
|
+ //5 一键报警,
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("model",name);
|
|
|
+ EmergencyDTO oneEmergency = emergencyService.getOneEmergency(where);
|
|
|
+ if (oneEmergency == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneEmergency.getId();
|
|
|
+ } else if (dType == 6) {
|
|
|
+ //6 充电桩,
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("model",name);
|
|
|
+ ChargeDTO oneCharge = chargeService.getOneCharge(where);
|
|
|
+ if (oneCharge == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneCharge.getId();
|
|
|
+ } else if (dType == 7) {
|
|
|
+ //7 气象站,8 微基站,9 音柱
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("model",name);
|
|
|
+ EnvmonitorDTO oneEnvmonitor = envmonitorService.getOneEnvmonitor(where);
|
|
|
+ if (oneEnvmonitor == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneEnvmonitor.getId();
|
|
|
+ }
|
|
|
+ } else if (devType == 2) {
|
|
|
+ //2 井盖, 3 水浸,4配电柜
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("name",name);
|
|
|
+ ManholeDTO oneManhole = manholeService.getOneManhole(where);
|
|
|
+ if (oneManhole == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneManhole.getId();
|
|
|
+ } else if (devType == 3) {
|
|
|
+ //3 水浸,4配电柜
|
|
|
+ where.put("number",number);
|
|
|
+ where.put("name",name);
|
|
|
+ WaterImmersionDevInfoDTO oneWaterImmersion = waterImmersionDevInfoService.getOneWaterImmersion(where);
|
|
|
+ if (oneWaterImmersion == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneWaterImmersion.getId();
|
|
|
+ } else {
|
|
|
+ //4配电柜
|
|
|
+ where.put("address",number);
|
|
|
+ where.put("name",name);
|
|
|
+ AirSwitchInfoDTO oneAirSwitch = airSwitchInfoService.getOneAirSwitch(where);
|
|
|
+ if (oneAirSwitch == null) return toolUtils.response(InterfaceResultEnum.CHECK_INFORMATION_ERROR,version);
|
|
|
+ id = oneAirSwitch.getId();
|
|
|
+ }
|
|
|
+ AllAlarmInfoLogDTO allAlarmInfoLogDTO = new AllAlarmInfoLogDTO();
|
|
|
+ allAlarmInfoLogDTO.setLampId(id);
|
|
|
+ allAlarmInfoLogDTO.setStrAlarmType(alarmType);
|
|
|
+ Integer timezone = timeZoneData.getTimezone();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String newCreatetime = "";
|
|
|
+ Date parse = null;
|
|
|
+ if (timezone > 0){
|
|
|
+
|
|
|
+ try {
|
|
|
+ parse = dateFormat.parse(createTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ long stamp = parse.getTime() / 1000 - timezone * 3600;
|
|
|
+ newCreatetime = dateFormat.format(new Date(stamp));
|
|
|
+ }else if (timezone < 0){
|
|
|
+ try {
|
|
|
+ parse = dateFormat.parse(createTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ long stamp = parse.getTime() / 1000 + timezone * 3600;
|
|
|
+ newCreatetime = dateFormat.format(new Date(stamp));
|
|
|
+ }
|
|
|
+ allAlarmInfoLogDTO.setUpdateTime(newCreatetime);
|
|
|
+ allAlarmInfoLogDTO.setDevType(devType);
|
|
|
+ allAlarmInfoLogDTO.setDType(dType);
|
|
|
+ allAlarmInfoLogDTO.setSource(source);
|
|
|
+ allAlarmInfoLogDTO.setLevel(level);
|
|
|
+ allAlarmInfoLogDTO.setAlarmStatus(alarmStatus);
|
|
|
+ allAlarmInfoLogService.addAlarmData(allAlarmInfoLogDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|