| | |
| | | Integer totalAvailablePoint = 0; |
| | | Integer transferablePoint = 0; |
| | | for (AppUserGiveawayTemporary datum : data) { |
| | | if(datum.getAppUserId().longValue() != appUserId){ |
| | | if(datum.getAppUserId().longValue() == appUserId){ |
| | | sharePoint += datum.getSharePoint(); |
| | | balance = balance.add(datum.getBalance()); |
| | | withdrawableAmount = withdrawableAmount.add(datum.getWithdrawableAmount()); |
| | |
| | | |
| | | //开始处理明细流水 |
| | | List<BalanceChangeRecordCopy> data2 = balanceChangeRecordClient.getBalanceChangeRecordCopy(order.getId(), Arrays.asList(4)).getData(); |
| | | if(null != data2){ |
| | | for(BalanceChangeRecordCopy item : data2){ |
| | | BalanceChangeRecord changeRecord = new BalanceChangeRecord(); |
| | | BeanUtil.copyProperties(item, changeRecord); |
| | | changeRecord.setId(null); |
| | | balanceChangeRecordClient.saveBalanceChangeRecord(changeRecord); |
| | | } |
| | | } |
| | | balanceChangeRecordClient.deleteBalanceChangeRecordCopy(order.getId(), Arrays.asList(4)); |
| | | |
| | | List<UserPointCopy> data3 = userPointClient.getUserPointCopy(order.getId(), Arrays.asList(2,8,9,10,14)).getData(); |
| | | if(null != data3){ |
| | | for(UserPointCopy item : data3){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | BeanUtil.copyProperties(item, userPoint); |
| | | userPoint.setId(null); |
| | | userPointClient.saveUserPoint(userPoint); |
| | | } |
| | | } |
| | | userPointClient.deleteUserPointCopy(order.getId(), Arrays.asList(2,8,9,10,14)); |
| | | |
| | | |
| | | List<ShopBalanceStatementCopy> data4 = shopBalanceStatementClient.getShopBalanceStatementCopy(order.getId(), Arrays.asList(1,2,3)).getData(); |
| | | if(null != data4){ |
| | | for(ShopBalanceStatementCopy item : data4){ |
| | | ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); |
| | | BeanUtil.copyProperties(item, shopBalanceStatement); |
| | | shopBalanceStatement.setId(null); |
| | | shopBalanceStatementClient.saveShopBalanceStatement(shopBalanceStatement); |
| | | } |
| | | } |
| | | shopBalanceStatementClient.deleteShopBalanceStatementCopy(order.getId(), Arrays.asList(1,2,3)); |
| | | |
| | | List<ShopPointCopy> data5 = shopPointClient.getShopPointCopy(order.getId(), Arrays.asList(1,2,3)).getData(); |
| | | if(null != data5){ |
| | | for(ShopPointCopy item : data5){ |
| | | ShopPoint shopPoint = new ShopPoint(); |
| | | BeanUtil.copyProperties(item, shopPoint); |
| | | shopPoint.setId(null); |
| | | shopPointClient.saveShopPoint(shopPoint); |
| | | } |
| | | } |
| | | shopPointClient.deleteShopPointCopy(order.getId(), Arrays.asList(1,2,3)); |
| | | order.setIsCommission(3); |
| | | orderService.updateById(order); |
| | | |
| | | appUserGiveawayTemporaryClient.delAppUserGiveawayTemporary(order.getId()); |
| | | shopGiveawayTemporaryClient.delShopGiveawayTemporary(order.getId()); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void calculationCommissionUser() { |
| | | List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().ne(Order::getIsCommission, 1).isNotNull(Order::getAfterSaleTime) |
| | | .eq(Order::getDelFlag, 0).ne(Order::getPayMethod, 3).last(" and after_sale_time <= now()")); |
| | | List<Long> collect = list.stream().map(Order::getId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return; |
| | | } |
| | | |
| | | for (Order order : list) { |
| | | public void calculationCommissionUser(Long orderId) { |
| | | Order order = orderService.getById(orderId); |
| | | List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>() |
| | | .eq(OrderGood::getOrderId, order.getId())); |
| | | AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); |
| | | if(null == appUser){ |
| | | continue; |
| | | log.error("无效的用户数据"); |
| | | return; |
| | | } |
| | | //指导老师分佣金额 |
| | | BigDecimal zdls_price = BigDecimal.ZERO; |
| | |
| | | |
| | | //直帮上级 |
| | | AppUser superiorLeader = appUserClient.getSuperiorLeader(appUser.getId()).getData(); |
| | | if(null == superiorLeader){ |
| | | log.error("指导老师查询失败"); |
| | | } |
| | | if(null != superiorLeader){ |
| | | BigDecimal balance = superiorLeader.getBalance(); |
| | | Integer lavePoint = superiorLeader.getLavePoint(); |
| | |
| | | |
| | | //服务商分佣 |
| | | Shop shop1 = shopClient.getServiceProvider(appUser.getId()).getData(); |
| | | if(null == shop1){ |
| | | log.error("服务商查询失败"); |
| | | } |
| | | if(null != shop1){ |
| | | AppUser bdShopAppUser = appUserClient.getAppUserById(shop1.getAppUserId()); |
| | | if(null == bdShopAppUser){ |
| | | log.error("服务商用户查询失败"); |
| | | } |
| | | if(null != bdShopAppUser){ |
| | | BigDecimal shopBalance = shop1.getBalance(); |
| | | Integer lavePoint = bdShopAppUser.getLavePoint(); |
| | |
| | | |
| | | //高级服务商 |
| | | Shop shop2 = shopClient.getSuperiorServiceProvider(order.getAppUserId()).getData(); |
| | | if(null == shop2){ |
| | | log.error("高级服务商查询失败"); |
| | | } |
| | | if(null != shop2){ |
| | | AppUser sjShopAppUser = appUserClient.getAppUserById(shop2.getAppUserId()); |
| | | if(null == sjShopAppUser){ |
| | | log.error("高级服务商用户查询失败"); |
| | | } |
| | | if(null != sjShopAppUser){ |
| | | BigDecimal shopBalance = shop2.getBalance(); |
| | | Integer lavePoint = sjShopAppUser.getLavePoint(); |
| | |
| | | } |
| | | } |
| | | |
| | | //自提单品和服务需要走线下核销流程 |
| | | if(order.getOrderType() == 2 && order.getDistributionMode() == 2){ |
| | | order.setIsCommission(2); |
| | | }else{ |
| | | order.setIsCommission(1); |
| | | orderService.updateById(order); |
| | | } |
| | | orderService.updateById(order); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void calculationCommissionShop() { |
| | | List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().ne(Order::getIsCommission, 2).isNotNull(Order::getAfterSaleTime) |
| | | .eq(Order::getDelFlag, 0).ne(Order::getPayMethod, 3).last(" and after_sale_time <= now()")); |
| | | List<Long> collect = list.stream().map(Order::getId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return; |
| | | } |
| | | |
| | | for (Order order : list) { |
| | | public void calculationCommissionShop(Long orderId) { |
| | | Order order = orderService.getById(orderId); |
| | | List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>() |
| | | .eq(OrderGood::getOrderId, order.getId())); |
| | | AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); |
| | | if(null == appUser){ |
| | | continue; |
| | | return; |
| | | } |
| | | //核销门店分佣金额 |
| | | BigDecimal hxmd_price = BigDecimal.ZERO; |
| | |
| | | //核销门店 |
| | | Shop shop = shopClient.getShopById(order.getShopId()).getData(); |
| | | AppUser shopAppUser = appUserClient.getAppUserById(shop.getAppUserId()); |
| | | if(null == shopAppUser){ |
| | | log.error("核销门店用户查询失败"); |
| | | } |
| | | if(null != shopAppUser){ |
| | | BigDecimal shopBalance = shop.getBalance(); |
| | | Integer lavePoint = shopAppUser.getLavePoint(); |
| | |
| | | shopBalanceStatementClient.saveShopBalanceStatementCopy(shopBalanceStatementCopy); |
| | | } |
| | | //添加积分明细 |
| | | if(!shopAppUser.getLavePoint().equals(lavePoint)){ |
| | | if(hxmd_point > 0){ |
| | | UserPointCopy userPointCopy = new UserPointCopy(); |
| | | userPointCopy.setType(8); |
| | | userPointCopy.setHistoricalPoint(lavePoint); |
| | |
| | | // appUserClient.vipUpgrade(shopAppUser.getId()); |
| | | } |
| | | |
| | | if(!shop.getLavePoint().equals(shopLavePoint)){ |
| | | if(hxmd_point > 0){ |
| | | ShopPointCopy shopPointCopy = new ShopPointCopy(); |
| | | shopPointCopy.setShopId(shop.getId()); |
| | | shopPointCopy.setType(1); |
| | |
| | | //技师服务积分 |
| | | if(order.getOrderType() == 1){ |
| | | Technician technician = technicianClient.shopdetail(order.getTechnicianId()).getData(); |
| | | if(null == technician){ |
| | | log.error("技师查询失败"); |
| | | } |
| | | if(null != technician){ |
| | | AppUser technicianAppUser = appUserClient.getAppUserById(technician.getAppUserId()); |
| | | if(null != technicianAppUser){ |
| | |
| | | } |
| | | // appUserClient.editAppUserById(technicianAppUser); |
| | | //添加积分明细 |
| | | if(!technicianAppUser.getLavePoint().equals(lavePoint)){ |
| | | if(js_point > 0){ |
| | | UserPointCopy userPointCopy = new UserPointCopy(); |
| | | userPointCopy.setType(10); |
| | | userPointCopy.setHistoricalPoint(lavePoint); |
| | |
| | | |
| | | order.setIsCommission(2); |
| | | orderService.updateById(order); |
| | | } |
| | | } |
| | | |
| | | |