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 | 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 | 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 | 25 | private String name; |
12 | 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 | 31 | private SaleUnitType(String name, int code) { |
15 | 32 | this.name = name; |
16 | 33 | this.code = code; |
... | ... | @@ -25,4 +42,15 @@ public enum SaleUnitType implements IEnumType { |
25 | 42 | public String getName() { |
26 | 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 | 100 | Map<Integer, ProductPresetVo> map = new HashMap<>(); |
101 | 101 | List<ProductPresetVo> presets = productListVo.getPresets(); |
102 | 102 | for (ProductPresetVo preset : presets) { |
103 | - map.put(preset.getSaleUnit().getCode(), preset); | |
103 | + map.put(preset.getSaleUnit(), preset); | |
104 | 104 | } |
105 | 105 | //封装商品预设信息productPresetMap |
106 | 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 | 36 | /** |
37 | 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 | 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 | 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 | 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 | 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 | 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 | 14 | /** |
15 | 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 | 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 | 25 | * stockExchange | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/constant/ProductMQConstant.java
etrade-shop/src/main/java/com/diligrp/etrade/shop/dao/ProductPresetMapper.java
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductCo.java
... | ... | @@ -59,6 +59,11 @@ public class ProductCo implements Serializable { |
59 | 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 | 69 | @NotNull(message = "店铺主键不能为空") |
... | ... | @@ -67,7 +72,7 @@ public class ProductCo implements Serializable { |
67 | 72 | /** |
68 | 73 | * 备注(最大140个字符) |
69 | 74 | */ |
70 | - @Length(max = 140,message = "备注最多只能包含140个字符") | |
75 | + @Length(max = 140, message = "备注最多只能包含140个字符") | |
71 | 76 | private String remark; |
72 | 77 | |
73 | 78 | /** |
... | ... | @@ -91,6 +96,7 @@ public class ProductCo implements Serializable { |
91 | 96 | |
92 | 97 | /** |
93 | 98 | * 允许重复 |
99 | + * | |
94 | 100 | * @see YesOrNoState |
95 | 101 | */ |
96 | 102 | private Integer allowRepeat = YesOrNoState.否.getCode(); |
... | ... | @@ -221,4 +227,12 @@ public class ProductCo implements Serializable { |
221 | 227 | public void setAllowRepeat(Integer allowRepeat) { |
222 | 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 | 2 | |
3 | 3 | import com.diligrp.etrade.core.jackson.deserializer.MoneyY2FDeserializer; |
4 | 4 | import com.diligrp.etrade.core.jackson.deserializer.WeightJ2KDeserializer; |
5 | -import com.diligrp.etrade.core.type.SaleUnitType; | |
6 | 5 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
7 | 6 | import jakarta.validation.constraints.NotNull; |
8 | 7 | import org.hibernate.validator.constraints.Range; |
... | ... | @@ -12,31 +11,32 @@ import java.io.Serializable; |
12 | 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 | 17 | @NotNull(message = "销售单位不能为空") |
18 | - private SaleUnitType saleUnit; | |
18 | + private Integer saleUnit; | |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * 预设价格(单位:元) |
22 | 22 | */ |
23 | 23 | @JsonDeserialize(using = MoneyY2FDeserializer.class) |
24 | 24 | @NotNull(message = "预设价格") |
25 | - @Range(max = 99999999,message = "预设价格 0 - 999999.99 元") | |
25 | + @Range(max = 99999999, message = "预设价格 0 - 999999.99 元") | |
26 | 26 | private Long prePrice; |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * 件重(单位:斤) |
30 | 30 | */ |
31 | 31 | @JsonDeserialize(using = WeightJ2KDeserializer.class) |
32 | - @Range(max = 499999995,message = "件重 0 - 999999.99 斤") | |
32 | + @Range(max = 499999995, message = "件重 0 - 999999.99 斤") | |
33 | 33 | private Long pieceWeight; |
34 | 34 | |
35 | - public SaleUnitType getSaleUnit() { | |
35 | + public Integer getSaleUnit() { | |
36 | 36 | return saleUnit; |
37 | 37 | } |
38 | 38 | |
39 | - public void setSaleUnit(SaleUnitType saleUnit) { | |
39 | + public void setSaleUnit(Integer saleUnit) { | |
40 | 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 | 52 | @Length(max = 15, message = "自定义商品码不能超过{max}") |
53 | 53 | private String articleCode; |
54 | 54 | |
55 | + /** | |
56 | + * 标签 | |
57 | + */ | |
58 | + private List<Integer> label; | |
59 | + | |
55 | 60 | @Valid |
56 | 61 | @NotEmpty(message = "预设信息不能为空") |
57 | 62 | private List<ProductPresetCo> presets; |
58 | 63 | |
64 | + /** | |
65 | + * 图片信息 | |
66 | + */ | |
67 | + @Valid | |
68 | + private List<ProductImageCo> images; | |
69 | + | |
59 | 70 | public Long getId() { |
60 | 71 | return id; |
61 | 72 | } |
... | ... | @@ -119,4 +130,20 @@ public class ProductUpdateCo implements Serializable { |
119 | 130 | public void setAlias(String alias) { |
120 | 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 | 55 | private String articleCode; |
56 | 56 | |
57 | 57 | /** |
58 | + * 标签 | |
59 | + */ | |
60 | + private List<Integer> label; | |
61 | + | |
62 | + /** | |
58 | 63 | * 店铺主键 |
59 | 64 | */ |
60 | 65 | private Long shopId; |
... | ... | @@ -287,4 +292,12 @@ public class ProductDetailVo implements Serializable { |
287 | 292 | public void setArticleCode(String articleCode) { |
288 | 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 | 2 | |
3 | 3 | import com.diligrp.etrade.core.jackson.serializer.MoneyF2YRetain2AndRetainZeroSerializer; |
4 | 4 | import com.diligrp.etrade.core.jackson.serializer.WeightK2JRetain2AndRetainZeroSerializer; |
5 | -import com.diligrp.etrade.core.type.SaleUnitType; | |
6 | 5 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
7 | 6 | |
8 | 7 | import java.io.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 | 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 | 44 | public Long getPrePrice() { |
54 | 45 | return prePrice; |
55 | 46 | } |
... | ... | @@ -65,4 +56,12 @@ public class ProductPresetVo implements Serializable { |
65 | 56 | public void setPieceWeight(Long pieceWeight) { |
66 | 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 | 53 | |
54 | 54 | /** |
55 | 55 | * 自定义商品码 |
56 | - * 中瑞市场:英文,数字,限制10位,必填;同店铺内商品码不可重复 | |
56 | + * 英文,数字,限制10位,必填;同店铺内商品码不可重复 | |
57 | 57 | */ |
58 | 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 | 68 | private Long shopId; |
... | ... | @@ -248,4 +253,12 @@ public class ProductDo extends BaseHasUserDo { |
248 | 253 | public void setAllowRepeat(Integer allowRepeat) { |
249 | 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 | 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 | 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 | 41 | public Long getPrePrice() { |
48 | 42 | return prePrice; |
49 | 43 | } |
... | ... | @@ -59,4 +53,12 @@ public class ProductPresetDo extends BaseHasUserDo { |
59 | 53 | public void setPieceWeight(Long pieceWeight) { |
60 | 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 | 45 | if (StringUtils.isNotBlank(data)) { |
46 | 46 | ProductCategorySyncCo co = JsonUtils.fromJsonString(data, ProductCategorySyncCo.class); |
47 | 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 | 48 | productService.productCategorySync(co); |
55 | 49 | } |
56 | 50 | } catch (Exception e) { | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/impl/ProductServiceImpl.java
1 | 1 | package com.diligrp.etrade.shop.service.impl; |
2 | 2 | |
3 | -import com.diligrp.etrade.admin.type.YesOrNoState; | |
4 | 3 | import com.diligrp.etrade.core.domain.Message; |
5 | 4 | import com.diligrp.etrade.core.domain.PageMessage; |
6 | 5 | import com.diligrp.etrade.core.type.YnType; |
... | ... | @@ -98,28 +97,11 @@ public class ProductServiceImpl implements ProductService { |
98 | 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 | 101 | return Message.success(); |
109 | 102 | } |
110 | 103 | |
111 | 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 | 105 | if (StringUtils.isNotBlank(entity.getCategoryIdPath())) { |
124 | 106 | //去掉空格 |
125 | 107 | entity.setCategoryIdPath(entity.getCategoryIdPath().replaceAll(" ", "")); |
... | ... | @@ -139,10 +121,8 @@ public class ProductServiceImpl implements ProductService { |
139 | 121 | |
140 | 122 | int ans = mapper.insert(entity); |
141 | 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 | 126 | productAuditService.init(entity.getId(), productAuditState); |
147 | 127 | |
148 | 128 | if (CollectionUtils.isNotEmpty(entity.getImages())) { |
... | ... | @@ -410,35 +390,8 @@ public class ProductServiceImpl implements ProductService { |
410 | 390 | * 注意:品类的基础信息是一致的,但是对应不同市场其图片是不一样的 |
411 | 391 | */ |
412 | 392 | //同步信息 |
393 | + co.setAlias(null); | |
413 | 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 | 397 | @Override | ... | ... |
etrade-shop/src/main/resources/com/diligrp/etrade/dao/mapper/ProductMapper.xml
... | ... | @@ -52,6 +52,7 @@ |
52 | 52 | <result column="p.name_path" property="namePath"/> |
53 | 53 | <result column="p.alias" property="alias"/> |
54 | 54 | <result column="p.article_code" property="articleCode"/> |
55 | + <result column="p.label" property="label" typeHandler="com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler"/> | |
55 | 56 | <result column="p.source" property="source"/> |
56 | 57 | <result column="p.remark" property="remark"/> |
57 | 58 | <result column="p.version" property="version"/> |
... | ... | @@ -119,6 +120,7 @@ |
119 | 120 | name_path_json, |
120 | 121 | alias, |
121 | 122 | article_code, |
123 | + label, | |
122 | 124 | shop_id, |
123 | 125 | source, |
124 | 126 | remark, |
... | ... | @@ -135,6 +137,7 @@ |
135 | 137 | #{namePathJson,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, |
136 | 138 | #{alias}, |
137 | 139 | #{articleCode}, |
140 | + #{label,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, | |
138 | 141 | #{shopId}, |
139 | 142 | #{source}, |
140 | 143 | #{remark}, |
... | ... | @@ -150,6 +153,9 @@ |
150 | 153 | <if test="articleCode != null and articleCode != ''"> |
151 | 154 | article_code = #{articleCode}, |
152 | 155 | </if> |
156 | + <if test="label !=null and label.size() > 0"> | |
157 | + label = #{label,typeHandler=com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler}, | |
158 | + </if> | |
153 | 159 | remark = #{remark}, |
154 | 160 | operater_id = #{operaterId}, |
155 | 161 | operater_name = #{operaterName}, |
... | ... | @@ -379,7 +385,7 @@ |
379 | 385 | ,s.id AS "s.id" |
380 | 386 | ,s.name AS "s.name" |
381 | 387 | ,s.customer_id AS "s.customer_id" |
382 | - ,st.stock * 500 AS "st.stock" | |
388 | + ,st.stock AS "st.stock" | |
383 | 389 | FROM product p |
384 | 390 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 1 |
385 | 391 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 1 |
... | ... | @@ -422,7 +428,7 @@ |
422 | 428 | ,s.id AS "s.id" |
423 | 429 | ,s.name AS "s.name" |
424 | 430 | ,s.customer_id AS "s.customer_id" |
425 | - ,st.stock * 500 AS "st.stock" | |
431 | + ,st.stock AS "st.stock" | |
426 | 432 | FROM product p |
427 | 433 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 0 AND pp.page_deleted = 1 |
428 | 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 | 479 | , p.name_path AS "p.name_path" |
474 | 480 | , p.alias AS "p.alias" |
475 | 481 | , p.article_code AS "p.article_code" |
482 | + , p.label AS "p.label" | |
476 | 483 | , p.source AS "p.source" |
477 | 484 | , p.remark AS "p.remark" |
478 | 485 | , p.version AS "p.version" |
... | ... | @@ -496,7 +503,7 @@ |
496 | 503 | , s.id AS "s.id" |
497 | 504 | , s.name AS "s.name" |
498 | 505 | , s.customer_id AS "s.customer_id" |
499 | - , st.stock * 500 AS "st.stock" | |
506 | + , st.stock AS "st.stock" | |
500 | 507 | FROM product p |
501 | 508 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 1 |
502 | 509 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 1 |
... | ... | @@ -540,7 +547,7 @@ |
540 | 547 | , s.id AS "s.id" |
541 | 548 | , s.name AS "s.name" |
542 | 549 | , s.customer_id AS "s.customer_id" |
543 | - , st.stock * 500 AS "st.stock" | |
550 | + , st.stock AS "st.stock" | |
544 | 551 | FROM product p |
545 | 552 | LEFT JOIN product_preset pp ON pp.product_id = p.id AND pp.deleted = 0 AND pp.page_deleted = 1 |
546 | 553 | LEFT JOIN product_image pi ON pi.product_id = p.id AND pi.deleted = 0 AND pi.page_deleted = 1 | ... | ... |