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

Commit ddabf002 authored by wanglele's avatar wanglele

兑换活动增加uid

parent 3aca768f
...@@ -25,7 +25,7 @@ import java.util.List; ...@@ -25,7 +25,7 @@ import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class GoblinNftExActivityVo implements Serializable,Cloneable { public class GoblinNftExActivityVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -37,74 +37,80 @@ public class GoblinNftExActivityVo implements Serializable,Cloneable { ...@@ -37,74 +37,80 @@ public class GoblinNftExActivityVo implements Serializable,Cloneable {
/** /**
* 活动id * 活动id
*/ */
@ApiModelProperty(position = 10,required = true,value ="活动id") @ApiModelProperty(position = 10, required = true, value = "活动id")
private String activityId; private String activityId;
/**
* 用户id
*/
@ApiModelProperty(position = 11, required = true, value = "用户id")
private String uid;
/** /**
* 活动标题 * 活动标题
*/ */
@ExcelProperty(value = "活动标题", index = 0)//”0“表示excel中的第一列 @ExcelProperty(value = "活动标题", index = 0)//”0“表示excel中的第一列
@ApiModelProperty(position = 11,required = true,value ="活动标题") @ApiModelProperty(position = 12, required = true, value = "活动标题")
private String title; private String title;
/** /**
* 创建时间 * 创建时间
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
@ApiModelProperty(position = 12,required = true,value ="创建时间") @ApiModelProperty(position = 13, required = true, value = "创建时间")
private LocalDateTime createdAt; private LocalDateTime createdAt;
/** /**
* 更新时间 * 更新时间
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
@ApiModelProperty(position = 13,required = true,value ="更新时间") @ApiModelProperty(position = 14, required = true, value = "更新时间")
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
/** /**
* 总数量 * 总数量
*/ */
@ExcelProperty(value = "优惠券总数量", index = 2)//”0“表示excel中的第一列 @ExcelProperty(value = "优惠券总数量", index = 2)//”0“表示excel中的第一列
@ApiModelProperty(position = 14,required = true,value ="总数量") @ApiModelProperty(position = 15, required = true, value = "总数量")
private Integer countNumber; private Integer countNumber;
/** /**
* 使用数量 * 使用数量
*/ */
@ExcelProperty(value = "优惠券使用数量", index = 3)//”0“表示excel中的第一列 @ExcelProperty(value = "优惠券使用数量", index = 3)//”0“表示excel中的第一列
@ApiModelProperty(position = 15,required = true,value ="使用数量") @ApiModelProperty(position = 16, required = true, value = "使用数量")
private Integer useNumber; private Integer useNumber;
/** /**
* 未使用数量 * 未使用数量
*/ */
@ExcelProperty(value = "兑换码未使用数量", index = 4)//”0“表示excel中的第一列 @ExcelProperty(value = "兑换码未使用数量", index = 4)//”0“表示excel中的第一列
@ApiModelProperty(position = 16,required = true,value ="未使用数量") @ApiModelProperty(position = 17, required = true, value = "未使用数量")
private Integer unUseNumber; private Integer unUseNumber;
/** /**
* *
*/ */
@ApiModelProperty(position = 18,required = true,value ="是否展示生效中 0:否 1:是") @ApiModelProperty(position = 18, required = true, value = "是否展示生效中 0:否 1:是")
private Integer isDisplay; private Integer isDisplay;
private final static GoblinNftExActivityVo obj = new GoblinNftExActivityVo(); private final static GoblinNftExActivityVo obj = new GoblinNftExActivityVo();
public static GoblinNftExActivityVo getNew(){ public static GoblinNftExActivityVo getNew() {
try { try {
return (GoblinNftExActivityVo) obj.clone(); return (GoblinNftExActivityVo) obj.clone();
}catch (CloneNotSupportedException e){ } catch (CloneNotSupportedException e) {
return new GoblinNftExActivityVo(); return new GoblinNftExActivityVo();
} }
} }
public GoblinNftExActivityVo copy(GoblinNftExActivity goblinNftExActivity){ public GoblinNftExActivityVo copy(GoblinNftExActivity goblinNftExActivity) {
if (null == goblinNftExActivity) return this; if (null == goblinNftExActivity) return this;
this.setActivityId(goblinNftExActivity.getActivityId()); this.setActivityId(goblinNftExActivity.getActivityId());
this.setUid(goblinNftExActivity.getUid());
this.setTitle(goblinNftExActivity.getTitle()); this.setTitle(goblinNftExActivity.getTitle());
this.setCreatedAt(goblinNftExActivity.getCreatedAt()); this.setCreatedAt(goblinNftExActivity.getCreatedAt());
this.setUpdatedAt(goblinNftExActivity.getUpdatedAt()); this.setUpdatedAt(goblinNftExActivity.getUpdatedAt());
......
...@@ -21,6 +21,9 @@ public class GoblinNftExActivityParam implements Serializable { ...@@ -21,6 +21,9 @@ public class GoblinNftExActivityParam implements Serializable {
@ApiModelProperty(position = 11,required = true,value = "活动标题" ,example = "草莓音乐节") @ApiModelProperty(position = 11,required = true,value = "活动标题" ,example = "草莓音乐节")
private String title; private String title;
@ApiModelProperty(position = 12,required = true,value = "用户id",example = "用户id")
private String uid;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
@ApiModelProperty(position = 12,required = false,value = "开始时间") @ApiModelProperty(position = 12,required = false,value = "开始时间")
private LocalDateTime startTime; private LocalDateTime startTime;
......
...@@ -30,6 +30,8 @@ public class GoblinNftExActivity implements Serializable,Cloneable { ...@@ -30,6 +30,8 @@ public class GoblinNftExActivity implements Serializable,Cloneable {
*/ */
private String activityId; private String activityId;
private String uid;
/** /**
* 活动标题 * 活动标题
*/ */
......
...@@ -34,7 +34,7 @@ public interface GoblinNftExActivityMapper extends BaseMapper<GoblinNftExActivit ...@@ -34,7 +34,7 @@ public interface GoblinNftExActivityMapper extends BaseMapper<GoblinNftExActivit
* @param endTime * @param endTime
* @return * @return
*/ */
List<GoblinNftExActivity> selectPageList(@Param("title") String title, @Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime); List<GoblinNftExActivity> selectPageList(@Param("title") String title, @Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime,@Param("uid")String uid);
/** /**
* 根据活动ids 获取活动 * 根据活动ids 获取活动
......
...@@ -4,18 +4,24 @@ ...@@ -4,18 +4,24 @@
<resultMap id="BaseResult" type="com.liquidnet.service.goblin.entity.GoblinNftExActivity"> <resultMap id="BaseResult" type="com.liquidnet.service.goblin.entity.GoblinNftExActivity">
<result column="activity_id" property="activityId" jdbcType="VARCHAR"/> <result column="activity_id" property="activityId" jdbcType="VARCHAR"/>
<result column="uid" property="uid" jdbcType="VARCHAR"/>
<result column="title" property="title" jdbcType="VARCHAR"/> <result column="title" property="title" jdbcType="VARCHAR"/>
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/> <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
<result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/> <result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<select id="selectByTitle" resultMap="BaseResult"> <select id="selectByTitle" resultMap="BaseResult">
select activity_id,title,created_at from goblin_nft_ex_activity where title = #{title} select activity_id, uid, title, created_at
from goblin_nft_ex_activity
where title = #{title}
</select> </select>
<select id="selectPageList" resultMap="BaseResult"> <select id="selectPageList" resultMap="BaseResult">
select activity_id,title,created_at from goblin_nft_ex_activity select activity_id,uid,title,created_at from goblin_nft_ex_activity
<where> <where>
<if test="uid != null and uid != ''">
and uid = #{uid,jdbcType=VARCHAR}
</if>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
<bind name="likeTitle" value="'%' + title + '%'"/> <bind name="likeTitle" value="'%' + title + '%'"/>
and title like #{likeTitle} and title like #{likeTitle}
...@@ -30,11 +36,15 @@ ...@@ -30,11 +36,15 @@
</select> </select>
<select id="selectByActivityId" resultMap="BaseResult"> <select id="selectByActivityId" resultMap="BaseResult">
select activity_id,title,created_at from goblin_nft_ex_activity where activity_id = #{activityId} select activity_id, title, created_at
from goblin_nft_ex_activity
where activity_id = #{activityId,jdbcType=VARCHAR}
</select> </select>
<select id="selectActivityCount" resultType="java.lang.Integer"> <select id="selectActivityCount" resultType="java.lang.Integer">
select count(0) from goblin_nft_ex_activity select count(0)
from goblin_nft_ex_activity
where uid = #{uid}
</select> </select>
<insert id="addGoblinNftExActivity" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExActivity"> <insert id="addGoblinNftExActivity" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExActivity">
...@@ -43,6 +53,9 @@ ...@@ -43,6 +53,9 @@
<if test="activityId != null and activityId != null"> <if test="activityId != null and activityId != null">
activity_id, activity_id,
</if> </if>
<if test="uid != null and uid != ''">
uid,
</if>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
title, title,
</if> </if>
...@@ -53,6 +66,9 @@ ...@@ -53,6 +66,9 @@
<if test="activityId != null and activityId != null"> <if test="activityId != null and activityId != null">
#{activityId,jdbcType=VARCHAR}, #{activityId,jdbcType=VARCHAR},
</if> </if>
<if test="uid != null and uid != ''">
#{uid,jdbcType=VARCHAR},
</if>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
#{title,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
</if> </if>
......
...@@ -65,6 +65,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -65,6 +65,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
BeanUtils.copyProperties(goblinNftExActivityParam, goblinNftExActivity); BeanUtils.copyProperties(goblinNftExActivityParam, goblinNftExActivity);
goblinNftExActivity.setActivityId(IDGenerator.nextSnowId()); goblinNftExActivity.setActivityId(IDGenerator.nextSnowId());
goblinNftExActivity.setCreatedAt(now); goblinNftExActivity.setCreatedAt(now);
goblinNftExActivity.setUid(goblinNftExActivityParam.getUid());
// mysql数据 // mysql数据
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
goblinNftExActivityMapper.addGoblinNftExActivity(goblinNftExActivity); goblinNftExActivityMapper.addGoblinNftExActivity(goblinNftExActivity);
...@@ -83,7 +84,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -83,7 +84,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
*/ */
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(), List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(),
goblinNftExActivityParam.getEndTime()); goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid());
// //
int count = goblinNftExActivityMapper.selectActivityCount(); int count = goblinNftExActivityMapper.selectActivityCount();
...@@ -188,7 +189,6 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -188,7 +189,6 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
} }
codeMap.get(goblinNftExCode.getSkuId()).add(goblinNftExCode); codeMap.get(goblinNftExCode.getSkuId()).add(goblinNftExCode);
} }
} }
...@@ -237,7 +237,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi ...@@ -237,7 +237,7 @@ public class GoblinNftExActivityServiceImpl implements IGoblinNftExActivityServi
*/ */
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(), List<GoblinNftExActivity> goblinNftExActivities = goblinNftExActivityMapper.selectPageList(goblinNftExActivityParam.getTitle(), goblinNftExActivityParam.getStartTime(),
goblinNftExActivityParam.getEndTime()); goblinNftExActivityParam.getEndTime(), goblinNftExActivityParam.getUid());
log.debug("#MYS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#MYS耗时:{}ms", System.currentTimeMillis() - s);
StringBuffer activityIds = new StringBuffer(); StringBuffer activityIds = new StringBuffer();
......
...@@ -134,8 +134,6 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -134,8 +134,6 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
break; break;
} }
} }
} }
} }
} }
...@@ -153,25 +151,30 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -153,25 +151,30 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
} }
LocalDateTime now = LocalDateTime.now();
for (GoblinNftExCodeVo gnc : goblinNftExCodeArrayList) { for (GoblinNftExCodeVo gnc : goblinNftExCodeArrayList) {
List<GoblinNftExSku> goblinNftExSkuList = map.get(gnc.getActivityId()); List<GoblinNftExSku> goblinNftExSkuList = map.get(gnc.getActivityId());
for (GoblinNftExSku goblinNftExSku : goblinNftExSkuList) { for (GoblinNftExSku goblinNftExSku : goblinNftExSkuList) {
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())) {
gnc.setState(3);
}
break; break;
} else { } else {
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())) {
gnc.setState(3);
}
break; break;
} }
} }
} }
} }
PageInfoVo pageInfo = new PageInfoVo(goblinNftExCodeArrayList, count); PageInfoVo pageInfo = new PageInfoVo(goblinNftExCodeArrayList, count);
return pageInfo; return pageInfo;
...@@ -266,7 +269,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -266,7 +269,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
goblinNftExCode.setAdminUid(goblinNftExCodeParam.getAdminUid()); goblinNftExCode.setAdminUid(goblinNftExCodeParam.getAdminUid());
goblinNftExCodeMapper.updateCodeAdminUid(goblinNftExCode); goblinNftExCodeMapper.updateCodeAdminUid(goblinNftExCode);
return ResponseDto.success(true); return ResponseDto.success(true);
}else { } else {
return ResponseDto.failure(rsp.getMessage()); return ResponseDto.failure(rsp.getMessage());
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -123,6 +123,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -123,6 +123,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// sku ---> 库存 // sku ---> 库存
Map<String, Integer> skuMap = getSkuHitRatio(goblinNftExSkuParam.getExStock(), map); Map<String, Integer> skuMap = getSkuHitRatio(goblinNftExSkuParam.getExStock(), map);
if (skuMap.size() > 0){
Integer sNumber = 0; Integer sNumber = 0;
for (String key : skuMap.keySet()) { for (String key : skuMap.keySet()) {
Integer stockNum = skuMap.get(key); Integer stockNum = skuMap.get(key);
...@@ -142,6 +143,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -142,6 +143,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
} }
goblinNftExCodeTaskRelationMapper.inserts(goblinNftExCodeTaskRelations); goblinNftExCodeTaskRelationMapper.inserts(goblinNftExCodeTaskRelations);
goblinNftExCodeTask.setExStock(sNumber); goblinNftExCodeTask.setExStock(sNumber);
}
} else { } else {
int stock = goblinRedisUtils.decrSkuStock(null, goblinNftExSkuParam.getSkuId(), goblinNftExSkuParam.getExStock()); int stock = goblinRedisUtils.decrSkuStock(null, goblinNftExSkuParam.getSkuId(), goblinNftExSkuParam.getExStock());
......
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