1 文件已重命名
39个文件已修改
44个文件已添加
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("lottery_event") |
| | | @TableName("t_lottery_event") |
| | | public class LotteryEvent { |
| | | /** |
| | | * 主键 |
| | |
| | | @TableField("activity_type") |
| | | private Integer activityType; |
| | | /** |
| | | * 抽奖总次数 |
| | | * 可抽奖次数 |
| | | */ |
| | | @TableField("total_times") |
| | | private Integer totalTimes; |
| | | /** |
| | | * 剩余次数 |
| | | */ |
| | | @TableField("lave_times") |
| | | private Integer laveTimes; |
| | | @TableField("times") |
| | | private Integer times; |
| | | /** |
| | | * 活动开始时间 |
| | | */ |
| | |
| | | @TableField("interval_time") |
| | | private Integer intervalTime; |
| | | /** |
| | | * 下单支付金额 |
| | | */ |
| | | @TableField("pay_money") |
| | | private BigDecimal payMoney; |
| | | /** |
| | | * 答题抽奖正确率% |
| | | */ |
| | | @TableField("accuracy") |
| | | private BigDecimal accuracy; |
| | | /** |
| | | * 答题时间限制(分钟) |
| | | */ |
| | | @TableField("answering_time") |
| | | private Integer answeringTime; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | @TableField("cover_image") |
New file |
| | |
| | | package com.ruoyi.goods.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 9:50 |
| | | */ |
| | | @Data |
| | | @TableName("t_lottery_event_prize") |
| | | public class LotteryEventPrize { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private String id; |
| | | /** |
| | | * 抽奖id |
| | | */ |
| | | @TableField("lottery_event_id") |
| | | private String lotteryEventId; |
| | | /** |
| | | * 奖品类型(1=优惠券,2=平台商品,3=线下商品,4=积分) |
| | | */ |
| | | @TableField("prize_type") |
| | | private Integer prizeType; |
| | | /** |
| | | * 奖品id |
| | | */ |
| | | @TableField("object_id") |
| | | private String objectId; |
| | | /** |
| | | * 奖品名称 |
| | | */ |
| | | @TableField("object_name") |
| | | private String objectName; |
| | | /** |
| | | * 奖品数量 |
| | | */ |
| | | @TableField("number") |
| | | private Integer number; |
| | | /** |
| | | * 中奖率% |
| | | */ |
| | | @TableField("win_rate") |
| | | private BigDecimal winRate; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.api.domain; |
| | | |
| | | 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 lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:00 |
| | | */ |
| | | @Data |
| | | @TableName("t_lottery_event_questions") |
| | | public class LotteryEventQuestions { |
| | | /** |
| | | * 数据id |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 抽奖活动id |
| | | */ |
| | | @TableField(value = "lottery_event_id") |
| | | private String lotteryEventId; |
| | | /** |
| | | * 题干名称 |
| | | */ |
| | | @TableField(value = "name") |
| | | private String name; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField(value = "sort") |
| | | private Integer sort; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.api.domain; |
| | | |
| | | 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 lombok.Data; /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:15 |
| | | */ |
| | | @Data |
| | | @TableName("t_lottery_event_questions_answers") |
| | | public class LotteryEventQuestionsAnswers { |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 抽奖id |
| | | */ |
| | | @TableField(value = "lottery_event_id") |
| | | private String lotteryEventId; |
| | | /** |
| | | * 抽奖答题id |
| | | */ |
| | | @TableField(value = "lottery_event_questions_id") |
| | | private String lotteryEventQuestionsId; |
| | | /** |
| | | * 答案 |
| | | */ |
| | | @TableField(value = "answer") |
| | | private String answer; |
| | | /** |
| | | * 是否是正确答案(0=否,1=是) |
| | | */ |
| | | @TableField(value = "is_right") |
| | | private Integer isRight; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 10:34 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_lottery_event") |
| | | public class UserLotteryEvent { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField(value = "user_id") |
| | | private Long userId; |
| | | /** |
| | | * 抽奖id |
| | | */ |
| | | @TableField(value = "lottery_event_id") |
| | | private String lotteryEventId; |
| | | /** |
| | | * 抽奖奖品id |
| | | */ |
| | | @TableField(value = "lottery_event_prize_id") |
| | | private String lotteryEventPrizeId; |
| | | /** |
| | | * 奖品类型(1=优惠券,2=平台商品,3=线下商品,4=积分,5=未中奖) |
| | | */ |
| | | @TableField(value = "prize_type") |
| | | private Integer prizeType; |
| | | /** |
| | | * 奖品id |
| | | */ |
| | | @TableField(value = "object_id") |
| | | private String objectId; |
| | | /** |
| | | * 奖品名称 |
| | | */ |
| | | @TableField(value = "object_name") |
| | | private String objectName; |
| | | /** |
| | | * 奖品数量 |
| | | */ |
| | | @TableField(value = "number") |
| | | private Integer number; |
| | | /** |
| | | * 中奖时间 |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private LocalDateTime createTime; |
| | | /** |
| | | * 核销码 |
| | | */ |
| | | @TableField(value = "verify_code") |
| | | private String verifyCode; |
| | | /** |
| | | * 是否已核销(0=否,1=是) |
| | | */ |
| | | @TableField(value = "is_verify") |
| | | private Integer isVerify; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.api.domain; |
| | | |
| | | 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 lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 用户抽奖答题记录 |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:01 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_lottery_event_questions") |
| | | public class UserLotteryEventQuestions { |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField(value = "user_id") |
| | | private Long userId; |
| | | /** |
| | | * 抽奖活动id |
| | | */ |
| | | @TableField(value = "lottery_event_id") |
| | | private String lotteryEventId; |
| | | /** |
| | | * 答题开始时间 |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private LocalDateTime createTime; |
| | | /** |
| | | * 答题结束时间 |
| | | */ |
| | | @TableField(value = "end_time") |
| | | private LocalDateTime endTime; |
| | | /** |
| | | * 状态(1=已开始,2=已结束) |
| | | */ |
| | | @TableField(value = "status") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.api.domain; |
| | | |
| | | 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 lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 用户抽奖答题记录 |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:01 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_lottery_event_questions_answers") |
| | | public class UserLotteryEventQuestionsAnswers { |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField(value = "user_id") |
| | | private Long userId; |
| | | /** |
| | | * 抽奖活动id |
| | | */ |
| | | @TableField(value = "lottery_event_id") |
| | | private String lotteryEventId; |
| | | /** |
| | | * 抽奖活动题干id |
| | | */ |
| | | @TableField(value = "lottery_event_question_id") |
| | | private String lotteryEventQuestionId; |
| | | /** |
| | | * 抽奖活动题干选项id |
| | | */ |
| | | @TableField(value = "lottery_event_questions_answers_id") |
| | | private String lotteryEventQuestionsAnswersId; |
| | | /** |
| | | * 是否正确(0=否,1=是) |
| | | */ |
| | | @TableField(value = "is_correct") |
| | | private Integer isCorrect; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | * @param activityType |
| | | * @return |
| | | */ |
| | | @PostMapping("/lotteryEvent/getLotteryEventList") |
| | | @PostMapping("/mer/lotteryEvent/getLotteryEventList") |
| | | R<List<LotteryEvent>> getLotteryEventList(@RequestParam("activityType") Integer activityType); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:49 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class AppointmentTimeDto { |
| | | @ApiModelProperty("门店id") |
| | | private Integer shopId; |
| | | @ApiModelProperty("预约时间(2025-01-01 14:00:00)") |
| | | private String time; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 16:20 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class LotteryEventListDto extends AppBaseDto { |
| | | |
| | | @ApiModelProperty(name = "pagenum", value = "页码") |
| | | private Integer pageNum = 1; |
| | | |
| | | |
| | | @ApiModelProperty(name = "pagesize", value = "每页显示条数") |
| | | private Integer pageSize = 20; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:38 |
| | | */ |
| | | @Data |
| | | public class ShopAppointmentTimeDto extends AppBaseDto{ |
| | | |
| | | @ApiModelProperty(value = "请求对象id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "查询时间(2025-01-01)") |
| | | private String date; |
| | | } |
| | |
| | | @TableField("coupon_name") |
| | | private String couponName; |
| | | /** |
| | | * 发送类型1.手动领取2.指定发放 |
| | | * 发送类型1.手动领取2.指定发放,3.抽奖领取 |
| | | */ |
| | | @TableField("send_type") |
| | | private Integer sendType; |
| | |
| | | */ |
| | | @TableField("shop_code") |
| | | private String shopCode; |
| | | |
| | | |
| | | /** |
| | | * 小鹅通讲师id |
| | | */ |
| | | @TableField("xiaoe_user_id") |
| | | private String xiaoeUserId; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 预约状态(0=关,1=开) |
| | | */ |
| | | @TableField("subscribe") |
| | | private Integer subscribe; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.shopId; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.domain.poji.shop; |
| | | |
| | | 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 lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:54 |
| | | */ |
| | | @Data |
| | | @TableName |
| | | public class ShopAppointableTime { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 商户id |
| | | */ |
| | | @TableField("shop_id") |
| | | private Integer shopId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | /** |
| | | * 预约时间 |
| | | */ |
| | | @TableField("appointable_time") |
| | | private String appointableTime; |
| | | /** |
| | | * 状态(0=已取消,1=待确认,2=等待中,3=已结束) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | /** |
| | | * 商家取消原因 |
| | | */ |
| | | @TableField("reason") |
| | | private String reason; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.domain.poji.shop; |
| | | |
| | | 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 io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:25 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | @TableName("t_shop_non_appointable_time") |
| | | public class ShopNonAppointableTime { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | /** |
| | | * 商户id |
| | | */ |
| | | @TableField("shop_id") |
| | | private Integer shopId; |
| | | /** |
| | | * 不可预约开始时间 |
| | | */ |
| | | @TableField("non_appointable_start_time") |
| | | @ApiModelProperty("不可预约开始时间") |
| | | private String nonAppointableStartTime; |
| | | /** |
| | | * 不可预约结束时间 |
| | | */ |
| | | @TableField("non_appointable_end_time") |
| | | @ApiModelProperty("不可预约结束时间") |
| | | private String nonAppointableEndTime; |
| | | } |
| | |
| | | public R useMemberCoupon(String memberCouponIds) { |
| | | return R.fail("使用优惠券失败" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R backMemberCoupon(String memberCouponIds) { |
| | | return R.fail("回退优惠券失败" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R sureMemberCoupon(MerVerifyMemberCouponDto merVerifyMemberCouponDto) { |
| | | return R.fail("确认核销优惠券失败" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R addMemberCoupon(String couponId, Integer number, Long userId) { |
| | | return R.fail("手动添加用户优惠券失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.poji.member.BirthdayCard; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.model.AppMiniLoginDto; |
| | | import com.ruoyi.system.api.model.AppMiniLoginVo; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public R verifyPrize(MerVerifyPrizeFinalDto merVerifyPrizeFinalDto) { |
| | | return R.fail("核销奖品失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<Long>> listUserIdByAgeType(Integer ageType) { |
| | | return R.fail("获取用户id列表失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<MgtBulletinBoardVo> boardMemberTotal(BoardMemberTotalDto boardMemberTotalDto) { |
| | | return R.fail(throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R addIntegralRecord(Integer integral, Long userId, String orderId) { |
| | | return R.fail("手动添加用户积分失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/coupon/backMemberCoupon") |
| | | public R backMemberCoupon(@RequestBody String memberCouponIds); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @description 确认核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/8/15 11:37 |
| | | * @param merVerifyMemberCouponDto |
| | | * @return R |
| | | * @return R |
| | | * @description 确认核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/8/15 11:37 |
| | | */ |
| | | @PostMapping("/coupon/verifyMemberCoupon") |
| | | public R sureMemberCoupon(@RequestBody MerVerifyMemberCouponDto merVerifyMemberCouponDto); |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户优惠券 |
| | | * |
| | | * @param couponId |
| | | * @param number |
| | | * @return |
| | | */ |
| | | @PostMapping("/coupon/addMemberCoupon") |
| | | R addMemberCoupon(@RequestParam("couponId") String couponId, @RequestParam("number") Integer number, @RequestParam("userId") Long userId); |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(contextId = "remoteMemberService", value = ServiceNameConstants.MEMBER_SERVICE, fallbackFactory = RemoteMemberFallbackFactory.class) |
| | | public interface RemoteMemberService { |
| | | |
| | | |
| | | @PostMapping("/member/getMember") |
| | | public R<Member> getMember(@RequestBody Long userId); |
| | | |
| | | |
| | | /** |
| | | * 小程序登录 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/member/miniLogin") |
| | | public R<AppMiniLoginVo> miniLogin(@RequestBody AppMiniLoginDto appMiniLoginDto); |
| | | |
| | | |
| | | /** |
| | | * 小程序注册 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/member/miniRegister") |
| | | public R<AppMiniRegisterVo> miniRegister(@RequestBody AppMiniRegisterDto appUserRegisterDto); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 更新绑定 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/member/updateMemberBinding") |
| | | public R updateMemberBinding(@RequestBody AppMemberBindingDto appMemberBindingDto); |
| | | |
| | | |
| | | /** |
| | | * 更新会员商品类型 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/member/updateMemberGoodsType") |
| | | public R updateMemberGoodsType(@RequestBody AppMemberGoodsTypeDto appMemberGoodsTypeDto); |
| | | |
| | | |
| | | /** |
| | | * 通过手机号获取会员 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/member/getMemberByMobile") |
| | | public R<Member> getMemberByMobile(@RequestBody String mobile); |
| | | |
| | | |
| | | /** |
| | | * 订单创建新用户 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/member/createNewMember") |
| | | public R createNewMember(@RequestBody Member member); |
| | | |
| | | |
| | | /** |
| | | * @param tag |
| | | * @return R |
| | |
| | | */ |
| | | @PostMapping("/member/deleteMemberTag") |
| | | public R deleteMemberTag(@RequestBody String tag); |
| | | |
| | | |
| | | /** |
| | | * @param suggestTag |
| | | * @return R |
| | |
| | | */ |
| | | @PostMapping("/member/deleteMemberSuggestTag") |
| | | public R deleteMemberSuggestTag(@RequestBody String suggestTag); |
| | | |
| | | |
| | | /** |
| | | * @param mgtBaseBathDto |
| | | * @return R<List < MgtSimpleMemberVo>> |
| | |
| | | */ |
| | | @PostMapping("/member/listSimpleVoByIds") |
| | | public R<List<MgtSimpleMemberVo>> listSimpleVoByIds(@RequestBody String userIds); |
| | | |
| | | |
| | | /** |
| | | * @param mgtUserIdByKeywordDto |
| | | * @return R<MgtUserIdByKeywordVo> |
| | |
| | | */ |
| | | @PostMapping("/member/getUserIdByKeyword") |
| | | public R<MgtUserIdByKeywordVo> getUserIdByKeyword(@RequestBody MgtUserIdByKeywordDto mgtUserIdByKeywordDto); |
| | | |
| | | |
| | | /** |
| | | * @param |
| | | * @return R<MgtBulletinBoardVo> |
| | |
| | | */ |
| | | @PostMapping("/member/boardMemberTotal") |
| | | public R<MgtBulletinBoardVo> boardMemberTotal(@RequestBody BoardMemberTotalDto boardMemberTotalDto); |
| | | |
| | | |
| | | /** |
| | | * @param mgtActivityAgeDto |
| | | * @return R<List < Long>> |
| | |
| | | */ |
| | | @PostMapping("/member/listUserIdByAge") |
| | | public R<List<Long>> listUserIdByAge(@RequestBody MgtActivityAgeDto mgtActivityAgeDto); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param shopIdlist |
| | | * @return R<List < Long>> |
| | |
| | | */ |
| | | @PostMapping("/member/listUserIdByShopId") |
| | | public R<List<Long>> listUserIdByShopId(@RequestBody List<Long> shopIdlist); |
| | | |
| | | |
| | | /** |
| | | * @param shopIdlist |
| | | * @return R<MgtShopTotalMemberVo> |
| | |
| | | */ |
| | | @PostMapping("/member/getUserTotalByShopId") |
| | | public R<MgtShopTotalMemberVo> getUserTotalByShopId(@RequestBody List<Long> shopIdlist); |
| | | |
| | | |
| | | /** |
| | | * @param memberTotalChangeDto |
| | | * @return R |
| | |
| | | */ |
| | | @PostMapping("/member/changeMemberTotal") |
| | | public R changeMemberTotal(@RequestBody MemberTotalChangeDto memberTotalChangeDto); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param merTotalDto |
| | | * @return R<MerOrderAgeUserVo> |
| | |
| | | */ |
| | | @PostMapping("/member/listOrderAgeUser") |
| | | public R<List<MerOrderAgeUserVo>> listOrderAgeUser(@RequestBody MerTotalDto merTotalDto); |
| | | |
| | | |
| | | /** |
| | | * @param |
| | | * @return R<Integer> |
| | |
| | | */ |
| | | @PostMapping("/member/getUnReplaySuggestVo") |
| | | public R<Integer> getUnReplaySuggestVo(); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param verifyPrize |
| | | * @return R<MemberGiftRecord> |
| | |
| | | */ |
| | | @PostMapping("/member/getVerifyPrize") |
| | | public R<MemberGiftRecord> getVerifyPrize(@RequestBody String verifyPrize); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param integralChangeDto |
| | | * @return R |
| | |
| | | */ |
| | | @PostMapping("/member/changeIntegral") |
| | | public R signShare(@RequestBody IntegralChangeDto integralChangeDto); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param shopIdList |
| | | * @return R<Integer> |
| | |
| | | */ |
| | | @PostMapping("/member/getAreaNewMember") |
| | | public R<Integer> getAreaNewMember(@RequestBody List<Long> shopIdList); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param mgtMemberShopNameDto |
| | | * @return R |
| | |
| | | */ |
| | | @PostMapping("/member/updateMemberShopName") |
| | | public R updateMemberShopName(@RequestBody MgtMemberShopNameDto mgtMemberShopNameDto); |
| | | |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | |
| | | */ |
| | | @PostMapping("/member/getBirthdayCard") |
| | | public R<BirthdayCard> getBirthdayCard(); |
| | | |
| | | |
| | | /** |
| | | * @description 核销奖品 |
| | | * @author jqs |
| | |
| | | */ |
| | | @PostMapping("/member/verifyPrize") |
| | | public R verifyPrize(@RequestBody MerVerifyPrizeFinalDto merVerifyPrizeFinalDto); |
| | | |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/8/23 19:06 |
| | | * @param ageType |
| | | * @return R<List<Long>> |
| | | * @return R<List < Long>> |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/8/23 19:06 |
| | | */ |
| | | @PostMapping("/member/listUserIdByAgeType") |
| | | public R<List<Long>> listUserIdByAgeType(@RequestBody Integer ageType); |
| | | |
| | | /** |
| | | * 手动添加用户积分 |
| | | * |
| | | * @param integral |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @PostMapping("/member/addIntegralRecord") |
| | | R addIntegralRecord(@RequestParam("integral") Integer integral, @RequestParam("userId") Long userId, @RequestParam("orderId") String orderId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.redis.configure; |
| | | |
| | | import org.redisson.Redisson; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.redisson.codec.JsonJacksonCodec; |
| | | import org.redisson.config.Config; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * redis配置 |
| | | * |
| | | * @author jqs |
| | | */ |
| | | @Configuration |
| | | public class RedissonConfig { |
| | | |
| | | @Value("${spring.redis.host}") |
| | | private String redisHost; |
| | | |
| | | @Value("${spring.redis.password}") |
| | | private String password; |
| | | |
| | | @Value("${spring.redis.port}") |
| | | private int port = 6379; |
| | | |
| | | @Bean |
| | | public RedissonClient getRedisson() { |
| | | Config config = new Config(); |
| | | config.useSingleServer(). |
| | | setAddress("redis://" + redisHost + ":" + port). |
| | | setPassword(password); |
| | | config.setCodec(new JsonJacksonCodec()); |
| | | return Redisson.create(config); |
| | | } |
| | | |
| | | } |
File was renamed from ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/business/LotteryEventController.java |
| | |
| | | * @Date 2025/5/8 18:13 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/lotteryEvent") |
| | | public class LotteryEventController { |
| | | @RequestMapping("/mer/lotteryEvent") |
| | | public class MerLotteryEventController { |
| | | |
| | | @Resource |
| | | private ILotteryEventService lotteryEventService; |
| | |
| | | |
| | | /** |
| | | * 根据开启方式获取活动列表 |
| | | * |
| | | * @param activityType |
| | | * @return |
| | | */ |
| | |
| | | .eq(LotteryEvent::getDelFlag, 0).last(" and now() between start_time and end_time")); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.controller.miniapp; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.goods.api.domain.LotteryEvent; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEvent; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestions; |
| | | import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo; |
| | | import com.ruoyi.goods.domain.vo.LotteryEventInfoVo; |
| | | import com.ruoyi.goods.domain.vo.LotteryEventVo; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventService; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventQuestionsService; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventService; |
| | | import com.ruoyi.system.api.domain.dto.LotteryEventListDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 15:26 |
| | | */ |
| | | @Validated |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "小程序抽奖相关接口") |
| | | @RequestMapping("/app/lotteryEvent") |
| | | public class AppLotteryEventController { |
| | | |
| | | @Resource |
| | | private ILotteryEventService lotteryEventService; |
| | | |
| | | @Resource |
| | | private IUserLotteryEventService userLotteryEventService; |
| | | |
| | | @Resource |
| | | private IUserLotteryEventQuestionsService userLotteryEventQuestionsService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getLotteryEvent/{id}") |
| | | @ApiOperation(value = "获取抽奖页详情【2.0】", tags = "抽奖活动") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "抽奖活动id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<LotteryEventVo> getLotteryEvent(@PathVariable("id") String id) { |
| | | LotteryEventVo lotteryEvent = lotteryEventService.getLotteryEvent(id); |
| | | return R.ok(lotteryEvent); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/lotteryDraw/{id}") |
| | | @ApiOperation(value = "抽奖操作【2.0】", tags = "抽奖活动", notes = "返回奖品ID") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "抽奖活动id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R lotteryDraw(@PathVariable("id") String id) { |
| | | return lotteryEventService.lotteryDraw(id); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getLotteryEventList") |
| | | @ApiOperation(value = "获取普通抽奖列表【2.0】", tags = "抽奖活动") |
| | | public R<Page<AppLotteryEventPageVo>> getLotteryEventList(@RequestBody LotteryEventListDto dto){ |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Page<AppLotteryEventPageVo> page = new Page<>(); |
| | | page.setSize(dto.getPageSize()); |
| | | page.setCurrent(dto.getPageNum()); |
| | | List<AppLotteryEventPageVo> activityPageVoList = lotteryEventService.pageAppLotteryEvent(page,userId); |
| | | return R.ok(page.setRecords(activityPageVoList)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getLotteryEventInfo/{id}") |
| | | @ApiOperation(value = "获取抽奖活动详情【2.0】", tags = "抽奖活动") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "抽奖活动id", required = true, dataType = "String", paramType = "path") |
| | | }) |
| | | public R<LotteryEventInfoVo> getLotteryEventInfo(@PathVariable("id") String id){ |
| | | Long userId = SecurityUtils.getUserId(); |
| | | LotteryEvent lotteryEvent = lotteryEventService.getById(id); |
| | | LotteryEventInfoVo vo = new LotteryEventInfoVo(); |
| | | vo.setId(lotteryEvent.getId()); |
| | | vo.setName(lotteryEvent.getName()); |
| | | vo.setActivityProfile(lotteryEvent.getActivityProfile()); |
| | | vo.setStartTime(lotteryEvent.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | vo.setActivityContent(lotteryEvent.getActivityContent()); |
| | | int count = userLotteryEventService.count(new QueryWrapper<UserLotteryEvent>().eq("lottery_event_id", id).eq("user_id", userId)); |
| | | vo.setParticipation(count > 0); |
| | | //答题抽奖需要判断是否答题完成 |
| | | if(5 == lotteryEvent.getActivityType()){ |
| | | UserLotteryEventQuestions questionsServiceOne = userLotteryEventQuestionsService.getOne(new QueryWrapper<UserLotteryEventQuestions>().eq("lottery_event_id", id).eq("user_id", userId)); |
| | | vo.setContinueAnswer(null != questionsServiceOne ? questionsServiceOne.getStatus() : 0); |
| | | } |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 16:25 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class AppLotteryEventPageVo { |
| | | @ApiModelProperty("数据id") |
| | | private String id; |
| | | @ApiModelProperty("抽奖名称") |
| | | private String name; |
| | | @ApiModelProperty("活动简介名称") |
| | | private String activityProfile; |
| | | @ApiModelProperty("开启方式(1=新注册用户,2=下单,3=分享小程序,4=普通抽奖,5=答题抽奖)") |
| | | private Integer activityType; |
| | | @ApiModelProperty("活动开始时间") |
| | | private String startTime; |
| | | @ApiModelProperty("活动结束时间") |
| | | private String endTime; |
| | | @ApiModelProperty("封面图") |
| | | private String coverImage; |
| | | @ApiModelProperty("参与状态") |
| | | private Boolean participation; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 17:42 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class LotteryEventInfoVo { |
| | | @ApiModelProperty(value = "抽奖id") |
| | | private String id; |
| | | @ApiModelProperty(value = "抽奖名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "活动简介名称") |
| | | private String activityProfile; |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String startTime; |
| | | @ApiModelProperty(value = "活动详情") |
| | | private String activityContent; |
| | | @ApiModelProperty(value = "是否参与") |
| | | private Boolean participation; |
| | | @ApiModelProperty(value = "是否继续答题(0=未开始,1=已开始,2=已结束)") |
| | | private Integer continueAnswer; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.ruoyi.goods.api.domain.LotteryEventPrize; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 9:39 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class LotteryEventVo { |
| | | @ApiModelProperty(value = "抽奖id") |
| | | private String id; |
| | | @ApiModelProperty(value = "抽奖名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "活动简介名称") |
| | | private String activityProfile; |
| | | @ApiModelProperty(value = "奖品列表") |
| | | private List<LotteryEventPrize> prizeList; |
| | | @ApiModelProperty(value = "剩余次数") |
| | | private Integer laveTimes; |
| | | @ApiModelProperty(value = "您的奖品") |
| | | private List<UserLotteryEventVo> yourPrizeList; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 10:44 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class UserLotteryEventVo { |
| | | @ApiModelProperty("奖品名称") |
| | | private String name; |
| | | @ApiModelProperty("奖品类型(1=优惠券,2=平台商品,3=线下商品,4=积分)") |
| | | private Integer prizeType; |
| | | @ApiModelProperty("奖品数量") |
| | | private Integer number; |
| | | @ApiModelProperty("核销码") |
| | | private String verifyCode; |
| | | } |
| | |
| | | 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.LotteryEvent; |
| | | import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/8 18:00 |
| | | */ |
| | | public interface LotteryEventMapper extends BaseMapper<LotteryEvent> { |
| | | |
| | | |
| | | /** |
| | | * 查询APP端普通抽奖列表数据 |
| | | * |
| | | * @param page |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<AppLotteryEventPageVo> pageAppLotteryEvent(Page<AppLotteryEventPageVo> page, @Param("userId") Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.mapper.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.api.domain.LotteryEventPrize; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 9:55 |
| | | */ |
| | | public interface LotteryEventPrizeMapper extends BaseMapper<LotteryEventPrize> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.mapper.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestionsAnswers; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:18 |
| | | */ |
| | | public interface LotteryEventQuestionsAnswersMapper extends BaseMapper<LotteryEventQuestionsAnswers> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.mapper.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestions; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:03 |
| | | */ |
| | | public interface LotteryEventQuestionsMapper extends BaseMapper<LotteryEventQuestions> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.mapper.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEvent; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 10:40 |
| | | */ |
| | | public interface UserLotteryEventMapper extends BaseMapper<UserLotteryEvent> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.mapper.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestionsAnswers; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:06 |
| | | */ |
| | | public interface UserLotteryEventQuestionsAnswersMapper extends BaseMapper<UserLotteryEventQuestionsAnswers> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.mapper.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestions; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:19 |
| | | */ |
| | | public interface UserLotteryEventQuestionsMapper extends BaseMapper<UserLotteryEventQuestions> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.goods.api.domain.LotteryEventPrize; |
| | | import com.ruoyi.goods.mapper.lottery.LotteryEventPrizeMapper; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventPrizeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 9:56 |
| | | */ |
| | | @Service |
| | | public class LotteryEventPrizeServiceImpl extends ServiceImpl<LotteryEventPrizeMapper, LotteryEventPrize> implements ILotteryEventPrizeService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestionsAnswers; |
| | | import com.ruoyi.goods.mapper.lottery.LotteryEventQuestionsAnswersMapper; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventQuestionsAnswersService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:19 |
| | | */ |
| | | @Service |
| | | public class LotteryEventQuestionsAnswersServiceImpl extends ServiceImpl<LotteryEventQuestionsAnswersMapper, LotteryEventQuestionsAnswers> implements ILotteryEventQuestionsAnswersService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestions; |
| | | import com.ruoyi.goods.mapper.lottery.LotteryEventQuestionsMapper; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventQuestionsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:04 |
| | | */ |
| | | @Service |
| | | public class LotteryEventQuestionsServiceImpl extends ServiceImpl<LotteryEventQuestionsMapper, LotteryEventQuestions> implements ILotteryEventQuestionsService { |
| | | } |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | 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.api.domain.UserLotteryEvent; |
| | | import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo; |
| | | import com.ruoyi.goods.domain.vo.LotteryEventVo; |
| | | import com.ruoyi.goods.domain.vo.UserLotteryEventVo; |
| | | import com.ruoyi.goods.mapper.lottery.LotteryEventMapper; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventPrizeService; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventService; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventQuestionsAnswersService; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventService; |
| | | import com.ruoyi.system.api.service.RemoteCouponService; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @Service |
| | | public class LotteryEventServiceImpl extends ServiceImpl<LotteryEventMapper, LotteryEvent> implements ILotteryEventService { |
| | | |
| | | @Resource |
| | | private IUserLotteryEventService userLotteryEventService; |
| | | |
| | | @Resource |
| | | private ILotteryEventPrizeService lotteryEventPrizeService; |
| | | |
| | | @Resource |
| | | private RemoteCouponService remoteCouponService; |
| | | |
| | | @Resource |
| | | private RemoteMemberService remoteMemberService; |
| | | |
| | | @Resource |
| | | private RedissonClient redissonClient; |
| | | |
| | | @Resource |
| | | private IUserLotteryEventQuestionsAnswersService userLotteryEventQuestionsService; |
| | | |
| | | |
| | | /** |
| | | * 根据id查询抽奖活动信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public LotteryEventVo getLotteryEvent(String id) { |
| | | LotteryEvent lotteryEvent = this.getById(id); |
| | | //构建返回结果 |
| | | LotteryEventVo vo = new LotteryEventVo(); |
| | | vo.setId(lotteryEvent.getId()); |
| | | vo.setName(lotteryEvent.getName()); |
| | | vo.setActivityProfile(lotteryEvent.getActivityProfile()); |
| | | List<UserLotteryEvent> userLotteryEvents = userLotteryEventService.list(new QueryWrapper<UserLotteryEvent>().eq("lottery_event_id", id)); |
| | | vo.setLaveTimes(lotteryEvent.getTimes() - userLotteryEvents.size()); |
| | | //查询抽检活动奖品 |
| | | List<LotteryEventPrize> lotteryEventPrizeList = lotteryEventPrizeService.list(new QueryWrapper<LotteryEventPrize>().eq("lottery_event_id", id)); |
| | | vo.setPrizeList(lotteryEventPrizeList); |
| | | |
| | | //构建我的奖品明细 |
| | | List<UserLotteryEventVo> collect = userLotteryEvents.stream().map(s -> { |
| | | UserLotteryEventVo userLotteryEventVo = new UserLotteryEventVo(); |
| | | userLotteryEventVo.setName(s.getObjectName()); |
| | | userLotteryEventVo.setPrizeType(s.getPrizeType()); |
| | | userLotteryEventVo.setNumber(s.getNumber()); |
| | | userLotteryEventVo.setVerifyCode(s.getVerifyCode()); |
| | | return userLotteryEventVo; |
| | | }).collect(Collectors.toList()); |
| | | vo.setYourPrizeList(collect); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 抽奖操作 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R lotteryDraw(String id) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | LotteryEvent lotteryEvent = this.getById(id); |
| | | //判断答题抽奖是否满足抽奖条件 |
| | | if (lotteryEvent.getActivityType() == 5) { |
| | | BigDecimal correctAnswerRate = userLotteryEventQuestionsService.getCorrectAnswerRate(userId, id); |
| | | if (correctAnswerRate.compareTo(lotteryEvent.getAccuracy()) < 0) { |
| | | return R.fail("答题抽奖失败,答题正确率低于活动要求"); |
| | | } |
| | | } |
| | | |
| | | //使用redis锁处理高并发 |
| | | RLock lock = redissonClient.getLock("lottery_event::" + userId + "::" + id); |
| | | try { |
| | | boolean tryLock = lock.tryLock(30, TimeUnit.SECONDS); |
| | | if (tryLock) { |
| | | //判断抽奖次数是否用完 |
| | | int count = userLotteryEventService.count(new QueryWrapper<UserLotteryEvent>().eq("lottery_event_id", id).eq("user_id", userId)); |
| | | if (lotteryEvent.getTimes() <= count) { |
| | | return R.fail("抽奖次数已用完"); |
| | | } |
| | | List<LotteryEventPrize> lotteryEventPrizeList = lotteryEventPrizeService.list(new QueryWrapper<LotteryEventPrize>().eq("lottery_event_id", id)); |
| | | //开始抽奖,根据中奖概率来抽奖 |
| | | List<LotteryEventPrize> list = new ArrayList<>(); |
| | | for (LotteryEventPrize lotteryEventPrize : lotteryEventPrizeList) { |
| | | int winRate = lotteryEventPrize.getWinRate().intValue(); |
| | | for (int i = 0; i < winRate; i++) { |
| | | LotteryEventPrize event = new LotteryEventPrize(); |
| | | BeanUtil.copyProperties(lotteryEventPrize, event); |
| | | list.add(event); |
| | | } |
| | | } |
| | | //将待抽奖的集合进行随机排序 |
| | | Collections.shuffle(list); |
| | | //开始获取随机数 |
| | | int random = new Random().nextInt(list.size()); |
| | | LotteryEventPrize lotteryEventPrize = lotteryEventPrizeList.get(random); |
| | | //添加中奖商品 |
| | | UserLotteryEvent userLotteryEvent = new UserLotteryEvent(); |
| | | userLotteryEvent.setId(IdUtils.simpleUUID()); |
| | | userLotteryEvent.setUserId(userId); |
| | | userLotteryEvent.setLotteryEventId(id); |
| | | userLotteryEvent.setLotteryEventPrizeId(lotteryEventPrize.getId()); |
| | | userLotteryEvent.setPrizeType(lotteryEventPrize.getPrizeType()); |
| | | userLotteryEvent.setObjectId(lotteryEventPrize.getObjectId()); |
| | | userLotteryEvent.setObjectName(lotteryEventPrize.getObjectName()); |
| | | userLotteryEvent.setNumber(lotteryEventPrize.getNumber()); |
| | | //商品需要生成核销码和核销状态 |
| | | if (Arrays.asList(2, 3).contains(lotteryEventPrize.getPrizeType())) { |
| | | userLotteryEvent.setVerifyCode(IdUtils.simpleUUID()); |
| | | userLotteryEvent.setIsVerify(0); |
| | | } |
| | | //中奖优惠券 |
| | | if (1 == lotteryEventPrize.getPrizeType()) { |
| | | remoteCouponService.addMemberCoupon(lotteryEventPrize.getObjectId(), lotteryEventPrize.getNumber(), userId); |
| | | } |
| | | //中奖积分 |
| | | if (4 == lotteryEventPrize.getPrizeType()) { |
| | | remoteMemberService.addIntegralRecord(lotteryEventPrize.getNumber(), userId, id); |
| | | } |
| | | userLotteryEvent.setCreateTime(LocalDateTime.now()); |
| | | userLotteryEventService.save(userLotteryEvent); |
| | | return R.ok(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | return R.fail("抽奖失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取APP抽奖列表 |
| | | * |
| | | * @param page |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<AppLotteryEventPageVo> pageAppLotteryEvent(Page<AppLotteryEventPageVo> page, Long userId) { |
| | | return this.baseMapper.pageAppLotteryEvent(page, userId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestionsAnswers; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestionsAnswers; |
| | | import com.ruoyi.goods.mapper.lottery.UserLotteryEventQuestionsAnswersMapper; |
| | | import com.ruoyi.goods.service.lottery.ILotteryEventQuestionsAnswersService; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventQuestionsAnswersService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:08 |
| | | */ |
| | | @Service |
| | | public class UserLotteryEventQuestionsAnswersServiceImpl extends ServiceImpl<UserLotteryEventQuestionsAnswersMapper, UserLotteryEventQuestionsAnswers> implements IUserLotteryEventQuestionsAnswersService { |
| | | |
| | | @Resource |
| | | private ILotteryEventQuestionsAnswersService lotteryEventQuestionsAnswersService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取答题正确率 |
| | | * @param userId |
| | | * @param lotteryEventId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal getCorrectAnswerRate(Long userId, String lotteryEventId) { |
| | | int count = this.count(new QueryWrapper<UserLotteryEventQuestionsAnswers>().eq("user_id", userId).eq("lottery_event_id", lotteryEventId).eq("is_correct", 1)); |
| | | if (count > 0) { |
| | | int count1 = lotteryEventQuestionsAnswersService.count(new QueryWrapper<LotteryEventQuestionsAnswers>().eq("lottery_event_id", lotteryEventId)); |
| | | return new BigDecimal(count).divide(new BigDecimal(count1), 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestions; |
| | | import com.ruoyi.goods.mapper.lottery.UserLotteryEventQuestionsMapper; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventQuestionsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:19 |
| | | */ |
| | | @Service |
| | | public class UserLotteryEventQuestionsServiceImpl extends ServiceImpl<UserLotteryEventQuestionsMapper, UserLotteryEventQuestions> implements IUserLotteryEventQuestionsService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.impl.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEvent; |
| | | import com.ruoyi.goods.mapper.lottery.UserLotteryEventMapper; |
| | | import com.ruoyi.goods.service.lottery.IUserLotteryEventService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 10:41 |
| | | */ |
| | | @Service |
| | | public class UserLotteryEventServiceImpl extends ServiceImpl<UserLotteryEventMapper, UserLotteryEvent> implements IUserLotteryEventService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.api.domain.LotteryEventPrize; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 9:56 |
| | | */ |
| | | public interface ILotteryEventPrizeService extends IService<LotteryEventPrize> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestionsAnswers; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:18 |
| | | */ |
| | | public interface ILotteryEventQuestionsAnswersService extends IService<LotteryEventQuestionsAnswers> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.api.domain.LotteryEventQuestions; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:03 |
| | | */ |
| | | public interface ILotteryEventQuestionsService extends IService<LotteryEventQuestions> { |
| | | } |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.goods.api.domain.LotteryEvent; |
| | | import com.ruoyi.goods.domain.vo.AppLotteryEventPageVo; |
| | | import com.ruoyi.goods.domain.vo.LotteryEventVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/8 18:05 |
| | | */ |
| | | public interface ILotteryEventService extends IService<LotteryEvent> { |
| | | |
| | | |
| | | /** |
| | | * 获取抽奖活动详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | LotteryEventVo getLotteryEvent(String id); |
| | | |
| | | |
| | | /** |
| | | * 抽奖操作 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | R lotteryDraw(String id); |
| | | |
| | | |
| | | /** |
| | | * 获取APP抽奖列表 |
| | | * |
| | | * @param page |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<AppLotteryEventPageVo> pageAppLotteryEvent(Page<AppLotteryEventPageVo> page, Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestionsAnswers; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/19 16:07 |
| | | */ |
| | | public interface IUserLotteryEventQuestionsAnswersService extends IService<UserLotteryEventQuestionsAnswers> { |
| | | |
| | | |
| | | /** |
| | | * 获取用户答题正确率 |
| | | * @param userId |
| | | * @param lotteryEventId |
| | | * @return |
| | | */ |
| | | BigDecimal getCorrectAnswerRate(Long userId, String lotteryEventId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEventQuestions; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 18:19 |
| | | */ |
| | | public interface IUserLotteryEventQuestionsService extends IService<UserLotteryEventQuestions> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.service.lottery; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.api.domain.UserLotteryEvent; |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/12 10:40 |
| | | */ |
| | | public interface IUserLotteryEventService extends IService<UserLotteryEvent> { |
| | | } |
| | |
| | | <?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.LotteryEventMapper"> |
| | | |
| | | |
| | | |
| | | <select id="pageAppLotteryEvent" resultType="com.ruoyi.goods.domain.vo.AppLotteryEventPageVo"> |
| | | select * |
| | | from (select a.id, |
| | | a.name, |
| | | a.activity_profile as activityProfile, |
| | | a.activity_type as activityType, |
| | | date_format(a.start_time, '%Y-%m-%d %H:%i:%s') as startTime, |
| | | date_format(a.end_time, '%Y-%m-%d %H:%i:%s') as endTime, |
| | | a.cover_image as coverImage, |
| | | if(ifnull(b.num, 0) = 0, false, true) as participation, |
| | | CASE |
| | | WHEN NOW() > a.start_time and now() <= a.end_time and ifnull(b.num, 0) > 0 THEN 1 |
| | | WHEN NOW() > a.start_time and now() <= a.end_time and ifnull(b.num, 0) = 0 THEN 2 |
| | | ELSE 3 END as sort |
| | | from t_lottery_event a |
| | | left join (select count(1) as num, lottery_event_id |
| | | from t_user_lottery_event |
| | | where user_id = #{userId} |
| | | group by lottery_event_id) b on a.id = b.lottery_event_id |
| | | where a.del_flag = 0 |
| | | and now() > a.end_time |
| | | and a.activity_type in (4, 5)) as aa |
| | | order by aa.sort, aa.startTime |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?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.LotteryEventPrizeMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?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.UserLotteryEventQuestionsMapper"> |
| | | |
| | | </mapper> |
| | |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>1.3.0.Final</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-goods</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import com.ruoyi.system.api.domain.vo.AppMemberCouponVo; |
| | | import com.ruoyi.system.api.domain.vo.MerVerifyCouponGetVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | memberCouponService.sureMemberCoupon(merVerifyMemberCouponDto.getCouponId(),merVerifyMemberCouponDto.getShopId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 回退优惠券 |
| | | * @author jqs |
| | | * @date 2023/7/13 19:38 |
| | | * @param memberCouponIds |
| | | * @return R |
| | | * @return R |
| | | * @description 回退优惠券 |
| | | * @author jqs |
| | | * @date 2023/7/13 19:38 |
| | | */ |
| | | @PostMapping("/backMemberCoupon") |
| | | public R backMemberCoupon(@RequestBody String memberCouponIds){ |
| | | public R backMemberCoupon(@RequestBody String memberCouponIds) { |
| | | memberCouponService.backMemberCoupon(memberCouponIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户优惠券 |
| | | * |
| | | * @param couponId |
| | | * @param number |
| | | * @return |
| | | */ |
| | | @PostMapping("/addMemberCoupon") |
| | | public R addMemberCoupon(@RequestParam("couponId") String couponId, @RequestParam("number") Integer number, @RequestParam("userId") Long userId) { |
| | | return memberCouponService.addMemberCoupon(couponId, number, userId); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.api.model.AppMiniLoginVo; |
| | | import com.ruoyi.system.api.service.RemoteShopService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | memberService.updateMemberShopName(mgtMemberShopNameDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/getBirthdayCard") |
| | | public R<BirthdayCard> getBirthdayCard() |
| | | { |
| | | public R<BirthdayCard> getBirthdayCard() { |
| | | BirthdayCard birthdayCard = birthdayCardService.getBirthdayCard(); |
| | | return R.ok(birthdayCard); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/listUserIdByAgeType") |
| | | public R<List<Long>> listUserIdByAgeType(@RequestBody Integer ageType){ |
| | | public R<List<Long>> listUserIdByAgeType(@RequestBody Integer ageType) { |
| | | List<Long> userIdList = memberService.listUserIdByAgeType(ageType); |
| | | return R.ok(userIdList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户积分 |
| | | * |
| | | * @param integral |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @PostMapping("/addIntegralRecord") |
| | | public R addIntegralRecord(@RequestParam("integral") Integer integral, @RequestParam("userId") Long userId, @RequestParam("orderId") String orderId) { |
| | | return memberService.addIntegralRecord(integral, userId, orderId); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.api.domain.LotteryEvent; |
| | | import com.ruoyi.goods.api.service.LotteryEventClient; |
| | | import com.ruoyi.member.domain.vo.AppIntegralRecordPageVo; |
| | | import com.ruoyi.member.domain.vo.AppIntegralTaskListVo; |
| | | import com.ruoyi.member.service.member.IntegralRecordService; |
| | |
| | | @RestController |
| | | @RequestMapping("/app/integral") |
| | | public class AppIntegralController { |
| | | |
| | | |
| | | @Resource |
| | | private MemberService memberService; |
| | | |
| | | |
| | | @Resource |
| | | private IntegralRecordService integralRecordService; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private LotteryEventClient lotteryEventClient; |
| | | |
| | | |
| | | @RequestMapping(value = "/pageAppMemberIntegralRecord", method = RequestMethod.POST) |
| | | @ApiOperation(value = "分页获取用户积分明细列表") |
| | | public R<Page<AppIntegralRecordPageVo>> pageAppMemberIntegralRecord(@RequestBody AppPageDto appPageDto) { |
| | |
| | | Page<AppIntegralRecordPageVo> page = new Page<>(); |
| | | page.setSize(appPageDto.getPageSize()); |
| | | page.setCurrent(appPageDto.getPageNum()); |
| | | List<AppIntegralRecordPageVo> integralRecordPageVoList = integralRecordService.pageAppMemberIntegralRecord(page,userId); |
| | | List<AppIntegralRecordPageVo> integralRecordPageVoList = integralRecordService.pageAppMemberIntegralRecord(page, userId); |
| | | return R.ok(page.setRecords(integralRecordPageVoList)); |
| | | } |
| | | |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/signShare", method = RequestMethod.POST) |
| | | @ApiOperation(value = "今日分享") |
| | | public R signShare() { |
| | | @ApiOperation(value = "今日分享【2.0】") |
| | | public R<Boolean> signShare() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | IntegralChangeDto integralChangeDto = new IntegralChangeDto(); |
| | | integralChangeDto.setIntegralType(1); |
| | | integralChangeDto.setUserId(userId); |
| | | Boolean complete = memberService.changeIntegral(integralChangeDto); |
| | | if(complete){ |
| | | if (complete) { |
| | | throw new ServiceException(AppErrorConstant.DOUBLE_INTEGRAL_TASK); |
| | | } |
| | | return R.ok(); |
| | | //判断是否可以抽奖 |
| | | List<LotteryEvent> data = lotteryEventClient.getLotteryEventList(3).getData(); |
| | | return R.ok(data.size() > 0); |
| | | } |
| | | } |
| | |
| | | @TableField(value = "user_id") |
| | | private Long userId; |
| | | /** |
| | | * 变动类型1分享获取2平台建议获取3门店建议获取4每日签到5消费得积分 |
| | | * 变动类型1分享获取2平台建议获取3门店建议获取4每日签到5消费得积分6抽奖获得 |
| | | */ |
| | | @TableField("change_type") |
| | | private Integer changeType; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | 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.StringUtils; |
| | | import com.ruoyi.member.domain.dto.AppMemberCouponPageDto; |
| | | import com.ruoyi.member.domain.dto.MemberSelectCouponDto; |
| | | import com.ruoyi.member.domain.dto.MerGoodsCouponListDto; |
| | | import com.ruoyi.member.domain.pojo.coupon.Coupon; |
| | | import com.ruoyi.member.domain.vo.AppMemberCouponPageVo; |
| | | import com.ruoyi.member.mapper.coupon.CouponMapper; |
| | | import com.ruoyi.member.mapper.member.MemberCouponMapper; |
| | | import com.ruoyi.member.service.coupon.CouponService; |
| | | import com.ruoyi.member.service.coupon.MemberCouponRecordService; |
| | | import com.ruoyi.member.service.member.MemberCouponService; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.MerBaseDto; |
| | |
| | | @Service |
| | | @DS("sharding") |
| | | public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, MemberCoupon> implements MemberCouponService { |
| | | |
| | | |
| | | @Resource |
| | | private MemberCouponMapper memberCouponMapper; |
| | | |
| | | |
| | | @Resource |
| | | private RemoteGoodsService remoteGoodsService; |
| | | |
| | | |
| | | @Resource |
| | | private RemoteShopService remoteShopService; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private CouponService couponService; |
| | | |
| | | @Resource |
| | | private MemberCouponRecordService memberCouponRecordService; |
| | | |
| | | @Resource |
| | | private CouponMapper couponMapper; |
| | | |
| | | |
| | | /** |
| | | * @description: TODO |
| | | * @author jqs34 |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public List<AppMemberCouponVo> listVoMemberCouponByUserId(MerBaseDto merBaseDto){ |
| | | public List<AppMemberCouponVo> listVoMemberCouponByUserId(MerBaseDto merBaseDto) { |
| | | List<AppMemberCouponVo> appMemberCouponVoList = memberCouponMapper.listVoMemberCouponByUserId(merBaseDto); |
| | | return appMemberCouponVoList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 核销优惠券 |
| | | * @author jqs |
| | |
| | | merVerifyCouponGetVo.setMemberCoupon(memberCoupon); |
| | | return merVerifyCouponGetVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 核销优惠券 |
| | | * @author jqs |
| | |
| | | merVerifyCouponGetVo.setCouponFrom("平台"); |
| | | } |
| | | memberCoupon.setCouponStatus(2); |
| | | |
| | | |
| | | memberCoupon.setUseTime(new Date()); |
| | | this.saveOrUpdate(memberCoupon); |
| | | merVerifyCouponGetVo.setMemberCoupon(memberCoupon); |
| | | return merVerifyCouponGetVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | |
| | | Integer total = this.count(queryWrapper); |
| | | return total; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 用户分页获取已领取优惠券列表 |
| | | * @author jqs |
| | |
| | | } |
| | | return memberCouponPageVoList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 定时检查优惠券过期 |
| | | * @author jqs |
| | |
| | | public void timingCheckMemberCoupon(){ |
| | | memberCouponMapper.timingCheckMemberCoupon(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 使用优惠券 |
| | | * @author jqs |
| | |
| | | public void useMemberCoupon(String memberCouponIds){ |
| | | memberCouponMapper.useMemberCoupon(memberCouponIds); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 使用优惠券 |
| | | * @author jqs |
| | |
| | | public void backMemberCoupon(String memberCouponIds){ |
| | | memberCouponMapper.backMemberCoupon(memberCouponIds); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | |
| | | } |
| | | return merMemberCouponVoList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * @description 确认核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/8/15 11:21 |
| | | * @param memberCouponId |
| | | * @param shopId |
| | | * @return void |
| | | * @return void |
| | | * @description 确认核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/8/15 11:21 |
| | | */ |
| | | @Override |
| | | public void sureMemberCoupon(Long memberCouponId, Long shopId){ |
| | | public void sureMemberCoupon(Long memberCouponId, Long shopId) { |
| | | memberCouponMapper.sureMemberCoupon(memberCouponId, shopId); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) |
| | | public void insert(MemberCoupon memberCoupon) { |
| | | this.baseMapper.insert(memberCoupon); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户优惠券 |
| | | * |
| | | * @param couponId |
| | | * @param number |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R addMemberCoupon(String couponId, Integer number, Long userId) { |
| | | Coupon coupon = couponService.getById(couponId); |
| | | if (null == coupon) { |
| | | return R.fail("优惠券不存在"); |
| | | } |
| | | List<MemberCoupon> memberCouponList = new ArrayList<>(); |
| | | MemberCoupon memberCoupon; |
| | | Integer sendTotal = 0; |
| | | Integer sendPerson = 0; |
| | | Integer sendUserTotal; |
| | | for (int i = 0; i < number; i++) { |
| | | memberCoupon = new MemberCoupon(); |
| | | memberCoupon.setDelFlag(0); |
| | | memberCoupon.setCouponId(coupon.getCouponId()); |
| | | memberCoupon.setUserId(userId); |
| | | memberCoupon.setShopId(coupon.getShopId()); |
| | | memberCoupon.setCouponType(coupon.getCouponType()); |
| | | if (coupon.getCouponType() == 1) { |
| | | memberCoupon.setMoneyThreshold(coupon.getMoneyThreshold()); |
| | | memberCoupon.setDiscountMoney(coupon.getDiscountMoney()); |
| | | } else if (coupon.getCouponType() == 2) { |
| | | memberCoupon.setDiscountPercent(coupon.getDiscountPercent()); |
| | | } else if (coupon.getCouponType() == 3) { |
| | | memberCoupon.setDiscountMoney(coupon.getDiscountMoney()); |
| | | } else { |
| | | memberCoupon.setRelGoodsIds(coupon.getRelGoodsIds()); |
| | | } |
| | | memberCoupon.setCouponStatus(coupon.getCouponStatus()); |
| | | memberCoupon.setCouponName(coupon.getCouponName()); |
| | | memberCoupon.setSendType(coupon.getSendType()); |
| | | memberCoupon.setSendTarget(coupon.getSendTarget()); |
| | | memberCoupon.setSendTimeType(coupon.getSendTimeType()); |
| | | memberCoupon.setSendTime(coupon.getSendTime()); |
| | | memberCoupon.setUseScope(coupon.getUseScope()); |
| | | if (memberCoupon.getUseScope() == 2) { |
| | | memberCoupon.setRelGoodsIds(coupon.getRelGoodsIds()); |
| | | } |
| | | memberCoupon.setValidTimeType(coupon.getValidTimeType()); |
| | | memberCoupon.setValidStartTime(coupon.getValidStartTime()); |
| | | memberCoupon.setValidEndTime(coupon.getValidEndTime()); |
| | | memberCoupon.setValidDay(coupon.getValidDay()); |
| | | memberCoupon.setCouponFrom(coupon.getCouponFrom()); |
| | | memberCoupon.setReceiveTime(new Date()); |
| | | //有效期处理1.时间段2.领取之日起 |
| | | if (coupon.getValidTimeType() == 1) { |
| | | memberCoupon.setDeadlineTime(coupon.getValidEndTime()); |
| | | } else if (coupon.getValidTimeType() == 2) { |
| | | memberCoupon.setDeadlineTime(DateUtils.addDays(new Date(), coupon.getValidDay())); |
| | | } |
| | | memberCouponList.add(memberCoupon); |
| | | sendTotal = sendTotal + 1; |
| | | if (coupon.getSendType() == 1) { |
| | | sendUserTotal = this.totalMemberCouponByUserAndCoupon(userId, coupon.getCouponId()); |
| | | if (sendUserTotal != null && sendUserTotal > 0) { |
| | | } else { |
| | | sendPerson = sendPerson + 1; |
| | | } |
| | | } |
| | | memberCouponRecordService.updateMemberCouponRecord(coupon, userId, 1); |
| | | } |
| | | this.saveBatch(memberCouponList); |
| | | //处理优惠券统计 |
| | | if (sendTotal > 0) { |
| | | couponMapper.updateCouponTotal(coupon.getCouponId(), sendTotal, sendPerson); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.member.service.impl.member; |
| | | import com.google.common.collect.Lists; |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | 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.google.common.collect.Lists; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | |
| | | import com.ruoyi.member.domain.pojo.member.IntegralRecord; |
| | | import com.ruoyi.member.domain.pojo.member.MemberArchive; |
| | | import com.ruoyi.member.domain.pojo.member.MemberTotal; |
| | | import com.ruoyi.member.domain.vo.MerMemberTotalVo; |
| | | import com.ruoyi.member.domain.vo.*; |
| | | import com.ruoyi.member.mapper.member.MemberMapper; |
| | | import com.ruoyi.member.service.member.IntegralRecordService; |
| | |
| | | List<Member> mobileList = memberMapper.listTodayBirthday(); |
| | | if(mobileList!=null&&!mobileList.isEmpty()){ |
| | | log.info("生日祝福发送短信---"+mobileList.toString()); |
| | | for(Member member : mobileList){ |
| | | for (Member member : mobileList) { |
| | | try { |
| | | String msg = "{\"name\":\"" + (StringUtils.isEmpty(member.getRealName()) ? member.getNickName() : member.getRealName()) + "\"}"; |
| | | MsgUtils.sendMsg(member.getMobile(),null, msg); |
| | | MsgUtils.sendMsg(member.getMobile(), null, msg); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户积分 |
| | | * |
| | | * @param integral |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R addIntegralRecord(Integer integral, Long userId, String orderId) { |
| | | Member member = this.getByUserId(userId); |
| | | MemberTotal memberTotal = memberTotalService.getById(member.getMemberId()); |
| | | IntegralRecord integralRecord = new IntegralRecord(); |
| | | integralRecord.setDelFlag(0); |
| | | integralRecord.setUserId(userId); |
| | | integralRecord.setChangeType(6); |
| | | integralRecord.setChangeIntegral(integral); |
| | | integralRecord.setSurpIntegral(memberTotal.getUseableIntegral() + integral); |
| | | integralRecord.setCreateTime(new Date()); |
| | | integralRecord.setOrderId(orderId); |
| | | integralRecord.setChangeReason("抽奖活动获得"); |
| | | integralRecordService.save(integralRecord); |
| | | memberTotal.setTotalIntegral(memberTotal.getTotalIntegral() + integral); |
| | | memberTotal.setUseableIntegral(memberTotal.getUseableIntegral() + integral); |
| | | memberTotal.setPlSuggestFlag(1); |
| | | memberTotalService.saveOrUpdate(memberTotal); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.member.domain.dto.AppMemberCouponPageDto; |
| | | import com.ruoyi.member.domain.dto.MerGoodsCouponListDto; |
| | | import com.ruoyi.member.domain.vo.AppMemberCouponPageVo; |
| | |
| | | * @return List<MerMemberCouponVo> |
| | | */ |
| | | List<MerMemberCouponVo> listMerShopGoodsMemberCoupon(MerGoodsCouponListDto merGoodsCouponListDto); |
| | | |
| | | |
| | | /** |
| | | * @description 确认核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/8/15 11:21 |
| | | * @param memberCouponId |
| | | * @param shopId |
| | | * @return void |
| | | * @return void |
| | | * @description 确认核销优惠券 |
| | | * @author jqs |
| | | * @date 2023/8/15 11:21 |
| | | */ |
| | | void sureMemberCoupon(Long memberCouponId,Long shopId); |
| | | |
| | | void sureMemberCoupon(Long memberCouponId, Long shopId); |
| | | |
| | | void insert(MemberCoupon memberCoupon); |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户优惠券 |
| | | * |
| | | * @param couponId |
| | | * @param number |
| | | * @return |
| | | */ |
| | | R addMemberCoupon(String couponId, Integer number, Long userId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.member.domain.dto.*; |
| | | import com.ruoyi.member.domain.vo.*; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | |
| | | * @return void |
| | | */ |
| | | void updateMemberShopName(MgtMemberShopNameDto mgtMemberShopNameDto); |
| | | |
| | | |
| | | /** |
| | | * @description 发送生日祝福 |
| | | * @author jqs |
| | | * @date 2023/8/7 15:40 |
| | | * @param |
| | | * @return void |
| | | * @return void |
| | | * @description 发送生日祝福 |
| | | * @author jqs |
| | | * @date 2023/8/7 15:40 |
| | | */ |
| | | void sendBirthdayBless(); |
| | | |
| | | |
| | | /** |
| | | * 手动添加用户积分 |
| | | * |
| | | * @param integral |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | R addIntegralRecord(Integer integral, Long userId, String orderId); |
| | | } |
| | |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.8.22</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-goods</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.domain.dto.*; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/payOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "支付订单") |
| | | @ApiOperation(value = "支付订单【2.0】") |
| | | public R<AppPlaceOrderVo> payOrder(@RequestBody AppBaseGetDto appBaseGetDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | AppPlaceOrderVo appPlaceOrderVo = orderService.payOrder(appBaseGetDto.getId()); |
| | |
| | | @ApiModelProperty(value = "package") |
| | | @JsonProperty("package") |
| | | private String packageStr; |
| | | |
| | | |
| | | @ApiModelProperty(value = "签名方式") |
| | | private String signType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "签名") |
| | | private String paySign; |
| | | |
| | | |
| | | @ApiModelProperty(value = "预支付回话标识") |
| | | private String prepayId; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "是否可抽奖(0=否,1=是)") |
| | | private Boolean lotteryDraw; |
| | | } |
| | |
| | | import com.google.common.collect.Lists; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.UserStatus; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.api.domain.LotteryEvent; |
| | | import com.ruoyi.goods.api.service.LotteryEventClient; |
| | | import com.ruoyi.order.config.WxPayConfiguration; |
| | | import com.ruoyi.order.domain.dto.*; |
| | | import com.ruoyi.order.domain.pojo.account.OrderPayment; |
| | |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.NumberFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | @Resource |
| | | private OrderPaymentService orderPaymentService; |
| | | |
| | | |
| | | @Resource |
| | | private ProfitSharingService profitSharingService; |
| | | |
| | | |
| | | @Resource |
| | | private OrderRefundService orderRefundService; |
| | | |
| | | |
| | | @Value("${wx.pay.callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private LotteryEventClient lotteryEventClient; |
| | | |
| | | |
| | | /** |
| | | * @description: buyGoods |
| | | * @param: appSureOrderDto |
| | |
| | | appPlaceOrderVo.setPaySign(payArr[5]); |
| | | appPlaceOrderVo.setPrepayId(orderPayment.getPrepayId()); |
| | | // 返回AppPlaceOrderVo对象 |
| | | List<LotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); |
| | | if (data.size() > 0) { |
| | | long count = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) >= 0).count(); |
| | | appPlaceOrderVo.setLotteryDraw(count > 0); |
| | | } else { |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | } |
| | | return appPlaceOrderVo; |
| | | } |
| | | |
| | |
| | | package com.ruoyi.shop.controller.miniapp; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.shop.domain.dto.AppNearbyShopDto; |
| | | import com.ruoyi.shop.domain.vo.AppNearbyShopVo; |
| | | import com.ruoyi.shop.domain.vo.AppShopInfoVo; |
| | | import com.ruoyi.shop.service.shop.ShopAppointableTimeService; |
| | | import com.ruoyi.shop.service.shop.ShopNonAppointableTimeService; |
| | | import com.ruoyi.shop.service.shop.ShopService; |
| | | import com.ruoyi.system.api.domain.dto.AppBaseGetDto; |
| | | import com.ruoyi.system.api.domain.dto.AppointmentTimeDto; |
| | | import com.ruoyi.system.api.domain.dto.ShopAppointmentTimeDto; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopNonAppointableTime; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | |
| | | @RequestMapping("/app/home") |
| | | @Log4j2 |
| | | public class AppHomeController { |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private RemoteMemberService memberService; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private ShopService shopService; |
| | | |
| | | |
| | | @Resource |
| | | private ShopNonAppointableTimeService shopNonAppointableTimeService; |
| | | |
| | | @Resource |
| | | private ShopAppointableTimeService shopAppointableTimeService; |
| | | |
| | | |
| | | @RequestMapping(value = "/getNearbyShop", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取最近商户") |
| | | public R<AppNearbyShopVo> getNearbyShop(@RequestBody AppNearbyShopDto appNearbyShopDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Member member = null; |
| | | if(userId!=null){ |
| | | if (userId != null) { |
| | | member = memberService.getMember(userId).getData(); |
| | | } |
| | | log.info("获取最近商户:userId=" + userId + "&appNearbyShopDto=" + JSON.toJSONString(appNearbyShopDto)); |
| | |
| | | AppNearbyShopVo appNearbyShopVo = shopService.getNearbyShop(appNearbyShopDto,member); |
| | | return R.ok(appNearbyShopVo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/getShopInfo", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商户详情") |
| | | public R<AppShopInfoVo> getShopInfo(@RequestBody AppBaseGetDto appBaseGetDto) { |
| | | AppShopInfoVo appShopInfoVo = shopService.getAppShopInfo(Long.valueOf(appBaseGetDto.getId())); |
| | | return R.ok(appShopInfoVo); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/getShopAppointmentTime", method = RequestMethod.POST) |
| | | @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")); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/appointmentTime", method = RequestMethod.POST) |
| | | @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())); |
| | | if (null != one) { |
| | | return R.fail("不能重复预约"); |
| | | } |
| | | Long userId = SecurityUtils.getUserId(); |
| | | one = new ShopAppointableTime(); |
| | | one.setShopId(dto.getShopId()); |
| | | one.setAppointableTime(dto.getTime()); |
| | | one.setUserId(userId); |
| | | one.setStatus(1); |
| | | one.setCreateTime(LocalDateTime.now()); |
| | | shopAppointableTimeService.save(one); |
| | | return R.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.mapper.shop; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 15:13 |
| | | */ |
| | | public interface ShopAppointableTimeMapper extends BaseMapper<ShopAppointableTime> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.mapper.shop; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopNonAppointableTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:31 |
| | | */ |
| | | public interface ShopNonAppointableTimeMapper extends BaseMapper<ShopNonAppointableTime> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.service.impl.shop; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.shop.mapper.shop.ShopAppointableTimeMapper; |
| | | import com.ruoyi.shop.service.shop.ShopAppointableTimeService; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 15:15 |
| | | */ |
| | | public class ShopAppointableTimeServiceImpl extends ServiceImpl<ShopAppointableTimeMapper, ShopAppointableTime> implements ShopAppointableTimeService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.service.impl.shop; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.shop.mapper.shop.ShopNonAppointableTimeMapper; |
| | | import com.ruoyi.shop.service.shop.ShopNonAppointableTimeService; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopNonAppointableTime; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:31 |
| | | */ |
| | | @Service |
| | | public class ShopNonAppointableTimeServiceImpl extends ServiceImpl<ShopNonAppointableTimeMapper, ShopNonAppointableTime> implements ShopNonAppointableTimeService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.service.shop; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopAppointableTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 15:14 |
| | | */ |
| | | public interface ShopAppointableTimeService extends IService<ShopAppointableTime> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.service.shop; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopNonAppointableTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/26 14:30 |
| | | */ |
| | | public interface ShopNonAppointableTimeService extends IService<ShopNonAppointableTime> { |
| | | } |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/getHomeBanner", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取首页banner") |
| | | @ApiOperation(value = "获取首页banner【2.0】") |
| | | public R<List<AppBannerVo>> getHomeBanner() { |
| | | List<AppBannerVo> appBannerVoList = bannerService.listHomeBannerVo(); |
| | | return R.ok(appBannerVoList); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getQuickEntry", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取首页快速入口") |
| | | @ApiOperation(value = "获取首页快速入口【2.0】") |
| | | public R<List<AppQuickEntryVo>> getQuickEntry() { |
| | | List<AppQuickEntryVo> appQuickEntryVoList = quickEntryService.listQuickEntryVo(); |
| | | return R.ok(appQuickEntryVoList); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getAdvert", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取首页广告") |
| | | @ApiOperation(value = "获取首页广告【2.0】") |
| | | public R<AppAdvertVo> getAdvert() { |
| | | AppAdvertVo appAdvertVo = advertService.getAdvertVo(); |
| | | return R.ok(appAdvertVo); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getPop", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取弹窗") |
| | | @ApiOperation(value = "获取弹窗【2.0】") |
| | | public R<AppPopVo> getAppPop() { |
| | | AppPopVo appPopVo = popService.getAppPop(); |
| | | return R.ok(appPopVo); |
| | |
| | | @TableField("target_type") |
| | | private Integer targetType; |
| | | /** |
| | | * 链接类型1.手动输入2.选择已有 |
| | | * 链接类型1.跳转地址,2=跳转小程序 |
| | | */ |
| | | @TableField("link_type") |
| | | private Integer linkType; |
| | | /** |
| | | * 小程序appid |
| | | */ |
| | | @TableField("appid") |
| | | private String appid; |
| | | /** |
| | | * 链接地址 |
| | | */ |
| | | @TableField("link_url") |
| | | private String linkUrl; |
| | | |
| | | |
| | | /** |
| | | * 跳转类型1.门店详情2.秒杀活动3领券中心4.商城列表5.关于洪瑞堂6.赚取积分7.建议有奖 |
| | | */ |
| | |
| | | @TableField("target_type") |
| | | private Integer targetType; |
| | | /** |
| | | * 链接类型1.手动输入2.选择已有 |
| | | * 链接类型1.跳转地址,2=跳转小程序 |
| | | */ |
| | | @TableField("link_type") |
| | | private Integer linkType; |
| | | /** |
| | | * 小程序appid |
| | | */ |
| | | @TableField("appid") |
| | | private String appid; |
| | | /** |
| | | * 链接地址 |
| | | */ |
| | | @TableField("link_url") |
| | |
| | | @TableField("link_url") |
| | | private String linkUrl; |
| | | /** |
| | | * 链接类型1.手动输入2.选择已有 |
| | | * 链接类型1.跳转地址,2=跳转小程序 |
| | | */ |
| | | @TableField("link_type") |
| | | private Integer linkType; |
| | | /** |
| | | * 小程序appid |
| | | */ |
| | | @TableField("appid") |
| | | private String appid; |
| | | /** |
| | | * 跳转活动id |
| | | */ |
| | | @TableField("jump_id") |
| | |
| | | @TableField("target_type") |
| | | private Integer targetType; |
| | | /** |
| | | * 链接类型1.手动输入2.选择已有 |
| | | * 链接类型1.跳转地址,2、跳转小程序 |
| | | */ |
| | | @TableField("link_type") |
| | | private Integer linkType; |
| | | /** |
| | | * 小程序appid |
| | | */ |
| | | @TableField("appid") |
| | | private String appid; |
| | | /** |
| | | * 链接地址 |
| | | */ |
| | | @TableField("link_url") |
| | |
| | | |
| | | @ApiModelProperty(value = "广告入口") |
| | | private Long adId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "广告图片地址") |
| | | private String adUrl; |
| | | |
| | | |
| | | @ApiModelProperty(value = "广告语") |
| | | private String adContent; |
| | | |
| | | |
| | | @ApiModelProperty(value = "对象类型1.外链2.内链3.无") |
| | | private Integer targetType; |
| | | |
| | | @ApiModelProperty(value = "链接类型1.手动输入2.选择已有") |
| | | |
| | | @ApiModelProperty(value = "链接类型1.跳转地址,2、跳转小程序") |
| | | private Integer linkType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "小程序appid") |
| | | private String appid; |
| | | |
| | | @ApiModelProperty(value = "链接地址") |
| | | private String linkUrl; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跳转类型1.门店详情2.秒杀活动3领券中心4.商城列表5.关于洪瑞堂6.赚取积分7.建议有奖") |
| | | private Integer jumpType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跳转id") |
| | | private String jumpId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "logo地址") |
| | | private String logoUrl; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "bannerid") |
| | | private Long bannerId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "banner图片地址") |
| | | private String bannerUrl; |
| | | |
| | | |
| | | @ApiModelProperty(value = "链接类型1.外部2.内部3.无") |
| | | private Integer targetType; |
| | | |
| | | @ApiModelProperty(value = "链接类型1.手动输入2.选择已有") |
| | | |
| | | @ApiModelProperty(value = "链接类型1.跳转地址,2、跳转小程序") |
| | | private Integer linkType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "小程序appid") |
| | | private String appid; |
| | | |
| | | @ApiModelProperty(value = "链接地址") |
| | | private String linkUrl; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跳转类型1.门店详情2.秒杀活动3领券中心4.商城列表5.关于洪瑞堂6.赚取积分7.建议有奖") |
| | | private Integer jumpType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跳转id") |
| | | private String jumpId; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "对象类型1.外链2.内链3.无") |
| | | private Integer targetType; |
| | | |
| | | @ApiModelProperty(value = "链接类型1.手动输入2.选择已有") |
| | | |
| | | @ApiModelProperty(value = "链接类型1.跳转地址,2、跳转小程序") |
| | | private Integer linkType; |
| | | |
| | | @ApiModelProperty(value = "小程序appid") |
| | | private String appid; |
| | | |
| | | @ApiModelProperty(value = "链接地址") |
| | | private String linkUrl; |
| | |
| | | |
| | | @ApiModelProperty(value = "快速入口") |
| | | private Long entryId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "入口图片地址") |
| | | private String entryUrl; |
| | | |
| | | |
| | | @ApiModelProperty(value = "入口名称") |
| | | private String entryName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "对象类型1.外链2.内链3.无") |
| | | private Integer targetType; |
| | | |
| | | @ApiModelProperty(value = "链接类型1.手动输入2.选择已有") |
| | | |
| | | @ApiModelProperty(value = "链接类型1.跳转地址,2、跳转小程序") |
| | | private Integer linkType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "小程序appid") |
| | | private String appid; |
| | | |
| | | @ApiModelProperty(value = "链接地址") |
| | | private String linkUrl; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跳转类型1.门店详情2.秒杀活动3领券中心4.商城列表5.关于洪瑞堂6.赚取积分7.建议有奖") |
| | | private Integer jumpType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跳转id") |
| | | private String jumpId; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | <select id="getAdvertVo" resultType="com.ruoyi.system.domain.vo.AppAdvertVo"> |
| | | SELECT |
| | | ad_id adId, |
| | | ad_url adUrl, |
| | | ad_content adContent, |
| | | link_type linkType, |
| | | ad_id adId, |
| | | ad_url adUrl, |
| | | ad_content adContent, |
| | | link_type linkType, |
| | | appid, |
| | | target_type targetType, |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId, |
| | | logo_url logoUrl |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId, |
| | | logo_url logoUrl |
| | | FROM t_advert WHERE del_flag = 0 ORDER BY create_time DESC LIMIT 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="listHomeBannerVo" resultType="com.ruoyi.system.domain.vo.AppBannerVo"> |
| | | SELECT |
| | | banner_id bannerId, |
| | | banner_url bannerUrl, |
| | | banner_id bannerId, |
| | | banner_url bannerUrl, |
| | | target_type targetType, |
| | | link_type linkType, |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId |
| | | link_type linkType, |
| | | appid, |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId |
| | | FROM t_banner WHERE del_flag = 0 AND banner_position = 1 |
| | | ORDER BY banner_sort DESC,create_time DESC LIMIT 5 |
| | | </select> |
| | |
| | | |
| | | <select id="getAppPop" resultType="com.ruoyi.system.domain.vo.AppPopVo"> |
| | | SELECT |
| | | pop_id popId, |
| | | pop_url popUrl, |
| | | link_type linkType, |
| | | pop_id popId, |
| | | pop_url popUrl, |
| | | link_type linkType, |
| | | appid, |
| | | target_type targetType, |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId |
| | | FROM t_pop |
| | | WHERE del_flag = 0 AND CURDATE() BETWEEN show_start_time AND show_end_time |
| | | ORDER BY pop_sort,create_time DESC LIMIT 1 |
| | |
| | | </delete> |
| | | |
| | | <select id="listQuickEntryVo" resultType="com.ruoyi.system.domain.vo.AppQuickEntryVo"> |
| | | SELECT |
| | | entry_id entryId, |
| | | entry_url entryUrl, |
| | | entry_name entryName, |
| | | link_type linkType, |
| | | target_type targetType, |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId |
| | | FROM t_quick_entry WHERE del_flag = 0 |
| | | ORDER BY entry_sort,create_time DESC |
| | | SELECT entry_id entryId, |
| | | entry_url entryUrl, |
| | | entry_name entryName, |
| | | link_type linkType, |
| | | appid, |
| | | target_type targetType, |
| | | link_url linkUrl, |
| | | jump_type jumpType, |
| | | jump_id jumpId |
| | | FROM t_quick_entry |
| | | WHERE del_flag = 0 |
| | | ORDER BY entry_sort, create_time DESC |
| | | </select> |
| | | |
| | | <select id="pageMgtQuickEntry" resultType="com.ruoyi.system.domain.vo.MgtQuickEntryPageVo"> |