From e5b802d4c12f7fef03461acd2d777f2a66d2f85e Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 29 七月 2025 11:00:27 +0800 Subject: [PATCH] 修改bug --- ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java | 7 + ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml | 229 +++++++++++++++++++++++---------------------- ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java | 3 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java | 4 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/AddIntegralRecordVo.java | 17 +++ ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java | 3 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java | 5 7 files changed, 147 insertions(+), 121 deletions(-) diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java index 9be611c..8124fd0 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMemberFallbackFactory.java @@ -6,6 +6,7 @@ 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.model.AddIntegralRecordVo; import com.ruoyi.system.api.model.AppMiniLoginDto; import com.ruoyi.system.api.model.AppMiniLoginVo; import com.ruoyi.system.api.service.RemoteMemberService; @@ -168,7 +169,7 @@ @Override - public R addIntegralRecord(Integer integral, Long userId, String orderId) { + public R addIntegralRecord(AddIntegralRecordVo addIntegralRecordVo) { return R.fail("手动添加用户积分失败:" + throwable.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/AddIntegralRecordVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/AddIntegralRecordVo.java new file mode 100644 index 0000000..b879cfa --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/AddIntegralRecordVo.java @@ -0,0 +1,17 @@ +package com.ruoyi.system.api.model; + +import lombok.Data; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author zhibing.pu + * @date 2025/7/29 10:54 + */ +@Data +public class AddIntegralRecordVo { + private Integer integral; + + private Long userId; + + private String orderId; +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java index 87a4ed5..bdf73f5 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/service/RemoteMemberService.java @@ -8,6 +8,7 @@ import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; import com.ruoyi.system.api.domain.vo.*; import com.ruoyi.system.api.factory.RemoteMemberFallbackFactory; +import com.ruoyi.system.api.model.AddIntegralRecordVo; import com.ruoyi.system.api.model.AppMiniLoginDto; import com.ruoyi.system.api.model.AppMiniLoginVo; import org.springframework.cloud.openfeign.FeignClient; @@ -283,7 +284,7 @@ * @return */ @PostMapping("/member/addIntegralRecord") - R addIntegralRecord(@RequestParam("integral") Integer integral, @RequestParam("userId") Long userId, @RequestParam("orderId") String orderId); + R addIntegralRecord(@RequestBody AddIntegralRecordVo addIntegralRecordVo); /** * 添加奖品数据 diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java index 2364d54..8cd372b 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/lottery/LotteryEventServiceImpl.java @@ -20,6 +20,7 @@ import com.ruoyi.system.api.domain.poji.member.Member; import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; import com.ruoyi.system.api.domain.poji.shop.Shop; +import com.ruoyi.system.api.model.AddIntegralRecordVo; import com.ruoyi.system.api.model.AddOrderVo; import com.ruoyi.system.api.service.RemoteCouponService; import com.ruoyi.system.api.service.RemoteMemberService; @@ -188,7 +189,11 @@ } //中奖积分 if (4 == lotteryEventPrize.getPrizeType()) { - remoteMemberService.addIntegralRecord(lotteryEventPrize.getNumber(), userId, id); + AddIntegralRecordVo addIntegralRecordVo = new AddIntegralRecordVo(); + addIntegralRecordVo.setIntegral(lotteryEventPrize.getNumber()); + addIntegralRecordVo.setUserId(userId); + addIntegralRecordVo.setOrderId(id); + remoteMemberService.addIntegralRecord(addIntegralRecordVo); } userLotteryEvent.setCreateTime(LocalDateTime.now()); userLotteryEventService.save(userLotteryEvent); diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml index 9289a51..dbc8fd1 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml +++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/lottery/LotteryEventMapper.xml @@ -1,9 +1,9 @@ <?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 id="pageAppLotteryEvent" resultType="com.ruoyi.goods.domain.vo.AppLotteryEventPageVo"> select * from (select a.id, a.name, @@ -14,9 +14,10 @@ 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 + 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 + WHEN NOW() < a.start_time THEN 3 + ELSE 4 END as sort from t_lottery_event a left join (select count(1) as num, lottery_event_id from t_user_lottery_event @@ -26,9 +27,9 @@ and a.activity_type in (4, 5)) as aa order by aa.sort, aa.startTime </select> - - - <select id="getShopLotteryDrawList" resultType="com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo"> + + + <select id="getShopLotteryDrawList" resultType="com.ruoyi.goods.domain.vo.ShopLotteryDrawListVo"> select id, `name`, activity_profile as activityProfile, @@ -41,109 +42,109 @@ order by create_time desc </select> <select id="pageMgtLotteryEvent" resultType="com.ruoyi.goods.domain.vo.MgtLotteryEventPageVo"> - SELECT - id, - shop_id, - name, - activity_type, - CONCAT(start_time,'-',end_time) activityTime, - create_time, - CASE - WHEN NOW() < start_time THEN 1 -- 未开始 - WHEN NOW() BETWEEN start_time AND end_time THEN 2 -- 进行中 - ELSE 3 -- 已结束 - END AS `status`, - CASE - WHEN NOW() BETWEEN start_time AND end_time THEN 1 - ELSE 0 - END AS flag - FROM - t_lottery_event - where - del_flag =0 - <choose> - <when test="dto.status != null and dto.status == 0"> - -- 0-全部状态,不添加额外条件 - </when> - <when test="dto.status != null and dto.status == 1"> - AND start_time > NOW() -- 1-未开始 - </when> - <when test="dto.status != null and dto.status == 2"> - AND start_time <= NOW() AND end_time >= NOW() -- 2-进行中 - </when> - <when test="dto.status != null and dto.status == 3"> - AND end_time < NOW() -- 3-已结束 - </when> - </choose> - <if test="null != dto.name and ''!= dto.name "> - and `name` like concat('%',#{dto.name},'%') - </if> - <if test="null != dto.activityType and dto.activityType!=0 "> - and activity_type = #{dto.activityType} - </if> - <if test="dto.shopIds != null and dto.shopIds.size() > 0"> - <choose> - <when test="dto.flag != null and dto.flag == 1"> - AND (shop_id IN - <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> - #{shopId} - </foreach> - OR shop_id IS NULL) - </when> - <otherwise> - AND shop_id IN - <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> - #{shopId} - </foreach> - </otherwise> - </choose> - </if> - order by create_time desc - limit #{dto.offset},#{dto.pageSize} - </select> - <select id="pageMgtLotteryEventCount" resultType="java.lang.Long"> - SELECT - count(*) - FROM - t_lottery_event - where - del_flag =0 - <choose> - <when test="dto.status != null and dto.status == 0"> - -- 0-全部状态,不添加额外条件 - </when> - <when test="dto.status != null and dto.status == 1"> - AND start_time > NOW() -- 1-未开始 - </when> - <when test="dto.status != null and dto.status == 2"> - AND start_time <= NOW() AND end_time >= NOW() -- 2-进行中 - </when> - <when test="dto.status != null and dto.status == 3"> - AND end_time < NOW() -- 3-已结束 - </when> - </choose> - <if test="null != dto.name and ''!= dto.name "> - and `name` like concat('%',#{dto.name},'%') - </if> - <if test="null != dto.activityType and dto.activityType!=0 "> - and activity_type = #{dto.activityType} - </if> - <if test="dto.shopIds != null and dto.shopIds.size() > 0"> - <choose> - <when test="dto.flag != null and dto.flag == 1"> - AND (shop_id IN - <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> - #{shopId} - </foreach> - OR shop_id IS NULL) - </when> - <otherwise> - AND shop_id IN - <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> - #{shopId} - </foreach> - </otherwise> - </choose> - </if> - </select> + SELECT + id, + shop_id, + name, + activity_type, + CONCAT(start_time,'-',end_time) activityTime, + create_time, + CASE + WHEN NOW() < start_time THEN 1 -- 未开始 + WHEN NOW() BETWEEN start_time AND end_time THEN 2 -- 进行中 + ELSE 3 -- 已结束 + END AS `status`, + CASE + WHEN NOW() BETWEEN start_time AND end_time THEN 1 + ELSE 0 + END AS flag + FROM + t_lottery_event + where + del_flag =0 + <choose> + <when test="dto.status != null and dto.status == 0"> + -- 0-全部状态,不添加额外条件 + </when> + <when test="dto.status != null and dto.status == 1"> + AND start_time > NOW() -- 1-未开始 + </when> + <when test="dto.status != null and dto.status == 2"> + AND start_time <= NOW() AND end_time >= NOW() -- 2-进行中 + </when> + <when test="dto.status != null and dto.status == 3"> + AND end_time < NOW() -- 3-已结束 + </when> + </choose> + <if test="null != dto.name and ''!= dto.name "> + and `name` like concat('%',#{dto.name},'%') + </if> + <if test="null != dto.activityType and dto.activityType!=0 "> + and activity_type = #{dto.activityType} + </if> + <if test="dto.shopIds != null and dto.shopIds.size() > 0"> + <choose> + <when test="dto.flag != null and dto.flag == 1"> + AND (shop_id IN + <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> + #{shopId} + </foreach> + OR shop_id IS NULL) + </when> + <otherwise> + AND shop_id IN + <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> + #{shopId} + </foreach> + </otherwise> + </choose> + </if> + order by create_time desc + limit #{dto.offset},#{dto.pageSize} + </select> + <select id="pageMgtLotteryEventCount" resultType="java.lang.Long"> + SELECT + count(*) + FROM + t_lottery_event + where + del_flag =0 + <choose> + <when test="dto.status != null and dto.status == 0"> + -- 0-全部状态,不添加额外条件 + </when> + <when test="dto.status != null and dto.status == 1"> + AND start_time > NOW() -- 1-未开始 + </when> + <when test="dto.status != null and dto.status == 2"> + AND start_time <= NOW() AND end_time >= NOW() -- 2-进行中 + </when> + <when test="dto.status != null and dto.status == 3"> + AND end_time < NOW() -- 3-已结束 + </when> + </choose> + <if test="null != dto.name and ''!= dto.name "> + and `name` like concat('%',#{dto.name},'%') + </if> + <if test="null != dto.activityType and dto.activityType!=0 "> + and activity_type = #{dto.activityType} + </if> + <if test="dto.shopIds != null and dto.shopIds.size() > 0"> + <choose> + <when test="dto.flag != null and dto.flag == 1"> + AND (shop_id IN + <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> + #{shopId} + </foreach> + OR shop_id IS NULL) + </when> + <otherwise> + AND shop_id IN + <foreach collection="dto.shopIds" item="shopId" open="(" separator="," close=")"> + #{shopId} + </foreach> + </otherwise> + </choose> + </if> + </select> </mapper> diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java index 69dcf2d..c761dd2 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/console/MemberController.java @@ -14,6 +14,7 @@ import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; import com.ruoyi.system.api.domain.poji.shop.Shop; import com.ruoyi.system.api.domain.vo.*; +import com.ruoyi.system.api.model.AddIntegralRecordVo; import com.ruoyi.system.api.model.AppMiniLoginDto; import com.ruoyi.system.api.model.AppMiniLoginVo; import com.ruoyi.system.api.service.RemoteShopService; @@ -397,8 +398,8 @@ * @return */ @PostMapping("/addIntegralRecord") - public R addIntegralRecord(@RequestParam("integral") Integer integral, @RequestParam("userId") Long userId, @RequestParam("orderId") String orderId) { - return memberService.addIntegralRecord(integral, userId, orderId); + public R addIntegralRecord(@RequestBody AddIntegralRecordVo addIntegralRecordVo) { + return memberService.addIntegralRecord(addIntegralRecordVo.getIntegral(), addIntegralRecordVo.getUserId(), addIntegralRecordVo.getOrderId()); } diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java index d425a37..04d58d7 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/miniapp/AppHomeController.java @@ -114,9 +114,9 @@ one.setCreateTime(LocalDateTime.now()); shopAppointableTimeService.save(one); //发送短信给商家 - String msg = "{}"; + String msg = "{\"name\":\"\"}"; try { - MsgUtils.sendMsg(shop.getShopownerPhone(), "", msg); + MsgUtils.sendMsg(shop.getShopownerPhone(), "SMS_491310429", msg); } catch (Exception e) { e.printStackTrace(); } -- Gitblit v1.7.1