无关风月
2025-01-14 4db8023227b3900740b8be361c436ddadb1d0585
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng
95个文件已修改
2个文件已添加
1964 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserShopClientFallbackFactory.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserCouponClientFallbackFactory.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserPointFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserShopClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserCouponClient.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserPointClient.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/BalanceChangeRecord.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/vo/CouponInfoVo.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/CouponInfo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsAppUser.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsClientFallbackFactory.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopBalanceStatementClientFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsClient.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopBalanceStatementClient.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysPasswordService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 160 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AgentApplicationServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserCouponServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/payment/TransferUtil.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/payment/model/SinglePayCallbackResult.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/CommissionDetail.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/NearbyReferrerVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WithdrawalAuth.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserCancellationLogMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 250 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/ExpressDeliveryUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/TaskUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java 22 ●●●● 补丁 | 查看 | 原始文档 | 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/service/impl/GoodsBargainPriceServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/payment/TransferUtil.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/payment/model/SinglePayCallbackResult.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsBargainPriceMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -95,6 +95,11 @@
            }
            @Override
            public R<List<AppUser>> setLowerUserShop(Long userId, Integer shopId) {
                return R.fail();
            }
            @Override
            public List<AppUser> listByIds(List<Long> list) {
                log.error("获取用户失败: "+cause.getMessage());
                return Collections.emptyList();
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserShopClientFallbackFactory.java
@@ -4,6 +4,7 @@
import com.ruoyi.account.api.model.AppUserShop;
import com.ruoyi.common.core.domain.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@@ -26,6 +27,7 @@
                return R.fail("删除用户门店关系数据失败:" + cause.getMessage());
            }
            @PostMapping("/saveAppUserShop/delAppUserShop")
            @Override
            public void saveAppUserShop(AppUserShop appUserShop) {
                R.fail("保存用户门店关系数据失败:" + cause.getMessage());
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserCouponClientFallbackFactory.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.api.factory;
import com.ruoyi.account.api.feignClient.UserCouponClient;
import com.ruoyi.account.api.model.UserCoupon;
import com.ruoyi.account.api.vo.CouponInfoVo;
import com.ruoyi.account.api.vo.PaymentUserCoupon;
import com.ruoyi.account.api.vo.PaymentUserCouponVo;
@@ -32,6 +33,21 @@
            public R<Long> getCouponCount(Integer couponId) {
                return R.fail("根据优惠券id获取优惠券数量失败:" + cause.getMessage());
            }
            @Override
            public R<UserCoupon> getUserCoupon(Long id) {
                return R.fail("获取用户优惠券失败:" + cause.getMessage());
            }
            @Override
            public R editUserCoupon(UserCoupon userCoupon) {
                return R.fail("编辑用户优惠券失败:" + cause.getMessage());
            }
            @Override
            public R editReturnUse(UserCoupon userCoupon) {
                return R.fail("编辑用户优惠券使用时间失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/UserPointFallbackFactory.java
@@ -24,6 +24,11 @@
            public R<List<UserPoint>> getUserPointList(UserPoint userPoint) {
                return R.fail("获取积分变动明细失败:" + cause.getMessage());
            }
            @Override
            public R<Boolean> judgmentDailyShare(Long appUserId) {
                return R.fail("判断当天是否分享获得过积分失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -59,7 +59,7 @@
    R<Long> getVipCount(@RequestParam("userId")Long userId, @RequestParam("vipId") Integer vipId );
    @GetMapping("/app-user/listByIds")
    @PostMapping("/app-user/listByIds")
    List<AppUser> listByIds(@RequestParam("ids") List<Long> list);
    /**
@@ -82,6 +82,14 @@
    @PostMapping("/app-user/getAppUserByPhone1")
    R<AppUser> getAppUserByPhone1(@RequestParam("phone") String phone);
    
    /**
     * 获得指定用户的下级用户
     * @param userId
     * @return
     */
    @PostMapping("/app-user/setLowerUserShop")
    R<List<AppUser>>  setLowerUserShop(@RequestParam("userId") Long userId,@RequestParam("shopId") Integer shopId);
    
    
    /**
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserShopClient.java
@@ -36,6 +36,6 @@
     * 保存关系数据
     * @param appUserShop
     */
    @PostMapping("/saveAppUserShop/delAppUserShop")
    @PostMapping("/appUserShop/saveAppUserShop")
    void saveAppUserShop(@RequestBody AppUserShop appUserShop);
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserCouponClient.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.api.feignClient;
import com.ruoyi.account.api.factory.UserCouponClientFallbackFactory;
import com.ruoyi.account.api.model.UserCoupon;
import com.ruoyi.account.api.vo.CouponInfoVo;
import com.ruoyi.account.api.vo.PaymentUserCoupon;
import com.ruoyi.account.api.vo.PaymentUserCouponVo;
@@ -40,4 +41,31 @@
    @GetMapping("/user-coupon/getCouponCount")
    R<Long> getCouponCount(@RequestParam("couponId") Integer couponId);
    /**
     * 获取用户优惠券
     * @param id
     * @return
     */
    @PostMapping("/user-coupon/getUserCoupon")
    R<UserCoupon> getUserCoupon(@RequestParam("id") Long id);
    /**
     * 编辑用户优惠券
     * @param userCoupon
     * @return
     */
    @PostMapping("/user-coupon/editUserCoupon")
    R editUserCoupon(@RequestBody UserCoupon userCoupon);
    /**
     * 编辑用户优惠券使用时间
     * @param userCoupon
     * @return
     */
    @PostMapping("/user-coupon/editReturnUse")
    R editReturnUse(@RequestBody UserCoupon userCoupon);
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/UserPointClient.java
@@ -7,6 +7,7 @@
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -33,4 +34,13 @@
     */
    @PostMapping("/user-point/getUserPointList")
    R<List<UserPoint>> getUserPointList(@RequestBody UserPoint userPoint);
    /**
     * 判断当天是否分享获得过积分
     * @param appUserId
     * @return
     */
    @PostMapping("/user-point/judgmentDailyShare")
    R<Boolean> judgmentDailyShare(@RequestParam("appUserId") Long appUserId);
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/BalanceChangeRecord.java
@@ -31,6 +31,9 @@
    @ApiModelProperty("用户id")
    private Long appUserId;
    @ApiModelProperty("vip等级id")
    private Integer vipId;
    @ApiModelProperty("订单id")
    private Long orderId;
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserAddress.java
@@ -49,6 +49,30 @@
    @ApiModelProperty(value = "收件人电话")
    @TableField("recieve_phone")
    private String recievePhone;
    @ApiModelProperty(value = "省")
    @TableField("province")
    private String province;
    @ApiModelProperty(value = "省编号")
    @TableField("province_code")
    private String provinceCode;
    @ApiModelProperty(value = "市")
    @TableField("city")
    private String city;
    @ApiModelProperty(value = "市编号")
    @TableField("city_code")
    private String cityCode;
    @ApiModelProperty(value = "区")
    @TableField("district")
    private String district;
    @ApiModelProperty(value = "区编号")
    @TableField("district_code")
    private String districtCode;
    @ApiModelProperty(value = "收件人地址")
    @TableField("recieve_address")
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/vo/CouponInfoVo.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java
@@ -2,6 +2,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.model.Order;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
@@ -29,7 +30,17 @@
            @Override
            public R<Set<Long>> getAppUserByShoppingShop(Integer shopId) {
                return R.fail("获取所有在指定门店消费的用户id失败:" + cause);
                return R.fail("获取所有在指定门店消费的用户id失败:" + cause.getMessage());
            }
            @Override
            public R<Order> getOrderById(Long id) {
                return R.fail("根据id获取订单详情失败:" + cause.getMessage());
            }
            @Override
            public R editOrder(Order order) {
                return R.fail("编辑订单详情失败:" + cause.getMessage());
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java
@@ -4,8 +4,10 @@
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.factory.OrderClientFallbackFactory;
import com.ruoyi.order.model.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -46,4 +48,22 @@
     */
    @PostMapping("/order/getAppUserByShoppingShop")
    R<Set<Long>> getAppUserByShoppingShop(@RequestParam("shopId") Integer shopId);
    /**
     * 根据id获取订单详情
     * @param id
     * @return
     */
    @PostMapping("/order/getOrderById")
    R<Order> getOrderById(@RequestParam("id") Long id);
    /**
     * 编辑订单详情
     * @param order
     * @return
     */
    @PostMapping("/order/editOrder")
    R editOrder(@RequestBody Order order);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java
@@ -43,6 +43,10 @@
    @TableField("order_status")
    private Integer orderStatus;
    @ApiModelProperty(value = "1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价")
    @TableField("old_order_status")
    private Integer oldOrderStatus;
    @ApiModelProperty(value = "是否已分佣: 0-否 1-是")
    @TableField("is_commission")
    private Integer isCommission;
@@ -99,6 +103,10 @@
    @TableField("good_amount")
    private BigDecimal goodAmount;
    @ApiModelProperty(value = "用户优惠券id")
    @TableField("user_coupon_id")
    private Long userCouponId;
    @ApiModelProperty(value = "活动优惠金额")
    @TableField("activity_amount")
    private BigDecimal activityAmount;
@@ -139,6 +147,34 @@
    @TableField("express_json")
    private String expressJson;
    @ApiModelProperty(value = "第三方快递结果")
    @TableField("express_result")
    private String expressResult;
    @ApiModelProperty(value = "发货省")
    @TableField("deliver_province")
    private String deliverProvince;
    @ApiModelProperty(value = "发货省编号")
    @TableField("deliver_province_code")
    private String deliverProvinceCode;
    @ApiModelProperty(value = "发货市")
    @TableField("deliver_city")
    private String deliverCity;
    @ApiModelProperty(value = "发货市编号")
    @TableField("deliver_city_code")
    private String deliverCityCode;
    @ApiModelProperty(value = "发货区")
    @TableField("deliver_district")
    private String deliverDistrict;
    @ApiModelProperty(value = "发货区编号")
    @TableField("deliver_district_code")
    private String deliverDistrictCode;
    @ApiModelProperty(value = "收货地址信息")
    @TableField("address_json")
    private String addressJson;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/CouponInfo.java
@@ -148,6 +148,9 @@
    @TableField(exist = false)
    private List<AppUser> appUserList;
    @TableField(exist = false)
    private String phone;
    public String getIdStr(){
        return String.valueOf(id);
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java
@@ -152,6 +152,18 @@
    @TableField(exist = false)
    private String payMethod;
    /**
     * 排序字段
     */
    @TableField(exist = false)
    private String orderByColumn;
    /**
     * 排序方式
     */
    @TableField(exist = false)
    private String isAsc;
    public String getIdStr() {
        return String.valueOf(id);
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsAppUser.java
@@ -39,6 +39,9 @@
    private Long appUserId;
    @TableField(exist = false)
    private String appUserIdStr;
    @TableField(exist = false)
    @ApiModelProperty(value = "用户名称")
    private String userName;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java
@@ -32,6 +32,8 @@
    @ApiModelProperty(value = "主键")
    @TableId("id")
    private Long id;
    @TableField(exist = false)
    private String idStr;
    @ApiModelProperty(value = "门店id")
    @TableField("shop_id")
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsClientFallbackFactory.java
@@ -34,6 +34,21 @@
            public R<List<Goods>> getGoodsById(String [] ids) {
                return R.fail("根据ids获取商品详情失败:" + cause.getMessage());
            }
            @Override
            public R editGoodsList(List<Goods> goods) {
                return R.fail("编辑商品信息失败:" + cause.getMessage());
            }
            @Override
            public R<Void> editGoodsNum(Integer goodsId, Integer num) {
                return R.fail();
            }
            @Override
            public R<List<Goods>> getAllGoods() {
                return R.fail("获取所有商品失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopBalanceStatementClientFallbackFactory.java
@@ -6,6 +6,7 @@
import com.ruoyi.other.api.feignClient.ShopBalanceStatementClient;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@@ -27,6 +28,11 @@
            public R<List<ShopBalanceStatement>> getShopBalanceStatementList(Collection<Integer> types, Long objectId) {
                return R.fail("获取门店余额流水失败:" + cause.getMessage());
            }
            @Override
            public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(Integer type, LocalDateTime date) {
                return R.fail();
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/GoodsClient.java
@@ -6,6 +6,8 @@
import com.ruoyi.other.api.factory.GoodsClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -34,7 +36,31 @@
     */
    @PostMapping("/goods/getGoodsById")
    R<Goods> getGoodsById(@RequestParam("id") Integer id);
    @PostMapping("/goods/getGoodsByIds")
    R<List<Goods>> getGoodsById(@RequestParam("ids") String[]  ids);
    /**
     * 编辑商品信息
     * @param goods
     * @return
     */
    @PostMapping("/goods/editGoods")
    R editGoodsList(@RequestBody List<Goods> goods);
    /**
     * 商品销量增加
     */
    @PutMapping("/goods/editGoodsNum")
    R<Void> editGoodsNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("num") Integer num);
    /**
     * 获取所有商品
     * @return
     */
    @PostMapping("/goods/getAllGoods")
    R<List<Goods>> getAllGoods();
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopBalanceStatementClient.java
@@ -9,6 +9,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@@ -34,5 +35,9 @@
     * @return
     */
    @PostMapping("/shop-balance-statement/getShopBalanceStatementList")
    R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam("objectId") Long objectId);
    R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam(value = "objectId",required = false) Long objectId);
    @PostMapping("/shop-balance-statement/getShopBalanceStatementList2")
    R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type,
                                                               @RequestParam(value = "date") LocalDateTime date);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -45,8 +45,8 @@
    @PostMapping("/shop/getShopByUserIds")
    R<List<Shop>> getShopByUserIds(@RequestBody List<Long> userIds);
    @GetMapping("/shop/getShopIdByName")
    R<Set<Integer>> getShopIdByName(String shopName);
    @PostMapping("/shop/getShopIdByName")
    R<Set<Integer>> getShopIdByName(@RequestParam("shopName") String shopName);
    @PostMapping("/shop-balance-statement/getList")
    R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestBody ShopBalanceStatement shopBalanceStatement);
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
@@ -29,6 +29,6 @@
     * @param ids
     * @return
     */
    @PostMapping("/technician-subscribe/getTechnicianByIds")
    @PostMapping("/technician/getTechnicianByIds")
    R<List<Technician>> getTechnicianByIds(@RequestParam("ids") Collection<Integer> ids);
}
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysPasswordService.java
@@ -24,7 +24,6 @@
    private RedisService redisService;
    private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
    private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
    @Autowired
@@ -59,8 +58,8 @@
            throw new ServiceException(errMsg);
        }
//        if (!matches(user, password))
//        {
//        if (!user.getPassword().equals(password)){
//            retryCount = retryCount + 1;
//            recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount));
//            redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java
@@ -5,6 +5,7 @@
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.core.exception.auth.NotPermissionException;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -90,7 +91,7 @@
    public LoginUser getLoginUserApplet() {
        LoginUser loginUserAppletToken = getLoginUserAppletToken(ServletUtils.getRequest());
        if (loginUserAppletToken == null) {
            throw new RuntimeException("令牌已过期,请重新登录!");
            throw new NotPermissionException("令牌已过期,请重新登录!");
        }
        return loginUserAppletToken;
    }
@@ -128,7 +129,7 @@
    public LoginUser getLoginUser() {
        LoginUser loginUser = getLoginUser(ServletUtils.getRequest());
        if (loginUser == null) {
            throw new RuntimeException("令牌已过期,请重新登录!");
            throw new NotPermissionException("令牌已过期,请重新登录!");
        }
        if(null == loginUser.getUserid()){
            loginUser.setUserid(loginUser.getSysUser().getUserId());
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/utils/SecurityUtils.java
@@ -118,7 +118,7 @@
    
    public static void main(String[] args) {
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String encode = passwordEncoder.encode("31dc4a464b71db3ddaea244410af4833");
        String encode = passwordEncoder.encode("123456");
        System.err.println(encode);
    }
}
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java
@@ -1,5 +1,6 @@
package com.ruoyi.gateway.filter;
import com.ruoyi.common.core.exception.auth.NotPermissionException;
import com.ruoyi.gateway.config.properties.AntiShakeProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -131,7 +132,7 @@
    /**
     * 防抖处理
     */
    public void antiShake(ServerHttpRequest request) throws Exception{
    public void antiShake(ServerHttpRequest request) {
        HttpMethod method = request.getMethod();
        if(HttpMethod.OPTIONS == method || !antiShakeProperties.getEnable()){
            return;
@@ -174,20 +175,19 @@
    /**
     * 验证token
     * @param request
     * @throws Exception
     */
    public void verifyToken(ServerHttpRequest request) throws Exception{
    public void verifyToken(ServerHttpRequest request) {
        String token = getToken(request);
        if (StringUtils.isEmpty(token)) {
            throw new RuntimeException("令牌不能为空");
            throw new NotPermissionException("令牌不能为空");
        }
        Claims claims = JwtUtils.parseToken(token);
        if (claims == null) {
            throw new RuntimeException("令牌已过期或验证不正确!");
            throw new NotPermissionException("令牌已过期或验证不正确!");
        }
        String userid = JwtUtils.getUserId(claims);
        if (StringUtils.isEmpty(userid)) {
            throw new RuntimeException("令牌验证失败");
            throw new NotPermissionException("令牌验证失败");
        }
    }
    
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysProfileController.java
@@ -14,6 +14,7 @@
import com.ruoyi.system.api.domain.SysFile;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import com.ruoyi.system.dto.UpdatePassword;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -97,8 +98,11 @@
    @ApiOperation(value = "个人信息-修改密码")
    @Log(title = "个人信息", businessType = BusinessType.UPDATE)
    @PostMapping("/updatePwd")
    public AjaxResult updatePwd(String username,String oldPassword, String newPassword)
    public AjaxResult updatePwd(@RequestBody UpdatePassword updatePassword)
    {
        String newPassword = updatePassword.getNewPassword();
        String oldPassword = updatePassword.getOldPassword();
        String username = updatePassword.getUsername();
        System.err.println(oldPassword);
        System.err.println(newPassword);
//        String username = SecurityUtils.getUsername();
@@ -121,6 +125,7 @@
//            tokenService.setLoginUser(loginUser);
            return success();
        }
        return error("修改密码异常,请联系管理员");
    }
    
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java
@@ -106,6 +106,7 @@
        }else{
            wrapper.isNull(SysRole::getShopId);
        }
        wrapper.ne(SysRole::getRoleId,2);//过滤门店管理员
        PageInfo<SysRole> page = roleService.page(pageInfo, wrapper.orderByDesc(SysRole::getCreateTime));
        for (SysRole record : page.getRecords()) {
            long count = sysUserRoleService.count(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, record.getRoleId()));
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
@@ -134,13 +134,13 @@
        }
        //门店员工添加数据,需要判断账号是否存在,共用同一个账号
        if(2 == sysUser1.getRoleType()){
            SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, user.getPhonenumber())
                    .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2));
            if(null == one){
                AppUser appUser = appUserClient.getAppUserByPhone1(user.getPhonenumber()).getData();
                if(null == appUser){
                    return error("请先注册小程序账号");
                }
            SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, user.getPhonenumber())
                    .eq(SysUser::getDelFlag, "0").eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2));
            if(null == one){
                user.setCreateBy(SecurityUtils.getUsername());
                user.setPassword(SecurityUtils.encryptPassword("a123456"));
                user.setRoleType(sysUser1.getRoleType());
@@ -154,8 +154,13 @@
                sysUserRole.setRoleId(user.getRoleId());
                sysUserRole.setUserId(user.getUserId());
                userRoleService.insertSysUserRole(sysUserRole);
            }
                //添加小程序店员关系数据
                if(null != appUser){
                List<AppUserShop> data = appUserShopClient.getAppUserShop(appUser.getId()).getData();
                Optional<AppUserShop> first = data.stream().filter(s -> s.getShopId().equals(sysUser1.getObjectId())).findFirst();
                if(!first.isPresent()){
                    AppUserShop appUserShop = new AppUserShop();
                    appUserShop.setAppUserId(appUser.getId());
                    appUserShop.setShopId(sysUser1.getObjectId());
@@ -164,6 +169,7 @@
                    appUserClient.editAppUserById(appUser);
                }
            }
            //添加门店员工关系数据
            UserShop userShop = new UserShop();
            userShop.setUserId(one.getUserId());
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/dto/UpdatePassword.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.system.dto;
import lombok.Data;
/**
 * @author zhibing.pu
 * @date 2025/1/11 20:21
 */
@Data
public class UpdatePassword {
    private String username;
    private String newPassword;
    private String oldPassword;
}
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -2,6 +2,10 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.feignClient.AppUserShopClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.AppUserShop;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.SpringUtils;
@@ -79,6 +83,12 @@
    
    @Resource
    private UserShopService userShopService;
    @Resource
    private AppUserShopClient appUserShopClient;
    @Resource
    private AppUserClient appUserClient;
    
    
    /**
@@ -442,6 +452,8 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteUserByIds(Long[] userIds) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = this.getById(userid);
        for (Long userId : userIds) {
            checkUserAllowed(new SysUser(userId));
//            checkUserDataScope(userId);
@@ -450,14 +462,34 @@
//        userRoleMapper.deleteUserRole(userIds);
//        // 删除用户与岗位关联
//        userPostMapper.deleteUserPost(userIds);
        int i = userMapper.deleteUserByIds(userIds);
//        int i = userMapper.deleteUserByIds(userIds);
        List<SysUser> sysUsers = this.listByIds(Arrays.asList(userIds));
        for (SysUser user : sysUsers) {
            if(2 == user.getRoleType()){
                userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId()));
                userShopService.remove(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, sysUser.getObjectId()));
                AppUser appUser = appUserClient.getAppUserByPhone1(user.getPhonenumber()).getData();
                if(null != appUser){
                    AppUserShop appUserShop = new AppUserShop();
                    appUserShop.setAppUserId(appUser.getId());
                    appUserShop.setShopId(sysUser.getObjectId());
                    appUserShopClient.delAppUserShop(appUserShop);
                    int size = appUserShopClient.getAppUserShop(appUser.getId()).getData().size();
                    if(size == 0){
                        appUser.setUserType(1);
                        appUserClient.editAppUserById(appUser);
            }
        }
        return i;
                long count = userShopService.count(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()));
                if(0 == count){
                    user.setDelFlag("2");
                    this.updateById(user);
                }
            }else{
                user.setDelFlag("2");
                this.updateById(user);
            }
        }
        return 0;
    }
    
    /**
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserCancellationLog;
import com.ruoyi.account.api.model.UserCoupon;
@@ -26,13 +28,19 @@
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopBalanceStatement;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.factory.ShopBalanceStatementClientFallbackFactory;
import com.ruoyi.other.api.feignClient.ShopBalanceStatementClient;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.api.feignClient.StoreClient;
import com.ruoyi.other.api.feignClient.VipSettingClient;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -44,8 +52,10 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.ruoyi.account.vo.*;
import com.ruoyi.common.core.web.controller.BaseController;
@@ -94,6 +104,12 @@
    private SysUserClient sysUserClient;
    @Resource
    private OrderClient orderClient;
    @Resource
    private ShopBalanceStatementClient shopBalanceStatementClient;
    @Resource
    private UserCancellationLogService userCancellationLogService;
    @Resource
    private BalanceChangeRecordService balanceChangeRecordService;
    @ResponseBody
@@ -140,7 +156,11 @@
    @ResponseBody
    @PostMapping("/getCouponCount")
    public R<Long> getCouponCount(@RequestParam("userId") Long userId, @RequestParam("couponId") Integer couponId) {
        Long count = userCouponService.lambdaQuery().eq(UserCoupon::getAppUserId, userId).eq(UserCoupon::getCouponId, couponId).count();
        LambdaQueryChainWrapper<UserCoupon> chainWrapper = userCouponService.lambdaQuery().eq(UserCoupon::getCouponId, couponId);
        if(null != userId && -1 == userId){
            chainWrapper.eq(UserCoupon::getAppUserId, userId);
        }
        Long count = chainWrapper.count();
        return R.ok(count);
    }
@@ -199,8 +219,7 @@
        return R.ok(user);
    }
    @Resource
    private UserCancellationLogService userCancellationLogService;
    @ResponseBody
    @GetMapping("/unregis")
@@ -296,7 +315,8 @@
        if (user.getShopId() != null) {
            R<Shop> storeById = shopClient.getShopById(user.getShopId());
            if (storeById.getData() != null) {
                user.setShopName(storeById.getData().getName());
                Shop shop = storeById.getData();
                user.setShopName(shop.getName());
            }
        }
        Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).or().eq(AppUser::getTopInviteId,userId).count();
@@ -432,11 +452,14 @@
    public R<IPage<AppUser>> shopGetAppuserPage(@ApiParam("页码") @RequestParam Integer pageCurr,
                                                @ApiParam("每一页数据大小") Integer pageSize,
                                                AppUser appUser) {
        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
        Long userid = tokenService.getLoginUser().getUserid();
        R<SysUser> sysUserR = sysUserClient.getSysUser(userid);
        SysUser sysUser = sysUserR.getData();
        List<Long> userIds = new ArrayList<>();
        userIds.add(-1L);
        //获取在该本店下单的用户ids
        Integer objectId = sysUser.getObjectId();
        R<List<Order>> listR = remoteOrderGoodsClient.byShopId(objectId);
        for (Order datum : listR.getData()) {
            userIds.add(datum.getAppUserId());
@@ -509,6 +532,10 @@
    @ApiOperation(value = "用户列表-更换绑定人", tags = {"管理后台"})
    public R<AppUser> select(Long id, Long inviteId) {
        AppUser byId = appUserService.getById(id);
        Long userId = byId.getId();
        if (userId.equals(inviteId)) {
            return R.fail("不能选择自己为绑定人。");
        }
        byId.setInviteUserId(inviteId);
        byId.setTopInviteId(getTop(inviteId));
        appUserService.updateById(byId);
@@ -541,6 +568,9 @@
    @GetMapping("/detail")
    @ApiOperation(value = "用户列表-详情", tags = {"管理后台"})
    public R<AppUser> detail(Long id) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        AppUser byId = appUserService.getById(id);
        if (byId.getShopId() != null) {
            R<Shop> shopById = shopClient.getShopById(Integer.parseInt(String.valueOf(byId.getShopId())));
@@ -571,6 +601,14 @@
        List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list();
        byId.setBottomUsers(list);
        //消费总金额
        R<List<Order>> orderR = remoteOrderGoodsClient.byShopId(sysUser.getObjectId());
        List<Order> orderList = orderR.getData();
        if (!CollectionUtils.isEmpty(orderList)){
            BigDecimal paymentAmount = orderList.stream().map(Order::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
            byId.setShopAmount(paymentAmount);
        }else {
            byId.setShopAmount(BigDecimal.ZERO);
        }
        return R.ok(byId);
    }
@@ -617,8 +655,8 @@
    }
    @GetMapping("/listByIds")
    List<AppUser> listByIds(@RequestParam("ids") List<Long> ids) {
    @PostMapping("/listByIds")
    public List<AppUser> listByIds(@RequestParam("ids") List<Long> ids) {
        if(ids.size() == 0){
            return new ArrayList<>();
        }
@@ -633,6 +671,19 @@
                .eq(AppUser::getPhone, phone));
        return R.ok(appUser);
    }
    /**
     * 设置指定用户的下级用户绑定门店
     */
    @PostMapping("/setLowerUserShop")
    public R<Void> setLowerUserShop(@RequestParam("userId") Long userId,@RequestParam("shopId") Integer shopId) {
        appUserService.update(new LambdaUpdateWrapper<AppUser>()
                .set(AppUser::getShopId,shopId)
                .eq(AppUser::getInviteUserId, userId));
        return R.ok();
    }
    /**
     * 用户统计
@@ -688,13 +739,18 @@
     */
    @GetMapping("/commissionDetail")
    @ApiOperation(value = "分佣统计", tags = "管理后台-首页统计")
    public R<CommissionDetail> commissionDetail() {
    public R<CommissionDetail> commissionDetail(CommissionDetail cd) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0);
        if(sysUser.getRoleType() == 2){
            queryWrapper.eq(AppUser::getShopId, sysUser.getObjectId());
        }
        LocalDateTime startTime = cd.getStartTime();
        LocalDateTime endTime = cd.getEndTime();
        queryWrapper.ge(null != startTime, AppUser::getCreateTime, startTime);
        queryWrapper.le(null != endTime, AppUser::getCreateTime, endTime);
        queryWrapper.orderByAsc(AppUser::getCreateTime);
        List<AppUser> appUserList = appUserService.list(queryWrapper);
        if (appUserList.isEmpty()) {
            return R.ok(new CommissionDetail());
@@ -703,7 +759,7 @@
        BigDecimal totalServiceFee = BigDecimal.ZERO;
        BigDecimal totalUserCommission = BigDecimal.ZERO;
        Map<Integer, BigDecimal> vipCommissions = new HashMap<>();
        Map<String, Map<Integer, BigDecimal>> dailyVipCommissions = new HashMap<>();
        Map<String, Map<Integer, BigDecimal>> dailyVipCommissions = new TreeMap<>();
        for (AppUser appUser : appUserList) {
            BigDecimal distributionAmount = Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO);
            totalCommission = totalCommission.add(distributionAmount);
@@ -724,6 +780,25 @@
            totalServiceFee = totalServiceFee.add(shop.getServerGiveawayMoney());
            totalUserCommission = totalUserCommission.add(shop.getGiveawayMoney());
        }
        R<List<ShopBalanceStatement>> r = shopBalanceStatementClient.getShopBalanceStatementList(Arrays.asList(1, 2, 3), null);
        List<ShopBalanceStatement> data1 = r.getData();
        if (!CollectionUtils.isEmpty(data1)){
            for (ShopBalanceStatement shopBalanceStatement : data1) {
                String dateKey = shopBalanceStatement.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                Integer type = shopBalanceStatement.getType();
                if (type == 1){
                    type = 8;
                }else if (type == 2){
                    type = 9;
                }else {
                    type = 10;
                }
                dailyVipCommissions.computeIfAbsent(dateKey, k -> new HashMap<>())
                        .merge(type, shopBalanceStatement.getVariableAmount(), BigDecimal::add);
            }
        }
        CommissionDetail commissionDetail = new CommissionDetail();
        commissionDetail.setTotalCommission(totalCommission);
@@ -753,6 +828,10 @@
                    BigDecimal add = commissionDate.getNormalCommission().add(commissionDate.getGoldCommission()).add(commissionDate.getDiamondCommission()).add(commissionDate.getAgentCommission())
                            .add(commissionDate.getSuperAgentCommission()).add(commissionDate.getTopAgentCommission()).add(commissionDate.getPartnerCommission());
                    commissionDate.setTotalCommission(add);
                    commissionDate.setServiceChargeCommission(dailyCommissions.getOrDefault(10, BigDecimal.ZERO));
                    commissionDate.setAssociatedUserCommission(dailyCommissions.getOrDefault(8, BigDecimal.ZERO));
                    commissionDate.setBindLowerLevelStoresCommission(dailyCommissions.getOrDefault(9, BigDecimal.ZERO));
                    return commissionDate;
                })
                .collect(Collectors.toList());
@@ -762,6 +841,69 @@
    }
    
    
    public R<CommissionDetail> commissionDetail2(CommissionDetail cd) {
        if (cd.getStartTime() == null || cd.getEndTime() == null) {
            return R.fail("请选择时间");
        }
        if (cd.getStartTime().isAfter(cd.getEndTime())) {
            return R.fail("开始时间不能大于结束时间");
        }
        Map<String, Map<Integer, BigDecimal>> dailyVipCommissions = new TreeMap<>();
        getDatesBetween(cd.getStartTime(), cd.getEndTime()).forEach(date -> {
            for (int i = 1; i < 8; i++){
                List<BalanceChangeRecord> list = balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>()
                        .eq(BalanceChangeRecord::getCreateTime, date)
                        .eq(BalanceChangeRecord::getChangeType,4)
                        .eq(BalanceChangeRecord::getVipId, i));
                BigDecimal reduce = list.stream().map(BalanceChangeRecord::getChangeAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                String dateKey = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                dailyVipCommissions.computeIfAbsent(dateKey, k -> new HashMap<>())
                        .merge(i, reduce, BigDecimal::add);
            }
            for (int i = 1; i < 4; i++){
                R<List<ShopBalanceStatement>> r = shopBalanceStatementClient.getShopBalanceStatementList2(i, date);
                if (!CollectionUtils.isEmpty(r.getData())){
                    List<ShopBalanceStatement> list = r.getData();
                    BigDecimal reduce = list.stream().map(ShopBalanceStatement::getVariableAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                    String dateKey = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                    int type;
                    if (i == 1){
                        type = 8;
                    }else if (i == 2){
                        type = 9;
                    }else {
                        type = 10;
                    }
                    dailyVipCommissions.computeIfAbsent(dateKey, k -> new HashMap<>())
                            .merge(type, reduce, BigDecimal::add);
                }
            }
        });
        return null;
    }
    /**
     * 获取指定时间段内每一天的列表
     *
     * @param startDate 开始日期时间
     * @param endDate 结束日期时间
     * @return 包含每天日期时间的列表
     */
    private static List<LocalDateTime> getDatesBetween(LocalDateTime startDate, LocalDateTime endDate) {
        // 计算开始日期和结束日期之间的天数差(忽略时间部分)
        long daysBetween = ChronoUnit.DAYS.between(startDate.toLocalDate(), endDate.toLocalDate());
        // 使用Stream.iterate从开始日期开始迭代,每次增加一天,直到达到天数差+1
        return Stream.iterate(startDate, date -> date.plus(1, ChronoUnit.DAYS))
                .limit(daysBetween + 1)
                .collect(Collectors.toList());
    }
    /**
     * 上传图片
     * @param file
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -2,7 +2,9 @@
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserCoupon;
@@ -71,11 +73,18 @@
    @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"})
    public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) {
        Long userid = tokenService.getLoginUserApplet().getUserid();
        Page<UserCoupon> page = userCouponService.lambdaQuery()
                .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime)
                .isNotNull(status!=null&&status==2,UserCoupon::getUseTime)
                .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now())
                .eq(UserCoupon::getAppUserId, userid).page(Page.of(pageNum-1, pageSize));
        LambdaQueryChainWrapper<UserCoupon> chainWrapper = userCouponService.lambdaQuery()
                .eq(UserCoupon::getAppUserId, userid);
        if(null != status && 1 == status){
            chainWrapper.isNull(UserCoupon::getUseTime).gt(UserCoupon::getEndTime, LocalDateTime.now());
        }
        if(null != status && 2 == status){
            chainWrapper.isNotNull(UserCoupon::getUseTime);
        }
        if(null != status && 3 == status){
            chainWrapper.isNull(UserCoupon::getUseTime).lt(UserCoupon::getEndTime, LocalDateTime.now());
        }
        Page<UserCoupon> page = chainWrapper.page(Page.of(pageNum-1, pageSize));
        for (UserCoupon record : page.getRecords()) {
            record.setIdStr(record.getId().toString());
            CouponInfo data = couponClient.detail(record.getCouponId()).getData();
@@ -85,7 +94,9 @@
            if (vo.getCouponType()==4){
                List<String> goodNames = new ArrayList<>();
                if (vo.getForGoodIds().equals("-1")){
                        goodNames.add("全部商品");
                    List<Goods> data1 = goodsClient.getAllGoods().getData();
                    List<String> collect = data1.stream().map(Goods::getName).collect(Collectors.toList());
                    goodNames.addAll(collect);
                }else{
                    String[] split = vo.getForGoodIds().split(",");
                    R<List<Goods>> goodsById = goodsClient.getGoodsById(split);
@@ -94,23 +105,20 @@
                            goodNames.add(datum.getName());
                        }
                    }
                }
                    vo.setGoodNames(goodNames);
                }
            }
            record.setCouponInfoVo(vo);
            if (record.getUseTime()==null){
                record.setStatus(1);
            if(null != record.getUseTime()){
                record.setStatus(2);
            }else{
                if (record.getEndTime().isBefore(LocalDateTime.now())){
                    record.setStatus(3);
                }
            }else {
                record.setStatus(2);
                    record.setStatus(1);
            }
            }
            AppUser appUser = appUserService.getById(record.getAppUserId());
            record.setUserName(appUser.getName());
            record.setPhone(appUser.getPhone());
@@ -121,11 +129,26 @@
    @GetMapping("/mine/list1")
    @ApiOperation(value = "已领取列表", tags = {"管理后台-优惠劵"})
    public R<Page<UserCoupon>> list1(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status, Integer id) {
    public R<Page<UserCoupon>> list1(@RequestParam Integer pageNum,
                                     @RequestParam Integer pageSize,
                                     @ApiParam("1未使用2已使用3已过期") Integer status,
                                     String phone,
                                     Integer id) {
        Long appUserId = null;
        if (!StringUtils.isEmpty(phone)){
            AppUser appUser1 = appUserService.getOne(new LambdaQueryWrapper<AppUser>()
                    .like(AppUser::getPhone, phone));
            if (appUser1 != null){
                appUserId = appUser1.getId();
            }
        }
        Page<UserCoupon> page = userCouponService.lambdaQuery()
                .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime)
                .isNotNull(status!=null&&status==2,UserCoupon::getUseTime)
                .eq(UserCoupon::getCouponId, id)
                .eq(appUserId != null,UserCoupon::getAppUserId, appUserId)
                .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()).page(Page.of(pageNum-1, pageSize));
        for (UserCoupon record : page.getRecords()) {
            record.setIdStr(record.getId().toString());
@@ -149,8 +172,6 @@
                }
            }
            record.setCouponInfoVo(vo);
            if (record.getUseTime()==null){
                record.setStatus(1);
@@ -160,7 +181,6 @@
            }else {
                record.setStatus(2);
            }
            AppUser appUser = appUserService.getById(record.getAppUserId());
            record.setUserName(appUser.getName());
@@ -184,6 +204,16 @@
        if (data==null){
            return  R.fail("当前优惠券不存在,请刷新后重试");
        }
        long count = userCouponService.count(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getCouponId, couponId).eq(UserCoupon::getDelFlag, 0));
        if(data.getSendNum() <= count){
            return R.fail("当前优惠券已全部领取完毕");
        }
        count = userCouponService.count(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getCouponId, couponId)
                .eq(UserCoupon::getAppUserId, userid).eq(UserCoupon::getDelFlag, 0));
        if(data.getMaxNum() <= count){
            return R.fail("当前优惠券已达到最大领取限制");
        }
        if (data.getSendType()!=1&& byId.getLavePoint().compareTo(data.getNeedPoint().intValue()) < 0){
           return  R.fail("当前积分不足,兑换失败");
        }
@@ -201,7 +231,7 @@
            appUserService.updateById(byId);
            
            UserPoint userPoint = new UserPoint();
            userPoint.setType(4);
            userPoint.setType(11);
            userPoint.setHistoricalPoint(lavePoint);
            userPoint.setVariablePoint(point);
            userPoint.setBalance(byId.getLavePoint());
@@ -321,5 +351,41 @@
        userCouponService.updateById(userCoupon);
        return R.ok();
    }
    /**
     * 获取用户优惠券详情
     * @param id
     * @return
     */
    @PostMapping("/getUserCoupon")
    public R<UserCoupon> getUserCoupon(@RequestParam("id") Long id){
        UserCoupon userCoupon = userCouponService.getById(id);
        return R.ok(userCoupon);
    }
    /**
     * 编辑用户优惠券
     * @return
     */
    @PostMapping("/editUserCoupon")
    public R editUserCoupon(@RequestBody UserCoupon userCoupon){
        userCouponService.updateById(userCoupon);
        return R.ok();
    }
    /**
     * 编辑用户优惠券使用时间
     * @param userCoupon
     * @return
     */
    @PostMapping("/editReturnUse")
    public R editReturnUse(@RequestBody UserCoupon userCoupon){
        userCouponService.update(new LambdaUpdateWrapper<UserCoupon>().eq(UserCoupon::getId, userCoupon.getId())
                .set(UserCoupon::getUseTime, userCoupon.getUseTime()));
        return R.ok();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -183,5 +183,19 @@
        List<UserPoint> list = userPointService.list(queryWrapper);
        return R.ok(list);
    }
    /**
     * 判断当天是否分享获得过积分
     * @param appUserId
     * @return
     */
    @PostMapping("/judgmentDailyShare")
    public R<Boolean> judgmentDailyShare(@RequestParam("appUserId") Long appUserId){
        long count = userPointService.count(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUserId)
                .eq(UserPoint::getType, 4).last(" and DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(create_time, '%Y-%m-%d')"));
        return R.ok(count != 0);
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserPoint;
import com.ruoyi.account.api.model.UserSignRecord;
@@ -61,6 +62,11 @@
    @ApiOperation(value = "签到", tags = {"小程序-签到"})
    public R<SignBackRDto> sign(){
        Long userId1 = tokenService.getLoginUserApplet().getUserid();
        UserSignRecord one = userSignRecordService.getOne(new LambdaQueryWrapper<UserSignRecord>().eq(UserSignRecord::getAppUserId, userId1)
                .eq(UserSignRecord::getDelFlag, 0).last(" and DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(create_time, '%Y-%m-%d')"));
        if(null != one){
            return R.fail("今天已经签过到了");
        }
        AppUser appUser = appUserService.getById(userId1);
        //获取当前用户的会员信息
        PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData();
@@ -77,6 +83,7 @@
                }
                Integer lavePoint = appUser.getLavePoint();
                appUser.setTotalPoint(appUser.getTotalPoint() + signPoint);
                appUser.setTotalSignPoint(appUser.getTotalSignPoint() + signPoint);
                appUser.setLavePoint(appUser.getLavePoint() + signPoint);
                appUser.setAvailablePoint(appUser.getAvailablePoint() + signPoint1);
                appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + signPoint1);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java
@@ -142,16 +142,6 @@
    private Map<Integer, R<GoodsVip>> getGoodsVips(List<Integer> vipIds) {
        Map<Integer, R<GoodsVip>> result = new HashMap<>();
        for (Integer vipId : vipIds) {
            R<GoodsVip> goodsVipR = goodsVipClient.getGoodsVip(null, vipId);
            result.put(vipId, goodsVipR);
        }
        return result;
    }
    private Map<Integer, R<List<VipGood>>> getVipGoods(List<Integer> vipIds) {
        Map<Integer, R<List<VipGood>>> result = new HashMap<>();
        for (Integer vipId : vipIds) {
@@ -161,13 +151,6 @@
        return result;
    }
    private boolean isValidJson(String json) {
        try {
            JSONObject.parseObject(json);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
@@ -102,7 +102,7 @@
        List<BalanceChangeRecord> list = balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>()
                .eq(changeType != null, BalanceChangeRecord::getChangeType, changeType)
                .between(startTime != null, BalanceChangeRecord::getCreateTime, startTime, endTime)
                .eq(BalanceChangeRecord::getAppUserId, userId));
                .eq(BalanceChangeRecord::getAppUserId, userId).orderByDesc(BalanceChangeRecord::getCreateTime));
        List<Long> orderIds = list.stream().map(BalanceChangeRecord::getOrderId).collect(Collectors.toList());
        if (CollectionUtil.isNotEmpty(orderIds)){
@@ -187,6 +187,7 @@
            //流水
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
            balanceChangeRecord.setAppUserId(appUser.getId());
            balanceChangeRecord.setVipId(appUser.getVipId());
            balanceChangeRecord.setOrderId(balanceChangeRecord.getId());
            balanceChangeRecord.setChangeType(1);
            balanceChangeRecord.setBeforeAmount(balance);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java
@@ -16,6 +16,7 @@
import com.ruoyi.account.util.payment.model.SinglePay;
import com.ruoyi.account.util.payment.model.SinglePayCallbackResult;
import com.ruoyi.account.util.payment.model.SinglePayResult;
import com.ruoyi.account.vo.WithdrawalAuth;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
@@ -78,27 +79,29 @@
    
    @PostMapping("/auth")
    @ApiOperation(value = "提现申请审批", tags = {"后台"})
    public R auth(@RequestParam("id") Long id,@ApiParam("2'审核通过',3'审核拒绝'") @RequestParam("auditStatus") Integer auditStatus){
        WithdrawalRequests withdrawal = withdrawalRequestsService.getById(id);
    public R auth(@RequestBody WithdrawalAuth withdrawalAuth){
        WithdrawalRequests withdrawal = withdrawalRequestsService.getById(withdrawalAuth.getId());
        BigDecimal withdrawalAmount = withdrawal.getWithdrawalAmount();
        if(withdrawal.getAuditStatus() != 1){
            return R.fail("不能重复审核");
        }
        Integer auditStatus = withdrawalAuth.getAuditStatus();
        if (auditStatus==2){
            //执行转账操作
            if(withdrawal.getWithdrawalMethod() == 2){
            //先检查账户余额是否充足
            AccountBalanceQueryResult accountBalanceQueryResult = TransferUtil.accountBalanceQuery();
            if(null == accountBalanceQueryResult){
                return R.fail("查询账户余额出错");
            }
            Double useAbleSettAmount = accountBalanceQueryResult.getUseAbleSettAmount();
            if(useAbleSettAmount < withdrawal.getArrivalAmount().doubleValue()){
                //计算代付手续费
                if(useAbleSettAmount < (withdrawal.getArrivalAmount().doubleValue() + 1)){
                return R.fail("账户可用余额不足,请先补充账户余额");
            }
            //执行转账操作
            if(withdrawal.getWithdrawalMethod() == 2){
                //银行卡转账
                SinglePay singlePay = new SinglePay();
                singlePay.setTradeMerchantNo("");
                singlePay.setTradeMerchantNo(TransferUtil.sysTradeMerchantNo);
                singlePay.setMerchantOrderNo(withdrawal.getId().toString());
                singlePay.setReceiverAccountNoEnc(withdrawal.getBankCardNumber());
                singlePay.setReceiverNameEnc(withdrawal.getAccountHolder());
@@ -114,6 +117,7 @@
                withdrawal.setStatus(1);
            }else{
                //微信转账
                return R.fail("微信转账开发中");
            }
        }
        if(3 == auditStatus){
@@ -130,6 +134,7 @@
            //添加变动明细
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
            balanceChangeRecord.setAppUserId(appUser.getId());
            balanceChangeRecord.setVipId(appUser.getVipId());
            balanceChangeRecord.setOrderId(withdrawal.getId());
            balanceChangeRecord.setChangeType(2);
            balanceChangeRecord.setBeforeAmount(balance);
@@ -153,7 +158,7 @@
    @PostMapping("/withdrawalCallback")
    public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){
        Integer status = singlePayCallbackResult.getStatus();
        if(203 == status){
        if(203 == status || 205 == status){
            String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
            WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo);
            if(1 == withdrawalRequests.getStatus()){
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java
@@ -84,6 +84,8 @@
    void onlineRecord();
    IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser, Integer shopId, Set<Long> userId);
    IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,Integer objectId,List<Long> userIds);
    
    /**
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AgentApplicationServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.account.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -53,7 +54,11 @@
    public void apply(AgentApplication agentApplication) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        AppUser appUser = appUserService.getById(loginUserApplet.getUserid());
        Long aLong = agentApplicationMapper.selectCount(new QueryWrapper<AgentApplication>().eq("app_user_id", appUser.getId())
                .eq("application_vip_id", agentApplication.getApplicationVipId()).eq("status", 1).eq("del_flag", 0));
        if(0 != aLong){
            throw new RuntimeException("已发起申请,请等待平台工作人员与您联系");
        }
        agentApplication.setAppUserId(loginUserApplet.getUserid());
        agentApplication.setStatus(1);
        agentApplication.setApplicationTime(LocalDateTime.now());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -43,10 +43,7 @@
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS.optional;
import static sun.plugin.util.ProgressMonitor.get;
/**
 * <p>
@@ -290,6 +287,7 @@
            appUser = appUser1;
        }else if(null == appUser){
            appUser = new AppUser();
            appUser.setAvatar(registerAccount.getAvatar());
            appUser.setName(registerAccount.getName());
            appUser.setPhone(registerAccount.getPhone());
            appUser.setWxOpenid(openid);
@@ -691,6 +689,31 @@
            String cityCode = citycode.substring(0, 4) + "00";
            PageInfo<NearbyReferrerVo> pageInfo = new PageInfo(nearbyReferrer.getPageCurr(), nearbyReferrer.getPageSize());
            List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(pageInfo, cityCode, nearbyReferrer);
            for (NearbyReferrerVo nearbyReferrerVo : list) {
                switch (nearbyReferrerVo.getVip()){
                    case "1":
                        nearbyReferrerVo.setVip("普通会员");
                        break;
                    case "2":
                        nearbyReferrerVo.setVip("黄金会员");
                        break;
                    case "3":
                        nearbyReferrerVo.setVip("钻石会员");
                        break;
                    case "4":
                        nearbyReferrerVo.setVip("准代理");
                        break;
                    case "5":
                        nearbyReferrerVo.setVip("代理");
                        break;
                    case "6":
                        nearbyReferrerVo.setVip("总代");
                        break;
                    case "7":
                        nearbyReferrerVo.setVip("合伙人");
                        break;
                }
            }
            return pageInfo.setRecords(list);
        }
        return null;
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -62,18 +62,6 @@
        ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
        shopBalanceStatement.setType(1);
        R<List<ShopBalanceStatement>> r;
        try {
            r = shopClient.getShopBalanceStatementList(shopBalanceStatement);
        } catch (Exception e) {
            log.error("获取店铺余额对账单列表时出错", e);
            return null;
        }
        if (R.isError(r)) {
            return null;
        }
        List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord);
        List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>();
        for (BalanceChangeRecord changeRecord : balanceChangeRecordList) {
@@ -82,24 +70,6 @@
            walletStatisticsDetailList.add(walletStatisticsDetail);
        }
        List<WalletStatisticsDetail> collect = r.getData().stream().map(this::createWalletStatisticsDetail).collect(Collectors.toList());
        // 根据门店名称、用户姓名、联系电话进行模糊过滤
        collect = collect.stream()
                .filter(e -> {
                    if (StringUtils.isNotEmpty(balanceChangeRecord.getShopName())) {
                        return e.getShopName().contains(balanceChangeRecord.getShopName());
                    } else if (StringUtils.isNotEmpty(balanceChangeRecord.getUserName())) {
                        return e.getUserName().contains(balanceChangeRecord.getUserName());
                    } else if (StringUtils.isNotEmpty(balanceChangeRecord.getUserPhone())) {
                        return e.getUserPhone().contains(balanceChangeRecord.getUserPhone());
                    }
                    // 根据时间进行范围过滤
                    if (balanceChangeRecord.getStartTime() != null && balanceChangeRecord.getEndTime() != null) {
                        return e.getCreateTime().isAfter(balanceChangeRecord.getStartTime()) && e.getCreateTime().isBefore(balanceChangeRecord.getEndTime());
                    }
                    return false;
                }).collect(Collectors.toList());
        walletStatisticsDetailList.addAll(collect);
        // 按时间排序(倒序)
        walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed());
@@ -112,12 +82,13 @@
        int fromIndex = (int) ((current - 1) * size);
        int toIndex = (int) Math.min(fromIndex + size, walletStatisticsDetailList.size());
        Page<WalletStatisticsDetail> walletStatisticsDetailPage = new Page<>();
        WalletStatistics walletStatistics = new WalletStatistics();
        if (fromIndex >= walletStatisticsDetailList.size()) {
            throw new ServiceException("页面参数无效");
            walletStatistics.setPage(walletStatisticsDetailPage);
            return walletStatistics;
        }
        List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex);
        Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream()
                .collect(Collectors.groupingBy(
@@ -133,29 +104,17 @@
        BigDecimal totalWithdraw = shopCommissionMap.get(2);
        BigDecimal totalShopWithdraw = shopCommissionMap.get(7);
        List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex);
        WalletStatistics walletStatistics = new WalletStatistics();
        Page<WalletStatisticsDetail> page1 = new Page<>();
        page1.setRecords(walletStatisticsDetailList2);
        page1.setTotal(walletStatisticsDetailList.size());
        page1.setCurrent(current);
        page1.setSize(size);
        walletStatistics.setPage(page1);
        walletStatisticsDetailPage.setCurrent(current);
        walletStatisticsDetailPage.setSize(size);
        walletStatisticsDetailPage.setTotal(walletStatisticsDetailList.size());
        walletStatisticsDetailPage.setRecords(walletStatisticsDetailList2);
        walletStatistics.setPage(walletStatisticsDetailPage);
        walletStatistics.setTotalRecharge(totalRecharge);
        walletStatistics.setTotalWithdraw(totalWithdraw);
        walletStatistics.setTotalShopWithdraw(totalShopWithdraw);
        return walletStatistics;
    }
    private WalletStatisticsDetail createWalletStatisticsDetail(ShopBalanceStatement item) {
        WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail();
        walletStatisticsDetail.setShopName(item.getShopName());
        walletStatisticsDetail.setUserName(item.getShopManagerName());
        walletStatisticsDetail.setUserPhone(item.getPhone());
        walletStatisticsDetail.setChangeType(4);
        walletStatisticsDetail.setCreateTime(item.getCreateTime());
        walletStatisticsDetail.setChangeAmount(item.getVariableAmount());
        return walletStatisticsDetail;
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserCouponServiceImpl.java
@@ -12,6 +12,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
@@ -44,14 +45,14 @@
    @Override
    public List<PaymentUserCouponVo> getUserCoupon(Long userId, Integer type) {
        List<UserCoupon> list = this.list(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getAppUserId, userId).eq(UserCoupon::getDelFlag, 0)
                .last(" and now() between start_time and end_time"));
                .isNull(UserCoupon::getUseTime).gt(UserCoupon::getEndTime, LocalDateTime.now()).last(" and now() between start_time and end_time"));
        List<Integer> couponIds = list.stream().map(UserCoupon::getCouponId).collect(Collectors.toList());
        if(couponIds.size() == 0){
            return null;
        }
        List<CouponInfo> couponInfoList = couponInfoClient.getCouponInfoList(couponIds).getData();
        //构建返回数据
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        List<PaymentUserCouponVo> infoVoList = new ArrayList<>();
        for (UserCoupon userCoupon : list) {
            CouponInfo couponInfo = couponInfoList.stream().filter(s -> s.getId().equals(userCoupon.getCouponId())).findFirst().get();
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -124,7 +124,7 @@
        if (vipSetting == null) {
            return R.fail("VIP 设置未找到");
        }
        if (vipSetting.getId() == 0 && vipSetting.getVipGiftRole() == 0) {
        if (vipSetting.getVipGiftRole() == 0) {
            return R.fail("转赠积分权限未开启");
        }
@@ -132,27 +132,29 @@
        if (appUser == null) {
            return R.fail("用户未找到");
        }
        PointSetting pointSetting = pointSettingService.getPointSettingByAppUserId(userid);
        if (pointSetting == null) {
            return R.fail("积分设置未找到");
        }
        // 可转赠积分总数
        Integer transferablePoint = appUser.getTransferablePoint();
        if (point > transferablePoint) {
            return R.fail("转赠积分不足");
            return R.fail("可转赠积分不足");
        }
        AppUser appUserForPhoe = appUserService.getOne(new LambdaQueryWrapper<AppUser>()
                .eq(AppUser::getPhone, phone));
                .eq(AppUser::getPhone, phone).eq(AppUser::getDelFlag, 0).ne(AppUser::getStatus, 3));
        if (appUserForPhoe == null) {
            return R.fail("目标用户未找到");
            return R.fail("目标用户不存在");
        }
        if(appUserForPhoe.getStatus() == 2){
            return R.fail("目标用户已被冻结");
        }
        if(appUserForPhoe.getId().equals(userid)){
            return R.fail("不能转增给自己");
        }
        Integer lavePoint1 = appUserForPhoe.getLavePoint();
        appUserForPhoe.setLavePoint(appUserForPhoe.getLavePoint() + point);
        appUserForPhoe.setTotalPoint(appUserForPhoe.getTotalPoint() + point);
        appUserForPhoe.setTransferablePoint(transferablePoint + point);
        appUserForPhoe.setAvailablePoint(appUserForPhoe.getAvailablePoint() + point);
        appUserForPhoe.setTotalAvailablePoint(appUserForPhoe.getTotalAvailablePoint() + point);
        appUserService.updateById(appUserForPhoe);
        //构建积分流水记录
        UserPoint userPoint = new UserPoint();
@@ -165,9 +167,7 @@
        userPointService.save(userPoint);
        Integer lavePoint = appUser.getLavePoint();
        appUser.setLavePoint(lavePoint - point);
        Integer totalPoint = appUser.getTotalPoint();
        appUser.setTotalPoint(totalPoint - point);
        appUser.setLavePoint(appUser.getLavePoint() - point);
        appUser.setTransferablePoint(appUser.getTransferablePoint() - point);
        appUser.setAvailablePoint(appUser.getAvailablePoint() - point);
        appUserService.updateById(appUser);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WithdrawalRequestsServiceImpl.java
@@ -1,20 +1,16 @@
package com.ruoyi.account.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.account.api.model.BalanceChangeRecord;
import com.ruoyi.account.api.model.UserClickLog;
import com.ruoyi.account.api.model.WithdrawalRequests;
import com.ruoyi.account.api.model.*;
import com.ruoyi.account.dto.WithQuery;
import com.ruoyi.account.dto.WithdrawalRequestsDTO;
import com.ruoyi.account.mapper.WithdrawalRequestsMapper;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.BalanceChangeRecordService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.account.service.WithdrawalRequestsService;
import com.ruoyi.account.service.*;
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;
@@ -51,6 +47,9 @@
    public static final BigDecimal MAX_WITHDRAWAL_AMOUNT = new BigDecimal("200");
    public static final BigDecimal VIP_WITHDRAWAL_FEE_DENOMINATOR = new BigDecimal("100");
    @Resource
    private AppUserBankService appUserBankService;
    @Override
    public void withdrawalApply(WithdrawalRequestsDTO params) {
        BigDecimal withdrawalAmount = params.getWithdrawalAmount();
@@ -84,6 +83,14 @@
        WithdrawalRequests withdrawalRequests = new WithdrawalRequests();
        BeanUtils.copyBeanProp(withdrawalRequests, params);
        if(2 == params.getWithdrawalMethod()){
            AppUserBank appUserBank = appUserBankService.getOne(new LambdaQueryWrapper<AppUserBank>().eq(AppUserBank::getAppUserId, loginUserApplet.getUserid()));
            if(null == appUserBank){
                throw new ServiceException("请先添加提款账户!");
            }
            withdrawalRequests.setAccountHolder(appUserBank.getBankName());
            withdrawalRequests.setBankCardNumber(appUserBank.getBankNumber());
        }
        withdrawalRequests.setWithdrawalAmount(withdrawalAmount);
        withdrawalRequests.setArrivalAmount(withdrawalRequests.getWithdrawalAmount());
        withdrawalRequests.setServiceCharge(multiply);
@@ -102,6 +109,7 @@
        //添加变动明细
        BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
        balanceChangeRecord.setAppUserId(appUser.getId());
        balanceChangeRecord.setVipId(appUser.getVipId());
        balanceChangeRecord.setOrderId(withdrawalRequests.getId());
        balanceChangeRecord.setChangeType(2);
        balanceChangeRecord.setBeforeAmount(balance);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/payment/TransferUtil.java
@@ -31,6 +31,10 @@
     * 商户号
     */
    private static final String merchantNo = "888122600004175";
    /**
     * 平台-报备商户号
     */
    public static final String sysTradeMerchantNo = "777168500885852";
    
    private static final String format = "yyyy-MM-dd HH:mm:ss";
    /**
@@ -52,7 +56,7 @@
        //商户编号
        body.put("userNo", merchantNo);
        //报备商户号
        body.put("tradeMerchantNo", singlePay.getTradeMerchantNo());
//        body.put("tradeMerchantNo", singlePay.getTradeMerchantNo());
        //产品类型
        body.put("productCode", "BANK_PAY_DAILY_ORDER");
        //交易请求时间
@@ -90,7 +94,7 @@
         */
        body.put("paidUse", singlePay.getPaidUse());
        //商户通知地址
        body.put("callbackUrl", singlePay.getCallbackUrl());
        body.put("callbackUrl", callbackUrl + singlePay.getCallbackUrl());
        String sign = null;
        try {
            sign = sign(body);
@@ -211,18 +215,12 @@
    
    
    
    public static String sign(JSONObject body) throws Exception{
    public static String sign(JSONObject body) {
        //构建字段顺序必须按照文档签名顺序
        Set<Map.Entry<String, Object>> entries = body.entrySet();
        List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries);
        // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序)
        Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() {
            public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) {
                return (o1.getKey()).toString().compareTo(o2.getKey());
            }
        });
        // 构造签名键值对的格式
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, Object> item : infoIds) {
        for (Map.Entry<String, Object> item : entries) {
            if (item.getKey() != null || item.getKey() != "") {
                Object val = item.getValue();
                if (!(val == "" || val == null)) {
@@ -231,6 +229,7 @@
            }
        }
        sb.append(key);
        log.info("待签名串:{}", sb.toString());
        return MD5AndKL.MD5(sb.toString());
    }
    
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/payment/model/SinglePayCallbackResult.java
@@ -15,6 +15,13 @@
     * 202 处理中 批次正在处理中状态
     * 203 处理完成 批次中的每笔明细都明确了代付结果
     * 204 批次不存在 汇聚未受理该批次的请求,找不到该批次,明确失败
     * 205 交易成功 明确交易成功的状态码
     * 208 订单已取消 代付订单被商户审核为拒绝付款
     * 210 账务冻结中 确认出款后对商户的账户余额进行冻结处理
     * 211 账务解冻中 确认失败后对商户的账户余额进行解冻处理
     * 212 订单取消中 商户审核为拒绝付款的中间状态
     * 213 账务扣款中 确认成功后对商户的账户冻结款的扣款处理
     * 214 订单不存在 汇聚未受理该笔代付请求,找不到该笔订单,明确失败
     */
    private Integer status;
    /**
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/CommissionDetail.java
@@ -1,10 +1,13 @@
package com.ruoyi.account.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
@@ -73,4 +76,12 @@
    private List<CommissionDate> commissionDateList;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/NearbyReferrerVo.java
@@ -23,4 +23,6 @@
    private String vip;
    @ApiModelProperty("距离(m)")
    private BigDecimal distance;
    @ApiModelProperty("手机号")
    private String phone;
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java
@@ -11,12 +11,6 @@
@Data
public class WalletStatisticsDetail {
    /**
     * 门店名称
     */
    @ApiModelProperty(value = "门店名称")
    @Excel(name = "门店名称")
    private String shopName;
    /**
     * 用户姓名
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WithdrawalAuth.java
New file
@@ -0,0 +1,19 @@
package com.ruoyi.account.vo;
import lombok.Data;
/**
 * @author zhibing.pu
 * @date 2025/1/11 9:23
 */
@Data
public class WithdrawalAuth {
    /**
     * 申请id
     */
    private Long id;
    /**
     * 审核状态
     */
    private Integer auditStatus;
}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -44,8 +44,9 @@
                ST_Distance_Sphere(
                    point(#{nearbyReferrer.longitude},#{nearbyReferrer.latitude}),
                    point(longitude, latitude)
                ) as distance
            from t_app_user where city_code = #{cityCode} and del_flag = 0 and status = 1
                ) as distance,
                phone
            from t_app_user where city_code = #{cityCode} and del_flag = 0 and status = 1 and vip_id >= 4
            <if test="null != nearbyReferrer.name and '' != nearbyReferrer.name">
                and `name` like CONCAT('%', #{nearbyReferrer.name}, '%')
            </if>
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml
@@ -20,6 +20,7 @@
                        and DATE(t1.create_time) between  #{agentQuery.localDate1} and #{agentQuery.localDate2}
                    </if>
                </where>
                order by t1.create_time desc
    </select>
    <sql id="balanceChangeRecordList">
@@ -42,6 +43,9 @@
            <if test="changeRecord.startTime != null and changeRecord.endTime != null">
                and (tbcr.create_time between  #{changeRecord.startTime} and #{changeRecord.endTime})
            </if>
            <if test="changeRecord.changeType != null">
                and tbcr.change_type = #{changeRecord.changeType}
            </if>
        </where>
    </sql>
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserCancellationLogMapper.xml
@@ -33,6 +33,7 @@
                and DATE(t1.create_time) between #{agentQuery.localDate1} and #{agentQuery.localDate2}
            </if>
        </where>
        order by t1.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
@@ -29,6 +29,7 @@
        t_user_point tup
        LEFT JOIN t_app_user tau ON tup.app_user_id = tau.id
        <where>
            tup.type not in (8, 9, 14)
            <if test="userPoint.userName != null and userPoint.userName != ''">
                AND tau.`name` LIKE concat('%',#{userPoint.userName},'%')
            </if>
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -1,12 +1,14 @@
package com.ruoyi.order.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.account.api.feignClient.UserAddressClient;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -19,6 +21,7 @@
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.util.payment.model.RefundCallbackResult;
import com.ruoyi.order.util.vo.MapTrackKD100Vo;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
@@ -206,6 +209,7 @@
    public R<Void> updateOrderStatus(@RequestBody Order order){
        Order order1 = orderService.getById(order.getId());
        order1.setOrderStatus(order.getOrderStatus());
        order1.setOldOrderStatus(order.getOldOrderStatus());
        orderService.updateById(order1);
        return R.ok();
    }
@@ -291,8 +295,10 @@
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>().eq(sysUser.getRoleType() == 2, Order::getShopId, sysUser.getObjectId())
                .between(Order::getCreateTime, LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))));
        List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>()
                .eq(sysUser.getRoleType() == 2, Order::getShopId, sysUser.getObjectId())
                .between(Order::getCreateTime, LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
                .orderByDesc(Order::getCreateTime));
        Map<String, List<Order>> map = orderList.stream().collect(Collectors.groupingBy(item -> item.getCreateTime()
@@ -437,5 +443,47 @@
        Set<Long> collect = list.stream().map(Order::getAppUserId).collect(Collectors.toSet());
        return R.ok(collect);
    }
    /**
     * 获取订单快递明细
     * @param id
     * @return
     */
    @GetMapping("/getOrderExpress/{id}")
    @ApiOperation(value = "获取订单快递明细", tags = {"小程序-订单管理"})
    public R<MapTrackKD100Vo> getOrderExpress(@PathVariable("id") Long id){
        Order order = orderService.getById(id);
        String expressResult = order.getExpressResult();
        if(StringUtils.isNotEmpty(expressResult)){
            MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(expressResult, MapTrackKD100Vo.class);
            return R.ok(mapTrackKD100Vo);
        }
        return R.ok();
    }
    /**
     * 根据id获取订单详情
     * @param id
     * @return
     */
    @PostMapping("/getOrderById")
    public R<Order> getOrderById(@RequestParam("id") Long id){
        Order order = orderService.getById(id);
        return R.ok(order);
    }
    /**
     * 修改订单
     * @param order
     * @return
     */
    @PostMapping("/editOrder")
    public R editOrder(@RequestBody Order order){
        orderService.updateById(order);
        return R.ok();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
@@ -43,10 +43,6 @@
    @Resource
    private TokenService tokenService;
    @Resource
    private GoodsShopClient goodsShopClient;
    @Resource
    private ShopClient shopClient;
    @Resource
    private AppUserClient appUserClient;
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -110,4 +110,9 @@
     * @return
     */
    Integer getShopSaleNum(Integer shopId, Integer type);
    /**
     * 定时查询快递信息
     */
    void taskExpress();
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -68,6 +68,9 @@
            List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
                    .eq(OrderGood::getOrderId, order.getId()));
            AppUser appUser = appUserClient.getAppUserById(order.getAppUserId());
            if(null == appUser){
                return;
            }
            //直推上级分佣金额
            BigDecimal ztsj_price = BigDecimal.ZERO;
            //直帮上级分佣金额
@@ -171,6 +174,7 @@
                    if(!inviteUser.getBalance().equals(balance)){
                        BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
                        balanceChangeRecord.setAppUserId(inviteUser.getId());
                        balanceChangeRecord.setVipId(inviteUser.getVipId());
                        balanceChangeRecord.setOrderId(order.getId());
                        balanceChangeRecord.setChangeType(4);
                        balanceChangeRecord.setBeforeAmount(balance);
@@ -229,6 +233,7 @@
                if(!superiorLeader.getBalance().equals(balance)){
                    BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
                    balanceChangeRecord.setAppUserId(superiorLeader.getId());
                    balanceChangeRecord.setVipId(superiorLeader.getVipId());
                    balanceChangeRecord.setOrderId(order.getId());
                    balanceChangeRecord.setChangeType(4);
                    balanceChangeRecord.setBeforeAmount(balance);
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.feignClient.BalanceChangeRecordClient;
import com.ruoyi.account.api.feignClient.UserCouponClient;
import com.ruoyi.account.api.feignClient.UserPointClient;
import com.ruoyi.account.api.model.*;
import com.ruoyi.common.core.domain.R;
@@ -22,14 +23,12 @@
import com.ruoyi.order.model.OrderBalancePayment;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.order.model.RefundPass;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.order.service.OrderBalancePaymentService;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.RefundPassService;
import com.ruoyi.order.service.*;
import com.ruoyi.order.util.ExpressDeliveryUtil;
import com.ruoyi.order.util.payment.PaymentUtil;
import com.ruoyi.order.util.payment.model.RefundCallbackResult;
import com.ruoyi.order.util.payment.model.RefundResult;
import com.ruoyi.order.util.vo.MapTrackKD100Vo;
import com.ruoyi.order.util.vo.QueryKD100Vo;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.*;
@@ -37,6 +36,7 @@
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -44,6 +44,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@@ -102,6 +103,15 @@
    private TechnicianSubscribeClient technicianSubscribeClient;
    @Resource
    private ShopBalanceStatementClient shopBalanceStatementClient;
    @Resource
    private RedisTemplate redisTemplate;
    @Resource
    private SystemConfigClient systemConfigClient;
    @Resource
    private UserCouponClient userCouponClient;
    
    
@@ -187,6 +197,7 @@
        orderDetailVO.setAddressId(userAddress.getId());
        orderDetailVO.setRecieveName(userAddress.getRecieveName());
        orderDetailVO.setRecievePhone(userAddress.getRecievePhone());
        userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress());
        orderDetailVO.setRecieveAddress(userAddress.getRecieveAddress());
        orderDetailVO.setOrderNumber(order.getOrderNumber());
        orderDetailVO.setCreateTime(order.getCreateTime());
@@ -438,6 +449,7 @@
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
            balanceChangeRecord.setOrderId(order.getId());
            balanceChangeRecord.setAppUserId(order.getAppUserId());
            balanceChangeRecord.setVipId(appUser.getVipId());
            balanceChangeRecord.setChangeType(6);
            balanceChangeRecord.setBeforeAmount(balance);
            balanceChangeRecord.setChangeAmount(paymentAmount);
@@ -484,7 +496,12 @@
            userPoint.setObjectId(order.getId());
            userPointClient.saveUserPoint(userPoint);
            appUserClient.editAppUserById(appUser);
            //回退优惠券状态
            if(null != order.getUserCouponId()){
                UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData();
                userCoupon.setUseTime(null);
                userCouponClient.editReturnUse(userCoupon);
            }
        }
        if(3 == payMethod){
            //开始运费退款,积分支付,运费是单独进行支付的,所以需要单独退款
@@ -513,6 +530,7 @@
                    BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
                    balanceChangeRecord.setOrderId(order.getId());
                    balanceChangeRecord.setAppUserId(order.getAppUserId());
                    balanceChangeRecord.setVipId(appUser.getVipId());
                    balanceChangeRecord.setChangeType(6);
                    balanceChangeRecord.setBeforeAmount(balance);
                    balanceChangeRecord.setChangeAmount(expressAmount);
@@ -609,6 +627,13 @@
        userPoint.setObjectId(order.getId());
        userPointClient.saveUserPoint(userPoint);
        appUserClient.editAppUserById(appUser);
        //回退优惠券状态
        if(null != order.getUserCouponId()){
            UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData();
            userCoupon.setUseTime(null);
            userCouponClient.editReturnUse(userCoupon);
        }
        return R.ok();
    }
@@ -655,9 +680,6 @@
        userPoint.setAppUserId(order.getAppUserId());
        userPoint.setObjectId(order.getId());
        userPointClient.saveUserPoint(userPoint);
        order.setRefundStatus(2);
        order.setRefundTime(LocalDateTime.now());
        return R.ok();
    }
@@ -740,9 +762,10 @@
        if(StringUtils.isNotEmpty(order.getAddressJson())){
            UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class);
            orderInfo.setRecipient(userAddress.getRecieveName() + "-" + userAddress.getRecievePhone());
            userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress());
            orderInfo.setAddress(userAddress.getRecieveAddress());
        }
        if(StringUtils.isNotEmpty(order.getExpressJson())){
        if(StringUtils.isNotEmpty(order.getExpressJson()) && !"NULL".equals(order.getExpressJson())){
            JSONObject jsonObject = JSON.parseObject(order.getExpressJson());
            String com = jsonObject.getString("com");
            String num = jsonObject.getString("num");
@@ -811,4 +834,41 @@
    public Integer getShopSaleNum(Integer shopId, Integer type) {
        return this.baseMapper.getShopSaleNum(shopId, type);
    }
    /**
     * 定时查询快递信息
     */
    @Override
    public void taskExpress() {
        Set<Long> order_express = redisTemplate.opsForZSet().rangeByScore("order_express", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC));
        if(order_express.size() > 0){
            for (Long id : order_express) {
                Order order = this.getById(id);
                if(order.getOrderStatus() != 2){
                    redisTemplate.opsForZSet().remove("order_express", id);
                    continue;
                }
                String expressJson = order.getExpressJson();
                if(StringUtils.isEmpty(expressJson)){
                    redisTemplate.opsForZSet().remove("order_express", id);
                    continue;
                }
                //{"com":"jd","num":"JDV016336234367"}
                JSONObject jsonObject = JSON.parseObject(expressJson);
                String com = jsonObject.getString("com");
                String num = jsonObject.getString("num");
                UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class);
                MapTrackKD100Vo mapTrackKD100Vo = ExpressDeliveryUtil.kd100MapTrack(com, num, order.getDeliverProvince() + order.getDeliverCity(),
                        userAddress.getProvince() + userAddress.getCity());
                order.setExpressResult(JSON.toJSONString(mapTrackKD100Vo));
                this.updateById(order);
                //延长时间x小时
                SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
                JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent());
                Integer waitTime = jsonObject1.getInteger("waitTime");
                redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC));
            }
        }
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -144,8 +144,31 @@
        //查询符合商品类型的商品数据
        List<ShoppingCart> list = this.list(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid)
                .in(ShoppingCart::getGoodsId, goodsIds).eq(ShoppingCart::getStatus, 1));
        //删除过期的秒杀活动商品
        List<ShoppingCart> list1 = new ArrayList<>();
        for (ShoppingCart shoppingCart : list) {
            if(shoppingCart.getType() == 2){
                GetSeckillActivityInfo info = new GetSeckillActivityInfo();
                info.setGoodsId(shoppingCart.getGoodsId());
                info.setVip(appUser.getVipId());
                GoodsSeckill data1 = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
                if(null != data1){
                    SeckillActivityInfo seckillActivityInfo = seckillActivityInfoClient.getSeckillActivityInfoById(data1.getSeckillActivityInfoId()).getData();
                    if(null != seckillActivityInfo && (seckillActivityInfo.getIsShelves() == 1 &&
                            seckillActivityInfo.getStartTime().isBefore(LocalDateTime.now()) && seckillActivityInfo.getEndTime().isAfter(LocalDateTime.now()))){
                        list1.add(shoppingCart);
                        continue;
                    }
                }
                this.removeById(shoppingCart.getId());
            }else{
                list1.add(shoppingCart);
            }
        }
        //构建返回数据
        List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null);
        List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list1, null);
        return page;
    }
@@ -485,23 +508,34 @@
        //满XX才打折,只有现金才能优惠
        if((confirmOrderVo.getUseSimultaneously() || (!confirmOrderVo.getUseSimultaneously() && activityAmount.equals(BigDecimal.ZERO)))
                && null != orderActivityInfo && confirmOrder.getPaymentType() == 1){
            BigDecimal zyh = BigDecimal.ZERO;
            OrderActivityInfo activityInfo1 = null;
            for (OrderActivityInfo activityInfo : orderActivityInfo) {
                if(activityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){
                    confirmOrderVo.setActivityName(activityInfo.getActivityName());
                    //优惠后的支付金额
                    BigDecimal multiply = activityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
                    //优惠金额
                    BigDecimal bigDecimal = paymentMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN);
                    paymentMoney = multiply;
                    activityAmount = activityAmount.add(bigDecimal);
                    break;
                    if(bigDecimal.compareTo(zyh) > 0){
                        zyh = bigDecimal;
                        activityInfo1 = activityInfo;
                    }
                }
            }
            if(null != activityInfo1){
                confirmOrderVo.setActivityName(activityInfo1.getActivityName());
                paymentMoney = paymentMoney.subtract(zyh);
                activityAmount = activityAmount.add(zyh);
            }
        }
        confirmOrderVo.setDiscountAmount(activityAmount);
        int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum();
        confirmOrderVo.setEarnPoint(earnPoint);
        if(null != paymentMoney && BigDecimal.ZERO.compareTo(paymentMoney) > 0){
            paymentMoney = BigDecimal.ZERO;
        }
        //支付金额,订单金额-订单优惠
        confirmOrderVo.setPayMoney(paymentMoney);
        confirmOrderVo.setResidualPoint(appUser.getAvailablePoint().intValue());
@@ -509,6 +543,7 @@
        UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData();
        if(null != userAddress){
            userAddress.setIdStr(userAddress.getId().toString());
            userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress());
            confirmOrderVo.setUserAddress(userAddress);
        }
        confirmOrderVo.setPaymentType(confirmOrder.getPaymentType());
@@ -704,6 +739,14 @@
                    }
                }
            }
            if(goods.getStatus() == 1){
                throw new RuntimeException(goods.getName() + "商品已被下架");
            }
            if(!goods.getCommodityAuthority().contains("-1") && !goods.getCommodityAuthority().contains(appUser.getVipId().toString())){
                throw new RuntimeException("无权限购买" + goods.getName());
            }
            ids.add(id);
        }
@@ -760,9 +803,6 @@
        }else{
            for (MyShoppingCartVo myShoppingCartVo : goodsList) {
                orderPoint += (myShoppingCartVo.getPoint() * myShoppingCartVo.getNumber());
            }
            if(appUser.getLavePoint().intValue() < orderPoint){
                return R.fail("账户剩余积分不足");
            }
        }
        //现金的支付金额
@@ -856,17 +896,21 @@
        OrderActivityInfo orderActivityInfo1 = null;
        if((1 == status || null == shoppingCartPayment.getUserCouponId()) &&
                null != orderActivityInfo && shoppingCartPayment.getPaymentType() != 3){
            //找出最优会的金额
            BigDecimal zyh = BigDecimal.ZERO;
            for (OrderActivityInfo activityInfo : orderActivityInfo) {
                if(activityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){
                    BigDecimal paymentMoney1 = activityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
                    BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
                    discount = activityInfo.getDiscount();
                    paymentMoney = paymentMoney1;
                    activityAmount = activityAmount.add(bigDecimal);
                    if(bigDecimal.compareTo(zyh) > 0){
                        zyh = bigDecimal;
                    orderActivityInfo1 = activityInfo;
                    break;
                }
            }
            }
            paymentMoney = paymentMoney.subtract(zyh);
            activityAmount = activityAmount.add(zyh);
        }
        //可获得的消费积分
@@ -900,6 +944,10 @@
                }
            }
        }
        if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){
            paymentMoney = BigDecimal.ZERO;
        }
        //构建订单明细
        Order order = new Order();
        order.setAppUserId(userid);
@@ -931,8 +979,9 @@
        }
        if(3 != shoppingCartPayment.getPaymentType() && (fullReductionAmount.compareTo(BigDecimal.ZERO) > 0 ||moneyAmount.compareTo(BigDecimal.ZERO) > 0 || discountAmount.compareTo(BigDecimal.ZERO) > 0)){
            order.setCouponJson(JSON.toJSONString(couponInfoVo));
            order.setUserCouponId(shoppingCartPayment.getUserCouponId());
        }
        if(activityAmount.compareTo(BigDecimal.ZERO) > 0){
        if(null != orderActivityInfo1){
            order.setActivityJson(JSON.toJSONString(orderActivityInfo1));
        }
        if(null != shoppingCartPayment.getUserAddressId()){
@@ -956,7 +1005,7 @@
        if(3 == shoppingCartPayment.getPaymentType()){
            Integer availablePoint = appUser.getAvailablePoint();
            if(availablePoint < orderPoint){
                return R.fail("账户积分不足");
                return R.fail("账户可用积分不足");
            }
        }
        //判断运费支付是否足够
@@ -1019,7 +1068,11 @@
        //开始构建支付数据
        //现金支付
        paymentMoney = paymentMoney.add(expressFee).setScale(2, RoundingMode.HALF_EVEN);
        if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){
            paymentMoney = BigDecimal.ZERO;
        }
        if(1 == shoppingCartPayment.getPaymentType()){
            if(BigDecimal.ZERO.compareTo(paymentMoney) < 0){
            //调起微信支付
            String goodsNames = goodsList.stream().map(MyShoppingCartVo::getName).collect(Collectors.joining("\n"));
            UniPayResult uniPayResult = PaymentUtil.uniPay(order.getOrderNumber(), paymentMoney.doubleValue(), order.getOrderType() == 1 ? "购买服务商品" : "购买单品商品",
@@ -1034,6 +1087,79 @@
            long second = LocalDateTime.now().plusMinutes(15).toEpochSecond(ZoneOffset.UTC);
            redisTemplate.opsForZSet().add("OrderPayment", order.getOrderNumber(), second);
            return R.ok(jsonObject.toJSONString());
            }else{
                earnPoint = order.getGetPoint();
                appUser = appUserClient.getAppUserById(order.getAppUserId());
                Integer lavePoint = appUser.getLavePoint();
                paymentMoney = order.getPaymentAmount();
                //构建积分流水记录
                if(earnPoint > 0){
                    PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData();
                    int earnPoint1 = 0;
                    if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){
                        earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue();
                    }
                    appUser.setShopPoint(appUser.getShopPoint() + earnPoint);
                    appUser.setLavePoint(appUser.getLavePoint() + earnPoint);
                    appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint);
                    appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1);
                    appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + earnPoint1);
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("shopPoint", earnPoint);
                    jsonObject.put("availablePoint", earnPoint1);
                    if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){
                        appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1);
                        jsonObject.put("transferablePoint", earnPoint1);
                    }
                    UserPoint userPoint = new UserPoint();
                    userPoint.setType(1);
                    userPoint.setHistoricalPoint(lavePoint);
                    userPoint.setVariablePoint(earnPoint);
                    userPoint.setBalance(appUser.getLavePoint());
                    userPoint.setCreateTime(LocalDateTime.now());
                    userPoint.setAppUserId(appUser.getId());
                    userPoint.setObjectId(order.getId());
                    userPoint.setExtention(jsonObject.toJSONString());
                    userPointClient.saveUserPoint(userPoint);
                }
                appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN));
                appUser.setLastShopTime(LocalDateTime.now());
                appUserClient.editAppUserById(appUser);
                //变更等级
                appUserClient.vipUpgrade(appUser.getId());
                //修改订支付状态
                order.setPayStatus(2);
                //自提
                if(order.getOrderType() == 1 && StringUtils.isEmpty(order.getAddressJson())){
                    order.setOrderStatus(2);
                }
                orderService.updateById(order);
                //处理优惠券
                if(null != order.getUserCouponId()){
                    UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData();
                    if(null != userCoupon && null == userCoupon.getUseTime()){
                        userCoupon.setStatus(2);
                        userCoupon.setUseTime(LocalDateTime.now());
                        userCouponClient.editUserCoupon(userCoupon);
                    }
                }
                //添加查询快递信息队列
                if(StringUtils.isNotEmpty(order.getExpressJson())){
                    //一小时后定时查询快递信息
                    redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(1).toEpochSecond(ZoneOffset.UTC));
                }
                //删除购物车数据
                userid = tokenService.getLoginUserApplet().getUserid();
                List<OrderGood> list1 = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, order.getId()));
                List<Integer> goodsIds1 = list1.stream().map(OrderGood::getGoodsId).collect(Collectors.toList());
                this.remove(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid).in(ShoppingCart::getGoodsId, goodsIds1));
            }
        }
        //账户余额
        BigDecimal redPacketAmount = BigDecimal.ZERO;
@@ -1043,27 +1169,28 @@
            BigDecimal totalDistributionAmount = appUser.getTotalDistributionAmount();
            BigDecimal balance = appUser.getBalance();
            //红包金额满足支付
            if(paymentMoney.compareTo(totalRedPacketAmount) <= 0){
                totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney);
                balance = balance.subtract(paymentMoney);
            BigDecimal paymentMoney1 = paymentMoney;
            if(paymentMoney1.compareTo(totalRedPacketAmount) <= 0){
                totalRedPacketAmount = totalRedPacketAmount.subtract(paymentMoney1);
                balance = balance.subtract(paymentMoney1);
                appUser.setTotalRedPacketAmount(totalRedPacketAmount);
                appUser.setBalance(balance);
                redPacketAmount = paymentMoney;
                redPacketAmount = paymentMoney1;
            }else{
                paymentMoney = paymentMoney.subtract(totalRedPacketAmount);
                paymentMoney1 = paymentMoney1.subtract(totalRedPacketAmount);
                redPacketAmount = totalRedPacketAmount;
                totalRedPacketAmount = BigDecimal.ZERO;
                if(paymentMoney.compareTo(totalDistributionAmount) <= 0){
                    totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney);
                    balance = balance.subtract(paymentMoney);
                if(paymentMoney1.compareTo(totalDistributionAmount) <= 0){
                    totalDistributionAmount = totalDistributionAmount.subtract(paymentMoney1);
                    balance = balance.subtract(paymentMoney1);
                    appUser.setTotalRedPacketAmount(totalRedPacketAmount);
                    appUser.setTotalDistributionAmount(totalDistributionAmount);
                    appUser.setBalance(balance);
                    distributionAmount = paymentMoney;
                    distributionAmount = paymentMoney1;
                }else{
                    paymentMoney = paymentMoney.subtract(totalDistributionAmount);
                    paymentMoney1 = paymentMoney1.subtract(totalDistributionAmount);
                    totalDistributionAmount = BigDecimal.ZERO;
                    balance = balance.subtract(paymentMoney);
                    balance = balance.subtract(paymentMoney1);
                    appUser.setTotalRedPacketAmount(totalRedPacketAmount);
                    appUser.setTotalDistributionAmount(totalDistributionAmount);
                    appUser.setBalance(balance);
@@ -1112,6 +1239,7 @@
            //构建余额明细变动记录
            BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
            balanceChangeRecord.setAppUserId(appUser.getId());
            balanceChangeRecord.setVipId(appUser.getVipId());
            balanceChangeRecord.setOrderId(order.getId());
            balanceChangeRecord.setChangeType(5);
            balanceChangeRecord.setBeforeAmount(balance.add(paymentMoney));
@@ -1128,6 +1256,19 @@
            orderService.updateById(order);
            //删除购物车数据
            this.removeBatchByIds(ids);
            //处理优惠券
            if(null != order.getUserCouponId()){
                UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData();
                if(null != userCoupon && null == userCoupon.getUseTime()){
                    userCoupon.setUseTime(LocalDateTime.now());
                    userCouponClient.editUserCoupon(userCoupon);
                }
            }
            //添加查询快递信息队列
            if(StringUtils.isNotEmpty(order.getExpressJson())){
                //一小时后定时查询快递信息
                redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(1).toEpochSecond(ZoneOffset.UTC));
            }
        }
        //积分支付
        if(3 == shoppingCartPayment.getPaymentType()){
@@ -1189,27 +1330,28 @@
                    BigDecimal totalRedPacketAmount = appUser.getTotalRedPacketAmount();
                    BigDecimal totalDistributionAmount = appUser.getTotalDistributionAmount();
                    BigDecimal balance = appUser.getBalance();
                    if(expressFee.compareTo(totalRedPacketAmount) <= 0){
                        totalRedPacketAmount = totalRedPacketAmount.subtract(expressFee);
                        balance = balance.subtract(expressFee);
                    BigDecimal expressFee1 = expressFee;
                    if(expressFee1.compareTo(totalRedPacketAmount) <= 0){
                        totalRedPacketAmount = totalRedPacketAmount.subtract(expressFee1);
                        balance = balance.subtract(expressFee1);
                        appUser.setTotalRedPacketAmount(totalRedPacketAmount);
                        appUser.setBalance(balance);
                        redPacketAmount = expressFee;
                        redPacketAmount = expressFee1;
                    }else{
                        expressFee = expressFee.subtract(totalRedPacketAmount);
                        expressFee1 = expressFee1.subtract(totalRedPacketAmount);
                        redPacketAmount = totalRedPacketAmount;
                        totalRedPacketAmount = BigDecimal.ZERO;
                        if(expressFee.compareTo(totalDistributionAmount) <= 0){
                            totalDistributionAmount = totalDistributionAmount.subtract(expressFee);
                            balance = balance.subtract(expressFee);
                        if(expressFee1.compareTo(totalDistributionAmount) <= 0){
                            totalDistributionAmount = totalDistributionAmount.subtract(expressFee1);
                            balance = balance.subtract(expressFee1);
                            appUser.setTotalRedPacketAmount(totalRedPacketAmount);
                            appUser.setTotalDistributionAmount(totalDistributionAmount);
                            appUser.setBalance(balance);
                            distributionAmount = expressFee;
                            distributionAmount = expressFee1;
                        }else{
                            expressFee = expressFee.subtract(totalDistributionAmount);
                            expressFee1 = expressFee1.subtract(totalDistributionAmount);
                            totalDistributionAmount = BigDecimal.ZERO;
                            balance = balance.subtract(expressFee);
                            balance = balance.subtract(expressFee1);
                            appUser.setTotalRedPacketAmount(totalRedPacketAmount);
                            appUser.setTotalDistributionAmount(totalDistributionAmount);
                            appUser.setBalance(balance);
@@ -1221,10 +1363,11 @@
                    //构建余额明细变动记录
                    BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord();
                    balanceChangeRecord.setAppUserId(appUser.getId());
                    balanceChangeRecord.setVipId(appUser.getVipId());
                    balanceChangeRecord.setOrderId(order.getId());
                    balanceChangeRecord.setChangeType(5);
                    balanceChangeRecord.setBeforeAmount(balance.add(paymentMoney));
                    balanceChangeRecord.setChangeAmount(paymentMoney);
                    balanceChangeRecord.setBeforeAmount(balance.add(expressFee));
                    balanceChangeRecord.setChangeAmount(expressFee);
                    balanceChangeRecord.setAfterAmount(balance);
                    balanceChangeRecord.setDelFlag(0);
                    balanceChangeRecord.setCreateTime(LocalDateTime.now());
@@ -1247,6 +1390,14 @@
                orderService.updateById(order);
                //删除购物车数据
                this.removeBatchByIds(ids);
            }
            //添加查询快递信息队列
            if(StringUtils.isNotEmpty(order.getExpressJson())){
                //一小时后定时查询快递信息
                SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData();
                JSONObject jsonObject = JSON.parseObject(systemConfig.getContent());
                Integer waitTime = jsonObject.getInteger("waitTime");
                redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC));
            }
        }
@@ -1330,11 +1481,32 @@
            order.setOrderStatus(2);
        }
        orderService.updateById(order);
        //处理优惠券
        if(null != order.getUserCouponId()){
            UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData();
            if(null != userCoupon && null == userCoupon.getUseTime()){
                userCoupon.setStatus(2);
                userCoupon.setUseTime(LocalDateTime.now());
                userCouponClient.editUserCoupon(userCoupon);
            }
        }
        //添加查询快递信息队列
        if(StringUtils.isNotEmpty(order.getExpressJson())){
            //一小时后定时查询快递信息
            redisTemplate.opsForZSet().add("order_express", order.getId(), LocalDateTime.now().plusHours(1).toEpochSecond(ZoneOffset.UTC));
        }
        //删除购物车数据
        Long userid = tokenService.getLoginUserApplet().getUserid();
        Long userid = order.getAppUserId();
        List<OrderGood> list = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, order.getId()));
        List<Integer> goodsIds = list.stream().map(OrderGood::getGoodsId).collect(Collectors.toList());
        this.remove(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid).in(ShoppingCart::getGoodsId, goodsIds));
        //商品销量增加
        for (Integer goodsId : goodsIds) {
            goodsClient.editGoodsNum(goodsId, 1);
        }
        return R.ok();
    }
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/ExpressDeliveryUtil.java
@@ -68,7 +68,7 @@
     * 快递100查询带有地图轨迹数据的快递详情
     * @param com   快递公司代码
     * @param num   快递单号
     * @param from  触发城市名称
     * @param from  出发城市名称
     * @param to    到达城市名称
     * @return
     */
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/TaskUtil.java
@@ -1,6 +1,7 @@
package com.ruoyi.order.util;
import com.ruoyi.order.service.CommissionService;
import com.ruoyi.order.service.OrderService;
import com.ruoyi.order.service.ShoppingCartService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -21,6 +22,9 @@
    @Resource
    private ShoppingCartService shoppingCartService;
    
    @Resource
    private OrderService orderService;
    
    
@@ -28,6 +32,7 @@
    public void taskMonth() {
        commissionService.calculationCommission();
        shoppingCartService.closeOrder();
        orderService.taskExpress();
    }
    // 每天晚上23:59:59执行的定时任务
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java
@@ -28,8 +28,16 @@
     * 商户号
     */
    private static final String merchantNo = "888122600004175";
    /**
     * 平台-报备商户号
     */
    public static final String sysTradeMerchantNo = "777168500885852";
    
    private static final String format = "yyyy-MM-dd HH:mm:ss";
    /**
     * 支付回调地址
     */
    private static final String callbackUrl = "http://221.182.45.100:9000";
    
    
    /**
@@ -45,7 +53,7 @@
        //商户编号
        body.put("userNo", merchantNo);
        //报备商户号
        body.put("tradeMerchantNo", singlePay.getTradeMerchantNo());
//        body.put("tradeMerchantNo", singlePay.getTradeMerchantNo());
        //产品类型
        body.put("productCode", "BANK_PAY_DAILY_ORDER");
        //交易请求时间
@@ -83,7 +91,7 @@
         */
        body.put("paidUse", singlePay.getPaidUse());
        //商户通知地址
        body.put("callbackUrl", singlePay.getCallbackUrl());
        body.put("callbackUrl", callbackUrl + singlePay.getCallbackUrl());
        String sign = null;
        try {
            sign = sign(body);
@@ -205,17 +213,11 @@
    
    
    public static String sign(JSONObject body) {
        //构建字段顺序必须按照文档签名顺序
        Set<Map.Entry<String, Object>> entries = body.entrySet();
        List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries);
        // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序)
        Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() {
            public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) {
                return (o1.getKey()).compareTo(o2.getKey());
            }
        });
        // 构造签名键值对的格式
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, Object> item : infoIds) {
        for (Map.Entry<String, Object> item : entries) {
            if (item.getKey() != null || item.getKey() != "") {
                Object val = item.getValue();
                if (!(val == "" || val == null)) {
@@ -224,6 +226,7 @@
            }
        }
        sb.append(key);
        log.info("待签名串:{}", sb.toString());
        return MD5AndKL.MD5(sb.toString());
    }
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageListVo.java
@@ -35,6 +35,8 @@
    private BigDecimal point;
    @ApiModelProperty("订单状态(1待发货2待收货3待使用4已完成5已取消6已退款7售后中8已评价)")
    private Integer status;
    @ApiModelProperty("物流类型(1=自提,2=快递)")
    private Integer expressType;
    /**
     * 用户id
     */
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java
@@ -44,6 +44,8 @@
    private BigDecimal paymentAmount;
    @ApiModelProperty("获得积分")
    private Integer point;
    @ApiModelProperty("获得积分")
    private Integer getPoint;
    @ApiModelProperty("商品数量")
    private Integer goodsNum;
    @ApiModelProperty("商品信息")
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -60,7 +60,8 @@
            pay_method as paymentType,
            total_amount as orderMoney,
            point,
            order_status as status
            order_status as status,
            if(express_json is not null and express_json != 'NULL' and express_json != '', 2, 1) as expressType
        from t_order where del_flag = 0 and pay_status = 2
        <if test="null != item.code and '' != item.code">
            and order_number like CONCAT('%', #{item.code}, '%')
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
@@ -3,10 +3,20 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.other.api.domain.Banner;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.SeckillActivityInfo;
import com.ruoyi.other.service.BannerService;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.service.GoodsVipService;
import com.ruoyi.other.service.SeckillActivityInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -29,6 +39,19 @@
public class BannerController {
    @Resource
    private BannerService bannerService;
    @Resource
    private GoodsService goodsService;
    @Resource
    private GoodsVipService goodsVipService;
    @Resource
    private SeckillActivityInfoService seckillActivityInfoService;
    @Resource
    private TokenService tokenService;
    @Resource
    private AppUserClient appUserClient;
    @GetMapping("/list")
    @ApiOperation(value = "banner列表", tags = {"小程序-banner"})
    public R<List<Banner>> list(@ApiParam("名称") String name,
@@ -38,6 +61,36 @@
                .eq(jumpType!=null,Banner::getJumpType, jumpType)
                .eq(position!=null,Banner::getPosition, position)
                .list();
        Integer vipId = 0;
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            AppUser appUser = appUserClient.getAppUserById(userid);
            vipId = appUser.getVipId();
        }
        for (Banner banner : list) {
            Integer jumpType1 = banner.getJumpType();
            //商品详情
            if(null != jumpType1 && 3 == jumpType1){
                Goods goods = goodsService.getById(banner.getContent());
                if(null == goods || goods.getDelFlag() == 1){
                    banner.setJumpType(1);
                }
                if(!goods.getCommodityAuthority().contains("-1") && !goods.getCommodityAuthority().contains(vipId.toString())){
                    banner.setJumpType(1);
                }
            }
            //秒杀活动
            if(null != jumpType1 && 4 == jumpType1){
                SeckillActivityInfo activityInfo = seckillActivityInfoService.getById(banner.getContent());
                if(null == activityInfo || activityInfo.getDelFlag() == 1){
                    banner.setJumpType(1);
                }
                if(!activityInfo.getVipIds().contains(vipId.toString())){
                    banner.setJumpType(1);
                }
            }
        }
        return R.ok(list);
    }
    @PostMapping("/add")
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -159,19 +159,25 @@
        //查出指定人员可领取优惠券
        List<CouponInfo> list1 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 2).apply("FIND_IN_SET('" + appUserById.getId() + "', person_ids)").list();
        //查出指定会员可领取优惠劵
        List<CouponInfo> list2 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 3).apply("FIND_IN_SET('" + appUserById.getVipId() + "', person_ids)").list();
        List<CouponInfo> list2 = couponInfoService.lambdaQuery().le(CouponInfo::getSendStartTime, now).ge(CouponInfo::getSendEndTime, now).eq(CouponInfo::getPersonType, 3).apply("FIND_IN_SET('" + appUserById.getVipId() + "', vip_ids)").list();
        List<CouponInfo> returnList = new ArrayList<>();
        count(userid, list, returnList);
        count(userid, list1, returnList);
        count(userid, list2, returnList);
        return R.ok(returnList);
    }
    private void count(Long userid, List<CouponInfo> list1, List<CouponInfo> returnList) {
        for (CouponInfo couponInfo : list1) {
            Long count = appUserClient.getCouponCount(userid, couponInfo.getId()).getData();
            Long count = appUserClient.getCouponCount(-1L, couponInfo.getId()).getData();
            if(couponInfo.getSendNum() <= count){
                couponInfo.setMaxNum(count.intValue() - couponInfo.getSendNum());
                for (int i = 0; i < couponInfo.getMaxNum(); i++) {
                    returnList.add(couponInfo);
                }
                continue;
            }
            count = appUserClient.getCouponCount(userid, couponInfo.getId()).getData();
            couponInfo.setMaxNum(couponInfo.getMaxNum() - count.intValue());
            for (int i = 0; i < couponInfo.getMaxNum(); i++) {
                returnList.add(couponInfo);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -10,6 +10,7 @@
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.redis.annotation.DistributedLock;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.VipSettingClient;
@@ -209,5 +210,40 @@
        return R.ok(goods);
    }
    /**
     * 编辑商品
     * @param goods
     * @return
     */
    @PostMapping("/editGoodsList")
    public R editGoodsList(@RequestBody List<Goods> goods){
        goodsService.updateBatchById(goods);
        return R.ok();
    }
    /**
     * 商品销量增加
     */
    @PutMapping("/editGoodsNum")
    @DistributedLock(lockNamePre = "#goods_lock", lockNamePost = "#goodsId")
    public R<Void> editGoodsNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("num") Integer num){
        Goods goods = goodsService.getById(goodsId);
        goods.setSaleNum(goods.getSaleNum() + num);
        goodsService.updateById(goods);
        return R.ok();
    }
    /**
     * 获取所有商品
     * @return
     */
    @PostMapping("/getAllGoods")
    public R<List<Goods>> getAllGoods(){
        List<Goods> list = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag, 0).eq(Goods::getStatus, 2));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -9,6 +9,8 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.service.GoodsEvaluateService;
@@ -46,11 +48,17 @@
    private GoodsService goodsService;
    @Resource
    private TokenService tokenService;
    @Resource
    private OrderClient orderClient;
    @GetMapping("/goodsList")
    @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
    public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){
        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list();
        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0)
                .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "").orderByDesc(GoodsEvaluate::getCreateTime).list();
        for (GoodsEvaluate goodsEvaluate : list) {
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
            if(null != appUserById){
@@ -82,6 +90,7 @@
        List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>()
                .eq(GoodsEvaluate::getStatus, 2)
                .eq(GoodsEvaluate::getAppUserId,loginUserApplet.getUserid())
                .eq(GoodsEvaluate::getDelFlag, 0)
                .eq(GoodsEvaluate::getOrderId, orderId));
        for (GoodsEvaluate goodsEvaluate : list) {
            Goods goods = goodsService.getById(goodsEvaluate.getGoodsId());
@@ -98,22 +107,17 @@
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除评论", tags = {"管理后台-商品管理-评价管理"})
    public R<Void> delete(@PathVariable("id") Long id){
        goodsEvaluateService.removeById(id);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
        goodsEvaluate.setDelFlag(1);
        goodsEvaluateService.updateById(goodsEvaluate);
        //修改订单为待评价
        Order data = orderClient.getOrderById(goodsEvaluate.getOrderId()).getData();
        data.setOrderStatus(data.getOldOrderStatus());
        orderClient.editOrder(data);
        return R.ok();
    }
    public static void main(String[] args) {
        List<Integer> integers = new ArrayList<>();
        integers.add(1);
        integers.add(2);
        integers.add(3);
        integers.add(4);
        List<Integer> integers1 = new ArrayList<>();
        integers.retainAll(integers1);
        System.err.println(integers);
        System.err.println(integers1);
    }
    /**
     * 评论列表
@@ -153,6 +157,7 @@
                .in(!goodsIds.isEmpty(), GoodsEvaluate::getGoodsId, goodsIds)
                .in(!usersNameList.isEmpty(), GoodsEvaluate::getAppUserId, usersNameList)
                .eq(goodsEvaluate.getStatus() != null, GoodsEvaluate::getStatus, goodsEvaluate.getStatus())
                .eq(GoodsEvaluate::getDelFlag, 0)
                .orderByDesc(GoodsEvaluate::getCreateTime));
@@ -168,8 +173,10 @@
            item.setUserName(appUser.getName());
        }
        Goods goods = goodsService.getById(item.getGoodsId());
        if(null != goods){
        item.setGoodsName(goods.getName());
    }
    }
    /**
     * 评论详情
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java
@@ -62,7 +62,7 @@
    public R<Void> saveActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){
        orderActivityInfo.setIsShelf(0);
        if (org.springframework.util.StringUtils.hasLength(orderActivityInfo.getVipIds())){
            List<String> vipIds = Arrays.asList(orderActivityInfo.getVipIds().split(","));
            List<String> vipIds = new ArrayList<>(Arrays.asList(orderActivityInfo.getVipIds().split(",")));
            List<OrderActivityInfo> list = orderActivityInfoService.lambdaQuery()
                    .le(OrderActivityInfo::getStartTime, orderActivityInfo.getStartTime())
                    .or()
@@ -70,7 +70,7 @@
            if (!list.isEmpty()){
                for (OrderActivityInfo activityInfo : list) {
                    List<String> vips = Arrays.asList(activityInfo.getVipIds().split(","));
                    vipIds.retainAll(vips);
                    vipIds.addAll(vips);
                    if (!vipIds.isEmpty()){
                        StringBuilder message = new StringBuilder();
                        List<String> collect = vips.stream().sorted().collect(Collectors.toList());
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java
@@ -13,6 +13,9 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
@@ -63,23 +66,11 @@
    @PostMapping("/addRedPackegeSet")
    @Transactional(rollbackFor = Exception.class)
    public R<Void> addRedPackegeSet(@RequestBody RedPackegeSetDto redPackegeSets){
        redPackegeSetService.remove(null);
        List<RedPackegeSet> redPackegeSetList = redPackegeSets.getRedPackegeSets();
        for (int i = 0; i < redPackegeSetList.size(); i++) {
            RedPackegeSet redPackegeSet = redPackegeSetList.get(i);
            LocalDateTime startTime = redPackegeSet.getStartTime();
            LocalDateTime endTime = redPackegeSet.getEndTime();
            for (int j = 0; j < redPackegeSetList.size(); j++) {
                RedPackegeSet redPackegeSet1 = redPackegeSetList.get(j);
                LocalDateTime startTime1 = redPackegeSet1.getStartTime();
                LocalDateTime endTime1 = redPackegeSet1.getEndTime();
                if(i != j && ((startTime.isAfter(startTime1) && endTime.isBefore(endTime1))
                        || (startTime.isBefore(startTime1) && endTime.isAfter(startTime1) && endTime.isBefore(endTime1))
                        || (startTime.isAfter(startTime1) && startTime.isBefore(endTime1)  && endTime.isAfter(endTime1)))){
                    return R.fail("时间有重叠,请重新配置");
        if (hasOverlap(redPackegeSetList)) {
            return R.fail("时间段存在重叠,请重新配置");
                }
            }
        }
        redPackegeSetService.remove(null);
        redPackegeSetService.saveBatch(redPackegeSetList);
        return R.ok();
    }
@@ -94,5 +85,44 @@
        return R.ok();
    }
    public static boolean hasOverlap(List<RedPackegeSet> redPackegeSetList) {
        // 首先根据startTime对列表进行排序
        Collections.sort(redPackegeSetList, Comparator.comparing(RedPackegeSet::getStartTime));
        // 然后检查是否存在重叠
        for (int i = 0; i < redPackegeSetList.size() - 1; i++) {
            RedPackegeSet current = redPackegeSetList.get(i);
            RedPackegeSet next = redPackegeSetList.get(i + 1);
            // 如果当前时间段的结束时间晚于或等于下一个时间段的开始时间,则存在重叠
            if (current.getEndTime().isAfter(next.getStartTime()) ||
                    current.getEndTime().isEqual(next.getStartTime())) {
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        // 示例数据
        RedPackegeSet redPackegeSet = new RedPackegeSet();
        redPackegeSet.setStartTime(LocalDateTime.of(2025, 1, 13, 0, 0));
        redPackegeSet.setEndTime(LocalDateTime.of(2025, 1, 14, 0, 0));
        RedPackegeSet redPackegeSet2 = new RedPackegeSet();
        redPackegeSet2.setStartTime(LocalDateTime.of(2025, 1, 13, 0, 0));
        redPackegeSet2.setEndTime(LocalDateTime.of(2025, 1, 14, 0, 0));
        List<RedPackegeSet> redPackegeSetList = Arrays.asList(
                redPackegeSet,redPackegeSet2
        );
        boolean overlapExists = hasOverlap(redPackegeSetList);
        System.out.println("是否存在重叠: " + overlapExists);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java
@@ -198,5 +198,6 @@
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -4,16 +4,22 @@
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.feignClient.UserPointClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserPoint;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
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.PointSetting;
import com.ruoyi.other.api.domain.Share;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.feignClient.ShopClient;
import com.ruoyi.other.enums.ShareAddType;
import com.ruoyi.other.enums.ShareAuditStatus;
import com.ruoyi.other.service.PointSettingService;
import com.ruoyi.other.service.ShareService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
@@ -22,6 +28,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -46,6 +53,10 @@
    private ShopClient shopClient;
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private UserPointClient userPointClient;
    @Resource
    private PointSettingService pointSettingService;
    
    
@@ -166,7 +177,7 @@
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        if (sysUser.getRoleType()==1) {
            Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).eq(Share::getDelFlag, 0).like(name != null, Share::getName, name)
                    .eq(Share::getAddType, 1).page(Page.of(pageNum, pageSize));
                    .eq(addType != null , Share::getAddType, addType).page(Page.of(pageNum, pageSize));
            return R.ok(page);
        }else {
            Page<Share> page = shareService.lambdaQuery().eq(Share::getAddType,3).eq(Share::getDelFlag, 0).eq(Share::getObjectId, sysUser.getObjectId())
@@ -239,6 +250,38 @@
    @GetMapping("/auth/getAppletShare")
    public R<Share> getAppletShare(){
        Share one = shareService.getOne(new LambdaQueryWrapper<Share>().eq(Share::getDelFlag, 0).eq(Share::getAppletShare, 1).eq(Share::getAuditStatus, 1).last(" limit 0, 1"));
        //添加每日分享积分
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            Boolean data = userPointClient.judgmentDailyShare(userid).getData();
            if(!data){
                AppUser appUser = appUserClient.getAppUserById(userid);
                PointSetting pointSetting = pointSettingService.getOne(new LambdaQueryWrapper<PointSetting>().eq(PointSetting::getId, appUser.getVipId()).eq(PointSetting::getDelFlag, 0));
                if(null != pointSetting){
                    Integer everySharePoint = pointSetting.getEverySharePoint();
                    Integer lavePoint = appUser.getLavePoint();
                    appUser.setTotalSharePoint(appUser.getTotalSharePoint() + everySharePoint);
                    appUser.setLavePoint(appUser.getLavePoint() + everySharePoint);
                    appUser.setAvailablePoint(appUser.getAvailablePoint() + everySharePoint);
                    appUser.setTransferablePoint(appUser.getTransferablePoint() + everySharePoint);
                    appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + everySharePoint);
                    appUser.setTotalPoint(appUser.getTotalPoint() + everySharePoint);
                    appUserClient.editAppUserById(appUser);
                    //添加积分流水
                    UserPoint userPoint = new UserPoint();
                    userPoint.setAppUserId(userid);
                    userPoint.setType(4);
                    userPoint.setHistoricalPoint(lavePoint);
                    userPoint.setVariablePoint(everySharePoint);
                    userPoint.setBalance(appUser.getLavePoint());
                    userPoint.setCreateTime(LocalDateTime.now());
                    userPoint.setAppUserId(appUser.getId());
                    userPointClient.saveUserPoint(userPoint);
                }
            }
        }
        return R.ok(one);
    }
    
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -15,6 +15,8 @@
import com.ruoyi.other.service.ShopBalanceStatementService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.ShopCommissionStatisticsVO;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -23,6 +25,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.List;
@@ -45,9 +48,10 @@
    private TokenService tokenService;
    @Resource
    private ShopBalanceStatementMapper shopBalanceStatementMapper;
    @Resource
    private ShopService shopService;
    @Resource
    private SysUserClient sysUserClient;
    
    
    
@@ -69,7 +73,10 @@
    public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum,
                                                                  @ApiParam("每一页数据大小") Integer pageSize,
                                                                  ShopBalanceStatement shopBalanceStatement){
        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
        Long userid = tokenService.getLoginUser().getUserid();
        R<SysUser> sysUserR = sysUserClient.getSysUser(userid);
        SysUser sysUser = sysUserR.getData();
        Integer objectId = sysUser.getObjectId();
        Page<ShopBalanceStatement> page = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(shopBalanceStatement.getType() != null, ShopBalanceStatement::getType, shopBalanceStatement.getType())
                .orderByDesc(ShopBalanceStatement::getCreateTime)
                .page(Page.of(pageNum, pageSize));
@@ -159,9 +166,19 @@
     * @return
     */
    @PostMapping("/getShopBalanceStatementList")
    public R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam("objectId") Long objectId){
        List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>().eq(ShopBalanceStatement::getObjectId, objectId)
                .in(ShopBalanceStatement::getType, types));
    public R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam(value = "objectId",required = false) Long objectId){
        List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>()
                .eq(objectId != null,ShopBalanceStatement::getObjectId, objectId)
                .in(types !=null && !types.isEmpty(),ShopBalanceStatement::getType, types));
        return R.ok(list);
    }
    @PostMapping("/getShopBalanceStatementList2")
    public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type,
                                                                      @RequestParam(value = "date") LocalDateTime date){
        List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>()
                .eq(ShopBalanceStatement::getType, type)
                .in(ShopBalanceStatement::getCreateTime, date));
        return R.ok(list);
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -94,10 +94,10 @@
    @Transactional(rollbackFor = Exception.class)
    public R<Void> add(@RequestBody Shop shop){
        String phone = shop.getPhone();
        if (!shopService.cheUserByPhone(phone)) {
        AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData();
        if (appUser == null){
            return R.fail("该手机号未注册");
        }
        AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData();
        shop.setShopAllPoint(0);
        shop.setLowerLevelSharePoint(0);
        shop.setSharePoint(0);
@@ -119,9 +119,11 @@
        shop.setDistrictCode(city);
        shopService.save(shop);
        Integer shopId = shop.getId();
        AppUserShop appUserShop = new AppUserShop();
        appUserShop.setAppUserId(appUser.getId());
        appUserShop.setShopId(shop.getId());
        appUserShop.setShopId(shopId);
        R<Void> r = appUserClient.addAppUserShop(appUserShop);
        if (R.isError(r)){
            throw new RuntimeException("添加失败");
@@ -136,14 +138,14 @@
        if(null != sysUser){
            UserShop userShop = new UserShop();
            userShop.setUserId(sysUser.getUserId());
            userShop.setShopId(shop.getId());
            userShop.setShopId(shopId);
            userShop.setRoleType(1);
            userShop.setNickName(sysUser.getNickName());
            List<UserShop> data = userShopClient.getUserShop(userShop).getData();
            if(null == data || data.size() == 0){
                userShop = new UserShop();
                userShop.setUserId(sysUser.getUserId());
                userShop.setShopId(shop.getId());
                userShop.setShopId(shopId);
                userShop.setRoleType(1);
                userShop.setRoleId(2L);
                userShop.setCreateTime(LocalDateTime.now());
@@ -160,7 +162,7 @@
            user.setStatus("0");
            user.setDelFlag("0");
            user.setRoleType(2);
            user.setObjectId(shop.getId());
            user.setObjectId(shopId);
            user.setAppUserId(appUser.getId());
            user.setPassword(phone.substring(5));
            user.setCreateTime(new Date());
@@ -168,10 +170,16 @@
            UserShop userShop = new UserShop();
            userShop.setUserId(userId);
            userShop.setShopId(shop.getId());
            userShop.setShopId(shopId);
            userShop.setRoleType(1);
            userShop.setRoleId(2L);
            userShopClient.saveUserShop(userShop);
        }
        // 更换下级会员绑定门店
        R<List<AppUser>> lowerShopR = appUserClient.setLowerUserShop(appUser.getId(), shopId);
        if (R.isError(lowerShopR)){
            throw new RuntimeException("更换下级会员绑定门店失败");
        }
        return R.ok();
    }
@@ -187,6 +195,14 @@
    @DeleteMapping("/deleteShop")
    @ApiOperation(value = "删除门店", tags = {"管理后台-门店管理"})
    public R<Void> deleteShop(@ApiParam("门店id") @RequestParam("id") Integer id){
        List<Goods> list1 = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag, 0).eq(Goods::getAppointStore, 1).eq(Goods::getStatus, 2));
        if(list1.size() > 0){
            Set<Integer> collect1 = list1.stream().map(Goods::getId).collect(Collectors.toSet());
            long count = goodsShopService.count(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getShopId, id).in(GoodsShop::getGoodsId, collect1));
            if(0 < count){
                return R.fail("门店已被商品使用,不能删除");
            }
        }
        Shop shop = shopService.getById(id);
        shop.setDelFlag(1);
        shopService.updateById(shop);
@@ -244,6 +260,9 @@
            }
        }
        String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false);
        if(!StringUtils.hasLength(city)){
            city = "510100";
        }
        shop.setProvinceCode(city.substring(0, 2) + "0000");
        shop.setCityCode(city.substring(0, 4) + "00");
        shop.setDistrictCode(city);
@@ -421,7 +440,12 @@
                return R.ok(new ArrayList<>());
            }
            List<Integer> shopIds = appUserShopList.stream().map(AppUserShop::getShopId).collect(Collectors.toList());
            List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
            List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0));
            long count = shopList.stream().filter(s -> s.getStatus() == 1).count();
            if(shopList.size() > 0 && count == 0){
                return R.fail("操作失败,当前门店已冻结");
            }
            shopList = shopList.stream().filter(s -> s.getStatus() == 1).collect(Collectors.toList());
            if(null != appUser.getShopId()){
                Optional<Shop> first = shopList.stream().filter(s -> s.getId().equals(appUser.getShopId())).findFirst();
                if(first.isPresent()){
@@ -525,8 +549,13 @@
        return R.ok(list);
    }
    @GetMapping("/getShopIdByName")
    R<Set<Integer>> getShopIdByName(@RequestParam String shopName){
    /**
     * 根据名称查询门店id
     * @param shopName
     * @return
     */
    @PostMapping("/getShopIdByName")
    public R<Set<Integer>> getShopIdByName(@RequestParam("shopName") 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()));
@@ -615,7 +644,9 @@
        userShop.setUserId(userid);
        List<UserShop> data = userShopClient.getUserShop(userShop).getData();
        List<Integer> collect = data.stream().map(UserShop::getShopId).collect(Collectors.toList());
        List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getId, collect).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>()
                .in(!CollectionUtils.isEmpty(collect),Shop::getId, collect)
                .eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        List<VerifiableShopVo> list = new ArrayList<>();
        for (Shop shop : shops) {
            VerifiableShopVo vo = new VerifiableShopVo();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java
@@ -26,10 +26,12 @@
import com.ruoyi.other.util.payment.model.SinglePayCallbackResult;
import com.ruoyi.other.util.payment.model.SinglePayResult;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
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.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -66,6 +68,9 @@
    @Resource
    private AppUserClient appUserClient;
    
    @Resource
    private SysUserClient sysUserClient;
    
    
@@ -77,8 +82,13 @@
    public R<IPage<ShopWithdraw>> list(@ApiParam("页码") @RequestParam Integer pageNum,
                         @ApiParam("每一页数据大小") Integer pageSize,
                         ShopWithdraw shopWithdraw) {
        List<Shop> list = shopService.list(new LambdaUpdateWrapper<Shop>().like(StringUtils.isNotEmpty(shopWithdraw.getShopName()), Shop::getName, shopWithdraw.getShopName()).eq(Shop::getDelFlag, 0));
        List<Shop> list = shopService.list(new LambdaUpdateWrapper<Shop>()
                .like(StringUtils.isNotEmpty(shopWithdraw.getShopName()), Shop::getName, shopWithdraw.getShopName())
                .eq(Shop::getDelFlag, 0));
        List<Integer> collect1 = list.stream().map(Shop::getId).collect(Collectors.toList());
        if (CollectionUtils.isEmpty(collect1)){
            return R.ok(Page.of(pageNum, pageSize));
        }
        Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>()
                .in(collect1.size() > 0, ShopWithdraw::getShopId, collect1));
        List<ShopWithdraw> records = page.getRecords();
@@ -88,10 +98,11 @@
            shops = shopService.listByIds(collect);
        }
        for(ShopWithdraw item : records){
            Optional<Shop> first = shops.stream().filter(s -> s.getId().equals(item.getId())).findFirst();
            Optional<Shop> first = shops.stream().filter(s -> s.getId().equals(item.getShopId())).findFirst();
            if(first.isPresent()){
                item.setShopName(first.get().getName());
            }
            item.setIdStr(item.getId().toString());
        }
        return R.ok(page);
    }
@@ -107,6 +118,7 @@
                        .eq(shopWithdraw.getAuditStatus()!=null,ShopWithdraw::getAuditStatus,shopWithdraw.getAuditStatus())
                        .orderByDesc(ShopWithdraw::getCreateTime)
                );
        page.getRecords().forEach(s->s.setIdStr(s.getId().toString()));
        return R.ok(page);
    }
@@ -121,7 +133,8 @@
    @GetMapping("/shop/with")
    @ApiOperation(value = "提现申请", notes = "提现申请列表", tags = {"门店后台"})
    public R shopwith(@RequestParam BigDecimal money){
        SysUser sysUser = tokenService.getLoginUser().getSysUser();
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Integer objectId = sysUser.getObjectId();
        Shop shop = shopService.getById(objectId);
        if (money.compareTo(shop.getCanWithdrawMoney())>0){
@@ -179,12 +192,12 @@
                return R.fail("查询账户余额出错");
            }
            Double useAbleSettAmount = accountBalanceQueryResult.getUseAbleSettAmount();
            if(useAbleSettAmount < shopWithdraw1.getMoney().doubleValue()){
            if(useAbleSettAmount < (shopWithdraw1.getMoney().doubleValue() + 1)){
                return R.fail("账户可用余额不足,请先补充账户余额");
            }
            //银行卡转账
            SinglePay singlePay = new SinglePay();
            singlePay.setTradeMerchantNo("");
            singlePay.setTradeMerchantNo(TransferUtil.sysTradeMerchantNo);
            singlePay.setMerchantOrderNo(shopWithdraw1.getId().toString());
            singlePay.setReceiverAccountNoEnc(shop.getReceiverAccountNoEnc());
            singlePay.setReceiverNameEnc(shop.getReceiverNameEnc());
@@ -238,7 +251,7 @@
    @PostMapping("/withdrawalCallback")
    public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){
        Integer status = singlePayCallbackResult.getStatus();
        if(203 == status){
        if(203 == status || 205 == status){
            String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo();
            ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo);
            if(1 == shopWithdraw.getStatus()){
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -4,7 +4,9 @@
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.feignClient.AppUserShopClient;
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.core.web.page.TableDataInfo;
@@ -46,6 +48,8 @@
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private AppUserShopClient appUserShopClient;
@@ -66,10 +70,11 @@
    @GetMapping("/manage/list")
    @ApiOperation(value = "技师列表", tags = {"门店-技师列表"})
    public R<Page<Technician>> managelist(@RequestParam Integer pageNum,@RequestParam Integer pageSize,@ApiParam("技师姓名") String name,@ApiParam("技师电话") String phone) {
        Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId();
        Long userid = tokenService.getLoginUser().getSysUser().getUserId();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Page<Technician> page = technicianService.lambdaQuery().like(name != null, Technician::getName, name)
                .like(phone != null, Technician::getPhone, phone)
                .eq(Technician::getShopId, objectId)
                .eq(Technician::getShopId, sysUser.getObjectId())
                .page(Page.of(pageNum, pageSize));
        return R.ok(page);
    }
@@ -79,8 +84,11 @@
    @PostMapping("/manage/addorupdate")
    @ApiOperation(value = "添加编辑", tags = {"门店-技师列表"})
    public R<Page<Technician>> add(@RequestBody Technician technician) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        if (technician.getId()==null) {
            technician.setSubscribeStatus(2);
            List<Technician> list = technicianService.lambdaQuery().eq(Technician::getPhone, technician.getPhone()).eq(Technician::getShopId, sysUser.getObjectId()).list();
@@ -88,9 +96,17 @@
                return R.fail("当前号码已经添加");
            }
            R<AppUser> appUserByPhone1 = appUserClient.getAppUserByPhone1(technician.getPhone());
            if (appUserByPhone1.getData()==null){
            AppUser appUser = appUserByPhone1.getData();
            if (appUser ==null){
                return R.fail("当前号码暂无注册用户");
            }
            appUser.setUserType(2);
            appUserClient.editAppUserById(appUser);
            AppUserShop appUserShop = new AppUserShop();
            appUserShop.setShopId(sysUser.getObjectId());
            appUserShop.setAppUserId(appUser.getId());
            appUserShopClient.saveAppUserShop(appUserShop);
        }else {
            Technician byId = technicianService.getById(technician.getId());
            if (byId.getPhone()!=technician.getPhone()){
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java
@@ -26,10 +26,9 @@
    /**
     * 获取商品列表
     * @param pageInfo
     * @param goodsCategoryId
     * @param name
     * @return
     */
    List<GoodsVO> goodsList(PageInfo<GoodsVO> pageInfo, @Param("goodsCategoryId") Integer goodsCategoryId, @Param("name") String name, @Param("vip") Integer vip);
    List<GoodsVO> goodsList(@Param("goodsCategoryId") Integer goodsCategoryId, @Param("name") String name, @Param("vip") Integer vip);
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsBargainPriceServiceImpl.java
@@ -86,7 +86,7 @@
        bargainPrice = new GoodsBargainPrice();
        bargainPrice.setShopId(sysUser.getObjectId());
        bargainPrice.setGoodsId(vo.getGoodsId());
        bargainPrice.setAuditStatus(1);
        bargainPrice.setAuditStatus(0);
        bargainPrice.setDelFlag(0);
        bargainPrice.setCreateTime(LocalDateTime.now());
        bargainPrice.setCreateUserId(userid);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsEvaluateServiceImpl.java
@@ -5,6 +5,7 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.other.mapper.GoodsEvaluateMapper;
@@ -16,6 +17,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -32,6 +34,8 @@
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @Resource
    private TokenService tokenService;
    @Resource
    private OrderClient orderClient;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -45,12 +49,16 @@
            }else {
                LoginUser loginUserApplet = tokenService.getLoginUserApplet();
                goodsEvaluate.setAppUserId(loginUserApplet.getUserid());
                goodsEvaluate.setCreateTime(LocalDateTime.now());
                save(goodsEvaluate);
            }
        }
        if (CollectionUtil.isNotEmpty(evaluates)){
            Long orderId = goodsEvaluateVO.getEvaluates().get(0).getOrderId();
            Order data = orderClient.getOrderById(orderId).getData();
            Order order = new Order();
            order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId());
            order.setId(data.getId());
            order.setOldOrderStatus(data.getOrderStatus());
            order.setOrderStatus(8);
            R<Void> r = remoteOrderGoodsClient.updateOrderStatus(order);
            if (R.isError(r)){
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.other.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -86,16 +87,17 @@
    private GoodsBargainPriceDetailService goodsBargainPriceDetailService;
    @Resource
    private OrderClient orderClient;
    @Resource
    private GoodsEvaluateService goodsEvaluateService;
    @Override
    public PageInfo<GoodsVO> goodsList(Goods search) {
        PageInfo<GoodsVO> pageInfo = new PageInfo(search.getPageCurr(), search.getPageSize());
        Integer vipId = 0;
        String provinceCode = null;
        String cityCode = null;
        String districtCode = null;
        String provinceCode = "0";
        String cityCode = "0";
        String districtCode = "0";
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
@@ -105,7 +107,7 @@
            cityCode = appUser.getCityCode();
            districtCode = appUser.getDistrictCode();
        }
        List<GoodsVO> list = this.baseMapper.goodsList(pageInfo, search.getGoodsCategoryId(), search.getName(), vipId);
        List<GoodsVO> list = this.baseMapper.goodsList(search.getGoodsCategoryId(), search.getName(), vipId);
        for (GoodsVO goods : list) {
            Price price = getPrice(vipId, goods.getGoodsId(), null, 1, provinceCode, cityCode, districtCode);
            if(null != price){
@@ -116,6 +118,66 @@
            }
            Integer data = orderClient.getGoodsSaleNum(goods.getGoodsId(), 1).getData();
            goods.setSaleNum(data);
        }
        //手动排序
        if(StringUtils.isNotEmpty(search.getOrderByColumn())){
            if("selling_price".equals(search.getOrderByColumn())){
                list.sort(new Comparator<GoodsVO>() {
                    @Override
                    public int compare(GoodsVO o1, GoodsVO o2) {
                        if(null != o1.getSellingPrice() && null != o2.getSellingPrice()){
                            return o1.getSellingPrice().compareTo(o2.getSellingPrice()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                        }
                        if(null == o1.getSellingPrice() && null != o2.getSellingPrice()){
                            return BigDecimal.ZERO.compareTo(o2.getSellingPrice()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                        }
                        if(null != o1.getSellingPrice() && null == o2.getSellingPrice()){
                            return o1.getSellingPrice().compareTo(BigDecimal.ZERO) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                        }
                        return 0;
                    }
                });
            }
            if("integral".equals(search.getOrderByColumn())){
                list.sort(new Comparator<GoodsVO>() {
                    @Override
                    public int compare(GoodsVO o1, GoodsVO o2) {
                        if(null != o1.getIntegral() && null != o2.getIntegral()){
                            return o1.getIntegral().compareTo(o2.getIntegral()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                        }
                        if(null == o1.getIntegral() && null != o2.getIntegral()){
                            return Integer.valueOf(0).compareTo(o2.getIntegral()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                        }
                        if(null != o1.getIntegral() && null == o2.getIntegral()){
                            return o1.getIntegral().compareTo(Integer.valueOf(0)) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                        }
                        return 0;
                    }
                });
            }
            if("sale_num".equals(search.getOrderByColumn())){
                list.sort(new Comparator<GoodsVO>() {
                    @Override
                    public int compare(GoodsVO o1, GoodsVO o2) {
                        return o1.getSaleNum().compareTo(o2.getSaleNum()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
                    }
                });
            }
        }
        //手动处理分页
        PageInfo<GoodsVO> pageInfo = new PageInfo<>();
        pageInfo.setSize(search.getPageSize());
        pageInfo.setTotal(list.size());
        Integer pageSize = search.getPageSize();
        Integer pageNum = (search.getPageCurr() - 1) * pageSize;
        if(list.size() >= (pageNum + 1) * pageSize){
            list = list.subList(pageNum, pageNum + pageSize);
        }else if(pageNum < list.size() && list.size() < (pageNum + 1) * pageSize){
            list = list.subList(pageNum, list.size());
        }else{
            list = new ArrayList<>();
        }
        return pageInfo.setRecords(list);
    }
@@ -141,6 +203,15 @@
        }
        Goods goods = this.getById(goodsId);
        if(null == goods || goods.getDelFlag() == 1){
            throw new RuntimeException("商品不存在");
        }
        if(goods.getStatus() == 1){
            throw new RuntimeException("商品已被下架");
        }
        if(!goods.getCommodityAuthority().contains("-1") && !goods.getCommodityAuthority().contains(vipId.toString())){
            throw new RuntimeException("权限不足");
        }
        GoodsVO goodsVO = new GoodsVO();
        BeanUtils.copyBeanProp(goodsVO, goods);
        goodsVO.setGoodsId(goods.getId());
@@ -189,6 +260,18 @@
        }
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData();
        goodsVO.setSaleNum(integer);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).ne(GoodsEvaluate::getComment, "")
                .orderByDesc(GoodsEvaluate::getGrade).eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment)
                .eq(GoodsEvaluate::getDelFlag, 0).last(" limit 0, 1").one();
        if (null != goodsEvaluate) {
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
            if(null != appUserById){
                goodsEvaluate.setUserName(appUserById.getName());
                goodsEvaluate.setAvatar(appUserById.getAvatar());
                goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
            }
        }
        goodsVO.setGoodsEvaluate(goodsEvaluate);
        return goodsVO;
    }
@@ -225,7 +308,12 @@
    @Override
    public IPage<Goods> getManageGoodsList(Page<Goods> page, Goods goods) {
        return goodsMapper.selectManageGoodsList(page, goods);
        IPage<Goods> goodsIPage = goodsMapper.selectManageGoodsList(page, goods);
        goodsIPage.getRecords().forEach(goods1 -> {
            Integer data = orderClient.getGoodsSaleNum(goods1.getId(), 1).getData();
            goods1.setSaleNum(data);
        });
        return goodsIPage;
    }
    @Override
@@ -265,7 +353,10 @@
    @Override
    public void updateManageGoods(Goods goods) {
        goodsMapper.updateById(goods);
        this.updateById(goods);
        //修改个别字段
        this.update(new LambdaUpdateWrapper<Goods>().eq(Goods::getId, goods.getId()).set(Goods::getSellingPrice, goods.getSellingPrice())
                .set(Goods::getIntegral, goods.getIntegral()));
        // 指定门店
        List<GoodsShop> goodsShopList = goods.getGoodsShopList();
        saveGoodsShopList(goodsShopList, goods.getId());
@@ -283,6 +374,10 @@
        saveGoodsAreaList(goodsAreaList, goods.getId());
    }
    private void saveGoodsAreaList(List<GoodsArea> goodsAreaList, Integer id) {
        goodsAreaService.remove(new LambdaQueryWrapper<GoodsArea>()
                .eq(GoodsArea::getGoodsId, id));
@@ -299,7 +394,7 @@
                    area.setProvinceCode(goodsArea.getProvinceCode());
                    area.setCityCode(goodsArea.getCityCode());
                    area.setDistrictsCode(goodsArea.getDistrictsCode());
                    if(null != area.getSellingPrice() && null != area.getIntegral()){
                    if(null != area.getSellingPrice() || null != area.getIntegral()){
                        goodsAreaList2.add(area);
                    }
                }
@@ -370,6 +465,7 @@
        List<AppUser> appUsers = appUserClient.listByIds(userIds);
        for (GoodsAppUser goodsAppUser : goodsAppUserList) {
            appUsers.stream().filter(u -> u.getId().equals(goodsAppUser.getAppUserId())).findFirst().ifPresent( u -> {
                goodsAppUser.setAppUserIdStr(goodsAppUser.getAppUserId().toString());
                goodsAppUser.setUserName(u.getName());
                goodsAppUser.setPhone(u.getPhone());
                VipSetting vipSetting = vipSettingService.getById(u.getVipId());
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -14,6 +14,7 @@
import com.ruoyi.other.mapper.GoodsShopMapper;
import com.ruoyi.other.mapper.SeckillActivityInfoMapper;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.service.GoodsSeckillService;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.service.SeckillActivityInfoService;
@@ -57,6 +58,8 @@
    private GoodsService goodsService;
    @Resource
    private OrderClient orderClient;
    @Resource
    private GoodsEvaluateService goodsEvaluateService;
    @Override
    public List<SeckillActivityVO> listSeckillActivity(Goods goods) {
@@ -90,6 +93,16 @@
            AppUser appUser = appUserClient.getAppUserById(userid);
            vipId = appUser.getVipId();
        }
        SeckillActivityInfo activityInfo = this.getById(seckillActivityId);
        if(null == activityInfo || activityInfo.getDelFlag() == 1){
            throw new RuntimeException("活动不存在");
        }
        if(activityInfo.getIsShelves() == 0){
            throw new RuntimeException("活动已下架");
        }
        if(!activityInfo.getVipIds().contains(vipId.toString())){
            throw new RuntimeException("权限不足");
        }
        SeckillActivityDetailVO seckillActivityDetailVO = seckillActivityInfoMapper.selectDetail(seckillActivityId, vipId);
        Integer goodsId = seckillActivityDetailVO.getGoodsId();
@@ -121,12 +134,29 @@
        seckillActivityDetailVO.setShopList(shops);
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 2).getData();
        seckillActivityDetailVO.setSaleNum(integer);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "")
                .orderByDesc(GoodsEvaluate::getGrade).eq(GoodsEvaluate::getStatus, 2).eq(GoodsEvaluate::getDelFlag, 0).last(" limit 0, 1").one();
        if (null != goodsEvaluate) {
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
            if(null != appUserById){
                goodsEvaluate.setUserName(appUserById.getName());
                goodsEvaluate.setAvatar(appUserById.getAvatar());
                goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
            }
        }
        seckillActivityDetailVO.setGoodsEvaluate(goodsEvaluate);
        return seckillActivityDetailVO;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo) {
        Integer goodId = seckillActivityInfo.getGoodId();
        long count = this.count(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, goodId).eq(SeckillActivityInfo::getDelFlag, 0)
                .eq(SeckillActivityInfo::getIsShelves, 1).last(" and now() between start_time and end_time"));
        if(0 < count){
            throw new RuntimeException("该秒杀商品已在其他秒杀活动中存在");
        }
        this.baseMapper.insert(seckillActivityInfo);
        List<GoodsSeckill> goodsSeckills = seckillActivityInfo.getGoodsSeckills();
        for (GoodsSeckill goodsSeckill : goodsSeckills) {
@@ -140,6 +170,12 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo) {
        Integer goodId = seckillActivityInfo.getGoodId();
        long count = this.count(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, goodId).eq(SeckillActivityInfo::getDelFlag, 0)
                .eq(SeckillActivityInfo::getIsShelves, 1).last(" and now() between start_time and end_time"));
        if(1 < count){
            throw new RuntimeException("该秒杀商品已在其他秒杀活动中存在");
        }
        this.baseMapper.updateById(seckillActivityInfo);
        goodsSeckillService.remove(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, seckillActivityInfo.getId()));
        List<GoodsSeckill> goodsSeckills = seckillActivityInfo.getGoodsSeckills();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -3,13 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.ShopPoint;
import com.ruoyi.other.api.enums.PointChangeType;
import com.ruoyi.other.mapper.ShopPointMapper;
import com.ruoyi.other.service.ShopPointService;
import com.ruoyi.other.vo.ShopPointStatistics;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@@ -29,8 +33,18 @@
@Service
public class ShopPointServiceImpl extends ServiceImpl<ShopPointMapper, ShopPoint> implements ShopPointService {
    @Resource
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    @Override
    public ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        List<ShopPoint> shopPoints = this.baseMapper.selectShopPointList(shopPoint);
        Map<Integer, Integer> shopPointMap = shopPoints.stream()
                .collect(Collectors.groupingBy(
@@ -54,8 +68,7 @@
        LocalDateTime endTime = shopPoint.getEndTime();
        if(null != startTime){
            List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>()
                    // todo bug说应展示所有门店积分数据
//                    .eq(ShopPoint::getShopId, shopPoint.getShopId())
                    .eq(ShopPoint::getShopId, sysUser.getObjectId())
                    .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'"));
            List<String> date = new ArrayList<>();
            List<Map<String, Integer>> data = new ArrayList<>();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -73,7 +73,7 @@
        List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList();
        for (NearbyShopVO nearbyShopVO : nearbyShopVOS) {
            Double wgs84 = GeodesyUtil.getDistance(nearbyShopVO.getLongitude() + "," + nearbyShopVO.getLatitude(), longitude + "," + latitude).get("WGS84");
            nearbyShopVO.setDistance(wgs84);
            nearbyShopVO.setDistance(new BigDecimal(wgs84).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
        }
        nearbyShopVOS.sort(new Comparator<NearbyShopVO>() {
            @Override
@@ -100,7 +100,7 @@
                vo.setAddress(shop.getAddress());
                vo.setHomePicture(shop.getHomePicture());
                Double wgs84 = GeodesyUtil.getDistance(longitude.toString() + "," + latitude.toString(), shop.getLongitude() + "," + shop.getLatitude()).get("WGS84");
                vo.setDistance(wgs84);
                vo.setDistance(new BigDecimal(wgs84).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
                nearbyShopVOS.add(0, vo);
            }
        }
@@ -117,6 +117,7 @@
        Map<Long, List<ShopScore>> shopScoreMap = shopScores.stream().collect(Collectors.groupingBy(ShopScore::getShopId));
        AppUser finalAppUser1 = appUser;
        nearbyShopVOS.forEach(nearbyShopVO -> {
            nearbyShopVO.setScore("5");
            List<ShopScore> scores = shopScoreMap.get(nearbyShopVO.getId());
            if (scores != null && !scores.isEmpty()){
                BigDecimal score = scores.stream()
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/payment/TransferUtil.java
@@ -31,8 +31,16 @@
     * 商户号
     */
    private static final String merchantNo = "888122600004175";
    /**
     * 平台-报备商户号
     */
    public static final String sysTradeMerchantNo = "777168500885852";
    
    private static final String format = "yyyy-MM-dd HH:mm:ss";
    /**
     * 支付回调地址
     */
    private static final String callbackUrl = "http://221.182.45.100:9000";
    
    
    /**
@@ -48,7 +56,7 @@
        //商户编号
        body.put("userNo", merchantNo);
        //报备商户号
        body.put("tradeMerchantNo", singlePay.getTradeMerchantNo());
//        body.put("tradeMerchantNo", singlePay.getTradeMerchantNo());
        //产品类型
        body.put("productCode", "BANK_PAY_DAILY_ORDER");
        //交易请求时间
@@ -86,7 +94,7 @@
         */
        body.put("paidUse", singlePay.getPaidUse());
        //商户通知地址
        body.put("callbackUrl", singlePay.getCallbackUrl());
        body.put("callbackUrl", callbackUrl + singlePay.getCallbackUrl());
        String sign = null;
        try {
            sign = sign(body);
@@ -207,18 +215,12 @@
    
    
    
    public static String sign(JSONObject body) throws Exception{
    public static String sign(JSONObject body) {
        //构建字段顺序必须按照文档签名顺序
        Set<Map.Entry<String, Object>> entries = body.entrySet();
        List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries);
        // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序)
        Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() {
            public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) {
                return (o1.getKey()).toString().compareTo(o2.getKey());
            }
        });
        // 构造签名键值对的格式
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, Object> item : infoIds) {
        for (Map.Entry<String, Object> item : entries) {
            if (item.getKey() != null || item.getKey() != "") {
                Object val = item.getValue();
                if (!(val == "" || val == null)) {
@@ -227,12 +229,8 @@
            }
        }
        sb.append(key);
        log.info("待签名串:{}", sb.toString());
        return MD5AndKL.MD5(sb.toString());
    }
    public static void main(String[] args) {
        TransferUtil.accountBalanceQuery();
    }
    
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/payment/model/SinglePayCallbackResult.java
@@ -11,6 +11,17 @@
public class SinglePayCallbackResult {
    /**
     * 交易状态
     * 201 批次已创建 汇聚受理并创建该批次的初始状态
     * 202 处理中 批次正在处理中状态
     * 203 处理完成 批次中的每笔明细都明确了代付结果
     * 204 批次不存在 汇聚未受理该批次的请求,找不到该批次,明确失败
     * 205 交易成功 明确交易成功的状态码
     * 208 订单已取消 代付订单被商户审核为拒绝付款
     * 210 账务冻结中 确认出款后对商户的账户余额进行冻结处理
     * 211 账务解冻中 确认失败后对商户的账户余额进行解冻处理
     * 212 订单取消中 商户审核为拒绝付款的中间状态
     * 213 账务扣款中 确认成功后对商户的账户冻结款的扣款处理
     * 214 订单不存在 汇聚未受理该笔代付请求,找不到该笔订单,明确失败
     */
    private Integer status;
    /**
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/GoodsVO.java
@@ -1,6 +1,7 @@
package com.ruoyi.other.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.api.domain.Shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -62,5 +63,8 @@
    @ApiModelProperty(value = "门店列表")
    private List<Shop> shopList;
    @ApiModelProperty("评价")
    private GoodsEvaluate goodsEvaluate;
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java
@@ -1,5 +1,6 @@
package com.ruoyi.other.vo;
import com.ruoyi.other.api.domain.GoodsEvaluate;
import com.ruoyi.other.api.domain.Shop;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -24,4 +25,7 @@
    @ApiModelProperty(value = "商品详情")
    private String detail;
    @ApiModelProperty("评价")
    private GoodsEvaluate goodsEvaluate;
}
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsBargainPriceMapper.xml
@@ -28,7 +28,7 @@
        <if test="gp.categoryId != null and gp.categoryId != ''">
            and tg.goods_category_id = #{gp.categoryId}
        </if>
        <if test="gp.auditStatus != null and gp.auditStatus != ''">
        <if test="gp.auditStatus != null">
            and tgbp.audit_status = #{gp.auditStatus}
        </if>
    </select>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml
@@ -12,14 +12,15 @@
        tg.original_price as originalPrice,
        tg.integral as integral,
        tg.sale_num as saleNum,
        tg.home_page_picture as homePagePicture
        tg.home_page_picture as homePagePicture,
        tg.sort
        FROM t_goods tg
        where tg.del_flag = 0 and tg.status = 2 and (tg.appoint_store = 2 or (tg.appoint_store = 1 and tg.id in (select goods_id from t_goods_shop where shop_id = #{shopId})))
        and tg.type = 1
        <if test="vip != null">
            and (tg.commodity_authority like '%-1%' or tg.commodity_authority like CONCAT('%', #{vip}, '%'))
        </if>
        ORDER BY tg.sale_num DESC
        ORDER BY ifnull(tg.sort, -1) DESC
    </select>
    <select id="selectManageGoodsList" resultType="com.ruoyi.other.api.domain.Goods">
        SELECT
@@ -71,5 +72,6 @@
        <if test="null != vip">
            and (FIND_IN_SET(#{vip}, commodity_authority) or commodity_authority like '%-1%')
        </if>
        order by sort desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -64,7 +64,7 @@
        tgc.`name` goodsCategoryName,
        tg.operating_cost,
        tg.shop_cost,
        tg.purchase_limit maxNum,
        tsai.max_num maxNum,
        tg.home_page_picture,
        tg.original_price,
        tg.sale_num,
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -57,7 +57,7 @@
            SUM(ts.shop_all_point) totalPoint,
            SUM(ts.share_point) commissionPoint,
            SUM(ts.server_point) servicePoint,
            SUM(ts.lower_level_giveaway_money) bindCommissionPoint,
            SUM(ts.lower_level_share_point) bindCommissionPoint,
            SUM(ts.giveaway_all_money) totalCommissionMoney,
            SUM(ts.giveaway_money) commissionMoney,
            SUM(ts.lower_level_giveaway_money) bindCommissionMoney,
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopPointMapper.xml
@@ -68,6 +68,9 @@
            <if test="shopPoint.startTime !=null and shopPoint.endTime !=null">
                AND tsp.create_time BETWEEN #{shopPoint.startTime} AND #{shopPoint.endTime}
            </if>
            <if test="shopPoint.shopId !=null">
                AND tsp.shop_id = #{shopPoint.shopId}
            </if>
        </where>
        order by tsp.create_time desc
    </select>