作者 yangfu
@@ -4,13 +4,10 @@ import ( @@ -4,13 +4,10 @@ import (
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
5 ) 5 )
6 6
7 -//MoneyIncentivesItem 金额激励分红列表  
8 -type MoneyIncentivesItem struct {  
9 -}  
10 -  
11 //业绩分红列表 7 //业绩分红列表
12 type DividendsEstimateDividendItem struct { 8 type DividendsEstimateDividendItem struct {
13 OrderGoodId int `json:"orderGoodId,string"` 9 OrderGoodId int `json:"orderGoodId,string"`
  10 + OrderGoodName string `json:"orderGoodName"` //货品名称
14 CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号 11 CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号
15 CustomerName string `json:"customerName"` //客户名称 12 CustomerName string `json:"customerName"` //客户名称
16 DividendsIncentivesAmount float64 `json:"dividendsIncentivesAmount"` //业绩激励分红金额 13 DividendsIncentivesAmount float64 `json:"dividendsIncentivesAmount"` //业绩激励分红金额
@@ -25,6 +22,7 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi @@ -25,6 +22,7 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi
25 for _, v := range param.List { 22 for _, v := range param.List {
26 item := DividendsEstimateDividendItem{ 23 item := DividendsEstimateDividendItem{
27 OrderGoodId: v.OrderGoodId, 24 OrderGoodId: v.OrderGoodId,
  25 + OrderGoodName: v.OrderGoodName,
28 CooperationContractNumber: v.CooperationContractNumber, 26 CooperationContractNumber: v.CooperationContractNumber,
29 CustomerName: v.CustomerName, 27 CustomerName: v.CustomerName,
30 DividendsIncentivesAmount: v.OrderAmount, 28 DividendsIncentivesAmount: v.OrderAmount,
@@ -83,3 +81,29 @@ type MoneyIncentivesRule struct { @@ -83,3 +81,29 @@ type MoneyIncentivesRule struct {
83 MoneyIncentivesStage int //阶段 81 MoneyIncentivesStage int //阶段
84 MoneyIncentivesStageStart int //阶段开始时间 82 MoneyIncentivesStageStart int //阶段开始时间
85 } 83 }
  84 +
  85 +//DividendsEstimateItem 分红预算单列表
  86 +type DividendsEstimateItem struct {
  87 + DividendsEstimateId int `json:"dividendsEstimateId,string,"` // 承接人分红预算记录ID
  88 + DividendsAccountStatus int `json:"dividendsAccountStatus"` // 分红结算状态
  89 + DividendsAmount float64 `json:"dividendsAmount"` // 分红金额
  90 + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` // 承接人分红预算单号
  91 + DividendsEstimateTime int64 `json:"dividendsEstimateTime"` // 分红预算时间
  92 + DividendsParticipateType int `json:"dividendsParticipateType"` // 参与分红类型,1承接人,2推荐人,3关联业务员
  93 + DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
  94 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
  95 + CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
  96 + DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段
  97 + IsCanceled bool `json:"isCanceled"` // 取消状态
  98 + DividendsUser struct {
  99 + UsersId int `json:"usersId,string,"` // 用户ID,
  100 + UserBaseId int `json:"userBaseId,string,"` // 用户基本id
  101 + UserType int `json:"userType"` // 用户类型
  102 + UsersName string `json:"usersName"` // 用户姓名
  103 + Phone string `json:"phone"` // 用户手机号
  104 + } `json:"dividendsUser"` // 分红用户
  105 + Org struct {
  106 + OrgId int `json:"orgId,string,"` // 组织机构ID
  107 + OrgName string `json:"orgName"` // 组织名称
  108 + } `json:"org"` // 数据所属组织机构
  109 +}
@@ -66,7 +66,8 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive @@ -66,7 +66,8 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive
66 } 66 }
67 67
68 // 查询分红预算单列表 68 // 查询分红预算单列表
69 -func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimate(searchDividendsEstimateQuery *query.SearchDividendsEstimateQuery) (interface{}, error) { 69 +func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimate(searchDividendsEstimateQuery *query.SearchDividendsEstimateQuery) (
  70 + int, interface{}, error) {
70 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 71 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
71 searchDividendsEstimateQuery.Operator) 72 searchDividendsEstimateQuery.Operator)
72 result, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{ 73 result, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{
@@ -74,11 +75,38 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat @@ -74,11 +75,38 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
74 DividendsType: searchDividendsEstimateQuery.DividendsType, //分红类型,1订单分红,2退货冲销,3金额激励 75 DividendsType: searchDividendsEstimateQuery.DividendsType, //分红类型,1订单分红,2退货冲销,3金额激励
75 PageNumber: searchDividendsEstimateQuery.PageNumber, 76 PageNumber: searchDividendsEstimateQuery.PageNumber,
76 PageSize: searchDividendsEstimateQuery.PageSize, 77 PageSize: searchDividendsEstimateQuery.PageSize,
  78 + CompanyId: searchDividendsEstimateQuery.Operator.CompanyId,
77 }) 79 })
78 if err != nil { 80 if err != nil {
79 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 81 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
80 } 82 }
81 - return result, nil 83 +
  84 + items := []dto.DividendsEstimateItem{}
  85 + for _, v := range result.Grid.List {
  86 + item := dto.DividendsEstimateItem{
  87 + DividendsEstimateId: v.DividendsEstimateId,
  88 + DividendsAccountStatus: v.DividendsAccountStatus,
  89 + DividendsAmount: v.DividendsAmount,
  90 + DividendsEstimateOrderNumber: v.DividendsEstimateOrderNumber,
  91 + DividendsEstimateTime: v.DividendsEstimateTime.UnixNano() / 1e6,
  92 + DividendsParticipateType: v.DividendsParticipateType,
  93 + DividendsType: v.DividendsType,
  94 + OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
  95 + CooperationProjectNumber: v.CooperationProjectNumber,
  96 + DividendsIncentivesStage: v.DividendsIncentivesStage,
  97 + IsCanceled: v.IsCanceled,
  98 + }
  99 + item.DividendsUser.Phone = v.DividendsUser.UserPhone
  100 + item.DividendsUser.UsersName = v.DividendsUser.UserName
  101 + item.DividendsUser.UsersId = v.DividendsUser.UserId
  102 + item.DividendsUser.UserBaseId = v.DividendsUser.UserBaseId
  103 + item.DividendsUser.UserType = v.DividendsUser.UserType
  104 + item.Org.OrgId = v.Org.OrgId
  105 + item.Org.OrgName = v.Org.OrgName
  106 + items = append(items, item)
  107 + }
  108 +
  109 + return result.Grid.Total, items, nil
82 } 110 }
83 111
84 // 查询业绩分红 112 // 查询业绩分红
@@ -26,6 +26,8 @@ type ( @@ -26,6 +26,8 @@ type (
26 CustomerName string `json:"customerName"` 26 CustomerName string `json:"customerName"`
27 // 订单区域 27 // 订单区域
28 RegionName string `json:"region"` 28 RegionName string `json:"region"`
  29 + //货品名称
  30 + OrderGoodName string `json:"orderGoodName"`
29 // 订单金额 31 // 订单金额
30 OrderAmount float64 `json:"orderAmount"` 32 OrderAmount float64 `json:"orderAmount"`
31 // 订单/退货单日期 33 // 订单/退货单日期
@@ -37,13 +39,15 @@ type ( @@ -37,13 +39,15 @@ type (
37 //查询分红预算单 39 //查询分红预算单
38 type ( 40 type (
39 ReqDividendsEstimateSearch struct { 41 ReqDividendsEstimateSearch struct {
40 - //承接人分红预算单号  
41 - DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`  
42 - CooperationContractNumber string `json:"orderOrReturnedOrderNum"` //合约编号  
43 - //分红类型,1订单分红,2退货冲销,3金额激励  
44 - DividendsType int `json:"dividendsType"`  
45 - PageNumber int `json:"pageNumber"`  
46 - PageSize int `json:"pageSize"` 42 + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` //承接人分红预算单号
  43 + CooperationContractNumber string `json:"orderOrReturnedOrderNum"` //合约编号
  44 + DividendsType int `json:"dividendsType"` //分红类型,1订单分红,2退货冲销,3金额激励
  45 + PageNumber int `json:"pageNumber"`
  46 + PageSize int `json:"pageSize"`
  47 + CompanyId int64 `json:"companyId"` // 公司ID,通过集成REST上下文获取
  48 + OrgId int64 `json:"orgId"` // 组织机构ID
  49 + UserId int64 `json:"userId"` // 用户ID,
  50 + UserBaseId int64 ` json:"userBaseId"` // 用户基础数据id
47 } 51 }
48 52
49 DataDividendsEstimateSearch struct { 53 DataDividendsEstimateSearch struct {
@@ -59,11 +63,14 @@ type ( @@ -59,11 +63,14 @@ type (
59 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励 63 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
60 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号 64 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
61 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号, 65 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
62 - DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段 66 + DividendsIncentivesStage int `json:"DividendsIncentivesStage"` // 分红阶段
  67 + IsCanceled bool `json:"isCanceled"` // 取消状态
63 DividendsUser struct { 68 DividendsUser struct {
64 - UserId int `json:"userId,string,"` // 用户ID,  
65 - UserBaseId int `json:"userBaseId,string,"` // 用户基本id  
66 - UserType int `json:"userType"` // 用户类型 69 + UserId int `json:"userId,string,"` // 用户ID,
  70 + UserBaseId int `json:"userBaseId,string,"` // 用户基本id
  71 + UserType int `json:"userType"` // 用户类型
  72 + UserName string `json:"userName"` // 用户姓名
  73 + UserPhone string `json:"userPhone"` // 用户手机号
67 } `json:"dividendsUser"` // 分红用户 74 } `json:"dividendsUser"` // 分红用户
68 Org struct { 75 Org struct {
69 OrgId int `json:"orgId,string,"` // 组织机构ID 76 OrgId int `json:"orgId,string,"` // 组织机构ID
@@ -33,8 +33,8 @@ func (controller *DividendsEstimateController) SearchDividendsEstimate() { @@ -33,8 +33,8 @@ func (controller *DividendsEstimateController) SearchDividendsEstimate() {
33 log.Logger.Debug("json err:" + err.Error()) 33 log.Logger.Debug("json err:" + err.Error())
34 } 34 }
35 searchDividendsEstimateQuery.Operator = controller.GetOperator() 35 searchDividendsEstimateQuery.Operator = controller.GetOperator()
36 - data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)  
37 - controller.Response(data, err) 36 + cnt, data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
  37 + controller.ReturnPageListData(int64(cnt), data, err, searchDividendsEstimateQuery.PageNumber)
38 } 38 }
39 39
40 //SearchDividendsIncentives 查询业绩分红 40 //SearchDividendsIncentives 查询业绩分红