luodangjia
2024-12-12 ff811ae8df41273d7ab0011b6b7f1f278f03bbd2
Merge remote-tracking branch 'origin/master'

# Conflicts:
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java
11 文件已重命名
87个文件已修改
9个文件已添加
2497 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserChangeLogFallbackFactory.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserChangeLogClient.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AgentApplication.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserSignRecord.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrderVo.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/EndOfChargePageInfo.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ReplyEvaluationVO.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsAppUser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsBargainPrice.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsBargainPriceDetail.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsShop.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/OrderActivityInfo.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/PointSetting.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/LogisticsSetDto.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipSettingClientFallbackFactory.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsVipClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipGoodClient.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipSettingClient.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-job/pom.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/TechnicianSubscribe.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserChangeLogController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/SignBackRDto.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/UserPointMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AgentApplicationService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AgentApplicationServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 244 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/EnvVersion.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/CommissionController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 300 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/AgreementController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java 217 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/PhoneController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 112 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/TechnicianStatus.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -6,6 +6,7 @@
import com.ruoyi.common.core.domain.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@@ -41,6 +42,7 @@
                throw new RuntimeException("获取优惠券数量失败");
            }
            @GetMapping("/appUserShop/shop/{userId}")
            @Override
            public R<List<AppUserShop>> getAppUserShop(Long userId) {
                log.error("获取用户门店信息失败:{}", cause.getMessage());
@@ -70,7 +72,15 @@
                throw new RuntimeException("获取直推会员数失败");
            }
            @Override
            public R<Void> addAppUserShop(AppUserShop appUserShop) {
                return R.fail("添加失败");
            }
            @Override
            public R<AppUser> getAppUserByPhone(String phone) {
                return R.fail("通过手机号查询用户失败");
            }
        };
    }
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserChangeLogFallbackFactory.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.account.api.factory;
import com.ruoyi.account.api.feignClient.UserChangeLogClient;
import com.ruoyi.account.api.model.UserChangeLog;
import com.ruoyi.common.core.domain.R;
import org.springframework.cloud.openfeign.FallbackFactory;
/**
 * @author zhibing.pu
 * @Date 2024/12/10 15:01
 */
public class UserChangeLogFallbackFactory implements FallbackFactory<UserChangeLogClient> {
    @Override
    public UserChangeLogClient create(Throwable cause) {
        return new UserChangeLogClient(){
            @Override
            public R saveUserChangeLog(UserChangeLog userChangeLog) {
                return R.fail("保存会员等级变更记录失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -40,6 +40,9 @@
    @GetMapping("/appUserShop/shop/{userId}")
    R<List<AppUserShop>> getAppUserShop(@PathVariable("userId") Long userId);
    @PostMapping("/appUserShop/addAppUserShop")
    R<Void> addAppUserShop(@RequestBody AppUserShop appUserShop);
    /**
     * 根据用户id获取用户的祖籍列表
     */
@@ -54,4 +57,8 @@
    @PostMapping("/app-user/getVipCount")
    R<Long> getVipCount(@RequestParam("userId")Long userId, @RequestParam("vipId") Integer vipId );
    @GetMapping("/getAppUserByPhone")
    public R<AppUser> getAppUserByPhone(@RequestParam("phone") String phone);
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserChangeLogClient.java
New file
@@ -0,0 +1,26 @@
package com.ruoyi.account.api.feignClient;
import com.ruoyi.account.api.factory.UserChangeLogFallbackFactory;
import com.ruoyi.account.api.model.UserChangeLog;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
 * @author zhibing.pu
 * @Date 2024/12/10 15:01
 */
@FeignClient(contextId = "UserChangeLogClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = UserChangeLogFallbackFactory.class)
public interface UserChangeLogClient {
    /**
     * 保存会员等级变更记录
     * @param userChangeLog
     * @return
     */
    @PostMapping("/user-change-log/saveUserChangeLog")
    R saveUserChangeLog(@RequestBody UserChangeLog userChangeLog);
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AgentApplication.java
@@ -50,11 +50,11 @@
    @ApiModelProperty(value = "用户当前消费积分")
    @TableField("shop_point")
    private BigDecimal shopPoint;
    private Integer shopPoint;
    @ApiModelProperty(value = "用户当前分佣积分")
    @TableField("share_point")
    private BigDecimal sharePoint;
    private Integer sharePoint;
    @ApiModelProperty(value = "直推用户已达钻石会员数")
    @TableField("direct_vip_num")
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
@@ -13,6 +13,7 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
 * <p>
@@ -167,6 +168,10 @@
    @TableField("lave_point")
    private Integer lavePoint;
    
    @ApiModelProperty(value = "总积分")
    @TableField("total_point")
    private Integer totalPoint;
    @ApiModelProperty(value = "是否可更换推广人(0=否,1=是)")
    @TableField("change_promoter")
    private Integer changePromoter;
@@ -238,6 +243,10 @@
    @TableField(exist = false)
    private Integer isSign;
    @ApiModelProperty("绑定门店id列表")
    @TableField(exist = false)
    private Set<Integer> shopIds;
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserSignRecord.java
@@ -45,9 +45,9 @@
    @TableField("red_amount")
    private BigDecimal redAmount;
    @ApiModelProperty(value = "红包金额")
    @ApiModelProperty(value = "积分")
    @TableField("point")
    private BigDecimal point;
    private Integer point;
    @ApiModelProperty(value = "删除(0=否,1=是)")
    @TableField("del_flag")
ruoyi-api/ruoyi-api-account/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -2,4 +2,5 @@
com.ruoyi.account.api.factory.UserAddressClientFallbackFactory
com.ruoyi.account.api.factory.UserCouponClientFallbackFactory
com.ruoyi.account.api.factory.UserPointFallbackFactory
com.ruoyi.account.api.factory.BalanceChangeRecordClientFallbackFactory
com.ruoyi.account.api.factory.BalanceChangeRecordClientFallbackFactory
com.ruoyi.account.api.factory.UserChangeLogFallbackFactory
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -2,12 +2,14 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.vo.Price;
import lombok.extern.slf4j.Slf4j;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.OrderGood;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
import java.util.Set;
@Slf4j
public class RemoteOrderGoodsFallbackFactory implements FallbackFactory<RemoteOrderGoodsClient> {
@@ -40,6 +42,16 @@
            public R<Void> subscribe(Long id, Integer technicianId) {
                return R.fail("预约失败");
            }
            @Override
            public R<Void> calculationCommission(Set<String> orderIds) {
                return R.fail("计算佣金失败");
            }
            @Override
            public R<Price> getGoodsPrice(Long appUserId, Integer goodsId, Integer shopId) {
                return R.fail("获取商品价格失败");
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -6,6 +6,7 @@
import com.ruoyi.order.factory.RemoteOrderGoodsFallbackFactory;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.order.vo.Price;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -13,6 +14,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Set;
@FeignClient(contextId = "RemoteOrderGoodsClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = RemoteOrderGoodsFallbackFactory.class)
public interface RemoteOrderGoodsClient {
@@ -46,4 +48,13 @@
     */
    @PostMapping("/order/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id" , required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId);
    /**
     * 预约技师
     */
    @PostMapping("/commission/calculationCommission")
    public R<Void> calculationCommission(@RequestBody Set<String> orderIds);
    @GetMapping("/shopping-cart/getGoodsPrice")
    public R<Price> getGoodsPrice(@RequestParam("appUserId") Long appUserId, @RequestParam("goodsId") Integer goodsId, @RequestParam("shopId") Integer shopId);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java
@@ -7,7 +7,6 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
@ApiModel(value = "ChargingOrderListInfoVO对象",description = "充电时段统计列表查看详情VO")
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrderVo.java
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ConfirmOrderVo.java
@@ -1,7 +1,6 @@
package com.ruoyi.order.vo;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.account.api.vo.CouponInfoVo;
import com.ruoyi.account.api.vo.PaymentUserCouponVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/EndOfChargePageInfo.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
@@ -83,4 +83,7 @@
    @ApiModelProperty(value = "技师名称")
    private String technicianName;
    @ApiModelProperty(value = "预约单id")
    private String technicianSubscribeId;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderVO.java
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java
@@ -1,11 +1,9 @@
package com.ruoyi.order.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class OrderVO {
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java
New file
@@ -0,0 +1,73 @@
package com.ruoyi.order.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class Price {
    /**
     * 现金
     */
    private BigDecimal cash;
    /**
     * 积分
     */
    private Integer point;
    /**
     * 获取结束时间
     */
    private Long endTime;
    /**
     * 现金支付
     */
    private Boolean cashPayment;
    /**
     * 积分支付
     */
    private Boolean pointPayment;
    /**
     * 可获得消费积分
     */
    private Integer earnSpendingPoints;
    /**
     * 上级获得分佣金额
     */
    private BigDecimal superiorSubcommission;
    /**
     * 上级获得返佣积分
     */
    private Integer superiorRebatePoints;
    /**
     * 获取返佣积分上级类型(1=直推上级,2=直帮上级)
     */
    private Integer superiorType;
    /**
     * 核销门店可获得服务费
     */
    private BigDecimal servuceShopCharges;
    /**
     * 核销门店可获得服务积分
     */
    private Integer servuceShopPoints;
    /**
     * 技师可获得服务积分
     */
    private Integer technicianPoints;
    /**
     * 绑定门店可获得分佣金额
     */
    private BigDecimal boundShopCharges;
    /**
     * 绑定门店可获得返佣积分
     */
    private Integer boundShopPoints;
    /**
     * 绑定门店上级门店可获得分佣金额
     */
    private BigDecimal boundShopSuperiorsCharges;
    /**
     * 绑定门店上级门店可获得返佣积分
     */
    private Integer boundShopSuperiorsPoints;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ReplyEvaluationVO.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java
@@ -9,6 +9,7 @@
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
 * <p>
@@ -122,5 +123,21 @@
    @TableField(exist = false)
    private Integer vipId;
    @TableField(exist = false)
    @ApiModelProperty(value = "指定门店")
    private List<GoodsShop> goodsShopList;
    @TableField(exist = false)
    @ApiModelProperty(value = "指定用户")
    private List<GoodsAppUser> goodsAppUserList;
    @TableField(exist = false)
    @ApiModelProperty(value = "会员价格")
    private List<GoodsVip> goodsVipList;
    @TableField(exist = false)
    @ApiModelProperty(value = "地区价格")
    private List<GoodsArea> goodsAreaList;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsAppUser.java
@@ -21,7 +21,7 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_app_user")
@ApiModel(value="GoodsAppUser对象", description="")
@ApiModel(value="指定用户对象", description="")
public class GoodsAppUser implements Serializable {
    private static final long serialVersionUID = 1L;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsArea.java
@@ -23,7 +23,7 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_area")
@ApiModel(value="GoodsArea对象", description="")
@ApiModel(value="商品地区价格对象", description="")
public class GoodsArea implements Serializable {
    private static final long serialVersionUID = 1L;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsBargainPrice.java
@@ -8,6 +8,7 @@
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
 * <p>
@@ -20,7 +21,7 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_bargain_price")
@ApiModel(value="GoodsBargainPrice对象", description="")
@ApiModel(value="门店特殊价格对象", description="")
public class GoodsBargainPrice implements Serializable {
    private static final long serialVersionUID = 1L;
@@ -35,7 +36,7 @@
    @ApiModelProperty(value = "门店id")
    @TableField("shop_id")
    private Integer shopId;
    private Integer  shopId;
    @ApiModelProperty(value = "审核状态(0=待审核,1=审核通过,2=审核失败)")
    @TableField("audit_status")
@@ -64,7 +65,29 @@
    @ApiModelProperty(value = "添加用户id")
    @TableField("create_user_id")
    private Integer createUserId;
    private Long createUserId;
    @TableField(exist = false)
    private List<GoodsBargainPriceDetail> goodsBargainPriceDetailList;
    @ApiModelProperty(value = "商品名称")
    @TableField(exist = false)
    private String goodsName;
    @ApiModelProperty(value = "所属分类")
    @TableField(exist = false)
    private String categoryName;
    @ApiModelProperty(value = "门店名称")
    @TableField(exist = false)
    private String shopName;
    @ApiModelProperty(value = "店长名称")
    @TableField(exist = false)
    private String ownerName;
    @ApiModelProperty(value = "店长手机号")
    @TableField(exist = false)
    private String ownerPhone;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsBargainPriceDetail.java
@@ -23,7 +23,7 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_bargain_price_detail")
@ApiModel(value="GoodsBargainPriceDetail对象", description="")
@ApiModel(value="门店特殊价格明细对象", description="")
public class GoodsBargainPriceDetail implements Serializable {
    private static final long serialVersionUID = 1L;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsEvaluate.java
@@ -75,9 +75,13 @@
    private String avatar;
    @ApiModelProperty(value = "名字")
    @ApiModelProperty(value = "评价用户")
    @TableField(exist = false)
    private String userName;
    @ApiModelProperty(value = "联系电话")
    @TableField(exist = false)
    private String phone;
    @ApiModelProperty(value = "商品名字")
    @TableField(exist = false)
@@ -92,6 +96,8 @@
    public void setId(Long id) {
        this.id = id;
        this.idStr = String.valueOf(id);
        if (id != null){
            this.idStr = String.valueOf(id);
        }
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsShop.java
@@ -21,7 +21,7 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_shop")
@ApiModel(value="GoodsShop对象", description="")
@ApiModel(value="指定门店对象", description="")
public class GoodsShop implements Serializable {
    private static final long serialVersionUID = 1L;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java
@@ -23,7 +23,7 @@
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_goods_vip")
@ApiModel(value="GoodsVip对象", description="")
@ApiModel(value="会员价格对象", description="")
public class GoodsVip implements Serializable {
    private static final long serialVersionUID = 1L;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/OrderActivityInfo.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -66,5 +67,12 @@
    @TableField("discount")
    private BigDecimal discount;
    @ApiModelProperty(value = "是否上架:0否 1是")
    @TableField("is_shelf")
    private Integer isShelf;
    @ApiModelProperty(value = "活动状态:0未开始,1已开始")
    @TableField(exist = false)
    private Integer status;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/PointSetting.java
@@ -7,7 +7,6 @@
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@@ -41,23 +40,23 @@
    @ApiModelProperty(value = "拉新人积分")
    @TableField("new_point")
    private BigDecimal newPoint;
    private Integer newPoint;
    @ApiModelProperty(value = "每日分享积分")
    @TableField("every_share_point")
    private BigDecimal everySharePoint;
    private Integer everySharePoint;
    @ApiModelProperty(value = "每日签到积分")
    @TableField("sign_point")
    private BigDecimal signPoint;
    private Integer signPoint;
    @ApiModelProperty(value = "使用一小时积分")
    @TableField("hour_point")
    private BigDecimal hourPoint;
    private Integer hourPoint;
    @ApiModelProperty(value = "注册积分")
    @TableField("regis_point")
    private BigDecimal regisPoint;
    private Integer regisPoint;
    @ApiModelProperty(value = "注册积分 1开0关")
    @TableField("regis_point_open")
@@ -69,7 +68,7 @@
    @ApiModelProperty(value = "消费积分")
    @TableField("buy_point")
    private BigDecimal buyPoint;
    private Integer buyPoint;
    @ApiModelProperty(value = "消费积分积分 1开0关")
    @TableField("buy_point_open")
@@ -81,7 +80,7 @@
    @ApiModelProperty(value = "返佣积分")
    @TableField("share_point")
    private BigDecimal sharePoint;
    private Integer sharePoint;
    @ApiModelProperty(value = "返佣积分 1开0关")
    @TableField("share_point_open")
@@ -93,7 +92,7 @@
    @ApiModelProperty(value = "门店返佣积分")
    @TableField("shop_share_point")
    private BigDecimal shopSharePoint;
    private Integer shopSharePoint;
    @ApiModelProperty(value = "门店返佣积分 1开0关")
    @TableField("shop_share_point_open")
@@ -117,7 +116,7 @@
    @ApiModelProperty(value = "技师业绩积分")
    @TableField("person_point")
    private BigDecimal personPoint;
    private Integer personPoint;
    @ApiModelProperty(value = "技师业绩积分 1开0关")
    @TableField("person_point_open")
@@ -141,7 +140,7 @@
    @ApiModelProperty(value = "注册积分")
    @TableField("get_regis_point")
    private BigDecimal getRegisPoint;
    private Integer getRegisPoint;
    @ApiModelProperty(value = "注册积分 1开0关")
    @TableField("get_regis_point_open")
@@ -153,7 +152,7 @@
    @ApiModelProperty(value = "做工积分")
    @TableField("work_point")
    private BigDecimal workPoint;
    private Integer workPoint;
    @ApiModelProperty(value = "做工积分 1开0关")
    @TableField("work_point_open")
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -96,27 +96,27 @@
    @ApiModelProperty(value = "门店积分总数")
    @TableField("shop_all_point")
    private BigDecimal shopAllPoint;
    private Integer shopAllPoint;
    @ApiModelProperty(value = "门店业绩积分")
    @TableField("shop_point")
    private BigDecimal shopPoint;
    private Integer shopPoint;
    @ApiModelProperty(value = "门店返佣积分")
    @TableField("share_point")
    private BigDecimal sharePoint;
    private Integer sharePoint;
    @ApiModelProperty(value = "门店服务积分")
    @TableField("server_point")
    private BigDecimal serverPoint;
    private Integer serverPoint;
    @ApiModelProperty(value = "下级门店返佣积分")
    @TableField("lower_level_rebate_points")
    private BigDecimal lowerLevelRebatePoints;
    private Integer lowerLevelRebatePoints;
    @ApiModelProperty(value = "门店已用积分")
    @TableField("use_point")
    private BigDecimal usePoint;
    private Integer usePoint;
    @ApiModelProperty(value = "门店分佣总金额")
    @TableField("giveaway_all_money")
@@ -163,5 +163,9 @@
    @TableField("create_time")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "店长姓名")
    @TableField(exist = false)
    private String managerName;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -55,7 +55,7 @@
    @TableField("user_address")
    private String userAddress;
    @ApiModelProperty(value = "状态(0=待服务,1=已服务,2=已取消)")
    @ApiModelProperty(value = "状态(0=待服务,1=已服务,2=已取消, 3=已到期)")
    @TableField("status")
    private Integer status;
@@ -68,13 +68,10 @@
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "订单id")
    private Long orderId;
    @TableField(exist = false)
    private String idStr;
    @TableField(exist = false)
    private Long orderId;
    public void setId(Long id) {
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/LogisticsSetDto.java
New file
@@ -0,0 +1,39 @@
package com.ruoyi.other.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "物流设置")
public class LogisticsSetDto {
    /**
     * 物流查询时间间隔
     */
    @ApiModelProperty(value = "物流查询时间间隔")
    private Integer waitTime;
    /**
     * 订单运费
     */
    @ApiModelProperty(value = "订单运费")
    private Integer freight;
    /**
     * 包邮订单金额
     */
    @ApiModelProperty(value = "包邮订单金额")
    private Integer freeFreight;
    /**
     * 包邮订单积分
     */
    @ApiModelProperty(value = "包邮订单积分")
    private Integer freeIntegral;
    /**
     * 包邮会员等级要求:1普通会员,2黄金会员,3钻石会员,4准代理,5代理,6总代,7合伙人
     */
    @ApiModelProperty(value = "包邮会员等级要求:1普通会员,2黄金会员,3钻石会员,4准代理,5代理,6总代,7合伙人")
    private Integer freeVip;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -7,6 +7,7 @@
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
import java.util.Set;
@Slf4j
public class ShopClientFallbackFactory implements FallbackFactory<ShopClient> {
@@ -27,6 +28,11 @@
            public R<List<Shop>> getShopByUserIds(List<Long> userIds) {
                return R.fail("根据用户id集合获取门店数据失败");
            }
            @Override
            public R<Set<Integer>> getShopIdByName(String shopName) {
                return R.fail("根据门店名称获取门店id失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java
@@ -19,11 +19,6 @@
            public R<Void> updateStatus(Integer status, Long subscribeId) {
                return R.fail("跟新技师预约状态失败:" + cause.getMessage());
            }
            @Override
            public R<TechnicianSubscribe> getSubscribeByOrderId(Long orderId) {
                return R.fail("根据订单id获取预约信息失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipSettingClientFallbackFactory.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.other.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.VipSettingClient;
import org.springframework.cloud.openfeign.FallbackFactory;
/**
 * @author zhibing.pu
 * @Date 2024/12/10 13:53
 */
public class VipSettingClientFallbackFactory implements FallbackFactory<VipSettingClient> {
    @Override
    public VipSettingClient create(Throwable cause) {
        return new VipSettingClient(){
            @Override
            public R<VipSetting> getVipSetting(Integer id) {
                return R.fail("查询会员配置失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsVipClient.java
@@ -17,7 +17,7 @@
    
    
    /**
     * 获取会员价格配置
     * 取获会员价格配置
     * @param vip
     * @return
     */
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -6,11 +6,13 @@
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.GetMapping;
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;
import java.util.Set;
/**
 * @author zhibing.pu
@@ -39,4 +41,7 @@
    @PostMapping("/getShopByUserIds")
    public R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds);
    @GetMapping("/getShopIdByName")
    R<Set<Integer>> getShopIdByName(String shopName);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
@@ -18,7 +18,4 @@
    @PutMapping("/technician-subscribe/updateStatus")
    R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Long subscribeId);
    @GetMapping("/technician-subscribe/getSubscribeByOrderId")
    R<TechnicianSubscribe> getSubscribeByOrderId(@RequestParam("orderId") Long orderId);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipGoodClient.java
@@ -15,8 +15,8 @@
public interface VipGoodClient {
    @GetMapping("/vip-good/getVipGoodsByVipId")
    public R<List<VipGood>> getVipGoodsByVipId(@RequestParam("subscribeId") Integer vipId);
    R<List<VipGood>> getVipGoodsByVipId(@RequestParam("vipId") Integer vipId);
    @GetMapping("/vip-setting/getVipSettingById")
    public R<VipSetting> getVipSettingById(@RequestParam("id") Integer id);
    R<VipSetting> getVipSettingById(@RequestParam("id") Integer id);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipSettingClient.java
New file
@@ -0,0 +1,26 @@
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.VipSetting;
import com.ruoyi.other.api.factory.VipSettingClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author zhibing.pu
 * @Date 2024/12/10 13:52
 */
@FeignClient(contextId = "VipSettingClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = VipSettingClientFallbackFactory.class)
public interface VipSettingClient {
    /**
     * 查询会员配置
     * @param id
     * @return
     */
    @PostMapping("/vip-setting/getVipSetting")
    R<VipSetting> getVipSetting(@RequestParam("id") Integer id);
}
ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -14,4 +14,5 @@
com.ruoyi.other.api.factory.CouponClientFallbackFactory
com.ruoyi.other.api.factory.TechnicianClientFallbackFactory
com.ruoyi.other.api.factory.PointSettingClientFallbackFactory
com.ruoyi.other.api.factory.VipGoodClientFallbackFactory
com.ruoyi.other.api.factory.VipGoodClientFallbackFactory
com.ruoyi.other.api.factory.VipSettingClientFallbackFactory
ruoyi-modules/ruoyi-job/pom.xml
@@ -19,10 +19,16 @@
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-modules-order</artifactId>
            <version>3.6.2</version>
            <artifactId>ruoyi-api-account</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-api-other</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-api-order</artifactId>
        </dependency>
        <!-- SpringCloud Alibaba Nacos -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/AfterSalesTask.java
@@ -1,6 +1,7 @@
package com.ruoyi.job.task;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import lombok.extern.log4j.Log4j2;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@@ -8,13 +9,13 @@
import javax.annotation.Resource;
import java.util.Set;
@Component("ryTask")
@Component("afterSalesTask")
@Log4j2
public class AfterSalesTask {
    @Resource
    private RedisTemplate<String, String> redisTemplate;
    @Resource
    private CommissionService commissionService;
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    /**
     * 计算佣金(设置每分钟执行一次)
@@ -25,7 +26,10 @@
        // 从延迟队列中获取需要处理的订单
        Set<String> orderIds = redisTemplate.opsForZSet().rangeByScore("delay_queue:commission", 0, now);
        if (orderIds != null && !orderIds.isEmpty()) {
            commissionService.calculationCommission(orderIds);
            R<Void> r = remoteOrderGoodsClient.calculationCommission(orderIds);
            if (R.isError(r)) {
                log.error("计算佣金失败,订单号:{},错误信息:{}", orderIds, r.getMsg());
            }
            // 处理完后移除已处理的订单
            redisTemplate.opsForZSet().removeRangeByScore("delay_queue:commission", 0, now);
        }
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/TechnicianSubscribe.java
New file
@@ -0,0 +1,29 @@
package com.ruoyi.job.task;
import com.ruoyi.other.api.feignClient.TechnicianClient;
import lombok.extern.log4j.Log4j2;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Set;
@Component("technicianSubscribe")
@Log4j2
public class TechnicianSubscribe {
    @Resource
    private TechnicianClient technicianClient;
    @Resource
    private RedisTemplate<String, String> redisTemplate;
    public void updateStatus() {
        long now = System.currentTimeMillis() / 1000; // 获取当前时间戳(秒)
        Set<String> subscribeIds = redisTemplate.opsForZSet().rangeByScore("delay_queue:subscribe", 0, now);
        if (!CollectionUtils.isEmpty(subscribeIds)) {
            subscribeIds.forEach(subscribeId -> {
                technicianClient.updateStatus(3, Long.valueOf(subscribeId));
            });
        }
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -1,8 +1,18 @@
package com.ruoyi.account.controller;
import com.ruoyi.account.api.model.AgentApplication;
import com.ruoyi.account.service.AgentApplicationService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.other.api.domain.VipSetting;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * <p>
@@ -14,7 +24,16 @@
 */
@RestController
@RequestMapping("/agent-application")
public class AgentApplicationController {
public class AgentApplicationController extends BaseController {
    @Resource
    private AgentApplicationService agentApplicationService;
    @PostMapping("/apply")
    @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"})
    public R<Void> apply(@RequestBody AgentApplication agentApplication) {
        agentApplicationService.apply(agentApplication);
        return R.ok();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserCancellationLog;
import com.ruoyi.account.api.model.UserCoupon;
@@ -64,10 +65,6 @@
    public R<LoginVo> mobileLogin(@RequestBody MobileLogin mobileLogin){
        return appUserService.mobileLogin(mobileLogin);
    }
    @ResponseBody
@@ -170,12 +167,7 @@
        Long userId = tokenService.getLoginUserApplet().getUserid();
        AppUser user = appUserService.getById(userId);
        List<UserSignRecord> list = userSignRecordService.lambdaQuery().eq(UserSignRecord::getSignDay, LocalDate.now()).list();
        if (!list.isEmpty()){
            user.setIsSign(1);
        }else {
            user.setIsSign(0);
        }
        return R.ok(user);
    }
@@ -296,6 +288,13 @@
        user.setCount5(count5);
        user.setCount6(count6);
        user.setCount7(count7);
        List<UserSignRecord> list = userSignRecordService.lambdaQuery().eq(UserSignRecord::getSignDay, LocalDate.now()).list();
        if (!list.isEmpty()){
            user.setIsSign(1);
        }else {
            user.setIsSign(0);
        }
        return R.ok(user);
@@ -331,6 +330,36 @@
        AppUser superiorLeader = appUserService.getSuperiorLeader(id);
        return R.ok(superiorLeader);
    }
    @ResponseBody
    @PostMapping("/onlineRecord")
    @ApiOperation(value = "10分钟定时任务调用,记录用户在线时长", tags = {"小程序-个人中心首页"})
    public R onlineRecord(){
        appUserService.onlineRecord();
        return R.ok();
    }
    /**
     * 获取用户列表
     */
    @GetMapping("/getAppuserPage")
    @ApiOperation(value = "用户列表", tags = {"管理后台"})
    public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum,
                                  @ApiParam("每一页数据大小") Integer pageSize,
                                  AppUser appUser)
    {
        IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser);
        return R.ok(appuserPage);
    }
    @GetMapping("/getAppUserByPhone")
    public R<AppUser> getAppUserByPhone(String phone){
        AppUser appUser = appUserService.lambdaQuery().eq(AppUser::getPhone, phone).one();
        return R.ok(appUser);
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java
@@ -20,6 +20,13 @@
    @Resource
    private AppUserShopService appUserShopService;
    @PostMapping("/addAppUserShop")
    public R<Void> add(@RequestBody AppUserShop appUserShop) {
        appUserShopService.save(appUserShop);
        return R.ok();
    }
    @GetMapping("/shop/{userId}")
    public R<List<AppUserShop>> getAppUserShop(@PathVariable("userId") Long userId) {
        return R.ok(appUserShopService.list(new LambdaQueryWrapper<AppUserShop>()
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserChangeLogController.java
@@ -1,8 +1,15 @@
package com.ruoyi.account.controller;
import com.ruoyi.account.api.model.UserChangeLog;
import com.ruoyi.account.service.UserChangeLogService;
import com.ruoyi.common.core.domain.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * <p>
@@ -15,6 +22,24 @@
@RestController
@RequestMapping("/user-change-log")
public class UserChangeLogController {
    @Resource
    private UserChangeLogService userChangeLogService;
    /**
     * 保存会员等级变更记录
     * @param userChangeLog
     * @return
     */
    @PostMapping("/saveUserChangeLog")
    public R saveUserChangeLog(@RequestBody UserChangeLog userChangeLog){
        userChangeLogService.save(userChangeLog);
        return R.ok();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java
@@ -60,7 +60,7 @@
        if (pointSetting.getData() != null) {
            userSignRecord.setPoint(pointSetting.getData().getSignPoint());
        }else {
            userSignRecord.setPoint(BigDecimal.ZERO);
            userSignRecord.setPoint(0);
        }
        R<BigDecimal> bigDecimalR = systemConfigClient.redPackegeSet();
        userSignRecord.setRedAmount(bigDecimalR.getData());
@@ -69,6 +69,7 @@
        SignBackRDto signBackRDto = new SignBackRDto();
        signBackRDto.setPoint(userSignRecord.getPoint());
        signBackRDto.setRedAmount(userSignRecord.getRedAmount());
        userSignRecordService.save(userSignRecord);
        return R.ok(signBackRDto);
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java
@@ -6,20 +6,19 @@
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.exception.ServiceException;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
@@ -45,6 +44,8 @@
    private TokenService tokenService;
    @Resource
    private VipCenterService vipCenterService;
    @Resource
    private VipGoodClient vipGoodClient;
    @GetMapping("getVipLevelList")
@@ -52,7 +53,7 @@
    public R<VipLevel> vipLevelList() {
        try {
            R<List<VipSetting>> r = remoteVipSettingClient.list();
            if (checkSuccess(r)) {
            if (R.isError(r)) {
                return R.fail("会员等级获取失败");
            }
            List<VipSetting> vipSettingList = r.getData();
@@ -61,7 +62,7 @@
            }
            R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3);
            if (checkSuccess(baseSettingR)) {
            if (R.isError(baseSettingR)) {
                log.error("【会员设置说明】获取失败:{}", baseSettingR.getMsg());
                return R.fail("会员等级获取失败");
            }
@@ -79,7 +80,6 @@
            // 批量获取 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 -> {
@@ -87,25 +87,23 @@
                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);
                R<List<VipGood>> vipGoodR = vipGoodsMap.get(vipSetting.getId());
                if (R.isError(vipGoodR)) {
                    throw new ServiceException("会员商品获取失败");
                }
                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);
            });
@@ -127,12 +125,8 @@
    }
    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<>();
@@ -146,8 +140,8 @@
    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);
            R<List<VipGood>> vipGoodR = vipGoodClient.getVipGoodsByVipId(vipId);
            result.put(vipId, vipGoodR);
        }
        return result;
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/SignBackRDto.java
@@ -7,6 +7,6 @@
@Data
public class SignBackRDto {
    private BigDecimal point;
    private Integer point;
    private BigDecimal redAmount;
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.vo.NearbyReferrer;
import com.ruoyi.account.vo.NearbyReferrerVo;
@@ -25,6 +26,8 @@
     * @return
     */
    List<NearbyReferrerVo> getNearbyReferrer(@Param("cityCode") String cityCode, @Param("nearbyReferrer") NearbyReferrer nearbyReferrer);
    IPage<AppUser> getAppuserPage(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser);
    
    
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/UserPointMapper.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.account.api.model.UserPoint;
import java.util.List;
/**
 * <p>
 *  Mapper 接口
@@ -13,4 +15,5 @@
 */
public interface UserPointMapper extends BaseMapper<UserPoint> {
    List<UserPoint> findLatestUserPointByTypeForUser(Long userId);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AgentApplicationService.java
@@ -13,4 +13,6 @@
 */
public interface AgentApplicationService extends IService<AgentApplication> {
    void apply(AgentApplication agentApplication);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java
@@ -1,5 +1,6 @@
package com.ruoyi.account.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.vo.*;
@@ -67,4 +68,18 @@
     * 获取指定用户的直帮上级用户(消费用户绑定的上级,最近一个用户会员类型为【创业者】的用户)
     */
    AppUser getSuperiorLeader(Long id);
    /**
     * 解绑推广人
     */
    void unbindThePromoter();
    /**
     * 在线记录操作,用于赠送积分
     */
    void onlineRecord();
    IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AgentApplicationServiceImpl.java
@@ -1,10 +1,24 @@
package com.ruoyi.account.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.model.AgentApplication;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.mapper.AgentApplicationMapper;
import com.ruoyi.account.service.AgentApplicationService;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
 * <p>
@@ -16,5 +30,42 @@
 */
@Service
public class AgentApplicationServiceImpl extends ServiceImpl<AgentApplicationMapper, AgentApplication> implements AgentApplicationService {
    @Resource
    private AgentApplicationMapper agentApplicationMapper;
    @Resource
    private TokenService tokenService;
    @Resource
    private AppUserService appUserService;
    @Resource
    private ShopClient shopClient;
    @Override
    public void apply(AgentApplication agentApplication) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        AppUser appUser = appUserService.getById(loginUserApplet.getUserid());
        agentApplication.setAppUserId(loginUserApplet.getUserid());
        agentApplication.setStatus(1);
        agentApplication.setApplicationTime(LocalDateTime.now());
        agentApplication.setShopPoint(appUser.getShopPoint());
        agentApplication.setSharePoint(appUser.getSharePoint());
        // 直推用户已达钻石会员数量
        List<AppUser> directVipUserList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                .eq(AppUser::getInviteUserId, appUser.getId())
                .eq(AppUser::getVipId, 3));
        agentApplication.setDirectVipNum(directVipUserList.size());
        // 直推用户已成为代理数量
        List<AppUser> directAgentUserList = appUserService.list(new LambdaQueryWrapper<AppUser>()
                .eq(AppUser::getInviteUserId, appUser.getId())
                .eq(AppUser::getUserType, 4));
        agentApplication.setDirectAgentNum(directAgentUserList.size());
        // 已绑定门店数量
        R<List<Shop>> R = shopClient.getShopByUserIds(Collections.singletonList(loginUserApplet.getUserid()));
        List<Shop> shopList = R.getData();
        agentApplication.setBindShopNum(shopList.size());
        agentApplicationMapper.insert(agentApplication);
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -3,12 +3,19 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.account.api.model.AppUserShop;
import com.ruoyi.account.api.model.UserChangeLog;
import com.ruoyi.account.api.model.UserPoint;
import com.ruoyi.account.mapper.AppUserMapper;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.AppUserShopService;
import com.ruoyi.account.service.UserChangeLogService;
import com.ruoyi.account.service.UserPointService;
import com.ruoyi.account.util.weChat.EnvVersion;
import com.ruoyi.account.util.weChat.WXCore;
import com.ruoyi.account.util.weChat.WeChatUtil;
import com.ruoyi.account.vo.*;
@@ -16,17 +23,29 @@
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.PointSetting;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.PointSettingClient;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.VipSettingClient;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.logging.log4j.core.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS.optional;
/**
 * <p>
@@ -57,12 +76,27 @@
    @Resource
    private SysUserClient sysUserClient;
    
    @Resource
    private VipSettingClient vipSettingClient;
    @Resource
    private PointSettingClient pointSettingClient;
    
    @Resource
    private UserChangeLogService userChangeLogService;
    @Value("${file.upload.location}")
    private String filePath;
    
    @Value("${file.upload.accessPath}")
    private String accessPath;
    @Resource
    private UserPointService userPointService;
    @Autowired
    private AppUserMapper appUserMapper;
    /**
     * 小程序一键登录
     * @param appletLogin
@@ -107,6 +141,9 @@
        Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser);
        loginVo.setToken(tokenApplet.get("access_token").toString());
        loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString()));
        appUser.setLastLoginTime(LocalDateTime.now());
        this.updateById(appUser);
        return R.ok(loginVo);
    }
    
@@ -147,6 +184,9 @@
        Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser);
        loginVo.setToken(tokenApplet.get("access_token").toString());
            loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString()));
        appUser.setLastLoginTime(LocalDateTime.now());
        this.updateById(appUser);
        return R.ok(loginVo);
    }
    
@@ -258,7 +298,16 @@
            appUser.setTotalRedPacketAmount(BigDecimal.ZERO);
            appUser.setTotalDistributionAmount(BigDecimal.ZERO);
            appUser.setBalance(BigDecimal.ZERO);
            appUser.setLavePoint(0);
            R<PointSetting> pointSettingR = pointSettingClient.getPointSetting(1);
            if (R.isError(pointSettingR)){
                throw new RuntimeException("获取积分设置失败");
            }
            PointSetting pointSetting = pointSettingR.getData();
            if (pointSetting == null){
                throw new RuntimeException("积分设置不存在");
            }
            appUser.setLavePoint(pointSetting.getGetRegisPoint());
            appUser.setTotalPoint(0);
            //根据平台的配置未达标,则标注为可修改推广人
            appUser.setChangePromoter(0);
            appUser.setLongitude(registerAccount.getLongitude());
@@ -271,6 +320,15 @@
//            appUser.setDistrict();
//            appUser.setDistrictCode();
            this.save(appUser);
            //获取微信推广二维码
            String fileName = UUID.randomUUID() + ".jpg";
            weChatUtil.getwxacodeunlimit("pages/login/login", "id=" + appUser.getId(), EnvVersion.DEVELOP, filePath + fileName);
            appUser.setQrCode(accessPath + fileName);
            this.updateById(appUser);
            //直推用户检查是否满足升级条件
            if(null != appUser.getInviteUserId()){
                vipUpgrade(appUser.getInviteUserId());
            }
            
            //查询当前注册的手机号是都和门店管理员手机号相同
            Shop shop = shopClient.getShopByPhone(registerAccount.getPhone()).getData();
@@ -300,7 +358,7 @@
        }
        LoginVo loginVo = new LoginVo();
        loginVo.setSkipPage(1);
        loginVo.setFirstTime(null == appUser1 ? true : false);
        loginVo.setFirstTime(null == appUser1);
        loginVo.setPhone(appUser.getPhone());
        //构建token
        LoginUser loginUser = new LoginUser();
@@ -311,6 +369,67 @@
        loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString()));
        return R.ok(loginVo);
    }
    /**
     * 会员等级变化
     */
    public void vipUpgrade(Long id){
        AppUser appUser = this.getById(id);
        Integer vipId = appUser.getVipId();
        //钻石会员
        VipSetting vipSetting3 = vipSettingClient.getVipSetting(3).getData();
        Integer vipLevelUpNumRole = vipSetting3.getVipLevelUpNumRole();
        Integer vipDirectNum = vipSetting3.getVipDirectNum();
        Integer vipTeamNum = vipSetting3.getVipTeamNum();
        if(1 == vipLevelUpNumRole && appUser.getVipId() < 3){
            //查询直推用户达到X人或者团队人数达到X人后,可升级
            //直推用户数
            long count = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1).eq(AppUser::getInviteUserId, id));
            //团队用户数
            List<AppUser> subordinate = getSubordinate(id);
            if(vipDirectNum <= count || vipTeamNum <= subordinate.size()){
                appUser.setVipId(3);
                this.updateById(appUser);
                //添加等级变化记录
                UserChangeLog userChangeLog = new UserChangeLog();
                userChangeLog.setDelFlag(0);
                userChangeLog.setCreateTime(LocalDateTime.now());
                userChangeLog.setAppUserId(appUser.getId());
                userChangeLog.setBeforeVipId(vipId);
                userChangeLog.setAfterVipId(appUser.getVipId());
                userChangeLog.setChangeType(1);
                userChangeLogService.save(userChangeLog);
                return;
            }
        }
        //黄金会员
        VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData();
        vipLevelUpNumRole = vipSetting2.getVipLevelUpNumRole();
        vipDirectNum = vipSetting2.getVipDirectNum();
        vipTeamNum = vipSetting2.getVipTeamNum();
        if(1 == vipLevelUpNumRole && appUser.getVipId() < 2){
            //查询直推用户达到X人或者团队人数达到X人后,可升级
            //直推用户数
            long count = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1).eq(AppUser::getInviteUserId, id));
            //团队用户数
            List<AppUser> subordinate = getSubordinate(id);
            if(vipDirectNum <= count || vipTeamNum <= subordinate.size()){
                appUser.setVipId(2);
                this.updateById(appUser);
                //添加等级变化记录
                UserChangeLog userChangeLog = new UserChangeLog();
                userChangeLog.setDelFlag(0);
                userChangeLog.setCreateTime(LocalDateTime.now());
                userChangeLog.setAppUserId(appUser.getId());
                userChangeLog.setBeforeVipId(vipId);
                userChangeLog.setAfterVipId(appUser.getVipId());
                userChangeLog.setChangeType(1);
                userChangeLogService.save(userChangeLog);
            }
        }
    }
    
    
    /**
@@ -331,6 +450,36 @@
        return getTopAppUser(list, appUser.getInviteUserId());
    }
    
    /**
     * 获取所有下级数据
     * @param id
     * @return
     */
    public List<AppUser> getSubordinate(Long id){
        List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0));
        List<AppUser> result = new ArrayList<>();
        List<Long> ids = new ArrayList<>();
        ids.add(id);
        return getSubordinate(list, ids, result);
    }
    public List<AppUser> getSubordinate(List<AppUser> list, List<Long> ids, List<AppUser> result){
        List<Long> idss = new ArrayList<>();
        for (Long id : ids) {
            List<AppUser> collect = list.stream().filter(s -> s.getInviteUserId().equals(id)).collect(Collectors.toList());
            if(collect.size() == 0){
                return result;
            }else{
                result.addAll(collect);
                List<Long> collect1 = collect.stream().map(AppUser::getId).collect(Collectors.toList());
                idss.addAll(collect1);
            }
        }
        return getSubordinate(list, idss, result);
    }
    
    /**
     * 获取附近推广人
@@ -342,7 +491,7 @@
        //使用地图获取省市区数据
        String longitude = nearbyReferrer.getLongitude();
        String latitude = nearbyReferrer.getLatitude();
        String cityCode = ""; // TODO 待完善
        String cityCode = "510100"; // TODO 待完善
        List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer);
        return list;
    }
@@ -395,4 +544,85 @@
        }
        return null;
    }
    /**
     * 定时解绑推广人
     */
    @Override
    public void unbindThePromoter() {
        //注册X天后没有升级成黄金会员则自动解绑推广人
        VipSetting vipSetting = vipSettingClient.getVipSetting(1).getData();
        Integer vipCancelDay = vipSetting.getVipCancelDay();
        Integer vipChangeDay = vipSetting.getVipChangeDay();
        List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).isNotNull(AppUser::getInviteUserId)
                .eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(create_time) + " + vipCancelDay + ") <= UNIX_TIMESTAMP()"));
        for (AppUser appUser : list) {
            appUser.setInviteUserId(null);
            appUser.setShopId(null);
            this.updateById(appUser);
        }
        //可更换推广人
        list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).eq(AppUser::getChangePromoter, 0)
                .isNull(AppUser::getLastShopTime).eq(AppUser::getStatus, 1).last(" and (UNIX_TIMESTAMP(create_time) + " + vipCancelDay + ") <= UNIX_TIMESTAMP()"));
        for (AppUser appUser : list) {
            appUser.setChangePromoter(1);
            this.updateById(appUser);
        }
    }
    /**
     * 在线记录操作,用于赠送积分
     */
    @Override
    public void onlineRecord() {
        Long userid = tokenService.getLoginUserApplet().getUserid();
        Object cacheObject = redisService.getCacheObject("ONLINE_" + userid);
        if(null == cacheObject){
            redisService.setCacheObject("ONLINE_" + userid, 0, 15L, TimeUnit.MINUTES);
        }else{
            Long duration = (Long) cacheObject;
            duration += 10;
            //满足一个小时,开始发放积分,计时归0
            if(60 >= duration){
                redisService.setCacheObject("ONLINE_" + userid, 0, 15L, TimeUnit.MINUTES);
                AppUser appUser = this.getById(userid);
                PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData();
                if(null != pointSetting){
                    int hourPoint = pointSetting.getHourPoint().intValue();
                    Integer lavePoint = appUser.getLavePoint();
                    appUser.setTotalPoint(appUser.getTotalPoint() + hourPoint);
                    appUser.setLavePoint(appUser.getLavePoint() + hourPoint);
                    this.updateById(appUser);
                    //添加积分变动记录
                    UserPoint userPoint = new UserPoint();
                    userPoint.setType(9);
                    userPoint.setHistoricalPoint(lavePoint);
                    userPoint.setVariablePoint(hourPoint);
                    userPoint.setBalance(appUser.getLavePoint());
                    userPoint.setCreateTime(LocalDateTime.now());
                    userPoint.setAppUserId(appUser.getId());
                    userPointService.save(userPoint);
                }
            }else{
                redisService.setCacheObject("ONLINE_" + userid, duration, 15L, TimeUnit.MINUTES);
            }
        }
    }
    @Override
    public IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser) {
        if (StringUtils.isNotEmpty(appUser.getShopName())){
            R<Set<Integer>> shopR = shopClient.getShopIdByName(appUser.getShopName());
            if (R.isSuccess(shopR)){
                Set<Integer> shopIds = shopR.getData();
                if (!CollectionUtils.isEmpty(shopIds)){
                    appUser.setShopIds(shopIds);
                }
            }
        }
        return appUserMapper.getAppuserPage(new Page<>(pageNum, pageSize), appUser);
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -55,23 +55,20 @@
    @Override
    public UserPointVO getUserPoint(Long userId) {
        AppUser appUser = appUserService.getById(userId);
        List<UserPoint> userPointList = list(new LambdaQueryWrapper<UserPoint>()
                .eq(UserPoint::getAppUserId, userId));
        List<UserPoint> userPointList = this.baseMapper.findLatestUserPointByTypeForUser(userId);
        Map<Integer, Integer> userBalanceMap = userPointList.stream()
                .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance));
        VipSetting vipSetting = vipSettingService.getVipSettingByUserId(userId);
        Integer lavePoint = appUser.getLavePoint();
        UserPointVO userPointVO = new UserPointVO();
        userPointVO.setTotalPoint(lavePoint);
//        userPointVO.setConsumePoint(lavePoint);
        userPointVO.setShopPoint(userBalanceMap.get(PointChangeType.CONSUME.getCode()));
        userPointVO.setSharePoint(userBalanceMap.get(PointChangeType.COMMISSION_RETURN.getCode()));
        userPointVO.setTotalPoint(appUser.getTotalPoint());
        userPointVO.setConsumePoint(appUser.getLavePoint());
        userPointVO.setShopPoint(appUser.getShopPoint());
        userPointVO.setSharePoint(appUser.getSharePoint());
        userPointVO.setPullNewPoint(userBalanceMap.get(PointChangeType.NEW_USER_REFERRAL.getCode()));
        userPointVO.setShopAchievementPoint(userBalanceMap.get(PointChangeType.STORE_PERFORMANCE.getCode()));
        userPointVO.setShopSharePoint(userBalanceMap.get(PointChangeType.STORE_COMMISSION_RETURN.getCode()));
        userPointVO.setGiftPoint(vipSetting.getVipGiftRole());
        userPointVO.setGiftPoint(vipSetting.getVipGiftRole() == 1 && vipSetting.getId() == 1 ? 1 : 0);
        return userPointVO;
    }
@@ -108,7 +105,7 @@
        if (vipSetting == null) {
            throw new ServiceException("VIP 设置未找到");
        }
        if (vipSetting.getVipGiftRole() == 0) {
        if (vipSetting.getId() == 0 && vipSetting.getVipGiftRole() == 0) {
            throw new ServiceException("转赠积分权限未开启");
        }
@@ -149,6 +146,7 @@
        }
        appUserForPhoe.setLavePoint(appUserForPhoe.getLavePoint() + point.intValue());
        appUserForPhoe.setTotalPoint(appUserForPhoe.getTotalPoint() + point.intValue());
        appUserService.updateById(appUserForPhoe);
        log.info("积分转赠完成,用户ID: {}, 新积分: {}", appUserForPhoe.getId(), appUserForPhoe.getLavePoint());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java
@@ -1,9 +1,11 @@
package com.ruoyi.account.util;
import com.ruoyi.account.service.AppUserService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
@@ -11,6 +13,11 @@
 */
@Component
public class TaskUtil {
    @Resource
    private AppUserService appUserService;
    /**
@@ -18,13 +25,8 @@
     */
    @Scheduled(fixedRate = 1000 * 60)
    public void sendVipCoupon(){
    }
    @Scheduled(fixedRate = 1000 * 60)
    public void changeVipId(){
        //解绑推广人
        appUserService.unbindThePromoter();
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/EnvVersion.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.account.util.weChat;
/**
 * @author zhibing.pu
 * @Date 2024/12/10 15:56
 */
public enum EnvVersion {
    /**
     * 开发版
     */
    DEVELOP("develop"),
    /**
     * 体验版
     */
    TRIAL("trial"),
    /**
     * 线上版本
     */
    RELEASE("release");
    EnvVersion(String version) {
        this.version = version;
    }
    private String version;
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/weChat/WeChatUtil.java
@@ -1,5 +1,7 @@
package com.ruoyi.account.util.weChat;
import cn.hutool.core.io.FileUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
@@ -7,10 +9,20 @@
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.redis.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpHeaders;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -186,35 +198,49 @@
    
//    /**
//     * 获取小程序二维码
//     * @param page      跳转页 例如 pages/index/index
//     * @param scene     参数 a=1&b=2
//     */
//    public InputStream getwxacodeunlimit(String page, String scene){
//        try {
//            String token = getWxAppletsAccessToken();
//            if(StringUtils.isEmpty(token)){
//                System.err.println("获取接口调用凭证失败");
//            }
//            String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + token;
//            Map<String, Object> param = new HashMap<>();
//            param.put("scene", scene);
//            param.put("page", page);
//            HttpHeaders httpHeaders = new HttpHeaders();
//            MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8");
//            httpHeaders.setContentType(type);
//            HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders);
//            ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class, new Object[0]);
//            String body1 = exchange.getBody();
////            System.err.println(body1);
//            ResponseEntity<byte[]> entity  = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]);
//            byte[] body = entity.getBody();
////            System.err.println(Base64.encodeBase64String(body));
//            return new ByteArrayInputStream(body);
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return null;
//    }
    /**
     * 获取小程序二维码
     * @param page      跳转页 例如 pages/index/index
     * @param scene     参数 a=1&b=2
     */
    public InputStream getwxacodeunlimit(String page, String scene, EnvVersion env_version){
        try {
            String token = getWxAppletsAccessToken();
            if(StringUtils.isEmpty(token)){
                System.err.println("获取接口调用凭证失败");
            }
            String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + token;
            Map<String, Object> param = new HashMap<>();
            param.put("scene", scene);
            param.put("page", page);
            param.put("env_version", env_version.getVersion());
            HttpRequest post = HttpUtil.createPost(url);
            post.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8");
            post.body(JSON.toJSONString(param));
            HttpResponse execute = post.execute();
            byte[] bytes = execute.bodyBytes();
            String body1 = execute.body();
            System.err.println(body1);
            System.err.println(Base64.encodeBase64String(bytes));
            return new ByteArrayInputStream(bytes);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 获取微信小程序二维码
     * @param page
     * @param scene
     * @param filePath
     * @return
     */
    public String getwxacodeunlimit(String page, String scene, EnvVersion env_version, String filePath){
        InputStream getwxacodeunlimit = getwxacodeunlimit(page, scene, env_version);
        File file = FileUtil.writeFromStream(getwxacodeunlimit, new File(filePath));
        return file.getPath();
    }
}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -51,4 +51,28 @@
            </if>
        ) as aa order by aa.distance
    </select>
    <select id="getAppuserPage" resultType="com.ruoyi.account.api.model.AppUser">
        SELECT ta.id, ta.`name`, ta.vip_id, ta.shop_id
        FROM t_app_user ta
        <where>
            ta.del_flag = 0
            <if test="null != appUser.name and '' != appUser.name">
                and ta.`name` like CONCAT('%',#{appUser.name},'%')
            </if>
            <if test="null != appUser.phone and '' != appUser.phone">
                and ta.phone like CONCAT('%',#{appUser.phone},'%')
            </if>
            <if test="null != appUser.vipId">
                and ta.vip_id = #{appUser.vipId}
            </if>
            <if test="null != appUser.shopIds and appUser.shopIds.size() > 0">
                and ta.shop_id in
                <foreach collection="appUser.shopIds" item="shopId" open="(" separator="," close=")">
                    #{shopId}
                </foreach>
            </if>
        </where>
    </select>
</mapper>
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
@@ -17,5 +17,15 @@
    <sql id="Base_Column_List">
        id, type, historical_point, variable_point, create_time, app_user_id, object_id
    </sql>
    <select id="findLatestUserPointByTypeForUser" resultType="com.ruoyi.account.api.model.UserPoint">
        SELECT
            t1.*
        FROM
            t_user_point t1
                INNER JOIN ( SELECT type, MAX( create_time ) AS max_create_time FROM t_user_point WHERE app_user_id = 1864118151377129473 GROUP BY type ) t2 ON t1.type = t2.type
                AND t1.create_time = t2.max_create_time
        WHERE
            t1.app_user_id = #{userId}
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/CommissionController.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.order.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.service.CommissionService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Set;
@RestController
@RequestMapping("commission")
public class CommissionController {
    @Resource
    private CommissionService commissionService;
    @PostMapping("/calculationCommission")
    public R<Void> calculationCommission(@RequestBody Set<String> orderIds){
        commissionService.calculationCommission(orderIds);
        return R.ok();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -23,7 +23,6 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;
@@ -76,7 +75,7 @@
    /**
     * 订单详情
     */
    @ApiOperation(value = "订单详情", tags = {"小程序-订单详情"})
    @ApiOperation(value = "订单详情", tags = {"小程序-个人中心-我的订单-订单详情"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -88,7 +87,7 @@
    /**
     * 扫码校验
     */
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理-扫码核销校验"})
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType="query"),
    })
@@ -103,7 +102,7 @@
    /**
     * 订单核销
     */
    @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理-扫码核销"})
    @ApiOperation(value = "订单核销", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单号", name = "code", required = true, dataType = "String"),
    })
@@ -116,7 +115,7 @@
    /**
     * 取消订单
     */
    @ApiOperation(value = "取消订单", tags = {"小程序-个人中心-我的订单-取消订单"})
    @ApiOperation(value = "取消订单", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -131,7 +130,7 @@
    /**
     * 确认收货
     */
    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单-确认收货"})
    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -162,7 +161,7 @@
    /**
     * 更换收货地址
     */
    @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单-更换收货地址"})
    @ApiOperation(value = "更换收货地址", tags = {"小程序-个人中心-我的订单"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
@@ -183,7 +182,7 @@
    /**
     * 更新订单状态
     */
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理-更新订单状态"})
    @ApiOperation(value = "更新订单状态", tags = {"后台-订单管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "订单对象", name = "order", required = true, dataType = "Order"),
    })
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -85,7 +85,7 @@
        if(Arrays.asList(2, 3).contains(refundPass.getStatus())){
            return R.fail("售后取消失败");
        }
        refundPass.setDelFlag(1);
//        refundPass.setDelFlag(1);
        refundPassService.removeById(id);
        order.setOrderStatus(4);
        orderService.updateById(order);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
@@ -2,6 +2,8 @@
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -41,6 +43,8 @@
    private GoodsShopClient goodsShopClient;
    @Resource
    private ShopClient shopClient;
    @Resource
    private AppUserClient appUserClient;
    
    
    
@@ -136,6 +140,14 @@
        }
        return R.ok(verifiableShopVoList);
    }
    @GetMapping("/getGoodsPrice")
    public R<Price> getGoodsPrice(Long appUserId, Integer goodsId, Integer shopId){
        AppUser appUser = appUserClient.getAppUserById(appUserId);
        Price price = shoppingCartService.getPrice(appUser, goodsId, shopId);
        return R.ok(price);
    }
    
    
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java
@@ -4,7 +4,6 @@
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>
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java
@@ -1,6 +1,7 @@
package com.ruoyi.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.model.ShoppingCart;
import com.ruoyi.order.vo.*;
@@ -47,4 +48,6 @@
     * @return
     */
    R shoppingCartPayment(ShoppingCartPayment shoppingCartPayment);
    Price getPrice(AppUser appUser, Integer goodsId, Integer shopId);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.order.model.OrderGood;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -50,6 +51,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void calculationCommission(Set<String> orderIds) {
        List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
                .in(OrderGood::getOrderId, orderIds));
@@ -63,6 +65,8 @@
            if (order.getIsCommission() == 1) {
                continue;
            }
            order.setIsCommission(1);
            orderService.updateById(order);
            R<Shop> r = shopClient.getShopById(order.getShopId());
            if (!R.isSuccess(r)) {
                throw new RuntimeException("获取门店信息失败");
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -12,7 +12,6 @@
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.enums.OrderStatus;
import com.ruoyi.order.enums.OrderType;
import com.ruoyi.order.mapper.OrderGoodMapper;
import com.ruoyi.order.mapper.OrderMapper;
import com.ruoyi.order.model.Order;
@@ -209,18 +208,6 @@
        order.setOrderStatus(OrderStatus.COMPLETED.getCode());
        orderMapper.updateById(order);
        Integer orderType = order.getOrderType();
        if (orderType.equals(OrderType.SERVICE.getCode())){
            R<TechnicianSubscribe> subscribeR = technicianClient.getSubscribeByOrderId(order.getId());
            if (R.isError(subscribeR)){
                throw new ServiceException("获取预约信息失败");
            }
            TechnicianSubscribe subscribe = subscribeR.getData();
            subscribe.setStatus(2);
            R<Void> r = technicianClient.updateStatus(subscribe.getStatus(), subscribe.getId());
            if (R.isError(r)){
                throw new ServiceException("更新预约状态失败");
            }
        }
        // 售后设置
        R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -6,10 +6,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.*;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.BalanceChangeRecord;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.account.api.model.UserPoint;
import com.ruoyi.account.api.model.*;
import com.ruoyi.account.api.vo.CouponInfoVo;
import com.ruoyi.account.api.vo.PaymentUserCoupon;
import com.ruoyi.account.api.vo.PaymentUserCouponVo;
@@ -30,7 +27,6 @@
import com.ruoyi.other.api.vo.GetGoodsBargainPrice;
import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds;
import com.ruoyi.other.api.vo.GetSeckillActivityInfo;
import lombok.Data;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -38,75 +34,80 @@
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService {
    @Resource
    private TokenService tokenService;
    @Resource
    private GoodsClient goodsClient;
    @Resource
    private GoodsShopClient goodsShopClient;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private GoodsAreaClient goodsAreaClient;
    @Resource
    private GoodsVipClient goodsVipClient;
    @Resource
    private SeckillActivityInfoClient seckillActivityInfoClient;
    @Resource
    private GoodsBargainPriceClient goodsBargainPriceClient;
    @Resource
    private OrderService orderService;
    @Resource
    private OrderGoodService orderGoodService;
    @Resource
    private ShopClient shopClient;
    @Resource
    private OrderActivityInfoClient orderActivityInfoClient;
    @Resource
    private BaseSettingClient baseSettingClient;
    @Resource
    private UserAddressClient userAddressClient;
    @Resource
    private UserCouponClient userCouponClient;
    @Resource
    private SystemConfigClient systemConfigClient;
    @Resource
    private UserPointClient userPointClient;
    @Resource
    private BalanceChangeRecordClient balanceChangeRecordClient;
    @Resource
    private CommissionService commissionService;
    @Resource
    private VipSettingClient vipSettingClient;
    @Resource
    private UserChangeLogClient userChangeLogClient;
    /**
     * 获取购物车列表
     * @param type
@@ -129,8 +130,8 @@
        List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null);
        return page;
    }
    /**
     * 获取支付价格
     * @param appUser
@@ -152,8 +153,11 @@
            GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice();
            goodsBargainPrice.setGoodsId(goodsId);
            goodsBargainPrice.setVip(appUser.getVipId());
            goodsBargainPrice.setShopId(shopId);
            GoodsBargainPriceDetail bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData();
            GoodsBargainPriceDetail bargainPriceDetail = null;
            if (shopId != null){
                goodsBargainPrice.setShopId(shopId);
                bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData();
            }
            if(null == bargainPriceDetail){
                //没有门店特价,判断地区价格配置
                GoodsArea area = new GoodsArea();
@@ -171,8 +175,8 @@
                    }else{
                        price.setCash(goodsVip.getSellingPrice());
                        price.setPoint(goodsVip.getIntegral());
                        price.setCashPayment(goodsVip.getCashPayment() == 1 ? true : false);
                        price.setPointPayment(goodsVip.getPointPayment() == 1 ? true : false);
                        price.setCashPayment(goodsVip.getCashPayment() == 1);
                        price.setPointPayment(goodsVip.getPointPayment() == 1);
                        price.setEarnSpendingPoints(goodsVip.getEarnSpendingPoints());
                        price.setSuperiorSubcommission(goodsVip.getSuperiorSubcommission());
                        price.setSuperiorRebatePoints(goodsVip.getSuperiorRebatePoints());
@@ -188,8 +192,8 @@
                }else{
                    price.setCash(goodsArea.getSellingPrice());
                    price.setPoint(goodsArea.getIntegral());
                    price.setCashPayment(goodsArea.getCashPayment() == 1 ? true : false);
                    price.setPointPayment(goodsArea.getPointPayment() == 1 ? true : false);
                    price.setCashPayment(goodsArea.getCashPayment() == 1);
                    price.setPointPayment(goodsArea.getPointPayment() == 1);
                    price.setEarnSpendingPoints(goodsArea.getEarnSpendingPoints());
                    price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission());
                    price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints());
@@ -205,8 +209,8 @@
            }else{
                price.setCash(bargainPriceDetail.getSellingPrice());
                price.setPoint(bargainPriceDetail.getIntegral());
                price.setCashPayment(bargainPriceDetail.getSellingPrice() != null ? true : false);
                price.setPointPayment(bargainPriceDetail.getIntegral() != null ? true : false);
                price.setCashPayment(bargainPriceDetail.getSellingPrice() != null);
                price.setPointPayment(bargainPriceDetail.getIntegral() != null);
                //门店特价,消费积分使用会员等级的消费积分
                GoodsArea area = new GoodsArea();
                area.setDistrictsCode(appUser.getDistrictCode());
@@ -238,8 +242,8 @@
            if(goodsSeckill.getCashPayment() == 0 && goodsSeckill.getPointPayment() == 1){
                price.setPoint(goodsSeckill.getIntegral());
            }
            price.setCashPayment(goodsSeckill.getCashPayment() == 1 ? true : false);
            price.setPointPayment(goodsSeckill.getPointPayment() == 1 ? true : false);
            price.setCashPayment(goodsSeckill.getCashPayment() == 1);
            price.setPointPayment(goodsSeckill.getPointPayment() == 1);
            price.setEndTime(goodsSeckill.getEndTime());
            price.setEarnSpendingPoints(goodsSeckill.getEarnSpendingPoints());
            price.setSuperiorSubcommission(goodsSeckill.getSuperiorSubcommission());
@@ -255,76 +259,9 @@
        }
        return price;
    }
    @Data
    class Price {
        /**
         * 现金
         */
        private BigDecimal cash;
        /**
         * 积分
         */
        private Integer point;
        /**
         * 获取结束时间
         */
        private Long endTime;
        /**
         * 现金支付
         */
        private Boolean cashPayment;
        /**
         * 积分支付
         */
        private Boolean pointPayment;
        /**
         * 可获得消费积分
         */
        private Integer earnSpendingPoints;
        /**
         * 上级获得分佣金额
         */
        private BigDecimal superiorSubcommission;
        /**
         * 上级获得返佣积分
         */
        private Integer superiorRebatePoints;
        /**
         * 获取返佣积分上级类型(1=直推上级,2=直帮上级)
         */
        private Integer superiorType;
        /**
         * 核销门店可获得服务费
         */
        private BigDecimal servuceShopCharges;
        /**
         * 核销门店可获得服务积分
         */
        private Integer servuceShopPoints;
        /**
         * 技师可获得服务积分
         */
        private Integer technicianPoints;
        /**
         * 绑定门店可获得分佣金额
         */
        private BigDecimal boundShopCharges;
        /**
         * 绑定门店可获得返佣积分
         */
        private Integer boundShopPoints;
        /**
         * 绑定门店上级门店可获得分佣金额
         */
        private BigDecimal boundShopSuperiorsCharges;
        /**
         * 绑定门店上级门店可获得返佣积分
         */
        private Integer boundShopSuperiorsPoints;
    }
    @Override
    public Long addGoods(ShoppingCart shoppingCart) {
@@ -333,8 +270,8 @@
        this.save(shoppingCart);
        return shoppingCart.getId();
    }
    /**
     * 修改购物车数量
     * @param setGoodsNumber
@@ -359,8 +296,8 @@
        }
        return R.ok();
    }
    /**
     * 确认购物车订单
     * @param confirmOrder
@@ -497,8 +434,8 @@
        }
        return confirmOrderVo;
    }
    /**
     * 构建购物车商品列表
     * @param appUser
@@ -533,8 +470,8 @@
                //使用商品的基础价格
                price.setCash(1 == goods.getCashPayment() ? goods.getSellingPrice() : null);
                price.setPoint(1 == goods.getPointPayment() ? goods.getIntegral() : null);
                price.setCashPayment(goods.getCashPayment() == 1 ? true : false);
                price.setPointPayment(goods.getPointPayment() == 1 ? true : false);
                price.setCashPayment(goods.getCashPayment() == 1);
                price.setPointPayment(goods.getPointPayment() == 1);
            }
            vo.setCash(price.getCash());
            vo.setPoint(price.getPoint());
@@ -547,7 +484,7 @@
            goodsShop.setGoodsId(shoppingCart.getGoodsId());
            goodsShop.setShopId(shopId);
            GoodsShop goodsShop1 = goodsShopClient.getGoodsShop(goodsShop).getData();
            vo.setVerifiable(goods.getAppointStore() == 1 && null == goodsShop1 ? false : true);
            vo.setVerifiable(goods.getAppointStore() != 1 || null != goodsShop1);
            //判断当前数量是否已经超出限购数量(需要计算已经购买的数量)
            if(null == goods.getPurchaseLimit() || -1 == goods.getPurchaseLimit()){
                vo.setPurchaseLimit(false);
@@ -560,7 +497,7 @@
                            .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0));
                    sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum();
                }
                vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit() ? true : false);
                vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit());
            }
            vo.setDistributionMode(goods.getDistributionMode());
            vo.setEarnSpendingPoints(price.getEarnSpendingPoints());
@@ -578,8 +515,8 @@
        }
        return page;
    }
    /**
     * 购物车支付操作
     * @param shoppingCartPayment
@@ -616,7 +553,7 @@
            }
            ids.add(id);
        }
        List<ShoppingCart> list = this.listByIds(ids);
        //构建商品明细列表
        List<MyShoppingCartVo> goodsList = buildDetail(appUser, shopId, list, objects);
@@ -664,9 +601,14 @@
        //积分支付的订单积分
        Integer orderPoint = 0;
        if(3 != shoppingCartPayment.getPaymentType()){
            orderMoney = goodsList.stream().map(MyShoppingCartVo::getCash).reduce(BigDecimal::add).get();
            for (MyShoppingCartVo myShoppingCartVo : goodsList) {
                orderMoney = orderMoney.add(myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber())));
            }
        }else{
            orderPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getPoint).sum();
            for (MyShoppingCartVo myShoppingCartVo : goodsList) {
                orderPoint += (myShoppingCartVo.getPoint() * myShoppingCartVo.getNumber());
            }
            if(appUser.getLavePoint().intValue() < orderPoint){
                return R.fail("账户剩余积分不足");
            }
@@ -681,7 +623,7 @@
        BigDecimal discountAmount = BigDecimal.ZERO;
        //活动优惠金额
        BigDecimal activityAmount = BigDecimal.ZERO;
        //减去优惠券优惠金额
        CouponInfoVo couponInfoVo = null;
        if(null != shoppingCartPayment.getUserCouponId() && 3 != shoppingCartPayment.getPaymentType()){
@@ -724,7 +666,7 @@
                        paymentMoney = paymentMoney.add(cash);
                    }
                }
                //满减
                if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(goodsMoney) <= 0){
                    goodsMoney = goodsMoney.subtract(couponInfoVo.getDiscountAmount());
@@ -749,16 +691,16 @@
                paymentMoney = paymentMoney.add(goodsMoney);
            }
        }
        //查询当前是否有订单活动
        OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData();
        BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData();
        //系统活动设置(优惠券和活动能否同时使用)
        boolean useSimultaneously = baseSetting.getContent().equals("1") ? true : false;
        boolean useSimultaneously = baseSetting.getContent().equals("1");
        //满XX才打折,只有现金才能优惠
        //如果使用优惠券,则需要判断是否可以和同时使用,且活动满足使用条件。
        //没有使用优惠券,只需要判断是都满足使用条件
        if(((useSimultaneously && null != shoppingCartPayment.getUserCouponId()) || null == shoppingCartPayment.getUserCouponId()) &&
        if((useSimultaneously || null == shoppingCartPayment.getUserCouponId()) &&
                null != orderActivityInfo && shoppingCartPayment.getPaymentType() != 3 && orderActivityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){
            BigDecimal paymentMoney1 = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
            BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
@@ -766,13 +708,16 @@
            paymentMoney = paymentMoney1;
            activityAmount = activityAmount.add(bigDecimal);
        }
        //可获得的消费积分
        int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum();
        int earnPoint = 0;
        for (MyShoppingCartVo myShoppingCartVo : goodsList) {
            earnPoint += (myShoppingCartVo.getEarnSpendingPoints() * myShoppingCartVo.getNumber());
        }
        if(null != shoppingCartPayment.getUserAddressId()){
            userAddressClient.getUserAddressById(shoppingCartPayment.getUserAddressId()).getData();
        }
        //获取快递策略,计算快递费
        BigDecimal expressFee = BigDecimal.ZERO;
        if(null != shoppingCartPayment.getUserAddressId()){
@@ -844,7 +789,7 @@
        order.setDelFlag(0);
        order.setCreateTime(LocalDateTime.now());
        order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType());
        if(2 == shoppingCartPayment.getPaymentType()){
            BigDecimal balance = appUser.getBalance();
            if(balance.compareTo(paymentMoney) < 0){
@@ -858,7 +803,7 @@
                return R.fail("账户余额不足");
            }
        }
        orderService.save(order);
        //构建订单明细数据
        for (MyShoppingCartVo myShoppingCartVo : goodsList) {
@@ -898,15 +843,15 @@
            orderGood.setBoundShopSuperiorsPoints(myShoppingCartVo.getBoundShopSuperiorsPoints());
            orderGoodService.save(orderGood);
        }
        //开始构建支付数据
        //现金支付
        paymentMoney = paymentMoney.add(expressFee).setScale(2, RoundingMode.HALF_EVEN);
        if(1 == shoppingCartPayment.getPaymentType()){
            //调起微信支付 TODO 待完善
        }
        //账户余额
        if(2 == shoppingCartPayment.getPaymentType()){
@@ -940,7 +885,8 @@
            if(earnPoint > 0){
                appUser.setShopPoint(appUser.getShopPoint() + earnPoint);
                appUser.setLavePoint(appUser.getLavePoint() + earnPoint);
                appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint);
                UserPoint userPoint = new UserPoint();
                userPoint.setType(1);
                userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint);
@@ -951,6 +897,8 @@
                userPoint.setObjectId(order.getId());
                userPointClient.saveUserPoint(userPoint);
            }
            appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setLastShopTime(LocalDateTime.now());
            appUserClient.editAppUserById(appUser);
            //构建余额明细变动记录
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
@@ -965,9 +913,14 @@
            balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
            //修改订支付状态
            order.setPayStatus(2);
            if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){
                order.setOrderStatus(2);
            }
            orderService.updateById(order);
            //删除购物车数据
            this.removeBatchByIds(ids);
            //检查消费积分满足后升级会员
            vipUpgrade(appUser);
        }
        //积分支付
        if(3 == shoppingCartPayment.getPaymentType()){
@@ -975,7 +928,13 @@
            appUser.setLavePoint(lavePoint - orderPoint);
            appUser.setShopPoint(appUser.getShopPoint() + earnPoint);
            appUser.setLavePoint(appUser.getLavePoint() + earnPoint);
            appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint);
            appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setLastShopTime(LocalDateTime.now());
            appUserClient.editAppUserById(appUser);
            //检查消费积分满足后升级会员
            vipUpgrade(appUser);
            //构建积分流水记录
            UserPoint userPoint = new UserPoint();
            userPoint.setType(4);
@@ -1029,7 +988,7 @@
                            appUser.setBalance(balance);
                        }
                    }
                    appUserClient.editAppUserById(appUser);
                    //构建余额明细变动记录
                    BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
@@ -1044,6 +1003,9 @@
                    balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
                    //修改订支付状态
                    order.setPayStatus(2);
                    if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){
                        order.setOrderStatus(2);
                    }
                    orderService.updateById(order);
                    //删除购物车数据
                    this.removeBatchByIds(ids);
@@ -1051,6 +1013,9 @@
            }else{
                //修改订支付状态
                order.setPayStatus(2);
                if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){
                    order.setOrderStatus(2);
                }
                orderService.updateById(order);
                //删除购物车数据
                this.removeBatchByIds(ids);
@@ -1058,8 +1023,8 @@
        }
        return R.ok(order.getId().toString());
    }
    public String getNumber(Integer size){
        String str = "";
        for (Integer i = 0; i < size; i++) {
@@ -1067,4 +1032,49 @@
        }
        return str;
    }
    /**
     * 会员等级变化
     * @param appUser
     */
    public void vipUpgrade(AppUser appUser){
        Integer shopPoint = appUser.getShopPoint();
        Integer vipId = appUser.getVipId();
        //钻石会员
        VipSetting vipSetting3 = vipSettingClient.getVipSetting(3).getData();
        Integer vipLevelUpShopRole = vipSetting3.getVipLevelUpShopRole();
        Integer vipLevelUpShop = vipSetting3.getVipLevelUpShop();
        if(null != vipLevelUpShopRole && 1 == vipLevelUpShopRole && appUser.getVipId() < 3 && shopPoint >= vipLevelUpShop){
            appUser.setVipId(3);
            appUserClient.editAppUserById(appUser);
            //添加等级变化记录
            UserChangeLog userChangeLog = new UserChangeLog();
            userChangeLog.setDelFlag(0);
            userChangeLog.setCreateTime(LocalDateTime.now());
            userChangeLog.setAppUserId(appUser.getId());
            userChangeLog.setBeforeVipId(vipId);
            userChangeLog.setAfterVipId(appUser.getVipId());
            userChangeLog.setChangeType(1);
            userChangeLogClient.saveUserChangeLog(userChangeLog);
            return;
        }
        //黄金会员
        VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData();
        vipLevelUpShopRole = vipSetting2.getVipLevelUpShopRole();
        vipLevelUpShop = vipSetting2.getVipLevelUpShop();
        if(null != vipLevelUpShopRole && 1 == vipLevelUpShopRole && appUser.getVipId() < 2 && shopPoint >= vipLevelUpShop){
            appUser.setVipId(2);
            appUserClient.editAppUserById(appUser);
            //添加等级变化记录
            UserChangeLog userChangeLog = new UserChangeLog();
            userChangeLog.setDelFlag(0);
            userChangeLog.setCreateTime(LocalDateTime.now());
            userChangeLog.setAppUserId(appUser.getId());
            userChangeLog.setBeforeVipId(vipId);
            userChangeLog.setAfterVipId(appUser.getVipId());
            userChangeLog.setChangeType(1);
            userChangeLogClient.saveUserChangeLog(userChangeLog);
        }
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/AgreementController.java
@@ -43,7 +43,7 @@
    
    @ResponseBody
    @GetMapping("/getAgreementByType/{type}")
    @ApiOperation(value = "获取协议详情", tags = {"管理后台-协议管理"})
    @ApiOperation(value = "协议管理-详情", tags = {"管理后台"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=技师上门免责声明,4=注销协议,5门店提现免责声明)", name = "type", required = true, dataType = "int"),
    })
@@ -55,7 +55,7 @@
    
    @ResponseBody
    @PostMapping("/saveAgreement")
    @ApiOperation(value = "保存协议", tags = {"管理后台-协议管理"})
    @ApiOperation(value = "协议管理-保存协议", tags = {"管理后台"})
    public R saveAgreement(@RequestBody Agreement agreement){
        if(null != agreement.getId()){
            agreementService.updateById(agreement);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
@@ -23,7 +23,7 @@
 */
@RestController
@RequestMapping("/banner")
@Api(tags = "轮播图")
@Api("轮播图")
public class BannerController {
    @Resource
    private BannerService bannerService;
@@ -37,35 +37,35 @@
        return R.ok(list);
    }
    @PostMapping("/add")
    @ApiOperation(value = "添加", tags = {"后台-广告管理-banner管理"})
    @ApiOperation(value = "广告管理-banner管理-添加", tags = {"管理后台"})
    public R add(@RequestBody Banner banner){
            bannerService.save(banner);
            return R.ok();
      }
      @PostMapping("/delete")
    @ApiOperation(value = "删除", tags = {"后台-广告管理-banner管理"})
      @GetMapping("/delete")
    @ApiOperation(value = "广告管理-banner管理-删除", tags = {"管理后台"})
    public R delete(@RequestParam Integer id){
            bannerService.removeById(id);
            return R.ok();
      }
      @PostMapping("/edit")
    @ApiOperation(value = "修改", tags = {"后台-广告管理-banner管理"})
    @ApiOperation(value = "广告管理-banner管理-修改", tags = {"管理后台"})
    public R edit(@RequestBody Banner banner){
            bannerService.updateById(banner);
            return R.ok();
      }
      @PostMapping("/detail")
    @ApiOperation(value = "详情", tags = {"后台-广告管理-banner管理"})
      @GetMapping("/detail")
    @ApiOperation(value = "广告管理-banner管理-详情", tags = {"管理后台"})
    public R detail(@RequestParam Integer id){
          Banner byId = bannerService.getById(id);
          return R.ok(byId);
      }
      @PostMapping("/page/list")
    @ApiOperation(value = "列表", tags = {"后台-广告管理--banner"})
      @GetMapping("/page/list")
    @ApiOperation(value = "广告管理-banner-列表", tags = {"管理后台"})
    public R<Page<Banner>> pagelist(String name, Integer jumpType, Integer position,Integer pageNum,Integer pageSize){
          Page<Banner> page = bannerService.lambdaQuery().like(StringUtils.isNotEmpty(name), Banner::getName, name)
                  .eq(Banner::getJumpType, jumpType)
                  .eq(Banner::getPosition, position)
                  .eq(jumpType!=null,Banner::getJumpType, jumpType)
                  .eq(position!=null,Banner::getPosition, position)
                  .page(Page.of(pageNum, pageSize));
          return R.ok(page);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java
@@ -1,9 +1,11 @@
package com.ruoyi.other.controller;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.service.BaseSettingService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -18,6 +20,7 @@
 */
@RestController
@RequestMapping("/base-setting")
@Api("基础配置")
public class BaseSettingController {
    @Resource
@@ -35,6 +38,19 @@
        BaseSetting baseSetting = baseSettingService.getById(id);
        return R.ok(baseSetting);
    }
    /**
     * 保存设置
     */
    @PostMapping("/save")
    public R saveActivityConfig(@RequestBody String json){
        JSONObject jsonObject = JSONObject.parseObject(json);
        Integer id = jsonObject.getInteger("id");
        BaseSetting baseSetting = baseSettingService.getById(id);
        baseSetting.setContent(jsonObject.getString("content"));
        baseSettingService.saveOrUpdate(baseSetting);
        return R.ok();
    }
    
    
    
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -39,7 +39,7 @@
    private AppUserClient appUserClient;
    //查看详情
    @PostMapping("/detail")
    @ApiOperation(value = "详情", tags = {"后台-优惠劵"})
    @ApiOperation(value = "活动管理-优惠劵管理-详情", tags = {"管理后台"})
    public R<CouponInfo> detail(@RequestParam("id") Integer id){
        CouponInfo byId = couponInfoService.getById(id);
        return R.ok(byId);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java
@@ -2,22 +2,33 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.GoodsBargainPrice;
import com.ruoyi.other.api.domain.GoodsBargainPriceDetail;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.*;
import com.ruoyi.other.api.vo.GetGoodsBargainPrice;
import com.ruoyi.other.service.GoodsBargainPriceDetailService;
import com.ruoyi.other.service.GoodsBargainPriceService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.other.service.*;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import static com.alibaba.nacos.shaded.org.checkerframework.checker.units.UnitsTools.g;
/**
 * <p>
 *  前端控制器
 * 前端控制器
 * </p>
 *
 * @author luodangjia
@@ -25,34 +36,168 @@
 */
@RestController
@RequestMapping("/goods-bargain-price")
@Api("门店特殊售价")
public class GoodsBargainPriceController {
    @Resource
    private GoodsBargainPriceService goodsBargainPriceService;
    @Resource
    private GoodsBargainPriceDetailService goodsBargainPriceDetailService;
    /**
     * 根据商品id和会员等级获取门店特价
     * @param goodsBargainPrice
     * @return
     */
    @PostMapping("/getGoodsBargainPrice")
    public R<GoodsBargainPriceDetail> getGoodsBargainPrice(@RequestBody GetGoodsBargainPrice goodsBargainPrice){
        GoodsBargainPrice one = goodsBargainPriceService.getOne(new LambdaQueryWrapper<GoodsBargainPrice>().eq(GoodsBargainPrice::getGoodsId, goodsBargainPrice.getGoodsId())
                .eq(GoodsBargainPrice::getShopId, goodsBargainPrice.getShopId()).eq(GoodsBargainPrice::getAuditStatus, 1).eq(GoodsBargainPrice::getDelFlag, 0)
                .orderByDesc(GoodsBargainPrice::getCreateTime).last(" limit 0,1"));
        if(null == one){
            return R.ok();
        }
        GoodsBargainPriceDetail detailServiceOne = goodsBargainPriceDetailService.getOne(new LambdaQueryWrapper<GoodsBargainPriceDetail>()
                .eq(GoodsBargainPriceDetail::getGoodsBargainPriceId, one.getId()).eq(GoodsBargainPriceDetail::getVip, goodsBargainPrice.getVip()));
        return R.ok(detailServiceOne);
    }
    @Resource
    private GoodsBargainPriceService goodsBargainPriceService;
    @Resource
    private GoodsBargainPriceDetailService goodsBargainPriceDetailService;
    @Resource
    private TokenService tokenService;
    @Resource
    private GoodsService goodsService;
    @Resource
    private GoodsCategoryService goodsCategoryService;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private ShopService shopService;
    /**
     * 根据商品id和会员等级获取门店特价
     *
     * @param goodsBargainPrice
     * @return
     */
    @PostMapping("/getGoodsBargainPrice")
    public R<GoodsBargainPriceDetail> getGoodsBargainPrice(@RequestBody GetGoodsBargainPrice goodsBargainPrice) {
        GoodsBargainPrice one = goodsBargainPriceService.getOne(new LambdaQueryWrapper<GoodsBargainPrice>()
                .eq(GoodsBargainPrice::getGoodsId, goodsBargainPrice.getGoodsId())
                .eq(GoodsBargainPrice::getShopId, goodsBargainPrice.getShopId())
                .eq(GoodsBargainPrice::getAuditStatus, 1)
                .eq(GoodsBargainPrice::getDelFlag, 0)
                .orderByDesc(GoodsBargainPrice::getCreateTime)
                .last(" limit 0,1"));
        if (null == one) {
            return R.ok();
        }
        GoodsBargainPriceDetail detailServiceOne = goodsBargainPriceDetailService.getOne(new LambdaQueryWrapper<GoodsBargainPriceDetail>()
                .eq(GoodsBargainPriceDetail::getGoodsBargainPriceId, one.getId()).eq(GoodsBargainPriceDetail::getVip, goodsBargainPrice.getVip()));
        return R.ok(detailServiceOne);
    }
    /**
     * 新增
     */
    @PostMapping("/add")
    @ApiOperation(value = "新增", tags = {"管理后台-商品管理-门店特殊售价"})
    @Transactional(rollbackFor = Exception.class)
    public R<Void> add(@RequestBody GoodsBargainPrice goodsBargainPrice) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        goodsBargainPrice.setAuditStatus(0);
        goodsBargainPrice.setCreateUserId(loginUserApplet.getUserid());
        goodsBargainPriceService.save(goodsBargainPrice);
        saveGoodsBargainPriceDetail(goodsBargainPrice);
        return R.ok();
    }
    private void saveGoodsBargainPriceDetail(@RequestBody GoodsBargainPrice goodsBargainPrice) {
        List<GoodsBargainPriceDetail> goodsBargainPriceDetailList = goodsBargainPrice.getGoodsBargainPriceDetailList();
        if (goodsBargainPriceDetailList == null || goodsBargainPriceDetailList.isEmpty()) {
            throw new RuntimeException("请输入明细");
        }
        for (GoodsBargainPriceDetail goodsBargainPriceDetail : goodsBargainPriceDetailList) {
            goodsBargainPriceDetail.setGoodsBargainPriceId(goodsBargainPrice.getId());
        }
        goodsBargainPriceDetailService.saveBatch(goodsBargainPriceDetailList);
    }
    /**
     * 删除
     */
    @DeleteMapping("/delete")
    @ApiOperation(value = "删除", tags = {"管理后台-商品管理-门店特殊售价-"})
    public R<Void> delete(@ApiParam("id") @RequestParam("id") Integer id) {
        goodsBargainPriceService.removeById(id);
        goodsBargainPriceDetailService.remove(new LambdaQueryWrapper<GoodsBargainPriceDetail>()
                .eq(GoodsBargainPriceDetail::getGoodsBargainPriceId, id));
        return R.ok();
    }
    /**
     * 修改
     */
    @PutMapping("/edit")
    @ApiOperation(value = "修改", tags = {"管理后台-商品管理-门店特殊售价"})
    @Transactional(rollbackFor = Exception.class)
    public R<Void> edit(@RequestBody GoodsBargainPrice goodsBargainPrice) {
        goodsBargainPriceService.updateById(goodsBargainPrice);
        goodsBargainPriceDetailService.remove(new LambdaQueryWrapper<GoodsBargainPriceDetail>()
                .eq(GoodsBargainPriceDetail::getGoodsBargainPriceId, goodsBargainPrice.getId()));
        saveGoodsBargainPriceDetail(goodsBargainPrice);
        return R.ok();
    }
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperation(value = "详情", tags = {"管理后台-商品管理-门店特殊售价"})
    public R<GoodsBargainPrice> detail(@ApiParam("id") @RequestParam("id") Integer id) {
        GoodsBargainPrice goodsBargainPrice = goodsBargainPriceService.getById(id);
        List<GoodsBargainPriceDetail> goodsBargainPriceDetailList = goodsBargainPriceDetailService.list(new LambdaQueryWrapper<GoodsBargainPriceDetail>()
                .eq(GoodsBargainPriceDetail::getGoodsBargainPriceId, id));
        goodsBargainPrice.setGoodsBargainPriceDetailList(goodsBargainPriceDetailList);
        return R.ok(goodsBargainPrice);
    }
    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "列表", tags = {"管理后台-商品管理-门店特殊售价"})
    public R<Page<GoodsBargainPrice>> list(@ApiParam("页码") @RequestParam(value = "pageNum", required = false) Integer pageNum,
                                           @ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                           @ApiParam("商品id") @RequestParam(value = "goodsId", required = false) Integer goodsId,
                                           @ApiParam("商品名称") @RequestParam(value = "goodsName", required = false) String goodsName,
                                           @ApiParam("商品类型") @RequestParam(value = "goodsType", required = false) Integer goodsType,
                                           @ApiParam("所属分类") @RequestParam(value = "categoryId", required = false) Integer categoryId,
                                           @ApiParam("审核状态") @RequestParam(value = "auditStatus", required = false) Integer auditStatus) {
        List<Goods> goodsList = goodsService.list(new LambdaQueryWrapper<Goods>()
                .eq(StringUtils.isNotEmpty(goodsName), Goods::getName, goodsName)
                .eq(goodsType != null, Goods::getType, goodsType)
                .eq(categoryId != null, Goods::getGoodsCategoryId, categoryId));
        List<Integer> goodsIds = goodsList.stream().map(Goods::getId).collect(Collectors.toList());
        if (goodsId != null){
            goodsIds.add(goodsId);
        }
        Page<GoodsBargainPrice> page = goodsBargainPriceService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<GoodsBargainPrice>()
                .eq(!CollectionUtils.isEmpty(goodsIds), GoodsBargainPrice::getGoodsId, goodsId)
                .eq(auditStatus != null, GoodsBargainPrice::getAuditStatus, auditStatus));
        page.getRecords().forEach(goodsBargainPrice -> {
            goodsList.stream()
                    .filter(goods -> goods.getId().equals(goodsBargainPrice.getGoodsId()))
                    .findFirst().ifPresent(g -> {
                        GoodsCategory goodsCategory = goodsCategoryService.getById(g.getGoodsCategoryId());
                        Integer shopId = goodsBargainPrice.getShopId();
                        Shop shop = shopService.getById(shopId);
                        R<AppUser> r = appUserClient.getAppUserByPhone(shop.getPhone());
                        if (R.isError(r)){
                            throw new RuntimeException("获取店长信息失败");
                        }
                        goodsBargainPrice.setOwnerName(r.getData().getName());
                        goodsBargainPrice.setOwnerPhone(shop.getPhone());
                        goodsBargainPrice.setShopName(shop.getName());
                        goodsBargainPrice.setGoodsName(g.getName());
                        goodsBargainPrice.setCategoryName(goodsCategory.getName());
                    });
        });
        return R.ok(page);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
@@ -33,37 +33,37 @@
    @PostMapping("/addGoodsCategory")
    @ApiOperation(value = "添加商品分类", tags = {"管理后台-商品分类"})
    @ApiOperation(value = "商品管理-商品分类-添加", tags = {"管理后台"})
    public R<Void> addGoodsCategory(@RequestBody GoodsCategory goodsCategory){
        goodsCategoryService.save(goodsCategory);
        return R.ok();
    }
    @PutMapping("/updateGoodsCategory")
    @ApiOperation(value = "修改商品分类", tags = {"管理后台-商品分类"})
    @ApiOperation(value = "商品管理-商品分类-修改", tags = {"管理后台"})
    public R<Void> updateGoodsCategory(@RequestBody GoodsCategory goodsCategory){
        goodsCategoryService.updateById(goodsCategory);
        return R.ok();
    }
    @GetMapping("/getGoodsCategoryById")
    @ApiOperation(value = "商品分类详情", tags = {"管理后台-商品分类"})
    @ApiOperation(value = "商品管理-商品分类-详情", tags = {"管理后台"})
    public R<GoodsCategory> getGoodsCategoryById(@RequestParam("id") Integer id){
        return R.ok(goodsCategoryService.getById(id));
    }
    @GetMapping("/getList")
    @ApiOperation(value = "商品分类列表", tags = {"管理后台-商品分类"})
    public R<Page<GoodsCategory>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize, GoodsCategory goodsCategory){
    @ApiOperation(value = "商品管理-商品分类-列表", tags = {"管理后台"})
    public R<Page<GoodsCategory>> list(@ApiParam("页码") @RequestParam Integer pageNum,@ApiParam("每一页数据大小") Integer pageSize, GoodsCategory goodsCategory){
        Page<GoodsCategory> page = goodsCategoryService.lambdaQuery()
                .like(StringUtils.isNotEmpty(goodsCategory.getName()),GoodsCategory::getName, goodsCategory.getName())
                .page(Page.of(PageNum, pageSize));
                .page(Page.of(pageNum, pageSize));
        return R.ok(page);
    }
    @DeleteMapping("/delete")
    @ApiOperation(value = "删除商品分类", tags = {"管理后台-商品分类"})
    @ApiOperation(value = "商品管理-商品分类-删除", tags = {"管理后台"})
    public R<Void> delete(@RequestParam("id") Integer id){
        goodsCategoryService.removeById(id);
        return R.ok();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -26,7 +28,7 @@
 */
@RestController
@RequestMapping("/goods")
@Api(tags = "商品")
@Api("商品")
public class GoodsController extends BaseController {
    @Resource
    private GoodsService goodsService;
@@ -35,8 +37,49 @@
     * 添加商品
     */
    @PostMapping("/addGoods")
    @ApiOperation(value = "添加商品", tags = {"管理后台-发布商品"})
    @ApiOperation(value = "发布商品", tags = {"管理后台-商品管理"})
    public R<Void> addGoods(@RequestBody Goods goods) {
        goodsService.addGoods(goods);
        return R.ok();
    }
    /**
     * 管理后台商品列表
     */
    @GetMapping("/manageGoodsList")
    @ApiOperation(value = "商品列表", tags = {"管理后台-商品管理"})
    public R<IPage<Goods>> manageGoodsList(@ApiParam("页码") @RequestParam Integer pageNum,
                                           @ApiParam("每一页数据大小") Integer pageSize,
                                           Goods goods){
        return R.ok(goodsService.getManageGoodsList(new Page<>(pageNum, pageSize), goods));
    }
    /**
     * 后台商品详情
     */
    @GetMapping("/manageGoodsDetail/{goodsId}")
    @ApiOperation(value = "商品详情", tags = {"管理后台-商品管理"})
    public R<Goods> manageGoodsDetail(@PathVariable("goodsId") Long goodsId){
        return R.ok(goodsService.getManageGoodsDetail(goodsId));
    }
    /**
     * 后台商品修改
     */
    @PutMapping("/manageGoodsUpdate")
    @ApiOperation(value = "商品修改", tags = {"管理后台-商品管理"})
    public R<Void> manageGoodsUpdate(@RequestBody Goods goods){
        goodsService.updateManageGoods(goods);
        return R.ok();
    }
    /**
     * 后台商品删除
     */
    @DeleteMapping("/manageGoodsDelete/{goodsId}")
    @ApiOperation(value = "商品删除", tags = {"管理后台-商品管理"})
    public R<Void> manageGoodsDelete(@PathVariable("goodsId") Long goodsId){
        goodsService.removeById(goodsId);
        return R.ok();
    }
@@ -46,7 +89,7 @@
     * 商品列表
     */
    @GetMapping("/goodsList")
    @ApiOperation(value = "商品列表", tags = {"小程序-商城-首页-热门商品列表", "首页热门商品-小程序"})
    @ApiOperation(value = "热门商品列表", tags = {"小程序-商城-首页", "小程序-首页"})
    public R<TableDataInfo> goodsList(Goods goods){
        startPage();
        return R.ok(getDataTable(goodsService.goodsList(goods)));
@@ -57,7 +100,7 @@
     * 指定门店商品
     */
    @GetMapping("/getGoodsListByShopId")
    @ApiOperation(value = "商品列表", tags = {"小程序-首页-门店详情-商品购买列表"})
    @ApiOperation(value = "商品购买列表", tags = {"小程序-首页-门店详情"})
    public R<TableDataInfo> getGoodsListByShopId(@ApiParam("门店id") @RequestParam Integer shopId) {
        startPage();
        return R.ok(getDataTable(goodsService.getGoodsListByShopId(shopId)));
@@ -68,7 +111,7 @@
     * 商品详情
     */
    @GetMapping("/goodsDetail/{goodsId}")
    @ApiOperation(value = "商品详情", tags = {"小程序-商城-首页-商品详情"})
    @ApiOperation(value = "商品详情", tags = {"小程序-商城-首页"})
    public R<GoodsVO> goodsDetail(@PathVariable("goodsId") Long goodsId){
        return R.ok(goodsService.goodsDetail(goodsId));
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -2,9 +2,11 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsEvaluate;
@@ -19,7 +21,6 @@
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -59,7 +60,7 @@
     * 发布商品评价
     */
    @PostMapping("/addGoodsEvaluate")
    @ApiOperation(value = "发布商品评价", tags = {"小程序-发布商品评价"})
    @ApiOperation(value = "发布商品评价", tags = {"小程序-个人中心-我的订单"})
    public R<Void> addGoodsEvaluate(@RequestBody GoodsEvaluateVO goodsEvaluateVO){
        goodsEvaluateService.addGoodsEvaluate(goodsEvaluateVO);
        return R.ok();
@@ -84,5 +85,69 @@
        return R.ok(list);
    }
    /**
     * 删除评论
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除评论", tags = {"管理后台-商品管理-评价管理"})
    public R<Void> delete(@PathVariable("id") Long id){
        goodsEvaluateService.removeById(id);
        return R.ok();
    }
    /**
     * 评论列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "评论列表", tags = {"管理后台-商品管理-评价管理"})
    public R<List<GoodsEvaluate>> list(GoodsEvaluate goodsEvaluate){
        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery()
                .like(StringUtils.isNotEmpty(goodsEvaluate.getGoodsName()),GoodsEvaluate::getGoodsName, goodsEvaluate.getComment())
                .like(StringUtils.isNotEmpty(goodsEvaluate.getUserName()),GoodsEvaluate::getUserName, goodsEvaluate.getUserName())
                .like(StringUtils.isNotEmpty(goodsEvaluate.getPhone()),GoodsEvaluate::getPhone, goodsEvaluate.getPhone())
                .eq(goodsEvaluate.getStatus()!=null,GoodsEvaluate::getStatus, goodsEvaluate.getStatus())
                .orderByDesc(GoodsEvaluate::getCreateTime)
                .list();
        list.forEach(this::buildDetail);
        return R.ok(list);
    }
    private void buildDetail(GoodsEvaluate item) {
        AppUser appUser = appUserClient.getAppUserById(item.getAppUserId());
        if (appUser == null){
            throw new RuntimeException("获取用户信息失败");
        }
        Goods goods = goodsService.getById(item.getGoodsId());
        item.setGoodsName(goods.getName());
        item.setPhone(appUser.getPhone());
        item.setUserName(appUser.getName());
    }
    /**
     * 评论详情
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理"})
    public R<GoodsEvaluate> getDetail(@PathVariable("id") Long id){
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
        buildDetail(goodsEvaluate);
        return R.ok(goodsEvaluate);
    }
    /**
     * 评论上/下架
     */
    @PutMapping("/changeStatus")
    @ApiOperation(value = "上/下架", tags = {"管理后台-商品管理-评价管理"})
    public R<Void> changeStatus(@RequestBody GoodsEvaluate goodsEvaluate){
        goodsEvaluateService.update(new LambdaUpdateWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getId, goodsEvaluate.getId())
                .set(GoodsEvaluate::getStatus, goodsEvaluate.getStatus()));
        return R.ok();
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java
@@ -2,12 +2,21 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.other.api.domain.OrderActivityInfo;
import com.ruoyi.other.service.OrderActivityInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -19,6 +28,7 @@
 */
@RestController
@RequestMapping("/order-activity-info")
@Api("订单优惠活动")
public class OrderActivityInfoController {
    @Resource
@@ -37,7 +47,63 @@
                .last(" and now() between start_time and end_time and FIND_IN_SET(" + vip + ", vip_ids) limit 0, 1"));
        return R.ok(one);
    }
    /**
     * 添加活动
     */
    @PostMapping("/save")
    @ApiOperation(value = "添加活动", tags = {"管理后台-活动管理-订单优惠活动"})
    public R<Void> saveActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){
        orderActivityInfoService.save(orderActivityInfo);
        return R.ok();
    }
    /**
     * 删除活动
     */
    @PostMapping("/delete")
    @ApiOperation(value = "删除活动", tags = {"管理后台-活动管理-订单优惠活动-"})
    public R<Void> deleteActivityConfig(@RequestParam("id") Long id){
        orderActivityInfoService.removeById(id);
        return R.ok();
    }
    /**
     * 修改活动
     */
    @PostMapping("/update")
    @ApiOperation(value = "修改活动", tags = {"管理后台-活动管理-订单优惠活动-"})
    public R<Void> updateActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){
        orderActivityInfoService.updateById(orderActivityInfo);
        return R.ok();
    }
    /**
     * 获取活动列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "获取活动列表", tags = {"管理后台-活动管理-订单优惠活动"})
    public R<Page<OrderActivityInfo>> list(@ApiParam("页码") @RequestParam Integer pageNum,
                                     @ApiParam("每一页数据大小") Integer pageSize,
                                     OrderActivityInfo orderActivityInfo){
        return R.ok(orderActivityInfoService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<OrderActivityInfo>()
                .eq(orderActivityInfo.getId() != null, OrderActivityInfo::getId, orderActivityInfo.getId())
                .eq(StringUtils.isNotEmpty(orderActivityInfo.getActivityName()), OrderActivityInfo::getActivityName, orderActivityInfo.getActivityName())
                .lt(orderActivityInfo.getStatus() == 0, OrderActivityInfo::getStartTime, orderActivityInfo.getStartTime())
                .ge(orderActivityInfo.getStatus() == 1, OrderActivityInfo::getEndTime, orderActivityInfo.getStartTime())
                .eq(orderActivityInfo.getIsShelf() != null, OrderActivityInfo::getIsShelf, orderActivityInfo.getIsShelf())));
    }
    /**
     * 获取活动详情
     */
    @GetMapping("/getDetailById")
    @ApiOperation(value = "获取活动详情", tags = {"管理后台-活动管理-订单优惠活动"})
    public R<OrderActivityInfo> getDetailById(@RequestParam("id") Long id){
        return R.ok(orderActivityInfoService.getById(id));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/PhoneController.java
@@ -46,7 +46,7 @@
     * 查询指定门店手机号
     */
    @GetMapping("/selectPhoneByShopId")
    @ApiOperation(value = "查询指定门店手机号", tags = {"小程序-门店详情-查询客服电话"})
    @ApiOperation(value = "查询指定门店手机号", tags = {"小程序-首页-门店详情"})
    public R<List<Phone>> getPhoneByShopId(@ApiParam("门店id") @RequestParam Integer shopId) {
        return R.ok(phoneService.list(new LambdaQueryWrapper<Phone>()
                .eq(Phone::getType, PhoneType.SHOP.getCode())
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java
@@ -29,7 +29,7 @@
 * @author luodangjia
 * @since 2024-11-20
 */
@Api(tags = "秒杀活动信息")
@Api("秒杀活动信息")
@RestController
@RequestMapping("/seckill-activity-info")
public class SeckillActivityInfoController extends BaseController {
@@ -47,7 +47,7 @@
     * 秒杀活动列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页-秒杀活动列表"})
    @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页"})
    public R<TableDataInfo> list(Goods goods)
    {
        startPage();
@@ -58,7 +58,7 @@
     * 秒杀活动详情
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "秒杀活动详情", tags = {"小程序-商城-首页-秒杀活动列表-秒杀活动详情"})
    @ApiOperation(value = "秒杀活动详情", tags = {"小程序-商城-首页"})
    public R<SeckillActivityDetailVO> detail(@PathVariable("id") Integer id)
    {
        return R.ok(seckillActivityInfoService.detail(id));
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -33,7 +33,7 @@
 * @author luodangjia
 * @since 2024-11-20
 */
@Api(tags = "分享")
@Api("分享")
@RestController
@RequestMapping("/share")
public class ShareController extends BaseController {
@@ -49,7 +49,7 @@
    /**
     * 分享列表
     */
    @ApiOperation(value = "分享列表", tags = {"小程序-个人中心-门店管理-分享列表"})
    @ApiOperation(value = "分享列表", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "对象id(addType=1:平台添加,addType=2:推广人添加,addType=3:门店添加)", name = "objectId", required = true, dataType = "int"),
    })
@@ -73,7 +73,7 @@
    /**
     * 分享添加
     */
    @ApiOperation(value = "分享添加", tags = {"小程序-个人中心-门店管理-分享添加"})
    @ApiOperation(value = "分享添加", tags = {"小程序-个人中心-门店管理"})
    @PostMapping
    public R<Void> add(@RequestBody Share share){
        Long userid = tokenService.getLoginUserApplet().getUserid();
@@ -92,7 +92,7 @@
    /**
     * 分享删除
     */
    @ApiOperation(value = "分享删除", tags = {"小程序-个人中心-门店管理-分享删除-小程序"})
    @ApiOperation(value = "分享删除", tags = {"小程序-个人中心-门店管理"})
    @DeleteMapping
    public R<Void> delete(@RequestBody Share share){
        shareService.removeById(share);
@@ -102,7 +102,7 @@
    /**
     * 分享编辑
     */
    @ApiOperation(value = "分享编辑", tags = {"小程序-个人中心-门店管理-分享编辑-小程序"})
    @ApiOperation(value = "分享编辑", tags = {"小程序-个人中心-门店管理"})
    @PutMapping
     public R<Void> edit(@RequestBody Share share){
        share.setAuditStatus(ShareAuditStatus.WAIT.getCode());
@@ -113,14 +113,14 @@
    /**
     * 分享详情
     */
    @ApiOperation(value = "分享详情", tags = {"小程序-个人中心-门店管理-分享详情-小程序"})
    @ApiOperation(value = "分享详情", tags = {"小程序-个人中心-门店管理"})
    @GetMapping("/detail/{id}")
    public R<Share> detail(@PathVariable("id") Integer id){
        return R.ok(shareService.getById(id));
    }
    @ApiOperation(value = "添加", tags = {"后台-分享管理"})
    @ApiOperation(value = "广告管理-分享管理-添加", tags = {"管理后台"})
    @PostMapping("/manage/add")
    public R<Void> manage(@RequestBody Share share){
        LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -133,7 +133,7 @@
        return R.ok();
    }
    @ApiOperation(value = "编辑", tags = {"后台-分享管理"})
    @ApiOperation(value = "广告管理-分享管理-编辑", tags = {"管理后台"})
    @PostMapping("/manage/edit")
    public R<Void> manageedit(@RequestBody Share share){
@@ -141,7 +141,7 @@
        return R.ok();
    }
    @ApiOperation(value = "删除", tags = {"后台-分享管理"})
    @ApiOperation(value = "广告管理-分享管理-删除", tags = {"管理后台"})
    @GetMapping("/manage/delete")
    public R<Void> managedelete(@RequestParam Integer id){
@@ -149,14 +149,14 @@
        return R.ok();
    }
    @ApiOperation(value = "列表", tags = {"后台-分享管理"})
    @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().eq(Share::getAuditStatus,1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageSize, pageSize));
        return R.ok(page);
    }
    @ApiOperation(value = "设为小程序分享", tags = {"后台-分享管理"})
    @ApiOperation(value = "广告管理-分享管理-设为小程序分享", tags = {"管理后台"})
    @GetMapping("/manage/set")
    public R<Void> set(@RequestParam Integer id){
        //将所有分享设为不是小程序分享
@@ -175,7 +175,7 @@
    }
    @ApiOperation(value = "列表", tags = {"后台-分享管理-审核"})
    @ApiOperation(value = "广告管理-分享管理-审核列表", tags = {"管理后台"})
    @GetMapping("/manage/auth/list")
    public R<Page<Share>> authmanagelist(String name,Integer addType,@RequestParam Integer pageNum,Integer pageSize){
        Page<Share> page = shareService.lambdaQuery().ne(Share::getAuditStatus,1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize));
@@ -194,10 +194,6 @@
        }
        return R.ok(page);
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -2,30 +2,34 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.AppUserShop;
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.Shop;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.enums.ShopStatus;
import com.ruoyi.other.service.ShopScoreService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.service.TechnicianService;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.ShopDetailVO;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
 * <p>
@@ -37,10 +41,8 @@
 */
@RestController
@RequestMapping("/shop")
@Api(tags = "门店")
@Api("门店")
public class ShopController extends BaseController {
    @Resource
    private TechnicianService technicianService;
    @Resource
    private ShopService shopService;
    @Resource
@@ -52,10 +54,79 @@
    @PostMapping("/getDetailById")
    @PostMapping
    @ApiOperation(value = "新增门店", tags = {"管理后台-门店管理"})
    @Transactional(rollbackFor = Exception.class)
    public R<Void> add(@RequestBody Shop shop){
        String phone = shop.getPhone();
        if (!shopService.cheUserByPhone(phone)) {
            return R.fail("该手机号未注册");
        }
        shop.setShopAllPoint(0);
        shop.setShopPoint(0);
        shop.setSharePoint(0);
        shop.setServerPoint(0);
        shop.setLowerLevelRebatePoints(0);
        shop.setUsePoint(0);
        shop.setGiveawayAllMoney(BigDecimal.ZERO);
        shop.setGiveawayMoney(BigDecimal.ZERO);
        shop.setLowerLevelGiveawayMoney(BigDecimal.ZERO);
        shop.setServerGiveawayMoney(BigDecimal.ZERO);
        shop.setCanWithdrawMoney(BigDecimal.ZERO);
        shop.setWithdrawMoney(BigDecimal.ZERO);
        shop.setOrderNumber(0);
        shop.setServerOrderNumber(0);
        shop.setCustomOrderNumber(0);
        shopService.save(shop);
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        AppUserShop appUserShop = new AppUserShop();
        appUserShop.setAppUserId(loginUserApplet.getUserid());
        appUserShop.setShopId(shop.getId());
        R<Void> r = appUserClient.addAppUserShop(appUserShop);
        if (R.isError(r)){
            throw new RuntimeException("添加失败");
        }
        return R.ok();
    }
    @GetMapping("/getDetailById")
    @ApiOperation(value = "门店详情", tags = {"管理后台-门店管理"})
    public R<Shop> getDetailById(@RequestParam("id") Long id){
        Shop byId = shopService.getById(id);
        return R.ok(byId);
    }
    @DeleteMapping("/deleteShop")
    @ApiOperation(value = "删除门店", tags = {"管理后台-门店管理"})
    public R<Void> deleteShop(@ApiParam("门店id") @RequestParam("id") Integer id){
        shopService.removeById(id);
        return R.ok();
    }
    @PutMapping("/editShop")
    @ApiOperation(value = "门店管理-编辑门店", tags = {"管理后台"})
    public R<Void> editShop(@RequestBody Shop shop){
        shopService.updateById(shop);
        return R.ok();
    }
    @GetMapping("/list")
    @ApiOperation(value = "门店列表", tags = {"管理后台-门店管理"})
    public R<IPage<Shop>> list(@ApiParam("页码") @RequestParam Integer pageNum,@ApiParam("每一页数据大小") Integer pageSize,Shop shop){
        IPage<Shop> shopIPage = shopService.getShopList(pageNum, pageSize, shop);
        return R.ok(shopIPage);
    }
    /**
     * 通过手机号校验店长
     */
    @PostMapping("/cheUserByPhone")
    @ApiOperation(value = "通过手机号校验店长", tags = {"管理后台-门店管理"})
    public R<Boolean> cheUserByPhone(@RequestParam("phone") String phone) {
        return R.ok(shopService.cheUserByPhone(phone));
    }
@@ -63,7 +134,7 @@
     * 附近门店列表
     */
    @GetMapping("/nearbyShopList")
    @ApiOperation(value = "附近门店列表", tags = {"小程序-首页-附近门店列表"})
    @ApiOperation(value = "附近门店列表", tags = {"小程序-首页"})
    public R<List<NearbyShopVO>> nearbyShopList(@ApiParam("经度") @RequestParam BigDecimal longitude,
                                                @ApiParam("纬度") @RequestParam BigDecimal latitude) {
        return R.ok(shopService.nearbyShopList(longitude, latitude));
@@ -71,7 +142,7 @@
    @GetMapping("/shopDetail")
    @ApiOperation(value = "门店详情", tags = {"小程序-首页-门店详情"})
    @ApiOperation(value = "门店详情", tags = {"小程序-首页"})
    public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId,
                                      @ApiParam("经度") @RequestParam BigDecimal longitude,
                                      @ApiParam("纬度") @RequestParam BigDecimal latitude) {
@@ -82,19 +153,23 @@
     * 查询当前店长所属门店
     */
    @GetMapping("/shopByUser")
    @ApiOperation(value = "查询当前店长所属门店", tags = {"小程序-个人中心-首页"}, notes = "可绑定的门店列表")
    @ApiOperation(value = "查询当前店长所属门店", tags = {"小程序-个人中心"}, notes = "可绑定的门店列表")
    public R<List<Shop>> shopByUser() {
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>()
                .eq(Shop::getAppUserId, SecurityUtils.getUserId())
                .eq(Shop::getStatus, ShopStatus.SHOP_STATUS_NORMAL.getCode()));
        return R.ok(list);
        R<List<AppUserShop>> r = appUserClient.getAppUserShop(SecurityUtils.getUserId());
        if (R.isSuccess(r)){
            List<AppUserShop> appUserShopList = r.getData();
            List<Integer> shopIds = appUserShopList.stream().map(AppUserShop::getShopId).collect(Collectors.toList());
            List<Shop> shopList = shopService.listByIds(shopIds);
            return R.ok(shopList);
        }
        return R.ok(new ArrayList<>());
    }
    /**
     * 绑定门店
     */
    @GetMapping("/bindShop")
    @ApiOperation(value = "绑定门店", tags = {"小程序-个人中心-绑定门店"})
    @ApiOperation(value = "绑定门店", tags = {"小程序-个人中心"})
    public R<Void> bindShop(@ApiParam("门店id") @RequestParam Long shopId) {
        AppUser appUser = appUserClient.getAppUserById(SecurityUtils.getUserId());
        appUser.setShopId(shopId);
@@ -106,7 +181,7 @@
     * @return
     */
    @PostMapping("/shopScore")
    @ApiOperation(value = "门店打分", tags = {"小程序-个人中心-门店打分"})
    @ApiOperation(value = "门店打分", tags = {"小程序-个人中心"})
    public R<Void> shopScore(@RequestBody ShopScore shopScore) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        shopScore.setAppUserId(loginUserApplet.getUserid());
@@ -148,5 +223,12 @@
        return R.ok(list);
    }
    @GetMapping("/getShopIdByName")
    R<Set<Integer>> getShopIdByName(@RequestParam String shopName){
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>()
                .like(Shop::getName, shopName));
        return R.ok(list.stream().map(Shop::getId).collect(Collectors.toSet()));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java
@@ -6,6 +6,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.SystemConfig;
import com.ruoyi.other.api.dto.IndexConfigSetDto;
import com.ruoyi.other.api.dto.LogisticsSetDto;
import com.ruoyi.other.api.dto.StartPageSetDto;
import com.ruoyi.other.service.SystemConfigService;
import org.springframework.web.bind.annotation.*;
@@ -28,7 +29,7 @@
    @Resource
    private SystemConfigService systemConfigService;
    @PostMapping("/index/add")
    @ApiOperation(value = "添加", tags = {"后台-广告管理-首页配置"})
    @ApiOperation(value = "广告管理-首页配置-添加", tags = {"管理后台"})
    public R add(@RequestBody IndexConfigSetDto indexConfigSetDto){
        //先删除type=2的数据
        List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).list();
@@ -40,7 +41,7 @@
        return R.ok();
      }
    @GetMapping("/index/detail")
    @ApiOperation(value = "宣传图片-公司简介", tags = {"后台-广告管理-首页配置","小程序-首页"})
    @ApiOperation(value = "广告管理-首页配置-宣传图片-公司简介", tags = {"管理后台","小程序-首页"})
    public R<IndexConfigSetDto> detail(){
        SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).one();
        if (one==null){
@@ -77,7 +78,7 @@
    }
    @PostMapping("/startPage/add")
    @ApiOperation(value = "添加", tags = {"后台-广告管理-启动页管理"})
    @ApiOperation(value = "广告管理-启动页管理-添加", tags = {"管理后台"})
    public R startPageadd(@RequestBody StartPageSetDto startPageSetDto){
        //先删除type=1的数据
        List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).list();
@@ -89,6 +90,35 @@
        return R.ok();
    }
    /**
     * 订单包邮设置
     */
    @PostMapping("/logistics/add")
    @ApiOperation(value = "添加", tags = {"管理后台-商品管理-订单包邮设置"})
    public R add(@RequestBody LogisticsSetDto logisticsSetDto){
        List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 3).list();
        systemConfigService.removeBatchByIds(list);
        SystemConfig  systemConfig = new SystemConfig();
        systemConfig.setType(3);
        systemConfig.setContent(JSON.toJSONString(logisticsSetDto));
        systemConfigService.save(systemConfig);
        return R.ok();
    }
    /**
     * 获取订单包邮设置
     */
    @GetMapping("/logistics/detail")
    @ApiOperation(value = "订单包邮设置", tags = {"管理后台-商品管理-订单包邮设置"})
    public R<LogisticsSetDto> logisticsDetail(){
        SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 3).one();
        if (one==null){
            return R.ok();
        }
        LogisticsSetDto logisticsSetDto = JSONObject.parseObject(one.getContent(), LogisticsSetDto.class);
        return R.ok(logisticsSetDto);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -29,7 +29,7 @@
 */
@RestController
@RequestMapping("/technician")
@Api(tags = "技师")
@Api("技师")
public class TechnicianController extends BaseController {
    @Resource
    private TechnicianService technicianService;
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -26,7 +26,7 @@
 * @author luodangjia
 * @since 2024-11-20
 */
@Api(tags = "技师预约管理")
@Api("技师预约管理")
@RestController
@RequestMapping("/technician-subscribe")
public class TechnicianSubscribeController extends BaseController {
@@ -38,11 +38,11 @@
     */
    @GetMapping("/list")
    @ApiOperation(value = "预约列表", notes = "预约列表", tags = {"小程序-个人中心-门店管理-预约列表"})
    public TableDataInfo<TechnicianSubscribeVO> list(@ApiParam(value = "状态") @RequestParam Integer status,
    public TableDataInfo<TechnicianSubscribeVO> list(@ApiParam(value = "状态") Integer status,
                              @ApiParam(value = "门店id") @RequestParam Long shopId) {
        startPage();
        List<TechnicianSubscribeVO> list = technicianSubscribeService
                .getTechnicianSubscribeByUserAndShop(SecurityUtils.getUserId(), shopId);
                .getTechnicianSubscribeByUserAndShop(shopId,status);
        return getDataTable(list);
    }
@@ -50,7 +50,7 @@
     * 预约技师
     */
    @PostMapping("/subscribe")
    @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表-预约技师"})
    @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表"})
    public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) {
        technicianSubscribeService.subscribe(technicianSubscribe);
        return R.ok();
@@ -60,7 +60,7 @@
     * 取消服务
     */
    @GetMapping("/cancel")
    @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理-预约列表-取消服务"})
    @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理,小程序-个人中心-我的预约"})
    public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id) {
        TechnicianSubscribe subscribe = technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>()
@@ -103,14 +103,6 @@
                                                 @ApiParam(hidden = true) Page<TechnicianSubscribe> page) {
        return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status));
    }
    @GetMapping("/getSubscribeByOrderId")
    @ApiOperation(value = "根据订单id获取预约信息", notes = "根据订单id获取预约信息", tags = {"后台-技师预约管理-根据订单id获取预约信息"})
    public R<TechnicianSubscribe> getSubscribeByOrderId(@ApiParam(value = "订单id") @RequestParam Long orderId) {
        return R.ok(technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>()
                .eq(TechnicianSubscribe::getOrderId, orderId)));
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/VipSettingController.java
@@ -111,6 +111,22 @@
        return R.ok(vipSettingService.getById(id));
    }
    /**
     * 查询会员配置
     * @param id
     * @return
     */
    @PostMapping("/getVipSetting")
    public R<VipSetting> getVipSetting(@RequestParam("id") Integer id) {
        return R.ok(vipSettingService.getById(id));
    }
    @GetMapping("/list")
    public R<List<VipSetting>> getList(){
        return R.ok(vipSettingService.list());
    }
    @GetMapping("/manage/info")
    @ApiOperation(value = "查询", tags = {"后台-会员设置"})
    public R<VipSetDto> managesetinfo() {
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/TechnicianStatus.java
@@ -6,7 +6,8 @@
public enum TechnicianStatus {
    UNSUBSCRIBE(0, "待服务"),
    SERVE(1, "已服务"),
    CANCEL(2, "已取消");
    CANCEL(2, "已取消"),
    EXPIRED(3, "已到期");
    private final Integer code;
    private final String message;
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java
@@ -1,6 +1,7 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.other.api.domain.Goods;
import org.apache.ibatis.annotations.Param;
@@ -16,4 +17,6 @@
 */
public interface GoodsMapper extends BaseMapper<Goods> {
    List<Goods> selectListByShopId(@Param("shopId") Integer shopId,@Param("vip") Integer vip);
    IPage<Goods> selectManageGoodsList(@Param("page") IPage<Goods> page, @Param("goods") Goods goods);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
@@ -1,6 +1,8 @@
package com.ruoyi.other.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.ShopDetailVO;
@@ -19,6 +21,8 @@
 */
public interface ShopMapper extends BaseMapper<Shop> {
    IPage<Shop> selectShopList(@Param("page") Page<Shop> page,@Param("shop") Shop shop);
    List<NearbyShopVO> selectNearbyShopList(@Param("longitude") BigDecimal longitude,@Param("latitude") BigDecimal latitude);
    ShopDetailVO selectShopDetail(Integer shopId);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java
@@ -24,8 +24,9 @@
     * @param shopId
     * @return
     */
    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(@Param("userId") Long userId,
                                                                           @Param("shopId") Long shopId);
    List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(
                                                                    @Param("shopId") Long shopId,
                                                                    @Param("status") Integer status);
    IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(@Param("page") Page<TechnicianSubscribe> page, @Param("userId") Long userId,
                                       @Param("status") Integer status);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java
@@ -1,5 +1,7 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.vo.GoodsVO;
@@ -21,4 +23,12 @@
    GoodsVO goodsDetail(Long goodsId);
    List<Goods> getGoodsListByShopId(Integer shopId);
    void addGoods(Goods goods);
    void updateManageGoods(Goods goods);
    IPage<Goods> getManageGoodsList(Page<Goods> page, Goods goods);
    Goods getManageGoodsDetail(Long goodsId);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java
@@ -1,16 +1,19 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.ShopDetailVO;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.util.List;
/**
 * <p>
 *  服务类
 * 服务类
 * </p>
 *
 * @author luodangjia
@@ -18,8 +21,12 @@
 */
public interface ShopService extends IService<Shop> {
    IPage<Shop> getShopList(Integer PageNum, Integer pageSize, Shop shop);
    List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude);
    ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude);
    Boolean cheUserByPhone(String phone);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java
@@ -21,7 +21,7 @@
    /**
     * 查询用于指定门店的相关预约记录
     */
    List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId);
    List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long shopId, Integer status);
    IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -1,29 +1,34 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
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.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.vo.Price;
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;
import com.ruoyi.other.service.*;
import com.ruoyi.other.vo.GoodsVO;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -53,7 +58,15 @@
    @Resource
    private GoodsShopMapper goodsShopMapper;
    @Resource
    private GoodsShopService goodsShopService;
    @Resource
    private GoodsAppUserService goodsAppUserService;
    @Resource
    private ShopMapper shopMapper;
    @Resource
    private GoodsAreaService goodsAreaService;
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @Override
    public List<GoodsVO> goodsList(Goods search) {
@@ -63,11 +76,18 @@
                .like(StringUtils.isNotEmpty(search.getName()), Goods::getName, search.getName()));
        List<GoodsVO> result = new ArrayList<>();
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        for (Goods goods : goodsList) {
            GoodsVO goodsVO = new GoodsVO();
            BeanUtils.copyBeanProp(goodsVO, goods);
            goodsVO.setGoodsId(goods.getId());
            goodsVO.setGoodsName(goods.getName());
            R<Price> r = remoteOrderGoodsClient.getGoodsPrice(loginUserApplet.getUserid(), goods.getId(), null);
            if (R.isSuccess(r)){
                Price price = r.getData();
                goodsVO.setSellingPrice(price.getCash());
                goodsVO.setIntegral(price.getPoint());
            }
            result.add(goodsVO);
        }
        return result;
@@ -131,4 +151,87 @@
        return goodsMapper.selectListByShopId(shopId, vipSetting.getId());
    }
    @Override
    public IPage<Goods> getManageGoodsList(Page<Goods> page, Goods goods) {
        return goodsMapper.selectManageGoodsList(page, goods);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addGoods(Goods goods) {
        goods.setSaleNum(0);
        goods.setStatus(GoodsStatus.DOWN.getCode());
        goodsMapper.insert(goods);
        // 指定门店
        Integer appointStore = goods.getAppointStore();
        if (appointStore == 1){
            List<GoodsShop> goodsShopList = goods.getGoodsShopList();
            if (CollectionUtils.isEmpty(goodsShopList)){
                throw new NullPointerException("请选择指定门店");
            }
            goodsShopService.saveBatch(goodsShopList);
        }
        // 指定用户
        List<GoodsAppUser> goodsAppUserList = goods.getGoodsAppUserList();
        if (!CollectionUtils.isEmpty(goodsAppUserList)){
            goodsAppUserService.saveBatch(goodsAppUserList);
        }
        // 会员价格配置
        List<GoodsVip> goodsVipList = goods.getGoodsVipList();
        goodsVipService.saveBatch(goodsVipList);
        // 特殊地区售价设置
        List<GoodsArea> goodsAreaList = goods.getGoodsAreaList();
        if (!CollectionUtils.isEmpty(goodsAreaList)){
            goodsAreaService.saveBatch(goodsAreaList);
        }
    }
    @Override
    public void updateManageGoods(Goods goods) {
        goodsMapper.updateById(goods);
        // 指定门店
        List<GoodsShop> goodsShopList = goods.getGoodsShopList();
        goodsShopService.updateBatchById(goodsShopList);
        // 指定用户
        List<GoodsAppUser> goodsAppUserList = goods.getGoodsAppUserList();
        goodsAppUserService.updateBatchById(goodsAppUserList);
        // 会员价格配置
        List<GoodsVip> goodsVipList = goods.getGoodsVipList();
        goodsVipService.updateBatchById(goodsVipList);
        // 特殊地区售价设置
        List<GoodsArea> goodsAreaList = goods.getGoodsAreaList();
        goodsAreaService.updateBatchById(goodsAreaList);
    }
    @Override
    public Goods getManageGoodsDetail(Long goodsId) {
        Goods goods = getById(goodsId);
        // 指定门店
        List<GoodsShop> goodsShops = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>()
                .eq(GoodsShop::getGoodsId, goodsId));
        goods.setGoodsShopList(goodsShops);
        // 指定用户
        List<GoodsAppUser> goodsAppUserList = goodsAppUserService.list(new LambdaQueryWrapper<GoodsAppUser>()
                .eq(GoodsAppUser::getGoodsId, goodsId));
        goods.setGoodsAppUserList(goodsAppUserList);
        // 会员价格
        List<GoodsVip> goodsVipList = goodsVipService.list(new LambdaQueryWrapper<GoodsVip>()
                .eq(GoodsVip::getGoodsId, goodsId));
        goods.setGoodsVipList(goodsVipList);
        // 特殊地区售价设置
        List<GoodsArea> goodsAreaList = goodsAreaService.list(new LambdaQueryWrapper<GoodsArea>()
                .eq(GoodsArea::getGoodsId, goodsId));
        goods.setGoodsAreaList(goodsAreaList);
        return goods;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -1,12 +1,17 @@
package com.ruoyi.other.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.GeodesyUtil;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.service.ShopScoreService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.NearbyShopVO;
@@ -35,6 +40,18 @@
    private ShopMapper shopMapper;
    @Resource
    private ShopScoreService shopScoreService;
    @Resource
    private AppUserClient appUserClient;
    @Override
    public IPage<Shop> getShopList(Integer PageNum, Integer pageSize, Shop shop) {
        Page<Shop> page = new Page<>();
        page.setCurrent(PageNum);
        page.setSize(pageSize);
        IPage<Shop> shopIPage = shopMapper.selectShopList(page, shop);
        return shopIPage;
    }
    @Override
    public List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude) {
@@ -83,6 +100,12 @@
        return shopDetailVO;
    }
    @Override
    public Boolean cheUserByPhone(String phone) {
        R<AppUser> r = appUserClient.getAppUserByPhone(phone);
        if (R.isError(r)){
            return false;
        }
        return r.getData() != null;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java
@@ -11,10 +11,12 @@
import com.ruoyi.other.mapper.TechnicianSubscribeMapper;
import com.ruoyi.other.service.TechnicianSubscribeService;
import com.ruoyi.other.vo.TechnicianSubscribeVO;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
/**
@@ -31,10 +33,12 @@
    private TechnicianSubscribeMapper technicianSubscribeMapper;
    @Resource
    private RemoteOrderGoodsClient orderGoodsClient;
    @Resource
    private RedisTemplate<String, String> redisTemplate;
    @Override
    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) {
        return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(userId, shopId);
    public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long shopId, Integer status) {
        return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(shopId,status);
    }
    @Override
    public IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status) {
@@ -43,20 +47,17 @@
    @Override
    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){
        Long userId = SecurityUtils.getUserId();
        subscribe.setAppUserId(userId);
        subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode());
        subscribe.setDelFlag(0);
        subscribe.setCreateTime(LocalDateTime.now());
        technicianSubscribeMapper.insert(subscribe);
        if (subscribe.getOrderId() != null){
            orderGoodsClient.subscribe(subscribe.getOrderId(), subscribe.getTechnicianId());
        }
        LocalDateTime subscribeTime = subscribe.getSubscribeTime();
        long deadlineTimestamp = subscribeTime.atZone(ZoneId.systemDefault()).toEpochSecond();
        redisTemplate.opsForZSet().add("delay_queue:subscribe", subscribe.getId().toString(), deadlineTimestamp);
    }
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml
@@ -16,10 +16,44 @@
            t_shop ts
                LEFT JOIN t_goods_shop tgs ON ts.id = tgs.shop_id
                LEFT JOIN t_goods tg ON tg.id = tgs.goods_id
        where ts.id = #{shopId}
        where ts.id = #{shopId} and ts.del_flag = 0
        <if test="vip != null">
            and FIND_IN_SET(#{vip}, commodity_authority) > 0
        </if>
        ORDER BY tg.sale_num DESC
    </select>
    <select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods">
        SELECT
            tg.id,
            tg.`name`,
            tg.type,
            tg.goods_category_id,
            tgc.`name`,
            tg.operating_cost,
            tg.shop_cost,
            tg.`status`
        FROM
            t_goods tg
                LEFT JOIN t_goods_category tgc ON tg.goods_category_id = tgc.id
        <where>
                tg.del_flag = 0
            <if test="goods.id != null">
                <if test="goods.id != null">
                    and tg.id = #{goods.id}
                </if>
                <if test="goods.name != null and goods.name != ''">
                    and tg.`name` like concat('%',#{goods.name},'%')
                </if>
                <if test="goods.type != null">
                    and tg.type = #{goods.type}
                </if>
                <if test="goods.goodsCategoryId != null">
                    and tg.goodsCategoryId = #{goods.goodsCategoryId}
                </if>
                <if test="goods.status != null">
                    and tg.`status` = #{goods.status}
                </if>
            </if>
        </where>
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -16,7 +16,7 @@
            t_seckill_activity_info tsai
                LEFT JOIN t_goods tg ON tsai.good_id = tg.id
                LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id
        WHERE tsai.end_time >= NOW()
        WHERE tsai.end_time >= NOW() AND tsai.del_flag = 0
        <if test="name != null and name != ''">
            AND tg.`name` LIKE concat('%',#{goodsName},'%')
        </if>
@@ -44,6 +44,6 @@
            t_seckill_activity_info tsai
                LEFT JOIN t_goods tg ON tsai.good_id = tg.id
                LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id
        WHERE tsai.id = #{seckillActivityId}
        WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -53,4 +53,32 @@
            ts.longitude,
            ts.latitude
    </select>
    <select id="selectShopList" resultType="com.ruoyi.other.api.domain.Shop">
        SELECT
            ts.id,
            ts.`name`,
            ts.business_date,
            tau.`name` managerName,
            ts.phone,
            ts.address,
            ts.`status`
        FROM
            `qijisheng_other`.t_shop ts
                LEFT JOIN `qijisheng_account`.t_app_user tau ON ts.app_user_id = tau.id
        <where>
            ts.del_flag = 0
            <if test="shop.name != null and shop.name != ''">
                and ts.name like concat('%',#{shop.name},'%')
            </if>
            <if test="shop.managerName != null and shop.managerName != ''">
                and tau.name like concat('%',#{shop.managerName},'%')
            </if>
            <if test="shop.phone != null and shop.phone != ''">
                and ts.phone like concat('%',#{shop.phone},'%')
            </if>
            <if test="shop.status != null and shop.status != ''">
                and ts.status = #{shop.status}
            </if>
        </where>
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml
@@ -4,10 +4,13 @@
    <select id="getTechnicianSubscribeByUserAndShop" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO">
        SELECT
            CAST(tts.id AS CHAR) id,
            tts.user_address,
            ts.`name` shopName,
            ts.address shopAddress,
            tt.name technicianName,
            ts.longitude,
            ts.latitude,
            tts.subscribe_time,
            tts.service_mode,
            tts.status
@@ -16,10 +19,11 @@
                LEFT JOIN t_technician tt ON tts.technician_id = tt.id AND tt.del_flag = 0
                LEFT JOIN t_shop ts ON tt.shop_id = ts.id AND ts.del_flag = 0
        WHERE
           ( (ts.app_user_id = #{userId} AND ts.id = #{shopId})
           OR
            (tt.app_user_id = #{userId} AND ts.id = #{shopId}))
            ts.id = #{shopId}
            AND tts.del_flag = 0
        <if test="status != null">
            AND tts.status = #{status}
        </if>
        ORDER BY tts.create_time DESC
    </select>