Commit 90ab9ae4e8cffd22b4614476b5a0a0d4fdfa167d
1 parent
68c948f9
修改商品库接口 --m
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 | 16 | import com.diligrp.titan.sdk.input.CategoryInput; |
17 | 17 | import com.diligrp.titan.sdk.input.PopProductView; |
18 | 18 | import com.diligrp.titan.sdk.input.ProductSearchInput; |
19 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | |
19 | 20 | import com.diligrp.titan.sdk.output.PageOutput; |
20 | 21 | |
21 | 22 | import java.util.HashMap; |
... | ... | @@ -131,4 +132,5 @@ public interface GoodsRPC { |
131 | 132 | List<Category> listCategory(int parentId,int shopId); |
132 | 133 | |
133 | 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 | 22 | import com.diligrp.titan.sdk.input.CategoryInput; |
23 | 23 | import com.diligrp.titan.sdk.input.PopProductView; |
24 | 24 | import com.diligrp.titan.sdk.input.ProductSearchInput; |
25 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | |
25 | 26 | import com.diligrp.titan.sdk.output.BaseOutput; |
26 | 27 | import com.diligrp.titan.sdk.output.PageOutput; |
27 | 28 | import com.diligrp.website.util.redis.RedisUtil; |
... | ... | @@ -269,21 +270,22 @@ public class GoodsRPCImpl implements GoodsRPC { |
269 | 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 | 274 | PageOutput<List<Product>> output = null; |
274 | 275 | try { |
275 | 276 | output = titanClient.getProductService().searchListPopProducts(input); |
276 | - }catch (Exception e){ | |
277 | - logger.info("获取店铺热门推荐商品接口出错:",e); | |
277 | + } catch (Exception e) { | |
278 | + logger.info("获取店铺热门推荐商品接口出错:", e); | |
278 | 279 | throw new ServiceException(ResultCode.NETWORK_FAILED); |
279 | 280 | } |
280 | - if (output.getCode()!=200) { | |
281 | + if (output.getCode() != 200) { | |
281 | 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 | 286 | return output; |
286 | 287 | } |
288 | + | |
287 | 289 | @Override |
288 | 290 | public List<Category> listCategory(int parentId, int shopId) { |
289 | 291 | try { |
... | ... | @@ -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 | 18 | import com.diligrp.titan.sdk.input.CategoryInput; |
19 | 19 | import com.diligrp.titan.sdk.input.PopProductView; |
20 | 20 | import com.diligrp.titan.sdk.input.ProductSearchInput; |
21 | +import com.diligrp.titan.sdk.input.UpdateProductInput; | |
21 | 22 | import com.diligrp.website.util.security.Validator; |
22 | 23 | import com.yqyw.filter.client.KeyWordsClient; |
23 | 24 | import org.apache.log4j.Logger; |
... | ... | @@ -228,14 +229,18 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
228 | 229 | |
229 | 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 | 238 | @Override |
238 | 239 | public UpdateGoodsResp updateGoods(UpdateGoodsReq req) { |
240 | + UpdateProductInput input = new UpdateProductInput(); | |
241 | + | |
242 | + input.setDesc(req.getGoods().getDesc()); | |
243 | + goodsRPC.updateProduct(input); | |
239 | 244 | return null; |
240 | 245 | } |
241 | 246 | ... | ... |