|
@@ -322,52 +322,86 @@ public class StatMeterReadRateByBuildingServiceImpl implements StatMeterReadRate
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Pagination<WaterReadRateListDto> getListByCustomer(Integer period, String sortColumn, String sortOrder, int pageNum, int pageSize) {
|
|
|
+ public Pagination<CustomerRateDto> getListByCustomer(Integer period, Integer channelId, Integer customerId, String sortColumn, String sortOrder, int pageNum, int pageSize) {
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
///查询数据权限的建筑ids
|
|
|
List<Integer> buildingIds = buildingService.getIdsByDataPermission();
|
|
|
//2、根据数据项查询客户
|
|
|
- List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds);
|
|
|
+ //List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds, customerId);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
- Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
|
|
|
+ //Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
|
|
|
+ Integer startDate = 20200619;
|
|
|
+
|
|
|
|
|
|
+ List<CustomerRateDto> customerRateDtoList = newArrayList();
|
|
|
List<WaterReadRateListDto> waterReadRateListDtoList = newArrayList();
|
|
|
+
|
|
|
if (period == 2) { // 昨天,查询天表
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- waterReadRateListDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomer(loginUser.getSiteId(), startDate, buildingIds, customerList, sortColumn, sortOrder);
|
|
|
+ customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building",loginUser.getSiteId(), startDate, buildingIds,channelId,newArrayList(customerId));
|
|
|
} else if (period == 7) { // 近7天,查询7天表
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- waterReadRateListDtoList = statMeterReadRateByBuildingMapper.getRateList7DayByCustomer(loginUser.getSiteId(), startDate, buildingIds, customerList, sortColumn, sortOrder);
|
|
|
+ customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building_7day",loginUser.getSiteId(), startDate, buildingIds,channelId,newArrayList(customerId));
|
|
|
} else if (period == 15) {// 近15天,查询15天表
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- waterReadRateListDtoList = statMeterReadRateByBuildingMapper.getRateList15DayByCustomer(loginUser.getSiteId(), startDate, buildingIds, customerList, sortColumn, sortOrder);
|
|
|
+ customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building_15day",loginUser.getSiteId(), startDate, buildingIds,channelId,newArrayList(customerId));
|
|
|
+ }else if (period == 99) {// 上个月,查询15天表
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ customerRateDtoList = statMeterReadRateByBuildingMapper.getRateListByCustomerV2("sc_stat_meter_read_rate_by_building_month",loginUser.getSiteId(), startDate, buildingIds,channelId,newArrayList(customerId));
|
|
|
+ }
|
|
|
+ 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 new Pagination<>(customerRateDtoList);
|
|
|
+ }
|
|
|
|
|
|
- /*long days = endTime - beginTime;
|
|
|
- if (0 == days) {
|
|
|
- DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
- LocalDate endDate = LocalDate.parse(beginTime.toString(), df);
|
|
|
- // 根据日期的间隔来判断是否查询最近7天的抄表率
|
|
|
- for (int i = 0; i < waterReadRateListDtoList.size(); i++) {
|
|
|
- WaterReadRateListDto waterReadRateListDto = waterReadRateListDtoList.get(i);
|
|
|
- LocalDate start = endDate.minusDays(6);
|
|
|
- Double last7dayReadRate = statMeterReadRateByBuildingMapper.getLast7DaysReadRate(loginUser.getSiteId(),null, waterReadRateListDto.getCustomerId(), Integer.valueOf(start.format(df)), endTime, programItems);
|
|
|
- waterReadRateListDto.setLast7dayReadRate(last7dayReadRate);
|
|
|
+ @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 = 20200619;
|
|
|
+
|
|
|
+
|
|
|
+ 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天表
|
|
|
+ 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 new Pagination<>(waterReadRateListDtoList);
|
|
|
+ }
|
|
|
+ return customerRateDtoList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void getRateExcelByCustomer(Integer period, HttpServletResponse httpServletResponse) {
|
|
|
+ public void getRateExcelByCustomer(Integer period, Integer channelId, Integer customerId, HttpServletResponse httpServletResponse) {
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
//1、查询数据权限的建筑ids
|
|
|
List<Integer> buildingIds = buildingService.getIdsByDataPermission();
|
|
|
|
|
|
//2、根据数据项查询客户
|
|
|
- List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds);
|
|
|
+ List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds, null);
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
|
|
@@ -405,23 +439,26 @@ public class StatMeterReadRateByBuildingServiceImpl implements StatMeterReadRate
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public WaterReadRateCountDto getCountByCustomer(Integer period) {
|
|
|
+ public WaterReadRateCountDto getCountByCustomer(Integer period, Integer channelId, Integer customerId) {
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
//1、查询数据权限的建筑ids
|
|
|
List<Integer> buildingIds = buildingService.getIdsByDataPermission();
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
- Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
|
|
|
+ //Integer startDate = Integer.valueOf(LocalDate.now().plusDays(-1).format(formatter));
|
|
|
+ Integer startDate = 20200619;
|
|
|
|
|
|
//2、根据数据项查询客户
|
|
|
- List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds);
|
|
|
+ //List<Customer> customerList = customerService.getCustomerListByItem(loginUser.getSiteId(), buildingIds, null);
|
|
|
|
|
|
if (period == 2) {
|
|
|
- return statMeterReadRateByBuildingMapper.getCountByCustomer(loginUser.getSiteId(), startDate, buildingIds, customerList);
|
|
|
+ return statMeterReadRateByBuildingMapper.getCountByCustomerV2("sc_stat_meter_read_rate_by_building",loginUser.getSiteId(), startDate, buildingIds, channelId, customerId);
|
|
|
} else if (period == 7) {
|
|
|
- return statMeterReadRateByBuildingMapper.getCount7DayByCustomer(loginUser.getSiteId(), startDate, buildingIds, customerList);
|
|
|
+ return statMeterReadRateByBuildingMapper.getCountByCustomerV2("sc_stat_meter_read_rate_by_building_7day",loginUser.getSiteId(), startDate, buildingIds, channelId, customerId);
|
|
|
} else if (period == 15) {
|
|
|
- return statMeterReadRateByBuildingMapper.getCount15DayByCustomer(loginUser.getSiteId(), startDate, buildingIds, customerList);
|
|
|
+ return statMeterReadRateByBuildingMapper.getCountByCustomerV2("sc_stat_meter_read_rate_by_building_15day",loginUser.getSiteId(), startDate, buildingIds, channelId, customerId);
|
|
|
+ } else if (period == 99) {
|
|
|
+ return statMeterReadRateByBuildingMapper.getCountByCustomerV2("sc_stat_meter_read_rate_by_building_month",loginUser.getSiteId(), startDate, buildingIds, channelId, customerId);
|
|
|
}
|
|
|
return null;
|
|
|
}
|