| @@ -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<WxGameUserActionLogVo> page = wxGameService.listUserActionLogAsPage(wxGameLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| List<WxGameUserGiftVo> list = wxGameService.listUserGiftList(wxGameLog); | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @@ -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<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<Long> findIdList(WxCouponOrder wxCouponOrder); | |||
| List<Long> findCouponIdList(WxCouponOrder wxCouponOrder); | |||
| List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | |||
| List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | |||
| @@ -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<WxGameActionLog, Str | |||
| 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.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<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.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<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 | |||
| @@ -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); | |||
| @@ -182,6 +182,11 @@ | |||
| <include refid="dynamicWhereConditions" /> | |||
| </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 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, | |||
| @@ -8,15 +8,15 @@ | |||
| <result column="game_id" jdbcType="BIGINT" property="gameId" /> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId" /> | |||
| <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="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="used_credit" jdbcType="INTEGER" property="usedCredit" /> | |||
| <result column="add_credit" jdbcType="INTEGER" property="addCredit" /> | |||
| </resultMap> | |||
| <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 id="dynamicWhereConditions"> | |||
| @@ -35,18 +35,19 @@ | |||
| </if> | |||
| <if test=" null != gameId "> | |||
| and `game_id` = #{gameId} | |||
| and `game_id` = #{gameId} | |||
| </if> | |||
| <if test=" null != userId "> | |||
| and `user_id` = #{userId} | |||
| and `user_id` = #{userId} | |||
| </if> | |||
| <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 test=" null != createTime "> | |||
| @@ -172,11 +173,16 @@ | |||
| group by user_id | |||
| </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 | |||
| 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> | |||
| </mapper> | |||