diff --git a/src/main/java/com/zcloud/controller/anemometer/AnemometerController.java b/src/main/java/com/zcloud/controller/anemometer/AnemometerController.java index 4e1cbf6c..1497587e 100644 --- a/src/main/java/com/zcloud/controller/anemometer/AnemometerController.java +++ b/src/main/java/com/zcloud/controller/anemometer/AnemometerController.java @@ -3,15 +3,24 @@ package com.zcloud.controller.anemometer; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; +import com.zcloud.service.alarm.AlarmInfoService; import com.zcloud.service.announcement.AnemometerLocalService; import com.zcloud.service.announcement.AnemometerMachineService; import com.zcloud.service.announcement.AnemometerService; import com.zcloud.service.gatemachine.GateAreaService; +import com.zcloud.util.DateUtil; import com.zcloud.util.ReturnMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Calendar; +import java.util.Date; import java.util.List; /** @@ -29,6 +38,8 @@ public class AnemometerController extends BaseController { private AnemometerLocalService anemometerLocalService; @Resource private AnemometerService anemometerService; + @Resource + private AlarmInfoService alarmInfoService; @RequestMapping(value = "/page") @@ -81,6 +92,57 @@ public class AnemometerController extends BaseController { ReturnMap returnMap = new ReturnMap(); PageData pd = this.getPageData(); List dataList = anemometerLocalService.detailListAll(pd); + List alarmCount = alarmInfoService.alarmCountForMap(pd); + if (alarmCount.size()>0) { + PageData pageData = alarmCount.get(0); + String timeString = pageData.getString("ALARM_TIME"); + //当前时间 时间戳 + Date currentDate = new Date(); + // 使用Calendar清空分钟、秒和毫秒 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(currentDate); + calendar.set(Calendar.MILLISECOND,0); + currentDate = calendar.getTime(); + //数据时间 时间戳 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date alarmDate = simpleDateFormat.parse(timeString); + //判断当前时间范围 + Date second0 = new Date(currentDate.getTime()); + Date second15 = new Date(currentDate.getTime()); + Date second30 = new Date(currentDate.getTime()); + Date second45 = new Date(currentDate.getTime()); + Date second60 = new Date(currentDate.getTime()); + second0.setSeconds(0); + second15.setSeconds(15); + second30.setSeconds(30); + second45.setSeconds(45); + second60.setSeconds(60); + if (currentDate.compareTo(second0) >= 0 && currentDate.compareTo(second15) < 0) { + if (alarmDate.compareTo(second0) >= 0 && alarmDate.compareTo(second15) < 0) { + returnMap.put("alarmCount",pageData.getString("ALARMCOUNT")); + } else { + returnMap.put("alarmCount","0"); + } + } else if (currentDate.compareTo(second15) >= 0 && currentDate.compareTo(second30) <0) { + if (alarmDate.compareTo(second15) >= 0 && alarmDate.compareTo(second30) < 0) { + returnMap.put("alarmCount",pageData.getString("ALARMCOUNT")); + } else { + returnMap.put("alarmCount","0"); + } + } else if (currentDate.compareTo(second30) >= 0 && currentDate.compareTo(second45) <0) { + if (alarmDate.compareTo(second30) >= 0 && alarmDate.compareTo(second45) < 0) { + returnMap.put("alarmCount",pageData.getString("ALARMCOUNT")); + } else { + returnMap.put("alarmCount","0"); + } + } else if (currentDate.compareTo(second45) >= 0 && currentDate.compareTo(second60) <0) { + if (alarmDate.compareTo(second45) >= 0 && alarmDate.compareTo(second60) < 0) { + returnMap.put("alarmCount",pageData.getString("ALARMCOUNT")); + } else { + returnMap.put("alarmCount","0"); + } + } + } returnMap.put("anemometerCount",dataList.size()); returnMap.put("varList",dataList); return returnMap; diff --git a/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java b/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java index 08cfba56..475b59f6 100644 --- a/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java +++ b/src/main/java/com/zcloud/controller/firemanager/app/AppFireRecordController.java @@ -518,6 +518,17 @@ public class AppFireRecordController extends BaseController { Map map = new HashMap(); String errInfo = "success"; PageData pd = this.getPageData(); + if (pd.getString("FIRE_CHECK_ID").equals("undefined") || pd.getString("FIRE_RECORD_ID").equals("undefined") ) { + pd.put("pointId",pd.getString("FIRE_POINT_ID")); + Page page = new Page(); + page.setPd(pd); + List dataList = fireCheckListService.getFireCheckListByAppV2(page); + if (dataList.size()>0) { + PageData pageData = dataList.get(0); + pd.put("FIRE_CHECK_ID",pageData.getString("FIRE_CHECK_ID")); + pd.put("FIRE_RECORD_ID",pageData.getString("FIRE_RECORD_ID")); + } + } List varList = fireCheckStandardService.getAppRiskByDevice(pd); map.put("result", errInfo); map.put("varData", varList); diff --git a/src/main/java/com/zcloud/controller/map/CmtMapController.java b/src/main/java/com/zcloud/controller/map/CmtMapController.java index 3386e9c4..65fabe27 100644 --- a/src/main/java/com/zcloud/controller/map/CmtMapController.java +++ b/src/main/java/com/zcloud/controller/map/CmtMapController.java @@ -297,6 +297,23 @@ public class CmtMapController extends BaseController { return map; } + @RequestMapping(value = "/fireDevice/listAllDeviceForMap") + @ResponseBody + public Object listAllDeviceForMap(Page page) { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + String corpinfoId = Jurisdiction.getCORPINFO_ID(); + pd.put("CORPINFO_ID", corpinfoId); + //获取当前人的公司id + page.setPd(pd); + List varList = fireResourcesService.deviceAlllistPage(page); + map.put("varList", varList); + map.put("page", page); + map.put("result", errInfo); + return map; + } + /** * 获取人员、车辆进出记录 * diff --git a/src/main/java/com/zcloud/mapper/datasource/alarm/AlarmInfoMapper.java b/src/main/java/com/zcloud/mapper/datasource/alarm/AlarmInfoMapper.java index 635f1a11..9d96ee00 100644 --- a/src/main/java/com/zcloud/mapper/datasource/alarm/AlarmInfoMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/alarm/AlarmInfoMapper.java @@ -49,6 +49,8 @@ public interface AlarmInfoMapper { */ PageData findById(PageData pd); + List alarmCountForMap(PageData pd); + /**批量删除 * @param ArrayDATA_IDS * @throws Exception diff --git a/src/main/java/com/zcloud/mapper/dsno2/fireresources/CmtFireResourcesMapper.java b/src/main/java/com/zcloud/mapper/dsno2/fireresources/CmtFireResourcesMapper.java index 590fbb1b..a50c8756 100644 --- a/src/main/java/com/zcloud/mapper/dsno2/fireresources/CmtFireResourcesMapper.java +++ b/src/main/java/com/zcloud/mapper/dsno2/fireresources/CmtFireResourcesMapper.java @@ -64,5 +64,7 @@ public interface CmtFireResourcesMapper { List devicelistPage(Page page); + List deviceAlllistPage(Page page); + List getPointCheckPhotoById(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/alarm/AlarmInfoService.java b/src/main/java/com/zcloud/service/alarm/AlarmInfoService.java index ee6b4863..3b93d865 100644 --- a/src/main/java/com/zcloud/service/alarm/AlarmInfoService.java +++ b/src/main/java/com/zcloud/service/alarm/AlarmInfoService.java @@ -49,6 +49,8 @@ public interface AlarmInfoService { */ public PageData findById(PageData pd)throws Exception; + public List alarmCountForMap(PageData pd)throws Exception; + /**批量删除 * @param ArrayDATA_IDS * @throws Exception diff --git a/src/main/java/com/zcloud/service/alarm/impl/AlarmInfoServiceImpl.java b/src/main/java/com/zcloud/service/alarm/impl/AlarmInfoServiceImpl.java index d22a86b0..23da06f8 100644 --- a/src/main/java/com/zcloud/service/alarm/impl/AlarmInfoServiceImpl.java +++ b/src/main/java/com/zcloud/service/alarm/impl/AlarmInfoServiceImpl.java @@ -90,6 +90,14 @@ public class AlarmInfoServiceImpl implements AlarmInfoService { return alarmInfoMapper.findById(pd); } + /**通过id获取数据 + * @param pd + * @throws Exception + */ + public List alarmCountForMap(PageData pd)throws Exception{ + return alarmInfoMapper.alarmCountForMap(pd); + } + /**批量删除 * @param ArrayDATA_IDS * @throws Exception diff --git a/src/main/java/com/zcloud/service/fireresources/CmtFireResourcesService.java b/src/main/java/com/zcloud/service/fireresources/CmtFireResourcesService.java index cb626464..25db51eb 100644 --- a/src/main/java/com/zcloud/service/fireresources/CmtFireResourcesService.java +++ b/src/main/java/com/zcloud/service/fireresources/CmtFireResourcesService.java @@ -59,4 +59,6 @@ public interface CmtFireResourcesService { List goRecordDeviceByPid(PageData pd); List devicelistPage(Page page); + + List deviceAlllistPage(Page page); } diff --git a/src/main/java/com/zcloud/service/fireresources/impl/CmtFireResourcesServiceImpl.java b/src/main/java/com/zcloud/service/fireresources/impl/CmtFireResourcesServiceImpl.java index 682cd153..634a475d 100644 --- a/src/main/java/com/zcloud/service/fireresources/impl/CmtFireResourcesServiceImpl.java +++ b/src/main/java/com/zcloud/service/fireresources/impl/CmtFireResourcesServiceImpl.java @@ -133,4 +133,9 @@ public class CmtFireResourcesServiceImpl implements CmtFireResourcesService { public List devicelistPage(Page page) { return czksfireResourcesMapper.devicelistPage(page); } + + @Override + public List deviceAlllistPage(Page page) { + return czksfireResourcesMapper.deviceAlllistPage(page); + } } diff --git a/src/main/java/com/zcloud/util/SaveAnemometerInfoScheduled.java b/src/main/java/com/zcloud/util/SaveAnemometerInfoScheduled.java index 1d793ae2..0c3af353 100644 --- a/src/main/java/com/zcloud/util/SaveAnemometerInfoScheduled.java +++ b/src/main/java/com/zcloud/util/SaveAnemometerInfoScheduled.java @@ -66,6 +66,7 @@ public class SaveAnemometerInfoScheduled { PageData tPd = new PageData(); tPd.put("DICT_NAME","风速仪"); List levelList = alarmInfoService.findThreshold(tPd); + String date = DateUtil.date2Str(new Date()); for (PageData codeData : anemometerList) { //若风速大于阈值则存储报警信息 for (PageData data : levelList) { @@ -73,7 +74,7 @@ public class SaveAnemometerInfoScheduled { PageData alarmPd = new PageData(); alarmPd.put("ALARM_INFO_ID",UuidUtil.get32UUID()); alarmPd.put("ALARM_VALUE",codeData.getString("FVALUE")); - alarmPd.put("ALARM_TIME",DateUtil.date2Str(new Date())); + alarmPd.put("ALARM_TIME",date); alarmPd.put("LEVEL",data.getString("LEVELNAME")); alarmPd.put("CREATOR","c5187fb9565649a89267f9adf6b0fab6"); alarmPd.put("CREATTIME",DateUtil.date2Str(new Date())); diff --git a/src/main/resources/mybatis/datasource/alarm/AlarmInfoMapper.xml b/src/main/resources/mybatis/datasource/alarm/AlarmInfoMapper.xml index f035db91..7098472f 100644 --- a/src/main/resources/mybatis/datasource/alarm/AlarmInfoMapper.xml +++ b/src/main/resources/mybatis/datasource/alarm/AlarmInfoMapper.xml @@ -114,6 +114,17 @@ f.ALARM_INFO_ID=#{ALARM_INFO_ID} + + + +