From c6899e1be764cb94d340a14b08f8c8f8880fb818 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 26 十二月 2024 20:06:50 +0800 Subject: [PATCH] 修改分佣逻辑 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java | 49 ++++++++++++++++++++++++++----------------------- 1 files changed, 26 insertions(+), 23 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java index e40aedf..e4a8c6c 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java @@ -72,7 +72,7 @@ continue; } List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>() - .eq(OrderGood::getGoodsId, order.getId())); + .eq(OrderGood::getOrderId, order.getId())); AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); //直推上级分佣金额 BigDecimal ztsj_price = BigDecimal.ZERO; @@ -308,26 +308,28 @@ //技师服务积分 if(order.getOrderType() == 1){ Technician technician = technicianClient.shopdetail(order.getTechnicianId()).getData(); - AppUser technicianAppUser = appUserClient.getAppUserById(technician.getAppUserId()); - Integer lavePoint = technicianAppUser.getLavePoint(); - if(js_point > 0){ - technicianAppUser.setLavePoint(technicianAppUser.getLavePoint() + js_point); - technicianAppUser.setTotalPoint(technicianAppUser.getTotalPoint() + js_point); - technicianAppUser.setTotalPerformancePoint(technicianAppUser.getTotalPerformancePoint() + js_point); - } - appUserClient.editAppUserById(technicianAppUser); - //添加积分明细 - if(!technicianAppUser.getLavePoint().equals(lavePoint)){ - UserPoint userPoint = new UserPoint(); - userPoint.setType(10); - userPoint.setHistoricalPoint(lavePoint); - userPoint.setVariablePoint(js_point); - userPoint.setBalance(technicianAppUser.getLavePoint()); - userPoint.setCreateTime(LocalDateTime.now()); - userPoint.setAppUserId(technicianAppUser.getId()); - userPoint.setObjectId(order.getId()); - userPoint.setExtention(order.getOrderNumber()); - userPointClient.saveUserPoint(userPoint); + if(null != technician){ + AppUser technicianAppUser = appUserClient.getAppUserById(technician.getAppUserId()); + Integer lavePoint = technicianAppUser.getLavePoint(); + if(js_point > 0){ + technicianAppUser.setLavePoint(technicianAppUser.getLavePoint() + js_point); + technicianAppUser.setTotalPoint(technicianAppUser.getTotalPoint() + js_point); + technicianAppUser.setTotalPerformancePoint(technicianAppUser.getTotalPerformancePoint() + js_point); + } + appUserClient.editAppUserById(technicianAppUser); + //添加积分明细 + if(!technicianAppUser.getLavePoint().equals(lavePoint)){ + UserPoint userPoint = new UserPoint(); + userPoint.setType(10); + userPoint.setHistoricalPoint(lavePoint); + userPoint.setVariablePoint(js_point); + userPoint.setBalance(technicianAppUser.getLavePoint()); + userPoint.setCreateTime(LocalDateTime.now()); + userPoint.setAppUserId(technicianAppUser.getId()); + userPoint.setObjectId(order.getId()); + userPoint.setExtention(order.getOrderNumber()); + userPointClient.saveUserPoint(userPoint); + } } } @@ -445,7 +447,7 @@ sjShopAppUser.setShopSharePoint(sjShopAppUser.getShopSharePoint() + bdmdsj_point); //门店返佣 shop2.setShopAllPoint(shop2.getShopAllPoint() + bdmdsj_point); - shop2.setSharePoint(shop2.getSharePoint() + bdmdsj_point); + shop2.setLowerLevelSharePoint(shop2.getLowerLevelSharePoint() + bdmdsj_point); shop2.setLavePoint(shop2.getLavePoint() + bdmdsj_point); } appUserClient.editAppUserById(sjShopAppUser); @@ -506,7 +508,8 @@ } } } - + order.setIsCommission(1); + orderService.updateById(order); } -- Gitblit v1.7.1