Commit 83b11ebdb02f8cfff340d4eaf805bc351672a6e6
1 parent
68c948f9
修改商品库接
Showing
3 changed files
with
32 additions
and
8 deletions
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/GoodsRPC.java
@@ -16,6 +16,7 @@ import com.diligrp.titan.sdk.domain.Product; | @@ -16,6 +16,7 @@ import com.diligrp.titan.sdk.domain.Product; | ||
16 | import com.diligrp.titan.sdk.input.CategoryInput; | 16 | import com.diligrp.titan.sdk.input.CategoryInput; |
17 | import com.diligrp.titan.sdk.input.PopProductView; | 17 | import com.diligrp.titan.sdk.input.PopProductView; |
18 | import com.diligrp.titan.sdk.input.ProductSearchInput; | 18 | import com.diligrp.titan.sdk.input.ProductSearchInput; |
19 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | ||
19 | import com.diligrp.titan.sdk.output.PageOutput; | 20 | import com.diligrp.titan.sdk.output.PageOutput; |
20 | 21 | ||
21 | import java.util.HashMap; | 22 | import java.util.HashMap; |
@@ -131,4 +132,5 @@ public interface GoodsRPC { | @@ -131,4 +132,5 @@ public interface GoodsRPC { | ||
131 | List<Category> listCategory(int parentId,int shopId); | 132 | List<Category> listCategory(int parentId,int shopId); |
132 | 133 | ||
133 | List<Product> searchProduct(ProductSearchInput input); | 134 | List<Product> searchProduct(ProductSearchInput input); |
135 | + Object updateProduct(UpdateProductInput updateProductInput); | ||
134 | } | 136 | } |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/GoodsRPCImpl.java
@@ -22,6 +22,7 @@ import com.diligrp.titan.sdk.domain.Product; | @@ -22,6 +22,7 @@ import com.diligrp.titan.sdk.domain.Product; | ||
22 | import com.diligrp.titan.sdk.input.CategoryInput; | 22 | import com.diligrp.titan.sdk.input.CategoryInput; |
23 | import com.diligrp.titan.sdk.input.PopProductView; | 23 | import com.diligrp.titan.sdk.input.PopProductView; |
24 | import com.diligrp.titan.sdk.input.ProductSearchInput; | 24 | import com.diligrp.titan.sdk.input.ProductSearchInput; |
25 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | ||
25 | import com.diligrp.titan.sdk.output.BaseOutput; | 26 | import com.diligrp.titan.sdk.output.BaseOutput; |
26 | import com.diligrp.titan.sdk.output.PageOutput; | 27 | import com.diligrp.titan.sdk.output.PageOutput; |
27 | import com.diligrp.website.util.redis.RedisUtil; | 28 | import com.diligrp.website.util.redis.RedisUtil; |
@@ -269,21 +270,22 @@ public class GoodsRPCImpl implements GoodsRPC { | @@ -269,21 +270,22 @@ public class GoodsRPCImpl implements GoodsRPC { | ||
269 | return output.getData(); | 270 | return output.getData(); |
270 | } | 271 | } |
271 | 272 | ||
272 | - public PageOutput<List<Product>> getProductRecommend(ProductSearchInput input, Long userId) { | 273 | + public PageOutput<List<Product>> getProductRecommend(ProductSearchInput input, Long userId) { |
273 | PageOutput<List<Product>> output = null; | 274 | PageOutput<List<Product>> output = null; |
274 | try { | 275 | try { |
275 | output = titanClient.getProductService().searchListPopProducts(input); | 276 | output = titanClient.getProductService().searchListPopProducts(input); |
276 | - }catch (Exception e){ | ||
277 | - logger.info("获取店铺热门推荐商品接口出错:",e); | 277 | + } catch (Exception e) { |
278 | + logger.info("获取店铺热门推荐商品接口出错:", e); | ||
278 | throw new ServiceException(ResultCode.NETWORK_FAILED); | 279 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
279 | } | 280 | } |
280 | - if (output.getCode()!=200) { | 281 | + if (output.getCode() != 200) { |
281 | logger.error("获取店铺热门推荐商品失败[userId={},code={},result={}]", | 282 | logger.error("获取店铺热门推荐商品失败[userId={},code={},result={}]", |
282 | - new Object[]{ userId,output.getCode(),output.getResult()}); | ||
283 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | 283 | + new Object[]{userId, output.getCode(), output.getResult()}); |
284 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | ||
284 | } | 285 | } |
285 | return output; | 286 | return output; |
286 | } | 287 | } |
288 | + | ||
287 | @Override | 289 | @Override |
288 | public List<Category> listCategory(int parentId, int shopId) { | 290 | public List<Category> listCategory(int parentId, int shopId) { |
289 | try { | 291 | try { |
@@ -312,5 +314,20 @@ public class GoodsRPCImpl implements GoodsRPC { | @@ -312,5 +314,20 @@ public class GoodsRPCImpl implements GoodsRPC { | ||
312 | } | 314 | } |
313 | } | 315 | } |
314 | 316 | ||
317 | + @Override | ||
318 | + public Object updateProduct(UpdateProductInput updateProductInput) { | ||
319 | + BaseOutput<Object> output; | ||
320 | + try { | ||
321 | + output = titanClient.getProductService().updatePop(updateProductInput); | ||
322 | + } catch (Exception e) { | ||
323 | + logger.error("调用修改商品接口失败"); | ||
324 | + throw new ServiceException(); | ||
315 | 325 | ||
326 | + } | ||
327 | + if (output.getCode() != 200) { | ||
328 | + logger.error("调用修改分类接口失败"); | ||
329 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | ||
330 | + } | ||
331 | + return output.getData(); | ||
332 | + } | ||
316 | } | 333 | } |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerGoodsServiceImpl.java
@@ -18,6 +18,7 @@ import com.diligrp.titan.sdk.domain.Sku; | @@ -18,6 +18,7 @@ import com.diligrp.titan.sdk.domain.Sku; | ||
18 | import com.diligrp.titan.sdk.input.CategoryInput; | 18 | import com.diligrp.titan.sdk.input.CategoryInput; |
19 | import com.diligrp.titan.sdk.input.PopProductView; | 19 | import com.diligrp.titan.sdk.input.PopProductView; |
20 | import com.diligrp.titan.sdk.input.ProductSearchInput; | 20 | import com.diligrp.titan.sdk.input.ProductSearchInput; |
21 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | ||
21 | import com.diligrp.website.util.security.Validator; | 22 | import com.diligrp.website.util.security.Validator; |
22 | import com.yqyw.filter.client.KeyWordsClient; | 23 | import com.yqyw.filter.client.KeyWordsClient; |
23 | import org.apache.log4j.Logger; | 24 | import org.apache.log4j.Logger; |
@@ -228,14 +229,18 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { | @@ -228,14 +229,18 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { | ||
228 | 229 | ||
229 | private List<com.diligrp.titan.sdk.domain.Attribute> buildSaleAttr(List<Attribute> saleAtt) { | 230 | private List<com.diligrp.titan.sdk.domain.Attribute> buildSaleAttr(List<Attribute> saleAtt) { |
230 | 231 | ||
231 | - List<com.diligrp.titan.sdk.domain.Attribute> attrs = null; | 232 | + String jsonString = JSONArray.toJSONString(saleAtt); |
232 | 233 | ||
233 | - return attrs; | 234 | + return JSONArray.parseArray(jsonString, com.diligrp.titan.sdk.domain.Attribute.class); |
234 | 235 | ||
235 | } | 236 | } |
236 | 237 | ||
237 | @Override | 238 | @Override |
238 | public UpdateGoodsResp updateGoods(UpdateGoodsReq req) { | 239 | public UpdateGoodsResp updateGoods(UpdateGoodsReq req) { |
240 | + UpdateProductInput input = new UpdateProductInput(); | ||
241 | + | ||
242 | + input.setDesc(req.getGoods().getDesc()); | ||
243 | + goodsRPC.updateProduct(input); | ||
239 | return null; | 244 | return null; |
240 | } | 245 | } |
241 | 246 |