Authored by caoyan

订单管理

... ... @@ -22,7 +22,6 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.core.rest.governance.ServiceStragetyFinder;
import com.yoho.core.rest.governance.model.ServiceGovernStrategy;
import com.yoho.order.dal.AppraiseAddressMapper;
import com.yoho.order.dal.AreaMapper;
import com.yoho.order.dal.BuyerOrderGoodsMapper;
... ... @@ -55,6 +54,7 @@ import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yoho.ufo.service.impl.UserHelper;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
import com.yohobuy.ufo.model.order.resp.ExpressInfoResp;
import com.yohobuy.ufo.model.order.resp.OrderDetailResp;
... ... @@ -519,8 +519,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
int operateType = OPERATE_TYPE_UPDATE_SELLERWAYBILLCODE;
String oldInfo = "";
OrderOperateRecord optRecord = new OrderOperateRecord();
optRecord.setOrderCode(req.getOrderCode());
//卖家已发货,更新卖家物流单号
if(buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal()) {
... ... @@ -540,31 +538,47 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
if(null == buyerMeta) {
return 0;
}
JSONObject metaValue = JSONObject.parseObject(buyerMeta.getMetaValue());
metaValue.replace("consignee", req.getReceiveName());
metaValue.replace("mobile", req.getReceiveMobile());
metaValue.replace("address", req.getReceiveAddressDetail());
metaValue.replace("zipCode", req.getReceiveZipCode());
metaValue.replace("areaCode", req.getReceiveAreaCode());
metaValue.replace("area", getAddressInfo(req.getReceiveAreaCode()));
result = buyerOrderMetaMapper.updateMetaValue(req.getOrderCode(), BUYER_ORDER_META_KEY_DELIVERY_ADDRESS, metaValue.toJSONString());
JSONObject jsonObject = updateBuyerReceiveInfo(req, buyerMeta.getMetaValue(), buyerOrder.getUid());
if(jsonObject.getIntValue("code") == 200) {
return 0;
}
oldInfo = buyerMeta.getMetaValue();
}
//记录操作日志
UserHelper userInfo = new UserHelper();
Integer uid = userInfo.getUserId();
if(null == uid) {
return 0;
}
saveOrderOperateRecord(req.getOrderCode(), new UserHelper(), operateType, oldInfo);
return result;
}
private JSONObject updateBuyerReceiveInfo(BuyerOrderReq req, String oldMetaValue, Integer buyerUid) {
JSONObject metaValue = JSONObject.parseObject(oldMetaValue);
metaValue.replace("consignee", req.getReceiveName());
metaValue.replace("mobile", req.getReceiveMobile());
metaValue.replace("address", req.getReceiveAddressDetail());
metaValue.replace("zipCode", req.getReceiveZipCode());
metaValue.replace("areaCode", req.getReceiveAreaCode());
metaValue.replace("area", getAddressInfo(req.getReceiveAreaCode()));
BuyerOrderMetaUpdateReq metaReq = new BuyerOrderMetaUpdateReq();
metaReq.setOrderCode(Long.valueOf(req.getOrderCode()));
metaReq.setUid(buyerUid);
metaReq.setAddress(metaValue.toJSONString());
//调用前台接口更新收货信息
return serviceCaller.call("orderBuyerOrderMeta.updateDeliveryAddress", metaReq, JSONObject.class);
}
private void saveOrderOperateRecord(String orderCode, UserHelper userInfo, int operateType, String oldInfo) {
OrderOperateRecord optRecord = new OrderOperateRecord();
optRecord.setOrderCode(orderCode);
optRecord.setType(operateType);
optRecord.setUid(uid);
optRecord.setUid(userInfo.getUserId());
optRecord.setUserName(userInfo.getUserName());
optRecord.setUpdateTime(DateUtil.getCurrentTimeSecond());
optRecord.setOldInfo(oldInfo);
orderOperateRecordMapper.insert(optRecord);
return result;
}
private String getAddressInfo(String areaCode) {
... ...