Commit b20778717f4ff3fd76df0184b2423babcc6fdd54
Merge remote-tracking branch 'origin/dev' into dev
Showing
13 changed files
with
1666 additions
and
1482 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
... | ... | @@ -5,100 +5,109 @@ import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
5 | 5 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; |
6 | 6 | import com.diligrp.mobsite.getway.domain.protocol.user.*; |
7 | 7 | |
8 | - | |
9 | 8 | /** |
10 | 9 | * <B>Description</B> userservice <br /> |
11 | - * <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 /> | |
12 | 12 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
13 | 13 | * <B>Company</B> 地利集团 |
14 | + * | |
14 | 15 | * @createTime 2014年8月26日 下午5:34:42 |
15 | 16 | * @author zhangshirui |
16 | 17 | */ |
17 | 18 | public interface UserService { |
18 | 19 | |
19 | - /** | |
20 | - * 用户登录 | |
21 | - * @param req | |
22 | - * @return | |
23 | - * @createTime 2014年8月26日 下午5:37:05 | |
24 | - * @author zhangshirui | |
25 | - */ | |
26 | - LoginResp buyerlogin(LoginReq req); | |
27 | - | |
28 | - | |
29 | - /** | |
30 | - * 验证手机收到的验证码 | |
31 | - * @param req | |
32 | - * @return | |
33 | - * @createTime 2014年8月27日 下午4:25:11 | |
34 | - * @author zhangshirui | |
35 | - */ | |
36 | - CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req); | |
37 | - | |
38 | - /** | |
39 | - * 发送手机验证码 | |
40 | - * @createTime 2014年8月27日 下午4:50:38 | |
41 | - * @author zhangshirui | |
42 | - */ | |
43 | - SendVeriCodeResp sendVeriCode(SendVeriCodeReq req); | |
44 | - | |
45 | - /** | |
46 | - * 修改用户信息 | |
47 | - * @param req | |
48 | - * @return | |
49 | - * @createTime 2014年8月28日 下午3:15:53 | |
50 | - * @author zhangshirui | |
51 | - */ | |
52 | - UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); | |
53 | - | |
54 | - | |
55 | - /** | |
56 | - *用户注册 | |
57 | - * @param req | |
58 | - * @return | |
59 | - * @createTime 2014年8月28日 下午4:37:08 | |
60 | - * @author zhangshirui | |
61 | - */ | |
62 | - UserRegisterResp userRegister(UserRegisterReq req); | |
63 | - | |
64 | - GetUserInfoResp getUserIntroduction(GetUserInfoReq req); | |
20 | + /** | |
21 | + * 用户登录 | |
22 | + * | |
23 | + * @param req | |
24 | + * @return | |
25 | + * @createTime 2014年8月26日 下午5:37:05 | |
26 | + * @author zhangshirui | |
27 | + */ | |
28 | + LoginResp buyerlogin(LoginReq req); | |
65 | 29 | |
30 | + /** | |
31 | + * 验证手机收到的验证码 | |
32 | + * | |
33 | + * @param req | |
34 | + * @return | |
35 | + * @createTime 2014年8月27日 下午4:25:11 | |
36 | + * @author zhangshirui | |
37 | + */ | |
38 | + CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req); | |
39 | + | |
40 | + /** | |
41 | + * 发送手机验证码 | |
42 | + * | |
43 | + * @createTime 2014年8月27日 下午4:50:38 | |
44 | + * @author zhangshirui | |
45 | + */ | |
46 | + SendVeriCodeResp sendVeriCode(SendVeriCodeReq req); | |
47 | + | |
48 | + /** | |
49 | + * 修改用户信息 | |
50 | + * | |
51 | + * @param req | |
52 | + * @return | |
53 | + * @createTime 2014年8月28日 下午3:15:53 | |
54 | + * @author zhangshirui | |
55 | + */ | |
56 | + UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req); | |
57 | + | |
58 | + /** | |
59 | + * 用户注册 | |
60 | + * | |
61 | + * @param req | |
62 | + * @return | |
63 | + * @createTime 2014年8月28日 下午4:37:08 | |
64 | + * @author zhangshirui | |
65 | + */ | |
66 | + UserRegisterResp userRegister(UserRegisterReq req); | |
67 | + | |
68 | + GetUserInfoResp getUserIntroduction(GetUserInfoReq req); | |
66 | 69 | |
67 | 70 | LogoutResp logout(LogoutReq req); |
68 | 71 | |
69 | 72 | /** |
70 | 73 | * 修改密码 |
74 | + * | |
71 | 75 | * @param req |
72 | 76 | * @return |
73 | 77 | * @createTime 2015年1月24日 下午4:29:26 |
74 | 78 | * @author zhangshirui |
75 | 79 | */ |
76 | - ModifyPwdResp modifyPwd(ModifyPwdReq req); | |
77 | - | |
80 | + ModifyPwdResp modifyPwd(ModifyPwdReq req); | |
78 | 81 | |
79 | 82 | /** |
80 | - * 查询用户极光号 | |
81 | - * @param req | |
82 | - * @return | |
83 | - * @createTime 2015-11-10 19:43:18 | |
84 | - */ | |
83 | + * 查询用户极光号 | |
84 | + * | |
85 | + * @param req | |
86 | + * @return | |
87 | + * @createTime 2015-11-10 19:43:18 | |
88 | + */ | |
85 | 89 | GetRegisterNoResp getRegisterNo(GetRegisterNoReq req); |
86 | - | |
90 | + | |
87 | 91 | /** |
88 | - * 批量查询用户极光号 | |
89 | - * @param req | |
90 | - * @return | |
91 | - * @createTime 2015-11-10 19:43:18 | |
92 | - */ | |
92 | + * 批量查询用户极光号 | |
93 | + * | |
94 | + * @param req | |
95 | + * @return | |
96 | + * @createTime 2015-11-10 19:43:18 | |
97 | + */ | |
93 | 98 | GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req); |
94 | 99 | |
95 | - | |
96 | - | |
97 | 100 | GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req); |
98 | 101 | |
99 | - | |
100 | - | |
101 | 102 | SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req); |
102 | 103 | |
103 | 104 | LoginResp authlogin(AuthLoginReq req); |
105 | + | |
106 | + /** | |
107 | + * 获取买家收货地址信息 | |
108 | + * | |
109 | + * @param req | |
110 | + * @return | |
111 | + */ | |
112 | + GetDeliveryAddressResp getDeliveryAddresses(GetDeliveryAddressReq req); | |
104 | 113 | } | ... | ... |
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.beans.factory.annotation.Value; | |
14 | +import org.springframework.stereotype.Service; | |
15 | + | |
3 | 16 | import com.b2c.myapp.common.api.buyerInfo.output.BuyerInfoOutput; |
17 | +import com.b2c.myapp.common.api.pickingInfo.output.PickingInfoOutput; | |
4 | 18 | import com.b2c.myapp.common.api.shopBuyer.output.ShopBuyerOutput; |
5 | 19 | import com.diligrp.mobsite.getway.domain.RegisterNoMapper; |
6 | 20 | import com.diligrp.mobsite.getway.domain.common.Constant; |
... | ... | @@ -8,33 +22,48 @@ import com.diligrp.mobsite.getway.domain.common.ErrorMessage; |
8 | 22 | import com.diligrp.mobsite.getway.domain.common.RedisKey; |
9 | 23 | import com.diligrp.mobsite.getway.domain.common.ResultCode; |
10 | 24 | import com.diligrp.mobsite.getway.domain.except.ServiceException; |
11 | -import com.diligrp.mobsite.getway.domain.protocol.login.*; | |
25 | +import com.diligrp.mobsite.getway.domain.protocol.PickInfo; | |
26 | +import com.diligrp.mobsite.getway.domain.protocol.login.AuthLoginReq; | |
27 | +import com.diligrp.mobsite.getway.domain.protocol.login.CheckVeriCodeReq; | |
28 | +import com.diligrp.mobsite.getway.domain.protocol.login.CheckVeriCodeResp; | |
29 | +import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; | |
30 | +import com.diligrp.mobsite.getway.domain.protocol.login.LoginResp; | |
31 | +import com.diligrp.mobsite.getway.domain.protocol.login.LogoutReq; | |
32 | +import com.diligrp.mobsite.getway.domain.protocol.login.LogoutResp; | |
33 | +import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeReq; | |
34 | +import com.diligrp.mobsite.getway.domain.protocol.login.SendVeriCodeResp; | |
12 | 35 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
13 | 36 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterResp; |
14 | -import com.diligrp.mobsite.getway.domain.protocol.user.*; | |
37 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDeliveryAddressReq; | |
38 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDeliveryAddressResp; | |
39 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDepositCardAmountReq; | |
40 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetDepositCardAmountResp; | |
41 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoReq; | |
42 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNoResp; | |
43 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNobyUidsReq; | |
44 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetRegisterNobyUidsResp; | |
45 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetUserInfoReq; | |
46 | +import com.diligrp.mobsite.getway.domain.protocol.user.GetUserInfoResp; | |
47 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | |
48 | +import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdResp; | |
49 | +import com.diligrp.mobsite.getway.domain.protocol.user.SearchUserInfoReq; | |
50 | +import com.diligrp.mobsite.getway.domain.protocol.user.SearchUserInfoResp; | |
51 | +import com.diligrp.mobsite.getway.domain.protocol.user.UpdateUserInfoReq; | |
52 | +import com.diligrp.mobsite.getway.domain.protocol.user.UpdateUserInfoResp; | |
15 | 53 | import com.diligrp.mobsite.getway.domain.protocol.user.model.RegisterNoPlatform; |
16 | 54 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; |
17 | 55 | import com.diligrp.mobsite.getway.rpc.PassportRPC; |
56 | +import com.diligrp.mobsite.getway.rpc.PickInfoRPC; | |
18 | 57 | import com.diligrp.mobsite.getway.rpc.UserRPC; |
19 | 58 | import com.diligrp.mobsite.getway.rpc.base.BaseOutput; |
20 | 59 | import com.diligrp.mobsite.getway.service.buyer.user.UserService; |
21 | 60 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
22 | 61 | import com.diligrp.website.util.security.Validator; |
23 | -import org.slf4j.Logger; | |
24 | -import org.slf4j.LoggerFactory; | |
25 | -import org.springframework.beans.factory.annotation.Autowired; | |
26 | -import org.springframework.beans.factory.annotation.Value; | |
27 | -import org.springframework.stereotype.Service; | |
28 | - | |
29 | -import javax.annotation.Resource; | |
30 | -import java.util.ArrayList; | |
31 | -import java.util.HashMap; | |
32 | -import java.util.List; | |
33 | -import java.util.Map; | |
34 | 62 | |
35 | 63 | /** |
36 | 64 | * <B>Description</B> 用户 服务层 <br /> |
37 | - * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
65 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. | |
66 | + * <br /> | |
38 | 67 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
39 | 68 | * <B>Company</B> 地利集团 |
40 | 69 | * |
... | ... | @@ -44,379 +73,385 @@ import java.util.Map; |
44 | 73 | @Service("userService") |
45 | 74 | public class UserServiceImpl implements UserService { |
46 | 75 | |
47 | - @Resource | |
48 | - private UserRPC userRPC; | |
49 | - @Autowired | |
50 | - private RedisUtilImpl redisUtil; | |
51 | - | |
52 | - @Resource | |
53 | - private RegisterNoMapperManager registerNoMapperManager; | |
54 | - @Resource | |
55 | - private PassportRPC passportRPC; | |
56 | - | |
57 | - | |
58 | - /** | |
59 | - * 登录超时时间:秒 | |
60 | - */ | |
61 | - @Value("${login.timeout.second}") | |
62 | - private int loginExpireTime; | |
63 | - | |
64 | - | |
65 | - private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); | |
66 | - | |
67 | - @Override | |
68 | - public LoginResp buyerlogin(LoginReq req) { | |
69 | - BuyerInfoOutput userInfo = passportRPC.buyerLogin(req); | |
70 | - | |
71 | - //缓存用户登录信息 | |
72 | - cacheUserInfo(userInfo.getId(),req.getDeviceId()); | |
73 | - | |
74 | - if (Validator.isEmpty(req.getRegisterNo())){ | |
75 | - logger.error("卖家登录激光推送id为空[userId=]",userInfo.getId()); | |
76 | - }else{ | |
77 | - //绑定用户激光推送id | |
78 | - bindUserRegisterNo(userInfo.getId(),req.getRegisterNo(),req.getDeviceType()); | |
79 | - } | |
80 | - Long currentShopId = userInfo.getCurrentShopId(); | |
81 | - LoginResp resp = new LoginResp(); | |
82 | - if (Validator.isNull(currentShopId)){ | |
83 | - logger.info("用户未绑定店铺[buyerId=]",userInfo.getId()); | |
84 | - resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
85 | - } | |
86 | - resp.setBuyerId(userInfo.getId()); | |
87 | - resp.setHeadImg(userInfo.getFace()); | |
88 | - resp.setMobile(userInfo.getMobilePhone()); | |
89 | - resp.setAccountName(userInfo.getAccountName()); | |
90 | - resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
91 | - return resp; | |
92 | - } | |
93 | - | |
94 | - private void bindUserRegisterNo(Long id,String registerNo,Integer deviceType) { | |
95 | - // 缓存 | |
96 | - String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_BUYER+ | |
97 | - String.valueOf(id)); | |
98 | - | |
99 | - GetRegisterNoResp mappers = redisUtil.getObject(redisKey, | |
100 | - GetRegisterNoResp.class); | |
101 | - // 绑定极光ID | |
102 | - RegisterNoMapper mapper = new RegisterNoMapper(); | |
103 | - mapper.setRegisterNo(registerNo); | |
104 | - mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
105 | - mapper.setUserid(id); | |
106 | - mapper.setUserType(Constant.USER_ROLE_BUYER); | |
107 | - mapper.setDeviceType(deviceType); | |
108 | - try { | |
109 | - //清除当前极光号userid缓存 | |
110 | - cleanOldredis(mapper); | |
111 | - //构建缓存信息 | |
112 | - buildRedisInfo(mappers, mapper); | |
113 | - redisUtil.setObjectByExpire(redisKey, mappers, | |
114 | - RedisKey.REGISTERNO_EXPIRE_TIME); | |
115 | - } catch (Exception e) { | |
116 | - throw new ServiceException(ResultCode.PUSH_MESSAGE_NO, | |
117 | - "绑定极光推送系统注册号失败"); | |
118 | - } | |
119 | - } | |
120 | - | |
121 | - private void cacheUserInfo(Long id, String deviceId) { | |
122 | - | |
123 | - //缓存userId | |
124 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(id)); | |
125 | - redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(id), loginExpireTime); | |
126 | - | |
127 | - //缓存设备id,userId作为key | |
128 | - if (!Validator.isNull(deviceId)) { | |
129 | - String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(id)); | |
130 | - redisUtil.setStringByExpire(onlyOneLoginRedisKey, deviceId, loginExpireTime); | |
131 | - } | |
132 | - | |
133 | - //缓存currentShopId | |
134 | - //if (!Validator.isNull(resp.getCurrentShopId())){ | |
135 | - // String currentShopIdKey = redisUtil.makeKey(RedisKey.USER_BUYER_CURRENTSHOPID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
136 | - // redisUtil.setStringByExpire(currentShopIdKey, String.valueOf(resp.getCurrentShopId()), loginExpireTime); | |
137 | - //} | |
138 | - | |
139 | - | |
140 | - //缓存shopBuyerId | |
141 | - //if (!Validator.isNull(resp.getShopBuyerId())){ | |
142 | - // String shopUserIdKey = redisUtil.makeKey(RedisKey.USER_BUYER_SHOPUSERID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
143 | - // redisUtil.setStringByExpire(shopUserIdKey, String.valueOf(resp.getShopBuyerId()), loginExpireTime); | |
144 | - //} | |
145 | - } | |
146 | - | |
147 | - | |
148 | - /** | |
149 | - * 清除当前极光号下userid缓存 | |
150 | - * @param mapper | |
151 | - */ | |
152 | - private void cleanOldredis(RegisterNoMapper mapper) { | |
153 | - RegisterNoMapper oldmapper = registerNoMapperManager | |
154 | - .bindRegisterNo(mapper); | |
155 | - if (!Validator.isNull(oldmapper)){ | |
156 | - String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO,Constant.USER_ROLE_SIGN_BUYER+ | |
157 | - String.valueOf(oldmapper.getUserid())); | |
158 | - redisUtil.deleteByKey(oldKey); | |
159 | - } | |
160 | - } | |
161 | - | |
162 | - /** | |
163 | - * 建立缓存信息 | |
164 | - * @param mappers | |
165 | - * @param mapper | |
166 | - */ | |
167 | - private void buildRedisInfo(GetRegisterNoResp mappers, | |
168 | - RegisterNoMapper mapper) { | |
169 | - // 如果缓存没有重新建 | |
170 | - List<RegisterNoMapper> renolist = new ArrayList<RegisterNoMapper>(); | |
171 | - | |
172 | - if (Validator.isNull(mappers)) { | |
173 | - mappers = new GetRegisterNoResp(); | |
174 | - } | |
175 | - renolist.add(mapper); | |
176 | - mappers.setRegisterNos(renolist); | |
177 | - } | |
178 | - | |
179 | - | |
180 | - | |
181 | - | |
182 | - @Override | |
183 | - public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { | |
184 | - passportRPC.verifyBuyerSmsCode(req.getMobile(),req.getVeriCode()); | |
185 | - | |
186 | - return new CheckVeriCodeResp(); | |
187 | - } | |
188 | - | |
189 | - @Override | |
190 | - public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { | |
191 | - String mobile = req.getMobile(); | |
192 | - BuyerInfoOutput userinfo = userRPC.checkMobile(mobile); | |
193 | - Integer msgType = req.getMsgType(); | |
194 | - if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN||msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | |
195 | - if (Validator.isNull(userinfo)){ | |
196 | - if (Validator.isNull(userinfo)){ | |
197 | - throw new ServiceException(ErrorMessage.USER_MOBILE_NOT_EXIST); | |
198 | - } | |
199 | - } | |
200 | - } | |
201 | - if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | |
202 | - if (!Validator.isNull(userinfo)){ | |
203 | - throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | |
204 | - } | |
205 | - } | |
206 | - BaseOutput<String> out = passportRPC.sendVeriCodeOfBuyer(mobile, req.getMsgType()); | |
207 | - SendVeriCodeResp resp = new SendVeriCodeResp(); | |
208 | - resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
209 | - resp.setPassKey(out.getData()); | |
210 | - return resp; | |
211 | - } | |
212 | - | |
213 | - @Override | |
214 | - public UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req) { | |
215 | - return null; | |
216 | - } | |
217 | - | |
218 | - | |
219 | - | |
220 | - @Override | |
221 | - public UserRegisterResp userRegister(UserRegisterReq req) { | |
222 | - //手机号码和账号验证、验证码 | |
223 | - //if (!checkRegisterInfo(resp, req)) { | |
224 | - // return resp; | |
225 | - //} | |
226 | - passportRPC.buyerRegister(req); | |
227 | - UserRegisterResp resp = new UserRegisterResp(); | |
228 | - resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
229 | - return resp; | |
230 | - } | |
231 | - | |
232 | - | |
233 | - | |
234 | - | |
235 | - | |
236 | - | |
237 | - @Override | |
238 | - public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { | |
239 | - return null; | |
240 | - } | |
241 | - | |
242 | - | |
243 | - | |
244 | - @Override | |
245 | - public LogoutResp logout(LogoutReq req) { | |
246 | - LogoutResp resp = new LogoutResp(); | |
247 | - | |
248 | - | |
249 | - //解除登录缓存信息 | |
250 | - //userId | |
251 | - String cookieUserIdKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(req.getUserId())); | |
252 | - //设备id | |
253 | - String cookieDeviceIdKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(req.getUserId())); | |
254 | - try { | |
255 | - redisUtil.deleteByKey(cookieUserIdKey); | |
256 | - redisUtil.deleteByKey(cookieDeviceIdKey); | |
257 | - } | |
258 | - catch(Exception e) { | |
259 | - logger.error("买家退出登录异常:清除登录缓存信息失败",e); | |
260 | - } | |
261 | - // 解除绑定极光ID | |
262 | - if(!Validator.isEmpty(req.getRegisterNo())){ | |
263 | - | |
264 | - String userId = req.getUserId().toString(); | |
265 | - //先清缓存再清数据库 | |
266 | - String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_BUYER+userId); | |
267 | - | |
268 | - RegisterNoMapper mapper = new RegisterNoMapper(); | |
269 | - mapper.setRegisterNo(req.getRegisterNo()); | |
270 | - mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
271 | - mapper.setUserid(req.getUserId()); | |
272 | - mapper.setUserType(Constant.USER_ROLE_BUYER); | |
273 | - mapper.setDeviceType(req.getDeviceType()); | |
274 | - try { | |
275 | - redisUtil.deleteByKey(reNOCache); | |
276 | - registerNoMapperManager.unBindRegisterNo(mapper); | |
277 | - } | |
278 | - catch(Exception e) { | |
279 | - logger.error("解除极光推送系统绑定的注册号失败",e); | |
280 | - } | |
281 | - } | |
282 | - | |
283 | - return resp; | |
284 | - } | |
285 | - | |
286 | - @Override | |
287 | - public ModifyPwdResp modifyPwd(ModifyPwdReq req) { | |
288 | - BuyerInfoOutput userInfo = userRPC.getUserByMobile(req.getAccountName()); | |
289 | - Long userId = userInfo.getId(); | |
290 | - boolean result = passportRPC.modifyPwdBuyer(req); | |
291 | - ModifyPwdResp resp = new ModifyPwdResp(); | |
292 | - if(!result){ | |
293 | - //失败 | |
294 | - resp.setCode(ResultCode.BUSINESS_FAILED); | |
295 | - resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); | |
296 | - return resp; | |
297 | - }else { | |
298 | - //修改成功,退出所有账号信息 | |
299 | - String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(userId)); | |
300 | - redisUtil.deleteByKey(cookieRedisKey); | |
301 | - } | |
302 | - return resp; | |
303 | - } | |
304 | - | |
305 | - | |
306 | - | |
307 | - @Override | |
308 | - public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | |
309 | - GetRegisterNoResp resp = new GetRegisterNoResp(); | |
310 | - if (Validator.isNull(req.getUserId())||Validator.isNull(req.getUserType())) { | |
311 | - resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | |
312 | - resp.setMsg("用户ID和用户类型不能为空"); | |
313 | - return resp; | |
314 | - } | |
315 | - //先从缓存取 | |
316 | - String redisKey=""; | |
317 | - if (req.getUserType()==Constant.USER_ROLE_BUYER){ | |
318 | - redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(req.getUserId())); | |
319 | - }else if (req.getUserType()==Constant.USER_ROLE_SELLER){ | |
320 | - redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(req.getUserId())); | |
321 | - } | |
322 | - GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
323 | - if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | |
324 | - resp.setRegisterNos(recache.getRegisterNos()); | |
325 | - }else { | |
326 | - List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserType(),req.getUserId()); | |
327 | - if (!Validator.isEmpty(mapppers)) { | |
328 | - | |
329 | - resp.setRegisterNos(mapppers); | |
330 | - redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | |
331 | - }else { | |
332 | - resp.setCode(ResultCode.BUSINESS_FAILED); | |
333 | - resp.setMsg("该用户没有绑定极光号"); | |
334 | - } | |
335 | - } | |
336 | - return resp; | |
337 | - } | |
338 | - | |
339 | - @Override | |
340 | - public GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req) { | |
341 | - GetRegisterNobyUidsResp resp = new GetRegisterNobyUidsResp(); | |
342 | - Map<String, Object> param = new HashMap<String, Object>(); | |
343 | - param.put("userids", req.getUserIds()); | |
344 | - param.put("userType",req.getUserType()); | |
345 | - if (!Validator.isNull(req.getPlatform())) { | |
346 | - param.put("device_type",req.getPlatform().toString()); | |
347 | - } | |
348 | - List<RegisterNoMapper> mappers = registerNoMapperManager.batchQuery(param); | |
349 | - | |
350 | - List<RegisterNoPlatform> registerNos = new ArrayList<RegisterNoPlatform>(); | |
351 | - RegisterNoPlatform androidPlatform = new RegisterNoPlatform(); | |
352 | - androidPlatform.setPlatform("android"); | |
353 | - List<String> androids = new ArrayList<String>(); | |
354 | - RegisterNoPlatform iosPlatform = new RegisterNoPlatform(); | |
355 | - iosPlatform.setPlatform("ios"); | |
356 | - List<String> iosids = new ArrayList<String>(); | |
357 | - if (!Validator.isEmpty(mappers)) { | |
358 | - for (RegisterNoMapper registerNoMapper : mappers) { | |
359 | - if (!Validator.isNull(registerNoMapper.getDeviceType())) { | |
360 | - if (registerNoMapper.getDeviceType().equals(1)) { | |
361 | - androids.add(registerNoMapper.getRegisterNo()); | |
362 | - } | |
363 | - if (registerNoMapper.getDeviceType().equals(2)) { | |
364 | - iosids.add(registerNoMapper.getRegisterNo()); | |
365 | - } | |
366 | - } | |
367 | - } | |
368 | - } | |
369 | - androidPlatform.setIds(androids); | |
370 | - iosPlatform.setIds(iosids); | |
371 | - registerNos.add(androidPlatform); | |
372 | - registerNos.add(iosPlatform); | |
373 | - resp.setRegisterNos(registerNos); | |
374 | - resp.setCode(ResultCode.SUCCESS); | |
375 | - return resp; | |
376 | - } | |
377 | - | |
378 | - | |
379 | - | |
380 | - @Override | |
381 | - public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) { | |
382 | - ShopBuyerOutput shopByuer = userRPC.getDepositCardAmount(req.getShopBuyerId(),req.getUserId()); | |
383 | - GetDepositCardAmountResp resp = new GetDepositCardAmountResp(); | |
384 | - resp.setShopId(shopByuer.getShopId()); | |
385 | - resp.setFreezeTotalPrice(shopByuer.getFreezeTotalPrice()); | |
386 | - resp.setResidueTotalPrice(shopByuer.getResidueTotalPrice()); | |
387 | - resp.setStoredTotalPrice(shopByuer.getStoredTotalPrice()); | |
388 | - return resp; | |
389 | - } | |
390 | - | |
391 | - | |
392 | - @Override | |
393 | - public SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req) { | |
394 | - return null; | |
395 | - } | |
396 | - | |
397 | - @Override | |
398 | - public LoginResp authlogin(AuthLoginReq req) { | |
399 | - BuyerInfoOutput userInfo = passportRPC.authlogin(req); | |
400 | - | |
401 | - //缓存用户信息 | |
402 | - cacheUserInfo(userInfo.getId(),req.getDeviceId()); | |
403 | - if (Validator.isEmpty(req.getRegisterNo())){ | |
404 | - logger.error("卖家登录激光推送id为空[userId=]",userInfo.getId()); | |
405 | - }else{ | |
406 | - //绑定用户激光推送id | |
407 | - bindUserRegisterNo(userInfo.getId(),req.getRegisterNo(),req.getDeviceType()); | |
408 | - } | |
409 | - Long currentShopId = userInfo.getCurrentShopId(); | |
410 | - LoginResp resp = new LoginResp(); | |
411 | - if (Validator.isNull(currentShopId)){ | |
412 | - logger.info("用户未绑定店铺[buyerId=]",userInfo.getId()); | |
413 | - resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
414 | - } | |
415 | - resp.setBuyerId(userInfo.getId()); | |
416 | - resp.setHeadImg(userInfo.getFace()); | |
417 | - resp.setMobile(userInfo.getMobilePhone()); | |
418 | - resp.setAccountName(userInfo.getAccountName()); | |
419 | - resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
420 | - return resp; | |
421 | - } | |
76 | + @Resource | |
77 | + private UserRPC userRPC; | |
78 | + @Autowired | |
79 | + private RedisUtilImpl redisUtil; | |
80 | + | |
81 | + @Resource | |
82 | + private RegisterNoMapperManager registerNoMapperManager; | |
83 | + @Resource | |
84 | + private PassportRPC passportRPC; | |
85 | + @Resource | |
86 | + private PickInfoRPC pickInfoRPC; | |
87 | + | |
88 | + /** | |
89 | + * 登录超时时间:秒 | |
90 | + */ | |
91 | + @Value("${login.timeout.second}") | |
92 | + private int loginExpireTime; | |
93 | + | |
94 | + private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); | |
95 | + | |
96 | + @Override | |
97 | + public LoginResp buyerlogin(LoginReq req) { | |
98 | + BuyerInfoOutput userInfo = passportRPC.buyerLogin(req); | |
99 | + | |
100 | + // 缓存用户登录信息 | |
101 | + cacheUserInfo(userInfo.getId(), req.getDeviceId()); | |
102 | + | |
103 | + if (Validator.isEmpty(req.getRegisterNo())) { | |
104 | + logger.error("卖家登录激光推送id为空[userId=]", userInfo.getId()); | |
105 | + } else { | |
106 | + // 绑定用户激光推送id | |
107 | + bindUserRegisterNo(userInfo.getId(), req.getRegisterNo(), req.getDeviceType()); | |
108 | + } | |
109 | + Long currentShopId = userInfo.getCurrentShopId(); | |
110 | + LoginResp resp = new LoginResp(); | |
111 | + if (Validator.isNull(currentShopId)) { | |
112 | + logger.info("用户未绑定店铺[buyerId=]", userInfo.getId()); | |
113 | + resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
114 | + } | |
115 | + resp.setBuyerId(userInfo.getId()); | |
116 | + resp.setHeadImg(userInfo.getFace()); | |
117 | + resp.setMobile(userInfo.getMobilePhone()); | |
118 | + resp.setAccountName(userInfo.getAccountName()); | |
119 | + resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
120 | + return resp; | |
121 | + } | |
122 | + | |
123 | + private void bindUserRegisterNo(Long id, String registerNo, Integer deviceType) { | |
124 | + // 缓存 | |
125 | + String redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
126 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(id)); | |
127 | + | |
128 | + GetRegisterNoResp mappers = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
129 | + // 绑定极光ID | |
130 | + RegisterNoMapper mapper = new RegisterNoMapper(); | |
131 | + mapper.setRegisterNo(registerNo); | |
132 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
133 | + mapper.setUserid(id); | |
134 | + mapper.setUserType(Constant.USER_ROLE_BUYER); | |
135 | + mapper.setDeviceType(deviceType); | |
136 | + try { | |
137 | + // 清除当前极光号userid缓存 | |
138 | + cleanOldredis(mapper); | |
139 | + // 构建缓存信息 | |
140 | + buildRedisInfo(mappers, mapper); | |
141 | + redisUtil.setObjectByExpire(redisKey, mappers, RedisKey.REGISTERNO_EXPIRE_TIME); | |
142 | + } catch (Exception e) { | |
143 | + throw new ServiceException(ResultCode.PUSH_MESSAGE_NO, "绑定极光推送系统注册号失败"); | |
144 | + } | |
145 | + } | |
146 | + | |
147 | + private void cacheUserInfo(Long id, String deviceId) { | |
148 | + | |
149 | + // 缓存userId | |
150 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, | |
151 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(id)); | |
152 | + redisUtil.setStringByExpire(cookieRedisKey, String.valueOf(id), loginExpireTime); | |
153 | + | |
154 | + // 缓存设备id,userId作为key | |
155 | + if (!Validator.isNull(deviceId)) { | |
156 | + String onlyOneLoginRedisKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, | |
157 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(id)); | |
158 | + redisUtil.setStringByExpire(onlyOneLoginRedisKey, deviceId, loginExpireTime); | |
159 | + } | |
160 | + | |
161 | + // 缓存currentShopId | |
162 | + // if (!Validator.isNull(resp.getCurrentShopId())){ | |
163 | + // String currentShopIdKey = | |
164 | + // redisUtil.makeKey(RedisKey.USER_BUYER_CURRENTSHOPID, | |
165 | + // Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
166 | + // redisUtil.setStringByExpire(currentShopIdKey, | |
167 | + // String.valueOf(resp.getCurrentShopId()), loginExpireTime); | |
168 | + // } | |
169 | + | |
170 | + // 缓存shopBuyerId | |
171 | + // if (!Validator.isNull(resp.getShopBuyerId())){ | |
172 | + // String shopUserIdKey = | |
173 | + // redisUtil.makeKey(RedisKey.USER_BUYER_SHOPUSERID, | |
174 | + // Constant.USER_ROLE_SIGN_BUYER+String.valueOf(resp.getBuyerId())); | |
175 | + // redisUtil.setStringByExpire(shopUserIdKey, | |
176 | + // String.valueOf(resp.getShopBuyerId()), loginExpireTime); | |
177 | + // } | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * 清除当前极光号下userid缓存 | |
182 | + * | |
183 | + * @param mapper | |
184 | + */ | |
185 | + private void cleanOldredis(RegisterNoMapper mapper) { | |
186 | + RegisterNoMapper oldmapper = registerNoMapperManager.bindRegisterNo(mapper); | |
187 | + if (!Validator.isNull(oldmapper)) { | |
188 | + String oldKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
189 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(oldmapper.getUserid())); | |
190 | + redisUtil.deleteByKey(oldKey); | |
191 | + } | |
192 | + } | |
193 | + | |
194 | + /** | |
195 | + * 建立缓存信息 | |
196 | + * | |
197 | + * @param mappers | |
198 | + * @param mapper | |
199 | + */ | |
200 | + private void buildRedisInfo(GetRegisterNoResp mappers, RegisterNoMapper mapper) { | |
201 | + // 如果缓存没有重新建 | |
202 | + List<RegisterNoMapper> renolist = new ArrayList<RegisterNoMapper>(); | |
203 | + | |
204 | + if (Validator.isNull(mappers)) { | |
205 | + mappers = new GetRegisterNoResp(); | |
206 | + } | |
207 | + renolist.add(mapper); | |
208 | + mappers.setRegisterNos(renolist); | |
209 | + } | |
210 | + | |
211 | + @Override | |
212 | + public CheckVeriCodeResp checkVeriCode(CheckVeriCodeReq req) { | |
213 | + passportRPC.verifyBuyerSmsCode(req.getMobile(), req.getVeriCode()); | |
214 | + | |
215 | + return new CheckVeriCodeResp(); | |
216 | + } | |
217 | + | |
218 | + @Override | |
219 | + public SendVeriCodeResp sendVeriCode(SendVeriCodeReq req) { | |
220 | + String mobile = req.getMobile(); | |
221 | + BuyerInfoOutput userinfo = userRPC.checkMobile(mobile); | |
222 | + Integer msgType = req.getMsgType(); | |
223 | + if (msgType == SendVeriCodeReq.MSG_TYPE_LOGIN || msgType == SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD) { | |
224 | + if (Validator.isNull(userinfo)) { | |
225 | + if (Validator.isNull(userinfo)) { | |
226 | + throw new ServiceException(ErrorMessage.USER_MOBILE_NOT_EXIST); | |
227 | + } | |
228 | + } | |
229 | + } | |
230 | + if (msgType == SendVeriCodeReq.MSG_TYPE_REGISTER) { | |
231 | + if (!Validator.isNull(userinfo)) { | |
232 | + throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | |
233 | + } | |
234 | + } | |
235 | + BaseOutput<String> out = passportRPC.sendVeriCodeOfBuyer(mobile, req.getMsgType()); | |
236 | + SendVeriCodeResp resp = new SendVeriCodeResp(); | |
237 | + resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | |
238 | + resp.setPassKey(out.getData()); | |
239 | + return resp; | |
240 | + } | |
241 | + | |
242 | + @Override | |
243 | + public UpdateUserInfoResp updateUserInfo(UpdateUserInfoReq req) { | |
244 | + return null; | |
245 | + } | |
246 | + | |
247 | + @Override | |
248 | + public UserRegisterResp userRegister(UserRegisterReq req) { | |
249 | + // 手机号码和账号验证、验证码 | |
250 | + // if (!checkRegisterInfo(resp, req)) { | |
251 | + // return resp; | |
252 | + // } | |
253 | + passportRPC.buyerRegister(req); | |
254 | + UserRegisterResp resp = new UserRegisterResp(); | |
255 | + resp.setResultFlag(UserRegisterResp.RESULT_FLAG_SUCCESS); | |
256 | + return resp; | |
257 | + } | |
258 | + | |
259 | + @Override | |
260 | + public GetUserInfoResp getUserIntroduction(GetUserInfoReq req) { | |
261 | + return null; | |
262 | + } | |
263 | + | |
264 | + @Override | |
265 | + public LogoutResp logout(LogoutReq req) { | |
266 | + LogoutResp resp = new LogoutResp(); | |
267 | + | |
268 | + // 解除登录缓存信息 | |
269 | + // userId | |
270 | + String cookieUserIdKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, | |
271 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(req.getUserId())); | |
272 | + // 设备id | |
273 | + String cookieDeviceIdKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, | |
274 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(req.getUserId())); | |
275 | + try { | |
276 | + redisUtil.deleteByKey(cookieUserIdKey); | |
277 | + redisUtil.deleteByKey(cookieDeviceIdKey); | |
278 | + } catch (Exception e) { | |
279 | + logger.error("买家退出登录异常:清除登录缓存信息失败", e); | |
280 | + } | |
281 | + // 解除绑定极光ID | |
282 | + if (!Validator.isEmpty(req.getRegisterNo())) { | |
283 | + | |
284 | + String userId = req.getUserId().toString(); | |
285 | + // 先清缓存再清数据库 | |
286 | + String reNOCache = redisUtil.makeKey(RedisKey.USER_REGISTERNO, Constant.USER_ROLE_SIGN_BUYER + userId); | |
287 | + | |
288 | + RegisterNoMapper mapper = new RegisterNoMapper(); | |
289 | + mapper.setRegisterNo(req.getRegisterNo()); | |
290 | + mapper.setSysFlag(RegisterNoMapper.SYS_FLAG_JPUSH); | |
291 | + mapper.setUserid(req.getUserId()); | |
292 | + mapper.setUserType(Constant.USER_ROLE_BUYER); | |
293 | + mapper.setDeviceType(req.getDeviceType()); | |
294 | + try { | |
295 | + redisUtil.deleteByKey(reNOCache); | |
296 | + registerNoMapperManager.unBindRegisterNo(mapper); | |
297 | + } catch (Exception e) { | |
298 | + logger.error("解除极光推送系统绑定的注册号失败", e); | |
299 | + } | |
300 | + } | |
301 | + | |
302 | + return resp; | |
303 | + } | |
304 | + | |
305 | + @Override | |
306 | + public ModifyPwdResp modifyPwd(ModifyPwdReq req) { | |
307 | + BuyerInfoOutput userInfo = userRPC.getUserByMobile(req.getAccountName()); | |
308 | + Long userId = userInfo.getId(); | |
309 | + boolean result = passportRPC.modifyPwdBuyer(req); | |
310 | + ModifyPwdResp resp = new ModifyPwdResp(); | |
311 | + if (!result) { | |
312 | + // 失败 | |
313 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
314 | + resp.setResultFlag(ModifyPwdResp.RESULT_FLAG_FAILED); | |
315 | + return resp; | |
316 | + } else { | |
317 | + // 修改成功,退出所有账号信息 | |
318 | + String cookieRedisKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, | |
319 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(userId)); | |
320 | + redisUtil.deleteByKey(cookieRedisKey); | |
321 | + } | |
322 | + return resp; | |
323 | + } | |
324 | + | |
325 | + @Override | |
326 | + public GetRegisterNoResp getRegisterNo(GetRegisterNoReq req) { | |
327 | + GetRegisterNoResp resp = new GetRegisterNoResp(); | |
328 | + if (Validator.isNull(req.getUserId()) || Validator.isNull(req.getUserType())) { | |
329 | + resp.setCode(ResultCode.REQUET_PARAMS_ERROR); | |
330 | + resp.setMsg("用户ID和用户类型不能为空"); | |
331 | + return resp; | |
332 | + } | |
333 | + // 先从缓存取 | |
334 | + String redisKey = ""; | |
335 | + if (req.getUserType() == Constant.USER_ROLE_BUYER) { | |
336 | + redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
337 | + Constant.USER_ROLE_SIGN_BUYER + String.valueOf(req.getUserId())); | |
338 | + } else if (req.getUserType() == Constant.USER_ROLE_SELLER) { | |
339 | + redisKey = redisUtil.makeKey(RedisKey.USER_REGISTERNO, | |
340 | + Constant.USER_ROLE_SIGN_SELLER + String.valueOf(req.getUserId())); | |
341 | + } | |
342 | + GetRegisterNoResp recache = redisUtil.getObject(redisKey, GetRegisterNoResp.class); | |
343 | + if (!Validator.isNull(recache) && !Validator.isEmpty(recache.getRegisterNos())) { | |
344 | + resp.setRegisterNos(recache.getRegisterNos()); | |
345 | + } else { | |
346 | + List<RegisterNoMapper> mapppers = registerNoMapperManager.getRegisterNo(req.getUserType(), req.getUserId()); | |
347 | + if (!Validator.isEmpty(mapppers)) { | |
348 | + | |
349 | + resp.setRegisterNos(mapppers); | |
350 | + redisUtil.setObjectByExpire(redisKey, resp, RedisKey.REGISTERNO_EXPIRE_TIME); | |
351 | + } else { | |
352 | + resp.setCode(ResultCode.BUSINESS_FAILED); | |
353 | + resp.setMsg("该用户没有绑定极光号"); | |
354 | + } | |
355 | + } | |
356 | + return resp; | |
357 | + } | |
358 | + | |
359 | + @Override | |
360 | + public GetRegisterNobyUidsResp getRegisterNobyUids(GetRegisterNobyUidsReq req) { | |
361 | + GetRegisterNobyUidsResp resp = new GetRegisterNobyUidsResp(); | |
362 | + Map<String, Object> param = new HashMap<String, Object>(); | |
363 | + param.put("userids", req.getUserIds()); | |
364 | + param.put("userType", req.getUserType()); | |
365 | + if (!Validator.isNull(req.getPlatform())) { | |
366 | + param.put("device_type", req.getPlatform().toString()); | |
367 | + } | |
368 | + List<RegisterNoMapper> mappers = registerNoMapperManager.batchQuery(param); | |
369 | + | |
370 | + List<RegisterNoPlatform> registerNos = new ArrayList<RegisterNoPlatform>(); | |
371 | + RegisterNoPlatform androidPlatform = new RegisterNoPlatform(); | |
372 | + androidPlatform.setPlatform("android"); | |
373 | + List<String> androids = new ArrayList<String>(); | |
374 | + RegisterNoPlatform iosPlatform = new RegisterNoPlatform(); | |
375 | + iosPlatform.setPlatform("ios"); | |
376 | + List<String> iosids = new ArrayList<String>(); | |
377 | + if (!Validator.isEmpty(mappers)) { | |
378 | + for (RegisterNoMapper registerNoMapper : mappers) { | |
379 | + if (!Validator.isNull(registerNoMapper.getDeviceType())) { | |
380 | + if (registerNoMapper.getDeviceType().equals(1)) { | |
381 | + androids.add(registerNoMapper.getRegisterNo()); | |
382 | + } | |
383 | + if (registerNoMapper.getDeviceType().equals(2)) { | |
384 | + iosids.add(registerNoMapper.getRegisterNo()); | |
385 | + } | |
386 | + } | |
387 | + } | |
388 | + } | |
389 | + androidPlatform.setIds(androids); | |
390 | + iosPlatform.setIds(iosids); | |
391 | + registerNos.add(androidPlatform); | |
392 | + registerNos.add(iosPlatform); | |
393 | + resp.setRegisterNos(registerNos); | |
394 | + resp.setCode(ResultCode.SUCCESS); | |
395 | + return resp; | |
396 | + } | |
397 | + | |
398 | + @Override | |
399 | + public GetDepositCardAmountResp getDepositCardAmount(GetDepositCardAmountReq req) { | |
400 | + ShopBuyerOutput shopByuer = userRPC.getDepositCardAmount(req.getShopBuyerId(), req.getUserId()); | |
401 | + GetDepositCardAmountResp resp = new GetDepositCardAmountResp(); | |
402 | + resp.setShopId(shopByuer.getShopId()); | |
403 | + resp.setFreezeTotalPrice(shopByuer.getFreezeTotalPrice()); | |
404 | + resp.setResidueTotalPrice(shopByuer.getResidueTotalPrice()); | |
405 | + resp.setStoredTotalPrice(shopByuer.getStoredTotalPrice()); | |
406 | + return resp; | |
407 | + } | |
408 | + | |
409 | + @Override | |
410 | + public SearchUserInfoResp searchBuyerInfo(SearchUserInfoReq req) { | |
411 | + return null; | |
412 | + } | |
413 | + | |
414 | + @Override | |
415 | + public LoginResp authlogin(AuthLoginReq req) { | |
416 | + BuyerInfoOutput userInfo = passportRPC.authlogin(req); | |
417 | + | |
418 | + // 缓存用户信息 | |
419 | + cacheUserInfo(userInfo.getId(), req.getDeviceId()); | |
420 | + if (Validator.isEmpty(req.getRegisterNo())) { | |
421 | + logger.error("卖家登录激光推送id为空[userId=]", userInfo.getId()); | |
422 | + } else { | |
423 | + // 绑定用户激光推送id | |
424 | + bindUserRegisterNo(userInfo.getId(), req.getRegisterNo(), req.getDeviceType()); | |
425 | + } | |
426 | + Long currentShopId = userInfo.getCurrentShopId(); | |
427 | + LoginResp resp = new LoginResp(); | |
428 | + if (Validator.isNull(currentShopId)) { | |
429 | + logger.info("用户未绑定店铺[buyerId=]", userInfo.getId()); | |
430 | + resp.setMsg(ErrorMessage.BUYER_NOT_OPEN_SHOP); | |
431 | + } | |
432 | + resp.setBuyerId(userInfo.getId()); | |
433 | + resp.setHeadImg(userInfo.getFace()); | |
434 | + resp.setMobile(userInfo.getMobilePhone()); | |
435 | + resp.setAccountName(userInfo.getAccountName()); | |
436 | + resp.setCurrentShopId(userInfo.getCurrentShopId()); | |
437 | + return resp; | |
438 | + } | |
439 | + | |
440 | + @Override | |
441 | + public GetDeliveryAddressResp getDeliveryAddresses(GetDeliveryAddressReq req) { | |
442 | + PickingInfoOutput response = this.pickInfoRPC.getDefaultPickingInfoByBuyerId(req.getShopBuyerId()); | |
443 | + if (response == null) { | |
444 | + throw new ServiceException(ResultCode.NETWORK_FAILED, "获取默认收货地址失败"); | |
445 | + } | |
446 | + GetDeliveryAddressResp resp = new GetDeliveryAddressResp(); | |
447 | + PickInfo pickInfo = new PickInfo(); | |
448 | + pickInfo.setCityAddress(response.getAddressText()); | |
449 | + pickInfo.setCityId(response.getAddressId()); | |
450 | + pickInfo.setIsDefault(response.getDef()); | |
451 | + pickInfo.setMobile(response.getTelphone()); | |
452 | + pickInfo.setName(response.getName()); | |
453 | + pickInfo.setStreetAddress(response.getAddressDetail()); | |
454 | + resp.setPickInfo(pickInfo); | |
455 | + return resp; | |
456 | + } | |
422 | 457 | } | ... | ... |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/order/OrderController.java
... | ... | @@ -21,7 +21,6 @@ import com.diligrp.mobsite.getway.domain.protocol.order.GetOrderReq; |
21 | 21 | import com.diligrp.mobsite.getway.domain.protocol.order.GetOrderResp; |
22 | 22 | import com.diligrp.mobsite.getway.domain.protocol.order.PaymentReq; |
23 | 23 | import com.diligrp.mobsite.getway.domain.protocol.order.PaymentResp; |
24 | -import com.diligrp.mobsite.getway.domain.protocol.order.SearchOrderReq; | |
25 | 24 | import com.diligrp.mobsite.getway.domain.protocol.order.SubmitOrderReq; |
26 | 25 | import com.diligrp.mobsite.getway.domain.protocol.order.SubmitOrderResp; |
27 | 26 | import com.diligrp.mobsite.getway.domain.protocol.saler.order.SearchOrderListReq; |
... | ... | @@ -68,7 +67,7 @@ public class OrderController extends BaseApiController { |
68 | 67 | @RequestMapping(value = "/getOrders", method = RequestMethod.POST) |
69 | 68 | @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "temp", dataType = "SearchOrderReq") }) |
70 | 69 | @ResponseBody |
71 | - public void getOrders(@RequestBody SearchOrderReq temp) { | |
70 | + public void getOrders(@RequestBody SearchOrderListReq temp) { | |
72 | 71 | |
73 | 72 | SearchOrderListReq req = super.getRequest(SearchOrderListReq.class); |
74 | 73 | try { | ... | ... |
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,517 @@ 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.buyerlogin(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.buyerlogin(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.buyerlogin(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.buyerlogin(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 | + // * 查询用户信息 | |
364 | + // * GetUserInfoReq | |
365 | + // */ | |
366 | + // @ApiOperation(value = "查询买家用户信息", httpMethod = "POST" ,response = | |
367 | + /// GetDepositCardAmountResp.class) | |
368 | + // @RequestMapping(value = "/getBuyerInfo",method = RequestMethod.POST) | |
369 | + // @ResponseBody | |
370 | + // public void getBuyerInfo() { | |
371 | + // GetUserInfoReq req = getRequest(GetUserInfoReq.class); | |
372 | + // try { | |
373 | + // GetUserInfoResp resp = userService.getUserIntroduction(req); | |
374 | + // super.sendSuccessResp(resp); | |
375 | + // } catch (ServiceException e){ | |
376 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
377 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
378 | + // sendError(e.getCode(), e.getMessage()); | |
379 | + // } catch (Exception e) { | |
380 | + // LOGGER.error(String.format("ErrorMessage=%s,UserId=%s", e.getMessage(), | |
381 | + /// req.getUserId()), e); | |
382 | + // sendError(e.getMessage()); | |
383 | + // } | |
384 | + // } | |
385 | + | |
386 | + /// ** | |
387 | + // * 搜索买家用户信息 | |
388 | + // * GetUserInfoReq | |
389 | + // */ | |
390 | + // @ApiOperation(value = "搜索买家用户信息", httpMethod = "POST" ,response = | |
391 | + /// SearchUserInfoResp.class) | |
392 | + // @RequestMapping(value = "/searchBuyerInfo",method = RequestMethod.POST) | |
393 | + // @ResponseBody | |
394 | + // public void searchBuyerInfo(@RequestBody SearchUserInfoReq temp) { | |
395 | + // SearchUserInfoReq req = getRequest(SearchUserInfoReq.class); | |
396 | + // try { | |
397 | + // SearchUserInfoResp resp = userService.searchBuyerInfo(req); | |
398 | + // super.sendSuccessResp(resp); | |
399 | + // } catch (ServiceException e){ | |
400 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
401 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
402 | + // sendError(e.getCode(), e.getMessage()); | |
403 | + // } catch (Exception e) { | |
404 | + // LOGGER.error(String.format("ErrorMessage=%s,UserId=%s", e.getMessage(), | |
405 | + /// req.getUserId()), e); | |
406 | + // sendError(e.getMessage()); | |
407 | + // } | |
408 | + // } | |
409 | + | |
410 | + /** | |
411 | + * 查询极光推送号 | |
412 | + * | |
413 | + * getRegisterNo | |
414 | + */ | |
415 | + @ApiOperation(value = "查询极光推送号", httpMethod = "POST", response = GetRegisterNoResp.class) | |
416 | + @RequestMapping(value = "/getRegisterNo", method = RequestMethod.POST) | |
417 | + @ResponseBody | |
418 | + public void getRegisterNo(@RequestBody GetRegisterNoReq temp) { | |
419 | + GetRegisterNoReq req = getRequest(GetRegisterNoReq.class); | |
420 | + try { | |
421 | + GetRegisterNoResp resp = userService.getRegisterNo(req); | |
422 | + sendSuccessResp(resp); | |
423 | + } catch (ServiceException e) { | |
424 | + LOGGER.error(String.format("Code=%s,ErrorMessage=%s", e.getCode(), e.getMessage()), e); | |
425 | + sendError(e.getCode(), e.getMessage()); | |
426 | + } catch (Exception e) { | |
427 | + LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
428 | + sendError(e.getMessage()); | |
429 | + } | |
430 | + } | |
431 | + | |
432 | + /** | |
433 | + * 批量查询极光推送号 | |
434 | + * | |
435 | + * getNosByUserids | |
436 | + */ | |
437 | + @ApiOperation(value = "批量查询极光推送号", httpMethod = "POST", response = GetRegisterNobyUidsResp.class) | |
438 | + @RequestMapping(value = "/getRegisterNobyUids", method = RequestMethod.POST) | |
439 | + @ResponseBody | |
440 | + public void getRegisterNobyUids(@RequestBody GetRegisterNobyUidsReq temp) { | |
441 | + GetRegisterNobyUidsReq req = getRequest(GetRegisterNobyUidsReq.class); | |
442 | + try { | |
443 | + GetRegisterNobyUidsResp resp = userService.getRegisterNobyUids(req); | |
444 | + sendSuccessResp(resp); | |
445 | + } catch (ServiceException e) { | |
446 | + LOGGER.error(String.format("Code=%s,ErrorMessage=%s", e.getCode(), e.getMessage()), e); | |
447 | + sendError(e.getCode(), e.getMessage()); | |
448 | + } catch (Exception e) { | |
449 | + LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
450 | + sendError(e.getMessage()); | |
451 | + } | |
452 | + } | |
453 | + | |
454 | + public void getDeliveryAddress(@RequestBody GetDeliveryAddressReq temp) { | |
455 | + GetDeliveryAddressReq req = getRequest(GetDeliveryAddressReq.class); | |
456 | + try { | |
457 | + GetDeliveryAddressResp resp = userService.getDeliveryAddresses(req); | |
458 | + sendSuccessResp(resp); | |
459 | + } catch (ServiceException e) { | |
460 | + LOGGER.error(String.format("Code=%s,ErrorMessage=%s", e.getCode(), e.getMessage()), e); | |
461 | + sendError(e.getCode(), e.getMessage()); | |
462 | + } catch (Exception e) { | |
463 | + LOGGER.error(String.format("ErrorMessage=%s", e.getMessage()), e); | |
464 | + sendError(e.getMessage()); | |
465 | + } | |
466 | + } | |
467 | + | |
468 | + /// ** | |
469 | + // * 查看交易记录 | |
470 | + // * @createTime 2016年8月24日 下午10:55:03 | |
471 | + // * @author weili | |
472 | + // */ | |
473 | + // @ApiOperation(value = "查看交易记录", httpMethod = "POST" ,response = | |
474 | + /// TradeRecordResp.class) | |
475 | + // @RequestMapping(value = "/getTradeRecord",method = RequestMethod.POST) | |
476 | + // @ResponseBody | |
477 | + // public void getTradeRecord(){ | |
478 | + // TradeRecordReq req = super.getRequest(TradeRecordReq.class); | |
479 | + // try { | |
480 | + // TradeRecordResp resp = userService.getTradeRecord(req); | |
481 | + // super.sendSuccessResp(resp); | |
482 | + // } catch (ServiceException e){ | |
483 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
484 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
485 | + // sendError(e.getCode(), e.getMessage()); | |
486 | + // } catch (Exception e) { | |
487 | + // LOGGER.error("查看交易记录:", e); | |
488 | + // super.sendError(e.getMessage()); | |
489 | + // } | |
490 | + // | |
491 | + // } | |
492 | + | |
493 | + /// ** | |
494 | + // * 验证用户账号是否可用 | |
495 | + // * @createTime 2014年8月28日 下午3:41:02 | |
496 | + // * @author weili | |
497 | + // */ | |
498 | + // @RequestMapping("/checkAccountName") | |
499 | + // @ResponseBody | |
500 | + // public void checkAccountName(){ | |
501 | + // CheckAccountNameReq req = super.getRequest(CheckAccountNameReq.class); | |
502 | + // CheckAccountNameResp resp = null; | |
503 | + // try { | |
504 | + // if(!Validator.isNull(req) && !Validator.isNull(req.getAccountName())){ | |
505 | + // resp = userService.checkAccountName(req); | |
506 | + // } | |
507 | + // else { | |
508 | + // resp = new CheckAccountNameResp(); | |
509 | + // } | |
510 | + // super.sendSuccessResp(resp); | |
511 | + // } catch (ServiceException e){ | |
512 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
513 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
514 | + // sendError(e.getCode(), e.getMessage()); | |
515 | + // } catch (Exception e) { | |
516 | + // LOGGER.error("验证用户账号失败:", e); | |
517 | + // super.sendError(e.getMessage()); | |
518 | + // } | |
519 | + // } | |
520 | + // | |
521 | + | |
522 | + /** | |
523 | + * 验证手机号是否已经被注册 | |
524 | + * | |
525 | + * @createTime 2014年8月28日 下午3:41:02 | |
526 | + * @author weili | |
527 | + */ | |
528 | + // @RequestMapping("/checkMobile") | |
529 | + // @ResponseBody | |
530 | + // @ApiOperation(value = "", httpMethod = "POST") | |
531 | + // public void checkMobile(){ | |
532 | + // CheckMobileReq req = super.getRequest(CheckMobileReq.class); | |
533 | + // CheckMobileResp resp = null; | |
534 | + // try { | |
535 | + // if(!Validator.isNull(req) && !Validator.isNull(req.getMobile())){ | |
536 | + // resp = userService.checkMobile(req); | |
537 | + // } else { | |
538 | + // resp = new CheckMobileResp(); | |
539 | + // } | |
540 | + // super.sendSuccessResp(resp); | |
541 | + // } catch (ServiceException e){ | |
542 | + // LOGGER.error(String.format("Code=%s,ErrorMessage=%s,UserId=%s", | |
543 | + // e.getCode(), e.getMessage(), req.getUserId()), e); | |
544 | + // sendError(e.getCode(), e.getMessage()); | |
545 | + // } catch (Exception e) { | |
546 | + // LOGGER.error("验证手机失败:", e); | |
547 | + // super.sendError(e.getMessage()); | |
548 | + // } | |
549 | + // } | |
524 | 550 | |
525 | 551 | } | ... | ... |