Commit c1f67239389345ce5602688f3bd65c5d34c6c576
1 parent
7e151eff
feat 杭果甄选商品
Showing
16 changed files
with
152 additions
and
103 deletions
etrade-core/src/main/java/com/diligrp/etrade/core/type/SaleUnitType.java
1 | package com.diligrp.etrade.core.type; | 1 | package com.diligrp.etrade.core.type; |
2 | 2 | ||
3 | +import java.util.Map; | ||
4 | +import java.util.stream.Collectors; | ||
5 | +import java.util.stream.Stream; | ||
6 | + | ||
3 | /** | 7 | /** |
4 | * 销售单位 | 8 | * 销售单位 |
9 | + * 件-、箱-、斤-、袋-、盒-、份-、组-、瓶-、只 | ||
5 | */ | 10 | */ |
6 | -public enum SaleUnitType implements IEnumType { | 11 | +public enum SaleUnitType implements IEnumType, EnumArrayValuableEnums { |
7 | 12 | ||
8 | CATTY("斤", 0), | 13 | CATTY("斤", 0), |
9 | - PIECE("件", 1); | 14 | + PIECE("件", 1), |
15 | + INDIVIDUAL("个", 2), | ||
16 | + BOX("盒", 3), | ||
17 | + CHEST("箱", 4), | ||
18 | + BAG("袋", 5), | ||
19 | + PART("份", 6), | ||
20 | + GROUP("组", 7), | ||
21 | + BOTTLE("瓶", 8), | ||
22 | + ZHI("只", 9), | ||
23 | + ; | ||
10 | 24 | ||
11 | private String name; | 25 | private String name; |
12 | private int code; | 26 | private int code; |
13 | 27 | ||
28 | + private final static Map<Integer, String> DATA = Stream.of(SaleUnitType.values()) | ||
29 | + .collect(Collectors.toMap(SaleUnitType::getCode, SaleUnitType::getName)); | ||
30 | + | ||
14 | private SaleUnitType(String name, int code) { | 31 | private SaleUnitType(String name, int code) { |
15 | this.name = name; | 32 | this.name = name; |
16 | this.code = code; | 33 | this.code = code; |
@@ -25,4 +42,15 @@ public enum SaleUnitType implements IEnumType { | @@ -25,4 +42,15 @@ public enum SaleUnitType implements IEnumType { | ||
25 | public String getName() { | 42 | public String getName() { |
26 | return name; | 43 | return name; |
27 | } | 44 | } |
45 | + | ||
46 | + /** | ||
47 | + * 自定义序列化 | ||
48 | + * | ||
49 | + * @return {@link Map}<{@link String}, {@link String}> | ||
50 | + */ | ||
51 | + @Override | ||
52 | + public Map<String, String> keyValue() { | ||
53 | + return DATA.entrySet().stream() | ||
54 | + .collect(Collectors.toMap(vo -> vo.getKey().toString(), Map.Entry::getValue)); | ||
55 | + } | ||
28 | } | 56 | } |
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/ShopCartImpl.java
@@ -100,7 +100,7 @@ public class ShopCartImpl implements IShopCartService { | @@ -100,7 +100,7 @@ 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 | + map.put(preset.getSaleUnit(), preset); |
104 | } | 104 | } |
105 | //封装商品预设信息productPresetMap | 105 | //封装商品预设信息productPresetMap |
106 | productPresetMap.put(productListVo.getId(), map); | 106 | productPresetMap.put(productListVo.getId(), map); |
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 = "dili.product.expiry.exchange.xtrade"; |
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 = "dili.order.exchange.xtrade"; |
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 = "dili.stock.exchange.xtrade"; |
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 = "dili.product.expiry.sentinel.queue.xtrade"; |
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 = "dili.order.sentinel.queue.xtrade"; |
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 = "dili.stock.sentinel.queue.xtrade"; |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * 单价预警信息模版 | 67 | * 单价预警信息模版 |
etrade-shared/src/main/java/com/diligrp/etrade/shared/SharedConfiguration.java
@@ -14,12 +14,12 @@ public class SharedConfiguration { | @@ -14,12 +14,12 @@ public class SharedConfiguration { | ||
14 | /** | 14 | /** |
15 | * MQ_STOCK_EXCHANGE | 15 | * MQ_STOCK_EXCHANGE |
16 | */ | 16 | */ |
17 | - public static final String MQ_STOCK_EXCHANGE = "dili.stock.exchange"; | 17 | + public static final String MQ_STOCK_EXCHANGE = "dili.stock.exchange.xtrade"; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * MQ_ORDER_EXCHANGE | 20 | * MQ_ORDER_EXCHANGE |
21 | */ | 21 | */ |
22 | - public static final String MQ_ORDER_EXCHANGE = "dili.order.exchange"; | 22 | + public static final String MQ_ORDER_EXCHANGE = "dili.order.exchange.xtrade"; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * stockExchange | 25 | * stockExchange |
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 = "category.queue.product.xtrade"; |
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,11 @@ public class ProductCo implements Serializable { | @@ -59,6 +59,11 @@ public class ProductCo implements Serializable { | ||
59 | private String articleCode; | 59 | private String articleCode; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | + * 标签 数据字典ddCode=xtrade_product_label | ||
63 | + */ | ||
64 | + private List<Integer> label; | ||
65 | + | ||
66 | + /** | ||
62 | * 店铺主键 | 67 | * 店铺主键 |
63 | */ | 68 | */ |
64 | @NotNull(message = "店铺主键不能为空") | 69 | @NotNull(message = "店铺主键不能为空") |
@@ -67,7 +72,7 @@ public class ProductCo implements Serializable { | @@ -67,7 +72,7 @@ public class ProductCo implements Serializable { | ||
67 | /** | 72 | /** |
68 | * 备注(最大140个字符) | 73 | * 备注(最大140个字符) |
69 | */ | 74 | */ |
70 | - @Length(max = 140,message = "备注最多只能包含140个字符") | 75 | + @Length(max = 140, message = "备注最多只能包含140个字符") |
71 | private String remark; | 76 | private String remark; |
72 | 77 | ||
73 | /** | 78 | /** |
@@ -91,6 +96,7 @@ public class ProductCo implements Serializable { | @@ -91,6 +96,7 @@ public class ProductCo implements Serializable { | ||
91 | 96 | ||
92 | /** | 97 | /** |
93 | * 允许重复 | 98 | * 允许重复 |
99 | + * | ||
94 | * @see YesOrNoState | 100 | * @see YesOrNoState |
95 | */ | 101 | */ |
96 | private Integer allowRepeat = YesOrNoState.否.getCode(); | 102 | private Integer allowRepeat = YesOrNoState.否.getCode(); |
@@ -221,4 +227,12 @@ public class ProductCo implements Serializable { | @@ -221,4 +227,12 @@ public class ProductCo implements Serializable { | ||
221 | public void setAllowRepeat(Integer allowRepeat) { | 227 | public void setAllowRepeat(Integer allowRepeat) { |
222 | this.allowRepeat = allowRepeat; | 228 | this.allowRepeat = allowRepeat; |
223 | } | 229 | } |
230 | + | ||
231 | + public List<Integer> getLabel() { | ||
232 | + return label; | ||
233 | + } | ||
234 | + | ||
235 | + public void setLabel(List<Integer> label) { | ||
236 | + this.label = label; | ||
237 | + } | ||
224 | } | 238 | } |
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; |
@@ -12,31 +11,32 @@ import java.io.Serializable; | @@ -12,31 +11,32 @@ import java.io.Serializable; | ||
12 | public class ProductPresetCo implements Serializable { | 11 | public class ProductPresetCo implements Serializable { |
13 | 12 | ||
14 | /** | 13 | /** |
15 | - * 销售单位(0-斤,1-件) | 14 | + * 数据字典ddCode=xtrade_product_sale_unit |
15 | + * @see com.diligrp.etrade.core.type.SaleUnitType | ||
16 | */ | 16 | */ |
17 | @NotNull(message = "销售单位不能为空") | 17 | @NotNull(message = "销售单位不能为空") |
18 | - private SaleUnitType saleUnit; | 18 | + private Integer saleUnit; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * 预设价格(单位:元) | 21 | * 预设价格(单位:元) |
22 | */ | 22 | */ |
23 | @JsonDeserialize(using = MoneyY2FDeserializer.class) | 23 | @JsonDeserialize(using = MoneyY2FDeserializer.class) |
24 | @NotNull(message = "预设价格") | 24 | @NotNull(message = "预设价格") |
25 | - @Range(max = 99999999,message = "预设价格 0 - 999999.99 元") | 25 | + @Range(max = 99999999, message = "预设价格 0 - 999999.99 元") |
26 | private Long prePrice; | 26 | private Long prePrice; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * 件重(单位:斤) | 29 | * 件重(单位:斤) |
30 | */ | 30 | */ |
31 | @JsonDeserialize(using = WeightJ2KDeserializer.class) | 31 | @JsonDeserialize(using = WeightJ2KDeserializer.class) |
32 | - @Range(max = 499999995,message = "件重 0 - 999999.99 斤") | 32 | + @Range(max = 499999995, message = "件重 0 - 999999.99 斤") |
33 | private Long pieceWeight; | 33 | private Long pieceWeight; |
34 | 34 | ||
35 | - public SaleUnitType getSaleUnit() { | 35 | + public Integer getSaleUnit() { |
36 | return saleUnit; | 36 | return saleUnit; |
37 | } | 37 | } |
38 | 38 | ||
39 | - public void setSaleUnit(SaleUnitType saleUnit) { | 39 | + public void setSaleUnit(Integer saleUnit) { |
40 | this.saleUnit = saleUnit; | 40 | this.saleUnit = saleUnit; |
41 | } | 41 | } |
42 | 42 |
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductUpdateCo.java
@@ -52,10 +52,21 @@ public class ProductUpdateCo implements Serializable { | @@ -52,10 +52,21 @@ 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 | + private List<Integer> label; | ||
59 | + | ||
55 | @Valid | 60 | @Valid |
56 | @NotEmpty(message = "预设信息不能为空") | 61 | @NotEmpty(message = "预设信息不能为空") |
57 | private List<ProductPresetCo> presets; | 62 | private List<ProductPresetCo> presets; |
58 | 63 | ||
64 | + /** | ||
65 | + * 图片信息 | ||
66 | + */ | ||
67 | + @Valid | ||
68 | + private List<ProductImageCo> images; | ||
69 | + | ||
59 | public Long getId() { | 70 | public Long getId() { |
60 | return id; | 71 | return id; |
61 | } | 72 | } |
@@ -119,4 +130,20 @@ public class ProductUpdateCo implements Serializable { | @@ -119,4 +130,20 @@ public class ProductUpdateCo implements Serializable { | ||
119 | public void setAlias(String alias) { | 130 | public void setAlias(String alias) { |
120 | this.alias = alias; | 131 | this.alias = alias; |
121 | } | 132 | } |
133 | + | ||
134 | + public List<ProductImageCo> getImages() { | ||
135 | + return images; | ||
136 | + } | ||
137 | + | ||
138 | + public void setImages(List<ProductImageCo> images) { | ||
139 | + this.images = images; | ||
140 | + } | ||
141 | + | ||
142 | + public List<Integer> getLabel() { | ||
143 | + return label; | ||
144 | + } | ||
145 | + | ||
146 | + public void setLabel(List<Integer> label) { | ||
147 | + this.label = label; | ||
148 | + } | ||
122 | } | 149 | } |
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 List<Integer> label; | ||
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 List<Integer> getLabel() { | ||
297 | + return label; | ||
298 | + } | ||
299 | + | ||
300 | + public void setLabel(List<Integer> label) { | ||
301 | + this.label = label; | ||
302 | + } | ||
290 | } | 303 | } |
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
@@ -53,11 +53,16 @@ public class ProductDo extends BaseHasUserDo { | @@ -53,11 +53,16 @@ public class ProductDo extends BaseHasUserDo { | ||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * 自定义商品码 | 55 | * 自定义商品码 |
56 | - * 中瑞市场:英文,数字,限制10位,必填;同店铺内商品码不可重复 | 56 | + * 英文,数字,限制10位,必填;同店铺内商品码不可重复 |
57 | */ | 57 | */ |
58 | private String articleCode; | 58 | private String articleCode; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | + * 商品标签 来源:数据字典【ddcode=xtrade_product_label】 | ||
62 | + */ | ||
63 | + private List<Integer> label; | ||
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 List<Integer> getLabel() { | ||
258 | + return label; | ||
259 | + } | ||
260 | + | ||
261 | + public void setLabel(List<Integer> label) { | ||
262 | + this.label = label; | ||
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 | + * 销售单位 数据字典配置 |
18 | + * | ||
19 | + * @see SaleUnitType | ||
18 | */ | 20 | */ |
19 | - private SaleUnitType saleUnit; | 21 | + private Integer saleUnit; |
20 | 22 | ||
21 | /** | 23 | /** |
22 | * 预设价格 | 24 | * 预设价格 |
@@ -36,14 +38,6 @@ public class ProductPresetDo extends BaseHasUserDo { | @@ -36,14 +38,6 @@ public class ProductPresetDo extends BaseHasUserDo { | ||
36 | this.productId = productId; | 38 | this.productId = productId; |
37 | } | 39 | } |
38 | 40 | ||
39 | - public SaleUnitType getSaleUnit() { | ||
40 | - return saleUnit; | ||
41 | - } | ||
42 | - | ||
43 | - public void setSaleUnit(SaleUnitType saleUnit) { | ||
44 | - this.saleUnit = saleUnit; | ||
45 | - } | ||
46 | - | ||
47 | public Long getPrePrice() { | 41 | public Long getPrePrice() { |
48 | return prePrice; | 42 | return prePrice; |
49 | } | 43 | } |
@@ -59,4 +53,12 @@ public class ProductPresetDo extends BaseHasUserDo { | @@ -59,4 +53,12 @@ public class ProductPresetDo extends BaseHasUserDo { | ||
59 | public void setPieceWeight(Long pieceWeight) { | 53 | public void setPieceWeight(Long pieceWeight) { |
60 | this.pieceWeight = pieceWeight; | 54 | this.pieceWeight = pieceWeight; |
61 | } | 55 | } |
56 | + | ||
57 | + public Integer getSaleUnit() { | ||
58 | + return saleUnit; | ||
59 | + } | ||
60 | + | ||
61 | + public void setSaleUnit(Integer saleUnit) { | ||
62 | + this.saleUnit = saleUnit; | ||
63 | + } | ||
62 | } | 64 | } |
etrade-shop/src/main/java/com/diligrp/etrade/shop/mq/CategorySyncMqListener.java
@@ -45,12 +45,6 @@ public class CategorySyncMqListener { | @@ -45,12 +45,6 @@ public class CategorySyncMqListener { | ||
45 | if (StringUtils.isNotBlank(data)) { | 45 | if (StringUtils.isNotBlank(data)) { |
46 | ProductCategorySyncCo co = JsonUtils.fromJsonString(data, ProductCategorySyncCo.class); | 46 | ProductCategorySyncCo co = JsonUtils.fromJsonString(data, ProductCategorySyncCo.class); |
47 | ValidatorUtil.validate(co); | 47 | ValidatorUtil.validate(co); |
48 | - // 2024/6/14 一品多商商品别名不修改 | ||
49 | - Integer allowRepeat = propertiesConfig.getAllowRepeat(); | ||
50 | - log.info("customerUpdateToCreateShop allowRepeat:{}", allowRepeat); | ||
51 | - if (Objects.equals(allowRepeat, YesOrNoState.是.getCode())) { | ||
52 | - co.setAlias(null); | ||
53 | - } | ||
54 | productService.productCategorySync(co); | 48 | productService.productCategorySync(co); |
55 | } | 49 | } |
56 | } catch (Exception e) { | 50 | } catch (Exception e) { |
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/impl/ProductServiceImpl.java
1 | package com.diligrp.etrade.shop.service.impl; | 1 | package com.diligrp.etrade.shop.service.impl; |
2 | 2 | ||
3 | -import com.diligrp.etrade.admin.type.YesOrNoState; | ||
4 | import com.diligrp.etrade.core.domain.Message; | 3 | import com.diligrp.etrade.core.domain.Message; |
5 | import com.diligrp.etrade.core.domain.PageMessage; | 4 | import com.diligrp.etrade.core.domain.PageMessage; |
6 | import com.diligrp.etrade.core.type.YnType; | 5 | import com.diligrp.etrade.core.type.YnType; |
@@ -98,28 +97,11 @@ public class ProductServiceImpl implements ProductService { | @@ -98,28 +97,11 @@ public class ProductServiceImpl implements ProductService { | ||
98 | productPresetService.insertBatch(entity.getPresets()); | 97 | productPresetService.insertBatch(entity.getPresets()); |
99 | } | 98 | } |
100 | 99 | ||
101 | - /* | ||
102 | - * 初始化信息审核信息 | ||
103 | - * 2023/11/7 审核逻辑变更 | ||
104 | - * 商品对应品类在对应预设价格内 OR 备注不为空才需要审核 | ||
105 | - */ | ||
106 | - productAuditService.audit(entity); | ||
107 | - // productAuditService.reSubmit(entity.getId(), ProductAuditState.AUDITING); | 100 | + productAuditService.reSubmit(entity.getId(), ProductAuditState.AUDITING); |
108 | return Message.success(); | 101 | return Message.success(); |
109 | } | 102 | } |
110 | 103 | ||
111 | private int insert(ProductDo entity) { | 104 | private int insert(ProductDo entity) { |
112 | - // 2024/6/14 是否允许一品多商 | ||
113 | - if (!Objects.equals(propertiesConfig.getAllowRepeat(), YesOrNoState.是.getCode())) { | ||
114 | - // 2024/6/14 后台一套逻辑 可能存在测试环境下 建了一品多商数据 再切换一品一商 | ||
115 | - // Long id = mapper.findId(entity.getShopId(), entity.getCategoryId()); | ||
116 | - List<Long> ids = mapper.findIdV1(entity.getShopId(), entity.getCategoryId()); | ||
117 | - if (CollectionUtils.isNotEmpty(ids)) { | ||
118 | - logger.warn("商品已存在:{}", entity); | ||
119 | - throw new ProductException(String.format("商品已存在:%s", entity.getAlias())); | ||
120 | - } | ||
121 | - } | ||
122 | - | ||
123 | if (StringUtils.isNotBlank(entity.getCategoryIdPath())) { | 105 | if (StringUtils.isNotBlank(entity.getCategoryIdPath())) { |
124 | //去掉空格 | 106 | //去掉空格 |
125 | entity.setCategoryIdPath(entity.getCategoryIdPath().replaceAll(" ", "")); | 107 | entity.setCategoryIdPath(entity.getCategoryIdPath().replaceAll(" ", "")); |
@@ -139,10 +121,8 @@ public class ProductServiceImpl implements ProductService { | @@ -139,10 +121,8 @@ public class ProductServiceImpl implements ProductService { | ||
139 | 121 | ||
140 | int ans = mapper.insert(entity); | 122 | int ans = mapper.insert(entity); |
141 | if (ans > 0) { | 123 | if (ans > 0) { |
142 | - // 2023/11/7 审核逻辑变更 | ||
143 | - ProductAuditState productAuditState = ProductSourceType.DISPENSE.equals(entity.getSource()) ? | ||
144 | - ProductAuditState.PASSED : | ||
145 | - productAuditService.getAuditState(entity); | 124 | + // 2024/7/17 杭果商品默认不审核 |
125 | + ProductAuditState productAuditState = ProductAuditState.PASSED; | ||
146 | productAuditService.init(entity.getId(), productAuditState); | 126 | productAuditService.init(entity.getId(), productAuditState); |
147 | 127 | ||
148 | if (CollectionUtils.isNotEmpty(entity.getImages())) { | 128 | if (CollectionUtils.isNotEmpty(entity.getImages())) { |
@@ -410,35 +390,8 @@ public class ProductServiceImpl implements ProductService { | @@ -410,35 +390,8 @@ public class ProductServiceImpl implements ProductService { | ||
410 | * 注意:品类的基础信息是一致的,但是对应不同市场其图片是不一样的 | 390 | * 注意:品类的基础信息是一致的,但是对应不同市场其图片是不一样的 |
411 | */ | 391 | */ |
412 | //同步信息 | 392 | //同步信息 |
393 | + co.setAlias(null); | ||
413 | mapper.productCategorySync(co); | 394 | mapper.productCategorySync(co); |
414 | - | ||
415 | - //同步图片 | ||
416 | - //1.删除图片 | ||
417 | - productImageService.removeByMarketIdAndCategoryId(co.getMarketId(), co.getCategoryId()); | ||
418 | - if (StringUtils.isNotBlank(co.getUrl())) { | ||
419 | - //2.查找商品 | ||
420 | - List<Long> productIds = mapper.listByMarketIdAndCategoryId(co.getMarketId(), co.getCategoryId()); | ||
421 | - if (!productIds.isEmpty()) { | ||
422 | - //3.新增图片,分批次新增,保证数据量过大情况下sql过长导致的错误 | ||
423 | - long mod = 200; | ||
424 | - long n = (productIds.size() / mod) + (productIds.size() % mod == 0 ? 0 : 1); | ||
425 | - long k = 0; | ||
426 | - while (k < n) { | ||
427 | - List<ProductImageDo> images = productIds.stream() | ||
428 | - .skip(k++ * mod) | ||
429 | - .limit(mod) | ||
430 | - .map(e -> { | ||
431 | - ProductImageDo image = new ProductImageDo(); | ||
432 | - image.setProductId(e); | ||
433 | - image.setUrl(co.getUrl()); | ||
434 | - return image; | ||
435 | - }).collect(Collectors.toList()); | ||
436 | - productImageService.insertBatch(images); | ||
437 | - } | ||
438 | - | ||
439 | - | ||
440 | - } | ||
441 | - } | ||
442 | } | 395 | } |
443 | 396 | ||
444 | @Override | 397 | @Override |
etrade-shop/src/main/resources/com/diligrp/etrade/dao/mapper/ProductMapper.xml
@@ -52,6 +52,7 @@ | @@ -52,6 +52,7 @@ | ||
52 | <result column="p.name_path" property="namePath"/> | 52 | <result column="p.name_path" property="namePath"/> |
53 | <result column="p.alias" property="alias"/> | 53 | <result column="p.alias" property="alias"/> |
54 | <result column="p.article_code" property="articleCode"/> | 54 | <result column="p.article_code" property="articleCode"/> |
55 | + <result column="p.label" property="label" typeHandler="com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler"/> | ||
55 | <result column="p.source" property="source"/> | 56 | <result column="p.source" property="source"/> |
56 | <result column="p.remark" property="remark"/> | 57 | <result column="p.remark" property="remark"/> |
57 | <result column="p.version" property="version"/> | 58 | <result column="p.version" property="version"/> |
@@ -119,6 +120,7 @@ | @@ -119,6 +120,7 @@ | ||
119 | name_path_json, | 120 | name_path_json, |
120 | alias, | 121 | alias, |
121 | article_code, | 122 | article_code, |
123 | + label, | ||
122 | shop_id, | 124 | shop_id, |
123 | source, | 125 | source, |
124 | remark, | 126 | remark, |
@@ -135,6 +137,7 @@ | @@ -135,6 +137,7 @@ | ||
135 | #{namePathJson,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, | 137 | #{namePathJson,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, |
136 | #{alias}, | 138 | #{alias}, |
137 | #{articleCode}, | 139 | #{articleCode}, |
140 | + #{label,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, | ||
138 | #{shopId}, | 141 | #{shopId}, |
139 | #{source}, | 142 | #{source}, |
140 | #{remark}, | 143 | #{remark}, |
@@ -150,6 +153,9 @@ | @@ -150,6 +153,9 @@ | ||
150 | <if test="articleCode != null and articleCode != ''"> | 153 | <if test="articleCode != null and articleCode != ''"> |
151 | article_code = #{articleCode}, | 154 | article_code = #{articleCode}, |
152 | </if> | 155 | </if> |
156 | + <if test="label !=null and label.size() > 0"> | ||
157 | + label = #{label,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, | ||
158 | + </if> | ||
153 | remark = #{remark}, | 159 | remark = #{remark}, |
154 | operater_id = #{operaterId}, | 160 | operater_id = #{operaterId}, |
155 | operater_name = #{operaterName}, | 161 | operater_name = #{operaterName}, |
@@ -379,7 +385,7 @@ | @@ -379,7 +385,7 @@ | ||
379 | ,s.id AS "s.id" | 385 | ,s.id AS "s.id" |
380 | ,s.name AS "s.name" | 386 | ,s.name AS "s.name" |
381 | ,s.customer_id AS "s.customer_id" | 387 | ,s.customer_id AS "s.customer_id" |
382 | - ,st.stock * 500 AS "st.stock" | 388 | + ,st.stock AS "st.stock" |
383 | FROM product p | 389 | FROM product p |
384 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 1 | 390 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 1 |
385 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 1 | 391 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 1 |
@@ -422,7 +428,7 @@ | @@ -422,7 +428,7 @@ | ||
422 | ,s.id AS "s.id" | 428 | ,s.id AS "s.id" |
423 | ,s.name AS "s.name" | 429 | ,s.name AS "s.name" |
424 | ,s.customer_id AS "s.customer_id" | 430 | ,s.customer_id AS "s.customer_id" |
425 | - ,st.stock * 500 AS "st.stock" | 431 | + ,st.stock AS "st.stock" |
426 | FROM product p | 432 | FROM product p |
427 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 0 AND pp.page_deleted = 1 | 433 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 0 AND pp.page_deleted = 1 |
428 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 0 AND pi.page_deleted = 1 | 434 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 0 AND pi.page_deleted = 1 |
@@ -473,6 +479,7 @@ | @@ -473,6 +479,7 @@ | ||
473 | , p.name_path AS "p.name_path" | 479 | , p.name_path AS "p.name_path" |
474 | , p.alias AS "p.alias" | 480 | , p.alias AS "p.alias" |
475 | , p.article_code AS "p.article_code" | 481 | , p.article_code AS "p.article_code" |
482 | + , p.label AS "p.label" | ||
476 | , p.source AS "p.source" | 483 | , p.source AS "p.source" |
477 | , p.remark AS "p.remark" | 484 | , p.remark AS "p.remark" |
478 | , p.version AS "p.version" | 485 | , p.version AS "p.version" |
@@ -496,7 +503,7 @@ | @@ -496,7 +503,7 @@ | ||
496 | , s.id AS "s.id" | 503 | , s.id AS "s.id" |
497 | , s.name AS "s.name" | 504 | , s.name AS "s.name" |
498 | , s.customer_id AS "s.customer_id" | 505 | , s.customer_id AS "s.customer_id" |
499 | - , st.stock * 500 AS "st.stock" | 506 | + , st.stock AS "st.stock" |
500 | FROM product p | 507 | FROM product p |
501 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 1 | 508 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 1 |
502 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 1 | 509 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 1 |
@@ -540,7 +547,7 @@ | @@ -540,7 +547,7 @@ | ||
540 | , s.id AS "s.id" | 547 | , s.id AS "s.id" |
541 | , s.name AS "s.name" | 548 | , s.name AS "s.name" |
542 | , s.customer_id AS "s.customer_id" | 549 | , s.customer_id AS "s.customer_id" |
543 | - , st.stock * 500 AS "st.stock" | 550 | + , st.stock AS "st.stock" |
544 | FROM product p | 551 | FROM product p |
545 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 0 AND pp.page_deleted = 1 | 552 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 0 AND pp.page_deleted = 1 |
546 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 0 AND pi.page_deleted = 1 | 553 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 0 AND pi.page_deleted = 1 |