作者 tangxuhui

更新分红单结构

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