1
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import "git.rosy.net.cn/jx-callback/business/model/dao"
|
|
||||||
|
|
||||||
type UserVendorOrder struct {
|
type UserVendorOrder struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
UserId string `orm:"size(128);column(user_id);index" json:"userID"` // 用户ID
|
UserId string `orm:"size(128);column(user_id);index" json:"userID"` // 用户ID
|
||||||
@@ -22,6 +20,7 @@ type UserVendorOrder struct {
|
|||||||
Type int `orm:"size(8);column(type)" json:"type"` // 快递公司
|
Type int `orm:"size(8);column(type)" json:"type"` // 快递公司
|
||||||
PromiseTimeType int `orm:"size(8);column(promise_Time_type)" json:"promiseTimeType"` // 快递时效产品
|
PromiseTimeType int `orm:"size(8);column(promise_Time_type)" json:"promiseTimeType"` // 快递时效产品
|
||||||
DeliveryType int `orm:"size(8);column(delivery_type)" json:"deliveryType"` // 产品类型
|
DeliveryType int `orm:"size(8);column(delivery_type)" json:"deliveryType"` // 产品类型
|
||||||
|
ReallyChannelFee float64 `orm:"column(really_channel_fee)" json:"reallyChannelFee"` // 真实价格
|
||||||
ChannelFee float64 `orm:"column(channel_fee)" json:"channelFee"` // 渠道价
|
ChannelFee float64 `orm:"column(channel_fee)" json:"channelFee"` // 渠道价
|
||||||
ServiceCharge float64 `orm:"column(service_charge)" json:"serviceCharge"` // 服务费
|
ServiceCharge float64 `orm:"column(service_charge)" json:"serviceCharge"` // 服务费
|
||||||
GuarantFee float64 `orm:"column(guarant_fee)" json:"guarantFee"` // 保价费用
|
GuarantFee float64 `orm:"column(guarant_fee)" json:"guarantFee"` // 保价费用
|
||||||
@@ -30,20 +29,22 @@ type UserVendorOrder struct {
|
|||||||
Increment float64 `orm:"column(increment)" json:"increment"` // 增值(物流)
|
Increment float64 `orm:"column(increment)" json:"increment"` // 增值(物流)
|
||||||
ChannelType int `orm:"size(8);column(channel_type)" json:"channelType"` // 渠道类型(1-快递,2-物流,3-国际物流,4-整车)
|
ChannelType int `orm:"size(8);column(channel_type)" json:"channelType"` // 渠道类型(1-快递,2-物流,3-国际物流,4-整车)
|
||||||
OrderStatus int `orm:"size(8);column(order_status)" json:"orderType"` // 订单状态(1-待支付,2-支付失败,3-支付成功,4-取件,5-配送,6-,4-取消)
|
OrderStatus int `orm:"size(8);column(order_status)" json:"orderType"` // 订单状态(1-待支付,2-支付失败,3-支付成功,4-取件,5-配送,6-,4-取消)
|
||||||
Img string `orm:"text;column(img)" json:"img"` // 包裹图片
|
Img string `orm:"column(img)" json:"img"` // 包裹图片
|
||||||
|
IsForward int `orm:"column(is_forward)" json:"isForward"` // 1否,2是
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*UserVendorOrder) TableUnique() [][]string {
|
func (*UserVendorOrder) TableUnique() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"LocalWayBill", "DeletedAt"},
|
[]string{"LocalWayBill"},
|
||||||
[]string{"OtherWayBill", "DeletedAt"},
|
[]string{"OtherWayBill"},
|
||||||
[]string{"CreatedAt", "DeletedAt"},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserVendorOrder) CreateVendorOrder() error {
|
//func (*UserVendorOrder) TableIndex()[][]string {
|
||||||
return dao.CreateEntity(dao.GetDB(), u)
|
// return [][]string{
|
||||||
}
|
// []string{""},
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
// MakeOrderParamReq 下订单请求参数
|
// MakeOrderParamReq 下订单请求参数
|
||||||
type MakeOrderParamReq struct {
|
type MakeOrderParamReq struct {
|
||||||
@@ -62,14 +63,14 @@ type MakeOrderParamReq struct {
|
|||||||
ReceiveName string `json:"receiveName"` // 收件人姓名
|
ReceiveName string `json:"receiveName"` // 收件人姓名
|
||||||
ReceivePhone string `json:"receivePhone"` // 收件人手机号
|
ReceivePhone string `json:"receivePhone"` // 收件人手机号
|
||||||
Remark string `json:"remark"` // 运单备注
|
Remark string `json:"remark"` // 运单备注
|
||||||
SenderAddressID int64 `json:"senderAddressId"` // 寄件人地址Id
|
SenderAddressId int64 `json:"senderAddressId"` // 寄件人地址Id
|
||||||
SenderAddress string `json:"senderAddress"` // 寄件人地址
|
SenderAddress string `json:"senderAddress"` // 寄件人地址
|
||||||
SenderName string `json:"senderName"` // 寄件人姓名
|
SenderName string `json:"senderName"` // 寄件人姓名
|
||||||
SenderPhone string `json:"senderPhone"` // 寄件人手机号
|
SenderPhone string `json:"senderPhone"` // 寄件人手机号
|
||||||
ThirdPlatform int `json:"thirdPlatform"` // 第三方平台-京东商家下单传3
|
ThirdPlatform int `json:"thirdPlatform"` // 第三方平台-京东商家下单传3
|
||||||
Type int `json:"type"` // 快递公司
|
Type int `json:"type"` // 快递公司
|
||||||
ChannelType int `json:"channelType"` // 渠道类型(1-快递,2-物流,3-国际物流,4-整车)
|
ChannelType int `json:"channelType"` // 渠道类型(1-快递,2-物流,3-国际物流,4-整车)
|
||||||
Img string `json:"img"` // 包裹图片
|
Images string `json:"images"` // 包裹图片
|
||||||
// 快递费
|
// 快递费
|
||||||
ChannelFee float64 `json:"channel_fee"` // 渠道价
|
ChannelFee float64 `json:"channel_fee"` // 渠道价
|
||||||
Bulk float64 `json:"bulk"` // 体积抛比系数
|
Bulk float64 `json:"bulk"` // 体积抛比系数
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ func QueryExpressPrice(param *bida.GetExpressPriceReq) (map[string]*bida.GetExpr
|
|||||||
// CreateWayOrder 创建快递订单
|
// CreateWayOrder 创建快递订单
|
||||||
func CreateWayOrder(ctx *jxcontext.Context, param *model.MakeOrderParamReq, userId string) error {
|
func CreateWayOrder(ctx *jxcontext.Context, param *model.MakeOrderParamReq, userId string) error {
|
||||||
// 检查价格
|
// 检查价格
|
||||||
|
reallyCannelleFee := param.ChannelFee
|
||||||
if err := checkWayFeeIsTrue(param); err != nil {
|
if err := checkWayFeeIsTrue(param); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -86,9 +87,10 @@ func CreateWayOrder(ctx *jxcontext.Context, param *model.MakeOrderParamReq, user
|
|||||||
PackageNum: param.PackageNum,
|
PackageNum: param.PackageNum,
|
||||||
ReceiveAddressID: param.ReceiveAddressId,
|
ReceiveAddressID: param.ReceiveAddressId,
|
||||||
Remark: param.Remark,
|
Remark: param.Remark,
|
||||||
SenderAddressID: param.SenderAddressID,
|
SenderAddressID: param.SenderAddressId,
|
||||||
ThirdPlatform: param.ThirdPlatform,
|
ThirdPlatform: param.ThirdPlatform,
|
||||||
Type: param.Type,
|
Type: param.Type,
|
||||||
|
ReallyChannelFee: reallyCannelleFee,
|
||||||
ChannelFee: param.ChannelFee,
|
ChannelFee: param.ChannelFee,
|
||||||
ServiceCharge: param.ServiceCharge,
|
ServiceCharge: param.ServiceCharge,
|
||||||
GuarantFee: param.GuarantFee,
|
GuarantFee: param.GuarantFee,
|
||||||
@@ -97,8 +99,41 @@ func CreateWayOrder(ctx *jxcontext.Context, param *model.MakeOrderParamReq, user
|
|||||||
Increment: param.Increment,
|
Increment: param.Increment,
|
||||||
ChannelType: param.ChannelType,
|
ChannelType: param.ChannelType,
|
||||||
OrderStatus: model.YES, // 创建
|
OrderStatus: model.YES, // 创建
|
||||||
Img: param.Img,
|
Img: param.Images,
|
||||||
|
IsForward: model.YES,
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULEntity(vendorOrder, ctx.GetUserName())
|
dao.WrapAddIDCULEntity(vendorOrder, ctx.GetUserName())
|
||||||
return vendorOrder.CreateVendorOrder()
|
return dao.CreateEntity(dao.GetDB(), vendorOrder)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelWayOrder 取消运单 todo
|
||||||
|
func CancelWayOrder(param *bida.CancelOrderReq) error {
|
||||||
|
if err := api.QBiDaAPI.CancelOrder(param); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发起退款
|
||||||
|
// 修改本地订单状态
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryOrderDetail 获取订单详细信息
|
||||||
|
func QueryOrderDetail(typeCode int, orderNo string) (*bida.OrderDetail, error) {
|
||||||
|
detail, err := api.QBiDaAPI.GetOrderDetail(&bida.GetOrderDetailReq{
|
||||||
|
Type: typeCode,
|
||||||
|
OrderNo: orderNo,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 本地查询获取真是支付快递费用
|
||||||
|
sql := `SELECT * FROM user_vendor_order a WHERE a.other_way_bill = ? and a.type = ? `
|
||||||
|
data := &model.UserVendorOrder{}
|
||||||
|
param := []interface{}{orderNo, typeCode}
|
||||||
|
if err := dao.GetRow(dao.GetDB(), data, sql, param); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
detail.ExpressFee = data.ChannelFee
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ addEvent = true
|
|||||||
|
|
||||||
dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true"
|
dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true"
|
||||||
|
|
||||||
|
#QBIDA 账号
|
||||||
|
QBiDaAccess = "18048531223"
|
||||||
|
QBiDaPassword = "18080188338"
|
||||||
|
|
||||||
[beta]
|
[beta]
|
||||||
enableStoreWrite = true
|
enableStoreWrite = true
|
||||||
enableJdStoreWrite = false
|
enableJdStoreWrite = false
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
|
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
bidaServer "git.rosy.net.cn/jx-callback/business/q_bida"
|
bidaServer "git.rosy.net.cn/jx-callback/business/q_bida"
|
||||||
"github.com/astaxie/beego/server/web"
|
"github.com/astaxie/beego/server/web"
|
||||||
@@ -11,16 +12,16 @@ type QBiDaExpressController struct {
|
|||||||
web.Controller
|
web.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryExpressPrice 查询物业费
|
// QueryExpressPrice 查询物流费
|
||||||
// @Title Q必达
|
// @Title Q必达
|
||||||
// @Description 查询快递费
|
// @Description 查询快递费
|
||||||
// @Param token header string false "管理员token"
|
// @Param token header string true "管理员token"
|
||||||
// @Param promiseTimeType formData int true "快递时效产品"
|
// @Param promiseTimeType formData int false "快递时效产品"
|
||||||
// @Param deliveryType formData int true "产品类型"
|
// @Param deliveryType formData int false "产品类型"
|
||||||
// @Param goodsValue formData float64 true "保价金额"
|
// @Param goodsValue formData float64 false "保价金额"
|
||||||
// @Param receiveAddress formData string true "收件人地址"
|
// @Param receiveAddress formData string true "收件人地址"
|
||||||
// @Param sendAddress formData string true "寄件人地址"
|
// @Param sendAddress formData string true "寄件人地址"
|
||||||
// @Param type formData int true "快递公司"
|
// @Param type formData int false "快递公司"
|
||||||
// @Param weight formData int true "重量kg"
|
// @Param weight formData int true "重量kg"
|
||||||
// @Param length formData int true "所有包裹累计长"
|
// @Param length formData int true "所有包裹累计长"
|
||||||
// @Param width formData int true "所有包裹累计宽"
|
// @Param width formData int true "所有包裹累计宽"
|
||||||
@@ -49,21 +50,19 @@ func (c *QBiDaExpressController) QueryExpressPrice() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下单
|
|
||||||
|
|
||||||
// CreateWayOrder 下单
|
// CreateWayOrder 下单
|
||||||
// @Title Q必达
|
// @Title Q必达
|
||||||
// @Description 下单
|
// @Description 下单
|
||||||
// @Param token header string false "管理员token"
|
// @Param token header string true "管理员token"
|
||||||
// @Param promiseTimeType formData int true "快递时效产品"
|
// @Param promiseTimeType formData int true "快递时效产品"
|
||||||
// @Param deliveryType formData int true "产品类型"
|
// @Param deliveryType formData int true "产品类型"
|
||||||
// @Param goods formData string true "商品名称"
|
// @Param goods formData string true "商品名称"
|
||||||
// @Param guaranteeValueAmount formData float64 true "保价金额"
|
// @Param guaranteeValueAmount formData float64 false "保价金额"
|
||||||
// @Param weight formData int true "重量kg"
|
// @Param weight formData int true "重量kg"
|
||||||
// @Param length formData int true "所有包裹累计长"
|
// @Param length formData int false "所有包裹累计长"
|
||||||
// @Param width formData int true "所有包裹累计宽"
|
// @Param width formData int false "所有包裹累计宽"
|
||||||
// @Param height formData int true "所有包裹累计高"
|
// @Param height formData int false "所有包裹累计高"
|
||||||
// @Param orderSendTime formData string true "预约时间"
|
// @Param orderSendTime formData string false "预约时间"
|
||||||
// @Param packageNum formData int true "包裹数量"
|
// @Param packageNum formData int true "包裹数量"
|
||||||
// @Param receiveAddress formData string true "收件人地址"
|
// @Param receiveAddress formData string true "收件人地址"
|
||||||
// @Param receiveName formData string true "收件人姓名"
|
// @Param receiveName formData string true "收件人姓名"
|
||||||
@@ -74,6 +73,16 @@ func (c *QBiDaExpressController) QueryExpressPrice() {
|
|||||||
// @Param senderPhone formData string true "寄件人手机号"
|
// @Param senderPhone formData string true "寄件人手机号"
|
||||||
// @Param thirdPlatform formData int true "第三方平台"
|
// @Param thirdPlatform formData int true "第三方平台"
|
||||||
// @Param type formData int true "快递公司"
|
// @Param type formData int true "快递公司"
|
||||||
|
// @Param receiveAddressId formData int64 true "收件人地址Id"
|
||||||
|
// @Param senderAddressId formData int64 true "寄件人地址Id"
|
||||||
|
// @Param channelType formData int true "渠道类型(1-快递,2-物流,3-国际物流,4-整车)"
|
||||||
|
// @Param images formData string false "物品图片多个用逗号隔开"
|
||||||
|
// @Param channelFee formData float64 true "渠道价"
|
||||||
|
// @Param bulk formData int false "泡比"
|
||||||
|
// @Param serviceCharge formData float64 false "服务费"
|
||||||
|
// @Param guarantFee formData float64 false "保价"
|
||||||
|
// @Param originalFee formData float64 false "原价"
|
||||||
|
// @Param increment formData float64 false "物流"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /CreateWayOrder [post]
|
// @router /CreateWayOrder [post]
|
||||||
@@ -99,18 +108,46 @@ func (c *QBiDaExpressController) CreateWayOrder() {
|
|||||||
SenderPhone: params.SenderPhone,
|
SenderPhone: params.SenderPhone,
|
||||||
ThirdPlatform: params.ThirdPlatform,
|
ThirdPlatform: params.ThirdPlatform,
|
||||||
Type: params.Type,
|
Type: params.Type,
|
||||||
ReceiveAddressId: 0,
|
ReceiveAddressId: int64(params.ReceiveAddressId),
|
||||||
SenderAddressID: 0,
|
SenderAddressId: int64(params.SenderAddressId),
|
||||||
ChannelType: 0,
|
ChannelType: params.ChannelType,
|
||||||
Img: "",
|
Images: params.Images,
|
||||||
ChannelFee: 0,
|
ChannelFee: params.ChannelFee,
|
||||||
Bulk: 0,
|
Bulk: utils.Int2Float64(params.Bulk),
|
||||||
ServiceCharge: 0,
|
ServiceCharge: params.ServiceCharge,
|
||||||
GuarantFee: 0,
|
GuarantFee: params.GuarantFee,
|
||||||
OriginalFee: 0,
|
OriginalFee: params.OriginalFee,
|
||||||
Increment: 0,
|
Increment: params.Increment,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := bidaServer.CreateWayOrder(params.Ctx, param, params.Ctx.GetUserID()); err != nil {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
return nil, "", nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelWayVendorOrder 取消运单
|
||||||
|
// @Title Q必达
|
||||||
|
// @Description 取消运单
|
||||||
|
// @Param token header string true "管理员token"
|
||||||
|
// @Param genre formData int true "1取消2关闭"
|
||||||
|
// @Param orderNo formData string true "订单编号"
|
||||||
|
// @Param type formData int true "快递公司"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /CancelWayVendorOrder [post]
|
||||||
|
func (c *QBiDaExpressController) CancelWayVendorOrder() {
|
||||||
|
c.callCancelWayVendorOrder(func(params *tExpressCancelWayVendorOrderParams) (interface{}, string, error) {
|
||||||
|
cancel := &bida.CancelOrderReq{
|
||||||
|
Genre: params.Genre,
|
||||||
|
OrderNo: params.OrderNo,
|
||||||
|
Type: params.Type,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := bidaServer.CancelWayOrder(cancel); err != nil {
|
||||||
|
return nil, "", err
|
||||||
}
|
}
|
||||||
bidaServer.CreateWayOrder(c.Ctx, params)
|
|
||||||
return nil, "", nil
|
return nil, "", nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1015,7 +1015,7 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
// 快递运单
|
// 快递运单,查询物流运费
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "QueryExpressPrice",
|
Method: "QueryExpressPrice",
|
||||||
@@ -1024,4 +1024,13 @@ func init() {
|
|||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
// 创建物流订单
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "CreateWayOrder",
|
||||||
|
Router: "/CreateWayOrder",
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user