diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java index dd78530..610fb33 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java @@ -16,6 +16,8 @@ import org.hswebframework.expands.office.excel.ExcelIO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,7 +61,7 @@ @ResponseBody public Object listByDevice(String devcode, String beginTime, String endTime) { Page page = new PageFactory().defaultPage(); - List lists = gasFlowService.listByDevice(page,devcode, beginTime, endTime); + List lists = gasFlowService.listByDevice(page, devcode, beginTime, endTime); page.setRecords(lists); return ResponseData.success(lists); } @@ -71,23 +73,25 @@ Page page = new PageFactory().defaultPage(); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); - List list = deviceService.selectDataScopePage(dataScope, page, "15", "", beginTime, endTime, keywords, "", areaId); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", beginTime, endTime, keywords, "", areaId)); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", beginTime, endTime, keywords, "", areaId)); + List list = deviceService.selectDataScopePage(dataScope, page, "15", "", null, null, keywords, "", areaId); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", null, null, keywords, "", areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", null, null, keywords, "", areaId)); String date = sdf.format(new Date()); List> viewList = new ArrayList<>(); list.forEach(deviceDto -> { Map viewMap = gasFlowService.selectLatestGasFlow(deviceDto.getDevcode()); if (viewMap == null) { viewMap = new HashMap<>(); - viewMap.put("yearCount", "0"); + viewMap.put("yearCount", 0); viewMap.put("upTime", sdf4.format(new Date())); - viewMap.put("totalFlow", ""); - viewMap.put("instantFlow", ""); - viewMap.put("instantVelocity", ""); - viewMap.put("ambocetorTemperture", ""); - viewMap.put("LogTime", sdf4.format(new Date())); + viewMap.put("totalFlow", 0); + viewMap.put("instantFlow", 0); + viewMap.put("instantVelocity", 0); + viewMap.put("ambocetorTemperture", 0); + viewMap.put("logTime", sdf4.format(new Date())); } + Integer peroidCount = gasFlowService.selectPhaseGasFlow(deviceDto.getDevcode(), beginTime, endTime); + viewMap.put("peroidCount", ObjectUtils.isEmpty(peroidCount) ? 0 : peroidCount); viewMap.put("devcode", deviceDto.getDevcode()); viewMap.put("wellCode", deviceDto.getWellCode()); viewMap.put("deviceTypeName", deviceDto.getDeviceTypeName()); @@ -125,16 +129,20 @@ Page> page = new PageFactory>().defaultPage(); String keywords = httpServletRequest.getParameter("keywords"); String areaId = httpServletRequest.getParameter("areaId"); + String beginTime = httpServletRequest.getParameter("beginTime"); + String endTime = httpServletRequest.getParameter("endTime"); page.setLimit(maxRowsExcel); page.setSize(maxRowsExcel); page.setOffset(0); + page.setCurrent(1); page.setSearchCount(false); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); +// List> list = ; List> list = deviceService.selectDataScopePage(dataScope, page, "15", "", keywords, areaId); - + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", keywords, areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", keywords, areaId)); String date = sdf.format(new Date()); - list.forEach(deviceDto -> { // 获取日月年用水量和最近的读数 Map dayGasFlowDay = gasFlowService.selectGasFlowDay(deviceDto.get("DEVCODE").toString(), date); @@ -181,7 +189,11 @@ httpServletResponse.setContentType("application/octet-stream"); httpServletResponse.addHeader("Content-Disposition", " attachment;filename=" + "GasFlowList.xlsx"); Map var = new HashMap<>(); - var.put("标题", "设备数据列表"); + String tempTime = ""; + if (StringUtils.isEmpty(beginTime)) { + tempTime = beginTime + "-" + endTime; + } + var.put("标题", "燃气设备数据列表"+tempTime); var.put("list", list); ExcelIO.writeTemplate(fileInputStream, httpServletResponse.getOutputStream(), var); diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java index dd78530..610fb33 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java @@ -16,6 +16,8 @@ import org.hswebframework.expands.office.excel.ExcelIO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,7 +61,7 @@ @ResponseBody public Object listByDevice(String devcode, String beginTime, String endTime) { Page page = new PageFactory().defaultPage(); - List lists = gasFlowService.listByDevice(page,devcode, beginTime, endTime); + List lists = gasFlowService.listByDevice(page, devcode, beginTime, endTime); page.setRecords(lists); return ResponseData.success(lists); } @@ -71,23 +73,25 @@ Page page = new PageFactory().defaultPage(); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); - List list = deviceService.selectDataScopePage(dataScope, page, "15", "", beginTime, endTime, keywords, "", areaId); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", beginTime, endTime, keywords, "", areaId)); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", beginTime, endTime, keywords, "", areaId)); + List list = deviceService.selectDataScopePage(dataScope, page, "15", "", null, null, keywords, "", areaId); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", null, null, keywords, "", areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", null, null, keywords, "", areaId)); String date = sdf.format(new Date()); List> viewList = new ArrayList<>(); list.forEach(deviceDto -> { Map viewMap = gasFlowService.selectLatestGasFlow(deviceDto.getDevcode()); if (viewMap == null) { viewMap = new HashMap<>(); - viewMap.put("yearCount", "0"); + viewMap.put("yearCount", 0); viewMap.put("upTime", sdf4.format(new Date())); - viewMap.put("totalFlow", ""); - viewMap.put("instantFlow", ""); - viewMap.put("instantVelocity", ""); - viewMap.put("ambocetorTemperture", ""); - viewMap.put("LogTime", sdf4.format(new Date())); + viewMap.put("totalFlow", 0); + viewMap.put("instantFlow", 0); + viewMap.put("instantVelocity", 0); + viewMap.put("ambocetorTemperture", 0); + viewMap.put("logTime", sdf4.format(new Date())); } + Integer peroidCount = gasFlowService.selectPhaseGasFlow(deviceDto.getDevcode(), beginTime, endTime); + viewMap.put("peroidCount", ObjectUtils.isEmpty(peroidCount) ? 0 : peroidCount); viewMap.put("devcode", deviceDto.getDevcode()); viewMap.put("wellCode", deviceDto.getWellCode()); viewMap.put("deviceTypeName", deviceDto.getDeviceTypeName()); @@ -125,16 +129,20 @@ Page> page = new PageFactory>().defaultPage(); String keywords = httpServletRequest.getParameter("keywords"); String areaId = httpServletRequest.getParameter("areaId"); + String beginTime = httpServletRequest.getParameter("beginTime"); + String endTime = httpServletRequest.getParameter("endTime"); page.setLimit(maxRowsExcel); page.setSize(maxRowsExcel); page.setOffset(0); + page.setCurrent(1); page.setSearchCount(false); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); +// List> list = ; List> list = deviceService.selectDataScopePage(dataScope, page, "15", "", keywords, areaId); - + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", keywords, areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", keywords, areaId)); String date = sdf.format(new Date()); - list.forEach(deviceDto -> { // 获取日月年用水量和最近的读数 Map dayGasFlowDay = gasFlowService.selectGasFlowDay(deviceDto.get("DEVCODE").toString(), date); @@ -181,7 +189,11 @@ httpServletResponse.setContentType("application/octet-stream"); httpServletResponse.addHeader("Content-Disposition", " attachment;filename=" + "GasFlowList.xlsx"); Map var = new HashMap<>(); - var.put("标题", "设备数据列表"); + String tempTime = ""; + if (StringUtils.isEmpty(beginTime)) { + tempTime = beginTime + "-" + endTime; + } + var.put("标题", "燃气设备数据列表"+tempTime); var.put("list", list); ExcelIO.writeTemplate(fileInputStream, httpServletResponse.getOutputStream(), var); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java index 30a7720..6ce659f 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java @@ -25,14 +25,16 @@ List selectDeviceForMap(@Param("devType") String devType, @Param("keywords") String keywords); DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode); + DeviceWellDto selectWellByDevcode(@Param("devcode") String devcode); + List getAreaIds(@Param("areaId") Long areaId); String getArea(@Param("id") String id); String getAreaPId(@Param("id") String id); - List> getAllArea(); + List> getAllArea(); DeviceConcentratorDto selectDeviceConcentorByCode(@Param("concenCode") String concenCode); @@ -72,7 +74,8 @@ List> selectHarmfulDataList(@Param("dataScope") DataScope dataScope, @Param("wellCode") String wellCode, @Param("beginTime") String beginTime, @Param("endTime") String endTime); - List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); + List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, + @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); Map selectWaterMeterDay(@Param("devcode") String devcode, @Param("date") String date); diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java index dd78530..610fb33 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java @@ -16,6 +16,8 @@ import org.hswebframework.expands.office.excel.ExcelIO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,7 +61,7 @@ @ResponseBody public Object listByDevice(String devcode, String beginTime, String endTime) { Page page = new PageFactory().defaultPage(); - List lists = gasFlowService.listByDevice(page,devcode, beginTime, endTime); + List lists = gasFlowService.listByDevice(page, devcode, beginTime, endTime); page.setRecords(lists); return ResponseData.success(lists); } @@ -71,23 +73,25 @@ Page page = new PageFactory().defaultPage(); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); - List list = deviceService.selectDataScopePage(dataScope, page, "15", "", beginTime, endTime, keywords, "", areaId); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", beginTime, endTime, keywords, "", areaId)); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", beginTime, endTime, keywords, "", areaId)); + List list = deviceService.selectDataScopePage(dataScope, page, "15", "", null, null, keywords, "", areaId); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", null, null, keywords, "", areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", null, null, keywords, "", areaId)); String date = sdf.format(new Date()); List> viewList = new ArrayList<>(); list.forEach(deviceDto -> { Map viewMap = gasFlowService.selectLatestGasFlow(deviceDto.getDevcode()); if (viewMap == null) { viewMap = new HashMap<>(); - viewMap.put("yearCount", "0"); + viewMap.put("yearCount", 0); viewMap.put("upTime", sdf4.format(new Date())); - viewMap.put("totalFlow", ""); - viewMap.put("instantFlow", ""); - viewMap.put("instantVelocity", ""); - viewMap.put("ambocetorTemperture", ""); - viewMap.put("LogTime", sdf4.format(new Date())); + viewMap.put("totalFlow", 0); + viewMap.put("instantFlow", 0); + viewMap.put("instantVelocity", 0); + viewMap.put("ambocetorTemperture", 0); + viewMap.put("logTime", sdf4.format(new Date())); } + Integer peroidCount = gasFlowService.selectPhaseGasFlow(deviceDto.getDevcode(), beginTime, endTime); + viewMap.put("peroidCount", ObjectUtils.isEmpty(peroidCount) ? 0 : peroidCount); viewMap.put("devcode", deviceDto.getDevcode()); viewMap.put("wellCode", deviceDto.getWellCode()); viewMap.put("deviceTypeName", deviceDto.getDeviceTypeName()); @@ -125,16 +129,20 @@ Page> page = new PageFactory>().defaultPage(); String keywords = httpServletRequest.getParameter("keywords"); String areaId = httpServletRequest.getParameter("areaId"); + String beginTime = httpServletRequest.getParameter("beginTime"); + String endTime = httpServletRequest.getParameter("endTime"); page.setLimit(maxRowsExcel); page.setSize(maxRowsExcel); page.setOffset(0); + page.setCurrent(1); page.setSearchCount(false); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); +// List> list = ; List> list = deviceService.selectDataScopePage(dataScope, page, "15", "", keywords, areaId); - + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", keywords, areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", keywords, areaId)); String date = sdf.format(new Date()); - list.forEach(deviceDto -> { // 获取日月年用水量和最近的读数 Map dayGasFlowDay = gasFlowService.selectGasFlowDay(deviceDto.get("DEVCODE").toString(), date); @@ -181,7 +189,11 @@ httpServletResponse.setContentType("application/octet-stream"); httpServletResponse.addHeader("Content-Disposition", " attachment;filename=" + "GasFlowList.xlsx"); Map var = new HashMap<>(); - var.put("标题", "设备数据列表"); + String tempTime = ""; + if (StringUtils.isEmpty(beginTime)) { + tempTime = beginTime + "-" + endTime; + } + var.put("标题", "燃气设备数据列表"+tempTime); var.put("list", list); ExcelIO.writeTemplate(fileInputStream, httpServletResponse.getOutputStream(), var); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java index 30a7720..6ce659f 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java @@ -25,14 +25,16 @@ List selectDeviceForMap(@Param("devType") String devType, @Param("keywords") String keywords); DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode); + DeviceWellDto selectWellByDevcode(@Param("devcode") String devcode); + List getAreaIds(@Param("areaId") Long areaId); String getArea(@Param("id") String id); String getAreaPId(@Param("id") String id); - List> getAllArea(); + List> getAllArea(); DeviceConcentratorDto selectDeviceConcentorByCode(@Param("concenCode") String concenCode); @@ -72,7 +74,8 @@ List> selectHarmfulDataList(@Param("dataScope") DataScope dataScope, @Param("wellCode") String wellCode, @Param("beginTime") String beginTime, @Param("endTime") String endTime); - List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); + List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, + @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); Map selectWaterMeterDay(@Param("devcode") String devcode, @Param("date") String date); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java index 1b21738..33f8a68 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java @@ -20,6 +20,9 @@ Map selectLatestGasFlow(@Param("devcode") String devcode); + Integer selectPhaseGasFlow(@Param("devcode") String devcode, + @Param("beginTime") String beginTime,@Param("endTime") String endTime); + String getGasFlowCount(); diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java index dd78530..610fb33 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java @@ -16,6 +16,8 @@ import org.hswebframework.expands.office.excel.ExcelIO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,7 +61,7 @@ @ResponseBody public Object listByDevice(String devcode, String beginTime, String endTime) { Page page = new PageFactory().defaultPage(); - List lists = gasFlowService.listByDevice(page,devcode, beginTime, endTime); + List lists = gasFlowService.listByDevice(page, devcode, beginTime, endTime); page.setRecords(lists); return ResponseData.success(lists); } @@ -71,23 +73,25 @@ Page page = new PageFactory().defaultPage(); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); - List list = deviceService.selectDataScopePage(dataScope, page, "15", "", beginTime, endTime, keywords, "", areaId); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", beginTime, endTime, keywords, "", areaId)); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", beginTime, endTime, keywords, "", areaId)); + List list = deviceService.selectDataScopePage(dataScope, page, "15", "", null, null, keywords, "", areaId); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", null, null, keywords, "", areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", null, null, keywords, "", areaId)); String date = sdf.format(new Date()); List> viewList = new ArrayList<>(); list.forEach(deviceDto -> { Map viewMap = gasFlowService.selectLatestGasFlow(deviceDto.getDevcode()); if (viewMap == null) { viewMap = new HashMap<>(); - viewMap.put("yearCount", "0"); + viewMap.put("yearCount", 0); viewMap.put("upTime", sdf4.format(new Date())); - viewMap.put("totalFlow", ""); - viewMap.put("instantFlow", ""); - viewMap.put("instantVelocity", ""); - viewMap.put("ambocetorTemperture", ""); - viewMap.put("LogTime", sdf4.format(new Date())); + viewMap.put("totalFlow", 0); + viewMap.put("instantFlow", 0); + viewMap.put("instantVelocity", 0); + viewMap.put("ambocetorTemperture", 0); + viewMap.put("logTime", sdf4.format(new Date())); } + Integer peroidCount = gasFlowService.selectPhaseGasFlow(deviceDto.getDevcode(), beginTime, endTime); + viewMap.put("peroidCount", ObjectUtils.isEmpty(peroidCount) ? 0 : peroidCount); viewMap.put("devcode", deviceDto.getDevcode()); viewMap.put("wellCode", deviceDto.getWellCode()); viewMap.put("deviceTypeName", deviceDto.getDeviceTypeName()); @@ -125,16 +129,20 @@ Page> page = new PageFactory>().defaultPage(); String keywords = httpServletRequest.getParameter("keywords"); String areaId = httpServletRequest.getParameter("areaId"); + String beginTime = httpServletRequest.getParameter("beginTime"); + String endTime = httpServletRequest.getParameter("endTime"); page.setLimit(maxRowsExcel); page.setSize(maxRowsExcel); page.setOffset(0); + page.setCurrent(1); page.setSearchCount(false); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); +// List> list = ; List> list = deviceService.selectDataScopePage(dataScope, page, "15", "", keywords, areaId); - + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", keywords, areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", keywords, areaId)); String date = sdf.format(new Date()); - list.forEach(deviceDto -> { // 获取日月年用水量和最近的读数 Map dayGasFlowDay = gasFlowService.selectGasFlowDay(deviceDto.get("DEVCODE").toString(), date); @@ -181,7 +189,11 @@ httpServletResponse.setContentType("application/octet-stream"); httpServletResponse.addHeader("Content-Disposition", " attachment;filename=" + "GasFlowList.xlsx"); Map var = new HashMap<>(); - var.put("标题", "设备数据列表"); + String tempTime = ""; + if (StringUtils.isEmpty(beginTime)) { + tempTime = beginTime + "-" + endTime; + } + var.put("标题", "燃气设备数据列表"+tempTime); var.put("list", list); ExcelIO.writeTemplate(fileInputStream, httpServletResponse.getOutputStream(), var); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java index 30a7720..6ce659f 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java @@ -25,14 +25,16 @@ List selectDeviceForMap(@Param("devType") String devType, @Param("keywords") String keywords); DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode); + DeviceWellDto selectWellByDevcode(@Param("devcode") String devcode); + List getAreaIds(@Param("areaId") Long areaId); String getArea(@Param("id") String id); String getAreaPId(@Param("id") String id); - List> getAllArea(); + List> getAllArea(); DeviceConcentratorDto selectDeviceConcentorByCode(@Param("concenCode") String concenCode); @@ -72,7 +74,8 @@ List> selectHarmfulDataList(@Param("dataScope") DataScope dataScope, @Param("wellCode") String wellCode, @Param("beginTime") String beginTime, @Param("endTime") String endTime); - List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); + List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, + @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); Map selectWaterMeterDay(@Param("devcode") String devcode, @Param("date") String date); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java index 1b21738..33f8a68 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java @@ -20,6 +20,9 @@ Map selectLatestGasFlow(@Param("devcode") String devcode); + Integer selectPhaseGasFlow(@Param("devcode") String devcode, + @Param("beginTime") String beginTime,@Param("endTime") String endTime); + String getGasFlowCount(); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml index 8564bba..0000e65 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml @@ -110,13 +110,7 @@ and onlineState = #{isOnline} - - and installDate > - - - and installDate < - - + and (DEVCODE LIKE diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java index dd78530..610fb33 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java @@ -16,6 +16,8 @@ import org.hswebframework.expands.office.excel.ExcelIO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,7 +61,7 @@ @ResponseBody public Object listByDevice(String devcode, String beginTime, String endTime) { Page page = new PageFactory().defaultPage(); - List lists = gasFlowService.listByDevice(page,devcode, beginTime, endTime); + List lists = gasFlowService.listByDevice(page, devcode, beginTime, endTime); page.setRecords(lists); return ResponseData.success(lists); } @@ -71,23 +73,25 @@ Page page = new PageFactory().defaultPage(); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); - List list = deviceService.selectDataScopePage(dataScope, page, "15", "", beginTime, endTime, keywords, "", areaId); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", beginTime, endTime, keywords, "", areaId)); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", beginTime, endTime, keywords, "", areaId)); + List list = deviceService.selectDataScopePage(dataScope, page, "15", "", null, null, keywords, "", areaId); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", null, null, keywords, "", areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", null, null, keywords, "", areaId)); String date = sdf.format(new Date()); List> viewList = new ArrayList<>(); list.forEach(deviceDto -> { Map viewMap = gasFlowService.selectLatestGasFlow(deviceDto.getDevcode()); if (viewMap == null) { viewMap = new HashMap<>(); - viewMap.put("yearCount", "0"); + viewMap.put("yearCount", 0); viewMap.put("upTime", sdf4.format(new Date())); - viewMap.put("totalFlow", ""); - viewMap.put("instantFlow", ""); - viewMap.put("instantVelocity", ""); - viewMap.put("ambocetorTemperture", ""); - viewMap.put("LogTime", sdf4.format(new Date())); + viewMap.put("totalFlow", 0); + viewMap.put("instantFlow", 0); + viewMap.put("instantVelocity", 0); + viewMap.put("ambocetorTemperture", 0); + viewMap.put("logTime", sdf4.format(new Date())); } + Integer peroidCount = gasFlowService.selectPhaseGasFlow(deviceDto.getDevcode(), beginTime, endTime); + viewMap.put("peroidCount", ObjectUtils.isEmpty(peroidCount) ? 0 : peroidCount); viewMap.put("devcode", deviceDto.getDevcode()); viewMap.put("wellCode", deviceDto.getWellCode()); viewMap.put("deviceTypeName", deviceDto.getDeviceTypeName()); @@ -125,16 +129,20 @@ Page> page = new PageFactory>().defaultPage(); String keywords = httpServletRequest.getParameter("keywords"); String areaId = httpServletRequest.getParameter("areaId"); + String beginTime = httpServletRequest.getParameter("beginTime"); + String endTime = httpServletRequest.getParameter("endTime"); page.setLimit(maxRowsExcel); page.setSize(maxRowsExcel); page.setOffset(0); + page.setCurrent(1); page.setSearchCount(false); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); +// List> list = ; List> list = deviceService.selectDataScopePage(dataScope, page, "15", "", keywords, areaId); - + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", keywords, areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", keywords, areaId)); String date = sdf.format(new Date()); - list.forEach(deviceDto -> { // 获取日月年用水量和最近的读数 Map dayGasFlowDay = gasFlowService.selectGasFlowDay(deviceDto.get("DEVCODE").toString(), date); @@ -181,7 +189,11 @@ httpServletResponse.setContentType("application/octet-stream"); httpServletResponse.addHeader("Content-Disposition", " attachment;filename=" + "GasFlowList.xlsx"); Map var = new HashMap<>(); - var.put("标题", "设备数据列表"); + String tempTime = ""; + if (StringUtils.isEmpty(beginTime)) { + tempTime = beginTime + "-" + endTime; + } + var.put("标题", "燃气设备数据列表"+tempTime); var.put("list", list); ExcelIO.writeTemplate(fileInputStream, httpServletResponse.getOutputStream(), var); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java index 30a7720..6ce659f 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java @@ -25,14 +25,16 @@ List selectDeviceForMap(@Param("devType") String devType, @Param("keywords") String keywords); DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode); + DeviceWellDto selectWellByDevcode(@Param("devcode") String devcode); + List getAreaIds(@Param("areaId") Long areaId); String getArea(@Param("id") String id); String getAreaPId(@Param("id") String id); - List> getAllArea(); + List> getAllArea(); DeviceConcentratorDto selectDeviceConcentorByCode(@Param("concenCode") String concenCode); @@ -72,7 +74,8 @@ List> selectHarmfulDataList(@Param("dataScope") DataScope dataScope, @Param("wellCode") String wellCode, @Param("beginTime") String beginTime, @Param("endTime") String endTime); - List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); + List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, + @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); Map selectWaterMeterDay(@Param("devcode") String devcode, @Param("date") String date); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java index 1b21738..33f8a68 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java @@ -20,6 +20,9 @@ Map selectLatestGasFlow(@Param("devcode") String devcode); + Integer selectPhaseGasFlow(@Param("devcode") String devcode, + @Param("beginTime") String beginTime,@Param("endTime") String endTime); + String getGasFlowCount(); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml index 8564bba..0000e65 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml @@ -110,13 +110,7 @@ and onlineState = #{isOnline} - - and installDate > - - - and installDate < - - + and (DEVCODE LIKE diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml index 9fffd53..644ac08 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml @@ -16,6 +16,13 @@ + + #{endTime} + + + #{beginTime} + + + + SELECT dwd.DEVCODE, dwD.DATE, dwd.TOTAL_FLOW_DATE from data_gasflow_day as dwd @@ -52,6 +59,18 @@ ORDER BY UPTIME DESC LIMIT 1 + + SELECT dwd.DEVCODE, dwD.DATE, dwd.TOTAL_FLOW_DATE from data_gasflow_day as dwd @@ -52,6 +59,18 @@ ORDER BY UPTIME DESC LIMIT 1 + + SELECT dwd.DEVCODE, dwD.DATE, dwd.TOTAL_FLOW_DATE from data_gasflow_day as dwd @@ -52,6 +59,18 @@ ORDER BY UPTIME DESC LIMIT 1 + + SELECT dwd.DEVCODE, dwD.DATE, dwd.TOTAL_FLOW_DATE from data_gasflow_day as dwd @@ -52,6 +59,18 @@ ORDER BY UPTIME DESC LIMIT 1 + + - SELECT CAST(SUM(total_Flow) AS DECIMAL (10, 2)) AS sumComm + SELECT + ifnull(CAST(SUM(total_Flow) AS DECIMAL (10, 2)),0.00) AS sumComm FROM ( SELECT total_Flow, @@ -45,7 +46,7 @@ SELECT - cast( SUM( TOTAL_FLOW_DATE ) AS DECIMAL ( 10, 2 ) ) AS sumComm + ifnull(cast( SUM( TOTAL_FLOW_DATE ) AS DECIMAL ( 10, 2 ) ),0.00) AS sumComm FROM ( SELECT diff --git a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml index 0242c20..77f8c24 100644 --- a/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml +++ b/casic-alarm/src/main/java/com/casic/missiles/modular/system/dao/mapping/AlarmRecordsMapper.xml @@ -60,6 +60,7 @@ and ar.WELL_CODE like concat('%',CONCAT(#{keywords},'%')) + OR ar.DEVCODE like concat('%',CONCAT(#{keywords},'%')) AND ar.ALARM_TYPE = #{alarmType} diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java index dd78530..610fb33 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/controller/GasFlowDataController.java @@ -16,6 +16,8 @@ import org.hswebframework.expands.office.excel.ExcelIO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,7 +61,7 @@ @ResponseBody public Object listByDevice(String devcode, String beginTime, String endTime) { Page page = new PageFactory().defaultPage(); - List lists = gasFlowService.listByDevice(page,devcode, beginTime, endTime); + List lists = gasFlowService.listByDevice(page, devcode, beginTime, endTime); page.setRecords(lists); return ResponseData.success(lists); } @@ -71,23 +73,25 @@ Page page = new PageFactory().defaultPage(); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); - List list = deviceService.selectDataScopePage(dataScope, page, "15", "", beginTime, endTime, keywords, "", areaId); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", beginTime, endTime, keywords, "", areaId)); - list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", beginTime, endTime, keywords, "", areaId)); + List list = deviceService.selectDataScopePage(dataScope, page, "15", "", null, null, keywords, "", areaId); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", null, null, keywords, "", areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", null, null, keywords, "", areaId)); String date = sdf.format(new Date()); List> viewList = new ArrayList<>(); list.forEach(deviceDto -> { Map viewMap = gasFlowService.selectLatestGasFlow(deviceDto.getDevcode()); if (viewMap == null) { viewMap = new HashMap<>(); - viewMap.put("yearCount", "0"); + viewMap.put("yearCount", 0); viewMap.put("upTime", sdf4.format(new Date())); - viewMap.put("totalFlow", ""); - viewMap.put("instantFlow", ""); - viewMap.put("instantVelocity", ""); - viewMap.put("ambocetorTemperture", ""); - viewMap.put("LogTime", sdf4.format(new Date())); + viewMap.put("totalFlow", 0); + viewMap.put("instantFlow", 0); + viewMap.put("instantVelocity", 0); + viewMap.put("ambocetorTemperture", 0); + viewMap.put("logTime", sdf4.format(new Date())); } + Integer peroidCount = gasFlowService.selectPhaseGasFlow(deviceDto.getDevcode(), beginTime, endTime); + viewMap.put("peroidCount", ObjectUtils.isEmpty(peroidCount) ? 0 : peroidCount); viewMap.put("devcode", deviceDto.getDevcode()); viewMap.put("wellCode", deviceDto.getWellCode()); viewMap.put("deviceTypeName", deviceDto.getDeviceTypeName()); @@ -125,16 +129,20 @@ Page> page = new PageFactory>().defaultPage(); String keywords = httpServletRequest.getParameter("keywords"); String areaId = httpServletRequest.getParameter("areaId"); + String beginTime = httpServletRequest.getParameter("beginTime"); + String endTime = httpServletRequest.getParameter("endTime"); page.setLimit(maxRowsExcel); page.setSize(maxRowsExcel); page.setOffset(0); + page.setCurrent(1); page.setSearchCount(false); //查询数据权限 使用默认DEPTID 字段 DataScope dataScope = permissionService.getCurrUserDataScope(); +// List> list = ; List> list = deviceService.selectDataScopePage(dataScope, page, "15", "", keywords, areaId); - + list.addAll(deviceService.selectDataScopePage(dataScope, page, "16", "", keywords, areaId)); + list.addAll(deviceService.selectDataScopePage(dataScope, page, "17", "", keywords, areaId)); String date = sdf.format(new Date()); - list.forEach(deviceDto -> { // 获取日月年用水量和最近的读数 Map dayGasFlowDay = gasFlowService.selectGasFlowDay(deviceDto.get("DEVCODE").toString(), date); @@ -181,7 +189,11 @@ httpServletResponse.setContentType("application/octet-stream"); httpServletResponse.addHeader("Content-Disposition", " attachment;filename=" + "GasFlowList.xlsx"); Map var = new HashMap<>(); - var.put("标题", "设备数据列表"); + String tempTime = ""; + if (StringUtils.isEmpty(beginTime)) { + tempTime = beginTime + "-" + endTime; + } + var.put("标题", "燃气设备数据列表"+tempTime); var.put("list", list); ExcelIO.writeTemplate(fileInputStream, httpServletResponse.getOutputStream(), var); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java index 30a7720..6ce659f 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/DeviceMapper.java @@ -25,14 +25,16 @@ List selectDeviceForMap(@Param("devType") String devType, @Param("keywords") String keywords); DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode); + DeviceWellDto selectWellByDevcode(@Param("devcode") String devcode); + List getAreaIds(@Param("areaId") Long areaId); String getArea(@Param("id") String id); String getAreaPId(@Param("id") String id); - List> getAllArea(); + List> getAllArea(); DeviceConcentratorDto selectDeviceConcentorByCode(@Param("concenCode") String concenCode); @@ -72,7 +74,8 @@ List> selectHarmfulDataList(@Param("dataScope") DataScope dataScope, @Param("wellCode") String wellCode, @Param("beginTime") String beginTime, @Param("endTime") String endTime); - List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); + List> selectWaterMeterDeviceListScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page> page, @Param("deviceType") String deviceType, + @Param("deptid") String deptid, @Param("keywords") String keywords, @Param("areaId") String areaId); Map selectWaterMeterDay(@Param("devcode") String devcode, @Param("date") String date); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java index 1b21738..33f8a68 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/GasFlowMapper.java @@ -20,6 +20,9 @@ Map selectLatestGasFlow(@Param("devcode") String devcode); + Integer selectPhaseGasFlow(@Param("devcode") String devcode, + @Param("beginTime") String beginTime,@Param("endTime") String endTime); + String getGasFlowCount(); diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml index 8564bba..0000e65 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/DeviceMapper.xml @@ -110,13 +110,7 @@ and onlineState = #{isOnline} - - and installDate > - - - and installDate < - - + and (DEVCODE LIKE diff --git a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml index 9fffd53..644ac08 100644 --- a/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml +++ b/casic-device/src/main/java/com/casic/missiles/modular/system/dao/mapping/GasFlowMapper.xml @@ -16,6 +16,13 @@ + + #{endTime} + + + #{beginTime} + + + + - SELECT CAST(SUM(total_Flow) AS DECIMAL (10, 2)) AS sumComm + SELECT + ifnull(CAST(SUM(total_Flow) AS DECIMAL (10, 2)),0.00) AS sumComm FROM ( SELECT total_Flow, @@ -45,7 +46,7 @@ SELECT - cast( SUM( TOTAL_FLOW_DATE ) AS DECIMAL ( 10, 2 ) ) AS sumComm + ifnull(cast( SUM( TOTAL_FLOW_DATE ) AS DECIMAL ( 10, 2 ) ),0.00) AS sumComm FROM ( SELECT diff --git a/casic-sluicewell/src/main/java/com/casic/missiles/modular/system/service/impl/GasFlowDataProvider.java b/casic-sluicewell/src/main/java/com/casic/missiles/modular/system/service/impl/GasFlowDataProvider.java index be040b7..9064106 100644 --- a/casic-sluicewell/src/main/java/com/casic/missiles/modular/system/service/impl/GasFlowDataProvider.java +++ b/casic-sluicewell/src/main/java/com/casic/missiles/modular/system/service/impl/GasFlowDataProvider.java @@ -26,20 +26,19 @@ public Map dateBuilder(String deviceType) throws DataAccessException { Map dateMap = dateBuilder(); Map dataMap = new HashMap<>(); - dataMap.put("total", gasFlowHomeMapper.gasTotalUsed( Long.valueOf(deviceType))); + dataMap.put("total", gasFlowHomeMapper.gasTotalUsed(Long.valueOf(deviceType))); dataMap.put("month", gasFlowHomeMapper.gasMonthUsed(Long.valueOf(deviceType), dateMap.get("month"))); - dataMap.put("day", gasFlowHomeMapper.gasDayUsed(Long.valueOf(deviceType), dateMap.get("day"))); + dataMap.put("day",gasFlowHomeMapper.gasDayUsed(Long.valueOf(deviceType), dateMap.get("day"))); return dataMap; } - /** * 1、取设备基础数据 2、取各设备近七日数据、总数据 3、构建返回结构 */ - public List>> trendBuilder(String deviceType, Integer intervalDay,String totalName) { + public List>> trendBuilder(String deviceType, Integer intervalDay, String totalName) { List deviceList = gasFlowHomeMapper.getDevice(Long.valueOf(deviceType)); deviceList.add(totalName); List> gasDayList = gasFlowHomeMapper.countGasByDay(Long.valueOf(deviceType), intervalDay); - List> totalGasDayList = gasFlowHomeMapper.totalGasByDay(Long.valueOf(deviceType),totalName, intervalDay); + List> totalGasDayList = gasFlowHomeMapper.totalGasByDay(Long.valueOf(deviceType), totalName, intervalDay); gasDayList.addAll(totalGasDayList); List>> devcodeTrendList = devcodeDataBuilder(deviceList, gasDayList, intervalDay); return devcodeTrendList; @@ -56,14 +55,14 @@ private List>> devcodeDataBuilder(List deviceList, List> gasDayList, Integer intervalDay) { Map> gasDayMap = gasDayList.stream(). - filter(e-> StringUtils.isNotBlank(e.get("devcode"))) + filter(e -> StringUtils.isNotBlank(e.get("devcode"))) .collect(Collectors.groupingBy(e -> e.get("devcode"), - Collectors.toMap(e -> String.valueOf(e.get("date")), e -> String.valueOf(e.get("dayTotal"))) + Collectors.toMap(e -> String.valueOf(e.get("date")), e -> String.valueOf(e.get("dayTotal"))) )); List>> devcodeTrendList = new ArrayList<>(); Calendar beginDate = Calendar.getInstance(); beginDate.setTime(new Date()); - beginDate.add(Calendar.DAY_OF_MONTH, 0 - intervalDay+1); + beginDate.add(Calendar.DAY_OF_MONTH, 0 - intervalDay + 1); Calendar endDate = Calendar.getInstance(); endDate.setTime(new Date()); deviceList.stream().forEach( @@ -73,7 +72,7 @@ while (beginDate.getTime().compareTo(endDate.getTime()) <= 0) { Map dataMap = new HashMap(); dataMap.put("date", dayFormate.format(beginDate.getTime())); - dataMap.put("count", !ObjectUtils.isEmpty(gasDayDeviceMap)&&gasDayDeviceMap.containsKey(dayFormate.format(beginDate.getTime())) ? gasDayDeviceMap.get(dayFormate.format(beginDate.getTime())) : "0.00"); + dataMap.put("count", !ObjectUtils.isEmpty(gasDayDeviceMap) && gasDayDeviceMap.containsKey(dayFormate.format(beginDate.getTime())) ? gasDayDeviceMap.get(dayFormate.format(beginDate.getTime())) : "0.00"); dataMap.put("typeName", devcode); mapList.add(dataMap); beginDate.add(Calendar.DAY_OF_MONTH, 1);