作者 tangxuhui

更新分红单结构

... ... @@ -2,6 +2,7 @@ package command
import (
"fmt"
"strconv"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -14,7 +15,7 @@ type CreateDividendsOrderCommand struct {
CustomerName string `json:"customerName" valid:"Required"`
//分红订单原单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"`
//订单产生时间 时间戳 秒
//订单产生时间 时间戳
OrderTime int64 `json:"orderTime" valid:"Required"`
//备注
Remarks string `json:"remarks" valid:"Required"`
... ... @@ -35,7 +36,12 @@ type CreateDividendsOrderCommand struct {
}
func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) {
// 162 92522 89000
orderTimeStr := strconv.Itoa(int(createDividendsOrderCommand.OrderTime))
orderTimeStrRune := []rune(orderTimeStr)
if len(orderTimeStrRune) != 13 {
validation.AddError("订单产生时间", "格式错误")
}
}
func (createDividendsOrderCommand *CreateDividendsOrderCommand) ValidateCommand() error {
... ...
... ... @@ -2,6 +2,7 @@ package command
import (
"fmt"
"strconv"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -18,7 +19,7 @@ type UpdateDividendsOrderCommand struct {
DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"`
//分红订单原单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"`
//订单产生时间
//订单产生时间 时间戳 毫秒
OrderTime int64 `json:"orderTime" valid:"Required"`
//备注
Remarks string `json:"remarks" valid:"Required"`
... ... @@ -37,7 +38,12 @@ type UpdateDividendsOrderCommand struct {
}
func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {
// 162 92522 89000
orderTimeStr := strconv.Itoa(int(updateDividendsOrderCommand.OrderTime))
orderTimeStrRune := []rune(orderTimeStr)
if len(orderTimeStrRune) != 13 {
validation.AddError("订单产生时间", "格式错误")
}
}
func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) ValidateCommand() error {
... ...
... ... @@ -17,7 +17,7 @@ type DividendsOrder struct {
DividendsOrderID int `json:"dividendsOrderId,string,"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderTime int64 `json:"orderTime"`
OrderTime int64 `json:"orderTime"` //订单日日期 13位毫秒输出
Org struct {
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
... ... @@ -26,6 +26,8 @@ type DividendsOrder struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
} `json:"region"`
Remark string `json:"remark"`
Goods []allied_creation_cooperation.DividendsOrderGoods
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
... ... @@ -38,9 +40,11 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
DividendsOrderID: param.DividendsOrderID,
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
OrderTime: param.OrderTime.Unix(),
OrderTime: param.OrderTime.UnixNano() / 1e6, //转为毫米输出
Org: param.Org,
Region: param.Region,
Remark: param.Remark,
Goods: param.Goods,
}
return &data
}
... ...
... ... @@ -39,7 +39,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
CustomerName: createDividendsOrderCommand.CustomerName,
DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(createDividendsOrderCommand.Operator.UserId),
OrderTime: strconv.Itoa(int(createDividendsOrderCommand.OrderTime * 1000)),
OrderTime: strconv.Itoa(int(createDividendsOrderCommand.OrderTime)),
Remarks: createDividendsOrderCommand.Remarks,
RegionName: createDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
... ... @@ -131,7 +131,7 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount,
DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(updateDividendsOrderCommand.Operator.UserId),
OrderTime: strconv.Itoa(int(updateDividendsOrderCommand.OrderTime * 1000)),
OrderTime: strconv.Itoa(int(updateDividendsOrderCommand.OrderTime)),
Remarks: updateDividendsOrderCommand.Remarks,
RegionName: updateDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
... ...
... ... @@ -48,6 +48,8 @@ type DividendsOrder struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
} `json:"region"`
Remark string `json:"remark"`
Goods []DividendsOrderGoods `json:"goods"`
}
type (
... ...