Authored by caoyan

Merge branch 'test6.8.5' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.5

... ... @@ -2,6 +2,8 @@ package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.SellerEnterApply;
import java.util.List;
public interface SellerEnterApplyMapper {
int deleteByPrimaryKey(Integer id);
... ... @@ -14,4 +16,6 @@ public interface SellerEnterApplyMapper {
int updateByPrimaryKeySelective(SellerEnterApply record);
int updateByPrimaryKey(SellerEnterApply record);
List<SellerEnterApply> selectByUidEnterType(SellerEnterApply condition);
}
\ No newline at end of file
... ...
... ... @@ -20,6 +20,14 @@
from seller_enter_apply
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByUidEnterType" parameterType="com.yohoufo.dal.order.model.SellerEnterApply" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from seller_enter_apply
where uid = #{uid,jdbcType=INTEGER}
enter_type = #{enterType,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from seller_enter_apply
where id = #{id,jdbcType=INTEGER}
... ...
... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.controller;
import com.yoho.core.rest.annotation.ServiceDesc;
import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
... ... @@ -62,9 +63,28 @@ public class AppraiseController {
@IgnoreSignature
public ApiResponse appraiseFail(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
logger.info("in appraise Fail, req {}", appraiseExpressInfoBo);
return appraiseService.appraiseFail(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum(),appraiseExpressInfoBo.getMobile());
OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
return appraiseService.appraiseFail(appraiseExpressInfoBo,expectStatus,true);
}
/**
*
* 质检不通过 -- > 商品鉴定不通过,
* 但是不发物流
* 提供给运营平台使用
* @return
*/
@RequestMapping(value="/appraiseFailWithoutExpress")
@IgnoreSession
@IgnoreSignature
public ApiResponse appraiseFailWithoutExpress(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
logger.info("in appraiseFailWithoutExpress , req {}", appraiseExpressInfoBo);
OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
return appraiseService.appraiseFail( appraiseExpressInfoBo,expectStatus,false);
}
/**
* 鉴定中心鉴定不通过后,寄回
... ...
... ... @@ -434,12 +434,16 @@ public class AppraiseService {
* 更新发到卖家的物流信息
* 将卖家的保证金分账给平台和买家
* 更新买家订单状态
* @param expressCompanyId
* @param orderCode
* @param wayBillCode
* @return
*/
public ApiResponse appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum,String mobile){
public ApiResponse appraiseFail(AppraiseExpressInfoBo appraiseExpressInfoBo,OrderStatus expectStatus,boolean sendExpressFlag){
LOGGER.info("appraiseFail enter , appraiseExpressInfoBo {} ,sendExpressFlag {}", appraiseExpressInfoBo ,sendExpressFlag);
Integer expressCompanyId = appraiseExpressInfoBo.getExpressCompanyId();
Long orderCode = appraiseExpressInfoBo.getOrderCode();
String wayBillCode = appraiseExpressInfoBo.getWayBillCode();
Integer depotNum = appraiseExpressInfoBo.getDepotNum();
String mobile = appraiseExpressInfoBo.getMobile();
ApiResponse apiResponse=new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
... ... @@ -447,7 +451,7 @@ public class AppraiseService {
LOGGER.warn("appraiseFail getOrderInfo order not exist, orderCode {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
if (buyerOrder.getStatus() != expectStatus.getCode()){
LOGGER.warn("appraiseFail expectStatus {}, actual status {}, orderCode {}", expectStatus,
buyerOrder.getStatus(), orderCode);
... ... @@ -564,7 +568,10 @@ public class AppraiseService {
}finally {
//更新物流信息,写到最后
//鉴定不通过,发物流
expressInfoService.returnBackOrderCauseOfJudgeFailure(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
if(sendExpressFlag){
expressInfoService.returnBackOrderCauseOfJudgeFailure(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
}
//记录调拨信息(只保存卖家一条)
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
... ...
... ... @@ -9,7 +9,7 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohobuy.ufo.model.order.resp.ExpressStage;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.constant.ExpressInfoConstant;
import com.yohoufo.common.exception.UfoServiceException;
... ... @@ -18,7 +18,6 @@ import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.ExpressForMqSend;
import com.yohoufo.order.constants.MetaKey;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.service.IExpressCompanyService;
... ... @@ -28,8 +27,6 @@ import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -394,27 +391,19 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
private void buildExpressStage(int status,ExpressInfoRespBo expressInfoRespBo ){
ExpressStage seller_send_out_stage = new ExpressStage("卖家发货",false);
ExpressStage judge_stage = new ExpressStage("平台鉴定",false);
ExpressStage platform_delivery_stage = new ExpressStage("交易成功",false);
if(OrderStatus.SELLER_SEND_OUT.getCode()==status){
seller_send_out_stage.setEnable(true);
}else if(OrderStatus.PLATFORM_RECEIVE.getCode()==status
// 1 卖家发货 -- 平台鉴定 -- 交易成功 ,其中卖家发货点亮
// 2 卖家发货 == 平台鉴定 -- 交易成功 ,其中卖家发货和平台鉴定点亮
// 3 卖家发货 == 平台鉴定 == 交易成功 ,全部点亮
// 4 卖家发货 == 平台鉴定 == 交易失败 ,全部点亮
expressInfoRespBo.setStage(1);
if(OrderStatus.PLATFORM_RECEIVE.getCode()==status
||OrderStatus.PLATFORM_CHECKING.getCode()==status){
seller_send_out_stage.setEnable(true);
judge_stage.setEnable(true);
expressInfoRespBo.setStage(2);
}else if(OrderStatus.WAITING_RECEIVE.getCode()==status||OrderStatus.DONE.getCode()==status){
seller_send_out_stage.setEnable(true);
judge_stage.setEnable(true);
platform_delivery_stage.setEnable(true);
}else if(OrderStatus.CHECKING_FAKE.getCode()==status||OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==status){
seller_send_out_stage.setEnable(true);
judge_stage.setEnable(true);
platform_delivery_stage.setEnable(true);
platform_delivery_stage.setText("交易失败");
expressInfoRespBo.setStage(3);
}else if(OrderStatus.CHECKING_FAKE.getCode()==status){
expressInfoRespBo.setStage(4);
}
List<ExpressStage> stageList = Arrays.asList(seller_send_out_stage,judge_stage,platform_delivery_stage);
expressInfoRespBo.setExpressStageList(stageList);
}
private void constructSupplementExpress(Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohobuy.ufo.model.order.common.MetaConfigKey;
import com.yohobuy.ufo.model.order.resp.EntryThreshold;
import com.yohoufo.common.cache.CacheClient;
import com.yohoufo.dal.order.MetaConfigMapper;
import com.yohoufo.dal.order.model.MetaConfig;
... ... @@ -15,6 +18,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
... ... @@ -58,4 +64,36 @@ public class MetaConfigService {
return bp;
}
private Map<EntrySellerType,EntryThreshold> buildDefaultEntryThreshold(){
Map<EntrySellerType,EntryThreshold> map = new HashMap<>(2);
EntryThreshold commonET = new EntryThreshold();
commonET.setEntrySellerType(EntrySellerType.COMMON);
commonET.setPrepaymentAmount(new BigDecimal(999));
map.put(commonET.getEntrySellerType(), commonET);
EntryThreshold superET = new EntryThreshold();
superET.setEntrySellerType(EntrySellerType.SUPER_ENTRY);
superET.setPrepaymentAmount(new BigDecimal(5000));
superET.setGoodsOnOffShelveAmount(new BigDecimal(3000));
superET.setHiddenGoodsAmount(new BigDecimal(1000));
map.put(superET.getEntrySellerType(), superET);
return map;
}
public Map<EntrySellerType,EntryThreshold> getEntryThreshold(){
Map<EntrySellerType,EntryThreshold> map = new HashMap<>(2);
String key = MetaConfigKey.SELLER_ENTER_THRESHOLD;
MetaConfig metaConfig = metaConfigMapper.selectByCode(key);
logger.info("in getEntryThreshold from DB {}", metaConfig);
String configVal = null;
try {
map = JSONObject.parseObject(configVal=metaConfig.getValue(), new TypeReference<Map<EntrySellerType,EntryThreshold>>(){});
}catch (Exception ex){
map = buildDefaultEntryThreshold();
logger.warn("in getEntryThreshold parse value fail,configVal {} use default {}", configVal, map, ex);
}
return map;
}
}
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohobuy.ufo.model.order.common.SellerEnterApplyStatus;
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.SellerEnterApplyMapper;
import com.yohoufo.dal.order.model.SellerEnterApply;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* Created by chao.chen on 2019/1/14.
*/
@Service
public class SellerEnterApplyService {
private static final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private SellerEnterApplyMapper sellerEnterApplyMapper;
/**
* 申请成为超级卖家
* 对于未支付的某一种身份申请做订单号替换
* @param uid
* @param orderCode
*/
public void applySuperEntry(Integer uid, Long orderCode, EntrySellerType targetEST){
logger.info("in applySuperEntry uid {} orderCode {} targetEST {}", uid, orderCode, targetEST);
if (Objects.isNull(orderCode)){
logger.warn("in applySuperEntry uid {} orderCode is null targetEST {}", uid, targetEST);
throw new UfoServiceException(400, "orderCode is null");
}
if (Objects.isNull(targetEST)){
logger.warn("in applySuperEntry uid {} orderCode {} targetEST is null", uid, orderCode);
throw new UfoServiceException(400, "EntrySellerType is null");
}
SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).buildBase();
SellerBo sellerBo = sellerWrapper.build();
StoredSeller storedSeller = sellerWrapper.getStoredSeller();
EntrySellerType currentEST = sellerBo.getEntrySellerType();
//入驻卖家表没有记录
if (Objects.isNull(storedSeller)){
SellerEnterApply condition = new SellerEnterApply();
condition.setUid(uid);
condition.setEnterType(targetEST.getCode());
List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUidEnterType(condition);
//是否已经申请
if (CollectionUtils.isNotEmpty(seaList)){
//有记录
SellerEnterApply msea = findSellerEnterApply(uid, orderCode, targetEST, seaList);
if (Objects.isNull(msea)){
logger.info("applySuperEntry no one apply of waiting audit then add new, uid {} orderCode {} targetEST {} ",
uid, orderCode, targetEST);
//create new apply
add(uid, orderCode, currentEST, targetEST);
}else{
//update matched one
logger.info("applySuperEntry one apply waiting audit then update uid {} orderCode {} targetEST {} matched SellerEnterApply {}",
uid, orderCode, targetEST, msea);
update(msea.getId(),orderCode, currentEST, targetEST);
}
}else{
//没有申请过 => 第一次申请
logger.info("applySuperEntry no one apply of waiting audit then add new, uid {} orderCode {} targetEST {} ",
uid, orderCode, targetEST);
//create new apply
add(uid, orderCode, currentEST, targetEST);
}
}
//入驻卖家表有记录
//检查合法标识
//检查当前身份
if (Objects.nonNull(storedSeller)){
sellerWrapper.buildSuperEnterStageLevel();
Integer entryType = sellerBo.getEntryTypeCode();
if(Objects.equals(entryType, EntrySellerType.SUPER_ENTRY.getCode())){
SuperEnterStageLevel sesl = sellerBo.getSuperEnterStageLevel();
}
}
}
private SellerEnterApply findSellerEnterApply(Integer uid, Long orderCode, EntrySellerType targetEST,List<SellerEnterApply> seaList){
SellerEnterApply msea = null;
for(SellerEnterApply sea : seaList){
// 异常情况:已经通过
if (Objects.equals(sea.getStatus(), SellerEnterApplyStatus.PASS.getCode())){
logger.warn("findSellerEnterApply pass one apply, uid {} orderCode {} targetEST {} SellerEnterApply {}",
uid, orderCode, targetEST, sea);
}
// 没有通过
if (Objects.equals(sea.getStatus(),SellerEnterApplyStatus.WAITING_AUDIT.getCode())){
msea = sea;
logger.info("findSellerEnterApply one apply waiting audit, uid {} orderCode {} targetEST {} matched SellerEnterApply {}",
uid, orderCode, targetEST, msea);
break;
}
}
return msea;
}
public int update(Integer id,Long orderCode, EntrySellerType currentEST, EntrySellerType targetEST){
SellerEnterApply wpOfSea = new SellerEnterApply();
wpOfSea.setId(id);
Integer cdt = DateUtil.getCurrentTimeSecond();
wpOfSea.setUpdateTime(cdt);
wpOfSea.setOrderCode(orderCode);
wpOfSea.setPreEnterType(currentEST.getCode());
wpOfSea.setEnterType(targetEST.getCode());
return sellerEnterApplyMapper.updateByPrimaryKeySelective(wpOfSea);
}
public int add(int uid, Long orderCode, EntrySellerType currentEST, EntrySellerType targetEST){
SellerEnterApply wpOfSea = new SellerEnterApply();
wpOfSea.setUid(uid);
wpOfSea.setOrderCode(orderCode);
wpOfSea.setPreEnterType(currentEST.getCode());
wpOfSea.setEnterType(targetEST.getCode());
Integer cdt = DateUtil.getCurrentTimeSecond();
wpOfSea.setCreateTime(cdt);
wpOfSea.setUpdateTime(cdt);
wpOfSea.setStatus(SellerEnterApplyStatus.WAITING_AUDIT.getCode());
return sellerEnterApplyMapper.insertSelective(wpOfSea);
}
}
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by chao.chen on 2019/1/14.
*/
@Service
public class SellerFuncService {
private final Logger logger = LoggerUtils.getSellerOrderLogger();
public List getFuncList(StoredSeller pss){
Integer uid = pss.getUid();
String lflStr = pss.getLevelFuncList();
List<Integer> funcIds = null;
if (StringUtils.isNotBlank(lflStr)){
try {
funcIds = JSONObject.parseArray(lflStr, Integer.class);
}catch (Exception ex){
logger.warn("in getFuncList parse storedSeller.LevelFuncList fail uid {} funcIds {}",
uid, lflStr);
}
}
return funcIds;
}
}
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohobuy.ufo.model.order.common.SellerEnterApplyStatus;
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
import com.yohobuy.ufo.model.order.resp.EntryThreshold;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.SellerEnterApplyMapper;
import com.yohoufo.dal.order.SellerLevelFuncMapper;
import com.yohoufo.dal.order.StoredSellerMapper;
import com.yohoufo.dal.order.SuperEntrySellerMapper;
import com.yohoufo.dal.order.model.SellerEnterApply;
import com.yohoufo.dal.order.model.SellerLevelFunc;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.dal.order.model.SuperEntrySeller;
import com.yohoufo.order.common.SurperEntrySellerStatus;
... ... @@ -14,6 +22,7 @@ import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.cache.StoredSellerCacheService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.user.cache.CacheKeyEnum;
import lombok.Getter;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -35,7 +44,7 @@ import java.util.stream.Collectors;
@Service
public class SellerService {
private final Logger logger = LoggerUtils.getSellerOrderLogger();
private static final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private StoredSellerCacheService storedSellerCacheService;
... ... @@ -51,6 +60,11 @@ public class SellerService {
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
@Autowired
private SellerLevelFuncMapper sellerLevelFuncMapper;
/**更低出价提醒
* 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子)
*2)同一卖家的同一SKU 1小时内仅推送一条提醒(最先推送的那条)
... ... @@ -115,6 +129,87 @@ public class SellerService {
return false;
}
public class SellerWrapper{
@Getter
StoredSeller storedSeller;
Integer uid;
SellerBo sellerBo = new SellerBo();
SellerWrapper(int uid){
this.uid = uid;
this.sellerBo.setUid(uid);
}
SellerWrapper buildBase(){
logger.info("buildBase uid {}", uid);
if (uid <= 0){
logger.warn("buildBase illegal uid {}", uid);
throw new UfoServiceException(401, "uid is not legal");
}
EntrySellerType est = null;
//case 1 : not entry
this.storedSeller = storedSellerMapper.selectByUid(uid);
if (Objects.isNull(storedSeller)){
est = EntrySellerType.NOT_ENTRY;
logger.info("buildBase storedSeller is null uid {} entryType {}",
uid, est);
}else {
//case 2:exit entry
Integer validStatus = storedSeller.getValidStatus();
Integer entryType = storedSeller.getEntryType();
logger.info("buildBase uid {} validStatus {} entryType {}",
uid, validStatus, entryType);
if (Objects.equals(StoredSellerStatusEnum.quit.getId(), validStatus)) {
est = EntrySellerType.NOT_ENTRY;
} else if (isSpecialSuper(uid)) {
//case 3:valid ok and in white list
est = EntrySellerType.SPECIAL_SUPER;
} else if (Objects.equals(StoredSellerStatusEnum.entered.getId(), validStatus)) {
//case 4: left common or super
est = EntrySellerType.getEntrySellerType(entryType);
}
Integer funcId;
if (Objects.nonNull(funcId = storedSeller.getLevelFuncId())){
sellerBo.setLevelFuncId(funcId);
}
}
logger.info("buildBase uid {} EntrySellerType {}", uid, est);
if (Objects.nonNull(est)) {
sellerBo.setEntrySellerType(est);
sellerBo.setEntryTypeCode(est.getCode());
}
return this;
}
SellerWrapper buildSuperEnterStageLevel(){
EntrySellerType entrySellerType = sellerBo.getEntrySellerType();
if (Objects.nonNull(entrySellerType)){
//
Integer entryType = sellerBo.getEntryTypeCode();
if(Objects.equals(entryType, EntrySellerType.SUPER_ENTRY.getCode())){
Integer levelFuncId = sellerBo.getLevelFuncId();
if(Objects.nonNull(levelFuncId)){
SellerLevelFunc slf = sellerLevelFuncMapper.selectByPrimaryKey(levelFuncId);
logger.info("buildSuperEnterStageLevel SellerLevelFunc uid {} levelFuncId {} SellerLevelFunc {}",
uid, levelFuncId, slf);
Integer level = slf.getLevel();
SuperEnterStageLevel sesl = SuperEnterStageLevel.getSuperEnterStageLevel(level);
sellerBo.setSuperEnterStageLevel(sesl);
}
}
}
return this;
}
SellerBo build(){
return sellerBo;
}
}
/**
* 获取入驻商家类型
... ... @@ -123,46 +218,13 @@ public class SellerService {
*/
public EntrySellerType getEntrySellerType(int uid){
logger.info("getEntrySellerType uid {}", uid);
if (uid<=0){
logger.warn("getEntrySellerType illegal uid {}", uid);
throw new UfoServiceException(401, "uid is not legal");
}
EntrySellerType est = null;
//case 1 : not entry
StoredSeller storedSeller = storedSellerMapper.selectByUid(uid);
if (Objects.isNull(storedSeller)){
est = EntrySellerType.NOT_ENTRY;
logger.info("getEntrySellerType storedSeller is null uid {} entryType {}",
uid, est);
return est;
}
//case 2:exit entry
Integer validStatus = storedSeller.getValidStatus();
Integer entryType = storedSeller.getEntryType();
logger.info("getEntrySellerType uid {} validStatus {} entryType {}",
uid, validStatus, entryType);
if (Objects.equals(StoredSellerStatusEnum.quit.getId(), validStatus)){
est = EntrySellerType.NOT_ENTRY;
}else if(isSpecialSuper(uid)){
//case 3:valid ok and in white list
est = EntrySellerType.SPECIAL_SUPER;
}else if (Objects.equals(StoredSellerStatusEnum.entered.getId(), validStatus)){
//case 4: left common or super
est = EntrySellerType.getEntrySellerType(entryType);
}
SellerBo sellerBo = new SellerWrapper(uid).buildBase().build();
EntrySellerType est = sellerBo.getEntrySellerType();
logger.info("getEntrySellerType uid {} EntrySellerType {}", uid, est);
return est;
}
/**
* 申请成为超级卖家
* 对于未支付的某一种身份申请做订单号替换
* @param uid
* @param orderCode
*/
public void applySuperEntry(Integer uid, Long orderCode, EntrySellerType targetEST){
}
/**
* 支付成功后回调
... ... @@ -183,22 +245,11 @@ public class SellerService {
}
public Map<EntrySellerType,EntryThreshold> getEntryThreshold(){
Map<EntrySellerType,EntryThreshold> map = new HashMap<>(2);
EntryThreshold commonET = new EntryThreshold();
commonET.setEntrySellerType(EntrySellerType.COMMON);
commonET.setPrepaymentAmount(new BigDecimal(999));
map.put(commonET.getEntrySellerType(), commonET);
EntryThreshold superET = new EntryThreshold();
superET.setEntrySellerType(EntrySellerType.SUPER_ENTRY);
superET.setPrepaymentAmount(new BigDecimal(5000));
superET.setGoodsOnOffShelveAmount(new BigDecimal(3000));
superET.setHiddenGoodsAmount(new BigDecimal(1000));
map.put(superET.getEntrySellerType(), superET);
@Autowired
private MetaConfigService metaConfigService;
return map;
public Map<EntrySellerType,EntryThreshold> getEntryThreshold(){
return metaConfigService.getEntryThreshold();
}
public Boolean applySuperEnter(Integer uid){
... ...
... ... @@ -78,6 +78,9 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
@Autowired
private SellerService sellerService;
@Autowired
private SellerEnterApplyService sellerEnterApplyService;
/**
* 充值保证金
*/
... ... @@ -195,7 +198,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
}
private void markAsSuper(long orderCode, Integer uid, EntrySellerType sellerType) {
sellerService.applySuperEntry(uid, orderCode, sellerType);
sellerEnterApplyService.applySuperEntry(uid, orderCode, sellerType);
}
/**
... ...