From b2ab37c9f351326e0a23d8b2b3650810c05ab50c Mon Sep 17 00:00:00 2001 From: winter <664946893@qq.com> Date: Wed, 27 Nov 2024 20:00:17 +0800 Subject: [PATCH] fix --- .../controller/market/WxGameController.java | 8 ++--- .../iformall/domain/po/WxGameActionLog.java | 7 ++--- .../iformall/domain/vo/WxGameUserGiftVo.java | 20 ++++++++++++ .../iformall/mapper/WxCouponOrderMapper.java | 1 + .../mapper/WxGameActionLogMapper.java | 4 +-- .../com/iformall/service/WxGameService.java | 3 +- .../service/impl/WxGameServiceImpl.java | 31 +++++++++++++++++-- .../resources/mapper/WxCouponOrderMapper.xml | 5 +++ .../mapper/WxGameActionLogMapper.xml | 30 +++++++++++------- 9 files changed, 84 insertions(+), 25 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/domain/vo/WxGameUserGiftVo.java diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java index 8d258b9ad..88cd481ef 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java @@ -13,6 +13,7 @@ import com.iformall.domain.po.WxGameActionLog; import com.iformall.domain.po.WxGameUserCount; import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.vo.WxGameUserActionLogVo; +import com.iformall.domain.vo.WxGameUserGiftVo; import com.iformall.enums.EnumGameStatus; import com.iformall.exception.MallinkException; import com.iformall.service.WxCUserBasicInfoService; @@ -88,15 +89,14 @@ public class WxGameController extends BaseController { @ApiOperation("用户中奖记录接口") @GetMapping("userGiftList") - public ResultData userGiftList(@ModelAttribute WxGameActionLog wxGameLog, Integer pageNum, Integer pageSize) { + public ResultData userGiftList(@ModelAttribute WxGameActionLog wxGameLog) { if (null == wxGameLog) wxGameLog = new WxGameActionLog(); if (null == wxGameLog.getGameId()|| null == wxGameLog.getUserId()) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"参数无效"); } wxGameLog.updateTenantInfo(getTenantInfo()); - - final PageInfo page = wxGameService.listUserActionLogAsPage(wxGameLog, pageNum, pageSize); - return new ResultData(page); + List list = wxGameService.listUserGiftList(wxGameLog); + return new ResultData(list); } @ApiOperation("新增接口") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java b/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java index 840ffe2a7..89c2fa586 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java @@ -27,6 +27,9 @@ public class WxGameActionLog extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="",name="couponOrderId") private Long couponOrderId; + + @io.swagger.annotations.ApiModelProperty(value="",name="couponId") + private Long couponId; @io.swagger.annotations.ApiModelProperty(value="",name="userId") private Long userId; @@ -47,8 +50,4 @@ public class WxGameActionLog extends TenantEntity { @TableField(exist = false) private List userIdList; - @TableField(exist = false) - private String couponName; - @TableField(exist = false) - private Integer couponCount; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxGameUserGiftVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxGameUserGiftVo.java new file mode 100644 index 000000000..1e0565e12 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxGameUserGiftVo.java @@ -0,0 +1,20 @@ +package com.iformall.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.iformall.domain.po.WxCouponBatch; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class WxGameUserGiftVo implements Serializable{ + + private static final long serialVersionUID = 4494858079134918638L; + //核销金额记录 + private Long couponId; + private Integer couponCount; + + @TableField(exist = false) + private String couponName; +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java index ffe20d70a..2d5e516c0 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java @@ -20,6 +20,7 @@ public interface WxCouponOrderMapper extends CommonMapper { List findList(WxCouponOrder wxCouponOrder); List findIdList(WxCouponOrder wxCouponOrder); + List findCouponIdList(WxCouponOrder wxCouponOrder); List findListOfOrderedByDate(Map dateMap); List findListOfVerifiedByDate(Map dateMap); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java index a1633e745..e51e06b6a 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java @@ -3,6 +3,7 @@ package com.iformall.mapper; import com.iformall.common.CommonMapper; import com.iformall.domain.po.WxGameActionLog; import com.iformall.domain.vo.WxGameUserActionLogVo; +import com.iformall.domain.vo.WxGameUserGiftVo; import java.util.List; @@ -16,6 +17,5 @@ public interface WxGameActionLogMapper extends CommonMapper findUserGiftList(WxGameActionLog wxGameActionLog); + List findUserGiftList(WxGameActionLog wxGameActionLog); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxGameService.java b/mallinkService/src/main/java/com/iformall/service/WxGameService.java index bd864bd3b..6e0d84a3e 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxGameService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxGameService.java @@ -9,6 +9,7 @@ import com.iformall.domain.po.WxGameActionLog; import com.iformall.domain.po.WxGameUserCount; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxGameUserActionLogVo; +import com.iformall.domain.vo.WxGameUserGiftVo; public interface WxGameService { @@ -24,7 +25,7 @@ public interface WxGameService { PageInfo listUserActionLogAsPage(WxGameActionLog record, Integer pageIndex, Integer pageSize); - List listUserGiftList(WxGameActionLog record); + List listUserGiftList(WxGameActionLog record); /** * 获取用户要玩的游戏信息 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index a29fa7559..403cffde8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -17,6 +17,7 @@ import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.domain.vo.WxGameUserActionLogVo; +import com.iformall.domain.vo.WxGameUserGiftVo; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxCouponChannelMapper; @@ -31,6 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; @@ -58,15 +60,18 @@ public class WxGameServiceImpl implements WxGameService { @Autowired WxCouponChannelMapper wxCouponChannelMapper; + @Lazy @Autowired WxCouponService wxCouponService; @Autowired WxCouponOrderMapper wxCouponOrderMapper; + @Lazy @Autowired WxCouponChannelService wxCouponChannelService; + @Lazy @Autowired WxGameTemplateService wxGameTemplateService; @@ -126,8 +131,29 @@ public class WxGameServiceImpl implements WxGameService { } @Override - public List listUserGiftList(WxGameActionLog record) { - return wxGameActionLogMapper.findUserGiftList(record); + public List listUserGiftList(WxGameActionLog record) { + List list = wxGameActionLogMapper.findUserGiftList(record); + if (null != list && list.size() > 0 ) { + List couponIdList = new ArrayList(); + for (int i = 0 ; i < list.size() ; i ++) { + WxGameUserGiftVo log = list.get(i); + couponIdList.add(log.getCouponId()); + } + Map couponMap = null; + if (null != couponIdList && couponIdList.size() > 0 ) { + couponMap = wxCouponService.getCouponMap(couponIdList, record); + } + for (int i = 0 ; i < list.size() ; i ++) { + WxGameUserGiftVo log = list.get(i); + if (null != couponMap) { + WxCoupon wxCoupon = couponMap.get(log.getCouponId()); + if (null != wxCoupon) { + log.setCouponName(wxCoupon.getTitle()); + } + } + } + } + return list; } @Override @@ -185,6 +211,7 @@ public class WxGameServiceImpl implements WxGameService { wxGameActionLog.updateTenantInfo(wxCouponOrder); wxGameActionLog.setGameId(gameId); wxGameActionLog.setCouponOrderId(wxCouponOrder.getOrderId()); + wxGameActionLog.setCouponId(wxCouponOrder.getCouponId()); wxGameActionLog.setId(idWorker.nextId()); wxGameActionLog.setCreateTime(new Date()); wxGameActionLogMapper.insert(wxGameActionLog); diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 541627630..cbf9c8bea 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -182,6 +182,11 @@ + + - - + select coupon_id, count(1) as coupon_count from wx_game_action_log + where `tenant_id` = #{tenantId} and `game_id` = #{gameId} and user_id = #{userId} and coupon_order_id > 0 + and coupon_id > 0 and coupon_id is not null + group by coupon_id