Commit 40c2f9d37fb9d0e626956d4db4d9fbe2efcd4c4d
1 parent
d56dd93a
购物车接口开发
Showing
12 changed files
with
1872 additions
and
1633 deletions
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/ProductSku.java
... | ... | @@ -3,214 +3,223 @@ package com.diligrp.mobsite.getway.domain.protocol; |
3 | 3 | import java.util.List; |
4 | 4 | import java.util.Map; |
5 | 5 | |
6 | +import io.swagger.annotations.ApiModelProperty; | |
6 | 7 | |
7 | 8 | /** |
8 | 9 | * <B>Description</B> 商品属性 <br /> |
9 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
11 | + * <br /> | |
10 | 12 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
11 | 13 | * <B>Company</B> 地利集团 |
14 | + * | |
12 | 15 | * @createTime 2014年9月17日 下午6:19:19 |
13 | 16 | * @author zhangshirui |
14 | 17 | */ |
15 | 18 | public class ProductSku { |
16 | - | |
17 | - /** | |
18 | - * 商品状态:1-库存为零,销售完毕,2-商品状态:已下架或删除,3-在售并且正常 | |
19 | - * 1-库存为零,销售完毕 | |
20 | - */ | |
21 | - public static final int STATE_SOLD_OUT = 1; | |
22 | - /** | |
23 | - * 2-已下架或删除 | |
24 | - */ | |
25 | - public static final int STATE_DOWN_DEL=2; | |
26 | - /** | |
27 | - * 3-在售并且正常 | |
28 | - */ | |
29 | - public static final int STATE_ON_SALE = 3; | |
30 | - | |
31 | - /** | |
32 | - * 购物车项sk | |
33 | - */ | |
34 | - private String sku; | |
35 | - | |
36 | - /** | |
37 | - * 属性map | |
38 | - */ | |
39 | - private Map<String,String> attributeMap; | |
40 | - | |
41 | - /** | |
42 | - * 价格类型 | |
43 | - */ | |
44 | - private Integer priceType; | |
45 | - | |
46 | - /** | |
47 | - * 最新价格 | |
48 | - */ | |
49 | - private Long price; | |
50 | - | |
51 | - /** | |
52 | - * 之前的价格 | |
53 | - */ | |
54 | - private Long oldPrice; | |
55 | - | |
56 | - /** | |
57 | - * 购买数量 | |
58 | - */ | |
59 | - private Integer buyNum; | |
60 | - | |
61 | - /** | |
62 | - * sku商品的状态 | |
63 | - */ | |
64 | - private Integer state; | |
65 | - | |
66 | - /** | |
67 | - * 选择的服务 | |
68 | - */ | |
69 | - private List<Service> serviceList; | |
70 | - | |
71 | - | |
72 | - /** | |
73 | - * get value of ProductAttribute.sku | |
74 | - * @return the sku | |
75 | - * @createTime 2014年9月17日 下午6:27:08 | |
76 | - * @author zhangshirui | |
77 | - */ | |
78 | - public String getSku() { | |
79 | - return sku; | |
80 | - } | |
81 | - | |
82 | - | |
83 | - /** | |
84 | - * set value of ProductAttribute.sku | |
85 | - * @param sku the sku to set | |
86 | - * @createTime 2014年9月17日 下午6:27:08 | |
87 | - * @author zhangshirui | |
88 | - */ | |
89 | - public void setSku(String sku) { | |
90 | - this.sku = sku; | |
91 | - } | |
92 | - | |
93 | - | |
94 | - /** | |
95 | - * get value of ProductAttribute.attributeMap | |
96 | - * @return the attributeMap | |
97 | - * @createTime 2014年9月17日 下午6:27:08 | |
98 | - * @author zhangshirui | |
99 | - */ | |
100 | - public Map<String, String> getAttributeMap() { | |
101 | - return attributeMap; | |
102 | - } | |
103 | - | |
104 | - | |
105 | - /** | |
106 | - * set value of ProductAttribute.attributeMap | |
107 | - * @param attributeMap the attributeMap to set | |
108 | - * @createTime 2014年9月17日 下午6:27:08 | |
109 | - * @author zhangshirui | |
110 | - */ | |
111 | - public void setAttributeMap(Map<String, String> attributeMap) { | |
112 | - this.attributeMap = attributeMap; | |
113 | - } | |
114 | - | |
115 | - | |
116 | - /** | |
117 | - * get value of ProductAttribute.priceType | |
118 | - * @return the priceType | |
119 | - * @createTime 2014年9月17日 下午6:27:08 | |
120 | - * @author zhangshirui | |
121 | - */ | |
122 | - public Integer getPriceType() { | |
123 | - return priceType; | |
124 | - } | |
125 | - | |
126 | - | |
127 | - /** | |
128 | - * set value of ProductAttribute.priceType | |
129 | - * @param priceType the priceType to set | |
130 | - * @createTime 2014年9月17日 下午6:27:08 | |
131 | - * @author zhangshirui | |
132 | - */ | |
133 | - public void setPriceType(Integer priceType) { | |
134 | - this.priceType = priceType; | |
135 | - } | |
136 | - | |
137 | - | |
138 | - /** | |
139 | - * get value of ProductAttribute.price | |
140 | - * @return the price | |
141 | - * @createTime 2014年9月17日 下午6:27:08 | |
142 | - * @author zhangshirui | |
143 | - */ | |
144 | - public Long getPrice() { | |
145 | - return price; | |
146 | - } | |
147 | - | |
148 | - | |
149 | - /** | |
150 | - * set value of ProductAttribute.price | |
151 | - * @param price the price to set | |
152 | - * @createTime 2014年9月17日 下午6:27:08 | |
153 | - * @author zhangshirui | |
154 | - */ | |
155 | - public void setPrice(Long price) { | |
156 | - this.price = price; | |
157 | - } | |
158 | - | |
159 | - | |
160 | - /** | |
161 | - * get value of ProductAttribute.buyNum | |
162 | - * @return the buyNum | |
163 | - * @createTime 2014年9月17日 下午6:27:08 | |
164 | - * @author zhangshirui | |
165 | - */ | |
166 | - public Integer getBuyNum() { | |
167 | - return buyNum; | |
168 | - } | |
169 | - | |
170 | - | |
171 | - /** | |
172 | - * set value of ProductAttribute.buyNum | |
173 | - * @param buyNum the buyNum to set | |
174 | - * @createTime 2014年9月17日 下午6:27:08 | |
175 | - * @author zhangshirui | |
176 | - */ | |
177 | - public void setBuyNum(Integer buyNum) { | |
178 | - this.buyNum = buyNum; | |
179 | - } | |
180 | - | |
181 | - | |
182 | - /** | |
183 | - * get value of ProductAttribute.serviceList | |
184 | - * @return the serviceList | |
185 | - * @createTime 2014年9月17日 下午6:27:08 | |
186 | - * @author zhangshirui | |
187 | - */ | |
188 | - public List<Service> getServiceList() { | |
189 | - return serviceList; | |
190 | - } | |
191 | - | |
192 | - | |
193 | - /** | |
194 | - * set value of ProductAttribute.serviceList | |
195 | - * @param serviceList the serviceList to set | |
196 | - * @createTime 2014年9月17日 下午6:27:08 | |
197 | - * @author zhangshirui | |
198 | - */ | |
199 | - public void setServiceList(List<Service> serviceList) { | |
200 | - this.serviceList = serviceList; | |
201 | - } | |
202 | 19 | |
20 | + /** | |
21 | + * 商品状态:1-库存为零,销售完毕,2-商品状态:已下架或删除,3-在售并且正常 1-库存为零,销售完毕 | |
22 | + */ | |
23 | + public static final int STATE_SOLD_OUT = 1; | |
24 | + /** | |
25 | + * 2-已下架或删除 | |
26 | + */ | |
27 | + public static final int STATE_DOWN_DEL = 2; | |
28 | + /** | |
29 | + * 3-在售并且正常 | |
30 | + */ | |
31 | + public static final int STATE_ON_SALE = 3; | |
32 | + | |
33 | + /** | |
34 | + * 购物车项sk | |
35 | + */ | |
36 | + private String sku; | |
37 | + | |
38 | + /** | |
39 | + * 属性map | |
40 | + */ | |
41 | + private Map<String, String> attributeMap; | |
42 | + | |
43 | + /** | |
44 | + * 价格类型 | |
45 | + */ | |
46 | + private Integer priceType; | |
47 | + | |
48 | + /** | |
49 | + * 最新价格 | |
50 | + */ | |
51 | + private Long price; | |
52 | + | |
53 | + /** | |
54 | + * 之前的价格 | |
55 | + */ | |
56 | + private Long oldPrice; | |
57 | + | |
58 | + /** | |
59 | + * 购买数量 | |
60 | + */ | |
61 | + private Integer buyNum; | |
62 | + | |
63 | + /** | |
64 | + * sku商品的状态 | |
65 | + */ | |
66 | + private Integer state; | |
67 | + | |
68 | + /** | |
69 | + * 选择的服务 | |
70 | + */ | |
71 | + private List<Service> serviceList; | |
72 | + @ApiModelProperty("商品id") | |
73 | + private Long productId; | |
74 | + @ApiModelProperty("商品名称") | |
75 | + private String productName; | |
76 | + | |
77 | + /** | |
78 | + * get value of ProductAttribute.sku | |
79 | + * | |
80 | + * @return the sku | |
81 | + * @createTime 2014年9月17日 下午6:27:08 | |
82 | + * @author zhangshirui | |
83 | + */ | |
84 | + public String getSku() { | |
85 | + return sku; | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * set value of ProductAttribute.sku | |
90 | + * | |
91 | + * @param sku | |
92 | + * the sku to set | |
93 | + * @createTime 2014年9月17日 下午6:27:08 | |
94 | + * @author zhangshirui | |
95 | + */ | |
96 | + public void setSku(String sku) { | |
97 | + this.sku = sku; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * get value of ProductAttribute.attributeMap | |
102 | + * | |
103 | + * @return the attributeMap | |
104 | + * @createTime 2014年9月17日 下午6:27:08 | |
105 | + * @author zhangshirui | |
106 | + */ | |
107 | + public Map<String, String> getAttributeMap() { | |
108 | + return attributeMap; | |
109 | + } | |
110 | + | |
111 | + /** | |
112 | + * set value of ProductAttribute.attributeMap | |
113 | + * | |
114 | + * @param attributeMap | |
115 | + * the attributeMap to set | |
116 | + * @createTime 2014年9月17日 下午6:27:08 | |
117 | + * @author zhangshirui | |
118 | + */ | |
119 | + public void setAttributeMap(Map<String, String> attributeMap) { | |
120 | + this.attributeMap = attributeMap; | |
121 | + } | |
122 | + | |
123 | + /** | |
124 | + * get value of ProductAttribute.priceType | |
125 | + * | |
126 | + * @return the priceType | |
127 | + * @createTime 2014年9月17日 下午6:27:08 | |
128 | + * @author zhangshirui | |
129 | + */ | |
130 | + public Integer getPriceType() { | |
131 | + return priceType; | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * set value of ProductAttribute.priceType | |
136 | + * | |
137 | + * @param priceType | |
138 | + * the priceType to set | |
139 | + * @createTime 2014年9月17日 下午6:27:08 | |
140 | + * @author zhangshirui | |
141 | + */ | |
142 | + public void setPriceType(Integer priceType) { | |
143 | + this.priceType = priceType; | |
144 | + } | |
145 | + | |
146 | + /** | |
147 | + * get value of ProductAttribute.price | |
148 | + * | |
149 | + * @return the price | |
150 | + * @createTime 2014年9月17日 下午6:27:08 | |
151 | + * @author zhangshirui | |
152 | + */ | |
153 | + public Long getPrice() { | |
154 | + return price; | |
155 | + } | |
156 | + | |
157 | + /** | |
158 | + * set value of ProductAttribute.price | |
159 | + * | |
160 | + * @param price | |
161 | + * the price to set | |
162 | + * @createTime 2014年9月17日 下午6:27:08 | |
163 | + * @author zhangshirui | |
164 | + */ | |
165 | + public void setPrice(Long price) { | |
166 | + this.price = price; | |
167 | + } | |
168 | + | |
169 | + /** | |
170 | + * get value of ProductAttribute.buyNum | |
171 | + * | |
172 | + * @return the buyNum | |
173 | + * @createTime 2014年9月17日 下午6:27:08 | |
174 | + * @author zhangshirui | |
175 | + */ | |
176 | + public Integer getBuyNum() { | |
177 | + return buyNum; | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * set value of ProductAttribute.buyNum | |
182 | + * | |
183 | + * @param buyNum | |
184 | + * the buyNum to set | |
185 | + * @createTime 2014年9月17日 下午6:27:08 | |
186 | + * @author zhangshirui | |
187 | + */ | |
188 | + public void setBuyNum(Integer buyNum) { | |
189 | + this.buyNum = buyNum; | |
190 | + } | |
191 | + | |
192 | + /** | |
193 | + * get value of ProductAttribute.serviceList | |
194 | + * | |
195 | + * @return the serviceList | |
196 | + * @createTime 2014年9月17日 下午6:27:08 | |
197 | + * @author zhangshirui | |
198 | + */ | |
199 | + public List<Service> getServiceList() { | |
200 | + return serviceList; | |
201 | + } | |
202 | + | |
203 | + /** | |
204 | + * set value of ProductAttribute.serviceList | |
205 | + * | |
206 | + * @param serviceList | |
207 | + * the serviceList to set | |
208 | + * @createTime 2014年9月17日 下午6:27:08 | |
209 | + * @author zhangshirui | |
210 | + */ | |
211 | + public void setServiceList(List<Service> serviceList) { | |
212 | + this.serviceList = serviceList; | |
213 | + } | |
203 | 214 | |
204 | 215 | public Integer getState() { |
205 | 216 | return state; |
206 | 217 | } |
207 | 218 | |
208 | - | |
209 | 219 | public void setState(Integer state) { |
210 | 220 | this.state = state; |
211 | 221 | } |
212 | 222 | |
213 | - | |
214 | 223 | /** |
215 | 224 | * @return the oldPrice |
216 | 225 | */ |
... | ... | @@ -218,11 +227,27 @@ public class ProductSku { |
218 | 227 | return oldPrice; |
219 | 228 | } |
220 | 229 | |
221 | - | |
222 | 230 | /** |
223 | - * @param oldPrice the oldPrice to set | |
231 | + * @param oldPrice | |
232 | + * the oldPrice to set | |
224 | 233 | */ |
225 | 234 | public void setOldPrice(Long oldPrice) { |
226 | 235 | this.oldPrice = oldPrice; |
227 | 236 | } |
237 | + | |
238 | + public Long getProductId() { | |
239 | + return productId; | |
240 | + } | |
241 | + | |
242 | + public void setProductId(Long productId) { | |
243 | + this.productId = productId; | |
244 | + } | |
245 | + | |
246 | + public String getProductName() { | |
247 | + return productName; | |
248 | + } | |
249 | + | |
250 | + public void setProductName(String productName) { | |
251 | + this.productName = productName; | |
252 | + } | |
228 | 253 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/cart/ConfirmCartReq.java
1 | 1 | package com.diligrp.mobsite.getway.domain.protocol.cart; |
2 | 2 | |
3 | -import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
4 | - | |
5 | 3 | import java.util.List; |
6 | 4 | |
5 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
6 | + | |
7 | +import io.swagger.annotations.ApiModelProperty; | |
7 | 8 | |
8 | 9 | /** |
9 | 10 | * <B>Description</B> 进货单确认请求 <br /> |
10 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
12 | + * <br /> | |
11 | 13 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
12 | 14 | * <B>Company</B> 地利集团 |
15 | + * | |
13 | 16 | * @createTime 2014年9月17日 上午11:54:10 |
14 | 17 | * @author zhangshirui |
15 | 18 | */ |
16 | 19 | @SuppressWarnings("serial") |
17 | -public class ConfirmCartReq extends BaseReq{ | |
18 | - | |
19 | - /** | |
20 | - * 商品sku进货单id | |
21 | - */ | |
20 | +public class ConfirmCartReq extends BaseReq { | |
21 | + | |
22 | + @ApiModelProperty("买家id") | |
23 | + private Long shopBuyerId; | |
24 | + @ApiModelProperty("选择的sku") | |
22 | 25 | private List<String> skus; |
23 | 26 | |
24 | - public List<String> getSkus() { | |
25 | - return skus; | |
26 | - } | |
27 | + public Long getShopBuyerId() { | |
28 | + return shopBuyerId; | |
29 | + } | |
30 | + | |
31 | + public void setShopBuyerId(Long shopBuyerId) { | |
32 | + this.shopBuyerId = shopBuyerId; | |
33 | + } | |
34 | + | |
35 | + public List<String> getSkus() { | |
36 | + return skus; | |
37 | + } | |
38 | + | |
39 | + public void setSkus(List<String> skus) { | |
40 | + this.skus = skus; | |
41 | + } | |
27 | 42 | |
28 | - public void setSkus(List<String> skus) { | |
29 | - this.skus = skus; | |
30 | - } | |
31 | 43 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/cart/ConfirmCartResp.java
... | ... | @@ -3,118 +3,33 @@ package com.diligrp.mobsite.getway.domain.protocol.cart; |
3 | 3 | import java.util.List; |
4 | 4 | |
5 | 5 | import com.diligrp.mobsite.getway.domain.protocol.BaseResp; |
6 | -import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
7 | -import com.diligrp.mobsite.getway.domain.protocol.cart.model.ConfirmCartShopInfo; | |
8 | - | |
6 | +import com.diligrp.mobsite.getway.domain.protocol.cart.model.CartProductSku; | |
9 | 7 | |
10 | 8 | /** |
11 | 9 | * <B>Description</B> 确认订单 <br /> |
12 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
11 | + * <br /> | |
13 | 12 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
14 | 13 | * <B>Company</B> 地利集团 |
14 | + * | |
15 | 15 | * @createTime 2014年9月17日 上午11:55:09 |
16 | - * @author zhangshirui | |
16 | + * @author jiang | |
17 | 17 | */ |
18 | -@SuppressWarnings("serial") | |
19 | 18 | public class ConfirmCartResp extends BaseResp { |
20 | - | |
21 | - /** | |
22 | - * 提货人信息 | |
23 | - */ | |
24 | - private PickInfo pickInfo; | |
25 | - | |
26 | - /** | |
27 | - * 购物单店铺信息 | |
28 | - */ | |
29 | - private List<ConfirmCartShopInfo> cartShops; | |
30 | - | |
31 | - /** | |
32 | - * 总价 | |
33 | - */ | |
34 | - private Long totalPrice; | |
35 | - | |
36 | - /** | |
37 | - * 信用额度 | |
38 | - */ | |
39 | - private Long creditAmount; | |
40 | - /** | |
41 | - * 进货单类型 | |
42 | - * 1.普通支付 | |
43 | - * 2.赊账支付 | |
44 | - */ | |
45 | - private Integer cartType; | |
46 | - | |
47 | - /** | |
48 | - * @return the pickInfo | |
49 | - */ | |
50 | - public PickInfo getPickInfo() { | |
51 | - return pickInfo; | |
52 | - } | |
53 | - | |
54 | - /** | |
55 | - * @param pickInfo the pickInfo to set | |
56 | - */ | |
57 | - public void setPickInfo(PickInfo pickInfo) { | |
58 | - this.pickInfo = pickInfo; | |
59 | - } | |
60 | - | |
61 | - /** | |
62 | - * @return the totalPrice | |
63 | - */ | |
64 | - public Long getTotalPrice() { | |
65 | - return totalPrice; | |
66 | - } | |
67 | - | |
68 | - /** | |
69 | - * @param totalPrice the totalPrice to set | |
70 | - */ | |
71 | - public void setTotalPrice(Long totalPrice) { | |
72 | - this.totalPrice = totalPrice; | |
73 | - } | |
74 | - | |
75 | - /** | |
76 | - * @return the cartShops | |
77 | - */ | |
78 | - public List<ConfirmCartShopInfo> getCartShops() { | |
79 | - return cartShops; | |
80 | - } | |
81 | - | |
82 | - /** | |
83 | - * @param cartShops the cartShops to set | |
84 | - */ | |
85 | - public void setCartShops(List<ConfirmCartShopInfo> cartShops) { | |
86 | - this.cartShops = cartShops; | |
87 | - } | |
88 | 19 | |
89 | - /** | |
90 | - * get value of ConfirmCartResp.creditAmount | |
91 | - * @return the creditAmount | |
92 | - * @createTime 2014年11月5日 上午11:51:01 | |
93 | - * @author zhangshirui | |
94 | - */ | |
95 | - public Long getCreditAmount() { | |
96 | - return creditAmount; | |
97 | - } | |
20 | + /** | |
21 | + * | |
22 | + */ | |
23 | + private static final long serialVersionUID = -5717619810514850072L; | |
98 | 24 | |
99 | - | |
100 | - /** | |
101 | - * set value of ConfirmCartResp.creditAmount | |
102 | - * @param creditAmount the creditAmount to set | |
103 | - * @createTime 2014年11月5日 上午11:51:01 | |
104 | - * @author zhangshirui | |
105 | - */ | |
106 | - public void setCreditAmount(Long creditAmount) { | |
107 | - this.creditAmount = creditAmount; | |
108 | - } | |
25 | + private List<CartProductSku> skus; | |
109 | 26 | |
110 | - | |
111 | - public Integer getCartType() { | |
112 | - return cartType; | |
113 | - } | |
27 | + public List<CartProductSku> getSkus() { | |
28 | + return skus; | |
29 | + } | |
114 | 30 | |
115 | - | |
116 | - public void setCartType(Integer cartType) { | |
117 | - this.cartType = cartType; | |
118 | - } | |
31 | + public void setSkus(List<CartProductSku> skus) { | |
32 | + this.skus = skus; | |
33 | + } | |
119 | 34 | |
120 | 35 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/cart/model/CartProductSku.java
... | ... | @@ -2,204 +2,99 @@ package com.diligrp.mobsite.getway.domain.protocol.cart.model; |
2 | 2 | |
3 | 3 | import com.diligrp.mobsite.getway.domain.protocol.ProductSku; |
4 | 4 | |
5 | - | |
6 | 5 | /** |
7 | 6 | * <B>Description</B> 购物单商品属性 <br /> |
8 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
7 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
8 | + * <br /> | |
9 | 9 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
10 | 10 | * <B>Company</B> 地利集团 |
11 | + * | |
11 | 12 | * @createTime 2014年9月11日 下午5:51:30 |
12 | 13 | * @author zhangshirui |
13 | 14 | */ |
14 | -public class CartProductSku extends ProductSku{ | |
15 | - | |
15 | +public class CartProductSku extends ProductSku { | |
16 | + | |
16 | 17 | /** |
17 | - * 价格变化 | |
18 | - * 1-价格变化 | |
18 | + * 价格变化 1-价格变化 | |
19 | 19 | */ |
20 | 20 | public static final int PRICE_CHANGE = 1; |
21 | 21 | /** |
22 | 22 | * 2-价格未变化 |
23 | 23 | */ |
24 | 24 | public static final int PRICE_NO_CHANGE = 2; |
25 | - | |
25 | + | |
26 | 26 | /** |
27 | - * 购买数量变化 | |
28 | - * 1-购买数量变化 | |
29 | - */ | |
30 | - public static final int BUY_NUM_CHANGE = 1; | |
31 | - /** | |
32 | - * 2-购买数量未变化 | |
33 | - */ | |
34 | - public static final int BUY_NUM_NO_CHANGE = 2; | |
35 | - | |
27 | + * 购买数量变化 1-购买数量变化 | |
28 | + */ | |
29 | + public static final int BUY_NUM_CHANGE = 1; | |
36 | 30 | /** |
37 | - * 商品sku进货单id | |
38 | - */ | |
39 | - private Long skuCartId; | |
40 | - | |
41 | - /** | |
42 | - * 起批量-最少购买量 | |
43 | - */ | |
44 | - private Integer minWholesale; | |
45 | - | |
46 | - /** | |
47 | - * 库存 | |
48 | - */ | |
49 | - private Integer stockNum; | |
50 | - | |
51 | - /** | |
52 | - * 添加到进货单的时间 | |
53 | - */ | |
54 | - private String addToCartTime; | |
55 | - | |
56 | - /** | |
57 | - * 单位 | |
58 | - */ | |
59 | - private String unit; | |
60 | - | |
61 | - | |
62 | - | |
63 | - /** 是否允许市场外交割: 1-允许 ,2- 不允许 **/ | |
64 | - private int isAllowDelivery; | |
65 | - | |
66 | - | |
67 | - public int getIsAllowDelivery() { | |
68 | - return isAllowDelivery; | |
69 | - } | |
70 | - | |
71 | - public void setIsAllowDelivery(int isAllowDelivery) { | |
72 | - this.isAllowDelivery = isAllowDelivery; | |
73 | - } | |
74 | - | |
75 | - | |
76 | - /** | |
77 | - * 购买数量是否变化 | |
78 | - * 默认2,没变化 | |
79 | - */ | |
80 | - private Integer isBuyNumChange = BUY_NUM_NO_CHANGE; | |
81 | - | |
82 | - /** | |
83 | - * 价格是否变化 | |
84 | - * 默认2,没变化 | |
85 | - */ | |
86 | - private Integer isPriceChange = PRICE_NO_CHANGE; | |
87 | - | |
88 | - /** | |
89 | - * get value of CartProductAttribute.minWholesale | |
90 | - * @return the minWholesale | |
91 | - * @createTime 2014年9月17日 下午6:14:30 | |
92 | - * @author zhangshirui | |
93 | - */ | |
94 | - public Integer getMinWholesale() { | |
95 | - return minWholesale; | |
96 | - } | |
97 | - | |
98 | - | |
99 | - /** | |
100 | - * set value of CartProductAttribute.minWholesale | |
101 | - * @param minWholesale the minWholesale to set | |
102 | - * @createTime 2014年9月17日 下午6:14:30 | |
103 | - * @author zhangshirui | |
104 | - */ | |
105 | - public void setMinWholesale(Integer minWholesale) { | |
106 | - this.minWholesale = minWholesale; | |
107 | - } | |
108 | - | |
109 | - /** | |
110 | - * get value of CartProductAttribute.stockNum | |
111 | - * @return the stockNum | |
112 | - * @createTime 2014年9月17日 下午6:27:40 | |
113 | - * @author zhangshirui | |
114 | - */ | |
115 | - public Integer getStockNum() { | |
116 | - return stockNum; | |
117 | - } | |
118 | - | |
119 | - | |
120 | - | |
121 | - /** | |
122 | - * set value of CartProductAttribute.stockNum | |
123 | - * @param stockNum the stockNum to set | |
124 | - * @createTime 2014年9月17日 下午6:27:40 | |
125 | - * @author zhangshirui | |
126 | - */ | |
127 | - public void setStockNum(Integer stockNum) { | |
128 | - this.stockNum = stockNum; | |
129 | - } | |
130 | - | |
31 | + * 2-购买数量未变化 | |
32 | + */ | |
33 | + public static final int BUY_NUM_NO_CHANGE = 2; | |
131 | 34 | |
132 | 35 | /** |
133 | - * @return the addToCartTime | |
36 | + * 库存 | |
134 | 37 | */ |
135 | - public String getAddToCartTime() { | |
136 | - return addToCartTime; | |
137 | - } | |
138 | - | |
38 | + private Integer stockNum; | |
139 | 39 | |
140 | 40 | /** |
141 | - * @param addToCartTime the addToCartTime to set | |
41 | + * 添加到进货单的时间 | |
142 | 42 | */ |
143 | - public void setAddToCartTime(String addToCartTime) { | |
144 | - this.addToCartTime = addToCartTime; | |
145 | - } | |
43 | + private String addToCartTime; | |
146 | 44 | |
45 | + /** | |
46 | + * 单位 | |
47 | + */ | |
48 | + private String unit; | |
147 | 49 | |
148 | - | |
149 | - /** | |
150 | - * get value of CartProductSku.unit | |
151 | - * @return the unit | |
152 | - * @createTime 2014年10月13日 下午4:12:23 | |
153 | - * @author zhangshirui | |
154 | - */ | |
155 | - public String getUnit() { | |
156 | - return unit; | |
157 | - } | |
158 | - | |
50 | + /** | |
51 | + * 购买数量是否变化 默认2,没变化 | |
52 | + */ | |
53 | + private Integer isBuyNumChange = BUY_NUM_NO_CHANGE; | |
159 | 54 | |
160 | - | |
161 | - /** | |
162 | - * set value of CartProductSku.unit | |
163 | - * @param unit the unit to set | |
164 | - * @createTime 2014年10月13日 下午4:12:23 | |
165 | - * @author zhangshirui | |
166 | - */ | |
167 | - public void setUnit(String unit) { | |
168 | - this.unit = unit; | |
169 | - } | |
170 | - | |
171 | - public Long getSkuCartId() { | |
172 | - return skuCartId; | |
173 | - } | |
55 | + /** | |
56 | + * 价格是否变化 默认2,没变化 | |
57 | + */ | |
58 | + private Integer isPriceChange = PRICE_NO_CHANGE; | |
174 | 59 | |
60 | + public Integer getStockNum() { | |
61 | + return stockNum; | |
62 | + } | |
175 | 63 | |
176 | - | |
177 | - public void setSkuCartId(Long skuCartId) { | |
178 | - this.skuCartId = skuCartId; | |
179 | - } | |
64 | + public void setStockNum(Integer stockNum) { | |
65 | + this.stockNum = stockNum; | |
66 | + } | |
180 | 67 | |
68 | + public String getAddToCartTime() { | |
69 | + return addToCartTime; | |
70 | + } | |
181 | 71 | |
182 | - | |
183 | - public Integer getIsBuyNumChange() { | |
184 | - return isBuyNumChange; | |
185 | - } | |
72 | + public void setAddToCartTime(String addToCartTime) { | |
73 | + this.addToCartTime = addToCartTime; | |
74 | + } | |
186 | 75 | |
76 | + public String getUnit() { | |
77 | + return unit; | |
78 | + } | |
187 | 79 | |
188 | - | |
189 | - public void setIsBuyNumChange(Integer isBuyNumChange) { | |
190 | - this.isBuyNumChange = isBuyNumChange; | |
191 | - } | |
80 | + public void setUnit(String unit) { | |
81 | + this.unit = unit; | |
82 | + } | |
192 | 83 | |
84 | + public Integer getIsBuyNumChange() { | |
85 | + return isBuyNumChange; | |
86 | + } | |
193 | 87 | |
194 | - | |
195 | - public Integer getIsPriceChange() { | |
196 | - return isPriceChange; | |
197 | - } | |
88 | + public void setIsBuyNumChange(Integer isBuyNumChange) { | |
89 | + this.isBuyNumChange = isBuyNumChange; | |
90 | + } | |
198 | 91 | |
92 | + public Integer getIsPriceChange() { | |
93 | + return isPriceChange; | |
94 | + } | |
199 | 95 | |
200 | - | |
201 | - public void setIsPriceChange(Integer isPriceChange) { | |
202 | - this.isPriceChange = isPriceChange; | |
203 | - } | |
96 | + public void setIsPriceChange(Integer isPriceChange) { | |
97 | + this.isPriceChange = isPriceChange; | |
98 | + } | |
204 | 99 | |
205 | 100 | } | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetDeliveryAddressReq.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.user; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | |
4 | + | |
5 | +import io.swagger.annotations.ApiModelProperty; | |
6 | + | |
7 | +public class GetDeliveryAddressReq extends BaseReq { | |
8 | + | |
9 | + /** | |
10 | + * | |
11 | + */ | |
12 | + private static final long serialVersionUID = -3406556869427158247L; | |
13 | + | |
14 | + @ApiModelProperty("买家id") | |
15 | + private Long shopBuyerId; | |
16 | + | |
17 | + public Long getShopBuyerId() { | |
18 | + return shopBuyerId; | |
19 | + } | |
20 | + | |
21 | + public void setShopBuyerId(Long shopBuyerId) { | |
22 | + this.shopBuyerId = shopBuyerId; | |
23 | + } | |
24 | + | |
25 | +} | ... | ... |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/user/GetDeliveryAddressResp.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.domain.protocol.user; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.BaseResp; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
5 | + | |
6 | +import io.swagger.annotations.ApiModelProperty; | |
7 | + | |
8 | +public class GetDeliveryAddressResp extends BaseResp { | |
9 | + | |
10 | + /** | |
11 | + * | |
12 | + */ | |
13 | + private static final long serialVersionUID = 322459069347665875L; | |
14 | + | |
15 | + @ApiModelProperty("送货地址") | |
16 | + private PickInfo pickInfo; | |
17 | + | |
18 | + public PickInfo getPickInfo() { | |
19 | + return pickInfo; | |
20 | + } | |
21 | + | |
22 | + public void setPickInfo(PickInfo pickInfo) { | |
23 | + this.pickInfo = pickInfo; | |
24 | + } | |
25 | + | |
26 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/ShoppingCartRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.rpc; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartProductReq; | |
4 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartProductResp; | |
5 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ConfirmCartReq; | |
6 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ConfirmCartResp; | |
7 | +import com.diligrp.mobsite.getway.domain.protocol.cart.DelCartsReq; | |
8 | +import com.diligrp.mobsite.getway.domain.protocol.cart.DelCartsResp; | |
9 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartByUserReq; | |
10 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartByUserResp; | |
11 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; | |
12 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountResp; | |
13 | + | |
14 | +public interface ShoppingCartRPC { | |
15 | + | |
16 | + GetCartByUserResp getCart(GetCartByUserReq req); | |
17 | + | |
18 | + AddCartProductResp addCartProduct(AddCartProductReq req); | |
19 | + | |
20 | + DelCartsResp delCartByIds(DelCartsReq req); | |
21 | + | |
22 | + ModifyAmountResp modifyAmount(ModifyAmountReq req); | |
23 | + | |
24 | + ConfirmCartResp confirmCartInfo(ConfirmCartReq req); | |
25 | + | |
26 | +} | ... | ... |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/ShoppingCartRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.getway.rpc.impl; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.HashMap; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +import javax.annotation.Resource; | |
9 | + | |
10 | +import org.springframework.util.CollectionUtils; | |
11 | + | |
12 | +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartListInput; | |
13 | +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartSaveInput; | |
14 | +import com.b2c.myapp.common.api.shoppingCart.input.ShoppingCartUpdateInput; | |
15 | +import com.b2c.myapp.common.api.shoppingCart.output.ShoppingCartOutput; | |
16 | +import com.b2c.myapp.common.utils.BaseOutput; | |
17 | +import com.b2c.myapp.sdk.service.ShoppingCartService; | |
18 | +import com.diligrp.mobsite.getway.domain.common.ResultCode; | |
19 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
20 | +import com.diligrp.mobsite.getway.domain.protocol.AddCartProduct; | |
21 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartProductReq; | |
22 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartProductResp; | |
23 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ConfirmCartReq; | |
24 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ConfirmCartResp; | |
25 | +import com.diligrp.mobsite.getway.domain.protocol.cart.DelCartsReq; | |
26 | +import com.diligrp.mobsite.getway.domain.protocol.cart.DelCartsResp; | |
27 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartByUserReq; | |
28 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartByUserResp; | |
29 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; | |
30 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountResp; | |
31 | +import com.diligrp.mobsite.getway.domain.protocol.cart.model.CartProduct; | |
32 | +import com.diligrp.mobsite.getway.domain.protocol.cart.model.CartProductSku; | |
33 | +import com.diligrp.mobsite.getway.domain.protocol.cart.model.ConfirmCartShopInfo; | |
34 | +import com.diligrp.mobsite.getway.rpc.ShoppingCartRPC; | |
35 | + | |
36 | +public class ShoppingCartRPCImpl implements ShoppingCartRPC { | |
37 | + | |
38 | + @Resource | |
39 | + private ShoppingCartService cartService; | |
40 | + | |
41 | + @Override | |
42 | + public GetCartByUserResp getCart(GetCartByUserReq req) { | |
43 | + GetCartByUserResp resp = new GetCartByUserResp(); | |
44 | + ShoppingCartListInput input = new ShoppingCartListInput(); | |
45 | + input.setShopBuyerId(req.getUserId()); | |
46 | + BaseOutput<List<ShoppingCartOutput>> response = this.cartService.getCarts(input); | |
47 | + if (response == null) { | |
48 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取购物车失败"); | |
49 | + } | |
50 | + if (response.getCode() != com.b2c.myapp.common.utils.ResultCode.OK) { | |
51 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
52 | + } | |
53 | + if (CollectionUtils.isEmpty(response.getData())) { | |
54 | + List<CartProduct> cartGoods = new ArrayList<>(response.getData().size()); | |
55 | + for (ShoppingCartOutput output : response.getData()) { | |
56 | + CartProduct cartProduct = new CartProduct(); | |
57 | + cartProduct.setCid(output.getCid()); | |
58 | + cartProduct.setPid(Long.valueOf(output.getPid())); | |
59 | + List<CartProductSku> skus = new ArrayList<>(1); | |
60 | + CartProductSku sku = new CartProductSku(); | |
61 | + sku.setPrice(output.getCurrentPrice()); | |
62 | + skus.add(sku); | |
63 | + cartProduct.setCartGoodsSkus(skus); | |
64 | + cartProduct.setName(output.getProductName()); | |
65 | + cartProduct.setQuantity(output.getQuantity().intValue()); | |
66 | + cartProduct.setUnit(output.getSaleUnit()); | |
67 | + cartGoods.add(cartProduct); | |
68 | + } | |
69 | + resp.setCartGoods(cartGoods); | |
70 | + } | |
71 | + return resp; | |
72 | + } | |
73 | + | |
74 | + @Override | |
75 | + public AddCartProductResp addCartProduct(AddCartProductReq req) { | |
76 | + ShoppingCartSaveInput input = new ShoppingCartSaveInput(); | |
77 | + AddCartProduct reqProduct = req.getCartProduct(); | |
78 | + input.setPid(reqProduct.getPid().toString()); | |
79 | + input.setPrice(reqProduct.getPrice()); | |
80 | + input.setShopBuyerId(req.getUserId()); | |
81 | + input.setSku(reqProduct.getSku()); | |
82 | + BaseOutput<ShoppingCartOutput> response = this.cartService.addCart(input); | |
83 | + if (response == null) { | |
84 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取购物车失败"); | |
85 | + } | |
86 | + if (response.getCode() != com.b2c.myapp.common.utils.ResultCode.OK) { | |
87 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
88 | + } | |
89 | + AddCartProductResp resp = new AddCartProductResp(); | |
90 | + return resp; | |
91 | + } | |
92 | + | |
93 | + @Override | |
94 | + public DelCartsResp delCartByIds(DelCartsReq req) { | |
95 | + String[] skus = req.getSkus().toArray(new String[req.getSkus().size()]); | |
96 | + BaseOutput<Boolean> response = this.cartService.delCarts(req.getUserId(), skus); | |
97 | + if (response == null) { | |
98 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取购物车失败"); | |
99 | + } | |
100 | + if (response.getCode() != com.b2c.myapp.common.utils.ResultCode.OK) { | |
101 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
102 | + } | |
103 | + if (!response.getData()) { | |
104 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
105 | + } | |
106 | + DelCartsResp resp = new DelCartsResp(); | |
107 | + return resp; | |
108 | + } | |
109 | + | |
110 | + @Override | |
111 | + public ModifyAmountResp modifyAmount(ModifyAmountReq req) { | |
112 | + ShoppingCartUpdateInput input = new ShoppingCartUpdateInput(); | |
113 | + input.setQuantity(req.getAmount().longValue()); | |
114 | + input.setShopBuyerId(req.getUserId()); | |
115 | + input.setSku(req.getSku()); | |
116 | + BaseOutput<Boolean> response = this.cartService.modifyCart(input); | |
117 | + if (response == null) { | |
118 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取购物车失败"); | |
119 | + } | |
120 | + if (response.getCode() != com.b2c.myapp.common.utils.ResultCode.OK) { | |
121 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
122 | + } | |
123 | + if (!response.getData()) { | |
124 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
125 | + } | |
126 | + ModifyAmountResp resp = new ModifyAmountResp(); | |
127 | + return resp; | |
128 | + } | |
129 | + | |
130 | + @Override | |
131 | + public ConfirmCartResp confirmCartInfo(ConfirmCartReq req) { | |
132 | + GetCartByUserReq cartReq = new GetCartByUserReq(); | |
133 | + ShoppingCartListInput input = new ShoppingCartListInput(); | |
134 | + input.setShopBuyerId(req.getShopBuyerId()); | |
135 | + input.setSkus(req.getSkus().toArray(new String[req.getSkus().size()])); | |
136 | + BaseOutput<List<ShoppingCartOutput>> response = this.cartService.getCarts(input); | |
137 | + if (response == null) { | |
138 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取购物车失败"); | |
139 | + } | |
140 | + if (response.getCode() != com.b2c.myapp.common.utils.ResultCode.OK) { | |
141 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, response.getResult()); | |
142 | + } | |
143 | + ConfirmCartResp resp = new ConfirmCartResp(); | |
144 | + List<CartProductSku> skus = new ArrayList<>(response.getData().size()); | |
145 | + for (ShoppingCartOutput output : response.getData()) { | |
146 | + CartProductSku sku = new CartProductSku(); | |
147 | + sku.setPrice(output.getCurrentPrice()); | |
148 | + sku.setOldPrice(output.getPrice()); | |
149 | + sku.setProductId(Long.valueOf(output.getPid())); | |
150 | + sku.setProductName(output.getProductName()); | |
151 | + sku.setSku(output.getSku()); | |
152 | + sku.setBuyNum(output.getQuantity().intValue()); | |
153 | + sku.setUnit(output.getSaleUnit()); | |
154 | + skus.add(sku); | |
155 | + } | |
156 | + resp.setSkus(skus); | |
157 | + return resp; | |
158 | + } | |
159 | + | |
160 | +} | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/settle/impl/CartServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.settle.impl; |
2 | 2 | |
3 | -import com.diligrp.mobsite.getway.domain.protocol.cart.*; | |
3 | +import javax.annotation.Resource; | |
4 | + | |
5 | +import org.springframework.stereotype.Service; | |
6 | + | |
7 | +import com.b2c.myapp.sdk.service.ShoppingCartService; | |
8 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartImmediatelyReq; | |
9 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartImmediatelyResp; | |
10 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartProductReq; | |
11 | +import com.diligrp.mobsite.getway.domain.protocol.cart.AddCartProductResp; | |
12 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ConfirmCartReq; | |
13 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ConfirmCartResp; | |
14 | +import com.diligrp.mobsite.getway.domain.protocol.cart.DelCartsReq; | |
15 | +import com.diligrp.mobsite.getway.domain.protocol.cart.DelCartsResp; | |
16 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartByUserReq; | |
17 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartByUserResp; | |
18 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetCartNumResp; | |
19 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetProductSaleInfoReq; | |
20 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetProductSaleInfoResp; | |
21 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetSpotSaleInfoReq; | |
22 | +import com.diligrp.mobsite.getway.domain.protocol.cart.GetSpotSaleInfoResp; | |
23 | +import com.diligrp.mobsite.getway.domain.protocol.cart.MargeCartReq; | |
24 | +import com.diligrp.mobsite.getway.domain.protocol.cart.MargeCartResp; | |
25 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountReq; | |
26 | +import com.diligrp.mobsite.getway.domain.protocol.cart.ModifyAmountResp; | |
27 | +import com.diligrp.mobsite.getway.domain.protocol.cart.MoveToFavoriteReq; | |
28 | +import com.diligrp.mobsite.getway.domain.protocol.cart.MoveToFavoriteResp; | |
4 | 29 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetServiceByPickupReq; |
5 | 30 | import com.diligrp.mobsite.getway.domain.protocol.detail.GetServiceByPickupResp; |
31 | +import com.diligrp.mobsite.getway.rpc.ShoppingCartRPC; | |
6 | 32 | import com.diligrp.mobsite.getway.service.buyer.settle.CartService; |
7 | -import org.springframework.stereotype.Service; | |
8 | 33 | |
9 | 34 | /** |
10 | 35 | * <B>Description</B> 进货单业务层 <br /> |
11 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
36 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
37 | + * <br /> | |
12 | 38 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
13 | 39 | * <B>Company</B> 地利集团 |
14 | 40 | * |
... | ... | @@ -18,69 +44,74 @@ import org.springframework.stereotype.Service; |
18 | 44 | @Service |
19 | 45 | public class CartServiceImpl implements CartService { |
20 | 46 | |
21 | - | |
22 | - @Override | |
23 | - public GetCartByUserResp getCart(GetCartByUserReq req) { | |
24 | - return null; | |
25 | - } | |
26 | - | |
27 | - @Override | |
28 | - public AddCartProductResp addCartProduct(AddCartProductReq req) { | |
29 | - return null; | |
30 | - } | |
31 | - | |
32 | - @Override | |
33 | - public GetProductSaleInfoResp getProductSaleInfo(GetProductSaleInfoReq req) { | |
34 | - return null; | |
35 | - } | |
36 | - | |
37 | - @Override | |
38 | - public MargeCartResp margeCart(MargeCartReq req) { | |
39 | - return null; | |
40 | - } | |
41 | - | |
42 | - @Override | |
43 | - public ModifyAmountResp modifyAmount(ModifyAmountReq req) { | |
44 | - return null; | |
45 | - } | |
46 | - | |
47 | - @Override | |
48 | - public GetServiceByPickupResp getServiceByPickup(Long pickupId) { | |
49 | - return null; | |
50 | - } | |
51 | - | |
52 | - @Override | |
53 | - public GetServiceByPickupResp getOrderServiceByPickup(GetServiceByPickupReq req) { | |
54 | - return null; | |
55 | - } | |
56 | - | |
57 | - @Override | |
58 | - public ConfirmCartResp confirmCartInfo(ConfirmCartReq req) { | |
59 | - return null; | |
60 | - } | |
61 | - | |
62 | - @Override | |
63 | - public DelCartsResp delCartByIds(DelCartsReq req) { | |
64 | - return null; | |
65 | - } | |
66 | - | |
67 | - @Override | |
68 | - public GetCartNumResp getCartNum(Long userId) { | |
69 | - return null; | |
70 | - } | |
71 | - | |
72 | - @Override | |
73 | - public AddCartImmediatelyResp addCartImmediately(AddCartImmediatelyReq req) { | |
74 | - return null; | |
75 | - } | |
76 | - | |
77 | - @Override | |
78 | - public GetSpotSaleInfoResp getSpotSaleInfo(GetSpotSaleInfoReq req) { | |
79 | - return null; | |
80 | - } | |
81 | - | |
82 | - @Override | |
83 | - public MoveToFavoriteResp moveToFavorite(MoveToFavoriteReq req) { | |
84 | - return null; | |
85 | - } | |
47 | + // private MyAppClient mac; | |
48 | + // @Resource | |
49 | + // private ShoppingCartService cartService; | |
50 | + @Resource | |
51 | + private ShoppingCartRPC cartRPC; | |
52 | + | |
53 | + @Override | |
54 | + public GetCartByUserResp getCart(GetCartByUserReq req) { | |
55 | + return this.cartRPC.getCart(req); | |
56 | + } | |
57 | + | |
58 | + @Override | |
59 | + public AddCartProductResp addCartProduct(AddCartProductReq req) { | |
60 | + return this.cartRPC.addCartProduct(req); | |
61 | + } | |
62 | + | |
63 | + @Override | |
64 | + public GetProductSaleInfoResp getProductSaleInfo(GetProductSaleInfoReq req) { | |
65 | + return null; | |
66 | + } | |
67 | + | |
68 | + @Override | |
69 | + public MargeCartResp margeCart(MargeCartReq req) { | |
70 | + return null; | |
71 | + } | |
72 | + | |
73 | + @Override | |
74 | + public ModifyAmountResp modifyAmount(ModifyAmountReq req) { | |
75 | + return this.cartRPC.modifyAmount(req); | |
76 | + } | |
77 | + | |
78 | + @Override | |
79 | + public GetServiceByPickupResp getServiceByPickup(Long pickupId) { | |
80 | + return null; | |
81 | + } | |
82 | + | |
83 | + @Override | |
84 | + public GetServiceByPickupResp getOrderServiceByPickup(GetServiceByPickupReq req) { | |
85 | + return null; | |
86 | + } | |
87 | + | |
88 | + @Override | |
89 | + public ConfirmCartResp confirmCartInfo(ConfirmCartReq req) { | |
90 | + return this.cartRPC.confirmCartInfo(req); | |
91 | + } | |
92 | + | |
93 | + @Override | |
94 | + public DelCartsResp delCartByIds(DelCartsReq req) { | |
95 | + return this.cartRPC.delCartByIds(req); | |
96 | + } | |
97 | + | |
98 | + @Override | |
99 | + public GetCartNumResp getCartNum(Long userId) { | |
100 | + return null; | |
101 | + } | |
102 | + | |
103 | + @Override | |
104 | + public AddCartImmediatelyResp addCartImmediately(AddCartImmediatelyReq req) { | |
105 | + return null; | |
106 | + } | |
107 | + | |
108 | + @Override | |
109 | + public GetSpotSaleInfoResp getSpotSaleInfo(GetSpotSaleInfoReq req) { | |
110 | + return null; | |
111 | + } | |
112 | + | |
113 | + @Override | |
114 | + public MoveToFavoriteResp moveToFavorite(MoveToFavoriteReq req) { | |
115 | + return null; | |
116 | + } | |
86 | 117 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/UserService.java
... | ... | @@ -9,129 +9,140 @@ import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
9 | 9 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; |
10 | 10 | import com.diligrp.mobsite.getway.domain.protocol.user.*; |
11 | 11 | |
12 | - | |
13 | 12 | /** |
14 | 13 | * <B>Description</B> userservice <br /> |
15 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
14 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
15 | + * <br /> | |
16 | 16 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
17 | 17 | * <B>Company</B> 地利集团 |
18 | + * | |
18 | 19 | * @createTime 2014年8月26日 下午5:34:42 |
19 | 20 | * @author zhangshirui |
20 | 21 | */ |
21 | 22 | public interface UserService { |
22 | 23 | |
23 | - /** | |
24 | - * 用户登录 | |
25 | - * @param req | |
26 | - * @return | |
27 | - * @createTime 2014年8月26日 下午5:37:05 | |
28 | - * @author zhangshirui | |
29 | - */ | |
30 | - LoginResp login(LoginReq req); | |
31 | - | |
32 | - /** | |
33 | - * 验证用户名是否合法 | |
34 | - * @param req | |
35 | - * @return | |
36 | - * @createTime 2014年8月26日 下午6:32:14 | |
37 | - * @author zhangshirui | |
38 | - */ | |
39 | - CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req); | |
40 | - | |
41 | - /** | |
42 | - * 验证手机收到的验证码 | |
43 | - * @param req | |
44 | - * @return | |
45 | - * @createTime 2014年8月27日 下午4:25:11 | |
46 | - * @author zhangshirui | |
47 | - */ | |
48 | - CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req); | |
49 | - | |
50 | - /** | |
51 | - * 发送手机验证码 | |
52 | - * @createTime 2014年8月27日 下午4:50:38 | |
53 | - * @author zhangshirui | |
54 | - */ | |
55 | - SendVeriCodeResp sendVeriCode(SendVeriCodeReq req); | |
56 | - | |
57 | - /** | |
58 | - * 修改用户信息 | |
59 | - * @param req | |
60 | - * @return | |
61 | - * @createTime 2014年8月28日 下午3:15:53 | |
62 | - * @author zhangshirui | |
63 | - */ | |
64 | - UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); | |
65 | - | |
66 | - /** | |
67 | - * | |
68 | - * @createTime 2014年8月28日 下午3:45:48 | |
69 | - * @author zhangshirui | |
70 | - * @param req | |
71 | - * @return | |
72 | - */ | |
73 | - CheckAccountNameResp checkAccountName(CheckAccountNameReq req); | |
74 | - | |
75 | - /** | |
76 | - * 验证手机号 | |
77 | - * @param req | |
78 | - * @return | |
79 | - * @createTime 2014年8月28日 下午4:03:59 | |
80 | - * @author zhangshirui | |
81 | - */ | |
82 | - CheckMobileResp checkMobile(CheckMobileReq req); | |
83 | - | |
84 | - /** | |
85 | - *用户注册 | |
86 | - * @param req | |
87 | - * @return | |
88 | - * @createTime 2014年8月28日 下午4:37:08 | |
89 | - * @author zhangshirui | |
90 | - */ | |
91 | - UserRegisterResp userRegister(UserRegisterReq req); | |
92 | - | |
93 | - GetUserInfoResp getUserIntroduction(GetUserInfoReq req); | |
94 | - | |
95 | - UpdateMobileResp updateMobile(UpdateMobileReq req); | |
96 | - | |
97 | - SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req); | |
98 | - | |
99 | - SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req); | |
100 | - | |
101 | - GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req); | |
102 | - | |
103 | - GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req); | |
104 | - | |
105 | - DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req); | |
106 | - | |
107 | - DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req); | |
108 | - | |
109 | - GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req); | |
110 | - | |
111 | - GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req); | |
24 | + /** | |
25 | + * 用户登录 | |
26 | + * | |
27 | + * @param req | |
28 | + * @return | |
29 | + * @createTime 2014年8月26日 下午5:37:05 | |
30 | + * @author zhangshirui | |
31 | + */ | |
32 | + LoginResp login(LoginReq req); | |
33 | + | |
34 | + /** | |
35 | + * 验证用户名是否合法 | |
36 | + * | |
37 | + * @param req | |
38 | + * @return | |
39 | + * @createTime 2014年8月26日 下午6:32:14 | |
40 | + * @author zhangshirui | |
41 | + */ | |
42 | + CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req); | |
43 | + | |
44 | + /** | |
45 | + * 验证手机收到的验证码 | |
46 | + * | |
47 | + * @param req | |
48 | + * @return | |
49 | + * @createTime 2014年8月27日 下午4:25:11 | |
50 | + * @author zhangshirui | |
51 | + */ | |
52 | + CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req); | |
53 | + | |
54 | + /** | |
55 | + * 发送手机验证码 | |
56 | + * | |
57 | + * @createTime 2014年8月27日 下午4:50:38 | |
58 | + * @author zhangshirui | |
59 | + */ | |
60 | + SendVeriCodeResp sendVeriCode(SendVeriCodeReq req); | |
61 | + | |
62 | + /** | |
63 | + * 修改用户信息 | |
64 | + * | |
65 | + * @param req | |
66 | + * @return | |
67 | + * @createTime 2014年8月28日 下午3:15:53 | |
68 | + * @author zhangshirui | |
69 | + */ | |
70 | + UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); | |
71 | + | |
72 | + /** | |
73 | + * | |
74 | + * @createTime 2014年8月28日 下午3:45:48 | |
75 | + * @author zhangshirui | |
76 | + * @param req | |
77 | + * @return | |
78 | + */ | |
79 | + CheckAccountNameResp checkAccountName(CheckAccountNameReq req); | |
80 | + | |
81 | + /** | |
82 | + * 验证手机号 | |
83 | + * | |
84 | + * @param req | |
85 | + * @return | |
86 | + * @createTime 2014年8月28日 下午4:03:59 | |
87 | + * @author zhangshirui | |
88 | + */ | |
89 | + CheckMobileResp checkMobile(CheckMobileReq req); | |
90 | + | |
91 | + /** | |
92 | + * 用户注册 | |
93 | + * | |
94 | + * @param req | |
95 | + * @return | |
96 | + * @createTime 2014年8月28日 下午4:37:08 | |
97 | + * @author zhangshirui | |
98 | + */ | |
99 | + UserRegisterResp userRegister(UserRegisterReq req); | |
100 | + | |
101 | + GetUserInfoResp getUserIntroduction(GetUserInfoReq req); | |
102 | + | |
103 | + UpdateMobileResp updateMobile(UpdateMobileReq req); | |
104 | + | |
105 | + SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req); | |
106 | + | |
107 | + SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req); | |
108 | + | |
109 | + GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req); | |
110 | + | |
111 | + GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req); | |
112 | + | |
113 | + DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req); | |
114 | + | |
115 | + DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req); | |
116 | + | |
117 | + GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req); | |
118 | + | |
119 | + GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req); | |
112 | 120 | |
113 | 121 | LogoutResp logout(LogoutReq req); |
114 | 122 | |
115 | 123 | /** |
116 | 124 | * 修改密码 |
125 | + * | |
117 | 126 | * @param req |
118 | 127 | * @return |
119 | 128 | * @createTime 2015年1月24日 下午4:29:26 |
120 | 129 | * @author zhangshirui |
121 | 130 | */ |
122 | - ModifyPwdResp modifyPwd(ModifyPwdReq req); | |
131 | + ModifyPwdResp modifyPwd(ModifyPwdReq req); | |
123 | 132 | |
124 | - /** | |
125 | - * 查询用户认证信息 | |
126 | - * @param req | |
127 | - * @return | |
128 | - * @createTime 2015年7月9日 上午11:04:45 | |
129 | - * @author zhangshirui | |
130 | - */ | |
133 | + /** | |
134 | + * 查询用户认证信息 | |
135 | + * | |
136 | + * @param req | |
137 | + * @return | |
138 | + * @createTime 2015年7月9日 上午11:04:45 | |
139 | + * @author zhangshirui | |
140 | + */ | |
131 | 141 | GetAuthInfoResp getAuthInfo(GetAuthInfoReq req); |
132 | 142 | |
133 | 143 | /** |
134 | 144 | * 删除收藏的信息 |
145 | + * | |
135 | 146 | * @param req |
136 | 147 | * @return |
137 | 148 | */ |
... | ... | @@ -139,6 +150,7 @@ public interface UserService { |
139 | 150 | |
140 | 151 | /** |
141 | 152 | * 查询收藏的信息 |
153 | + * | |
142 | 154 | * @param req |
143 | 155 | * @return |
144 | 156 | */ |
... | ... | @@ -146,25 +158,28 @@ public interface UserService { |
146 | 158 | |
147 | 159 | /** |
148 | 160 | * 添加收藏信息 |
161 | + * | |
149 | 162 | * @param req |
150 | 163 | * @return |
151 | 164 | */ |
152 | 165 | AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req); |
153 | - | |
166 | + | |
154 | 167 | /** |
155 | - * 查询用户极光号 | |
156 | - * @param req | |
157 | - * @return | |
158 | - * @createTime 2015-11-10 19:43:18 | |
159 | - */ | |
168 | + * 查询用户极光号 | |
169 | + * | |
170 | + * @param req | |
171 | + * @return | |
172 | + * @createTime 2015-11-10 19:43:18 | |
173 | + */ | |
160 | 174 | GetRegisterNoResp getRegisterNo(GetRegisterNoReq req); |
161 | - | |
175 | + | |
162 | 176 | /** |
163 | - * 批量查询用户极光号 | |
164 | - * @param req | |
165 | - * @return | |
166 | - * @createTime 2015-11-10 19:43:18 | |
167 | - */ | |
177 | + * 批量查询用户极光号 | |
178 | + * | |
179 | + * @param req | |
180 | + * @return | |
181 | + * @createTime 2015-11-10 19:43:18 | |
182 | + */ | |
168 | 183 | GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req); |
169 | 184 | |
170 | 185 | GetMemberListResp getMemberList(GetMemberListReq req); |
... | ... | @@ -178,4 +193,12 @@ public interface UserService { |
178 | 193 | SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req); |
179 | 194 | |
180 | 195 | LoginResp authlogin(AuthLoginReq req); |
196 | + | |
197 | + /** | |
198 | + * 获取买家收货地址信息 | |
199 | + * | |
200 | + * @param req | |
201 | + * @return | |
202 | + */ | |
203 | + GetDeliveryAddressResp getDeliveryAddresses(GetDeliveryAddressReq req); | |
181 | 204 | } | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
1 | 1 | package com.diligrp.mobsite.getway.service.buyer.user.impl; |
2 | 2 | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.HashMap; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +import javax.annotation.Resource; | |
9 | + | |
10 | +import org.slf4j.Logger; | |
11 | +import org.slf4j.LoggerFactory; | |
12 | +import org.springframework.beans.factory.annotation.Autowired; | |
13 | +import org.springframework.stereotype.Service; | |
14 | + | |
3 | 15 | import com.alibaba.fastjson.JSONObject; |
4 | 16 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
17 | +import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; | |
5 | 18 | import com.diligrp.mobsite.getway.domain.RegisterNoMapper; |
6 | 19 | import com.diligrp.mobsite.getway.domain.common.Constant; |
7 | 20 | import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
8 | 21 | import com.diligrp.mobsite.getway.domain.common.RedisKey; |
9 | 22 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
10 | 23 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
11 | -import com.diligrp.mobsite.getway.domain.protocol.login.*; | |
12 | -import com.diligrp.mobsite.getway.domain.protocol.register.*; | |
13 | -import com.diligrp.mobsite.getway.domain.protocol.user.*; | |
24 | +import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
25 | +import com.diligrp.mobsite.getway.domain.protocol.login.AuthLoginReq; | |
26 | +import com.diligrp.mobsite.getway.domain.protocol.login.CheckVeriCodeReq; | |
27 | +import com.diligrp.mobsite.getway.domain.protocol.login.CheckVeriCodeResp; | |
28 | +import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; | |
29 | +import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp; | |
30 | +import com.diligrp.mobsite.getway.domain.protocol.login.LogoutReq; | |
31 | +import com.diligrp.mobsite.getway.domain.protocol.login.LogoutResp; | |
32 | +import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeReq; | |
33 | +import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeResp; | |
34 | +import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameReq; | |
35 | +import com.diligrp.mobsite.getway.domain.protocol.register.CheckAccountNameResp; | |
36 | +import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileReq; | |
37 | +import com.diligrp.mobsite.getway.domain.protocol.register.CheckMobileResp; | |
38 | +import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; | |
39 | +import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; | |
40 | +import com.diligrp.mobsite.getway.domain.protocol.user.AddFavoriteInfoReq; | |
41 | +import com.diligrp.mobsite.getway.domain.protocol.user.AddFavoriteInfoResp; | |
42 | +import com.diligrp.mobsite.getway.domain.protocol.user.CheckUserInvalidReq; | |
43 | +import com.diligrp.mobsite.getway.domain.protocol.user.CheckUserInvalidResp; | |
44 | +import com.diligrp.mobsite.getway.domain.protocol.user.CompleteUserInfoReq; | |
45 | +import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteInfoReq; | |
46 | +import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteInfoResp; | |
47 | +import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteProductReq; | |
48 | +import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteProductResp; | |
49 | +import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteShopReq; | |
50 | +import com.diligrp.mobsite.getway.domain.protocol.user.DelFavoriteShopResp; | |
51 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetAuthInfoReq; | |
52 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetAuthInfoResp; | |
53 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDeliveryAddressReq; | |
54 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDeliveryAddressResp; | |
55 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDepositCardAmountReq; | |
56 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDepositCardAmountResp; | |
57 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetEnterpriseAuthReq; | |
58 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetEnterpriseAuthResp; | |
59 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteInfoReq; | |
60 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteInfoResp; | |
61 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteProductReq; | |
62 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteProductResp; | |
63 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteShopReq; | |
64 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetFavoriteShopResp; | |
65 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetIdentityAuthReq; | |
66 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetIdentityAuthResp; | |
67 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetMemberListReq; | |
68 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetMemberListResp; | |
69 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoReq; | |
70 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoResp; | |
71 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNobyUidsReq; | |
72 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNobyUidsResp; | |
73 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetUserInfoReq; | |
74 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetUserInfoResp; | |
75 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
76 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdResp; | |
77 | +import com.diligrp.mobsite.getway.domain.protocol.user.SearchUserInfoReq; | |
78 | +import com.diligrp.mobsite.getway.domain.protocol.user.SearchUserInfoResp; | |
79 | +import com.diligrp.mobsite.getway.domain.protocol.user.SubmitEnterpriseAuthReq; | |
80 | +import com.diligrp.mobsite.getway.domain.protocol.user.SubmitEnterpriseAuthResp; | |
81 | +import com.diligrp.mobsite.getway.domain.protocol.user.SubmitIdentityAuthReq; | |
82 | +import com.diligrp.mobsite.getway.domain.protocol.user.SubmitIdentityAuthResp; | |
83 | +import com.diligrp.mobsite.getway.domain.protocol.user.TradeRecordReq; | |
84 | +import com.diligrp.mobsite.getway.domain.protocol.user.TradeRecordResp; | |
85 | +import com.diligrp.mobsite.getway.domain.protocol.user.UpdateMobileReq; | |
86 | +import com.diligrp.mobsite.getway.domain.protocol.user.UpdateMobileResp; | |
87 | +import com.diligrp.mobsite.getway.domain.protocol.user.UpdateUserInfoReq; | |
88 | +import com.diligrp.mobsite.getway.domain.protocol.user.UpdateUserInfoResp; | |
14 | 89 | import com.diligrp.mobsite.getway.domain.protocol.user.model.RegisterNoPlatform; |
15 | 90 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; |
16 | -import com.diligrp.mobsite.getway.rpc.*; | |
91 | +import com.diligrp.mobsite.getway.rpc.ConfigRPC; | |
92 | +import com.diligrp.mobsite.getway.rpc.GoodsRPC; | |
93 | +import com.diligrp.mobsite.getway.rpc.MessageRPC; | |
94 | +import com.diligrp.mobsite.getway.rpc.PassportRPC; | |
95 | +import com.diligrp.mobsite.getway.rpc.PickInfoRPC; | |
96 | +import com.diligrp.mobsite.getway.rpc.ShopRPC; | |
97 | +import com.diligrp.mobsite.getway.rpc.UserRPC; | |
17 | 98 | import com.diligrp.mobsite.getway.rpc.utils.UserRedisUtil; |
18 | 99 | import com.diligrp.mobsite.getway.service.buyer.user.UserService; |
19 | 100 | import com.diligrp.mobsite.getway.service.common.utils.PassportUtils; |
20 | 101 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
21 | 102 | import com.diligrp.website.util.security.Validator; |
22 | 103 | import com.diligrp.website.web.interfaces.domain.output.DataDictionaryResp; |
23 | -import org.slf4j.Logger; | |
24 | -import org.slf4j.LoggerFactory; | |
25 | -import org.springframework.beans.factory.annotation.Autowired; | |
26 | -import org.springframework.stereotype.Service; | |
27 | - | |
28 | -import javax.annotation.Resource; | |
29 | -import java.util.ArrayList; | |
30 | -import java.util.HashMap; | |
31 | -import java.util.List; | |
32 | -import java.util.Map; | |
33 | 104 | |
34 | 105 | /** |
35 | 106 | * <B>Description</B> 用户 服务层 <br /> |
36 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
107 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
108 | + * <br /> | |
37 | 109 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
38 | 110 | * <B>Company</B> 地利集团 |
39 | 111 | * |
... | ... | @@ -43,485 +115,492 @@ import java.util.Map; |
43 | 115 | @Service("userService") |
44 | 116 | public class UserServiceImpl implements UserService { |
45 | 117 | |
46 | - @Resource | |
47 | - private UserRPC userRPC; | |
48 | - @Resource | |
49 | - private GoodsRPC goodsRPC; | |
50 | - @Autowired | |
51 | - private RedisUtilImpl redisUtil; | |
52 | - @Autowired | |
53 | - private UserRedisUtil userRedisUtil; | |
54 | - | |
55 | - @Resource | |
56 | - private RegisterNoMapperManager registerNoMapperManager; | |
57 | - @Resource | |
58 | - private PassportRPC passportRPC; | |
59 | - @Resource | |
60 | - private ConfigRPC configRPC; | |
61 | - | |
62 | - @Resource | |
63 | - private ShopRPC shopRPC; | |
64 | - @Autowired | |
65 | - private MessageRPC messageRPC; | |
66 | - | |
67 | - | |
68 | - private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); | |
69 | - | |
70 | - @Override | |
71 | - public LoginResp login(LoginReq req) { | |
72 | - LoginResp resp = (LoginResp) passportRPC.buyerLogin(req); | |
73 | - | |
74 | - if (!Validator.isEmpty(req.getRegisterNo())) { | |
75 | - // 缓存 | |
76 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_BUYER+ | |
77 | - String.valueOf(resp.getAccountId())); | |
78 | - | |
79 | - GetRegisterNoResp mappers = redisUtil.getObject(redisKey, | |
80 | - GetRegisterNoResp.class); | |
81 | - // 绑定极光ID | |
82 | - RegisterNoMapper mapper = new RegisterNoMapper(); | |
83 | - mapper.setRegisterNo(req.getRegisterNo()); | |
84 | - mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
85 | - mapper.setUserid(resp.getAccountId()); | |
86 | - mapper.setDeviceType(req.getDeviceType()); | |
87 | - try { | |
88 | - //清除当前极光号userid缓存 | |
89 | - cleanOldredis(mapper); | |
90 | - //构建缓存信息 | |
91 | - buildRedisInfo(mappers, mapper); | |
92 | - redisUtil.setObjectByExpire(redisKey, mappers, | |
93 | - RedisKey.REGISTERNO_EXPIRE_TIME); | |
94 | - } catch (Exception e) { | |
95 | - throw new ServiceException(ResultCode.PUSH_MESSAGE_NO, | |
96 | - "绑定极光推送系统注册号失败"); | |
97 | - } | |
98 | - } | |
99 | - return resp; | |
100 | - } | |
101 | - | |
102 | - | |
103 | - /** | |
104 | - * 清除当前极光号下userid缓存 | |
105 | - * @param mapper | |
106 | - */ | |
107 | - private void cleanOldredis(RegisterNoMapper mapper) { | |
108 | - RegisterNoMapper oldmapper = registerNoMapperManager | |
109 | - .bindRegisterNo(mapper); | |
110 | - if (!Validator.isNull(oldmapper)){ | |
111 | - String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
112 | - String.valueOf(oldmapper.getUserid())); | |
113 | - redisUtil.deleteByKey(oldKey); | |
114 | - } | |
115 | - } | |
116 | - | |
117 | - /** | |
118 | - * 建立缓存信息 | |
119 | - * @param mappers | |
120 | - * @param mapper | |
121 | - */ | |
122 | - private void buildRedisInfo(GetRegisterNoResp mappers, | |
123 | - RegisterNoMapper mapper) { | |
124 | - // 如果缓存没有重新建 | |
125 | - List<RegisterNoMapper> renolist = new ArrayList<RegisterNoMapper>(); | |
126 | - | |
127 | - if (Validator.isNull(mappers)) { | |
128 | - mappers = new GetRegisterNoResp(); | |
129 | - } | |
130 | - renolist.add(mapper); | |
131 | - mappers.setRegisterNos(renolist); | |
132 | - } | |
133 | - | |
134 | - | |
135 | - | |
136 | - @Override | |
137 | - public CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req) { | |
138 | - return null; | |
139 | - } | |
140 | - | |
141 | - @Override | |
142 | - public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { | |
143 | - CheckVeriCodeResp resp = new CheckVeriCodeResp(); | |
144 | - | |
145 | - checkVeriCode(req.getVeriCode(), req.getMobile(),req.getMsgType()); | |
146 | - | |
147 | - return resp; | |
148 | - } | |
149 | - | |
150 | - @Override | |
151 | - public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { | |
152 | - SendVeriCodeResp resp = new SendVeriCodeResp(); | |
153 | - | |
154 | - String mobile = req.getMobile(); | |
155 | - boolean existFlag = !userRPC.checkMobile(mobile); | |
156 | - | |
157 | - Integer msgType = req.getMsgType(); | |
158 | - String code = null; | |
159 | - String message = null; | |
160 | - | |
161 | - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
162 | - String veriCode = redisUtil.getString(redisKey); | |
163 | - | |
164 | - if (Validator.isEmpty(veriCode)) { | |
165 | - //生成验证码 | |
166 | - veriCode = PassportUtils.generateMobileRandomNumber(); | |
167 | - redisUtil.setStringByExpire(redisKey, String.valueOf(veriCode), RedisKey.USER_SEND_VERICODE_EXPIRE_TIME); | |
168 | - } | |
169 | - | |
170 | - if (!Validator.isNull(msgType) && msgType != SendVeriCodeReq.MSG_TYPE_DEFAULT) { | |
171 | - if (msgType==SendVeriCodeReq.MSG_TYPE_REGISTER) { | |
172 | - //注册,电话号码已经存在 | |
173 | - if(existFlag){ | |
174 | - throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
175 | - } | |
176 | - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
177 | - resp.setPassKey(passkey); | |
178 | - | |
179 | - messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_ACCOUNT_REGISTRATION); | |
180 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
181 | - return resp; | |
182 | - }else if(msgType==SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) { | |
183 | - //找回密码,电话号码没有存在 | |
184 | - if (!existFlag) { | |
185 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST); | |
186 | - } | |
187 | - messageRPC.sendSMSMsg(mobile, veriCode,Constant.SMS_CONTENT_RETRIEVE_PASSWORD); | |
188 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
189 | - return resp; | |
190 | - }else if(msgType==SendVeriCodeReq.MSG_TYPE_MODIFY_NEW_MOBILE) { | |
191 | - //修改手机号,电话号码已经存在 | |
192 | - if (existFlag) { | |
193 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST); | |
194 | - } | |
195 | - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
196 | - }else if (msgType==SendVeriCodeReq.MSG_TYPE_CHECK_OLD_MOBILE) { | |
197 | - //验证旧的手机号,手机不存在 | |
198 | - if (!existFlag) { | |
199 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_NOT_EXIST); | |
200 | - } | |
201 | - code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
202 | - } | |
203 | - DataDictionaryResp dataDic = configRPC.getMessageTemplate(Constant.DIC_SMS_CONTENT); | |
204 | - message = dataDic.getValueByCode(code).getRemark().replace("{code}", veriCode); | |
205 | - }else { | |
206 | - message = Constant.SMS_CONTENT_DEFAULT.replace("{code}", veriCode); | |
207 | - } | |
208 | - | |
209 | - messageRPC.sendSMS(mobile, message); | |
210 | - | |
211 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
212 | - | |
213 | - return resp; | |
214 | - } | |
215 | - | |
216 | - @Override | |
217 | - public UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req) { | |
218 | - return null; | |
219 | - } | |
220 | - | |
221 | - @Override | |
222 | - public CheckAccountNameResp checkAccountName(CheckAccountNameReq req) { | |
223 | - return null; | |
224 | - } | |
225 | - | |
226 | - @Override | |
227 | - public CheckMobileResp checkMobile(CheckMobileReq req) { | |
228 | - return null; | |
229 | - } | |
230 | - | |
231 | - @Override | |
232 | - public UserRegisterResp userRegister(UserRegisterReq req) { | |
233 | - UserRegisterResp resp = new UserRegisterResp(); | |
234 | - | |
235 | - //手机号码和账号验证、验证码 | |
236 | - //if (!checkRegisterInfo(resp, req)) { | |
237 | - // return resp; | |
238 | - //} | |
239 | - | |
240 | - resp = passportRPC.register(req); | |
241 | - | |
242 | - return resp; | |
243 | - } | |
244 | - | |
245 | - | |
246 | - /** | |
247 | - * 检测注册信息是否正确 | |
248 | - * 1.电话号码 | |
249 | - * 2.账号,会员名 | |
250 | - * 3.验证码 | |
251 | - * @createTime 2014年10月31日 下午2:37:16 | |
252 | - * @author zhangshirui | |
253 | - */ | |
254 | - private boolean checkRegisterInfo(UserRegisterResp resp, UserRegisterReq req){ | |
255 | - if(!userRPC.checkMobile(req.getMobile())){ | |
256 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_MOBILE_EXIST); | |
257 | - } | |
258 | - //验证万能验证码 | |
259 | - String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
260 | - if (req.getVeriCode().equals(passkey)) { | |
261 | - return true; | |
262 | - } | |
263 | - | |
264 | - checkVeriCode(req.getVeriCode(), req.getMobile(),SendVeriCodeReq.MSG_TYPE_REGISTER); | |
265 | - | |
266 | - return true; | |
267 | - } | |
268 | - | |
269 | - /** | |
270 | - * 根据验证码和电话号码,验证收到的验证码 | |
271 | - * | |
272 | - * @param code | |
273 | - * @param mobile | |
274 | - * @return | |
275 | - * @createTime 2014年8月28日 下午5:44:48 | |
276 | - * @author zhangshirui | |
277 | - */ | |
278 | - private void checkVeriCode(String code, String mobile,Integer msgType) { | |
279 | - | |
280 | - String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
281 | - | |
282 | - String redisCode = redisUtil.getString(redisKey); | |
283 | - | |
284 | - if(Validator.isEmpty(code)){ | |
285 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_EMPTY); | |
286 | - } | |
287 | - | |
288 | - //验证码为空 | |
289 | - if (Validator.isEmpty(redisCode)) { | |
290 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_OVERTIME); | |
291 | - } | |
292 | - | |
293 | - //验证码不为空,并且和redis中的验证码相同 | |
294 | - if (!code.equals(redisCode)) { | |
295 | - throw new ServiceException(ResultCode.BUSINESS_FAILED,ErrorMessage.USER_AUTH_CODE_WRONG); | |
296 | - } | |
297 | - | |
298 | - } | |
299 | - | |
300 | - @Override | |
301 | - public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { | |
302 | - return null; | |
303 | - } | |
304 | - | |
305 | - @Override | |
306 | - public UpdateMobileResp updateMobile(UpdateMobileReq req) { | |
307 | - return null; | |
308 | - } | |
309 | - | |
310 | - @Override | |
311 | - public SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req) { | |
312 | - return null; | |
313 | - } | |
314 | - | |
315 | - @Override | |
316 | - public SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req) { | |
317 | - return null; | |
318 | - } | |
319 | - | |
320 | - @Override | |
321 | - public GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req) { | |
322 | - return null; | |
323 | - } | |
324 | - | |
325 | - @Override | |
326 | - public GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req) { | |
327 | - return null; | |
328 | - } | |
329 | - | |
330 | - @Override | |
331 | - public DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req) { | |
332 | - return null; | |
333 | - } | |
334 | - | |
335 | - @Override | |
336 | - public DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req) { | |
337 | - return null; | |
338 | - } | |
339 | - | |
340 | - @Override | |
341 | - public GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req) { | |
342 | - return null; | |
343 | - } | |
344 | - | |
345 | - @Override | |
346 | - public GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req) { | |
347 | - return null; | |
348 | - } | |
349 | - | |
350 | - @Override | |
351 | - public LogoutResp logout(LogoutReq req) { | |
352 | - LogoutResp resp = new LogoutResp(); | |
353 | - | |
354 | - | |
355 | - // 解除绑定极光ID | |
356 | - if(!Validator.isEmpty(req.getRegisterNo())){ | |
357 | - | |
358 | - String userId = req.getUserId().toString(); | |
359 | - //先清缓存再清数据库 | |
360 | - String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_BUYER+userId); | |
361 | - | |
362 | - RegisterNoMapper mapper = new RegisterNoMapper(); | |
363 | - mapper.setRegisterNo(req.getRegisterNo()); | |
364 | - mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
365 | - mapper.setUserid(req.getUserId()); | |
366 | - mapper.setDeviceType(req.getDeviceType()); | |
367 | - try { | |
368 | - redisUtil.deleteByKey(reNOCache); | |
369 | - registerNoMapperManager.unBindRegisterNo(mapper); | |
370 | - } | |
371 | - catch(Exception e) { | |
372 | - logger.error("解除极光推送系统绑定的注册号失败",e); | |
373 | - } | |
374 | - } | |
375 | - | |
376 | - return resp; | |
377 | - } | |
378 | - | |
379 | - @Override | |
380 | - public ModifyPwdResp modifyPwd(ModifyPwdReq req) { | |
381 | - BuyerInfoOutput userInfo = userRPC.getUserByMobile(req.getAccountName()); | |
382 | - Long userId = userInfo.getId(); | |
383 | - | |
384 | - | |
385 | - Map<String,String> params = new HashMap<String, String>(); | |
386 | - params.put("password", req.getPassword()); | |
387 | - params.put("accountId", String.valueOf(userId)); | |
388 | - | |
389 | - | |
390 | - String result = passportRPC.modifyPwd(params); | |
391 | - | |
392 | - JSONObject jsonBody = JSONObject.parseObject(result); | |
393 | - int code = jsonBody.getIntValue("code"); | |
394 | - ModifyPwdResp resp = new ModifyPwdResp(); | |
395 | - resp.setMsg(jsonBody.getString("msg")); | |
396 | - | |
397 | - if(code != ResultCode.SUCCESS){ | |
398 | - //失败 | |
399 | - resp.setCode(ResultCode.BUSINESS_FAILED); | |
400 | - resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); | |
401 | - return resp; | |
402 | - }else { | |
403 | - //修改成功,退出所有账号信息 | |
404 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_BUYER+String.valueOf(userId)); | |
405 | - redisUtil.deleteByKey(cookieRedisKey); | |
406 | - } | |
407 | - | |
408 | - logger.info("修改用户密码"+jsonBody.getString("msg")); | |
409 | - | |
410 | - return resp; | |
411 | - } | |
412 | - | |
413 | - @Override | |
414 | - public GetAuthInfoResp getAuthInfo(GetAuthInfoReq req) { | |
415 | - return null; | |
416 | - } | |
417 | - | |
418 | - @Override | |
419 | - public DelFavoriteInfoResp delFavoriteInfo(DelFavoriteInfoReq req) { | |
420 | - return null; | |
421 | - } | |
422 | - | |
423 | - @Override | |
424 | - public GetFavoriteInfoResp getFavoriteInfo(GetFavoriteInfoReq req) { | |
425 | - return null; | |
426 | - } | |
427 | - | |
428 | - @Override | |
429 | - public AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req) { | |
430 | - return null; | |
431 | - } | |
432 | - | |
433 | - @Override | |
434 | - public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | |
435 | - GetRegisterNoResp resp = new GetRegisterNoResp(); | |
436 | - if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserRole())) { | |
437 | - resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | |
438 | - resp.setMsg("用户ID和用户角色不能为空"); | |
439 | - return resp; | |
440 | - } | |
441 | - //先从缓存取 | |
442 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, req.getUserRole()+String.valueOf(req.getUserId())); | |
443 | - GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
444 | - if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | |
445 | - resp.setRegisterNos(recache.getRegisterNos()); | |
446 | - }else { | |
447 | - List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId()); | |
448 | - if (!Validator.isEmpty(mapppers)) { | |
449 | - | |
450 | - resp.setRegisterNos(mapppers); | |
451 | - redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | |
452 | - }else { | |
453 | - resp.setCode(ResultCode.BUSINESS_FAILED); | |
454 | - resp.setMsg("该用户没有绑定极光号"); | |
455 | - } | |
456 | - } | |
457 | - return resp; | |
458 | - } | |
459 | - | |
460 | - @Override | |
461 | - public GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req) { | |
462 | - GetRegisterNobyUidsResp resp = new GetRegisterNobyUidsResp(); | |
463 | - Map<String, Object> param = new HashMap<String, Object>(); | |
464 | - param.put("userids", req.getUserIds()); | |
465 | - if (!Validator.isNull(req.getPlatform())) { | |
466 | - param.put("device_type",req.getPlatform().toString()); | |
467 | - } | |
468 | - List<RegisterNoMapper> mappers = registerNoMapperManager.batchQuery(param); | |
469 | - | |
470 | - List<RegisterNoPlatform> registerNos = new ArrayList<RegisterNoPlatform>(); | |
471 | - RegisterNoPlatform androidPlatform = new RegisterNoPlatform(); | |
472 | - androidPlatform.setPlatform("android"); | |
473 | - List<String> androids = new ArrayList<String>(); | |
474 | - RegisterNoPlatform iosPlatform = new RegisterNoPlatform(); | |
475 | - iosPlatform.setPlatform("ios"); | |
476 | - List<String> iosids = new ArrayList<String>(); | |
477 | - if (!Validator.isEmpty(mappers)) { | |
478 | - for (RegisterNoMapper registerNoMapper : mappers) { | |
479 | - if (!Validator.isNull(registerNoMapper.getDeviceType())) { | |
480 | - if (registerNoMapper.getDeviceType().equals(1)) { | |
481 | - androids.add(registerNoMapper.getRegisterNo()); | |
482 | - } | |
483 | - if (registerNoMapper.getDeviceType().equals(2)) { | |
484 | - iosids.add(registerNoMapper.getRegisterNo()); | |
485 | - } | |
486 | - } | |
487 | - } | |
488 | - } | |
489 | - androidPlatform.setIds(androids); | |
490 | - iosPlatform.setIds(iosids); | |
491 | - registerNos.add(androidPlatform); | |
492 | - registerNos.add(iosPlatform); | |
493 | - resp.setRegisterNos(registerNos); | |
494 | - resp.setCode(ResultCode.SUCCESS); | |
495 | - return resp; | |
496 | - } | |
497 | - | |
498 | - @Override | |
499 | - public GetMemberListResp getMemberList(GetMemberListReq req) { | |
500 | - return null; | |
501 | - } | |
502 | - | |
503 | - @Override | |
504 | - public UpdateUserInfoResp completeUserInfo(CompleteUserInfoReq req) { | |
505 | - return null; | |
506 | - } | |
507 | - | |
508 | - @Override | |
509 | - public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) { | |
510 | - return null; | |
511 | - } | |
512 | - | |
513 | - @Override | |
514 | - public TradeRecordResp getTradeRecord(TradeRecordReq req) { | |
515 | - return null; | |
516 | - } | |
517 | - | |
518 | - @Override | |
519 | - public SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req) { | |
520 | - return null; | |
521 | - } | |
522 | - | |
523 | - @Override | |
524 | - public LoginResp authlogin(AuthLoginReq req) { | |
525 | - return null; | |
526 | - } | |
118 | + @Resource | |
119 | + private UserRPC userRPC; | |
120 | + @Resource | |
121 | + private GoodsRPC goodsRPC; | |
122 | + @Autowired | |
123 | + private RedisUtilImpl redisUtil; | |
124 | + @Autowired | |
125 | + private UserRedisUtil userRedisUtil; | |
126 | + | |
127 | + @Resource | |
128 | + private RegisterNoMapperManager registerNoMapperManager; | |
129 | + @Resource | |
130 | + private PassportRPC passportRPC; | |
131 | + @Resource | |
132 | + private ConfigRPC configRPC; | |
133 | + | |
134 | + @Resource | |
135 | + private ShopRPC shopRPC; | |
136 | + @Autowired | |
137 | + private MessageRPC messageRPC; | |
138 | + @Resource | |
139 | + private PickInfoRPC pickInfoRPC; | |
140 | + | |
141 | + private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); | |
142 | + | |
143 | + @Override | |
144 | + public LoginResp login(LoginReq req) { | |
145 | + LoginResp resp = (LoginResp) passportRPC.buyerLogin(req); | |
146 | + | |
147 | + if (!Validator.isEmpty(req.getRegisterNo())) { | |
148 | + // 缓存 | |
149 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
150 | + Constant.USER_ROLE_BUYER + String.valueOf(resp.getAccountId())); | |
151 | + | |
152 | + GetRegisterNoResp mappers = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
153 | + // 绑定极光ID | |
154 | + RegisterNoMapper mapper = new RegisterNoMapper(); | |
155 | + mapper.setRegisterNo(req.getRegisterNo()); | |
156 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
157 | + mapper.setUserid(resp.getAccountId()); | |
158 | + mapper.setDeviceType(req.getDeviceType()); | |
159 | + try { | |
160 | + // 清除当前极光号userid缓存 | |
161 | + cleanOldredis(mapper); | |
162 | + // 构建缓存信息 | |
163 | + buildRedisInfo(mappers, mapper); | |
164 | + redisUtil.setObjectByExpire(redisKey, mappers, RedisKey.REGISTERNO_EXPIRE_TIME); | |
165 | + } catch (Exception e) { | |
166 | + throw new ServiceException(ResultCode.PUSH_MESSAGE_NO, "绑定极光推送系统注册号失败"); | |
167 | + } | |
168 | + } | |
169 | + return resp; | |
170 | + } | |
171 | + | |
172 | + /** | |
173 | + * 清除当前极光号下userid缓存 | |
174 | + * | |
175 | + * @param mapper | |
176 | + */ | |
177 | + private void cleanOldredis(RegisterNoMapper mapper) { | |
178 | + RegisterNoMapper oldmapper = registerNoMapperManager.bindRegisterNo(mapper); | |
179 | + if (!Validator.isNull(oldmapper)) { | |
180 | + String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, String.valueOf(oldmapper.getUserid())); | |
181 | + redisUtil.deleteByKey(oldKey); | |
182 | + } | |
183 | + } | |
184 | + | |
185 | + /** | |
186 | + * 建立缓存信息 | |
187 | + * | |
188 | + * @param mappers | |
189 | + * @param mapper | |
190 | + */ | |
191 | + private void buildRedisInfo(GetRegisterNoResp mappers, RegisterNoMapper mapper) { | |
192 | + // 如果缓存没有重新建 | |
193 | + List<RegisterNoMapper> renolist = new ArrayList<RegisterNoMapper>(); | |
194 | + | |
195 | + if (Validator.isNull(mappers)) { | |
196 | + mappers = new GetRegisterNoResp(); | |
197 | + } | |
198 | + renolist.add(mapper); | |
199 | + mappers.setRegisterNos(renolist); | |
200 | + } | |
201 | + | |
202 | + @Override | |
203 | + public CheckUserInvalidResp checkUserInvalid(CheckUserInvalidReq req) { | |
204 | + return null; | |
205 | + } | |
206 | + | |
207 | + @Override | |
208 | + public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { | |
209 | + CheckVeriCodeResp resp = new CheckVeriCodeResp(); | |
210 | + | |
211 | + checkVeriCode(req.getVeriCode(), req.getMobile(), req.getMsgType()); | |
212 | + | |
213 | + return resp; | |
214 | + } | |
215 | + | |
216 | + @Override | |
217 | + public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { | |
218 | + SendVeriCodeResp resp = new SendVeriCodeResp(); | |
219 | + | |
220 | + String mobile = req.getMobile(); | |
221 | + boolean existFlag = !userRPC.checkMobile(mobile); | |
222 | + | |
223 | + Integer msgType = req.getMsgType(); | |
224 | + String code = null; | |
225 | + String message = null; | |
226 | + | |
227 | + String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
228 | + String veriCode = redisUtil.getString(redisKey); | |
229 | + | |
230 | + if (Validator.isEmpty(veriCode)) { | |
231 | + // 生成验证码 | |
232 | + veriCode = PassportUtils.generateMobileRandomNumber(); | |
233 | + redisUtil.setStringByExpire(redisKey, String.valueOf(veriCode), RedisKey.USER_SEND_VERICODE_EXPIRE_TIME); | |
234 | + } | |
235 | + | |
236 | + if (!Validator.isNull(msgType) && msgType != SendVeriCodeReq.MSG_TYPE_DEFAULT) { | |
237 | + if (msgType == SendVeriCodeReq.MSG_TYPE_REGISTER) { | |
238 | + // 注册,电话号码已经存在 | |
239 | + if (existFlag) { | |
240 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
241 | + } | |
242 | + String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
243 | + resp.setPassKey(passkey); | |
244 | + | |
245 | + messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_ACCOUNT_REGISTRATION); | |
246 | + resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
247 | + return resp; | |
248 | + } else if (msgType == SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) { | |
249 | + // 找回密码,电话号码没有存在 | |
250 | + if (!existFlag) { | |
251 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_NOT_EXIST); | |
252 | + } | |
253 | + messageRPC.sendSMSMsg(mobile, veriCode, Constant.SMS_CONTENT_RETRIEVE_PASSWORD); | |
254 | + resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
255 | + return resp; | |
256 | + } else if (msgType == SendVeriCodeReq.MSG_TYPE_MODIFY_NEW_MOBILE) { | |
257 | + // 修改手机号,电话号码已经存在 | |
258 | + if (existFlag) { | |
259 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
260 | + } | |
261 | + code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
262 | + } else if (msgType == SendVeriCodeReq.MSG_TYPE_CHECK_OLD_MOBILE) { | |
263 | + // 验证旧的手机号,手机不存在 | |
264 | + if (!existFlag) { | |
265 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_NOT_EXIST); | |
266 | + } | |
267 | + code = Constant.SMS_CONTENT_MODIFY_OLD_PHONE; | |
268 | + } | |
269 | + DataDictionaryResp dataDic = configRPC.getMessageTemplate(Constant.DIC_SMS_CONTENT); | |
270 | + message = dataDic.getValueByCode(code).getRemark().replace("{code}", veriCode); | |
271 | + } else { | |
272 | + message = Constant.SMS_CONTENT_DEFAULT.replace("{code}", veriCode); | |
273 | + } | |
274 | + | |
275 | + messageRPC.sendSMS(mobile, message); | |
276 | + | |
277 | + resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
278 | + | |
279 | + return resp; | |
280 | + } | |
281 | + | |
282 | + @Override | |
283 | + public UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req) { | |
284 | + return null; | |
285 | + } | |
286 | + | |
287 | + @Override | |
288 | + public CheckAccountNameResp checkAccountName(CheckAccountNameReq req) { | |
289 | + return null; | |
290 | + } | |
291 | + | |
292 | + @Override | |
293 | + public CheckMobileResp checkMobile(CheckMobileReq req) { | |
294 | + return null; | |
295 | + } | |
296 | + | |
297 | + @Override | |
298 | + public UserRegisterResp userRegister(UserRegisterReq req) { | |
299 | + UserRegisterResp resp = new UserRegisterResp(); | |
300 | + | |
301 | + // 手机号码和账号验证、验证码 | |
302 | + // if (!checkRegisterInfo(resp, req)) { | |
303 | + // return resp; | |
304 | + // } | |
305 | + | |
306 | + resp = passportRPC.register(req); | |
307 | + | |
308 | + return resp; | |
309 | + } | |
310 | + | |
311 | + /** | |
312 | + * 检测注册信息是否正确 1.电话号码 2.账号,会员名 3.验证码 | |
313 | + * | |
314 | + * @createTime 2014年10月31日 下午2:37:16 | |
315 | + * @author zhangshirui | |
316 | + */ | |
317 | + private boolean checkRegisterInfo(UserRegisterResp resp, UserRegisterReq req) { | |
318 | + if (!userRPC.checkMobile(req.getMobile())) { | |
319 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_MOBILE_EXIST); | |
320 | + } | |
321 | + // 验证万能验证码 | |
322 | + String passkey = configRPC.getSystemConfig(Constant.USER_REGISTER_PASS_KEY); | |
323 | + if (req.getVeriCode().equals(passkey)) { | |
324 | + return true; | |
325 | + } | |
326 | + | |
327 | + checkVeriCode(req.getVeriCode(), req.getMobile(), SendVeriCodeReq.MSG_TYPE_REGISTER); | |
328 | + | |
329 | + return true; | |
330 | + } | |
331 | + | |
332 | + /** | |
333 | + * 根据验证码和电话号码,验证收到的验证码 | |
334 | + * | |
335 | + * @param code | |
336 | + * @param mobile | |
337 | + * @return | |
338 | + * @createTime 2014年8月28日 下午5:44:48 | |
339 | + * @author zhangshirui | |
340 | + */ | |
341 | + private void checkVeriCode(String code, String mobile, Integer msgType) { | |
342 | + | |
343 | + String redisKey = redisUtil.makeKey(RedisKey.USER_AUTH_CODE + String.valueOf(msgType), mobile); | |
344 | + | |
345 | + String redisCode = redisUtil.getString(redisKey); | |
346 | + | |
347 | + if (Validator.isEmpty(code)) { | |
348 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_AUTH_CODE_EMPTY); | |
349 | + } | |
350 | + | |
351 | + // 验证码为空 | |
352 | + if (Validator.isEmpty(redisCode)) { | |
353 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_AUTH_CODE_OVERTIME); | |
354 | + } | |
355 | + | |
356 | + // 验证码不为空,并且和redis中的验证码相同 | |
357 | + if (!code.equals(redisCode)) { | |
358 | + throw new ServiceException(ResultCode.BUSINESS_FAILED, ErrorMessage.USER_AUTH_CODE_WRONG); | |
359 | + } | |
360 | + | |
361 | + } | |
362 | + | |
363 | + @Override | |
364 | + public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { | |
365 | + return null; | |
366 | + } | |
367 | + | |
368 | + @Override | |
369 | + public UpdateMobileResp updateMobile(UpdateMobileReq req) { | |
370 | + return null; | |
371 | + } | |
372 | + | |
373 | + @Override | |
374 | + public SubmitIdentityAuthResp submitIdentityAuth(SubmitIdentityAuthReq req) { | |
375 | + return null; | |
376 | + } | |
377 | + | |
378 | + @Override | |
379 | + public SubmitEnterpriseAuthResp submitEnterpriseAuth(SubmitEnterpriseAuthReq req) { | |
380 | + return null; | |
381 | + } | |
382 | + | |
383 | + @Override | |
384 | + public GetFavoriteProductResp getFavoriteProducts(GetFavoriteProductReq req) { | |
385 | + return null; | |
386 | + } | |
387 | + | |
388 | + @Override | |
389 | + public GetFavoriteShopResp getFavoriteShop(GetFavoriteShopReq req) { | |
390 | + return null; | |
391 | + } | |
392 | + | |
393 | + @Override | |
394 | + public DelFavoriteShopResp delFavoriteShop(DelFavoriteShopReq req) { | |
395 | + return null; | |
396 | + } | |
397 | + | |
398 | + @Override | |
399 | + public DelFavoriteProductResp delFavoriteProduct(DelFavoriteProductReq req) { | |
400 | + return null; | |
401 | + } | |
402 | + | |
403 | + @Override | |
404 | + public GetIdentityAuthResp getIdentityAuth(GetIdentityAuthReq req) { | |
405 | + return null; | |
406 | + } | |
407 | + | |
408 | + @Override | |
409 | + public GetEnterpriseAuthResp getEnterpriseAuth(GetEnterpriseAuthReq req) { | |
410 | + return null; | |
411 | + } | |
412 | + | |
413 | + @Override | |
414 | + public LogoutResp logout(LogoutReq req) { | |
415 | + LogoutResp resp = new LogoutResp(); | |
416 | + | |
417 | + // 解除绑定极光ID | |
418 | + if (!Validator.isEmpty(req.getRegisterNo())) { | |
419 | + | |
420 | + String userId = req.getUserId().toString(); | |
421 | + // 先清缓存再清数据库 | |
422 | + String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_BUYER + userId); | |
423 | + | |
424 | + RegisterNoMapper mapper = new RegisterNoMapper(); | |
425 | + mapper.setRegisterNo(req.getRegisterNo()); | |
426 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
427 | + mapper.setUserid(req.getUserId()); | |
428 | + mapper.setDeviceType(req.getDeviceType()); | |
429 | + try { | |
430 | + redisUtil.deleteByKey(reNOCache); | |
431 | + registerNoMapperManager.unBindRegisterNo(mapper); | |
432 | + } catch (Exception e) { | |
433 | + logger.error("解除极光推送系统绑定的注册号失败", e); | |
434 | + } | |
435 | + } | |
436 | + | |
437 | + return resp; | |
438 | + } | |
439 | + | |
440 | + @Override | |
441 | + public ModifyPwdResp modifyPwd(ModifyPwdReq req) { | |
442 | + BuyerInfoOutput userInfo = userRPC.getUserByMobile(req.getAccountName()); | |
443 | + Long userId = userInfo.getId(); | |
444 | + | |
445 | + Map<String, String> params = new HashMap<String, String>(); | |
446 | + params.put("password", req.getPassword()); | |
447 | + params.put("accountId", String.valueOf(userId)); | |
448 | + | |
449 | + String result = passportRPC.modifyPwd(params); | |
450 | + | |
451 | + JSONObject jsonBody = JSONObject.parseObject(result); | |
452 | + int code = jsonBody.getIntValue("code"); | |
453 | + ModifyPwdResp resp = new ModifyPwdResp(); | |
454 | + resp.setMsg(jsonBody.getString("msg")); | |
455 | + | |
456 | + if (code != ResultCode.SUCCESS) { | |
457 | + // 失败 | |
458 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
459 | + resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); | |
460 | + return resp; | |
461 | + } else { | |
462 | + // 修改成功,退出所有账号信息 | |
463 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, | |
464 | + Constant.USER_ROLE_BUYER + String.valueOf(userId)); | |
465 | + redisUtil.deleteByKey(cookieRedisKey); | |
466 | + } | |
467 | + | |
468 | + logger.info("修改用户密码" + jsonBody.getString("msg")); | |
469 | + | |
470 | + return resp; | |
471 | + } | |
472 | + | |
473 | + @Override | |
474 | + public GetAuthInfoResp getAuthInfo(GetAuthInfoReq req) { | |
475 | + return null; | |
476 | + } | |
477 | + | |
478 | + @Override | |
479 | + public DelFavoriteInfoResp delFavoriteInfo(DelFavoriteInfoReq req) { | |
480 | + return null; | |
481 | + } | |
482 | + | |
483 | + @Override | |
484 | + public GetFavoriteInfoResp getFavoriteInfo(GetFavoriteInfoReq req) { | |
485 | + return null; | |
486 | + } | |
487 | + | |
488 | + @Override | |
489 | + public AddFavoriteInfoResp addFavoriteInfo(AddFavoriteInfoReq req) { | |
490 | + return null; | |
491 | + } | |
492 | + | |
493 | + @Override | |
494 | + public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | |
495 | + GetRegisterNoResp resp = new GetRegisterNoResp(); | |
496 | + if (Validator.isNull(req.getUserId()) || Validator.isNull(req.getUserRole())) { | |
497 | + resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | |
498 | + resp.setMsg("用户ID和用户角色不能为空"); | |
499 | + return resp; | |
500 | + } | |
501 | + // 先从缓存取 | |
502 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
503 | + req.getUserRole() + String.valueOf(req.getUserId())); | |
504 | + GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
505 | + if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | |
506 | + resp.setRegisterNos(recache.getRegisterNos()); | |
507 | + } else { | |
508 | + List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserId()); | |
509 | + if (!Validator.isEmpty(mapppers)) { | |
510 | + | |
511 | + resp.setRegisterNos(mapppers); | |
512 | + redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | |
513 | + } else { | |
514 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
515 | + resp.setMsg("该用户没有绑定极光号"); | |
516 | + } | |
517 | + } | |
518 | + return resp; | |
519 | + } | |
520 | + | |
521 | + @Override | |
522 | + public GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req) { | |
523 | + GetRegisterNobyUidsResp resp = new GetRegisterNobyUidsResp(); | |
524 | + Map<String, Object> param = new HashMap<String, Object>(); | |
525 | + param.put("userids", req.getUserIds()); | |
526 | + if (!Validator.isNull(req.getPlatform())) { | |
527 | + param.put("device_type", req.getPlatform().toString()); | |
528 | + } | |
529 | + List<RegisterNoMapper> mappers = registerNoMapperManager.batchQuery(param); | |
530 | + | |
531 | + List<RegisterNoPlatform> registerNos = new ArrayList<RegisterNoPlatform>(); | |
532 | + RegisterNoPlatform androidPlatform = new RegisterNoPlatform(); | |
533 | + androidPlatform.setPlatform("android"); | |
534 | + List<String> androids = new ArrayList<String>(); | |
535 | + RegisterNoPlatform iosPlatform = new RegisterNoPlatform(); | |
536 | + iosPlatform.setPlatform("ios"); | |
537 | + List<String> iosids = new ArrayList<String>(); | |
538 | + if (!Validator.isEmpty(mappers)) { | |
539 | + for (RegisterNoMapper registerNoMapper : mappers) { | |
540 | + if (!Validator.isNull(registerNoMapper.getDeviceType())) { | |
541 | + if (registerNoMapper.getDeviceType().equals(1)) { | |
542 | + androids.add(registerNoMapper.getRegisterNo()); | |
543 | + } | |
544 | + if (registerNoMapper.getDeviceType().equals(2)) { | |
545 | + iosids.add(registerNoMapper.getRegisterNo()); | |
546 | + } | |
547 | + } | |
548 | + } | |
549 | + } | |
550 | + androidPlatform.setIds(androids); | |
551 | + iosPlatform.setIds(iosids); | |
552 | + registerNos.add(androidPlatform); | |
553 | + registerNos.add(iosPlatform); | |
554 | + resp.setRegisterNos(registerNos); | |
555 | + resp.setCode(ResultCode.SUCCESS); | |
556 | + return resp; | |
557 | + } | |
558 | + | |
559 | + @Override | |
560 | + public GetMemberListResp getMemberList(GetMemberListReq req) { | |
561 | + return null; | |
562 | + } | |
563 | + | |
564 | + @Override | |
565 | + public UpdateUserInfoResp completeUserInfo(CompleteUserInfoReq req) { | |
566 | + return null; | |
567 | + } | |
568 | + | |
569 | + @Override | |
570 | + public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) { | |
571 | + return null; | |
572 | + } | |
573 | + | |
574 | + @Override | |
575 | + public TradeRecordResp getTradeRecord(TradeRecordReq req) { | |
576 | + return null; | |
577 | + } | |
578 | + | |
579 | + @Override | |
580 | + public SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req) { | |
581 | + return null; | |
582 | + } | |
583 | + | |
584 | + @Override | |
585 | + public LoginResp authlogin(AuthLoginReq req) { | |
586 | + return null; | |
587 | + } | |
588 | + | |
589 | + @Override | |
590 | + public GetDeliveryAddressResp getDeliveryAddresses(GetDeliveryAddressReq req) { | |
591 | + PickingInfoOutput response = this.pickInfoRPC.getDefaultPickingInfoByBuyerId(req.getShopBuyerId()); | |
592 | + if (response == null) { | |
593 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取默认收货地址失败"); | |
594 | + } | |
595 | + GetDeliveryAddressResp resp = new GetDeliveryAddressResp(); | |
596 | + PickInfo pickInfo = new PickInfo(); | |
597 | + pickInfo.setCityAddress(response.getAddressText()); | |
598 | + pickInfo.setCityId(response.getAddressId()); | |
599 | + pickInfo.setIsDefault(response.getDef()); | |
600 | + pickInfo.setMobile(response.getTelphone()); | |
601 | + pickInfo.setName(response.getName()); | |
602 | + pickInfo.setStreetAddress(response.getAddressDetail()); | |
603 | + resp.setPickInfo(pickInfo); | |
604 | + return resp; | |
605 | + } | |
527 | 606 | } | ... | ... |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/user/UserController.java
... | ... | @@ -21,12 +21,13 @@ import org.springframework.web.bind.annotation.ResponseBody; |
21 | 21 | import javax.annotation.Resource; |
22 | 22 | import javax.servlet.http.HttpServletRequest; |
23 | 23 | |
24 | - | |
25 | 24 | /** |
26 | 25 | * <B>Description</B> 用户Controller <br /> |
27 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
26 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
27 | + * <br /> | |
28 | 28 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
29 | 29 | * <B>Company</B> 地利集团 |
30 | + * | |
30 | 31 | * @createTime 2014年8月24日 下午10:53:27 |
31 | 32 | * @author weili |
32 | 33 | */ |
... | ... | @@ -34,492 +35,513 @@ import javax.servlet.http.HttpServletRequest; |
34 | 35 | @RequestMapping("/mobsiteApp/user") |
35 | 36 | @Api(value = "/mobsiteApp-user", description = "用户接口-买家") |
36 | 37 | public class UserController extends BaseApiController { |
37 | - | |
38 | - @Resource | |
39 | - private UserService userService; | |
40 | - | |
41 | - private final Logger LOGGER = Logger.getLogger(UserController.class); | |
42 | - | |
43 | - /** | |
44 | - * 买家登录 | |
45 | - * @createTime 2014年8月24日 下午10:55:03 | |
46 | - * @author weili | |
47 | - */ | |
48 | - @ApiOperation(value = "买家登录", httpMethod = "POST",response = LoginResp.class) | |
49 | - @RequestMapping(value = "/buyerLogin",method = RequestMethod.POST) | |
50 | - @ResponseBody | |
51 | - public void buyerLogin(HttpServletRequest request,@RequestBody LoginReq temp ){ | |
52 | - LoginReq req = super.getRequest(LoginReq.class); | |
53 | - try { | |
54 | - BeanValidator.validator(req); | |
55 | - LoginResp resp = userService.login(req); | |
56 | - super.sendSuccessResp(resp); | |
57 | - LOGGER.info(String.format("用户登陆:[ 设备id<%s>用户名<%s>用户id<%s>ip<%s> ]" | |
58 | - , req.getDeviceId(), req.getAccountName(), req.getUserId(), request.getRemoteAddr())); | |
59 | - } catch (ServiceException e){ | |
60 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
61 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
62 | - super.sendError(e.getCode(), e.getMessage()); | |
63 | - } catch (Exception e) { | |
64 | - LOGGER.error("用户登录失败:", e); | |
65 | - super.sendError(e.getMessage()); | |
66 | - } | |
67 | - } | |
68 | - | |
69 | - | |
70 | - /** | |
71 | - * 加密用户登录(加密) | |
72 | - * @createTime 2014年8月24日 下午10:55:03 | |
73 | - * @author weili | |
74 | - */ | |
75 | - @ApiOperation(value = "买家登录", httpMethod = "POST",response = LoginResp.class) | |
76 | - @RequestMapping(value = "/buyerLogins",method = RequestMethod.POST) | |
77 | - @ResponseBody | |
78 | - public void buyerLogins(@RequestBody LoginReq temp){ | |
79 | - LoginReq req = super.getRequest(LoginReq.class); | |
80 | - try { | |
81 | - BeanValidator.validator(req); | |
82 | - req.setPassword(decodeStr(req.getPassword())); | |
83 | - LoginResp resp = userService.login(req); | |
84 | - super.sendSuccessResp(resp); | |
85 | - } catch (ServiceException e){ | |
86 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
87 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
88 | - super.sendError(e.getCode(), e.getMessage()); | |
89 | - } catch (Exception e) { | |
90 | - LOGGER.error("用户登录失败:", e); | |
91 | - super.sendError(e.getMessage()); | |
92 | - } | |
93 | - } | |
94 | - | |
95 | - /** | |
96 | - * 验证码登录 | |
97 | - * @createTime 2014年8月24日 下午10:55:03 | |
98 | - * @author weili | |
99 | - */ | |
100 | - @ApiOperation(value = "买家验证码登录", httpMethod = "POST" , notes = "买家验证码登录",response = LoginResp.class) | |
101 | - @RequestMapping(value = "/loginForAuth",method = RequestMethod.POST) | |
102 | - @ResponseBody | |
103 | - public void loginForAuth(@RequestBody AuthLoginReq temp){ | |
104 | - AuthLoginReq req = super.getRequest(AuthLoginReq.class); | |
105 | - try { | |
106 | - BeanValidator.validator(req); | |
107 | - LoginResp resp = userService.authlogin(req); | |
108 | - super.sendSuccessResp(resp); | |
109 | - } catch (ServiceException e){ | |
110 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
111 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
112 | - super.sendError(e.getCode(), e.getMessage()); | |
113 | - } catch (Exception e) { | |
114 | - LOGGER.error("用户登录失败:", e); | |
115 | - super.sendError(e.getMessage()); | |
116 | - } | |
117 | - } | |
118 | - | |
119 | - ///** | |
120 | - // * 找回密码:验证用户名是否可用 | |
121 | - // * @createTime 2014年8月24日 下午10:55:03 | |
122 | - // * @author weili | |
123 | - // */ | |
124 | - //@ApiOperation(value = "买家登录", httpMethod = "POST" , notes = "买家登录",response = LoginResp.class) | |
125 | - //@RequestMapping(value = "/checkUserInvalid",method = RequestMethod.POST) | |
126 | - //@ResponseBody | |
127 | - //public void checkUserInvalid(){ | |
128 | - // CheckUserInvalidReq req= super.getRequest(CheckUserInvalidReq.class); | |
129 | - // try { | |
130 | - // CheckUserInvalidResp resp = userService.checkUserInvalid(req); | |
131 | - // super.sendSuccessResp(resp); | |
132 | - // } catch (ServiceException e){ | |
133 | - // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
134 | - // e.getCode(), e.getMessage(), req.getUserId()), e); | |
135 | - // sendError(e.getCode(), e.getMessage()); | |
136 | - // } catch (Exception e) { | |
137 | - // LOGGER.error("验证用户名失败:", e); | |
138 | - // super.sendError(e.getMessage()); | |
139 | - // } | |
140 | - //} | |
141 | - | |
142 | - /** | |
143 | - * 发送验证码到手机 | |
144 | - * @createTime 2014年8月24日 下午10:55:03 | |
145 | - * @author weili | |
146 | - */ | |
147 | - @ApiOperation(value = "发送验证码到手机", httpMethod = "POST" , notes = "发送验证码到手机",response = SendVeriCodeResp.class) | |
148 | - @RequestMapping(value = "/sendAuthCode",method = RequestMethod.POST) | |
149 | - @ResponseBody | |
150 | - public void sendAuthCode(@RequestBody SendVeriCodeReq temp){ | |
151 | - SendVeriCodeReq req= super.getRequest(SendVeriCodeReq.class); | |
152 | - try { | |
153 | - BeanValidator.validator(req); | |
154 | - SendVeriCodeResp resp = userService.sendVeriCode(req); | |
155 | - super.sendSuccessResp(resp); | |
156 | - } catch (ServiceException e){ | |
157 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
158 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
159 | - sendError(e.getMessage()); | |
160 | - } catch (Exception e) { | |
161 | - LOGGER.error("发送验证码失败:", e); | |
162 | - super.sendError(e.getMessage()); | |
163 | - } | |
164 | - } | |
165 | - | |
166 | - /** | |
167 | - * 忘记密码:验证手机收到的验证码 | |
168 | - * @createTime 2014年8月24日 下午10:55:03 | |
169 | - * @author weili | |
170 | - */ | |
171 | - @ApiOperation(value = "忘记密码:验证手机号和验证码", httpMethod = "POST" , notes = "验证手机收到的验证码",response = CheckVeriCodeResp.class) | |
172 | - @RequestMapping(value = "/checkAuthCode",method = RequestMethod.POST) | |
173 | - @ResponseBody | |
174 | - public void checkAuthCode(@RequestBody CheckVeriCodeReq temp){ | |
175 | - CheckVeriCodeReq req= super.getRequest(CheckVeriCodeReq.class); | |
176 | - try { | |
177 | - BeanValidator.validator(req); | |
178 | - CheckVeriCodeResp resp = userService.checkVeriCode(req); | |
179 | - super.sendSuccessResp(resp); | |
180 | - } catch (ServiceException e){ | |
181 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
182 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
183 | - sendError(e.getCode(), e.getMessage()); | |
184 | - } catch (Exception e) { | |
185 | - LOGGER.error("验证手机收到的验证码:", e); | |
186 | - super.sendError(e.getMessage()); | |
187 | - } | |
188 | - } | |
189 | - | |
190 | - | |
191 | - /** | |
192 | - * 找回密码-修改用户密码 | |
193 | - * @createTime 2014年8月24日 下午10:55:03 | |
194 | - * @author weili | |
195 | - */ | |
196 | - @ApiOperation(value = "找回密码-设置用户新密码", httpMethod = "POST" ,response = SendVeriCodeResp.class) | |
197 | - @RequestMapping(value = "/modifyPwd",method = RequestMethod.POST) | |
198 | - @ResponseBody | |
199 | - public void modifyPwd(@RequestBody ModifyPwdReq temp){ | |
200 | - ModifyPwdReq req = super.getRequest(ModifyPwdReq.class); | |
201 | - ModifyPwdResp resp = null; | |
202 | - try { | |
203 | - BeanValidator.validator(req); | |
204 | - resp = userService.modifyPwd(req); | |
205 | - super.sendSuccessResp(resp); | |
206 | - } catch (ServiceException e){ | |
207 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
208 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
209 | - sendError(e.getCode(), e.getMessage()); | |
210 | - } catch (Exception e) { | |
211 | - LOGGER.error("修改密码:", e); | |
212 | - super.sendError(e.getMessage()); | |
213 | - } | |
214 | - | |
215 | - } | |
216 | - | |
217 | - /** | |
218 | - * 买家注册 | |
219 | - * @createTime 2014年8月28日 下午3:41:02 | |
220 | - * @author weili | |
221 | - */ | |
222 | - @ApiOperation(value = "买家注册", httpMethod = "POST" ,response = UserRegisterResp.class) | |
223 | - @RequestMapping(value = "/buyerRegister",method = RequestMethod.POST) | |
224 | - @ResponseBody | |
225 | - public void buyerRegister(@RequestBody UserRegisterReq temp){ | |
226 | - UserRegisterReq req = super.getRequest(UserRegisterReq.class); | |
227 | - try { | |
228 | - BeanValidator.validator(req); | |
229 | - UserRegisterResp resp = userService.userRegister(req); | |
230 | - super.sendSuccessResp(resp); | |
231 | - } catch (ServiceException e){ | |
232 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
233 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
234 | - sendError(e.getCode(), e.getMessage()); | |
235 | - } catch (Exception e) { | |
236 | - LOGGER.error("用户注册失败:", e); | |
237 | - super.sendError(e.getMessage()); | |
238 | - } | |
239 | - } | |
240 | - | |
241 | - /** | |
242 | - * 买家注册(加密) | |
243 | - * @createTime 2014年8月28日 下午3:41:02 | |
244 | - * @author weili | |
245 | - */ | |
246 | - @ApiOperation(value = "买家注册", httpMethod = "POST" ,response = UserRegisterResp.class) | |
247 | - @RequestMapping(value = "/buyerRegisters",method = RequestMethod.POST) | |
248 | - @ResponseBody | |
249 | - public void buyerRegisters(@RequestBody UserRegisterReq temp){ | |
250 | - UserRegisterReq req = super.getRequest(UserRegisterReq.class); | |
251 | - try { | |
252 | - BeanValidator.validator(req); | |
253 | - req.setPassword(decodeStr(req.getPassword())); | |
254 | - UserRegisterResp resp = userService.userRegister(req); | |
255 | - super.sendSuccessResp(resp); | |
256 | - } catch (ServiceException e){ | |
257 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
258 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
259 | - sendError(e.getCode(), e.getMessage()); | |
260 | - } catch (Exception e) { | |
261 | - LOGGER.error("用户注册失败:", e); | |
262 | - super.sendError(e.getMessage()); | |
263 | - } | |
264 | - } | |
265 | - | |
266 | - /** | |
267 | - * 退出操作 | |
268 | - * | |
269 | - * @createTime 2014年8月29日 上午9:30:10 | |
270 | - * @author weili | |
271 | - */ | |
272 | - @ApiOperation(value = "退出", httpMethod = "POST" ,response = LogoutResp.class) | |
273 | - @RequestMapping(value = "/logout",method = RequestMethod.POST) | |
274 | - @ResponseBody | |
275 | - public void logout(@RequestBody LogoutReq temp){ | |
276 | - LogoutReq req = super.getRequest(LogoutReq.class); | |
277 | - try { | |
278 | - if(Validator.isNull(req) || !Validator.isNumber(req.getUserId()+"")) { | |
279 | - throw new NullPointerException("参数传递错误"); | |
280 | - } | |
281 | - LogoutResp resp = userService.logout(req); | |
282 | - super.sendSuccessResp(resp); | |
283 | - } catch (ServiceException e){ | |
284 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
285 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
286 | - sendError(e.getCode(), e.getMessage()); | |
287 | - } | |
288 | - catch (Exception e) { | |
289 | - LOGGER.error("用户退出失败:", e); | |
290 | - super.sendError(e.getMessage()); | |
291 | - } | |
292 | - } | |
293 | - | |
294 | - /** | |
295 | - * 个人信息维护 | |
296 | - * @createTime 2016年8月24日 下午10:55:03 | |
297 | - * @author weili | |
298 | - */ | |
299 | - @ApiOperation(value = "个人信息维护", httpMethod = "POST" ,response = UpdateUserInfoResp.class) | |
300 | - @RequestMapping(value = "/updateUserInfo",method = RequestMethod.POST) | |
301 | - @ResponseBody | |
302 | - public void updateUserInfo(@RequestBody UpdateUserInfoReq temp){ | |
303 | - UpdateUserInfoReq req = super.getRequest(UpdateUserInfoReq.class); | |
304 | - try { | |
305 | - UpdateUserInfoResp resp = userService.updateUserInfo(req); | |
306 | - super.sendSuccessResp(resp); | |
307 | - } catch (ServiceException e){ | |
308 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
309 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
310 | - sendError(e.getCode(), e.getMessage()); | |
311 | - } catch (Exception e) { | |
312 | - LOGGER.error("个人信息维护:", e); | |
313 | - super.sendError(e.getMessage()); | |
314 | - } | |
315 | - | |
316 | - } | |
317 | - | |
318 | - | |
319 | - /** | |
320 | - * 查看储值卡余额 | |
321 | - * @createTime 2016年8月24日 下午10:55:03 | |
322 | - * @author weili | |
323 | - */ | |
324 | - @ApiOperation(value = "查看储值卡余额", httpMethod = "POST" ,response = GetDepositCardAmountResp.class) | |
325 | - @RequestMapping(value = "/getDepositCardAmount",method = RequestMethod.POST) | |
326 | - @ResponseBody | |
327 | - public void getDepositCardAmount(){ | |
328 | - GetDepositCardAmountReq req = super.getRequest(GetDepositCardAmountReq.class); | |
329 | - try { | |
330 | - GetDepositCardAmountResp resp = userService.getDepositCardAmount(req); | |
331 | - super.sendSuccessResp(resp); | |
332 | - } catch (ServiceException e){ | |
333 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
334 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
335 | - sendError(e.getCode(), e.getMessage()); | |
336 | - } catch (Exception e) { | |
337 | - LOGGER.error("个人信息维护:", e); | |
338 | - super.sendError(e.getMessage()); | |
339 | - } | |
340 | - | |
341 | - } | |
342 | - | |
343 | - | |
344 | - /** | |
345 | - * 查询用户信息 | |
346 | - * GetUserInfoReq | |
347 | - */ | |
348 | - @ApiOperation(value = "查询买家用户信息", httpMethod = "POST" ,response = GetDepositCardAmountResp.class) | |
349 | - @RequestMapping(value = "/getBuyerInfo",method = RequestMethod.POST) | |
350 | - @ResponseBody | |
351 | - public void getBuyerInfo() { | |
352 | - GetUserInfoReq req = getRequest(GetUserInfoReq.class); | |
353 | - try { | |
354 | - GetUserInfoResp resp = userService.getUserIntroduction(req); | |
355 | - super.sendSuccessResp(resp); | |
356 | - } catch (ServiceException e){ | |
357 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
358 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
359 | - sendError(e.getCode(), e.getMessage()); | |
360 | - } catch (Exception e) { | |
361 | - LOGGER.error(String.format("ErrorMessage=%s,UserId=%s", e.getMessage(), req.getUserId()), e); | |
362 | - sendError(e.getMessage()); | |
363 | - } | |
364 | - } | |
365 | - | |
366 | - | |
367 | - /** | |
368 | - * 搜索买家用户信息 | |
369 | - * GetUserInfoReq | |
370 | - */ | |
371 | - @ApiOperation(value = "搜索买家用户信息", httpMethod = "POST" ,response = SearchUserInfoResp.class) | |
372 | - @RequestMapping(value = "/searchBuyerInfo",method = RequestMethod.POST) | |
373 | - @ResponseBody | |
374 | - public void searchBuyerInfo(@RequestBody SearchUserInfoReq temp) { | |
375 | - SearchUserInfoReq req = getRequest(SearchUserInfoReq.class); | |
376 | - try { | |
377 | - SearchUserInfoResp resp = userService.searchBuyerInfo(req); | |
378 | - super.sendSuccessResp(resp); | |
379 | - } catch (ServiceException e){ | |
380 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
381 | - e.getCode(), e.getMessage(), req.getUserId()), e); | |
382 | - sendError(e.getCode(), e.getMessage()); | |
383 | - } catch (Exception e) { | |
384 | - LOGGER.error(String.format("ErrorMessage=%s,UserId=%s", e.getMessage(), req.getUserId()), e); | |
385 | - sendError(e.getMessage()); | |
386 | - } | |
387 | - } | |
388 | - | |
389 | - | |
390 | - /** | |
391 | - * 查询极光推送号 | |
392 | - * | |
393 | - * getRegisterNo | |
394 | - */ | |
395 | - @ApiOperation(value = "查询极光推送号", httpMethod = "POST" ,response = GetRegisterNoResp.class) | |
396 | - @RequestMapping(value = "/getRegisterNo",method = RequestMethod.POST) | |
397 | - @ResponseBody | |
398 | - public void getRegisterNo(@RequestBody GetRegisterNoReq temp) { | |
399 | - GetRegisterNoReq req = getRequest(GetRegisterNoReq.class); | |
400 | - try { | |
401 | - GetRegisterNoResp resp = userService.getRegisterNo(req); | |
402 | - sendSuccessResp(resp); | |
403 | - } catch (ServiceException e){ | |
404 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s", | |
405 | - e.getCode(), e.getMessage()), e); | |
406 | - sendError(e.getCode(), e.getMessage()); | |
407 | - } catch (Exception e) { | |
408 | - LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
409 | - sendError(e.getMessage()); | |
410 | - } | |
411 | - } | |
412 | - | |
413 | - /** | |
414 | - * 批量查询极光推送号 | |
415 | - * | |
416 | - * getNosByUserids | |
417 | - */ | |
418 | - @ApiOperation(value = "批量查询极光推送号", httpMethod = "POST" ,response = GetRegisterNobyUidsResp.class) | |
419 | - @RequestMapping(value = "/getRegisterNobyUids",method = RequestMethod.POST) | |
420 | - @ResponseBody | |
421 | - public void getRegisterNobyUids(@RequestBody GetRegisterNobyUidsReq temp) { | |
422 | - GetRegisterNobyUidsReq req = getRequest(GetRegisterNobyUidsReq.class); | |
423 | - try { | |
424 | - GetRegisterNobyUidsResp resp = userService.getRegisterNobyUids(req); | |
425 | - sendSuccessResp(resp); | |
426 | - } catch (ServiceException e){ | |
427 | - LOGGER.error(String.format("Code=%s,ErrorMessage=%s", | |
428 | - e.getCode(), e.getMessage()), e); | |
429 | - sendError(e.getCode(), e.getMessage()); | |
430 | - } catch (Exception e) { | |
431 | - LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
432 | - sendError(e.getMessage()); | |
433 | - } | |
434 | - } | |
435 | - | |
436 | - | |
437 | - ///** | |
438 | - // * 查看交易记录 | |
439 | - // * @createTime 2016年8月24日 下午10:55:03 | |
440 | - // * @author weili | |
441 | - // */ | |
442 | - //@ApiOperation(value = "查看交易记录", httpMethod = "POST" ,response = TradeRecordResp.class) | |
443 | - //@RequestMapping(value = "/getTradeRecord",method = RequestMethod.POST) | |
444 | - //@ResponseBody | |
445 | - //public void getTradeRecord(){ | |
446 | - // TradeRecordReq req = super.getRequest(TradeRecordReq.class); | |
447 | - // try { | |
448 | - // TradeRecordResp resp = userService.getTradeRecord(req); | |
449 | - // super.sendSuccessResp(resp); | |
450 | - // } catch (ServiceException e){ | |
451 | - // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
452 | - // e.getCode(), e.getMessage(), req.getUserId()), e); | |
453 | - // sendError(e.getCode(), e.getMessage()); | |
454 | - // } catch (Exception e) { | |
455 | - // LOGGER.error("查看交易记录:", e); | |
456 | - // super.sendError(e.getMessage()); | |
457 | - // } | |
458 | - // | |
459 | - //} | |
460 | - | |
461 | - ///** | |
462 | - // * 验证用户账号是否可用 | |
463 | - // * @createTime 2014年8月28日 下午3:41:02 | |
464 | - // * @author weili | |
465 | - // */ | |
466 | - //@RequestMapping("/checkAccountName") | |
467 | - //@ResponseBody | |
468 | - //public void checkAccountName(){ | |
469 | - // CheckAccountNameReq req = super.getRequest(CheckAccountNameReq.class); | |
470 | - // CheckAccountNameResp resp = null; | |
471 | - // try { | |
472 | - // if(!Validator.isNull(req) && !Validator.isNull(req.getAccountName())){ | |
473 | - // resp = userService.checkAccountName(req); | |
474 | - // } | |
475 | - // else { | |
476 | - // resp = new CheckAccountNameResp(); | |
477 | - // } | |
478 | - // super.sendSuccessResp(resp); | |
479 | - // } catch (ServiceException e){ | |
480 | - // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
481 | - // e.getCode(), e.getMessage(), req.getUserId()), e); | |
482 | - // sendError(e.getCode(), e.getMessage()); | |
483 | - // } catch (Exception e) { | |
484 | - // LOGGER.error("验证用户账号失败:", e); | |
485 | - // super.sendError(e.getMessage()); | |
486 | - // } | |
487 | - //} | |
488 | - // | |
489 | - | |
490 | - /** | |
491 | - * 验证手机号是否已经被注册 | |
492 | - * @createTime 2014年8月28日 下午3:41:02 | |
493 | - * @author weili | |
494 | - */ | |
495 | - //@RequestMapping("/checkMobile") | |
496 | - //@ResponseBody | |
497 | - //@ApiOperation(value = "", httpMethod = "POST") | |
498 | - //public void checkMobile(){ | |
499 | - // CheckMobileReq req = super.getRequest(CheckMobileReq.class); | |
500 | - // CheckMobileResp resp = null; | |
501 | - // try { | |
502 | - // if(!Validator.isNull(req) && !Validator.isNull(req.getMobile())){ | |
503 | - // resp = userService.checkMobile(req); | |
504 | - // } else { | |
505 | - // resp = new CheckMobileResp(); | |
506 | - // } | |
507 | - // super.sendSuccessResp(resp); | |
508 | - // } catch (ServiceException e){ | |
509 | - // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
510 | - // e.getCode(), e.getMessage(), req.getUserId()), e); | |
511 | - // sendError(e.getCode(), e.getMessage()); | |
512 | - // } catch (Exception e) { | |
513 | - // LOGGER.error("验证手机失败:", e); | |
514 | - // super.sendError(e.getMessage()); | |
515 | - // } | |
516 | - //} | |
517 | - | |
518 | - | |
519 | - | |
520 | - | |
521 | - | |
522 | - | |
523 | 38 | |
39 | + @Resource | |
40 | + private UserService userService; | |
41 | + | |
42 | + private final Logger LOGGER = Logger.getLogger(UserController.class); | |
43 | + | |
44 | + /** | |
45 | + * 买家登录 | |
46 | + * | |
47 | + * @createTime 2014年8月24日 下午10:55:03 | |
48 | + * @author weili | |
49 | + */ | |
50 | + @ApiOperation(value = "买家登录", httpMethod = "POST", response = LoginResp.class) | |
51 | + @RequestMapping(value = "/buyerLogin", method = RequestMethod.POST) | |
52 | + @ResponseBody | |
53 | + public void buyerLogin(HttpServletRequest request, @RequestBody LoginReq temp) { | |
54 | + LoginReq req = super.getRequest(LoginReq.class); | |
55 | + try { | |
56 | + BeanValidator.validator(req); | |
57 | + LoginResp resp = userService.login(req); | |
58 | + super.sendSuccessResp(resp); | |
59 | + LOGGER.info(String.format("用户登陆:[ 设备id<%s>用户名<%s>用户id<%s>ip<%s> ]", req.getDeviceId(), req.getAccountName(), | |
60 | + req.getUserId(), request.getRemoteAddr())); | |
61 | + } catch (ServiceException e) { | |
62 | + LOGGER.error( | |
63 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
64 | + e); | |
65 | + super.sendError(e.getCode(), e.getMessage()); | |
66 | + } catch (Exception e) { | |
67 | + LOGGER.error("用户登录失败:", e); | |
68 | + super.sendError(e.getMessage()); | |
69 | + } | |
70 | + } | |
71 | + | |
72 | + /** | |
73 | + * 加密用户登录(加密) | |
74 | + * | |
75 | + * @createTime 2014年8月24日 下午10:55:03 | |
76 | + * @author weili | |
77 | + */ | |
78 | + @ApiOperation(value = "买家登录", httpMethod = "POST", response = LoginResp.class) | |
79 | + @RequestMapping(value = "/buyerLogins", method = RequestMethod.POST) | |
80 | + @ResponseBody | |
81 | + public void buyerLogins(@RequestBody LoginReq temp) { | |
82 | + LoginReq req = super.getRequest(LoginReq.class); | |
83 | + try { | |
84 | + BeanValidator.validator(req); | |
85 | + req.setPassword(decodeStr(req.getPassword())); | |
86 | + LoginResp resp = userService.login(req); | |
87 | + super.sendSuccessResp(resp); | |
88 | + } catch (ServiceException e) { | |
89 | + LOGGER.error( | |
90 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
91 | + e); | |
92 | + super.sendError(e.getCode(), e.getMessage()); | |
93 | + } catch (Exception e) { | |
94 | + LOGGER.error("用户登录失败:", e); | |
95 | + super.sendError(e.getMessage()); | |
96 | + } | |
97 | + } | |
98 | + | |
99 | + /** | |
100 | + * 验证码登录 | |
101 | + * | |
102 | + * @createTime 2014年8月24日 下午10:55:03 | |
103 | + * @author weili | |
104 | + */ | |
105 | + @ApiOperation(value = "买家验证码登录", httpMethod = "POST", notes = "买家验证码登录", response = LoginResp.class) | |
106 | + @RequestMapping(value = "/loginForAuth", method = RequestMethod.POST) | |
107 | + @ResponseBody | |
108 | + public void loginForAuth(@RequestBody AuthLoginReq temp) { | |
109 | + AuthLoginReq req = super.getRequest(AuthLoginReq.class); | |
110 | + try { | |
111 | + BeanValidator.validator(req); | |
112 | + LoginResp resp = userService.authlogin(req); | |
113 | + super.sendSuccessResp(resp); | |
114 | + } catch (ServiceException e) { | |
115 | + LOGGER.error( | |
116 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
117 | + e); | |
118 | + super.sendError(e.getCode(), e.getMessage()); | |
119 | + } catch (Exception e) { | |
120 | + LOGGER.error("用户登录失败:", e); | |
121 | + super.sendError(e.getMessage()); | |
122 | + } | |
123 | + } | |
124 | + | |
125 | + /// ** | |
126 | + // * 找回密码:验证用户名是否可用 | |
127 | + // * @createTime 2014年8月24日 下午10:55:03 | |
128 | + // * @author weili | |
129 | + // */ | |
130 | + // @ApiOperation(value = "买家登录", httpMethod = "POST" , notes = | |
131 | + /// "买家登录",response = LoginResp.class) | |
132 | + // @RequestMapping(value = "/checkUserInvalid",method = RequestMethod.POST) | |
133 | + // @ResponseBody | |
134 | + // public void checkUserInvalid(){ | |
135 | + // CheckUserInvalidReq req= super.getRequest(CheckUserInvalidReq.class); | |
136 | + // try { | |
137 | + // CheckUserInvalidResp resp = userService.checkUserInvalid(req); | |
138 | + // super.sendSuccessResp(resp); | |
139 | + // } catch (ServiceException e){ | |
140 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
141 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
142 | + // sendError(e.getCode(), e.getMessage()); | |
143 | + // } catch (Exception e) { | |
144 | + // LOGGER.error("验证用户名失败:", e); | |
145 | + // super.sendError(e.getMessage()); | |
146 | + // } | |
147 | + // } | |
148 | + | |
149 | + /** | |
150 | + * 发送验证码到手机 | |
151 | + * | |
152 | + * @createTime 2014年8月24日 下午10:55:03 | |
153 | + * @author weili | |
154 | + */ | |
155 | + @ApiOperation(value = "发送验证码到手机", httpMethod = "POST", notes = "发送验证码到手机", response = SendVeriCodeResp.class) | |
156 | + @RequestMapping(value = "/sendAuthCode", method = RequestMethod.POST) | |
157 | + @ResponseBody | |
158 | + public void sendAuthCode(@RequestBody SendVeriCodeReq temp) { | |
159 | + SendVeriCodeReq req = super.getRequest(SendVeriCodeReq.class); | |
160 | + try { | |
161 | + BeanValidator.validator(req); | |
162 | + SendVeriCodeResp resp = userService.sendVeriCode(req); | |
163 | + super.sendSuccessResp(resp); | |
164 | + } catch (ServiceException e) { | |
165 | + LOGGER.error( | |
166 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
167 | + e); | |
168 | + sendError(e.getMessage()); | |
169 | + } catch (Exception e) { | |
170 | + LOGGER.error("发送验证码失败:", e); | |
171 | + super.sendError(e.getMessage()); | |
172 | + } | |
173 | + } | |
174 | + | |
175 | + /** | |
176 | + * 忘记密码:验证手机收到的验证码 | |
177 | + * | |
178 | + * @createTime 2014年8月24日 下午10:55:03 | |
179 | + * @author weili | |
180 | + */ | |
181 | + @ApiOperation(value = "忘记密码:验证手机号和验证码", httpMethod = "POST", notes = "验证手机收到的验证码", response = CheckVeriCodeResp.class) | |
182 | + @RequestMapping(value = "/checkAuthCode", method = RequestMethod.POST) | |
183 | + @ResponseBody | |
184 | + public void checkAuthCode(@RequestBody CheckVeriCodeReq temp) { | |
185 | + CheckVeriCodeReq req = super.getRequest(CheckVeriCodeReq.class); | |
186 | + try { | |
187 | + BeanValidator.validator(req); | |
188 | + CheckVeriCodeResp resp = userService.checkVeriCode(req); | |
189 | + super.sendSuccessResp(resp); | |
190 | + } catch (ServiceException e) { | |
191 | + LOGGER.error( | |
192 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
193 | + e); | |
194 | + sendError(e.getCode(), e.getMessage()); | |
195 | + } catch (Exception e) { | |
196 | + LOGGER.error("验证手机收到的验证码:", e); | |
197 | + super.sendError(e.getMessage()); | |
198 | + } | |
199 | + } | |
200 | + | |
201 | + /** | |
202 | + * 找回密码-修改用户密码 | |
203 | + * | |
204 | + * @createTime 2014年8月24日 下午10:55:03 | |
205 | + * @author weili | |
206 | + */ | |
207 | + @ApiOperation(value = "找回密码-设置用户新密码", httpMethod = "POST", response = SendVeriCodeResp.class) | |
208 | + @RequestMapping(value = "/modifyPwd", method = RequestMethod.POST) | |
209 | + @ResponseBody | |
210 | + public void modifyPwd(@RequestBody ModifyPwdReq temp) { | |
211 | + ModifyPwdReq req = super.getRequest(ModifyPwdReq.class); | |
212 | + ModifyPwdResp resp = null; | |
213 | + try { | |
214 | + BeanValidator.validator(req); | |
215 | + resp = userService.modifyPwd(req); | |
216 | + super.sendSuccessResp(resp); | |
217 | + } catch (ServiceException e) { | |
218 | + LOGGER.error( | |
219 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
220 | + e); | |
221 | + sendError(e.getCode(), e.getMessage()); | |
222 | + } catch (Exception e) { | |
223 | + LOGGER.error("修改密码:", e); | |
224 | + super.sendError(e.getMessage()); | |
225 | + } | |
226 | + | |
227 | + } | |
228 | + | |
229 | + /** | |
230 | + * 买家注册 | |
231 | + * | |
232 | + * @createTime 2014年8月28日 下午3:41:02 | |
233 | + * @author weili | |
234 | + */ | |
235 | + @ApiOperation(value = "买家注册", httpMethod = "POST", response = UserRegisterResp.class) | |
236 | + @RequestMapping(value = "/buyerRegister", method = RequestMethod.POST) | |
237 | + @ResponseBody | |
238 | + public void buyerRegister(@RequestBody UserRegisterReq temp) { | |
239 | + UserRegisterReq req = super.getRequest(UserRegisterReq.class); | |
240 | + try { | |
241 | + BeanValidator.validator(req); | |
242 | + UserRegisterResp resp = userService.userRegister(req); | |
243 | + super.sendSuccessResp(resp); | |
244 | + } catch (ServiceException e) { | |
245 | + LOGGER.error( | |
246 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
247 | + e); | |
248 | + sendError(e.getCode(), e.getMessage()); | |
249 | + } catch (Exception e) { | |
250 | + LOGGER.error("用户注册失败:", e); | |
251 | + super.sendError(e.getMessage()); | |
252 | + } | |
253 | + } | |
254 | + | |
255 | + /** | |
256 | + * 买家注册(加密) | |
257 | + * | |
258 | + * @createTime 2014年8月28日 下午3:41:02 | |
259 | + * @author weili | |
260 | + */ | |
261 | + @ApiOperation(value = "买家注册", httpMethod = "POST", response = UserRegisterResp.class) | |
262 | + @RequestMapping(value = "/buyerRegisters", method = RequestMethod.POST) | |
263 | + @ResponseBody | |
264 | + public void buyerRegisters(@RequestBody UserRegisterReq temp) { | |
265 | + UserRegisterReq req = super.getRequest(UserRegisterReq.class); | |
266 | + try { | |
267 | + BeanValidator.validator(req); | |
268 | + req.setPassword(decodeStr(req.getPassword())); | |
269 | + UserRegisterResp resp = userService.userRegister(req); | |
270 | + super.sendSuccessResp(resp); | |
271 | + } catch (ServiceException e) { | |
272 | + LOGGER.error( | |
273 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
274 | + e); | |
275 | + sendError(e.getCode(), e.getMessage()); | |
276 | + } catch (Exception e) { | |
277 | + LOGGER.error("用户注册失败:", e); | |
278 | + super.sendError(e.getMessage()); | |
279 | + } | |
280 | + } | |
281 | + | |
282 | + /** | |
283 | + * 退出操作 | |
284 | + * | |
285 | + * @createTime 2014年8月29日 上午9:30:10 | |
286 | + * @author weili | |
287 | + */ | |
288 | + @ApiOperation(value = "退出", httpMethod = "POST", response = LogoutResp.class) | |
289 | + @RequestMapping(value = "/logout", method = RequestMethod.POST) | |
290 | + @ResponseBody | |
291 | + public void logout(@RequestBody LogoutReq temp) { | |
292 | + LogoutReq req = super.getRequest(LogoutReq.class); | |
293 | + try { | |
294 | + if (Validator.isNull(req) || !Validator.isNumber(req.getUserId() + "")) { | |
295 | + throw new NullPointerException("参数传递错误"); | |
296 | + } | |
297 | + LogoutResp resp = userService.logout(req); | |
298 | + super.sendSuccessResp(resp); | |
299 | + } catch (ServiceException e) { | |
300 | + LOGGER.error( | |
301 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
302 | + e); | |
303 | + sendError(e.getCode(), e.getMessage()); | |
304 | + } catch (Exception e) { | |
305 | + LOGGER.error("用户退出失败:", e); | |
306 | + super.sendError(e.getMessage()); | |
307 | + } | |
308 | + } | |
309 | + | |
310 | + /** | |
311 | + * 个人信息维护 | |
312 | + * | |
313 | + * @createTime 2016年8月24日 下午10:55:03 | |
314 | + * @author weili | |
315 | + */ | |
316 | + @ApiOperation(value = "个人信息维护", httpMethod = "POST", response = UpdateUserInfoResp.class) | |
317 | + @RequestMapping(value = "/updateUserInfo", method = RequestMethod.POST) | |
318 | + @ResponseBody | |
319 | + public void updateUserInfo(@RequestBody UpdateUserInfoReq temp) { | |
320 | + UpdateUserInfoReq req = super.getRequest(UpdateUserInfoReq.class); | |
321 | + try { | |
322 | + UpdateUserInfoResp resp = userService.updateUserInfo(req); | |
323 | + super.sendSuccessResp(resp); | |
324 | + } catch (ServiceException e) { | |
325 | + LOGGER.error( | |
326 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
327 | + e); | |
328 | + sendError(e.getCode(), e.getMessage()); | |
329 | + } catch (Exception e) { | |
330 | + LOGGER.error("个人信息维护:", e); | |
331 | + super.sendError(e.getMessage()); | |
332 | + } | |
333 | + | |
334 | + } | |
335 | + | |
336 | + /** | |
337 | + * 查看储值卡余额 | |
338 | + * | |
339 | + * @createTime 2016年8月24日 下午10:55:03 | |
340 | + * @author weili | |
341 | + */ | |
342 | + @ApiOperation(value = "查看储值卡余额", httpMethod = "POST", response = GetDepositCardAmountResp.class) | |
343 | + @RequestMapping(value = "/getDepositCardAmount", method = RequestMethod.POST) | |
344 | + @ResponseBody | |
345 | + public void getDepositCardAmount() { | |
346 | + GetDepositCardAmountReq req = super.getRequest(GetDepositCardAmountReq.class); | |
347 | + try { | |
348 | + GetDepositCardAmountResp resp = userService.getDepositCardAmount(req); | |
349 | + super.sendSuccessResp(resp); | |
350 | + } catch (ServiceException e) { | |
351 | + LOGGER.error( | |
352 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
353 | + e); | |
354 | + sendError(e.getCode(), e.getMessage()); | |
355 | + } catch (Exception e) { | |
356 | + LOGGER.error("个人信息维护:", e); | |
357 | + super.sendError(e.getMessage()); | |
358 | + } | |
359 | + | |
360 | + } | |
361 | + | |
362 | + /** | |
363 | + * 查询用户信息 GetUserInfoReq | |
364 | + */ | |
365 | + @ApiOperation(value = "查询买家用户信息", httpMethod = "POST", response = GetDepositCardAmountResp.class) | |
366 | + @RequestMapping(value = "/getBuyerInfo", method = RequestMethod.POST) | |
367 | + @ResponseBody | |
368 | + public void getBuyerInfo() { | |
369 | + GetUserInfoReq req = getRequest(GetUserInfoReq.class); | |
370 | + try { | |
371 | + GetUserInfoResp resp = userService.getUserIntroduction(req); | |
372 | + super.sendSuccessResp(resp); | |
373 | + } catch (ServiceException e) { | |
374 | + LOGGER.error( | |
375 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
376 | + e); | |
377 | + sendError(e.getCode(), e.getMessage()); | |
378 | + } catch (Exception e) { | |
379 | + LOGGER.error(String.format("ErrorMessage=%s,UserId=%s", e.getMessage(), req.getUserId()), e); | |
380 | + sendError(e.getMessage()); | |
381 | + } | |
382 | + } | |
383 | + | |
384 | + /** | |
385 | + * 搜索买家用户信息 GetUserInfoReq | |
386 | + */ | |
387 | + @ApiOperation(value = "搜索买家用户信息", httpMethod = "POST", response = SearchUserInfoResp.class) | |
388 | + @RequestMapping(value = "/searchBuyerInfo", method = RequestMethod.POST) | |
389 | + @ResponseBody | |
390 | + public void searchBuyerInfo(@RequestBody SearchUserInfoReq temp) { | |
391 | + SearchUserInfoReq req = getRequest(SearchUserInfoReq.class); | |
392 | + try { | |
393 | + SearchUserInfoResp resp = userService.searchBuyerInfo(req); | |
394 | + super.sendSuccessResp(resp); | |
395 | + } catch (ServiceException e) { | |
396 | + LOGGER.error( | |
397 | + String.format("Code=%s,ErrorMessage=%s,UserId=%s", e.getCode(), e.getMessage(), req.getUserId()), | |
398 | + e); | |
399 | + sendError(e.getCode(), e.getMessage()); | |
400 | + } catch (Exception e) { | |
401 | + LOGGER.error(String.format("ErrorMessage=%s,UserId=%s", e.getMessage(), req.getUserId()), e); | |
402 | + sendError(e.getMessage()); | |
403 | + } | |
404 | + } | |
405 | + | |
406 | + /** | |
407 | + * 查询极光推送号 | |
408 | + * | |
409 | + * getRegisterNo | |
410 | + */ | |
411 | + @ApiOperation(value = "查询极光推送号", httpMethod = "POST", response = GetRegisterNoResp.class) | |
412 | + @RequestMapping(value = "/getRegisterNo", method = RequestMethod.POST) | |
413 | + @ResponseBody | |
414 | + public void getRegisterNo(@RequestBody GetRegisterNoReq temp) { | |
415 | + GetRegisterNoReq req = getRequest(GetRegisterNoReq.class); | |
416 | + try { | |
417 | + GetRegisterNoResp resp = userService.getRegisterNo(req); | |
418 | + sendSuccessResp(resp); | |
419 | + } catch (ServiceException e) { | |
420 | + LOGGER.error(String.format("Code=%s,ErrorMessage=%s", e.getCode(), e.getMessage()), e); | |
421 | + sendError(e.getCode(), e.getMessage()); | |
422 | + } catch (Exception e) { | |
423 | + LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
424 | + sendError(e.getMessage()); | |
425 | + } | |
426 | + } | |
427 | + | |
428 | + /** | |
429 | + * 批量查询极光推送号 | |
430 | + * | |
431 | + * getNosByUserids | |
432 | + */ | |
433 | + @ApiOperation(value = "批量查询极光推送号", httpMethod = "POST", response = GetRegisterNobyUidsResp.class) | |
434 | + @RequestMapping(value = "/getRegisterNobyUids", method = RequestMethod.POST) | |
435 | + @ResponseBody | |
436 | + public void getRegisterNobyUids(@RequestBody GetRegisterNobyUidsReq temp) { | |
437 | + GetRegisterNobyUidsReq req = getRequest(GetRegisterNobyUidsReq.class); | |
438 | + try { | |
439 | + GetRegisterNobyUidsResp resp = userService.getRegisterNobyUids(req); | |
440 | + sendSuccessResp(resp); | |
441 | + } catch (ServiceException e) { | |
442 | + LOGGER.error(String.format("Code=%s,ErrorMessage=%s", e.getCode(), e.getMessage()), e); | |
443 | + sendError(e.getCode(), e.getMessage()); | |
444 | + } catch (Exception e) { | |
445 | + LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
446 | + sendError(e.getMessage()); | |
447 | + } | |
448 | + } | |
449 | + | |
450 | + public void getDeliveryAddress(@RequestBody GetDeliveryAddressReq temp) { | |
451 | + GetDeliveryAddressReq req = getRequest(GetDeliveryAddressReq.class); | |
452 | + try { | |
453 | + GetDeliveryAddressResp resp = userService.getDeliveryAddresses(req); | |
454 | + sendSuccessResp(resp); | |
455 | + } catch (ServiceException e) { | |
456 | + LOGGER.error(String.format("Code=%s,ErrorMessage=%s", e.getCode(), e.getMessage()), e); | |
457 | + sendError(e.getCode(), e.getMessage()); | |
458 | + } catch (Exception e) { | |
459 | + LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
460 | + sendError(e.getMessage()); | |
461 | + } | |
462 | + } | |
463 | + | |
464 | + /// ** | |
465 | + // * 查看交易记录 | |
466 | + // * @createTime 2016年8月24日 下午10:55:03 | |
467 | + // * @author weili | |
468 | + // */ | |
469 | + // @ApiOperation(value = "查看交易记录", httpMethod = "POST" ,response = | |
470 | + /// TradeRecordResp.class) | |
471 | + // @RequestMapping(value = "/getTradeRecord",method = RequestMethod.POST) | |
472 | + // @ResponseBody | |
473 | + // public void getTradeRecord(){ | |
474 | + // TradeRecordReq req = super.getRequest(TradeRecordReq.class); | |
475 | + // try { | |
476 | + // TradeRecordResp resp = userService.getTradeRecord(req); | |
477 | + // super.sendSuccessResp(resp); | |
478 | + // } catch (ServiceException e){ | |
479 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
480 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
481 | + // sendError(e.getCode(), e.getMessage()); | |
482 | + // } catch (Exception e) { | |
483 | + // LOGGER.error("查看交易记录:", e); | |
484 | + // super.sendError(e.getMessage()); | |
485 | + // } | |
486 | + // | |
487 | + // } | |
488 | + | |
489 | + /// ** | |
490 | + // * 验证用户账号是否可用 | |
491 | + // * @createTime 2014年8月28日 下午3:41:02 | |
492 | + // * @author weili | |
493 | + // */ | |
494 | + // @RequestMapping("/checkAccountName") | |
495 | + // @ResponseBody | |
496 | + // public void checkAccountName(){ | |
497 | + // CheckAccuntNameReq req = super.getRequest(CheckAccountNameReq.class); | |
498 | + // CheckAccountNameResp resp = null; | |
499 | + // try { | |
500 | + // if(!Validator.isNull(req) && !Validator.isNull(req.getAccountName())){ | |
501 | + // resp = userService.checkAccountName(req); | |
502 | + // } | |
503 | + // else { | |
504 | + // resp = new CheckAccountNameResp(); | |
505 | + // } | |
506 | + // super.sendSuccessResp(resp); | |
507 | + // } catch (ServiceException e){ | |
508 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
509 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
510 | + // sendError(e.getCode(), e.getMessage()); | |
511 | + // } catch (Exception e) { | |
512 | + // LOGGER.error("验证用户账号失败:", e); | |
513 | + // super.sendError(e.getMessage()); | |
514 | + // } | |
515 | + // } | |
516 | + // | |
517 | + | |
518 | + /** | |
519 | + * 验证手机号是否已经被注册 | |
520 | + * | |
521 | + * @createTime 2014年8月28日 下午3:41:02 | |
522 | + * @author weili | |
523 | + */ | |
524 | + // @RequestMapping("/checkMobile") | |
525 | + // @ResponseBody | |
526 | + // @ApiOperation(value = "", httpMethod = "POST") | |
527 | + // public void checkMobile(){ | |
528 | + // CheckMobileReq req = super.getRequest(CheckMobileReq.class); | |
529 | + // CheckMobileResp resp = null; | |
530 | + // try { | |
531 | + // if(!Validator.isNull(req) && !Validator.isNull(req.getMobile())){ | |
532 | + // resp = userService.checkMobile(req); | |
533 | + // } else { | |
534 | + // resp = new CheckMobileResp(); | |
535 | + // } | |
536 | + // super.sendSuccessResp(resp); | |
537 | + // } catch (ServiceException e){ | |
538 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
539 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
540 | + // sendError(e.getCode(), e.getMessage()); | |
541 | + // } catch (Exception e) { | |
542 | + // LOGGER.error("验证手机失败:", e); | |
543 | + // super.sendError(e.getMessage()); | |
544 | + // } | |
545 | + // } | |
524 | 546 | |
525 | 547 | } | ... | ... |