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

Commit febe7020 authored by wanglele's avatar wanglele

兑换码sku--->时间

parent dc25f99e
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</select> </select>
<select id="selectBySkuIds" resultMap="BaseResult"> <select id="selectBySkuIds" resultMap="BaseResult">
select sku_id,name,sku_pic from goblin_goods_sku where select sku_id,name,sku_pic,unbox 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}
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<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,activity_id,state,redeem_uid,redeem_at,admin_uid,created_at from goblin_nft_ex_code 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
<where> <where>
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and code = #{code,jdbcType=VARCHAR} and code = #{code,jdbcType=VARCHAR}
......
...@@ -86,7 +86,12 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -86,7 +86,12 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
StringBuffer skuIds = new StringBuffer(); StringBuffer skuIds = new StringBuffer();
StringBuffer acticityIds = new StringBuffer(); StringBuffer acticityIds = new StringBuffer();
for (GoblinNftExCode gnc : goblinNftExCodes) { for (GoblinNftExCode gnc : goblinNftExCodes) {
if (StringUtil.isNotBlank(gnc.getSkuId())){
skuIds.append(gnc.getSkuId()).append(","); skuIds.append(gnc.getSkuId()).append(",");
}else {
skuIds.append(gnc.getBoxSkuId()).append(",");
}
acticityIds.append(gnc.getActivityId()).append(","); acticityIds.append(gnc.getActivityId()).append(",");
} }
...@@ -99,13 +104,22 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -99,13 +104,22 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
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) { for (GoblinGoodsSku goblinGoodsSku : goblinGoodsSkus) {
if (gnc.getSkuId().equals(goblinGoodsSku.getSkuId())) {
GoblinNftExCodeVo goblinNftExCodeVo = GoblinNftExCodeVo.getNew().copy(gnc); GoblinNftExCodeVo goblinNftExCodeVo = GoblinNftExCodeVo.getNew().copy(gnc);
if (StringUtil.isNotBlank(gnc.getBoxSkuId())&&gnc.getBoxSkuId().equals(goblinGoodsSku.getSkuId())){
goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName());
goblinNftExCodeArrayList.add(goblinNftExCodeVo);
break;
}else {
if (gnc.getSkuId().equals(goblinGoodsSku.getSkuId())){
goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName()); goblinNftExCodeVo.setSkuName(goblinGoodsSku.getName());
goblinNftExCodeArrayList.add(goblinNftExCodeVo); goblinNftExCodeArrayList.add(goblinNftExCodeVo);
break; break;
} }
} }
}
} }
} }
...@@ -123,11 +137,19 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService { ...@@ -123,11 +137,19 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
for (GoblinNftExCodeVo gnc : goblinNftExCodeArrayList) { for (GoblinNftExCodeVo gnc : goblinNftExCodeArrayList) {
for (GoblinNftExSku goblinNftExSku:goblinNftExSkus) { List<GoblinNftExSku> goblinNftExSkuList = map.get(gnc.getActivityId());
if (goblinNftExSku.getSkuId().equals(gnc.getSkuId())){ for (GoblinNftExSku goblinNftExSku : goblinNftExSkuList) {
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());
break; break;
}else {
if (gnc.getSkuId().equals(goblinNftExSku.getSkuId())) {
gnc.setExStartTime(goblinNftExSku.getExStartTime());
gnc.setExStopTime(goblinNftExSku.getExStopTime());
break;
}
} }
} }
} }
......
...@@ -104,6 +104,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -104,6 +104,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// 盲盒 概率 // 盲盒 概率
switch (goblinNftExSkuParam.getUnbox()) { switch (goblinNftExSkuParam.getUnbox()) {
case "1": case "1":
// sku ---> 库存 // sku ---> 库存
Map<String, Integer> skuMap = getSkuHitRatio(goblinNftExSkuParam.getExStock(), map); Map<String, Integer> skuMap = getSkuHitRatio(goblinNftExSkuParam.getExStock(), map);
for (String key : skuMap.keySet()) { for (String key : skuMap.keySet()) {
...@@ -146,9 +147,10 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -146,9 +147,10 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// redis 存储 // redis 存储
goblinRedisUtils.addCode(code, goblinNftExCodeVo, millisNum); goblinRedisUtils.addCode(code, goblinNftExCodeVo, millisNum);
goblinNftExCode.setSkuId(key);
} }
goblinNftExSkuParamMap.put(key, goblinNftExSkuParam); goblinNftExSkuParamMap.put(key, goblinNftExSkuParam);
goblinNftExSkus.add(goblinNftExSku);
} }
} }
...@@ -199,13 +201,15 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -199,13 +201,15 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
if (value == null) { if (value == null) {
goblinNftExSkuParamMap.put(goblinNftExSkuParam.getSkuId(), goblinNftExSkuParam); goblinNftExSkuParamMap.put(goblinNftExSkuParam.getSkuId(), goblinNftExSkuParam);
} }
goblinNftExSkus.add(goblinNftExSku);
} }
// goblinNftExSkuArrayList.add(GoblinNftExSkuVo.getNew().copy(goblinNftExSku)); // goblinNftExSkuArrayList.add(GoblinNftExSkuVo.getNew().copy(goblinNftExSku));
} }
goblinNftExSkus.add(goblinNftExSku);
} }
...@@ -251,25 +255,6 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -251,25 +255,6 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
return true; return true;
} }
public static void main(String[] args) {
String time1 = "2019-06-26 19:00:00";
String time2 = "2022-06-26 19:00:00";
String time3 = "2023-06-26 19:00:00";
String time4 = "2024-06-26 19:00:00";
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime localDateTime = LocalDateTime.parse(time1, dtf2);
LocalDateTime localDateTime2 = LocalDateTime.parse(time2, dtf2);
LocalDateTime localDateTime3 = LocalDateTime.parse(time3, dtf2);
LocalDateTime localDateTime4 = LocalDateTime.parse(time4, dtf2);
System.out.println(localDateTime.isAfter(localDateTime2)); // 当time1小于当前时间是返回false
System.out.println(localDateTime3.isAfter(localDateTime4));
}
/** /**
* 获取每个sku的兑换码生成数量 * 获取每个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