Authored by LUOXC

no message

... ... @@ -10,6 +10,7 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.DepotType;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohobuy.ufo.model.order.resp.MiniFaultConfirm;
... ... @@ -78,7 +79,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Autowired
private BuyerOrderMapper buyerOrderMapper;
@Resource( name = "ufoExpressInfoProducer")
@Resource(name = "ufoExpressInfoProducer")
private YhProducer ufoExpressInfoProducer;
@Autowired
... ... @@ -91,7 +92,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private ProductProxyService productProxyService;
private StorageDepositMapper storageDepositMapper;
@Autowired
InBoxFacade inBoxFacade;
... ... @@ -123,92 +124,92 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
//物流文案设置
private final String pre_seller="尊敬的卖家您好,你出售的鞋子实收品相如图,";
private final String pre_buyer ="尊敬的买家您好,你购买的鞋子实收品相如图,";
private final String last_seller_un_accept="。";
private final String last_seller_confirm=",等待买家确认。";
private final String pre_seller = "尊敬的卖家您好,你出售的鞋子实收品相如图,";
private final String pre_buyer = "尊敬的买家您好,你购买的鞋子实收品相如图,";
private final String last_seller_un_accept = "。";
private final String last_seller_confirm = ",等待买家确认。";
@Autowired
private SkupService skupService;
/**
*
* @param sellerUid 卖家的uid
* @param sellerUid 卖家的uid
* @param expressCompanyId 快递公司id
* @param orderCode 订单号 :一定是买家订单编号
* @param wayBillCode 快递单号
* @param depotNum 鉴定中心id
* @param depotNum 鉴定中心id
*/
@Override
public void deliverToDepot(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,
public void deliverToDepot(Integer sellerUid, Integer expressCompanyId, Long orderCode, String wayBillCode,
Integer depotNum) {
//用户扫描二维码,防止注入信息
if(StringUtils.isBlank(wayBillCode)||wayBillCode.toLowerCase().contains("http")){
throw new UfoServiceException(400,"无效的快递单号");
if (StringUtils.isBlank(wayBillCode) || wayBillCode.toLowerCase().contains("http")) {
throw new UfoServiceException(400, "无效的快递单号");
}
wayBillCode = StringUtils.defaultString(wayBillCode).trim();
//保存物流信息+更新订单状态;
//本阶段的物流类型和订单状态
final OrderStatus expectOrderStatus = OrderStatus.HAS_PAYED;
final OrderStatus targetOrderStatus=OrderStatus.SELLER_SEND_OUT;
final OrderStatus targetOrderStatus = OrderStatus.SELLER_SEND_OUT;
Integer expressType = EnumExpressType.EXPRESS_TYPE_1.getCode();
LOGGER.info("deliverToDepot saveExpressAndUpdateBuyerOrderStatus sellerUid={} ,expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {} ,expectOrderStatus = {} ,targetOrderStatus = {} ,depotNum = {}", new Object[]{sellerUid ,expressCompanyId, orderCode, wayBillCode,expressType,expectOrderStatus,targetOrderStatus,depotNum});
",expressType = {} ,expectOrderStatus = {} ,targetOrderStatus = {} ,depotNum = {}", new Object[]{sellerUid, expressCompanyId, orderCode, wayBillCode, expressType, expectOrderStatus, targetOrderStatus, depotNum});
//TODO 应该将卖家的id带进去查询买家订单,防止操作别人卖的订单
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
if (buyerOrder == null){
if (buyerOrder == null) {
LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
Integer orderStatus = buyerOrder.getStatus();
if ( orderStatus != expectOrderStatus.getCode()){
if (orderStatus != expectOrderStatus.getCode()) {
LOGGER.warn("deliverToDepot order status changed , orderCode {} orderStatus {}", orderCode, orderStatus);
throw new UfoServiceException(400, "订单状态已变更,不能发货");
}
int buyerUid;
//获取skup
BuyerOrderGoods buyerOrderGoods= buyerOrderGoodsMapper.selectByOrderCode(buyerUid=buyerOrder.getUid(),orderCode);
if(buyerOrderGoods==null){
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerUid = buyerOrder.getUid(), orderCode);
if (buyerOrderGoods == null) {
LOGGER.warn("deliverToDepot buyerOrderGoods order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
if (isHKLargeSettlementSuper(sellerUid)){
if (isHKLargeSettlementSuper(sellerUid)) {
depotNum = DepotType.HK.getCode();
}
//根据skup ,更新鉴定中心
int skup;
skupService.setDepotNum(skup=buyerOrderGoods.getSkup(), depotNum);
skupService.setDepotNum(skup = buyerOrderGoods.getSkup(), depotNum);
// 更新买家订单状态
int updateBuyerCnt = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerOrder.getUid(),
expectOrderStatus.getCode(), targetOrderStatus.getCode(), DateUtil.getCurrentTimeSecond());
SellerOrderGoods psog ;
SellerOrderGoods psog;
if (updateBuyerCnt > 0) { // 更新买家订单成功之后,插入物流信息。防止并发、重复提交
// 保存订单物流信息
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.seller_send_out;
String mobile ="";
AppraiseAddressResp appraiseAddressResp =appraiseAddressService.queryInitAddressByDepotNum(depotNum);
if(appraiseAddressResp!=null){
String mobile = "";
AppraiseAddressResp appraiseAddressResp = appraiseAddressService.queryInitAddressByDepotNum(depotNum);
if (appraiseAddressResp != null) {
mobile = appraiseAddressResp.getMobile();
}
LOGGER.info("deliverToDepot saveExpress expressCompanyId {}, orderCode {}, wayBillCode {} " +
",expressType {},depotNum {},mobile {},expressDataType {},operateTransferCode {}",
new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile,expressDataType,operateTransferCode});
saveExpressRecordAndOperateTransferExpressInfo(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,expressDataType,operateTransferCode,depotNum);
new Object[]{expressCompanyId, orderCode, wayBillCode, expressType, depotNum, mobile, expressDataType, operateTransferCode});
saveExpressRecordAndOperateTransferExpressInfo(sellerUid, expressCompanyId, orderCode, wayBillCode, expressType, expressDataType, operateTransferCode, depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile);
sendExpressMQ(sellerUid, expressCompanyId, orderCode, wayBillCode, mobile);
psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
LOGGER.info("deliverToDepot end ! send express to erp ");
//记录订单的状态变更信息
LOGGER.info("in deliverToDepot record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
LOGGER.info("in deliverToDepot record status change, orderCode {},uid {} ,sellerUid {}", orderCode, buyerUid, sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
buyerNoticeFacade.sellerDeliver2Depot(buyerOrder, psog);
... ... @@ -225,84 +226,84 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()),
CacheKeyBuilder.sellerOrderDetailKey(psog),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
}else{
} else {
LOGGER.warn("deliverToDepot can not update order, orderCode {}", orderCode);
}
LOGGER.info("deliverToDepot update buyer order status, orderCode {} result {} ", orderCode, updateBuyerCnt);
}
@Override
public void returnBackCauseOfBuyerCancelAfterSellerSendOut(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile,boolean unSureFlag){
public void returnBackCauseOfBuyerCancelAfterSellerSendOut(Integer sellerUid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String mobile, boolean unSureFlag) {
Integer expressType = EnumExpressType.EXPRESS_TYPE_REBACK.getCode();
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.platform_express_cause_buyer_cancel_after_seller_send;
wayBillCode = StringUtils.defaultString(wayBillCode).trim();
LOGGER.info("returnBack expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={},unSureFlag={}",
new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile,expressDataType,operateTransferCode,unSureFlag});
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={},unSureFlag={}",
new Object[]{expressCompanyId, orderCode, wayBillCode, expressType, depotNum, mobile, expressDataType, operateTransferCode, unSureFlag});
// 保存订单物流信息
saveExpressRecordAndOperateTransferExpressInfo(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,expressDataType,operateTransferCode,depotNum);
saveExpressRecordAndOperateTransferExpressInfo(sellerUid, expressCompanyId, orderCode, wayBillCode, expressType, expressDataType, operateTransferCode, depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile);
sendExpressMQ(sellerUid, expressCompanyId, orderCode, wayBillCode, mobile);
LOGGER.info("returnBack end ! send express to erp ");
}
@Override
public void returnBackOrderCauseOfJudgeFailure(Integer sellerUid ,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile) {
public void returnBackOrderCauseOfJudgeFailure(Integer sellerUid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String mobile) {
Integer expressType = EnumExpressType.EXPRESS_TYPE_3.getCode();
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.platform_express_cause_failure;
wayBillCode = StringUtils.defaultString(wayBillCode).trim();
LOGGER.info("appraiseFail expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={}",
new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile,expressDataType,operateTransferCode});
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={}",
new Object[]{expressCompanyId, orderCode, wayBillCode, expressType, depotNum, mobile, expressDataType, operateTransferCode});
// 保存订单物流信息
saveExpressRecordAndOperateTransferExpressInfo(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,expressDataType,operateTransferCode,depotNum);
saveExpressRecordAndOperateTransferExpressInfo(sellerUid, expressCompanyId, orderCode, wayBillCode, expressType, expressDataType, operateTransferCode, depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile);
sendExpressMQ(sellerUid, expressCompanyId, orderCode, wayBillCode, mobile);
LOGGER.info("appraiseFail end ! send express to erp ");
}
@Override
public void deliverGoods(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile) {
public void deliverGoods(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String mobile) {
Integer expressType = EnumExpressType.EXPRESS_TYPE_2.getCode();
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.platform_express_cause_pass;
wayBillCode = StringUtils.defaultString(wayBillCode).trim();
LOGGER.info("appraiseSuccess expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={} ",
new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile,expressDataType,operateTransferCode});
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={} ",
new Object[]{expressCompanyId, orderCode, wayBillCode, expressType, depotNum, mobile, expressDataType, operateTransferCode});
// 保存订单物流信息
saveExpressRecordAndOperateTransferExpressInfo(uid,expressCompanyId,orderCode,wayBillCode,expressType,expressDataType,operateTransferCode,depotNum);
saveExpressRecordAndOperateTransferExpressInfo(uid, expressCompanyId, orderCode, wayBillCode, expressType, expressDataType, operateTransferCode, depotNum);
// 发送mq获取物流信息
sendExpressMQ(uid,expressCompanyId,orderCode,wayBillCode,mobile);
sendExpressMQ(uid, expressCompanyId, orderCode, wayBillCode, mobile);
LOGGER.info("appraiseSuccess end ! send express to erp ");
}
/**
* 保存物流信息和调拨信息
* @param uid 卖家到鉴定中心和鉴定失败时,记录卖家的uid,鉴定成功记录买家uid
*
* @param uid 卖家到鉴定中心和鉴定失败时,记录卖家的uid,鉴定成功记录买家uid
* @param expressCompanyId
* @param orderCode
* @param wayBillCode
* @param expressType
*/
private void saveExpressRecordAndOperateTransferExpressInfo(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer expressType,EnumExpressDataType expressDataType,EnumExpressDataOperateTransferCode operateTransferCode,Integer depotNum ){
ExpressRecord record=new ExpressRecord();
private void saveExpressRecordAndOperateTransferExpressInfo(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer expressType, EnumExpressDataType expressDataType, EnumExpressDataOperateTransferCode operateTransferCode, Integer depotNum) {
ExpressRecord record = new ExpressRecord();
record.setUid(uid);/// 存卖家的uid
record.setOrderCode(orderCode);
record.setWaybillCode(wayBillCode);
... ... @@ -314,15 +315,15 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
expressRecordMapper.insert(record);
//新增一条保存调拨信息
LOGGER.info("ExpressInfoServiceImpl begin add OperateTransferExpressInfo ,expressDataType = {} ,operateTransferCode = {},record = {}",expressDataType,operateTransferCode,record);
saveOperateTransferExpressInfo(uid,expressCompanyId,orderCode,wayBillCode,expressType,expressDataType,operateTransferCode);
LOGGER.info("ExpressInfoServiceImpl begin add OperateTransferExpressInfo ,expressDataType = {} ,operateTransferCode = {},record = {}", expressDataType, operateTransferCode, record);
saveOperateTransferExpressInfo(uid, expressCompanyId, orderCode, wayBillCode, expressType, expressDataType, operateTransferCode);
}
public void saveOperateTransferExpressInfo(Integer uid, Long orderCode, Integer expressType, EnumExpressDataType expressDataType,EnumExpressDataOperateTransferCode operateTransferCode){
public void saveOperateTransferExpressInfo(Integer uid, Long orderCode, Integer expressType, EnumExpressDataType expressDataType, EnumExpressDataOperateTransferCode operateTransferCode) {
LOGGER.info("ExpressInfoServiceImpl begin add OperateTran enter ,uid ={},orderCode={},expressType={},expressDataType={},operateTransferCode={} ",
uid,orderCode,expressType,expressDataType,operateTransferCode);
saveOperateTransferExpressInfo(uid,23,orderCode, "",
expressType, expressDataType, operateTransferCode);
uid, orderCode, expressType, expressDataType, operateTransferCode);
saveOperateTransferExpressInfo(uid, 23, orderCode, "",
expressType, expressDataType, operateTransferCode);
}
@Override
... ... @@ -330,7 +331,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
try {
saveOperateTransferExpressInfo(request.getUid(), 23, request.getOrderCode(), "",
request.getExpressType().getCode(), EnumExpressDataType.operate_transfer, request.getOperateTransferCode());
}catch (Exception e){
} catch (Exception e) {
LOGGER.warn("save Operate Transfer fail, uid is {} order code is {} ");
}
}
... ... @@ -342,13 +343,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
}
private void saveOperateTransferExpressInfo(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer expressType, EnumExpressDataType expressDataType,EnumExpressDataOperateTransferCode operateTransferCode){
private void saveOperateTransferExpressInfo(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer expressType, EnumExpressDataType expressDataType, EnumExpressDataOperateTransferCode operateTransferCode) {
ExpressInfo expressInfo = new ExpressInfo();
expressInfo.setDataType(expressDataType.getCode());
if(operateTransferCode!=null){
if (operateTransferCode != null) {
expressInfo.setOperateTransferCode(operateTransferCode.getCode());
}
expressInfo.setAcceptRemark(StringUtils.defaultString(operateTransferCode==null?"":operateTransferCode.getOperateTransferDesc()));
expressInfo.setAcceptRemark(StringUtils.defaultString(operateTransferCode == null ? "" : operateTransferCode.getOperateTransferDesc()));
expressInfo.setAcceptAddress("");
expressInfo.setState(ExpressInfoConstant.EXPRESS_STATUS_UNSING);
expressInfo.setLogisticsType(expressCompanyId);
... ... @@ -359,20 +360,21 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
expressInfo.setExpressType(expressType.byteValue());
LOGGER.info("ExpressInfoServiceImpl saveOperateTransferExpressInfo {} ", expressInfo);
int num = expressInfoMapper.insert(expressInfo);
LOGGER.info("ExpressInfoServiceImpl saveOperateTransferExpressInfo end ,num = {} ,expressInfo = {} ",num,expressInfo );
LOGGER.info("ExpressInfoServiceImpl saveOperateTransferExpressInfo end ,num = {} ,expressInfo = {} ", num, expressInfo);
}
@Override
public void triggerExpressMQ(Integer uid,Integer expressCompanyId,Long orderCode,String wayBillCode,String mobile ){
public void triggerExpressMQ(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, String mobile) {
// 发送mq获取物流信息
sendExpressMQ(uid,expressCompanyId,orderCode,wayBillCode,mobile);
sendExpressMQ(uid, expressCompanyId, orderCode, wayBillCode, mobile);
LOGGER.info("triggerExpressMQ end ! send express to erp ");
}
/**
* 发送mq消息,获取物流信息
*/
private void sendExpressMQ(Integer uid,Integer expressCompanyId,Long orderCode,String wayBillCode,String mobile ){
ExpressForMqSend mqInfo=new ExpressForMqSend();
private void sendExpressMQ(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, String mobile) {
ExpressForMqSend mqInfo = new ExpressForMqSend();
mqInfo.setExpressNumber(wayBillCode);
mqInfo.setExpressId(expressCompanyId);
mqInfo.setOrderCode(orderCode);
... ... @@ -380,43 +382,44 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
mqInfo.setBusinessType(5);
mqInfo.setMobile(mobile);
try{
try {
ufoExpressInfoProducer.send(EXPRESS_MQ_SEND, mqInfo);
LOGGER.info("send express mq success. topic is {}, param is {}", EXPRESS_MQ_SEND, mqInfo);
}catch (Exception e){
} catch (Exception e) {
LOGGER.warn("send express mq failed. param is {}, exception is {}", mqInfo, e);
}
}
/**
* 查询快递详情
*
* @param orderCode
* @return
*/
@Override
public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode,TabType actor,Integer scene) {
LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {},actor = {} ",uid, orderCode,actor);
public ExpressInfoRespBo queryExpressDetailInfo(Integer uid, Long orderCode, TabType actor, Integer scene) {
LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {},actor = {} ", uid, orderCode, actor);
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null){
if (buyerOrder == null) {
LOGGER.warn("queryExpressDetailInfo getOrderInfo order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
//验证订单和tabType匹配
if(actor!=null){
switch (actor){
if (actor != null) {
switch (actor) {
case BUY:
if(!uid.equals(buyerOrder.getUid())){
if (!uid.equals(buyerOrder.getUid())) {
//验证是买家
LOGGER.warn("queryExpressDetailInfo check order not match buyer , uid = {} ,order is {} ", orderCode ,JSON.toJSONString(buyerOrder) );
throw new UfoServiceException(400,"订单物流不允许买家用户查询");
LOGGER.warn("queryExpressDetailInfo check order not match buyer , uid = {} ,order is {} ", orderCode, JSON.toJSONString(buyerOrder));
throw new UfoServiceException(400, "订单物流不允许买家用户查询");
}
break;
case SELL:
if(!uid.equals(buyerOrder.getSellerUid())){
if (!uid.equals(buyerOrder.getSellerUid())) {
//验证是卖家
LOGGER.warn("queryExpressDetailInfo check order not match seller , uid = {} ,order is {} ", orderCode ,JSON.toJSONString(buyerOrder) );
throw new UfoServiceException(400,"订单物流不允许卖家用户查询");
LOGGER.warn("queryExpressDetailInfo check order not match seller , uid = {} ,order is {} ", orderCode, JSON.toJSONString(buyerOrder));
throw new UfoServiceException(400, "订单物流不允许卖家用户查询");
}
break;
}
... ... @@ -431,75 +434,78 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
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);
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;
}
//1.物流单号信息
constructWayBillInfo(orderCode,expressTypeList,expressInfoRespBo);
if(TabType.BUY==actor&&expressInfoRespBo.getExpressType()!=null
&&expressInfoRespBo.getExpressType().intValue()==EnumExpressType.EXPRESS_TYPE_1.getCode().intValue()){
constructWayBillInfo(orderCode, expressTypeList, expressInfoRespBo);
if (TabType.BUY == actor && expressInfoRespBo.getExpressType() != null
&& expressInfoRespBo.getExpressType().intValue() == EnumExpressType.EXPRESS_TYPE_1.getCode().intValue()) {
//买家不能看到卖家的物流单号
expressInfoRespBo.setWayBillCode("");
}
// 构造物流信息
if(expressTypeList.size()==1){
if (expressTypeList.size() == 1) {
//设定最近一个阶段的物流
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
constructExpressInfo(actor, expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
expressInfoRespBo.setExpressInfoDetailTitle("卖家发往平台");
}else if(expressTypeList.size()==2){
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressTypeList.get(0)){
} 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());
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{
constructSupplementExpress(actor, orderCode, expressTypeList.get(0), expressInfoRespBo);
} else {
//设定最近一个阶段的物流
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
if(EnumExpressType.EXPRESS_TYPE_2.getCode().equals(expressTypeList.get(0))){
constructExpressInfo(actor, expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
if (EnumExpressType.EXPRESS_TYPE_2.getCode().equals(expressTypeList.get(0))) {
expressInfoRespBo.setExpressInfoDetailTitle("平台发往买家");
}else{
} else {
expressInfoRespBo.setExpressInfoDetailTitle("平台发往卖家");
}
//获取上一阶段的辅助物流信息
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
constructSupplementExpress(actor, orderCode, expressTypeList.get(0), expressInfoRespBo);
}
}else if(expressTypeList.size()==3){
} else if (expressTypeList.size() == 3) {
//设定最近一个阶段的物流
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressTypeList.get(0));
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
if(EnumExpressType.EXPRESS_TYPE_2.getCode().equals(expressTypeList.get(0))){
constructExpressInfo(actor, expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
if (EnumExpressType.EXPRESS_TYPE_2.getCode().equals(expressTypeList.get(0))) {
expressInfoRespBo.setExpressInfoDetailTitle("平台发往买家");
}else{
} else {
expressInfoRespBo.setExpressInfoDetailTitle("平台发往卖家");
}
//设定鉴定的物流调拨信息
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());
//获取上一阶段的辅助物流信息
constructSupplementExpress( actor,orderCode,expressTypeList.get(0),expressInfoRespBo);
constructSupplementExpress(actor, orderCode, expressTypeList.get(0), expressInfoRespBo);
}
//5.设定阶段的信息
expressInfoRespBo.setStage(new ExpressStageBuilder(actor, buyerOrder.getStatus())
expressInfoRespBo.setStage(new ExpressStageBuilder(actor, buyerOrder)
.scene(scene)
.expressInfoRespBo(expressInfoRespBo)
.isQuickShipDone(() -> Optional.ofNullable(storageDepositMapper.selectByOrderCode(orderCode))
.filter(e -> Objects.equals(e.getStatus(), StorageDepositStatusEnum.HAS_END.getCode()))
.isPresent())
.build());
//鉴定阶段的物流仍然属于卖家
if(expressInfoRespBo.getExpressType()!=null&&EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode()==expressInfoRespBo.getExpressType().intValue()){
if (expressInfoRespBo.getExpressType() != null && EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode() == expressInfoRespBo.getExpressType().intValue()) {
expressInfoRespBo.setExpressType(EnumExpressType.EXPRESS_TYPE_1.getCode().byteValue());
}
... ... @@ -513,43 +519,43 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
return expressInfoRespBo;
}
private void constructSupplementExpress(TabType actor,Long orderCode,Integer expressType,ExpressInfoRespBo expressInfoRespBo){
if(EnumExpressType.EXPRESS_TYPE_2.getCode().intValue()==expressType.intValue()
||EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue()==expressType.intValue()){
private void constructSupplementExpress(TabType actor, Long orderCode, Integer expressType, ExpressInfoRespBo expressInfoRespBo) {
if (EnumExpressType.EXPRESS_TYPE_2.getCode().intValue() == expressType.intValue()
|| EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().intValue() == expressType.intValue()) {
//买家这个时候需要看卖家的物流
//设置物流提示头信息
if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){
if (StringUtils.isBlank(expressInfoRespBo.getExpressSender())) {
expressInfoRespBo.setExpressSender(getSenderName(EnumExpressType.EXPRESS_TYPE_1.getCode().intValue()));
}
//卖家物流详细
List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
}else if(EnumExpressType.EXPRESS_TYPE_3.getCode().intValue()==expressType.intValue()
||EnumExpressType.EXPRESS_TYPE_REBACK.getCode().intValue()==expressType.intValue()){
constructExpressInfo(actor, previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
} else if (EnumExpressType.EXPRESS_TYPE_3.getCode().intValue() == expressType.intValue()
|| EnumExpressType.EXPRESS_TYPE_REBACK.getCode().intValue() == expressType.intValue()) {
//卖家这个时候看自己上一阶段的物流
//如果还没有新的物流信息,卖家显示上一个阶段的物流
if(StringUtils.isBlank(expressInfoRespBo.getExpressSender())){
if (StringUtils.isBlank(expressInfoRespBo.getExpressSender())) {
//物流单号信息
constructWayBillInfo(orderCode,Arrays.asList(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());
List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
constructExpressInfo(actor, previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
}
}
//物流单号信息
private void constructWayBillInfo(Long orderCode,List<Integer> expressTypeList,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)){
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){
ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode, expressType);
if (expressRecord != null) {
expressInfoRespBo.setExpressInfoDetailList(new ArrayList<>());
// 快递单号
expressInfoRespBo.setWayBillCode(expressRecord.getWaybillCode());
... ... @@ -565,32 +571,33 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
/**
* 根据状态和actor 获取最近的物流记录状态
* orderCode 一定是买家订单号
*
* @return
*/
private List<Integer> getCurrentExpressType4ExpressRecord(Integer status, TabType actor) {
if(null==actor){
if(OrderStatus.SELLER_SEND_OUT.getCode()==status
){
if (null == actor) {
if (OrderStatus.SELLER_SEND_OUT.getCode() == status
) {
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_1.getCode());
}else if(OrderStatus.PLATFORM_RECEIVE.getCode()==status
||OrderStatus.PLATFORM_CHECKING.getCode()==status
||OrderStatus.MINI_FAULT_WAITING.getCode()==status
||OrderStatus.MINI_FAULT_ACCEPT.getCode()==status
||OrderStatus.JUDGE_PASS.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){
} else if (OrderStatus.PLATFORM_RECEIVE.getCode() == status
|| OrderStatus.PLATFORM_CHECKING.getCode() == status
|| OrderStatus.MINI_FAULT_WAITING.getCode() == status
|| OrderStatus.MINI_FAULT_ACCEPT.getCode() == status
|| OrderStatus.JUDGE_PASS.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 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
||OrderStatus.QUALITY_CHECK_FAKE.getCode()==status
||OrderStatus.MINI_FAULT_REJECT.getCode()==status
||OrderStatus.MINI_FAULT_OUT_TIME_REJECT.getCode()==status){
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||OrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()==status){
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_REBACK.getCode(),EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(),EnumExpressType.EXPRESS_TYPE_1.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
|| OrderStatus.QUALITY_CHECK_FAKE.getCode() == status
|| OrderStatus.MINI_FAULT_REJECT.getCode() == status
|| OrderStatus.MINI_FAULT_OUT_TIME_REJECT.getCode() == status) {
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 || OrderStatus.PLATFORM_APPRAISE_UNSURE.getCode() == status) {
return Arrays.asList(EnumExpressType.EXPRESS_TYPE_REBACK.getCode(), EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode(), EnumExpressType.EXPRESS_TYPE_1.getCode());
}
}else {
switch (actor){
} else {
switch (actor) {
case BUY:
return getExpressType4Buyer(status);
case SELL:
... ... @@ -621,50 +628,51 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
* 获取物流详情
* 逻辑变更:以前是直接从express_info获取
* 变更为:先从express_record获取物流单号,再通过物流单号关联express_info ,从而解决多个订单一个物流号问题
*
* @return
*/
private List<ExpressInfo> getExpressInfoListByStage(TabType actor,Long orderCode, Integer expressType){
LOGGER.info("getExpressInfoListByStage enter ,orderCode = {} ,expressType = {} ,actor = {}",orderCode,expressType,actor);
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(expressType)){
LOGGER.info("getExpressInfoListByStage expressType is judge center ,orderCode = {} ,expressType = {} ",orderCode,expressType);
List<ExpressInfo> ls = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode,expressType);
if(CollectionUtils.isNotEmpty(ls)){
for(ExpressInfo info:ls){
if(info.getOperateTransferCode()==null){
private List<ExpressInfo> getExpressInfoListByStage(TabType actor, Long orderCode, Integer expressType) {
LOGGER.info("getExpressInfoListByStage enter ,orderCode = {} ,expressType = {} ,actor = {}", orderCode, expressType, actor);
if (EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(expressType)) {
LOGGER.info("getExpressInfoListByStage expressType is judge center ,orderCode = {} ,expressType = {} ", orderCode, expressType);
List<ExpressInfo> ls = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode, expressType);
if (CollectionUtils.isNotEmpty(ls)) {
for (ExpressInfo info : ls) {
if (info.getOperateTransferCode() == null) {
continue;
}
if(EnumExpressDataOperateTransferCode.mini_fault_create.getCode()==info.getOperateTransferCode()){
if(TabType.BUY==actor){
if (EnumExpressDataOperateTransferCode.mini_fault_create.getCode() == info.getOperateTransferCode()) {
if (TabType.BUY == actor) {
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_create_buyer.getOperateTransferDesc());
}
//存在需要瑕疵确认的信息
QualityCheck qualityCheck = qualityCheckMapper.selectByOrderCode(orderCode);
if(qualityCheck!=null
&&qualityCheck.getType()!=null
&&EnumQualityCheckType.MINI_FAULT.getCode()==qualityCheck.getType().intValue()){
if (qualityCheck != null
&& qualityCheck.getType() != null
&& EnumQualityCheckType.MINI_FAULT.getCode() == qualityCheck.getType().intValue()) {
info.setQualityCheck(qualityCheck);
}
}else if(EnumExpressDataOperateTransferCode.quality_check_reject.getCode()==info.getOperateTransferCode()){
if(TabType.SELL==actor){
} else if (EnumExpressDataOperateTransferCode.quality_check_reject.getCode() == info.getOperateTransferCode()) {
if (TabType.SELL == actor) {
//存在需要瑕疵确认的信息
QualityCheck qualityCheck = qualityCheckMapper.selectByOrderCode(orderCode);
if(qualityCheck!=null
&&qualityCheck.getType()!=null
&&EnumQualityCheckType.CHECK_NOT_PASS.getCode()==qualityCheck.getType().intValue()){
if (qualityCheck != null
&& qualityCheck.getType() != null
&& EnumQualityCheckType.CHECK_NOT_PASS.getCode() == qualityCheck.getType().intValue()) {
info.setQualityCheck(qualityCheck);
}
}
}else if(EnumExpressDataOperateTransferCode.mini_fault_accept.getCode()==info.getOperateTransferCode()){
if(TabType.BUY==actor){
} else if (EnumExpressDataOperateTransferCode.mini_fault_accept.getCode() == info.getOperateTransferCode()) {
if (TabType.BUY == actor) {
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_accept_buyer.getOperateTransferDesc());
}
}else if(EnumExpressDataOperateTransferCode.mini_fault_reject.getCode()==info.getOperateTransferCode()){
if(TabType.BUY==actor){
} else if (EnumExpressDataOperateTransferCode.mini_fault_reject.getCode() == info.getOperateTransferCode()) {
if (TabType.BUY == actor) {
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_reject_buyer.getOperateTransferDesc());
}
}
... ... @@ -676,18 +684,18 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
List<ExpressInfo> list = getExpressInfoList(orderCode, expressType);
//第一阶段的物流:买家不允许查看卖家给平台订单的顺丰联系人的手机号,手机号脱敏
if(EnumExpressType.EXPRESS_TYPE_1.getCode().equals(expressType)&&TabType.BUY==actor&&CollectionUtils.isNotEmpty(list)){
for(ExpressInfo expressInfo:list){
String info = StringUtils.defaultString(expressInfo.getAcceptRemark(),"");
boolean hasSendKeyword = info.contains("派送")||info.contains("派件");
if(info.contains("电话")&&hasSendKeyword){
if (EnumExpressType.EXPRESS_TYPE_1.getCode().equals(expressType) && TabType.BUY == actor && CollectionUtils.isNotEmpty(list)) {
for (ExpressInfo expressInfo : list) {
String info = StringUtils.defaultString(expressInfo.getAcceptRemark(), "");
boolean hasSendKeyword = info.contains("派送") || info.contains("派件");
if (info.contains("电话") && hasSendKeyword) {
List<String> phoneList = UserInfoHiddenHelper.fetchPhone(info);
LOGGER.info("getExpressInfoListByStage hide phone number , orderCode = {} ,expressType = {}, actor = {} ,remark {}",orderCode,expressType, actor,info);
for(String ph:phoneList){
info = info.replaceFirst(ph,UserInfoHiddenHelper.hidePhoneNo(ph));
LOGGER.info("getExpressInfoListByStage hide phone number , orderCode = {} ,expressType = {}, actor = {} ,remark {}", orderCode, expressType, actor, info);
for (String ph : phoneList) {
info = info.replaceFirst(ph, UserInfoHiddenHelper.hidePhoneNo(ph));
}
expressInfo.setAcceptRemark(info);
LOGGER.info("getExpressInfoListByStage hide phone number , orderCode = {} ,expressType = {}, actor = {} ,new replace remark {}",orderCode,expressType, actor,info);
LOGGER.info("getExpressInfoListByStage hide phone number , orderCode = {} ,expressType = {}, actor = {} ,new replace remark {}", orderCode, expressType, actor, info);
}
}
}
... ... @@ -696,47 +704,47 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
private List<ExpressInfo> getExpressInfoList(Long orderCode, Integer expressType) {
List<ExpressInfo> list;
ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode,expressType);
if(expressRecord==null){
list = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode,expressType).stream()
ExpressRecord expressRecord = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode, expressType);
if (expressRecord == null) {
list = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode, expressType).stream()
// 保留正确的物流信息和调拨信息
.filter(info -> StringUtils.isBlank(info.getWaybillCode()))
.collect(Collectors.toList());
}else {
} else {
String waybillCode = expressRecord.getWaybillCode();
Integer logisticsType = expressRecord.getLogisticsType();
list = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode,expressType).stream()
list = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode, expressType).stream()
// 保留正确的物流信息和调拨信息
.filter(info -> StringUtils.equals(waybillCode, info.getWaybillCode()) || StringUtils.isBlank(info.getWaybillCode()))
.collect(Collectors.toList());
//如果获取为空,尝试另外一个方式,通过物流单号查
if(CollectionUtils.isEmpty(list)){
LOGGER.info("getExpressInfoListByStage try again by waybillCode, orderCode = {} ,expressType = {}, expressRecord = {} ",orderCode,expressType,expressRecord);
list = expressInfoMapper.selectExpressInfoListByWaybillCodeAndLogisticsType(waybillCode,logisticsType);
if (CollectionUtils.isEmpty(list)) {
LOGGER.info("getExpressInfoListByStage try again by waybillCode, orderCode = {} ,expressType = {}, expressRecord = {} ", orderCode, expressType, expressRecord);
list = expressInfoMapper.selectExpressInfoListByWaybillCodeAndLogisticsType(waybillCode, logisticsType);
//如果存在多笔订单的情况,选择一个最近的订单
if(CollectionUtils.isNotEmpty(list)){
long latestOrder=list.get(0).getOrderCode();
list = list.stream().filter(info -> (latestOrder==info.getOrderCode())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
long latestOrder = list.get(0).getOrderCode();
list = list.stream().filter(info -> (latestOrder == info.getOrderCode())).collect(Collectors.toList());
}
}
}
return list;
}
private List<ExpressInfoDetail> queryLastExpressDetailInfo(TabType actor,Long orderCode, int expressType) {
private List<ExpressInfoDetail> queryLastExpressDetailInfo(TabType actor, Long orderCode, int expressType) {
LOGGER.info("queryLastExpressDetailInfo orderCode {}, expressType {}", orderCode, expressType);
List<ExpressInfo> expressInfoList_All = getExpressInfoListByStage( actor,orderCode, expressType);
if (expressInfoList_All==null||expressInfoList_All.size()<=0){
List<ExpressInfo> expressInfoList_All = getExpressInfoListByStage(actor, orderCode, expressType);
if (expressInfoList_All == null || expressInfoList_All.size() <= 0) {
LOGGER.info("queryLastExpressDetailInfo, getExpressType result is null ,orderCode {}, expressType {}", orderCode, expressType);
return null;
}
//已经是按照时间倒叙排列了,直接取第一条就可以了
ExpressInfo last=expressInfoList_All.get(0);
ExpressInfo last = expressInfoList_All.get(0);
List<ExpressInfo> expressInfoList = Arrays.asList(last);
List<ExpressInfoDetail> expressInfoDetailList= Lists.newArrayList();
constructExpressInfo(actor,expressInfoList,expressInfoDetailList);
List<ExpressInfoDetail> expressInfoDetailList = Lists.newArrayList();
constructExpressInfo(actor, expressInfoList, expressInfoDetailList);
LOGGER.info("queryLastExpressDetailInfo.queryExpressDetailInfo result = {}", JSON.toJSONString(expressInfoDetailList));
return expressInfoDetailList;
... ... @@ -745,22 +753,22 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Override
public ExpressInfoDetail getLastExpressInfoDetail(TabType actor, int status, Long orderCode) {
List<Integer> types = null;
if(actor == TabType.SELL){
if (actor == TabType.SELL) {
types = getExpressTypes4Seller(status);
}
if (actor == TabType.BUY){
if (actor == TabType.BUY) {
types = getExpressType4Buyer(status);
}
if (CollectionUtils.isEmpty(types)){
if (CollectionUtils.isEmpty(types)) {
return null;
}
//from big 2 small
//List<Integer> sortedTypes = types.stream().sorted((o1,o2)-> o2-o1).collect(Collectors.toList());
//types 本身已经有顺序了,新增了数字type,不能执行之前的根据大小排序
ExpressInfoDetail lastEID = null;
for(Integer type : types){
List<ExpressInfoDetail> eidList = queryLastExpressDetailInfo(actor,orderCode, type);
if ( CollectionUtils.isNotEmpty(eidList)){
for (Integer type : types) {
List<ExpressInfoDetail> eidList = queryLastExpressDetailInfo(actor, orderCode, type);
if (CollectionUtils.isNotEmpty(eidList)) {
lastEID = eidList.get(0);
break;
}
... ... @@ -798,7 +806,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
}
private String getSenderName(int expressType){
private String getSenderName(int expressType) {
//seller("物流详情", EnumExpressType.EXPRESS_TYPE_1),
//yoho_to_buyer("物流详情", EnumExpressType.EXPRESS_TYPE_2.intValue()),
//yoho_to_seller_appraise_fail("物流详情", EnumExpressType.EXPRESS_TYPE_3.intValue()),
... ... @@ -808,7 +816,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
private void constructExpressInfo(TabType actor,List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> detailList) {
private void constructExpressInfo(TabType actor, List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> detailList) {
if (CollectionUtils.isNotEmpty(expressInfoList)) {
for (ExpressInfo expressInfo : expressInfoList) {
ExpressInfoDetail expressInfoDetail = new ExpressInfoDetail();
... ... @@ -822,68 +830,67 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
expressInfoDetail.setExpressType(expressInfo.getExpressType().intValue());
//确认信息
if(expressInfo.getQualityCheck()!=null){
if (expressInfo.getQualityCheck() != null) {
QualityCheck qualityCheck = expressInfo.getQualityCheck();
boolean showBtn=false;
boolean showBtn = false;
int leftTime = 0;
//倒计时
OrderOverTime orderOverTime = Optional.ofNullable(qualityCheck.getOrderCode()).map(orderOverTimeService::selectByOrderCode).orElse(null);
// 对于老订单来说,超时表记录无数据,则默认24小时 ,即1440分钟
Integer miniFaultConfirmMinutes = Optional.ofNullable(orderOverTime).map(OrderOverTime::getMiniFaultConfirmMinutes).orElse(1440);
int mini_fault_mark_outer_time_second= miniFaultConfirmMinutes * 60;
int mini_fault_mark_outer_time_second = miniFaultConfirmMinutes * 60;
//int mini_fault_mark_outer_time_second= DelayTime.MINI_FAULT_CONFIRM_OUTER_TIME_MINUTE * 60;
int expireTime = qualityCheck.getCreateTime() + mini_fault_mark_outer_time_second;
int nowTs = DateUtil.getCurrentTimeSecond();
if(expireTime> nowTs){
if (expireTime > nowTs) {
leftTime = expireTime - nowTs;
}
MiniFaultConfirm miniFaultConfirm=new MiniFaultConfirm();
MiniFaultConfirm miniFaultConfirm = new MiniFaultConfirm();
//质检不通过,只有卖家显示
if(qualityCheck.getType()!=null&&EnumQualityCheckType.CHECK_NOT_PASS.getCode().intValue()==qualityCheck.getType().intValue()){
if(TabType.SELL ==actor){
if (qualityCheck.getType() != null && EnumQualityCheckType.CHECK_NOT_PASS.getCode().intValue() == qualityCheck.getType().intValue()) {
if (TabType.SELL == actor) {
miniFaultConfirm.setPreText(pre_seller);
miniFaultConfirm.setSuppleText(last_seller_un_accept);
}
}else if(qualityCheck.getType()!=null&&EnumQualityCheckType.MINI_FAULT.getCode().intValue()==qualityCheck.getType().intValue()){
} else if (qualityCheck.getType() != null && EnumQualityCheckType.MINI_FAULT.getCode().intValue() == qualityCheck.getType().intValue()) {
//瑕疵,卖家还是买家
if(TabType.BUY==actor){
if (TabType.BUY == actor) {
miniFaultConfirm.setPreText(pre_buyer);
//二手或者瑕疵商品,卖家提供的瑕疵图
miniFaultConfirm.setSecondDetailBySeller(getSecondDetailInfo(qualityCheck.getOrderCode()));
}else if(TabType.SELL ==actor){
} else if (TabType.SELL == actor) {
miniFaultConfirm.setPreText(pre_seller);
}
//瑕疵
if(qualityCheck.getStatus()!=null){
if(EnumQualityCheckStatus.WAIT_CONFIRM.getCode().intValue()==qualityCheck.getStatus().intValue()){
if(TabType.BUY==actor){
if (qualityCheck.getStatus() != null) {
if (EnumQualityCheckStatus.WAIT_CONFIRM.getCode().intValue() == qualityCheck.getStatus().intValue()) {
if (TabType.BUY == actor) {
//倒计时大于零,才有按钮
if(leftTime>0){
showBtn=true;
if (leftTime > 0) {
showBtn = true;
}
//
miniFaultConfirm.setSuppleText("");//后续由app添加倒计时
}else{
} else {
miniFaultConfirm.setSuppleText(last_seller_confirm);
}
}else if(EnumQualityCheckStatus.PASS.getCode().intValue()==qualityCheck.getStatus().intValue()){
} else if (EnumQualityCheckStatus.PASS.getCode().intValue() == qualityCheck.getStatus().intValue()) {
//接收,后续不需要添加文案
if(TabType.BUY==actor){
if (TabType.BUY == actor) {
miniFaultConfirm.setSuppleText("");
}else if(TabType.SELL ==actor){
} else if (TabType.SELL == actor) {
miniFaultConfirm.setSuppleText("");
}
}else if(EnumQualityCheckStatus.REJECT_BY_BUYER.getCode().intValue()==qualityCheck.getStatus().intValue()
||EnumQualityCheckStatus.REJECT_BY_OUTER_TIME.getCode().intValue()==qualityCheck.getStatus().intValue()){
} else if (EnumQualityCheckStatus.REJECT_BY_BUYER.getCode().intValue() == qualityCheck.getStatus().intValue()
|| EnumQualityCheckStatus.REJECT_BY_OUTER_TIME.getCode().intValue() == qualityCheck.getStatus().intValue()) {
//不接受,后续不需要添加文案
if(TabType.BUY==actor){
if (TabType.BUY == actor) {
miniFaultConfirm.setSuppleText("");
}else if(TabType.SELL ==actor){
} else if (TabType.SELL == actor) {
miniFaultConfirm.setSuppleText("");
}
}
... ... @@ -894,25 +901,25 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
miniFaultConfirm.setShowBtn(showBtn);
miniFaultConfirm.setActor(TabType.BUY==actor?TabType.BUY.getValue():TabType.SELL.getValue());
miniFaultConfirm.setActor(TabType.BUY == actor ? TabType.BUY.getValue() : TabType.SELL.getValue());
miniFaultConfirm.setCreateTime(qualityCheck.getCreateTime());
miniFaultConfirm.setLeftTime(leftTime);
miniFaultConfirm.setText(StringUtils.defaultString(miniFaultConfirm.getPreText(),"")
+qualityCheck.getCheckText()
+StringUtils.defaultString(miniFaultConfirm.getSuppleText(),""));
miniFaultConfirm.setText(StringUtils.defaultString(miniFaultConfirm.getPreText(), "")
+ qualityCheck.getCheckText()
+ StringUtils.defaultString(miniFaultConfirm.getSuppleText(), ""));
//图片信息
String imageUrl = qualityCheck.getImageUrl();
List<String> absoluteUrls = new ArrayList<>();
List<String> absoluteUrls = new ArrayList<>();
//获取图片的完整路径
if(StringUtils.isNotEmpty(imageUrl)){
if(StringUtils.endsWith(imageUrl,",")){
imageUrl = imageUrl.substring(0,imageUrl.length()-1);
if (StringUtils.isNotEmpty(imageUrl)) {
if (StringUtils.endsWith(imageUrl, ",")) {
imageUrl = imageUrl.substring(0, imageUrl.length() - 1);
}
List<String> urlList = Arrays.asList(imageUrl.split(","));
for(String s : urlList){
for (String s : urlList) {
String url = buildMiniFaultImgFullUrl(s);
if(StringUtils.isNotBlank(url)){
if (StringUtils.isNotBlank(url)) {
absoluteUrls.add(url);
}
}
... ... @@ -926,35 +933,35 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
}
private MiniFaultForSecondDetail getSecondDetailInfo(Long orderCode){
private MiniFaultForSecondDetail getSecondDetailInfo(Long orderCode) {
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
if(buyerOrder==null||buyerOrderGoods==null){
if (buyerOrder == null || buyerOrderGoods == null) {
LOGGER.warn("getSecondDetailInfo buyerOrderGoods order not exist, orderCode is {}", orderCode);
return null;
}
//根据skup
int skup = buyerOrderGoods.getSkup();
MiniFaultForSecondDetail miniFaultForSecondDetail = null;
if(PrdAttributes.FLAW.getCode()==buyerOrder.getAttributes()||PrdAttributes.SECOND_HAND.getCode()==buyerOrder.getAttributes()){
if (PrdAttributes.FLAW.getCode() == buyerOrder.getAttributes() || PrdAttributes.SECOND_HAND.getCode() == buyerOrder.getAttributes()) {
try {
com.yohoufo.common.ApiResponse resp = ufoServiceCaller.call("ufo.secondhand.secondDetail", com.yohoufo.common.ApiResponse.class, skup);
SecondDetailResp result = (SecondDetailResp) resp.getData();
if(result!=null){
if (result != null) {
miniFaultForSecondDetail = new MiniFaultForSecondDetail();
miniFaultForSecondDetail.setTitle("卖家上传图片");
miniFaultForSecondDetail.setSndTitle("卖家描述");
miniFaultForSecondDetail.setDesc(result.getDesc());
List<String> urls=new ArrayList<>();
result.getImageInfoList().forEach(e->urls.add(e.getImageUrl()));
List<String> urls = new ArrayList<>();
result.getImageInfoList().forEach(e -> urls.add(e.getImageUrl()));
miniFaultForSecondDetail.setImageUrlList(urls);
}
} catch (Exception e) {
LOGGER.warn("getSecondDetailInfo call ufo.secondhand.secondDetail error , orderCode is {} ,skup {}", orderCode,skup ,e);
LOGGER.warn("getSecondDetailInfo call ufo.secondhand.secondDetail error , orderCode is {} ,skup {}", orderCode, skup, e);
}
}
LOGGER.info("getSecondDetailInfo get orderCode is {} ,skup {} buyerOrder attr {} ,miniFaultForSecondDetail {}", orderCode ,skup,buyerOrder.getAttributes(),miniFaultForSecondDetail);
LOGGER.info("getSecondDetailInfo get orderCode is {} ,skup {} buyerOrder attr {} ,miniFaultForSecondDetail {}", orderCode, skup, buyerOrder.getAttributes(), miniFaultForSecondDetail);
return miniFaultForSecondDetail;
}
... ... @@ -969,19 +976,19 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
}
private BuyerOrder findOrderCodeBySkup(int skup){
private BuyerOrder findOrderCodeBySkup(int skup) {
List<Integer> skups = new ArrayList<>(1);
skups.add(skup);
List<BuyerOrderGoods> buyerOrderGoodsList = buyerOrderGoodsMapper.selectBySkups(skups);
List<BuyerOrder> buyerOrderList = null;
if (CollectionUtils.isNotEmpty(buyerOrderGoodsList)){
if (CollectionUtils.isNotEmpty(buyerOrderGoodsList)) {
List<Long> orderCodeList = buyerOrderGoodsList.parallelStream()
.map(BuyerOrderGoods::getOrderCode).collect(Collectors.toList());
buyerOrderList = buyerOrderMapper.selectByOrderCodes(orderCodeList, Arrays.asList(OrderStatus.HAS_PAYED.getCode()));
}
int pboSize = 0;
boolean noPaidOrder;
if (noPaidOrder = (buyerOrderList == null) || (pboSize =buyerOrderList.size()) > 1){
if (noPaidOrder = (buyerOrderList == null) || (pboSize = buyerOrderList.size()) > 1) {
LOGGER.warn("findOrderCodeBySkup skup {} noPaidOrder {} pboSize {}", skup, noPaidOrder, pboSize);
throw new UfoServiceException(400, "订单状态已变更,请刷新后操作");
}
... ... @@ -989,13 +996,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
return buyerOrderList.get(0);
}
private AddressInfo findBuyerAddressInfo(Integer uid, Long orderCode, Integer skup){
private AddressInfo findBuyerAddressInfo(Integer uid, Long orderCode, Integer skup) {
boolean skupIsNull = (null == skup);
boolean orderCodeIsNull = (null == orderCode);
BuyerOrder buyerOrder = null;
if (orderCodeIsNull){
if (orderCodeIsNull) {
//4 compatible before version 6.9.3(exclude), client transfer without order code
buyerOrder = findOrderCodeBySkup(skup);
orderCode = buyerOrder.getOrderCode();
... ... @@ -1007,7 +1014,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
return buyerAddress;
}
private AddressInfo findSellerAddressInfo(Integer uid, Integer skup){
private AddressInfo findSellerAddressInfo(Integer uid, Integer skup) {
SellerOrderMeta addressMeta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS);
AddressInfo addressInfo = null;
if (null != addressMeta) {
... ... @@ -1015,7 +1022,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
try {
addressInfo = JSONObject.parseObject(addressMeta.getMetaValue(), AddressInfo.class);
}catch (Exception ex){
} catch (Exception ex) {
LOGGER.warn("findSellerAddressInfo parse addressMeta fail, uid {} skup {}, addressMeta {}",
uid, skup, addressMeta, ex);
}
... ... @@ -1026,11 +1033,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Autowired
private SellerService sellerService;
private boolean isHKLargeSettlementSuper(int uid){
private boolean isHKLargeSettlementSuper(int uid) {
SellerWrapper sellerWrapper = sellerService.getFullDimensionSeller(uid);
SellerBo sellerBo;
if (sellerWrapper!= null && Objects.nonNull(sellerBo=sellerWrapper.buildSellerBo())){
if (sellerBo.isLargeSettlementSuper()){
if (sellerWrapper != null && Objects.nonNull(sellerBo = sellerWrapper.buildSellerBo())) {
if (sellerBo.isLargeSettlementSuper()) {
return true;
}
}
... ... @@ -1048,23 +1055,23 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Override
public AppraiseAddressResp queryAppraiseAddress(Integer uid, Long orderCode, Integer skup) {
if (isHKLargeSettlementSuper(uid)){
if (isHKLargeSettlementSuper(uid)) {
return appraiseAddressService.queryHKAppraiseAddress();
}
boolean skupIsNull = (null == skup);
boolean orderCodeIsNull = (null == orderCode);
if (skupIsNull && orderCodeIsNull) {
LOGGER.warn("queryAppraiseAddress can not save back, all key info are null, uid {}", uid);
return appraiseAddressService.queryInitAddress();
}
if (skupIsNull && orderCodeIsNull) {
LOGGER.warn("queryAppraiseAddress can not save back, all key info are null, uid {}", uid);
return appraiseAddressService.queryInitAddress();
}
//寄存订单
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
//防止较早版本出错
if (Objects.nonNull(buyerOrder)){
if (OrderAttributes.DEPOSITE.getCode() == buyerOrder.getAttributes()){
if (Objects.nonNull(buyerOrder)) {
if (OrderAttributes.DEPOSITE.getCode() == buyerOrder.getAttributes()) {
return appraiseAddressService.findByDepotType(DepotType.NJ.getCode());
}
}
... ... @@ -1075,16 +1082,17 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
// 根据用户id查询默认地址的省份
AppraiseAddressResp resp = null;
if (null != buyerAddress ) {
if (null != buyerAddress) {
// 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
resp = appraiseAddressService.queryAddressByAreaCode(buyerAddress.getAreaCode());
}
// 匹配不了,给个娄底的
return resp==null ? appraiseAddressService.queryInitAddress() : resp;
return resp == null ? appraiseAddressService.queryInitAddress() : resp;
}
/**
* 鉴定中心地址变更弹框通知
*
* @param uid
* @param orderCode
* @return
... ... @@ -1098,19 +1106,19 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
AppraiseAddressResp resp = null;
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (Objects.isNull(buyerOrder)){
if (Objects.isNull(buyerOrder)) {
LOGGER.warn("in forceNoticeAppraiseAddress buyerOrder not exist,uid {}, orderCode {}", uid, orderCode);
return resp;
}
if(BuyerOrderUtils.isDeposit(buyerOrder)){
if (BuyerOrderUtils.isDeposit(buyerOrder)) {
resp = getAppraiseAddressResp4Deposit(uid, orderCode);
}
return resp;
}
private AppraiseAddressResp getAppraiseAddressResp4Deposit(Integer uid, Long orderCode){
private AppraiseAddressResp getAppraiseAddressResp4Deposit(Integer uid, Long orderCode) {
LOGGER.info("in getAppraiseAddressResp4Deposit uid {}, orderCode {}", uid, orderCode);
AppraiseAddressResp resp = appraiseAddressService.findByDepotType(DepotType.NJ.getCode());
AppraiseAddressResp resp = appraiseAddressService.findByDepotType(DepotType.NJ.getCode());
final String tips = SellerConfig.DELIVER2DEPOTTIPS4DEPOSITGOODS;
resp.setTitle(SellerConfig.FORCENOTICE_ADDRESS_TITLE);
resp.setForceShow(true);
... ... @@ -1118,9 +1126,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
return resp;
}
private AppraiseAddressResp getAppraiseAddressResp4AddrressChange(int uid, long orderCode){
private AppraiseAddressResp getAppraiseAddressResp4AddrressChange(int uid, long orderCode) {
BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
if (Objects.isNull(pbog)){
if (Objects.isNull(pbog)) {
LOGGER.warn("in noticeAppraiseAddressChanged BuyerOrderGoods not exist, uid {}, order code {}", uid, orderCode);
return null;
}
... ... @@ -1131,15 +1139,15 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
// 根据用户id查询默认地址的省份
AppraiseAddressResp resp = null;
if (null != buyerAddress ) {
if (null != buyerAddress) {
// 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
resp = appraiseAddressService.queryAddressByAreaCode(buyerAddress.getAreaCode());
}
// 匹配不了,给个娄底的
resp = resp==null ? appraiseAddressService.queryInitAddress() : resp;
if (resp.getType() == 1){
resp = resp == null ? appraiseAddressService.queryInitAddress() : resp;
if (resp.getType() == 1) {
resp.setChanged(true);
}else{
} else {
resp = null;
}
return resp;
... ... @@ -1148,7 +1156,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Override
public AppraiseAddressResp queryByUserAddress(int uid, String addressIdStr) {
int addressId = AddressUtil.getDecryptStr(addressIdStr);
if (addressId < 0){
if (addressId < 0) {
LOGGER.warn("queryByUserAddess addressId invalidate, uid {}, addressId is {}",
uid, addressIdStr);
throw new ServiceException(ServiceError.ORDER_ADDRESSID_INVALIDATE);
... ... @@ -1158,7 +1166,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId);
// 根据用户id查询默认地址的省份
AppraiseAddressResp resp = null;
if (null != hiddenBackAddress ) {
if (null != hiddenBackAddress) {
// 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
AppraiseAddress address = appraiseAddressService.queryAppraiseAddressByAreaCode(hiddenBackAddress.getAreaCode());
... ... @@ -1166,7 +1174,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
resp.setShipFee(address.getShipFee());
LOGGER.info("In queryByUserAddess hiddenBackAddress success, uid {} addressIdStr {}, AppraiseAddressResp",
uid, addressIdStr, resp);
}else {
} else {
LOGGER.warn("In queryByUserAddess hiddenBackAddress is null, uid {} addressIdStr {}", uid, addressIdStr);
}
... ... @@ -1175,6 +1183,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
/**
* 根据订单号查询物流信息
*
* @param orderCode
* @param expressType
* @return
... ...
... ... @@ -7,11 +7,14 @@ import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohoufo.common.constant.ExpressInfoConstant;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.order.utils.BuyerOrderUtils;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.util.Objects;
import java.util.function.Supplier;
@Setter
@Accessors(fluent = true)
... ... @@ -52,14 +55,26 @@ public class ExpressStageBuilder {
*/
private static final int QUICK_SHIP_DONE = 7;
/**
* 8 平台鉴定 == 交易成功 ,平台鉴定点亮
*/
private static final int DEPOSIT_BEFORE_DONE = 8;
/**
* 9 平台鉴定 == 交易成功 ,全部点亮
*/
private static final int DEPOSIT_DONE = 9;
final TabType actor;
final int status;
final BuyerOrder buyerOrder;
ExpressInfoRespBo expressInfoRespBo;
Integer scene;
Supplier<Boolean> isQuickShipDone;
public ExpressStageBuilder(TabType actor, int status) {
public ExpressStageBuilder(TabType actor, BuyerOrder buyerOrder) {
this.actor = actor;
this.status = status;
this.buyerOrder = buyerOrder;
}
/**
... ... @@ -71,27 +86,42 @@ public class ExpressStageBuilder {
* @see #CANCEL_BEFORE_DEPOT_RECEIVE
* @see #QUICK_SHIP_DEPOT_SENT
* @see #QUICK_SHIP_DONE
* @see #DEPOSIT_BEFORE_DONE
* @see #DEPOSIT_DONE
*
*/
public int build() {
boolean isBuyer = TabType.BUY == actor;
// 快速发货
if (ExpressScene.QUICK_SHIP.equals(scene)) {
if (TabType.BUY == actor) {
if (isBuyer) {
expressInfoRespBo.setSupplementExpressInfoDetailTitle(StringUtils.EMPTY);
expressInfoRespBo.setSupplementExpressInfoDetailList(Lists.newArrayList());
expressInfoRespBo.setJudgeExpressInfoDetailTitle(StringUtils.EMPTY);
expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList());
boolean isDone = expressInfoRespBo.getExpressInfoDetailList()
.stream()
.filter(e -> Objects.equals(e.getExpressType(), EnumExpressType.EXPRESS_TYPE_2.getCode()))
.filter(e -> Objects.equals(e.getState(), ExpressInfoConstant.EXPRESS_STATUS_SIGN))
.findFirst()
.isPresent();
return isDone ? QUICK_SHIP_DONE : QUICK_SHIP_DEPOT_SENT;
return isQuickShipDone.get() ? QUICK_SHIP_DONE : QUICK_SHIP_DEPOT_SENT;
} else {
return DONE;
}
}
int status = buyerOrder.getStatus();
if (BuyerOrderUtils.isDeposit(buyerOrder)) {
if (isBuyer) {
return OrderStatus.DONE.getCode() == status ? DEPOSIT_DONE : DEPOSIT_BEFORE_DONE;
} else {
return OrderStatus.HAS_PAYED.getCode() == status
|| OrderStatus.JUDGE_PASS.getCode() == status
|| OrderStatus.JUDGE_PASS_WAIT_WAREHOUSE.getCode() == status
|| OrderStatus.WAITING_RECEIVE.getCode() == status
|| OrderStatus.DONE.getCode() == status
? DEPOSIT_DONE : DEPOSIT_BEFORE_DONE;
}
}
if (OrderStatus.PLATFORM_RECEIVE.getCode() == status
|| OrderStatus.PLATFORM_CHECKING.getCode() == status
|| OrderStatus.MINI_FAULT_WAITING.getCode() == status) {
... ...