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

Commit ccad70a2 authored by 张禹's avatar 张禹

Merge branch 'pre' into 'master'

Pre

See merge request !226
parents 22dd369b b1ea0af6
......@@ -4,12 +4,14 @@
<resultMap id="BaseResult" type="com.liquidnet.service.goblin.entity.GoblinGoodsSku">
<result column="spu_id" property="spuId" jdbcType="VARCHAR"/>
<result column="sku_id" property="skuId" jdbcType="VARCHAR"/>
<result column="sku_pic" property="skuPic" jdbcType="VARCHAR"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="unbox" property="unbox" jdbcType="VARCHAR"/>
<result column="hit_ratio" property="hitRatio" jdbcType="DECIMAL"/>
<result column="sku_type" property="skuType" jdbcType="INTEGER"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="shelves_status" property="shelvesStatus" jdbcType="VARCHAR"/>
<result column="sale_stop_time" property="saleStopTime" jdbcType="TIMESTAMP"/>
<result column="sku_appear" property="skuAppear" jdbcType="VARCHAR"/>
<result column="sku_canbuy" property="skuCanbuy" jdbcType="VARCHAR"/>
<result column="del_flg" property="delFlg" jdbcType="VARCHAR"/>
......@@ -25,7 +27,7 @@
</select>
<select id="selectBySkuIds" resultMap="BaseResult">
select sku_id,name,sku_pic,hit_ratio,unbox,sku_type,status,shelves_status,sku_canbuy,sku_appear,del_flg,soldout_status,sale_start_time from goblin_goods_sku where
select sku_id,name,sku_pic,sale_stop_time,hit_ratio,unbox,sku_type,status,shelves_status,sku_canbuy,sku_appear,del_flg,soldout_status,sale_start_time from goblin_goods_sku where
sku_id in
<foreach collection="skuIds.split(',')" item="skuId" open="(" separator="," close=")">
#{skuId,jdbcType=VARCHAR}
......@@ -33,7 +35,7 @@
</select>
<select id="selectBySpuIds" resultMap="BaseResult">
select spu_id,sku_id,hit_ratio,unbox,sku_type,status,shelves_status,sku_appear,del_flg,sku_canbuy,soldout_status,sale_start_time from goblin_goods_sku where
select spu_id,sku_id,sale_stop_time,hit_ratio,unbox,sku_type,status,shelves_status,sku_appear,del_flg,sku_canbuy,soldout_status,sale_start_time from goblin_goods_sku where
spu_id in
<foreach collection="spuIds.split(',')" item="spuId" open="(" separator="," close=")">
#{spuId,jdbcType=VARCHAR}
......
......@@ -90,7 +90,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
ArrayList<String> skuIdList = CollectionUtil.arrayListString();
for (GoblinGoodsSku goblinGoodsSku : goblinGoodsSkuListCheck) {
// 不能购买的 没库存的 概率是0的 过滤
// 不能购买的过滤
if (getSkuAllStatusShow(goblinGoodsSku)) {
skuIdList.add(goblinGoodsSku.getSkuId());
}
......@@ -108,17 +108,37 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// 获取spu下所有sku
List<GoblinGoodsSku> goblinGoodsSkus = goblinGoodsSkuMapper.selectBySpuIds(spuIds.toString());
int countStockNumber = 0;
int checkNumberSku = 0;
for (GoblinGoodsSku goblinGoodsSku : goblinGoodsSkus) {
if (goblinGoodsSku.getUnbox().equals("1")) {
continue;
}
// 判断开售、停售时间
LocalDateTime saleStartTime = goblinGoodsSku.getSaleStartTime();
LocalDateTime saleStopTime = goblinGoodsSku.getSaleStopTime();
LocalDateTime nowTime = LocalDateTime.now();
if (nowTime.isBefore(saleStartTime)) {
continue;
} else if (null != saleStopTime && nowTime.isAfter(saleStopTime)) {
continue;
}
//是否购买
if (!goblinGoodsSku.getSkuCanbuy().equals("1")){
continue;
}
// 不能购买的 没库存的 概率是0的 过滤
if (getSkuAllStatusShow(goblinGoodsSku) && goblinRedisUtils.getSkuAllStatusStock(goblinGoodsSku) > 0 && goblinGoodsSku.getHitRatio() != null) {
countStockNumber += goblinRedisUtils.getSkuStock(goblinGoodsSku.getSkuId());
map.put(goblinGoodsSku.getSkuId(), goblinGoodsSku.getHitRatio());
checkNumberSku++;
}
}
if (checkNumberSku <= 0){
return ResponseDto.failure("盲盒下没有可生成兑换码的sku!");
}
if (countStockNumber < stockNumber) {
ResponseDto.failure("配置库存大于sku总库存!");
}
......@@ -128,6 +148,8 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
List<GoblinNftExCodeTask> goblinNftExCodeTasks = ObjectUtil.getGoblinNftExCodeTaskArrayList();
// 构建对象
for (GoblinNftExSkuParam goblinNftExSkuParam : goblinNftExSkuParams) {
......@@ -230,7 +252,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
// Map<String, Map<String, Object>> mapMap = new HashMap<>();
// sku --> 概率/库存
Integer countStockNumber = 10;
Integer countStockNumber = 0;
HashMap<String, Map<String, Object>> mapMap = CollectionUtil.mapHashMap();
for (String key : map.keySet()) {
BigDecimal skuHitRatio = BigDecimal.valueOf(Double.valueOf(map.get(key).toString()));
......@@ -262,28 +284,28 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Map<String, Map<String, Object>> mapMap = new HashMap<>();
Map<String, Object> objectMap = new HashMap<>();
objectMap.put("hitRatio", 30);
objectMap.put("hitRatio", 20);
objectMap.put("stock", 1000);
mapMap.put("1", objectMap);
Map<String, Object> objectMap1 = new HashMap<>();
objectMap1.put("hitRatio", 30);
objectMap1.put("stock", 1000);
mapMap.put("2", objectMap1);
objectMap1.put("stock", 4);
// mapMap.put("2", objectMap1);
Map<String, Object> objectMap2 = new HashMap<>();
objectMap2.put("hitRatio", 30);
objectMap2.put("stock", 1000);
mapMap.put("3", objectMap2);
// mapMap.put("3", objectMap2);
Map<String, Object> objectMap3 = new HashMap<>();
objectMap3.put("hitRatio", 10);
objectMap3.put("stock", 1000);
mapMap.put("4", objectMap3);
// mapMap.put("4", objectMap3);
Map<String, Integer> stockMap = new HashMap<>();
ArrayList<String> eliminateSkuIdList = CollectionUtil.arrayListString();
getStock(51, new BigDecimal(100), mapMap, stockMap, 1032, eliminateSkuIdList);
getStock(7, new BigDecimal(20), mapMap, stockMap, 1032, eliminateSkuIdList);
for (String key : stockMap.keySet()) {
System.out.println("skuId" + key + "***********数量" + stockMap.get(key));
}
......@@ -389,7 +411,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
&& info.getShelvesStatus().equals("3")
// && (info.getSkuAppear() == null || info.getSkuAppear().equals("0"))
&& info.getDelFlg().equals("0")
&& info.getSkuCanbuy().equals("1")) {
) {
return true;
} else {
return false;
......
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