Authored by mali

Merge branch 'dev'

... ... @@ -94,7 +94,7 @@ public class ControllerCacheAop implements ApplicationContextAware{
try {
Object level1_obj = this.cacheClient.get(level1_cache_key, returnType);
if (level1_obj != null) {
logger.debug("Cache1 hit for method:{} at key:{}.", methodName, level1_cache_key);
logger.info("Cache1 hit for method:{} at key:{}.", methodName, level1_cache_key);
return level1_obj;
}
} catch (Exception e) {
... ...
package com.yohoufo.order.convert;
import com.yoho.service.model.response.UserAddressRspBO;
import com.yohoufo.order.model.AddressInfo;
import java.util.Objects;
/**
* Created by chenchao on 2018/9/21.
*/
public class AddressInfoConvertor {
public static AddressInfo userAddressRsp2AddressInfo(UserAddressRspBO resp){
if (Objects.isNull(resp)){
return null;
}
AddressInfo addressInfo = new AddressInfo();
addressInfo.setAddress_id(Integer.valueOf(resp.getId()));
addressInfo.setAddress(resp.getAddress());
addressInfo.setConsignee(resp.getAddresseeName());
addressInfo.setPhone(resp.getPhone());
addressInfo.setZipCode(resp.getZipCode());
return addressInfo;
}
}
... ...
package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.response.UserAddressRspBO;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
... ... @@ -12,11 +14,13 @@ import com.yohoufo.order.common.Payment;
import com.yohoufo.order.common.TabType;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.constants.OrderConstant;
import com.yohoufo.order.convert.AddressInfoConvertor;
import com.yohoufo.order.model.AddressInfo;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.GoodsInfo;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.service.IOrderDetailService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -51,11 +55,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
}
TabType actor = orderRequest.getActor();
if (actor == null){
logger.warn("getOrderDetail tabType invalidate, uid is {}, orderCode is {}",
orderRequest.getUid(), orderRequest.getOrderCode());
throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
}
boolean isBuyer = actor.equals(TabType.BUY);
// 查询订单状态
BuyerOrder buyerOrder = getBuyerOrder(orderRequest.getUid(), orderRequest.getOrderCode());
... ... @@ -74,9 +74,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
}
// 收货地址 and 用户信息 TODO
BuyerOrderMeta buyerOrderMeta = getBuyerOrderMeta(buyerUid,
orderRequest.getOrderCode(), MetaKey.BUYER_DELIVERY_ADDRESS);
BuyerOrderGoods buyerOrderGoods = getBuyerOrderGoods(buyerUid, orderRequest.getOrderCode());
if (buyerOrderGoods == null){
... ... @@ -91,8 +89,16 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
orderRequest.getUid(), orderRequest.getOrderCode(), buyerOrderGoods.getSkup());
throw new ServiceException(ServiceError.ORDER_ORDERS_GOODS_IS_EMPTY);
}
OrderDetailInfo orderDetailInfo = buildOrderDetail(buyerOrder, orderStatus, buyerOrderGoods, sellerOrderGoods, actor);
// 收货地址 and 用户信息
BuyerOrderMeta buyerOrderMeta = getBuyerOrderMeta(buyerUid,
orderRequest.getOrderCode(), MetaKey.BUYER_DELIVERY_ADDRESS);
AddressInfo userAddress = null;
if (isBuyer && null != buyerOrderMeta && StringUtils.isNotBlank(buyerOrderMeta.getMetaValue())){
UserAddressRspBO addressRsp = JSONObject.parseObject(buyerOrderMeta.getMetaValue(), UserAddressRspBO.class);
userAddress = AddressInfoConvertor.userAddressRsp2AddressInfo(addressRsp);
}
OrderDetailInfo orderDetailInfo = buildOrderDetail(buyerOrder, orderStatus, buyerOrderGoods, sellerOrderGoods,
userAddress, actor);
return orderDetailInfo;
... ... @@ -100,7 +106,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
OrderDetailInfo buildOrderDetail(BuyerOrder buyerOrder, OrderStatus orderStatus,
BuyerOrderGoods buyerOrderGoods, SellerOrderGoods sellerOrderGoods,
TabType tabType) {
AddressInfo userAddress, TabType tabType) {
OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
orderDetailInfo.setUid(buyerOrder.getUid());
orderDetailInfo.setOrderCode(buyerOrder.getOrderCode());
... ... @@ -108,9 +114,12 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
orderDetailInfo.setButtons(orderStatus.getDetailButtons(tabType));
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType);
orderDetailInfo.setStatusDetail(statusDetail);
//good info
GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
orderDetailInfo.setGoodsInfo(goodsInfo);
//user address
orderDetailInfo.setUserAddress(userAddress);
//priceInfo
OrderDetailInfo.PriceInfo priceInfo = OrderDetailInfo.PriceInfo.builder()
.goodPrice(buyerOrderGoods.getGoodsPrice() == null ? "0" : buyerOrderGoods.getGoodsPrice().toPlainString() )
.feePrice(buyerOrder.getShipFee() == null ? "0" : buyerOrder.getShipFee().toPlainString())
... ...
... ... @@ -9,6 +9,7 @@ import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.order.common.OrderCodeType;
import com.yohoufo.order.convert.AddressInfoConvertor;
import com.yohoufo.order.convert.SellerOrderConvertor;
import com.yohoufo.order.model.AddressInfo;
import com.yohoufo.order.model.GoodsInfo;
... ... @@ -207,15 +208,9 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
}
//the address of send back 2 seller
AddressInfo backAddress = new AddressInfo();
backAddress.setAddress_id(req.getAddressId());
//
UserAddressRspBO addressRspBO = userProxyService.getAddressInfo(uid, req.getAddressId());
backAddress.setAddress(addressRspBO.getAddress());
backAddress.setConsignee(addressRspBO.getAddresseeName());
backAddress.setPhone(addressRspBO.getPhone());
backAddress.setZipCode(addressRspBO.getZipCode());
AddressInfo backAddress = AddressInfoConvertor.userAddressRsp2AddressInfo(addressRspBO);
//
SellerOrderContext context = new SellerOrderContext();
... ...
... ... @@ -248,11 +248,16 @@ public class ProductServiceImpl implements ProductService{
StoragePrice sp = storagePriceMapper.selectBySkup(skup);
storageId = sp.getStorageId();
if (sp == null || (storageId = sp.getStorageId()) == null) {
LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId,
num);
LOGGER.error("修改库存:StoragePrice表无数据或者StorageId为空, skup={}, storageId={}, num={}, find storageId is null",
skup, storageId, num);
return;
}
}
try {
storageMapper.addStorageNum(storageId, num);
} catch (Exception e) {
LOGGER.error("修改库存出错: skup=" + skup + ", storageId=" + storageId + ", num=" + num + ", find storageId is null", e);
}
}
private StoragePrice checkSkupCanSale(Integer skup) {
... ...