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

Commit 02d6d2bd authored by 张国柄's avatar 张国柄

~API:店铺认证+MYSQL、商品规格处理;

parent db6ed7f2
package com.liquidnet.service.goblin.dto.manage; package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex; import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreCertificationVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreCertificationVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -33,11 +33,11 @@ public class GoblinStoreMgtCertificationParam implements java.io.Serializable { ...@@ -33,11 +33,11 @@ public class GoblinStoreMgtCertificationParam implements java.io.Serializable {
@NotBlank(message = "证件是否长期有效不能为空") @NotBlank(message = "证件是否长期有效不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "证件是否长期有效参数无效") @Pattern(regexp = "\\b(0|1)\\b", message = "证件是否长期有效参数无效")
private String personCertLasting; private String personCertLasting;
@ApiModelProperty(position = 17, required = true, value = "证件正面照[256]") @ApiModelProperty(position = 17, required = true, value = "证件正面照[256]", example = "http://pic.zhengzai.tv/202201/F1/50/1641481155557_6581EB9242485010CE0133147DF5D080.jpg")
private String personCertFpic; private String personCertFpic;
@ApiModelProperty(position = 18, required = true, value = "证件背面照[256]") @ApiModelProperty(position = 18, required = true, value = "证件背面照[256]", example = "http://pic.zhengzai.tv/202201/C3/C7/1641361041_5D81A954265418219490CB2538239880.jpg")
private String personCertBpic; private String personCertBpic;
@ApiModelProperty(position = 19, required = true, value = "证件手持照[256]") @ApiModelProperty(position = 19, required = true, value = "证件手持照[256]", example = "http://pic.zhengzai.tv/202201/81/30/1641362407_A60B2870D92EAD9B985289382A3ECA3A.jpg")
private String personCertSpic; private String personCertSpic;
@ApiModelProperty(position = 19, required = false, value = "省ID[20]", example = "110000") @ApiModelProperty(position = 19, required = false, value = "省ID[20]", example = "110000")
...@@ -66,7 +66,7 @@ public class GoblinStoreMgtCertificationParam implements java.io.Serializable { ...@@ -66,7 +66,7 @@ public class GoblinStoreMgtCertificationParam implements java.io.Serializable {
@NotBlank(message = "证件是否长期有效不能为空") @NotBlank(message = "证件是否长期有效不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "证件是否长期有效参数无效") @Pattern(regexp = "\\b(0|1)\\b", message = "证件是否长期有效参数无效")
private String busCertLasting; private String busCertLasting;
@ApiModelProperty(position = 30, required = false, value = "营业执照照片[256]") @ApiModelProperty(position = 30, required = false, value = "营业执照照片[256]", example = "http://pic.zhengzai.tv/202201/3C/00/1641369685_B1673980AE72DBF44E32BE88FCA3EBA2.jpg")
private String busCertPic; private String busCertPic;
@ApiModelProperty(position = 31, required = false, value = "资质证书照片[256]") @ApiModelProperty(position = 31, required = false, value = "资质证书照片[256]")
private String busQualityPic; private String busQualityPic;
......
...@@ -4,19 +4,25 @@ import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo; ...@@ -4,19 +4,25 @@ import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.Pattern;
@ApiModel(value = "GoblinStoreMgtCompleteParam", description = "店铺认证:认证资料入参") @ApiModel(value = "GoblinStoreMgtCompleteParam", description = "店铺认证:认证资料入参")
@Data @Data
public class GoblinStoreMgtCompleteParam implements java.io.Serializable { public class GoblinStoreMgtCompleteParam implements java.io.Serializable {
private static final long serialVersionUID = -5612313562282544613L; private static final long serialVersionUID = -5612313562282544613L;
@ApiModelProperty(position = 11, value = "店铺名称[128]") @ApiModelProperty(position = 11, value = "店铺名称[128]", example = "店铺名称...")
private String storeName; private String storeName;
@ApiModelProperty(position = 12, value = "店铺LOGO[256]") @ApiModelProperty(position = 12, value = "店铺LOGO[256]", example = "https://img.zhengzai.tv/files/2020/08/31/5f4c75095e9bc.png")
private String logoPic; private String logoPic;
@ApiModelProperty(position = 13, value = "店铺背景图[256]") @ApiModelProperty(position = 13, value = "店铺背景图[256]", example = "http://pic.zhengzai.tv/202201/CC/BF/1641361220_C8648990308E1C77247CCA0A37B68F07.jpg")
private String backgroundPic; private String backgroundPic;
@ApiModelProperty(position = 14, value = "店铺介绍[500]") @ApiModelProperty(position = 14, value = "店铺介绍[500]", example = "店铺介绍......")
private String introduce; private String introduce;
@ApiModelProperty(position = 15, value = "店铺类型[1-普通店铺|2-加盟|3-连锁|5-直营]", allowableValues = "1,2,3,5", example = "1")
@Pattern(regexp = "\\b(1|2|3|5)\\b", message = "店铺类型参数无效")
private String storeType;
public GoblinStoreInfoVo completeStoreInfoVo(GoblinStoreInfoVo vo) { public GoblinStoreInfoVo completeStoreInfoVo(GoblinStoreInfoVo vo) {
vo.setStoreName(this.getStoreName()); vo.setStoreName(this.getStoreName());
...@@ -24,6 +30,7 @@ public class GoblinStoreMgtCompleteParam implements java.io.Serializable { ...@@ -24,6 +30,7 @@ public class GoblinStoreMgtCompleteParam implements java.io.Serializable {
vo.setBackgroundPic(this.getBackgroundPic()); vo.setBackgroundPic(this.getBackgroundPic());
vo.setIntroduce(this.getIntroduce()); vo.setIntroduce(this.getIntroduce());
vo.setStatus("1"); vo.setStatus("1");
vo.setStoreType(StringUtils.isNotBlank(this.getStoreType()) ? this.getStoreType() : "1");
return vo; return vo;
} }
} }
\ No newline at end of file
...@@ -68,8 +68,8 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -68,8 +68,8 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
@ApiModelProperty(position = 23, required = true, value = "规格展现方式[1-常规|2-组合]", allowableValues = "1,2", example = "1") @ApiModelProperty(position = 23, required = true, value = "规格展现方式[1-常规|2-组合]", allowableValues = "1,2", example = "1")
private String specMode; private String specMode;
@ApiModelProperty(position = 24, required = true, value = "SKU规格信息") @ApiModelProperty(position = 24, required = false, value = "SKU规格信息[初次添加商品必填]")
@NotNull(message = "SKU规格信息不能为空") // @NotNull(message = "SKU规格信息不能为空")
@Valid @Valid
private List<GoblinStoreMgtGoodsAddSkuParam> skuParamList; private List<GoblinStoreMgtGoodsAddSkuParam> skuParamList;
@ApiModelProperty(position = 25, required = true, value = "物流模版", example = "松鼠德邦") @ApiModelProperty(position = 25, required = true, value = "物流模版", example = "松鼠德邦")
...@@ -157,7 +157,8 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -157,7 +157,8 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
vo.setStatus("1"); vo.setStatus("1");
// vo.setReason(null); // vo.setReason(null);
vo.setShelvesStatus("0"); vo.setShelvesStatus("0");
// vo.setSpuAppear(null); vo.setSpuAppear("0");
vo.setDelFlg("0");
// vo.setShelvesAt(null); // vo.setShelvesAt(null);
vo.setImageList(this.getImageList()); vo.setImageList(this.getImageList());
vo.setLogisticsTemplate(this.getLogisticsTemplate()); vo.setLogisticsTemplate(this.getLogisticsTemplate());
...@@ -249,6 +250,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -249,6 +250,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
// vo.setReason(); // vo.setReason();
vo.setShelvesStatus("0"); vo.setShelvesStatus("0");
vo.setSkuAppear(addSkuParam.getSkuAppear()); vo.setSkuAppear(addSkuParam.getSkuAppear());
vo.setDelFlg("0");
// vo.setShelvesAt(); // vo.setShelvesAt();
vo.setCreatedBy(goodsInfoVo.getCreatedBy()); vo.setCreatedBy(goodsInfoVo.getCreatedBy());
vo.setCreatedAt(goodsInfoVo.getCreatedAt()); vo.setCreatedAt(goodsInfoVo.getCreatedAt());
...@@ -269,14 +271,13 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable { ...@@ -269,14 +271,13 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
for (int j = 0; j < specSize; j++) { for (int j = 0; j < specSize; j++) {
GoblinGoodsSpecDto specDto = skuSpecList.get(j); GoblinGoodsSpecDto specDto = skuSpecList.get(j);
GoblinGoodsSpecValueVo specValueVo = GoblinGoodsSpecValueVo.getNew().setSpecVname(specDto.getSpecVname()).setSpecVsort(0); GoblinGoodsSpecValueVo specValueVo = GoblinGoodsSpecValueVo.getNew().setSpecVname(specDto.getSpecVname()).setSpecVsort(j);
if (i == 0) { if (i == 0) {
ArrayList<GoblinGoodsSpecValueVo> specValueVos = new ArrayList<>(); ArrayList<GoblinGoodsSpecValueVo> specValueVos = new ArrayList<>();
specValueVos.add(specValueVo); specValueVos.add(specValueVo);
goodsSpecVos.add(j, GoblinGoodsSpecVo.getNew() goodsSpecVos.add(j, GoblinGoodsSpecVo.getNew()
.setSpecName(specDto.getSpecName()).setSpecSort(0).setSpecValues(specValueVos)); .setSpecName(specDto.getSpecName()).setSpecSort(j).setSpecValues(specValueVos));
} else {// 补充规格对应的值 } else {// 补充规格对应的值
goodsSpecVos.get(j).getSpecValues().add(specValueVo); goodsSpecVos.get(j).getSpecValues().add(specValueVo);
} }
......
package com.liquidnet.service.goblin.dto.manage.vo; package com.liquidnet.service.goblin.dto.manage.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
...@@ -74,12 +74,14 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable { ...@@ -74,12 +74,14 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable {
private String shelvesStatus; private String shelvesStatus;
@ApiModelProperty(position = 37, value = "自定义展示[0-默认展示|1-隐藏不可购买]") @ApiModelProperty(position = 37, value = "自定义展示[0-默认展示|1-隐藏不可购买]")
private String spuAppear; private String spuAppear;
@ApiModelProperty(position = 38, value = "上架时间") @ApiModelProperty(position = 38, value = "删除标记[0-未删除|1-删除]")
private String delFlg;
@ApiModelProperty(position = 39, value = "上架时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime shelvesAt; private LocalDateTime shelvesAt;
@ApiModelProperty(position = 39, value = "商品图片列表") @ApiModelProperty(position = 40, value = "商品图片列表")
private List<String> imageList; private List<String> imageList;
@ApiModelProperty(position = 40, value = "物流模版") @ApiModelProperty(position = 41, value = "物流模版")
private String logisticsTemplate; private String logisticsTemplate;
private String createdBy; private String createdBy;
...@@ -88,6 +90,9 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable { ...@@ -88,6 +90,9 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable {
private String updatedBy; private String updatedBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
private String deletedBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime deletedAt;
@ApiModelProperty(position = 51, value = "规格信息") @ApiModelProperty(position = 51, value = "规格信息")
private List<GoblinGoodsSpecVo> specVoList; private List<GoblinGoodsSpecVo> specVoList;
......
...@@ -68,19 +68,25 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable { ...@@ -68,19 +68,25 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
private String shelvesStatus; private String shelvesStatus;
@ApiModelProperty(position = 33, value = "自定义展示[0-默认展示|1-隐藏不可购买]") @ApiModelProperty(position = 33, value = "自定义展示[0-默认展示|1-隐藏不可购买]")
private String skuAppear; private String skuAppear;
@ApiModelProperty(position = 34, value = "上架时间") @ApiModelProperty(position = 34, value = "删除标记[0-未删除|1-删除]")
private String delFlg;
@ApiModelProperty(position = 35, value = "上架时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime shelvesAt; private LocalDateTime shelvesAt;
@ApiModelProperty(position = 34, value = "活动Id") @ApiModelProperty(position = 36, value = "活动Id")
private String marketId; private String marketId;
@ApiModelProperty(position = 37, value = "物流模版ID")
private String logisticsTemplate;
private String createdBy; private String createdBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt; private LocalDateTime createdAt;
private String updatedBy; private String updatedBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
@ApiModelProperty(position = 35, value = "物流模版ID") private String deletedBy;
private String logisticsTemplate; @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime deletedAt;
@ApiModelProperty(position = 40, value = "单品规格信息") @ApiModelProperty(position = 40, value = "单品规格信息")
private List<GoblinGoodsSpecDto> skuSpecList; private List<GoblinGoodsSpecDto> skuSpecList;
......
...@@ -2,7 +2,6 @@ package com.liquidnet.service.goblin.dto.vo; ...@@ -2,7 +2,6 @@ package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreCertificationVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package com.liquidnet.service.goblin.dto.manage.vo; package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
...@@ -59,9 +59,6 @@ public class GoblinStoreCertificationVo implements Serializable, Cloneable { ...@@ -59,9 +59,6 @@ public class GoblinStoreCertificationVo implements Serializable, Cloneable {
private String busCertPic; private String busCertPic;
@ApiModelProperty(position = 32, value = "资质证书照片[256]") @ApiModelProperty(position = 32, value = "资质证书照片[256]")
private String busQualityPic; private String busQualityPic;
private String updatedBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt;
private static final GoblinStoreCertificationVo obj = new GoblinStoreCertificationVo(); private static final GoblinStoreCertificationVo obj = new GoblinStoreCertificationVo();
public static GoblinStoreCertificationVo getNew() { public static GoblinStoreCertificationVo getNew() {
......
package com.liquidnet.service.goblin.dto.vo; package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreCertificationVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -13,6 +13,7 @@ import java.time.LocalDateTime; ...@@ -13,6 +13,7 @@ import java.time.LocalDateTime;
@ApiModel(value = "GoblinStoreInfoVo", description = "店铺基础信息") @ApiModel(value = "GoblinStoreInfoVo", description = "店铺基础信息")
@Data @Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinStoreInfoVo implements Serializable, Cloneable { public class GoblinStoreInfoVo implements Serializable, Cloneable {
private static final long serialVersionUID = -2268722236055938975L; private static final long serialVersionUID = -2268722236055938975L;
@ApiModelProperty(position = 11, value = "店铺ID[64]") @ApiModelProperty(position = 11, value = "店铺ID[64]")
...@@ -42,14 +43,19 @@ public class GoblinStoreInfoVo implements Serializable, Cloneable { ...@@ -42,14 +43,19 @@ public class GoblinStoreInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 23, value = "店铺有效期") @ApiModelProperty(position = 23, value = "店铺有效期")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime validity; private LocalDateTime validity;
@ApiModelProperty(position = 24, value = "删除标记[0-未删除|1-删除]")
private String delFlg;
private String createdBy; private String createdBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt; private LocalDateTime createdAt;
private String updatedBy; private String updatedBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
private String deletedBy;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime deletedAt;
@ApiModelProperty(position = 25, value = "店铺认证信息") @ApiModelProperty(position = 30, value = "店铺认证信息")
private GoblinStoreCertificationVo certificationVo; private GoblinStoreCertificationVo certificationVo;
......
...@@ -2,19 +2,33 @@ package com.liquidnet.service.goblin.service.manage; ...@@ -2,19 +2,33 @@ package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCertificationParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCertificationParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCompleteParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCompleteParam;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
public interface IGoblinStoreMgtCertificationService { public interface IGoblinStoreMgtCertificationService {
/** /**
* 店铺认证:认证资料保存 * 店铺认证:认证资料保存
* *
* @param param GoblinStoreMgtCertificationParam * @param param GoblinStoreMgtCertificationParam
* @param storeInfoVo GoblinStoreInfoVo
* @return GoblinStoreInfoVo
*/ */
void certificationInformationProcessing(GoblinStoreMgtCertificationParam param); GoblinStoreInfoVo certificationInformationProcessing(GoblinStoreMgtCertificationParam param, GoblinStoreInfoVo storeInfoVo);
/** /**
* 店铺认证:完善信息保存 * 店铺认证:完善信息保存
* *
* @param param GoblinStoreMgtCompleteParam * @param param GoblinStoreMgtCompleteParam
* @param storeInfoVo GoblinStoreInfoVo
* @return boolean
*/ */
void certificationCompleteProcessing(GoblinStoreMgtCompleteParam param); boolean certificationCompleteProcessing(GoblinStoreMgtCompleteParam param, GoblinStoreInfoVo storeInfoVo);
/**
* 店铺认证:删除店铺处理
*
* @param storeId 店铺ID
* @param uid UID
* @return boolean
*/
boolean certificationCancelProcessing(String storeId, String uid);
} }
...@@ -5,6 +5,7 @@ import com.liquidnet.service.goblin.dto.manage.*; ...@@ -5,6 +5,7 @@ import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
public interface IGoblinstoreMgtGoodsService { public interface IGoblinstoreMgtGoodsService {
/** /**
...@@ -43,9 +44,10 @@ public interface IGoblinstoreMgtGoodsService { ...@@ -43,9 +44,10 @@ public interface IGoblinstoreMgtGoodsService {
* 商品管理:商品编辑:SKU编辑 * 商品管理:商品编辑:SKU编辑
* *
* @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam * @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam
* @param goodsInfoVo GoblinGoodsInfoVo
* @return boolean * @return boolean
*/ */
boolean goodsEditSku(GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam); boolean goodsEditSku(GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo);
/** /**
* 商品管理:商品编辑:SKU添加 * 商品管理:商品编辑:SKU添加
...@@ -58,11 +60,10 @@ public interface IGoblinstoreMgtGoodsService { ...@@ -58,11 +60,10 @@ public interface IGoblinstoreMgtGoodsService {
/** /**
* 商品管理:商品编辑:SKU删除 * 商品管理:商品编辑:SKU删除
* *
* @param spuId 商品ID * @param goodsSkuInfoVo GoblinGoodsSkuInfoVo
* @param skuId 单品ID
* @return boolean * @return boolean
*/ */
boolean goodsEditSkuDel(String spuId, String skuId); boolean goodsEditSkuDel(GoblinGoodsSkuInfoVo goodsSkuInfoVo);
/** /**
* 商品管理:商品编辑:SKU批改 * 商品管理:商品编辑:SKU批改
......
...@@ -201,6 +201,8 @@ public class MQConst { ...@@ -201,6 +201,8 @@ public class MQConst {
} }
public enum GoblinQueue { public enum GoblinQueue {
SQL_STORE("goblin:stream:sql.store", "group.sql.ustore", "店铺相关"),
SQL_GOODS("goblin:stream:sql.goods", "group.sql.ustore", "商品相关"),
GOBLIN_STORE_MARKET("goblin:stream:store.market", "group.store.market", "店铺活动"), GOBLIN_STORE_MARKET("goblin:stream:store.market", "group.store.market", "店铺活动"),
GOBLIN_SELF_MARKET("goblin:stream:self.market", "group.self.market", "平台活动"), GOBLIN_SELF_MARKET("goblin:stream:self.market", "group.self.market", "平台活动"),
GOBLIN_ORDER_CREATE_PAY("goblin:stream:order:create_pay", "group.order:create_pay", "订单创建&支付"), GOBLIN_ORDER_CREATE_PAY("goblin:stream:order:create_pay", "group.order:create_pay", "订单创建&支付"),
......
...@@ -90,6 +90,11 @@ public class GoblinStoreInfo implements Serializable { ...@@ -90,6 +90,11 @@ public class GoblinStoreInfo implements Serializable {
*/ */
private LocalDateTime validity; private LocalDateTime validity;
/**
* 删除标记[0-未删除|1-删除]
*/
private String delFlg;
private String createdBy; private String createdBy;
private LocalDateTime createdAt; private LocalDateTime createdAt;
......
package com.liquidnet.service.consumer.goblin.config;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlGoodsRdsReceiver;
import com.liquidnet.service.consumer.goblin.receiver.ConsumerGoblinSqlStoreRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.time.Duration;
import static com.liquidnet.service.base.constant.MQConst.AdamQueue;
@Configuration
public class ConsumerGoblinSqlUstoreRedisStreamConfig {
@Autowired
ConsumerGoblinSqlStoreRdsReceiver consumerGoblinSqlStoreRdsReceiver;
@Autowired
ConsumerGoblinSqlGoodsRdsReceiver consumerGoblinSqlGoodsRdsReceiver;
private StreamMessageListenerContainer<String, MapRecord<String, String, String>> buildStreamMessageListenerContainer(RedisConnectionFactory factory) {
var options = StreamMessageListenerContainer
.StreamMessageListenerContainerOptions
.builder()
.pollTimeout(Duration.ofMillis(1))
.build();
return StreamMessageListenerContainer.create(factory, options);
}
/**
* 店铺相关
*
* @param listenerContainer StreamMessageListenerContainer
* @param t 消费者序号
* @return Subscription
*/
private Subscription receiveSqlStore(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(
Consumer.from(MQConst.GoblinQueue.SQL_STORE.getGroup(), MQConst.GoblinQueue.SQL_STORE.name() + t),
StreamOffset.create(MQConst.GoblinQueue.SQL_STORE.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlStoreRdsReceiver
);
}
/**
* 商品相关
*
* @param listenerContainer StreamMessageListenerContainer
* @param t 消费者序号
* @return Subscription
*/
private Subscription receiveSqlGoods(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(
Consumer.from(MQConst.GoblinQueue.SQL_GOODS.getGroup(), MQConst.GoblinQueue.SQL_GOODS.name() + t),
StreamOffset.create(MQConst.GoblinQueue.SQL_GOODS.getKey(), ReadOffset.lastConsumed()), consumerGoblinSqlGoodsRdsReceiver
);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 店铺相关 */
@Bean
public Subscription subscriptionSqlStore1(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlStore(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlStore2(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlStore(listenerContainer, 2);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlStore3(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlStore(listenerContainer, 3);
listenerContainer.start();
return subscription;
}
/* -------------------------------------------------------- | 用户中心 */
@Bean
public Subscription subscriptionSqlGoods1(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlGoods2(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 2);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlGoods3(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlGoods(listenerContainer, 3);
listenerContainer.start();
return subscription;
}
/* -------------------------------------------------------- | */
}
package com.liquidnet.service.consumer.goblin.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlGoodsRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_GOODS.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_GOODS.getGroup();
}
}
package com.liquidnet.service.consumer.goblin.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerGoblinSqlStoreRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.SQL_STORE.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.SQL_STORE.getGroup();
}
}
...@@ -9,7 +9,7 @@ eureka: ...@@ -9,7 +9,7 @@ eureka:
spring: spring:
cloud: cloud:
config: config:
# uri: http://39.106.122.201:7002/support-config # uri: http://39.107.71.112:7002/support-config
profile: ${liquidnet.cloudConfig.profile} profile: ${liquidnet.cloudConfig.profile}
name: ${spring.application.name} #默认为spring.application.name name: ${spring.application.name} #默认为spring.application.name
discovery: discovery:
......
...@@ -96,7 +96,7 @@ create table goblin_store_info ...@@ -96,7 +96,7 @@ create table goblin_store_info
mid bigint auto_increment primary key, mid bigint auto_increment primary key,
store_id varchar(64) not null comment '店铺id', store_id varchar(64) not null comment '店铺id',
uid varchar(64) not null comment '店主UID', uid varchar(64) not null comment '店主UID',
store_name varchar(128) not null comment '店铺名称', store_name varchar(128) null comment '店铺名称',
logo_pic varchar(256) null comment '店铺LOGO', logo_pic varchar(256) null comment '店铺LOGO',
background_pic varchar(256) null comment '店铺背景图', background_pic varchar(256) null comment '店铺背景图',
introduce varchar(500) null comment '店铺介绍', introduce varchar(500) null comment '店铺介绍',
...@@ -107,6 +107,7 @@ create table goblin_store_info ...@@ -107,6 +107,7 @@ create table goblin_store_info
ave_score decimal(8, 2) default 0.0 comment '店铺评分', ave_score decimal(8, 2) default 0.0 comment '店铺评分',
service_acc varchar(128) null comment '客服账号',# == service_acc varchar(128) null comment '客服账号',# ==
validity datetime null comment '店铺有效期', validity datetime null comment '店铺有效期',
del_flg char default '0' comment '删除标记[0-未删除|1-删除]',
created_by varchar(64) not null, created_by varchar(64) not null,
created_at datetime not null, created_at datetime not null,
updated_by varchar(64) null, updated_by varchar(64) null,
......
#---- 店铺相关
XADD goblin:stream:sql.store * 0 0
XGROUP CREATE goblin:stream:sql.store group.sql.ustore 0
#---- 商品相关
XADD goblin:stream:sql.goods * 0 0
XGROUP CREATE goblin:stream:sql.goods group.sql.ustore 0
#---- #
XADD goblin:stream:store.market * 0 0 XADD goblin:stream:store.market * 0 0
XGROUP CREATE goblin:stream:store.market group.store.market 0 XGROUP CREATE goblin:stream:store.market group.store.market 0
...@@ -12,3 +19,4 @@ XGROUP CREATE goblin:stream:order:again group.order:again 0 ...@@ -12,3 +19,4 @@ XGROUP CREATE goblin:stream:order:again group.order:again 0
XADD goblin:stream:order:close * 0 0 XADD goblin:stream:order:close * 0 0
XGROUP CREATE goblin:stream:order:close group.order:close 0 XGROUP CREATE goblin:stream:order:close group.order:close 0
#---- #
\ No newline at end of file
...@@ -13,16 +13,18 @@ import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtCertificationS ...@@ -13,16 +13,18 @@ import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtCertificationS
import com.liquidnet.service.goblin.util.GoblinMongoUtils; import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.Arrays;
import java.util.List;
@ApiSupport(order = 149001) @ApiSupport(order = 149001)
@Api(tags = "店铺认证") @Api(tags = "店铺认证")
...@@ -38,26 +40,41 @@ public class GoblinStoreMgtCertificationController { ...@@ -38,26 +40,41 @@ public class GoblinStoreMgtCertificationController {
@Autowired @Autowired
GoblinRedisUtils goblinRedisUtils; GoblinRedisUtils goblinRedisUtils;
public static final List<String> ENABLE_CERT_STATUS = Arrays.asList("0", "2");
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "店铺认证第一步:认证资料") @ApiOperation(value = "店铺认证第一步:认证资料")
@PostMapping("fstep") @PostMapping("fstep")
public ResponseDto<Object> certificationFirstStep(@Valid @RequestBody GoblinStoreMgtCertificationParam certificationParam) { public ResponseDto<String> certificationFirstStep(@Valid @RequestBody GoblinStoreMgtCertificationParam certificationParam) {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(CurrentUtil.getCurrentUid());
if (null != storeInfoVo && !ENABLE_CERT_STATUS.contains(storeInfoVo.getStatus())) {
log.warn("店铺认证:无效请求:店铺已认证,无需再次认证[UID={},storeId={},storeStatus={}]", CurrentUtil.getCurrentUid(), storeInfoVo.getStoreId(), storeInfoVo.getStatus());
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("店铺认证[GoblinStoreMgtCertificationParam:{}]", JsonUtils.toJson(certificationParam)); log.debug("店铺认证[GoblinStoreMgtCertificationParam:{}]", JsonUtils.toJson(certificationParam));
} }
goblinStoreMgtCertificationService.certificationInformationProcessing(certificationParam); storeInfoVo = goblinStoreMgtCertificationService.certificationInformationProcessing(certificationParam, storeInfoVo);
return ResponseDto.success(); return ResponseDto.success(storeInfoVo.getStoreId());
} }
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "店铺认证第二步:完善信息") @ApiOperation(value = "店铺认证第二步:完善信息")
@PostMapping("sstep") @PostMapping("sstep")
public ResponseDto<Object> certificationSecondStep(@Valid @RequestBody GoblinStoreMgtCompleteParam completeParam) { public ResponseDto<Object> certificationSecondStep(@Valid @RequestBody GoblinStoreMgtCompleteParam completeParam) {
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVoByUid(CurrentUtil.getCurrentUid());
if (null == storeInfoVo) {
log.warn("店铺认证:完善信息:店铺信息不存在,请按流程完成第一步:[UID={}]", CurrentUtil.getCurrentUid());
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (!ENABLE_CERT_STATUS.contains(storeInfoVo.getStatus())) {
log.warn("店铺认证:无效请求:店铺已认证,无需再次认证[UID={},storeId={},storeStatus={}]", CurrentUtil.getCurrentUid(), storeInfoVo.getStoreId(), storeInfoVo.getStatus());
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("店铺认证[GoblinStoreMgtCompleteParam:{}]", JsonUtils.toJson(completeParam)); log.debug("店铺认证[GoblinStoreMgtCompleteParam:{}]", JsonUtils.toJson(completeParam));
} }
goblinStoreMgtCertificationService.certificationCompleteProcessing(completeParam); return ResponseDto.success(goblinStoreMgtCertificationService.certificationCompleteProcessing(completeParam, storeInfoVo));
return ResponseDto.success();
} }
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
...@@ -76,19 +93,18 @@ public class GoblinStoreMgtCertificationController { ...@@ -76,19 +93,18 @@ public class GoblinStoreMgtCertificationController {
} }
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "店铺认证编辑中:删除店铺") @ApiOperation(value = "删除店铺")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺ID"),
})
@PostMapping("cancel") @PostMapping("cancel")
public ResponseDto<Object> certificationCancel(String storeId) { public ResponseDto<Object> certificationCancel(@NotBlank(message = "店铺ID不能为空") @RequestParam String storeId) {
if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeId)) { String currentUid = CurrentUtil.getCurrentUid();
// if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
if (!goblinRedisUtils.hasStoreId(currentUid, storeId) || storeId.equals("1")) {// TODO: 2022/1/7 zhanggb del
return ResponseDto.failure(ErrorMapping.get("149002")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId); log.info("删除店铺[UID={},storeId={}]", currentUid, storeId);
if (null != storeInfoVo) { return ResponseDto.success(goblinStoreMgtCertificationService.certificationCancelProcessing(storeId, currentUid));
if (goblinMongoUtils.delStoreInfoVo(storeId)) {
goblinRedisUtils.delStoreId(CurrentUtil.getCurrentUid(), storeId);
goblinRedisUtils.delStoreInfoVo(storeId);
}
}
return ResponseDto.success();
} }
} }
...@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.service.impl.manage; ...@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil; import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsActionParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsActionParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsAddParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsEditSkuParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsEditSkuParam;
...@@ -23,6 +24,8 @@ import org.springframework.util.CollectionUtils; ...@@ -23,6 +24,8 @@ import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsService { public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsService {
...@@ -133,9 +136,12 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -133,9 +136,12 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
} }
@Override @Override
public boolean goodsEditSku(GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam) { public boolean goodsEditSku(GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo) {
GoblinGoodsSkuInfoVo editGoodsSkuInfoVo = storeMgtGoodsEditSkuParam.initEditGoodsSkuInfoVo(); GoblinGoodsSkuInfoVo editGoodsSkuInfoVo = storeMgtGoodsEditSkuParam.initEditGoodsSkuInfoVo();
if (goblinMongoUtils.updateGoodsSkuInfoVo(editGoodsSkuInfoVo)) { if (goblinMongoUtils.updateGoodsSkuInfoVo(editGoodsSkuInfoVo)) {
if (!CollectionUtils.isEmpty(storeMgtGoodsEditSkuParam.getSkuSpecList())) {// 更改了规格,需要同步SPU里的规格信息
goblinMongoUtils.updateGoodsInfoVo(goodsInfoVo);
}
// TODO: 2022/1/5 zhanggb redis+sql // TODO: 2022/1/5 zhanggb redis+sql
return true; return true;
...@@ -152,6 +158,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -152,6 +158,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
GoblinGoodsSkuInfoVo addGoodsSkuInfoVo = storeMgtGoodsEditSkuParam.initEditAddGoodsSkuInfoVo(); GoblinGoodsSkuInfoVo addGoodsSkuInfoVo = storeMgtGoodsEditSkuParam.initEditAddGoodsSkuInfoVo();
addGoodsSkuInfoVo.setSkuId(spuId.concat(StringUtils.right(String.valueOf(System.nanoTime()), 5))); addGoodsSkuInfoVo.setSkuId(spuId.concat(StringUtils.right(String.valueOf(System.nanoTime()), 5)));
addGoodsSkuInfoVo.setSpuId(spuId); addGoodsSkuInfoVo.setSpuId(spuId);
addGoodsSkuInfoVo.setSkuNo(goodsInfoVo.getSpuNo());
addGoodsSkuInfoVo.setName(goodsInfoVo.getName()); addGoodsSkuInfoVo.setName(goodsInfoVo.getName());
addGoodsSkuInfoVo.setSubtitle(goodsInfoVo.getSubtitle()); addGoodsSkuInfoVo.setSubtitle(goodsInfoVo.getSubtitle());
addGoodsSkuInfoVo.setVirtualFlg(goodsInfoVo.getVirtualFlg()); addGoodsSkuInfoVo.setVirtualFlg(goodsInfoVo.getVirtualFlg());
...@@ -173,15 +180,45 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -173,15 +180,45 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
} }
@Override @Override
public boolean goodsEditSkuDel(String spuId, String skuId) { public boolean goodsEditSkuDel(GoblinGoodsSkuInfoVo goodsSkuInfoVo) {
goblinRedisUtils.delGoodsSkuInfoVo(skuId); String skuId = goodsSkuInfoVo.getSkuId();
goblinMongoUtils.delGoodsSkuInfoVo(skuId);
GoblinGoodsInfoVo mgtGoodsInfoVo = goblinRedisUtils.getMgtGoodsInfoVo(spuId); GoblinGoodsInfoVo mgtGoodsInfoVo = goblinRedisUtils.getMgtGoodsInfoVo(goodsSkuInfoVo.getSpuId());
List<String> skuIdList = mgtGoodsInfoVo.getSkuIdList(); List<String> skuIdList = mgtGoodsInfoVo.getSkuIdList();
skuIdList.removeIf(r -> r.equals(skuId)); skuIdList.removeIf(r -> r.equals(skuId));
mgtGoodsInfoVo.setSkuIdList(skuIdList); mgtGoodsInfoVo.setSkuIdList(skuIdList);
List<GoblinGoodsSpecVo> specVoList = mgtGoodsInfoVo.getSpecVoList();
Map<String, String> delGoodsSkuSpecMap = goodsSkuInfoVo.getSkuSpecList().stream()
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname, (k1, k2) -> k2));
for (int i = 0; i < specVoList.size(); i++) {// 处理商品规格信息
GoblinGoodsSpecVo specVo = specVoList.get(i);
List<GoblinGoodsSpecValueVo> modifySpecValues = ObjectUtil.getGoblinGoodsSpecValueVoArrayList();
String delSpecVname = delGoodsSkuSpecMap.get(specVo.getSpecName());
List<GoblinGoodsSpecValueVo> specValues = specVo.getSpecValues();
Integer rmIdx = null;
for (GoblinGoodsSpecValueVo specValue : specValues) {
if (specValue.getSpecVname().equals(delSpecVname)) {
modifySpecValues.remove(specValue);
rmIdx = specValue.getSpecVsort();
} else {
modifySpecValues.add(specValue);
}
if (null != rmIdx && specValue.getSpecVsort() > rmIdx) {
specValue.setSpecVsort(specValue.getSpecVsort() - 1);
}
}
if (modifySpecValues.size() == 0) {// 规格下规格值为0的时候,移除规格
specVoList.remove(specVo);
} else {
specVo.setSpecValues(modifySpecValues);
}
}
goblinMongoUtils.delGoodsSkuInfoVo(skuId);
goblinRedisUtils.delGoodsSkuInfoVo(skuId);
// TODO: 2022/1/5 zhanggb redis+sql // TODO: 2022/1/5 zhanggb redis+sql
return goblinMongoUtils.updateGoodsInfoVo(mgtGoodsInfoVo); return goblinMongoUtils.updateGoodsInfoVo(mgtGoodsInfoVo);
......
...@@ -18,14 +18,15 @@ import org.springframework.data.mongodb.core.MongoTemplate; ...@@ -18,14 +18,15 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter; import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Component @Component
public class GoblinMongoUtils { public class GoblinMongoUtils {
...@@ -76,9 +77,10 @@ public class GoblinMongoUtils { ...@@ -76,9 +77,10 @@ public class GoblinMongoUtils {
return mongoTemplate.insert(vo, GoblinStoreInfoVo.class.getSimpleName()); return mongoTemplate.insert(vo, GoblinStoreInfoVo.class.getSimpleName());
} }
public boolean delStoreInfoVo(String storeId) { public boolean delStoreInfoVo(String storeId, String uid, LocalDateTime time) {
return mongoTemplate.remove(Query.query(Criteria.where("storeId").is(storeId)), return mongoTemplate.updateFirst(Query.query(Criteria.where("storeId").is(storeId)),
GoblinStoreInfoVo.class, GoblinStoreInfoVo.class.getSimpleName()).getDeletedCount() > 0; Update.update("delFlg", 1).set("updatedBy", uid).set("updatedAt", time).set("deletedBy", uid).set("deletedAt", time),
GoblinStoreInfoVo.class.getSimpleName()).getModifiedCount() > 0;
} }
public boolean updateStoreInfoVo(GoblinStoreInfoVo vo) { public boolean updateStoreInfoVo(GoblinStoreInfoVo vo) {
...@@ -111,6 +113,24 @@ public class GoblinMongoUtils { ...@@ -111,6 +113,24 @@ public class GoblinMongoUtils {
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()).getDeletedCount() > 0; GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()).getDeletedCount() > 0;
} }
public List<String> delGoodsInfoVoByStoreId(String storeId, String uid, LocalDateTime time) {
Query query = Query.query(Criteria.where("storeId").is(storeId).and("shelves_status").is("3"));
query.fields().include("spuId");
List<GoblinGoodsInfoVo> storeSpus = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
List<String> storeSpuIdList = CollectionUtil.arrayListString();
if (!CollectionUtils.isEmpty(storeSpus)) {
storeSpuIdList = storeSpus.stream().map(GoblinGoodsInfoVo::getSpuId).collect(Collectors.toList());
UpdateResult updateResult = mongoTemplate.updateMulti(Query.query(Criteria.where("spuId").in(storeSpuIdList)),
Update.update("delFlg", 1).set("updatedBy", uid).set("updatedAt", time).set("deletedBy", uid).set("deletedAt", time),
GoblinGoodsInfoVo.class.getSimpleName());
if (updateResult.getModifiedCount() > 0) {
return storeSpuIdList;
}
}
return storeSpuIdList;
}
// SPU分页 // SPU分页
public PagedResult<GoblinStoreMgtGoodsListVo> getGoodsInfoVo(GoblinStoreMgtGoodsFilterParam filterParam) { public PagedResult<GoblinStoreMgtGoodsListVo> getGoodsInfoVo(GoblinStoreMgtGoodsFilterParam filterParam) {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
...@@ -196,6 +216,24 @@ public class GoblinMongoUtils { ...@@ -196,6 +216,24 @@ public class GoblinMongoUtils {
GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName()).getDeletedCount() > 0; GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName()).getDeletedCount() > 0;
} }
public List<String> delGoodsSkuInfoVoByStoreId(String storeId, String uid, LocalDateTime time) {
Query query = Query.query(Criteria.where("storeId").is(storeId).and("shelves_status").is("3"));
query.fields().include("skuId");
List<GoblinGoodsSkuInfoVo> storeSkus = mongoTemplate.find(query, GoblinGoodsSkuInfoVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
List<String> storeSkuIdList = CollectionUtil.arrayListString();
if (!CollectionUtils.isEmpty(storeSkus)) {
storeSkuIdList = storeSkus.stream().map(GoblinGoodsSkuInfoVo::getSkuId).collect(Collectors.toList());
UpdateResult updateResult = mongoTemplate.updateMulti(Query.query(Criteria.where("skuId").in(storeSkuIdList)),
Update.update("delFlg", 1).set("updatedBy", uid).set("updatedAt", time).set("deletedBy", uid).set("deletedAt", time),
GoblinGoodsSkuInfoVo.class.getSimpleName());
if (updateResult.getModifiedCount() > 0) {
return storeSkuIdList;
}
}
return storeSkuIdList;
}
// SKU信息 // SKU信息
public GoblinGoodsSkuInfoVo getGoodsSkuInfoVo(String skuId) { public GoblinGoodsSkuInfoVo getGoodsSkuInfoVo(String skuId) {
return mongoTemplate.findOne(Query.query(Criteria.where("skuId").is(skuId).and("shelvesStatus").is("3")), return mongoTemplate.findOne(Query.query(Criteria.where("skuId").is(skuId).and("shelvesStatus").is("3")),
...@@ -218,8 +256,7 @@ public class GoblinMongoUtils { ...@@ -218,8 +256,7 @@ public class GoblinMongoUtils {
} }
public boolean updateGoodsSkuInfoVoBySpuId(GoblinGoodsSkuInfoVo vo) { public boolean updateGoodsSkuInfoVoBySpuId(GoblinGoodsSkuInfoVo vo) {
return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName()) return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName()).updateMany(
.updateOne(
Query.query(Criteria.where("spuId").is(vo.getSpuId())).getQueryObject(), Query.query(Criteria.where("spuId").is(vo.getSpuId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo)) ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0; ).getModifiedCount() > 0;
......
...@@ -69,6 +69,16 @@ public class GoblinRedisUtils { ...@@ -69,6 +69,16 @@ public class GoblinRedisUtils {
return redisUtil.set(GoblinRedisConst.BASIC_USTORE.concat(uid), storeIds); return redisUtil.set(GoblinRedisConst.BASIC_USTORE.concat(uid), storeIds);
} }
public boolean addStoreId(String uid, String storeId) {
List<String> storeIds = this.getStoreIds(uid);
// if (CollectionUtils.isEmpty(storeIds)) {
if (CollectionUtils.isEmpty(storeIds) || storeIds.contains("1")) {// TODO: 2022/1/6 zhanggb del
storeIds = CollectionUtil.arrayListString();
}
storeIds.add(storeId);
return this.setStoreIds(uid, storeIds);
}
public void delStoreIds(String uid) { public void delStoreIds(String uid) {
redisUtil.del(GoblinRedisConst.BASIC_USTORE.concat(uid)); redisUtil.del(GoblinRedisConst.BASIC_USTORE.concat(uid));
} }
...@@ -83,7 +93,9 @@ public class GoblinRedisUtils { ...@@ -83,7 +93,9 @@ public class GoblinRedisUtils {
public List<String> getStoreIds(String uid) { public List<String> getStoreIds(String uid) {
// return (List<String>) redisUtil.get(GoblinRedisConst.BASIC_USTORE.concat(uid)); // return (List<String>) redisUtil.get(GoblinRedisConst.BASIC_USTORE.concat(uid));
return Arrays.asList("1");// TODO: 2022/1/5 zhanggb // return Arrays.asList("1");// TODO: 2022/1/5 zhanggb
List<String> list = (List<String>) redisUtil.get(GoblinRedisConst.BASIC_USTORE.concat(uid));
return CollectionUtils.isEmpty(list) ? Arrays.asList("1") : list;
} }
public boolean hasStoreId(String uid, String storeId) { public boolean hasStoreId(String uid, String storeId) {
......
...@@ -24,6 +24,7 @@ public class ObjectUtil { ...@@ -24,6 +24,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinStoreMgtThumbVo> goblinStoreMgtThumbVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinStoreMgtThumbVo> goblinStoreMgtThumbVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSpecValueVo> goblinGoodsSpecValueVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinServiceSupportVo> goblinServiceSupportVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinServiceSupportVo> goblinServiceSupportVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinSelfTagVo> goblinSelfTagVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinSelfTagVo> goblinSelfTagVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsTagVo> goblinGoodsTagVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsTagVo> goblinGoodsTagVoArrayList = new ArrayList<>();
...@@ -112,6 +113,10 @@ public class ObjectUtil { ...@@ -112,6 +113,10 @@ public class ObjectUtil {
return (ArrayList<GoblinGoodsSpecVo>) goblinGoodsSpecVoArrayList.clone(); return (ArrayList<GoblinGoodsSpecVo>) goblinGoodsSpecVoArrayList.clone();
} }
public static ArrayList<GoblinGoodsSpecValueVo> getGoblinGoodsSpecValueVoArrayList() {
return (ArrayList<GoblinGoodsSpecValueVo>) goblinGoodsSpecValueVoArrayList.clone();
}
public static ArrayList<GoblinServiceSupportVo> getGoblinServiceSupportVoArrayList() { public static ArrayList<GoblinServiceSupportVo> getGoblinServiceSupportVoArrayList() {
return (ArrayList<GoblinServiceSupportVo>) goblinServiceSupportVoArrayList.clone(); return (ArrayList<GoblinServiceSupportVo>) goblinServiceSupportVoArrayList.clone();
} }
......
#---- 店铺信息
goblin_store_info.insert_by_cert=INSERT INTO goblin_store_info (store_id,uid,status,store_type,cert_type,created_by,created_at)VALUES(?,?,?,?,?,?,?)
goblin_store_info.update_by_cert1=UPDATE goblin_store_info SET store_type=?,cert_type=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_cert2=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,store_type=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_del=UPDATE goblin_store_info SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_certification.insert_by_cert=INSERT INTO goblin_store_certification (store_id,person_cert_type,person_name,person_cert_code,person_cert_validity,person_cert_lasting,person_cert_fpic,person_cert_bpic,person_cert_spic,province_id,province_name,city_id,city_name,county_id,county_name,bus_address,bus_name,bus_cert_code,bus_cert_validity,bus_cert_lasting,bus_cert_pic,bus_quality_pic,created_by,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET person_cert_type=?,person_name=?,person_cert_code=?,person_cert_validity=?,person_cert_lasting=?,person_cert_fpic=?,person_cert_bpic=?,person_cert_spic=?,province_id=?,province_name=?,city_id=?,city_name=?,county_id=?,county_name=?,bus_address=?,bus_name=?,bus_cert_code=?,bus_cert_validity=?,bus_cert_lasting=?,bus_cert_pic=?,bus_quality_pic=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_certification.update_by_del=UPDATE goblin_store_certification SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=?
#---- 商品信息
goblin_goods.update_by_del=UPDATE goblin_goods SET del_flg=1,updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=?
goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg=1,updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=?
#---- 商铺活动 #---- 商铺活动
goblin.store.market.insert=INSERT INTO goblin_store_marketing (`store_market_id`,`name`,`type`,`status`,`store_id`,`start_time`,`end_time`,`del_flag`,`is_pre`,`pre_time`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?) goblin.store.market.insert=INSERT INTO goblin_store_marketing (`store_market_id`,`name`,`type`,`status`,`store_id`,`start_time`,`end_time`,`del_flag`,`is_pre`,`pre_time`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?)
goblin.store.market.status=UPDATE goblin_store_marketing SET status=? , del_flag=? WHERE store_market_id =? and store_id =? goblin.store.market.status=UPDATE goblin_store_marketing SET status=? , del_flag=? WHERE store_market_id =? and store_id =?
......
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