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

Commit b7495299 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents df2ab097 15696cb6
......@@ -21,7 +21,7 @@ public class GoblinStorePurchaseCommonParam {
@ApiModelProperty(required = true, value = "spuId", example = "1")
@NotBlank(message = "spuId不能空")
private String spuId;
@ApiModelProperty(required = true, value = "相关配置", example = "1")
@ApiModelProperty(required = true, value = "相关配置")
private List<GoblinStorePurchaseItemParam> goblinStorePurchaseItemParam;
}
......
......@@ -18,7 +18,7 @@ public class GoblinStorePurchaseItemParam {
private BigDecimal priceMarketing;
@ApiModelProperty(required = true, value = "活动库存", example = "1.00")
@NotBlank(message = "活动库存不能为空")
private String stockMarketing;
private Integer stockMarketing;
@ApiModelProperty(required = true, value = "用户限购[0-不限购|x-限购数量]", example = "1")
@NotBlank(message = "用户限购类型不能为空")
private Integer buyLimit;
......
......@@ -30,9 +30,9 @@ public class GoblinStorePurchaseSkuVo implements Serializable, Cloneable {
@ApiModelProperty(position = 6, value = "限量[0-无限制|X:限购数量]")
private Integer buyLimit;
@ApiModelProperty(position = 7, value = "购买限制[0-全部用户|1-仅会员|2-指定用户]")
private Integer buyFactor;
private String buyFactor;
@ApiModelProperty(position = 8, value = "购买限制人员名单[购买限制为2-指定用户时必填]")
private Integer buyRoster;
private String buyRoster;
......
package com.liquidnet.service.goblin.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -50,14 +51,14 @@ public class GoblinFrontBannerBuildParam implements Serializable {
* 开启时间
*/
@ApiModelProperty(value = "开启时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime startTime;
/**
* 结束时间
*/
@ApiModelProperty(value = "结束时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime endTime;
/**
......@@ -82,14 +83,14 @@ public class GoblinFrontBannerBuildParam implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createTime;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime;
/**
......
package com.liquidnet.service.goblin.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -62,12 +64,14 @@ public class GoblinFrontHotWordBuildParam implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createTime;
/**
* 修改时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime;
/**
......
package com.liquidnet.service.goblin.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -80,12 +82,14 @@ public class GoblinFrontNavigationBuildParam implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createTime;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime;
/**
......
package com.liquidnet.service.goblin.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -49,12 +53,14 @@ public class GoblinFrontSeckillBuildParam implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createTime;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime;
/**
......@@ -75,6 +81,18 @@ public class GoblinFrontSeckillBuildParam implements Serializable {
@ApiModelProperty(value = "秒杀id")
private String seckilId;
//活动
public List<Map> acityList;
private static final GoblinFrontSeckillBuildParam obj = new GoblinFrontSeckillBuildParam();
public static GoblinFrontSeckillBuildParam getNew() {
try {
return (GoblinFrontSeckillBuildParam) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinFrontSeckillBuildParam();
}
}
}
......@@ -104,8 +104,8 @@ public interface IGoblinStorePurchasingService {
* 删除活动内sku
*
* @param marketId 活动秒杀id
* @param skuId skuId
* @param spuId spuId
* @return
*/
ResponseDto<Boolean> purchasingSkuDel(String marketId, String storeId,String spuId);
ResponseDto<Boolean> purchasingSpuDel(String marketId, String storeId, String spuId);
}
......@@ -138,11 +138,12 @@ public class GoblinFrontSeckillController extends BaseController {
@PostMapping("page")
@ApiOperation(value = "分页")
@ResponseBody
public AjaxResult page( @RequestParam(name = "pageSize", required = true) int pageSize,@RequestParam(name = "pageNumber", required = true)int pageNumber,@RequestBody GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam) {
GoblinFrontSeckill goblinFrontSeckill=new GoblinFrontSeckill();
//@RequestParam(name = "pageSize", required = true) int pageSize,@RequestParam(name = "pageNumber", required = true)int pageNumber,@RequestBody GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam
public AjaxResult page( ) {
/*GoblinFrontSeckill goblinFrontSeckill=new GoblinFrontSeckill();
BeanUtils.copyProperties(goblinFrontSeckillBuildParam,goblinFrontSeckill);
logger.info("限时秒杀分页{}", JSON.toJSONString(goblinFrontSeckill));
return AjaxResult.success(goblinFrontSeckillService.page(pageSize,pageNumber,null));
logger.info("限时秒杀分页{}", JSON.toJSONString(goblinFrontSeckill));*/
return AjaxResult.success(goblinFrontSeckillService.page());
}
/**
......
......@@ -4,18 +4,20 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontSeckillService;
import com.liquidnet.common.cache.redis.util.RedisGoblinUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.entity.GoblinFrontSeckill;
import com.liquidnet.service.goblin.entity.GoblinSelfMarketing;
import com.liquidnet.service.goblin.entity.GoblinStoreMarketing;
import com.liquidnet.service.goblin.mapper.GoblinFrontSeckillMapper;
import com.liquidnet.service.goblin.mapper.GoblinSelfMarketingMapper;
import com.liquidnet.service.goblin.mapper.GoblinStoreMarketingMapper;
import com.liquidnet.service.goblin.param.GoblinFrontSeckillBuildParam;
import com.mongodb.BasicDBObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
......@@ -23,7 +25,11 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -87,18 +93,50 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil
* @Description:分页
* @date 2021/12/27 下午5:19
*/
public PageInfo<GoblinFrontSeckill> page(int pageSize, int pageNumber, GoblinFrontSeckill goblinFrontSeckill) {
PageInfo<GoblinFrontSeckill> pageInfoTmp = null;
public GoblinFrontSeckillBuildParam page() {
try {
PageHelper.startPage(pageNumber, pageSize);
LambdaQueryWrapper<GoblinFrontSeckill> queryWrapper = Wrappers.lambdaQuery(GoblinFrontSeckill.class);
queryWrapper.orderByDesc(GoblinFrontSeckill::getCreateTime);
List<GoblinFrontSeckill> list=goblinFrontSeckillMapper.selectList(queryWrapper);
pageInfoTmp = new PageInfo(list);
GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam=GoblinFrontSeckillBuildParam.getNew();
List<Map> acityList= new ArrayList<>();
//遍历list 然后查找 官方 或者商铺
if(list.size()>0){
GoblinFrontSeckill goblinFrontSeckill1=list.get(0);
BeanUtils.copyProperties(goblinFrontSeckill1,goblinFrontSeckillBuildParam);
String selfActivityids =goblinFrontSeckill1.getSelfActivityids();
String[] actiyids=selfActivityids.split(",");
for(String aid:actiyids){
String type=aid.split("_")[0];
String id=aid.split("_")[1];
if(type.equals("g")){
//官方
GoblinSelfMarketing goblinSelfMarketing=goblinSelfMarketingMapper.selectById(id);
Map a=new HashMap();
a.put("name",goblinSelfMarketing.getName());
a.put("startTime",goblinSelfMarketing.getStartTime()==null?"":goblinSelfMarketing.getStartTime().format( DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
a.put("endTime",goblinSelfMarketing.getEndTime()==null?"":goblinSelfMarketing.getEndTime().format( DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
acityList.add(a);
//封装
}else if(type.equals("s")){
//商铺
GoblinStoreMarketing goblinStoreMarketing= goblinStoreMarketingMapper.selectById(id);
Map a=new HashMap();
a.put("name",goblinStoreMarketing.getName());
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
a.put("startTime",goblinStoreMarketing.getStartTime()==null?"":goblinStoreMarketing.getStartTime().format( DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
a.put("endTime",goblinStoreMarketing.getEndTime()==null?"":goblinStoreMarketing.getEndTime().format( DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
acityList.add(a);
}
}
goblinFrontSeckillBuildParam.setAcityList(acityList);
return goblinFrontSeckillBuildParam;
}
//pageInfoTmp = new PageInfo(Collections.singletonList(new ArrayList().add(goblinFrontSeckillBuildParam)));
} catch (Exception e) {
return new PageInfo();
return null;
}
return pageInfoTmp;
return null;
}
/**
* @author zhangfuxin
......
......@@ -7,6 +7,7 @@ import com.liquidnet.service.goblin.dto.vo.GoblinFrontBannerVo;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import com.liquidnet.service.goblin.entity.GoblinFrontSeckill;
import com.liquidnet.service.goblin.util.ObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -80,5 +81,20 @@ public class GoblinFrontController {
return ResponseDto.success( list );
}
@GetMapping("getSeckilll")
@ApiOperation("获得秒杀首页要用的")
public ResponseDto getSeckilll() {
List<GoblinFrontSeckill> list= (List<GoblinFrontSeckill>) redisUtil.get(GoblinRedisConst.FRONT_SECKILL);
//判断是否有
if(null!=list&&list.size()>0){
//
}
return ResponseDto.success( list );
}
}
......@@ -131,18 +131,18 @@ public class GoblinStorePurchasingController {
return goblinStorePurchasingService.purchasingSkuUpdate(params);
}
@DeleteMapping("purchasing/sku")
@ApiOperation("活动详情-限时秒杀-sku删除")
@DeleteMapping("purchasing/spu")
@ApiOperation("活动详情-限时秒杀-spu删除")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "spuId", example = "1")
})
public ResponseDto<Boolean> purchasingSkuDel(@RequestParam("marketId") @Valid String marketId,
public ResponseDto<Boolean> purchasingSpuDel(@RequestParam("marketId") @Valid String marketId,
@RequestParam("storeId") @Valid String storeId,
@RequestParam("spuId") @Valid String spuId) {
return goblinStorePurchasingService.purchasingSkuDel(marketId, storeId, spuId);
return goblinStorePurchasingService.purchasingSpuDel(marketId, storeId, spuId);
}
}
......@@ -47,7 +47,9 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
HashMap<String, Object> map = goblinMongoUtils.getStoreMarketList(page, purchaseName, status, st, et, ct);
List<GoblinStoreMarketVo> list = (List<GoblinStoreMarketVo>) map.get("data");
for (GoblinStoreMarketVo item : list) {
if (LocalDateTime.parse(item.getStartTime(), DTF_YMD_HMS).isAfter(now)) {
if (item.getStatus().equals(7)) {
item.setStatus(7);
} else if (LocalDateTime.parse(item.getStartTime(), DTF_YMD_HMS).isAfter(now)) {
item.setStatus(0);
} else if (LocalDateTime.parse(item.getEndTime(), DTF_YMD_HMS).isBefore(now)) {
item.setStatus(2);
......@@ -178,7 +180,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
GoblinMarketSpuListVo vo = GoblinMarketSpuListVo.getNew();
String marketSpuId = marketSpuList.get(i);
GoblinGoodsInfoVo spuVo = goblinRedisUtils.getGoodsInfoVo(marketSpuId);
vo.setMarketSpuId(marketSpuId);
vo.setMarketSpuId(marketSpuId.split(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue())[0]);
vo.setCoverPic(spuVo.getCoverPic());
vo.setName(spuVo.getName());
vo.setPriceGe(spuVo.getPriceGe());
......@@ -204,9 +206,9 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
vo.setSkuStock(skuVo.getSkuStock());
vo.setPriceMarketing(marketSkuVo.getPrice());
vo.setStockMarketing(marketSkuVo.getSkuStock());
vo.setBuyFactor(vo.getBuyFactor());
vo.setBuyLimit(vo.getBuyLimit());
vo.setBuyRoster(vo.getBuyRoster());
vo.setBuyFactor(marketSkuVo.getBuyFactor());
vo.setBuyLimit(marketSkuVo.getBuyLimit());
vo.setBuyRoster(marketSkuVo.getBuyRoster());
voList.add(vo);
}
return ResponseDto.success(voList);
......@@ -224,6 +226,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
sqls.add(SqlMapping.get("goblin.store.market.insertRelation"));
LinkedList<Object[]> sqlsData = CollectionUtil.linkedListObjectArr();
for (GoblinStorePurchaseItemParam item : params.getGoblinStorePurchaseItemParam()) {
//todo 修改 相关vo 修改库存 判断库存
String purchaseId = IDGenerator.nextMilliId2();
GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew();
bean.setStoreId(params.getStoreId());
......@@ -232,7 +235,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
bean.setPurchaseId(purchaseId);
bean.setSkuId(item.getSkuId());
bean.setPriceMarketing(item.getPriceMarketing());
bean.setStockMarketing(item.hashCode());
bean.setStockMarketing(item.getStockMarketing());
bean.setBuyLimit(item.getBuyLimit());
bean.setBuyFactor(item.getBuyFactor());
bean.setBuyRoster(item.getBuyRoster());
......@@ -249,6 +252,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
skuVo.setBuyRoster(bean.getBuyRoster());
skuVo.setBuyFactor(bean.getBuyFactor().toString());
skuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId()));
goblinMongoUtils.setGoodsSkuInfoVo(skuVo);
//redis
goblinRedisUtils.setGoodsSkuInfoVo(skuVo);
//mysql
......@@ -279,13 +283,15 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
public ResponseDto<Boolean> purchasingSkuUpdate(GoblinStorePurchaseCommonParam params) {
LocalDateTime now = LocalDateTime.now();
String marketSpuId = params.getSpuId().concat(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue()).concat(IDGenerator.marketGoodId(params.getStoreMarketId()));
List<String> marketSkuList = CollectionUtil.arrayListString();
LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("goblin.store.market.updateRelation"));
LinkedList<Object[]> sqlsData = CollectionUtil.linkedListObjectArr();
for (GoblinStorePurchaseItemParam item : params.getGoblinStorePurchaseItemParam()) {
//todo 修改 相关vo 修改库存 判断库存
GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew();
bean.setPriceMarketing(item.getPriceMarketing());
bean.setStockMarketing(item.hashCode());
bean.setStockMarketing(item.getStockMarketing());
bean.setBuyLimit(item.getBuyLimit());
bean.setBuyFactor(item.getBuyFactor());
bean.setBuyRoster(item.getBuyRoster());
......@@ -300,17 +306,20 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
skuVo.setBuyRoster(bean.getBuyRoster());
skuVo.setBuyFactor(bean.getBuyFactor().toString());
skuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId()));
goblinMongoUtils.updateGoodsSkuInfoVo(skuVo);
//redis
goblinRedisUtils.setGoodsSkuInfoVo(skuVo);
//mysql
sqlsData.add(new Object[]{bean.getPriceMarketing(),
bean.getStockMarketing(), bean.getBuyFactor(), bean.getBuyRoster(), bean.getBuyLimit(), bean.getUpdatedAt(), params.getStoreMarketId(), params.getStoreId()});
marketSkuList.add(skuVo.getSkuId());
}
//mongo
GoblinGoodsInfoVo spuVo = goblinRedisUtils.getGoodsInfoVo(params.getSpuId());
spuVo.setSpuId(marketSpuId);
spuVo.setSkuIdList(marketSkuList);
spuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId()));
goblinMongoUtils.setGoodsInfoVo(spuVo);
goblinMongoUtils.updateGoodsInfoVo(spuVo);
//redis
goblinRedisUtils.setGoodsInfoVo(spuVo);
// 执行sql
......@@ -321,7 +330,8 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
}
@Override
public ResponseDto<Boolean> purchasingSkuDel(String marketId, String storeId, String spuId) {
public ResponseDto<Boolean> purchasingSpuDel(String marketId, String storeId, String spuId) {
//todo 修改 相关vo 修改库存 判断库存
LocalDateTime now = LocalDateTime.now();
String marketSpuId = spuId.concat(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue()).concat(IDGenerator.marketGoodId(marketId));
GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew();
......
......@@ -146,7 +146,7 @@ public class GoblinMongoUtils {
public boolean updateGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) {
return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName())
.updateOne(
Query.query(Criteria.where("skuId").is(vo.getSpuId())).getQueryObject(),
Query.query(Criteria.where("skuId").is(vo.getSkuId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0;
}
......
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