huliguo
昨天 a966dafb8877552267a94fe8c544c5ea72cf5650
Merge remote-tracking branch 'origin/2.0' into 2.0

# Conflicts:
# ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/Shop.java
# ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
22个文件已添加
59个文件已修改
1898 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-goods/src/main/java/com/ruoyi/goods/api/domain/LotteryEvent.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-goods/src/main/java/com/ruoyi/goods/api/domain/LotteryEventPrize.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-goods/src/main/java/com/ruoyi/goods/api/service/LotteryEventClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/member/Member.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/Shop.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/ShopAppointableTime.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/ShopNonAppointableTime.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/vo/MerHomeShopTotalVo.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/vo/ShopRelUserVo.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/OauthUserVo.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/QwH5LoginVo.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/concole/MerLotteryEventController.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AnswerQuestionDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/DelShopLotteryDrawDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/LotteryEventQuestionsDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/ShopLotteryDrawListDto.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/ShopWinningRecordDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/LotteryEventQuestionsVo.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/MerGoodsPageVo.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/ShopLotteryDrawListVo.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/ShopLotteryDrawVo.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/ShopWinningRecordVo.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/lottery/LotteryEventMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/lottery/UserLotteryEventMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/UserLotteryEventServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/lottery/ILotteryEventService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/lottery/IUserLotteryEventService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/UserLotteryEventMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/business/MerCouponController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/business/MerMemberController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MerCouponEditDto.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/CouponInfoVo.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerCouponGetVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerCouponPageVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerMemberPageVo.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerConsumerController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/CancelMerOrderDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerOrderPageDto.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerMemberOrderVo.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerVerifyAwardVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java 73 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java 181 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/CancelReservationDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MyAppointmentListDto.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/ShopAppointableTimeListDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/ShopNonAppointableTimeDto.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/shop/ShopRelUser.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MyAppointmentListVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/ShopAppointableTimeListVo.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/ShopReservationConfigVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/mapper/shop/ShopAppointableTimeMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/mapper/shop/ShopNonAppointableTimeMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopNonAppointableTimeServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopRelUserServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java 123 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopAppointableTimeService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopNonAppointableTimeService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopRelUserService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/util/TaskUtil.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopAppointableTimeMapper.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopNonAppointableTimeMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-goods/src/main/java/com/ruoyi/goods/api/domain/LotteryEvent.java
@@ -4,12 +4,14 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
 * @author zhibing.pu
@@ -24,66 +26,85 @@
     * 主键
     */
    @TableId(value = "id", type = IdType.INPUT)
    @ApiModelProperty("活动id")
    private String id;
    /**
     * 门店id
     */
    @TableField("shop_id")
    @ApiModelProperty("门店id")
    private Integer shopId;
    /**
     * 抽奖名称
     */
    @TableField("name")
    @ApiModelProperty("抽奖名称")
    private String name;
    /**
     * 活动简介名称
     */
    @TableField("activity_profile")
    @ApiModelProperty("活动简介名称")
    private String activityProfile;
    /**
     * 开启方式(1=新注册用户,2=下单,3=分享小程序,4=普通抽奖,5=答题抽奖)
     */
    @TableField("activity_type")
    @ApiModelProperty("开启方式(1=新注册用户,2=下单,3=分享小程序,4=普通抽奖,5=答题抽奖)")
    private Integer activityType;
    /**
     * 可抽奖次数
     */
    @TableField("times")
    @ApiModelProperty("可抽奖次数")
    private Integer times;
    /**
     * 活动开始时间
     */
    @TableField("start_time")
    @ApiModelProperty("活动开始时间")
    private LocalDateTime startTime;
    /**
     * 活动结束时间
     */
    @TableField("end_time")
    @ApiModelProperty("活动结束时间")
    private LocalDateTime endTime;
    /**
     * 分享抽奖间隔天数
     */
    @TableField("interval_time")
    @ApiModelProperty("分享抽奖间隔天数")
    private Integer intervalTime;
    /**
     * 下单支付金额
     */
    @TableField("pay_money")
    @ApiModelProperty("下单支付金额")
    private BigDecimal payMoney;
    /**
     * 答题抽奖正确率%
     */
    @TableField("accuracy")
    @ApiModelProperty("答题抽奖正确率%")
    private BigDecimal accuracy;
    /**
     * 答题时间限制(分钟)
     */
    @TableField("answering_time")
    @ApiModelProperty("答题时间限制(分钟)")
    private Integer answeringTime;
    /**
     * 封面图
     */
    @TableField("cover_image")
    @ApiModelProperty("封面图")
    private String coverImage;
    /**
     * 详情介绍
     */
    @TableField("activity_content")
    @ApiModelProperty("详情介绍")
    private String activityContent;
    /**
     * 删除标记
@@ -104,10 +125,13 @@
     * 更新用户id
     */
    @TableField("update_user_id")
    private Integer updateUserId;
    private Long updateUserId;
    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;
    @ApiModelProperty("奖品列表")
    private List<LotteryEventPrize> prizes;
}
ruoyi-api/ruoyi-api-goods/src/main/java/com/ruoyi/goods/api/domain/LotteryEventPrize.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@@ -18,36 +19,43 @@
    /**
     * 主键
     */
    @TableId(value = "id",  type = IdType.AUTO)
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty("奖品id")
    private String id;
    /**
     * 抽奖id
     */
    @TableField("lottery_event_id")
    @ApiModelProperty("抽奖id")
    private String lotteryEventId;
    /**
     * 奖品类型(1=优惠券,2=平台商品,3=线下商品,4=积分)
     */
    @TableField("prize_type")
    @ApiModelProperty("奖品类型(1=优惠券,2=平台商品,3=线下商品,4=积分)")
    private Integer prizeType;
    /**
     * 奖品id
     */
    @TableField("object_id")
    @ApiModelProperty("奖品id")
    private String objectId;
    /**
     * 奖品名称
     */
    @TableField("object_name")
    @ApiModelProperty("奖品名称")
    private String objectName;
    /**
     * 奖品数量
     */
    @TableField("number")
    @ApiModelProperty("奖品数量")
    private Integer number;
    /**
     * 中奖率%
     */
    @TableField("win_rate")
    @ApiModelProperty("中奖率%")
    private BigDecimal winRate;
}
ruoyi-api/ruoyi-api-goods/src/main/java/com/ruoyi/goods/api/service/LotteryEventClient.java
@@ -23,6 +23,6 @@
     * @param activityType
     * @return
     */
    @PostMapping("/mer/lotteryEvent/getLotteryEventList")
    @PostMapping("/lotteryEvent/getLotteryEventList")
    R<List<LotteryEvent>> getLotteryEventList(@RequestParam("activityType") Integer activityType);
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/member/Member.java
@@ -162,19 +162,24 @@
     */
    @TableField("belong_district")
    private String belongDistrict;
    @TableField("frozen_flag")
    private Integer frozenFlag;
    /**
     * 绑定类型1商城订单2活动订单3线下订单4核销优惠券5核销奖品6商户创建7平台变动8商户绑定
     */
    @TableField("binding_type")
    private Integer bindingType;
    /**
     * 上次确认服务的id
     */
    @TableField("last_service_id")
    private String lastServiceId;
    @Override
    protected Serializable pkVal() {
        return this.userId;
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/Shop.java
@@ -222,6 +222,11 @@
    @TableField("platform_birthday_flag")
    private Integer platformBirthdayFlag;
    /**
     * 抽奖1开2关
     */
    @TableField("lottery_draw_flag")
    private Integer lotteryDrawFlag;
    /**
     * 店铺设置状态
     */
    @TableField("shop_custom_status")
@@ -303,14 +308,14 @@
     */
    @TableField("subscribe")
    private Integer subscribe;
    /**
     * 修改价格权限(0=关,1=开)
     */
    @TableField("modify_price_permission")
    private Integer modifyPricePermission;
    @Override
    protected Serializable pkVal() {
        return this.shopId;
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/ShopAppointableTime.java
@@ -34,7 +34,7 @@
     * 预约时间
     */
    @TableField("appointable_time")
    private String appointableTime;
    private LocalDateTime appointableTime;
    /**
     * 状态(0=已取消,1=待确认,2=等待中,3=已结束)
     */
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/poji/shop/ShopNonAppointableTime.java
@@ -8,6 +8,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
 * @Date 2025/5/26 14:25
@@ -31,11 +33,11 @@
     */
    @TableField("non_appointable_start_time")
    @ApiModelProperty("不可预约开始时间")
    private String nonAppointableStartTime;
    private LocalDateTime nonAppointableStartTime;
    /**
     * 不可预约结束时间
     */
    @TableField("non_appointable_end_time")
    @ApiModelProperty("不可预约结束时间")
    private String nonAppointableEndTime;
    private LocalDateTime nonAppointableEndTime;
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/vo/MerHomeShopTotalVo.java
@@ -35,14 +35,17 @@
    @ApiModelProperty(value = "剩余周期人数")
    private Integer cycleSurp;
    @ApiModelProperty(value = "剩余体验人数")
    private Integer explorationSurp;
    @ApiModelProperty(value = "领券1开2关")
    private Integer platformCouponFlag;
    @ApiModelProperty(value = "生日卡1开2关")
    private Integer platformBirthdayFlag;
    @ApiModelProperty(value = "待处理预约单数量")
    private Integer unHandleReserve;
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/vo/ShopRelUserVo.java
@@ -5,10 +5,16 @@
@Data
public class ShopRelUserVo {
    @ApiModelProperty(value="商户id")
    @ApiModelProperty(value = "商户id")
    private Long shopId;
    @ApiModelProperty(value="用户姓名")
    @ApiModelProperty(value = "商户数量")
    private Integer shopNum;
    @ApiModelProperty(value = "商户名称")
    private String shopName;
    @ApiModelProperty(value = "用户姓名")
    private String userName;
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java
@@ -176,6 +176,11 @@
            public R saveMemberGiftRecord(MemberGiftRecord memberGiftRecord) {
                return R.fail("添加奖品数据失败:" + throwable.getMessage());
            }
            @Override
            public R editMember(Member member) {
                return R.fail("修改会员失败:" + throwable.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/OauthUserVo.java
@@ -5,19 +5,25 @@
@Data
public class OauthUserVo {
    @ApiModelProperty(value="商户id")
    @ApiModelProperty(value = "商户id")
    private Long shopId;
    @ApiModelProperty(value="成员UserID")
    @ApiModelProperty(value = "商户数量")
    private Integer shopNum;
    @ApiModelProperty(value = "商户名称")
    private String shopName;
    @ApiModelProperty(value = "成员UserID")
    private String userid;
    @ApiModelProperty(value="手机")
    @ApiModelProperty(value = "手机")
    private String mobile;
    @ApiModelProperty(value="token凭证")
    @ApiModelProperty(value = "token凭证")
    private String token;
    @ApiModelProperty(value="过期时间")
    @ApiModelProperty(value = "过期时间")
    private Long expiresIn;
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/QwH5LoginVo.java
@@ -6,16 +6,22 @@
@Data
public class QwH5LoginVo {
    @ApiModelProperty(value="成员UserID")
    @ApiModelProperty(value = "成员UserID")
    private String userid;
    @ApiModelProperty(value="商户id")
    @ApiModelProperty(value = "商户id")
    private Long shopId;
    @ApiModelProperty(value="手机")
    @ApiModelProperty(value = "商户数量")
    private Integer shopNum;
    @ApiModelProperty(value = "商户名称")
    private String shopName;
    @ApiModelProperty(value = "手机")
    private String mobile;
    @ApiModelProperty(value = "用户信息")
    private SysUser sysUser;
}
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java
@@ -293,4 +293,13 @@
     */
    @PostMapping("/member/saveMemberGiftRecord")
    R saveMemberGiftRecord(@RequestBody MemberGiftRecord memberGiftRecord);
    /**
     * 修改会员数据
     *
     * @param member
     * @return
     */
    @PostMapping("/member/editMember")
    R editMember(@RequestBody Member member);
}
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java
@@ -87,9 +87,9 @@
        // 2、生成Token
       return R.ok(tokenService.createQwH5Token(qwH5LoginVo));
    }
    @GetMapping("/h5/oauthUser")
    @ApiOperation("通过code获取商户端用户登录")
    @ApiOperation("通过code获取商户端用户登录【2.0】")
    public R<OauthUserVo> oauthUser(@ApiParam(value = "成员授权获取到的code", required = true) @RequestParam("code") String code) throws IOException {
        // 通过code获取访问用户敏感信息
        JSONObject result = qywxInnerService.getOauthUser(code);
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -238,26 +238,28 @@
            throw new ServiceException(userResult.getMsg());
        }
        ShopRelUserVo shopInfo = shopResult.getData();
        if(null == shopInfo){
        if (null == shopInfo) {
            throw new ServiceException("未查询到商户信息");
        }
        Long shopId = shopInfo.getShopId();
        Shop shop = remoteShopService.getShop(shopId).getData();
        if(-1 == shop.getShopStatus()){
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对应商户已删除,请联系管理员",Constants.FROM_SHOP);
        if (-1 == shop.getShopStatus()) {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对应商户已删除,请联系管理员", Constants.FROM_SHOP);
            throw new ServiceException("对应商户已删除,请联系管理员");
        }
        if(0 == shop.getShopStatus()){
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对应商户已冻结,请联系管理员",Constants.FROM_SHOP);
        if (0 == shop.getShopStatus()) {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对应商户已冻结,请联系管理员", Constants.FROM_SHOP);
            throw new ServiceException("对应商户已冻结,请联系管理员");
        }
        if(2 == shop.getShopStatus()){
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对应商户已终止合作,请联系管理员",Constants.FROM_SHOP);
        if (2 == shop.getShopStatus()) {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对应商户已终止合作,请联系管理员", Constants.FROM_SHOP);
            throw new ServiceException("对应商户已终止合作,请联系管理员");
        }
    
        userInfo.setShopId(shopInfo.getShopId());
        recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功",Constants.FROM_SHOP);
        userInfo.setShopName(shopInfo.getShopName());
        userInfo.setShopNum(shopInfo.getShopNum());
        recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功", Constants.FROM_SHOP);
        return userInfo;
    }
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java
@@ -125,7 +125,7 @@
        loginUser.setUsername(userName);
        loginUser.setIpaddr(IpUtils.getIpAddr());
        refreshToken(loginUser);
        // Jwt存储信息
        Map<String, Object> claimsMap = new HashMap<String, Object>();
        claimsMap.put(SecurityConstants.USER_KEY, token);
@@ -135,6 +135,8 @@
        // 接口返回信息
        OauthUserVo oauthUserVo = new OauthUserVo();
        oauthUserVo.setShopId(qwH5LoginVo.getShopId());
        oauthUserVo.setShopNum(qwH5LoginVo.getShopNum());
        oauthUserVo.setShopName(qwH5LoginVo.getShopName());
        oauthUserVo.setToken(JwtUtils.createToken(claimsMap));
        oauthUserVo.setExpiresIn(EXPIRE_TIME);
        oauthUserVo.setUserid(qwH5LoginVo.getUserid());
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerGoodsController.java
@@ -1,5 +1,6 @@
package com.ruoyi.goods.controller.business;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.utils.SecurityUtils;
@@ -8,8 +9,12 @@
import com.ruoyi.goods.domain.dto.MgtSelectGoodsPageDto;
import com.ruoyi.goods.domain.vo.MerGoodsPageVo;
import com.ruoyi.goods.service.goods.GoodsService;
import com.ruoyi.goods.service.goods.ShopGoodsService;
import com.ruoyi.system.api.domain.dto.MerBaseDto;
import com.ruoyi.system.api.domain.poji.goods.ShopGoods;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo;
import com.ruoyi.system.api.service.RemoteShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
@@ -31,19 +36,41 @@
@RestController
@RequestMapping("/mer/goods")
public class MerGoodsController {
    @Resource
    private GoodsService goodsService;
    @Resource
    private RemoteShopService remoteShopService;
    @Resource
    private ShopGoodsService shopGoodsService;
    @RequestMapping(value = "/pageMerShopGoods", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取商户商品列表")
    @ApiOperation(value = "分页获取商户商品列表【2.0】")
    public R<Page<MerGoodsPageVo>> pageMerShopGoods(@RequestBody MerGoodsPageDto merGoodsPageDto) {
        Long userId = SecurityUtils.getUserId();
        Page<MerGoodsPageVo> page = new Page<>();
        page.setSize(merGoodsPageDto.getPageSize());
        page.setCurrent(merGoodsPageDto.getPageNum());
        page.setOptimizeCountSql(false);
        List<MerGoodsPageVo> merGoodsPageVoList = goodsService.pageMerShopGoods(page,merGoodsPageDto);
        List<MerGoodsPageVo> merGoodsPageVoList = goodsService.pageMerShopGoods(page, merGoodsPageDto);
        Shop shop = remoteShopService.getShop(merGoodsPageDto.getShopId()).getData();
        Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
        merGoodsPageVoList.forEach(merGoodsPageVo -> {
            ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(belongShop.getShopId(), merGoodsPageVo.getGoodsId());
            //后台开启经销商统一售价,且经销商设置了统一售价,加盟商不能修改价格
            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                merGoodsPageVo.setModifyPricePermission(0);
                merGoodsPageVo.setIsUnifiedPrice(1);
                merGoodsPageVo.setUnifiedPrice(shopGoods.getSalesPrice());
                merGoodsPageVo.setUnifiedServerNum(shopGoods.getServiceNum());
            } else {
                merGoodsPageVo.setModifyPricePermission(1);
                merGoodsPageVo.setIsUnifiedPrice(0);
            }
        });
        return R.ok(page.setRecords(merGoodsPageVoList));
    }
@@ -53,16 +80,26 @@
        List<MerGoodsPageVo> merGoodsPageVoList = goodsService.listMerCycleGoods(merBaseDto.getShopId());
        return R.ok(merGoodsPageVoList);
    }
    @RequestMapping(value = "/editMerShopGoods", method = RequestMethod.POST)
    @ApiOperation(value = "编辑商户商品价格")
    @ApiOperation(value = "编辑商户商品价格【2.0】")
    public R editMerShopGoods(@RequestBody MerShopGoodsEditDto merShopGoodsEditDto) {
        Long userId = SecurityUtils.getUserId();
        merShopGoodsEditDto.setUserId(userId);
        goodsService.editMerShopGoods(merShopGoodsEditDto);
        return R.ok();
    }
    @RequestMapping(value = "/cancelUniformPrice", method = RequestMethod.POST)
    @ApiOperation(value = "取消统一售价【2.0】")
    public R cancelUniformPrice(@RequestBody MerShopGoodsEditDto merShopGoodsEditDto) {
        shopGoodsService.remove(new LambdaUpdateWrapper<ShopGoods>().eq(ShopGoods::getShopId, merShopGoodsEditDto.getShopId())
                .eq(ShopGoods::getGoodsId, merShopGoodsEditDto.getGoodsId()));
        return R.ok();
    }
    @RequestMapping(value = "/pageMerSelectGoods", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取商品选择列表")
    public R<Page<MgtSelectGoodsPageVo>> pageMerSelectGoods(@RequestBody MgtSelectGoodsPageDto mgtSelectGoodsPageDto) {
@@ -70,7 +107,7 @@
        page.setSize(mgtSelectGoodsPageDto.getPageSize());
        page.setCurrent(mgtSelectGoodsPageDto.getPageNum());
        page.setOptimizeCountSql(false);
        List<MgtSelectGoodsPageVo> mgtSelectGoodsPageVos = goodsService.pageMgtSelectGoods(page,mgtSelectGoodsPageDto);
        List<MgtSelectGoodsPageVo> mgtSelectGoodsPageVos = goodsService.pageMgtSelectGoods(page, mgtSelectGoodsPageDto);
        return R.ok(page.setRecords(mgtSelectGoodsPageVos));
    }
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/MerLotteryEventController.java
@@ -1,18 +1,42 @@
package com.ruoyi.goods.controller.business;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.goods.api.domain.LotteryEvent;
import com.ruoyi.goods.api.domain.LotteryEventPrize;
import com.ruoyi.goods.domain.dto.DelShopLotteryDrawDto;
import com.ruoyi.goods.domain.dto.ShopLotteryDrawListDto;
import com.ruoyi.goods.domain.dto.ShopWinningRecordDto;
import com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo;
import com.ruoyi.goods.domain.vo.ShopLotteryDrawVo;
import com.ruoyi.goods.domain.vo.ShopWinningRecordVo;
import com.ruoyi.goods.service.goods.GoodsService;
import com.ruoyi.goods.service.lottery.ILotteryEventPrizeService;
import com.ruoyi.goods.service.lottery.ILotteryEventService;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.goods.service.lottery.IUserLotteryEventService;
import com.ruoyi.system.api.domain.poji.goods.Goods;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.service.RemoteShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
 * @author zhibing.pu
 * @Date 2025/5/8 18:13
 */
@Api(value = "商户端商户相关接口", tags = "商户端商户相关接口", description = "商户端商户相关接口")
@RestController
@RequestMapping("/mer/lotteryEvent")
public class MerLotteryEventController {
@@ -20,19 +44,109 @@
    @Resource
    private ILotteryEventService lotteryEventService;
    
    @Resource
    private RemoteShopService remoteShopService;
    
    /**
     * 根据开启方式获取活动列表
     *
     * @param activityType
     * @return
     */
    @ResponseBody
    @PostMapping("/getLotteryEventList")
    public R<List<LotteryEvent>> getLotteryEventList(@RequestParam("activityType") Integer activityType) {
        List<LotteryEvent> list = lotteryEventService.list(new LambdaQueryWrapper<LotteryEvent>().eq(LotteryEvent::getActivityType, activityType)
                .eq(LotteryEvent::getDelFlag, 0).last(" and now() between start_time and end_time"));
        return R.ok(list);
    @Resource
    private ILotteryEventPrizeService lotteryEventPrizeService;
    @Resource
    private IUserLotteryEventService userLotteryEventService;
    @Resource
    private GoodsService goodsService;
    @RequestMapping(value = "/getShopLotteryDrawList", method = RequestMethod.POST)
    @ApiOperation(value = "获取门店抽奖活动列表【2.0】")
    public R<ShopLotteryDrawVo> getShopLotteryDrawList(@RequestBody ShopLotteryDrawListDto dto) {
        Page<ShopLotteryDrawListVo> page = new Page<>();
        page.setSize(dto.getPageSize());
        page.setCurrent(dto.getPageNum());
        Shop shop = remoteShopService.getShop(dto.getShopId()).getData();
        ShopLotteryDrawVo shopLotteryDrawVo = new ShopLotteryDrawVo();
        shopLotteryDrawVo.setLotteryDrawFlag(shop.getLotteryDrawFlag());
        List<ShopLotteryDrawListVo> shopLotteryDrawList = lotteryEventService.getShopLotteryDrawList(page, dto.getShopId());
        page.setRecords(shopLotteryDrawList);
        shopLotteryDrawVo.setPage(page);
        return R.ok(shopLotteryDrawVo);
    }
    @RequestMapping(value = "/delShopLotteryDraw", method = RequestMethod.POST)
    @ApiOperation(value = "门店删除抽奖活动【2.0】")
    public R delShopLotteryDraw(@RequestBody DelShopLotteryDrawDto dto) {
        LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
        if (null == lotteryEvent) {
            return R.fail("抽奖活动不存在");
        }
        if (LocalDateTime.now().isAfter(lotteryEvent.getStartTime())) {
            return R.fail("删除失败");
        }
        if (!lotteryEvent.getShopId().equals(dto.getShopId())) {
            return R.fail("删除失败");
        }
        lotteryEvent.setDelFlag(1);
        lotteryEventService.updateById(lotteryEvent);
        return R.ok();
    }
    @RequestMapping(value = "/getShopLotteryDrawInfo", method = RequestMethod.POST)
    @ApiOperation(value = "获取门店抽奖详情【2.0】")
    public R<LotteryEvent> getShopLotteryDrawInfo(@RequestBody DelShopLotteryDrawDto dto) {
        LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
        if (null == lotteryEvent) {
            return R.fail("抽奖活动不存在");
        }
        if (!lotteryEvent.getShopId().equals(dto.getShopId())) {
            return R.fail("查询失败");
        }
        List<LotteryEventPrize> list = lotteryEventPrizeService.list(new LambdaQueryWrapper<LotteryEventPrize>().eq(LotteryEventPrize::getLotteryEventId, dto.getId()));
        lotteryEvent.setPrizes(list);
        return R.ok(lotteryEvent);
    }
    @RequestMapping(value = "/editShopLotteryDraw", method = RequestMethod.POST)
    @ApiOperation(value = "保存门店抽奖【2.0】")
    public R editShopLotteryDraw(@RequestBody LotteryEvent lotteryEvent) {
        if (lotteryEvent.getId() == null) {
            lotteryEvent.setId(IdUtils.simpleUUID());
        }
        lotteryEvent.setUpdateTime(LocalDateTime.now());
        lotteryEvent.setUpdateUserId(SecurityUtils.getUserId());
        lotteryEventService.saveOrUpdate(lotteryEvent);
        //先删除原有的奖品
        lotteryEventPrizeService.remove(new LambdaQueryWrapper<LotteryEventPrize>().eq(LotteryEventPrize::getLotteryEventId, lotteryEvent.getId()));
        //添加新的奖品
        List<LotteryEventPrize> prizes = lotteryEvent.getPrizes();
        prizes.forEach(s -> {
            s.setId(IdUtils.simpleUUID());
            if (s.getPrizeType() == 2 && StringUtils.isEmpty(s.getObjectName())) {
                Goods goods = goodsService.getById(s.getObjectId());
                s.setObjectName(goods.getGoodsName());
            }
            s.setLotteryEventId(lotteryEvent.getId());
        });
        lotteryEventPrizeService.saveOrUpdateBatch(prizes);
        return R.ok();
    }
    @RequestMapping(value = "/getShopWinningRecord", method = RequestMethod.POST)
    @ApiOperation(value = "获取中奖记录列表【2.0】")
    public R<Page<ShopWinningRecordVo>> getShopWinningRecord(@RequestBody ShopWinningRecordDto dto) {
        LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId());
        if (null == lotteryEvent) {
            return R.fail("抽奖活动不存在");
        }
        if (!lotteryEvent.getShopId().equals(dto.getShopId())) {
            return R.fail("查询失败");
        }
        Page<ShopWinningRecordVo> page = new Page<>();
        page.setSize(dto.getPageSize());
        page.setCurrent(dto.getPageNum());
        List<ShopWinningRecordVo> shopWinningRecordVoList = userLotteryEventService.getShopWinningRecord(page, dto.getId());
        return R.ok(page.setRecords(shopWinningRecordVoList));
    }
    
    
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/concole/MerLotteryEventController.java
New file
@@ -0,0 +1,39 @@
package com.ruoyi.goods.controller.concole;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.goods.api.domain.LotteryEvent;
import com.ruoyi.goods.service.lottery.ILotteryEventService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author zhibing.pu
 * @Date 2025/5/8 18:13
 */
@RestController
@RequestMapping("/lotteryEvent")
public class MerLotteryEventController {
    @Resource
    private ILotteryEventService lotteryEventService;
    /**
     * 根据开启方式获取活动列表
     *
     * @param activityType
     * @return
     */
    @ResponseBody
    @PostMapping("/getLotteryEventList")
    public R<List<LotteryEvent>> getLotteryEventList(@RequestParam("activityType") Integer activityType) {
        List<LotteryEvent> list = lotteryEventService.list(new LambdaQueryWrapper<LotteryEvent>().eq(LotteryEvent::getActivityType, activityType)
                .eq(LotteryEvent::getDelFlag, 0).last(" and now() between start_time and end_time"));
        return R.ok(list);
    }
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AnswerQuestionDto.java
New file
@@ -0,0 +1,18 @@
package com.ruoyi.goods.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/5/27 10:45
 */
@Data
@ApiModel
public class AnswerQuestionDto {
    @ApiModelProperty(value = "抽奖id")
    private String id;
    @ApiModelProperty(value = "当前题号")
    private Integer current;
    @ApiModelProperty(value = "答案")
    private String answer;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/DelShopLotteryDrawDto.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.goods.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/5 10:32
 */
@ApiModel
@Data
public class DelShopLotteryDrawDto {
    @ApiModelProperty("门店id")
    private Long shopId;
    @ApiModelProperty("抽奖活动id")
    private String id;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/LotteryEventQuestionsDto.java
New file
@@ -0,0 +1,18 @@
package com.ruoyi.goods.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/5/27 10:22
 */
@Data
@ApiModel
public class LotteryEventQuestionsDto {
    @ApiModelProperty(value = "抽奖id")
    private String id;
    @ApiModelProperty(value = "当前题号")
    private Integer current;
    @ApiModelProperty(value = "-1=上一题,1=下一题")
    private Integer stepOrDown;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/ShopLotteryDrawListDto.java
New file
@@ -0,0 +1,15 @@
package com.ruoyi.goods.domain.dto;
import com.ruoyi.system.api.domain.dto.MgtPageDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/5 9:23
 */
@Data
@ApiModel
public class ShopLotteryDrawListDto extends MgtPageDto {
    @ApiModelProperty(value = "商户id")
    private Long shopId;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/ShopWinningRecordDto.java
New file
@@ -0,0 +1,17 @@
package com.ruoyi.goods.domain.dto;
import com.ruoyi.system.api.domain.dto.MgtPageDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/5 11:24
 */
@Data
@ApiModel
public class ShopWinningRecordDto extends MgtPageDto {
    @ApiModelProperty("门店id")
    private Long shopId;
    @ApiModelProperty("抽奖id")
    private String id;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/LotteryEventQuestionsVo.java
New file
@@ -0,0 +1,29 @@
package com.ruoyi.goods.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
 * @author zhibing.pu
 * @Date 2025/5/27 10:05
 */
@Data
@ApiModel
public class LotteryEventQuestionsVo {
    @ApiModelProperty(value = "抽奖id")
    private String id;
    @ApiModelProperty("题干名称")
    private String name;
    @ApiModelProperty("总提数")
    private Integer total;
    @ApiModelProperty("当前题数")
    private Integer current;
    @ApiModelProperty("已答答案")
    private String answer;
    @ApiModelProperty("答题选项")
    private List<Map<String, String>> options;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/MerGoodsPageVo.java
@@ -31,27 +31,39 @@
    @ApiModelProperty(value = "商品图片")
    private String goodsPicture;
    @ApiModelProperty(value = "商品类型1周期2服务3体验4单品")
    private Integer goodsType;
    @ApiModelProperty(value = "商品调理问题")
    private String goodsNurses;
    @ApiModelProperty(value = "商品建议售价")
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal suggestSalesPrice;;
    private BigDecimal suggestSalesPrice;
    @ApiModelProperty(value = "商品售价")
    @JsonSerialize(using = ToStringSerializer.class)
    private BigDecimal salesPrice;;
    @ApiModelProperty(value="周期次数标记0否1是")
    private BigDecimal salesPrice;
    @ApiModelProperty(value = "周期次数标记0否1是")
    private Integer cycleNumFlag;
    @ApiModelProperty(value = "商品默认服务次数")
    private Integer defaultServiceNum;;
    private Integer defaultServiceNum;
    @ApiModelProperty(value = "服务次数")
    private Integer serviceNum;;
    private Integer serviceNum;
    @ApiModelProperty(value = "加盟商修改价格权限(0=关,1=开)")
    private Integer modifyPricePermission;
    @ApiModelProperty("是否设置统一售价(0=否,1=是)")
    private Integer isUnifiedPrice;
    @ApiModelProperty("统一售价")
    private BigDecimal unifiedPrice;
    @ApiModelProperty("统一服务次数")
    private Integer unifiedServerNum;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/ShopLotteryDrawListVo.java
New file
@@ -0,0 +1,24 @@
package com.ruoyi.goods.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/5 9:27
 */
@Data
@ApiModel
public class ShopLotteryDrawListVo {
    @ApiModelProperty("数据id")
    private String id;
    @ApiModelProperty("抽奖名称")
    private String name;
    @ApiModelProperty("简介")
    private String activityProfile;
    @ApiModelProperty("抽奖图片")
    private String coverImage;
    @ApiModelProperty("抽奖开始时间")
    private String startTime;
    @ApiModelProperty("抽奖结束时间")
    private String endTime;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/ShopLotteryDrawVo.java
New file
@@ -0,0 +1,19 @@
package com.ruoyi.goods.domain.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2025/6/5 9:25
 */
@Data
@ApiModel
public class ShopLotteryDrawVo {
    @ApiModelProperty(value = "抽奖1开2关")
    private Integer lotteryDrawFlag;
    @ApiModelProperty("抽奖列表")
    private Page<ShopLotteryDrawListVo> page;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/ShopWinningRecordVo.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.goods.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/5 11:09
 */
@Data
@ApiModel
public class ShopWinningRecordVo {
    @ApiModelProperty("用户名")
    private String userName;
    @ApiModelProperty("用户电话")
    private String userPhone;
    @ApiModelProperty("抽奖时间")
    private String lotteryTime;
    @ApiModelProperty("奖品名称")
    private String awardName;
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/lottery/LotteryEventMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.goods.api.domain.LotteryEvent;
import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo;
import com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -23,4 +24,14 @@
     * @return
     */
    List<AppLotteryEventPageVo> pageAppLotteryEvent(Page<AppLotteryEventPageVo> page, @Param("userId") Long userId);
    /**
     * 获取门店抽奖列表
     *
     * @param page
     * @param shopId
     * @return
     */
    List<ShopLotteryDrawListVo> getShopLotteryDrawList(Page<ShopLotteryDrawListVo> page, @Param("shopId") Long shopId);
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/lottery/UserLotteryEventMapper.java
@@ -1,11 +1,27 @@
package com.ruoyi.goods.mapper.lottery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.goods.api.domain.UserLotteryEvent;
import com.ruoyi.goods.domain.vo.ShopWinningRecordVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * @author zhibing.pu
 * @Date 2025/5/12 10:40
 */
public interface UserLotteryEventMapper extends BaseMapper<UserLotteryEvent> {
    /**
     * 获取门店中奖记录
     *
     * @param page
     * @param id
     * @return
     */
    List<Map<String, Object>> getShopWinningRecord(Page<ShopWinningRecordVo> page, @Param("id") String id);
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java
@@ -10,7 +10,6 @@
import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.security.utils.CodeFactoryUtil;
import com.ruoyi.goods.domain.dto.*;
import com.ruoyi.system.api.domain.poji.activity.Activity;
import com.ruoyi.goods.domain.pojo.goods.GoodsTotal;
import com.ruoyi.goods.domain.vo.*;
import com.ruoyi.goods.mapper.goods.GoodsMapper;
@@ -26,6 +25,7 @@
import com.ruoyi.system.api.domain.dto.MerGoodsPriceListDto;
import com.ruoyi.system.api.domain.dto.MgtBaseGetDto;
import com.ruoyi.system.api.domain.dto.MgtClassNumDto;
import com.ruoyi.system.api.domain.poji.activity.Activity;
import com.ruoyi.system.api.domain.poji.activity.ActivityGoods;
import com.ruoyi.system.api.domain.poji.config.SysClassification;
import com.ruoyi.system.api.domain.poji.goods.Goods;
@@ -83,16 +83,17 @@
    @Resource
    private RemoteShopService remoteShopService;
    /**
    * @description 获取推荐商品列表
    * @param page shopId
    * @return List<AppSimpleGoodsVo>
    * @author jqs34
    * @date 2023/6/4 16:27
    */
     * @param page shopId
     * @return List<AppSimpleGoodsVo>
     * @description 获取推荐商品列表
     * @author jqs34
     * @date 2023/6/4 16:27
     */
    @Override
    public List<AppSimpleGoodsVo> pageRecommendGoods(Page page, Long shopId){
        List<AppSimpleGoodsVo> appSimpleGoodsVoList = goodsMapper.pageRecommendGoods(page,shopId);
    public List<AppSimpleGoodsVo> pageRecommendGoods(Page page, Long shopId) {
        List<AppSimpleGoodsVo> appSimpleGoodsVoList = goodsMapper.pageRecommendGoods(page, shopId);
        return appSimpleGoodsVoList;
    }
@@ -185,10 +186,21 @@
        BeanUtils.copyProperties(goods, appGoodsInfoVo);
        //商户定制价格
        ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(appGoodsInfoGetDto.getShopId(),goods.getGoodsId());
        if(shopGoods!=null){
        if (shopGoods != null) {
            appGoodsInfoVo.setSalesPrice(shopGoods.getSalesPrice());
            appGoodsInfoVo.setServiceNum(shopGoods.getServiceNum());
        } else {
            //经销商定制价格
            Shop shop = remoteShopService.getShop(appGoodsInfoGetDto.getShopId()).getData();
            Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
            shopGoods = shopGoodsService.getByShopIdAndGoodsId(belongShop.getShopId(), goods.getGoodsId());
            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                appGoodsInfoVo.setSalesPrice(shopGoods.getSalesPrice());
                appGoodsInfoVo.setServiceNum(shopGoods.getServiceNum());
            }
        }
        GoodsTotal goodsTotal = goodsTotalService.getById(goods.getGoodsId());
        appGoodsInfoVo.setSalesNum(goodsTotal.getBuyNumCount());
        //活动商品判断
@@ -275,22 +287,32 @@
    /**
     * 修改商户商品
     *
     * @param merShopGoodsEditDto
     */
    @Override
    public void editMerShopGoods(MerShopGoodsEditDto merShopGoodsEditDto){
    public void editMerShopGoods(MerShopGoodsEditDto merShopGoodsEditDto) {
        Shop shop = remoteShopService.getShop(merShopGoodsEditDto.getShopId()).getData();
        if (2 == shop.getShopType()) {
            Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
            ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(shop.getBelongShopId(), merShopGoodsEditDto.getGoodsId());
            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                throw new ServiceException("经销商开启了统一价格管理");
            }
        }
        Goods goods = this.getById(merShopGoodsEditDto.getGoodsId());
        if(merShopGoodsEditDto.getSalePrice().compareTo(goods.getMininumPrice())<0){
            throw new ServiceException(AppErrorConstant.SALESPRICE_MIN+goods.getMininumPrice().toString()+"元");
        if (merShopGoodsEditDto.getSalePrice().compareTo(goods.getMininumPrice()) < 0) {
            throw new ServiceException(AppErrorConstant.SALESPRICE_MIN + goods.getMininumPrice().toString() + "元");
        }
        //商户定制价格
        ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(merShopGoodsEditDto.getShopId(),goods.getGoodsId());
        if(shopGoods!=null){
        ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(merShopGoodsEditDto.getShopId(), goods.getGoodsId());
        if (shopGoods != null) {
            shopGoods.setSalesPrice(merShopGoodsEditDto.getSalePrice());
            shopGoods.setServiceNum(merShopGoodsEditDto.getServiceNum());
            shopGoods.setUpdateTime(new Date());
            shopGoods.setUpdateUserId(merShopGoodsEditDto.getUserId());
        }else{
        } else {
            shopGoods = new ShopGoods();
            shopGoods.setDelFlag(0);
            shopGoods.setShopId(merShopGoodsEditDto.getShopId());
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.goods.api.domain.UserLotteryEventQuestions;
import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo;
import com.ruoyi.goods.domain.vo.LotteryEventVo;
import com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo;
import com.ruoyi.goods.domain.vo.UserLotteryEventVo;
import com.ruoyi.goods.mapper.lottery.LotteryEventMapper;
import com.ruoyi.goods.service.lottery.ILotteryEventPrizeService;
@@ -198,6 +199,7 @@
                    case 2:
                        memberGiftRecord.setGiftType(2);
                        memberGiftRecord.setGoodsId(userLotteryEvent.getObjectId());
                        memberGiftRecord.setGiftName(userLotteryEvent.getObjectName());
                        memberGiftRecord.setGoodsNumber(userLotteryEvent.getNumber());
                        break;
                    case 3:
@@ -236,4 +238,17 @@
    public List<AppLotteryEventPageVo> pageAppLotteryEvent(Page<AppLotteryEventPageVo> page, Long userId) {
        return this.baseMapper.pageAppLotteryEvent(page, userId);
    }
    /**
     * 获取门店抽奖列表
     *
     * @param page
     * @param shopId
     * @return
     */
    @Override
    public List<ShopLotteryDrawListVo> getShopLotteryDrawList(Page<ShopLotteryDrawListVo> page, Long shopId) {
        return this.baseMapper.getShopLotteryDrawList(page, shopId);
    }
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/UserLotteryEventServiceImpl.java
@@ -1,10 +1,20 @@
package com.ruoyi.goods.service.impl.lottery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.goods.api.domain.UserLotteryEvent;
import com.ruoyi.goods.domain.vo.ShopWinningRecordVo;
import com.ruoyi.goods.mapper.lottery.UserLotteryEventMapper;
import com.ruoyi.goods.service.lottery.IUserLotteryEventService;
import com.ruoyi.system.api.domain.poji.member.Member;
import com.ruoyi.system.api.service.RemoteMemberService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import java.util.stream.Collectors;
/**
 * @author zhibing.pu
@@ -12,4 +22,53 @@
 */
@Service
public class UserLotteryEventServiceImpl extends ServiceImpl<UserLotteryEventMapper, UserLotteryEvent> implements IUserLotteryEventService {
    @Resource
    private RemoteMemberService remoteMemberService;
    /**
     * 获取店铺中中奖记录
     *
     * @return
     */
    @Override
    public List<ShopWinningRecordVo> getShopWinningRecord(Page<ShopWinningRecordVo> page, String id) {
        List<Map<String, Object>> shopWinningRecord = this.baseMapper.getShopWinningRecord(page, id);
        List<ShopWinningRecordVo> collect = shopWinningRecord.stream().map(item -> {
            Long user_id = Long.valueOf(item.get("user_id").toString());
            Member member = remoteMemberService.getMember(user_id).getData();
            String create_time = item.get("create_time").toString();
            String content = item.get("content").toString();
            String[] prizes = content.split(",");
            StringJoiner awardName = new StringJoiner("、");
            for (String prize : prizes) {
                String[] split = prize.split("_");
                String name = "";
                switch (split[0]) {
                    case "1":
                        name = "优惠券";
                        break;
                    case "2":
                        name = split[2] + "x" + split[3];
                        break;
                    case "3":
                        name = split[2] + "x" + split[3];
                        break;
                    case "4":
                        name = "积分";
                        break;
                }
                awardName.add(name);
            }
            ShopWinningRecordVo shopWinningRecordVo = new ShopWinningRecordVo();
            shopWinningRecordVo.setUserName(member.getRealName());
            shopWinningRecordVo.setUserPhone(member.getMobile());
            shopWinningRecordVo.setLotteryTime(create_time);
            shopWinningRecordVo.setAwardName(awardName.toString());
            return shopWinningRecordVo;
        }).collect(Collectors.toList());
        return collect;
    }
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/lottery/ILotteryEventService.java
@@ -6,6 +6,7 @@
import com.ruoyi.goods.api.domain.LotteryEvent;
import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo;
import com.ruoyi.goods.domain.vo.LotteryEventVo;
import com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo;
import java.util.List;
@@ -42,4 +43,13 @@
     * @return
     */
    List<AppLotteryEventPageVo> pageAppLotteryEvent(Page<AppLotteryEventPageVo> page, Long userId);
    /**
     * 获取门店的抽奖列表
     *
     * @param page
     * @return
     */
    List<ShopLotteryDrawListVo> getShopLotteryDrawList(Page<ShopLotteryDrawListVo> page, Long shopId);
}
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/lottery/IUserLotteryEventService.java
@@ -1,7 +1,11 @@
package com.ruoyi.goods.service.lottery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.goods.api.domain.UserLotteryEvent;
import com.ruoyi.goods.domain.vo.ShopWinningRecordVo;
import java.util.List;
/**
@@ -9,4 +13,10 @@
 * @Date 2025/5/12 10:40
 */
public interface IUserLotteryEventService extends IService<UserLotteryEvent> {
    /**
     * 获取店铺中中奖记录
     */
    List<ShopWinningRecordVo> getShopWinningRecord(Page<ShopWinningRecordVo> page, String id);
}
ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml
@@ -27,4 +27,17 @@
                and a.activity_type in (4, 5)) as aa
        order by aa.sort, aa.startTime
    </select>
    <select id="getShopLotteryDrawList" resultType="com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo">
        select id,
               `name`,
               activity_profile                          as activityProfile,
               cover_image                               as coverImage,
               DATE_FORMAT(start_time, '%Y-%m-%d %H:%i') as startTime,
               DATE_FORMAT(end_time, '%Y-%m-%d %H:%i')   as endTime
        from t_lottery_event
        where shop_id = #{shopId}
        order by create_time desc
    </select>
</mapper>
ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/UserLotteryEventMapper.xml
@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.goods.mapper.lottery.UserLotteryEventMapper">
    <select id="getShopWinningRecord" resultType="map">
        select aa.user_id,
               DATE_FORMAT(any_value(aa.create_time), '%Y-%m-%d %H:%i')                                    as create_time,
               GROUP_CONCAT(CONCAT(aa.prize_type, '_', aa.object_id, '_', aa.object_name, '_', aa.number)) as content
        from (select *
              from t_user_lottery_event
              where prize_type != 5 and lottery_event_id = #{id}
              order by create_time) as aa
        group by aa.user_id
    </select>
</mapper>
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/business/MerCouponController.java
@@ -72,16 +72,16 @@
    }
    @RequestMapping(value = "/getMerCouponVo", method = RequestMethod.POST)
    @ApiOperation(value = "商户获取优惠券编辑信息")
    @ApiOperation(value = "商户获取优惠券编辑信息【2.0】")
    public R<MerCouponGetVo> getMerCouponVo(@RequestBody MerBaseGetDto merBaseGetDto) {
        Long userId = SecurityUtils.getUserId();
        merBaseGetDto.setUserId(userId);
        MerCouponGetVo couponGetVo = couponService.getMerCouponVo(merBaseGetDto);
        return R.ok(couponGetVo);
    }
    @RequestMapping(value = "/editMerCoupon", method = RequestMethod.POST)
    @ApiOperation(value = "商户编辑优惠券")
    @ApiOperation(value = "商户编辑优惠券【2.0】")
    public R editMerCoupon(@RequestBody MerCouponEditDto merCouponEditDto) {
        Long userId = SecurityUtils.getUserId();
        merCouponEditDto.setUserId(userId);
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/business/MerMemberController.java
@@ -53,7 +53,7 @@
    }
    @RequestMapping(value = "/pageMerMember", method = RequestMethod.POST)
    @ApiOperation(value = "分页获取商户绑定会员列表")
    @ApiOperation(value = "分页获取商户绑定会员列表【2.0】")
    public R<Page<MerMemberPageVo>> pageMerMember(@RequestBody MerMemberPageDto merMemberPageDto) {
        Long userId = SecurityUtils.getUserId();
        Page<MerMemberPageVo> page = new Page<>();
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java
@@ -50,7 +50,7 @@
     * @author jqs34
     * @date: 2023/4/30 12:49
     */
    @PostMapping("/getMember")
    public R<Member> getMember(@RequestBody Long userId) {
        Member member = memberService.getByUserId(userId);
@@ -60,6 +60,20 @@
        return R.ok(member);
    }
    
    /**
     * 修改会员数据
     *
     * @param member
     * @return
     */
    @PostMapping("/editMember")
    public R editMember(@RequestBody Member member) {
        memberService.updateById(member);
        return R.ok();
    }
    /**
     * 小程序登录
     */
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/dto/MerCouponEditDto.java
@@ -27,7 +27,7 @@
    @ApiModelProperty(value="优惠券名称")
    private String couponName;
    @ApiModelProperty(value = "发送类型1.手动领取2.指定发放")
    @ApiModelProperty(value = "发送类型1.手动领取2.指定发放3.抽奖领取")
    private Integer sendType;
    @ApiModelProperty(value = "发送对象2.全部用户3.会员用户4非会员用户5自定义")
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/CouponInfoVo.java
New file
@@ -0,0 +1,48 @@
package com.ruoyi.member.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @author zhibing.pu
 * @Date 2025/5/27 12:01
 */
@ApiModel
@Data
public class CouponInfoVo {
    @ApiModelProperty(value = "优惠券id")
    private String id;
    @ApiModelProperty(value = "优惠券名称")
    private String name;
    @ApiModelProperty(value = "优惠券类型1.满减2.折扣3.代金4.商品")
    private Integer type;
    @ApiModelProperty(value = "门槛金额")
    private BigDecimal moneyThreshold;
    @ApiModelProperty(value = "折扣")
    private BigDecimal discountPercent;
    @ApiModelProperty(value = "优惠金额")
    private BigDecimal discountMoney;
    @ApiModelProperty(value = "有效期类型1.时间段2.领取之日起")
    private Integer validType;
    @ApiModelProperty(value = "有效期")
    private Integer validDays;
    @ApiModelProperty(value = "有效期开始时间")
    private String validStartTime;
    @ApiModelProperty(value = "有效期结束时间")
    private String validEndTime;
    @ApiModelProperty(value = "使用范围商品")
    private String useGoods;
    @ApiModelProperty(value = "发放限制0否1是")
    private Integer limitFlag;
    @ApiModelProperty(value = "可领数量")
    private Integer receiveNum;
    @ApiModelProperty(value = "剩余数量")
    private Integer laveNum;
    @ApiModelProperty(value = "宣传海报")
    private String propagandaPoster;
    @ApiModelProperty(value = "优惠券状态-1删除0已过期1已领取2已使用")
    private Integer status;
}
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerCouponGetVo.java
@@ -29,7 +29,7 @@
    @ApiModelProperty(value="优惠券名称")
    private String couponName;
    @ApiModelProperty(value = "发送类型1.手动领取2.指定发放")
    @ApiModelProperty(value = "发送类型1.手动领取2.指定发放3.抽奖领取")
    private Integer sendType;
    @ApiModelProperty(value = "发送对象2.全部用户3.会员用户4非会员用户5自定义")
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerCouponPageVo.java
@@ -22,7 +22,7 @@
    @ApiModelProperty(value="优惠券名称")
    private String couponName;
    @ApiModelProperty(value="优惠券类型1.满减2.折扣3.代金4.商品")
    @ApiModelProperty(value = "优惠券类型1.满减2.折扣3.代金4.商品")
    private Integer couponType;
    @ApiModelProperty(value = "使用限制")
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/domain/vo/MerMemberPageVo.java
@@ -44,13 +44,16 @@
    @ApiModelProperty(value = "用户标签")
    private String userTags;
    @ApiModelProperty(value = "商品类型")
    private String goodsType;
    @ApiModelProperty(value = "最近消费时间",hidden = true)
    @ApiModelProperty(value = "最近消费时间", hidden = true)
    private Date lastPayTime;
    @ApiModelProperty(value = "活跃度")
    private String memberActiveness;
    @ApiModelProperty(value = "调理问题")
    private String memberNurse;
}
ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java
@@ -1124,9 +1124,9 @@
        CouponTotal couponTotal;
        if(StringUtils.isNotBlank(merCouponEditDto.getCouponId())){
            coupon = this.getById(merCouponEditDto.getCouponId());
            if(coupon.getAuditStatus()!=3){
                throw new ServiceException(AppErrorConstant.COUPON_AUDIT_EDIT);
            }
//            if(coupon.getAuditStatus()!=3){
//                throw new ServiceException(AppErrorConstant.COUPON_AUDIT_EDIT);
//            }
            couponRelUserService.deleteCouponRelByCouponId(coupon.getCouponId());
            couponRelGoodsService.deleteCouponRelByCouponId(coupon.getCouponId());
            coupon.setCouponStatus(1);
ruoyi-modules/ruoyi-member/src/main/resources/mapper/member/MemberMapper.xml
@@ -161,7 +161,8 @@
        tm.birthday birthday,
        tm.user_tags userTags,
        tm.goods_type goodsType,
        tmt.last_service_time lastPayTime
        tmt.last_service_time lastPayTime,
        tm.memberNurse
        FROM t_member tm
        INNER JOIN t_member_total tmt ON tm.member_id = tmt.member_id
        WHERE tm.relation_shop_id = #{param.shopId} AND tm.binding_flag = 1
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerConsumerController.java
@@ -43,7 +43,7 @@
    private UserServiceRecordService userServiceRecordService;
    @RequestMapping(value = "/listMerConsumerGoods", method = RequestMethod.POST)
    @ApiOperation(value = "获取用户服务列表")
    @ApiOperation(value = "获取用户服务列表【2.0】")
    public R<MerConsumerGoodsVo> listMerConsumerGoods(@RequestBody MerConsumerGoodsDto merConsumerGoodsDto) {
        Long userId = SecurityUtils.getUserId();
        merConsumerGoodsDto.setUserId(userId);
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java
@@ -5,6 +5,7 @@
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.domain.dto.*;
import com.ruoyi.order.domain.pojo.order.Order;
import com.ruoyi.order.domain.vo.*;
import com.ruoyi.order.service.order.OrderService;
import com.ruoyi.system.api.constant.AppErrorConstant;
@@ -16,6 +17,7 @@
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
@@ -71,7 +73,12 @@
        Long userId = SecurityUtils.getUserId();
        merVerifyCodeDto.setUserId(userId);
        String verifyCode = merVerifyCodeDto.getVerifyCode();
        MerVerifyOrderVo merVerifyOrderVo = orderService.verifyOrder(verifyCode,merVerifyCodeDto.getShopId());
        MerVerifyOrderVo merVerifyOrderVo = null;
        if (!verifyCode.contains("http")) {
            merVerifyOrderVo = orderService.verifyOrder(verifyCode, merVerifyCodeDto.getShopId());
        } else {
            //三方订单
        }
        return R.ok(merVerifyOrderVo);
    }
@@ -80,7 +87,12 @@
    public R<MerVerifyOrderVo> sureVerifyOrder(@RequestBody MerVerifyOrderDto merVerifyOrderDto) {
        Long userId = SecurityUtils.getUserId();
        merVerifyOrderDto.setUserId(userId);
        MerVerifyOrderVo merVerifyOrderVo = orderService.sureVerifyOrder(merVerifyOrderDto);
        MerVerifyOrderVo merVerifyOrderVo = null;
        if (!merVerifyOrderDto.getOrderId().contains("http")) {
            merVerifyOrderVo = orderService.sureVerifyOrder(merVerifyOrderDto);
        } else {
            //三方订单
        }
        return R.ok(merVerifyOrderVo);
    }
@@ -133,19 +145,43 @@
        orderService.createNewOrder(merNewOrderDto);
        return R.ok();
    }
    @RequestMapping(value = "/pageMerOrder", method = RequestMethod.POST)
    @ApiOperation(value = "获取商户端订单列表")
    @ApiOperation(value = "获取商户端订单列表【2.0】")
    public R<Page<MerOrderPageVo>> pageMerOrder(@RequestBody MerOrderPageDto merOrderPageDto) {
        Long userId = SecurityUtils.getUserId();
        merOrderPageDto.setUserId(userId);
        Page<MerOrderPageVo> page = new Page<>();
        page.setSize(merOrderPageDto.getPageSize());
        page.setCurrent(merOrderPageDto.getPageNum());
        List<MerOrderPageVo> merOrderPageVoList = orderService.pageMerOrder(page,merOrderPageDto);
        List<MerOrderPageVo> merOrderPageVoList = orderService.pageMerOrder(page, merOrderPageDto);
        return R.ok(page.setRecords(merOrderPageVoList));
    }
    @RequestMapping(value = "/cancelMerOrder", method = RequestMethod.POST)
    @ApiOperation(value = "商户端取消线下订单【2.0】")
    public R cancelMerOrder(@RequestBody CancelMerOrderDto dto) {
        Order order = orderService.getById(dto.getOrderId());
        if (null == order) {
            return R.fail("订单不存在");
        }
        if (order.getOrderStatus() == 0) {
            return R.fail("订单已取消");
        }
        if (!order.getShopId().equals(dto.getShopId())) {
            return R.fail("取消失败");
        }
        if (3 != order.getOrderFrom()) {
            return R.fail("取消失败");
        }
        order.setOrderStatus(0);
        order.setCancelTime(new Date());
        orderService.updateById(order);
        return R.ok();
    }
    @RequestMapping(value = "/totalMerOrder", method = RequestMethod.POST)
    @ApiOperation(value = "商户端订单管理统计")
    public R<MerTotalOrderVo> totalMerOrder(@RequestBody MerOrderPageDto merOrderPageDto) {
@@ -154,9 +190,9 @@
        MerTotalOrderVo totalOrderVo = orderService.totalMerOrder(merOrderPageDto);
        return R.ok(totalOrderVo);
    }
    @RequestMapping(value = "/pageMerMemberOrder", method = RequestMethod.POST)
    @ApiOperation(value = "分页商户端用户收银记录")
    @ApiOperation(value = "分页商户端用户收银记录【2.0】")
    public R<Page<MerMemberOrderVo>> pageMerMemberOrder(@RequestBody MerMemberNoClearOrderDto merMemberNoClearOrderDto) {
        Long userId = SecurityUtils.getUserId();
        merMemberNoClearOrderDto.setUserId(userId);
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/CancelMerOrderDto.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.order.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/5 17:53
 */
@Data
@ApiModel
public class CancelMerOrderDto {
    @ApiModelProperty("商户id")
    private Long shopId;
    @ApiModelProperty("订单id")
    private String orderId;
}
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/dto/MerOrderPageDto.java
@@ -27,7 +27,7 @@
    @ApiModelProperty(value = "搜索关键词")
    private String keyword;
    @ApiModelProperty(value = "1.全部2.待核销3.已核销")
    @ApiModelProperty(value = "0.已取消1.全部2.待核销3.已核销")
    private Integer type;
    @ApiModelProperty(value = "订单开始时间")
@@ -35,7 +35,7 @@
    @ApiModelProperty(value = "订单结束时间")
    private String endOrderDate;
    @ApiModelProperty(value = "订单来源1.店铺商品2.平台秒杀活动3.线下创建")
    @ApiModelProperty(value = "订单来源1.商城2.秒杀活动3.线下创建4.抽奖5.美团6.抖音7.快手")
    private Integer orderFrom;
}
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerConsumerGoodsListVo.java
@@ -24,31 +24,34 @@
    @ApiModelProperty(value="商品类型1周期2服务3体验4单品")
    private Integer goodsType;
    @ApiModelProperty(value="商品名称")
    @ApiModelProperty(value = "商品名称")
    private String goodsName;
    @ApiModelProperty(value="商品标签")
    @ApiModelProperty(value = "商品标签")
    private String goodsTags;
    @ApiModelProperty(value = "商品简介")
    private String goodsIntroduction;
    @ApiModelProperty(value="商品图片")
    @ApiModelProperty(value = "商品图片")
    private String goodsPicture;
    @ApiModelProperty(value="商品调理问题")
    @ApiModelProperty(value = "商品调理问题")
    private String goodsNurses;
    @ApiModelProperty(value="周期标记")
    @ApiModelProperty(value = "周期标记")
    private Integer cycleNumFlag;
    @ApiModelProperty(value="服务次数")
    @ApiModelProperty(value = "服务次数")
    private Integer serviceNum;
    @ApiModelProperty(value="消耗次数")
    @ApiModelProperty(value = "消耗次数")
    private Integer usedNum;
    @ApiModelProperty(value="待确认次数")
    @ApiModelProperty(value = "待确认次数")
    private Integer sureNum;
    @ApiModelProperty(value = "是否选中")
    private Boolean optionFlag;
}
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerMemberOrderVo.java
@@ -1,11 +1,13 @@
package com.ruoyi.order.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.system.api.domain.vo.MerCouponGoodsListVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
 * @ClassName MerMemberOrderVo
@@ -55,14 +57,17 @@
    @ApiModelProperty(value="未收金额")
    
    private BigDecimal unPaidMoney;
    @ApiModelProperty(value="收款时间")
    @ApiModelProperty(value = "收款时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date receiveMoneyTime;
    @ApiModelProperty(value="收款金额")
    @ApiModelProperty(value = "收款金额")
    private BigDecimal thisReceiveMoney;
    @ApiModelProperty(value="收款方式")
    @ApiModelProperty(value = "收款方式")
    private String thisReceiveType;
    @ApiModelProperty(value = "商品信息")
    private List<MerCouponGoodsListVo> goodsList;
}
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/domain/vo/MerVerifyAwardVo.java
@@ -31,7 +31,7 @@
    @ApiModelProperty(value = "奖品来源")
    private String giftFrom;
    @ApiModelProperty(value = "礼物类型1优惠券2商品3现金4实物")
    @ApiModelProperty(value = "礼物类型1优惠券2商品3现金4实物5积分")
    private Integer giftType;
    @ApiModelProperty(value = "奖品名称")
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/ConsumerGoodsServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.order.service.impl.order;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.R;
@@ -87,20 +88,29 @@
    public List<AppConsumerPageVo> pageUserConsumerGoods(Page page, AppConsumerPageDto appConsumerPageDto){
        return consumerGoodsMapper.pageUserConsumerGoods(page, appConsumerPageDto);
    }
    /**
     * 获取会员服务商品
     *
     * @param merConsumerGoodsDto
     * @return
     */
    @Override
    public MerConsumerGoodsVo listMerConsumerGoods(MerConsumerGoodsDto merConsumerGoodsDto){
    public MerConsumerGoodsVo listMerConsumerGoods(MerConsumerGoodsDto merConsumerGoodsDto) {
        MerConsumerGoodsVo merConsumerGoodsVo = new MerConsumerGoodsVo();
        if(merConsumerGoodsDto.getGoodsType()==1){
        if (merConsumerGoodsDto.getGoodsType() == 1) {
            List<MerConsumerGoodsListVo> noSureList = consumerGoodsMapper.listMerNoSureConsumerGoods(merConsumerGoodsDto);
            merConsumerGoodsVo.setNoSureList(noSureList);
        }
        List<MerConsumerGoodsListVo> sureList = consumerGoodsMapper.listMerConsumerGoods(merConsumerGoodsDto);
        Member member = remoteMemberService.getMember(merConsumerGoodsDto.getUserId()).getData();
        String lastServiceId = member.getLastServiceId();
        if (StringUtils.isNotEmpty(lastServiceId)) {
            List<String> list = JSON.parseArray(lastServiceId, String.class);
            sureList.forEach(s -> {
                s.setOptionFlag(list.contains(s.getConsumerGoodsId()));
            });
        }
        merConsumerGoodsVo.setSureList(sureList);
        return merConsumerGoodsVo;
    }
@@ -174,13 +184,13 @@
                }
            }
            //判断商品确认次数
            if(sureNum>oldConsumerGoods.getSureNum()){
            if (sureNum > oldConsumerGoods.getSureNum()) {
                throw new ServiceException(AppErrorConstant.GOODS_SURE_FAILED);
            }else{
            } else {
                int surpNum = oldConsumerGoods.getSureNum();
                surpNum = surpNum - sureNum;
                oldConsumerGoods.setSureNum(surpNum);
                if(surpNum==0){
                if (surpNum == 0) {
                    oldConsumerGoods.setDelFlag(1);
                }
                this.saveOrUpdate(oldConsumerGoods);
@@ -304,20 +314,26 @@
            serviceRecord.setConsumerGoodsNames(goodsNames);
            userServiceRecordService.saveOrUpdate(serviceRecord);
            //服务记录详情
            for(ServiceRecordDetail serviceRecordDetail1 : serviceRecordDetailList){
            for (ServiceRecordDetail serviceRecordDetail1 : serviceRecordDetailList) {
                serviceRecordDetail1.setRecordId(serviceRecord.getId());
            }
            serviceRecordDetailService.saveBatch(serviceRecordDetailList);
            //保存本次确认的服务商品id,用于下次进入页面后默认勾选上
            List<String> collect = goodsList.stream().map(MerSureConsumerGoodsListDto::getConsumerGoodsId).collect(Collectors.toList());
            Member member = remoteMemberService.getMember(merSureConsumerGoodsDto.getUserId()).getData();
            member.setLastServiceId(JSON.toJSONString(collect));
            remoteMemberService.editMember(member);
            //更新商户和会员服务统计
            MemberTotalChangeDto memberTotalChange = new MemberTotalChangeDto();
            memberTotalChange.setUserId(merSureConsumerGoodsDto.getMemberUserId());
            memberTotalChange.setTypeService(2);
            memberTotalChange.setServiceCount(serviceCount);
            remoteMemberService.changeMemberTotal(memberTotalChange);
            if(!sendData.isEmpty()){
                Member member = remoteMemberService.getMember(userId).getData();
            if (!sendData.isEmpty()) {
                R<Shop> r = remoteShopService.getShop(shopId);
                if(r.getCode() != 200){
                if (r.getCode() != 200) {
                    throw new ServiceException(r.getMsg());
                }
                Shop shop = r.getData();
@@ -327,11 +343,10 @@
                        Integer number = Integer.valueOf(sendDatum.get("number").toString());
                        String msg = "{\"name\":\"" + (StringUtils.isEmpty(member.getRealName()) ? member.getNickName() : member.getRealName()) + "\"," +
                                "\"store\":\"" + shop.getShopName() + "\",\"product\":\"" + product + "\"}";
                        if(number == 2){
                            MsgUtils.sendMsg(member.getMobile(),"SMS_464376210",msg);
                        }
                        if(number == 0){
                            MsgUtils.sendMsg(member.getMobile(),"SMS_464321234",msg);
                        if (number == 0) {
                            MsgUtils.sendMsg(member.getMobile(), "SMS_464321234", msg);
                        } else {
                            MsgUtils.sendMsg(member.getMobile(), "SMS_464376210", msg);
                        }
                    }
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -181,6 +181,7 @@
        if(shop!=null&&shop.getShopStatus()!=1){
            throw new ServiceException(AppErrorConstant.SHOP_CLOSED);
        }
        Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
        // 初始化订单对象
        AppSureOrderVo appSureOrderVo = new AppSureOrderVo();
        // 初始化订单商品列表
@@ -266,6 +267,14 @@
            ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
            if (shopGoods != null) {
                goodsPrice = shopGoods.getSalesPrice();
            } else {
                //经销商定制价格
                appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
                appShopGoodsGetDto.setShopId(belongShop.getShopId());
                shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
                if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                    goodsPrice = shopGoods.getSalesPrice();
                }
            }
            appSureOrderGoodsVo.setGoodsPrice(goodsPrice);
            buyNumBig = BigDecimal.valueOf(buyNum);
@@ -449,6 +458,16 @@
        ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
        if (shopGoods != null) {
            goodsPrice = shopGoods.getSalesPrice();
        } else {
            //经销商定制价格
            Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
            appShopGoodsGetDto = new AppShopGoodsGetDto();
            appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
            appShopGoodsGetDto.setShopId(belongShop.getShopId());
            shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                goodsPrice = shopGoods.getSalesPrice();
            }
        }
        appPanicBuyVo.setGoodsPrice(goodsPrice);
        buyNumBig = BigDecimal.valueOf(buyNum);
@@ -588,6 +607,18 @@
            if (shopGoods != null) {
                goodsPrice = shopGoods.getSalesPrice();
                serviceNum = shopGoods.getServiceNum();
            } else {
                //经销商定制价格
                Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData();
                Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
                appShopGoodsGetDto = new AppShopGoodsGetDto();
                appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
                appShopGoodsGetDto.setShopId(belongShop.getShopId());
                shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
                if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
                    goodsPrice = shopGoods.getSalesPrice();
                    serviceNum = shopGoods.getServiceNum();
                }
            }
            appSureOrderGoodsVo.setGoodsPrice(goodsPrice);
            // 计算商品总价
@@ -3032,9 +3063,27 @@
                if (merMemberNoClearOrderVo.getUnPaidMoney() == null) {
                    merMemberNoClearOrderVo.setUnPaidMoney(zeroBig);
                }
                if(merMemberNoClearOrderVo.getUnPaidMoney().compareTo(zeroBig)<0){
                if (merMemberNoClearOrderVo.getUnPaidMoney().compareTo(zeroBig) < 0) {
                    merMemberNoClearOrderVo.setUnPaidMoney(zeroBig);
                }
                List<MerCouponGoodsListVo> goodsList = new ArrayList<>();
                orderGoodsService.listByOrderId(merMemberNoClearOrderVo.getOrderId()).forEach(orderGoodsVo -> {
                    MerCouponGoodsListVo merCouponGoodsListVo = new MerCouponGoodsListVo();
                    merCouponGoodsListVo.setGoodsId(orderGoodsVo.getGoodsId());
                    merCouponGoodsListVo.setGoodsName(orderGoodsVo.getGoodsName());
                    merCouponGoodsListVo.setGoodsNum(orderGoodsVo.getBuyNum());
                    if (orderGoodsVo.getGoodsType() == 1) {
                        merCouponGoodsListVo.setGoodsType("周期");
                    } else if (orderGoodsVo.getGoodsType() == 2) {
                        merCouponGoodsListVo.setGoodsType("服务");
                    } else if (orderGoodsVo.getGoodsType() == 3) {
                        merCouponGoodsListVo.setGoodsType("体验");
                    } else if (orderGoodsVo.getGoodsType() == 4) {
                        merCouponGoodsListVo.setGoodsType("单品");
                    }
                    goodsList.add(merCouponGoodsListVo);
                });
                merMemberNoClearOrderVo.setGoodsList(goodsList);
            }
        }
        return merMemberNoClearOrderVoList;
@@ -4801,17 +4850,17 @@
        if (memberGiftRecord.getGiftFrom() == 1) {
            BirthdayCard birthdayCard = remoteMemberService.getBirthdayCard().getData();
            //判断生日活动状态
            if(birthdayCard!=null&&birthdayCard.getCardStatus()==1){
            if (birthdayCard != null && birthdayCard.getCardStatus() == 1) {
                shop = remoteShopService.getShop(shopId).getData();
                //判断指定区域全部店铺
                if(birthdayCard.getAreaFlag()==2&&birthdayCard.getShopFlag()==1&&!StringUtils.checkString(birthdayCard.getDesignatedArea(),shop.getShopCityCode())){
                if (birthdayCard.getAreaFlag() == 2 && birthdayCard.getShopFlag() == 1 && !StringUtils.checkString(birthdayCard.getDesignatedArea(), shop.getShopCityCode())) {
                    throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR);
                }
                //判断指定店铺
                if(birthdayCard.getShopFlag()==2&&!StringUtils.checkString(birthdayCard.getApplicableShop(),shopId.toString())){
                if (birthdayCard.getShopFlag() == 2 && !StringUtils.checkString(birthdayCard.getApplicableShop(), shopId.toString())) {
                    throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR);
                }
            }else{
            } else {
                throw new ServiceException(AppErrorConstant.BIRTHDAY_CARD_ERROR);
            }
        }
@@ -4819,16 +4868,20 @@
        if (memberGiftRecord.getGiftFrom() == 2 && !memberGiftRecord.getShopId().equals(shopId)) {
            throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR);
        }
        merVerifyAwardVo.setUserName(member.getRealName());
        merVerifyAwardVo.setUserMobile(member.getMobile());
        if (memberGiftRecord.getGiftFrom() == 1) {
            merVerifyAwardVo.setGiftFrom("平台生日卡");
        if (1 == memberGiftRecord.getPrizeFrom()) {
            if (memberGiftRecord.getGiftFrom() == 1) {
                merVerifyAwardVo.setGiftFrom("平台生日卡");
            } else {
                merVerifyAwardVo.setGiftFrom("商户生日卡");
            }
        } else {
            merVerifyAwardVo.setGiftFrom("商户生日卡");
            merVerifyAwardVo.setGiftFrom("平台抽奖");
        }
        merVerifyAwardVo.setGiftType(memberGiftRecord.getGiftType());
        //礼物类型1优惠券2商品3现金4实物
        //礼物类型1优惠券2商品3现金4实物5积分
        switch (memberGiftRecord.getGiftType()) {
            case 1:
                merVerifyAwardVo.setGiftName(memberGiftRecord.getCouponName());
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -365,24 +365,32 @@
        toc.order_status orderStatus,
        toc.order_money orderGoodsMoney,
        toc.coupon_money couponDiscount,
        CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney,
        CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN
        toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney,
        toc.receivable_deposit receivableDeposit,
        toc.pay_money payMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) relReceiveMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE
        toc.change_receivable_money END) relReceiveMoney,
        CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END receiveMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) - (CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END) unPaidMoney,
        (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE
        toc.change_receivable_money END) - (CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN
        IFNULL(toc.offline_pay_money,0) END) unPaidMoney,
        toc.order_remark orderRemark,
        toc.create_time createTime,
        toc.order_from orderFrom,
        CASE toc.order_from WHEN 1 THEN '商城订单' WHEN 2 THEN CONCAT('平台秒杀活动(',toc.activity_name,')') WHEN 3 THEN '线下创建' END orderFromDesc,
        CASE toc.order_from WHEN 1 THEN '商城订单' WHEN 2 THEN CONCAT('平台秒杀活动(',toc.activity_name,')') WHEN 3 THEN
        '线下创建' END orderFromDesc,
        toc.activity_name activityName
        FROM t_order toc
        WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId}  and if(toc.order_from = 1, 1 = 1, toc.order_status = 3)<!--临时增加过滤-->
        WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId}
        <if test="param.memberUserId != null and param.memberUserId != ''">
            AND toc.user_id = #{param.memberUserId}
        </if>
        <if test="param.type != null and param.type ==0 ">
            AND toc.order_status = 0
        </if>
        <if test="param.type != null and param.type ==1 ">
            AND (toc.order_status = 2 OR toc.order_status = 3)
            AND toc.order_status in(0, 2, 3)
        </if>
        <if test="param.type != null and param.type ==2 ">
            AND toc.order_status = 2
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerShopController.java
@@ -1,27 +1,37 @@
package com.ruoyi.shop.controller.business;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.shop.domain.dto.*;
import com.ruoyi.shop.domain.pojo.shop.ShopRelUser;
import com.ruoyi.shop.domain.vo.MerAgencyPageVo;
import com.ruoyi.shop.domain.vo.MerShopCertificateListVo;
import com.ruoyi.shop.domain.vo.MerShopSuggestVo;
import com.ruoyi.shop.domain.vo.MerchantBasicdataSettlementVo;
import com.ruoyi.shop.domain.vo.*;
import com.ruoyi.shop.service.shop.*;
import com.ruoyi.system.api.domain.dto.*;
import com.ruoyi.system.api.domain.dto.MerBaseDto;
import com.ruoyi.system.api.domain.dto.MerBaseGetDto;
import com.ruoyi.system.api.domain.dto.MerEditUserDto;
import com.ruoyi.system.api.domain.dto.MerPageDto;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime;
import com.ruoyi.system.api.domain.poji.shop.ShopNonAppointableTime;
import com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo;
import com.ruoyi.system.api.domain.vo.MerStaffInfoVo;
import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author jqs34
@@ -41,23 +51,31 @@
    @Resource
    private ShopCertificateService shopCertificateService;
    @Resource
    private ShopStaffService shopStaffService;
    @Resource
    private ShopRelUserService shopRelUserService;
    @Resource
    private ShopSuggestService shopSuggestService;
    @Resource
    private ShopNonAppointableTimeService shopNonAppointableTimeService;
    @Resource
    private ShopAppointableTimeService shopAppointableTimeService;
    /**
     * 未完成实际统计
     *
     * @param merBaseDto
     * @return
     */
    @RequestMapping(value = "/getMerHomeTotal", method = RequestMethod.POST)
    @ApiOperation(value = "获取商户端商业统计")
    @ApiOperation(value = "获取商户端商业统计【2.0】")
    public R<MerHomeShopTotalVo> getMerHomeTotal(@RequestBody MerBaseDto merBaseDto) {
        Long userId = SecurityUtils.getUserId();
        merBaseDto.setUserId(userId);
@@ -100,14 +118,16 @@
        shopCertificateService.deleteShopCertificate(Long.valueOf(merBaseGetDto.getId()));
        return R.ok();
    }
    @RequestMapping(value = "/getShopStaffInfo", method = RequestMethod.POST)
    @ApiOperation(value = "获取员工信息")
    public R<MerStaffInfoVo> getShopStaffInfo() {
    @ApiOperation(value = "获取员工信息【2.0】")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "当前商户id", name = "shopId", required = true, dataType = "Long", paramType = "query")
    })
    public R<MerStaffInfoVo> getShopStaffInfo(@RequestParam("shopId") Long shopId) {
        Long userId = SecurityUtils.getUserId();
        ShopRelUser shopRelUser = shopRelUserService.getByUserId(userId);
        Shop shop = shopService.getByShopId(shopRelUser.getShopId());
        MerStaffInfoVo merStaffInfoVo = shopStaffService.getShopStaffInfo(userId,shop);
        Shop shop = shopService.getByShopId(shopId);
        MerStaffInfoVo merStaffInfoVo = shopStaffService.getShopStaffInfo(userId, shop);
        return R.ok(merStaffInfoVo);
    }
@@ -151,22 +171,133 @@
        shopSuggestService.suggest(merShopSuggestDto);
        return R.ok();
    }
    @RequestMapping(value = "/listShopByShop", method = RequestMethod.POST)
    @ApiOperation(value = "获取商户下属代理商")
    public R<List<MgtSimpleShopVo>> listShopByShop(@RequestBody MerBaseDto merBaseDto)
    {
    public R<List<MgtSimpleShopVo>> listShopByShop(@RequestBody MerBaseDto merBaseDto) {
        List<MgtSimpleShopVo> mgtShopListSimpleVos = shopService.listShopByShop(merBaseDto.getShopId());
        return R.ok(mgtShopListSimpleVos);
    }
    @RequestMapping(value = "/getShopMerchantBasicDataSettlement", method = RequestMethod.POST)
    @ApiOperation(value = "获取提现记录(汇付天下)")
    public R<List<MerchantBasicdataSettlementVo>> getMerchantBasicDataSettlement(@Validated @RequestBody MerchantBasicdataSettlementDto mgtShopShareRatioSetDto){
    public R<List<MerchantBasicdataSettlementVo>> getMerchantBasicDataSettlement(@Validated @RequestBody MerchantBasicdataSettlementDto mgtShopShareRatioSetDto) {
        return shopService.getMerchantBasicDataSettlement(mgtShopShareRatioSetDto);
    }
    @RequestMapping(value = "/getUserShopList", method = RequestMethod.POST)
    @ApiOperation(value = "获取切换门店列表【2.0】")
    public R<List<Shop>> getUserShopList() {
        List<ShopRelUser> shopRelUsers = shopRelUserService.getByUserId(SecurityUtils.getUserId());
        shopRelUsers.sort(Comparator.comparing(ShopRelUser::getIsDefault));
        List<Shop> collect = shopRelUsers.stream().map(shopRelUser -> {
            Shop shop = shopService.getById(shopRelUser.getShopId());
            return shop;
        }).collect(Collectors.toList());
        return R.ok(collect);
    }
    @RequestMapping(value = "/getShopReservationConfig/{shopId}", method = RequestMethod.POST)
    @ApiOperation(value = "获取门店预约管理配置【2.0】")
    public R<ShopReservationConfigVo> getShopReservationConfig(@PathVariable("shopId") Long shopId) {
        Shop shop = shopService.getById(shopId);
        Integer subscribe = shop.getSubscribe();
        ShopReservationConfigVo vo = new ShopReservationConfigVo();
        vo.setSubscribe(subscribe);
        List<ShopNonAppointableTime> list = shopNonAppointableTimeService.list(new LambdaQueryWrapper<ShopNonAppointableTime>().eq(ShopNonAppointableTime::getShopId, shopId)
                .orderByAsc(ShopNonAppointableTime::getNonAppointableStartTime));
        vo.setUnsubscribeTime(list.stream().map(shopNonAppointableTime -> {
            Map<String, String> map = new HashMap<>();
            String time = shopNonAppointableTime.getNonAppointableStartTime().format(DateTimeFormatter.ofPattern("MM月dd日 HH:mm")) + "-" + shopNonAppointableTime.getNonAppointableEndTime().format(DateTimeFormatter.ofPattern("HH:mm"));
            map.put("time", time);
            map.put("id", shopNonAppointableTime.getId());
            return map;
        }).collect(Collectors.toList()));
        return R.ok(vo);
    }
    @RequestMapping(value = "/addShopNonAppointableTime", method = RequestMethod.POST)
    @ApiOperation(value = "门店添加不可预约时间段【2.0】")
    public R addShopNonAppointableTime(@RequestBody ShopNonAppointableTimeDto dto) {
        ShopNonAppointableTime shopNonAppointableTime = new ShopNonAppointableTime();
        shopNonAppointableTime.setShopId(dto.getShopId());
        shopNonAppointableTime.setNonAppointableStartTime(dto.getNonAppointableStartTime());
        shopNonAppointableTime.setNonAppointableEndTime(dto.getNonAppointableEndTime());
        shopNonAppointableTimeService.save(shopNonAppointableTime);
        return R.ok();
    }
    @RequestMapping(value = "/switchAppointment/{shopId}/{subscribe}", method = RequestMethod.POST)
    @ApiOperation(value = "开关门店预约配置【2.0】")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "门店id", name = "shopId", required = true, dataType = "Long", paramType = "path"),
            @ApiImplicitParam(value = "预约开关(0=关,1=开)", name = "subscribe", required = true, dataType = "Integer", paramType = "path")
    })
    public R switchAppointment(@PathVariable("shopId") Long shopId, @PathVariable("subscribe") Integer subscribe) {
        Shop shop = shopService.getById(shopId);
        shop.setSubscribe(subscribe);
        shopService.updateById(shop);
        return R.ok();
    }
    @RequestMapping(value = "/getShopAppointableTimeList", method = RequestMethod.POST)
    @ApiOperation(value = "商户获取预约列表【2.0】")
    public R<Page<ShopAppointableTimeListVo>> getShopAppointableTimeList(@RequestBody ShopAppointableTimeListDto dto) {
        Page<ShopAppointableTimeListVo> page = new Page<>();
        page.setSize(dto.getPageSize());
        page.setCurrent(dto.getPageNum());
        List<ShopAppointableTimeListVo> shopAppointableTimeList = shopAppointableTimeService.getShopAppointableTimeList(page, dto);
        return R.ok(page.setRecords(shopAppointableTimeList));
    }
    @RequestMapping(value = "/confirmReservation/{id}", method = RequestMethod.POST)
    @ApiOperation(value = "商户确认预约【2.0】")
    public R confirmReservation(@PathVariable("id") String id) {
        ShopAppointableTime shopAppointableTime = shopAppointableTimeService.getById(id);
        if (null == shopAppointableTime) {
            return R.fail("预约不存在");
        }
        if (1 != shopAppointableTime.getStatus()) {
            return R.fail("确认预约失败");
        }
        shopAppointableTime.setStatus(2);
        shopAppointableTimeService.updateById(shopAppointableTime);
        return R.ok();
    }
    @RequestMapping(value = "/cancelReservation", method = RequestMethod.POST)
    @ApiOperation(value = "商户取消预约【2.0】")
    public R cancelReservation(@RequestBody CancelReservationDto dto) {
        ShopAppointableTime shopAppointableTime = shopAppointableTimeService.getById(dto.getId());
        if (null == shopAppointableTime) {
            return R.fail("预约不存在");
        }
        if (0 == shopAppointableTime.getStatus()) {
            return R.fail("不能重复操作");
        }
        shopAppointableTime.setStatus(0);
        shopAppointableTime.setReason(dto.getReason());
        shopAppointableTimeService.updateById(shopAppointableTime);
        return R.ok();
    }
    @RequestMapping(value = "/getMyShopList", method = RequestMethod.POST)
    @ApiOperation(value = "获取当前账户可切换的门店列表【2.0】")
    public R<List<Shop>> getMyShopList() {
        Long userId = SecurityUtils.getUserId();
        List<ShopRelUser> shopRelUser = shopRelUserService.getByUserId(userId);
        List<Shop> collect = shopRelUser.stream().map(e -> {
            Shop shop = shopService.getById(e.getShopId());
            return shop;
        }).collect(Collectors.toList());
        return R.ok(collect);
    }
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java
@@ -1,7 +1,6 @@
package com.ruoyi.shop.controller.console;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
@@ -16,7 +15,6 @@
import com.ruoyi.system.api.constant.AppErrorConstant;
import com.ruoyi.system.api.domain.dto.*;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.domain.vo.ShopProportionVo;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.api.domain.vo.*;
import com.ruoyi.system.api.model.QwH5LoginVo;
@@ -32,7 +30,6 @@
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * @author jqs34
@@ -174,17 +171,20 @@
    @PostMapping("/getShopByUserId")
    public R<ShopRelUserVo> getShopByUserId(@RequestBody Long userId)
    {
        ShopRelUser shopRelUser = shopRelUserService.getByUserId(userId);
        List<ShopRelUser> shopRelUser = shopRelUserService.getByUserId(userId);
        Optional.ofNullable(shopRelUser).orElseThrow(() -> new ServiceException("未查询到用户关联商户"));
        ShopRelUserVo shopRelUserVo = new ShopRelUserVo();
        shopRelUserVo.setShopId(shopRelUser.getShopId());
        shopRelUserVo.setUserName(shopRelUser.getUserName());
        ShopRelUser shopRelUser1 = shopRelUser.stream().filter(s -> s.getIsDefault() == 1).collect(Collectors.toList()).get(0);
        shopRelUserVo.setShopId(shopRelUser1.getShopId());
        shopRelUserVo.setUserName(shopRelUser1.getUserName());
        Shop shop = shopService.getById(shopRelUser1.getShopId());
        shopRelUserVo.setShopName(shop.getShopName());
        shopRelUserVo.setShopNum(shopRelUser.size());
        return R.ok(shopRelUserVo);
    }
    @PostMapping("/getShopByBelongUserId")
    public R<ShopRelUserVo> getShopByBelongUserId(@RequestBody Long userId)
    {
    public R<ShopRelUserVo> getShopByBelongUserId(@RequestBody Long userId) {
        List<Shop> shopList = shopService.getShopByBelongUserId(userId);
        Optional.ofNullable(shopList.get(0)).orElseThrow(() -> new ServiceException("未查询到商户信息"));
        ShopRelUserVo shopRelUserVo = new ShopRelUserVo();
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java
@@ -3,7 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.shop.domain.dto.AppNearbyShopDto;
@@ -28,6 +28,7 @@
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
@@ -82,7 +83,7 @@
    @ApiOperation(value = "获取商户不可预约时间段【2.0】")
    public R<List<ShopNonAppointableTime>> getShopAppointmentTime(@RequestBody ShopAppointmentTimeDto dto) {
        List<ShopNonAppointableTime> list = shopNonAppointableTimeService.list(new QueryWrapper<ShopNonAppointableTime>().eq("shop_id", dto.getId())
                .last(" and '" + dto.getDate() + "' like CONCAT('%', non_appointable_start_time, '%') order by non_appointable_start_time"));
                .last(" and '" + dto.getDate() + "' = DATE(non_appointable_start_time) order by non_appointable_start_time"));
        return R.ok(list);
    }
    
@@ -90,14 +91,14 @@
    @ApiOperation(value = "门店详情预约操作【2.0】")
    public R appointmentTime(@RequestBody AppointmentTimeDto dto) {
        ShopAppointableTime one = shopAppointableTimeService.getOne(new LambdaQueryWrapper<ShopAppointableTime>().eq(ShopAppointableTime::getShopId, dto.getShopId())
                .eq(ShopAppointableTime::getAppointableTime, dto.getTime()));
                .last(" and DATE_FORMAT(appointable_time, '%Y-%m-%d %H:%i') = '" + dto.getTime() + "'"));
        if (null != one) {
            return R.fail("不能重复预约");
        }
        Long userId = SecurityUtils.getUserId();
        one = new ShopAppointableTime();
        one.setShopId(dto.getShopId());
        one.setAppointableTime(dto.getTime());
        one.setAppointableTime(LocalDateTime.parse(dto.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")));
        one.setUserId(userId);
        one.setStatus(1);
        one.setCreateTime(LocalDateTime.now());
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/CancelReservationDto.java
New file
@@ -0,0 +1,16 @@
package com.ruoyi.shop.domain.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/3 16:08
 */
@Data
@ApiModel
public class CancelReservationDto {
    @ApiModelProperty(value = "预约id")
    private String id;
    @ApiModelProperty(value = "取消原因")
    private String reason;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MyAppointmentListDto.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.shop.domain.dto;
import com.ruoyi.system.api.domain.dto.MgtBaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @Date 2025/5/27 14:29
 */
@ApiModel
@Data
public class MyAppointmentListDto extends MgtBaseDto {
    @ApiModelProperty("页码,首页1")
    private Integer pageNum;
    @ApiModelProperty("页查询条数")
    private Integer pageSize;
    @ApiModelProperty("状态(0=已取消,1=待确认,2=等待中,3=已结束)")
    private Integer status;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/ShopAppointableTimeListDto.java
New file
@@ -0,0 +1,17 @@
package com.ruoyi.shop.domain.dto;
import com.ruoyi.system.api.domain.dto.MgtPageDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/6/3 15:17
 */
@Data
@ApiModel
public class ShopAppointableTimeListDto extends MgtPageDto {
    @ApiModelProperty(value = "商户id")
    private Integer shopId;
    @ApiModelProperty(value = "状态(0=已取消,1=待确认,2=等待中,3=已结束)")
    private Integer status;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/ShopNonAppointableTimeDto.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.shop.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime; /**
 * @author zhibing.pu
 * @Date 2025/6/3 14:59
 */
@Data
@ApiModel
public class ShopNonAppointableTimeDto {
    @ApiModelProperty("门店id")
    private Integer shopId;
    @ApiModelProperty("不可预约开始时间(yyyy-MM-dd HH:mm:ss)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime nonAppointableStartTime;
    @ApiModelProperty("不可预约结束时间(yyyy-MM-dd HH:mm:ss)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime nonAppointableEndTime;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/pojo/shop/ShopRelUser.java
@@ -1,15 +1,15 @@
package com.ruoyi.shop.domain.pojo.shop;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
 * <p>
@@ -40,6 +40,11 @@
    @TableField("shop_id")
    private Long shopId;
    /**
     * 默认门店(0=否,1=是)
     */
    @TableField("is_default")
    private Integer isDefault;
    /**
     * 用户id
     */
    @TableField("user_id")
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/MyAppointmentListVo.java
New file
@@ -0,0 +1,22 @@
package com.ruoyi.shop.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; /**
 * @author zhibing.pu
 * @Date 2025/5/27 14:32
 */
@Data
@ApiModel
public class MyAppointmentListVo {
    @ApiModelProperty(value = "预约id")
    private String id;
    @ApiModelProperty(value = "预约时间")
    private String appointmentTime;
    @ApiModelProperty(value = "预约状态(0=已取消,1=待确认,2=等待中,3=已结束)")
    private Integer status;
    @ApiModelProperty(value = "预约门店")
    private String shopName;
    @ApiModelProperty(value = "商家取消原因")
    private String cancelReason;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/ShopAppointableTimeListVo.java
New file
@@ -0,0 +1,28 @@
package com.ruoyi.shop.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * @author zhibing.pu
 * @Date 2025/6/3 15:19
 */
@Data
@ApiModel
public class ShopAppointableTimeListVo {
    @ApiModelProperty("预约数据id")
    private String id;
    @ApiModelProperty("预约时间")
    private LocalDateTime appointableTime;
    @ApiModelProperty("预约状态(0=已取消,1=待确认,2=等待中,3=已结束)")
    private Integer status;
    @ApiModelProperty("预约人")
    private String userName;
    @ApiModelProperty("预约人手机号")
    private String mobile;
    @ApiModelProperty("预约人性别")
    private String sex;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/vo/ShopReservationConfigVo.java
New file
@@ -0,0 +1,22 @@
package com.ruoyi.shop.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
 * @author zhibing.pu
 * @Date 2025/6/3 14:26
 */
@Data
@ApiModel
public class ShopReservationConfigVo {
    @ApiModelProperty("预约开关(0=关,1=开)")
    private Integer subscribe;
    @ApiModelProperty("不可预约时段")
    private List<Map<String, String>> unsubscribeTime;
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/mapper/shop/ShopAppointableTimeMapper.java
@@ -1,8 +1,10 @@
package com.ruoyi.shop.mapper.shop;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.shop.domain.dto.ShopAppointableTimeListDto;
import com.ruoyi.shop.domain.vo.MyAppointmentListVo;
import com.ruoyi.shop.domain.vo.ShopAppointableTimeListVo;
import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime;
import org.apache.ibatis.annotations.Param;
@@ -24,4 +26,20 @@
     * @return
     */
    List<MyAppointmentListVo> pageMyAppointmentList(Page<MyAppointmentListVo> page, @Param("userId") Long userId, @Param("status") Integer status);
    /**
     * 商户端获取预约列表数据
     *
     * @param page
     * @param dto
     * @return
     */
    List<ShopAppointableTime> getShopAppointableTimeList(Page<ShopAppointableTimeListVo> page, @Param("item") ShopAppointableTimeListDto dto);
    /**
     * 定时任务修改预约状态
     */
    void taskUpdateStatus();
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/mapper/shop/ShopNonAppointableTimeMapper.java
@@ -8,4 +8,10 @@
 * @Date 2025/5/26 14:31
 */
public interface ShopNonAppointableTimeMapper extends BaseMapper<ShopNonAppointableTime> {
    /**
     * 每天凌晨3点删除3天前的数据
     */
    void taskDelData();
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAppointableTimeServiceImpl.java
@@ -1,15 +1,21 @@
package com.ruoyi.shop.service.impl.shop;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.plugins.Page;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.shop.domain.dto.MyAppointmentListDto;
import com.ruoyi.shop.domain.dto.ShopAppointableTimeListDto;
import com.ruoyi.shop.domain.vo.MyAppointmentListVo;
import com.ruoyi.shop.domain.vo.ShopAppointableTimeListVo;
import com.ruoyi.shop.mapper.shop.ShopAppointableTimeMapper;
import com.ruoyi.shop.service.shop.ShopAppointableTimeService;
import com.ruoyi.system.api.domain.poji.member.Member;
import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime;
import com.ruoyi.system.api.service.RemoteMemberService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@@ -18,6 +24,9 @@
 */
@Service
public class ShopAppointableTimeServiceImpl extends ServiceImpl<ShopAppointableTimeMapper, ShopAppointableTime> implements ShopAppointableTimeService {
    @Resource
    private RemoteMemberService remoteMemberService;
    
    
    /**
@@ -32,4 +41,39 @@
        Long userId = SecurityUtils.getUserId();
        return this.baseMapper.pageMyAppointmentList(page, userId, dto.getStatus());
    }
    /**
     * 商户端获取预约列表
     *
     * @param page
     * @param dto
     * @return
     */
    @Override
    public List<ShopAppointableTimeListVo> getShopAppointableTimeList(Page<ShopAppointableTimeListVo> page, ShopAppointableTimeListDto dto) {
        List<ShopAppointableTime> shopAppointableTimeList = this.baseMapper.getShopAppointableTimeList(page, dto);
        List<ShopAppointableTimeListVo> list = new ArrayList<>();
        shopAppointableTimeList.forEach(shopAppointableTime -> {
            ShopAppointableTimeListVo shopAppointableTimeListVo = new ShopAppointableTimeListVo();
            shopAppointableTimeListVo.setId(shopAppointableTime.getId());
            shopAppointableTimeListVo.setAppointableTime(shopAppointableTime.getAppointableTime());
            shopAppointableTimeListVo.setStatus(shopAppointableTime.getStatus());
            Member member = remoteMemberService.getMember(shopAppointableTime.getUserId()).getData();
            shopAppointableTimeListVo.setUserName(member.getRealName());
            shopAppointableTimeListVo.setMobile(member.getMobile());
            shopAppointableTimeListVo.setSex(member.getGender() == 1 ? "女" : member.getGender() == 0 ? "男" : "未知");
            list.add(shopAppointableTimeListVo);
        });
        return list;
    }
    /**
     * 定时任务修改预约状态
     */
    @Override
    public void taskUpdateStatus() {
        this.baseMapper.taskUpdateStatus();
    }
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopNonAppointableTimeServiceImpl.java
@@ -12,4 +12,13 @@
 */
@Service
public class ShopNonAppointableTimeServiceImpl extends ServiceImpl<ShopNonAppointableTimeMapper, ShopNonAppointableTime> implements ShopNonAppointableTimeService {
    /**
     * 每天凌晨3点删除3天前的数据
     */
    @Override
    public void taskDelData() {
        this.baseMapper.taskDelData();
    }
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopRelUserServiceImpl.java
@@ -3,10 +3,10 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.shop.domain.pojo.shop.ShopRelUser;
import com.ruoyi.shop.mapper.shop.ShopRelUserMapper;
import com.ruoyi.shop.service.shop.ShopRelUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -59,15 +59,14 @@
    /**
     *
     * @param userId
     * @return
     */
    @Override
    public ShopRelUser getByUserId(Long userId){
    public List<ShopRelUser> getByUserId(Long userId) {
        LambdaQueryWrapper<ShopRelUser> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(ShopRelUser::getDelFlag, 0).eq(ShopRelUser::getUserId, userId);
        return this.getOne(queryWrapper,false);
        return this.list(queryWrapper);
    }
    /**
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -1,6 +1,5 @@
package com.ruoyi.shop.service.impl.shop;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -8,7 +7,6 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult;
import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult;
import com.github.binarywang.wxpay.bean.ecommerce.ProfitSharingReceiverRequest;
@@ -18,7 +16,6 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.ExceptionUtil;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.core.utils.uuid.IdUtils;
@@ -46,20 +43,18 @@
import com.ruoyi.system.api.domain.poji.config.SysTag;
import com.ruoyi.system.api.domain.poji.member.Member;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.api.domain.vo.*;
import com.ruoyi.system.api.service.*;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.rmi.ServerException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -141,21 +136,23 @@
    @Resource
    private RedisService redisService;
    @Resource
    private WechatPayUtils wechatPayUtils;
    @Resource
    private ShopDetailService shopDetailService;
    @Resource
    private RemoteUserService remoteUserService;
    @Resource
    private ShopAppointableTimeService shopAppointableTimeService;
    @Value("${callback_path}")
    private String callback_path;
    /**
     * 获取商户详情
     *
@@ -191,47 +188,48 @@
        }
        return appShopInfoVo;
    }
    /**
     * 创建商户
     *
     * @param mgtEditShopDto
     */
    @Override
    public void createShop(MgtEditShopDto mgtEditShopDto){
    public void createShop(MgtEditShopDto mgtEditShopDto) {
        Shop shop = new Shop();
        Boolean newShop = false;
        BigDecimal zeroBig = BigDecimal.ZERO;
        //验证关联账号唯一
        String relUserIds = mgtEditShopDto.getRelUserIds();
        if(StringUtils.isNotBlank(relUserIds)) {
            if(relUserIds.startsWith(",")){
                relUserIds = relUserIds.substring(1);
            }
            String[] relUserIdArray = relUserIds.split(",");
            ShopRelUser shopRelUser;
            Long userId;
            if(mgtEditShopDto.getShopId()!=null){
                for (String str : relUserIdArray) {
                    userId = Long.valueOf(str);
                    shopRelUser = shopRelUserService.getByUserId(userId);
                    if(shopRelUser!=null&&!shopRelUser.getShopId().equals(mgtEditShopDto.getShopId())){
                        throw new ServiceException(AppErrorConstant.SHOP_USER_DOUBLE);
                    }
                }
            }else {
                for (String str : relUserIdArray) {
                    userId = Long.valueOf(str);
                    shopRelUser = shopRelUserService.getByUserId(userId);
                    if(shopRelUser!=null){
                        throw new ServiceException(AppErrorConstant.SHOP_USER_DOUBLE);
                    }
                }
            }
        }
//        if(StringUtils.isNotBlank(relUserIds)) {
//            if(relUserIds.startsWith(",")){
//                relUserIds = relUserIds.substring(1);
//            }
//            String[] relUserIdArray = relUserIds.split(",");
//            ShopRelUser shopRelUser;
//            Long userId;
//            if(mgtEditShopDto.getShopId()!=null){
//                for (String str : relUserIdArray) {
//                    userId = Long.valueOf(str);
//                    shopRelUser = shopRelUserService.getByUserId(userId);
//                    if(shopRelUser!=null&&!shopRelUser.getShopId().equals(mgtEditShopDto.getShopId())){
//                        throw new ServiceException(AppErrorConstant.SHOP_USER_DOUBLE);
//                    }
//                }
//            }else {
//                for (String str : relUserIdArray) {
//                    userId = Long.valueOf(str);
//                    shopRelUser = shopRelUserService.getByUserId(userId);
//                    if(shopRelUser!=null){
//                        throw new ServiceException(AppErrorConstant.SHOP_USER_DOUBLE);
//                    }
//                }
//            }
//
//        }
        //验证商户名唯一
        //Shop shopSame = this.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag,0).eq(Shop::getShopName,mgtEditShopDto.getShopName()));
        if(mgtEditShopDto.getShopId()!=null){
        if (mgtEditShopDto.getShopId() != null) {
            //取消验重
            /*if(shopSame!=null&&!Objects.equals(shopSame.getShopId(),mgtEditShopDto.getShopId())){
                throw new ServiceException(AppErrorConstant.SHOP_DOUBLE);
@@ -918,29 +916,30 @@
        staffHomeShopTotalVo.setShopTask(shopTaskCount);
        return staffHomeShopTotalVo;
    }
    /**
     * 获取商户端
     *
     * @param merBaseDto
     * @return
     */
    @Override
    public MerHomeShopTotalVo getMerHomeTotal(MerBaseDto merBaseDto){
    public MerHomeShopTotalVo getMerHomeTotal(MerBaseDto merBaseDto) {
        Long userId = merBaseDto.getUserId();
        MerHomeShopTotalVo merHomeShopTotalVo = new MerHomeShopTotalVo();
        ShopRelUser shopRelUser = shopRelUserService.getByUserId(userId);
        Long shopId = shopRelUser.getShopId();
        Long shopId = merBaseDto.getShopId();
        //如果商户变动刷新token
        if(!shopId.equals(merBaseDto.getShopId())){
            String userKey = SecurityUtils.getUserKey();
            redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY+userKey);
            throw new ServiceException("登录状态已过期",401);
        }
//        if(!shopId.equals(merBaseDto.getShopId())){
//            String userKey = SecurityUtils.getUserKey();
//            redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY+userKey);
//            throw new ServiceException("登录状态已过期",401);
//        }
        merHomeShopTotalVo.setShopId(shopId);
        Shop shop = this.getById(shopId);
        if(shop.getFrozenFlag()==1){
        if (shop.getFrozenFlag() == 1) {
            String userKey = SecurityUtils.getUserKey();
            redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY+userKey);
            throw new ServiceException("商户已被冻结,请联系管理员",401);
            redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + userKey);
            throw new ServiceException("商户已被冻结,请联系管理员", 401);
        }
        merHomeShopTotalVo.setShopType(shop.getShopType());
        MerHomeShopTotalVo orderVo = remoteOrderService.getMerHomeTotal(merHomeShopTotalVo).getData();
@@ -955,6 +954,8 @@
        merHomeShopTotalVo.setExplorationSurp(orderVo.getExplorationSurp());
        merHomeShopTotalVo.setPlatformBirthdayFlag(shop.getPlatformBirthdayFlag());
        merHomeShopTotalVo.setPlatformCouponFlag(shop.getPlatformCouponFlag());
        int unHandleReserve = shopAppointableTimeService.count(new LambdaQueryWrapper<ShopAppointableTime>().eq(ShopAppointableTime::getShopId, shopId).eq(ShopAppointableTime::getStatus, 1));
        merHomeShopTotalVo.setUnHandleReserve(unHandleReserve);
        return merHomeShopTotalVo;
    }
@@ -1454,19 +1455,19 @@
                }).collect(Collectors.toList());
        return simpleShopVoList;
    }
    /**
     * @description  获取用户管理商户
     * @author  jqs
     * @date    2023/7/14 10:00
     * @param userId
     * @return  Shop
     * @return Shop
     * @description 获取用户管理商户
     * @author jqs
     * @date 2023/7/14 10:00
     */
    @Override
    public List<Shop> getShopByBelongUserId(Long userId){
    public List<Shop> getShopByBelongUserId(Long userId) {
        LambdaQueryWrapper<Shop> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Shop::getDelFlag,0);
        queryWrapper.eq(Shop::getBelongUserId,userId);
        queryWrapper.eq(Shop::getDelFlag, 0);
        queryWrapper.eq(Shop::getBelongUserId, userId);
        return this.list(queryWrapper);
    }
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopAppointableTimeService.java
@@ -1,9 +1,11 @@
package com.ruoyi.shop.service.shop;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.plugins.Page;
import com.ruoyi.shop.domain.dto.MyAppointmentListDto;
import com.ruoyi.shop.domain.dto.ShopAppointableTimeListDto;
import com.ruoyi.shop.domain.vo.MyAppointmentListVo;
import com.ruoyi.shop.domain.vo.ShopAppointableTimeListVo;
import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime;
import java.util.List;
@@ -23,4 +25,20 @@
     * @return
     */
    List<MyAppointmentListVo> pageMyAppointmentList(Page<MyAppointmentListVo> page, MyAppointmentListDto dto);
    /**
     * 商户端获取预约列表
     *
     * @param page
     * @param dto
     * @return
     */
    List<ShopAppointableTimeListVo> getShopAppointableTimeList(Page<ShopAppointableTimeListVo> page, ShopAppointableTimeListDto dto);
    /**
     * 定时任务修改预约状态
     */
    void taskUpdateStatus();
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopNonAppointableTimeService.java
@@ -8,4 +8,10 @@
 * @Date 2025/5/26 14:30
 */
public interface ShopNonAppointableTimeService extends IService<ShopNonAppointableTime> {
    /**
     * 每天凌晨3点删除3天前的数据
     */
    void taskDelData();
}
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopRelUserService.java
@@ -1,7 +1,7 @@
package com.ruoyi.shop.service.shop;
import com.ruoyi.shop.domain.pojo.shop.ShopRelUser;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.shop.domain.pojo.shop.ShopRelUser;
import java.util.List;
@@ -33,7 +33,7 @@
     * @param userId
     * @return
     */
    ShopRelUser getByUserId(Long userId);
    List<ShopRelUser> getByUserId(Long userId);
    /**
     * 通过用户id删除关联
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/util/TaskUtil.java
New file
@@ -0,0 +1,40 @@
package com.ruoyi.shop.util;
import com.ruoyi.shop.service.shop.ShopAppointableTimeService;
import com.ruoyi.shop.service.shop.ShopNonAppointableTimeService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
 * @author zhibing.pu
 * @Date 2025/6/3 16:11
 */
@Component
public class TaskUtil {
    @Resource
    private ShopAppointableTimeService shopAppointableTimeService;
    @Resource
    private ShopNonAppointableTimeService shopNonAppointableTimeService;
    /**
     * 每天3点执行的定时任务
     */
    @Scheduled(cron="0 0 3 * * ?")
    public void timingTask(){
        shopNonAppointableTimeService.taskDelData();
    }
    /**
     * 每分钟执行的定时任务
     */
    @Scheduled(cron="0 0/1 * * * ?")
    public void timingTask1(){
        shopAppointableTimeService.taskUpdateStatus();
    }
}
ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopAppointableTimeMapper.xml
New file
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.shop.mapper.shop.ShopAppointableTimeMapper">
    <select id="pageMyAppointmentList" resultType="com.ruoyi.shop.domain.vo.MyAppointmentListVo">
        select * from (
            select
            a.id,
            DATE_FORMAT(a.appointable_time,  '%Y-%m-%d %H:%i') as appointmentTime,
            a.status,
            b.shop_name as shopName,
            a.reason as cancelReason,
            CASE WHEN a.`status` in (1, 2) THEN 1 WHEN a.`status` = 3 THEN 2 ELSE 3 END as sort
            from t_shop_appointable_time a
            left join t_shop b on (a.shop_id = b.shop_id)
            where a.user_id = #{userId}
            <if test="status != null">
                and a.status = #{status}
            </if>
        ) as aa order by aa.sort, aa.appointmentTime
    </select>
    <select id="getShopAppointableTimeList" resultType="com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime">
        select * from (
            select
                a.*,
                CASE WHEN a.`status` = 3 THEN 3 WHEN a.`status` = 0 THEN 2 ELSE 1 END as sort
            from t_shop_appointable_time a where shop_id = #{item.shopId}
           <if test="null != item.status">
               and a.status = #{item.status}
           </if>
        ) as aa order by aa.sort,aa.appointable_time
    </select>
    <update id="taskUpdateStatus">
        update t_shop_appointable_time set status = 3 where status in (1, 2) and appointment_time &lt; now()
    </update>
</mapper>
ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopNonAppointableTimeMapper.xml
New file
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.shop.mapper.shop.ShopNonAppointableTimeMapper">
    <delete id="taskDelData">
        delete from t_shop_non_appointable_time where DATE(non_appointable_start_time) &lt; DATE(DATE_SUB(NOW(), INTERVAL 3 DAY))
    </delete>
</mapper>