记得上下班打卡 | git大法好,push需谨慎

Commit 447afeb1 authored by wanglele's avatar wanglele

兑换活动增加uid

parent 2c6464b8
...@@ -13,16 +13,15 @@ public class PageInfoVo { ...@@ -13,16 +13,15 @@ public class PageInfoVo {
private Object list; private Object list;
public PageInfoVo(){ public PageInfoVo(){
} }
public PageInfoVo(ArrayList<GoblinNftExActivityVo> goblinNftExActivityArrayList, int count,int num) { public PageInfoVo(ArrayList<GoblinNftExActivityVo> goblinNftExActivityArrayList, int count,int num) {
this.list = goblinNftExActivityArrayList; this.list = goblinNftExActivityArrayList;
total= count; this.total= count;
} }
public PageInfoVo(ArrayList<GoblinNftExCodeVo> goblinNftExCodeVos,int count){ public PageInfoVo(ArrayList<GoblinNftExCodeVo> goblinNftExCodeVos,int count,String vio){
this.list = goblinNftExCodeVos; this.list = goblinNftExCodeVos;
total= count; this.total= count;
} }
} }
package com.liquidnet.service.goblin.service; package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.param.GoblinNftExSkuParam; import com.liquidnet.service.goblin.param.GoblinNftExSkuParam;
import java.util.List; import java.util.List;
...@@ -9,5 +10,5 @@ public interface IGoblinNftExSkuService { ...@@ -9,5 +10,5 @@ public interface IGoblinNftExSkuService {
/** /**
* 新增nft兑换活动和sku的关联 * 新增nft兑换活动和sku的关联
*/ */
Boolean add(List<GoblinNftExSkuParam> goblinNftExSkuParams); ResponseDto<Object> add(List<GoblinNftExSkuParam> goblinNftExSkuParams);
} }
...@@ -48,11 +48,11 @@ public interface GoblinNftExActivityMapper extends BaseMapper<GoblinNftExActivit ...@@ -48,11 +48,11 @@ public interface GoblinNftExActivityMapper extends BaseMapper<GoblinNftExActivit
* @param title * @param title
* @return * @return
*/ */
GoblinNftExActivity selectByTitle(@Param("title") String title); GoblinNftExActivity selectByTitle(@Param("title") String title,@Param("uid")String uid);
/** /**
* 获取 * 获取
* @return * @return
*/ */
int selectActivityCount(); int selectActivityCount(@Param("title") String title, @Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime,@Param("uid") String uid);
} }
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</select> </select>
<select id="selectBySkuIds" resultMap="BaseResult"> <select id="selectBySkuIds" resultMap="BaseResult">
select sku_id,name,sku_pic,unbox from goblin_goods_sku where select sku_id,name,sku_pic,hit_ratio,unbox,sku_type,status,shelves_status,sku_appear,del_flg,soldout_status,sale_start_time from goblin_goods_sku where
sku_id in sku_id in
<foreach collection="skuIds.split(',')" item="skuId" open="(" separator="," close=")"> <foreach collection="skuIds.split(',')" item="skuId" open="(" separator="," close=")">
#{skuId,jdbcType=VARCHAR} #{skuId,jdbcType=VARCHAR}
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<select id="selectByTitle" resultMap="BaseResult"> <select id="selectByTitle" resultMap="BaseResult">
select activity_id, uid, title, created_at select activity_id, uid, title, created_at
from goblin_nft_ex_activity from goblin_nft_ex_activity
where title = #{title} where title = #{title} and uid = #{uid}
</select> </select>
<select id="selectPageList" resultMap="BaseResult"> <select id="selectPageList" resultMap="BaseResult">
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
and created_at &lt; #{endTime,jdbcType=TIMESTAMP} and created_at &lt; #{endTime,jdbcType=TIMESTAMP}
</if> </if>
</where> </where>
order by created_at desc
</select> </select>
<select id="selectByActivityId" resultMap="BaseResult"> <select id="selectByActivityId" resultMap="BaseResult">
...@@ -44,7 +45,21 @@ ...@@ -44,7 +45,21 @@
<select id="selectActivityCount" resultType="java.lang.Integer"> <select id="selectActivityCount" resultType="java.lang.Integer">
select count(0) select count(0)
from goblin_nft_ex_activity from goblin_nft_ex_activity
where uid = #{uid} <where>
<if test="uid != null and uid != ''">
and uid = #{uid,jdbcType=VARCHAR}
</if>
<if test="title != null and title != ''">
<bind name="likeTitle" value="'%' + title + '%'"/>
and title like #{likeTitle}
</if>
<if test="startTime != null">
and created_at &gt; #{startTime,jdbcType=TIMESTAMP}
</if>
<if test="endTime != null">
and created_at &lt; #{endTime,jdbcType=TIMESTAMP}
</if>
</where>
</select> </select>
<insert id="addGoblinNftExActivity" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExActivity"> <insert id="addGoblinNftExActivity" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExActivity">
......
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
</select> </select>
<select id="selectGoblinNftCodeByCode" resultMap="BeseResult"> <select id="selectGoblinNftCodeByCode" resultMap="BeseResult">
select code_id, activity_id, code, box_sku_id,state from goblin_nft_ex_code where code = #{code} select code_id, activity_id, code, box_sku_id, state
from goblin_nft_ex_code
where code = #{code}
</select> </select>
<insert id="addGoblinNftExCodes"> <insert id="addGoblinNftExCodes">
...@@ -66,22 +68,35 @@ ...@@ -66,22 +68,35 @@
<select id="selectGoblinNftCode" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExCode" <select id="selectGoblinNftCode" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExCode"
resultMap="BeseResult"> resultMap="BeseResult">
select code_id,code,sku_id,box_sku_id,activity_id,state,redeem_uid,redeem_at,admin_uid,created_at from goblin_nft_ex_code select
<where> DISTINCT gnec.code,gnec.code_id,gnec.sku_id,gnec.box_sku_id,gnec.activity_id,gnec.state,gnec.redeem_uid,gnec.redeem_at,gnec.admin_uid,gnec.created_at
from goblin_nft_ex_code gnec inner join goblin_nft_ex_sku gnes on gnec.sku_id = gnes.sku_id
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and code = #{code,jdbcType=VARCHAR} and gnec.code = #{code,jdbcType=VARCHAR}
</if> </if>
<if test="activityId != null and activityId != ''"> <if test="activityId != null and activityId != ''">
and activity_id = #{activityId,jdbcType=VARCHAR} and gnec.activity_id = #{activityId,jdbcType=VARCHAR}
</if> </if>
<if test="state != null"> <if test="state != null">
and state = #{state,jdbcType=INTEGER} <choose>
<when test="state == 1">
and gnec.sku_id = gnes.sku_id and (now() BETWEEN gnes.ex_start_time and gnes.ex_stop_time) and
gnec.state =1
</when>
<when test="state == 2">
and gnec.state = 2
</when>
<when test="state == 3">
and gnec.sku_id = gnes.sku_id and (((now() &gt; gnes.ex_stop_time) AND gnec.state = 1) ||
gnec.state = 3)
</when>
</choose>
</if> </if>
<if test="redeemUid != null and redeemUid != ''"> <if test="redeemUid != null and redeemUid != ''">
and redeem_uid = #{redeemUid,jdbcType=VARCHAR} and gnec.redeem_uid = #{redeemUid,jdbcType=VARCHAR}
</if> </if>
<if test="skuId != null and skuId != ''"> <if test="skuId != null and skuId != ''">
and sku_id in and gnec.sku_id in
<foreach collection="skuId.split(',')" item="sId" open="(" separator="," close=")"> <foreach collection="skuId.split(',')" item="sId" open="(" separator="," close=")">
#{sId,jdbcType=VARCHAR} #{sId,jdbcType=VARCHAR}
</foreach> </foreach>
...@@ -89,34 +104,47 @@ ...@@ -89,34 +104,47 @@
<if test="isDrivi != null"> <if test="isDrivi != null">
<choose> <choose>
<when test="isDrivi == 1"> <when test="isDrivi == 1">
and admin_uid = '' and gnec.admin_uid = ''
</when> </when>
<when test="isDrivi == 2"> <when test="isDrivi == 2">
and admin_uid != '' and gnec.admin_uid != ''
</when> </when>
</choose> </choose>
</if> </if>
</where>
</select> </select>
<select id="selectGoblinNftCodeCount" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExCode" <select id="selectGoblinNftCodeCount" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExCode"
resultType="java.lang.Integer"> resultType="java.lang.Integer">
select count(0) from goblin_nft_ex_code select count(DISTINCT gnec.code)
<where> from goblin_nft_ex_code gnec inner join goblin_nft_ex_sku gnes
on
gnec.sku_id = gnes.sku_id
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and code = #{code,jdbcType=VARCHAR} and gnec.code = #{code,jdbcType=VARCHAR}
</if> </if>
<if test="activityId != null and activityId != ''"> <if test="activityId != null and activityId != ''">
and activity_id = #{activityId,jdbcType=VARCHAR} and gnec.activity_id = #{activityId,jdbcType=VARCHAR}
</if> </if>
<if test="state != null"> <if test="state != null">
and state = #{state,jdbcType=INTEGER} <choose>
<when test="state == 1">
and gnec.sku_id = gnes.sku_id and (now() BETWEEN gnes.ex_start_time and gnes.ex_stop_time) and
gnec.state =1
</when>
<when test="state == 2">
and gnec.state = 2
</when>
<when test="state == 3">
and gnec.sku_id = gnes.sku_id and (((now() &gt; gnes.ex_stop_time) AND gnec.state = 1) ||
gnec.state = 3)
</when>
</choose>
</if> </if>
<if test="redeemUid != null and redeemUid != ''"> <if test="redeemUid != null and redeemUid != ''">
and redeem_uid = #{redeemUid,jdbcType=VARCHAR} and gnec.redeem_uid = #{redeemUid,jdbcType=VARCHAR}
</if> </if>
<if test="skuId != null and skuId != ''"> <if test="skuId != null and skuId != ''">
and sku_id in and gnec.sku_id in
<foreach collection="skuId.split(',')" item="sId" open="(" separator="," close=")"> <foreach collection="skuId.split(',')" item="sId" open="(" separator="," close=")">
#{sId,jdbcType=VARCHAR} #{sId,jdbcType=VARCHAR}
</foreach> </foreach>
...@@ -124,14 +152,13 @@ ...@@ -124,14 +152,13 @@
<if test="isDrivi != null"> <if test="isDrivi != null">
<choose> <choose>
<when test="isDrivi == 1"> <when test="isDrivi == 1">
and admin_uid = '' and gnec.admin_uid = ''
</when> </when>
<when test="isDrivi == 2"> <when test="isDrivi == 2">
and admin_uid != '' and gnec.admin_uid != ''
</when> </when>
</choose> </choose>
</if> </if>
</where>
</select> </select>
<select id="selectByActivityIds" resultMap="BeseResult"> <select id="selectByActivityIds" resultMap="BeseResult">
......
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
<foreach collection="activityIds.split(',')" item="activityId" open="(" separator="," close=")"> <foreach collection="activityIds.split(',')" item="activityId" open="(" separator="," close=")">
#{activityId} #{activityId}
</foreach> </foreach>
group by activity_id
</select> </select>
<insert id="addGoblinNftExCodeTasks"> <insert id="addGoblinNftExCodeTasks">
......
...@@ -26,12 +26,11 @@ CREATE TABLE `goblin_nft_ex_code` ...@@ -26,12 +26,11 @@ CREATE TABLE `goblin_nft_ex_code`
INDEX `idx_nft_redeem_uid`(`redeem_uid`) USING BTREE INDEX `idx_nft_redeem_uid`(`redeem_uid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'NFT兑换码表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'NFT兑换码表' ROW_FORMAT = Dynamic;
-- >>------------------------------------------------------------------------------------
DROP TABLE IF EXISTS `goblin_nft_ex_activity`; DROP TABLE IF EXISTS `goblin_nft_ex_activity`;
CREATE TABLE `goblin_nft_ex_activity` CREATE TABLE `goblin_nft_ex_activity`
( (
`mid` bigint(0) UNSIGNED NOT NULL AUTO_INCREMENT, `mid` bigint(0) UNSIGNED NOT NULL AUTO_INCREMENT,
`uid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`activity_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '活动id', `activity_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '活动id',
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '活动标题', `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '活动标题',
`created_at` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', `created_at` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
...@@ -40,6 +39,8 @@ CREATE TABLE `goblin_nft_ex_activity` ...@@ -40,6 +39,8 @@ CREATE TABLE `goblin_nft_ex_activity`
INDEX `idx_nft_activity_id`(`activity_id`) USING BTREE INDEX `idx_nft_activity_id`(`activity_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'NFT兑换活动表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'NFT兑换活动表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `goblin_nft_ex_sku`; DROP TABLE IF EXISTS `goblin_nft_ex_sku`;
CREATE TABLE `goblin_nft_ex_sku` CREATE TABLE `goblin_nft_ex_sku`
( (
......
...@@ -55,7 +55,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -55,7 +55,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
// 根据名称查询 // 根据名称查询
String title = goblinNftExActivityParam.getTitle(); String title = goblinNftExActivityParam.getTitle();
GoblinNftExActivity goblinNftExActivityShow = goblinNftExActivityMapper.selectByTitle(title); GoblinNftExActivity goblinNftExActivityShow = goblinNftExActivityMapper.selectByTitle(title,goblinNftExActivityParam.getUid());
if (goblinNftExActivityShow != null) { if (goblinNftExActivityShow != null) {
return ResponseDto.failure("活动名称已存在!"); return ResponseDto.failure("活动名称已存在!");
} }
...@@ -86,8 +86,9 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -86,8 +86,9 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(), List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(),
goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid()); goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid());
// // 获取活动数量
int count = goblinNftExActivityMapper.selectActivityCount(); int count = goblinNftExActivityMapper.selectActivityCount(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(),
goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid());
log.debug("#MYS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#MYS耗时:{}ms", System.currentTimeMillis() - s);
...@@ -236,6 +237,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -236,6 +237,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
* 获取分页nft兑换活动数据 * 获取分页nft兑换活动数据
*/ */
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
PageHelper.startPage(goblinNftExActivityParam.getPageNum(), 20, true);
List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(), List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(),
goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid()); goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid());
log.debug("#MYS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#MYS耗时:{}ms", System.currentTimeMillis() - s);
...@@ -286,7 +288,6 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -286,7 +288,6 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
log.error("导出excel失败!"); log.error("导出excel失败!");
} }
} }
......
...@@ -108,33 +108,29 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -108,33 +108,29 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
} else { } else {
skuIds.append(gnc.getBoxSkuId()).append(","); skuIds.append(gnc.getBoxSkuId()).append(",");
} }
acticityIds.append(gnc.getActivityId()).append(","); acticityIds.append(gnc.getActivityId()).append(",");
} }
// 获取返回对象实例 // 获取返回对象实例
ArrayList<GoblinNftExCodeVo> goblinNftExCodeArrayList = ObjectUtil.getGoblinNftExCodeArrayList(); ArrayList<GoblinNftExCodeVo> goblinNftExCodeArrayList = ObjectUtil.getGoblinNftExCodeArrayList();
if (StringUtil.isNotBlank(skuIds)) { if (StringUtil.isNotBlank(skuIds)) {
// 批量查询 // 批量查询
List<GoblinGoodsSku> goblinGoodsSkus = goblinGoodsSkuMapper.selectBySkuIds(skuIds.toString()); List<GoblinGoodsSku> goblinGoodsSkus = goblinGoodsSkuMapper.selectBySkuIds(skuIds.toString());
for (GoblinNftExCode gnc : goblinNftExCodes) { for (GoblinNftExCode gnc : goblinNftExCodes) {
for (GoblinGoodsSku goblinGoodsSku : goblinGoodsSkus) {
GoblinNftExCodeVo goblinNftExCodeVo = GoblinNftExCodeVo.getNew().copy(gnc); GoblinNftExCodeVo goblinNftExCodeVo = GoblinNftExCodeVo.getNew().copy(gnc);
for (GoblinGoodsSku goblinGoodsSku : goblinGoodsSkus) {
if (StringUtil.isNotBlank(gnc.getBoxSkuId()) && gnc.getBoxSkuId().equals(goblinGoodsSku.getSkuId())) { if (StringUtil.isNotBlank(gnc.getBoxSkuId()) && gnc.getBoxSkuId().equals(goblinGoodsSku.getSkuId())) {
goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName()); goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName());
goblinNftExCodeArrayList.add(goblinNftExCodeVo);
break; break;
} else { } else {
if (gnc.getSkuId().equals(goblinGoodsSku.getSkuId())) { if (gnc.getSkuId().equals(goblinGoodsSku.getSkuId())) {
goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName()); goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName());
goblinNftExCodeArrayList.add(goblinNftExCodeVo);
break; break;
} }
} }
} }
goblinNftExCodeArrayList.add(goblinNftExCodeVo);
} }
} }
...@@ -158,7 +154,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -158,7 +154,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
if (StringUtil.isNotBlank(gnc.getBoxSkuId()) && gnc.getSkuId().equals(goblinNftExSku.getSkuId())) { if (StringUtil.isNotBlank(gnc.getBoxSkuId()) && gnc.getSkuId().equals(goblinNftExSku.getSkuId())) {
gnc.setExStartTime(goblinNftExSku.getExStartTime()); gnc.setExStartTime(goblinNftExSku.getExStartTime());
gnc.setExStopTime(goblinNftExSku.getExStopTime()); gnc.setExStopTime(goblinNftExSku.getExStopTime());
if (now.isBefore(goblinNftExSku.getExStartTime()) || now.isAfter(goblinNftExSku.getExStopTime())) { if (now.isAfter(goblinNftExSku.getExStopTime())) {
gnc.setState(3); gnc.setState(3);
} }
break; break;
...@@ -166,7 +162,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -166,7 +162,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
if (gnc.getSkuId().equals(goblinNftExSku.getSkuId())) { if (gnc.getSkuId().equals(goblinNftExSku.getSkuId())) {
gnc.setExStartTime(goblinNftExSku.getExStartTime()); gnc.setExStartTime(goblinNftExSku.getExStartTime());
gnc.setExStopTime(goblinNftExSku.getExStopTime()); gnc.setExStopTime(goblinNftExSku.getExStopTime());
if (now.isBefore(goblinNftExSku.getExStartTime()) || now.isAfter(goblinNftExSku.getExStopTime())) { if (now.isAfter(goblinNftExSku.getExStopTime())) {
gnc.setState(3); gnc.setState(3);
} }
break; break;
...@@ -175,7 +171,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -175,7 +171,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
} }
} }
PageInfoVo pageInfo = new PageInfoVo(goblinNftExCodeArrayList, count); PageInfoVo pageInfo = new PageInfoVo(goblinNftExCodeArrayList, count,"");
return pageInfo; return pageInfo;
} }
...@@ -213,11 +209,11 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -213,11 +209,11 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
goblinRedisUtils.removeCode(goblinNftExCode.getCode()); goblinRedisUtils.removeCode(goblinNftExCode.getCode());
} }
if (skuMap.size() > 0) { /* if (skuMap.size() > 0) {
for (String key : skuMap.keySet()) { for (String key : skuMap.keySet()) {
// goblinRedisUtils.incrSkuStock(null, key, skuMap.get(key)); // goblinRedisUtils.incrSkuStock(null, key, skuMap.get(key));
} }
} }*/
// 批量修改 // 批量修改
goblinNftExCodeMapper.updateCodes(goblinNftExCodes); goblinNftExCodeMapper.updateCodes(goblinNftExCodes);
return true; return true;
......
...@@ -10,6 +10,7 @@ import com.liquidnet.commons.lang.util.JsonUtils; ...@@ -10,6 +10,7 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil; import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto; import com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto; import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
...@@ -116,6 +117,9 @@ public class GoblinRedisUtils { ...@@ -116,6 +117,9 @@ public class GoblinRedisUtils {
return (int) getRedis().incr(rk, stock); return (int) getRedis().incr(rk, stock);
} }
// 获取sku库存
// 减少库存 // 减少库存
public int decrSkuStock(String marketPre, String skuId, Integer stock){ public int decrSkuStock(String marketPre, String skuId, Integer stock){
String rk = GoblinRedisConst.REAL_STOCK_SKU; String rk = GoblinRedisConst.REAL_STOCK_SKU;
...@@ -225,7 +229,7 @@ public class GoblinRedisUtils { ...@@ -225,7 +229,7 @@ public class GoblinRedisUtils {
public int getSkuAllStatusStock(GoblinGoodsSku info) { public int getSkuAllStatusStock(GoblinGoodsSku info) {
if ( if (
info != null info != null
&& LocalDateTime.now().isAfter(info.getSaleStartTime()) // && LocalDateTime.now().isAfter(info.getSaleStartTime())
&& (null == info.getSoldoutStatus() || info.getSoldoutStatus().equals("0")) && (null == info.getSoldoutStatus() || info.getSoldoutStatus().equals("0"))
&& (null == info.getHitRatio() || info.getHitRatio().compareTo(BigDecimal.ZERO) > 0) && (null == info.getHitRatio() || info.getHitRatio().compareTo(BigDecimal.ZERO) > 0)
) {// 可以返回库存 ) {// 可以返回库存
...@@ -237,7 +241,6 @@ public class GoblinRedisUtils { ...@@ -237,7 +241,6 @@ public class GoblinRedisUtils {
} }
} }
/** /**
* redis codes主动失效 * redis codes主动失效
* @param code * @param code
...@@ -272,6 +275,26 @@ public class GoblinRedisUtils { ...@@ -272,6 +275,26 @@ public class GoblinRedisUtils {
return getRedis().set(key,goblinNftExSkuVo); return getRedis().set(key,goblinNftExSkuVo);
} }
/**
* 获取sku库存
* @param skuId
* @return
*/
public int getSkuStock(String skuId) {
String rk = GoblinRedisConst.REAL_STOCK_SKU.concat(skuId);
Object obj = getRedis().get(rk);
if (obj == null) {
return 0;
} else {
return (int) obj;
}
}
// 获取sku配置库存
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment