| | |
| | | long times = rechargeAmount1.divide(s_total_amount, 0, RoundingMode.DOWN).longValue(); |
| | | if(times > m){ |
| | | //充电时间跨度两个计费策略,需要继续对下一个策略进行计算 |
| | | serviceCharge = s_server_amount.multiply(new BigDecimal(m)); |
| | | serviceCharge = serviceCharge.add(s_server_amount.multiply(new BigDecimal(m))); |
| | | rechargeAmount1 = rechargeAmount1.subtract(s_total_amount.multiply(new BigDecimal(m))); |
| | | if(null != discount){ |
| | | discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); |
| | | } |
| | | nowTimeMillis = null; |
| | | }else{ |
| | | serviceCharge = s_server_amount.multiply(new BigDecimal(times)); |
| | | if(null != discount){ |
| | | discountAmount = discountAmount.add(serviceCharge.multiply(new BigDecimal(1).subtract(discount))); |
| | | } |
| | | serviceCharge = serviceCharge.add(s_server_amount.multiply(new BigDecimal(times))); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(null != discount){ |
| | | discountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(discount)); |
| | | } |
| | | |
| | | if(discountAmount.compareTo(BigDecimal.ZERO) >= 0){ |
| | | //计算会员最大优惠金额 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | |
| | | } |
| | | } |
| | | discountAmount = discountAmount.setScale(4, RoundingMode.HALF_EVEN); |
| | | if(discountAmount.compareTo(BigDecimal.ZERO) >= 0){ |
| | | data.setChargeNum(data.getChargeNum() - 1); |
| | | appUserVipDetailClient.updateAppUserVipDetail(data); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //机子上显示的金额为用户充值的金额+会员折扣金额 |
| | | BigDecimal account_balance = chargingOrder.getRechargeAmount().add(discountAmount).setScale(4, RoundingMode.HALF_EVEN); |
| | |
| | | BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100)); |
| | | chargingOrderRefund.setRefundFee(refund_fee); |
| | | chargingOrderRefundService.updateById(chargingOrderRefund); |
| | | //回退会员折扣次数 |
| | | if(chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO) > 0){ |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); |
| | | getAppUserVipDetail.setVipId(appUser.getVipId()); |
| | | TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); |
| | | if(null != data){ |
| | | data.setChargeNum(data.getChargeNum() + 1); |
| | | appUserVipDetailClient.updateAppUserVipDetail(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(2 == rechargePaymentType){ |
| | |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | //回退会员折扣次数 |
| | | if(chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO) > 0){ |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); |
| | | getAppUserVipDetail.setVipId(appUser.getVipId()); |
| | | TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); |
| | | if(null != data){ |
| | | data.setChargeNum(data.getChargeNum() + 1); |
| | | appUserVipDetailClient.updateAppUserVipDetail(data); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | |
| | | List<TChargingPile> allPile = chargingGunClient.getAllPile().getData(); |
| | | List<Site> data9 = siteClient.getSiteAll().getData(); |
| | | List<TAppUser> data6 = appUserClient.getAllUser().getData(); |
| | | List<Partner> data7 = siteClient.getAllPartner().getData(); |
| | | List<TAppUserCar> data4 = appUserCarClient.getAllCar().getData(); |
| | | String startTime1 = null; |
| | | String startTime2 = null; |
| | |
| | | List<ChargingOrderVO> list1 = this.baseMapper.chargingOrder(pageInfo1,dto,startTime1,startTime2,endTime1,endTime2); |
| | | BigDecimal total = new BigDecimal("0"); |
| | | long time = 0L; |
| | | BigDecimal income = new BigDecimal("0"); |
| | | BigDecimal electronicMoney = new BigDecimal("0"); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | BigDecimal commissionMoney = new BigDecimal("0"); |
| | | BigDecimal refundMoney = new BigDecimal("0"); |
| | | BigDecimal paymentMoney = new BigDecimal("0"); |
| | | List<Long> collect = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | List<TChargingOrderAccountingStrategy> list3 = chargingOrderAccountingStrategyService.list(); |
| | | |
| | | for (ChargingOrderVO chargingOrderVO : list) { |
| | |
| | | } |
| | | |
| | | |
| | | List<Long> orderIds = list1.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | if(orderIds.isEmpty())orderIds.add(-1L); |
| | | List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery() |
| | | .eq(TChargingOrderRefund::getRefundStatus,2).list(); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getSumByType(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getSumByType(chargingOrderIds); |
| | | public List<Map<String, Object>> getSumByType(LocalDate start,LocalDate end) { |
| | | LocalDateTime start1 = start.atStartOfDay(); |
| | | LocalDateTime end1 = end.atTime(LocalTime.MAX); |
| | | return this.baseMapper.getSumByType(start1,end1); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getDateData(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getDateData(chargingOrderIds); |
| | | public List<Map<String, Object>> getDateData(LocalDate start,LocalDate end) { |
| | | LocalDateTime start1 = start.atStartOfDay(); |
| | | LocalDateTime end1 = end.atTime(LocalTime.MAX); |
| | | return this.baseMapper.getDateData(start1,end1); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getWeekData(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getWeekData(chargingOrderIds); |
| | | public List<Map<String, Object>> getWeekData(LocalDate start,LocalDate end) { |
| | | LocalDateTime start1 = start.atStartOfDay(); |
| | | LocalDateTime end1 = end.atTime(LocalTime.MAX); |
| | | return this.baseMapper.getWeekData(start1,end1); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getMonthData(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getMonthData(chargingOrderIds); |
| | | public List<Map<String, Object>> getMonthData(LocalDate start,LocalDate end) { |
| | | LocalDateTime start1 = start.atStartOfDay(); |
| | | LocalDateTime end1 = end.atTime(LocalTime.MAX); |
| | | return this.baseMapper.getMonthData(start1,end1); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getYearData(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getYearData(chargingOrderIds); |
| | | public List<Map<String, Object>> getYearData(LocalDate start,LocalDate end) { |
| | | LocalDateTime start1 = start.atStartOfDay(); |
| | | LocalDateTime end1 = end.atTime(LocalTime.MAX); |
| | | return this.baseMapper.getYearData(start1,end1); |
| | | } |
| | | |
| | | @Resource |
| | |
| | | if(null == chargingOrder){ |
| | | return R.ok(); |
| | | } |
| | | // Integer status = chargingOrder.getStatus(); |
| | | // if(status == 5){ |
| | | // return R.ok(); |
| | | // } |
| | | Integer status = chargingOrder.getStatus(); |
| | | if(status == 5){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | //如果使用优惠券需要判断优惠券是否满足使用条件 |
| | | //根据实际的充电金额计算退款金额 退回费用=(原金额/总金额)*(总金额-实际充电金额) |
| | |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getByDate(List<Long> chargingOrderIds) { |
| | | return this.baseMapper.getByDate(chargingOrderIds); |
| | | public List<Map<String, Object>> getByDate(LocalDate start,LocalDate end) { |
| | | |
| | | LocalDateTime start1 = start.atStartOfDay(); |
| | | LocalDateTime end1 = end.atTime(LocalTime.MAX); |
| | | return this.baseMapper.getByDate(start1,end1); |
| | | } |
| | | |
| | | @Override |
| | |
| | | chargingOrder.setStatus(2); |
| | | chargingOrder.setPayTime(LocalDateTime.now()); |
| | | chargingOrder.setChargeAmount(chargingOrder.getRechargeAmount()); |
| | | chargingOrder.setVipDiscountAmount(BigDecimal.ZERO); |
| | | this.save(chargingOrder); |
| | | |
| | | Integer accountingStrategyId = tChargingGun.getAccountingStrategyId(); |