Authored by caoyan

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

... ... @@ -12,7 +12,7 @@
<result column="status" jdbcType="SMALLINT" property="status" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, pre_enter_type, enter_type, create_time, update_time, status
id, uid, order_code, pre_enter_type, enter_type, create_time, update_time, `status`
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
... ... @@ -33,7 +33,7 @@
and enter_type = #{enterType,jdbcType=INTEGER}
</if>
<if test="preEnterType != null">
pre_enter_type = #{preEnterType,jdbcType=INTEGER}
and pre_enter_type = #{preEnterType,jdbcType=INTEGER}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
... ...
... ... @@ -746,6 +746,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
&& sellerType == EntrySellerType.SUPER_ENTRY) {
// 升级超级卖家:并发期间 处罚保证金 retry
if (availAmount == null) {
logger.info("{}修改钱包表余额,升级超级卖家:并发期间 处罚保证金 retry,bean={}", message, sw);
availAmount = lockAmount;
lockAmount = null;
sw.setAmount(availAmount);
... ...
... ... @@ -358,38 +358,57 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo();
expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList());
expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList());
expressInfoRespBo.setSupplementExpressInfoDetailList(Lists.newArrayList());
List<Integer> expressTypeList = getCurrentExpressType4ExpressRecord(buyerOrder.getStatus(), actor);
LOGGER.info("queryExpressDetailInfo getExpressType expressTypeList result = {}, uid={}, orderCode = {},actor = {} ",expressTypeList,uid, orderCode,actor);
if(CollectionUtils.isEmpty(expressTypeList)){
LOGGER.info("queryExpressDetailInfo getExpressType expressTypeList return empty result = {}, uid={}, orderCode = {},actor = {} ",expressTypeList,uid, orderCode,actor);
return expressInfoRespBo;
}
Integer expressType = getCurrentExpressType4ExpressRecord(buyerOrder.getStatus(), actor);
LOGGER.info("queryExpressDetailInfo getExpressType expressType result = {}, uid={}, orderCode = {},actor = {} ",expressType,uid, orderCode,actor);
//1.物流单号信息
constructWayBillInfo(orderCode,expressType,expressInfoRespBo);
//2.设定最近一个阶段的物流
expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList());
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressType);
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
constructWayBillInfo(orderCode,expressTypeList,expressInfoRespBo);
// 构造物流信息
if(expressTypeList.size()==1){
//设定最近一个阶段的物流
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
}else if(expressTypeList.size()==2){
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressTypeList.get(0)){
//设定鉴定的物流调拨信息
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
//获取上一阶段的辅助物流信息
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
}else{
//设定最近一个阶段的物流
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
//获取上一阶段的辅助物流信息
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
}
}else if(expressTypeList.size()==3){
//设定最近一个阶段的物流
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
//3.设定鉴定的物流调拨信息
expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList());
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
//设定鉴定的物流调拨信息
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
//4.获取上一阶段的辅助物流信息
List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList();
expressInfoRespBo.setSupplementExpressInfoDetailList(supplementExpressInfoDetailList);
constructSupplementExpress( actor,orderCode,expressType,expressInfoRespBo);
//获取上一阶段的辅助物流信息
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
}
//5.设定三个阶段的信息
buildExpressStage(buyerOrder.getStatus(), expressInfoRespBo);
//6.根据状态重设expressType
if(Objects.equals(OrderStatus.PLATFORM_RECEIVE.getCode(),buyerOrder.getStatus())
||Objects.equals(OrderStatus.PLATFORM_CHECKING.getCode(),buyerOrder.getStatus())
){
expressInfoRespBo.setExpressType(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().byteValue());
}
LOGGER.info("queryExpressDetailInfo result = {}", JSON.toJSONString(expressInfoRespBo));
return expressInfoRespBo;
}
... ... @@ -414,7 +433,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
private void constructSupplementExpress(TabType actor,Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){
if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue()){
if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue()
||EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressType.intValue()){
//买家这个时候需要看卖家的物流
//设置物流提示头信息
if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){
... ... @@ -429,7 +449,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
//如果还没有新的物流信息,卖家显示上一个阶段的物流
if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){
//物流单号信息
constructWayBillInfo(orderCode,EnumExpressType.EXPRESS_TYPE_1.getCode(),expressInfoRespBo);
constructWayBillInfo(orderCode,Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode()),expressInfoRespBo);
}
List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor,orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
... ... @@ -438,14 +458,22 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
//物流单号信息
private void constructWayBillInfo(Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){
private void constructWayBillInfo(Long orderCode,List<Integer> expressTypeList,ExpressInfoRespBo expressInfoRespBo){
Integer expressType = 0;
for(Integer i:expressTypeList){
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(i)){
continue;
}
expressType = i;
break; //循环一次 ,取最近的一个
}
ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode,expressType);
if(expressRecord!=null){
expressInfoRespBo.setExpressInfoDetailList(new ArrayList<>());
// 快递单号
expressInfoRespBo.setWayBillCode(expressRecord.getWaybillCode());
//物流类型
expressInfoRespBo.setExpressType(expressRecord.getExpressType());
expressInfoRespBo.setExpressType(expressTypeList.get(0).byteValue());
//物流发货方
expressInfoRespBo.setExpressSender(getSenderName(expressInfoRespBo.getExpressType().intValue()));
// 快递公司名称
... ... @@ -458,36 +486,37 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
* orderCode 一定是买家订单号
* @return
*/
private Integer getCurrentExpressType4ExpressRecord(Integer status, TabType actor) {
private List<Integer> getCurrentExpressType4ExpressRecord(Integer status, TabType actor) {
if(null==actor){
if(OrderStatus.SELLER_SEND_OUT.getCode()==status
||OrderStatus.PLATFORM_RECEIVE.getCode()==status
||OrderStatus.PLATFORM_CHECKING.getCode()==status
){
return EnumExpressType.EXPRESS_TYPE_1.getCode();
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode());
}else if(OrderStatus.PLATFORM_RECEIVE.getCode()==status
||OrderStatus.PLATFORM_CHECKING.getCode()==status){
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
}else if(OrderStatus.WAITING_RECEIVE.getCode()==status||OrderStatus.DONE.getCode()==status){
//4 和 5 状态有问题 ,买家查看物流是没问题的,卖家查看物流有问题啊.
return EnumExpressType.EXPRESS_TYPE_2.getCode();
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_2.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
}else if(OrderStatus.CHECKING_FAKE.getCode()==status){
return EnumExpressType.EXPRESS_TYPE_3.getCode();
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_3.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==status){
return EnumExpressType.EXPRESS_TYPE_REBACK.getCode();
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_REBACK.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.getCode());
}
}else {
switch (actor){
case BUY:
return EnumExpressType.EXPRESS_TYPE_2.getCode();
return getExpressType4Buyer(status);
case SELL:
return getCurrentExpressType4ExpressRecordAndSeller(status);
return getExpressTypes4Seller(status);
default:
return 0;
return null;
}
}
return 0;
return null;
}
private Integer getCurrentExpressType4ExpressRecordAndSeller(Integer status){
/* private Integer getCurrentExpressType4ExpressRecordAndSeller(Integer status){
Integer type ;
if (Objects.equals(OrderStatus.CHECKING_FAKE.getCode(), status)){
... ... @@ -498,7 +527,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
type = EnumExpressType.EXPRESS_TYPE_1.getCode();
}
return type;
}
}*/
/**
... ...
... ... @@ -10,10 +10,12 @@ 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.StoredSellerMapper;
import com.yohoufo.dal.order.model.SellerEnterApply;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.order.constants.SellerConfig;
import com.yohoufo.order.service.IStoredSellerService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -45,6 +47,9 @@ public class SellerEnterApplyService {
@Autowired
private SellerFuncService sellerFuncService;
@Autowired
private StoredSellerMapper storedSellerMapper;
/**
* 申请成为超级卖家
* 对于未支付的某一种身份申请做订单号替换
... ... @@ -61,7 +66,7 @@ public class SellerEnterApplyService {
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();
SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).storedSellerDataSource(storedSellerMapper::selectByUid).buildBase();
SellerBo sellerBo = sellerWrapper.build();
EntrySellerType currentEST = sellerBo.getEntrySellerType();
... ... @@ -174,7 +179,8 @@ public class SellerEnterApplyService {
logger.warn("in upgradeLevel one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode);
}
//卖家包装类
SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).buildBase();
SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid)
.storedSellerDataSource(storedSellerMapper::selectByUid).buildBase();
upgradeLevel(sellerWrapper, orderCode, left, seaList);
}
... ... @@ -248,6 +254,27 @@ public class SellerEnterApplyService {
if (!noStoredSeller && isMatchedET && levelNeedUpgrade) {
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
storedSellerService.updateEnterSeller(uid, targetEst, slfb);
processWithLevel(currentLevel, level, uid);
}
}
}
@Autowired
private ProductProxyService productProxyService;
public void processWithLevel(Integer currentLevel, Integer targetLevel, Integer uid){
logger.info("processWithLevel currentLevel {} targetLevel {} uid {}",currentLevel, targetLevel, uid);
if (SellerConfig.ENTER_TYPE_DEFAULT_LEVEL == currentLevel){
if(targetLevel == SuperEnterStageLevel.FULL.getCode()
||targetLevel == SuperEnterStageLevel.PARTITION.getCode()){
productProxyService.cancelHiddenGoods(uid);
}
}
if (SellerConfig.ENTER_TYPE_DEFAULT_LEVEL == targetLevel) {
if (currentLevel == SuperEnterStageLevel.FULL.getCode()
|| currentLevel == SuperEnterStageLevel.PARTITION.getCode()) {
productProxyService.hiddenGoods(uid);
}
}
}
... ...
... ... @@ -33,6 +33,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
... ... @@ -142,12 +144,19 @@ public class SellerService {
StoredSeller storedSeller;
@Getter
Integer uid;
Function<Integer,StoredSeller> storedSellerFunc;
SellerBo sellerBo = new SellerBo();
SellerWrapper(int uid){
this.uid = uid;
this.sellerBo.setUid(uid);
}
SellerWrapper storedSellerDataSource(Function<Integer,StoredSeller> storedSellerFunc){
this.storedSellerFunc = storedSellerFunc;
return this;
}
SellerWrapper buildBase(){
logger.info("buildBase uid {}", uid);
... ... @@ -158,7 +167,7 @@ public class SellerService {
EntrySellerType est = null;
//case 1 : not entry
this.storedSeller = storedSellerMapper.selectByUid(uid);
this.storedSeller = storedSellerFunc.apply(uid);//storedSellerMapper.selectByUid(uid);
if (Objects.isNull(storedSeller)){
est = EntrySellerType.NOT_ENTRY;
logger.info("buildBase storedSeller is null uid {} entryType {}",
... ... @@ -227,7 +236,7 @@ public class SellerService {
*/
public EntrySellerType getEntrySellerType(int uid){
logger.info("getEntrySellerType uid {}", uid);
SellerBo sellerBo = new SellerWrapper(uid).buildBase().build();
SellerBo sellerBo = new SellerWrapper(uid).storedSellerDataSource(storedSellerMapper::selectByUid).buildBase().build();
EntrySellerType est = sellerBo.getEntrySellerType();
logger.info("getEntrySellerType uid {} EntrySellerType {}", uid, est);
return est;
... ... @@ -263,7 +272,7 @@ public class SellerService {
public Boolean applySuperEnter(Integer uid){
SellerService.SellerWrapper sellerWrapper = new SellerService()
.new SellerWrapper(uid).buildBase();
.new SellerWrapper(uid).storedSellerDataSource(storedSellerMapper::selectByUid).buildBase();
SellerBo sellerBo = sellerWrapper.build();
EntrySellerType currentEST = sellerBo.getEntrySellerType();
EntrySellerType targetEST = EntrySellerType.SUPER_ENTRY;
... ...
... ... @@ -22,8 +22,6 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Service
... ...
... ... @@ -321,5 +321,31 @@ public class ProductProxyService {
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
private final static String hideSellerAllSkup = "ufo.product.hideSellerAllSkup",
showSellerAllSkup = "ufo.product.showSellerAllSkup";
public boolean hiddenGoods(Integer uid){
logger.info("begin in {} uid {}", hideSellerAllSkup, uid);
ApiResponse resp = null;
try {
resp = ufoServiceCaller.call(hideSellerAllSkup, uid);
} catch (Exception e) {
logger.warn("in {} call fail uid {}", hideSellerAllSkup, uid, e);
}
logger.info("finish {} -> uid {}", hideSellerAllSkup, uid);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
public boolean cancelHiddenGoods(Integer uid){
logger.info("begin in {} uid {}", showSellerAllSkup, uid);
ApiResponse resp = null;
try {
resp = ufoServiceCaller.call(showSellerAllSkup, uid);
}catch (Exception ex){
logger.warn("in {} call fail uid {}", showSellerAllSkup, uid, ex);
}
logger.info("finish {} -> uid {}", showSellerAllSkup, uid);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
}
... ...