作者 tangxuhui

分红单修改

@@ -6,42 +6,20 @@ import ( @@ -6,42 +6,20 @@ import (
6 6
7 type DividendsOrder struct { 7 type DividendsOrder struct {
8 Company struct { 8 Company struct {
9 - CompanyID int `json:"companyId"` 9 + CompanyID int `json:"companyId,string"`
10 CompanyLogo string `json:"companyLogo"` 10 CompanyLogo string `json:"companyLogo"`
11 CompanyName string `json:"companyName"` 11 CompanyName string `json:"companyName"`
12 } `json:"company"` 12 } `json:"company"`
13 - CustomerName string `json:"customerName"` //客户名字  
14 - DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红  
15 - DividendTime int64 `json:"dividendTime"` //分红订单分红时间  
16 - DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额  
17 - DividendsOrderID int `json:"dividendsOrderId"` //分红订单  
18 - DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号  
19 - DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号  
20 - OrderSalesman struct { //订单业务员  
21 - Department struct {  
22 - DepartmentID int `json:"departmentId"`  
23 - DepartmentName string `json:"departmentName"`  
24 - DepartmentNumber string `json:"departmentNumber"`  
25 - IsOrganization bool `json:"isOrganization"`  
26 - } `json:"department"`  
27 - Org struct {  
28 - OrgID int `json:"orgId"`  
29 - OrgName string `json:"orgName"`  
30 - } `json:"org"`  
31 - UserBaseID int `json:"userBaseId"`  
32 - UserID int `json:"userId"`  
33 - UserInfo struct {  
34 - UserAccount string `json:"userAccount"`  
35 - UserAvatar string `json:"userAvatar"`  
36 - UserEmail string `json:"userEmail"`  
37 - UserName string `json:"userName"`  
38 - UserPhone string `json:"userPhone"`  
39 - } `json:"userInfo"`  
40 - UserType int `json:"userType"`  
41 - } `json:"orderSalesman"`  
42 - OrderTime int64 `json:"orderTime"`  
43 - Org struct {  
44 - OrgID int `json:"orgId"` 13 + CustomerName string `json:"customerName"` //客户名字
  14 + DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
  15 + DividendTime int64 `json:"dividendTime"` //分红订单分红时间
  16 + DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
  17 + DividendsOrderID int `json:"dividendsOrderId"` //分红订单
  18 + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
  19 + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
  20 + OrderTime int64 `json:"orderTime"`
  21 + Org struct {
  22 + OrgID int `json:"orgId,string"`
45 OrgName string `json:"orgName"` 23 OrgName string `json:"orgName"`
46 } `json:"org"` 24 } `json:"org"`
47 Region struct { 25 Region struct {
@@ -60,7 +38,6 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide @@ -60,7 +38,6 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
60 DividendsOrderID: param.DividendsOrderID, 38 DividendsOrderID: param.DividendsOrderID,
61 DividendsOrderNumber: param.DividendsOrderNumber, 39 DividendsOrderNumber: param.DividendsOrderNumber,
62 DividendsOriginalOrderNum: param.DividendsOriginalOrderNum, 40 DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
63 - OrderSalesman: param.OrderSalesman,  
64 OrderTime: param.OrderTime.Unix(), 41 OrderTime: param.OrderTime.Unix(),
65 Org: param.Org, 42 Org: param.Org,
66 Region: param.Region, 43 Region: param.Region,
1 package service 1 package service
2 2
3 import ( 3 import (
4 - "time" 4 + "strconv"
5 5
6 "github.com/linmadan/egglib-go/core/application" 6 "github.com/linmadan/egglib-go/core/application"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/command" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/command"
@@ -32,14 +32,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -32,14 +32,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
32 } 32 }
33 orderGoods = append(orderGoods, good) 33 orderGoods = append(orderGoods, good)
34 } 34 }
35 - t := time.Unix(createDividendsOrderCommand.OrderTime, 0)  
36 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator) 35 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator)
37 result, err := creationCooperationGateway.DividendsOrderAdd(allied_creation_cooperation.ReqDividendsOrderAdd{ 36 result, err := creationCooperationGateway.DividendsOrderAdd(allied_creation_cooperation.ReqDividendsOrderAdd{
38 CompanyId: int(createDividendsOrderCommand.Operator.CompanyId), 37 CompanyId: int(createDividendsOrderCommand.Operator.CompanyId),
  38 + UserId: int(createDividendsOrderCommand.Operator.UserId),
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: t, 42 + OrderTime: strconv.Itoa(int(createDividendsOrderCommand.OrderTime * 1000)),
43 Remarks: createDividendsOrderCommand.Remarks, 43 Remarks: createDividendsOrderCommand.Remarks,
44 RegionName: createDividendsOrderCommand.RegionName, 44 RegionName: createDividendsOrderCommand.RegionName,
45 OrderGoods: orderGoods, 45 OrderGoods: orderGoods,
@@ -129,7 +129,6 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD @@ -129,7 +129,6 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
129 } 129 }
130 orderGoods = append(orderGoods, good) 130 orderGoods = append(orderGoods, good)
131 } 131 }
132 - t := time.Unix(updateDividendsOrderCommand.OrderTime, 0)  
133 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator) 132 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator)
134 _, err := creationCooperationGateway.DividendsOrderUpdate(allied_creation_cooperation.ReqDividendsOrderUpdate{ 133 _, err := creationCooperationGateway.DividendsOrderUpdate(allied_creation_cooperation.ReqDividendsOrderUpdate{
135 DividendsOrderId: updateDividendsOrderCommand.DividendsOrderID, 134 DividendsOrderId: updateDividendsOrderCommand.DividendsOrderID,
@@ -138,7 +137,7 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD @@ -138,7 +137,7 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
138 DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount, 137 DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount,
139 DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum, 138 DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum,
140 OperatorUid: int(updateDividendsOrderCommand.Operator.UserId), 139 OperatorUid: int(updateDividendsOrderCommand.Operator.UserId),
141 - OrderTime: t, 140 + OrderTime: strconv.Itoa(int(updateDividendsOrderCommand.OrderTime * 1000)),
142 Remarks: updateDividendsOrderCommand.Remarks, 141 Remarks: updateDividendsOrderCommand.Remarks,
143 RegionName: updateDividendsOrderCommand.RegionName, 142 RegionName: updateDividendsOrderCommand.RegionName,
144 OrderGoods: orderGoods, 143 OrderGoods: orderGoods,
@@ -12,6 +12,7 @@ import ( @@ -12,6 +12,7 @@ import (
12 12
13 // DividendsOrderAdd 创建分红订单 13 // DividendsOrderAdd 创建分红订单
14 func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDividendsOrderAdd) (*DataDividendsOrderAdd, error) { 14 func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDividendsOrderAdd) (*DataDividendsOrderAdd, error) {
  15 + param.SalesmanUid = "1" //TODO 调试用删除
15 url := gateway.baseUrL + "/dividends-orders" 16 url := gateway.baseUrL + "/dividends-orders"
16 method := "POST" 17 method := "POST"
17 req := gateway.CreateRequest(url, method) 18 req := gateway.CreateRequest(url, method)
@@ -43,6 +44,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDivid @@ -43,6 +44,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDivid
43 44
44 // DividendsOrderUpdate 更新分红订单 45 // DividendsOrderUpdate 更新分红订单
45 func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) { 46 func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) {
  47 + param.SalesmanUid = "1" //TODO 调试用删除
46 url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId) 48 url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
47 method := "PUT" 49 method := "PUT"
48 req := gateway.CreateRequest(url, method) 50 req := gateway.CreateRequest(url, method)
@@ -6,7 +6,7 @@ import "time" @@ -6,7 +6,7 @@ import "time"
6 6
7 type DividendsOrder struct { 7 type DividendsOrder struct {
8 Company struct { 8 Company struct {
9 - CompanyID int `json:"companyId"` 9 + CompanyID int `json:"companyId,string"`
10 CompanyLogo string `json:"companyLogo"` 10 CompanyLogo string `json:"companyLogo"`
11 CompanyName string `json:"companyName"` 11 CompanyName string `json:"companyName"`
12 } `json:"company"` 12 } `json:"company"`
@@ -14,22 +14,22 @@ type DividendsOrder struct { @@ -14,22 +14,22 @@ type DividendsOrder struct {
14 DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红 14 DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
15 DividendTime time.Time `json:"dividendTime"` //分红订单分红时间 15 DividendTime time.Time `json:"dividendTime"` //分红订单分红时间
16 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 16 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
17 - DividendsOrderID int `json:"dividendsOrderId"` //分红订单 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 OrderSalesman struct { //订单业务员 20 OrderSalesman struct { //订单业务员
21 Department struct { 21 Department struct {
22 - DepartmentID int `json:"departmentId"` 22 + DepartmentID int `json:"departmentId,string"`
23 DepartmentName string `json:"departmentName"` 23 DepartmentName string `json:"departmentName"`
24 DepartmentNumber string `json:"departmentNumber"` 24 DepartmentNumber string `json:"departmentNumber"`
25 IsOrganization bool `json:"isOrganization"` 25 IsOrganization bool `json:"isOrganization"`
26 } `json:"department"` 26 } `json:"department"`
27 Org struct { 27 Org struct {
28 - OrgID int `json:"orgId"` 28 + OrgID int `json:"orgId,string"`
29 OrgName string `json:"orgName"` 29 OrgName string `json:"orgName"`
30 } `json:"org"` 30 } `json:"org"`
31 - UserBaseID int `json:"userBaseId"`  
32 - UserID int `json:"userId"` 31 + UserBaseID int `json:"userBaseId,string"`
  32 + UserID int `json:"userId,string"`
33 UserInfo struct { 33 UserInfo struct {
34 UserAccount string `json:"userAccount"` 34 UserAccount string `json:"userAccount"`
35 UserAvatar string `json:"userAvatar"` 35 UserAvatar string `json:"userAvatar"`
@@ -41,7 +41,7 @@ type DividendsOrder struct { @@ -41,7 +41,7 @@ type DividendsOrder struct {
41 } `json:"orderSalesman"` 41 } `json:"orderSalesman"`
42 OrderTime time.Time `json:"orderTime"` 42 OrderTime time.Time `json:"orderTime"`
43 Org struct { 43 Org struct {
44 - OrgID int `json:"orgId"` 44 + OrgID int `json:"orgId,string"`
45 OrgName string `json:"orgName"` 45 OrgName string `json:"orgName"`
46 } `json:"org"` 46 } `json:"org"`
47 Region struct { 47 Region struct {
@@ -62,14 +62,15 @@ type ( @@ -62,14 +62,15 @@ type (
62 OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 62 OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
63 } 63 }
64 ReqDividendsOrderAdd struct { 64 ReqDividendsOrderAdd struct {
65 - CompanyId int `json:"companyId"` 65 + CompanyId int `json:"companyId,string"`
66 CustomerName string `json:"customerName"` //客户名称 66 CustomerName string `json:"customerName"` //客户名称
67 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 67 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
68 - OperatorUid int `json:"operatorUid"` //订单操作人id 68 + OperatorUid int `json:"operatorUid,string"` //订单操作人id
69 OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表 69 OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表
70 - OrderTime time.Time `json:"orderTime"` //订单产生时间 70 + OrderTime string `json:"orderTime"` //订单日期,13位长度字符串类型时间戳
71 Remarks string `json:"remarks"` //备注 71 Remarks string `json:"remarks"` //备注
72 - UserId int `json:"userId"` // 72 + UserId int `json:"userId,string"` //
  73 + SalesmanUid string `json:"salesmanUid"` //订单业务员uid
73 RegionName string `json:"regionName"` //区域名称 74 RegionName string `json:"regionName"` //区域名称
74 } 75 }
75 76
@@ -81,18 +82,18 @@ type ( @@ -81,18 +82,18 @@ type (
81 //更新分红订单 82 //更新分红订单
82 type ( 83 type (
83 ReqDividendsOrderUpdate struct { 84 ReqDividendsOrderUpdate struct {
84 - DividendsOrderId int `json:"dividendsOrderId"`  
85 - CompanyId int `json:"companyId"` 85 + DividendsOrderId int `json:"dividendsOrderId,string"`
  86 + CompanyId int `json:"companyId,string"`
86 CustomerName string `json:"customerName"` //客户名称 87 CustomerName string `json:"customerName"` //客户名称
87 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 88 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
88 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号 89 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
89 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 90 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
90 - OperatorUid int `json:"operatorUid"` //订单操作人id 91 + OperatorUid int `json:"operatorUid,string"` //订单操作人id
91 OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表 92 OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表
92 - OrderTime time.Time `json:"orderTime"` //订单产生时间 93 + OrderTime string `json:"orderTime"` //订单日期,13位长度字符串类型时间戳
93 Remarks string `json:"remarks"` //备注 94 Remarks string `json:"remarks"` //备注
94 SalesmanUid string `json:"salesmanUid"` //订单业务员uid 95 SalesmanUid string `json:"salesmanUid"` //订单业务员uid
95 - UserId int `json:"userId"` // 96 + UserId int `json:"userId,string"` //
96 RegionName string `json:"regionName"` //区域名称 97 RegionName string `json:"regionName"` //区域名称
97 } 98 }
98 99
@@ -18,6 +18,7 @@ func (controller *DividendsOrderController) CreateDividendsOrder() { @@ -18,6 +18,7 @@ func (controller *DividendsOrderController) CreateDividendsOrder() {
18 if err != nil { 18 if err != nil {
19 log.Logger.Debug("json err:" + err.Error()) 19 log.Logger.Debug("json err:" + err.Error())
20 } 20 }
  21 + createDividendsOrderCommand.Operator = controller.GetOperator()
21 data, err := dividendsOrderService.CreateDividendsOrder(createDividendsOrderCommand) 22 data, err := dividendsOrderService.CreateDividendsOrder(createDividendsOrderCommand)
22 controller.Response(data, err) 23 controller.Response(data, err)
23 } 24 }
@@ -30,6 +31,7 @@ func (controller *DividendsOrderController) UpdateDividendsOrder() { @@ -30,6 +31,7 @@ func (controller *DividendsOrderController) UpdateDividendsOrder() {
30 log.Logger.Debug("json err:" + err.Error()) 31 log.Logger.Debug("json err:" + err.Error())
31 } 32 }
32 orderId, _ := controller.GetInt(":orderId") 33 orderId, _ := controller.GetInt(":orderId")
  34 + updateDividendsOrderCommand.Operator = controller.GetOperator()
33 updateDividendsOrderCommand.DividendsOrderID = orderId 35 updateDividendsOrderCommand.DividendsOrderID = orderId
34 data, err := dividendsOrderService.UpdateDividendsOrder(updateDividendsOrderCommand) 36 data, err := dividendsOrderService.UpdateDividendsOrder(updateDividendsOrderCommand)
35 controller.Response(data, err) 37 controller.Response(data, err)
@@ -43,6 +45,7 @@ func (controller *DividendsOrderController) RemoveDividendsOrder() { @@ -43,6 +45,7 @@ func (controller *DividendsOrderController) RemoveDividendsOrder() {
43 log.Logger.Debug("json err:" + err.Error()) 45 log.Logger.Debug("json err:" + err.Error())
44 } 46 }
45 removeDividendsOrderCommand.Operator = controller.GetOperator() 47 removeDividendsOrderCommand.Operator = controller.GetOperator()
  48 +
46 data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand) 49 data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand)
47 controller.Response(data, err) 50 controller.Response(data, err)
48 } 51 }