Commit 12ee4916be987ee462e1ec2860688ed4ae409d08
Merge remote-tracking branch 'origin/feature_hg_20240716' into feature_hg_20240716
Showing
10 changed files
with
293 additions
and
19 deletions
etrade-rpc/src/main/java/com/diligrp/etrade/rpc/basicdata/CategoryRpc.java
... | ... | @@ -36,6 +36,15 @@ public interface CategoryRpc { |
36 | 36 | Message<CusCategoryDTO> getCusCategory(CusCategoryQuery query); |
37 | 37 | |
38 | 38 | /** |
39 | + * 获取类别 getCategoryChildByXtrade | |
40 | + * | |
41 | + * @param query query | |
42 | + * @return {@link Message }<{@link CusCategoryDTO }> | |
43 | + */ | |
44 | + @PostMapping(value = "/api/getCategoryChildByXtrade") | |
45 | + Message<List<CusCategoryDTO>> listCategoryChildByXtrade(CusCategoryQuery query); | |
46 | + | |
47 | + /** | |
39 | 48 | * listCusCategoryData |
40 | 49 | * |
41 | 50 | * @param categoryId categoryId |
... | ... | @@ -58,4 +67,19 @@ public interface CategoryRpc { |
58 | 67 | result.addAll(list); |
59 | 68 | return result; |
60 | 69 | } |
70 | + | |
71 | + /** | |
72 | + * listCusCategoryData | |
73 | + * | |
74 | + * @param categoryId categoryId | |
75 | + * @param marketId marketId | |
76 | + * @return {@link List}<{@link CusCategoryDTO}> | |
77 | + */ | |
78 | + default List<CusCategoryDTO> listCategoryChildByXtrade(Long categoryId, Long marketId) { | |
79 | + CusCategoryQuery query = new CusCategoryQuery(); | |
80 | + query.setParent(categoryId); | |
81 | + query.setMarketId(marketId); | |
82 | + List<CusCategoryDTO> list = this.listCusCategory(query).getData(); | |
83 | + return list; | |
84 | + } | |
61 | 85 | } | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/api/ProductApi.java
1 | 1 | package com.diligrp.etrade.shop.api; |
2 | 2 | |
3 | +import com.diligrp.etrade.core.annotation.ParamLogPrint; | |
3 | 4 | import com.diligrp.etrade.core.domain.Message; |
4 | 5 | import com.diligrp.etrade.core.domain.PageMessage; |
5 | 6 | import com.diligrp.etrade.core.util.ValidatorUtil; |
7 | +import com.diligrp.etrade.rpc.dto.response.CusCategoryDTO; | |
6 | 8 | import com.diligrp.etrade.shop.domain.request.*; |
7 | 9 | import com.diligrp.etrade.shop.domain.response.ProductCategoryVo; |
8 | 10 | import com.diligrp.etrade.shop.domain.response.ProductDetailVo; |
... | ... | @@ -59,7 +61,7 @@ public class ProductApi { |
59 | 61 | */ |
60 | 62 | @PostMapping("/saveDispense") |
61 | 63 | public Message<Void> saveDispense(@RequestBody @Validated List<ProductDispenseCo> coList) { |
62 | - Assert.notEmpty(coList,"分货数据不能为空"); | |
64 | + Assert.notEmpty(coList, "分货数据不能为空"); | |
63 | 65 | //手动校验 |
64 | 66 | ValidatorUtil.validateCollection(coList); |
65 | 67 | return productService.saveDispense(coList); |
... | ... | @@ -165,6 +167,17 @@ public class ProductApi { |
165 | 167 | } |
166 | 168 | |
167 | 169 | /** |
170 | + * 分页查询 - 商品库存列表 | |
171 | + * | |
172 | + * @param co | |
173 | + * @return | |
174 | + */ | |
175 | + @PostMapping("/v2/stock/page") | |
176 | + public PageMessage<ProductListVo> pageStockV2(@RequestBody @Validated ProductListStockCo co) { | |
177 | + return productService.pageStockV2(co); | |
178 | + } | |
179 | + | |
180 | + /** | |
168 | 181 | * 查找二级品类 |
169 | 182 | * |
170 | 183 | * @param shopId |
... | ... | @@ -176,6 +189,18 @@ public class ProductApi { |
176 | 189 | } |
177 | 190 | |
178 | 191 | /** |
192 | + * 存在商品的子品类 | |
193 | + * | |
194 | + * @param co co | |
195 | + * @return | |
196 | + */ | |
197 | + @PostMapping("/category/child") | |
198 | + @ParamLogPrint | |
199 | + public Message<List<CusCategoryDTO>> listCategoryChild(@RequestBody @Validated ProductListStockCo co) { | |
200 | + return productService.listCategoryChild(co); | |
201 | + } | |
202 | + | |
203 | + /** | |
179 | 204 | * 详情 |
180 | 205 | * |
181 | 206 | * @param id |
... | ... | @@ -188,20 +213,22 @@ public class ProductApi { |
188 | 213 | |
189 | 214 | /** |
190 | 215 | * 获取审核状态 |
216 | + * | |
191 | 217 | * @return |
192 | 218 | */ |
193 | 219 | @PostMapping("/findAuditStates") |
194 | - public Message<List<ProductAuditState>> findAuditStates(){ | |
220 | + public Message<List<ProductAuditState>> findAuditStates() { | |
195 | 221 | return Message.success(Arrays.asList(ProductAuditState.values())); |
196 | 222 | } |
197 | 223 | |
198 | 224 | /** |
199 | 225 | * 删除 |
226 | + * | |
200 | 227 | * @param co |
201 | 228 | * @return |
202 | 229 | */ |
203 | 230 | @PostMapping("/remove") |
204 | - public Message<Void> remove(@RequestBody @Validated ProductRemovedCo co){ | |
231 | + public Message<Void> remove(@RequestBody @Validated ProductRemovedCo co) { | |
205 | 232 | return productService.remove(co); |
206 | 233 | } |
207 | 234 | |
... | ... | @@ -218,6 +245,7 @@ public class ProductApi { |
218 | 245 | |
219 | 246 | /** |
220 | 247 | * 分页查询 - 已删除 |
248 | + * | |
221 | 249 | * @param co |
222 | 250 | * @return |
223 | 251 | */ | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/dao/ProductMapper.java
... | ... | @@ -24,6 +24,7 @@ public interface ProductMapper extends MybatisMapperSupport { |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * 分页查询 - 待审核 |
27 | + * | |
27 | 28 | * @param co |
28 | 29 | * @return |
29 | 30 | */ |
... | ... | @@ -32,6 +33,7 @@ public interface ProductMapper extends MybatisMapperSupport { |
32 | 33 | |
33 | 34 | /** |
34 | 35 | * 分页查询 - 已审核 (已通过/已拒绝) |
36 | + * | |
35 | 37 | * @param co |
36 | 38 | * @return |
37 | 39 | */ |
... | ... | @@ -39,6 +41,7 @@ public interface ProductMapper extends MybatisMapperSupport { |
39 | 41 | |
40 | 42 | /** |
41 | 43 | * 分页查询 - 未通过 (待审核/已拒绝) |
44 | + * | |
42 | 45 | * @param co |
43 | 46 | * @return |
44 | 47 | */ |
... | ... | @@ -46,6 +49,7 @@ public interface ProductMapper extends MybatisMapperSupport { |
46 | 49 | |
47 | 50 | /** |
48 | 51 | * 分页查询 - 无预设价格优先 |
52 | + * | |
49 | 53 | * @param co |
50 | 54 | * @return |
51 | 55 | */ |
... | ... | @@ -53,6 +57,7 @@ public interface ProductMapper extends MybatisMapperSupport { |
53 | 57 | |
54 | 58 | /** |
55 | 59 | * 分页查询 - 在售商品 - 最新上市 |
60 | + * | |
56 | 61 | * @param co |
57 | 62 | * @return |
58 | 63 | */ |
... | ... | @@ -60,6 +65,7 @@ public interface ProductMapper extends MybatisMapperSupport { |
60 | 65 | |
61 | 66 | /** |
62 | 67 | * 分页查询 - 在售商品 - 月销量 |
68 | + * | |
63 | 69 | * @param co |
64 | 70 | * @return |
65 | 71 | */ |
... | ... | @@ -68,15 +74,25 @@ public interface ProductMapper extends MybatisMapperSupport { |
68 | 74 | |
69 | 75 | /** |
70 | 76 | * 分页查询 - 商品库存列表 - 按库存排序 |
77 | + * | |
71 | 78 | * @param co |
72 | 79 | * @return |
73 | 80 | */ |
74 | 81 | Page<Long> pageIdStock(ProductListStockCo co); |
75 | 82 | |
83 | + /** | |
84 | + * 分页查询 - 商品库存列表 - 按商品更新时间排序 | |
85 | + * | |
86 | + * @param co 一氧化碳 | |
87 | + * @return {@link Page }<{@link Long }> | |
88 | + */ | |
89 | + Page<Long> pageIdStockV2(ProductListStockCo co); | |
90 | + | |
76 | 91 | List<ProductListVo> list(List<Long> ids); |
77 | 92 | |
78 | 93 | /** |
79 | 94 | * 查询 - 已删除 |
95 | + * | |
80 | 96 | * @param ids |
81 | 97 | * @return |
82 | 98 | */ |
... | ... | @@ -85,16 +101,18 @@ public interface ProductMapper extends MybatisMapperSupport { |
85 | 101 | |
86 | 102 | /** |
87 | 103 | * 获取列表详情 by 店铺主键 |
88 | - * | |
104 | + * <p> | |
89 | 105 | * 注:只查询每个店铺前6条数据 |
106 | + * | |
90 | 107 | * @param shopIds |
91 | 108 | * @param productName |
92 | 109 | * @return |
93 | 110 | */ |
94 | - List<ProductListVo> listIdAndShopIdByShopIdsAndProductName(@Param("shopIds") List<Long> shopIds,@Nullable @Param("productName") String productName); | |
111 | + List<ProductListVo> listIdAndShopIdByShopIdsAndProductName(@Param("shopIds") List<Long> shopIds, @Nullable @Param("productName") String productName); | |
95 | 112 | |
96 | 113 | /** |
97 | 114 | * 详情 |
115 | + * | |
98 | 116 | * @param id |
99 | 117 | * @return |
100 | 118 | */ |
... | ... | @@ -102,44 +120,54 @@ public interface ProductMapper extends MybatisMapperSupport { |
102 | 120 | |
103 | 121 | /** |
104 | 122 | * 详情 - 已删除 |
123 | + * | |
105 | 124 | * @param id |
106 | 125 | * @return |
107 | 126 | */ |
108 | 127 | ProductDetailVo detailRemoved(Long id); |
109 | 128 | |
110 | 129 | /** |
111 | - * | |
112 | - * @param shopId 店铺主键 | |
130 | + * @param shopId 店铺主键 | |
113 | 131 | * @param categoryId 品类主键 |
114 | 132 | * @return |
115 | 133 | */ |
116 | - Long findId(Long shopId,Long categoryId); | |
134 | + Long findId(Long shopId, Long categoryId); | |
117 | 135 | |
118 | 136 | /** |
119 | - * | |
120 | - * @param shopId 店铺主键 | |
137 | + * @param shopId 店铺主键 | |
121 | 138 | * @param categoryId 品类主键 |
122 | 139 | * @return |
123 | 140 | */ |
124 | - List<Long> findIdV1(Long shopId,Long categoryId); | |
141 | + List<Long> findIdV1(Long shopId, Long categoryId); | |
125 | 142 | |
126 | 143 | |
127 | 144 | /** |
128 | 145 | * 查找二级品类 |
146 | + * | |
129 | 147 | * @param shopId |
130 | 148 | * @return |
131 | 149 | */ |
132 | - List<ProductCategoryVo> findAllCategoryLevel2ByShopId(Long shopId); | |
150 | + List<ProductCategoryVo> findAllCategoryLevel2ByShopId(Long shopId); | |
151 | + | |
152 | + /** | |
153 | + * listCategoryChild | |
154 | + * | |
155 | + * @param co co | |
156 | + * @return {@link List }<{@link ProductCategoryVo }> | |
157 | + */ | |
158 | + List<ProductCategoryVo> listCategoryChild(ProductListStockCo co); | |
133 | 159 | |
134 | 160 | /** |
135 | 161 | * 更新版本号 |
162 | + * | |
136 | 163 | * @param entity |
137 | 164 | * @return |
138 | 165 | */ |
139 | - int updateVersion(ProductDo entity); | |
166 | + int updateVersion(ProductDo entity); | |
140 | 167 | |
141 | 168 | /** |
142 | 169 | * 品类信息同步 |
170 | + * | |
143 | 171 | * @param co |
144 | 172 | * @return |
145 | 173 | */ |
... | ... | @@ -147,11 +175,12 @@ public interface ProductMapper extends MybatisMapperSupport { |
147 | 175 | |
148 | 176 | /** |
149 | 177 | * 查找商品主键 |
178 | + * | |
150 | 179 | * @param marketId |
151 | 180 | * @param categoryId |
152 | 181 | * @return |
153 | 182 | */ |
154 | - List<Long> listByMarketIdAndCategoryId(Long marketId,Long categoryId); | |
183 | + List<Long> listByMarketIdAndCategoryId(Long marketId, Long categoryId); | |
155 | 184 | |
156 | 185 | /** |
157 | 186 | * 获取市场id |
... | ... | @@ -163,8 +192,10 @@ public interface ProductMapper extends MybatisMapperSupport { |
163 | 192 | |
164 | 193 | /** |
165 | 194 | * 分页查询 - 已删除 |
195 | + * | |
166 | 196 | * @param co |
167 | 197 | * @return |
168 | 198 | */ |
169 | 199 | Page<Long> pageIdRemoved(ProductListRemovedCo co); |
200 | + | |
170 | 201 | } | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductListCo.java
... | ... | @@ -30,6 +30,11 @@ public class ProductListCo extends BasePageQueryDecorator { |
30 | 30 | private Long categoryId; |
31 | 31 | |
32 | 32 | /** |
33 | + * 上级品类主键 | |
34 | + */ | |
35 | + private Long parentCategoryId; | |
36 | + | |
37 | + /** | |
33 | 38 | * 商品名称 |
34 | 39 | */ |
35 | 40 | private String name; |
... | ... | @@ -39,6 +44,11 @@ public class ProductListCo extends BasePageQueryDecorator { |
39 | 44 | */ |
40 | 45 | private ProductAuditState auditState; |
41 | 46 | |
47 | + /** | |
48 | + * 标签code | |
49 | + */ | |
50 | + private Integer labelCode; | |
51 | + | |
42 | 52 | |
43 | 53 | public Long getShopId() { |
44 | 54 | return shopId; |
... | ... | @@ -87,4 +97,20 @@ public class ProductListCo extends BasePageQueryDecorator { |
87 | 97 | public void setShopName(String shopName) { |
88 | 98 | this.shopName = shopName; |
89 | 99 | } |
100 | + | |
101 | + public Long getParentCategoryId() { | |
102 | + return parentCategoryId; | |
103 | + } | |
104 | + | |
105 | + public void setParentCategoryId(Long parentCategoryId) { | |
106 | + this.parentCategoryId = parentCategoryId; | |
107 | + } | |
108 | + | |
109 | + public Integer getLabelCode() { | |
110 | + return labelCode; | |
111 | + } | |
112 | + | |
113 | + public void setLabelCode(Integer labelCode) { | |
114 | + this.labelCode = labelCode; | |
115 | + } | |
90 | 116 | } | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/request/ProductListStockCo.java
... | ... | @@ -26,6 +26,11 @@ public class ProductListStockCo extends BasePageQueryDecorator { |
26 | 26 | private String shopName; |
27 | 27 | |
28 | 28 | /** |
29 | + * 商品名称 | |
30 | + */ | |
31 | + private String name; | |
32 | + | |
33 | + /** | |
29 | 34 | * 品类主键 |
30 | 35 | */ |
31 | 36 | private Long categoryId; |
... | ... | @@ -41,6 +46,11 @@ public class ProductListStockCo extends BasePageQueryDecorator { |
41 | 46 | private String productName; |
42 | 47 | |
43 | 48 | /** |
49 | + * 标签code | |
50 | + */ | |
51 | + private Integer labelCode; | |
52 | + | |
53 | + /** | |
44 | 54 | * 商品审核状态(0:未通过,1:已通过,2:已拒绝) |
45 | 55 | */ |
46 | 56 | private ProductAuditState auditState; |
... | ... | @@ -114,4 +124,20 @@ public class ProductListStockCo extends BasePageQueryDecorator { |
114 | 124 | public void setAuditState(ProductAuditState auditState) { |
115 | 125 | this.auditState = auditState; |
116 | 126 | } |
127 | + | |
128 | + public Integer getLabelCode() { | |
129 | + return labelCode; | |
130 | + } | |
131 | + | |
132 | + public void setLabelCode(Integer labelCode) { | |
133 | + this.labelCode = labelCode; | |
134 | + } | |
135 | + | |
136 | + public String getName() { | |
137 | + return name; | |
138 | + } | |
139 | + | |
140 | + public void setName(String name) { | |
141 | + this.name = name; | |
142 | + } | |
117 | 143 | } | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/response/ProductCategoryVo.java
... | ... | @@ -17,6 +17,11 @@ public class ProductCategoryVo implements Serializable { |
17 | 17 | */ |
18 | 18 | private String categoryName; |
19 | 19 | |
20 | + /** | |
21 | + * 品类主键全路径 | |
22 | + */ | |
23 | + private String categoryIdPath; | |
24 | + | |
20 | 25 | public Long getCategoryId() { |
21 | 26 | return categoryId; |
22 | 27 | } |
... | ... | @@ -32,4 +37,12 @@ public class ProductCategoryVo implements Serializable { |
32 | 37 | public void setCategoryName(String categoryName) { |
33 | 38 | this.categoryName = categoryName; |
34 | 39 | } |
40 | + | |
41 | + public String getCategoryIdPath() { | |
42 | + return categoryIdPath; | |
43 | + } | |
44 | + | |
45 | + public void setCategoryIdPath(String categoryIdPath) { | |
46 | + this.categoryIdPath = categoryIdPath; | |
47 | + } | |
35 | 48 | } | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/domain/response/ProductListVo.java
... | ... | @@ -49,6 +49,11 @@ public class ProductListVo implements Serializable { |
49 | 49 | private String alias; |
50 | 50 | |
51 | 51 | /** |
52 | + * 自定义商品码 | |
53 | + */ | |
54 | + private String articleCode; | |
55 | + | |
56 | + /** | |
52 | 57 | * 店铺主键 |
53 | 58 | */ |
54 | 59 | private Long shopId; |
... | ... | @@ -99,6 +104,11 @@ public class ProductListVo implements Serializable { |
99 | 104 | */ |
100 | 105 | private ProductAuditVo audit; |
101 | 106 | |
107 | + /** | |
108 | + * 标签 | |
109 | + */ | |
110 | + private List<Integer> label; | |
111 | + | |
102 | 112 | public Long getId() { |
103 | 113 | return id; |
104 | 114 | } |
... | ... | @@ -234,4 +244,20 @@ public class ProductListVo implements Serializable { |
234 | 244 | public void setCode(String code) { |
235 | 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 List<Integer> getLabel() { | |
257 | + return label; | |
258 | + } | |
259 | + | |
260 | + public void setLabel(List<Integer> label) { | |
261 | + this.label = label; | |
262 | + } | |
237 | 263 | } | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/ProductService.java
... | ... | @@ -2,6 +2,7 @@ package com.diligrp.etrade.shop.service; |
2 | 2 | |
3 | 3 | import com.diligrp.etrade.core.domain.Message; |
4 | 4 | import com.diligrp.etrade.core.domain.PageMessage; |
5 | +import com.diligrp.etrade.rpc.dto.response.CusCategoryDTO; | |
5 | 6 | import com.diligrp.etrade.shop.domain.request.*; |
6 | 7 | import com.diligrp.etrade.shop.domain.response.ProductCategoryVo; |
7 | 8 | import com.diligrp.etrade.shop.domain.response.ProductDetailVo; |
... | ... | @@ -41,6 +42,7 @@ public interface ProductService { |
41 | 42 | |
42 | 43 | /** |
43 | 44 | * 删除 |
45 | + * | |
44 | 46 | * @param co |
45 | 47 | * @return |
46 | 48 | */ |
... | ... | @@ -49,6 +51,7 @@ public interface ProductService { |
49 | 51 | |
50 | 52 | /** |
51 | 53 | * 分页查询 |
54 | + * | |
52 | 55 | * @param co |
53 | 56 | * @return |
54 | 57 | */ |
... | ... | @@ -88,7 +91,6 @@ public interface ProductService { |
88 | 91 | PageMessage<ProductListVo> pageNonPrePricePriority(ProductListNonAuditStateCo co); |
89 | 92 | |
90 | 93 | |
91 | - | |
92 | 94 | /** |
93 | 95 | * 分页查询 - 在售商品 - 最新上市 |
94 | 96 | * |
... | ... | @@ -123,6 +125,14 @@ public interface ProductService { |
123 | 125 | PageMessage<ProductListVo> pageStock(ProductListStockCo co); |
124 | 126 | |
125 | 127 | /** |
128 | + * 分页查询 - 商品库存列表v2 | |
129 | + * | |
130 | + * @param co co | |
131 | + * @return {@link PageMessage }<{@link ProductListVo }> | |
132 | + */ | |
133 | + PageMessage<ProductListVo> pageStockV2(ProductListStockCo co); | |
134 | + | |
135 | + /** | |
126 | 136 | * 详情 |
127 | 137 | * |
128 | 138 | * @param id |
... | ... | @@ -146,9 +156,18 @@ public interface ProductService { |
146 | 156 | */ |
147 | 157 | Message<List<ProductCategoryVo>> findAllCategoryLevel2ByShopId(Long shopId); |
148 | 158 | |
159 | + /** | |
160 | + * 存在商品的子品类 | |
161 | + * | |
162 | + * @param co co | |
163 | + * @return {@link Message }<{@link List }<{@link ProductCategoryVo }>> | |
164 | + */ | |
165 | + Message<List<CusCategoryDTO>> listCategoryChild(ProductListStockCo co); | |
166 | + | |
149 | 167 | |
150 | 168 | /** |
151 | 169 | * 品类信息同步 |
170 | + * | |
152 | 171 | * @param co |
153 | 172 | * @return |
154 | 173 | */ |
... | ... | @@ -156,6 +175,7 @@ public interface ProductService { |
156 | 175 | |
157 | 176 | /** |
158 | 177 | * 详情 - 已删除 |
178 | + * | |
159 | 179 | * @param id |
160 | 180 | * @return |
161 | 181 | */ | ... | ... |
etrade-shop/src/main/java/com/diligrp/etrade/shop/service/impl/ProductServiceImpl.java
... | ... | @@ -4,6 +4,8 @@ import com.diligrp.etrade.core.domain.Message; |
4 | 4 | import com.diligrp.etrade.core.domain.PageMessage; |
5 | 5 | import com.diligrp.etrade.core.type.YnType; |
6 | 6 | import com.diligrp.etrade.core.util.JsonUtils; |
7 | +import com.diligrp.etrade.rpc.basicdata.CategoryRpc; | |
8 | +import com.diligrp.etrade.rpc.dto.response.CusCategoryDTO; | |
7 | 9 | import com.diligrp.etrade.shared.service.OrderSharedService; |
8 | 10 | import com.diligrp.etrade.shop.config.PropertiesConfig; |
9 | 11 | import com.diligrp.etrade.shop.dao.ProductMapper; |
... | ... | @@ -56,6 +58,8 @@ public class ProductServiceImpl implements ProductService { |
56 | 58 | private OrderSharedService orderSharedService; |
57 | 59 | @Resource |
58 | 60 | private PropertiesConfig propertiesConfig; |
61 | + @Resource | |
62 | + private CategoryRpc categoryRpc; | |
59 | 63 | |
60 | 64 | private static final Pattern DIGIT_PATTERN = Pattern.compile("^\\d+(,\\d+)*,?$"); |
61 | 65 | |
... | ... | @@ -106,7 +110,7 @@ public class ProductServiceImpl implements ProductService { |
106 | 110 | productImageService.insertBatch(entity.getImages()); |
107 | 111 | } |
108 | 112 | |
109 | - productAuditService.reSubmit(entity.getId(), ProductAuditState.AUDITING); | |
113 | + productAuditService.reSubmit(entity.getId(), ProductAuditState.PASSED); | |
110 | 114 | return Message.success(); |
111 | 115 | } |
112 | 116 | |
... | ... | @@ -370,6 +374,20 @@ public class ProductServiceImpl implements ProductService { |
370 | 374 | } |
371 | 375 | |
372 | 376 | @Override |
377 | + public PageMessage<ProductListVo> pageStockV2(ProductListStockCo co) { | |
378 | + logger.info("商品分页查询 - 商品库存列表V2:{}", co); | |
379 | + PageHelper.startPage(ObjectUtils.defaultIfNull(co.getPageNo(), 1), | |
380 | + ObjectUtils.defaultIfNull(co.getPageSize(), 10)); | |
381 | + Page<Long> idPage = mapper.pageIdStockV2(co); | |
382 | + if (CollectionUtils.isEmpty(idPage)) { | |
383 | + return PageMessage.success(null == idPage ? 0 : idPage.getTotal(), new ArrayList<>()); | |
384 | + } | |
385 | + List<ProductListVo> vos = mapper.list(idPage); | |
386 | + vos = sort(idPage, vos); | |
387 | + return PageMessage.success(idPage.getTotal(), vos); | |
388 | + } | |
389 | + | |
390 | + @Override | |
373 | 391 | public Message<ProductDetailVo> detail(Long id) { |
374 | 392 | logger.info("商品详情:{}", id); |
375 | 393 | Assert.notNull(id, "主键不能为空"); |
... | ... | @@ -390,6 +408,34 @@ public class ProductServiceImpl implements ProductService { |
390 | 408 | return Message.success(mapper.findAllCategoryLevel2ByShopId(shopId)); |
391 | 409 | } |
392 | 410 | |
411 | + /** | |
412 | + * 存在商品的子品类 | |
413 | + * | |
414 | + * @param co co | |
415 | + * @return {@link Message }<{@link List }<{@link ProductCategoryVo }>> | |
416 | + */ | |
417 | + @Override | |
418 | + public Message<List<CusCategoryDTO>> listCategoryChild(ProductListStockCo co) { | |
419 | + // category | |
420 | + List<CusCategoryDTO> cusCategoryDTOS = categoryRpc.listCategoryChildByXtrade(co.getParentCategoryId(), co.getMarketId()); | |
421 | + if (CollectionUtils.isEmpty(cusCategoryDTOS)) { | |
422 | + return Message.success(Collections.emptyList()); | |
423 | + } | |
424 | + // category product | |
425 | + Set<String> productCategoryIds = mapper.listCategoryChild(co) | |
426 | + .stream() | |
427 | + .filter(vo -> StringUtils.isNotBlank(vo.getCategoryIdPath())) | |
428 | + .flatMap(vo -> Arrays.stream(StringUtils.split(vo.getCategoryIdPath(), ","))) | |
429 | + .collect(Collectors.toSet()); | |
430 | + | |
431 | + // filter category | |
432 | + cusCategoryDTOS = cusCategoryDTOS | |
433 | + .stream() | |
434 | + .filter(vo -> productCategoryIds.contains(vo.getId().toString())) | |
435 | + .collect(Collectors.toList()); | |
436 | + return Message.success(cusCategoryDTOS); | |
437 | + } | |
438 | + | |
393 | 439 | @Transactional |
394 | 440 | @Override |
395 | 441 | public void productCategorySync(ProductCategorySyncCo co) { | ... | ... |
etrade-shop/src/main/resources/com/diligrp/etrade/dao/mapper/ProductMapper.xml
... | ... | @@ -9,6 +9,8 @@ |
9 | 9 | <result column="p.name" property="name"/> |
10 | 10 | <result column="p.name_path" property="namePath"/> |
11 | 11 | <result column="p.alias" property="alias"/> |
12 | + <result column="p.article_code" property="articleCode"/> | |
13 | + <result column="p.label" property="label" typeHandler="com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler"/> | |
12 | 14 | <result column="p.source" property="source"/> |
13 | 15 | <result column="p.remark" property="remark"/> |
14 | 16 | <result column="p.version" property="version"/> |
... | ... | @@ -105,6 +107,12 @@ |
105 | 107 | <if test="_parameter.containsField('categoryId') and null != categoryId"> |
106 | 108 | AND p.category_id = #{categoryId} |
107 | 109 | </if> |
110 | + <if test="_parameter.containsField('parentCategoryId') and parentCategoryId != null"> | |
111 | + AND JSON_OVERLAPS(p.category_id_path_json,JSON_ARRAY(#{parentCategoryId})) | |
112 | + </if> | |
113 | + <if test="_parameter.containsField('labelCode') and labelCode != null"> | |
114 | + AND JSON_OVERLAPS(p.label,JSON_ARRAY(#{labelCode})) | |
115 | + </if> | |
108 | 116 | </sql> |
109 | 117 | |
110 | 118 | <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true" |
... | ... | @@ -336,9 +344,6 @@ |
336 | 344 | LEFT JOIN stock st ON st.product_id = p.id |
337 | 345 | WHERE p.deleted = 1 |
338 | 346 | <include refid="listWhere"/> |
339 | - <if test="null != parentCategoryId"> | |
340 | - AND JSON_OVERLAPS(p.category_id_path_json,JSON_ARRAY(#{parentCategoryId})) | |
341 | - </if> | |
342 | 347 | <if test="null != auditState"> |
343 | 348 | AND pa.state = #{auditState} |
344 | 349 | </if> |
... | ... | @@ -356,6 +361,20 @@ |
356 | 361 | </choose> |
357 | 362 | </select> |
358 | 363 | |
364 | + <!-- 查询商品主键集合 - 商品库存列表 取状态=待审核+审核通过的,且有库存的商品 --> | |
365 | + <select id="pageIdStockV2" resultType="java.lang.Long"> | |
366 | + SELECT | |
367 | + DISTINCT p.id | |
368 | + FROM product p | |
369 | + INNER JOIN product_audit pa ON pa.product_id = p.id AND pa.deleted = 1 | |
370 | + INNER JOIN shop s ON s.id = p.shop_Id AND s.state = 1 AND s.market_id = #{marketId} | |
371 | + INNER JOIN stock st ON st.product_id = p.id | |
372 | + WHERE p.deleted = 1 | |
373 | + AND pa.state != 2 | |
374 | + <include refid="listWhere"/> | |
375 | + ORDER BY p.modified_time DESC, id DESC | |
376 | + </select> | |
377 | + | |
359 | 378 | <select id="list" resultMap="listMap"> |
360 | 379 | SELECT |
361 | 380 | p.id AS "p.id" |
... | ... | @@ -407,6 +426,8 @@ |
407 | 426 | ,p.name AS "p.name" |
408 | 427 | ,p.name_path AS "p.name_path" |
409 | 428 | ,p.alias AS "p.alias" |
429 | + ,p.article_code AS "p.article_code" | |
430 | + ,p.label AS "p.label" | |
410 | 431 | ,p.source AS "p.source" |
411 | 432 | ,p.remark AS "p.remark" |
412 | 433 | ,p.version AS "p.version" |
... | ... | @@ -524,6 +545,7 @@ |
524 | 545 | , p.name_path AS "p.name_path" |
525 | 546 | , p.alias AS "p.alias" |
526 | 547 | , p.article_code AS "p.article_code" |
548 | + , p.label AS "p.label" | |
527 | 549 | , p.source AS "p.source" |
528 | 550 | , p.remark AS "p.remark" |
529 | 551 | , p.version AS "p.version" |
... | ... | @@ -585,6 +607,18 @@ |
585 | 607 | ORDER BY categoryName |
586 | 608 | </select> |
587 | 609 | |
610 | + | |
611 | + <select id="listCategoryChild" resultType="com.diligrp.etrade.shop.domain.response.ProductCategoryVo"> | |
612 | + SELECT | |
613 | + DISTINCT p.category_id_path | |
614 | + FROM product p | |
615 | + INNER JOIN product_audit pa ON pa.product_id = p.id AND pa.deleted = 1 | |
616 | + INNER JOIN shop s ON s.id = p.shop_Id AND s.state = 1 AND s.market_id = #{marketId} | |
617 | + INNER JOIN stock st ON st.product_id = p.id | |
618 | + WHERE p.deleted = 1 | |
619 | + <include refid="listWhere"/> | |
620 | + </select> | |
621 | + | |
588 | 622 | <update id="updateVersion"> |
589 | 623 | update product |
590 | 624 | SET modifier_id = #{modifierId}, | ... | ... |