Ver código fonte

Merge remote-tracking branch 'origin/0617' into 0617

pengdi@zoniot.com 4 anos atrás
pai
commit
ac5cf0ad2d

+ 0 - 10
smart-city-platform/src/main/java/com/bz/smart_city/controller/water/WaterReadController.java

@@ -140,16 +140,6 @@ public class WaterReadController {
         return new AjaxMessage<>(ResultStatus.OK, statMeterReadRateByBuildingService.getListByCustomer(period, channelId, customerId, null, null));
     }
 
-    @ResponseBody
-    @GetMapping("getSubListByCustomer")
-    @ApiOperation(value = "根据客户获取子类抄表率列表数据")
-    public AjaxMessage<List<CustomerRateDto>> getSubListByCustomer(
-            @ApiParam(value = "查询范围,2:昨天,7:近7日,15:近15日,99:上月", required = false) @RequestParam(required = false) Integer period,
-            @ApiParam(value = "场景id", required = false) @RequestParam(required = false) Integer channelId,
-            @ApiParam(value = "客户id", required = false) @RequestParam(required = false) Integer customerId
-    ) {
-        return new AjaxMessage<>(ResultStatus.OK, statMeterReadRateByBuildingService.getSubListByCustomer(period, channelId, customerId));
-    }
 
     @GetMapping("getExcelByCustomer")
     @ApiOperation(value = "根据客户获取抄表率Excel")

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/entity/Device.java

@@ -71,7 +71,7 @@ public class Device {
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "创建时间", hidden = true)
-    private LocalDateTime dateCreate = LocalDateTime.now();
+    private LocalDateTime dateCreate;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "更新时间", hidden = true)

+ 0 - 2
smart-city-platform/src/main/java/com/bz/smart_city/service/StatMeterReadRateByBuildingService.java

@@ -27,8 +27,6 @@ public interface StatMeterReadRateByBuildingService{
 
     List<CustomerRateDto> getListByCustomer(Integer period, Integer channelId, Integer customerId, String sortColumn, String sortOrder);
 
-    List<CustomerRateDto> getSubListByCustomer(Integer period, Integer channelId, Integer customerId);
-
     void getRateExcelByCustomer(Integer period, Integer channelId, Integer customerId, HttpServletResponse httpServletResponse);
 
     WaterReadRateCountDto getCountByCustomer(Integer period, Integer channelId, Integer customerId);

+ 4 - 38
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/StatMeterReadRateByBuildingServiceImpl.java

@@ -337,8 +337,8 @@ public class StatMeterReadRateByBuildingServiceImpl implements StatMeterReadRate
         List<Integer> customerIds = customerId != null?customerService.findAllIds(customerId):null;
 
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-        //Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
-        Integer startDate = 20200317;
+        Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
+        //Integer startDate = 20200317;
 
 
         List<CustomerRateDto> customerRateDtoList = newArrayList();
@@ -396,40 +396,6 @@ public class StatMeterReadRateByBuildingServiceImpl implements StatMeterReadRate
         return newList;
     }
 
-    @Override
-    public List<CustomerRateDto> getSubListByCustomer(Integer period, Integer channelId, Integer customerId) {
-        LoginUser loginUser = UserUtil.getCurrentUser();
-        ///查询数据权限的建筑ids
-        List<Integer> buildingIds = buildingService.getIdsByDataPermission();
-        //2、根据数据项查询客户
-        //List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds, customerId);
-        List<Integer> subIds = customerService.findSubIds(customerId);
-
-
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-        //Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
-        Integer startDate = 20200317;
-
-
-        List<CustomerRateDto> customerRateDtoList = newArrayList();
-        if (period == 2) { // 昨天,查询天表
-            customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building",loginUser.getSiteId(), startDate, buildingIds,channelId,subIds);
-        } else if (period == 7) { // 近7天,查询7天表
-            customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building_7day",loginUser.getSiteId(), startDate, buildingIds,channelId,subIds);
-        } else if (period == 15) {// 近15天,查询15天表
-            customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building_15day",loginUser.getSiteId(), startDate, buildingIds,channelId,subIds);
-        }else if (period == 99) {// 上个月,查询15天表
-            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMM");
-            startDate = Integer.parseInt(LocalDateTime.now().plusMonths(-1).format(df));
-            customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building_month",loginUser.getSiteId(), startDate, buildingIds,channelId,subIds);
-        }
-        if (customerRateDtoList != null && customerRateDtoList.size()>0) {
-            for (CustomerRateDto customerRateDto : customerRateDtoList) {
-                customerRateDto.setList(statMeterReadRateByBuildingMapper.getRateListByCustomerV2AndDeviceType("sc_stat_meter_read_rate_by_building_month",loginUser.getSiteId(), startDate, buildingIds,channelId,customerRateDto.getCustomerId()));
-            }
-        }
-        return customerRateDtoList;
-    }
 
     @Override
     public void getRateExcelByCustomer(Integer period, Integer channelId, Integer customerId, HttpServletResponse httpServletResponse) {
@@ -473,8 +439,8 @@ public class StatMeterReadRateByBuildingServiceImpl implements StatMeterReadRate
         }
 
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-        //Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
-        Integer startDate = 20200317;
+        Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
+        //Integer startDate = 20200317;
 
 
         if (period == 2) {

+ 11 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/importfile/AsyncTaskImportService.java

@@ -113,6 +113,7 @@ public class AsyncTaskImportService {
         dto.setInstallTime(LocalDateTime.now());
         Integer siteId = record.getSiteId();
         boolean isDownload = false;
+        boolean invalidTemplate = false;
         int successTime = 0 ;
         int failTime = 0 ;
         String messageTitle = "新装水表管理-批量添加水表";
@@ -137,6 +138,7 @@ public class AsyncTaskImportService {
                     if (!StringUtils.equals("安装计划模板", hssfSheet.getSheetName())) {
                         continue;
                     }
+                    invalidTemplate = true;
                     // 1,处理表头,解析客户、户数
                     Row customerIdRow = hssfSheet.getRow(2); // 客户Id行
                     Cell customerIdCell =  customerIdRow.getCell(7);
@@ -373,7 +375,9 @@ public class AsyncTaskImportService {
         }
 
 
-
+        if(!invalidTemplate){
+            messageContent.append("无效模板");
+        }
 
         //更新完成生成消息
         Message message = new Message();
@@ -400,6 +404,7 @@ public class AsyncTaskImportService {
         dto.setSiteId(record.getSiteId());
         dto.setInstallTime(LocalDateTime.now());
         boolean isDownload = false;
+        boolean invalidTemplate = false;
         int successTime = 0 ;
         int failTime = 0 ;
         String messageTitle = "设备列表-批量添加";
@@ -422,6 +427,7 @@ public class AsyncTaskImportService {
                     if (hssfSheet == null || !StringUtils.equals("表格模板", hssfSheet.getSheetName())) {
                         continue;
                     }
+                    invalidTemplate = true;
                     // 循环行Row
                     for (int rowNum = 4; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                         Row row = hssfSheet.getRow(rowNum);
@@ -675,6 +681,7 @@ public class AsyncTaskImportService {
                 importService.updateByPrimaryKeySelective(record);
 
                 isDownload = true;
+
             } catch (Exception e) {
                 e.printStackTrace();
                 log.error("read excel error" + e.getMessage());
@@ -686,6 +693,9 @@ public class AsyncTaskImportService {
         } else {
             throw new ServiceException(-900, "文件不能为空!");
         }
+        if(!invalidTemplate){
+            messageContent.append("无效模板");
+        }
 
         //更新完成生成消息
         Message message = new Message();

+ 1 - 0
smart-city-platform/src/main/resources/mapper/DeviceMapper.xml

@@ -519,6 +519,7 @@
         <if test="customerId != null"> and sd.customer_id = #{customerId}</if>
         <if test="valveStatus != null and valveStatus != 2"> and swmed.valve_status = #{valveStatus}</if>
         <if test="valveStatus != null and valveStatus == 2"> and sdt.is_valve = 0</if>
+        <if test="registerStatus != null"> and sd.register_status = #{registerStatus}</if>
         <if test="days != null">
             <choose>
                 <when test="days == 0">