diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/OrderBasicInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/OrderBasicInfoController.java index 82deb1ce4..113b87a1a 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/OrderBasicInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/OrderBasicInfoController.java @@ -257,7 +257,7 @@ public class OrderBasicInfoController extends BaseController { * 根据汇付会员id查询分账汇总数据 * @return */ - @PostMapping + @PostMapping("/queryStationAggregateData") public RestApiResponse queryStationAggregateData(@RequestBody QueryOrderSplitDTO dto) { RestApiResponse response = null; try { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java index 4ce17230a..e491752ee 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderSplitRecordServiceImpl.java @@ -365,53 +365,83 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService { //根据分组进行分账信息的汇总 List resultList = Lists.newArrayList(); + for (Map.Entry> entry : collect.entrySet()) { String stationId = entry.getKey(); List splitConfigStationVOList = entry.getValue(); - //计算时间范围 - List sortedList = splitConfigStationVOList.stream() - .sorted(Comparator.comparing(SplitConfigStationVO::getTradeDate)) - .collect(Collectors.toList()); - String startTime = sortedList.get(0).getTradeDate(); - String endTime = sortedList.get(sortedList.size() - 1).getTradeDate(); + // //计算时间范围 + // List sortedList = splitConfigStationVOList.stream() + // .sorted(Comparator.comparing(SplitConfigStationVO::getTradeDate)) + // .collect(Collectors.toList()); + // String startTime = sortedList.get(0).getTradeDate(); + // String endTime = sortedList.get(sortedList.size() - 1).getTradeDate(); + + String timeRange = dto.getStartTime() + "至" + dto.getEndTime(); + + BigDecimal totalElectricitySplitAmount = BigDecimal.ZERO; + BigDecimal totalServiceSplitAmount = BigDecimal.ZERO; + BigDecimal totalFeeAmount = BigDecimal.ZERO; + for (SplitConfigStationVO splitConfigStationVO : splitConfigStationVOList) { + // 总电费分账金额 + totalElectricitySplitAmount = totalElectricitySplitAmount.add(splitConfigStationVO.getElectricityAmount()); + // 总服务费分账金额 + totalServiceSplitAmount = totalServiceSplitAmount.add(splitConfigStationVO.getServiceAmount()); + // 总手续费 + totalFeeAmount = totalFeeAmount.add(splitConfigStationVO.getFeeAmount()); + } + + // 总收入 + BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount); + + SplitConfigOrderVO vo = SplitConfigOrderVO.builder() + .stationId(stationId) + .stationName(splitConfigStationVOList.get(0).getStationName()) + .totalElectricitySplitAmount(totalElectricitySplitAmount) + .totalServiceSplitAmount(totalServiceSplitAmount) + .totalFeeAmount(totalFeeAmount) + .totalRevenueAmount(totalRevenueAmount) + .orderCount(splitConfigStationVOList.size()) + .timeRange(timeRange) + + .build(); + resultList.add(vo); - String timeRange = startTime + "至" + endTime; //总的电费分账金额totalElectricitySplitAmount - BigDecimal totalElectricitySplitAmount = - splitConfigStationVOList.stream() - .map(SplitConfigStationVO::getElectricityAmount) - .filter(Objects::nonNull) //过滤掉null - .reduce(BigDecimal.ZERO, BigDecimal::add); - //总的服务费分账金额totalServiceSplitAmount - BigDecimal totalServiceSplitAmount = - splitConfigStationVOList.stream() - .map(SplitConfigStationVO::getServiceAmount) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); - //总手续费分账金额totalFeeAmount - BigDecimal totalFeeAmount = - splitConfigStationVOList.stream() - .map(SplitConfigStationVO::getFeeAmount) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - //总收入分账金额= 总电费分账金额 +总手续费分账金额 -总手续费分账金额 - BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount); - SplitConfigOrderVO splitConfigOrderVO = - SplitConfigOrderVO.builder() - .stationId(stationId) - .stationName(splitConfigStationVOList.get(0).getStationName()) - .orderCount(splitConfigStationVOList.size()) - .timeRange(timeRange) - .totalElectricitySplitAmount(totalElectricitySplitAmount) - .totalServiceSplitAmount(totalServiceSplitAmount) - .totalFeeAmount(totalFeeAmount) - .totalRevenueAmount(totalRevenueAmount) - .build(); - - resultList.add(splitConfigOrderVO); + // BigDecimal totalElectricitySplitAmount = + // splitConfigStationVOList.stream() + // .map(SplitConfigStationVO::getElectricityAmount) + // .filter(Objects::nonNull) //过滤掉null + // .reduce(BigDecimal.ZERO, BigDecimal::add); + // //总的服务费分账金额totalServiceSplitAmount + // BigDecimal totalServiceSplitAmount = + // splitConfigStationVOList.stream() + // .map(SplitConfigStationVO::getServiceAmount) + // .filter(Objects::nonNull) + // .reduce(BigDecimal.ZERO, BigDecimal::add); + // //总手续费分账金额totalFeeAmount + // BigDecimal totalFeeAmount = + // splitConfigStationVOList.stream() + // .map(SplitConfigStationVO::getFeeAmount) + // .filter(Objects::nonNull) + // .reduce(BigDecimal.ZERO, BigDecimal::add); + // + // //总收入分账金额= 总电费分账金额 +总手续费分账金额 -总手续费分账金额 + // BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount); + // SplitConfigOrderVO splitConfigOrderVO = + // SplitConfigOrderVO.builder() + // .stationId(stationId) + // .stationName(splitConfigStationVOList.get(0).getStationName()) + // .orderCount(splitConfigStationVOList.size()) + // .timeRange(timeRange) + // .totalElectricitySplitAmount(totalElectricitySplitAmount) + // .totalServiceSplitAmount(totalServiceSplitAmount) + // .totalFeeAmount(totalFeeAmount) + // .totalRevenueAmount(totalRevenueAmount) + // .build(); + // + // resultList.add(splitConfigOrderVO); } return resultList; } diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderSplitRecordMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderSplitRecordMapper.xml index 27fd03e54..8e9d458f1 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderSplitRecordMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderSplitRecordMapper.xml @@ -874,7 +874,10 @@ WHERE t1.adapay_member_id = #{adapayMemberId} AND t1.del_flag = '0' - AND t1.trade_date BETWEEN #{startTime,jdbcType=VARCHAR} AND #{endTime,jdbcType=VARCHAR}; + AND t1.trade_date BETWEEN #{startTime,jdbcType=VARCHAR} AND #{endTime,jdbcType=VARCHAR} + + and t1.station_id = #{dto.stationId,jdbcType=VARCHAR} +