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

Commit 254ed70b authored by 姜秀龙's avatar 姜秀龙

收钱 goods add

parent 6918c965
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.shouqianba.response.data.MallProductsQueryData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtGoodsSqbAddParam", description = "商品管理:添加收钱吧商品入参")
@Data
public class GoblinStoreMgtGoodsSqbAddParam implements Serializable {
private static final long serialVersionUID = -6261151635859590265L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID")
@NotNull(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = false, value = "商品ID[编辑时必传]")
private String spuId;
/**
* ---------------------------- 基本信息 ----------------------------
**/
@ApiModelProperty(position = 12, required = true, value = "商品名称[36]")
@NotBlank(message = "商品名称不能为空")
@Size(max = 36, message = "商品名称长度超限")
private String name;
@ApiModelProperty(position = 15, required = true, value = "商品一级分类ID[30]")
@NotBlank(message = "商品分类ID不能为空")
private String cateFid;
@ApiModelProperty(position = 16, required = true, value = "商品二级分类ID[30]")
private String cateSid;
@ApiModelProperty(position = 17, required = true, value = "商品三级分类ID[30]")
private String cateTid;
@ApiModelProperty(position = 18, required = false, value = "商品简介[256]", example = "商品简介...")
@Size(max = 256, message = "商品简介内容过长")
private String intro;
@ApiModelProperty(position = 19, required = false, value = "商品标签列表")
private List<String> tagList;
@ApiModelProperty(position = 20, required = true, value = "商品图片列表")
private List<String> imageList;
@ApiModelProperty(position = 21, required = false, value = "商品图片封面")
@Size(max = 256, message = "商品图片封面URL过长")
private String coverPic;
@ApiModelProperty(position = 22, required = false, value = "商品视频地址")
@Size(max = 256, message = "商品视频地址URL过长")
private String video;
/**
* ---------------------------- 价格库存 ----------------------------
**/
@ApiModelProperty(position = 24, required = false, value = "SKU规格信息[初次添加商品必填]")
@Valid
private GoblinStoreMgtGoodsSqbAddSkuParam skuParam;
@ApiModelProperty(position = 26, required = false, value = "商品编码[默认为系统编码,也可手动输入商家自己的编码]")
@Pattern(regexp = LnsRegex.Valid.ALPHABET_NUMBER_UNDER_50, message = "商品编码格式或长度有误")
private String spuNo;
/**
* ---------------------------- 商品介绍 ----------------------------
**/
@ApiModelProperty(position = 27, required = true, value = "商品详情", example = "商品详情...")
@Size(max = 10000, message = "商品详情内容过长")
private String details;
/**
* ---------------------------- 销售属性 ----------------------------
**/
@ApiModelProperty(position = 28, required = true, value = "上架处理方式[1-等待手动上架|2-直接上架售卖|3-预约定时上架]", example = "1")
@NotNull(message = "上架处理方式不能为空")
@Pattern(regexp = "\\b(1|2|3)\\b", message = "规格展现方式参数无效")
private String shelvesHandle;
@ApiModelProperty(position = 29, required = false, value = "预约上架时间[yyyy-MM-dd HH:mm:ss][上架处理方式为3-预约定时上架时需要指定]")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "预约上架时间格式有误")
private String shelvesTime;
/**
* ---------------------------- 服务保障 ----------------------------
**/
@ApiModelProperty(position = 32, required = false, value = "商品服务支持ID列表")
private List<String> ssidList;
/**
* ---------------------------- 专属标签 ----------------------------
**/
@ApiModelProperty(position = 33, required = false, value = "商品关联音乐人、艺术家、品牌方、厂牌列表")
private List<String> extagList;
/**
* ---------------------------- AR标签 ----------------------------
**/
@ApiModelProperty(position = 33, required = false, value = "商品关联音乐人、艺术家、品牌方、厂牌、AR列表")
private List<String> artagList;
/**
* 生成券类SPU
*
* @return GoblinGoodsInfoVo
*/
public GoblinGoodsInfoVo initGoodsInfoVo(String storeId, GoblinSqbPerfGoodsVo sqbGoods, String currentUid, LocalDateTime nowTime) {
GoblinGoodsInfoVo vo = GoblinGoodsInfoVo.getNew();
vo.setStoreId(storeId);
if (StringUtils.isBlank(sqbGoods.getSpuId())) {
vo.setSpuId(IDGenerator.nextMilliId2());
} else {
vo.setSpuId(sqbGoods.getSpuId());
}
vo.setSpuNo(vo.getSpuId());
vo.setSpuType(33);
vo.setName(sqbGoods.getTitle());
vo.setIntro("");
vo.setDetails(sqbGoods.getProductIntroduction());
vo.setCoverPic(CollectionUtil.isEmpty(sqbGoods.getConverImages()) ? "" : sqbGoods.getConverImages().get(0));
vo.setVideo("");
vo.setSpecMode("1");
vo.setCateFid("22196120924543");
vo.setCateSid("22199134037630");
vo.setCateTid("22199134105660");
vo.setShelvesHandle("1");
vo.setShelvesTime(null);
vo.setVirtualFlg("1");
vo.setStatus("3");
vo.setShelvesStatus("0");
vo.setSpuAppear("0");
vo.setDelFlg("0");
vo.setImageList(sqbGoods.getConverImages());
vo.setLogisticsTemplate("");
vo.setCreatedBy(currentUid);
vo.setCreatedAt(nowTime);
return vo;
}
/**
* 编辑SPU参数整理
*
* @return GoblinGoodsInfoVo
*/
public GoblinGoodsInfoVo initEditGoodsInfoVo() {
GoblinGoodsInfoVo vo = GoblinGoodsInfoVo.getNew();
vo.setStoreId(this.getStoreId());
vo.setSpuId(this.getSpuId());
if (StringUtils.isBlank(this.getSpuNo())) {
vo.setSpuNo(vo.getSpuId());
} else {
vo.setSpuNo(this.getSpuNo());
}
vo.setSpuType(2);
vo.setName(this.getName());
// vo.setSubtitle(this.getSubtitle());
// vo.setSellPrice(this.getSellPrice());
vo.setIntro(this.getIntro());
vo.setDetails(this.getDetails());
vo.setCoverPic(StringUtils.isBlank(this.getCoverPic()) ? this.getImageList().get(0) : this.getCoverPic());
vo.setVideo(this.getVideo());
vo.setSpecMode("1");
vo.setCateFid(this.getCateFid());
vo.setCateSid(this.getCateSid());
vo.setCateTid(this.getCateTid());
vo.setShelvesHandle(this.getShelvesHandle());
vo.setShelvesTime(this.getShelvesTime());
vo.setVirtualFlg("1");
vo.setImageList(this.getImageList());
vo.setLogisticsTemplate("");
return vo;
}
/**
* 生成SKU列表以及SPU规格等信息
*
* @param goodsInfoVo GoblinGoodsInfoVo
* @param skuInfoVos List<GoblinGoodsSkuInfoVo>
* @param goodsSpecVos List<GoblinGoodsSpecVo>
*/
public void initGoodsSkuInfoVo(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> skuInfoVos,
List<GoblinGoodsSpecVo> goodsSpecVos, GoblinSqbPerfGoodsVo sqbGoods) {
List<MallProductsQueryData.Sku> addSkuParamSqb = sqbGoods.getSkuResults();
List<String> skuIdList = CollectionUtil.arrayListString();
for (MallProductsQueryData.Sku sku : addSkuParamSqb) {
GoblinGoodsSkuInfoVo skuInfoVo = GoblinGoodsSkuInfoVo.getNew();
skuInfoVo.setSpuId(goodsInfoVo.getSpuId());
skuInfoVo.setSkuId(sku.getSkuId());
skuInfoVo.setSkuNo(sku.getSkuId());
skuInfoVo.setSkuBarCode(sku.getSkuId());
skuInfoVo.setSkuType(33);
skuInfoVo.setName(sku.getSkuName());
skuInfoVo.setSubtitle("");
skuInfoVo.setSkuPic("");
skuInfoVo.setSkuIsbn("");
skuInfoVo.setStock(999);
skuInfoVo.setSkuStock(999);
skuInfoVo.setPrice(BigDecimal.valueOf(sku.getPrice()));
skuInfoVo.setPriceMember(BigDecimal.valueOf(sku.getPrice()));
skuInfoVo.setBuyFactor("0");
skuInfoVo.setBuyLimit(0);
skuInfoVo.setStoreId(goodsInfoVo.getStoreId());
skuInfoVo.setVirtualFlg("1");
skuInfoVo.setStatus("3");// 没有审核流程,默认通过
skuInfoVo.setShelvesStatus(goodsInfoVo.getShelvesStatus());
skuInfoVo.setSkuAppear("0");
skuInfoVo.setDelFlg("0");
skuInfoVo.setCreatedBy(goodsInfoVo.getCreatedBy());
skuInfoVo.setCreatedAt(goodsInfoVo.getCreatedAt());
skuInfoVo.setLogisticsTemplate("");
skuInfoVo.setErpType(goodsInfoVo.getErpType());
skuInfoVo.setErpHosting(0);
{// 规格信息处理
// 收钱吧商品固定规格
GoblinGoodsSpecDto goblinGoodsSpecDto = GoblinGoodsSpecDto.getNew();
goblinGoodsSpecDto.setSpecName("规格");
goblinGoodsSpecDto.setSpecVname("默认");
// SKU规格设置
List<GoblinGoodsSpecDto> skuSpecList = new ArrayList<>();
skuSpecList.add(goblinGoodsSpecDto);
skuInfoVo.setSkuSpecList(skuSpecList);
}
skuIdList.add(skuInfoVo.getSkuId());
skuInfoVos.add(skuInfoVo);
}
// SPU规格集合
GoblinGoodsSpecValueVo specValueVo = GoblinGoodsSpecValueVo.getNew().setSpecVname("规格").setSpecVsort(0);
ArrayList<GoblinGoodsSpecValueVo> specValueVos = new ArrayList<>();
specValueVos.add(specValueVo);
goodsSpecVos.add(GoblinGoodsSpecVo.getNew().setSpecName("默认").setSpecSort(0).setSpecValues(specValueVos));
goodsInfoVo.setPriceGe(BigDecimal.ZERO);
goodsInfoVo.setPriceLe(BigDecimal.ZERO);
goodsInfoVo.setSkuIdList(skuIdList);
goodsInfoVo.setSpecVoList(goodsSpecVos);
}
}
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtGoodsSqbAddSkuParam", description = "商品管理:添加收钱吧商品:添加SKU入参")
@Data
public class GoblinStoreMgtGoodsSqbAddSkuParam implements Serializable {
private static final long serialVersionUID = 7886534346305369761L;
@ApiModelProperty(position = 10, required = false, value = "单品ID[编辑时必传]")
private String skuId;
// @ApiModelProperty(position = 11, required = false, value = "单品编码[默认为系统编码,也可手动输入商家自己的编码]")
// @Pattern(regexp = LnsRegex.Valid.ALPHABET_NUMBER_UNDER_50, message = "单品编码格式或长度有误")
// private String skuNo;
// @ApiModelProperty(position = 12, required = false, value = "单品条码")
// @Pattern(regexp = LnsRegex.Valid.ALPHABET_NUMBER_32, message = "单品条码格式或长度有误")
// private String skuBarCode;
// @ApiModelProperty(position = 13, required = false, value = "ERP商家编码")
// @Size(max = 40, message = "ERP商家编码长度限制40")
// private String skuErpCode;//-
// @ApiModelProperty(position = 14, required = false, value = "ERP托管[0-否|1-是],默认0")
// @Pattern(regexp = "\\b(0|1)\\b", message = "ERP托管参数无效")
// private String erpHosting;//-
// @ApiModelProperty(position = 15, required = false, value = "ERP仓库编号")
// @Size(max = 40, message = "ERP仓库编号长度限制40")
// private String erpWarehouseNo;//-
// @ApiModelProperty(position = 16, required = false, value = "单品默认图片的url[256]")
// @NotBlank(message = "单品图片不能为空")
// private String skuPic;
@ApiModelProperty(position = 12, required = false, value = "单品规格信息")
// @NotNull(message = "规格信息不能为空")
// @Valid// 初始化写死['规格':'张']
private List<GoblinGoodsSpecDto> skuSpecList;
// @ApiModelProperty(position = 18, required = false, value = "单品销售价-原价[20,2]")
// private BigDecimal sellPrice;
@ApiModelProperty(position = 19, required = true, value = "单品现价[20,2]")
@Digits(integer = 6, fraction = 2, message = "参数'单品现价'无效")
@DecimalMin(value = "0.01", message = "参数'单品现价'必须为大于0")
private BigDecimal price;
// @ApiModelProperty(position = 20, required = false, value = "单品会员价格[20,2]")
// @NotNull(message = "单品会员价格不能为空")
// @Min(value = 0, message = "单品会员价格不能小于0")
// private BigDecimal priceMember;
// @ApiModelProperty(position = 21, required = false, value = "单品的重量[20,2]")
// private BigDecimal weight;//-
@ApiModelProperty(position = 20, required = true, value = "总库存")
@Min(value = 0, message = "总库存不能小于0")
private Integer stock;
// @ApiModelProperty(position = 21, required = false, value = "预警库存")
// private Integer warningStock;
// @ApiModelProperty(position = 22, required = false, value = "ISBN,针对CD/图书等[100]")
// private String skuIsbn;//-
// @ApiModelProperty(position = 23, required = false, value = "购买限制[0-全部用户|1-仅会员|2-指定用户]")
// @NotNull(message = "购买限制不能为空")
// private String buyFactor;
// @ApiModelProperty(position = 24, required = false, value = "购买限制人员名单[购买限制为2-指定用户时必填]")
// private String buyRoster;
@ApiModelProperty(position = 25, required = false, value = "限量[0-无限制|X:限购数量]")
private Integer buyLimit;
// @ApiModelProperty(position = 26, required = false, value = "单品有效期[yyyy-MM-dd HH:mm:ss]")
// @Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "单品有效期格式有误")
// private String skuValidity;
// @ApiModelProperty(position = 27, required = false, value = "自定义展示[0-默认展示|1-隐藏不可购买]")
// private String skuAppear;
/**
* ---------------------------- 收钱吧商品-代金券属性 ----------------------------
*/
@ApiModelProperty(position = 28, required = true, value = "是否实名[0-否|1-是,表示该商品需要实名关联]", allowableValues = "0,1", example = "1")
@Pattern(regexp = "\\b(0|1)\\b", message = "参数'是否实名'无效")
private String isTrueName;
@ApiModelProperty(position = 29, required = true, value = "适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]", allowableValues = "101,102,103", example = "101")
@Pattern(regexp = "\\b(101|102|103)\\b", message = "参数'适用范围'无效")
private String useScope;
@ApiModelProperty(position = 30, required = true, value = "面值", example = "99.00")
@Digits(integer = 3, fraction = 2, message = "参数'面值'无效")
@DecimalMin(value = "0.01", message = "参数'面值'必须为大于0")
private BigDecimal valFace;
@ApiModelProperty(position = 31, required = true, value = "开始时间[yyyy-MM-dd HH:mm:ss]", example = "2024-01-01 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始时间格式有误")
@NotNull(message = "参数'开始时间'不可为空")
private String effectAt;
@ApiModelProperty(position = 32, required = true, value = "结束时间[yyyy-MM-dd HH:mm:ss]", example = "2024-12-31 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "结束时间格式有误")
@NotNull(message = "参数'结束时间'不可为空")
private String expireAt;
}
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(value = "GoblinStoreMgtGoodsSqbEditSkuParam", description = "商品管理:编辑收钱吧商品:编辑SKU入参")
@Data
public class GoblinStoreMgtGoodsSqbEditSkuParam implements Serializable {
private static final long serialVersionUID = 8174428924922310702L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID[64]")
@NotBlank(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "商品ID[64]")
@NotNull(message = "商品ID不能为空")
private String spuId;
@ApiModelProperty(position = 12, required = true, value = "单品ID[编辑时必传]")
@NotNull(message = "商品SKU_ID不能为空")
private String skuId;
@ApiModelProperty(position = 13, required = true, value = "单品现价[20,2]")
@Digits(integer = 3, fraction = 2, message = "参数'单品现价'无效")
@DecimalMin(value = "0.01", message = "参数'单品现价'必须为大于0")
private BigDecimal price;
@ApiModelProperty(position = 14, required = true, value = "限量[0-无限制|X:限购数量]")
@Min(value = 0, message = "参数'限购数量'不能小于0")
@NotNull(message = "参数'限购数量'不可为空")
private Integer buyLimit;
@ApiModelProperty(position = 15, required = false, value = "总库存")
private Integer stock;
@ApiModelProperty(position = 16, required = false, value = "总库存")
private Integer skuStock;
@ApiModelProperty(position = 17, required = false, value = "加减库存")
private Integer operStock;
/**
* ---------------------------- 收钱吧商品-代金券属性 ----------------------------
*/
@ApiModelProperty(position = 18, required = true, value = "是否实名[0-否|1-是,表示该商品需要实名关联]", example = "1")
@Pattern(regexp = "\\b(0|1)\\b", message = "参数'是否实名'无效")
private String isTrueName;
@ApiModelProperty(position = 19, required = true, value = "适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]")
@Pattern(regexp = "\\b(101|102|103)\\b", message = "参数'适用范围'无效")
private String useScope;
@ApiModelProperty(position = 20, required = true, value = "面值", example = "99.00")
@Digits(integer = 3, fraction = 2, message = "参数'面值'无效")
@DecimalMin(value = "0.01", message = "参数'面值'必须为大于0")
private BigDecimal valFace;
@ApiModelProperty(position = 21, required = true, value = "结束时间[yyyy-MM-dd HH:mm:ss]", example = "2024-01-01 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始时间格式有误")
@NotNull(message = "参数'开始时间'不可为空")
private String effectAt;
@ApiModelProperty(position = 22, required = true, value = "结束时间[yyyy-MM-dd HH:mm:ss]", example = "2024-12-31 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "结束时间格式有误")
@NotNull(message = "参数'结束时间'不可为空")
private String expireAt;
public GoblinGoodsSkuInfoVo initEditGoodsSkuInfoVo() {
GoblinGoodsSkuInfoVo goodsSkuInfoVo = GoblinGoodsSkuInfoVo.getNew();
goodsSkuInfoVo.setSkuType(2);
goodsSkuInfoVo.setSkuId(this.getSkuId());
goodsSkuInfoVo.setPrice(this.getPrice());
goodsSkuInfoVo.setPriceMember(this.getPrice());
goodsSkuInfoVo.setBuyLimit(this.getBuyLimit());
goodsSkuInfoVo.setStock(this.getStock());
goodsSkuInfoVo.setSkuStock(this.getSkuStock());
goodsSkuInfoVo.setIsTrueName(Integer.valueOf(this.getIsTrueName()));
goodsSkuInfoVo.setUseScope(Integer.valueOf(this.getUseScope()));
goodsSkuInfoVo.setValFace(this.getValFace());
goodsSkuInfoVo.setEffectAt(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getEffectAt()));
goodsSkuInfoVo.setExpireAt(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getExpireAt()));
return goodsSkuInfoVo;
}
}
...@@ -12,6 +12,7 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddParam; ...@@ -12,6 +12,7 @@ import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddSkuParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddSkuParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbEditSkuParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbEditSkuParam;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.shouqianba.response.data.MallProductsQueryData;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService; import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtSqbGoodsService; import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtSqbGoodsService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils; import com.liquidnet.service.goblin.util.GoblinMongoUtils;
...@@ -35,7 +36,7 @@ import java.util.Objects; ...@@ -35,7 +36,7 @@ import java.util.Objects;
/** /**
* 收钱吧商品管理 * 收钱吧商品管理
*/ */
@ApiSupport(order = 149005) @ApiSupport(order = 1)
@Api(tags = "收钱吧商品管理") @Api(tags = "收钱吧商品管理")
@Slf4j @Slf4j
@Validated @Validated
...@@ -55,98 +56,28 @@ public class GoblinStoreMgtSqbGoodsController { ...@@ -55,98 +56,28 @@ public class GoblinStoreMgtSqbGoodsController {
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "SPU添加-收钱吧商品") @ApiOperation(value = "SPU添加-收钱吧商品")
@PostMapping("add") @PostMapping("add")
public ResponseDto<Object> add(@Valid @RequestBody GoblinStoreMgtGoodsSqbAddParam mgtGoodsSqbAddParam) { public ResponseDto<Object> add(@RequestParam("storeId") String storeId,
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsSqbAddParam.getStoreId(); @RequestBody @Validated List<GoblinSqbPerfGoodsVo> items) {
String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) return ResponseDto.failure(ErrorMapping.get("149002")); if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) return ResponseDto.failure(ErrorMapping.get("149002"));
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("收钱吧商品管理:SPU添加:[GoblinStoreMgtGoodsSqbAddParam={}]", JsonUtils.toJson(mgtGoodsSqbAddParam)); log.debug("收钱吧商品管理:添加:[items={}]", JsonUtils.toJson(items));
} }
for (GoblinSqbPerfGoodsVo sqbGoods : items) {
GoblinStoreMgtGoodsSqbAddParam mgtGoodsSqbAddParamNew = new GoblinStoreMgtGoodsSqbAddParam();
GoblinGoodsInfoVo goodsInfoVo = mgtGoodsSqbAddParamNew.initGoodsInfoVo(storeId, sqbGoods, currentUid, LocalDateTime.now());
GoblinStoreMgtGoodsSqbAddSkuParam skuParam = mgtGoodsSqbAddParam.getSkuParam(); ArrayList<GoblinGoodsSpecVo> goodsSpecVoList = ObjectUtil.getGoblinGoodsSpecVoArrayList();
if (Objects.isNull(skuParam)) { List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList = ObjectUtil.getGoblinGoodsSkuInfoVoArrayList();
return ResponseDto.failure(ErrorMapping.get("149006")); mgtGoodsSqbAddParamNew.initGoodsSkuInfoVo(goodsInfoVo, goodsSkuInfoVoList, goodsSpecVoList, sqbGoods);
}
if (Objects.isNull(skuParam.getEffectAt()) || Objects.isNull(skuParam.getExpireAt())) {
return ResponseDto.failure(ErrorMapping.get("149025"));
}
LocalDateTime effectAt = DateUtil.Formatter.yyyyMMddHHmmss.parse(skuParam.getEffectAt());
LocalDateTime expireAt = DateUtil.Formatter.yyyyMMddHHmmss.parse(skuParam.getExpireAt());
if (effectAt.isAfter(expireAt) || expireAt.isBefore(LocalDateTime.now())) {
return ResponseDto.failure(ErrorMapping.get("149026"));
}
if (CollectionUtils.isEmpty(mgtGoodsSqbAddParam.getImageList())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品图片不能为空");
}
String cateFid = mgtGoodsSqbAddParam.getCateFid(), cateSid = mgtGoodsSqbAddParam.getCateSid(), cateTid = mgtGoodsSqbAddParam.getCateTid();
List<GoblinSelfGoodsCategoryVo> selfGoodsCategoryVos = goblinStoreMgtExtraService.listCategoryVo();
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateFid) && r.getGrade().equals("1"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品一级分类无效");
}
if (StringUtils.isNotBlank(cateSid)
&& selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateSid) && r.getGrade().equals("2"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品二级分类无效");
}
if (StringUtils.isNotBlank(cateTid)
&& selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品三级分类无效");
}
if (goblinMongoUtils.countMgtGoodsInfoVo(mgtGoodsSqbAddParam.getName()) > 0) {
return ResponseDto.failure(ErrorMapping.get("149007"));
}
if (mgtGoodsSqbAddParam.getShelvesHandle().equals("3") && null == mgtGoodsSqbAddParam.getShelvesTime()) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "预约上架时间未指定");
}
GoblinGoodsInfoVo goodsInfoVo = mgtGoodsSqbAddParam.initGoodsInfoVo(currentUid, LocalDateTime.now());
ArrayList<GoblinGoodsSpecVo> goodsSpecVoList = ObjectUtil.getGoblinGoodsSpecVoArrayList();
List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList = ObjectUtil.getGoblinGoodsSkuInfoVoArrayList();
mgtGoodsSqbAddParam.initGoodsSkuInfoVo(goodsInfoVo, goodsSkuInfoVoList, goodsSpecVoList);
List<String> goodsTagIdList = mgtGoodsSqbAddParam.getTagList(),
goodsExtagIdList = mgtGoodsSqbAddParam.getExtagList(),
goodsArtagIdList = mgtGoodsSqbAddParam.getArtagList();
if (!CollectionUtils.isEmpty(goodsTagIdList)) {
List<GoblinSelfTagVo> selfGoodsTagVos = goblinRedisUtils.getSelfTagVos();
List<GoblinGoodsTagVo> goodsTagVoList = ObjectUtil.getGoblinGoodsTagVoArrayList();
for (int i = 0; i < goodsTagIdList.size(); i++)
for (GoblinSelfTagVo r : selfGoodsTagVos)
if (r.getTagId().equals(goodsTagIdList.get(i)) && r.getTagBelong().equals("0")) {
goodsTagVoList.add(GoblinGoodsTagVo.getNew().copy(r).setSort(i));
break;
}
goodsInfoVo.setTagVoList(goodsTagVoList);
}
if (!CollectionUtils.isEmpty(goodsExtagIdList)) {
List<GoblinSelfTagVo> selfExtagVos = goblinRedisUtils.getSelfExtagVos();
List<GoblinGoodsExtagVo> goodsExtagVoList = ObjectUtil.getGoblinGoodsExtagVoArrayList();
for (int i = 0; i < goodsExtagIdList.size(); i++)
for (GoblinSelfTagVo r : selfExtagVos)
if (r.getTagId().equals(goodsExtagIdList.get(i)) && r.getTagBelong().equals("1") && !r.getTagType().equals("5")) {
goodsExtagVoList.add(GoblinGoodsExtagVo.getNew().copy(r).setSort(i));
break;
}
goodsInfoVo.setExtagVoList(goodsExtagVoList);
}
if (!CollectionUtils.isEmpty(goodsArtagIdList)) {
List<GoblinSelfTagVo> selfExtagVos = goblinRedisUtils.getSelfExtagVos();
List<GoblinGoodsExtagVo> goodsArtagVoList = ObjectUtil.getGoblinGoodsExtagVoArrayList();
for (int i = 0; i < goodsArtagIdList.size(); i++)
for (GoblinSelfTagVo r : selfExtagVos)
if (r.getTagId().equals(goodsArtagIdList.get(i)) && r.getTagBelong().equals("1")) {
goodsArtagVoList.add(GoblinGoodsExtagVo.getNew().copy(r).setSort(i));
break;
}
goodsInfoVo.setArtagVoList(goodsArtagVoList);
}
List<String> ssidList = mgtGoodsSqbAddParam.getSsidList(); goodsInfoVo.setTagVoList(new ArrayList<>());
if (!CollectionUtils.isEmpty(ssidList)) { goodsInfoVo.setExtagVoList(new ArrayList<>());
goodsInfoVo.setServiceSupportVoList(goblinMongoUtils.getServiceSupportVos(ssidList)); goodsInfoVo.setArtagVoList(new ArrayList<>());
goodsInfoVo.setServiceSupportVoList(new ArrayList<>());
goblinstoreMgtSqbGoodsService.sqbGoodsAdd(goodsInfoVo, goodsSkuInfoVoList);
} }
goblinstoreMgtSqbGoodsService.sqbGoodsAdd(goodsInfoVo, goodsSkuInfoVoList); return ResponseDto.success();
return ResponseDto.success(goodsInfoVo.getSpuId());
} }
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
......
...@@ -44,10 +44,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood ...@@ -44,10 +44,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
goblinMongoUtils.setGoodsInfoVo(goodsInfoVo); goblinMongoUtils.setGoodsInfoVo(goodsInfoVo);
goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList); goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList);
if (goodsInfoVo.getShelvesHandle().equals("2")) {
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
}
String createdBy = goodsInfoVo.getCreatedBy(); String createdBy = goodsInfoVo.getCreatedBy();
LocalDateTime createdAt = goodsInfoVo.getCreatedAt(); LocalDateTime createdAt = goodsInfoVo.getCreatedAt();
String spuId = goodsInfoVo.getSpuId(); String spuId = goodsInfoVo.getSpuId();
...@@ -83,9 +79,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood ...@@ -83,9 +79,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
} }
} }
LinkedList<Object[]> initGoodsSkuCouponObjs = CollectionUtil.linkedListObjectArr();// 券类商品信息
LinkedList<Object[]> initCandyCouponObjs = CollectionUtil.linkedListObjectArr();// 券信息
LinkedList<Object[]> initCandyCouponRuleObjs = CollectionUtil.linkedListObjectArr();// 券规则信息
int skuSize = goodsSkuInfoVoList.size(); int skuSize = goodsSkuInfoVoList.size();
for (int i = 0; i < skuSize; i++) { for (int i = 0; i < skuSize; i++) {
GoblinGoodsSkuInfoVo skuInfoVo = goodsSkuInfoVoList.get(i); GoblinGoodsSkuInfoVo skuInfoVo = goodsSkuInfoVoList.get(i);
...@@ -109,40 +102,10 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood ...@@ -109,40 +102,10 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
skuInfoVo.getSkuAppear(), skuInfoVo.getShelvesAt(), skuInfoVo.getSkuAppear(), skuInfoVo.getShelvesAt(),
createdBy, createdAt, skuInfoVo.getLogisticsTemplate() createdBy, createdAt, skuInfoVo.getLogisticsTemplate()
}); });
if (2 == goodsInfoVo.getSpuType()) {// 券类商品为一个SPU对应一个SKU
initGoodsSkuCouponObjs.add(
new Object[] { skuId, skuInfoVo.getBusiType(), skuInfoVo.getCouType(), skuInfoVo.getUseScope(),
skuInfoVo.getValFace(), skuInfoVo.getIsTrueName(), skuInfoVo.getValidity(),
skuInfoVo.getEffectAt(), skuInfoVo.getExpireAt() });
initCandyCouponObjs.add(
new Object[] { skuId, goodsInfoVo.getName(), goodsInfoVo.getIntro(), skuInfoVo.getBusiType(),
skuInfoVo.getCouType(), skuInfoVo.getValFace(), skuInfoVo.getValidity(),
skuInfoVo.getIsTrueName(),
skuInfoVo.getEffectAt(), skuInfoVo.getExpireAt(), createdBy, createdAt
});
String busiName = "%s";
switch (skuInfoVo.getUseScope()) {// 适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]
case 101:// 音乐节
busiName = String.format(busiName, "草莓、M_DSK、五百里音乐节");// 按杨要求文案'音乐节'改'草莓、M_DSK、五百里音乐节'
break;
case 102:// 小型演出(LiveHouse演出)
busiName = String.format(busiName, "小型演出(LiveHouse演出)系列");
break;
case 103:// 巡演
busiName = String.format(busiName, "巡演 系列");
break;
}
initCandyCouponRuleObjs
.add(new Object[] { IDGenerator.nextTimeId2(), skuId, skuInfoVo.getUseScope(), busiName, "" });
}
skuInfoVo.getSkuSpecList().forEach(skuSpecDto -> initGoodsSkuSpecValueObjs.add(new Object[] { skuInfoVo.getSkuSpecList().forEach(skuSpecDto -> initGoodsSkuSpecValueObjs.add(new Object[] {
spuId, skuId, skuSpecDto.getSpecName(), skuSpecDto.getSpecVname() spuId, skuId, skuSpecDto.getSpecName(), skuSpecDto.getSpecVname()
})); }));
if (skuInfoVo.getBuyFactor().equals("2") && StringUtils.isNotBlank(buyRoster)
&& buyRoster.startsWith("http")) {
queueUtils.sendMsgByRedisXls(buyRoster, "1", skuId);
}
} }
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
...@@ -164,9 +127,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood ...@@ -164,9 +127,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
goodsInfoVo.getShelvesAt(), createdBy, createdAt, goodsInfoVo.getLogisticsTemplate() goodsInfoVo.getShelvesAt(), createdBy, createdAt, goodsInfoVo.getLogisticsTemplate()
}); });
toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert_for_coupon")); toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert_for_coupon"));
toMqSqls.add(SqlMapping.get("goblin_goods_sku_coupon.insert"));
toMqSqls.add(SqlMapping.get("candy_coupon.goods_insert"));
toMqSqls.add(SqlMapping.get("candy_coupon_rule.goods_insert"));
toMqSqls.add(SqlMapping.get("goblin_goods_image.insert_byreplace")); toMqSqls.add(SqlMapping.get("goblin_goods_image.insert_byreplace"));
LinkedList<Object[]> initGoodsImageObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initGoodsImageObjs = CollectionUtil.linkedListObjectArr();
if (CollectionUtils.isEmpty(goodsInfoVo.getImageList())) { if (CollectionUtils.isEmpty(goodsInfoVo.getImageList())) {
...@@ -215,8 +175,7 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood ...@@ -215,8 +175,7 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
toMqSqls.add(SqlMapping.get("goblin_goods_category_spec.insert_byreplace"));// 分类关联规格信息 toMqSqls.add(SqlMapping.get("goblin_goods_category_spec.insert_byreplace"));// 分类关联规格信息
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, initGoodsObjs, initGoodsSkuObjs, initGoodsSkuCouponObjs, initCandyCouponObjs, SqlMapping.gets(toMqSqls, initGoodsObjs, initGoodsSkuObjs,
initCandyCouponRuleObjs,
initGoodsImageObjs, initGoodsTagObjs, initGoodsArTagObjs, initGoodsServiceSupportObjs, initGoodsImageObjs, initGoodsTagObjs, initGoodsArTagObjs, initGoodsServiceSupportObjs,
initGoodsSpecObjs, initGoodsSpecObjs,
initGoodsSpecValueObjs, initGoodsSpuSpecValueObjs, initGoodsSkuSpecValueObjs, initGoodsSpecValueObjs, initGoodsSpuSpecValueObjs, initGoodsSkuSpecValueObjs,
......
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