作者 tangxuhui

数据结构调整

... ... @@ -4,13 +4,10 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
//MoneyIncentivesItem 金额激励分红列表
type MoneyIncentivesItem struct {
}
//业绩分红列表
type DividendsEstimateDividendItem struct {
OrderGoodId int `json:"orderGoodId,string"`
OrderGoodName string `json:"orderGoodName"` //货品名称
CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号
CustomerName string `json:"customerName"` //客户名称
DividendsIncentivesAmount float64 `json:"dividendsIncentivesAmount"` //业绩激励分红金额
... ... @@ -25,6 +22,7 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi
for _, v := range param.List {
item := DividendsEstimateDividendItem{
OrderGoodId: v.OrderGoodId,
OrderGoodName: v.OrderGoodName,
CooperationContractNumber: v.CooperationContractNumber,
CustomerName: v.CustomerName,
DividendsIncentivesAmount: v.OrderAmount,
... ... @@ -83,3 +81,29 @@ type MoneyIncentivesRule struct {
MoneyIncentivesStage int //阶段
MoneyIncentivesStageStart int //阶段开始时间
}
//DividendsEstimateItem 分红预算单列表
type DividendsEstimateItem struct {
DividendsEstimateId int `json:"dividendsEstimateId,string,"` // 承接人分红预算记录ID
DividendsAccountStatus int `json:"dividendsAccountStatus"` // 分红结算状态
DividendsAmount float64 `json:"dividendsAmount"` // 分红金额
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` // 承接人分红预算单号
DividendsEstimateTime int64 `json:"dividendsEstimateTime"` // 分红预算时间
DividendsParticipateType int `json:"dividendsParticipateType"` // 参与分红类型,1承接人,2推荐人,3关联业务员
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段
IsCanceled bool `json:"isCanceled"` // 取消状态
DividendsUser struct {
UsersId int `json:"usersId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserType int `json:"userType"` // 用户类型
UsersName string `json:"usersName"` // 用户姓名
Phone string `json:"phone"` // 用户手机号
} `json:"dividendsUser"` // 分红用户
Org struct {
OrgId int `json:"orgId,string,"` // 组织机构ID
OrgName string `json:"orgName"` // 组织名称
} `json:"org"` // 数据所属组织机构
}
... ...
... ... @@ -66,7 +66,8 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive
}
// 查询分红预算单列表
func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimate(searchDividendsEstimateQuery *query.SearchDividendsEstimateQuery) (interface{}, error) {
func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimate(searchDividendsEstimateQuery *query.SearchDividendsEstimateQuery) (
int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
searchDividendsEstimateQuery.Operator)
result, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{
... ... @@ -74,11 +75,38 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
DividendsType: searchDividendsEstimateQuery.DividendsType, //分红类型,1订单分红,2退货冲销,3金额激励
PageNumber: searchDividendsEstimateQuery.PageNumber,
PageSize: searchDividendsEstimateQuery.PageSize,
CompanyId: searchDividendsEstimateQuery.Operator.CompanyId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
items := []dto.DividendsEstimateItem{}
for _, v := range result.Grid.List {
item := dto.DividendsEstimateItem{
DividendsEstimateId: v.DividendsEstimateId,
DividendsAccountStatus: v.DividendsAccountStatus,
DividendsAmount: v.DividendsAmount,
DividendsEstimateOrderNumber: v.DividendsEstimateOrderNumber,
DividendsEstimateTime: v.DividendsEstimateTime.UnixNano() / 1e6,
DividendsParticipateType: v.DividendsParticipateType,
DividendsType: v.DividendsType,
OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
CooperationProjectNumber: v.CooperationProjectNumber,
DividendsIncentivesStage: v.DividendsIncentivesStage,
IsCanceled: v.IsCanceled,
}
item.DividendsUser.Phone = v.DividendsUser.UserPhone
item.DividendsUser.UsersName = v.DividendsUser.UserName
item.DividendsUser.UsersId = v.DividendsUser.UserId
item.DividendsUser.UserBaseId = v.DividendsUser.UserBaseId
item.DividendsUser.UserType = v.DividendsUser.UserType
item.Org.OrgId = v.Org.OrgId
item.Org.OrgName = v.Org.OrgName
items = append(items, item)
}
return result.Grid.Total, items, nil
}
// 查询业绩分红
... ...
... ... @@ -26,6 +26,8 @@ type (
CustomerName string `json:"customerName"`
// 订单区域
RegionName string `json:"region"`
//货品名称
OrderGoodName string `json:"orderGoodName"`
// 订单金额
OrderAmount float64 `json:"orderAmount"`
// 订单/退货单日期
... ... @@ -37,13 +39,15 @@ type (
//查询分红预算单
type (
ReqDividendsEstimateSearch struct {
//承接人分红预算单号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
CooperationContractNumber string `json:"orderOrReturnedOrderNum"` //合约编号
//分红类型,1订单分红,2退货冲销,3金额激励
DividendsType int `json:"dividendsType"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` //承接人分红预算单号
CooperationContractNumber string `json:"orderOrReturnedOrderNum"` //合约编号
DividendsType int `json:"dividendsType"` //分红类型,1订单分红,2退货冲销,3金额激励
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
CompanyId int64 `json:"companyId"` // 公司ID,通过集成REST上下文获取
OrgId int64 `json:"orgId"` // 组织机构ID
UserId int64 `json:"userId"` // 用户ID,
UserBaseId int64 ` json:"userBaseId"` // 用户基础数据id
}
DataDividendsEstimateSearch struct {
... ... @@ -59,11 +63,14 @@ type (
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` // 分红阶段
IsCanceled bool `json:"isCanceled"` // 取消状态
DividendsUser struct {
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserType int `json:"userType"` // 用户类型
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserType int `json:"userType"` // 用户类型
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
} `json:"dividendsUser"` // 分红用户
Org struct {
OrgId int `json:"orgId,string,"` // 组织机构ID
... ...
... ... @@ -33,8 +33,8 @@ func (controller *DividendsEstimateController) SearchDividendsEstimate() {
log.Logger.Debug("json err:" + err.Error())
}
searchDividendsEstimateQuery.Operator = controller.GetOperator()
data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
controller.Response(data, err)
cnt, data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
controller.ReturnPageListData(int64(cnt), data, err, searchDividendsEstimateQuery.PageNumber)
}
//SearchDividendsIncentives 查询业绩分红
... ...