From 00674dbad3077f9b2272c04e5305943c1b157525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 13 Oct 2025 09:14:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=20=E5=A2=9E=E5=8A=A0=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E5=85=B3=E7=B3=BB=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?-=20=E5=9C=A8=E6=8E=A7=E5=88=B6=E5=99=A8=E4=B8=AD=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=20ShopDealerRefereeService=20=E4=BE=9D=E8=B5=96=20-?= =?UTF-8?q?=20=E5=AF=BC=E5=85=A5=E8=AE=A2=E5=8D=95=E6=97=B6=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E7=94=A8=E6=88=B7=20ID=20=E6=9F=A5=E8=AF=A2=E5=A4=9A?= =?UTF-8?q?=E7=BA=A7=E6=8E=A8=E8=8D=90=E5=85=B3=E7=B3=BB-=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=80=E3=80=81=E4=BA=8C=E3=80=81=E4=B8=89=E7=BA=A7?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E4=BA=BA=20ID=20=E5=92=8C=E6=98=B5=E7=A7=B0?= =?UTF-8?q?=20-=20=E8=A1=A5=E5=85=85=E6=8E=A8=E8=8D=90=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=8F=8A=E5=85=B6=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=96=B9=E6=B3=95=20-=E4=BC=98=E5=8C=96=E5=B7=B2?= =?UTF-8?q?=E7=AD=BE=E7=BA=A6=E5=AE=A2=E6=88=B7=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SdyDealerOrderController.java | 39 +++++++++++++++---- .../service/ShopDealerRefereeService.java | 1 + .../impl/ShopDealerRefereeServiceImpl.java | 7 ++++ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java b/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java index 096269a..8408322 100644 --- a/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java +++ b/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java @@ -9,8 +9,10 @@ import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.sdy.param.SdyDealerOrderImportParam; import com.gxwebsoft.shop.entity.ShopDealerApply; import com.gxwebsoft.shop.entity.ShopDealerOrder; +import com.gxwebsoft.shop.entity.ShopDealerReferee; import com.gxwebsoft.shop.service.ShopDealerApplyService; import com.gxwebsoft.shop.service.ShopDealerOrderService; +import com.gxwebsoft.shop.service.ShopDealerRefereeService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; @@ -36,6 +38,8 @@ public class SdyDealerOrderController extends BaseController { private ShopDealerOrderService shopDealerOrderService; @Resource private ShopDealerApplyService shopDealerApplyService; + @Resource + private ShopDealerRefereeService shopDealerRefereeService; /** * excel批量导入售电云分销订单 @@ -101,20 +105,39 @@ public class SdyDealerOrderController extends BaseController { item.setIsInvalid(1); item.setIsSettled(0); // 新导入的数据设为未结算 - // 查询绑定关系 - ShopDealerApply dealerApply = shopDealerApplyService.getByDealerNameRel(d.getComments()); - - // 指定用户ID + // TODO 导入指定用户ID if(d.getUserId() != null){ item.setUserId(d.getUserId()); item.setIsInvalid(1); + + }else { + // TODO 通过报备客户信息查询绑定关系 + ShopDealerApply dealerApply = shopDealerApplyService.getByDealerNameRel(d.getComments()); + + // 已签约客户 + if(dealerApply != null){ + item.setIsInvalid(0); + item.setUserId(dealerApply.getUserId()); + item.setFirstUserId(dealerApply.getRefereeId()); + } } - // 已签约客户 - if(dealerApply != null){ + // 查询推荐关系 + if(ObjectUtil.isNotEmpty(item.getUserId())){ + ShopDealerReferee referee = shopDealerRefereeService.getByUserIdRel(item.getUserId()); + item.setFirstUserId(referee.getDealerId()); + item.setFirstNickname(referee.getDealerName()); + ShopDealerReferee referee2 = shopDealerRefereeService.getByUserIdRel(referee.getDealerId()); + if(ObjectUtil.isNotEmpty(referee2)){ + item.setSecondUserId(referee2.getDealerId()); + item.setSecondNickname(referee2.getDealerName()); + ShopDealerReferee referee3 = shopDealerRefereeService.getByUserIdRel(referee2.getDealerId()); + if(ObjectUtil.isNotEmpty(referee3)){ + item.setThirdUserId(referee3.getDealerId()); + item.setThirdNickname(referee3.getDealerName()); + } + } item.setIsInvalid(0); - item.setUserId(dealerApply.getUserId()); - item.setFirstUserId(dealerApply.getRefereeId()); } System.out.println("准备导入数据: " + item); diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java index f36b263..87bacd1 100644 --- a/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java @@ -39,4 +39,5 @@ public interface ShopDealerRefereeService extends IService { */ ShopDealerReferee getByIdRel(Integer id); + ShopDealerReferee getByUserIdRel(Integer userId); } diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java index 287d9a7..e3b88a5 100644 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java @@ -44,4 +44,11 @@ public class ShopDealerRefereeServiceImpl extends ServiceImpl