Commit 3584caa79a3247e955ea769e65426cc3caf3f3c4

Authored by dengwei
1 parent c8a146df

feat zr init

etrade-boss/build.gradle
1 group = 'com.diligrp' 1 group = 'com.diligrp'
2 -archivesBaseName = 'etrade-boss' 2 +archivesBaseName = 'zr-etrade'
3 3
4 jar.enabled = false 4 jar.enabled = false
5 bootJar { 5 bootJar {
6 enabled = true 6 enabled = true
7 - archiveBaseName = 'etrade-boss' 7 + archiveBaseName = 'zr-etrade'
8 } 8 }
9 9
10 dependencies { 10 dependencies {
etrade-ecap/lib/ECAP_3.0_20240708135028.jar 0 → 100644
No preview for this file type
etrade-ecap/lib/lop-opensdk-support-1.0.28-SNAPSHOT.jar 0 → 100644
No preview for this file type
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartImpl.java
@@ -100,7 +100,8 @@ public class ShopCartImpl implements IShopCartService { @@ -100,7 +100,8 @@ public class ShopCartImpl implements IShopCartService {
100 Map<Integer, ProductPresetVo> map = new HashMap<>(); 100 Map<Integer, ProductPresetVo> map = new HashMap<>();
101 List<ProductPresetVo> presets = productListVo.getPresets(); 101 List<ProductPresetVo> presets = productListVo.getPresets();
102 for (ProductPresetVo preset : presets) { 102 for (ProductPresetVo preset : presets) {
103 - map.put(preset.getSaleUnit().getCode(), preset); 103 + // TODO: 2024/8/29 只有code
  104 + map.put(preset.getSaleUnit(), preset);
104 } 105 }
105 //封装商品预设信息productPresetMap 106 //封装商品预设信息productPresetMap
106 productPresetMap.put(productListVo.getId(), map); 107 productPresetMap.put(productListVo.getId(), map);
@@ -203,10 +204,10 @@ public class ShopCartImpl implements IShopCartService { @@ -203,10 +204,10 @@ public class ShopCartImpl implements IShopCartService {
203 ShopCart shopCartQuery = shopCarts.get(0); 204 ShopCart shopCartQuery = shopCarts.get(0);
204 shopCart.setVersion(shopCartQuery.getVersion()); 205 shopCart.setVersion(shopCartQuery.getVersion());
205 shopCart.setId(shopCartQuery.getId()); 206 shopCart.setId(shopCartQuery.getId());
206 - if (shopCartDto.getBo()){ 207 + if (shopCartDto.getBo()) {
207 int i = shopCartMapper.updateByPrimaryKeySelectiveCache(shopCart); 208 int i = shopCartMapper.updateByPrimaryKeySelectiveCache(shopCart);
208 Assert.isTrue(i > 0, "购物车更新失败"); 209 Assert.isTrue(i > 0, "购物车更新失败");
209 - }else { 210 + } else {
210 int i = shopCartMapper.updateByPrimaryKeySelective(shopCart); 211 int i = shopCartMapper.updateByPrimaryKeySelective(shopCart);
211 Assert.isTrue(i > 0, "购物车更新失败"); 212 Assert.isTrue(i > 0, "购物车更新失败");
212 } 213 }
@@ -226,7 +227,7 @@ public class ShopCartImpl implements IShopCartService { @@ -226,7 +227,7 @@ public class ShopCartImpl implements IShopCartService {
226 } 227 }
227 //存在相同商品信息,对商品信息进行更新操作 228 //存在相同商品信息,对商品信息进行更新操作
228 ShopCartMessage shopCartMessageOld = shopCartMessages.get(0); 229 ShopCartMessage shopCartMessageOld = shopCartMessages.get(0);
229 - shopCartMessageService.updateByOld(shopCartMessageOld, shopCartDto.getShopCartMessageDto(),shopCartDto.getBo()); 230 + shopCartMessageService.updateByOld(shopCartMessageOld, shopCartDto.getShopCartMessageDto(), shopCartDto.getBo());
230 } 231 }
231 232
232 233
@@ -235,7 +236,7 @@ public class ShopCartImpl implements IShopCartService { @@ -235,7 +236,7 @@ public class ShopCartImpl implements IShopCartService {
235 public void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList) { 236 public void updateShopcartList(List<ShopCartCacheDto> shopCartCacheDtoList) {
236 shopCartCacheDtoList.forEach(shopCartCacheDto -> { 237 shopCartCacheDtoList.forEach(shopCartCacheDto -> {
237 List<ShopCartMessageDto> shopCartMessageDtos = shopCartCacheDto.getShopCartMessageDtos(); 238 List<ShopCartMessageDto> shopCartMessageDtos = shopCartCacheDto.getShopCartMessageDtos();
238 - if (!CollectionUtils.isEmpty(shopCartMessageDtos)){ 239 + if (!CollectionUtils.isEmpty(shopCartMessageDtos)) {
239 List<ShopCartDto> shopCartDtos = shopCartMessageDtos.stream().map(shopCartMessageDto -> { 240 List<ShopCartDto> shopCartDtos = shopCartMessageDtos.stream().map(shopCartMessageDto -> {
240 ShopCartDto shopCartDto = new ShopCartDto(); 241 ShopCartDto shopCartDto = new ShopCartDto();
241 BeanUtils.copyProperties(shopCartCacheDto, shopCartDto); 242 BeanUtils.copyProperties(shopCartCacheDto, shopCartDto);
@@ -300,7 +301,7 @@ public class ShopCartImpl implements IShopCartService { @@ -300,7 +301,7 @@ public class ShopCartImpl implements IShopCartService {
300 // int i = shopCartMapper.deleteByPrimaryKey(shopCartId); 301 // int i = shopCartMapper.deleteByPrimaryKey(shopCartId);
301 // Assert.isTrue(i > 0, "删除购物车信息失败"); 302 // Assert.isTrue(i > 0, "删除购物车信息失败");
302 // } 303 // }
303 - AssertUtils.isTrue(shopCartDto!=null, "参数异常,请刷新后重试"); 304 + AssertUtils.isTrue(shopCartDto != null, "参数异常,请刷新后重试");
304 AssertUtils.isTrue(!CollectionUtils.isEmpty(shopCartDto.getIds()), "请传需要删除的购物车商品"); 305 AssertUtils.isTrue(!CollectionUtils.isEmpty(shopCartDto.getIds()), "请传需要删除的购物车商品");
305 List<Long> list = shopCartMessageService.findCartIdByMessageIds(shopCartDto); 306 List<Long> list = shopCartMessageService.findCartIdByMessageIds(shopCartDto);
306 AssertUtils.isTrue(!CollectionUtils.isEmpty(list), "商品已被删除,请刷新"); 307 AssertUtils.isTrue(!CollectionUtils.isEmpty(list), "商品已被删除,请刷新");
etrade-sentinel/src/main/java/com/diligrp/etrade/sentinel/constant/Constant.java
@@ -36,32 +36,32 @@ public interface Constant { @@ -36,32 +36,32 @@ public interface Constant {
36 /** 36 /**
37 * PRODUCT_EXPIRY_EXCHANGE 37 * PRODUCT_EXPIRY_EXCHANGE
38 */ 38 */
39 - String MQ_PRODUCT_EXPIRY_EXCHANGE = "dili.product.expiry.exchange"; 39 + String MQ_PRODUCT_EXPIRY_EXCHANGE = "zr.product.expiry.exchange";
40 40
41 /** 41 /**
42 * MQ_ORDER_EXCHANGE 42 * MQ_ORDER_EXCHANGE
43 */ 43 */
44 - String MQ_ORDER_EXCHANGE = "dili.order.exchange"; 44 + String MQ_ORDER_EXCHANGE = "zr.order.exchange";
45 45
46 /** 46 /**
47 * MQ_STOCK_EXCHANGE 47 * MQ_STOCK_EXCHANGE
48 */ 48 */
49 - String MQ_STOCK_EXCHANGE = "dili.stock.exchange"; 49 + String MQ_STOCK_EXCHANGE = "zr.stock.exchange";
50 50
51 /** 51 /**
52 * MQ_PRODUCT_EXPIRY_EXCHANGE_QUEUE 52 * MQ_PRODUCT_EXPIRY_EXCHANGE_QUEUE
53 */ 53 */
54 - String MQ_PRODUCT_EXPIRY_EXCHANGE_QUEUE = "dili.product.expiry.sentinel.queue"; 54 + String MQ_PRODUCT_EXPIRY_EXCHANGE_QUEUE = "zr.product.expiry.sentinel.queue";
55 55
56 /** 56 /**
57 * MQ_ORDER_EXCHANGE_QUEUE 57 * MQ_ORDER_EXCHANGE_QUEUE
58 */ 58 */
59 - String MQ_ORDER_EXCHANGE_QUEUE = "dili.order.sentinel.queue"; 59 + String MQ_ORDER_EXCHANGE_QUEUE = "zr.order.sentinel.queue";
60 60
61 /** 61 /**
62 * MQ_STOCK_EXCHANGE_QUEUE 62 * MQ_STOCK_EXCHANGE_QUEUE
63 */ 63 */
64 - String MQ_STOCK_EXCHANGE_QUEUE = "dili.stock.sentinel.queue"; 64 + String MQ_STOCK_EXCHANGE_QUEUE = "zr.stock.sentinel.queue";
65 65
66 /** 66 /**
67 * 单价预警信息模版 67 * 单价预警信息模版
etrade-shop/src/main/java/com/diligrp/etrade/shop/constant/ProductMQConstant.java
@@ -4,5 +4,5 @@ public interface ProductMQConstant { @@ -4,5 +4,5 @@ public interface ProductMQConstant {
4 4
5 String EXCHANGE_NAME_CATEGORY = "category.exchange"; 5 String EXCHANGE_NAME_CATEGORY = "category.exchange";
6 6
7 - String QUEUE_NAME_CATEGORY = "category.queue.product"; 7 + String QUEUE_NAME_CATEGORY = "zr.category.queue.product";
8 } 8 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/dao/ProductPresetMapper.java
@@ -12,7 +12,6 @@ public interface ProductPresetMapper extends MybatisMapperSupport { @@ -12,7 +12,6 @@ public interface ProductPresetMapper extends MybatisMapperSupport {
12 int removeByProductId(ProductPresetDo entity); 12 int removeByProductId(ProductPresetDo entity);
13 13
14 /** 14 /**
15 - * 用于标识是否由页面删除的数据,因为查询已删除列表时关联该表时会有历史删除记录  
16 * @param entity 15 * @param entity
17 * @return 16 * @return
18 */ 17 */
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductCo.java
@@ -59,6 +59,12 @@ public class ProductCo implements Serializable { @@ -59,6 +59,12 @@ public class ProductCo implements Serializable {
59 private String articleCode; 59 private String articleCode;
60 60
61 /** 61 /**
  62 + * 商品条码
  63 + */
  64 + @Length(max = 25, message = "商品条码长度不能超过{max}")
  65 + private String barCode;
  66 +
  67 + /**
62 * 店铺主键 68 * 店铺主键
63 */ 69 */
64 @NotNull(message = "店铺主键不能为空") 70 @NotNull(message = "店铺主键不能为空")
@@ -67,7 +73,7 @@ public class ProductCo implements Serializable { @@ -67,7 +73,7 @@ public class ProductCo implements Serializable {
67 /** 73 /**
68 * 备注(最大140个字符) 74 * 备注(最大140个字符)
69 */ 75 */
70 - @Length(max = 140,message = "备注最多只能包含140个字符") 76 + @Length(max = 140, message = "备注最多只能包含140个字符")
71 private String remark; 77 private String remark;
72 78
73 /** 79 /**
@@ -91,6 +97,7 @@ public class ProductCo implements Serializable { @@ -91,6 +97,7 @@ public class ProductCo implements Serializable {
91 97
92 /** 98 /**
93 * 允许重复 99 * 允许重复
  100 + *
94 * @see YesOrNoState 101 * @see YesOrNoState
95 */ 102 */
96 private Integer allowRepeat = YesOrNoState.否.getCode(); 103 private Integer allowRepeat = YesOrNoState.否.getCode();
@@ -221,4 +228,12 @@ public class ProductCo implements Serializable { @@ -221,4 +228,12 @@ public class ProductCo implements Serializable {
221 public void setAllowRepeat(Integer allowRepeat) { 228 public void setAllowRepeat(Integer allowRepeat) {
222 this.allowRepeat = allowRepeat; 229 this.allowRepeat = allowRepeat;
223 } 230 }
  231 +
  232 + public String getBarCode() {
  233 + return barCode;
  234 + }
  235 +
  236 + public void setBarCode(String barCode) {
  237 + this.barCode = barCode;
  238 + }
224 } 239 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductPresetCo.java
@@ -2,7 +2,6 @@ package com.diligrp.etrade.shop.domain.request; @@ -2,7 +2,6 @@ package com.diligrp.etrade.shop.domain.request;
2 2
3 import com.diligrp.etrade.core.jackson.deserializer.MoneyY2FDeserializer; 3 import com.diligrp.etrade.core.jackson.deserializer.MoneyY2FDeserializer;
4 import com.diligrp.etrade.core.jackson.deserializer.WeightJ2KDeserializer; 4 import com.diligrp.etrade.core.jackson.deserializer.WeightJ2KDeserializer;
5 -import com.diligrp.etrade.core.type.SaleUnitType;  
6 import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 5 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
7 import jakarta.validation.constraints.NotNull; 6 import jakarta.validation.constraints.NotNull;
8 import org.hibernate.validator.constraints.Range; 7 import org.hibernate.validator.constraints.Range;
@@ -15,28 +14,28 @@ public class ProductPresetCo implements Serializable { @@ -15,28 +14,28 @@ public class ProductPresetCo implements Serializable {
15 * 销售单位(0-斤,1-件) 14 * 销售单位(0-斤,1-件)
16 */ 15 */
17 @NotNull(message = "销售单位不能为空") 16 @NotNull(message = "销售单位不能为空")
18 - private SaleUnitType saleUnit; 17 + private Integer saleUnit;
19 18
20 /** 19 /**
21 * 预设价格(单位:元) 20 * 预设价格(单位:元)
22 */ 21 */
23 @JsonDeserialize(using = MoneyY2FDeserializer.class) 22 @JsonDeserialize(using = MoneyY2FDeserializer.class)
24 @NotNull(message = "预设价格") 23 @NotNull(message = "预设价格")
25 - @Range(max = 99999999,message = "预设价格 0 - 999999.99 元") 24 + @Range(max = 99999999, message = "预设价格 0 - 999999.99 元")
26 private Long prePrice; 25 private Long prePrice;
27 26
28 /** 27 /**
29 * 件重(单位:斤) 28 * 件重(单位:斤)
30 */ 29 */
31 @JsonDeserialize(using = WeightJ2KDeserializer.class) 30 @JsonDeserialize(using = WeightJ2KDeserializer.class)
32 - @Range(max = 499999995,message = "件重 0 - 999999.99 斤") 31 + @Range(max = 499999995, message = "件重 0 - 999999.99 斤")
33 private Long pieceWeight; 32 private Long pieceWeight;
34 33
35 - public SaleUnitType getSaleUnit() { 34 + public Integer getSaleUnit() {
36 return saleUnit; 35 return saleUnit;
37 } 36 }
38 37
39 - public void setSaleUnit(SaleUnitType saleUnit) { 38 + public void setSaleUnit(Integer saleUnit) {
40 this.saleUnit = saleUnit; 39 this.saleUnit = saleUnit;
41 } 40 }
42 41
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductUpdateCo.java
@@ -52,6 +52,12 @@ public class ProductUpdateCo implements Serializable { @@ -52,6 +52,12 @@ public class ProductUpdateCo implements Serializable {
52 @Length(max = 15, message = "自定义商品码不能超过{max}") 52 @Length(max = 15, message = "自定义商品码不能超过{max}")
53 private String articleCode; 53 private String articleCode;
54 54
  55 + /**
  56 + * 商品条码
  57 + */
  58 + @Length(max = 25, message = "商品条码长度不能超过{max}")
  59 + private String barCode;
  60 +
55 @Valid 61 @Valid
56 @NotEmpty(message = "预设信息不能为空") 62 @NotEmpty(message = "预设信息不能为空")
57 private List<ProductPresetCo> presets; 63 private List<ProductPresetCo> presets;
@@ -133,4 +139,12 @@ public class ProductUpdateCo implements Serializable { @@ -133,4 +139,12 @@ public class ProductUpdateCo implements Serializable {
133 public void setImages(List<ProductImageCo> images) { 139 public void setImages(List<ProductImageCo> images) {
134 this.images = images; 140 this.images = images;
135 } 141 }
  142 +
  143 + public String getBarCode() {
  144 + return barCode;
  145 + }
  146 +
  147 + public void setBarCode(String barCode) {
  148 + this.barCode = barCode;
  149 + }
136 } 150 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/response/ProductDetailVo.java
@@ -55,6 +55,11 @@ public class ProductDetailVo implements Serializable { @@ -55,6 +55,11 @@ public class ProductDetailVo implements Serializable {
55 private String articleCode; 55 private String articleCode;
56 56
57 /** 57 /**
  58 + * 条形码
  59 + */
  60 + private String barCode;
  61 +
  62 + /**
58 * 店铺主键 63 * 店铺主键
59 */ 64 */
60 private Long shopId; 65 private Long shopId;
@@ -287,4 +292,12 @@ public class ProductDetailVo implements Serializable { @@ -287,4 +292,12 @@ public class ProductDetailVo implements Serializable {
287 public void setArticleCode(String articleCode) { 292 public void setArticleCode(String articleCode) {
288 this.articleCode = articleCode; 293 this.articleCode = articleCode;
289 } 294 }
  295 +
  296 + public String getBarCode() {
  297 + return barCode;
  298 + }
  299 +
  300 + public void setBarCode(String barCode) {
  301 + this.barCode = barCode;
  302 + }
290 } 303 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/response/ProductListVo.java
@@ -49,6 +49,16 @@ public class ProductListVo implements Serializable { @@ -49,6 +49,16 @@ public class ProductListVo implements Serializable {
49 private String alias; 49 private String alias;
50 50
51 /** 51 /**
  52 + * 自定义商品码
  53 + */
  54 + private String articleCode;
  55 +
  56 + /**
  57 + * 条形码
  58 + */
  59 + private String barCode;
  60 +
  61 + /**
52 * 店铺主键 62 * 店铺主键
53 */ 63 */
54 private Long shopId; 64 private Long shopId;
@@ -234,4 +244,20 @@ public class ProductListVo implements Serializable { @@ -234,4 +244,20 @@ public class ProductListVo implements Serializable {
234 public void setCode(String code) { 244 public void setCode(String code) {
235 this.code = code; 245 this.code = code;
236 } 246 }
  247 +
  248 + public String getArticleCode() {
  249 + return articleCode;
  250 + }
  251 +
  252 + public void setArticleCode(String articleCode) {
  253 + this.articleCode = articleCode;
  254 + }
  255 +
  256 + public String getBarCode() {
  257 + return barCode;
  258 + }
  259 +
  260 + public void setBarCode(String barCode) {
  261 + this.barCode = barCode;
  262 + }
237 } 263 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/response/ProductPresetVo.java
@@ -2,7 +2,6 @@ package com.diligrp.etrade.shop.domain.response; @@ -2,7 +2,6 @@ package com.diligrp.etrade.shop.domain.response;
2 2
3 import com.diligrp.etrade.core.jackson.serializer.MoneyF2YRetain2AndRetainZeroSerializer; 3 import com.diligrp.etrade.core.jackson.serializer.MoneyF2YRetain2AndRetainZeroSerializer;
4 import com.diligrp.etrade.core.jackson.serializer.WeightK2JRetain2AndRetainZeroSerializer; 4 import com.diligrp.etrade.core.jackson.serializer.WeightK2JRetain2AndRetainZeroSerializer;
5 -import com.diligrp.etrade.core.type.SaleUnitType;  
6 import com.fasterxml.jackson.databind.annotation.JsonSerialize; 5 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
7 6
8 import java.io.Serializable; 7 import java.io.Serializable;
@@ -20,7 +19,7 @@ public class ProductPresetVo implements Serializable { @@ -20,7 +19,7 @@ public class ProductPresetVo implements Serializable {
20 /** 19 /**
21 * 销售单位 20 * 销售单位
22 */ 21 */
23 - private SaleUnitType saleUnit; 22 + private Integer saleUnit;
24 23
25 /** 24 /**
26 * 预设价格(单位:元) 25 * 预设价格(单位:元)
@@ -42,14 +41,6 @@ public class ProductPresetVo implements Serializable { @@ -42,14 +41,6 @@ public class ProductPresetVo implements Serializable {
42 this.id = id; 41 this.id = id;
43 } 42 }
44 43
45 - public SaleUnitType getSaleUnit() {  
46 - return saleUnit;  
47 - }  
48 -  
49 - public void setSaleUnit(SaleUnitType saleUnit) {  
50 - this.saleUnit = saleUnit;  
51 - }  
52 -  
53 public Long getPrePrice() { 44 public Long getPrePrice() {
54 return prePrice; 45 return prePrice;
55 } 46 }
@@ -65,4 +56,12 @@ public class ProductPresetVo implements Serializable { @@ -65,4 +56,12 @@ public class ProductPresetVo implements Serializable {
65 public void setPieceWeight(Long pieceWeight) { 56 public void setPieceWeight(Long pieceWeight) {
66 this.pieceWeight = pieceWeight; 57 this.pieceWeight = pieceWeight;
67 } 58 }
  59 +
  60 + public Integer getSaleUnit() {
  61 + return saleUnit;
  62 + }
  63 +
  64 + public void setSaleUnit(Integer saleUnit) {
  65 + this.saleUnit = saleUnit;
  66 + }
68 } 67 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/model/ProductDo.java
@@ -58,6 +58,11 @@ public class ProductDo extends BaseHasUserDo { @@ -58,6 +58,11 @@ public class ProductDo extends BaseHasUserDo {
58 private String articleCode; 58 private String articleCode;
59 59
60 /** 60 /**
  61 + * 商品条码
  62 + */
  63 + private String barCode;
  64 +
  65 + /**
61 * 店铺主键 66 * 店铺主键
62 */ 67 */
63 private Long shopId; 68 private Long shopId;
@@ -248,4 +253,12 @@ public class ProductDo extends BaseHasUserDo { @@ -248,4 +253,12 @@ public class ProductDo extends BaseHasUserDo {
248 public void setAllowRepeat(Integer allowRepeat) { 253 public void setAllowRepeat(Integer allowRepeat) {
249 this.allowRepeat = allowRepeat; 254 this.allowRepeat = allowRepeat;
250 } 255 }
  256 +
  257 + public String getBarCode() {
  258 + return barCode;
  259 + }
  260 +
  261 + public void setBarCode(String barCode) {
  262 + this.barCode = barCode;
  263 + }
251 } 264 }
etrade-shop/src/main/java/com/diligrp/etrade/shop/model/ProductPresetDo.java
@@ -14,9 +14,11 @@ public class ProductPresetDo extends BaseHasUserDo { @@ -14,9 +14,11 @@ public class ProductPresetDo extends BaseHasUserDo {
14 private Long productId; 14 private Long productId;
15 15
16 /** 16 /**
17 - * 销售单位 17 + * 销售单位 数据字典配置ddCode=zrtrade_product_sale_unit
  18 + *
  19 + * @see SaleUnitType
18 */ 20 */
19 - private SaleUnitType saleUnit; 21 + private Integer saleUnit;
20 22
21 /** 23 /**
22 * 预设价格 24 * 预设价格
@@ -36,11 +38,11 @@ public class ProductPresetDo extends BaseHasUserDo { @@ -36,11 +38,11 @@ public class ProductPresetDo extends BaseHasUserDo {
36 this.productId = productId; 38 this.productId = productId;
37 } 39 }
38 40
39 - public SaleUnitType getSaleUnit() { 41 + public Integer getSaleUnit() {
40 return saleUnit; 42 return saleUnit;
41 } 43 }
42 44
43 - public void setSaleUnit(SaleUnitType saleUnit) { 45 + public void setSaleUnit(Integer saleUnit) {
44 this.saleUnit = saleUnit; 46 this.saleUnit = saleUnit;
45 } 47 }
46 48
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/impl/ProductServiceImpl.java
@@ -99,14 +99,12 @@ public class ProductServiceImpl implements ProductService { @@ -99,14 +99,12 @@ public class ProductServiceImpl implements ProductService {
99 } 99 }
100 100
101 // 2024/7/11 自定义商品图片 先删除后新增 101 // 2024/7/11 自定义商品图片 先删除后新增
102 - if (Objects.equals(propertiesConfig.getAllowRepeat(), YesOrNoState.是.getCode())) {  
103 - productImageService.removeByProductId(entity.getId());  
104 - if (CollectionUtils.isNotEmpty(entity.getImages())) {  
105 - for (ProductImageDo image : entity.getImages()) {  
106 - image.setProductId(entity.getId());  
107 - }  
108 - productImageService.insertBatch(entity.getImages()); 102 + productImageService.removeByProductId(entity.getId());
  103 + if (CollectionUtils.isNotEmpty(entity.getImages())) {
  104 + for (ProductImageDo image : entity.getImages()) {
  105 + image.setProductId(entity.getId());
109 } 106 }
  107 + productImageService.insertBatch(entity.getImages());
110 } 108 }
111 109
112 /* 110 /*
@@ -120,17 +118,6 @@ public class ProductServiceImpl implements ProductService { @@ -120,17 +118,6 @@ public class ProductServiceImpl implements ProductService {
120 } 118 }
121 119
122 private int insert(ProductDo entity) { 120 private int insert(ProductDo entity) {
123 - // 2024/6/14 是否允许一品多商  
124 - if (!Objects.equals(propertiesConfig.getAllowRepeat(), YesOrNoState.是.getCode())) {  
125 - // 2024/6/14 后台一套逻辑 可能存在测试环境下 建了一品多商数据 再切换一品一商  
126 - // Long id = mapper.findId(entity.getShopId(), entity.getCategoryId());  
127 - List<Long> ids = mapper.findIdV1(entity.getShopId(), entity.getCategoryId());  
128 - if (CollectionUtils.isNotEmpty(ids)) {  
129 - logger.warn("商品已存在:{}", entity);  
130 - throw new ProductException(String.format("商品已存在:%s", entity.getAlias()));  
131 - }  
132 - }  
133 -  
134 if (StringUtils.isNotBlank(entity.getCategoryIdPath())) { 121 if (StringUtils.isNotBlank(entity.getCategoryIdPath())) {
135 //去掉空格 122 //去掉空格
136 entity.setCategoryIdPath(entity.getCategoryIdPath().replaceAll(" ", "")); 123 entity.setCategoryIdPath(entity.getCategoryIdPath().replaceAll(" ", ""));
@@ -424,43 +411,36 @@ public class ProductServiceImpl implements ProductService { @@ -424,43 +411,36 @@ public class ProductServiceImpl implements ProductService {
424 // 2024/6/14 一品多商商品别名不修改 411 // 2024/6/14 一品多商商品别名不修改
425 Integer allowRepeat = propertiesConfig.getAllowRepeat(); 412 Integer allowRepeat = propertiesConfig.getAllowRepeat();
426 logger.info("customerUpdateToCreateShop allowRepeat:{}", allowRepeat); 413 logger.info("customerUpdateToCreateShop allowRepeat:{}", allowRepeat);
427 - if (Objects.equals(allowRepeat, YesOrNoState.是.getCode())) {  
428 - co.setAlias(null);  
429 - } 414 + co.setAlias(null);
430 mapper.productCategorySync(co); 415 mapper.productCategorySync(co);
431 416
432 - // 2024/7/11 一品多商商品图片不同步 保留自定义图片  
433 - if (Objects.equals(allowRepeat, YesOrNoState.是.getCode())) {  
434 - return;  
435 - } 417 + // 2024/8/29 中瑞取消商品照片更新
436 418
437 //同步图片 419 //同步图片
438 //1.删除图片 420 //1.删除图片
439 - productImageService.removeByMarketIdAndCategoryId(co.getMarketId(), co.getCategoryId());  
440 - if (StringUtils.isNotBlank(co.getUrl())) {  
441 - //2.查找商品  
442 - List<Long> productIds = mapper.listByMarketIdAndCategoryId(co.getMarketId(), co.getCategoryId());  
443 - if (!productIds.isEmpty()) {  
444 - //3.新增图片,分批次新增,保证数据量过大情况下sql过长导致的错误  
445 - long mod = 200;  
446 - long n = (productIds.size() / mod) + (productIds.size() % mod == 0 ? 0 : 1);  
447 - long k = 0;  
448 - while (k < n) {  
449 - List<ProductImageDo> images = productIds.stream()  
450 - .skip(k++ * mod)  
451 - .limit(mod)  
452 - .map(e -> {  
453 - ProductImageDo image = new ProductImageDo();  
454 - image.setProductId(e);  
455 - image.setUrl(co.getUrl());  
456 - return image;  
457 - }).collect(Collectors.toList());  
458 - productImageService.insertBatch(images);  
459 - }  
460 -  
461 -  
462 - }  
463 - } 421 +// productImageService.removeByMarketIdAndCategoryId(co.getMarketId(), co.getCategoryId());
  422 +// if (StringUtils.isNotBlank(co.getUrl())) {
  423 +// //2.查找商品
  424 +// List<Long> productIds = mapper.listByMarketIdAndCategoryId(co.getMarketId(), co.getCategoryId());
  425 +// if (!productIds.isEmpty()) {
  426 +// //3.新增图片,分批次新增,保证数据量过大情况下sql过长导致的错误
  427 +// long mod = 200;
  428 +// long n = (productIds.size() / mod) + (productIds.size() % mod == 0 ? 0 : 1);
  429 +// long k = 0;
  430 +// while (k < n) {
  431 +// List<ProductImageDo> images = productIds.stream()
  432 +// .skip(k++ * mod)
  433 +// .limit(mod)
  434 +// .map(e -> {
  435 +// ProductImageDo image = new ProductImageDo();
  436 +// image.setProductId(e);
  437 +// image.setUrl(co.getUrl());
  438 +// return image;
  439 +// }).collect(Collectors.toList());
  440 +// productImageService.insertBatch(images);
  441 +// }
  442 +// }
  443 +// }
464 } 444 }
465 445
466 @Override 446 @Override
etrade-shop/src/main/resources/com/diligrp/etrade/dao/mapper/ProductMapper.xml
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 <result column="p.name" property="name"/> 9 <result column="p.name" property="name"/>
10 <result column="p.name_path" property="namePath"/> 10 <result column="p.name_path" property="namePath"/>
11 <result column="p.alias" property="alias"/> 11 <result column="p.alias" property="alias"/>
  12 + <result column="p.article_code" property="articleCode"/>
  13 + <result column="p.bar_code" property="barCode"/>
12 <result column="p.source" property="source"/> 14 <result column="p.source" property="source"/>
13 <result column="p.remark" property="remark"/> 15 <result column="p.remark" property="remark"/>
14 <result column="p.version" property="version"/> 16 <result column="p.version" property="version"/>
@@ -52,6 +54,7 @@ @@ -52,6 +54,7 @@
52 <result column="p.name_path" property="namePath"/> 54 <result column="p.name_path" property="namePath"/>
53 <result column="p.alias" property="alias"/> 55 <result column="p.alias" property="alias"/>
54 <result column="p.article_code" property="articleCode"/> 56 <result column="p.article_code" property="articleCode"/>
  57 + <result column="p.bar_code" property="barCode"/>
55 <result column="p.source" property="source"/> 58 <result column="p.source" property="source"/>
56 <result column="p.remark" property="remark"/> 59 <result column="p.remark" property="remark"/>
57 <result column="p.version" property="version"/> 60 <result column="p.version" property="version"/>
@@ -119,6 +122,7 @@ @@ -119,6 +122,7 @@
119 name_path_json, 122 name_path_json,
120 alias, 123 alias,
121 article_code, 124 article_code,
  125 + bar_code,
122 shop_id, 126 shop_id,
123 source, 127 source,
124 remark, 128 remark,
@@ -135,6 +139,7 @@ @@ -135,6 +139,7 @@
135 #{namePathJson,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, 139 #{namePathJson,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler},
136 #{alias}, 140 #{alias},
137 #{articleCode}, 141 #{articleCode},
  142 + #{barCode},
138 #{shopId}, 143 #{shopId},
139 #{source}, 144 #{source},
140 #{remark}, 145 #{remark},
@@ -150,6 +155,9 @@ @@ -150,6 +155,9 @@
150 <if test="articleCode != null and articleCode != ''"> 155 <if test="articleCode != null and articleCode != ''">
151 article_code = #{articleCode}, 156 article_code = #{articleCode},
152 </if> 157 </if>
  158 + <if test="barCode != null">
  159 + bar_code = #{barCode},
  160 + </if>
153 remark = #{remark}, 161 remark = #{remark},
154 operater_id = #{operaterId}, 162 operater_id = #{operaterId},
155 operater_name = #{operaterName}, 163 operater_name = #{operaterName},
@@ -358,6 +366,8 @@ @@ -358,6 +366,8 @@
358 ,p.name AS "p.name" 366 ,p.name AS "p.name"
359 ,p.name_path AS "p.name_path" 367 ,p.name_path AS "p.name_path"
360 ,p.alias AS "p.alias" 368 ,p.alias AS "p.alias"
  369 + ,p.article_code AS "p.article_code"
  370 + ,p.bar_code AS "p.bar_code"
361 ,p.source AS "p.source" 371 ,p.source AS "p.source"
362 ,p.remark AS "p.remark" 372 ,p.remark AS "p.remark"
363 ,p.version AS "p.version" 373 ,p.version AS "p.version"
@@ -473,6 +483,7 @@ @@ -473,6 +483,7 @@
473 , p.name_path AS "p.name_path" 483 , p.name_path AS "p.name_path"
474 , p.alias AS "p.alias" 484 , p.alias AS "p.alias"
475 , p.article_code AS "p.article_code" 485 , p.article_code AS "p.article_code"
  486 + , p.bar_code AS "p.bar_code"
476 , p.source AS "p.source" 487 , p.source AS "p.source"
477 , p.remark AS "p.remark" 488 , p.remark AS "p.remark"
478 , p.version AS "p.version" 489 , p.version AS "p.version"
@@ -517,6 +528,7 @@ @@ -517,6 +528,7 @@
517 , p.name_path AS "p.name_path" 528 , p.name_path AS "p.name_path"
518 , p.alias AS "p.alias" 529 , p.alias AS "p.alias"
519 , p.article_code AS "p.article_code" 530 , p.article_code AS "p.article_code"
  531 + , p.bar_code AS "p.bar_code"
520 , p.source AS "p.source" 532 , p.source AS "p.source"
521 , p.remark AS "p.remark" 533 , p.remark AS "p.remark"
522 , p.version AS "p.version" 534 , p.version AS "p.version"
settings.gradle
1 -rootProject.name = 'dili-etrade' 1 +rootProject.name = 'zr-etrade'
2 include 'etrade-core' 2 include 'etrade-core'
3 include 'etrade-rpc' 3 include 'etrade-rpc'
4 include 'etrade-shared' 4 include 'etrade-shared'