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,6 +36,15 @@ public interface CategoryRpc { | ||
36 | Message<CusCategoryDTO> getCusCategory(CusCategoryQuery query); | 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 | * listCusCategoryData | 48 | * listCusCategoryData |
40 | * | 49 | * |
41 | * @param categoryId categoryId | 50 | * @param categoryId categoryId |
@@ -58,4 +67,19 @@ public interface CategoryRpc { | @@ -58,4 +67,19 @@ public interface CategoryRpc { | ||
58 | result.addAll(list); | 67 | result.addAll(list); |
59 | return result; | 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 | package com.diligrp.etrade.shop.api; | 1 | package com.diligrp.etrade.shop.api; |
2 | 2 | ||
3 | +import com.diligrp.etrade.core.annotation.ParamLogPrint; | ||
3 | import com.diligrp.etrade.core.domain.Message; | 4 | import com.diligrp.etrade.core.domain.Message; |
4 | import com.diligrp.etrade.core.domain.PageMessage; | 5 | import com.diligrp.etrade.core.domain.PageMessage; |
5 | import com.diligrp.etrade.core.util.ValidatorUtil; | 6 | import com.diligrp.etrade.core.util.ValidatorUtil; |
7 | +import com.diligrp.etrade.rpc.dto.response.CusCategoryDTO; | ||
6 | import com.diligrp.etrade.shop.domain.request.*; | 8 | import com.diligrp.etrade.shop.domain.request.*; |
7 | import com.diligrp.etrade.shop.domain.response.ProductCategoryVo; | 9 | import com.diligrp.etrade.shop.domain.response.ProductCategoryVo; |
8 | import com.diligrp.etrade.shop.domain.response.ProductDetailVo; | 10 | import com.diligrp.etrade.shop.domain.response.ProductDetailVo; |
@@ -59,7 +61,7 @@ public class ProductApi { | @@ -59,7 +61,7 @@ public class ProductApi { | ||
59 | */ | 61 | */ |
60 | @PostMapping("/saveDispense") | 62 | @PostMapping("/saveDispense") |
61 | public Message<Void> saveDispense(@RequestBody @Validated List<ProductDispenseCo> coList) { | 63 | public Message<Void> saveDispense(@RequestBody @Validated List<ProductDispenseCo> coList) { |
62 | - Assert.notEmpty(coList,"分货数据不能为空"); | 64 | + Assert.notEmpty(coList, "分货数据不能为空"); |
63 | //手动校验 | 65 | //手动校验 |
64 | ValidatorUtil.validateCollection(coList); | 66 | ValidatorUtil.validateCollection(coList); |
65 | return productService.saveDispense(coList); | 67 | return productService.saveDispense(coList); |
@@ -165,6 +167,17 @@ public class ProductApi { | @@ -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 | * @param shopId | 183 | * @param shopId |
@@ -176,6 +189,18 @@ public class ProductApi { | @@ -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 | * @param id | 206 | * @param id |
@@ -188,20 +213,22 @@ public class ProductApi { | @@ -188,20 +213,22 @@ public class ProductApi { | ||
188 | 213 | ||
189 | /** | 214 | /** |
190 | * 获取审核状态 | 215 | * 获取审核状态 |
216 | + * | ||
191 | * @return | 217 | * @return |
192 | */ | 218 | */ |
193 | @PostMapping("/findAuditStates") | 219 | @PostMapping("/findAuditStates") |
194 | - public Message<List<ProductAuditState>> findAuditStates(){ | 220 | + public Message<List<ProductAuditState>> findAuditStates() { |
195 | return Message.success(Arrays.asList(ProductAuditState.values())); | 221 | return Message.success(Arrays.asList(ProductAuditState.values())); |
196 | } | 222 | } |
197 | 223 | ||
198 | /** | 224 | /** |
199 | * 删除 | 225 | * 删除 |
226 | + * | ||
200 | * @param co | 227 | * @param co |
201 | * @return | 228 | * @return |
202 | */ | 229 | */ |
203 | @PostMapping("/remove") | 230 | @PostMapping("/remove") |
204 | - public Message<Void> remove(@RequestBody @Validated ProductRemovedCo co){ | 231 | + public Message<Void> remove(@RequestBody @Validated ProductRemovedCo co) { |
205 | return productService.remove(co); | 232 | return productService.remove(co); |
206 | } | 233 | } |
207 | 234 | ||
@@ -218,6 +245,7 @@ public class ProductApi { | @@ -218,6 +245,7 @@ public class ProductApi { | ||
218 | 245 | ||
219 | /** | 246 | /** |
220 | * 分页查询 - 已删除 | 247 | * 分页查询 - 已删除 |
248 | + * | ||
221 | * @param co | 249 | * @param co |
222 | * @return | 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,6 +24,7 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
24 | 24 | ||
25 | /** | 25 | /** |
26 | * 分页查询 - 待审核 | 26 | * 分页查询 - 待审核 |
27 | + * | ||
27 | * @param co | 28 | * @param co |
28 | * @return | 29 | * @return |
29 | */ | 30 | */ |
@@ -32,6 +33,7 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -32,6 +33,7 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
32 | 33 | ||
33 | /** | 34 | /** |
34 | * 分页查询 - 已审核 (已通过/已拒绝) | 35 | * 分页查询 - 已审核 (已通过/已拒绝) |
36 | + * | ||
35 | * @param co | 37 | * @param co |
36 | * @return | 38 | * @return |
37 | */ | 39 | */ |
@@ -39,6 +41,7 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -39,6 +41,7 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
39 | 41 | ||
40 | /** | 42 | /** |
41 | * 分页查询 - 未通过 (待审核/已拒绝) | 43 | * 分页查询 - 未通过 (待审核/已拒绝) |
44 | + * | ||
42 | * @param co | 45 | * @param co |
43 | * @return | 46 | * @return |
44 | */ | 47 | */ |
@@ -46,6 +49,7 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -46,6 +49,7 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
46 | 49 | ||
47 | /** | 50 | /** |
48 | * 分页查询 - 无预设价格优先 | 51 | * 分页查询 - 无预设价格优先 |
52 | + * | ||
49 | * @param co | 53 | * @param co |
50 | * @return | 54 | * @return |
51 | */ | 55 | */ |
@@ -53,6 +57,7 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -53,6 +57,7 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
53 | 57 | ||
54 | /** | 58 | /** |
55 | * 分页查询 - 在售商品 - 最新上市 | 59 | * 分页查询 - 在售商品 - 最新上市 |
60 | + * | ||
56 | * @param co | 61 | * @param co |
57 | * @return | 62 | * @return |
58 | */ | 63 | */ |
@@ -60,6 +65,7 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -60,6 +65,7 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
60 | 65 | ||
61 | /** | 66 | /** |
62 | * 分页查询 - 在售商品 - 月销量 | 67 | * 分页查询 - 在售商品 - 月销量 |
68 | + * | ||
63 | * @param co | 69 | * @param co |
64 | * @return | 70 | * @return |
65 | */ | 71 | */ |
@@ -68,15 +74,25 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -68,15 +74,25 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
68 | 74 | ||
69 | /** | 75 | /** |
70 | * 分页查询 - 商品库存列表 - 按库存排序 | 76 | * 分页查询 - 商品库存列表 - 按库存排序 |
77 | + * | ||
71 | * @param co | 78 | * @param co |
72 | * @return | 79 | * @return |
73 | */ | 80 | */ |
74 | Page<Long> pageIdStock(ProductListStockCo co); | 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 | List<ProductListVo> list(List<Long> ids); | 91 | List<ProductListVo> list(List<Long> ids); |
77 | 92 | ||
78 | /** | 93 | /** |
79 | * 查询 - 已删除 | 94 | * 查询 - 已删除 |
95 | + * | ||
80 | * @param ids | 96 | * @param ids |
81 | * @return | 97 | * @return |
82 | */ | 98 | */ |
@@ -85,16 +101,18 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -85,16 +101,18 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
85 | 101 | ||
86 | /** | 102 | /** |
87 | * 获取列表详情 by 店铺主键 | 103 | * 获取列表详情 by 店铺主键 |
88 | - * | 104 | + * <p> |
89 | * 注:只查询每个店铺前6条数据 | 105 | * 注:只查询每个店铺前6条数据 |
106 | + * | ||
90 | * @param shopIds | 107 | * @param shopIds |
91 | * @param productName | 108 | * @param productName |
92 | * @return | 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 | * @param id | 116 | * @param id |
99 | * @return | 117 | * @return |
100 | */ | 118 | */ |
@@ -102,44 +120,54 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -102,44 +120,54 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
102 | 120 | ||
103 | /** | 121 | /** |
104 | * 详情 - 已删除 | 122 | * 详情 - 已删除 |
123 | + * | ||
105 | * @param id | 124 | * @param id |
106 | * @return | 125 | * @return |
107 | */ | 126 | */ |
108 | ProductDetailVo detailRemoved(Long id); | 127 | ProductDetailVo detailRemoved(Long id); |
109 | 128 | ||
110 | /** | 129 | /** |
111 | - * | ||
112 | - * @param shopId 店铺主键 | 130 | + * @param shopId 店铺主键 |
113 | * @param categoryId 品类主键 | 131 | * @param categoryId 品类主键 |
114 | * @return | 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 | * @param categoryId 品类主键 | 138 | * @param categoryId 品类主键 |
122 | * @return | 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 | * @param shopId | 147 | * @param shopId |
130 | * @return | 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 | * @param entity | 163 | * @param entity |
137 | * @return | 164 | * @return |
138 | */ | 165 | */ |
139 | - int updateVersion(ProductDo entity); | 166 | + int updateVersion(ProductDo entity); |
140 | 167 | ||
141 | /** | 168 | /** |
142 | * 品类信息同步 | 169 | * 品类信息同步 |
170 | + * | ||
143 | * @param co | 171 | * @param co |
144 | * @return | 172 | * @return |
145 | */ | 173 | */ |
@@ -147,11 +175,12 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -147,11 +175,12 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
147 | 175 | ||
148 | /** | 176 | /** |
149 | * 查找商品主键 | 177 | * 查找商品主键 |
178 | + * | ||
150 | * @param marketId | 179 | * @param marketId |
151 | * @param categoryId | 180 | * @param categoryId |
152 | * @return | 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 | * 获取市场id | 186 | * 获取市场id |
@@ -163,8 +192,10 @@ public interface ProductMapper extends MybatisMapperSupport { | @@ -163,8 +192,10 @@ public interface ProductMapper extends MybatisMapperSupport { | ||
163 | 192 | ||
164 | /** | 193 | /** |
165 | * 分页查询 - 已删除 | 194 | * 分页查询 - 已删除 |
195 | + * | ||
166 | * @param co | 196 | * @param co |
167 | * @return | 197 | * @return |
168 | */ | 198 | */ |
169 | Page<Long> pageIdRemoved(ProductListRemovedCo co); | 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,6 +30,11 @@ public class ProductListCo extends BasePageQueryDecorator { | ||
30 | private Long categoryId; | 30 | private Long categoryId; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | + * 上级品类主键 | ||
34 | + */ | ||
35 | + private Long parentCategoryId; | ||
36 | + | ||
37 | + /** | ||
33 | * 商品名称 | 38 | * 商品名称 |
34 | */ | 39 | */ |
35 | private String name; | 40 | private String name; |
@@ -39,6 +44,11 @@ public class ProductListCo extends BasePageQueryDecorator { | @@ -39,6 +44,11 @@ public class ProductListCo extends BasePageQueryDecorator { | ||
39 | */ | 44 | */ |
40 | private ProductAuditState auditState; | 45 | private ProductAuditState auditState; |
41 | 46 | ||
47 | + /** | ||
48 | + * 标签code | ||
49 | + */ | ||
50 | + private Integer labelCode; | ||
51 | + | ||
42 | 52 | ||
43 | public Long getShopId() { | 53 | public Long getShopId() { |
44 | return shopId; | 54 | return shopId; |
@@ -87,4 +97,20 @@ public class ProductListCo extends BasePageQueryDecorator { | @@ -87,4 +97,20 @@ public class ProductListCo extends BasePageQueryDecorator { | ||
87 | public void setShopName(String shopName) { | 97 | public void setShopName(String shopName) { |
88 | this.shopName = shopName; | 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,6 +26,11 @@ public class ProductListStockCo extends BasePageQueryDecorator { | ||
26 | private String shopName; | 26 | private String shopName; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | + * 商品名称 | ||
30 | + */ | ||
31 | + private String name; | ||
32 | + | ||
33 | + /** | ||
29 | * 品类主键 | 34 | * 品类主键 |
30 | */ | 35 | */ |
31 | private Long categoryId; | 36 | private Long categoryId; |
@@ -41,6 +46,11 @@ public class ProductListStockCo extends BasePageQueryDecorator { | @@ -41,6 +46,11 @@ public class ProductListStockCo extends BasePageQueryDecorator { | ||
41 | private String productName; | 46 | private String productName; |
42 | 47 | ||
43 | /** | 48 | /** |
49 | + * 标签code | ||
50 | + */ | ||
51 | + private Integer labelCode; | ||
52 | + | ||
53 | + /** | ||
44 | * 商品审核状态(0:未通过,1:已通过,2:已拒绝) | 54 | * 商品审核状态(0:未通过,1:已通过,2:已拒绝) |
45 | */ | 55 | */ |
46 | private ProductAuditState auditState; | 56 | private ProductAuditState auditState; |
@@ -114,4 +124,20 @@ public class ProductListStockCo extends BasePageQueryDecorator { | @@ -114,4 +124,20 @@ public class ProductListStockCo extends BasePageQueryDecorator { | ||
114 | public void setAuditState(ProductAuditState auditState) { | 124 | public void setAuditState(ProductAuditState auditState) { |
115 | this.auditState = auditState; | 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,6 +17,11 @@ public class ProductCategoryVo implements Serializable { | ||
17 | */ | 17 | */ |
18 | private String categoryName; | 18 | private String categoryName; |
19 | 19 | ||
20 | + /** | ||
21 | + * 品类主键全路径 | ||
22 | + */ | ||
23 | + private String categoryIdPath; | ||
24 | + | ||
20 | public Long getCategoryId() { | 25 | public Long getCategoryId() { |
21 | return categoryId; | 26 | return categoryId; |
22 | } | 27 | } |
@@ -32,4 +37,12 @@ public class ProductCategoryVo implements Serializable { | @@ -32,4 +37,12 @@ public class ProductCategoryVo implements Serializable { | ||
32 | public void setCategoryName(String categoryName) { | 37 | public void setCategoryName(String categoryName) { |
33 | this.categoryName = categoryName; | 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,6 +49,11 @@ 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 | + /** | ||
52 | * 店铺主键 | 57 | * 店铺主键 |
53 | */ | 58 | */ |
54 | private Long shopId; | 59 | private Long shopId; |
@@ -99,6 +104,11 @@ public class ProductListVo implements Serializable { | @@ -99,6 +104,11 @@ public class ProductListVo implements Serializable { | ||
99 | */ | 104 | */ |
100 | private ProductAuditVo audit; | 105 | private ProductAuditVo audit; |
101 | 106 | ||
107 | + /** | ||
108 | + * 标签 | ||
109 | + */ | ||
110 | + private List<Integer> label; | ||
111 | + | ||
102 | public Long getId() { | 112 | public Long getId() { |
103 | return id; | 113 | return id; |
104 | } | 114 | } |
@@ -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 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,6 +2,7 @@ package com.diligrp.etrade.shop.service; | ||
2 | 2 | ||
3 | import com.diligrp.etrade.core.domain.Message; | 3 | import com.diligrp.etrade.core.domain.Message; |
4 | import com.diligrp.etrade.core.domain.PageMessage; | 4 | import com.diligrp.etrade.core.domain.PageMessage; |
5 | +import com.diligrp.etrade.rpc.dto.response.CusCategoryDTO; | ||
5 | import com.diligrp.etrade.shop.domain.request.*; | 6 | import com.diligrp.etrade.shop.domain.request.*; |
6 | import com.diligrp.etrade.shop.domain.response.ProductCategoryVo; | 7 | import com.diligrp.etrade.shop.domain.response.ProductCategoryVo; |
7 | import com.diligrp.etrade.shop.domain.response.ProductDetailVo; | 8 | import com.diligrp.etrade.shop.domain.response.ProductDetailVo; |
@@ -41,6 +42,7 @@ public interface ProductService { | @@ -41,6 +42,7 @@ public interface ProductService { | ||
41 | 42 | ||
42 | /** | 43 | /** |
43 | * 删除 | 44 | * 删除 |
45 | + * | ||
44 | * @param co | 46 | * @param co |
45 | * @return | 47 | * @return |
46 | */ | 48 | */ |
@@ -49,6 +51,7 @@ public interface ProductService { | @@ -49,6 +51,7 @@ public interface ProductService { | ||
49 | 51 | ||
50 | /** | 52 | /** |
51 | * 分页查询 | 53 | * 分页查询 |
54 | + * | ||
52 | * @param co | 55 | * @param co |
53 | * @return | 56 | * @return |
54 | */ | 57 | */ |
@@ -88,7 +91,6 @@ public interface ProductService { | @@ -88,7 +91,6 @@ public interface ProductService { | ||
88 | PageMessage<ProductListVo> pageNonPrePricePriority(ProductListNonAuditStateCo co); | 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,6 +125,14 @@ public interface ProductService { | ||
123 | PageMessage<ProductListVo> pageStock(ProductListStockCo co); | 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 | * @param id | 138 | * @param id |
@@ -146,9 +156,18 @@ public interface ProductService { | @@ -146,9 +156,18 @@ public interface ProductService { | ||
146 | */ | 156 | */ |
147 | Message<List<ProductCategoryVo>> findAllCategoryLevel2ByShopId(Long shopId); | 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 | * @param co | 171 | * @param co |
153 | * @return | 172 | * @return |
154 | */ | 173 | */ |
@@ -156,6 +175,7 @@ public interface ProductService { | @@ -156,6 +175,7 @@ public interface ProductService { | ||
156 | 175 | ||
157 | /** | 176 | /** |
158 | * 详情 - 已删除 | 177 | * 详情 - 已删除 |
178 | + * | ||
159 | * @param id | 179 | * @param id |
160 | * @return | 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,6 +4,8 @@ import com.diligrp.etrade.core.domain.Message; | ||
4 | import com.diligrp.etrade.core.domain.PageMessage; | 4 | import com.diligrp.etrade.core.domain.PageMessage; |
5 | import com.diligrp.etrade.core.type.YnType; | 5 | import com.diligrp.etrade.core.type.YnType; |
6 | import com.diligrp.etrade.core.util.JsonUtils; | 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 | import com.diligrp.etrade.shared.service.OrderSharedService; | 9 | import com.diligrp.etrade.shared.service.OrderSharedService; |
8 | import com.diligrp.etrade.shop.config.PropertiesConfig; | 10 | import com.diligrp.etrade.shop.config.PropertiesConfig; |
9 | import com.diligrp.etrade.shop.dao.ProductMapper; | 11 | import com.diligrp.etrade.shop.dao.ProductMapper; |
@@ -56,6 +58,8 @@ public class ProductServiceImpl implements ProductService { | @@ -56,6 +58,8 @@ public class ProductServiceImpl implements ProductService { | ||
56 | private OrderSharedService orderSharedService; | 58 | private OrderSharedService orderSharedService; |
57 | @Resource | 59 | @Resource |
58 | private PropertiesConfig propertiesConfig; | 60 | private PropertiesConfig propertiesConfig; |
61 | + @Resource | ||
62 | + private CategoryRpc categoryRpc; | ||
59 | 63 | ||
60 | private static final Pattern DIGIT_PATTERN = Pattern.compile("^\\d+(,\\d+)*,?$"); | 64 | private static final Pattern DIGIT_PATTERN = Pattern.compile("^\\d+(,\\d+)*,?$"); |
61 | 65 | ||
@@ -106,7 +110,7 @@ public class ProductServiceImpl implements ProductService { | @@ -106,7 +110,7 @@ public class ProductServiceImpl implements ProductService { | ||
106 | productImageService.insertBatch(entity.getImages()); | 110 | productImageService.insertBatch(entity.getImages()); |
107 | } | 111 | } |
108 | 112 | ||
109 | - productAuditService.reSubmit(entity.getId(), ProductAuditState.AUDITING); | 113 | + productAuditService.reSubmit(entity.getId(), ProductAuditState.PASSED); |
110 | return Message.success(); | 114 | return Message.success(); |
111 | } | 115 | } |
112 | 116 | ||
@@ -370,6 +374,20 @@ public class ProductServiceImpl implements ProductService { | @@ -370,6 +374,20 @@ public class ProductServiceImpl implements ProductService { | ||
370 | } | 374 | } |
371 | 375 | ||
372 | @Override | 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 | public Message<ProductDetailVo> detail(Long id) { | 391 | public Message<ProductDetailVo> detail(Long id) { |
374 | logger.info("商品详情:{}", id); | 392 | logger.info("商品详情:{}", id); |
375 | Assert.notNull(id, "主键不能为空"); | 393 | Assert.notNull(id, "主键不能为空"); |
@@ -390,6 +408,34 @@ public class ProductServiceImpl implements ProductService { | @@ -390,6 +408,34 @@ public class ProductServiceImpl implements ProductService { | ||
390 | return Message.success(mapper.findAllCategoryLevel2ByShopId(shopId)); | 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 | @Transactional | 439 | @Transactional |
394 | @Override | 440 | @Override |
395 | public void productCategorySync(ProductCategorySyncCo co) { | 441 | public void productCategorySync(ProductCategorySyncCo co) { |
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.label" property="label" typeHandler="com.diligrp.etrade.core.mybatis.JsonArrayTypeHandler"/> | ||
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"/> |
@@ -105,6 +107,12 @@ | @@ -105,6 +107,12 @@ | ||
105 | <if test="_parameter.containsField('categoryId') and null != categoryId"> | 107 | <if test="_parameter.containsField('categoryId') and null != categoryId"> |
106 | AND p.category_id = #{categoryId} | 108 | AND p.category_id = #{categoryId} |
107 | </if> | 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 | </sql> | 116 | </sql> |
109 | 117 | ||
110 | <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true" | 118 | <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true" |
@@ -336,9 +344,6 @@ | @@ -336,9 +344,6 @@ | ||
336 | LEFT JOIN stock st ON st.product_id = p.id | 344 | LEFT JOIN stock st ON st.product_id = p.id |
337 | WHERE p.deleted = 1 | 345 | WHERE p.deleted = 1 |
338 | <include refid="listWhere"/> | 346 | <include refid="listWhere"/> |
339 | - <if test="null != parentCategoryId"> | ||
340 | - AND JSON_OVERLAPS(p.category_id_path_json,JSON_ARRAY(#{parentCategoryId})) | ||
341 | - </if> | ||
342 | <if test="null != auditState"> | 347 | <if test="null != auditState"> |
343 | AND pa.state = #{auditState} | 348 | AND pa.state = #{auditState} |
344 | </if> | 349 | </if> |
@@ -356,6 +361,20 @@ | @@ -356,6 +361,20 @@ | ||
356 | </choose> | 361 | </choose> |
357 | </select> | 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 | <select id="list" resultMap="listMap"> | 378 | <select id="list" resultMap="listMap"> |
360 | SELECT | 379 | SELECT |
361 | p.id AS "p.id" | 380 | p.id AS "p.id" |
@@ -407,6 +426,8 @@ | @@ -407,6 +426,8 @@ | ||
407 | ,p.name AS "p.name" | 426 | ,p.name AS "p.name" |
408 | ,p.name_path AS "p.name_path" | 427 | ,p.name_path AS "p.name_path" |
409 | ,p.alias AS "p.alias" | 428 | ,p.alias AS "p.alias" |
429 | + ,p.article_code AS "p.article_code" | ||
430 | + ,p.label AS "p.label" | ||
410 | ,p.source AS "p.source" | 431 | ,p.source AS "p.source" |
411 | ,p.remark AS "p.remark" | 432 | ,p.remark AS "p.remark" |
412 | ,p.version AS "p.version" | 433 | ,p.version AS "p.version" |
@@ -524,6 +545,7 @@ | @@ -524,6 +545,7 @@ | ||
524 | , p.name_path AS "p.name_path" | 545 | , p.name_path AS "p.name_path" |
525 | , p.alias AS "p.alias" | 546 | , p.alias AS "p.alias" |
526 | , p.article_code AS "p.article_code" | 547 | , p.article_code AS "p.article_code" |
548 | + , p.label AS "p.label" | ||
527 | , p.source AS "p.source" | 549 | , p.source AS "p.source" |
528 | , p.remark AS "p.remark" | 550 | , p.remark AS "p.remark" |
529 | , p.version AS "p.version" | 551 | , p.version AS "p.version" |
@@ -585,6 +607,18 @@ | @@ -585,6 +607,18 @@ | ||
585 | ORDER BY categoryName | 607 | ORDER BY categoryName |
586 | </select> | 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 | <update id="updateVersion"> | 622 | <update id="updateVersion"> |
589 | update product | 623 | update product |
590 | SET modifier_id = #{modifierId}, | 624 | SET modifier_id = #{modifierId}, |