Authored by qinchao

Merge branch 'dev_qc_1120_deposit2' into test6.8.2

@@ -35,6 +35,31 @@ public class SellerOrderController { @@ -35,6 +35,31 @@ public class SellerOrderController {
35 @Autowired 35 @Autowired
36 private SellerOrderComputeHandler sellerOrderComputeHandler; 36 private SellerOrderComputeHandler sellerOrderComputeHandler;
37 37
  38 +
  39 + /**
  40 + * 获取商家未完成的订单数量
  41 + * @param uid
  42 + */
  43 + @RequestMapping(params = "method=ufo.sellerOrder.getUnfinishedOrderBySellerUid")
  44 + @ResponseBody
  45 + public ApiResponse getUnfinishedOrderBySellerUid(@RequestParam(name = "uid")Integer uid){
  46 + logger.info("in ufo.sellerOrder.getUnfinishedOrderBySellerUid, uid {}", uid);
  47 + int total=sellerOrderService.getUnfinishedOrderBySellerUid(uid);
  48 + return new ApiResponse.ApiResponseBuilder().code(200).data(total).build();
  49 + }
  50 +
  51 + /**
  52 + * 获取商家出售中的商品数量
  53 + * @param uid
  54 + */
  55 + @RequestMapping(params = "method=ufo.sellerOrder.getCanSellSkupBySellerUid")
  56 + @ResponseBody
  57 + public ApiResponse getCanSellSkupBySellerUid(@RequestParam(name = "uid")Integer uid){
  58 + logger.info("in ufo.sellerOrder.getUnfinishedOrderBySellerUid, uid {}", uid);
  59 + int total=sellerOrderService.getCanSellSkupBySellerUid(uid);
  60 + return new ApiResponse.ApiResponseBuilder().code(200).data(total).build();
  61 + }
  62 +
38 /** 63 /**
39 * 根据卖家提交价格来计算各项费用 64 * 根据卖家提交价格来计算各项费用
40 * @param uid 65 * @param uid
@@ -459,4 +459,28 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi @@ -459,4 +459,28 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
459 return resp; 459 return resp;
460 } 460 }
461 461
  462 +
  463 +
  464 + /**
  465 + * 商家未完成订单数量
  466 + */
  467 + public int getUnfinishedOrderBySellerUid(Integer uid){
  468 + log.info("in seller order getUnfinishedOrderBySellerUid count uid {} ", uid);
  469 + List<Integer> statusList = OrderStatus.getUnfinishedOrderStatusCode();
  470 + Integer total = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList);
  471 + log.info("in seller order getUnfinishedOrderBySellerUid count uid {}, total {} ", uid, total);
  472 + return total;
  473 + }
  474 +
  475 + /**
  476 + * 商家出售中的商品
  477 + */
  478 + public int getCanSellSkupBySellerUid(Integer uid){
  479 + log.info("in seller order getCanSellSkupBySellerUid count uid {} ", uid);
  480 + Integer total = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
  481 + log.info("in seller order getCanSellSkupBySellerUid count uid {}, total {} ", uid, total);
  482 + return total;
  483 + }
  484 +
  485 +
462 } 486 }
@@ -2,6 +2,7 @@ package com.yohoufo.user.service.impl; @@ -2,6 +2,7 @@ package com.yohoufo.user.service.impl;
2 2
3 import com.yoho.error.exception.ServiceException; 3 import com.yoho.error.exception.ServiceException;
4 import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum; 4 import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
  5 +import com.yohoufo.common.ApiResponse;
5 import com.yohoufo.common.caller.UfoServiceCaller; 6 import com.yohoufo.common.caller.UfoServiceCaller;
6 import com.yohoufo.dal.user.IStoredSellerDao; 7 import com.yohoufo.dal.user.IStoredSellerDao;
7 import com.yohoufo.dal.user.model.StoredSeller; 8 import com.yohoufo.dal.user.model.StoredSeller;
@@ -55,7 +56,25 @@ public class StoredSellerServiceImpl implements IStoredSellerService { @@ -55,7 +56,25 @@ public class StoredSellerServiceImpl implements IStoredSellerService {
55 throw new ServiceException(400,"商户入驻状态变化,不允许退驻!"); 56 throw new ServiceException(400,"商户入驻状态变化,不允许退驻!");
56 } 57 }
57 58
58 - //TODO 检查商户是否有出售中的商品,或者有订单未完成的 ,都不可以提交 59 + // 检查商户是否有出售中的商品,或者有订单未完成的 ,都不可以提交
  60 + ApiResponse apiResponse=ufoServiceCaller.call("ufo.sellerOrder.getUnfinishedOrderBySellerUid", ApiResponse.class,uid);
  61 + if(apiResponse==null||apiResponse.getCode()!=200){
  62 + throw new ServiceException(400,"商户订单获取异常,不允许退驻!");
  63 + }
  64 + Integer total =(Integer)apiResponse.getData();
  65 + if(total!=null && total>0){
  66 + logger.error("quitStoredSeller not allowed cause of unfinished order ,total {}" ,total);
  67 + throw new ServiceException(400,"商户存在未完成订单,不允许退驻!");
  68 + }
  69 + apiResponse=ufoServiceCaller.call("ufo.sellerOrder.getCanSellSkupBySellerUid", ApiResponse.class,uid);
  70 + if(apiResponse==null||apiResponse.getCode()!=200){
  71 + throw new ServiceException(400,"商户商品获取异常,不允许退驻!");
  72 + }
  73 + total =(Integer)apiResponse.getData();
  74 + if(total!=null && total>0){
  75 + logger.error("quitStoredSeller not allowed cause of can seller product ,total {}" ,total);
  76 + throw new ServiceException(400,"商户存在出售中商品,不允许退驻!");
  77 + }
59 78
60 79
61 LocalDateTime now=LocalDateTime.now(); 80 LocalDateTime now=LocalDateTime.now();