Authored by chenchao

optimized

... ... @@ -6,15 +6,12 @@ import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
... ... @@ -25,7 +22,9 @@ import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
... ... @@ -45,9 +44,6 @@ public class BuyerOrderController {
@Autowired
private SellerFeeService sellerFeeService;
/**
* [购买]订单列表
* 1: 全部
... ... @@ -58,16 +54,12 @@ public class BuyerOrderController {
* 7:交易失败
*/
@RequestMapping(params = "method=ufo.order.list")
@ResponseBody
public ApiResponse getOrderList(@RequestParam("type") int type,
@RequestParam("uid") int uid,
@RequestParam("tabType") String tabType,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
TabType actor = TabType.getTabType(tabType);
if (Objects.isNull(actor)){
return new ApiResponse.ApiResponseBuilder().code(400).message("非法的tab").build();
}
... ... @@ -79,9 +71,7 @@ public class BuyerOrderController {
.tabType(tabType)
.actor(actor)
.build();
LOG.info("in ufo.order.list, req {}", orderListRequest);
PageResp<OrderListInfo> orderListInfoRsp;
switch (actor){
case BUY:
... ... @@ -93,7 +83,6 @@ public class BuyerOrderController {
default:
orderListInfoRsp = null;
}
return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("订单列表").build();
}
... ... @@ -105,7 +94,6 @@ public class BuyerOrderController {
* @return
*/
@RequestMapping(params = "method=ufo.order.detail")
@ResponseBody
public ApiResponse getOrderDetail(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid,
@RequestParam("tabType") String tabType) {
... ... @@ -137,8 +125,6 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).data(orderDetailInfo).message("订单详情").build();
}
/**
* 买家修改收货地址
* 最新逻辑:手机号码、详细地址和收货人如果存在*号,先判断是不是跟原来的一样,如果不一样,
... ... @@ -184,28 +170,6 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).message("接受瑕疵").build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/erp/qualityCheckPass")
@ResponseBody
public ApiResponse qualityCheckPass(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.qualityCheckPass in, req is {}", request);
buyerOrderService.qualityCheckPass(request.getOrderCode());
LOG.info("method ufo.depot.qualityCheckPass out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心质检通过成功").build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/erp/miniFaultCreate")
@ResponseBody
public ApiResponse miniFaultCreate(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.miniFaultCreate in, req is {}", request);
buyerOrderService.miniFaultCreate(request.getOrderCode());
LOG.info("method ufo.depot.miniFaultCreate out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("瑕疵创建成功").build();
}
/**
* 用户不接受瑕疵
*/
... ... @@ -229,29 +193,22 @@ public class BuyerOrderController {
*/
@RequestMapping(params = "method=ufo.buyer.cancel")
@ResponseBody
public ApiResponse cancel(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.cancel in, orderCode is {}, uid is {}", orderCode, uid);
OrderRequest orderRequest = OrderRequest.builder()
.uid(uid)
.orderCode(orderCode)
.build();
buyerOrderService.cancel(orderRequest);
LOG.info("method ufo.buyer.cancel out, orderCode is {}, uid is {}", orderCode, uid);
return new ApiResponse.ApiResponseBuilder().code(200).message("取消成功").build();
}
/**
* 取消订单
*/
@RequestMapping(params = "method=ufo.buyer.delete")
@ResponseBody
public ApiResponse delete(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.delete in, orderCode is {}, uid is {}", orderCode, uid);
... ... @@ -260,7 +217,6 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("取消成功").build();
}
/**
* 确认收货
* @param orderCode
... ... @@ -268,7 +224,6 @@ public class BuyerOrderController {
* @return
*/
@RequestMapping(params = "method=ufo.buyer.confirm")
@ResponseBody
public ApiResponse confirm(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.confirm in, orderCode is {}, uid is {}", orderCode, uid);
... ... @@ -285,42 +240,7 @@ public class BuyerOrderController {
}
/**
* 平台确认收货
*/
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/erp/confirmReceive")
@ResponseBody
public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
buyerOrderService.confirmReceive(request.getOrderCode());
LOG.info("method ufo.depot.confirmReceive out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build();
}
/**
* 客服取消买家订单
* 提供给运营平台使用
*
* @return
*/
@RequestMapping(value = "/erp/cancelBuyerOrderByCS")
@IgnoreSession
@IgnoreSignature
public ApiResponse cancelBuyerOrderByCS(@RequestBody BuyerOrderCancelReq request) {
LOG.info("method cs cancel buyer order in, req is {}", request);
// 检查
if (request.getUid() <= 0 || request.getOrderCode() <= 0) {
return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();
}
buyerOrderService.cancelByCS(request.getUid(), request.getOrderCode());
return new ApiResponse.ApiResponseBuilder().code(200).build();
}
@RequestMapping(params = "method=ufo.buyer.computeCompensate")
@ResponseBody
public ApiResponse computeCompensate(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.computeCompensate in, orderCode is {}, uid is {}", orderCode, uid);
... ... @@ -366,7 +286,6 @@ public class BuyerOrderController {
}
@RequestMapping(params = "method=ufo.buyer.orderListNums")
@ResponseBody
public ApiResponse getBuyerOrderNums(@RequestParam("uid") int uid){
LOG.info("in ufo.buyer.orderListNums uid {}", uid);
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
... ... @@ -377,27 +296,21 @@ public class BuyerOrderController {
* [购买] 已购买的商品列表
*/
@RequestMapping(params = "method=ufo.buyedGoods.list")
@ResponseBody
public ApiResponse getMyBuyedGoods(
@RequestParam("uid") int uid,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
TabType actor = TabType.BUY;
OrderListRequest orderListRequest = OrderListRequest.builder()
.uid(uid)
.type(5)
.type(OrderListType.ORDER_SUCCESS.getType())
.page(page)
.limit(limit)
.tabType(actor.getValue())
.actor(actor)
.build();
LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest);
//TODO remove below codes 2 service level
PageResp<OrderListInfo> orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
List<JSONObject> goods = Lists.newArrayList();
List<Integer> goodsId = Lists.newArrayList();
... ...
package com.yohoufo.order.controller;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq;
import com.yohobuy.ufo.model.order.req.ManualDealRequest;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/erp")
public class ErpGWOrderController {
private final Logger LOG = LoggerUtils.getBuyerOrderLogger();
@Autowired
IBuyerOrderService buyerOrderService;
... ... @@ -23,7 +27,6 @@ public class ErpGWOrderController {
IPaymentService paymentService;
@RequestMapping(params = "method=ufo.buyer.orderNums")
@ResponseBody
@IgnoreSession
public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
... ... @@ -33,7 +36,6 @@ public class ErpGWOrderController {
@IgnoreSignature
@IgnoreSession
//@RequestMapping(params = "method=ufo.order.manualDealMon")
@RequestMapping(value="/manualDealMon")
public ApiResponse manualDealMon(@RequestBody ManualDealRequest req) {
try {
... ... @@ -43,4 +45,56 @@ public class ErpGWOrderController {
}
return new ApiResponse.ApiResponseBuilder().code(200).data("").message("处理成功").build();
}
/**
* 客服取消买家订单
* 提供给运营平台使用
*
* @return
*/
@RequestMapping(value = "/cancelBuyerOrderByCS")
@IgnoreSession
@IgnoreSignature
public ApiResponse cancelBuyerOrderByCS(@RequestBody BuyerOrderCancelReq request) {
LOG.info("method cs cancel buyer order in, req is {}", request);
// 检查
if (request.getUid() <= 0 || request.getOrderCode() <= 0) {
return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();
}
buyerOrderService.cancelByCS(request.getUid(), request.getOrderCode());
return new ApiResponse.ApiResponseBuilder().code(200).build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/qualityCheckPass")
public ApiResponse qualityCheckPass(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.qualityCheckPass in, req is {}", request);
buyerOrderService.qualityCheckPass(request.getOrderCode());
LOG.info("method ufo.depot.qualityCheckPass out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心质检通过成功").build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/miniFaultCreate")
public ApiResponse miniFaultCreate(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.miniFaultCreate in, req is {}", request);
buyerOrderService.miniFaultCreate(request.getOrderCode());
LOG.info("method ufo.depot.miniFaultCreate out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("瑕疵创建成功").build();
}
/**
* 平台确认收货
*/
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/confirmReceive")
public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
buyerOrderService.confirmReceive(request.getOrderCode());
LOG.info("method ufo.depot.confirmReceive out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build();
}
}
... ...