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

Commit 2e419fc2 authored by zhengfuxin's avatar zhengfuxin

秒杀

parent b0b732ab
...@@ -81,6 +81,10 @@ public class GoblinFrontSeckillVo implements Serializable { ...@@ -81,6 +81,10 @@ public class GoblinFrontSeckillVo implements Serializable {
//活动 //活动
public List<Map> acityList; public List<Map> acityList;
//活动开始 返回前端的时间
private String startTime;
private String endTime;
private static final GoblinFrontSeckillVo obj = new GoblinFrontSeckillVo(); private static final GoblinFrontSeckillVo obj = new GoblinFrontSeckillVo();
......
...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -112,6 +113,10 @@ public class GoblinFrontController { ...@@ -112,6 +113,10 @@ public class GoblinFrontController {
if(type.equals("g")){ if(type.equals("g")){
//找到对应官方的活动 判断时间是否过期, //找到对应官方的活动 判断时间是否过期,
GoblinSelfMarketingVo goblinSelfMarketingVo=goblinRedisUtils.getSelfMarket(idM); GoblinSelfMarketingVo goblinSelfMarketingVo=goblinRedisUtils.getSelfMarket(idM);
if(!StringUtil.isNotBlank(goblinFrontSeckillVo.getStartTime())){
goblinFrontSeckillVo.setStartTime(goblinSelfMarketingVo.getStartTime());
goblinFrontSeckillVo.setEndTime(goblinSelfMarketingVo.getEndTime());
}
if(goblinSelfMarketingVo==null){ if(goblinSelfMarketingVo==null){
break; break;
} }
...@@ -128,11 +133,31 @@ public class GoblinFrontController { ...@@ -128,11 +133,31 @@ public class GoblinFrontController {
for(GoblinMarketRelationVo goblinMarketRelationVo:list1){ for(GoblinMarketRelationVo goblinMarketRelationVo:list1){
//找到对应的spu商品 //找到对应的spu商品
GoblinGoodsInfoVo goblinGoodsInfoVo=goblinRedisUtils.getGoodsInfoVo(goblinMarketRelationVo.getSpuId()); GoblinGoodsInfoVo goblinGoodsInfoVo=goblinRedisUtils.getGoodsInfoVo(goblinMarketRelationVo.getSpuId());
//遍历sku 找到
List<String> skuList=goblinMarketRelationVo.getSkuList();
int sellPrice=0;
int i=0;
for(String skuId:skuList){
GoblinGoodsSkuInfoVo goblinGoodsSkuInfoVo= goblinRedisUtils.getGoodsSkuInfoVo(skuId);
if(null!=goblinGoodsSkuInfoVo){
if(i==0){
sellPrice=goblinGoodsSkuInfoVo.getSellPrice().intValue();
}
if(sellPrice>goblinGoodsSkuInfoVo.getSellPrice().intValue()){
sellPrice=goblinGoodsSkuInfoVo.getSellPrice().intValue();
}
}
}
goblinGoodsInfoVo.setSellPrice(new BigDecimal(sellPrice));
goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo); goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo);
} }
}else if(type.equals("s")){ }else if(type.equals("s")){
//商铺活动的vo //商铺活动的vo
GoblinStoreMarketVo goblinStoreMarketVo=goblinRedisUtils.getGoblinStoreMarketVo(idM); GoblinStoreMarketVo goblinStoreMarketVo=goblinRedisUtils.getGoblinStoreMarketVo(idM);
if(!StringUtil.isNotBlank(goblinFrontSeckillVo.getStartTime())){
goblinFrontSeckillVo.setStartTime(goblinStoreMarketVo.getStartTime());
goblinFrontSeckillVo.setEndTime(goblinStoreMarketVo.getEndTime());
}
if(goblinStoreMarketVo==null){ if(goblinStoreMarketVo==null){
break; break;
} }
...@@ -153,6 +178,22 @@ public class GoblinFrontController { ...@@ -153,6 +178,22 @@ public class GoblinFrontController {
for(GoblinMarketRelationVo goblinMarketRelationVo:list1){ for(GoblinMarketRelationVo goblinMarketRelationVo:list1){
//找到对应的spu商品 //找到对应的spu商品
GoblinGoodsInfoVo goblinGoodsInfoVo=goblinRedisUtils.getGoodsInfoVo(goblinMarketRelationVo.getSpuId()); GoblinGoodsInfoVo goblinGoodsInfoVo=goblinRedisUtils.getGoodsInfoVo(goblinMarketRelationVo.getSpuId());
//遍历sku 找到
List<String> skuList=goblinMarketRelationVo.getSkuList();
int sellPrice=0;
int i=0;
for(String skuId:skuList){
GoblinGoodsSkuInfoVo goblinGoodsSkuInfoVo= goblinRedisUtils.getGoodsSkuInfoVo(skuId);
if(null!=goblinGoodsSkuInfoVo){
if(i==0){
sellPrice=goblinGoodsSkuInfoVo.getSellPrice().intValue();
}
if(sellPrice>goblinGoodsSkuInfoVo.getSellPrice().intValue()){
sellPrice=goblinGoodsSkuInfoVo.getSellPrice().intValue();
}
}
}
goblinGoodsInfoVo.setSellPrice(new BigDecimal(sellPrice));
goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo); goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo);
} }
} }
......
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