| | |
| | | //处理用户标签数据 |
| | | List<TUserTag> data = userTagClient.getAllUserTag().getData(); |
| | | //累计充电次数 |
| | | long count1 = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).isNotNull(TChargingOrder::getPaymentAmount).eq(TChargingOrder::getDelFlag, 0)); |
| | | List<TUserTag> userTagList1 = data.stream().filter(s -> s.getStandardCondition() == 1).collect(Collectors.toList()); |
| | | int old_times = 0; |
| | | Integer userTagId = null; |
| | | for (TUserTag tUserTag : userTagList1) { |
| | | Integer times = JSON.parseObject(tUserTag.getConditions()).getInteger("times"); |
| | | //加上本次充电 |
| | | //获取最大值标签 |
| | | if((count1 + 1) >= times && old_times < times){ |
| | | userTagId = tUserTag.getId(); |
| | | old_times = times; |
| | | } |
| | | } |
| | | if(null != userTagId){ |
| | | TAppUserTag appUserTag = new TAppUserTag(); |
| | | appUserTag.setAppUserId(chargingOrder.getAppUserId()); |
| | | appUserTag.setUserTagId(userTagId); |
| | | appUserTag.setUserTagId(tUserTag.getId()); |
| | | TAppUserTag data1 = appUserTagClient.getUserTag(appUserTag).getData(); |
| | | if(null == data1){ |
| | | |
| | | String start = tUserTag.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | String end = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | long count1 = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).between(TChargingOrder::getStartTime, start, end).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null == data1 && count1 >= times){ |
| | | data1 = new TAppUserTag(); |
| | | data1.setAppUserId(chargingOrder.getAppUserId()); |
| | | data1.setUserTagId(userTagId); |
| | | data1.setUserTagId(tUserTag.getId()); |
| | | data1.setCreateTime(LocalDateTime.now()); |
| | | appUserTagClient.addUserTag(data1); |
| | | } |
| | |
| | | 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){ |
| | | long count1 = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).between(TChargingOrder::getStartTime, start, end).eq(TChargingOrder::getDelFlag, 0)); |
| | | if(null == data1 && count1 >= times){ |
| | | data1 = new TAppUserTag(); |
| | | data1.setAppUserId(chargingOrder.getAppUserId()); |
| | | data1.setUserTagId(tUserTag.getId()); |