From 6b12805b53f7a6d131b5cffcf45e3b3c68336568 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期一, 09 十二月 2024 10:35:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java | 18 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/GoodsStatus.java | 4 ruoyi-modules/ruoyi-job/pom.xml | 6 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java | 62 +- ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsBargainPriceClient.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/AES.java | 0 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 11 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java | 10 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java | 8 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 34 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java | 25 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java | 14 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipGoodClient.java | 18 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/vip/Level.java | 82 ++- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserAddressController.java | 59 ++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipGoodClientFallbackFactory.java | 22 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WXCore.java | 0 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java | 11 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 84 ++- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java | 6 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserAddressClient.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java | 105 ++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 25 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipGoodController.java | 19 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml | 5 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java | 50 + ruoyi-service/ruoyi-account/pom.xml | 8 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java | 5 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java | 30 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WxPKCS7Encoder.java | 0 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java | 3 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java | 2 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java | 7 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java | 6 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java | 2 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SystemConfigClient.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java | 60 ++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java | 2 ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java | 4 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java | 5 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java | 50 ++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java | 3 ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | 4 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java | 24 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 68 ++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderActivityInfoClient.java | 2 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml | 7 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java | 2 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserAddressClientFallbackFactory.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java | 3 /dev/null | 85 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 28 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianVO.java | 2 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java | 2 ruoyi-service/ruoyi-other/pom.xml | 8 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java | 28 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java | 181 +++++++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java | 4 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java | 6 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java | 6 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 25 69 files changed, 1,055 insertions(+), 319 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java index eaae6be..5c0a263 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java @@ -23,7 +23,7 @@ public AppUserClient create(Throwable cause) { return new AppUserClient() { - @Override + @Override public AppUser getAppUserById(Long id) { log.error("根据id获取用户失败:{}", cause.getMessage()); throw new RuntimeException("根据id获取用户失败"); @@ -52,6 +52,12 @@ log.error("获取用户祖籍列表失败:{}", cause.getMessage()); throw new RuntimeException("获取用户祖籍列表失败"); } + + @Override + public R<AppUser> getSuperiorLeader(Long id) { + return R.fail("获取直帮上级用户失败"); + } + @Override public R<Long> getVipCount(Long userId, Integer vipId) { log.error("获取直推会员数失败:{}", cause.getMessage()); diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserAddressClientFallbackFactory.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserAddressClientFallbackFactory.java index f6b2f98..2f47327 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserAddressClientFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserAddressClientFallbackFactory.java @@ -20,7 +20,7 @@ } @Override - public R<UserAddress> getUserAddressById(Integer id) { + public R<UserAddress> getUserAddressById(Long id) { return R.fail("根据id获取用户地址信息失败:" + cause.getMessage()); } }; diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java index 772f740..dea7127 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java @@ -46,6 +46,9 @@ @GetMapping("/appletLogin/getUserAncestorList") R<List<AppUser>> getUserAncestorList(@RequestParam("id") Long id); + @GetMapping("/appletLogin/getSuperiorLeader") + R<AppUser> getSuperiorLeader(@RequestParam("id") Long id); + @PostMapping("/app-user/getVipCount") diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserAddressClient.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserAddressClient.java index 90ce1db..2fe5f5f 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserAddressClient.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserAddressClient.java @@ -30,5 +30,5 @@ * @return */ @PostMapping("/user-address/getUserAddressById") - R<UserAddress> getUserAddressById(@RequestParam("id") Integer id); + R<UserAddress> getUserAddressById(@RequestParam("id") Long id); } diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java index f7bc723..7ea8424 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java @@ -31,6 +31,13 @@ @TableId("id") private Long id; + @TableField(exist = false) + private String idStr; + + @TableField(exist = false) + private String uid; + + @ApiModelProperty(value = "用户id") @TableField("app_user_id") private Long appUserId; diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java index bdbdcba..33c9844 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java @@ -113,7 +113,7 @@ @TableField("point") private Integer point; - @ApiModelProperty(value = "1wx2积分") + @ApiModelProperty(value = "1微信,2账户余额,3积分") @TableField("pay_method") private Integer payMethod; @@ -128,6 +128,10 @@ @ApiModelProperty(value = "运费") @TableField("express_amount") private BigDecimal expressAmount; + + @ApiModelProperty(value = "1微信,2账户余额") + @TableField("express_pay_method") + private Integer expressPayMethod; @ApiModelProperty(value = "第三方快递信息") @TableField("express_json") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java index 6379aa0..fff54b2 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java @@ -77,7 +77,11 @@ @ApiModelProperty(value = "获取返佣积分上级类型(1=直推上级,2=直帮上级)") @TableField("superior_type") private Integer superiorType; - + + @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)") + @TableField("superior_price_type") + private Integer superiorPriceType; + @ApiModelProperty(value = "核销门店可获得服务费") @TableField("servuce_shop_charges") private BigDecimal servuceShopCharges; diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java index 9f9db3d..5aeea6e 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java @@ -30,6 +30,8 @@ @TableId("id") private Long id; + @TableField(exist = false) + private String idStr; @ApiModelProperty(value = "订单id") @TableField("order_id") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java index bf677d3..ece4111 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java @@ -14,6 +14,9 @@ @ApiModelProperty(value = "订单id") private Long id; + @ApiModelProperty(value = "订单状态") + private Integer orderStatus; + @ApiModelProperty(value = "订单商品") private List<OrderGoodsVO> goodsList; @@ -59,4 +62,19 @@ @ApiModelProperty(value = "实际支付价格") private BigDecimal paymentAmount; + @ApiModelProperty(value = "配送方式(1=自提,2=快递)") + private Integer distributionMode; + + @ApiModelProperty(value = "门店名称") + private String shopName; + + @ApiModelProperty(value = "门店地址") + private String shopAddress; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java index 99e44cb..d6b5789 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java @@ -72,6 +72,10 @@ @TableField("superior_type") private Integer superiorType; + @ApiModelProperty(value = "获取分佣金额上级类型(1=直推上级,2=直帮上级)") + @TableField("superior_price_type") + private Integer superiorPriceType; + @ApiModelProperty(value = "核销门店可获得服务费") @TableField("servuce_shop_charges") private BigDecimal servuceShopCharges; diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java index d01cb46..efcb5a7 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java @@ -39,15 +39,15 @@ @TableField("vip_info") private String vipInfo; - @ApiModelProperty(value = "1级会员用 注册 天后 未成为黄金会员自动解绑推广人") + @ApiModelProperty(value = "1级会员专用 自动解绑推广人天数: 达到设置天数未成为黄金会员自动解绑推广人") @TableField("vip_cancel_day") private Integer vipCancelDay; - @ApiModelProperty(value = "1级会员用 注册 天后 未在商城下单,可更换推广人") + @ApiModelProperty(value = "1级会员专用 可更换绑定人天数:用户在达到设置的天数未下单商品,可以更换绑定人") @TableField("vip_change_day") private Integer vipChangeDay; - @ApiModelProperty(value = "钱包提现权限1开0关") + @ApiModelProperty(value = "钱包提现权限:1开0关") @TableField("vip_withdrawal_role") private Integer vipWithdrawalRole; @@ -63,69 +63,73 @@ @TableField("vip_gift_role") private Integer vipGiftRole; - @ApiModelProperty(value = "消费达到积分 后升级") + @ApiModelProperty(value = "达成会员等级所需消费积分数量") @TableField("vip_level_up_shop") - private BigDecimal vipLevelUpShop; + private Integer vipLevelUpShop; - @ApiModelProperty(value = "普通会员:达到消费积分后升级开关 1开0关") + @ApiModelProperty(value = "通过消费积分达成会员等级的开关 1开0关") @TableField("vip_level_up_shop_role") private Integer vipLevelUpShopRole; - @ApiModelProperty(value = "返佣达到积分 后升级") + @ApiModelProperty(value = "达成会员等级所需的返佣积分数量") @TableField("vip_level_up_share") - private BigDecimal vipLevelUpShare; + private Integer vipLevelUpShare; - @ApiModelProperty(value = "普通会员:返佣积分后升级开关 1开0关") + @ApiModelProperty(value = "通过返佣积分达成会员等级的开关 1开0关") @TableField("vip_level_up_share_role") private Integer vipLevelUpShareRole; - @ApiModelProperty(value = "创业者:消费并且返佣升级 1开0关") - @TableField("vip_agent_level_up_role") - private Integer vipAgentLevelUpRole; - - @ApiModelProperty(value = "普通会员:直推用户数 达到后升级") + @ApiModelProperty(value = "达成会员等级所需的直推人数(包括钻石和代理)") @TableField("vip_direct_num") private Integer vipDirectNum; - @ApiModelProperty(value = "普通会员:团队人数达到后升级") + @ApiModelProperty(value = "达成会员等级所需的团队数量") @TableField("vip_team_num") private Integer vipTeamNum; - @ApiModelProperty(value = "普通会员:推广人数升级开关 1开0关") + @ApiModelProperty(value = "通过直推用户或团队数量的方式达成会员等级的开关 1开0关") @TableField("vip_level_up_num_role") private Integer vipLevelUpNumRole; - @ApiModelProperty(value = "创业者:直推钻石会员") + + + @ApiModelProperty(value = "达成会员等级所需准代理数(达成总代和合伙人用到)") @TableField("vip_direct_vip_num") private Integer vipDirectVipNum; - @ApiModelProperty(value = "创业者:直推钻石会员开关 1开0关") - @TableField("vip_direct_vip_role") - private Integer vipDirectVipRole; + @ApiModelProperty(value = "达成会员等级所需总代数量(达成合伙人用到)") + @TableField("vip_team_vip_num") + private Integer vipTeamVipNum; - @ApiModelProperty(value = "保级:消费x天") + @ApiModelProperty(value = "达成会员等级所需开店数量") + @TableField("vip_open_shop_num") + private Integer vipOpenShopNum; + + + + @ApiModelProperty(value = "消费积分保级周期(天)") @TableField("keep_buy_day") private Integer keepBuyDay; - @ApiModelProperty(value = "保级:消费x分") + @ApiModelProperty(value = "消费积分保级的积分阈值(分))") @TableField("keep_buy_point") - private BigDecimal keepBuyPoint; + private Integer keepBuyPoint; - @ApiModelProperty(value = "保级:返佣x天") + @ApiModelProperty(value = "返佣积分保的周期(天)") @TableField("keep_share_day") private Integer keepShareDay; - @ApiModelProperty(value = "保级:返佣x分") + @ApiModelProperty(value = "返佣积分保级的积分阈值(分)") @TableField("keep_share_point") - private BigDecimal keepSharePoint; + private Integer keepSharePoint; - @ApiModelProperty(value = "保级:门店x天") + @ApiModelProperty(value = "门店业绩积分保级的周期(天)") @TableField("keep_shop_day") private Integer keepShopDay; - @ApiModelProperty(value = "保级:门店x分") + @ApiModelProperty(value = "门店业绩积分保级的积分阈值(分)") @TableField("keep_shop_point") - private BigDecimal keepShopPoint; + private Integer keepShopPoint; } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipGoodClientFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipGoodClientFallbackFactory.java new file mode 100644 index 0000000..4d6bb47 --- /dev/null +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipGoodClientFallbackFactory.java @@ -0,0 +1,22 @@ +package com.ruoyi.other.api.factory; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.other.api.domain.VipGood; +import com.ruoyi.other.api.feignClient.VipGoodClient; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.List; + +public class VipGoodClientFallbackFactory implements FallbackFactory<VipGoodClient> { + @Override + public VipGoodClient create(Throwable cause) { + return new VipGoodClient() { + @GetMapping("/vip-good/getVipGoodsByVipId") + @Override + public R<List<VipGood>> getVipGoodsByVipId(Integer vipId) { + return R.fail("根据会员id获取会员购买商品失败:" + cause.getMessage()); + } + }; + } +} diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsBargainPriceClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsBargainPriceClient.java index e5cd406..b5e178d 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsBargainPriceClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsBargainPriceClient.java @@ -13,7 +13,7 @@ * @author zhibing.pu * @Date 2024/11/28 10:53 */ -@FeignClient(contextId = "GoodsBargainPriceClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = GoodsBargainPriceClientFallbackFactory.class) +@FeignClient(contextId = "GoodsBargainPriceClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = GoodsBargainPriceClientFallbackFactory.class) public interface GoodsBargainPriceClient { diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderActivityInfoClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderActivityInfoClient.java index 6404f0d..bc0817a 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderActivityInfoClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderActivityInfoClient.java @@ -12,7 +12,7 @@ * @author zhibing.pu * @Date 2024/11/29 10:55 */ -@FeignClient(contextId = "OrderActivityInfoClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderActivityInfoClientFallbackFactory.class) +@FeignClient(contextId = "OrderActivityInfoClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = OrderActivityInfoClientFallbackFactory.class) public interface OrderActivityInfoClient { diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java index 1bddb0e..d36d01d 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java @@ -13,7 +13,7 @@ * 后台订单服务 * @author ruoyi */ -@FeignClient(contextId = "OrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderFallbackFactory.class) +@FeignClient(contextId = "OrderClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = OrderFallbackFactory.class) public interface OrderClient { @PostMapping(value = "/management/give/vip") public R<List<Long>> getOrderIdsByTechId(@RequestParam("id") Integer id); diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java index d4e3973..d84674e 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SeckillActivityInfoClient.java @@ -13,7 +13,7 @@ * @author zhibing.pu * @Date 2024/11/28 10:38 */ -@FeignClient(contextId = "SeckillActivityInfoClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = SeckillActivityInfoClientFallbackFactory.class) +@FeignClient(contextId = "SeckillActivityInfoClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = SeckillActivityInfoClientFallbackFactory.class) public interface SeckillActivityInfoClient { diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java index a49ac62..2928637 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java @@ -12,7 +12,7 @@ * @author zhibing.pu * @Date 2024/11/29 10:28 */ -@FeignClient(contextId = "ShopClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ShopClientFallbackFactory.class) +@FeignClient(contextId = "ShopClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = ShopClientFallbackFactory.class) public interface ShopClient { diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SystemConfigClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SystemConfigClient.java index 9eff59d..7224646 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SystemConfigClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/SystemConfigClient.java @@ -12,7 +12,7 @@ * @author zhibing.pu * @Date 2024/11/29 15:58 */ -@FeignClient(contextId = "SystemConfigClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = SystemConfigClientFallbackFactory.class) +@FeignClient(contextId = "SystemConfigClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = SystemConfigClientFallbackFactory.class) public interface SystemConfigClient { diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java index da8b289..686b418 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestParam; -@FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class) +@FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class) public interface TechnicianClient { @PostMapping("/technician/shop/detail") diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipGoodClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipGoodClient.java new file mode 100644 index 0000000..887f3af --- /dev/null +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipGoodClient.java @@ -0,0 +1,18 @@ +package com.ruoyi.other.api.feignClient; + +import com.ruoyi.common.core.constant.ServiceNameConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.other.api.domain.VipGood; +import com.ruoyi.other.api.factory.VipGoodClientFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +@FeignClient(contextId = "VipGoodClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = VipGoodClientFallbackFactory.class) +public interface VipGoodClient { + + @GetMapping("/vip-good/getVipGoodsByVipId") + public R<List<VipGood>> getVipGoodsByVipId(@RequestParam("subscribeId") Integer vipId); +} diff --git a/ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 1790609..0105e63 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -12,4 +12,6 @@ com.ruoyi.other.api.factory.SystemConfigClientFallbackFactory com.ruoyi.other.api.factory.StoreFallbackFactory com.ruoyi.other.api.factory.CouponClientFallbackFactory -com.ruoyi.other.api.factory.TechnicianClientFallbackFactory \ No newline at end of file +com.ruoyi.other.api.factory.TechnicianClientFallbackFactory +com.ruoyi.other.api.factory.PointSettingClientFallbackFactory +com.ruoyi.other.api.factory.VipGoodClientFallbackFactory \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-job/pom.xml b/ruoyi-modules/ruoyi-job/pom.xml index 14334bf..107092d 100644 --- a/ruoyi-modules/ruoyi-job/pom.xml +++ b/ruoyi-modules/ruoyi-job/pom.xml @@ -16,6 +16,12 @@ </description> <dependencies> + + <dependency> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi-modules-order</artifactId> + <version>3.6.2</version> + </dependency> <!-- SpringCloud Alibaba Nacos --> <dependency> diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java index f6915f7..87ee464 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java @@ -1,5 +1,6 @@ package com.ruoyi.job.task; +import com.ruoyi.order.service.CommissionService; import lombok.extern.log4j.Log4j2; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; @@ -12,6 +13,8 @@ public class AfterSalesTask { @Resource private RedisTemplate<String, String> redisTemplate; + @Resource + private CommissionService commissionService; /** * 计算佣金(设置每分钟执行一次) @@ -22,6 +25,7 @@ // 从延迟队列中获取需要处理的订单 Set<String> orderIds = redisTemplate.opsForZSet().rangeByScore("delay_queue:commission", 0, now); if (orderIds != null && !orderIds.isEmpty()) { + commissionService.calculationCommission(orderIds); // 处理完后移除已处理的订单 redisTemplate.opsForZSet().removeRangeByScore("delay_queue:commission", 0, now); } diff --git a/ruoyi-service/ruoyi-account/pom.xml b/ruoyi-service/ruoyi-account/pom.xml index 7f5e8f8..727fca2 100644 --- a/ruoyi-service/ruoyi-account/pom.xml +++ b/ruoyi-service/ruoyi-account/pom.xml @@ -37,10 +37,10 @@ <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-seata</artifactId> - </dependency> + <!--<dependency>--> + <!--<groupId>com.alibaba.cloud</groupId>--> + <!--<artifactId>spring-cloud-starter-alibaba-seata</artifactId>--> + <!--</dependency>--> <!-- SpringBoot Actuator --> <dependency> diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 6ee0ca6..df6bffd 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -221,12 +221,16 @@ @ResponseBody @GetMapping("/change") @ApiOperation(value = "推广中心", tags = {"小程序-推广中心"}) - public R<AppUser> change(@ApiParam("换绑用户id") Long userId){ + public R<AppUser> change(@ApiParam("换绑用户手机号") String phone){ Long userId1 = tokenService.getLoginUserApplet().getUserid(); - //获取绑定门店 - AppUser user = appUserService.getById(userId1); - user.setInviteUserId(userId); - appUserService.updateById(user); + AppUser byId = appUserService.getById(userId1); + //获取绑定门店 + AppUser user = appUserService.lambdaQuery().eq(AppUser::getPhone,phone).one(); + if (user==null){ + return R.fail("当前手机号未注册"); + } + byId.setInviteUserId(user.getId()); + appUserService.updateById(byId); return R.ok(); } @@ -290,6 +294,17 @@ return R.ok(list); } + /** + * 获取用户的直帮上级用户 + */ + @ResponseBody + @PostMapping("/getSuperiorLeader") + @ApiOperation(value = "获取用户的直帮上级用户") + public R<AppUser> getSuperiorLeader(@RequestParam("id") Long id) { + AppUser superiorLeader = appUserService.getSuperiorLeader(id); + return R.ok(superiorLeader); + } + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserAddressController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserAddressController.java index 73091a9..c8b2c71 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserAddressController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserAddressController.java @@ -64,29 +64,60 @@ @ApiOperation(value = "添加", tags = {"小程序-个人中心首页-我的地址"}) public R add(@RequestBody UserAddress userAddress){ Long userId = tokenService.getLoginUserApplet().getUserid(); + + if (userAddress.getIsDefault()==1){ + List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).list(); + for (UserAddress userAddress1 : list) { + userAddress1.setIsDefault(0); + } + userAddressService.updateBatchById(list); + } + userAddress.setAppUserId(userId); userAddressService.save(userAddress); return R.ok(); } + + @ResponseBody + @GetMapping("/list") + @ApiOperation(value = "列表", tags = {"小程序-个人中心首页-我的地址"}) + public R list(){ + Long userId = tokenService.getLoginUserApplet().getUserid(); + List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).orderByDesc(UserAddress::getIsDefault).list(); + for (UserAddress userAddress : list) { + userAddress.setIdStr(userAddress.getId().toString()); + userAddress.setUid(userAddress.getId().toString()); + } + return R.ok(list); + } + @ResponseBody @PostMapping("/edit") @ApiOperation(value = "编辑", tags = {"小程序-个人中心首页-我的地址"}) public R edit(@RequestBody UserAddress userAddress){ + Long userId = tokenService.getLoginUserApplet().getUserid(); + if (userAddress.getIsDefault()==1){ + List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).list(); + for (UserAddress userAddress1 : list) { + userAddress1.setIsDefault(0); + } + userAddressService.updateBatchById(list); + } userAddressService.updateById(userAddress); return R.ok(); } @ResponseBody - @PostMapping("/delete") + @GetMapping("/delete") @ApiOperation(value = "删除", tags = {"小程序-个人中心首页-我的地址"}) - public R edit(@RequestParam Integer id){ + public R edit(@RequestParam String id){ userAddressService.removeById(id); return R.ok(); } @ResponseBody - @PostMapping("/set") + @GetMapping("/set") @ApiOperation(value = "设为默认", tags = {"小程序-个人中心首页-我的地址"}) - public R set(@RequestParam Integer id){ + public R set(@RequestParam String id){ Long userId = tokenService.getLoginUserApplet().getUserid(); List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).list(); for (UserAddress userAddress : list) { @@ -99,6 +130,22 @@ userAddressService.updateById(byId); return R.ok(); } + + /** + * 获取登录用户地址列表 + * @return + */ + @ResponseBody + @GetMapping("/getUserAddressList") + @ApiOperation(value = "获取登录用户地址列表", tags = {"小程序-个人中心首页-我的地址"}) + public R<List<UserAddress>> getUserAddressList(){ + Long userId = tokenService.getLoginUserApplet().getUserid(); + List<UserAddress> list = userAddressService.lambdaQuery().eq(UserAddress::getAppUserId, userId).list(); + for (UserAddress userAddress : list) { + userAddress.setIdStr(userAddress.getId().toString()); + } + return R.ok(list); + } /** * 根据id获取用户地址信息 @@ -107,10 +154,12 @@ */ @ResponseBody @PostMapping("/getUserAddressById") - public R<UserAddress> getUserAddressById(@RequestParam("id") Integer id){ + public R<UserAddress> getUserAddressById(@RequestParam("id") Long id){ UserAddress userAddress = userAddressService.getById(id); return R.ok(userAddress); } + + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java index 671074d..f3a4385 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java @@ -58,7 +58,7 @@ - @PostMapping("/mine/list") + @GetMapping("/mine/list") @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"}) public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) { Long userid = tokenService.getLoginUserApplet().getUserid(); @@ -66,7 +66,7 @@ .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime) .isNotNull(status!=null&&status==2,UserCoupon::getUseTime) .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()) - .eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum, pageSize)); + .eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum-1, pageSize)); for (UserCoupon record : page.getRecords()) { CouponInfo data = couponClient.detail(record.getCouponId()).getData(); CouponInfoVo vo = new CouponInfoVo(); @@ -104,7 +104,7 @@ } - @PostMapping("/get") + @GetMapping("/get") @ApiOperation(value = "领取或者兑换优惠券", tags = {"小程序-个人中心-优惠劵"}) public R<Page<UserCoupon>> get(@RequestParam Integer couponId) { diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java index eca25ea..cff28d8 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java @@ -1,8 +1,22 @@ package com.ruoyi.account.controller; +import com.ruoyi.account.api.model.AppUser; +import com.ruoyi.account.api.model.UserSignRecord; +import com.ruoyi.account.service.UserSignRecordService; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.security.service.TokenService; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; /** * <p> @@ -15,6 +29,22 @@ @RestController @RequestMapping("/user-sign-record") public class UserSignRecordController { + @Resource + private UserSignRecordService userSignRecordService; + @Resource + private TokenService tokenService; + @ResponseBody + @GetMapping("/sign") + @ApiOperation(value = "签到", tags = {"小程序-签到"}) + public R<AppUser> change(){ + Long userId1 = tokenService.getLoginUserApplet().getUserid(); + UserSignRecord userSignRecord = new UserSignRecord(); + userSignRecord.setAppUserId(userId1); + userSignRecord.setCreateTime(LocalDateTime.now()); + userSignRecord.setRedAmount(new BigDecimal(0)); + userSignRecord.setSignDay(LocalDate.now()); + return R.ok(); + } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenter.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenter.java deleted file mode 100644 index d964ef6..0000000 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenter.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ruoyi.account.controller; - -import com.ruoyi.account.service.VipSettingService; -import com.ruoyi.account.vo.vip.Level; -import com.ruoyi.account.vo.vip.VipLevel; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.security.service.TokenService; -import com.ruoyi.other.api.domain.BaseSetting; -import com.ruoyi.other.api.domain.VipSetting; -import com.ruoyi.other.api.feignClient.BaseSettingClient; -import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.log4j.Log4j2; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -@RestController -@RequestMapping("/vipCenter") -@Api(tags = "小程序-会员中心") -@Log4j2 -public class VipCenter { - @Resource - private RemoteVipSettingClient remoteVipSettingClient; - @Resource - private BaseSettingClient baseSettingClient; - @Resource - private VipSettingService vipSettingService; - @Resource - private TokenService tokenService; - - - @GetMapping("getVipLevelList") - @ApiOperation(value = "会员等级列表", tags = {"会员中心-小程序"}) - public R<VipLevel> vipLevelList() { - R<List<VipSetting>> r = remoteVipSettingClient.list(); - if (!R.isSuccess(r)){ - return R.fail("会员等级获取失败"); - } - List<VipSetting> vipSettingList = r.getData(); - if (vipSettingList == null || vipSettingList.isEmpty()){ - return R.fail("会员等级获取失败"); - } - R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3); - if (!R.isSuccess(baseSettingR)){ - log.error("【会员设置说明】获取失败"); - return R.fail("会员等级获取失败"); - } - BaseSetting baseSetting = baseSettingR.getData(); - if (baseSetting == null){ - log.error("【会员设置说明】未设置"); - return R.fail("会员等级获取失败"); - } - Long userid = tokenService.getLoginUserApplet().getUserid(); - VipSetting loginUserVipSetting = vipSettingService.getVipSettingByUserId(userid); - - VipLevel vipLevel = new VipLevel(); - List<Level> levelList = new ArrayList<>(); - vipSettingList.forEach(vipSetting -> { - Level level = new Level(); - level.setId(vipSetting.getId()); - level.setName(vipSetting.getVipName()); - level.setVipInfo(vipSetting.getVipInfo()); - level.setVipDesc(baseSetting.getContent()); - level.setVipLevelUpShop(vipSetting.getVipLevelUpShop()); - level.setVipLevelUpShare(vipSetting.getVipLevelUpShare()); - level.setKeepBuyDay(vipSetting.getKeepBuyDay()); - level.setKeepBuyPoint(vipSetting.getKeepBuyPoint()); - level.setKeepShareDay(vipSetting.getKeepShareDay()); - level.setKeepSharePoint(vipSetting.getKeepSharePoint()); - level.setKeepShopDay(vipSetting.getKeepShopDay()); - level.setKeepShopPoint(vipSetting.getKeepShopPoint()); - levelList.add(level); - }); - vipLevel.setLevelList(levelList); - vipLevel.setCurrentLevel(loginUserVipSetting.getId()); - return R.ok(vipLevel); - } - -} diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java new file mode 100644 index 0000000..3a6f8aa --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java @@ -0,0 +1,181 @@ +package com.ruoyi.account.controller; + +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.account.api.model.AppUser; +import com.ruoyi.account.service.AppUserService; +import com.ruoyi.account.service.VipSettingService; +import com.ruoyi.account.vo.vip.Level; +import com.ruoyi.account.vo.vip.VipLevel; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.bean.BeanUtils; +import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.other.api.domain.*; +import com.ruoyi.other.api.feignClient.BaseSettingClient; +import com.ruoyi.other.api.feignClient.GoodsVipClient; +import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; +import com.ruoyi.other.api.feignClient.VipGoodClient; +import com.ruoyi.system.api.model.LoginUser; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.log4j.Log4j2; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/vipCenter") +@Api(tags = "小程序-会员中心") +@Log4j2 +public class VipCenterController { + @Resource + private RemoteVipSettingClient remoteVipSettingClient; + @Resource + private BaseSettingClient baseSettingClient; + @Resource + private GoodsVipClient goodsVipClient; + @Resource + private VipSettingService vipSettingService; + @Resource + private TokenService tokenService; + @Resource + private VipGoodClient vipGoodClient; + @Resource + private AppUserService appUserService; + + + @GetMapping("getVipLevelList") + @ApiOperation(value = "会员等级列表", tags = {"会员中心-小程序"}) + public R<VipLevel> vipLevelList() { + try { + R<List<VipSetting>> r = remoteVipSettingClient.list(); + if (!checkSuccess(r)) { + return R.fail("会员等级获取失败"); + } + List<VipSetting> vipSettingList = r.getData(); + if (vipSettingList == null || vipSettingList.isEmpty()) { + return R.fail("会员等级获取失败"); + } + + R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3); + if (!checkSuccess(baseSettingR)) { + log.error("【会员设置说明】获取失败:{}", baseSettingR.getMsg()); + return R.fail("会员等级获取失败"); + } + BaseSetting baseSetting = baseSettingR.getData(); + if (baseSetting == null) { + log.error("【会员设置说明】未设置"); + return R.fail("会员等级获取失败"); + } + + Long userid = tokenService.getLoginUserApplet().getUserid(); + VipSetting loginUserVipSetting = vipSettingService.getVipSettingByUserId(userid); + + VipLevel vipLevel = new VipLevel(); + List<Level> levelList = new ArrayList<>(); + + // 批量获取 goodsVip 和 vipGoods + List<Integer> vipIds = vipSettingList.stream().map(VipSetting::getId).collect(Collectors.toList()); + Map<Integer, R<GoodsVip>> goodsVipMap = getGoodsVips(vipIds); + Map<Integer, R<List<VipGood>>> vipGoodsMap = getVipGoods(vipIds); + + vipSettingList.forEach(vipSetting -> { + Level level = new Level(); + BeanUtils.copyBeanProp(level, vipSetting); + level.setVipDesc(baseSetting.getContent()); + + R<GoodsVip> goodsVipR = goodsVipMap.get(vipSetting.getId()); + if (R.isSuccess(goodsVipR)) { + R<List<VipGood>> vipGoodR = vipGoodsMap.get(vipSetting.getId()); + if (R.isSuccess(vipGoodR)) { + List<VipGood> vipGoodList = vipGoodR.getData(); + if (vipGoodList != null && !vipGoodList.isEmpty()) { + List<String> goodsNames = new ArrayList<>(); + vipGoodList.forEach(vipGood -> { + String goodJson = vipGood.getGoodJson(); + if (isValidJson(goodJson)) { + Goods goods = JSONObject.parseObject(goodJson, Goods.class); + goodsNames.add(goods.getName()); + } else { + log.warn("JSON无效: " + goodJson); + } + }); + level.setGoodsNames(goodsNames); + } + } + } + levelList.add(level); + }); + + vipLevel.setLevelList(levelList); + vipLevel.setCurrentLevel(loginUserVipSetting.getId()); + return R.ok(vipLevel); + } catch (Exception e) { + log.error("会员等级获取失败", e); + return R.fail("会员等级获取失败"); + } + } + + + public R<Void> test() { + LoginUser loginUserApplet = tokenService.getLoginUserApplet(); + AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); + if (appUser.getShopPoint() < 500){ + return R.fail("消费积分不足500"); + } + if (appUser.getSharePoint() < 500){ + return R.fail("返佣积分不足500"); + } + // 当前用户的直推用户 +// List<AppUser> bottomUsers = appUserService.list(new LambdaQueryWrapper<AppUser>() +// .eq(AppUser::getInviteUserId, loginUserApplet.getUserid()) +// .eq(AppUser::getVipId)); + + return null; + } + + + + + private boolean checkSuccess(R<?> r) { + if (!R.isSuccess(r)) { + log.error("请求失败: " + r.getMsg()); + } + return R.isSuccess(r); + } + + private Map<Integer, R<GoodsVip>> getGoodsVips(List<Integer> vipIds) { + Map<Integer, R<GoodsVip>> result = new HashMap<>(); + for (Integer vipId : vipIds) { + R<GoodsVip> goodsVipR = goodsVipClient.getGoodsVip(vipId); + result.put(vipId, goodsVipR); + } + return result; + } + + private Map<Integer, R<List<VipGood>>> getVipGoods(List<Integer> vipIds) { + Map<Integer, R<List<VipGood>>> result = new HashMap<>(); + for (Integer vipId : vipIds) { +// R<List<VipGood>> vipGoodR = vipGoodClient.getVipGoodsByVipId(vipId); +// result.put(vipId, vipGoodR); + } + return result; + } + + private boolean isValidJson(String json) { + try { + JSONObject.parseObject(json); + return true; + } catch (Exception e) { + return false; + } + } + +} diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java index a9e78a6..d8f9645 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java @@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; @@ -115,18 +116,19 @@ return R.ok(list); } -// /** -// * 充值 -// */ -// @GetMapping("recharge") -// @ApiOperation(value = "充值", notes = "钱包充值") -// public AjaxResult recharge(@ApiParam(value = "充值金额", required = true) @RequestParam BigDecimal amount) { -// Long userId = SecurityUtils.getUserId(); -// String openId; -// // 商户号 -// String partnerTradeNo; -// // TODO 充值 -// return AjaxResult.success(); -// } + /** + * 充值 + */ + @GetMapping("recharge") + @ApiOperation(value = "充值", notes = "钱包充值") + public R<Void> recharge(@ApiParam(value = "充值金额", required = true) @RequestParam BigDecimal amount) { + LoginUser loginUserApplet = tokenService.getLoginUserApplet(); + AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); + String wxOpenid = appUser.getWxOpenid(); + // 商户号 + String partnerTradeNo; + // TODO 充值 + return R.ok(); + } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java index a313542..a51d268 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java @@ -62,4 +62,9 @@ * 获取用户的祖籍列表 */ List<AppUser> getUserAncestorList(Long id,List<AppUser> list); + + /** + * 获取指定用户的直帮上级用户(消费用户绑定的上级,最近一个用户会员类型为【创业者】的用户) + */ + AppUser getSuperiorLeader(Long id); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java index 637801f..28554a7 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.account.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.model.AppUserShop; @@ -7,9 +9,11 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.AppUserShopService; +import com.ruoyi.account.util.weChat.WXCore; import com.ruoyi.account.util.weChat.WeChatUtil; import com.ruoyi.account.vo.*; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.Shop; @@ -73,11 +77,19 @@ return R.fail(map.get("msg").toString()); } String openid = map.get("openid").toString(); + String sessionKey = map.get("sessionKey").toString(); //查询用户是否注册,没有注册则跳转到注册页面 AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); if(null == appUser){ + String decrypt = WXCore.decrypt(appletLogin.getEncryptedData_phone(), sessionKey, appletLogin.getIv_phone()); + if (StringUtils.isEmpty(decrypt)) { + return R.fail("获取手机信息失败"); + } + JSONObject phone = JSON.parseObject(decrypt); + String purePhoneNumber = phone.getString("purePhoneNumber"); LoginVo loginVo = new LoginVo(); loginVo.setSkipPage(2); + loginVo.setPhone(purePhoneNumber); return R.ok(loginVo); } //账户被冻结,给出提示 @@ -117,6 +129,7 @@ if(null == appUser){ LoginVo loginVo = new LoginVo(); loginVo.setSkipPage(2); + loginVo.setPhone(mobileLogin.getPhone()); return R.ok(loginVo); } //账户被冻结,给出提示 @@ -192,27 +205,34 @@ // return R.fail("验证码错误"); // } //使用jscode获取微信openid -// Map<String, Object> map = weChatUtil.code2Session(registerAccount.getJscode()); -// Integer errcode = Integer.valueOf(map.get("errcode").toString()); -// if(0 != errcode){ -// return R.fail(map.get("msg").toString()); -// } -// String openid = map.get("openid").toString(); -// //查询用户是否注册 -// AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); -// if(null != appUser){ -// return R.fail("此微信号已注册,请直接登录!"); -// } - AppUser appUser = null; + Map<String, Object> map = weChatUtil.code2Session(registerAccount.getJscode()); + Integer errcode = Integer.valueOf(map.get("errcode").toString()); + if(0 != errcode){ + return R.fail(map.get("msg").toString()); + } + String openid = map.get("openid").toString(); + //查询用户是否注册 + AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); + if(null != appUser){ + return R.fail("此微信号已注册,请直接登录!"); + } AppUser appUser1 = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, registerAccount.getPhone()).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); - if(null != appUser1){ + if(null != appUser1 && StringUtils.isNotEmpty(appUser1.getWxOpenid())){ return R.fail("手机号已注册,请直接登录!"); } - if(null == appUser){ + if(null != appUser1 && appUser1.getStatus() == 2){ + return R.fail("手机号已注册,请直接登录!"); + } + //如果手机号已注册,但是没有微信号,则将微信号添加到已有账户上 + if(null != appUser1 && StringUtils.isEmpty(appUser1.getWxOpenid())){ + appUser1.setWxOpenid(openid); + this.updateById(appUser1); + appUser = appUser1; + }else if(null == appUser){ appUser = new AppUser(); appUser.setName(registerAccount.getName()); appUser.setPhone(registerAccount.getPhone()); -// appUser.setWxOpenid(openid); + appUser.setWxOpenid(openid); //注册默认为普通会员 appUser.setVipId(1); appUser.setStatus(1); @@ -277,11 +297,10 @@ sysUserClient.saveShopUser(user); } } - } LoginVo loginVo = new LoginVo(); loginVo.setSkipPage(1); - loginVo.setFirstTime(false); + loginVo.setFirstTime(null == appUser1 ? true : false); loginVo.setPhone(appUser.getPhone()); //构建token LoginUser loginUser = new LoginUser(); @@ -361,4 +380,19 @@ return list; } + @Override + public AppUser getSuperiorLeader(Long id) { + AppUser appUser = getById(id); + Long inviteUserId = appUser.getInviteUserId(); + AppUser inviteUser = getById(inviteUserId); + if (inviteUser == null){ + return null; + } + if (inviteUser.getVipId() > 3) { + return inviteUser; + }else { + getSuperiorLeader(inviteUserId); + } + return null; + } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java index 0d4f040..06caeb7 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java @@ -54,7 +54,7 @@ walletVO.setAuditAmount(waitAuditList.stream() .map(WithdrawalRequests::getWithdrawalAmount) .reduce(BigDecimal.ZERO, BigDecimal::add)); - + walletVO.setBalance(appUser.getBalance()); return walletVO; } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/TaskUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java similarity index 91% rename from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/TaskUtil.java rename to ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java index a2e399d..7f028bc 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/TaskUtil.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java @@ -1,4 +1,4 @@ -package com.ruoyi.account.util.weChat; +package com.ruoyi.account.util; import org.springframework.scheduling.annotation.Scheduled; diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/AES.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/AES.java similarity index 100% rename from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/AES.java rename to ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/AES.java diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WXCore.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WXCore.java similarity index 100% rename from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WXCore.java rename to ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WXCore.java diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WeChatUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java similarity index 91% rename from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WeChatUtil.java rename to ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java index 31b295c..34adfb8 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WeChatUtil.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java @@ -5,11 +5,15 @@ import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.redis.service.RedisService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; + +import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; /** * 微信工具类 @@ -29,6 +33,11 @@ // @Value("${wx.appSecret}") private String webAppSecret; + + @Resource + private RedisService redisService; + + /** @@ -69,13 +78,24 @@ } return null; } - + + + public String getWxAppletsAccessToken(){ + Object wxAppletsAccessToken = redisService.getCacheObject("wxAppletsAccessToken"); + if(null != wxAppletsAccessToken){ + return wxAppletsAccessToken.toString(); + } + String appletsAccessToken = getAppletsAccessToken(); + redisService.setCacheObject("wxAppletsAccessToken", appletsAccessToken, 7200L, TimeUnit.SECONDS); + return appletsAccessToken; + } + /** * 获取微信小程序token * @return */ - public String getWxAppletsAccessToken() throws Exception{ + public String getAppletsAccessToken() { String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret; HttpRequest get = HttpUtil.createGet(url); HttpResponse response = get.execute(); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WxPKCS7Encoder.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WxPKCS7Encoder.java similarity index 100% rename from ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/weChat/WxPKCS7Encoder.java rename to ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WxPKCS7Encoder.java diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/vip/Level.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/vip/Level.java index 855de5c..d136501 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/vip/Level.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/vip/Level.java @@ -1,6 +1,5 @@ package com.ruoyi.account.vo.vip; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -13,48 +12,85 @@ @ApiModelProperty(value = "会员等级id") private Integer id; - /** - * 会员名称 - */ @ApiModelProperty(value = "会员名称") private String name; @ApiModelProperty(value = "会员专属权益") private String vipInfo; - @ApiModelProperty(value = "会员说明") - private String vipDesc; + @ApiModelProperty(value = "1级会员专用 自动解绑推广人天数: 达到设置天数未成为黄金会员自动解绑推广人") + private Integer vipCancelDay; - @ApiModelProperty(value = "消费达到积分 后升级") - private BigDecimal vipLevelUpShop; + @ApiModelProperty(value = "1级会员专用 可更换绑定人天数:用户在达到设置的天数未下单商品,可以更换绑定人") + private Integer vipChangeDay; - @ApiModelProperty(value = "返佣达到积分 后升级") - private BigDecimal vipLevelUpShare; + @ApiModelProperty(value = "钱包提现权限:1开0关") + private Integer vipWithdrawalRole; - @ApiModelProperty(value = "升级会员的直推用户人数要求") + @ApiModelProperty(value = "最低提现门槛") + private BigDecimal vipWithdrawalMinAmount; + + @ApiModelProperty(value = "提现手续费") + private BigDecimal vipWithdrawalFee; + + @ApiModelProperty(value = "积分转赠权限 1开0关") + private Integer vipGiftRole; + + @ApiModelProperty(value = "达成会员等级所需消费积分数量") + private Integer vipLevelUpShop; + + @ApiModelProperty(value = "通过消费积分达成会员等级的开关 1开0关") + private Integer vipLevelUpShopRole; + + @ApiModelProperty(value = "达成会员等级所需的返佣积分数量") + private Integer vipLevelUpShare; + + @ApiModelProperty(value = "通过返佣积分达成会员等级的开关 1开0关") + private Integer vipLevelUpShareRole; + + @ApiModelProperty(value = "达成会员等级所需的直推人数(包括钻石和代理)") private Integer vipDirectNum; - @ApiModelProperty(value = "升级会员的团队数要求") + + @ApiModelProperty(value = "达成会员等级所需的团队数量") private Integer vipTeamNum; - @ApiModelProperty(value = "保级:消费x天") + @ApiModelProperty(value = "通过直推用户或团队数量的方式达成会员等级的开关 1开0关") + private Integer vipLevelUpNumRole; + + + + @ApiModelProperty(value = "达成会员等级所需准代理数(达成总代和合伙人用到)") + private Integer vipDirectVipNum; + + @ApiModelProperty(value = "达成会员等级所需总代数量(达成合伙人用到)") + private Integer vipTeamVipNum; + + @ApiModelProperty(value = "达成会员等级所需开店数量") + private Integer vipOpenShopNum; + + + + @ApiModelProperty(value = "消费积分保级周期(天)") private Integer keepBuyDay; - @ApiModelProperty(value = "保级:消费x分") - private BigDecimal keepBuyPoint; + @ApiModelProperty(value = "消费积分保级的积分阈值(分))") + private Integer keepBuyPoint; - @ApiModelProperty(value = "保级:返佣x天") + @ApiModelProperty(value = "返佣积分保的周期(天)") private Integer keepShareDay; - @ApiModelProperty(value = "保级:返佣x分") - private BigDecimal keepSharePoint; + @ApiModelProperty(value = "返佣积分保级的积分阈值(分)") + private Integer keepSharePoint; - @ApiModelProperty(value = "保级:门店x天") + @ApiModelProperty(value = "门店业绩积分保级的周期(天)") private Integer keepShopDay; - @ApiModelProperty(value = "保级:门店x分") - private BigDecimal keepShopPoint; + @ApiModelProperty(value = "门店业绩积分保级的积分阈值(分)") + private Integer keepShopPoint; + @ApiModelProperty(value = "会员描述") + private String vipDesc; - - + @ApiModelProperty(value = "会员商品名称") + private List<String> goodsNames; } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java index 5c9cab3..ecd3255 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java @@ -1,17 +1,22 @@ package com.ruoyi.order.controller; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.ruoyi.account.api.feignClient.UserAddressClient; +import com.ruoyi.account.api.model.UserAddress; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.order.model.Order; import com.ruoyi.order.service.OrderService; +import com.ruoyi.order.vo.OrderDetailVO; +import com.ruoyi.order.vo.OrderVO; +import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; -import com.ruoyi.order.vo.OrderDetailVO; -import com.ruoyi.system.api.model.LoginUser; -import com.ruoyi.order.model.Order; import javax.annotation.Resource; import java.util.List; @@ -31,7 +36,9 @@ @Resource private OrderService orderService; @Resource - TokenService tokenService; + private TokenService tokenService; + @Resource + private UserAddressClient addressClient; /** @@ -42,7 +49,7 @@ @ApiImplicitParam(value = "订单状态", name = "status", required = true, dataType = "int"), }) @GetMapping("/getMyOrderList") - public TableDataInfo getMyOrderList(@ApiParam("订单状态") Integer status){ + public TableDataInfo<OrderVO> getMyOrderList(@ApiParam("订单状态") Integer status){ startPage(); LoginUser loginUserApplet = tokenService.getLoginUserApplet(); return getDataTable(orderService.selectOrderListByUserId(status, loginUserApplet.getUserid())); @@ -90,8 +97,9 @@ @ApiImplicitParams({ @ApiImplicitParam(value = "订单号", name = "code", required = true, dataType = "String"), }) - @GetMapping("/writeOff/{code}") - public R<Void> writeOff(@PathVariable("code") String code){ + @GetMapping("/writeOff/{code}/{shopId}") + public R<Void> writeOff(@PathVariable("code") String code, @PathVariable("shopId") Integer shopId){ + orderService.writeOff(code, shopId); return R.ok(); } @@ -104,9 +112,47 @@ }) @GetMapping("/cancel/{orderId}") public R<Void> cancel(@PathVariable("orderId") Long orderId){ + // TODO 待完善 return R.ok(); } + /** + * 确认收货 + */ + @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单-确认收货"}) + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), + }) + @GetMapping("/confirm/{orderId}") + public R<Void> confirm(@PathVariable("orderId") Long orderId){ + // TODO 待完善 + return R.ok(); + } + + /** + * 更换收货地址 + */ + @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单-更换收货地址"}) + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), + }) + @GetMapping("/changeAddress") + public R<Void> changeAddress(@RequestParam("orderId") Long orderId, @RequestParam("addressId") Long addressId){ + R<UserAddress> userAddressR = addressClient.getUserAddressById(addressId); + if(R.isError(userAddressR)){ + return R.fail("收货地址不存在"); + } + UserAddress userAddress = userAddressR.getData(); + String addressJson = JSONObject.toJSONString(userAddress); + orderService.update(new LambdaUpdateWrapper<Order>() + .eq(Order::getId, orderId) + .set(Order::getAddressJson, addressJson)); + return R.ok(); + } + + + + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java index 7ac38db..2085ad3 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java @@ -1,8 +1,21 @@ package com.ruoyi.order.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.order.model.Order; +import com.ruoyi.order.model.RefundPass; +import com.ruoyi.order.service.OrderService; +import com.ruoyi.order.service.RefundPassService; +import com.ruoyi.order.vo.ApplyRefundPass; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Arrays; /** * <p> @@ -16,5 +29,93 @@ @RequestMapping("/refund-pass") public class RefundPassController { + + @Resource + private RefundPassService refundPassService; + + @Resource + private TokenService tokenService; + + @Resource + private OrderService orderService; + + + @ResponseBody + @PostMapping("/applyRefundPass") + @ApiOperation(value = "售后申请", tags = {"我的订单-个人中心-小程序"}) + public R applyRefundPass(@RequestBody ApplyRefundPass applyRefundPass){ + return refundPassService.applyRefundPass(applyRefundPass); + } + + @ResponseBody + @GetMapping("/getRefundPass/{orderId}") + @ApiOperation(value = "获取售后详情", tags = {"我的订单-个人中心-小程序"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "orderId", value = "订单id", required = true, dataType = "long"), + }) + public R<RefundPass> getRefundPass(@PathVariable("orderId") Long orderId){ + Long userid = tokenService.getLoginUserApplet().getUserid(); + Order order = orderService.getById(orderId); + if(!order.getAppUserId().equals(userid)){ + return R.fail("权限不足"); + } + RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId) + .eq(RefundPass::getDelFlag, 0).last(" order by createTime desc limit 0,1")); + one.setIdStr(one.getId().toString()); + return R.ok(one); + } + + + @ResponseBody + @PutMapping("/cancelRefundPass/{id}") + @ApiOperation(value = "取消售后", tags = {"我的订单-个人中心-小程序"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), + }) + public R cancelRefundPass(@PathVariable("id") Long id){ + RefundPass refundPass = refundPassService.getById(id); + if(null == refundPass){ + return R.fail(); + } + Long userid = tokenService.getLoginUserApplet().getUserid(); + Order order = orderService.getById(refundPass.getOrderId()); + if(!order.getAppUserId().equals(userid)){ + return R.fail("权限不足"); + } + if(Arrays.asList(2, 3).contains(refundPass.getStatus())){ + return R.fail("售后取消失败"); + } + refundPass.setDelFlag(1); + refundPassService.updateById(refundPass); + order.setOrderStatus(4); + orderService.updateById(order); + return R.ok(); + } + + + @ResponseBody + @PutMapping("/deliverGoodsRefundPass/{id}") + @ApiOperation(value = "售后已发货操作", tags = {"我的订单-个人中心-小程序"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "售后数据id", required = true, dataType = "long"), + }) + public R deliverGoodsRefundPass(@PathVariable("id") Long id){ + RefundPass refundPass = refundPassService.getById(id); + if(null == refundPass){ + return R.fail(); + } + Long userid = tokenService.getLoginUserApplet().getUserid(); + Order order = orderService.getById(refundPass.getOrderId()); + if(!order.getAppUserId().equals(userid)){ + return R.fail("权限不足"); + } + if(4 != refundPass.getStatus()){ + return R.fail("操作失败"); + } + refundPass.setStatus(5); + refundPassService.updateById(refundPass); + return R.ok(); + } + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java index da99507..07a13a0 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java @@ -2,11 +2,12 @@ import java.time.LocalDateTime; import java.util.List; +import java.util.Set; public interface CommissionService { // 计算佣金 - void calculationCommission(List<Long> orderIds); + void calculationCommission(Set<String> orderIds); void addToCommissionDelayQueue(Long orderId, LocalDateTime afterSalesDeadline); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java index 57f8f22..d771ad7 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java @@ -1,7 +1,10 @@ package com.ruoyi.order.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.R; import com.ruoyi.order.model.RefundPass; +import com.ruoyi.order.vo.ApplyRefundPass; +import org.springframework.web.bind.annotation.RequestBody; /** * <p> @@ -12,5 +15,12 @@ * @since 2024-11-21 */ public interface RefundPassService extends IService<RefundPass> { + + /** + * 申请售后 + * @param applyRefundPass + * @return + */ + R applyRefundPass(ApplyRefundPass applyRefundPass); } 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 2efa1cb..a2d00ce 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 @@ -20,6 +20,7 @@ import java.time.ZoneId; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; @Service @@ -49,7 +50,7 @@ } @Override - public void calculationCommission(List<Long> orderIds) { + public void calculationCommission(Set<String> orderIds) { List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>() .in(OrderGood::getOrderId, orderIds)); @@ -77,32 +78,51 @@ throw new RuntimeException("获取用户信息失败"); } Long inviteUserId = appUser.getInviteUserId(); + // 直推上级用户 AppUser inviteUser = appUserClient.getAppUserById(inviteUserId); + + // 获取直帮上级用户 + R<AppUser> superiorLeaderR = appUserClient.getSuperiorLeader(appUserId); + if (!R.isSuccess(superiorLeaderR)) { + throw new RuntimeException("获取直帮上级信息失败"); + } + AppUser superiorLeader = superiorLeaderR.getData(); for (OrderGood og : v) {// 累计分销金额 - // 上级分销金额 - if (inviteUser != null){ + // 直推上级分佣金额 + Integer superiorType = og.getSuperiorType(); + if (superiorType == 1 && inviteUser != null){ + // 分佣金额 BigDecimal superiorSubcommission = og.getSuperiorSubcommission(); BigDecimal totalDistributionAmount = inviteUser.getTotalDistributionAmount(); totalDistributionAmount = totalDistributionAmount.add(superiorSubcommission); - // - Integer superiorType = og.getSuperiorType(); + inviteUser.setTotalDistributionAmount(totalDistributionAmount); + + // 分佣积分 Integer sharePoint = inviteUser.getSharePoint(); - if (superiorType == 1) { + Integer superiorRebatePoints = og.getSuperiorRebatePoints(); + sharePoint = sharePoint + superiorRebatePoints; + inviteUser.setSharePoint(sharePoint); + + appUserClient.editAppUserById(inviteUser); + }else + // 直帮上级分佣金额 + if (superiorType == 2 && superiorLeader != null){ + // 分佣金额 + BigDecimal superiorSubcommission = og.getSuperiorSubcommission(); + BigDecimal totalDistributionAmount = superiorLeader.getTotalDistributionAmount(); + totalDistributionAmount = totalDistributionAmount.add(superiorSubcommission); + superiorLeader.setTotalDistributionAmount(totalDistributionAmount); + + // 分佣积分 + Integer sharePoint = superiorLeader.getSharePoint(); Integer superiorRebatePoints = og.getSuperiorRebatePoints(); sharePoint = sharePoint + superiorRebatePoints; - } else if (superiorType == 2) { + superiorLeader.setSharePoint(sharePoint); - } else { - continue; + appUserClient.editAppUserById(superiorLeader); } - inviteUser.setTotalDistributionAmount(totalDistributionAmount); - inviteUser.setSharePoint(sharePoint); - } - - // 门店分销金额 - og.getBoundShopCharges(); } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index 5064e1b..1d08221 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.order.service.impl; +import cn.hutool.core.collection.CollectionUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -20,10 +21,9 @@ import com.ruoyi.order.vo.OrderDetailVO; import com.ruoyi.order.vo.OrderGoodsVO; import com.ruoyi.order.vo.OrderVO; -import com.ruoyi.other.api.domain.CouponInfo; -import com.ruoyi.other.api.domain.Goods; -import com.ruoyi.other.api.domain.OrderActivityInfo; -import com.ruoyi.other.api.domain.Technician; +import com.ruoyi.other.api.domain.*; +import com.ruoyi.other.api.feignClient.GoodsClient; +import com.ruoyi.other.api.feignClient.ShopClient; import com.ruoyi.other.api.feignClient.TechnicianClient; import com.ruoyi.system.api.model.LoginUser; import org.springframework.stereotype.Service; @@ -54,6 +54,8 @@ private TokenService tokenService; @Resource private TechnicianClient technicianClient; + @Resource + private ShopClient shopClient; @Override @@ -70,6 +72,11 @@ if (order == null){ throw new ServiceException("订单不存在"); } + R<Shop> shopR = shopClient.getShopById(order.getShopId()); + if (!R.isSuccess(shopR)){ + throw new ServiceException("获取门店信息失败"); + } + // 商品 List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>() .eq(OrderGood::getOrderId, orderId)); @@ -78,17 +85,17 @@ for (OrderGood orderGood : orderGoods) { String goodJson = orderGood.getGoodJson(); Goods goods = JSONObject.parseObject(goodJson, Goods.class); - OrderGoodsVO orderGoodsVO = new OrderGoodsVO(); orderGoodsVO.setGoodsId(orderGood.getGoodsId()); + orderGoodsVO.setNum(orderGood.getNum()); orderGoodsVO.setGoodsName(goods.getName()); orderGoodsVO.setType(goods.getType()); - orderGoodsVO.setNum(orderGood.getNum()); orderGoodsVO.setGoodsPic(goods.getHomePagePicture()); orderGoodsVO.setSellingPrice(goods.getSellingPrice()); orderGoodsVO.setOriginalPrice(goods.getOriginalPrice()); goodsList.add(orderGoodsVO); } + // 收货地址 @@ -114,7 +121,18 @@ } OrderDetailVO orderDetailVO = new OrderDetailVO(); + + if (CollectionUtil.isNotEmpty(orderGoods)){ + String goodJson = orderGoods.get(0).getGoodJson(); + Goods goods = JSONObject.parseObject(goodJson, Goods.class); + orderDetailVO.setDistributionMode(goods.getDistributionMode()); + } + + Shop shop = shopR.getData(); + + orderDetailVO.setId(order.getId()); + orderDetailVO.setOrderStatus(order.getOrderStatus()); orderDetailVO.setPoint(order.getPoint()); orderDetailVO.setAddressId(userAddress.getId()); orderDetailVO.setRecieveName(userAddress.getRecieveName()); @@ -130,6 +148,10 @@ orderDetailVO.setPointAmount(order.getGetPoint()); orderDetailVO.setPaymentAmount(order.getPaymentAmount()); orderDetailVO.setGoodsList(goodsList); + orderDetailVO.setShopName(shop.getName()); + orderDetailVO.setShopAddress(shop.getAddress()); + orderDetailVO.setLongitude(shop.getLongitude()); + orderDetailVO.setLatitude(shop.getLatitude()); return orderDetailVO; } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java index e729de4..a06c6bb 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java @@ -1,10 +1,19 @@ package com.ruoyi.order.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.R; import com.ruoyi.order.mapper.RefundPassMapper; +import com.ruoyi.order.model.Order; import com.ruoyi.order.model.RefundPass; +import com.ruoyi.order.service.OrderService; import com.ruoyi.order.service.RefundPassService; +import com.ruoyi.order.vo.ApplyRefundPass; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.ZoneOffset; /** * <p> @@ -16,5 +25,44 @@ */ @Service public class RefundPassServiceImpl extends ServiceImpl<RefundPassMapper, RefundPass> implements RefundPassService { - + + @Resource + private OrderService orderService; + + + /** + * 申请售后 + * @param applyRefundPass + * @return + */ + @Override + public R applyRefundPass(ApplyRefundPass applyRefundPass) { + RefundPass one = this.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, applyRefundPass.getId()).eq(RefundPass::getDelFlag, 0) + .ne(RefundPass::getStatus, 3)); + if(null != one){ + return R.fail("不能重复提交售后"); + } + Order order = orderService.getById(applyRefundPass.getId()); + //判断是都已经超过售后时间 + LocalDateTime afterSaleTime = order.getAfterSaleTime(); + if(null != afterSaleTime && afterSaleTime.toEpochSecond(ZoneOffset.UTC) < LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)){ + return R.fail("已超过售后期间"); + } + + //构建售后申请数据 + RefundPass refundPass = new RefundPass(); + refundPass.setOrderId(applyRefundPass.getId()); + refundPass.setStatus(1); + refundPass.setRefundMethod(applyRefundPass.getRefundMethod()); + refundPass.setRefundReason(applyRefundPass.getRefundReason()); + refundPass.setUserRemark(applyRefundPass.getUserRemark()); + refundPass.setPics(applyRefundPass.getPics()); + refundPass.setPassStatus(1); + refundPass.setDelFlag(0); + refundPass.setCreateTime(LocalDateTime.now()); + this.save(refundPass); + order.setOrderStatus(7); + orderService.updateById(order); + return R.ok(); + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index b5cf7dd..36745b4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -20,6 +20,7 @@ import com.ruoyi.order.model.Order; import com.ruoyi.order.model.OrderGood; import com.ruoyi.order.model.ShoppingCart; +import com.ruoyi.order.service.CommissionService; import com.ruoyi.order.service.OrderGoodService; import com.ruoyi.order.service.OrderService; import com.ruoyi.order.service.ShoppingCartService; @@ -97,6 +98,9 @@ @Resource private BalanceChangeRecordClient balanceChangeRecordClient; + + @Resource + private CommissionService commissionService; @@ -417,35 +421,37 @@ paymentUserCoupon.setType(confirmOrder.getType()); if(confirmOrder.getPaymentType() == 1){ List<PaymentUserCouponVo> data = userCouponClient.getPaymentUserCoupon(paymentUserCoupon).getData(); - for (PaymentUserCouponVo couponInfo : data) { - List<Integer> forGoodIds = couponInfo.getForGoodIds(); - //全部商品适用 - if(null == forGoodIds){ - //满减券 - if(1 == couponInfo.getCouponType() && orderMoney.compareTo(couponInfo.getConditionAmount()) >= 0){ - couponInfo.setAvailable(true); - } - //代金券和折扣券 - if(2 == couponInfo.getCouponType() || 3 == couponInfo.getCouponType()){ - couponInfo.setAvailable(true); - } - }else{ - //部分商品适用 - BigDecimal goodsMoney = BigDecimal.ZERO; - for (MyShoppingCartVo myShoppingCartVo : goodsList) { - Integer goodsId = myShoppingCartVo.getGoodsId(); - BigDecimal cash = myShoppingCartVo.getCash(); - if(forGoodIds.contains(goodsId)){ - goodsMoney = goodsMoney.add(cash); + if(null != data){ + for (PaymentUserCouponVo couponInfo : data) { + List<Integer> forGoodIds = couponInfo.getForGoodIds(); + //全部商品适用 + if(null == forGoodIds){ + //满减券 + if(1 == couponInfo.getCouponType() && orderMoney.compareTo(couponInfo.getConditionAmount()) >= 0){ + couponInfo.setAvailable(true); } - } - //满减 - if(1 == couponInfo.getCouponType() && couponInfo.getConditionAmount().compareTo(goodsMoney) <= 0){ - couponInfo.setAvailable(true); - } - //代金券 - if(2 == couponInfo.getCouponType() || 3 == couponInfo.getCouponType()){ - couponInfo.setAvailable(true); + //代金券和折扣券 + if(2 == couponInfo.getCouponType() || 3 == couponInfo.getCouponType()){ + couponInfo.setAvailable(true); + } + }else{ + //部分商品适用 + BigDecimal goodsMoney = BigDecimal.ZERO; + for (MyShoppingCartVo myShoppingCartVo : goodsList) { + Integer goodsId = myShoppingCartVo.getGoodsId(); + BigDecimal cash = myShoppingCartVo.getCash(); + if(forGoodIds.contains(goodsId)){ + goodsMoney = goodsMoney.add(cash); + } + } + //满减 + if(1 == couponInfo.getCouponType() && couponInfo.getConditionAmount().compareTo(goodsMoney) <= 0){ + couponInfo.setAvailable(true); + } + //代金券 + if(2 == couponInfo.getCouponType() || 3 == couponInfo.getCouponType()){ + couponInfo.setAvailable(true); + } } } } @@ -489,7 +495,7 @@ for (ShoppingCart shoppingCart : list) { Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); MyShoppingCartVo vo = new MyShoppingCartVo(); - vo.setId(shoppingCart.getId()); + vo.setId(shoppingCart.getId().toString()); vo.setGoodsId(goods.getId()); vo.setHomePicture(goods.getHomePagePicture()); vo.setName(goods.getName()); @@ -506,6 +512,7 @@ //获取支付价格 Price price = getPrice(appUser, shoppingCart.getGoodsId(), shopId); if(null == price){ + price = new Price(); //使用商品的基础价格 price.setCash(1 == goods.getCashPayment() ? goods.getSellingPrice() : null); price.setPoint(1 == goods.getPointPayment() ? goods.getIntegral() : null); @@ -523,7 +530,7 @@ goodsShop.setGoodsId(shoppingCart.getGoodsId()); goodsShop.setShopId(shopId); GoodsShop goodsShop1 = goodsShopClient.getGoodsShop(goodsShop).getData(); - vo.setVerifiable(null == goodsShop1 ? false : true); + vo.setVerifiable(goods.getAppointStore() == 1 && null == goodsShop1 ? false : true); //判断当前数量是否已经超出限购数量(需要计算已经购买的数量) if(null == goods.getPurchaseLimit() || -1 == goods.getPurchaseLimit()){ vo.setPurchaseLimit(false); @@ -622,12 +629,15 @@ if(data.size() != goodsList.size()){ String goodsName = ""; for (Integer goodsId : goodsIds) { - if(!collect.contains(goodsId)){ - goodsName = goodsClient.getGoodsById(goodsId).getData().getName(); + Goods goods = goodsClient.getGoodsById(goodsId).getData(); + if(1 == goods.getAppointStore() && !collect.contains(goodsId)){ + goodsName = goods.getName(); break; } } - return R.fail(goodsName + "不能在该门店核销"); + if(StringUtils.isNotEmpty(goodsName)){ + return R.fail(goodsName + "不能在该门店核销"); + } } //开始构建支付信息 //现金支付的订单金额 @@ -816,6 +826,7 @@ order.setShopId(shoppingCartPayment.getShopId()); order.setDelFlag(0); order.setCreateTime(LocalDateTime.now()); + order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType()); if(2 == shoppingCartPayment.getPaymentType()){ BigDecimal balance = appUser.getBalance(); @@ -824,7 +835,7 @@ } } //判断运费支付是否足够 - if(2 == shoppingCartPayment.getFreightPaymentType() && expressFee.compareTo(BigDecimal.ZERO) > 0){ + if(null != shoppingCartPayment.getFreightPaymentType() && 2 == shoppingCartPayment.getFreightPaymentType() && expressFee.compareTo(BigDecimal.ZERO) > 0){ BigDecimal balance = appUser.getBalance(); if(balance.compareTo(expressFee) < 0){ return R.fail("账户余额不足"); @@ -846,10 +857,11 @@ } for (int i = 0; i < objects.size(); i++) { Long id = objects.getJSONObject(i).getLong("id"); - if(myShoppingCartVo.getId().equals(id)){ + if(myShoppingCartVo.getId().equals(id.toString())){ + ShoppingCart shoppingCart = this.getById(id); Integer num1 = objects.getJSONObject(i).getInteger("num"); orderGood.setNum(num1); - Goods goods1 = goodsClient.getGoodsById(myShoppingCartVo.getGoodsId()).getData(); + Goods goods1 = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); orderGood.setGoodJson(JSON.toJSONString(goods1)); break; } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java new file mode 100644 index 0000000..651cd12 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java @@ -0,0 +1,25 @@ +package com.ruoyi.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @Date 2024/12/6 18:30 + */ +@Data +@ApiModel +public class ApplyRefundPass { + @ApiModelProperty(value = "订单id", required = true) + private Long id; + @ApiModelProperty(value = "售后类型(1=退货退款,2=仅退款)", required = true) + private Integer refundMethod; + @ApiModelProperty(value = "申请原因", required = true) + private String refundReason; + @ApiModelProperty(value = "备注", required = true) + private String userRemark; + @ApiModelProperty(value = "图片地址,多个逗号分隔", required = true) + private String pics; + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java index 94be85a..cc3b4b5 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java @@ -14,7 +14,7 @@ @ApiModel("购物车") public class MyShoppingCartVo { @ApiModelProperty("数据id") - private Long id; + private String id; @ApiModelProperty("商品id") private Integer goodsId; @ApiModelProperty("封面图") diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java index 2e65707..b837117 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java @@ -10,7 +10,7 @@ @Data public class OrderVO { @ApiModelProperty(value = "订单id") - private Integer id; + private String id; @ApiModelProperty(value = "订单编号") private String orderNumber; diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java index 896d95d..31172d3 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java @@ -12,7 +12,7 @@ @ApiModel public class SetGoodsNumber { @ApiModelProperty(value = "购物车数据id", required = true) - private Integer id; + private Long id; @ApiModelProperty(value = "修改数量", required = true) private Integer number; } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java index fee0f50..056104b 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java @@ -24,7 +24,7 @@ @ApiModelProperty(value = "配送方式(1=自提,2=快递)", required = false) private Integer distributionMode; @ApiModelProperty(value = "配送地址id", required = false) - private Integer userAddressId; + private Long userAddressId; @ApiModelProperty(value = "预计提货时间", required = false) private String expectedDeliveryTime; } diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml index c5188f0..e6f9770 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml @@ -5,7 +5,7 @@ <select id="selectOrderListByUserId" resultType="com.ruoyi.order.vo.OrderVO"> SELECT - o.id, + CAST(o.id AS CHAR) id, o.order_number, o.order_status, o.good_name, @@ -32,7 +32,8 @@ o.good_pics, o.num, o.point, - o.payment_amount + o.payment_amount, + o.create_time ORDER BY o.create_time DESC </select> diff --git a/ruoyi-service/ruoyi-other/pom.xml b/ruoyi-service/ruoyi-other/pom.xml index 2ee7e3b..2288606 100644 --- a/ruoyi-service/ruoyi-other/pom.xml +++ b/ruoyi-service/ruoyi-other/pom.xml @@ -44,10 +44,10 @@ <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-seata</artifactId> - </dependency> + <!--<dependency>--> + <!--<groupId>com.alibaba.cloud</groupId>--> + <!--<artifactId>spring-cloud-starter-alibaba-seata</artifactId>--> + <!--</dependency>--> <!-- SpringBoot Actuator --> <dependency> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java index 8baec9b..b1d1e35 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java @@ -46,7 +46,7 @@ } - @PostMapping("/gift/list") + @GetMapping("/gift/list") @ApiOperation(value = "待领取列表", tags = {"小程序-个人中心-优惠劵"}) public R<List<CouponInfo>> giftlist(){ Long userid = tokenService.getLoginUserApplet().getUserid(); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java index 8437f2b..1aa28d5 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java @@ -47,9 +47,9 @@ */ @GetMapping("/getGoodsListByShopId") @ApiOperation(value = "商品列表", tags = {"小程序-首页-门店详情-商品购买列表"}) - public R<List<Goods>> getGoodsListByShopId(@ApiParam("门店id") @RequestParam Integer shopId) { + public R<TableDataInfo> getGoodsListByShopId(@ApiParam("门店id") @RequestParam Integer shopId) { startPage(); - return R.ok(goodsService.getGoodsListByShopId(shopId)); + return R.ok(getDataTable(goodsService.getGoodsListByShopId(shopId))); } @@ -94,6 +94,6 @@ List<Goods> goods = goodsService.lambdaQuery().in(Goods::getId, ids).eq(Goods::getStatus, 0).list(); return R.ok(goods); } - + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java index 0f3f1b2..52be078 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java @@ -8,11 +8,10 @@ import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.domain.GoodsEvaluate; import com.ruoyi.other.service.GoodsEvaluateService; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -27,6 +26,7 @@ */ @RestController @RequestMapping("/goods-evaluate") +@Api("评论") public class GoodsEvaluateController { @Resource private GoodsEvaluateService goodsEvaluateService; @@ -34,7 +34,7 @@ private AppUserClient appUserClient; @GetMapping("/goodsList") - @ApiOperation(value = "商品评价", tags = {"小程序-商品评价"}) + @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"}) public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){ List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list(); for (GoodsEvaluate goodsEvaluate : list) { @@ -45,5 +45,25 @@ return R.ok(list); } + /** + * 发布商品评价 + */ + @PostMapping("/addGoodsEvaluate") + @ApiOperation(value = "发布商品评价", tags = {"小程序-发布商品评价"}) + public R<Void> addGoodsEvaluate(GoodsEvaluate goodsEvaluate){ + goodsEvaluateService.save(goodsEvaluate); + return R.ok(); + } + + /** + * 评论详情 + */ + @GetMapping("/detail/{id}") + @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"}) + public R<GoodsEvaluate> detail(@PathVariable("id") Long id){ + GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id); + return R.ok(goodsEvaluate); + } + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index e6fc1b1..41c12e5 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -71,17 +71,6 @@ return R.ok(shopService.nearbyShopList(longitude, latitude)); } - /** - * 门店详情 - */ - @GetMapping("/technicianList") - @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) - public AjaxResult technicianList(@ApiParam("门店id") @RequestParam String shopId){ - return success(technicianService.list(new LambdaQueryWrapper<Technician>() - .eq(Technician::getShopId,shopId) - .eq(Technician::getStatus,2) - .eq(Technician::getSubscribeStatus,1))); - } @GetMapping("/shopDetail") @ApiOperation(value = "门店详情", tags = {"小程序-首页-门店详情"}) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java index 64f1a8b..d90cd97 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java @@ -2,11 +2,14 @@ import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.feignClient.OrderClient; import com.ruoyi.other.service.GoodsEvaluateService; import com.ruoyi.other.service.TechnicianService; import com.ruoyi.other.service.TechnicianSubscribeService; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import javax.annotation.Resource; @@ -30,7 +33,8 @@ */ @RestController @RequestMapping("/technician") -public class TechnicianController { +@Api(tags = "技师") +public class TechnicianController extends BaseController { @Resource private TechnicianService technicianService; @Resource @@ -103,8 +107,9 @@ */ @GetMapping("/technicianListByShopId") @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) - public R<List<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) { - return R.ok(technicianService.getTechnicianListByShopId(shopId)); + public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) { + startPage(); + return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId))); } /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipGoodController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipGoodController.java index 4f867f2..45cd48d 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipGoodController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipGoodController.java @@ -1,8 +1,18 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.other.api.domain.VipGood; +import com.ruoyi.other.service.VipGoodService; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -14,7 +24,14 @@ */ @RestController @RequestMapping("/vip-good") -public class VipGoodController { +public class VipGoodController extends BaseController { + @Resource + private VipGoodService vipGoodService; + @GetMapping("getVipGoodsByVipId") + public R<List<VipGood>> getVipGoodsByVipId(@RequestParam("vipId") Integer vipId){ + return R.ok(vipGoodService.list(new LambdaQueryWrapper<VipGood>() + .eq(VipGood::getVipId, vipId))); + } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java index 8f73394..4af566f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java @@ -36,8 +36,9 @@ @Resource private VipGoodService vipGoodService; - @GetMapping("/list") - public R<List<VipSetting>> list() { + @GetMapping("/info") + @ApiOperation(value = "获取各级会员信息", tags = {"小程序-个人中心首页", "小程序-会员中心"}) + public R<List<VipSetting>> info() { List<VipSetting> list = vipSettingService.list(); return R.ok(list); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/GoodsStatus.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/GoodsStatus.java index 1a6702b..8f5dd6c 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/GoodsStatus.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/GoodsStatus.java @@ -4,8 +4,8 @@ @Getter public enum GoodsStatus { - DOWN(0, "下架"), - UP(1, "上架"); + DOWN(1, "下架"), + UP(2, "上架"); private final Integer code; private final String desc; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java index 2058cb9..a5bf0a5 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.other.api.domain.Goods; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,5 +15,5 @@ * @since 2024-11-20 */ public interface GoodsMapper extends BaseMapper<Goods> { - List<Goods> selectListByShopId(Integer shopId, Integer vip); + List<Goods> selectListByShopId(@Param("shopId") Integer shopId,@Param("vip") Integer vip); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 373e980..a299b54 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -7,13 +7,12 @@ import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.security.service.TokenService; -import com.ruoyi.other.api.domain.Goods; -import com.ruoyi.other.api.domain.GoodsArea; -import com.ruoyi.other.api.domain.GoodsVip; -import com.ruoyi.other.api.domain.VipSetting; +import com.ruoyi.other.api.domain.*; import com.ruoyi.other.enums.GoodsStatus; import com.ruoyi.other.mapper.GoodsAreaMapper; import com.ruoyi.other.mapper.GoodsMapper; +import com.ruoyi.other.mapper.GoodsShopMapper; +import com.ruoyi.other.mapper.ShopMapper; import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.service.GoodsVipService; import com.ruoyi.other.service.VipSettingService; @@ -26,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * <p> @@ -49,11 +49,15 @@ private GoodsVipService goodsVipService; @Resource private AppUserClient appUserClient; + @Resource + private GoodsShopMapper goodsShopMapper; + @Resource + private ShopMapper shopMapper; @Override public List<GoodsVO> goodsList(Goods search) { List<Goods> goodsList = this.list(new LambdaQueryWrapper<Goods>() - .eq(Goods::getStatus, GoodsStatus.UP) + .eq(Goods::getStatus, GoodsStatus.UP.getCode()) .eq(Objects.nonNull(search.getGoodsCategoryId()), Goods::getGoodsCategoryId, search.getGoodsCategoryId()) .like(StringUtils.isNotEmpty(search.getName()), Goods::getName, search.getName())); @@ -61,6 +65,8 @@ for (Goods goods : goodsList) { GoodsVO goodsVO = new GoodsVO(); BeanUtils.copyBeanProp(goodsVO, goods); + goodsVO.setGoodsId(goods.getId()); + goodsVO.setGoodsName(goods.getName()); result.add(goodsVO); } return result; @@ -97,8 +103,17 @@ } Goods goods = this.getById(goodsId); + + List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() + .eq(GoodsShop::getGoodsId, goodsId)); + List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList()); + List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() + .in(Shop::getId, shopIds)); GoodsVO goodsVO = new GoodsVO(); + goodsVO.setShopList(shopList); BeanUtils.copyBeanProp(goodsVO, goods); + goodsVO.setGoodsId(goods.getId()); + goodsVO.setGoodsName(goods.getName()); goodsVO.setSellingPrice(sellingPrice); goodsVO.setIntegral(integral); return goodsVO; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java index 03308d7..6569362 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java @@ -1,18 +1,19 @@ package com.ruoyi.other.vo; -import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.other.api.domain.Shop; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; +import java.util.List; @ApiModel(value="商品热销对象", description="热门商品") @Data public class GoodsVO { @ApiModelProperty(value = "商品id") - private Long goodsId; + private Integer goodsId; @ApiModelProperty(value = "商品名称") private String goodsName; @@ -39,7 +40,6 @@ private Integer pointPayment; @ApiModelProperty(value = "基础积分") - @TableField("integral") private Integer integral; @ApiModelProperty(value = "划线价") @@ -50,4 +50,12 @@ @ApiModelProperty(value = "已售数量") private Integer saleNum; + + @ApiModelProperty(value = "门店id") + private Integer shopId; + + @ApiModelProperty(value = "门店列表") + private List<Shop> shopList; + + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java index e5bc269..63d3063 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianDetailVO.java @@ -1,11 +1,13 @@ package com.ruoyi.other.vo; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data +@ApiModel(value="技师详情对象", description="技师详情对象") public class TechnicianDetailVO { /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianVO.java index 8b9c9ea..4bd5903 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianVO.java @@ -1,12 +1,14 @@ package com.ruoyi.other.vo; import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data +@ApiModel(value="技师对象", description="技师对象") public class TechnicianVO { @ApiModelProperty(value = "主键") private Long id; diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml index 96b150a..c20eb67 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml @@ -8,14 +8,13 @@ tt.introduction, tt.home_picture, COUNT(tts.id) AS serviceCount, - AVG(ttsc.score) AS score + AVG( IFNULL(ttsc.score,0) ) AS score FROM t_technician tt - LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id + LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id and tts.`status` != 0 LEFT JOIN t_technician_score ttsc ON ttsc.technician_id = tt.id WHERE - tts.`status` != 0 - AND tt.`status` = 2 + tt.`status` = 2 AND tt.del_flag = 0 AND tt.subscribe_status = 1 AND tt.shop_id = #{shopId} -- Gitblit v1.7.1