Authored by chenchao

throw out exception if occur

package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Throwables;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.CustomsClearanceResult;
... ... @@ -205,35 +204,30 @@ public class BuyerOrderMetaServiceImpl implements IBuyerOrderMetaService {
logger.warn("BuyerOrderMeta4PlatformController updateDeliveryAddress not allow status {} param req is {}",buyerOrder.getStatus(), req);
throw new UfoServiceException(400, "订单状态不允许变更地址");
}
try {
AddressInfo changedAddress = JSONObject.parseObject(addressOfJson, AddressInfo.class);
OrderAddressReq orderAddressReq = OrderAddressReq.builder()
.address(changedAddress.getAddress())
.consignee(changedAddress.getConsignee())
.mobile(changedAddress.getMobile())
.fromPlatform(req.isFromPlatform())
.build();
commomAddressService.checkAddressContent(orderAddressReq);
AddressInfo dbAddressInfo = getAddressInfo(buyerUid,orderCode);
if(dbAddressInfo==null){
logger.warn("dbAddressInfo is null ,uid {} ,orderCode {}",buyerUid,orderCode);
throw new UfoServiceException(400,"找不到地址信息");
}
AddressInfo hiddenAddressInDB = getHiddenAddressInfo(buyerUid,orderCode);
if(hiddenAddressInDB==null){
logger.warn("hiddenAddressInDB is null ,uid {} ,orderCode {}",buyerUid,orderCode);
throw new UfoServiceException(400,"找不到地址信息");
}
return updateDeliveryAddress(buyerUid,orderCode,changedAddress,dbAddressInfo, hiddenAddressInDB, req.isFromPlatform());
}catch (Exception ex){
logger.warn("updateDeliveryAddressByErp occur exception req {} error {}", req, Throwables.getStackTraceAsString(ex));
AddressInfo changedAddress = JSONObject.parseObject(addressOfJson, AddressInfo.class);
OrderAddressReq orderAddressReq = OrderAddressReq.builder()
.address(changedAddress.getAddress())
.consignee(changedAddress.getConsignee())
.mobile(changedAddress.getMobile())
.fromPlatform(req.isFromPlatform())
.build();
commomAddressService.checkAddressContent(orderAddressReq);
AddressInfo dbAddressInfo = getAddressInfo(buyerUid,orderCode);
if(dbAddressInfo==null){
logger.warn("dbAddressInfo is null ,uid {} ,orderCode {}",buyerUid,orderCode);
throw new UfoServiceException(400,"找不到地址信息");
}
AddressInfo hiddenAddressInDB = getHiddenAddressInfo(buyerUid,orderCode);
if(hiddenAddressInDB==null){
logger.warn("hiddenAddressInDB is null ,uid {} ,orderCode {}",buyerUid,orderCode);
throw new UfoServiceException(400,"找不到地址信息");
}
return null;
return updateDeliveryAddress(buyerUid,orderCode,changedAddress,dbAddressInfo, hiddenAddressInDB, req.isFromPlatform());
}
BuyerOrderMeta getBuyerOrderMeta(int uid, long orderCode, String metaKey) {
... ...