作者 tangxuhui

分红单数据结构调整

@@ -99,7 +99,6 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation @@ -99,7 +99,6 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation
99 CooperationApplicationAttachment: param.CooperationApplicationAttachment, 99 CooperationApplicationAttachment: param.CooperationApplicationAttachment,
100 } 100 }
101 data.CooperationApplicationApplicant.Company.CompanyID = param.CooperationApplicationApplicant.Company.CompanyID 101 data.CooperationApplicationApplicant.Company.CompanyID = param.CooperationApplicationApplicant.Company.CompanyID
102 - // data.CooperationApplicationApplicant.Company.CompanyLogo = param.CooperationApplicationApplicant.Company.CompanyLogo  
103 data.CooperationApplicationApplicant.Company.CompanyName = param.CooperationApplicationApplicant.Company.CompanyName 102 data.CooperationApplicationApplicant.Company.CompanyName = param.CooperationApplicationApplicant.Company.CompanyName
104 data.CooperationApplicationApplicant.Department.DepartmentId = param.CooperationApplicationApplicant.Department.DepartmentID 103 data.CooperationApplicationApplicant.Department.DepartmentId = param.CooperationApplicationApplicant.Department.DepartmentID
105 data.CooperationApplicationApplicant.Department.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName 104 data.CooperationApplicationApplicant.Department.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName
  1 +package dto
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  5 +)
  6 +
  7 +type DividendsOrder struct {
  8 + Company struct {
  9 + CompanyID int `json:"companyId"`
  10 + CompanyLogo string `json:"companyLogo"`
  11 + CompanyName string `json:"companyName"`
  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 int `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"`
  45 + OrgName string `json:"orgName"`
  46 + } `json:"org"`
  47 + Region struct {
  48 + RegionName string `json:"regionName"`
  49 + RegionNumber string `json:"regionNumber"`
  50 + }
  51 +}
  52 +
  53 +func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
  54 + data := DividendsOrder{
  55 + Company: param.Company,
  56 + CustomerName: param.CustomerName,
  57 + DividendStatus: param.DividendStatus,
  58 + DividendTime: param.DividendTime.Unix(),
  59 + DividendsOrderAmount: param.DividendsOrderAmount,
  60 + DividendsOrderID: param.DividendsOrderID,
  61 + DividendsOrderNumber: param.DividendsOrderNumber,
  62 + DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
  63 + OrderSalesman: param.OrderSalesman,
  64 + OrderTime: param.OrderTime.Unix(),
  65 + Org: param.Org,
  66 + Region: param.Region,
  67 + }
  68 + return &data
  69 +}
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
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"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/dto"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/query" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/query"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
10 ) 11 )
@@ -68,7 +69,7 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen @@ -68,7 +69,7 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
68 if err != nil { 69 if err != nil {
69 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 70 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
70 } 71 }
71 - return result, nil 72 + return dto.ToDividendsOrder(&result.DividendsOrder), nil
72 } 73 }
73 74
74 // 移除分红订单实体对象 75 // 移除分红订单实体对象
@@ -102,8 +103,12 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD @@ -102,8 +103,12 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
102 if err != nil { 103 if err != nil {
103 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 104 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
104 } 105 }
105 -  
106 - return result.Gride.Total, result.Gride.List, nil 106 + var dataList []dto.DividendsOrder
  107 + for i := range result.Gride.List {
  108 + item := dto.ToDividendsOrder(&result.Gride.List[i])
  109 + dataList = append(dataList, *item)
  110 + }
  111 + return result.Gride.Total, dataList, nil
107 } 112 }
108 113
109 // 更新分红订单实体对象 114 // 更新分红订单实体对象
@@ -10,14 +10,14 @@ type DividendsOrder struct { @@ -10,14 +10,14 @@ type DividendsOrder struct {
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 string `json:"dividendTime"` //分红订单分红时间  
16 - DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额  
17 - DividendsOrderID int `json:"dividendsOrderId"` //分红订单  
18 - DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号  
19 - DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号  
20 - OrderSalesman struct { //订单业务员 13 + CustomerName string `json:"customerName"` //客户名字
  14 + DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
  15 + DividendTime time.Time `json:"dividendTime"` //分红订单分红时间
  16 + DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
  17 + DividendsOrderID int `json:"dividendsOrderId"` //分红订单
  18 + DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号
  19 + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
  20 + OrderSalesman struct { //订单业务员
21 Department struct { 21 Department struct {
22 DepartmentID int `json:"departmentId"` 22 DepartmentID int `json:"departmentId"`
23 DepartmentName string `json:"departmentName"` 23 DepartmentName string `json:"departmentName"`
@@ -39,7 +39,7 @@ type DividendsOrder struct { @@ -39,7 +39,7 @@ type DividendsOrder struct {
39 } `json:"userInfo"` 39 } `json:"userInfo"`
40 UserType int `json:"userType"` 40 UserType int `json:"userType"`
41 } `json:"orderSalesman"` 41 } `json:"orderSalesman"`
42 - OrderTime string `json:"orderTime"` 42 + OrderTime time.Time `json:"orderTime"`
43 Org struct { 43 Org struct {
44 OrgID int `json:"orgId"` 44 OrgID int `json:"orgId"`
45 OrgName string `json:"orgName"` 45 OrgName string `json:"orgName"`