- mtps, dada create waybill

- create legacy jxorder(not finished).
This commit is contained in:
gazebo
2018-07-14 14:35:51 +08:00
parent 52248ca427
commit 805925ff58
19 changed files with 759 additions and 147 deletions

View File

@@ -6,6 +6,7 @@ import (
"git.rosy.net.cn/jx-callback/business/controller"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/scheduler"
"git.rosy.net.cn/jx-callback/globals/api"
)
type WaybillController struct {
@@ -57,8 +58,26 @@ func (c *WaybillController) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVa
}
//
func (c *WaybillController) CreateWaybill(bill *model.Waybill) (err error) {
return nil
func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) {
billParams := &dadaapi.OperateOrderRequiredParams{
ShopNo: utils.Int2Str(order.StoreID), // 当前达达的门店号与京西是一样的
OriginID: controller.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID),
CargoPrice: controller.IntPrice2Standard(order.SalePrice),
IsPrepay: 0,
ReceiverName: order.ConsigneeName,
ReceiverAddress: order.ConsigneeAddress,
ReceiverPhone: order.ConsigneeMobile,
}
if billParams.CityCode, err = controller.GetDataCityCodeFromOrder(order); err == nil {
billParams.ReceiverLng, billParams.ReceiverLat, _ = controller.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)
addParams := map[string]interface{}{
"info": order.BuyerComment,
"origin_mark": model.VendorNames[order.VendorID],
"origin_mark_no": utils.Int2Str(order.VendorID),
}
_, err = api.DadaAPI.AddOrder(billParams, addParams)
}
return err
}
func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) {