Authored by qinchao

Merge branch 'dev_qc_1120_deposit2' into test6.8.2

... ... @@ -35,6 +35,31 @@ public class SellerOrderController {
@Autowired
private SellerOrderComputeHandler sellerOrderComputeHandler;
/**
* 获取商家未完成的订单数量
* @param uid
*/
@RequestMapping(params = "method=ufo.sellerOrder.getUnfinishedOrderBySellerUid")
@ResponseBody
public ApiResponse getUnfinishedOrderBySellerUid(@RequestParam(name = "uid")Integer uid){
logger.info("in ufo.sellerOrder.getUnfinishedOrderBySellerUid, uid {}", uid);
int total=sellerOrderService.getUnfinishedOrderBySellerUid(uid);
return new ApiResponse.ApiResponseBuilder().code(200).data(total).build();
}
/**
* 获取商家出售中的商品数量
* @param uid
*/
@RequestMapping(params = "method=ufo.sellerOrder.getCanSellSkupBySellerUid")
@ResponseBody
public ApiResponse getCanSellSkupBySellerUid(@RequestParam(name = "uid")Integer uid){
logger.info("in ufo.sellerOrder.getUnfinishedOrderBySellerUid, uid {}", uid);
int total=sellerOrderService.getCanSellSkupBySellerUid(uid);
return new ApiResponse.ApiResponseBuilder().code(200).data(total).build();
}
/**
* 根据卖家提交价格来计算各项费用
* @param uid
... ...
... ... @@ -459,4 +459,28 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
return resp;
}
/**
* 商家未完成订单数量
*/
public int getUnfinishedOrderBySellerUid(Integer uid){
log.info("in seller order getUnfinishedOrderBySellerUid count uid {} ", uid);
List<Integer> statusList = OrderStatus.getUnfinishedOrderStatusCode();
Integer total = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList);
log.info("in seller order getUnfinishedOrderBySellerUid count uid {}, total {} ", uid, total);
return total;
}
/**
* 商家出售中的商品
*/
public int getCanSellSkupBySellerUid(Integer uid){
log.info("in seller order getCanSellSkupBySellerUid count uid {} ", uid);
Integer total = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
log.info("in seller order getCanSellSkupBySellerUid count uid {}, total {} ", uid, total);
return total;
}
}
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.user.service.impl;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.dal.user.IStoredSellerDao;
import com.yohoufo.dal.user.model.StoredSeller;
... ... @@ -55,7 +56,25 @@ public class StoredSellerServiceImpl implements IStoredSellerService {
throw new ServiceException(400,"商户入驻状态变化,不允许退驻!");
}
//TODO 检查商户是否有出售中的商品,或者有订单未完成的 ,都不可以提交
// 检查商户是否有出售中的商品,或者有订单未完成的 ,都不可以提交
ApiResponse apiResponse=ufoServiceCaller.call("ufo.sellerOrder.getUnfinishedOrderBySellerUid", ApiResponse.class,uid);
if(apiResponse==null||apiResponse.getCode()!=200){
throw new ServiceException(400,"商户订单获取异常,不允许退驻!");
}
Integer total =(Integer)apiResponse.getData();
if(total!=null && total>0){
logger.error("quitStoredSeller not allowed cause of unfinished order ,total {}" ,total);
throw new ServiceException(400,"商户存在未完成订单,不允许退驻!");
}
apiResponse=ufoServiceCaller.call("ufo.sellerOrder.getCanSellSkupBySellerUid", ApiResponse.class,uid);
if(apiResponse==null||apiResponse.getCode()!=200){
throw new ServiceException(400,"商户商品获取异常,不允许退驻!");
}
total =(Integer)apiResponse.getData();
if(total!=null && total>0){
logger.error("quitStoredSeller not allowed cause of can seller product ,total {}" ,total);
throw new ServiceException(400,"商户存在出售中商品,不允许退驻!");
}
LocalDateTime now=LocalDateTime.now();
... ...