|
|
package com.yoho.ufo.order.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Lists;
|
|
|
import org.elasticsearch.common.collect.Maps;
|
|
|
import org.elasticsearch.common.netty.util.internal.StringUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.base.Splitter;
|
...
|
...
|
@@ -9,8 +39,45 @@ import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations; |
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.order.dal.*;
|
|
|
import com.yoho.order.model.*;
|
|
|
import com.yoho.order.dal.AppraiseAddressMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderMetaMapper;
|
|
|
import com.yoho.order.dal.ExpressCompanyMapper;
|
|
|
import com.yoho.order.dal.ExpressInfoMapper;
|
|
|
import com.yoho.order.dal.ExpressRecordMapper;
|
|
|
import com.yoho.order.dal.OrderConfigMapper;
|
|
|
import com.yoho.order.dal.OrderOperateRecordMapper;
|
|
|
import com.yoho.order.dal.OrdersPayMapper;
|
|
|
import com.yoho.order.dal.PhoneUidDepotMapper;
|
|
|
import com.yoho.order.dal.QiniuLiveRecordMapper;
|
|
|
import com.yoho.order.dal.QualityCheckMapper;
|
|
|
import com.yoho.order.dal.SellerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.SellerOrderMapper;
|
|
|
import com.yoho.order.dal.SellerOrderMetaMapper;
|
|
|
import com.yoho.order.dal.SignForPackageMapper;
|
|
|
import com.yoho.order.dal.StoredSellerMapper;
|
|
|
import com.yoho.order.model.AppraiseAddress;
|
|
|
import com.yoho.order.model.BuyerOrder;
|
|
|
import com.yoho.order.model.BuyerOrderFeedback;
|
|
|
import com.yoho.order.model.BuyerOrderGoods;
|
|
|
import com.yoho.order.model.BuyerOrderMeta;
|
|
|
import com.yoho.order.model.BuyerOrderReq;
|
|
|
import com.yoho.order.model.ExpressCompany;
|
|
|
import com.yoho.order.model.ExpressInfo;
|
|
|
import com.yoho.order.model.ExpressRecord;
|
|
|
import com.yoho.order.model.OrderConfig;
|
|
|
import com.yoho.order.model.OrderOperateRecord;
|
|
|
import com.yoho.order.model.OrdersPay;
|
|
|
import com.yoho.order.model.PhoneUidDepot;
|
|
|
import com.yoho.order.model.QiniuLiveRecord;
|
|
|
import com.yoho.order.model.QualityCheck;
|
|
|
import com.yoho.order.model.QualityCheckResp;
|
|
|
import com.yoho.order.model.SellerOrder;
|
|
|
import com.yoho.order.model.SellerOrderGoods;
|
|
|
import com.yoho.order.model.SellerOrderMeta;
|
|
|
import com.yoho.order.model.SignForPackage;
|
|
|
import com.yoho.order.model.StoredSeller;
|
|
|
import com.yoho.service.model.order.request.OrderRequest;
|
|
|
import com.yoho.ufo.constants.PlatformConstant;
|
|
|
import com.yoho.ufo.constants.RedisKeyConstants;
|
...
|
...
|
@@ -26,34 +93,26 @@ import com.yoho.ufo.order.service.IBuyerOrderService; |
|
|
import com.yoho.ufo.service.impl.UfoServiceCaller;
|
|
|
import com.yoho.ufo.service.impl.UserHelper;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yoho.ufo.util.*;
|
|
|
import com.yohobuy.ufo.model.enums.ProductSkupStatusEnum;
|
|
|
import com.yoho.ufo.util.DateUtil;
|
|
|
import com.yoho.ufo.util.ImagesConstant;
|
|
|
import com.yoho.ufo.util.ImagesHelper;
|
|
|
import com.yoho.ufo.util.MobileHelper;
|
|
|
import com.yoho.ufo.util.OrderVideoUrlUtil;
|
|
|
import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
|
|
|
import com.yohobuy.ufo.model.order.common.*;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumExpressType;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumQualityCheckType;
|
|
|
import com.yohobuy.ufo.model.order.common.OperateTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
|
|
|
import com.yohobuy.ufo.model.order.resp.*;
|
|
|
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.ExpressInfoResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderDetailResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.QcOrderDetailResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.SkupImageInfo;
|
|
|
import com.yohobuy.ufo.model.resp.product.SecondDetailResp;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Lists;
|
|
|
import org.elasticsearch.common.collect.Maps;
|
|
|
import org.elasticsearch.common.netty.util.internal.StringUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author caoyan
|
...
|
...
|
@@ -135,6 +194,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
@Autowired
|
|
|
private UfoServiceCaller ufoServiceCaller;
|
|
|
|
|
|
@Autowired
|
|
|
private PhoneUidDepotMapper phoneUidDepotMapper;
|
|
|
|
|
|
private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
|
|
|
|
...
|
...
|
@@ -1747,7 +1809,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
String url = erpDomain + PlatformConstant.ERP_GET_SF_WAYBILLCODE;
|
|
|
|
|
|
JSONObject jsonReqObj = getStringHttpEntity(buyerOrder, sellerGoods, appraiseAddress.getAddress(), skup, req.getPayMethod());
|
|
|
JSONObject jsonReqObj = getStringHttpEntity(buyerOrder, sellerGoods, appraiseAddress.getAddress(), skup, req);
|
|
|
HttpEntity<String> formEntity = new HttpEntity<>(jsonReqObj.toString(), getHttpHeaders());
|
|
|
|
|
|
LOGGER.info("getSfWaybillCode formEntity is {}, url is {}", formEntity.toString(), url);
|
...
|
...
|
@@ -1846,7 +1908,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return RedisKeyBuilder.newInstance().appendFixed(RedisKeyConstants.SF_WAYBILL_CODE).appendVar(orderCode);
|
|
|
}
|
|
|
|
|
|
private JSONObject getStringHttpEntity(BuyerOrder buyerOrder, SellerOrderGoods sellerGoods, String appraiseAddress, Integer skup, Integer payMethod) {
|
|
|
private JSONObject getStringHttpEntity(BuyerOrder buyerOrder, SellerOrderGoods sellerGoods, String appraiseAddress, Integer skup, BuyerOrderReq req) {
|
|
|
JSONObject jsonObj = new JSONObject();
|
|
|
jsonObj.put("orderCode", buyerOrder.getOrderCode());
|
|
|
jsonObj.put("uid", buyerOrder.getUid());
|
...
|
...
|
@@ -1864,9 +1926,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
jsonObj.put("jDistrict", addressMap.get("district"));
|
|
|
jsonObj.put("jAddress", addressMap.get("address"));
|
|
|
jsonObj.put("expressType", 2);//快件产品类型 1:标准快递 2:顺丰特惠(便宜,全程陆运)
|
|
|
jsonObj.put("payMethod", payMethod);//1:寄方付 2:收方付 3:第三方付
|
|
|
jsonObj.put("payMethod", req.getPayMethod());//1:寄方付 2:收方付 3:第三方付
|
|
|
jsonObj.put("businessCode", "UFO");
|
|
|
jsonObj.put("custid", sellerGoods.getDepotNo().intValue() == 0 ? beijingCustid : nanjingCustid);
|
|
|
jsonObj.put("custid", getCustId(req.getPhoneUid(), sellerGoods.getDepotNo()));
|
|
|
|
|
|
//收件人信息
|
|
|
if(buyerOrder.getStatus().equals(Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal())
|
...
|
...
|
@@ -1892,6 +1954,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return jsonObj;
|
|
|
}
|
|
|
|
|
|
private String getCustId(String phoneUid, Integer depotNo) {
|
|
|
if(StringUtils.isNotEmpty(phoneUid)) {
|
|
|
PhoneUidDepot record = phoneUidDepotMapper.selectByphoneUid(phoneUid);
|
|
|
if(null != record) {
|
|
|
depotNo = record.getDepotNo();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return depotNo.intValue() == 0 ? beijingCustid : nanjingCustid;
|
|
|
}
|
|
|
|
|
|
private void buildAddressInfo(JSONObject metaValue, JSONObject jsonObj, Integer uid) {
|
|
|
// jsonObj.put("dCompany", "");
|
|
|
jsonObj.put("dContact", metaValue.getString("consignee"));
|
...
|
...
|
|