Authored by caoyan

修改订单买家地址

... ... @@ -8,9 +8,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.yoho.error.exception.ServiceException;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.model.Product;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
... ... @@ -26,9 +23,35 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
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.AreaMapper;
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.OrderOperateRecordMapper;
import com.yoho.order.dal.OrdersPayMapper;
import com.yoho.order.dal.SellerOrderGoodsMapper;
import com.yoho.order.dal.SellerOrderMapper;
import com.yoho.order.dal.SellerOrderMetaMapper;
import com.yoho.order.model.Area;
import com.yoho.order.model.BuyerOrder;
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.OrderOperateRecord;
import com.yoho.order.model.OrdersPay;
import com.yoho.order.model.SellerOrder;
import com.yoho.order.model.SellerOrderGoods;
import com.yoho.order.model.SellerOrderMeta;
import com.yoho.service.model.order.request.OrderRequest;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.order.constant.Constant;
import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yoho.ufo.service.impl.UserHelper;
... ... @@ -41,24 +64,6 @@ 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 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.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author caoyan
... ... @@ -575,19 +580,38 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
int operateType = OPERATE_TYPE_UPDATE_SELLERWAYBILLCODE;
String oldInfo = "";
//卖家已发货,更新卖家物流单号
//卖家已发货,更新卖家物流单号,卖家信息
if(buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal()) {
ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(buyerOrder.getOrderCode(),
buyerOrder.getSellerUid(), EXPRESS_TYPE_SELLER_TO_JUDGE);
if(null == sellerExpressRecord) {
return 0;
}
JSONObject jo = new JSONObject();
jo.put("sellerWaybillCode", sellerExpressRecord.getWaybillCode());
oldInfo = jo.toJSONString();
result = expressRecordMapper.updateWaybillCode(buyerOrder.getOrderCode(),
buyerOrder.getSellerUid(), EXPRESS_TYPE_SELLER_TO_JUDGE, req.getSellerWaybillCode());
}else if(buyerOrder.getStatus().byteValue() < 4) {//卖家发货前,更新收货人信息
//更新卖家物流单号
if(!sellerExpressRecord.getWaybillCode().equals(req.getSellerWaybillCode())) {
JSONObject jo = new JSONObject();
jo.put("sellerWaybillCode", sellerExpressRecord.getWaybillCode());
oldInfo = jo.toJSONString();
result = expressRecordMapper.updateWaybillCode(buyerOrder.getOrderCode(),
buyerOrder.getSellerUid(), EXPRESS_TYPE_SELLER_TO_JUDGE, req.getSellerWaybillCode());
}else {//修改买家信息
operateType = OPERATE_TYPE_UPDATE_RECEIVE_INFO;
BuyerOrderMeta buyerMeta = buyerOrderMetaMapper.selectByOrderCodeAndKey(req.getOrderCode(), BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);
if(null == buyerMeta) {
return 0;
}
JSONObject jsonObject = updateBuyerReceiveInfo(req, buyerMeta.getMetaValue(), buyerOrder.getUid());
if(jsonObject.getIntValue("code") != 200) {
return 0;
}
oldInfo = buyerMeta.getMetaValue();
}
}else if(buyerOrder.getStatus().byteValue() != Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal()
&&buyerOrder.getStatus().byteValue() < 4) {//平台鉴定前,更新收货人信息
operateType = OPERATE_TYPE_UPDATE_RECEIVE_INFO;
BuyerOrderMeta buyerMeta = buyerOrderMetaMapper.selectByOrderCodeAndKey(req.getOrderCode(), BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);
if(null == buyerMeta) {
... ...
... ... @@ -145,12 +145,10 @@ $(function() {
iconCls : "icon-search",
onClick : function() {
var status = $("#status").val();
if(status>2){
if(status>3){
alert("没有需要更新的数据!");
}else if(status == 2){//修改卖家物流单号
updateSellerWaybillCode(orderCode);
}else{
updateReceiveInfo(orderCode);
updateOrderInfo(orderCode);
}
}
... ... @@ -194,7 +192,13 @@ function updateSellerWaybillCode(orderCode){
});
}
function updateReceiveInfo(orderCode){
function updateOrderInfo(orderCode){
var sellerWaybillCode = $("#input_sellerWaybillCode").val();
if(sellerWaybillCode == ''){
alert("卖家快递单号不能为空");
return;
}
var receiveName = $("#input_receiveName").val();
var receiveMobile = $("#input_receiveMobile").val();
var receiveAddressDetail = $("#input_receiveAddressDetail").val();
... ... @@ -211,6 +215,7 @@ function updateReceiveInfo(orderCode){
receiveAddressDetail : receiveAddressDetail,
receiveZipCode : receiveZipCode,
receiveAreaCode : receiveAreaCode,
sellerWaybillCode : sellerWaybillCode
}, function(data) {
if (data.code == 200) {
getOrderInfo(orderCode);
... ...