...
|
...
|
@@ -32,7 +32,6 @@ import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.core.redis.cluster.annotation.Redis;
|
|
|
import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations;
|
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
...
|
...
|
@@ -53,6 +52,7 @@ 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.model.AppraiseAddress;
|
|
|
import com.yoho.order.model.Area;
|
|
|
import com.yoho.order.model.BuyerOrder;
|
...
|
...
|
@@ -71,6 +71,7 @@ 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.service.model.order.request.OrderRequest;
|
|
|
import com.yoho.ufo.constants.PlatformConstant;
|
|
|
import com.yoho.ufo.constants.RedisKeyConstants;
|
...
|
...
|
@@ -83,6 +84,7 @@ import com.yoho.ufo.order.request.SaveQualityCheckInfoRequest; |
|
|
import com.yoho.ufo.order.service.IBuyerOrderService;
|
|
|
import com.yoho.ufo.service.impl.UserHelper;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yoho.ufo.util.DateUtil;
|
|
|
import com.yoho.ufo.util.ImagesConstant;
|
|
|
import com.yoho.ufo.util.ImagesHelper;
|
|
|
import com.yoho.ufo.util.MobileHelper;
|
...
|
...
|
@@ -197,6 +199,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
@Redis("gwNoSyncRedis")
|
|
|
private YHValueOperations yhValueOperations;
|
|
|
|
|
|
@Autowired
|
|
|
private SignForPackageMapper signForPackageMapper;
|
|
|
|
|
|
//南京月结账号
|
|
|
private static final String NANJING_CUSTID = "0255045253";
|
|
|
// private static final String NANJING_CUSTID = "9999999999";
|
...
|
...
|
@@ -218,7 +223,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
private static final Byte QC_STATUS_PROBLEM = 3;
|
|
|
|
|
|
//待处理
|
|
|
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中
|
|
|
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货
|
|
|
Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中
|
|
|
|
|
|
//待发货
|
|
|
private static final List<Byte> processingList = Lists.newArrayList(Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),//已取消(商品质检不通过)
|
...
|
...
|
@@ -345,12 +351,12 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
private List<BuyerOrder> queryOrderByQueryStr(String queryStr, Integer depotNo, Byte status) {
|
|
|
//先按订单号来查
|
|
|
BuyerOrderReq req = new BuyerOrderReq();
|
|
|
req.setOrderCode(queryStr);
|
|
|
req.setDepotNo(depotNo);
|
|
|
req.setStatus(status);
|
|
|
req.setSize(100);
|
|
|
List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
|
|
|
if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
|
|
|
// req.setOrderCode(queryStr);
|
|
|
// req.setDepotNo(depotNo);
|
|
|
// req.setStatus(status);
|
|
|
// req.setSize(100);
|
|
|
// List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
|
|
|
// if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
|
|
|
req = new BuyerOrderReq();
|
|
|
req.setSellerWaybillCode(queryStr);
|
|
|
req.setDepotNo(depotNo);
|
...
|
...
|
@@ -362,9 +368,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
|
|
|
return list;
|
|
|
}else{
|
|
|
return orderList;
|
|
|
}
|
|
|
// }else{
|
|
|
// return orderList;
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
public Map<String, Integer> getCountByOrderStatus(){
|
...
|
...
|
@@ -553,7 +559,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
|
|
|
//查询卖家已发货的订单
|
|
|
List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null, Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal());
|
|
|
List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null, null);
|
|
|
if(CollectionUtils.isEmpty(orderList)) {
|
|
|
return null;
|
|
|
}
|
...
|
...
|
@@ -802,7 +808,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
//写入表
|
|
|
Long orderCode = Long.valueOf(buyerOrder.getOrderCode());
|
|
|
String checkText = req.getCheckText();
|
|
|
int ts = DateUtil.currentTimeSeconds();
|
|
|
int ts = DateUtil.getCurrentTimeSeconds();
|
|
|
QualityCheck record = new QualityCheck();
|
|
|
record.setOrderCode(orderCode);
|
|
|
record.setType(EnumQualityCheckType.CHECK_NOT_PASS.getCode().byteValue());
|
...
|
...
|
@@ -846,7 +852,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
//insert放到前台,防止出现调用失败的情况
|
|
|
Long orderCode = Long.valueOf(buyerOrder.getOrderCode());
|
|
|
String checkText = req.getCheckText();
|
|
|
int ts = DateUtil.currentTimeSeconds();
|
|
|
int ts = DateUtil.getCurrentTimeSeconds();
|
|
|
QualityCheck record = new QualityCheck();
|
|
|
record.setOrderCode(orderCode);
|
|
|
record.setType(EnumQualityCheckType.MINI_FAULT.getCode().byteValue());
|
...
|
...
|
@@ -1283,15 +1289,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
bo.setMobile(req.getMobile());
|
|
|
|
|
|
if(StringUtils.isBlank(bo.getMobile())){
|
|
|
LOGGER.warn("callAppraise empty mobile,args {} orderCode is {},req {}, AppraiseExpressInfoBo is {}, startTime is {}", args,orderCode,req, bo ,DateUtil.getCurrentTimeSecond());
|
|
|
LOGGER.warn("callAppraise empty mobile,args {} orderCode is {},req {}, AppraiseExpressInfoBo is {}, startTime is {}", args,orderCode,req, bo ,DateUtil.getCurrentTimeSeconds());
|
|
|
bo.setMobile("18012341234");//暂时保证数据不为空,正常情况下是mobile不会出现数据为空的,上线观察一段时间再去掉
|
|
|
//throw new ServiceException(400,"错误:物流收货人手机号不能为空!");
|
|
|
}
|
|
|
|
|
|
LOGGER.info("callAppraise orderCode is {}, AppraiseExpressInfoBo is {}, startTime is {}", orderCode, bo ,DateUtil.getCurrentTimeSecond());
|
|
|
LOGGER.info("callAppraise orderCode is {}, AppraiseExpressInfoBo is {}, startTime is {}", orderCode, bo ,DateUtil.getCurrentTimeSeconds());
|
|
|
|
|
|
JSONObject jsonObject = serviceCaller.asyncCall(args, bo, JSONObject.class).get(5, TimeUnit.SECONDS);
|
|
|
LOGGER.info("callAppraise orderCode is {}, endTime is {}", orderCode, DateUtil.getCurrentTimeSecond());
|
|
|
LOGGER.info("callAppraise orderCode is {}, endTime is {}", orderCode, DateUtil.getCurrentTimeSeconds());
|
|
|
LOGGER.info("call ufo-gateway orderCode is {}, interface is {},result is {}", orderCode, args, jsonObject);
|
|
|
|
|
|
return jsonObject;
|
...
|
...
|
@@ -1437,7 +1443,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
resp.setPayStatus("未支付");//支付状态
|
|
|
resp.setChannel(Objects.equals(buyerOrder.getAttributes(), 2) ? 2 : 1); //1,线上订单; 2,门店订单
|
|
|
|
|
|
resp.setCreateTimeStr(DateUtil.long2DateStr(buyerOrder.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setCreateTimeStr(DateUtil.int2DateStr(buyerOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setBuyerUid(buyerOrder.getUid());
|
|
|
|
|
|
resp.setBuyerName(getUserNameByUid(buyerOrder.getUid()));
|
...
|
...
|
@@ -1448,7 +1454,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
if(null != buyerOrder.getPayment()) {
|
|
|
OrdersPay ordersPay = ordersPayMapper.selectByOrderCode(buyerOrder.getOrderCode());
|
|
|
if(null != ordersPay) {
|
|
|
resp.setPayTime(DateUtil.long2DateStr(ordersPay.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setPayTime(DateUtil.int2DateStr(ordersPay.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setPayStatus("已支付");
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -1521,13 +1527,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
//买家收货时间
|
|
|
resp.setReceiveGoodsTime(buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_FINISHED.getByteVal() ?
|
|
|
DateUtil.long2DateStr(buyerOrder.getUpdateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss") : "--");
|
|
|
DateUtil.int2DateStr(buyerOrder.getUpdateTime(), "yyyy-MM-dd HH:mm:ss") : "--");
|
|
|
|
|
|
//物流信息-买家
|
|
|
ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(buyerOrder.getOrderCode(),
|
|
|
buyerOrder.getSellerUid(), EXPRESS_TYPE_SELLER_TO_JUDGE);
|
|
|
if(null != sellerExpressRecord) {
|
|
|
resp.setSellerSendGoodsTime(DateUtil.long2DateStr(sellerExpressRecord.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setSellerSendGoodsTime(DateUtil.int2DateStr(sellerExpressRecord.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setSellerWaybillCode(sellerExpressRecord.getWaybillCode());
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1536,7 +1542,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
expressRecordMapper.selectByOrderCodeListAndType(Lists.newArrayList(buyerOrder.getOrderCode()), Lists.newArrayList(EXPRESS_TYPE_JUDGE_TO_BUYER, EXPRESS_TYPE_JUDGE_TO_SELLER,EXPRESS_TYPE_RETURN_BACK_TO_SELLER));
|
|
|
if(CollectionUtils.isNotEmpty(platformExpressList)) {
|
|
|
ExpressRecord judgeExpressRecord =platformExpressList.get(0);
|
|
|
resp.setPlatformSendGoodsTime(DateUtil.long2DateStr(judgeExpressRecord.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setPlatformSendGoodsTime(DateUtil.int2DateStr(judgeExpressRecord.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setPlatformWaybillCode(judgeExpressRecord.getWaybillCode());
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1553,7 +1559,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
resp.setOrderCode(buyerOrder.getOrderCode());
|
|
|
resp.setStatus(buyerOrder.getStatus());
|
|
|
resp.setStatusStr(Constant.convertOrderStatusStr(buyerOrder.getStatus()));
|
|
|
resp.setCreateTimeStr(DateUtil.long2DateStr(buyerOrder.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setCreateTimeStr(DateUtil.int2DateStr(buyerOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
//卖家物流单号
|
|
|
ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(buyerOrder.getOrderCode(),
|
...
|
...
|
@@ -1649,7 +1655,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
Product product = productMapper.selectByPrimaryKey(sellerGoods.getProductId());
|
|
|
|
|
|
JSONObject data = body.getJSONObject("data");
|
|
|
data.put("createTime", DateUtil.getcurrentDateTime());
|
|
|
data.put("createTime", DateUtil.getCurrentTimeSeconds());
|
|
|
data.put("dContact", jsonReqObj.getString("dContact"));
|
|
|
data.put("dMobile", MobileHelper.coverMobile(jsonReqObj.getString("dMobile")));
|
|
|
data.put("receiverMobile", jsonReqObj.getString("dMobile"));
|
...
|
...
|
@@ -1680,6 +1686,33 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return data;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int signForPackage(String sellerWaybillCode, Integer depotNo) {
|
|
|
SignForPackage pkg = new SignForPackage();
|
|
|
pkg.setDate(Integer.parseInt(DateUtil.getCurrentDateStr()));
|
|
|
pkg.setSellerWaybillCode(sellerWaybillCode);
|
|
|
pkg.setDepotNo(depotNo);
|
|
|
pkg.setSignTime(DateUtil.getCurrentTimeSeconds());
|
|
|
|
|
|
return signForPackageMapper.insert(pkg);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int getPackageCount(Integer depotNo) {
|
|
|
Integer currentDate = Integer.valueOf(DateUtil.getCurrentDateStr());
|
|
|
return signForPackageMapper.selectCountByDate(currentDate, depotNo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<String> queryPackage(Integer depotNo, String sellerWaybillCode) {
|
|
|
|
|
|
BuyerOrderReq req = new BuyerOrderReq();
|
|
|
req.setDepotNo(depotNo);
|
|
|
req.setSellerWaybillCode(sellerWaybillCode);
|
|
|
req.setDate(Integer.valueOf(DateUtil.getCurrentDateStr()));
|
|
|
return signForPackageMapper.selectByCondition(req);
|
|
|
}
|
|
|
|
|
|
private RedisKeyBuilder getRedisKey(String orderCode) {
|
|
|
return RedisKeyBuilder.newInstance().appendFixed(RedisKeyConstants.SF_WAYBILL_CODE).appendVar(orderCode);
|
|
|
}
|
...
|
...
|
@@ -1894,7 +1927,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
ExpressInfoResp resp = new ExpressInfoResp();
|
|
|
resp.setExpressCompanyName(companyMap.get(info.getLogisticsType()));
|
|
|
resp.setWaybillCode(info.getWaybillCode());
|
|
|
resp.setCreateTimeStr(DateUtil.long2DateStr(info.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setCreateTimeStr(DateUtil.int2DateStr(info.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setAcceptRemark(info.getAcceptRemark());
|
|
|
|
|
|
respList.add(resp);
|
...
|
...
|
@@ -1957,7 +1990,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
rsp.setType(item.getType());
|
|
|
rsp.setTypeStr(OperateTypeEnum.getDescByCode(item.getType()));
|
|
|
rsp.setUserName(item.getUserName());
|
|
|
rsp.setUpdateTimeStr(DateUtil.long2DateStr(item.getUpdateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
rsp.setUpdateTimeStr(DateUtil.int2DateStr(item.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
rspList.add(rsp);
|
|
|
}
|
|
|
return rspList;
|
...
|
...
|
@@ -2014,7 +2047,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
resp.setImageUrlList(absoluteUrls);
|
|
|
}
|
|
|
resp.setTimeStr(qualityCheck.getUpdateTime() == null ? null : DateUtil.long2DateStr(qualityCheck.getUpdateTime() * 1000L,"yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setTimeStr(qualityCheck.getUpdateTime() == null ? null : DateUtil.int2DateStr(qualityCheck.getUpdateTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
//查看瑕疵--需要显示状态
|
|
|
if(qualityCheck.getType().byteValue() == EnumQualityCheckType.MINI_FAULT.getCode().byteValue()){
|
|
|
EnumQualityCheckStatus[] allStatus = EnumQualityCheckStatus.values();
|
...
|
...
|
@@ -2149,7 +2182,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
optRecord.setType(operateType);
|
|
|
optRecord.setUid(userInfo.getUserId());
|
|
|
optRecord.setUserName(userInfo.getUserName());
|
|
|
optRecord.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
optRecord.setUpdateTime(DateUtil.getCurrentTimeSeconds());
|
|
|
optRecord.setOldInfo(oldInfo);
|
|
|
orderOperateRecordMapper.insert(optRecord);
|
|
|
}
|
...
|
...
|
@@ -2261,7 +2294,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
resp.setSellerWaybillCode(null == expressInfoMap.get(item.getOrderCode()) ? "" : expressInfoMap.get(item.getOrderCode()).getWaybillCode());
|
|
|
resp.setSellerOrderCode(null == sellerOrder ? "-" : sellerOrder.getOrderCode());
|
|
|
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.int2DateStr(item.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setUid(item.getUid());
|
|
|
resp.setProductCode(skupProductCodeMap.get(skup));
|
|
|
|
...
|
...
|
@@ -2298,7 +2331,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
int createTime = qualityCheck.getCreateTime();
|
|
|
int outerTime = createTime+MINI_FAULT_MARK_OUTER_TIME_SECOND;
|
|
|
//超过12小时
|
|
|
if(DateUtil.getCurrentTimeSecond()>outerTime){
|
|
|
if(DateUtil.getCurrentTimeSeconds()>outerTime){
|
|
|
resp.setStatusStr(resp.getStatusStr()+"(<span style='color:red'>超时</span>)");
|
|
|
}
|
|
|
}
|
...
|
...
|
|