作者 tangxuhui

分红单数据结构调整

... ... @@ -99,7 +99,6 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation
CooperationApplicationAttachment: param.CooperationApplicationAttachment,
}
data.CooperationApplicationApplicant.Company.CompanyID = param.CooperationApplicationApplicant.Company.CompanyID
// data.CooperationApplicationApplicant.Company.CompanyLogo = param.CooperationApplicationApplicant.Company.CompanyLogo
data.CooperationApplicationApplicant.Company.CompanyName = param.CooperationApplicationApplicant.Company.CompanyName
data.CooperationApplicationApplicant.Department.DepartmentId = param.CooperationApplicationApplicant.Department.DepartmentID
data.CooperationApplicationApplicant.Department.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName
... ...
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type DividendsOrder struct {
Company struct {
CompanyID int `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
CustomerName string `json:"customerName"` //客户名字
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId"` //分红订单
DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderSalesman struct { //订单业务员
Department struct {
DepartmentID int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
IsOrganization bool `json:"isOrganization"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType int `json:"userType"`
} `json:"orderSalesman"`
OrderTime int64 `json:"orderTime"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
Region struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
}
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
data := DividendsOrder{
Company: param.Company,
CustomerName: param.CustomerName,
DividendStatus: param.DividendStatus,
DividendTime: param.DividendTime.Unix(),
DividendsOrderAmount: param.DividendsOrderAmount,
DividendsOrderID: param.DividendsOrderID,
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
OrderSalesman: param.OrderSalesman,
OrderTime: param.OrderTime.Unix(),
Org: param.Org,
Region: param.Region,
}
return &data
}
... ...
... ... @@ -5,6 +5,7 @@ import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
... ... @@ -68,7 +69,7 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
return dto.ToDividendsOrder(&result.DividendsOrder), nil
}
// 移除分红订单实体对象
... ... @@ -102,8 +103,12 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result.Gride.Total, result.Gride.List, nil
var dataList []dto.DividendsOrder
for i := range result.Gride.List {
item := dto.ToDividendsOrder(&result.Gride.List[i])
dataList = append(dataList, *item)
}
return result.Gride.Total, dataList, nil
}
// 更新分红订单实体对象
... ...
... ... @@ -12,7 +12,7 @@ type DividendsOrder struct {
} `json:"company"`
CustomerName string `json:"customerName"` //客户名字
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime string `json:"dividendTime"` //分红订单分红时间
DividendTime time.Time `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId"` //分红订单
DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号
... ... @@ -39,7 +39,7 @@ type DividendsOrder struct {
} `json:"userInfo"`
UserType int `json:"userType"`
} `json:"orderSalesman"`
OrderTime string `json:"orderTime"`
OrderTime time.Time `json:"orderTime"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
... ...