| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | startTime1 = split[0]; |
| | | startTime2 = split[1]; |
| | | } |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (dto.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteId()); |
| | | } |
| | | dto.setSiteIds(siteIds); |
| | | PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | PageInfo<ChargingBillListVO> pageInfo1 = new PageInfo<>(1,9999999); |
| | | List<ChargingBillListVO> list = this.baseMapper.chargingBillList1(pageInfo,dto,startTime1,startTime2); |
| | |
| | | if (data3!=null)tChargingOrder.setUserName(data3.getName()); |
| | | // 累加实收金额 支付结算金额 |
| | | if (tChargingOrder.getChargeAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | // 总金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount()); |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | |
| | | // 累加订单金额 |
| | |
| | | } |
| | | PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | PageInfo<ChargingBillListVO> pageInfo1 = new PageInfo<>(1,9999999); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (dto.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteId()); |
| | | } |
| | | List<ChargingBillListVO> list = this.baseMapper.chargingBillList(pageInfo,dto,startTime1,startTime2); |
| | | List<ChargingBillListVO> list1 = this.baseMapper.chargingBillList(pageInfo1,dto,startTime1,startTime2); |
| | | BigDecimal paymentAmountTotal = new BigDecimal("0"); |
| | |
| | | BigDecimal sharingAmountTotal = new BigDecimal("0"); |
| | | BigDecimal chargingCapacityTotal = new BigDecimal("0"); |
| | | BigDecimal discountTotal = new BigDecimal("0"); |
| | | BigDecimal refundAmount = new BigDecimal("0"); |
| | | BigDecimal refundAmountTotal = new BigDecimal("0"); |
| | | int orderCount = 0; |
| | | for (ChargingBillListVO chargingBillListVO : list) { |
| | | String temp = ""; |
| | |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | BigDecimal refundAmount = new BigDecimal("0"); |
| | | chargingBillVO.setCategory(""); |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); |
| | | } |
| | | // 累加订单金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); |
| | | orderAmountTotal = orderAmountTotal.add(tChargingOrder.getPaymentAmount()); |
| | | if (tChargingOrder.getRechargeAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount()); |
| | | orderAmountTotal = orderAmountTotal.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | // 累加累计电费 |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | |
| | | electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus() !=null && tChargingOrder.getRefundStatus() == 2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | refundAmountTotal = refundAmountTotal.add(tChargingOrder.getRefundAmount()); |
| | | } |
| | | // 累加累计服务费 |
| | | if (tChargingOrder.getServiceCharge()!=null){ |
| | |
| | | } |
| | | } |
| | | chargingBillVO.setChargingCapacity(chargingCapacityTotal); |
| | | chargingBillVO.setPaymentAmount(orderAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setPaymentAmount(paymentAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setOrderAmount(orderAmountTotal.subtract(refundAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setOrderCount(orderCount); |