| @@ -13,6 +13,7 @@ import com.iformall.domain.po.WxGameActionLog; | |||||
| import com.iformall.domain.po.WxGameUserCount; | import com.iformall.domain.po.WxGameUserCount; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.vo.WxGameUserActionLogVo; | import com.iformall.domain.vo.WxGameUserActionLogVo; | ||||
| import com.iformall.domain.vo.WxGameUserGiftVo; | |||||
| import com.iformall.enums.EnumGameStatus; | import com.iformall.enums.EnumGameStatus; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| @@ -88,15 +89,14 @@ public class WxGameController extends BaseController { | |||||
| @ApiOperation("用户中奖记录接口") | @ApiOperation("用户中奖记录接口") | ||||
| @GetMapping("userGiftList") | @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) wxGameLog = new WxGameActionLog(); | ||||
| if (null == wxGameLog.getGameId()|| null == wxGameLog.getUserId()) { | if (null == wxGameLog.getGameId()|| null == wxGameLog.getUserId()) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"参数无效"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"参数无效"); | ||||
| } | } | ||||
| wxGameLog.updateTenantInfo(getTenantInfo()); | wxGameLog.updateTenantInfo(getTenantInfo()); | ||||
| final PageInfo<WxGameUserActionLogVo> page = wxGameService.listUserActionLogAsPage(wxGameLog, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| List<WxGameUserGiftVo> list = wxGameService.listUserGiftList(wxGameLog); | |||||
| return new ResultData(list); | |||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @@ -27,6 +27,9 @@ public class WxGameActionLog extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="couponOrderId") | @io.swagger.annotations.ApiModelProperty(value="",name="couponOrderId") | ||||
| private Long couponOrderId; | private Long couponOrderId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="couponId") | |||||
| private Long couponId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="userId") | @io.swagger.annotations.ApiModelProperty(value="",name="userId") | ||||
| private Long userId; | private Long userId; | ||||
| @@ -47,8 +50,4 @@ public class WxGameActionLog extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<Long> userIdList; | private List<Long> userIdList; | ||||
| @TableField(exist = false) | |||||
| private String couponName; | |||||
| @TableField(exist = false) | |||||
| private Integer couponCount; | |||||
| } | } | ||||
| @@ -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; | |||||
| } | |||||
| @@ -20,6 +20,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | ||||
| List<Long> findIdList(WxCouponOrder wxCouponOrder); | List<Long> findIdList(WxCouponOrder wxCouponOrder); | ||||
| List<Long> findCouponIdList(WxCouponOrder wxCouponOrder); | |||||
| List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | ||||
| List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | ||||
| @@ -3,6 +3,7 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxGameActionLog; | import com.iformall.domain.po.WxGameActionLog; | ||||
| import com.iformall.domain.vo.WxGameUserActionLogVo; | import com.iformall.domain.vo.WxGameUserActionLogVo; | ||||
| import com.iformall.domain.vo.WxGameUserGiftVo; | |||||
| import java.util.List; | import java.util.List; | ||||
| @@ -16,6 +17,5 @@ public interface WxGameActionLogMapper extends CommonMapper<WxGameActionLog, Str | |||||
| WxGameUserActionLogVo findUserSumList(WxGameActionLog wxGameActionLog); | WxGameUserActionLogVo findUserSumList(WxGameActionLog wxGameActionLog); | ||||
| List<WxGameActionLog> findUserGiftList(WxGameActionLog wxGameActionLog); | |||||
| List<WxGameUserGiftVo> findUserGiftList(WxGameActionLog wxGameActionLog); | |||||
| } | } | ||||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.WxGameActionLog; | |||||
| import com.iformall.domain.po.WxGameUserCount; | import com.iformall.domain.po.WxGameUserCount; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxGameUserActionLogVo; | import com.iformall.domain.vo.WxGameUserActionLogVo; | ||||
| import com.iformall.domain.vo.WxGameUserGiftVo; | |||||
| public interface WxGameService { | public interface WxGameService { | ||||
| @@ -24,7 +25,7 @@ public interface WxGameService { | |||||
| PageInfo<WxGameUserActionLogVo> listUserActionLogAsPage(WxGameActionLog record, Integer pageIndex, Integer pageSize); | PageInfo<WxGameUserActionLogVo> listUserActionLogAsPage(WxGameActionLog record, Integer pageIndex, Integer pageSize); | ||||
| List<WxGameActionLog> listUserGiftList(WxGameActionLog record); | |||||
| List<WxGameUserGiftVo> listUserGiftList(WxGameActionLog record); | |||||
| /** | /** | ||||
| * 获取用户要玩的游戏信息 | * 获取用户要玩的游戏信息 | ||||
| @@ -17,6 +17,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.domain.vo.WxGameUserActionLogVo; | import com.iformall.domain.vo.WxGameUserActionLogVo; | ||||
| import com.iformall.domain.vo.WxGameUserGiftVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| @@ -31,6 +32,7 @@ import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Qualifier; | 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.RedisTemplate; | ||||
| import org.springframework.data.redis.core.ValueOperations; | import org.springframework.data.redis.core.ValueOperations; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -58,15 +60,18 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelMapper wxCouponChannelMapper; | WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @Lazy | |||||
| @Autowired | @Autowired | ||||
| WxCouponService wxCouponService; | WxCouponService wxCouponService; | ||||
| @Autowired | @Autowired | ||||
| WxCouponOrderMapper wxCouponOrderMapper; | WxCouponOrderMapper wxCouponOrderMapper; | ||||
| @Lazy | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelService wxCouponChannelService; | WxCouponChannelService wxCouponChannelService; | ||||
| @Lazy | |||||
| @Autowired | @Autowired | ||||
| WxGameTemplateService wxGameTemplateService; | WxGameTemplateService wxGameTemplateService; | ||||
| @@ -126,8 +131,29 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxGameActionLog> listUserGiftList(WxGameActionLog record) { | |||||
| return wxGameActionLogMapper.findUserGiftList(record); | |||||
| public List<WxGameUserGiftVo> listUserGiftList(WxGameActionLog record) { | |||||
| List<WxGameUserGiftVo> list = wxGameActionLogMapper.findUserGiftList(record); | |||||
| if (null != list && list.size() > 0 ) { | |||||
| List<Long> couponIdList = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < list.size() ; i ++) { | |||||
| WxGameUserGiftVo log = list.get(i); | |||||
| couponIdList.add(log.getCouponId()); | |||||
| } | |||||
| Map<Long, WxCoupon> 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 | @Override | ||||
| @@ -185,6 +211,7 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| wxGameActionLog.updateTenantInfo(wxCouponOrder); | wxGameActionLog.updateTenantInfo(wxCouponOrder); | ||||
| wxGameActionLog.setGameId(gameId); | wxGameActionLog.setGameId(gameId); | ||||
| wxGameActionLog.setCouponOrderId(wxCouponOrder.getOrderId()); | wxGameActionLog.setCouponOrderId(wxCouponOrder.getOrderId()); | ||||
| wxGameActionLog.setCouponId(wxCouponOrder.getCouponId()); | |||||
| wxGameActionLog.setId(idWorker.nextId()); | wxGameActionLog.setId(idWorker.nextId()); | ||||
| wxGameActionLog.setCreateTime(new Date()); | wxGameActionLog.setCreateTime(new Date()); | ||||
| wxGameActionLogMapper.insert(wxGameActionLog); | wxGameActionLogMapper.insert(wxGameActionLog); | ||||
| @@ -182,6 +182,11 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findCouponIdList" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="Long"> | |||||
| select distinct coupon_id from wx_coupon_order | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BaseResultMap"> | <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BaseResultMap"> | ||||
| select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time, | select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time, | ||||
| co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version, | co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version, | ||||
| @@ -8,15 +8,15 @@ | |||||
| <result column="game_id" jdbcType="BIGINT" property="gameId" /> | <result column="game_id" jdbcType="BIGINT" property="gameId" /> | ||||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | <result column="user_id" jdbcType="BIGINT" property="userId" /> | ||||
| <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" /> | <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" /> | ||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||
| <result column="type" jdbcType="INTEGER" property="type" /> | <result column="type" jdbcType="INTEGER" property="type" /> | ||||
| <result column="used_credit" jdbcType="INTEGER" property="usedCredit" /> | <result column="used_credit" jdbcType="INTEGER" property="usedCredit" /> | ||||
| <result column="add_credit" jdbcType="INTEGER" property="addCredit" /> | <result column="add_credit" jdbcType="INTEGER" property="addCredit" /> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`,`type`,`used_credit`,`add_credit` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`game_id`,`user_id`,`create_time`,`type`,`used_credit`,`add_credit` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -35,18 +35,19 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != gameId "> | <if test=" null != gameId "> | ||||
| and `game_id` = #{gameId} | |||||
| and `game_id` = #{gameId} | |||||
| </if> | </if> | ||||
| <if test=" null != userId "> | <if test=" null != userId "> | ||||
| and `user_id` = #{userId} | |||||
| and `user_id` = #{userId} | |||||
| </if> | </if> | ||||
| <if test=" null != couponOrderId "> | <if test=" null != couponOrderId "> | ||||
| and `coupon_order_id` = #{couponOrderId} | |||||
| and `coupon_order_id` = #{couponOrderId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and `coupon_id` = #{couponId} | |||||
| </if> | </if> | ||||
| <if test=" null != createTime "> | <if test=" null != createTime "> | ||||
| @@ -172,11 +173,16 @@ | |||||
| group by user_id | group by user_id | ||||
| </select> | </select> | ||||
| <select id="findUserGiftList" parameterType="com.iformall.domain.po.WxGameActionLog" resultMap="BaseResultMap"> | |||||
| select | |||||
| <resultMap id="userGiftResultMap" type="com.iformall.domain.vo.WxGameUserActionLogVo"> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="coupon_count" jdbcType="INTEGER" property="couponCount" /> | |||||
| </resultMap> | |||||
| <select id="findUserGiftList" parameterType="com.iformall.domain.po.WxGameActionLog" resultMap="userGiftResultMap"> | |||||
| select coupon_id, count(1) as coupon_count | |||||
| from wx_game_action_log | 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 | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||