作者 yangfu
1 -{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628731667364868600}  
  1 +{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628752601441259500}
1 package dto 1 package dto
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
5 ) 6 )
6 7
@@ -11,28 +12,17 @@ type CooperationContractItem struct { @@ -11,28 +12,17 @@ type CooperationContractItem struct {
11 CooperationContractName string `json:"CooperationContractName"` //合约名称 12 CooperationContractName string `json:"CooperationContractName"` //合约名称
12 Status int `json:"status"` //合约状态 13 Status int `json:"status"` //合约状态
13 CreateTtime int `json:"createTtime"` 14 CreateTtime int `json:"createTtime"`
14 - Department struct {  
15 - DepartmentId int `json:"departmentId"`  
16 - DepartmentName string `json:"departmentName"`  
17 - } `json:"department"` 15 + Department domain.Department `json:"department"`
18 IncentivesType string `json:"incentivesType"` //Incentives激励方式 16 IncentivesType string `json:"incentivesType"` //Incentives激励方式
19 CooperationContractSponsor struct { 17 CooperationContractSponsor struct {
20 UserId int `json:"userId,string,"` 18 UserId int `json:"userId,string,"`
21 UserName string `json:"userName"` 19 UserName string `json:"userName"`
22 } `json:"cooperationContractSponsor"` //共创发起人 20 } `json:"cooperationContractSponsor"` //共创发起人
23 - CooperationMode struct {  
24 - CooperationModeId int `json:"cooperationModeId,string,"` // 共创模式ID  
25 - CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,  
26 - CooperationModeName string `json:"cooperationModeName"` // 模式名称,  
27 - } `json:"cooperationMode"` //共创模式  
28 - Org struct {  
29 - OrgId int `json:"orgId"` // id  
30 - OrgName string `json:"orgName"` //  
31 - } `json:"org"` //组织结构 21 + CooperationMode domain.CooperationMode `json:"cooperationMode"` //共创模式
  22 + Org domain.Org `json:"org"` //组织结构
32 } 23 }
33 24
34 func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem { 25 func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem {
35 - // relevantPeople := []int{}  
36 data := CooperationContractItem{ 26 data := CooperationContractItem{
37 CooperationContractId: param.CooperationContractId, 27 CooperationContractId: param.CooperationContractId,
38 CooperationProjectNumber: param.CooperationContractNumber, 28 CooperationProjectNumber: param.CooperationContractNumber,
@@ -45,14 +35,149 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon @@ -45,14 +35,149 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
45 data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName 35 data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
46 data.Department.DepartmentId = param.Department.DepartmentId 36 data.Department.DepartmentId = param.Department.DepartmentId
47 data.Department.DepartmentName = param.Department.DepartmentName 37 data.Department.DepartmentName = param.Department.DepartmentName
48 - data.Org.OrgId = int(param.Org.OrgId) 38 + data.Org.OrgID = int(param.Org.OrgId)
49 data.Org.OrgName = param.Org.OrgName 39 data.Org.OrgName = param.Org.OrgName
50 data.CooperationMode.CooperationModeId = param.CooperationMode.CooperationModeId 40 data.CooperationMode.CooperationModeId = param.CooperationMode.CooperationModeId
51 data.CooperationMode.CooperationModeName = param.CooperationMode.CooperationModeName 41 data.CooperationMode.CooperationModeName = param.CooperationMode.CooperationModeName
52 data.CooperationMode.CooperationModeNumber = param.CooperationMode.CooperationModeNumber 42 data.CooperationMode.CooperationModeNumber = param.CooperationMode.CooperationModeNumber
53 - 43 + if len(param.DividendsIncentivesRules) > 0 {
  44 + data.IncentivesType = "业绩分红"
  45 + } else if len(param.MoneyIncentivesRules) > 0 {
  46 + data.IncentivesType = "金额激励"
  47 + }
54 return nil 48 return nil
55 } 49 }
56 50
  51 +type MoneyIncentivesRule struct {
  52 + MoneyIncentivesRuleId int `json:"moneyIncentivesRuleId"`
  53 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的共创合约编号
  54 + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` // 激励金额
  55 + MoneyIncentivesStage int `json:"moneyIncentivesStage"` // 金额激励阶段
  56 + MoneyIncentivesTime int64 `json:"moneyIncentivesTime"` // 金额激励规则时间
  57 + ReferrerPercentage float64 `json:"referrerPercentage"` // 推荐人抽成比例
  58 + SalesmanPercentage float64 `json:"salesmanPercentage"` // 业务员抽成比例
  59 +}
  60 +
  61 +type DividendsIncentivesRule struct {
  62 + DividendsIncentivesRuleId int `json:"dividendsIncentivesRuleId"`
  63 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的项目合约编号
  64 + ReferrerPercentage float64 `json:"referrerPercentage"` // 推荐人抽成比例
  65 + SalesmanPercentage float64 `json:"salesmanPercentage"` // 业务员抽成比例
  66 + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` // 分红规则激励百分点
  67 + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string"` // 分红规则激励阶段,
  68 + DividendsIncentivesStageEnd int64 `json:"dividendsIncentivesStageEnd"` // 分红规则激励阶段结束
  69 + DividendsIncentivesStageStart int64 `json:"dividendsIncentivesStageStart"` // 分红规则激励阶段开始
  70 +}
  71 +
  72 +type Relevant struct {
  73 + UserId int `json:"userId"`
  74 + UserInfo domain.UserInfo `json:"userInfo"`
  75 + Department domain.Department `json:"department"`
  76 +}
  77 +
  78 +type ContractUndertaker struct {
  79 + Attachment []domain.Attachment `json:"attachment"`
  80 + Department domain.Department `json:"department"`
  81 + HasReferrer bool `json:"hasReferrer"`
  82 + HasSalesman bool `json:"hasSalesman"`
  83 + ReferrerUser domain.UserInfo `json:"referrerUser"`
  84 + SalesmanUser domain.UserInfo `json:"salesmanUser"`
  85 + UserInfo domain.UserInfo `json:"userInfo"`
  86 +}
57 type CooperationContractInfo struct { 87 type CooperationContractInfo struct {
  88 + CooperationContract CooperationContractItem `json:"cooperationContract"`
  89 + Relevant []Relevant `json:"relevant"`
  90 + DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"`
  91 + MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
  92 + ContractUndertaker []ContractUndertaker `json:"contractUndertaker"`
  93 +}
  94 +
  95 +func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract) *CooperationContractInfo {
  96 +
  97 + relevants := []Relevant{}
  98 + dividendsIncentivesRules := []DividendsIncentivesRule{}
  99 + moneyIncentivesRules := []MoneyIncentivesRule{}
  100 + contractUndertaker := []ContractUndertaker{}
  101 + for _, v := range param.RelevantPeople {
  102 + r := Relevant{
  103 + UserId: int(v.UserId),
  104 + UserInfo: domain.UserInfo{
  105 + UsersName: v.UserInfo.UsersName,
  106 + UsersId: v.UserInfo.UsersId,
  107 + UserCode: v.UserInfo.UserCode,
  108 + },
  109 + Department: domain.Department{
  110 + DepartmentNumber: v.Department.DepartmentNumber,
  111 + DepartmentId: int(v.Department.DepartmentId),
  112 + DepartmentName: v.Department.DepartmentName,
  113 + }}
  114 + relevants = append(relevants, r)
  115 +
  116 + }
  117 +
  118 + for _, v := range param.DividendsIncentivesRules {
  119 + r := DividendsIncentivesRule{
  120 + DividendsIncentivesRuleId: v.DividendsIncentivesRuleId,
  121 + CooperationContractNumber: v.CooperationContractNumber,
  122 + ReferrerPercentage: v.ReferrerPercentage,
  123 + SalesmanPercentage: v.SalesmanPercentage,
  124 + DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
  125 + DividendsIncentivesStage: v.DividendsIncentivesStage,
  126 + DividendsIncentivesStageEnd: v.DividendsIncentivesStageEnd.Unix(),
  127 + DividendsIncentivesStageStart: v.DividendsIncentivesStageStart.Unix(),
  128 + }
  129 + dividendsIncentivesRules = append(dividendsIncentivesRules, r)
  130 + }
  131 +
  132 + for _, v := range param.MoneyIncentivesRules {
  133 + r := MoneyIncentivesRule{
  134 + MoneyIncentivesRuleId: v.MoneyIncentivesRuleId,
  135 + CooperationContractNumber: v.CooperationContractNumber,
  136 + MoneyIncentivesAmount: v.MoneyIncentivesAmount,
  137 + MoneyIncentivesStage: v.MoneyIncentivesStage,
  138 + MoneyIncentivesTime: v.MoneyIncentivesTime.Unix(),
  139 + ReferrerPercentage: v.ReferrerPercentage,
  140 + SalesmanPercentage: v.SalesmanPercentage,
  141 + }
  142 + moneyIncentivesRules = append(moneyIncentivesRules, r)
  143 + }
  144 +
  145 + for _, v := range param.Undertakers {
  146 + u := ContractUndertaker{
  147 + Attachment: v.ContractAttachment,
  148 + Department: domain.Department{
  149 + DepartmentNumber: v.Department.DepartmentNumber,
  150 + DepartmentId: int(v.Department.DepartmentId),
  151 + DepartmentName: v.Department.DepartmentName,
  152 + },
  153 + HasReferrer: v.Referrer.UserId > 0,
  154 + HasSalesman: v.Salesman.UserId > 0,
  155 + ReferrerUser: domain.UserInfo{
  156 + UsersName: v.Referrer.UserInfo.UserName,
  157 + Phone: v.Referrer.UserInfo.UserPhone,
  158 + UsersId: v.Referrer.UserId,
  159 + // UserCode :v.
  160 + },
  161 + SalesmanUser: domain.UserInfo{
  162 + UsersName: v.Salesman.UserInfo.UserName,
  163 + UsersId: v.Salesman.UserId,
  164 + Phone: v.Salesman.UserInfo.UserPhone,
  165 + },
  166 + UserInfo: domain.UserInfo{
  167 + UsersName: v.UserInfo.UserName,
  168 + UsersId: v.UserId,
  169 + Phone: v.UserInfo.UserPhone,
  170 + },
  171 + }
  172 + contractUndertaker = append(contractUndertaker, u)
  173 + }
  174 + data := CooperationContractInfo{
  175 + CooperationContract: *ToCooperationContractItem(param),
  176 + Relevant: relevants,
  177 + DividendsIncentivesRules: dividendsIncentivesRules,
  178 + MoneyIncentivesRules: moneyIncentivesRules,
  179 + ContractUndertaker: contractUndertaker,
  180 + }
  181 + return &data
  182 +
58 } 183 }
  1 +package query
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  4 +
  5 +type SearchCooperationContractsByUndertake struct {
  6 + //操作人
  7 + Operator domain.Operator `json:"-"`
  8 + // 查询偏离量
  9 + PageNumber int `json:"pageNumber"`
  10 + // 查询限制
  11 + PageSize int `json:"pageSize" valid:"Required"`
  12 + // 项目合约名称
  13 + CooperationContractName string `json:"cooperationContractName"`
  14 + //发起人
  15 + ContractSponsor string `json:"contractSponsor"`
  16 +}
@@ -97,7 +97,8 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont @@ -97,7 +97,8 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont
97 if err != nil { 97 if err != nil {
98 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 98 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
99 } 99 }
100 - return result, nil 100 +
  101 + return dto.ToCooperationContractInfo(&result.CooperationContract), nil
101 } 102 }
102 103
103 // 返回共创合约管理列表 104 // 返回共创合约管理列表
@@ -107,13 +108,14 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon @@ -107,13 +108,14 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon
107 return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) 108 return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
108 } 109 }
109 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator) 110 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
110 - result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{}) 111 + result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
  112 + PageNumber: listCooperationContractQuery.PageNumber,
  113 + PageSize: listCooperationContractQuery.PageSize,
  114 + })
111 if err != nil { 115 if err != nil {
112 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 116 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
113 } 117 }
114 -  
115 data := []dto.CooperationContractItem{} 118 data := []dto.CooperationContractItem{}
116 -  
117 for i := range result.Grid.List { 119 for i := range result.Grid.List {
118 item := dto.ToCooperationContractItem(&result.Grid.List[i]) 120 item := dto.ToCooperationContractItem(&result.Grid.List[i])
119 data = append(data, *item) 121 data = append(data, *item)
@@ -189,3 +191,16 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC @@ -189,3 +191,16 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC
189 newCooperationContractService := &CooperationContractService{} 191 newCooperationContractService := &CooperationContractService{}
190 return newCooperationContractService 192 return newCooperationContractService
191 } 193 }
  194 +
  195 +func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam query.SearchCooperationContractsByUndertake) (interface{}, error) {
  196 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
  197 + result, err := creationCooperationGateway.CooperationContractsSearchByUndertaker(
  198 + allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{
  199 + CooperationContractName: queryParam.CooperationContractName,
  200 + SponsorName: queryParam.ContractSponsor,
  201 + UserId: 0,
  202 + PageNumber: queryParam.PageNumber,
  203 + PageIndex: queryParam.PageSize,
  204 + })
  205 + return result, err
  206 +}
@@ -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 // 更新分红订单实体对象
  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 DividendsReturnedOrderInfo struct {
  8 + // 公司
  9 + Company struct {
  10 + CompanyID int `json:"companyId"`
  11 + CompanyLogo string `json:"companyLogo"`
  12 + CompanyName string `json:"companyName"`
  13 + } `json:"company"`
  14 + CreatedAt int64 `json:"createdAt"`
  15 + DividendStatus int `json:"dividendStatus"` // 分红订单分红状态,1待分红,2已分红,3部分分红
  16 + DividendTime int64 `json:"dividendTime"` //分红订单分红时间
  17 + DividendsOrderNumber int `json:"dividendsOrderNumber"` //关联分红订单号
  18 + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户姓名
  19 + DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
  20 + DividendsReturnedOrderID string `json:"dividendsReturnedOrderId"` //分红退货单记录id
  21 + DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` //分红退货单号
  22 + DividendsReturnedOrderRefund float64 `json:"dividendsReturnedOrderRefund"` //退货金额
  23 + OriginalOrderNum string `json:"originalOrderNum"` //源单号(原始订单号)
  24 + Remarks string `json:"remarks"` //备注
  25 + //更新时间
  26 + Org struct {
  27 + OrgID int `json:"orgId"` //
  28 + OrgName string `json:"orgName"` //
  29 + } `json:"org"` //归属组织机构
  30 +
  31 + Region struct {
  32 + RegionName string `json:"regionName"`
  33 + RegionNumber string `json:"regionNumber"` //区域编码
  34 + } `json:"region"` //区域信息
  35 + Goods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"goods"` //货品
  36 +}
  37 +
  38 +func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsReturnedOrder) *DividendsReturnedOrderInfo {
  39 + data := DividendsReturnedOrderInfo{
  40 + Goods: param.Goods,
  41 + Org: param.Org,
  42 + Region: param.Region,
  43 + Company: param.Company,
  44 + CreatedAt: param.CreatedAt.Unix(),
  45 + DividendStatus: param.DividendStatus,
  46 + DividendTime: param.DividendTime.Unix(),
  47 + DividendsOrderNumber: param.DividendsOrderNumber,
  48 + DividendsReturnedCustomerName: param.DividendsReturnedCustomerName,
  49 + DividendsReturnedDate: param.DividendsReturnedDate.Unix(),
  50 + DividendsReturnedOrderID: param.DividendsReturnedOrderID,
  51 + DividendsReturnedOrderNumber: param.DividendsReturnedOrderNumber,
  52 + DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund,
  53 + OriginalOrderNum: param.OriginalOrderNum,
  54 + Remarks: param.Remarks,
  55 + }
  56 + return &data
  57 +}
@@ -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/dividendsReturnedOrder/command" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/dto"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/query" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/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 )
@@ -33,7 +34,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends @@ -33,7 +34,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends
33 if err != nil { 34 if err != nil {
34 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 35 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
35 } 36 }
36 - return result, nil 37 + return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil
37 } 38 }
38 39
39 // 移除分红退货单服务 40 // 移除分红退货单服务
@@ -65,7 +66,12 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide @@ -65,7 +66,12 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
65 if err != nil { 66 if err != nil {
66 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 67 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
67 } 68 }
68 - return result.Total, result.List, nil 69 + dataList := []dto.DividendsReturnedOrderInfo{}
  70 + for i := range result.List {
  71 + item := dto.ToDividendsReturnedOrderInfo(&result.List[i])
  72 + dataList = append(dataList, *item)
  73 + }
  74 + return result.Total, dataList, nil
69 } 75 }
70 76
71 // 更新分红退货单服务 77 // 更新分红退货单服务
@@ -104,7 +104,8 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractSearch(param @@ -104,7 +104,8 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractSearch(param
104 } 104 }
105 105
106 // CooperationContractsSearchByUndertaker 根据承接人查询并返回共创项目合约 106 // CooperationContractsSearchByUndertaker 根据承接人查询并返回共创项目合约
107 -func (gateway HttplibAlliedCreationCooperation) CooperationContractsSearchByUndertaker(param ReqCooperationContractSearchByUndertaker) (*DataCooperationContractSearchByUndertaker, error) { 107 +func (gateway HttplibAlliedCreationCooperation) CooperationContractsSearchByUndertaker(
  108 + param ReqCooperationContractSearchByUndertaker) (*DataCooperationContractSearchByUndertaker, error) {
108 url := gateway.baseUrL + "/cooperation-contracts/search-by-undertaker" 109 url := gateway.baseUrL + "/cooperation-contracts/search-by-undertaker"
109 method := "POST" 110 method := "POST"
110 req := gateway.CreateRequest(url, method) 111 req := gateway.CreateRequest(url, method)
@@ -7,7 +7,7 @@ import ( @@ -7,7 +7,7 @@ import (
7 ) 7 )
8 8
9 type CooperationContract struct { 9 type CooperationContract struct {
10 - CooperationContractId int `json:"cooperationContractId,string"` // 共创合约ID 10 + CooperationContractId int `json:"cooperationContractId,string,"` // 共创合约ID
11 CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述 11 CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述
12 CooperationContractName string `json:"cooperationContractName"` // 共创合约名称 12 CooperationContractName string `json:"cooperationContractName"` // 共创合约名称
13 CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号 13 CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
@@ -16,7 +16,7 @@ type CooperationContract struct { @@ -16,7 +16,7 @@ type CooperationContract struct {
16 Department struct { 16 Department struct {
17 DepartmentId int `json:"departmentId"` 17 DepartmentId int `json:"departmentId"`
18 DepartmentName string `json:"departmentName"` 18 DepartmentName string `json:"departmentName"`
19 - } `jsopn:"department"` //发起部门 19 + } `jsopn:"department" json:"department"` //发起部门
20 CooperationContractSponsor struct { 20 CooperationContractSponsor struct {
21 UserId int `json:"userId"` //id 21 UserId int `json:"userId"` //id
22 UserInfo struct { 22 UserInfo struct {
@@ -27,12 +27,12 @@ type CooperationContract struct { @@ -27,12 +27,12 @@ type CooperationContract struct {
27 UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段 27 UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
28 } `json:"userInfo"` 28 } `json:"userInfo"`
29 Department struct { 29 Department struct {
30 - DepartmentId int64 `json:"departmentId,string"` // 部门ID,通过REST集成上下文获取 30 + DepartmentId int64 `json:"departmentId,string,"` // 部门ID,通过REST集成上下文获取
31 DepartmentName string `json:"departmentName"` // 部门名称 31 DepartmentName string `json:"departmentName"` // 部门名称
32 DepartmentNumber string `json:"departmentNumber"` // 部门编码 32 DepartmentNumber string `json:"departmentNumber"` // 部门编码
33 } `json:"department"` //申请人部门 33 } `json:"department"` //申请人部门
34 Org struct { 34 Org struct {
35 - OrgId int64 `json:"orgId,string"` // 组织机构ID 35 + OrgId int64 `json:"orgId,string,"` // 组织机构ID
36 OrgName string `json:"orgName"` // 组织名称 36 OrgName string `json:"orgName"` // 组织名称
37 } `json:"org"` 37 } `json:"org"`
38 UserType int `json:"userType"` 38 UserType int `json:"userType"`
@@ -42,17 +42,18 @@ type CooperationContract struct { @@ -42,17 +42,18 @@ type CooperationContract struct {
42 CooperationMode domain.CooperationMode `json:"cooperationMode"` // 共创模式或者合伙模式 42 CooperationMode domain.CooperationMode `json:"cooperationMode"` // 共创模式或者合伙模式
43 Status int `json:"status"` // 合约状态,1启用,2禁用 43 Status int `json:"status"` // 合约状态,1启用,2禁用
44 Org struct { 44 Org struct {
45 - OrgId int64 `json:"orgId,string"` // 组织机构ID 45 + OrgId int64 `json:"orgId,string,"` // 组织机构ID
46 OrgName string `json:"orgName"` // 组织名称 46 OrgName string `json:"orgName"` // 组织名称
47 } `json:"org"` // 数据所属组织机构 47 } `json:"org"` // 数据所属组织机构
48 Company struct { 48 Company struct {
49 - CompanyId int64 `json:"companyId,string"` // 公司ID 49 + CompanyId int64 `json:"companyId,string,"` // 公司ID
50 CompanyLogo string `json:"companyLogo"` // 公司logo 50 CompanyLogo string `json:"companyLogo"` // 公司logo
51 CompanyName string `json:"companyName"` // 公司名称 51 CompanyName string `json:"companyName"` // 公司名称
52 } `json:"company"` // 公司 52 } `json:"company"` // 公司
53 DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 分红激励规则 53 DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 分红激励规则
54 MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` // 金额激励规则 54 MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` // 金额激励规则
55 Undertakers []struct { 55 Undertakers []struct {
  56 + ContractAttachment []domain.Attachment `json:"contractAttachment"`
56 UserId int `json:"userId"` 57 UserId int `json:"userId"`
57 UserInfo struct { 58 UserInfo struct {
58 UserAvatar string `json:"userAvatar"` // 用户头像 59 UserAvatar string `json:"userAvatar"` // 用户头像
@@ -62,30 +63,50 @@ type CooperationContract struct { @@ -62,30 +63,50 @@ type CooperationContract struct {
62 UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段 63 UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
63 } `json:"userInfo"` 64 } `json:"userInfo"`
64 Department struct { 65 Department struct {
65 - DepartmentId int64 `json:"departmentId,string"` // 部门ID 66 + DepartmentId int64 `json:"departmentId,string,"` // 部门ID
66 DepartmentName string `json:"departmentName"` // 部门名称 67 DepartmentName string `json:"departmentName"` // 部门名称
67 DepartmentNumber string `json:"departmentNumber"` // 部门编码 68 DepartmentNumber string `json:"departmentNumber"` // 部门编码
68 } `json:"department"` //申请人部门 69 } `json:"department"` //申请人部门
69 Org struct { 70 Org struct {
70 - OrgId int64 `json:"orgId,string"` // 组织机构ID 71 + OrgId int64 `json:"orgId,string,"` // 组织机构ID
71 OrgName string `json:"orgName"` // 组织名称 72 OrgName string `json:"orgName"` // 组织名称
72 } `json:"org"` 73 } `json:"org"`
73 UserType int `json:"userType"` 74 UserType int `json:"userType"`
74 UserName string `json:"userName"` 75 UserName string `json:"userName"`
75 UserPhone string `json:"userPhone"` 76 UserPhone string `json:"userPhone"`
  77 + Referrer struct {
  78 + UserId int `json:"userId"`
  79 + UserInfo struct {
  80 + UserAvatar string `json:"userAvatar"` // 用户头像
  81 + UserEmail string `json:"userEmail"` // 用户邮箱
  82 + UserName string `json:"userName"` // 共创人员姓名
  83 + UserPhone string `json:"userPhone"` // 用户手机号
  84 + UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
  85 + } `json:"userInfo"`
  86 + } `json:"referrer"`
  87 + Salesman struct {
  88 + UserId int `json:"userId"`
  89 + UserInfo struct {
  90 + UserAvatar string `json:"userAvatar"` // 用户头像
  91 + UserEmail string `json:"userEmail"` // 用户邮箱
  92 + UserName string `json:"userName"` // 共创人员姓名
  93 + UserPhone string `json:"userPhone"` // 用户手机号
  94 + UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
  95 + } `json:"userInfo"`
  96 + } `json:"salesman"`
76 } `json:"undertakers"` // 共创承接人列表 97 } `json:"undertakers"` // 共创承接人列表
77 RelevantPeople []struct { 98 RelevantPeople []struct {
78 - RelevantId int `json:"relevantId,string"` 99 + RelevantId int `json:"relevantId,string,"`
79 CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号 100 CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
80 - UserId int64 `json:"userId,string"`  
81 - UserBaseId int `json:"userBaseId,string"` 101 + UserId int64 `json:"userId,string,"`
  102 + UserBaseId int `json:"userBaseId,string,"`
82 Org struct { 103 Org struct {
83 - OrgId int64 `json:"orgId,string"` // 组织机构ID 104 + OrgId int64 `json:"orgId,string,"` // 组织机构ID
84 OrgName string `json:"orgName"` // 组织名称 105 OrgName string `json:"orgName"` // 组织名称
85 } `json:"org"` 106 } `json:"org"`
86 UserInfo domain.UserInfo `json:"userInfo"` 107 UserInfo domain.UserInfo `json:"userInfo"`
87 Department struct { 108 Department struct {
88 - DepartmentId int64 `json:"departmentId,string"` // 部门ID 109 + DepartmentId int64 `json:"departmentId,string,"` // 部门ID
89 DepartmentName string `json:"departmentName"` // 部门名称 110 DepartmentName string `json:"departmentName"` // 部门名称
90 DepartmentNumber string `json:"departmentNumber"` // 部门编码 111 DepartmentNumber string `json:"departmentNumber"` // 部门编码
91 } `json:"department"` //申请人部门 112 } `json:"department"` //申请人部门
@@ -99,20 +120,14 @@ type CooperationContract struct { @@ -99,20 +120,14 @@ type CooperationContract struct {
99 type ( 120 type (
100 //分红激励规则 121 //分红激励规则
101 DividendsIncentivesRule struct { 122 DividendsIncentivesRule struct {
102 - // 关联的项目合约编号  
103 - CooperationContractNumber string `json:"cooperationContractNumber"`  
104 - // 推荐人抽成比例  
105 - ReferrerPercentage float64 `json:"referrerPercentage"`  
106 - // 业务员抽成比例  
107 - SalesmanPercentage float64 `json:"salesmanPercentage"`  
108 - // 分红规则激励百分点  
109 - DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"`  
110 - // 分红规则激励阶段,  
111 - DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string"`  
112 - // 分红规则激励阶段结束  
113 - DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"`  
114 - // 分红规则激励阶段开始  
115 - DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` 123 + DividendsIncentivesRuleId int `json:"dividendsIncentivesRuleId"`
  124 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的项目合约编号
  125 + ReferrerPercentage float64 `json:"referrerPercentage"` // 推荐人抽成比例
  126 + SalesmanPercentage float64 `json:"salesmanPercentage"` // 业务员抽成比例
  127 + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` // 分红规则激励百分点
  128 + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string,"` // 分红规则激励阶段,
  129 + DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` // 分红规则激励阶段结束
  130 + DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` // 分红规则激励阶段开始
116 } 131 }
117 //金额激励规则 132 //金额激励规则
118 MoneyIncentivesRule struct { 133 MoneyIncentivesRule struct {
@@ -184,7 +199,7 @@ type ( @@ -184,7 +199,7 @@ type (
184 // 查询偏离量 199 // 查询偏离量
185 PageNumber int `json:"pageNumber"` 200 PageNumber int `json:"pageNumber"`
186 // 查询限制 201 // 查询限制
187 - PageSize int `json:"pageSize" valid:"Required"` 202 + PageSize int `json:"pageSize"`
188 } 203 }
189 204
190 DataCooperationContractSearch struct { 205 DataCooperationContractSearch struct {
@@ -12,7 +12,7 @@ type DividendsOrder struct { @@ -12,7 +12,7 @@ type DividendsOrder struct {
12 } `json:"company"` 12 } `json:"company"`
13 CustomerName string `json:"customerName"` //客户名字 13 CustomerName string `json:"customerName"` //客户名字
14 DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红 14 DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
15 - DividendTime string `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"` //分红订单
18 DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号 18 DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号
@@ -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"`
@@ -7,6 +7,6 @@ import ( @@ -7,6 +7,6 @@ import (
7 7
8 func init() { 8 func init() {
9 web.Router("/v1/web/cooperation-applications/:applicationId", &web_client.CooperationApplicationController{}, "Get:GetCooperationApplication") 9 web.Router("/v1/web/cooperation-applications/:applicationId", &web_client.CooperationApplicationController{}, "Get:GetCooperationApplication")
10 - web.Router("/v1/web/cooperation-applications/search", &web_client.CooperationApplicationController{}, "Get:ListCooperationApplication") 10 + web.Router("/v1/web/cooperation-applications/search", &web_client.CooperationApplicationController{}, "Post:ListCooperationApplication")
11 web.Router("/v1/web/cooperation-applications/audit", &web_client.CooperationApplicationController{}, "Put:AuditCooperationApplication") 11 web.Router("/v1/web/cooperation-applications/audit", &web_client.CooperationApplicationController{}, "Put:AuditCooperationApplication")
12 } 12 }
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/cooperation-contracts/", &web_client.CooperationContractController{}, "Post:CreateCooperationContract")
  10 + web.Router("/v1/web/cooperation-contracts/:contractId", &web_client.CooperationContractController{}, "Put:UpdateCooperationContract")
  11 + web.Router("/v1/web/cooperation-contracts/:contractId", &web_client.CooperationContractController{}, "Get:GetCooperationContract")
  12 + web.Router("/v1/web/cooperation-contracts/search", &web_client.CooperationContractController{}, "Post:ListCooperationContract")
  13 + web.Router("/v1/web/cooperation-contracts/enable", &web_client.CooperationContractController{}, "Put:EnableCooperationContract")
  14 +}