Procházet zdrojové kódy

Merge branch '0617' of http://114.135.61.188:53000/ZONIOT/water-iot into 0617

wangli před 4 roky
rodič
revize
0de0960e28

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayPayCheckbalanceController.java

@@ -65,7 +65,7 @@ public class PayPayCheckbalanceController {
         List<PayPayCheckbalanceDto> payPayCheckbalanceDtoList = payPayCheckbalanceService.findStageList(year,month);
         return new AjaxMessage<>(ResultStatus.OK,payPayCheckbalanceDtoList);
     }
-
+/*
     @GetMapping("/findTradeDetail")
     @ApiOperation(value = "查询交易明细",notes = "查询交易明细")
     public AjaxMessage<Pagination<PayBaseAccountTransactionsDto>>findTradeDetail(
@@ -90,5 +90,5 @@ public class PayPayCheckbalanceController {
 
         return new AjaxMessage<>(ResultStatus.OK,payBaseAccountTransactionsDtoPagination);
     }
-
+*/
 }

+ 0 - 4
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayPayCheckbalanceMapper.java

@@ -28,10 +28,6 @@ public interface PayPayCheckbalanceMapper {
     //按帐期取交易总额
     List<PayPayCheckbalanceItemDto>findTradeMonthCycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
-    //按月帐期取系统总额 按机构分类
-    PayPayCheckbalanceAgentDto findSysMonthCycle2(@Param("agentName") String agentName, @Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
-    PayPayCheckbalanceAgentDto findTradeMonthCycle2(@Param("machid") String machid, @Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
-
     //按帐期取每天系统总额
     List<PayPayCheckbalanceItemDto>findSysDay2Cycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 

+ 320 - 316
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/MeterReadRecordServiceImpl.java

@@ -56,7 +56,7 @@ import static com.google.common.collect.Lists.newArrayList;
 
 /**
  * 抄表记录服务实现类
- * @Description  
+ * @Description
  * @author wilian.peng
  * @date 2019年3月15日 下午4:46:07
  */
@@ -66,89 +66,89 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 
 	@Value("${system.water.meter.lora.code}")
 	private String deviceTypeCode; // 智能水表场景id
-	
+
+	@Resource
+	private SnowflakeIdWorker idWorker;
+
+	@Resource
+	private MeterReadRecordMapper meterReadRecordMapper;
+
+	@Resource
+	private MeterReadRateMapper meterReadRateMapper;
+	@Resource
+	private DeviceMapper  deviceMapper;
+
+	@Resource
+	private RedisUtil redisUtil;
+
+	@Resource
+	private DeviceDataDimMapper deviceDataDimMapper;
+
+	@Resource
+	UserMapper userMapper;
+
+	@Resource
+	WMeterTypeMapper wneterTypeMapper;
+
+	@Resource
+	private BuildingMapper buildingMapper;
+
+	@Resource
+	private StatMeterReadRateByBuildingMapper statMeterReadRateByBuildingMapper;
+
 	@Resource
-    private SnowflakeIdWorker idWorker;
-	
-    @Resource
-    private MeterReadRecordMapper meterReadRecordMapper;
-    
-    @Resource
-    private MeterReadRateMapper meterReadRateMapper;
-    @Resource 
-    private DeviceMapper  deviceMapper;
-
-    @Resource
-    private RedisUtil redisUtil; 
-
-    @Resource
-    private DeviceDataDimMapper deviceDataDimMapper;
-    
-    @Resource
-    UserMapper userMapper;
-    
-    @Resource
-    WMeterTypeMapper wneterTypeMapper;
-    
-    @Resource
-    private BuildingMapper buildingMapper;
-    
-    @Resource
-    private StatMeterReadRateByBuildingMapper statMeterReadRateByBuildingMapper;
-    
-    @Resource
-    CustomerService customerService; 
-    
-    @Override
+	CustomerService customerService;
+
+	@Override
 	public Pagination<MeterReadRecord> queryMeterReadRecord(MeterReadRecord param, int pageNum, int pageSize) {
-    	log.info("begin MeterReadRecordService queryMeterReadRecord , param = "+JSON.toJSONString(param));
-    	PageHelper.startPage(pageNum, pageSize);
-    	if(StringUtils.isNotEmpty(param.getLocation())){
-    		param.setLocation("%"+param.getLocation()+"%");
-    	}
-    	if(StringUtils.isNotEmpty(param.getDeviceNo())) {
-    		param.setDeviceNo("%"+param.getDeviceNo()+"%");
-    	}
-    	List<MeterReadRecord> result = meterReadRecordMapper.queryMeterReadRecord(param);
-    	log.info("end MeterReadRecordService queryMeterReadRecord , result.size = "+result.size());
+		log.info("begin MeterReadRecordService queryMeterReadRecord , param = "+JSON.toJSONString(param));
+		PageHelper.startPage(pageNum, pageSize);
+		if(StringUtils.isNotEmpty(param.getLocation())){
+			param.setLocation("%"+param.getLocation()+"%");
+		}
+		if(StringUtils.isNotEmpty(param.getDeviceNo())) {
+			param.setDeviceNo("%"+param.getDeviceNo()+"%");
+		}
+		List<MeterReadRecord> result = meterReadRecordMapper.queryMeterReadRecord(param);
+		log.info("end MeterReadRecordService queryMeterReadRecord , result.size = "+result.size());
 		return new Pagination<MeterReadRecord>(result);
 	}
 
-    @Override
+	@Override
 	public Pagination<MeterReadRecord> queryMeterReadRecord(CommonQueryCondition condition, int pageNum, int pageSize) {
-    	log.info("begin MeterReadRecordService queryMeterReadRecord , param = "+JSON.toJSONString(condition));	
-    	List<Integer> siteList = new ArrayList<Integer>();
-    	siteList.add(condition.getSiteId());
-
-        List<Integer> buildingIds = buildingMapper.getIdsByDataPermission(siteList, condition.getProgramItems());
-    	condition.setBuildingIds(buildingIds);
-    	
-    	PageHelper.startPage(pageNum, pageSize);
-    	List<MeterReadRecord> result = meterReadRecordMapper.queryMeterReadRecordWithCondtion(condition);
-    	log.info("end MeterReadRecordService queryMeterReadRecord , result.size = "+result.size());
-    	return new Pagination<MeterReadRecord>(result);
+		log.info("begin MeterReadRecordService queryMeterReadRecord , param = "+JSON.toJSONString(condition));
+		List<Integer> siteList = new ArrayList<Integer>();
+		siteList.add(condition.getSiteId());
+
+		List<Integer> buildingIds = buildingMapper.getIdsByDataPermission(siteList, condition.getProgramItems());
+		condition.setBuildingIds(buildingIds);
+
+		PageHelper.startPage(pageNum, pageSize);
+		List<MeterReadRecord> result = meterReadRecordMapper.queryMeterReadRecordWithCondtion(condition);
+		log.info("end MeterReadRecordService queryMeterReadRecord , result.size = "+result.size());
+		return new Pagination<MeterReadRecord>(result);
 	}
-    
-    @Override
+
+	@Override
 	public List<MeterRecordStat> statisticRecords(CommonQueryCondition param) {
-    	Date startTime = new Date();
-    	if(StringUtils.isNotEmpty(param.getLocation())){
-    		param.setLocation("%"+param.getLocation()+"%");
-    	}
-    	if(StringUtils.isNotEmpty(param.getDeviceNo())) {
-    		param.setDeviceNo("%"+param.getDeviceNo()+"%");
-    	}
-    	List<MeterRecordStat> datas = newArrayList();
-    	meterReadRecordMapper.createTmpTable(param, "tmp_query");
-    	List<MeterRecordStat> provinceDatas = meterReadRecordMapper.statisticReadRecordsByProvince("tmp_query");
-    	datas.addAll(provinceDatas);
-    	List<MeterRecordStat> cityDatas = meterReadRecordMapper.statisticReadRecordsByCity("tmp_query");
-    	datas.addAll(cityDatas);
-    	List<MeterRecordStat> communityDatas = meterReadRecordMapper.statisticReadRecordsByCommuinty("tmp_query");
-    	datas.addAll(communityDatas);
-    	List<MeterRecordStat> buildingDatas = meterReadRecordMapper.statisticReadRecordsByBuilding("tmp_query");
-    	datas.addAll(buildingDatas);
-    	meterReadRecordMapper.dropTmpTable("tmp_query");
+		Date startTime = new Date();
+		if(StringUtils.isNotEmpty(param.getLocation())){
+			param.setLocation("%"+param.getLocation()+"%");
+		}
+		if(StringUtils.isNotEmpty(param.getDeviceNo())) {
+			param.setDeviceNo("%"+param.getDeviceNo()+"%");
+		}
+		List<MeterRecordStat> datas = newArrayList();
+		meterReadRecordMapper.createTmpTable(param, "tmp_query");
+		List<MeterRecordStat> provinceDatas = meterReadRecordMapper.statisticReadRecordsByProvince("tmp_query");
+		datas.addAll(provinceDatas);
+		List<MeterRecordStat> cityDatas = meterReadRecordMapper.statisticReadRecordsByCity("tmp_query");
+		datas.addAll(cityDatas);
+		List<MeterRecordStat> communityDatas = meterReadRecordMapper.statisticReadRecordsByCommuinty("tmp_query");
+		datas.addAll(communityDatas);
+		List<MeterRecordStat> buildingDatas = meterReadRecordMapper.statisticReadRecordsByBuilding("tmp_query");
+		datas.addAll(buildingDatas);
+		meterReadRecordMapper.dropTmpTable("tmp_query");
 //    	// 1,省份统计
 //    	List<MeterRecordStat> provinceStatDatas = meterReadRecordMapper.statisticReadRecordsByProvince(param);
 //    	for(MeterRecordStat provinceStatData : provinceStatDatas) {
@@ -175,211 +175,211 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 //    		}
 //    	}
 		long cost = (System.currentTimeMillis()-startTime.getTime())/1000 ;
-    	log.info("The cost time is {}",cost);
-    	return TreeUtil.getTreeList(datas, 100000, 1);
+		log.info("The cost time is {}",cost);
+		return TreeUtil.getTreeList(datas, 100000, 1);
+	}
+	@Override
+	public List<MeterReadRate> analysisMeterReadRate(CommonQueryCondition condition){
+		List<MeterReadRate>  result = new ArrayList<MeterReadRate>();
+		// 1,计算查询日期
+		Integer period = condition.getPeriod();
+		if(period == 0) { // 自定义
+			if(condition.getStartDate() == 0 && condition.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
+		}
+		else if(period == 1) {
+			condition.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 2) {
+			condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+		}
+		else if(period == 7) {
+			condition.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+		}
+		else if(period == 30) {
+			condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+		}
+		// 2,查询数据
+		List<StatMeterReadRateDto> datas = statMeterReadRateByBuildingMapper.analysisMeterReadRate(condition);
+
+		// 3,数据不够则补齐数据
+		List<String> dateStrs = DateTimeUtil.betweenDate(DateTimeUtil.parseDate(condition.getStartDate() + "", "yyyyMMdd"),
+				DateTimeUtil.parseDate(condition.getEndDate() + "", "yyyyMMdd"));
+
+		if (result.size() != dateStrs.size()) {
+			for (String dateStr : dateStrs) {
+				boolean exist = false;
+				for (StatMeterReadRateDto data : datas) {
+					Integer statDate = data.getStatDay();
+					if (dateStr.equals(String.valueOf(statDate))) {
+						exist = true;
+						MeterReadRate tmp = new MeterReadRate();
+						tmp.setStatDate(statDate);
+						tmp.setReadRate(data.getReadRate().doubleValue());
+						tmp.setRealReadTimes(data.getRealReadTimes().longValue());
+						tmp.setReadTimes(data.getReadTimes().longValue());
+						tmp.setUnReadTimes(data.getUnReadTimes().longValue());
+						result.add(tmp);
+						break;
+					}
+				}
+				if (!exist) {
+					MeterReadRate tmp = new MeterReadRate();
+					tmp.setReadRate(0.0);
+					tmp.setStatDate(Integer.parseInt(dateStr));
+					tmp.setRealReadTimes(0l);
+					tmp.setUnReadTimes(0l);
+					tmp.setReadTimes(0l);
+					result.add(tmp);
+				}
+			}
+		}
+		return result ;
 	}
-    @Override
-    public List<MeterReadRate> analysisMeterReadRate(CommonQueryCondition condition){
-    	List<MeterReadRate>  result = new ArrayList<MeterReadRate>();
-    	// 1,计算查询日期
-    	Integer period = condition.getPeriod();
-    	if(period == 0) { // 自定义
-    		if(condition.getStartDate() == 0 && condition.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
-    	}
-    	else if(period == 1) {
-    		condition.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 2) {
-    		condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    	}
-    	else if(period == 7) {
-    		condition.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    	}
-    	else if(period == 30) {
-    		condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    	}
-    	// 2,查询数据
-    	List<StatMeterReadRateDto> datas = statMeterReadRateByBuildingMapper.analysisMeterReadRate(condition);
-    	
-    	// 3,数据不够则补齐数据
-   	 	List<String> dateStrs = DateTimeUtil.betweenDate(DateTimeUtil.parseDate(condition.getStartDate() + "", "yyyyMMdd"),
-                DateTimeUtil.parseDate(condition.getEndDate() + "", "yyyyMMdd"));
-   	 
-	   	if (result.size() != dateStrs.size()) {
-	   		for (String dateStr : dateStrs) {
-                boolean exist = false;
-                for (StatMeterReadRateDto data : datas) {
-                    Integer statDate = data.getStatDay();
-                    if (dateStr.equals(String.valueOf(statDate))) {
-                        exist = true;
-                        MeterReadRate tmp = new MeterReadRate();
-                        tmp.setStatDate(statDate);
-                        tmp.setReadRate(data.getReadRate().doubleValue());
-                        tmp.setRealReadTimes(data.getRealReadTimes().longValue());
-                        tmp.setReadTimes(data.getReadTimes().longValue());
-                        tmp.setUnReadTimes(data.getUnReadTimes().longValue());
-                        result.add(tmp);
-                        break;
-                    }
-                }
-                if (!exist) {
-                    MeterReadRate tmp = new MeterReadRate();
-                    tmp.setReadRate(0.0);
-                    tmp.setStatDate(Integer.parseInt(dateStr));
-                    tmp.setRealReadTimes(0l);
-                    tmp.setUnReadTimes(0l);
-                    tmp.setReadTimes(0l);
-                    result.add(tmp);
-                }
-            }
-	   	}
-    	return result ; 
-    }
-    
-    @Override
+
+	@Override
 	public List<MeterReadRate> analysisMeterReadRate(MeterReadRate param) {
-    	log.info("begin MeterReadRecordService analysisMeterReadRate , param = "+JSON.toJSONString(param));
-    	// 1,先根据周期判断开始与结束时间  ,统计周期:0 表示自定义,1表示今天,2表示昨天,7表示近7天,30表示近30天
-    	Integer period = param.getPeriod();
-    	if(period == 0) { // 自定义
-    		if(param.getStartDate() == 0 && param.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
-    	}
-    	else if(period == 1) {
-             param.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-             param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 2) {
-    		param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-            param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 7) {
-    		param.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
-    		param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 30) {
-    		param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
-    		param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	// 2,查询数据
-    	List<MeterReadRate> result = meterReadRateMapper.analysisMeterReadRate(param);
-    	// 3,数据不够则补齐数据
-    	 List<String> dateStrs = DateTimeUtil.betweenDate(DateTimeUtil.parseDate(param.getStartDate() + "", "yyyyMMdd"),
-                 DateTimeUtil.parseDate(param.getEndDate() + "", "yyyyMMdd"));
-         if (result.size() != dateStrs.size()) {
-             for (String dateStr : dateStrs) {
-                 boolean exist = false;
-                 for (MeterReadRate data : result) {
-                     Integer statDate = data.getStatDate(); 
-                     if (dateStr.equals(String.valueOf(statDate))) {
-                         exist = true;
-                         break;
-                     }
-                 }
-                 if (!exist) {
-                     MeterReadRate tmp = new MeterReadRate();
-                     tmp.setReadRate(0.0);
-                     tmp.setStatDate(Integer.parseInt(dateStr));
-                     tmp.setRealReadTimes(0l);
-                     tmp.setUnReadTimes(0l);
-                     tmp.setReadTimes(0l);
-                     result.add(tmp);
-                 }
-             }
-         }
-         SortList<MeterReadRate> sortList = new SortList<MeterReadRate>();  
-         sortList.Sort(result, "getStatDate", "asc");  
-         log.info("end MeterReadRecordService analysisMeterReadRate , result.size = "+result.size());
+		log.info("begin MeterReadRecordService analysisMeterReadRate , param = "+JSON.toJSONString(param));
+		// 1,先根据周期判断开始与结束时间  ,统计周期:0 表示自定义,1表示今天,2表示昨天,7表示近7天,30表示近30天
+		Integer period = param.getPeriod();
+		if(period == 0) { // 自定义
+			if(param.getStartDate() == 0 && param.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
+		}
+		else if(period == 1) {
+			param.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 2) {
+			param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 7) {
+			param.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 30) {
+			param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		// 2,查询数据
+		List<MeterReadRate> result = meterReadRateMapper.analysisMeterReadRate(param);
+		// 3,数据不够则补齐数据
+		List<String> dateStrs = DateTimeUtil.betweenDate(DateTimeUtil.parseDate(param.getStartDate() + "", "yyyyMMdd"),
+				DateTimeUtil.parseDate(param.getEndDate() + "", "yyyyMMdd"));
+		if (result.size() != dateStrs.size()) {
+			for (String dateStr : dateStrs) {
+				boolean exist = false;
+				for (MeterReadRate data : result) {
+					Integer statDate = data.getStatDate();
+					if (dateStr.equals(String.valueOf(statDate))) {
+						exist = true;
+						break;
+					}
+				}
+				if (!exist) {
+					MeterReadRate tmp = new MeterReadRate();
+					tmp.setReadRate(0.0);
+					tmp.setStatDate(Integer.parseInt(dateStr));
+					tmp.setRealReadTimes(0l);
+					tmp.setUnReadTimes(0l);
+					tmp.setReadTimes(0l);
+					result.add(tmp);
+				}
+			}
+		}
+		SortList<MeterReadRate> sortList = new SortList<MeterReadRate>();
+		sortList.Sort(result, "getStatDate", "asc");
+		log.info("end MeterReadRecordService analysisMeterReadRate , result.size = "+result.size());
 		return result;
 	}
-    
+
 	@Override
 	public Pagination<MeterReadRate> queryMeterReadRate(MeterReadRate param, int pageNum, int pageSize) {
-    	log.info("begin MeterReadRecordService queryMeterReadRate , param = "+JSON.toJSONString(param));
-    	PageHelper.startPage(pageNum, pageSize);
-    	List<MeterReadRate> result = meterReadRateMapper.queryMeterReadRate(param);
-    	log.info("end MeterReadRecordService queryMeterReadRate , result.size = "+result.size());
+		log.info("begin MeterReadRecordService queryMeterReadRate , param = "+JSON.toJSONString(param));
+		PageHelper.startPage(pageNum, pageSize);
+		List<MeterReadRate> result = meterReadRateMapper.queryMeterReadRate(param);
+		log.info("end MeterReadRecordService queryMeterReadRate , result.size = "+result.size());
 		return new Pagination<MeterReadRate>(result);
 	}
-	
+
 	@Override
 	public MeterReadRate summaryMeterReadRate(CommonQueryCondition condition) {
 		// 1,先根据周期判断开始与结束时间  ,统计周期:0 表示自定义,1表示今天,2表示昨天,7表示近7天,30表示近30天
 		MeterReadRate result = new MeterReadRate(); ;
-    	Integer period = condition.getPeriod();
-    	if(period == 0) { // 自定义
-    		if(condition.getStartDate() == 0 && condition.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
-    	}
-    	else if(period == 1) {
-    		condition.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 2) {
-    		condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    	}
-    	else if(period == 7) {
-    		condition.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    	}
-    	else if(period == 30) {
-    		condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
-    		condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-    	}
+		Integer period = condition.getPeriod();
+		if(period == 0) { // 自定义
+			if(condition.getStartDate() == 0 && condition.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
+		}
+		else if(period == 1) {
+			condition.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 2) {
+			condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+		}
+		else if(period == 7) {
+			condition.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+		}
+		else if(period == 30) {
+			condition.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
+			condition.setEndDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+		}
 		StatMeterReadRateDto resp = statMeterReadRateByBuildingMapper.summaryRateListByBuilding(condition);
 		if(resp == null) {
-    		result.setReadRate(0.0);
-    		result.setRealReadTimes(0l);
-    		result.setUnReadTimes(0l);
-    		result.setReadTimes(0l);
-    	}
+			result.setReadRate(0.0);
+			result.setRealReadTimes(0l);
+			result.setUnReadTimes(0l);
+			result.setReadTimes(0l);
+		}
 		else {
 			result.setReadRate(resp.getReadRate().doubleValue());
-    		result.setRealReadTimes(resp.getRealReadTimes().longValue());
-    		result.setUnReadTimes(resp.getRealReadTimes().longValue());
-    		result.setReadTimes(resp.getReadTimes().longValue());
+			result.setRealReadTimes(resp.getRealReadTimes().longValue());
+			result.setUnReadTimes(resp.getRealReadTimes().longValue());
+			result.setReadTimes(resp.getReadTimes().longValue());
 		}
 		return result;
 	}
 
-	
+
 	@Override
 	public MeterReadRate summaryMeterReadRate(MeterReadRate param) {
-    	log.info("begin MeterReadRecordService summaryMeterReadRate , param = "+JSON.toJSONString(param));
-    	// 1,先根据周期判断开始与结束时间  ,统计周期:0 表示自定义,1表示今天,2表示昨天,7表示近7天,30表示近30天
-    	Integer period = param.getPeriod();
-    	if(period == 0) { // 自定义
-    		if(param.getStartDate() == 0 && param.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
-    	}
-    	else if(period == 1) {
-             param.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-             param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 2) {
-    		param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
-            param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 7) {
-    		param.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
-    		param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	else if(period == 30) {
-    		param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
-    		param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
-    	}
-    	// 1,先计算汇总信息
-    	MeterReadRate result = meterReadRateMapper.sumMeterReadRate(param);
-    	if(result == null) {
-    		result = new MeterReadRate();
-    		result.setReadRate(0.0);
-    		result.setRealReadTimes(0l);
-    		result.setUnReadTimes(0l);
-    		result.setReadTimes(0l);
-    	}
-    	// 2,单独计算设备总数
+		log.info("begin MeterReadRecordService summaryMeterReadRate , param = "+JSON.toJSONString(param));
+		// 1,先根据周期判断开始与结束时间  ,统计周期:0 表示自定义,1表示今天,2表示昨天,7表示近7天,30表示近30天
+		Integer period = param.getPeriod();
+		if(period == 0) { // 自定义
+			if(param.getStartDate() == 0 && param.getEndDate() == 0) throw new RuntimeException("获取不到查询开始与结束时间");
+		}
+		else if(period == 1) {
+			param.setStartDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 2) {
+			param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(1), "yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 7) {
+			param.setStartDate( Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(7), "yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		else if(period == 30) {
+			param.setStartDate(Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.beforeNow(30), "yyyyMMdd")));
+			param.setEndDate(Integer.parseInt(DateTimeUtil.formatNow("yyyyMMdd")));
+		}
+		// 1,先计算汇总信息
+		MeterReadRate result = meterReadRateMapper.sumMeterReadRate(param);
+		if(result == null) {
+			result = new MeterReadRate();
+			result.setReadRate(0.0);
+			result.setRealReadTimes(0l);
+			result.setUnReadTimes(0l);
+			result.setReadTimes(0l);
+		}
+		// 2,单独计算设备总数
 //    	if(period == 1) {
 //    		Device p = new Device();
 //    		WMeterType type = wneterTypeMapper.getWMeterTypeByDeviceTypeCode(deviceTypeCode);
@@ -399,16 +399,16 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 //        		result.setDeviceCount(rates.get(0).getDeviceCount());
 //        	}
 //    	}
-    	log.info("end MeterReadRecordService summaryMeterReadRate , result = "+JSON.toJSONString(result));
+		log.info("end MeterReadRecordService summaryMeterReadRate , result = "+JSON.toJSONString(result));
 		return result;
 	}
-	
+
 	@Async
 	@Override
 	public int createMeterReadRecordAsync(Date date) {
 		return createMeterReadRecord(date);
 	}
-	
+
 	@Override
 	public int createMeterReadRecord(Date date) {
 		log.info("begin MeterReadRecordService createMeterReadRecord ,date = "+ JSON.toJSONString(date));
@@ -427,20 +427,21 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 		statusList.add(4); // 预警
 		statusList.add(5); // 未启用
 		param.setDeviceStatusList(statusList);
+		param.setDeviceType(type.getDeviceTypeId());
 		int total = deviceMapper.countDevice(param);
-		
+
 		// 2,分页获取设备并生成抄表记录
 		int pageSize = 1000 ;
-		
+
 		int totalPage = total / pageSize;
 		if (total % pageSize != 0){
 			totalPage++;
 		}
 
-		
+
 		for(int i = 1 ;i <= totalPage; i++) {
 			int start = (i - 1) * pageSize;
-			
+
 			List<DeviceDto> deviceList = deviceMapper.getDeviceList(param, start, pageSize);
 			List<MeterReadRecord> records = new ArrayList<MeterReadRecord>();
 			for(DeviceDto device : deviceList) {
@@ -448,7 +449,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 				Integer startDate = Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.before(date, 1), "yyyyMMdd"));
 				Integer endDate = Integer.parseInt(DateTimeUtil.formatDate(date, "yyyyMMdd"));
 				MeterReadRecord record = new MeterReadRecord();
-				String deviceNo = device.getDeviceNo() ; 
+				String deviceNo = device.getDeviceNo() ;
 				Long deviceId = device.getId();
 				record.setId(idWorker.nextId());
 				record.setSiteId(device.getSiteId());
@@ -489,7 +490,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 						p.setEndDate(endDate);
 						p.setMeasuringCode("WSV");
 						List<DeviceDataDim> data = deviceDataDimMapper.queryDeviceDataDim(p,1);
-						
+
 						if(data.size() > 0) {
 							readStatus = "2" ; // 已抄
 							record.setReadTime(data.get(0).getSendTime()); // 抄表时间
@@ -505,7 +506,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 					p.setEndDate(endDate);
 					p.setMeasuringCode("WSV");
 					List<DeviceDataDim> data = deviceDataDimMapper.queryDeviceDataDim(p,1);
-					
+
 					if(data.size() > 0) {
 						readStatus = "2" ; // 已抄
 						record.setReadTime(data.get(0).getSendTime()); // 抄表时间
@@ -546,9 +547,9 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 				Thread.sleep(10000l);
 			} catch (InterruptedException e) {
 				log.error("thread interrupted", e);
-			} 
+			}
 		}
-		
+
 		log.info("end MeterReadRecordService createMeterReadRecord ,result = "+ result);
 		return total;
 	}
@@ -594,14 +595,14 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 	public void getMeterReadRecordExcel(MeterReadRecord param, HttpServletResponse httpServletResponse) {
 		log.info("begin MeterReadRecordService getMeterReadRecordExcel,param = "+JSON.toJSONString(param));
 		if(StringUtils.isNotEmpty(param.getLocation())){
-    		param.setLocation("%"+param.getLocation()+"%");
-    	}
-    	if(StringUtils.isNotEmpty(param.getDeviceNo())) {
-    		param.setDeviceNo("%"+param.getDeviceNo()+"%");
-    	}
-    	List<MeterReadRecord> result = meterReadRecordMapper.queryMeterReadRecord(param);
-    	
-    	String title = "抄表记录";
+			param.setLocation("%"+param.getLocation()+"%");
+		}
+		if(StringUtils.isNotEmpty(param.getDeviceNo())) {
+			param.setDeviceNo("%"+param.getDeviceNo()+"%");
+		}
+		List<MeterReadRecord> result = meterReadRecordMapper.queryMeterReadRecord(param);
+
+		String title = "抄表记录";
 		String[] rowsName = new String[]{"序号", "设备编号", "抄表状态", "抄表止度", "抄表时间", "所属建筑", "位置信息"};
 		List<Object[]> dataList = newArrayList();
 		Object[] objs = null;
@@ -626,7 +627,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 		log.info("end MeterReadRecordService getMeterReadRecordExcel , result.size = "+result.size());
 
 	}
-	
+
 	@Override
 	public void getMeterReadRecordExcel(CommonQueryCondition condition, HttpServletResponse httpServletResponse) {
 		log.info("begin MeterReadRecordService getMeterReadRecordExcel,param = "+JSON.toJSONString(condition));
@@ -662,28 +663,28 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 		}
 		log.info("end MeterReadRecordService getMeterReadRecordExcel , result.size = "+result.size());
 	}
-	
+
+	@Override
+	public int insert(MeterReadRecord meterReadRecord){
+		return meterReadRecordMapper.insert(meterReadRecord);
+	}
+
+	@Override
+	public int insertSelective(MeterReadRecord meterReadRecord){
+		return meterReadRecordMapper.insertSelective(meterReadRecord);
+	}
+
+	@Override
+	public int insertList(List<MeterReadRecord> meterReadRecords){
+		return meterReadRecordMapper.insertList(meterReadRecords);
+	}
+
+	@Override
+	public int updateByPrimaryKeySelective(MeterReadRecord meterReadRecord){
+		return meterReadRecordMapper.updateByPrimaryKeySelective(meterReadRecord);
+	}
+
 	@Override
-    public int insert(MeterReadRecord meterReadRecord){
-        return meterReadRecordMapper.insert(meterReadRecord);
-    }
-
-    @Override
-    public int insertSelective(MeterReadRecord meterReadRecord){
-        return meterReadRecordMapper.insertSelective(meterReadRecord);
-    }
-
-    @Override
-    public int insertList(List<MeterReadRecord> meterReadRecords){
-        return meterReadRecordMapper.insertList(meterReadRecords);
-    }
-
-    @Override
-    public int updateByPrimaryKeySelective(MeterReadRecord meterReadRecord){
-        return meterReadRecordMapper.updateByPrimaryKeySelective(meterReadRecord);
-    }
-
-    @Override
 	public WaterConsumptionSummaryDto waterConsumptionSummary(CommonQueryCondition condition) {
 		log.info("begin MeterReadRecordService waterConsumptionSummary, params = " + JSON.toJSONString(condition));
 		WaterConsumptionSummaryDto result = meterReadRecordMapper.getSummary(condition);
@@ -703,7 +704,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 	@Async
 	@Override
 	public void recoverAll(Integer startDate) {
-    	log.info("开始用水量恢复");
+		log.info("开始用水量恢复");
 		List<Long> allDeviceId = meterReadRecordMapper.getAllDeviceId(startDate);
 		for (Long deviceId : allDeviceId) {
 			log.info("开始恢复设备id : " + deviceId + " 的用水量");
@@ -757,19 +758,19 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 		statusList.add(4); // 预警
 		param.setDeviceStatusList(statusList);
 		int total = deviceMapper.countDevice(param);
-		
+
 		// 2,分页获取设备并生成抄表记录
 		int pageSize = 1000 ;
-		
+
 		int totalPage = total / pageSize;
 		if (total % pageSize != 0){
 			totalPage++;
 		}
 
-		
+
 		for(int i = 1 ;i <= totalPage; i++) {
 			int start = (i - 1) * pageSize;
-			
+
 			List<DeviceDto> deviceList = deviceMapper.getDeviceList(param, start, pageSize);
 			List<MeterReadRecord> records = new ArrayList<MeterReadRecord>();
 			for(DeviceDto device : deviceList) {
@@ -777,7 +778,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 				Integer startDate = Integer.parseInt(DateTimeUtil.formatDate(DateTimeUtil.before(date, 1), "yyyyMMdd"));
 				Integer endDate = Integer.parseInt(DateTimeUtil.formatDate(date, "yyyyMMdd"));
 				MeterReadRecord record = new MeterReadRecord();
-				String deviceNo = device.getDeviceNo() ; 
+				String deviceNo = device.getDeviceNo() ;
 				Long deviceId = device.getId();
 				record.setId(idWorker.nextId());
 				record.setSiteId(device.getSiteId());
@@ -819,7 +820,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 						p.setEndDate(endDate);
 						p.setMeasuringCode("WSV");
 						List<DeviceDataDim> data = deviceDataDimMapper.queryDeviceDataDim(p,1);
-						
+
 						if(data.size() > 0) {
 							readStatus = "2" ; // 已抄
 							record.setReadTime(data.get(0).getSendTime()); // 抄表时间
@@ -835,7 +836,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 					p.setEndDate(endDate);
 					p.setMeasuringCode("WSV");
 					List<DeviceDataDim> data = deviceDataDimMapper.queryDeviceDataDim(p,1);
-					
+
 					if(data.size() > 0) {
 						readStatus = "2" ; // 已抄
 						record.setReadTime(data.get(0).getSendTime()); // 抄表时间
@@ -853,23 +854,23 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 				Thread.sleep(10000l);
 			} catch (InterruptedException e) {
 				log.error("thread interrupted", e);
-			} 
+			}
 		}
-		
+
 		log.info("end MeterReadRecordService createMeterReadRecord ,result = "+ result);
 		return total;
 	}
 
 	@Override
 	public ListObjectWrapper<MeterReadDataDTO> queryMeterReadData(String meterReadDate, String deviceNo,
-			String electronicNo, String custNo) {
+																  String electronicNo, String custNo) {
 		if(StringUtils.isEmpty(custNo) && StringUtils.isEmpty(deviceNo)  &&  StringUtils.isEmpty(electronicNo)) {
 			throw new ServiceException(ResultStatus.CLEARING_DATA_QUERY_CONDITION_ERROR);
 		}
 		if(StringUtils.isEmpty(meterReadDate) ) {
 			throw new ServiceException(ResultStatus.METER_READ_DATA_QUERY_CONDITION_ACCOUNT);
 		}
-		if(!StringUtils.isEmpty(custNo)) { 
+		if(!StringUtils.isEmpty(custNo)) {
 			Customer cust = customerService.findBySiteIdAndCustomerNo(null, custNo);
 			if(cust == null) {
 				throw new ServiceException(ResultStatus.CLEARING_DATA_QUERY_NO_CUSTOMER);
@@ -959,6 +960,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 		statusList.add(4); // 预警
 		statusList.add(5); // 未启用
 		param.setDeviceStatusList(statusList);
+		param.setDeviceType(type.getDeviceTypeId());
 		return param;
 	}
 	protected  void calcWsvIncrement(Date current , DeviceDto device , MeterReadRecord  record){
@@ -1018,10 +1020,11 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 	 * 从缓存数据中生成抄表记录
 	 */
 	protected MeterReadRecord genrateMeterRecordFromCache(DeviceDto device, Integer startDate,Integer endDate , String wsvCode){
+		log.info("Generate Meter Record From Cache ,Device No = {}",device.getDeviceNo());
 		MeterReadRecord readRecord = null;
 		readRecord = buildRecordBaseInfo(device,startDate);
 		String deviceDataJSONStr = redisUtil.get(String.valueOf(device.getId()));
-
+		log.info(" Device {} Cache Data Log ,Data = {} ",device.getDeviceNo(),deviceDataJSONStr);
 		JSONObject dataObj = (JSONObject)JSON.parse(deviceDataJSONStr);
 		// 分别获取用水测点与上报时间测点
 		JSONObject timeData = (JSONObject)dataObj.get("TIME");
@@ -1045,6 +1048,7 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 	 * 从数据库记录中生成抄表记录
 	 */
 	protected MeterReadRecord genrateMeterRecordFromDB(DeviceDto device,Integer startDate,Integer endDate,String wsvCode){
+		log.info("Generate Meter Record From DB ,Device No = {}",device.getDeviceNo());
 		MeterReadRecord readRecord = null;
 		readRecord = buildRecordBaseInfo(device,startDate);
 
@@ -1057,12 +1061,12 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService{
 		List<DeviceDataDim> data = deviceDataDimMapper.queryDeviceDataDim(p,1);
 
 		if(data.size() > 0) {
-			readRecord.setReadData("2"); // 已抄
+			readRecord.setReadStatus("2"); // 已抄
 			readRecord.setReadTime(data.get(0).getSendTime()); // 抄表时间
 			readRecord.setReadData(data.get(0).getMeasuringData());
 		}
 		else{
-			readRecord.setReadData("1"); // 未抄
+			readRecord.setReadStatus("1"); // 未抄
 		}
 		return readRecord ;
 	}

+ 0 - 106
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayPayCheckbalanceServiceImpl.java

@@ -144,112 +144,6 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
 
     }
 
-    public List<PayPayCheckbalanceListDto>findMonth2List(String year, String month)
-    {
-        LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
-
-        List<PayPayCheckbalanceListDto> payPayCheckbalanceListDtoList = new ArrayList<>();
-        //查询机构
-        List<PayPayAgentbranch> payPayAgentbranchList = payPayAgentbranchMapper.findList(siteId,customerId);
-        if(payPayAgentbranchList != null && payPayAgentbranchList.size() > 0)
-        {
-            Integer iYear=null;
-            Integer iMonth=null;
-            if(!StringUtils.isNullOrEmpty(year))
-                iYear = Integer.valueOf(year);
-            if(!StringUtils.isNullOrEmpty(month))
-                iMonth = Integer.valueOf(month);
-            //查询帐期
-            List<BaseClosingAccountInfoDto> baseClosingAccountInfoList = baseClosingAccountInfoMapper.getList(iYear,iMonth,siteId,customerId,Integer.valueOf("1"));
-
-            if(baseClosingAccountInfoList != null)
-            {
-                ZoneId zoneId = ZoneId.systemDefault();
-
-                for(int i=0;i<baseClosingAccountInfoList.size();i++)
-                {
-                    PayPayCheckbalanceListDto payPayCheckbalanceListDto = new PayPayCheckbalanceListDto();
-                    payPayCheckbalanceListDto.setYear(baseClosingAccountInfoList.get(i).getYear());
-                    payPayCheckbalanceListDto.setMonth(baseClosingAccountInfoList.get(i).getMonth());
-
-                    List<PayPayCheckbalanceAgentDto> payPayCheckbalanceAgentDtoList = new ArrayList<>();
-
-                    String cycle = baseClosingAccountInfoList.get(i).getName();
-                    LocalDateTime stTime = LocalDateTime.ofInstant(baseClosingAccountInfoList.get(i).getStartTime().toInstant(), zoneId);
-                    LocalDateTime endTime = LocalDateTime.ofInstant(baseClosingAccountInfoList.get(i).getEndTime().toInstant(), zoneId);
-                    //取每月系统总额 按机构
-                    for (int k=0;k<payPayAgentbranchList.size();k++)
-                    {
-                        PayPayCheckbalanceAgentDto payPayCheckbalanceAgentDto =
-                                payPayCheckbalanceMapper.findSysMonthCycle2(payPayAgentbranchList.get(k).getName(),cycle,stTime,endTime,siteId,customerId);
-
-                        PayPayCheckbalanceAgentDto payPayCheckbalanceAgentDto1 =
-                                payPayCheckbalanceMapper.findTradeMonthCycle2(payPayAgentbranchList.get(k).getMchid(),cycle,stTime,endTime,siteId,customerId);
-
-                        if(payPayCheckbalanceAgentDto == null && payPayCheckbalanceAgentDto1 == null)
-                            break;
-
-                        if(payPayCheckbalanceAgentDto == null)
-                        {
-                            payPayCheckbalanceAgentDto = new PayPayCheckbalanceAgentDto();
-                            payPayCheckbalanceAgentDto.setAgentName(payPayAgentbranchList.get(k).getName());
-                        }
-                        if(payPayCheckbalanceAgentDto1 != null)
-                            payPayCheckbalanceAgentDto.setTradeData(payPayCheckbalanceAgentDto1.getTradeData());
-
-                        //帐期各机构数据
-                        payPayCheckbalanceAgentDtoList.add(payPayCheckbalanceAgentDto);
-                    }
-                    payPayCheckbalanceListDto.setPayPayCheckbalanceAgentDtoList(payPayCheckbalanceAgentDtoList);
-
-                    payPayCheckbalanceListDtoList.add(payPayCheckbalanceListDto);
-
-                }
-
-
-            }
-
-
-        }
-
-
-        return payPayCheckbalanceListDtoList;
-    }
-
-    @Override
-    public Pagination<PayPayCheckbalanceListDto>findMonth2List(String year,String month,int pageNum, int pageSize)
-    {
-        Pagination<PayPayCheckbalanceListDto> pg = new Pagination<>();
-        List<PayPayCheckbalanceListDto> payPayCheckbalanceListDtoList = findMonth2List(year,month);
-        pg.setTotal(payPayCheckbalanceListDtoList.size());
-        //获取分页部分
-        List<PayPayCheckbalanceListDto> payPayCheckbalanceDtoListPage = newArrayList();
-        int count = payPayCheckbalanceListDtoList.size();
-        int stIndex=0;
-        int endIndex=0;
-
-
-        if(count > 0 && pageNum >0 && pageSize >0)
-        {
-            stIndex = (pageNum-1) * pageSize;
-            endIndex = stIndex + pageSize -1;
-            if(count > stIndex )
-            {
-                for (int i=stIndex;i<=endIndex;i++)
-                {
-                    if(i >= count)
-                        break;
-                    payPayCheckbalanceDtoListPage.add(payPayCheckbalanceListDtoList.get(i));
-                }
-            }
-
-        }
-
-        pg.setList(payPayCheckbalanceDtoListPage);
-        return pg;
-    }
 
     /**
      * 查询指定年月下的每天数据

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

@@ -15,8 +15,6 @@ public interface PayPayCheckbalanceService {
 
     Pagination<PayPayCheckbalanceDto>findMonthList(String year,String month,int pageNum, int pageSize);
 
-    Pagination<PayPayCheckbalanceListDto>findMonth2List(String year, String month, int pageNum, int pageSize);
-
     //按自然月
     List<PayPayCheckbalanceDto> findDayList(String year,String month);
 

+ 24 - 24
smart-city-platform/src/main/resources/mapper/pay/PayPayAgentbranchMapper.xml

@@ -84,33 +84,33 @@
 
     <select id="getAll" resultType="com.bz.smart_city.dto.pay.PayPayAgentbranchSelectDto">
         select
-            pa1.id,
-            pa1.type,
-            pa1.`code`,
-            pa1.name,
-            pa1.mchid,
-            pa1.paykey paykey,
-            pa1.appid,
-            scu.`name` as updateName,
-            pa1.update_date as updateDate,
-            psd.label as agentbranchType,
-            pa2.number as transactionsNumber,
-            IFNULL(pa2.sumAmount,0) as transactionsMoney
+        pa1.id,
+        pa1.type,
+        pa1.`code`,
+        pa1.name,
+        pa1.mchid,
+        pa1.paykey paykey,
+        pa1.appid,
+        scu.`name` as updateName,
+        pa1.update_date as updateDate,
+        psd.label as agentbranchType,
+        pa2.number as transactionsNumber,
+        IFNULL(pa2.sumAmount,0) as transactionsMoney
         from pay_pay_agentbranch pa1
         left join sc_user scu on pa1.update_by=scu.id
         left join pay_sys_dict psd on pa1.type = psd.value and psd.type='机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
         left join (
-            select count(1) number,sum(amount) sumAmount,agent_code
-            from pay_pay_agenttransaction
-            <where>
-                state != 0 and state != 4
-                <if test="questParams != null"> and (agent_code like concat('%',#{questParams,jdbcType=VARCHAR} ,'%') or agent_name like concat('%',#{questParams,jdbcType=VARCHAR} ,'%'))</if>
-                <if test ="startTime != null"> and transtime >= #{startTime,jdbcType=TIMESTAMP}</if>
-                <if test="siteId != null"> and site_id=#{siteId}</if>
-                <if test="customerId != null"> and customer_id=#{customerId}</if>
-            </where>
-            group by agent_code) pa2
-        on pa1.code = pa2.agent_code
+        select count(1) number,sum(trans_fee) sumAmount,machid
+        from pay_pay_checkbalance
+        <where>
+            state != 0 and state != 4
+
+            <if test ="startTime != null"> and transtime >= #{startTime,jdbcType=TIMESTAMP}</if>
+            <if test="siteId != null"> and site_id=#{siteId}</if>
+            <if test="customerId != null"> and customer_id=#{customerId}</if>
+        </where>
+        group by machid) pa2
+        on pa1.mchid = pa2.machid
         <where>
             <if test="questParams != null"> (pa1.code like concat('%',#{questParams,jdbcType=VARCHAR} ,'%') or pa1.name like concat('%',#{questParams,jdbcType=VARCHAR} ,'%'))</if>
             <if test="siteId != null"> and pa1.site_id=#{siteId}</if>
@@ -122,7 +122,7 @@
     <select id="ExitsData" resultType="java.lang.Long">
         select id from pay_pay_agentbranch
         where site_id =#{siteId} and customer_id =#{customerId}
-          and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
+        and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
         <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
 </mapper>

+ 33 - 49
smart-city-platform/src/main/resources/mapper/pay/PayPayCheckbalanceMapper.xml

@@ -4,35 +4,17 @@
     <select id="findSysMonthCycle" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceItemDto">
         select
             #{cycle} cycle,
-            ppac.agent_name as typeName,
-            ppac.agent_code as typeCode,
+            psd.label as typeName,
+            psd.`value` as typeCode,
             SUM(ppac.amount) sumAmount
         from pay_pay_agenttransaction ppac
-        where ppac.transtime>= #{stTime} and ppac.transtime &lt;= #{endTime} and ppac.state not in(0,4)
+        left join pay_pay_agentbranch ppa on ppac.agentbranch_id = ppa.id and ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
+        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
+        where ppac.transtime>= #{stTime} and ppac.transtime <![CDATA[<=]]> #{endTime} and ppac.state not in(0,4)
         and ppac.site_id=#{siteId} and ppac.customer_id=#{customerId}
-        group by ppac.agent_name,ppac.agent_code
+        group by psd.label,psd.`value`
     </select>
 
-    <select id="findSysMonthCycle2" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceAgentDto">
-        SELECT
-            ppab.name as agentName,
-            ppab.type agentTypeId,
-            SUM(ppac.amount) sysData,
-            #{cycle} cycle
-        from pay_pay_agenttransaction ppac
-        left JOIN pay_pay_agentbranch ppab on ppab.id = ppac.agentbranch_id
-        where ppac.transtime>= #{stTime} and ppac.transtime <![CDATA[<]]> #{endTime}
-            and ppac.site_id=#{siteId} and ppac.customer_id=#{customerId} and ppab.name=#{agentName}
-        GROUP BY ppab.name,ppab.type
-    </select>
-
-    <select id="findTradeMonthCycle2" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceAgentDto">
-        select
-            IFNULL(sum(trans_fee),0) tradeData
-        from pay_pay_checkbalance
-        where transtime>=#{stTime} and transtime <![CDATA[<]]> #{endTime}
-            and site_id=#{siteId} and customer_id=#{customerId} and machid=#{machid}
-    </select>
 
     <select id="findTradeMonthCycle" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceItemDto">
         select
@@ -55,31 +37,33 @@
 
     <select id="findClosingAccount" resultType="com.bz.smart_city.entity.pay.BaseClosingAccountInfo">
         select
-            pbc.`name`,
-            pbc.`year`,
-            pbc.`month`,
-            pbc.starttime as startTime,
-            pbc.endtime as endTime,
-            pbc.state
+        pbc.`name`,
+        pbc.`year`,
+        pbc.`month`,
+        pbc.starttime as startTime,
+        pbc.endtime as endTime,
+        pbc.state
         from pay_base_closingaccountinfo pbc
         where pbc.year=#{year,jdbcType=INTEGER} and pbc.site_id=#{siteId} and pbc.customer_id=#{customerId}
         and pbc.endtime is not null and pbc.starttime is not null
         <if test="month != null and month != '' "> and pbc.month=#{month}</if>
-         order by pbc.year,pbc.month desc
+        order by pbc.year,pbc.month desc
     </select>
 
 
 
     <select id="findSysDay2Cycle" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceItemDto">
         select
-            ppac.agent_name as typeName,
-            ppac.agent_code as typeCode,
+            psd.label as typeName,
+            psd.`value` as typeCode,
             IFNULL(SUM(ppac.amount),0) sumAmount,
             date(ppac.transtime) as ymd
         from pay_pay_agenttransaction ppac
+        left join pay_pay_agentbranch ppa on ppac.agentbranch_id = ppa.id and ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
+        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
         where ppac.state not in(0,4) and  ppac.transtime >= #{stTime} and ppac.transtime <![CDATA[<=]]> #{endTime}
         and ppac.site_id=#{siteId} and ppac.customer_id=#{customerId}
-        group by agent_name,agent_code,ymd ORDER BY ymd asc
+        group by psd.label,psd.`value`,ymd ORDER BY ymd asc
     </select>
 
 
@@ -106,25 +90,25 @@
 
     <select id="findTradeDetail" resultType="com.bz.smart_city.dto.pay.PayBaseAccountTransactionsDto">
         select
-            ptrans.id,
-            ptrans.`name` as transactionInfo,
-            ptrans.payseriesno,
-            ptrans.transamount,
-            ptrans.transtime,
-            ptrans.transtype,
-            ptrans.payway,
-            psd1.label as transtypeName,
-            psd2.label as paywayName,
-            pagent.order_no orderNo,
-            ptrans.canceltime,
-            ptrans.iscanceled,
-            ptrans.cancelperson,
-            scu.`name` as cancelpersonName
+        ptrans.id,
+        ptrans.`name` as transactionInfo,
+        ptrans.payseriesno,
+        ptrans.transamount,
+        ptrans.transtime,
+        ptrans.transtype,
+        ptrans.payway,
+        psd1.label as transtypeName,
+        psd2.label as paywayName,
+        pagent.order_no orderNo,
+        ptrans.canceltime,
+        ptrans.iscanceled,
+        ptrans.cancelperson,
+        scu.`name` as cancelpersonName
         from pay_pay_transactiondetails ptrans
         LEFT JOIN pay_sys_dict psd1 on psd1.`value` = ptrans.transtype and psd1.type='交易类型' and psd1.site_id=#{siteId} and psd1.customer_id=#{customerId}
         LEFT JOIN pay_sys_dict psd2 on psd2.`value` = ptrans.payway and psd2.type='支付方式' and psd2.site_id=#{siteId} and psd2.customer_id=#{customerId}
         left join pay_pay_agenttransaction pagent on pagent.payseriesno = ptrans.payseriesno and pagent.site_id=#{siteId} and pagent.customer_id=#{customerId}
-		left join sc_user scu on scu.id = ptrans.cancelperson
+        left join sc_user scu on scu.id = ptrans.cancelperson
         where ptrans.site_id=#{siteId} and ptrans.customer_id=#{customerId}
         and ptrans.create_date >= #{stTime} and ptrans.create_date <![CDATA[<]]> #{endTime}
         <if test="name != null and name != '' ">