Authored by chenchao

optimized

@@ -6,15 +6,12 @@ import com.yohobuy.ufo.model.order.bo.GoodsInfo; @@ -6,15 +6,12 @@ import com.yohobuy.ufo.model.order.bo.GoodsInfo;
6 import com.yohobuy.ufo.model.order.common.OrderListType; 6 import com.yohobuy.ufo.model.order.common.OrderListType;
7 import com.yohobuy.ufo.model.order.common.SellerOrderListType; 7 import com.yohobuy.ufo.model.order.common.SellerOrderListType;
8 import com.yohobuy.ufo.model.order.common.TabType; 8 import com.yohobuy.ufo.model.order.common.TabType;
9 -import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq;  
10 import com.yohobuy.ufo.model.order.resp.BuyerOrderNums; 9 import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
11 import com.yohobuy.ufo.model.order.resp.OrderCntResp; 10 import com.yohobuy.ufo.model.order.resp.OrderCntResp;
12 import com.yohobuy.ufo.model.order.resp.OrderListInfo; 11 import com.yohobuy.ufo.model.order.resp.OrderListInfo;
13 import com.yohobuy.ufo.model.order.resp.PageResp; 12 import com.yohobuy.ufo.model.order.resp.PageResp;
14 import com.yohobuy.ufo.model.order.vo.AddressInfo; 13 import com.yohobuy.ufo.model.order.vo.AddressInfo;
15 import com.yohoufo.common.ApiResponse; 14 import com.yohoufo.common.ApiResponse;
16 -import com.yohoufo.common.annotation.IgnoreSession;  
17 -import com.yohoufo.common.annotation.IgnoreSignature;  
18 import com.yohoufo.order.model.request.OrderListRequest; 15 import com.yohoufo.order.model.request.OrderListRequest;
19 import com.yohoufo.order.model.request.OrderRequest; 16 import com.yohoufo.order.model.request.OrderRequest;
20 import com.yohoufo.order.model.response.OrderDetailInfo; 17 import com.yohoufo.order.model.response.OrderDetailInfo;
@@ -25,7 +22,9 @@ import com.yohoufo.order.utils.LoggerUtils; @@ -25,7 +22,9 @@ import com.yohoufo.order.utils.LoggerUtils;
25 import org.apache.commons.lang3.StringUtils; 22 import org.apache.commons.lang3.StringUtils;
26 import org.slf4j.Logger; 23 import org.slf4j.Logger;
27 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
28 -import org.springframework.web.bind.annotation.*; 25 +import org.springframework.web.bind.annotation.RequestMapping;
  26 +import org.springframework.web.bind.annotation.RequestParam;
  27 +import org.springframework.web.bind.annotation.RestController;
29 28
30 import java.util.HashMap; 29 import java.util.HashMap;
31 import java.util.List; 30 import java.util.List;
@@ -45,9 +44,6 @@ public class BuyerOrderController { @@ -45,9 +44,6 @@ public class BuyerOrderController {
45 @Autowired 44 @Autowired
46 private SellerFeeService sellerFeeService; 45 private SellerFeeService sellerFeeService;
47 46
48 -  
49 -  
50 -  
51 /** 47 /**
52 * [购买]订单列表 48 * [购买]订单列表
53 * 1: 全部 49 * 1: 全部
@@ -58,16 +54,12 @@ public class BuyerOrderController { @@ -58,16 +54,12 @@ public class BuyerOrderController {
58 * 7:交易失败 54 * 7:交易失败
59 */ 55 */
60 @RequestMapping(params = "method=ufo.order.list") 56 @RequestMapping(params = "method=ufo.order.list")
61 - @ResponseBody  
62 public ApiResponse getOrderList(@RequestParam("type") int type, 57 public ApiResponse getOrderList(@RequestParam("type") int type,
63 @RequestParam("uid") int uid, 58 @RequestParam("uid") int uid,
64 @RequestParam("tabType") String tabType, 59 @RequestParam("tabType") String tabType,
65 @RequestParam(value = "page", required = false, defaultValue = "1") int page, 60 @RequestParam(value = "page", required = false, defaultValue = "1") int page,
66 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { 61 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
67 -  
68 -  
69 TabType actor = TabType.getTabType(tabType); 62 TabType actor = TabType.getTabType(tabType);
70 -  
71 if (Objects.isNull(actor)){ 63 if (Objects.isNull(actor)){
72 return new ApiResponse.ApiResponseBuilder().code(400).message("非法的tab").build(); 64 return new ApiResponse.ApiResponseBuilder().code(400).message("非法的tab").build();
73 } 65 }
@@ -79,9 +71,7 @@ public class BuyerOrderController { @@ -79,9 +71,7 @@ public class BuyerOrderController {
79 .tabType(tabType) 71 .tabType(tabType)
80 .actor(actor) 72 .actor(actor)
81 .build(); 73 .build();
82 -  
83 LOG.info("in ufo.order.list, req {}", orderListRequest); 74 LOG.info("in ufo.order.list, req {}", orderListRequest);
84 -  
85 PageResp<OrderListInfo> orderListInfoRsp; 75 PageResp<OrderListInfo> orderListInfoRsp;
86 switch (actor){ 76 switch (actor){
87 case BUY: 77 case BUY:
@@ -93,7 +83,6 @@ public class BuyerOrderController { @@ -93,7 +83,6 @@ public class BuyerOrderController {
93 default: 83 default:
94 orderListInfoRsp = null; 84 orderListInfoRsp = null;
95 } 85 }
96 -  
97 return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("订单列表").build(); 86 return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("订单列表").build();
98 } 87 }
99 88
@@ -105,7 +94,6 @@ public class BuyerOrderController { @@ -105,7 +94,6 @@ public class BuyerOrderController {
105 * @return 94 * @return
106 */ 95 */
107 @RequestMapping(params = "method=ufo.order.detail") 96 @RequestMapping(params = "method=ufo.order.detail")
108 - @ResponseBody  
109 public ApiResponse getOrderDetail(@RequestParam("orderCode") long orderCode, 97 public ApiResponse getOrderDetail(@RequestParam("orderCode") long orderCode,
110 @RequestParam("uid") int uid, 98 @RequestParam("uid") int uid,
111 @RequestParam("tabType") String tabType) { 99 @RequestParam("tabType") String tabType) {
@@ -137,8 +125,6 @@ public class BuyerOrderController { @@ -137,8 +125,6 @@ public class BuyerOrderController {
137 return new ApiResponse.ApiResponseBuilder().code(200).data(orderDetailInfo).message("订单详情").build(); 125 return new ApiResponse.ApiResponseBuilder().code(200).data(orderDetailInfo).message("订单详情").build();
138 } 126 }
139 127
140 -  
141 -  
142 /** 128 /**
143 * 买家修改收货地址 129 * 买家修改收货地址
144 * 最新逻辑:手机号码、详细地址和收货人如果存在*号,先判断是不是跟原来的一样,如果不一样, 130 * 最新逻辑:手机号码、详细地址和收货人如果存在*号,先判断是不是跟原来的一样,如果不一样,
@@ -184,28 +170,6 @@ public class BuyerOrderController { @@ -184,28 +170,6 @@ public class BuyerOrderController {
184 return new ApiResponse.ApiResponseBuilder().code(200).message("接受瑕疵").build(); 170 return new ApiResponse.ApiResponseBuilder().code(200).message("接受瑕疵").build();
185 } 171 }
186 172
187 - @IgnoreSession  
188 - @IgnoreSignature  
189 - @RequestMapping(value = "/erp/qualityCheckPass")  
190 - @ResponseBody  
191 - public ApiResponse qualityCheckPass(@RequestBody OrderRequest request) {  
192 - LOG.info("method ufo.depot.qualityCheckPass in, req is {}", request);  
193 - buyerOrderService.qualityCheckPass(request.getOrderCode());  
194 - LOG.info("method ufo.depot.qualityCheckPass out, req is {}", request);  
195 - return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心质检通过成功").build();  
196 - }  
197 -  
198 - @IgnoreSession  
199 - @IgnoreSignature  
200 - @RequestMapping(value = "/erp/miniFaultCreate")  
201 - @ResponseBody  
202 - public ApiResponse miniFaultCreate(@RequestBody OrderRequest request) {  
203 - LOG.info("method ufo.depot.miniFaultCreate in, req is {}", request);  
204 - buyerOrderService.miniFaultCreate(request.getOrderCode());  
205 - LOG.info("method ufo.depot.miniFaultCreate out, req is {}", request);  
206 - return new ApiResponse.ApiResponseBuilder().code(200).message("瑕疵创建成功").build();  
207 - }  
208 -  
209 /** 173 /**
210 * 用户不接受瑕疵 174 * 用户不接受瑕疵
211 */ 175 */
@@ -229,29 +193,22 @@ public class BuyerOrderController { @@ -229,29 +193,22 @@ public class BuyerOrderController {
229 */ 193 */
230 194
231 @RequestMapping(params = "method=ufo.buyer.cancel") 195 @RequestMapping(params = "method=ufo.buyer.cancel")
232 - @ResponseBody  
233 public ApiResponse cancel(@RequestParam("orderCode") long orderCode, 196 public ApiResponse cancel(@RequestParam("orderCode") long orderCode,
234 @RequestParam("uid") int uid) { 197 @RequestParam("uid") int uid) {
235 LOG.info("method ufo.buyer.cancel in, orderCode is {}, uid is {}", orderCode, uid); 198 LOG.info("method ufo.buyer.cancel in, orderCode is {}, uid is {}", orderCode, uid);
236 -  
237 -  
238 OrderRequest orderRequest = OrderRequest.builder() 199 OrderRequest orderRequest = OrderRequest.builder()
239 .uid(uid) 200 .uid(uid)
240 .orderCode(orderCode) 201 .orderCode(orderCode)
241 .build(); 202 .build();
242 buyerOrderService.cancel(orderRequest); 203 buyerOrderService.cancel(orderRequest);
243 -  
244 LOG.info("method ufo.buyer.cancel out, orderCode is {}, uid is {}", orderCode, uid); 204 LOG.info("method ufo.buyer.cancel out, orderCode is {}, uid is {}", orderCode, uid);
245 -  
246 return new ApiResponse.ApiResponseBuilder().code(200).message("取消成功").build(); 205 return new ApiResponse.ApiResponseBuilder().code(200).message("取消成功").build();
247 } 206 }
248 207
249 /** 208 /**
250 * 取消订单 209 * 取消订单
251 */ 210 */
252 -  
253 @RequestMapping(params = "method=ufo.buyer.delete") 211 @RequestMapping(params = "method=ufo.buyer.delete")
254 - @ResponseBody  
255 public ApiResponse delete(@RequestParam("orderCode") long orderCode, 212 public ApiResponse delete(@RequestParam("orderCode") long orderCode,
256 @RequestParam("uid") int uid) { 213 @RequestParam("uid") int uid) {
257 LOG.info("method ufo.buyer.delete in, orderCode is {}, uid is {}", orderCode, uid); 214 LOG.info("method ufo.buyer.delete in, orderCode is {}, uid is {}", orderCode, uid);
@@ -260,7 +217,6 @@ public class BuyerOrderController { @@ -260,7 +217,6 @@ public class BuyerOrderController {
260 return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("取消成功").build(); 217 return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("取消成功").build();
261 } 218 }
262 219
263 -  
264 /** 220 /**
265 * 确认收货 221 * 确认收货
266 * @param orderCode 222 * @param orderCode
@@ -268,7 +224,6 @@ public class BuyerOrderController { @@ -268,7 +224,6 @@ public class BuyerOrderController {
268 * @return 224 * @return
269 */ 225 */
270 @RequestMapping(params = "method=ufo.buyer.confirm") 226 @RequestMapping(params = "method=ufo.buyer.confirm")
271 - @ResponseBody  
272 public ApiResponse confirm(@RequestParam("orderCode") long orderCode, 227 public ApiResponse confirm(@RequestParam("orderCode") long orderCode,
273 @RequestParam("uid") int uid) { 228 @RequestParam("uid") int uid) {
274 LOG.info("method ufo.buyer.confirm in, orderCode is {}, uid is {}", orderCode, uid); 229 LOG.info("method ufo.buyer.confirm in, orderCode is {}, uid is {}", orderCode, uid);
@@ -285,42 +240,7 @@ public class BuyerOrderController { @@ -285,42 +240,7 @@ public class BuyerOrderController {
285 } 240 }
286 241
287 242
288 - /**  
289 - * 平台确认收货  
290 - */  
291 - @IgnoreSession  
292 - @IgnoreSignature  
293 - @RequestMapping(value = "/erp/confirmReceive")  
294 - @ResponseBody  
295 - public ApiResponse confirmReceive(@RequestBody OrderRequest request) {  
296 - LOG.info("method ufo.depot.confirmReceive in, req is {}", request);  
297 - buyerOrderService.confirmReceive(request.getOrderCode());  
298 - LOG.info("method ufo.depot.confirmReceive out, req is {}", request);  
299 - return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build();  
300 - }  
301 -  
302 - /**  
303 - * 客服取消买家订单  
304 - * 提供给运营平台使用  
305 - *  
306 - * @return  
307 - */  
308 - @RequestMapping(value = "/erp/cancelBuyerOrderByCS")  
309 - @IgnoreSession  
310 - @IgnoreSignature  
311 - public ApiResponse cancelBuyerOrderByCS(@RequestBody BuyerOrderCancelReq request) {  
312 - LOG.info("method cs cancel buyer order in, req is {}", request);  
313 - // 检查  
314 - if (request.getUid() <= 0 || request.getOrderCode() <= 0) {  
315 - return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();  
316 - }  
317 - buyerOrderService.cancelByCS(request.getUid(), request.getOrderCode());  
318 - return new ApiResponse.ApiResponseBuilder().code(200).build();  
319 - }  
320 -  
321 -  
322 @RequestMapping(params = "method=ufo.buyer.computeCompensate") 243 @RequestMapping(params = "method=ufo.buyer.computeCompensate")
323 - @ResponseBody  
324 public ApiResponse computeCompensate(@RequestParam("orderCode") long orderCode, 244 public ApiResponse computeCompensate(@RequestParam("orderCode") long orderCode,
325 @RequestParam("uid") int uid) { 245 @RequestParam("uid") int uid) {
326 LOG.info("method ufo.buyer.computeCompensate in, orderCode is {}, uid is {}", orderCode, uid); 246 LOG.info("method ufo.buyer.computeCompensate in, orderCode is {}, uid is {}", orderCode, uid);
@@ -366,7 +286,6 @@ public class BuyerOrderController { @@ -366,7 +286,6 @@ public class BuyerOrderController {
366 } 286 }
367 287
368 @RequestMapping(params = "method=ufo.buyer.orderListNums") 288 @RequestMapping(params = "method=ufo.buyer.orderListNums")
369 - @ResponseBody  
370 public ApiResponse getBuyerOrderNums(@RequestParam("uid") int uid){ 289 public ApiResponse getBuyerOrderNums(@RequestParam("uid") int uid){
371 LOG.info("in ufo.buyer.orderListNums uid {}", uid); 290 LOG.info("in ufo.buyer.orderListNums uid {}", uid);
372 BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid); 291 BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
@@ -377,27 +296,21 @@ public class BuyerOrderController { @@ -377,27 +296,21 @@ public class BuyerOrderController {
377 * [购买] 已购买的商品列表 296 * [购买] 已购买的商品列表
378 */ 297 */
379 @RequestMapping(params = "method=ufo.buyedGoods.list") 298 @RequestMapping(params = "method=ufo.buyedGoods.list")
380 - @ResponseBody  
381 public ApiResponse getMyBuyedGoods( 299 public ApiResponse getMyBuyedGoods(
382 @RequestParam("uid") int uid, 300 @RequestParam("uid") int uid,
383 @RequestParam(value = "page", required = false, defaultValue = "1") int page, 301 @RequestParam(value = "page", required = false, defaultValue = "1") int page,
384 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { 302 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
385 -  
386 -  
387 TabType actor = TabType.BUY; 303 TabType actor = TabType.BUY;
388 -  
389 -  
390 OrderListRequest orderListRequest = OrderListRequest.builder() 304 OrderListRequest orderListRequest = OrderListRequest.builder()
391 .uid(uid) 305 .uid(uid)
392 - .type(5) 306 + .type(OrderListType.ORDER_SUCCESS.getType())
393 .page(page) 307 .page(page)
394 .limit(limit) 308 .limit(limit)
395 .tabType(actor.getValue()) 309 .tabType(actor.getValue())
396 .actor(actor) 310 .actor(actor)
397 .build(); 311 .build();
398 -  
399 LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest); 312 LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest);
400 - 313 + //TODO remove below codes 2 service level
401 PageResp<OrderListInfo> orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest); 314 PageResp<OrderListInfo> orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
402 List<JSONObject> goods = Lists.newArrayList(); 315 List<JSONObject> goods = Lists.newArrayList();
403 List<Integer> goodsId = Lists.newArrayList(); 316 List<Integer> goodsId = Lists.newArrayList();
1 package com.yohoufo.order.controller; 1 package com.yohoufo.order.controller;
2 2
3 import com.yoho.error.exception.ServiceException; 3 import com.yoho.error.exception.ServiceException;
  4 +import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq;
4 import com.yohobuy.ufo.model.order.req.ManualDealRequest; 5 import com.yohobuy.ufo.model.order.req.ManualDealRequest;
5 import com.yohobuy.ufo.model.order.resp.BuyerOrderNums; 6 import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
6 import com.yohoufo.common.ApiResponse; 7 import com.yohoufo.common.ApiResponse;
7 import com.yohoufo.common.annotation.IgnoreSession; 8 import com.yohoufo.common.annotation.IgnoreSession;
8 import com.yohoufo.common.annotation.IgnoreSignature; 9 import com.yohoufo.common.annotation.IgnoreSignature;
  10 +import com.yohoufo.order.model.request.OrderRequest;
9 import com.yohoufo.order.service.IBuyerOrderService; 11 import com.yohoufo.order.service.IBuyerOrderService;
10 import com.yohoufo.order.service.IPaymentService; 12 import com.yohoufo.order.service.IPaymentService;
  13 +import com.yohoufo.order.utils.LoggerUtils;
  14 +import org.slf4j.Logger;
11 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.*; 16 import org.springframework.web.bind.annotation.*;
13 17
14 @RestController 18 @RestController
15 @RequestMapping("/erp") 19 @RequestMapping("/erp")
16 public class ErpGWOrderController { 20 public class ErpGWOrderController {
17 - 21 + private final Logger LOG = LoggerUtils.getBuyerOrderLogger();
18 22
19 @Autowired 23 @Autowired
20 IBuyerOrderService buyerOrderService; 24 IBuyerOrderService buyerOrderService;
@@ -23,7 +27,6 @@ public class ErpGWOrderController { @@ -23,7 +27,6 @@ public class ErpGWOrderController {
23 IPaymentService paymentService; 27 IPaymentService paymentService;
24 28
25 @RequestMapping(params = "method=ufo.buyer.orderNums") 29 @RequestMapping(params = "method=ufo.buyer.orderNums")
26 - @ResponseBody  
27 @IgnoreSession 30 @IgnoreSession
28 public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){ 31 public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
29 32
@@ -33,7 +36,6 @@ public class ErpGWOrderController { @@ -33,7 +36,6 @@ public class ErpGWOrderController {
33 36
34 @IgnoreSignature 37 @IgnoreSignature
35 @IgnoreSession 38 @IgnoreSession
36 - //@RequestMapping(params = "method=ufo.order.manualDealMon")  
37 @RequestMapping(value="/manualDealMon") 39 @RequestMapping(value="/manualDealMon")
38 public ApiResponse manualDealMon(@RequestBody ManualDealRequest req) { 40 public ApiResponse manualDealMon(@RequestBody ManualDealRequest req) {
39 try { 41 try {
@@ -43,4 +45,56 @@ public class ErpGWOrderController { @@ -43,4 +45,56 @@ public class ErpGWOrderController {
43 } 45 }
44 return new ApiResponse.ApiResponseBuilder().code(200).data("").message("处理成功").build(); 46 return new ApiResponse.ApiResponseBuilder().code(200).data("").message("处理成功").build();
45 } 47 }
  48 +
  49 + /**
  50 + * 客服取消买家订单
  51 + * 提供给运营平台使用
  52 + *
  53 + * @return
  54 + */
  55 + @RequestMapping(value = "/cancelBuyerOrderByCS")
  56 + @IgnoreSession
  57 + @IgnoreSignature
  58 + public ApiResponse cancelBuyerOrderByCS(@RequestBody BuyerOrderCancelReq request) {
  59 + LOG.info("method cs cancel buyer order in, req is {}", request);
  60 + // 检查
  61 + if (request.getUid() <= 0 || request.getOrderCode() <= 0) {
  62 + return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();
  63 + }
  64 + buyerOrderService.cancelByCS(request.getUid(), request.getOrderCode());
  65 + return new ApiResponse.ApiResponseBuilder().code(200).build();
  66 + }
  67 +
  68 + @IgnoreSession
  69 + @IgnoreSignature
  70 + @RequestMapping(value = "/qualityCheckPass")
  71 + public ApiResponse qualityCheckPass(@RequestBody OrderRequest request) {
  72 + LOG.info("method ufo.depot.qualityCheckPass in, req is {}", request);
  73 + buyerOrderService.qualityCheckPass(request.getOrderCode());
  74 + LOG.info("method ufo.depot.qualityCheckPass out, req is {}", request);
  75 + return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心质检通过成功").build();
  76 + }
  77 +
  78 + @IgnoreSession
  79 + @IgnoreSignature
  80 + @RequestMapping(value = "/miniFaultCreate")
  81 + public ApiResponse miniFaultCreate(@RequestBody OrderRequest request) {
  82 + LOG.info("method ufo.depot.miniFaultCreate in, req is {}", request);
  83 + buyerOrderService.miniFaultCreate(request.getOrderCode());
  84 + LOG.info("method ufo.depot.miniFaultCreate out, req is {}", request);
  85 + return new ApiResponse.ApiResponseBuilder().code(200).message("瑕疵创建成功").build();
  86 + }
  87 +
  88 + /**
  89 + * 平台确认收货
  90 + */
  91 + @IgnoreSession
  92 + @IgnoreSignature
  93 + @RequestMapping(value = "/confirmReceive")
  94 + public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
  95 + LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
  96 + buyerOrderService.confirmReceive(request.getOrderCode());
  97 + LOG.info("method ufo.depot.confirmReceive out, req is {}", request);
  98 + return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build();
  99 + }
46 } 100 }