|
|
package com.yohoufo.order.controller;
|
|
|
|
|
|
import com.yohobuy.ufo.model.order.common.EntrySellerType;
|
|
|
import com.yohobuy.ufo.model.order.resp.EntryThreshold;
|
|
|
import com.yohobuy.ufo.model.order.resp.SellerResp;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.common.exception.GatewayException;
|
|
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
import com.yohoufo.order.service.IStoredSellerDepositService;
|
|
|
import com.yohoufo.order.service.IStoredSellerService;
|
|
|
import com.yohoufo.order.service.impl.SellerService;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by chao.chen on 2019/1/11.
|
|
|
*/
|
|
|
@Controller
|
|
|
public class SellerController {
|
|
|
private final Logger logger = LoggerUtils.getSellerOrderLogger();
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private IStoredSellerDepositService storedSellerDepositService;
|
|
|
|
|
|
@Autowired
|
|
|
private IStoredSellerService storedSellerService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerService sellerService;
|
|
|
/**
|
|
|
* 商户退驻
|
|
|
*/
|
|
|
@RequestMapping(params = "method=ufo.sellerOrder.quitStoredSeller")
|
|
|
@ResponseBody
|
|
|
public ApiResponse quitStoredSeller(@RequestParam("uid") Integer uid) throws GatewayException {
|
|
|
logger.info("enter StoredSellerController quitStoredSeller param uid is {}", uid);
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (uid == null || uid <=0 ){
|
|
|
throw new GatewayException(400, "参数错误,uid不存在!");
|
|
|
}
|
|
|
|
|
|
storedSellerDepositService.quitStoredSellerAndReturnDeposit(uid);
|
|
|
return new ApiResponse();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 入驻商户的状态
|
|
|
* 芝麻认证状态
|
|
|
* 入驻状态
|
|
|
*/
|
|
|
@RequestMapping(params = "method=ufo.sellerOrder.entryStatus")
|
|
|
@ResponseBody
|
|
|
public ApiResponse entryStatus(@RequestParam("uid") Integer uid) {
|
|
|
logger.info("enter StoredSellerController entryStatus param uid is {}", uid);
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (uid == null || uid <=0 ){
|
|
|
throw new UfoServiceException(400, "参数错误,uid不存在!");
|
|
|
}
|
|
|
SellerResp resp = storedSellerService.entryStatus(uid);
|
|
|
ApiResponse apiResponse = new ApiResponse();
|
|
|
apiResponse.setData(resp);
|
|
|
return apiResponse;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 是否入驻商户
|
|
|
*/
|
|
|
@RequestMapping(params = "method=ufo.sellerOrder.isStoredSeller")
|
|
|
@ResponseBody
|
|
|
public ApiResponse isStoredSeller(@RequestParam("uid") Integer uid) {
|
|
|
logger.info("enter StoredSellerController isStoredSeller param uid is {}", uid);
|
|
|
//(1) 优先校验请求的参数
|
|
|
if (uid == null || uid <=0 ){
|
|
|
throw new UfoServiceException(400, "参数错误,uid不存在!");
|
|
|
}
|
|
|
|
|
|
boolean isStoredSeller=storedSellerService.isStoredSeller(uid);
|
|
|
ApiResponse apiResponse = new ApiResponse();
|
|
|
apiResponse.setData(isStoredSeller);
|
|
|
return apiResponse;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(params = "method=ufo.seller.entryThresholds")
|
|
|
@ResponseBody
|
|
|
public ApiResponse getEntryThresholds() {
|
|
|
Map<EntrySellerType,EntryThreshold> data = sellerService.getEntryThreshold();
|
|
|
logger.info("enter ufo.seller.entryThresholds data {}", data);
|
|
|
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("升级预充值阈值").build();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(params = "method=ufo.seller.applySuperEnter")
|
|
|
@ResponseBody
|
|
|
public ApiResponse applySuperEnter(@RequestParam("uid") Integer uid) {
|
|
|
logger.info("enter ufo.seller.applySuperEnter uid {}", uid);
|
|
|
Boolean data = sellerService.applySuperEnter(uid);
|
|
|
String msg = "升级超级卖家";
|
|
|
if (data){
|
|
|
msg += "成功";
|
|
|
}else{
|
|
|
msg += "失败";
|
|
|
}
|
|
|
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message(msg).build();
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|