From fcabbb78c0158b4417f89475935f0f36f58f0d87 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 10 十二月 2024 10:04:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java | 7 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java | 7 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/VipSetting.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java | 278 +++++++++++++++++++++++++++++- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 10 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java | 12 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 12 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java | 16 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java | 36 ++-- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java | 6 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java | 12 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java | 2 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml | 3 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OrderClient.java | 2 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 17 + ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java | 5 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java | 14 + ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java | 6 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java | 23 -- ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java | 10 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java | 3 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java | 3 32 files changed, 438 insertions(+), 76 deletions(-) diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java index f719fcb..00e5cd1 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java @@ -35,6 +35,11 @@ public R<Void> updateOrderStatus(Order order) { return R.fail("更新订单状态失败"); } + + @Override + public R<Void> subscribe(Long id, Integer technicianId) { + return R.fail("预约失败"); + } }; } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java index 8a341d2..5aadf65 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java @@ -40,4 +40,10 @@ */ @PostMapping("/order/updateOrderStatus") public R<Void> updateOrderStatus(@RequestBody Order order); + + /** + * 预约技师 + */ + @PostMapping("/order/subscribe") + public R<Void> subscribe(@RequestParam(value = "id" , required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId); } 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 4157b44..f3a4662 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 @@ -80,4 +80,7 @@ @ApiModelProperty(value = "门店id") private Integer shopId; + @ApiModelProperty(value = "技师名称") + private String technicianName; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java index 2de0d6f..a2e609d 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java @@ -79,5 +79,19 @@ @TableField(exist = false) private String userName; + @ApiModelProperty(value = "商品名字") + @TableField(exist = false) + private String goodsName; + @ApiModelProperty(value = "商品图片") + @TableField(exist = false) + private String goodsImg; + + @TableField(exist = false) + private String idStr; + + public void setId(Long id) { + this.id = id; + this.idStr = String.valueOf(id); + } } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java index 2da2886..6e5404f 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java @@ -70,5 +70,15 @@ private LocalDateTime createTime; + @ApiModelProperty(value = "订单id") + private Long orderId; + @TableField(exist = false) + private String idStr; + + + public void setId(Long id) { + this.id = id; + this.idStr = String.valueOf(id); + } } 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 efcb5a7..688cbd4 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 @@ -131,5 +131,9 @@ @TableField("keep_shop_point") private Integer keepShopPoint; + @ApiModelProperty(value = "会员等级是否必须达到代理: 0-否 1-是") + @TableField("vip_level_up_proxy_role") + private Integer vipLevelUpProxyRole; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java index 933c976..3a33ec3 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java @@ -6,6 +6,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.openfeign.FallbackFactory; +import java.util.List; + @Slf4j public class ShopClientFallbackFactory implements FallbackFactory<ShopClient> { @Override @@ -20,6 +22,11 @@ public R<Shop> getShopByPhone(String phone) { return R.fail("根据店铺管理员电话获取门店数据失败:" + cause.getMessage()); } + + @Override + public R<List<Shop>> getShopByUserIds(List<Long> userIds) { + return R.fail("根据用户id集合获取门店数据失败"); + } }; } } 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 d36d01d..bc7cd91 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 @@ -17,6 +17,4 @@ 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/ShopClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java index 2928637..bbc7986 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 @@ -1,12 +1,16 @@ package com.ruoyi.other.api.feignClient; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.factory.ShopClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; /** * @author zhibing.pu @@ -32,4 +36,7 @@ */ @PostMapping("/shop/getShopByPhone") R<Shop> getShopByPhone(@RequestParam("phone") String phone); + + @PostMapping("/getShopByUserIds") + public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds); } 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 686b418..bcec36a 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 @@ -5,15 +5,15 @@ import com.ruoyi.other.api.domain.Technician; import com.ruoyi.other.api.factory.TechnicianClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestParam; @FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class) public interface TechnicianClient { - @PostMapping("/technician/shop/detail") - R<Technician> shopdetail(@RequestParam("techId") Integer techId); + @GetMapping("/technician/getById") + R<Technician> shopdetail(@RequestParam("id") Integer techId); @PutMapping("/technician-subscribe/updateStatus") R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Integer subscribeId); 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 index 6f20e70..aeb40c0 100644 --- 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 @@ -1,7 +1,6 @@ package com.ruoyi.account.controller; import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.VipCenterService; import com.ruoyi.account.service.VipSettingService; import com.ruoyi.account.vo.vip.Level; @@ -13,8 +12,6 @@ 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 io.swagger.annotations.ApiParam; @@ -46,10 +43,6 @@ private VipSettingService vipSettingService; @Resource private TokenService tokenService; - @Resource - private VipGoodClient vipGoodClient; - @Resource - private AppUserService appUserService; @Resource private VipCenterService vipCenterService; @@ -130,22 +123,8 @@ @GetMapping("/check") @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"}) public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) { - LoginUser loginUser = tokenService.getLoginUser(); - Long userid = loginUser.getUserid(); - if (type == 4){ - return R.ok(vipCenterService.checkReadyToBeProxy(userid, type)); - }else if (type == 5){ - return R.ok(vipCenterService.checkReadyToBeAgent(userid)); - }else if (type == 6){ - return R.ok(vipCenterService.checkReadyToBeTotalAgent(userid)); - }else if (type == 7){ - return R.ok(vipCenterService.checkReadyToBePartner(userid)); - }else { - return R.fail("参数错误"); - } + return R.ok(vipCenterService.check(type)); } - - private boolean checkSuccess(R<?> r) { diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java index 10b48d1..f64a14d 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java @@ -39,5 +39,6 @@ return AjaxResult.success(); } + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java index 0bfd5bf..d7b6228 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/VipCenterService.java @@ -21,4 +21,7 @@ * 校验合伙人的申请条件 */ Boolean checkReadyToBePartner(Long userId); + + + Boolean check(Integer type); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java index 68bae5a..2ec3a0c 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java @@ -8,16 +8,23 @@ import com.ruoyi.account.service.VipCenterService; import com.ruoyi.account.service.VipSettingService; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.exception.ServiceException; +import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.model.Order; import com.ruoyi.other.api.domain.Goods; +import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.domain.VipGood; import com.ruoyi.other.api.domain.VipSetting; +import com.ruoyi.other.api.feignClient.ShopClient; import com.ruoyi.other.api.feignClient.VipGoodClient; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; @Service @@ -30,6 +37,11 @@ private VipGoodClient vipGoodClient; @Resource private VipSettingService vipSettingService; + @Resource + private ShopClient shopClient; + @Resource + private TokenService tokenService; + @Override public Boolean checkReadyToBeProxy(Long userId,Integer vipId) { @@ -40,34 +52,276 @@ Integer sharePoint = appUser.getSharePoint(); // 准代理会员设置 VipSetting vipSetting = vipSettingService.getVipSettingById(4); - // 消费积分阈值 - Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); - // 返佣积分阈值 - Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); - if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ - return true; + // 获取通过消费积分达成会员等级的开关 + Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); + if (vipLevelUpShopRole == 1){ + // 消费积分阈值 + Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); + // 返佣积分阈值 + Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); + // 判断是否满足消费积分和返佣积分 + if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ + return true; + } } - // 直推钻石用户数阈值 - Integer vipDirectNum = vipSetting.getVipDirectNum(); - // 获取用户直推钻石用户数量 - long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>() - .eq(AppUser::getInviteUserId, userId) - .eq(AppUser::getVipId, 3)); + + Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); + if (vipLevelUpNumRole == 1){ + // 直推钻石用户数阈值 + Integer vipDirectNum = vipSetting.getVipDirectNum(); + // 获取用户直推钻石用户数量 + long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getInviteUserId, userId) + .eq(AppUser::getVipId, 3)); + // 判断是否满足直推钻石用户数量 + if (userDiamondsCount >= vipDirectNum){ + return true; + } + } + // 获取指定购买商品 + R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(4); + if (R.isSuccess(vipGoodsByVipId)){ + List<VipGood> vipGoods = vipGoodsByVipId.getData(); + if (CollectionUtil.isNotEmpty(vipGoods)){ + for (VipGood vipGood : vipGoods) { + String goodJson = vipGood.getGoodJson(); + Goods goods = JSONObject.parseObject(goodJson, Goods.class); + R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); + if (R.isSuccess(orderListByUserIdAndGoodsId)){ + List<Order> orderList = orderListByUserIdAndGoodsId.getData(); + if (CollectionUtil.isEmpty(orderList)){ + return false; + } + } + } + return true; + } + } + return false; } @Override public Boolean checkReadyToBeAgent(Long userId) { + AppUser appUser = appUserService.getById(userId); + // 消费积分 + Integer shopPoint = appUser.getShopPoint(); + // 返佣积分 + Integer sharePoint = appUser.getSharePoint(); + // 代理会员设置 + VipSetting vipSetting = vipSettingService.getVipSettingById(5); + // 获取通过消费积分达成会员等级的开关 + Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); + if (vipLevelUpShopRole == 1){ + // 消费积分阈值 + Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); + // 返佣积分阈值 + Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); + // 判断是否满足消费积分和返佣积分 + if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ + return true; + } + } + + Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); + if (vipLevelUpNumRole == 1){ + // 直推钻石用户数阈值 + Integer vipDirectNum = vipSetting.getVipDirectNum(); + // 获取用户直推钻石用户数量 + long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getInviteUserId, userId) + .eq(AppUser::getVipId, 3)); + // 判断是否满足直推钻石用户数量 + if (userDiamondsCount >= vipDirectNum){ + return true; + } + } + + R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5); + if (R.isSuccess(vipGoodsByVipId)){ + List<VipGood> vipGoods = vipGoodsByVipId.getData(); + if (CollectionUtil.isNotEmpty(vipGoods)){ + for (VipGood vipGood : vipGoods) { + String goodJson = vipGood.getGoodJson(); + Goods goods = JSONObject.parseObject(goodJson, Goods.class); + R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); + if (R.isSuccess(orderListByUserIdAndGoodsId)){ + List<Order> orderList = orderListByUserIdAndGoodsId.getData(); + if (CollectionUtil.isEmpty(orderList)){ + return false; + } + } + } + return true; + } + } + return false; } @Override public Boolean checkReadyToBeTotalAgent(Long userId) { + AppUser appUser = appUserService.getById(userId); + // 获取总代会员设置 + VipSetting vipSetting = vipSettingService.getVipSettingById(6); + // 获取会员等级是否必须达到代理 + Integer vipLevelUpProxyRole = vipSetting.getVipLevelUpProxyRole(); + if (vipLevelUpProxyRole == 1 && appUser.getVipId() == 5){ + return true; + } + + // 消费积分 + Integer shopPoint = appUser.getShopPoint(); + // 返佣积分 + Integer sharePoint = appUser.getSharePoint(); + // 获取通过消费积分达成会员等级的开关 + Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); + if (vipLevelUpShopRole == 1){ + // 消费积分阈值 + Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); + // 返佣积分阈值 + Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); + // 判断是否满足消费积分和返佣积分 + if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ + return true; + } + } + + Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); + if (vipLevelUpNumRole == 1){ + // 直推代理用户数阈值 + Integer vipDirectNum = vipSetting.getVipDirectNum(); + // 准代理用户数阈值 + Integer vipDirectVipNum = vipSetting.getVipDirectVipNum(); + // 获取用户直推代理用户数量 + List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getInviteUserId, userId) + .eq(AppUser::getVipId, 5)); + + // 代理下的准代理数量 + List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList()); + long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>() + .in(AppUser::getInviteUserId, userQuasiAgent) + .eq(AppUser::getVipId, 4)); + + // 判断是否满足直推代理用户数量和准代理数量 + if (userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum){ + return true; + } + } + // 获取指定购买商品 + R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5); + if (R.isSuccess(vipGoodsByVipId)){ + List<VipGood> vipGoods = vipGoodsByVipId.getData(); + if (CollectionUtil.isNotEmpty(vipGoods)){ + for (VipGood vipGood : vipGoods) { + String goodJson = vipGood.getGoodJson(); + Goods goods = JSONObject.parseObject(goodJson, Goods.class); + R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); + if (R.isSuccess(orderListByUserIdAndGoodsId)){ + List<Order> orderList = orderListByUserIdAndGoodsId.getData(); + if (CollectionUtil.isEmpty(orderList)){ + return false; + } + } + } + return true; + } + } + return false; } @Override public Boolean checkReadyToBePartner(Long userId) { + AppUser appUser = appUserService.getById(userId); + // 消费积分 + Integer shopPoint = appUser.getShopPoint(); + // 返佣积分 + Integer sharePoint = appUser.getSharePoint(); + // 合伙人会员设置 + VipSetting vipSetting = vipSettingService.getVipSettingById(7); + // 获取通过消费积分达成会员等级的开关 + Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole(); + if (vipLevelUpShopRole == 1){ + // 消费积分阈值 + Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); + // 返佣积分阈值 + Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); + // 判断是否满足消费积分和返佣积分 + if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ + return true; + } + + Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole(); + if (vipLevelUpNumRole == 1){ + // 直推代理用户数阈值 + Integer vipDirectNum = vipSetting.getVipDirectNum(); + // 准代理用户数阈值 + Integer vipDirectVipNum = vipSetting.getVipDirectVipNum(); + // 总代用户数阈值 + Integer vipTeamVipNum = vipSetting.getVipTeamVipNum(); + // 获取开店数量阈值 + Integer vipOpenShopNum = vipSetting.getVipOpenShopNum(); + + // 获取直推用户有超过指定门店数量的用户 + List<Long> userShopList = appUserService.list(new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getInviteUserId, userId)) + .stream().map(AppUser::getId).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(userShopList)){ + R<List<Shop>> r = shopClient.getShopByUserIds(userShopList); + List<Shop> shopList = r.getData(); + if (CollectionUtil.isNotEmpty(shopList)){ + Map<Long, List<Shop>> shopUserMap = shopList.stream().collect(Collectors.groupingBy(Shop::getAppUserId)); + + // 查找 list 长度大于 3 的 key + Set<Long> shopUserIdSet = shopUserMap.entrySet().stream() + .filter(entry -> entry.getValue().size() >= vipOpenShopNum) + .map(Map.Entry::getKey) + .collect(Collectors.toSet()); + + // 获取用户直推总代理数量 + List<AppUser> userTotalAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() + .in(AppUser::getInviteUserId, shopUserIdSet) + .eq(AppUser::getVipId, 6)); + + // 获取用户直推代理用户数量 + List<AppUser> userAgentList = appUserService.list(new LambdaQueryWrapper<AppUser>() + .in(AppUser::getInviteUserId, shopUserIdSet) + .eq(AppUser::getVipId, 5)); + + // 代理下的准代理数量 + List<Long> userQuasiAgent = userAgentList.stream().map(AppUser::getId).collect(Collectors.toList()); + long userQuasiAgentCount = appUserService.count(new LambdaQueryWrapper<AppUser>() + .in(AppUser::getInviteUserId, userQuasiAgent) + .eq(AppUser::getVipId, 4)); + + // 判断是否满足直推代理用户数量和准代理数量 + return userTotalAgentList.size() >= vipTeamVipNum && userAgentList.size() >= vipDirectNum && + userQuasiAgentCount >= vipDirectVipNum; + + } + + } + } + } return false; } + + @Override + public Boolean check(Integer type) { + LoginUser loginUser = tokenService.getLoginUser(); + Long userid = loginUser.getUserid(); + if (type == 4){ + return checkReadyToBeProxy(userid, type); + }else if (type == 5){ + return checkReadyToBeAgent(userid); + }else if (type == 6){ + return checkReadyToBeTotalAgent(userid); + }else if (type == 7){ + return checkReadyToBePartner(userid); + }else { + throw new ServiceException("参数错误"); + } + } } 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 f295ec5..f896d40 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 @@ -166,6 +166,18 @@ } + /** + * 预约技师 + */ + @PostMapping("/subscribe") + public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId){ + Order order = orderService.getById(id); + order.setTechnicianId(technicianId); + orderService.updateById(order); + return R.ok(); + } + + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java index a4d0f97..e8de328 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java @@ -88,7 +88,7 @@ @ResponseBody @PostMapping("/shoppingCartPayment") @ApiOperation(value = "购物车订单支付", tags = {"商城-购物车-小程序"}) - public R<Void> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ + public R<String> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ return shoppingCartService.shoppingCartPayment(shoppingCartPayment); } 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 70e238b..022167c 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 @@ -22,7 +22,6 @@ import com.ruoyi.order.vo.OrderGoodsVO; import com.ruoyi.order.vo.OrderVO; 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; @@ -128,9 +127,15 @@ orderDetailVO.setDistributionMode(goods.getDistributionMode()); } + Technician technician = new Technician(); + if (order.getTechnicianId() != null){ + R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId()); + if (shopdetail.getCode() != R.SUCCESS){ + throw new ServiceException("获取技师信息失败"); + } + technician = shopdetail.getData(); + } Shop shop = shopR.getData(); - - orderDetailVO.setId(order.getId()); orderDetailVO.setOrderStatus(order.getOrderStatus()); orderDetailVO.setPoint(order.getPoint()); @@ -153,6 +158,7 @@ orderDetailVO.setLongitude(shop.getLongitude()); orderDetailVO.setLatitude(shop.getLatitude()); orderDetailVO.setShopId(shop.getId()); + orderDetailVO.setTechnicianName(technician.getName()); return orderDetailVO; } 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 b7ffd3c..df2511b 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 @@ -1055,7 +1055,7 @@ this.removeBatchByIds(ids); } } - return R.ok(); + return R.ok(order.getId().toString()); } 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 1aa28d5..f5d19af 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 @@ -31,6 +31,9 @@ @Resource private GoodsService goodsService; + + + /** * 商品列表 */ 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 a7e2962..64c2bd0 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 @@ -5,9 +5,13 @@ import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.domain.GoodsEvaluate; import com.ruoyi.other.service.GoodsEvaluateService; +import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.vo.GoodsEvaluateVO; +import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -15,6 +19,7 @@ import javax.annotation.Resource; import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -32,6 +37,10 @@ private GoodsEvaluateService goodsEvaluateService; @Resource private AppUserClient appUserClient; + @Resource + private GoodsService goodsService; + @Resource + private TokenService tokenService; @GetMapping("/goodsList") @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"}) @@ -41,6 +50,7 @@ AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); goodsEvaluate.setUserName(appUserById.getName()); goodsEvaluate.setAvatar(appUserById.getAvatar()); + goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); } return R.ok(list); } @@ -61,9 +71,16 @@ @GetMapping("/detail/{orderId}") @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"}) public R<List<GoodsEvaluate>> detail(@PathVariable("orderId") Long orderId){ + LoginUser loginUserApplet = tokenService.getLoginUserApplet(); List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>() .eq(GoodsEvaluate::getStatus, 2) + .eq(GoodsEvaluate::getAppUserId,loginUserApplet.getUserid()) .eq(GoodsEvaluate::getOrderId, orderId)); + for (GoodsEvaluate goodsEvaluate : list) { + Goods goods = goodsService.getById(goodsEvaluate.getGoodsId()); + goodsEvaluate.setGoodsName(goods.getName()); + goodsEvaluate.setGoodsImg(goods.getHomePagePicture()); + } return R.ok(list); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java index 913d2b3..8f00eca 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java @@ -6,10 +6,12 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.other.api.domain.Share; import com.ruoyi.other.enums.ShareAddType; import com.ruoyi.other.enums.ShareAuditStatus; import com.ruoyi.other.service.ShareService; +import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -113,7 +115,8 @@ @ApiOperation(value = "添加", tags = {"后台-分享管理"}) @PostMapping("/manage/add") public R<Void> manage(@RequestBody Share share){ - Long userid = tokenService.getLoginUser().getUserid(); + LoginUser loginUser = SecurityUtils.getLoginUser(); + Long userid = loginUser.getSysUser().getUserId(); share.setAddType(1); share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); share.setObjectId(userid.toString()); @@ -141,7 +144,7 @@ @ApiOperation(value = "列表", tags = {"后台-分享管理"}) @GetMapping("/manage/list") public R<Page<Share>> managelist(String name,Integer addType,@RequestParam Integer PageNum,Integer pageSize){ - Page<Share> page = shareService.lambdaQuery().like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageSize, pageSize)); + Page<Share> page = shareService.lambdaQuery().like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(PageNum, pageSize)); return R.ok(page); } 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 41c12e5..39cf8ce 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 @@ -6,12 +6,10 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.domain.ShopScore; -import com.ruoyi.other.api.domain.Technician; import com.ruoyi.other.enums.ShopStatus; import com.ruoyi.other.service.ShopScoreService; import com.ruoyi.other.service.ShopService; @@ -52,6 +50,7 @@ private ShopScoreService shopScoreService; @Resource private TokenService tokenService; + @PostMapping("/getDetailById") @@ -152,5 +151,12 @@ Shop one = shopService.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getPhone, phone).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); return R.ok(one); } + + @PostMapping("/getShopByUserIds") + public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds){ + List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getAppUserId, userIds)); + return R.ok(list); + } + } 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 f35126a..17f892f 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 @@ -6,6 +6,7 @@ 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.domain.Technician; import com.ruoyi.other.api.domain.TechnicianScore; import com.ruoyi.other.service.TechnicianScoreService; import com.ruoyi.other.service.TechnicianService; @@ -99,9 +100,16 @@ */ @GetMapping("/technicianListByShopId") @ApiOperation(value = "技师列表", tags = {"技师列表-小程序"}) - public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId) { + public R<TableDataInfo<TechnicianVO>> technicianListByShopId(@ApiParam("门店id") @RequestParam Long shopId,@ApiParam("技师姓名") String name) { startPage(); - return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId))); + return R.ok(getDataTable(technicianService.getTechnicianListByShopId(shopId,name))); + } + + @GetMapping("/getById") + @ApiOperation(value = "技师详情", tags = {"技师详情-小程序"}) + public R<Technician> getById(@RequestParam("id") Integer id){ + Technician byId = technicianService.getById(id); + return R.ok(byId); } /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java index fabe13d..44975f1 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java @@ -52,7 +52,7 @@ @PostMapping("/subscribe") @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表-预约技师"}) public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) { - technicianSubscribeService.subscribe(technicianSubscribe, technicianSubscribe.getTechnicianId()); + technicianSubscribeService.subscribe(technicianSubscribe); return R.ok(); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java index c3b24f7..1ca3e83 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianMapper.java @@ -17,7 +17,7 @@ */ public interface TechnicianMapper extends BaseMapper<Technician> { - List<TechnicianVO> selectTechnicianListByShopId(Long shopId); + List<TechnicianVO> selectTechnicianListByShopId(Long shopId, String name); TechnicianDetailVO selectTechnicianDetail(Long technicianId); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java index 7784358..4500e50 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java @@ -21,4 +21,5 @@ List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude); ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude); + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java index 7be2cbc..9e245e6 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianService.java @@ -16,7 +16,7 @@ * @since 2024-11-20 */ public interface TechnicianService extends IService<Technician> { - List<TechnicianVO> getTechnicianListByShopId(Long shopId); + List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name); TechnicianDetailVO technicianDetail(Long technicianId); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java index 73e8cfc..af7e292 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java @@ -25,5 +25,5 @@ IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status); - void subscribe(TechnicianSubscribe technicianSubscribe, Long technicianId); + void subscribe(TechnicianSubscribe technicianSubscribe); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java index 943bb2c..1d047e0 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java @@ -3,12 +3,15 @@ import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.model.Order; import com.ruoyi.other.mapper.GoodsEvaluateMapper; import com.ruoyi.other.api.domain.GoodsEvaluate; import com.ruoyi.other.service.GoodsEvaluateService; import com.ruoyi.other.vo.GoodsEvaluateVO; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,15 +30,24 @@ public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService { @Resource private RemoteOrderGoodsClient remoteOrderGoodsClient; + @Resource + private TokenService tokenService; @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) { List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates(); for (GoodsEvaluate goodsEvaluate : evaluates) { goodsEvaluate.setStatus(2); + if (StringUtils.isNotEmpty(goodsEvaluate.getIdStr())){ + goodsEvaluate.setId(Long.valueOf(goodsEvaluate.getIdStr())); + updateById(goodsEvaluate); + }else { + LoginUser loginUserApplet = tokenService.getLoginUserApplet(); + goodsEvaluate.setAppUserId(loginUserApplet.getUserid()); + save(goodsEvaluate); + } } - this.saveBatch(evaluates); if (CollectionUtil.isNotEmpty(evaluates)){ Order order = new Order(); order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId()); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java index 26d1b4a..049adcb 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianServiceImpl.java @@ -39,8 +39,8 @@ private TechnicianScoreService technicianScoreService; @Override - public List<TechnicianVO> getTechnicianListByShopId(Long shopId) { - return technicianMapper.selectTechnicianListByShopId(shopId); + public List<TechnicianVO> getTechnicianListByShopId(Long shopId, String name) { + return technicianMapper.selectTechnicianListByShopId(shopId,name); } @Override diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java index 4acbbe7..10f951e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java @@ -3,10 +3,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.enums.TechnicianStatus; -import com.ruoyi.other.mapper.TechnicianMapper; import com.ruoyi.other.mapper.TechnicianSubscribeMapper; import com.ruoyi.other.service.TechnicianSubscribeService; import com.ruoyi.other.vo.TechnicianSubscribeVO; @@ -29,7 +30,7 @@ @Resource private TechnicianSubscribeMapper technicianSubscribeMapper; @Resource - private TechnicianMapper technicianMapper; + private RemoteOrderGoodsClient orderGoodsClient; @Override public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) { @@ -41,22 +42,21 @@ } @Override -// @DistributedLock(lockNamePre = "#technician_subscribe_lock", lockNamePost = "#technicianId") - public void subscribe(TechnicianSubscribe subscribe, Long technicianId) { -// Long count = technicianSubscribeMapper.selectCount(new LambdaQueryWrapper<TechnicianSubscribe>() -// .eq(TechnicianSubscribe::getTechnicianId, technicianId) -// .eq(TechnicianSubscribe::getSubscribeTime, subscribe.getSubscribeTime()) -// .eq(TechnicianSubscribe::getStatus, TechnicianStatus.UNSUBSCRIBE.getCode())); -// if (count > 0) { -// throw new ServiceException("当前时间段已被预约", TechnicianErrorCode.TECHNICIAN_ALREADY_SUBSCRIBED.getCode()); -// } - // 创建技师预约单 - Long userId = SecurityUtils.getUserId(); - subscribe.setAppUserId(userId); - subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode()); - subscribe.setDelFlag(0); - subscribe.setCreateTime(LocalDateTime.now()); - technicianSubscribeMapper.insert(subscribe); + public void subscribe(TechnicianSubscribe subscribe) { + if (StringUtils.isNotEmpty(subscribe.getIdStr())){ + subscribe.setId(Long.parseLong(subscribe.getIdStr())); + technicianSubscribeMapper.updateById(subscribe); + }else { + Long userId = SecurityUtils.getUserId(); + subscribe.setAppUserId(userId); + subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode()); + subscribe.setDelFlag(0); + subscribe.setCreateTime(LocalDateTime.now()); + technicianSubscribeMapper.insert(subscribe); + } + if (subscribe.getTechnicianId() != null){ + orderGoodsClient.subscribe(subscribe.getOrderId(), Math.toIntExact(subscribe.getId())); + } } } 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 e63668b..8ac6d57 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 @@ -17,6 +17,9 @@ tt.`status` = 2 AND tt.del_flag = 0 AND tt.shop_id = #{shopId} + <if test="name != null and name != ''"> + AND tt.`name` LIKE concat('%', #{name}, '%') + </if> GROUP BY tt.id, tt.`name`, -- Gitblit v1.7.1