Authored by mali

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

... ... @@ -23,19 +23,4 @@ public class ExpressInfoConstant {
*/
public static final Integer EXPRESS_STATUS_UNSEND = 2;
/**
* 清关成功
*/
public static final Integer EXPRESS_CLEAR_SUCCESS = 100;
/**
* 清关失败(平台原因)
*/
public static final Integer EXPRESS_CLEAR_FAIL_CAUSE_PLATFORM = 101;
/**
* 清关失败(买家原因)
*/
public static final Integer EXPRESS_CLEAR_FAIL_CAUSE_BUYER= 102;
}
... ...
... ... @@ -8,5 +8,6 @@ public class StorageDepositCount {
private Integer productId;
private Integer storageIdCount;
private Integer storageCount;
private Integer skup;
private Integer unShelfStorageCount;
}
\ No newline at end of file
... ...
... ... @@ -25,6 +25,7 @@
<resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" >
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" />
<result column="skup" property="skup" jdbcType="BIGINT" />
<result column="storage_count" property="storageCount" jdbcType="INTEGER" />
<result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" />
</resultMap>
... ... @@ -263,7 +264,7 @@
</select>
<select id="queryUserDepositProduct" resultMap="CountResultMap">
select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count from storage_deposit
select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit
where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
and product_id in
<foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
... ...
package com.yohoufo.order.common;
import java.util.Objects;
public class LogisticsTypes {
/**
* 判断是否是中通国际快递公司
*
* @param logisticsType
* @return
*/
public static boolean isZtoInternational(Integer logisticsType) {
return Objects.isNull(logisticsType) ? false : logisticsType.intValue() == 76;
}
}
... ...
... ... @@ -14,6 +14,7 @@ import com.yohoufo.dal.order.ExpressRecordMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.ExpressInfo;
import com.yohoufo.dal.order.model.ExpressRecord;
import com.yohoufo.order.common.LogisticsTypes;
import com.yohoufo.order.model.bo.ErpExpressBo;
import com.yohoufo.order.mq.publisher.ConsumerExceptionPublisher;
import com.yohoufo.order.service.IBuyerOrderService;
... ... @@ -156,30 +157,9 @@ private static final Logger LOGGER = LoggerUtils.getMqConsumerLogger();
expressInfo.setExpressType(initExpressType);
expressInfo.setState(state);
//清关失败和清关成功的物流信息,需要在OperateTransferCode记录下相应的code ,以便自动确认查询
if(ExpressInfoConstant.EXPRESS_CLEAR_SUCCESS.equals(state)){
//清关成功的纪录
// 中通国际快递公司,存在物流则表示清关成功
if (LogisticsTypes.isZtoInternational(logisticsType)) {
expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_success.getCode());
}else if(ExpressInfoConstant.EXPRESS_CLEAR_FAIL_CAUSE_PLATFORM.equals(state)){
//TODO 平台原因清关失败的信息记录下来,需要告诉order,退费
expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_fail_cause_platform.getCode());
/*暂时注释掉,等香港仓上线,中通物流返回信息未定
final CutomsClearanceFailType failType=CutomsClearanceFailType.PLATFORM;
LOGGER.info("call order clear fail interface,orderCode {},uid {},waybillCode {},state {} ,failType {}", orderCode,uid,waybillCode,state,failType);
executorService.execute(() -> {
buyerOrderCancelService.cancelOverseasOrder(orderCode, failType);
LOGGER.info("call order clear fail interface end,orderCode {},uid {},waybillCode {},state {},failType {} ", orderCode,uid,waybillCode,state,failType);
});*/
}else if(ExpressInfoConstant.EXPRESS_CLEAR_FAIL_CAUSE_BUYER.equals(state)){
//TODO 买家原因清关失败的信息记录下来,需要告诉order,退费
expressInfo.setOperateTransferCode(EnumExpressDataOperateTransferCode.express_clear_fail_cause_buyer.getCode());
/*暂时注释掉,等香港仓上线,中通物流返回信息未定
final CutomsClearanceFailType failType=CutomsClearanceFailType.BUYER;
LOGGER.info("call order clear fail interface,orderCode {},uid {},waybillCode {},state {} ,failType {}", orderCode,uid,waybillCode,state,failType);
executorService.execute(() -> {
buyerOrderCancelService.cancelOverseasOrder(orderCode, failType);
LOGGER.info("call order clear fail interface end,orderCode {},uid {},waybillCode {},state {},failType {} ", orderCode,uid,waybillCode,state,failType);
});*/
}
expressInfoMapper.insert(expressInfo);
... ...
... ... @@ -44,6 +44,7 @@ import com.yohoufo.order.service.proxy.OrderOperateRecordService;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.PaymentHelper;
import com.yohoufo.order.utils.PubThreadFactory;
import lombok.Data;
... ... @@ -195,18 +196,43 @@ public class AppraiseService {
* 正常发货
* 鉴定通过 -- 待收货
* 瑕疵接收 -- 待收货
* 寄存完成 -- 待收货
*/
public void deliveryGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo) {
LOGGER.info("deliveryGoodsToBuyer enter req {}", appraiseExpressInfoBo);
final OrderStatus expectOrderStatus;
final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;
Long orderCode = appraiseExpressInfoBo.getOrderCode();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null) {
LOGGER.warn("deliveryGoodsToBuyer getOrderInfo order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
// 寄存订单
if(BuyerOrderUtils.isDeposit(buyerOrder.getAttributes())){
deliveryDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
} else {
deliveryNonDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
}
}
private void deliveryDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
if(buyerOrder.getStatus() == OrderStatus.DONE.getCode()){
expressInfoService.deliverGoods(buyerOrder.getUid(),
appraiseExpressInfoBo.getExpressCompanyId(),
buyerOrder.getOrderCode(),
appraiseExpressInfoBo.getWayBillCode(),
appraiseExpressInfoBo.getDepotNum(),
appraiseExpressInfoBo.getMobile());
}else {
LOGGER.warn("in deliveryGoodsToBuyer, buyer Deposit Order orderCode {}", buyerOrder.getOrderCode());
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
}
}
private void deliveryNonDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
final Long orderCode = buyerOrder.getOrderCode();
final OrderStatus expectOrderStatus;
final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;
if (buyerOrder.getStatus() == OrderStatus.JUDGE_PASS.getCode()) {
expectOrderStatus = OrderStatus.JUDGE_PASS;
} else if (buyerOrder.getStatus() == OrderStatus.MINI_FAULT_ACCEPT.getCode()) {
... ...
... ... @@ -49,32 +49,20 @@ public class DepositServiceImpl implements DepositService {
}
List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit);
List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList);
/*// 商品名称
List<Product> productList = productMapper.selectByIds(productIdList);
// 颜色
List<Goods> goodsList = goodsMapper.selectByProductIds(productIdList);
// 图片
List<GoodsImages> goodsImagesList = goodsImagesMapper.selectByGoodsIdList(goodsList.stream().map(Goods::getId).collect(Collectors.toList()));
List<Integer> skupList = countInfoList.stream().map(StorageDepositCount::getSkup).collect(Collectors.toList());
List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity()));
Map<Integer, Product> productMap = productList.stream().map(Function.identity()).collect(Collectors.toMap(Product::getId, Function.identity()));
Map<Integer, Goods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(Goods::getProductId, Function.identity()));
Map<Integer, GoodsImages> goodsImagesMap = goodsImagesList.stream().map(Function.identity()).collect(Collectors.toMap(GoodsImages::getProductId, Function.identity()));
Map<Integer, SellerOrderGoods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(SellerOrderGoods::getProductId, Function.identity()));
List<DepositProductBo> result = new ArrayList<>();
for (Integer productId : productIdList) {
DepositProductBo bo = new DepositProductBo();
bo.setProductId(productId);
Product p = productMap.get(productId);
if (p != null) {
bo.setProductName(p.getProductName());
}
Goods g = goodsMap.get(productId);
if (g != null) {
bo.setColorName(StringUtils.isBlank(g.getGoodsName()) ? g.getColorName() : g.getGoodsName());
}
GoodsImages gi = goodsImagesMap.get(productId);
if (gi != null) {
bo.setPic(ImageUrlAssist.getAllProductPicUrl(gi.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
SellerOrderGoods goods = goodsMap.get(productId);
if (goods != null) {
bo.setProductName(goods.getProductName());
bo.setColorName(goods.getColorName());
bo.setPic(goods.getImageUrl());
}
StorageDepositCount countInfo = countInfoMap.get(productId);
if (countInfo != null) {
... ... @@ -83,7 +71,7 @@ public class DepositServiceImpl implements DepositService {
bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架"));
}
result.add(bo);
}*/
}
return null;
}
... ...
... ... @@ -143,8 +143,8 @@ public class OrdersPayService {
cmsPayVO.setStartVersion(e.getStartVersion());
cmsPayVO.setEndVersion(e.getEndVersion());
cmsPayVO.setIsRecommend(e.getIsRecommend());
cmsPayVO.setRecommendText1(cmsPayVO.getRecommendText1());
cmsPayVO.setRecommendText1Logo(cmsPayVO.getRecommendText1Logo());
cmsPayVO.setRecommendText1(e.getRecommendText1());
cmsPayVO.setRecommendText1Logo(e.getRecommendText1Logo());
return cmsPayVO;
}
... ...
... ... @@ -42,4 +42,11 @@ public class BuyerOrderUtils {
return isOffline(orderInfo.getAttributes());
}
/**
* 是否寄存订单
*/
public static boolean isDeposit(Integer attributes) {
return OrderAttributes.getOrderAttributes(attributes) == OrderAttributes.DEPOSITE;
}
}
... ...