Authored by chenchao

definition api req and resp

package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq;
import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq;
import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq;
import com.yohobuy.ufo.model.order.req.*;
import com.yohobuy.ufo.model.order.resp.BatchChangePriceResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
... ... @@ -34,6 +33,9 @@ public class SellerOrderController {
@Autowired
private SellerOrderService sellerOrderService;
@Autowired
private SellerOrderComputeHandler sellerOrderComputeHandler;
/**
* 根据卖家提交价格来计算各项费用
* @param uid
... ... @@ -46,7 +48,8 @@ public class SellerOrderController {
@ResponseBody
public ApiResponse computePublishPrd(@RequestParam(name = "uid", required = true)int uid,
@RequestParam(name = "storage_id", required = true)int storage_id,
@RequestParam(name="price", required = true)String price) throws GatewayException {
@RequestParam(name="price", required = true)String price,
@RequestParam(name="num", defaultValue = "1", required = false)int num) throws GatewayException {
SellerOrderComputeReq req = SellerOrderComputeReq.builder().uid(uid).storageId(storage_id).price(price).build();
logger.info("in ufo.sellerOrder.computePublishPrd, req {}", req);
SoldPrdComputeBo computeBo = sellerOrderService.computePublishPrd(req);
... ... @@ -68,7 +71,8 @@ public class SellerOrderController {
public ApiResponse publishPrd(@RequestParam(name = "uid", required = true)int uid,
@RequestParam(name = "storage_id", required = true)int storage_id,
@RequestParam(name="price", required = true)String price,
@RequestParam(name="address_id")String address_id) throws GatewayException {
@RequestParam(name="address_id")String address_id,
@RequestParam(name="num", defaultValue = "1", required = false)int num) throws GatewayException {
SellerOrderSubmitReq req = SellerOrderSubmitReq.builder()
.uid(uid)
.storageId(storage_id)
... ... @@ -80,7 +84,32 @@ public class SellerOrderController {
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("发布成功").build();
}
/**
* 入驻商家的批量下架
* @param uid
* @param batchNo
* @param num
* @return
* @throws GatewayException
*/
@RequestMapping(params = "method=ufo.sellerOrder.batchCancel")
@ResponseBody
public ApiResponse batchCancel(@RequestParam(name = "uid", required = true)int uid,
@RequestParam(name = "batchNo", required = true)String batchNo,
@RequestParam(name="num", defaultValue = "1", required = false)int num
) throws GatewayException {
SellerOrderBatchCancelReq req = SellerOrderBatchCancelReq.builder()
.uid(uid).batchNo(batchNo).storageNum(num)
.build();
logger.info("in ufo.sellerOrder.batchCancel, req {}", req);
boolean result = sellerOrderService.batchCancel(req);
String msg = "批量取消成功";
if(!result){
msg = "批量取消失败";
}
return new ApiResponse.ApiResponseBuilder().data(result).code(200).message(msg).build();
}
... ... @@ -144,8 +173,7 @@ public class SellerOrderController {
return new ApiResponse.ApiResponseBuilder().data(result).code(200).message(msg).build();
}
@Autowired
private SellerOrderComputeHandler sellerOrderComputeHandler;
@RequestMapping(params = "method=ufo.skup.earnestMoneyRange")
@ResponseBody
... ... @@ -154,4 +182,30 @@ public class SellerOrderController {
.data(sellerOrderComputeHandler.getEarnestMoneyrange())
.message("get EarnestMoneyrange success").build();
}
/**
* 批量调价
* @param uid
* @param batchNo
* @param price
* @return
* @throws GatewayException
*/
@RequestMapping(params = "method=ufo.sellerOrder.batchChangePrice")
@ResponseBody
public ApiResponse batchChangePrice(@RequestParam(name = "uid", required = true)int uid,
@RequestParam(name = "price", required = true)String price,
@RequestParam(name = "batchNo", required = true)String batchNo,
@RequestParam(name="num", defaultValue = "1", required = false)int num
) throws GatewayException {
BatchChangePriceReq req = BatchChangePriceReq.builder()
.uid(uid).price(price).storageNum(num)
.batchNo(batchNo)
.build();
logger.info("in ufo.sellerOrder.batchChangePrice, req {}", req);
BatchChangePriceResp result = sellerOrderService.batchChangePrice(req);
return new ApiResponse.ApiResponseBuilder().data(result).code(200).message(result.getTips()).build();
}
}
... ...
... ... @@ -4,9 +4,8 @@ import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq;
import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq;
import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq;
import com.yohobuy.ufo.model.order.req.*;
import com.yohobuy.ufo.model.order.resp.BatchChangePriceResp;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.alarm.EventBusPublisher;
... ... @@ -366,6 +365,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
return true;
}
public boolean batchCancel(SellerOrderBatchCancelReq req){
return true;
}
public boolean cancel(SellerOrderCancelReq req){
log.info("seller self cancel order,req {}", req);
... ... @@ -547,4 +551,12 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
.actor(orderRequest.getTabType()).build();
}
public BatchChangePriceResp batchChangePrice(BatchChangePriceReq req){
BatchChangePriceResp resp = BatchChangePriceResp.builder().successCnt(1).failCnt(1)
.tips("变价成功1个,失败1个").build();
return resp;
}
}
... ...