Commit 9860d6c4e7cc17d44cd2fc11cd4efe50414c3f54
1 parent
1bc16ae4
修改商品库接口
Showing
10 changed files
with
429 additions
and
190 deletions
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/ListCategoryReq.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
4 | + | |
5 | +/** | |
6 | + * Created by yanggang on 2017/1/17. | |
7 | + */ | |
8 | +public class ListCategoryReq extends BaseReq { | |
9 | + | |
10 | + private int parentId; | |
11 | + private int shopId; | |
12 | + | |
13 | + public int getParentId() { | |
14 | + return parentId; | |
15 | + } | |
16 | + | |
17 | + public void setParentId(int parentId) { | |
18 | + this.parentId = parentId; | |
19 | + } | |
20 | + | |
21 | + public int getShopId() { | |
22 | + return shopId; | |
23 | + } | |
24 | + | |
25 | + public void setShopId(int shopId) { | |
26 | + this.shopId = shopId; | |
27 | + } | |
28 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/ListCategoryResp.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseResp; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.Category; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * Created by yanggang on 2017/1/17. | |
10 | + */ | |
11 | +public class ListCategoryResp extends BaseResp { | |
12 | + | |
13 | + private List<Category> categories; | |
14 | + | |
15 | + public List<Category> getCategories() { | |
16 | + return categories; | |
17 | + } | |
18 | + | |
19 | + public void setCategories(List<Category> categories) { | |
20 | + this.categories = categories; | |
21 | + } | |
22 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/SearchProductReq.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
4 | + | |
5 | +/** | |
6 | + * Created by yanggang on 2017/1/17. | |
7 | + */ | |
8 | +public class SearchProductReq extends BaseReq { | |
9 | + | |
10 | + private Integer page; | |
11 | + private Integer pageSize; | |
12 | + private Integer cateId; | |
13 | + private Integer status; | |
14 | + private String name; | |
15 | + | |
16 | + public Integer getPage() { | |
17 | + return page; | |
18 | + } | |
19 | + | |
20 | + public void setPage(Integer page) { | |
21 | + this.page = page; | |
22 | + } | |
23 | + | |
24 | + public Integer getPageSize() { | |
25 | + return pageSize; | |
26 | + } | |
27 | + | |
28 | + public void setPageSize(Integer pageSize) { | |
29 | + this.pageSize = pageSize; | |
30 | + } | |
31 | + | |
32 | + public Integer getCateId() { | |
33 | + return cateId; | |
34 | + } | |
35 | + | |
36 | + public void setCateId(Integer cateId) { | |
37 | + this.cateId = cateId; | |
38 | + } | |
39 | + | |
40 | + public Integer getStatus() { | |
41 | + return status; | |
42 | + } | |
43 | + | |
44 | + public void setStatus(Integer status) { | |
45 | + this.status = status; | |
46 | + } | |
47 | + | |
48 | + public String getName() { | |
49 | + return name; | |
50 | + } | |
51 | + | |
52 | + public void setName(String name) { | |
53 | + this.name = name; | |
54 | + } | |
55 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/product/SearchProductResp.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.product; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseResp; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.Goods; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * Created by yanggang on 2017/1/17. | |
10 | + */ | |
11 | +public class SearchProductResp extends BaseResp { | |
12 | + | |
13 | + private List<Goods> productList; | |
14 | + | |
15 | + public List<Goods> getProductList() { | |
16 | + return productList; | |
17 | + } | |
18 | + | |
19 | + public void setProductList(List<Goods> productList) { | |
20 | + this.productList = productList; | |
21 | + } | |
22 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/GoodsRPC.java
... | ... | @@ -15,8 +15,6 @@ import com.diligrp.titan.sdk.domain.Category; |
15 | 15 | 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 | -import com.diligrp.titan.sdk.input.ProductSearchInput; | |
19 | -import com.diligrp.titan.sdk.output.PageOutput; | |
20 | 18 | |
21 | 19 | import java.util.HashMap; |
22 | 20 | import java.util.List; |
... | ... | @@ -43,7 +41,7 @@ public interface GoodsRPC { |
43 | 41 | * @Title: getGoodsById |
44 | 42 | * @Description: 根据id获取商品详情 |
45 | 43 | */ |
46 | - public Product getGoodsById(Long id, String[] defindResult); | |
44 | + Product getGoodsById(Long id, String[] defindResult); | |
47 | 45 | |
48 | 46 | /** |
49 | 47 | * @param categoryId |
... | ... | @@ -53,7 +51,7 @@ public interface GoodsRPC { |
53 | 51 | * @createTime 2014年8月19日 下午2:55:50 |
54 | 52 | * @author zhangshirui |
55 | 53 | */ |
56 | - public HashMap<String, List<Attribute>> getConditionByCid(Integer categoryId); | |
54 | + HashMap<String, List<Attribute>> getConditionByCid(Integer categoryId); | |
57 | 55 | |
58 | 56 | /** |
59 | 57 | * 更具商品id获取商品 |
... | ... | @@ -127,4 +125,8 @@ public interface GoodsRPC { |
127 | 125 | Object addGoods(PopProductView req, Long userId); |
128 | 126 | |
129 | 127 | PageOutput<List<Product>> getProductRecommend(ProductSearchInput input , Long userId); |
128 | + | |
129 | + List<Category> listCategory(int parentId,int shopId); | |
130 | + | |
131 | + List<Product> searchProduct(ProductSearchInput input); | |
130 | 132 | } | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/GoodsRPCImpl.java
1 | -/** | |
2 | - * @Title: GoodsRPCImpl.java | |
1 | +/** | |
2 | + * @Title: GoodsRPCImpl.java | |
3 | 3 | * @Package:com.diligrp.mobsite.getway.rpc.impl |
4 | - * @Copyright:地利集团 | |
5 | - * @Description: | |
6 | - * @author:zhangshirui | |
7 | - * @date: 2014年8月14日 上午11:21:21 | |
8 | - * @version: V1.0 | |
9 | - */ | |
4 | + * @Copyright:地利集团 | |
5 | + * @Description: | |
6 | + * @author:zhangshirui | |
7 | + * @date: 2014年8月14日 上午11:21:21 | |
8 | + * @version: V1.0 | |
9 | + */ | |
10 | 10 | package com.diligrp.mobsite.getway.rpc.impl; |
11 | 11 | |
12 | 12 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
... | ... | @@ -36,53 +36,53 @@ import java.util.HashMap; |
36 | 36 | import java.util.List; |
37 | 37 | import java.util.Map; |
38 | 38 | |
39 | -/** | |
40 | - * @ClassName: GoodsRPCImpl | |
39 | +/** | |
40 | + * @author zhangshirui | |
41 | + * @ClassName: GoodsRPCImpl | |
41 | 42 | * @Description: 商品信息接口 |
42 | - * @author zhangshirui | |
43 | - * @date 2014年8月14日 上午11:21:21 | |
43 | + * @date 2014年8月14日 上午11:21:21 | |
44 | 44 | */ |
45 | 45 | @Service("goodsRPC") |
46 | 46 | public class GoodsRPCImpl implements GoodsRPC { |
47 | 47 | |
48 | - @Resource | |
49 | - private TitanClient titanClient; | |
50 | - @Resource | |
51 | - private RedisUtil redisUtil; | |
52 | - | |
53 | - private static final Logger logger = LoggerFactory.getLogger(GoodsRPCImpl.class); | |
54 | - | |
55 | - @Override | |
56 | - public Product getGoodsById(Long id, String[] defindResult) { | |
57 | - | |
58 | - List<Long> idList = new ArrayList<Long>(); | |
59 | - idList.add(id); | |
48 | + @Resource | |
49 | + private TitanClient titanClient; | |
50 | + @Resource | |
51 | + private RedisUtil redisUtil; | |
52 | + | |
53 | + private static final Logger logger = LoggerFactory.getLogger(GoodsRPCImpl.class); | |
54 | + | |
55 | + @Override | |
56 | + public Product getGoodsById(Long id, String[] defindResult) { | |
57 | + | |
58 | + List<Long> idList = new ArrayList<Long>(); | |
59 | + idList.add(id); | |
60 | 60 | List<Product> productList = getProductByIds(idList, defindResult); |
61 | 61 | Product product = null; |
62 | - if(!Validator.isEmpty(productList)){ | |
63 | - product = productList.get(0); | |
64 | - } | |
65 | - return product; | |
66 | - } | |
67 | - | |
68 | - @Override | |
69 | - public HashMap<String,List<Attribute>> getConditionByCid(Integer categoryId) { | |
70 | - BaseOutput<HashMap<String, List<Attribute>>> attributeBo = null; | |
71 | - try { | |
72 | - attributeBo = titanClient.getCategoryService().listAttributes(categoryId); | |
62 | + if (!Validator.isEmpty(productList)) { | |
63 | + product = productList.get(0); | |
64 | + } | |
65 | + return product; | |
66 | + } | |
67 | + | |
68 | + @Override | |
69 | + public HashMap<String, List<Attribute>> getConditionByCid(Integer categoryId) { | |
70 | + BaseOutput<HashMap<String, List<Attribute>>> attributeBo = null; | |
71 | + try { | |
72 | + attributeBo = titanClient.getCategoryService().listAttributes(categoryId); | |
73 | 73 | } catch (Exception e) { |
74 | - logger.error("titanClient接口挂掉:根据分类id查询商品筛选条件",e); | |
74 | + logger.error("titanClient接口挂掉:根据分类id查询商品筛选条件", e); | |
75 | 75 | throw new ServiceException(); |
76 | 76 | } |
77 | - if(attributeBo.getCode() != ResultCode.SUCCESS){ | |
78 | - logger.error(String.format("商品筛选条件失败.[categoryId=%s,code=%s, message=%s]", | |
79 | - categoryId, attributeBo.getCode(), attributeBo.getResult())); | |
80 | - throw new ServiceException(); | |
81 | - } | |
82 | - if(logger.isInfoEnabled()){ | |
77 | + if (attributeBo.getCode() != ResultCode.SUCCESS) { | |
78 | + logger.error(String.format("商品筛选条件失败.[categoryId=%s,code=%s, message=%s]", | |
79 | + categoryId, attributeBo.getCode(), attributeBo.getResult())); | |
80 | + throw new ServiceException(); | |
81 | + } | |
82 | + if (logger.isInfoEnabled()) { | |
83 | 83 | logger.info(String.format("商品筛选条件.[size=%s]", attributeBo.getData().size())); |
84 | 84 | } |
85 | - return attributeBo.getData(); | |
85 | + return attributeBo.getData(); | |
86 | 86 | } |
87 | 87 | |
88 | 88 | |
... | ... | @@ -90,91 +90,90 @@ public class GoodsRPCImpl implements GoodsRPC { |
90 | 90 | public List<Product> getProductByIds(List<Long> productId, String[] defindResult) { |
91 | 91 | BaseOutput<List<Product>> output = null; |
92 | 92 | try { |
93 | - // output = titanClient.getProductService().getProductInfo(productId, defindResult); | |
93 | + // output = titanClient.getProductService().getProductInfo(productId, defindResult); | |
94 | 94 | } catch (Exception e) { |
95 | - logger.error("titanClient接口挂掉:搜索商品详情",e); | |
95 | + logger.error("titanClient接口挂掉:搜索商品详情", e); | |
96 | 96 | throw new RuntimeException(ErrorMessage.NETWORK_ERROR); |
97 | 97 | } |
98 | - if(output.getCode() != ResultCode.SUCCESS){ | |
99 | - logger.error(String.format("搜索商品详情失败.[productId=%s,code=%s, message=%s]", | |
100 | - productId.toString(),output.getCode(), output.getResult())); | |
98 | + if (output.getCode() != ResultCode.SUCCESS) { | |
99 | + logger.error(String.format("搜索商品详情失败.[productId=%s,code=%s, message=%s]", | |
100 | + productId.toString(), output.getCode(), output.getResult())); | |
101 | 101 | throw new ServiceException(ErrorMessage.PRODUCT_STATE_DOWNORDEL); |
102 | 102 | } |
103 | 103 | return output.getData(); |
104 | 104 | } |
105 | - | |
105 | + | |
106 | 106 | @Override |
107 | - public List<GoodsSuper> getGoodsInfoByIds(List<Long> productIds){ | |
108 | - List<Product> products = getProductByIds(productIds, new String[]{}); | |
109 | - if (Validator.isEmpty(products)) { | |
110 | - return null; | |
111 | - } | |
112 | - | |
113 | - List<GoodsSuper> goodsInfos = new ArrayList<GoodsSuper>(); | |
114 | - GoodsSuper goodsInfo = null; | |
115 | - for (Product product : products) { | |
116 | - //goodsInfo = new GoodsSuper(); | |
117 | - //goodsInfo.setId(product.getPid()); | |
118 | - //goodsInfo.setTitle(product.getName()); | |
119 | - //goodsInfo.setDefaultPic(product.getDefaultPic()); | |
120 | - //goodsInfo.setPrice((long)product.getMinPrice()); | |
121 | - //goodsInfo.setUnit(product.getSaleUnit()); | |
122 | - //goodsInfos.add(goodsInfo); | |
123 | - } | |
124 | - | |
125 | - return goodsInfos; | |
107 | + public List<GoodsSuper> getGoodsInfoByIds(List<Long> productIds) { | |
108 | + List<Product> products = getProductByIds(productIds, new String[]{}); | |
109 | + if (Validator.isEmpty(products)) { | |
110 | + return null; | |
111 | + } | |
112 | + | |
113 | + List<GoodsSuper> goodsInfos = new ArrayList<GoodsSuper>(); | |
114 | + GoodsSuper goodsInfo = null; | |
115 | + for (Product product : products) { | |
116 | + //goodsInfo = new GoodsSuper(); | |
117 | + //goodsInfo.setId(product.getPid()); | |
118 | + //goodsInfo.setTitle(product.getName()); | |
119 | + //goodsInfo.setDefaultPic(product.getDefaultPic()); | |
120 | + //goodsInfo.setPrice((long)product.getMinPrice()); | |
121 | + //goodsInfo.setUnit(product.getSaleUnit()); | |
122 | + //goodsInfos.add(goodsInfo); | |
123 | + } | |
124 | + | |
125 | + return goodsInfos; | |
126 | 126 | } |
127 | 127 | |
128 | 128 | |
129 | - | |
130 | 129 | @Override |
131 | - public Map<String, Product> getSkuInfoMap(List<String> skuList){ | |
132 | - BaseOutput<Map<String,Product>> output = null; | |
130 | + public Map<String, Product> getSkuInfoMap(List<String> skuList) { | |
131 | + BaseOutput<Map<String, Product>> output = null; | |
133 | 132 | try { |
134 | 133 | output = titanClient.getProductService().getSkuInfoMap(skuList); |
135 | 134 | } catch (Exception e) { |
136 | 135 | throw new RuntimeException(String.format("sku接口失败:获取商品sku信息失败.[code=%s, result=%s]", |
137 | - output.getCode(),output.getResult())); | |
136 | + output.getCode(), output.getResult())); | |
138 | 137 | } |
139 | - if(output.getCode() != ResultCode.SUCCESS){ | |
140 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
138 | + if (output.getCode() != ResultCode.SUCCESS) { | |
139 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
141 | 140 | } |
142 | 141 | if (logger.isInfoEnabled()) { |
143 | 142 | logger.info(String.format("查询sku信息成功:[skus=%s]", skuList.toString())); |
144 | 143 | } |
145 | 144 | return output.getData(); |
146 | 145 | } |
147 | - | |
146 | + | |
148 | 147 | @Override |
149 | - public String getProductDesc(Long productId){ | |
150 | - BaseOutput<String> output = null; | |
148 | + public String getProductDesc(Long productId) { | |
149 | + BaseOutput<String> output = null; | |
151 | 150 | try { |
152 | - // output = titanClient.getProductService().getProductDesc(productId); | |
151 | + // output = titanClient.getProductService().getProductDesc(productId); | |
153 | 152 | } catch (Exception e) { |
154 | - logger.error("商品库接口超时",e); | |
153 | + logger.error("商品库接口超时", e); | |
155 | 154 | } |
156 | - if(output.getCode() != ResultCode.SUCCESS){ | |
157 | - logger.error("查询商品描述信息失败[productId={},result={}]",productId,output.getResult()); | |
155 | + if (output.getCode() != ResultCode.SUCCESS) { | |
156 | + logger.error("查询商品描述信息失败[productId={},result={}]", productId, output.getResult()); | |
158 | 157 | } |
159 | 158 | logger.info("查询商品描述信息:[productId={}]", productId); |
160 | 159 | return output.getData(); |
161 | 160 | } |
162 | - | |
161 | + | |
163 | 162 | @Override |
164 | - public Category getCategoryById(Long cid){ | |
165 | - String redisKey = redisUtil.makeKey(RedisKey.PRODUCT_CATEGORY, String.valueOf(cid)); | |
166 | - Category category = redisUtil.getObject(redisKey, Category.class); | |
167 | - if (!Validator.isNull(category)) { | |
168 | - return category; | |
169 | - } | |
163 | + public Category getCategoryById(Long cid) { | |
164 | + String redisKey = redisUtil.makeKey(RedisKey.PRODUCT_CATEGORY, String.valueOf(cid)); | |
165 | + Category category = redisUtil.getObject(redisKey, Category.class); | |
166 | + if (!Validator.isNull(category)) { | |
167 | + return category; | |
168 | + } | |
170 | 169 | try { |
171 | - BaseOutput<Category> output = titanClient.getCategoryService().getCategoryInfo(cid.intValue()); | |
172 | - if(output.getCode() != ResultCode.SUCCESS){ | |
173 | - logger.error("查询分类信息失败[cid={},result={}]",cid,output.getResult()); | |
174 | - } | |
175 | - category = output.getData(); | |
170 | + BaseOutput<Category> output = titanClient.getCategoryService().getCategoryInfo(cid.intValue()); | |
171 | + if (output.getCode() != ResultCode.SUCCESS) { | |
172 | + logger.error("查询分类信息失败[cid={},result={}]", cid, output.getResult()); | |
173 | + } | |
174 | + category = output.getData(); | |
176 | 175 | } catch (Exception e) { |
177 | - logger.error("商品库接口超时",e); | |
176 | + logger.error("商品库接口超时", e); | |
178 | 177 | } |
179 | 178 | logger.info("查询分类信息:[cid={}]", cid); |
180 | 179 | redisUtil.setObjectByExpire(redisKey, category, RedisKey.PRODUCT_EXPIRE_TIME); |
... | ... | @@ -186,32 +185,32 @@ public class GoodsRPCImpl implements GoodsRPC { |
186 | 185 | List<Category> categories = null; |
187 | 186 | BaseOutput<List<Category>> output = null; |
188 | 187 | try { |
189 | - // BaseOutput<List<Category>> output = titanClient.getCategoryService().listCrumbs(cid.intValue()); | |
190 | - if(output.getCode() != ResultCode.SUCCESS){ | |
191 | - logger.error("查询类目面包屑失败[cid={},result={}]",cid,output.getResult()); | |
188 | + // BaseOutput<List<Category>> output = titanClient.getCategoryService().listCrumbs(cid.intValue()); | |
189 | + if (output.getCode() != ResultCode.SUCCESS) { | |
190 | + logger.error("查询类目面包屑失败[cid={},result={}]", cid, output.getResult()); | |
192 | 191 | } |
193 | 192 | categories = output.getData(); |
194 | 193 | } catch (Exception e) { |
195 | - logger.error("商品库接口超时",e); | |
194 | + logger.error("商品库接口超时", e); | |
196 | 195 | } |
197 | 196 | logger.info("查询类目面包屑:[cid={}]", cid); |
198 | 197 | return categories; |
199 | 198 | } |
200 | 199 | |
201 | 200 | @Override |
202 | - public Object addProductCategory(CategoryInput input,Long userId) { | |
201 | + public Object addProductCategory(CategoryInput input, Long userId) { | |
203 | 202 | BaseOutput<Object> output = null; |
204 | 203 | try { |
205 | 204 | output = titanClient.getCategoryService().insertCategory(input); |
206 | 205 | } catch (Exception e) { |
207 | - logger.error("调用添加分类接口失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
206 | + logger.error("调用添加分类接口失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
208 | 207 | throw new ServiceException(); |
209 | 208 | |
210 | 209 | } |
211 | - if (output.getCode()!=200) { | |
210 | + if (output.getCode() != 200) { | |
212 | 211 | logger.error("调用添加分类接口失败[userId={},code={},result={}]", |
213 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
214 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
212 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
213 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
215 | 214 | } |
216 | 215 | return output.getData(); |
217 | 216 | } |
... | ... | @@ -222,32 +221,32 @@ public class GoodsRPCImpl implements GoodsRPC { |
222 | 221 | try { |
223 | 222 | output = titanClient.getCategoryService().updateCategory(input); |
224 | 223 | } catch (Exception e) { |
225 | - logger.error("调用修改分类接口失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
224 | + logger.error("调用修改分类接口失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
226 | 225 | throw new ServiceException(); |
227 | 226 | |
228 | 227 | } |
229 | - if (output.getCode()!=200) { | |
228 | + if (output.getCode() != 200) { | |
230 | 229 | logger.error("调用修改分类接口失败[userId={},code={},result={}]", |
231 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
232 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
230 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
231 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
233 | 232 | } |
234 | 233 | return output.getData(); |
235 | 234 | } |
236 | 235 | |
237 | 236 | @Override |
238 | 237 | public List<Category> searchProductCategory(String input, Long userId) { |
239 | - BaseOutput<List<Category>> output = null; | |
238 | + BaseOutput<List<Category>> output = null; | |
240 | 239 | try { |
241 | 240 | output = titanClient.getCategoryService().searchCategoryInfo(input); |
242 | 241 | } catch (Exception e) { |
243 | - logger.error("搜索分类接口失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
242 | + logger.error("搜索分类接口失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
244 | 243 | throw new ServiceException(); |
245 | 244 | |
246 | 245 | } |
247 | - if (output.getCode()!=200) { | |
246 | + if (output.getCode() != 200) { | |
248 | 247 | logger.error("搜索分类接口失败[userId={},code={},result={}]", |
249 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
250 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
248 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
249 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
251 | 250 | } |
252 | 251 | return output.getData(); |
253 | 252 | } |
... | ... | @@ -256,16 +255,16 @@ public class GoodsRPCImpl implements GoodsRPC { |
256 | 255 | public Object addGoods(PopProductView input, Long userId) { |
257 | 256 | BaseOutput<Object> output = null; |
258 | 257 | try { |
259 | - output = titanClient.getProductService().insertPopProduct(input,userId+""); | |
258 | + output = titanClient.getProductService().insertPopProduct(input, userId + ""); | |
260 | 259 | } catch (Exception e) { |
261 | - logger.error("添加商品失败:[userId={},code={},result={}]",new Object[]{userId,output.getCode(),output.getResult()}); | |
260 | + logger.error("添加商品失败:[userId={},code={},result={}]", new Object[]{userId, output.getCode(), output.getResult()}); | |
262 | 261 | throw new ServiceException(); |
263 | 262 | |
264 | 263 | } |
265 | - if (output.getCode()!=200) { | |
264 | + if (output.getCode() != 200) { | |
266 | 265 | logger.error("添加商品失败[userId={},code={},result={}]", |
267 | - new Object[]{ userId,output.getCode(),output.getResult()}); | |
268 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,output.getResult()); | |
266 | + new Object[]{userId, output.getCode(), output.getResult()}); | |
267 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
269 | 268 | } |
270 | 269 | return output.getData(); |
271 | 270 | } |
... | ... | @@ -285,4 +284,33 @@ public class GoodsRPCImpl implements GoodsRPC { |
285 | 284 | } |
286 | 285 | return output; |
287 | 286 | } |
287 | + @Override | |
288 | + public List<Category> listCategory(int parentId, int shopId) { | |
289 | + try { | |
290 | + BaseOutput<List<Category>> output = titanClient.getCategoryService().listChildren(parentId, shopId); | |
291 | + if (output.getCode() != 200) { | |
292 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
293 | + } | |
294 | + return output.getData(); | |
295 | + } catch (Exception e) { | |
296 | + logger.error("获取商品分类失败:[parentId={},shopId={}]", new Object[]{parentId, shopId}); | |
297 | + throw new ServiceException(); | |
298 | + } | |
299 | + } | |
300 | + | |
301 | + @Override | |
302 | + public List<Product> searchProduct(ProductSearchInput input) { | |
303 | + try { | |
304 | + PageOutput<List<Product>> output = titanClient.getProductService().searchListPopProducts(input); | |
305 | + if (output.getCode() != 200) { | |
306 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, output.getResult()); | |
307 | + } | |
308 | + return output.getData(); | |
309 | + } catch (Exception e) { | |
310 | + logger.error("搜搜商品失败", e); | |
311 | + throw new ServiceException(); | |
312 | + } | |
313 | + } | |
314 | + | |
315 | + | |
288 | 316 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/SellerGoodsService.java
... | ... | @@ -29,7 +29,7 @@ public interface SellerGoodsService { |
29 | 29 | * @return |
30 | 30 | * @createTime 2014年8月18日 下午4:11:27 |
31 | 31 | */ |
32 | - public GetProductsResp searchProductsByStatus(GetProductsReq req); | |
32 | + GetProductsResp searchProductsByStatus(GetProductsReq req); | |
33 | 33 | |
34 | 34 | /** |
35 | 35 | *根据商品id查询商品详情 |
... | ... | @@ -37,7 +37,7 @@ public interface SellerGoodsService { |
37 | 37 | * @return |
38 | 38 | * @createTime 2014年8月18日 下午4:11:27 |
39 | 39 | */ |
40 | - public GetSellerProductDetailResp getSellerProductDetail(GetProductDetailReq req); | |
40 | + GetSellerProductDetailResp getSellerProductDetail(GetProductDetailReq req); | |
41 | 41 | |
42 | 42 | /** |
43 | 43 | *更新商品区间价格 |
... | ... | @@ -45,7 +45,7 @@ public interface SellerGoodsService { |
45 | 45 | * @return |
46 | 46 | * @createTime 2014年8月18日 下午4:11:27 |
47 | 47 | */ |
48 | - public SellerProductCommonResp updateSellerProductRangePrice(UpdateRangePriceReq rangePriceReq); | |
48 | + SellerProductCommonResp updateSellerProductRangePrice(UpdateRangePriceReq rangePriceReq); | |
49 | 49 | |
50 | 50 | /** |
51 | 51 | *更新商品sku价格 |
... | ... | @@ -53,7 +53,7 @@ public interface SellerGoodsService { |
53 | 53 | * @return |
54 | 54 | * @createTime 2014年8月18日 下午4:11:27 |
55 | 55 | */ |
56 | - public SellerProductCommonResp updateSellerProductSkuPrice(UpdateSkuPriceReq skuPriceReq); | |
56 | + SellerProductCommonResp updateSellerProductSkuPrice(UpdateSkuPriceReq skuPriceReq); | |
57 | 57 | |
58 | 58 | /** |
59 | 59 | *更新商品库存 |
... | ... | @@ -61,7 +61,7 @@ public interface SellerGoodsService { |
61 | 61 | * @return |
62 | 62 | * @createTime 2014年8月18日 下午4:11:27 |
63 | 63 | */ |
64 | - public SellerProductCommonResp updateSellerProductStock(UpdateSellerProductStockReq stockReq); | |
64 | + SellerProductCommonResp updateSellerProductStock(UpdateSellerProductStockReq stockReq); | |
65 | 65 | |
66 | 66 | /** |
67 | 67 | *批量更新商品状态 |
... | ... | @@ -69,7 +69,7 @@ public interface SellerGoodsService { |
69 | 69 | * @return |
70 | 70 | * @createTime 2014年8月18日 下午4:11:27 |
71 | 71 | */ |
72 | - public SellerProductCommonResp batchUpdateSellerProductStatus(BatchUpdateProductStatusReq batchReq); | |
72 | + SellerProductCommonResp batchUpdateSellerProductStatus(BatchUpdateProductStatusReq batchReq); | |
73 | 73 | |
74 | 74 | /** |
75 | 75 | *批量删除商品 |
... | ... | @@ -77,7 +77,7 @@ public interface SellerGoodsService { |
77 | 77 | * @return |
78 | 78 | * @createTime 2014年8月18日 下午4:11:27 |
79 | 79 | */ |
80 | - public SellerProductCommonResp batchDeleteProduct(List<Long> pids, Long sellerId); | |
80 | + SellerProductCommonResp batchDeleteProduct(List<Long> pids, Long sellerId); | |
81 | 81 | |
82 | 82 | /** |
83 | 83 | *卖家发布商品 |
... | ... | @@ -85,7 +85,7 @@ public interface SellerGoodsService { |
85 | 85 | * @return |
86 | 86 | * @createTime 2014年8月18日 下午4:11:27 |
87 | 87 | */ |
88 | - public SellerProductCommonResp insertPopProduct(SellerPublishProductReq req); | |
88 | + SellerProductCommonResp insertPopProduct(SellerPublishProductReq req); | |
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
... | ... | @@ -94,7 +94,7 @@ public interface SellerGoodsService { |
94 | 94 | * @return |
95 | 95 | * @createTime 2014年8月18日 下午4:11:27 |
96 | 96 | */ |
97 | - public SellerProductCommonResp updatePopProduct(SellerUpdateProductReq req); | |
97 | + SellerProductCommonResp updatePopProduct(SellerUpdateProductReq req); | |
98 | 98 | |
99 | 99 | /** |
100 | 100 | *根据分类id获取商品属性 |
... | ... | @@ -102,7 +102,7 @@ public interface SellerGoodsService { |
102 | 102 | * @return |
103 | 103 | * @createTime 2014年8月18日 下午4:11:27 |
104 | 104 | */ |
105 | - public GetProductAttrResp listAttributes(Integer cid); | |
105 | + GetProductAttrResp listAttributes(Integer cid); | |
106 | 106 | |
107 | 107 | /** |
108 | 108 | *设置商品描述信息 |
... | ... | @@ -124,7 +124,7 @@ public interface SellerGoodsService { |
124 | 124 | * @return |
125 | 125 | * @createTime 2014年8月18日 下午4:11:27 |
126 | 126 | */ |
127 | - public GetProductAttrResp getProductAttrHasSelected(Integer cid, Long pid); | |
127 | + GetProductAttrResp getProductAttrHasSelected(Integer cid, Long pid); | |
128 | 128 | |
129 | 129 | AddProductCategoryResp addProductCategory(AddProductCategoryReq req); |
130 | 130 | |
... | ... | @@ -139,4 +139,10 @@ public interface SellerGoodsService { |
139 | 139 | GetGoodsResp getGoods(GetGoodsReq req); |
140 | 140 | |
141 | 141 | HandleGoodsResp handleGoods(HandleGoodsReq req); |
142 | + | |
143 | + ListCategoryResp listCategory(ListCategoryReq req); | |
144 | + | |
145 | + SearchProductResp searchProduct(SearchProductReq req); | |
146 | + | |
147 | + | |
142 | 148 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerGoodsServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.seller.impl; |
2 | 2 | |
3 | +import com.alibaba.fastjson.JSONArray; | |
3 | 4 | import com.diligrp.mobsite.getway.domain.protocol.Attribute; |
5 | +import com.diligrp.mobsite.getway.domain.protocol.Goods; | |
4 | 6 | import com.diligrp.mobsite.getway.domain.protocol.GoodsSuper; |
5 | 7 | import com.diligrp.mobsite.getway.domain.protocol.SKUInfo; |
6 | 8 | import com.diligrp.mobsite.getway.domain.protocol.product.*; |
... | ... | @@ -11,9 +13,11 @@ import com.diligrp.mobsite.getway.rpc.GoodsRPC; |
11 | 13 | import com.diligrp.mobsite.getway.rpc.UserRPC; |
12 | 14 | import com.diligrp.mobsite.getway.service.seller.SellerGoodsService; |
13 | 15 | import com.diligrp.titan.sdk.domain.Category; |
16 | +import com.diligrp.titan.sdk.domain.Product; | |
14 | 17 | import com.diligrp.titan.sdk.domain.Sku; |
15 | 18 | import com.diligrp.titan.sdk.input.CategoryInput; |
16 | 19 | import com.diligrp.titan.sdk.input.PopProductView; |
20 | +import com.diligrp.titan.sdk.input.ProductSearchInput; | |
17 | 21 | import com.diligrp.website.util.security.Validator; |
18 | 22 | import com.yqyw.filter.client.KeyWordsClient; |
19 | 23 | import org.apache.log4j.Logger; |
... | ... | @@ -25,10 +29,9 @@ import java.util.ArrayList; |
25 | 29 | import java.util.List; |
26 | 30 | |
27 | 31 | /** |
28 | - * | |
29 | - * @ClassName: GoodsServiceImpl | |
30 | - * @Description: 商品服务层 | |
31 | 32 | * @author duanyugen |
33 | + * @ClassName: GoodsServiceImpl | |
34 | + * @Description: 商品服务层 | |
32 | 35 | * @date 2014年8月14日 上午10:34:22 |
33 | 36 | */ |
34 | 37 | @Service("sellerGoodsService") |
... | ... | @@ -42,10 +45,10 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
42 | 45 | @Resource |
43 | 46 | private GoodsRPC goodsRPC; |
44 | 47 | |
45 | - @Resource | |
46 | - private KeyWordsClient keyWordsClient; | |
48 | + @Resource | |
49 | + private KeyWordsClient keyWordsClient; | |
47 | 50 | |
48 | - private static Logger log = Logger.getLogger(SellerGoodsServiceImpl.class); | |
51 | + private static Logger log = Logger.getLogger(SellerGoodsServiceImpl.class); | |
49 | 52 | |
50 | 53 | |
51 | 54 | @Override |
... | ... | @@ -120,7 +123,7 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
120 | 123 | input.setName(req.getCategory().getName()); |
121 | 124 | input.setShopId(req.getShopId()); |
122 | 125 | input.setParent(req.getCategory().getParentId().intValue()); |
123 | - goodsRPC.addProductCategory(input,req.getUserId()); | |
126 | + goodsRPC.addProductCategory(input, req.getUserId()); | |
124 | 127 | return resp; |
125 | 128 | } |
126 | 129 | |
... | ... | @@ -132,28 +135,28 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
132 | 135 | input.setName(req.getCategory().getName()); |
133 | 136 | input.setShopId(req.getShopId()); |
134 | 137 | input.setParent(req.getCategory().getParentId().intValue()); |
135 | - goodsRPC.updateProductCategory(input,req.getUserId()); | |
138 | + goodsRPC.updateProductCategory(input, req.getUserId()); | |
136 | 139 | return resp; |
137 | 140 | } |
138 | 141 | |
139 | 142 | @Override |
140 | 143 | public SearchProductCategoryResp searchProductCategory(SearchProductCategoryReq req) { |
141 | 144 | SearchProductCategoryResp resp = new SearchProductCategoryResp(); |
142 | - List<Category> categories = goodsRPC.searchProductCategory(req.getKeyword(),req.getUserId()); | |
145 | + List<Category> categories = goodsRPC.searchProductCategory(req.getKeyword(), req.getUserId()); | |
143 | 146 | resp.setCategories(buildCategories(categories)); |
144 | 147 | return resp; |
145 | 148 | } |
146 | 149 | |
147 | 150 | private List<com.diligrp.mobsite.getway.domain.protocol.Category> buildCategories(List<Category> categories) { |
148 | - List<com.diligrp.mobsite.getway.domain.protocol.Category> categoryInfos = null; | |
149 | - if (!Validator.isEmpty(categories)){ | |
151 | + List<com.diligrp.mobsite.getway.domain.protocol.Category> categoryInfos = null; | |
152 | + if (!Validator.isEmpty(categories)) { | |
150 | 153 | categoryInfos = new ArrayList<>(); |
151 | - for(Category category:categories){ | |
154 | + for (Category category : categories) { | |
152 | 155 | com.diligrp.mobsite.getway.domain.protocol.Category categoryInfo = new com.diligrp.mobsite.getway.domain.protocol.Category(); |
153 | - categoryInfo.setId((long)category.getCid()); | |
156 | + categoryInfo.setId((long) category.getCid()); | |
154 | 157 | categoryInfo.setName(category.getCname()); |
155 | 158 | categoryInfo.setImgUrl(category.getIcon()); |
156 | - categoryInfo.setParentId((long)category.getPcid()); | |
159 | + categoryInfo.setParentId((long) category.getPcid()); | |
157 | 160 | categoryInfos.add(categoryInfo); |
158 | 161 | } |
159 | 162 | } |
... | ... | @@ -164,8 +167,8 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
164 | 167 | public AddGoodsResp addGoods(AddGoodsReq req) { |
165 | 168 | AddGoodsResp resp = new AddGoodsResp(); |
166 | 169 | PopProductView input = new PopProductView(); |
167 | - buildAddGoodsInput(req,input); | |
168 | - goodsRPC.addGoods(input ,req.getUserId()); | |
170 | + buildAddGoodsInput(req, input); | |
171 | + goodsRPC.addGoods(input, req.getUserId()); | |
169 | 172 | return resp; |
170 | 173 | } |
171 | 174 | |
... | ... | @@ -174,8 +177,8 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
174 | 177 | input.setName(goods.getName()); |
175 | 178 | input.setIndexTop(goods.getIndexTop()); |
176 | 179 | input.setPid(goods.getPid()); |
177 | - input.setSellerId(req.getUserId()+""); | |
178 | - input.setVendorId(req.getShopId()+""); | |
180 | + input.setSellerId(req.getUserId() + ""); | |
181 | + input.setVendorId(req.getShopId() + ""); | |
179 | 182 | input.setCid(goods.getCid()); |
180 | 183 | input.setCname(goods.getCname()); |
181 | 184 | input.setDefaultPic(goods.getDefaultPic()); |
... | ... | @@ -187,16 +190,34 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
187 | 190 | |
188 | 191 | } |
189 | 192 | |
193 | + private List<Goods> buildGoods(List<Product> productList) { | |
194 | + List<Goods> result = new ArrayList<>(); | |
195 | + for (Product product : productList) { | |
196 | + Goods goods = new Goods(); | |
197 | + goods.setName(product.getName()); | |
198 | + goods.setCid(product.getCid()); | |
199 | + goods.setDefaultPic(product.getDefaultPic()); | |
200 | + goods.setDesc(product.getDesc()); | |
201 | + goods.setPictures(product.getPictures()); | |
202 | + goods.setProductType(product.getProductType()); | |
203 | + String jsonString = JSONArray.toJSONString(product.getSaleAtt()); | |
204 | + goods.setSaleAtt(JSONArray.parseArray(jsonString, Attribute.class)); | |
205 | + | |
206 | + goods.setState(product.getStatus().longValue()); | |
207 | + goods.setSkus(JSONArray.parseArray(JSONArray.toJSONString(product.getSkus()), SKUInfo.class)); | |
208 | + result.add(goods); | |
209 | + } | |
210 | + return result; | |
211 | + } | |
212 | + | |
190 | 213 | private List<Sku> bulidSkus(List<SKUInfo> skusInfo) { |
191 | 214 | List<Sku> skus = null; |
192 | - if (!Validator.isEmpty(skusInfo)){ | |
215 | + if (!Validator.isEmpty(skusInfo)) { | |
193 | 216 | skus = new ArrayList<>(); |
194 | - for (SKUInfo info : skusInfo){ | |
217 | + for (SKUInfo info : skusInfo) { | |
195 | 218 | Sku sku = new Sku(); |
196 | 219 | |
197 | 220 | |
198 | - | |
199 | - | |
200 | 221 | skus.add(sku); |
201 | 222 | } |
202 | 223 | } |
... | ... | @@ -207,7 +228,7 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
207 | 228 | |
208 | 229 | private List<com.diligrp.titan.sdk.domain.Attribute> buildSaleAttr(List<Attribute> saleAtt) { |
209 | 230 | |
210 | - List<com.diligrp.titan.sdk.domain.Attribute> attrs = null; | |
231 | + List<com.diligrp.titan.sdk.domain.Attribute> attrs = null; | |
211 | 232 | |
212 | 233 | return attrs; |
213 | 234 | |
... | ... | @@ -227,4 +248,26 @@ public class SellerGoodsServiceImpl implements SellerGoodsService { |
227 | 248 | public HandleGoodsResp handleGoods(HandleGoodsReq req) { |
228 | 249 | return null; |
229 | 250 | } |
251 | + | |
252 | + @Override | |
253 | + public ListCategoryResp listCategory(ListCategoryReq req) { | |
254 | + return null; | |
255 | + } | |
256 | + | |
257 | + @Override | |
258 | + public SearchProductResp searchProduct(SearchProductReq req) { | |
259 | + ProductSearchInput input = new ProductSearchInput(); | |
260 | + SearchProductResp resp = new SearchProductResp(); | |
261 | + input.setPage(req.getPage()); | |
262 | + input.setPageSize(req.getPageSize()); | |
263 | + input.setCateId(req.getCateId()); | |
264 | + input.setStatus(req.getStatus()); | |
265 | + input.setName(req.getName()); | |
266 | + | |
267 | + List<Product> productList = goodsRPC.searchProduct(input); | |
268 | + | |
269 | + resp.setProductList(buildGoods(productList)); | |
270 | + return resp; | |
271 | + | |
272 | + } | |
230 | 273 | } | ... | ... |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/seller/product/SellerGoodsController.java
... | ... | @@ -20,8 +20,9 @@ import javax.annotation.Resource; |
20 | 20 | * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> |
21 | 21 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
22 | 22 | * <B>Company</B> 地利集团 |
23 | - * @createTime 2014年8月30日 下午2:13:16 | |
23 | + * | |
24 | 24 | * @author duanyugen |
25 | + * @createTime 2014年8月30日 下午2:13:16 | |
25 | 26 | */ |
26 | 27 | @Controller |
27 | 28 | @RequestMapping("/mobsiteApp/seller/goods") |
... | ... | @@ -29,18 +30,63 @@ import javax.annotation.Resource; |
29 | 30 | public class SellerGoodsController extends BaseApiController { |
30 | 31 | |
31 | 32 | @Resource |
32 | - private SellerGoodsService sellerGoodsService; | |
33 | + private SellerGoodsService sellerGoodsService; | |
33 | 34 | |
34 | - private static Logger log = Logger.getLogger(SellerGoodsController.class); | |
35 | + private static Logger log = Logger.getLogger(SellerGoodsController.class); | |
35 | 36 | |
36 | 37 | //商品操作 |
37 | - private static final Integer HANDLEGOODS_OPERATE_ON=1;//上架 | |
38 | - private static final Integer HANDLEGOODS_OPERATE_DOWN=2;//下架 | |
39 | - private static final Integer HANDLEGOODS_OPERATE_SALES=3;//设置促销 | |
40 | - private static final Integer HANDLEGOODS_OPERATE_TOP=4;//首页推荐 | |
41 | - private static final Integer HANDLEGOODS_OPERATE_DEL=5;//删除 | |
38 | + private static final Integer HANDLEGOODS_OPERATE_ON = 1;//上架 | |
39 | + private static final Integer HANDLEGOODS_OPERATE_DOWN = 2;//下架 | |
40 | + private static final Integer HANDLEGOODS_OPERATE_SALES = 3;//设置促销 | |
41 | + private static final Integer HANDLEGOODS_OPERATE_TOP = 4;//首页推荐 | |
42 | + private static final Integer HANDLEGOODS_OPERATE_DEL = 5;//删除 | |
43 | + | |
44 | + /** | |
45 | + * 商品搜搜 | |
46 | + * @param req | |
47 | + */ | |
48 | + @ApiOperation(value = "搜搜商品", httpMethod = "POST", response = SearchProductResp.class) | |
49 | + @RequestMapping(value = "/searchProduct", method = RequestMethod.POST) | |
50 | + @ResponseBody | |
51 | + public void searchProduct(SearchProductReq req) { | |
42 | 52 | |
53 | + try { | |
54 | + SearchProductResp resp = sellerGoodsService.searchProduct(req); | |
55 | + sendSuccessResp(resp); | |
56 | + } catch (ServiceException e) { | |
57 | + log.error(String.format("Code=%s,ErrorMessage=%s", | |
58 | + e.getCode(), e.getMessage()), e); | |
59 | + sendError(e.getCode(), e.getMessage()); | |
60 | + } catch (Exception e) { | |
61 | + log.error(String.format("ErrorMessage=%s", | |
62 | + e.getMessage()), e); | |
63 | + sendError(e.getMessage()); | |
64 | + } | |
65 | + | |
66 | + } | |
43 | 67 | |
68 | + /** | |
69 | + * 获取商品分类 | |
70 | + * | |
71 | + * @param listCategoryReq | |
72 | + */ | |
73 | + @ApiOperation(value = "获取商品分类", httpMethod = "POST", response = ListCategoryResp.class) | |
74 | + @RequestMapping(value = "/listCategory", method = RequestMethod.POST) | |
75 | + @ResponseBody | |
76 | + public void listCategory(@RequestBody ListCategoryReq listCategoryReq) { | |
77 | + try { | |
78 | + ListCategoryResp resp = sellerGoodsService.listCategory(listCategoryReq); | |
79 | + sendSuccessResp(resp); | |
80 | + } catch (ServiceException e) { | |
81 | + log.error(String.format("Code=%s,ErrorMessage=%s", | |
82 | + e.getCode(), e.getMessage()), e); | |
83 | + sendError(e.getCode(), e.getMessage()); | |
84 | + } catch (Exception e) { | |
85 | + log.error(String.format("ErrorMessage=%s", | |
86 | + e.getMessage()), e); | |
87 | + sendError(e.getMessage()); | |
88 | + } | |
89 | + } | |
44 | 90 | |
45 | 91 | /** |
46 | 92 | * 添加商品分类 |
... | ... | @@ -51,8 +97,8 @@ public class SellerGoodsController extends BaseApiController { |
51 | 97 | * @createTime Aug 18, 2014 4:02:38 PM |
52 | 98 | * @author weili |
53 | 99 | */ |
54 | - @ApiOperation(value = "添加商品分类", httpMethod = "POST",response = AddProductCategoryResp.class) | |
55 | - @RequestMapping(value = "/addProductCategory",method = RequestMethod.POST) | |
100 | + @ApiOperation(value = "添加商品分类", httpMethod = "POST", response = AddProductCategoryResp.class) | |
101 | + @RequestMapping(value = "/addProductCategory", method = RequestMethod.POST) | |
56 | 102 | @ResponseBody |
57 | 103 | public void addProductCategory(@RequestBody AddProductCategoryReq temp) { |
58 | 104 | AddProductCategoryReq req = getRequest(AddProductCategoryReq.class); |
... | ... | @@ -79,8 +125,8 @@ public class SellerGoodsController extends BaseApiController { |
79 | 125 | * @createTime Aug 18, 2014 4:02:38 PM |
80 | 126 | * @author weili |
81 | 127 | */ |
82 | - @ApiOperation(value = "修改商品分类", httpMethod = "POST",response = UpdateProductCategoryResp.class) | |
83 | - @RequestMapping(value = "/updateProductCategory",method = RequestMethod.POST) | |
128 | + @ApiOperation(value = "修改商品分类", httpMethod = "POST", response = UpdateProductCategoryResp.class) | |
129 | + @RequestMapping(value = "/updateProductCategory", method = RequestMethod.POST) | |
84 | 130 | @ResponseBody |
85 | 131 | public void updateProductCategory(@RequestBody UpdateProductCategoryReq temp) { |
86 | 132 | UpdateProductCategoryReq req = getRequest(UpdateProductCategoryReq.class); |
... | ... | @@ -107,8 +153,8 @@ public class SellerGoodsController extends BaseApiController { |
107 | 153 | * @createTime Aug 18, 2014 4:02:38 PM |
108 | 154 | * @author weili |
109 | 155 | */ |
110 | - @ApiOperation(value = "搜索商品分类", httpMethod = "POST",response = SearchProductCategoryResp.class) | |
111 | - @RequestMapping(value = "/searchProductCategory",method = RequestMethod.POST) | |
156 | + @ApiOperation(value = "搜索商品分类", httpMethod = "POST", response = SearchProductCategoryResp.class) | |
157 | + @RequestMapping(value = "/searchProductCategory", method = RequestMethod.POST) | |
112 | 158 | @ResponseBody |
113 | 159 | public void searchProductCategory(@RequestBody SearchProductCategoryReq temp) { |
114 | 160 | SearchProductCategoryReq req = getRequest(SearchProductCategoryReq.class); |
... | ... | @@ -127,8 +173,6 @@ public class SellerGoodsController extends BaseApiController { |
127 | 173 | } |
128 | 174 | |
129 | 175 | |
130 | - | |
131 | - | |
132 | 176 | /** |
133 | 177 | * 添加新商品 |
134 | 178 | * <p> |
... | ... | @@ -138,8 +182,8 @@ public class SellerGoodsController extends BaseApiController { |
138 | 182 | * @createTime Aug 18, 2014 4:02:38 PM |
139 | 183 | * @author weili |
140 | 184 | */ |
141 | - @ApiOperation(value = "添加新商品", httpMethod = "POST",response = AddGoodsResp.class) | |
142 | - @RequestMapping(value = "/addGoods",method = RequestMethod.POST) | |
185 | + @ApiOperation(value = "添加新商品", httpMethod = "POST", response = AddGoodsResp.class) | |
186 | + @RequestMapping(value = "/addGoods", method = RequestMethod.POST) | |
143 | 187 | @ResponseBody |
144 | 188 | public void addGoods(@RequestBody AddGoodsReq temp) { |
145 | 189 | AddGoodsReq req = getRequest(AddGoodsReq.class); |
... | ... | @@ -166,8 +210,8 @@ public class SellerGoodsController extends BaseApiController { |
166 | 210 | * @createTime Aug 18, 2014 4:02:38 PM |
167 | 211 | * @author weili |
168 | 212 | */ |
169 | - @ApiOperation(value = "修改商品", httpMethod = "POST",response = UpdateGoodsResp.class) | |
170 | - @RequestMapping(value = "/updateGoods",method = RequestMethod.POST) | |
213 | + @ApiOperation(value = "修改商品", httpMethod = "POST", response = UpdateGoodsResp.class) | |
214 | + @RequestMapping(value = "/updateGoods", method = RequestMethod.POST) | |
171 | 215 | @ResponseBody |
172 | 216 | public void updateGoods(@RequestBody UpdateGoodsReq temp) { |
173 | 217 | UpdateGoodsReq req = getRequest(UpdateGoodsReq.class); |
... | ... | @@ -195,8 +239,8 @@ public class SellerGoodsController extends BaseApiController { |
195 | 239 | * @createTime Aug 18, 2014 4:02:38 PM |
196 | 240 | * @author weili |
197 | 241 | */ |
198 | - @ApiOperation(value = "卖家获取商品列表", httpMethod = "POST",response = GetGoodsResp.class) | |
199 | - @RequestMapping(value = "/getGoods",method = RequestMethod.POST) | |
242 | + @ApiOperation(value = "卖家获取商品列表", httpMethod = "POST", response = GetGoodsResp.class) | |
243 | + @RequestMapping(value = "/getGoods", method = RequestMethod.POST) | |
200 | 244 | @ResponseBody |
201 | 245 | public void getGoods(@RequestBody GetGoodsReq temp) { |
202 | 246 | GetGoodsReq req = getRequest(GetGoodsReq.class); |
... | ... | @@ -224,8 +268,8 @@ public class SellerGoodsController extends BaseApiController { |
224 | 268 | * @createTime Aug 18, 2014 4:02:38 PM |
225 | 269 | * @author weili |
226 | 270 | */ |
227 | - @ApiOperation(value = "卖家操作商品:1上架 2 下架 3设置促销 4设置首页推荐 5删除", httpMethod = "POST",response = HandleGoodsResp.class) | |
228 | - @RequestMapping(value = "/handleGoods",method = RequestMethod.POST) | |
271 | + @ApiOperation(value = "卖家操作商品:1上架 2 下架 3设置促销 4设置首页推荐 5删除", httpMethod = "POST", response = HandleGoodsResp.class) | |
272 | + @RequestMapping(value = "/handleGoods", method = RequestMethod.POST) | |
229 | 273 | @ResponseBody |
230 | 274 | public void handleGoods(@RequestBody HandleGoodsReq temp) { |
231 | 275 | HandleGoodsReq req = getRequest(HandleGoodsReq.class); |
... | ... | @@ -244,5 +288,4 @@ public class SellerGoodsController extends BaseApiController { |
244 | 288 | } |
245 | 289 | |
246 | 290 | |
247 | - | |
248 | 291 | } | ... | ... |
pom.xml
... | ... | @@ -41,16 +41,6 @@ |
41 | 41 | |
42 | 42 | <dependencies> |
43 | 43 | |
44 | - <dependency> | |
45 | - <groupId>jdk.tools</groupId> | |
46 | - <artifactId>jdk.tools</artifactId> | |
47 | - <version>1.7</version> | |
48 | - <scope>system</scope> | |
49 | - <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> | |
50 | - </dependency> | |
51 | - | |
52 | - | |
53 | - | |
54 | 44 | <!-- spring --> |
55 | 45 | <dependency> |
56 | 46 | <groupId>org.springframework</groupId> | ... | ... |