| | |
| | | appUserTagClient.addUserTag(data1); |
| | | } |
| | | } |
| | | //充电评率 |
| | | //充电频率 |
| | | List<TUserTag> userTagList2 = data.stream().filter(s -> s.getStandardCondition() == 2).collect(Collectors.toList()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (TUserTag tUserTag : userTagList2) { |
| | | TAppUserTag appUserTag = new TAppUserTag(); |
| | | appUserTag.setAppUserId(chargingOrder.getAppUserId()); |
| | | appUserTag.setUserTagId(tUserTag.getId()); |
| | | TAppUserTag data1 = appUserTagClient.getUserTag(appUserTag).getData(); |
| | | if(null == data1){ |
| | | Integer day = JSON.parseObject(tUserTag.getConditions()).getInteger("day"); |
| | | Integer times = JSON.parseObject(tUserTag.getConditions()).getInteger("times"); |
| | | Calendar start = Calendar.getInstance(); |
| | | start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + day); |
| | | count1 = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).isNotNull(TChargingOrder::getPaymentAmount) |
| | | .between(TChargingOrder::getStartTime, sdf.format(start.getTime()), sdf.format(new Date())).eq(TChargingOrder::getDelFlag, 0)); |
| | | //加上本次充电 |
| | | if(count1 >= times){ |
| | | data1 = new TAppUserTag(); |
| | | data1.setAppUserId(chargingOrder.getAppUserId()); |
| | | data1.setUserTagId(tUserTag.getId()); |
| | | data1.setCreateTime(LocalDateTime.now()); |
| | | appUserTagClient.addUserTag(data1); |
| | | } |
| | | |
| | | Integer day = JSON.parseObject(tUserTag.getConditions()).getInteger("day"); |
| | | Integer times = JSON.parseObject(tUserTag.getConditions()).getInteger("times"); |
| | | LocalDateTime endTime = LocalDateTime.now(); |
| | | endTime.plusDays(day); |
| | | String start = tUserTag.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | String end = endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | count1 = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).isNotNull(TChargingOrder::getPaymentAmount) |
| | | .between(TChargingOrder::getStartTime, start, end).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null == data1 && (count1 + 1) >= times){ |
| | | data1 = new TAppUserTag(); |
| | | data1.setAppUserId(chargingOrder.getAppUserId()); |
| | | data1.setUserTagId(tUserTag.getId()); |
| | | data1.setCreateTime(LocalDateTime.now()); |
| | | appUserTagClient.addUserTag(data1); |
| | | } |
| | | } |
| | | } |
| | |
| | | order.setCouponDiscountAmount(couponDiscountAmount); |
| | | payAmount = payAmount.subtract(couponDiscountAmount); |
| | | } |
| | | |
| | | appCoupon.setStatus(2); |
| | | appCouponClient.updateAppCoupon(appCoupon); |
| | | }else{ |
| | | order.setAppCouponId(null); |
| | | order.setCouponDiscountAmount(BigDecimal.ZERO); |
| | |
| | | order.setCouponDiscountAmount(divide); |
| | | payAmount = payAmount.subtract(divide); |
| | | } |
| | | |
| | | appCoupon.setStatus(2); |
| | | appCouponClient.updateAppCoupon(appCoupon); |
| | | }else{ |
| | | order.setAppCouponId(null); |
| | | order.setCouponDiscountAmount(BigDecimal.ZERO); |
| | |
| | | info.setRefundAmount(chargingOrder.getRefundAmount()); |
| | | LocalDateTime startTime = chargingOrder.getStartTime(); |
| | | LocalDateTime endTime = chargingOrder.getEndTime(); |
| | | info.setStartDay(startTime.format(DateTimeFormatter.ofPattern("MM月dd日")) + " 周" + startTime.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.SIMPLIFIED_CHINESE)); |
| | | info.setStartDay(startTime.format(DateTimeFormatter.ofPattern("MM月dd日")) + " " + startTime.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.SIMPLIFIED_CHINESE)); |
| | | info.setStartHour(startTime.format(DateTimeFormatter.ofPattern("HH:mm"))); |
| | | info.setEndDay(endTime.format(DateTimeFormatter.ofPattern("MM月dd日")) + " 周" + endTime.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.SIMPLIFIED_CHINESE)); |
| | | info.setEndDay(endTime.format(DateTimeFormatter.ofPattern("MM月dd日")) + " " + endTime.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.SIMPLIFIED_CHINESE)); |
| | | info.setEndHour(endTime.format(DateTimeFormatter.ofPattern("HH:mm"))); |
| | | int hour = endTime.getHour() - startTime.getHour(); |
| | | int second = endTime.getMinute() - startTime.getMinute(); |
| | | long time = (endTime.toEpochSecond(ZoneOffset.UTC) - startTime.toEpochSecond(ZoneOffset.UTC)) / 60; |
| | | long hour = time / 60; |
| | | long second = time % 60; |
| | | info.setDuration(0 == hour ? String.format("%s分钟", second) : String.format("%s小时%s分钟", hour, second)); |
| | | return info; |
| | | } |