作者 yangfu
@@ -3,8 +3,7 @@ package command @@ -3,8 +3,7 @@ package command
3 import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 3 import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
4 4
5 type PayCreditAccountCommand struct { 5 type PayCreditAccountCommand struct {
6 - //操作人  
7 - Operator domain.Operator `json:"-"` 6 + Operator domain.Operator `json:"-"` //操作人
8 CreditAccountId int `json:"creditAccountId"` //账期结算id 7 CreditAccountId int `json:"creditAccountId"` //账期结算id
9 ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际金额 8 ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际金额
10 Remarks string `json:"remarks"` //备注 9 Remarks string `json:"remarks"` //备注
  1 +package dto
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  6 +)
  7 +
  8 +type CreditAccountItem struct {
  9 + CreditAccountId int `json:"creditAccountId,string"` // 账期结算单ID
  10 + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 账期结算实付金额
  11 + CreditAccountOrderNum string `json:"creditAccountOrderNum"` // 账期结算单号
  12 + PaymentStatus int `json:"paymentStatus"` // 账期结算支付状态,1待支付,2已支付
  13 + PaymentTime int64 `json:"paymentTime"` // 共创账期结算支付时间
  14 + SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额
  15 + SettlementTime int64 `json:"settlementTime"` // 共创账期结算时间
  16 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号
  17 + Participator struct {
  18 + UserName string `json:"userName"` // 用户姓名
  19 + UserPhone string `json:"userPhone"` // 用户手机号
  20 + UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开
  21 + } `json:"participator"` // 参与人
  22 + ParticipateType string `json:"participateType"` // 参与类型
  23 + PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件
  24 + Org domain.Org `json:"org"` // 数据所属组织机构
  25 + Company domain.CompanyData `json:"company"` // 公司
  26 + CreatedAt int64 `json:"createdAt"` // 创建时间
  27 + UpdatedAt int64 `json:"updatedAt"` // 更新时间
  28 + AccountDetail []struct {
  29 + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
  30 + DividendsType string `json:"dividendsType"`
  31 + DividendsAmount float64 `json:"dividendsAmount"`
  32 + } `json:"accountDetail"` //结算明细
  33 +}
  34 +
  35 +func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem {
  36 + data := CreditAccountItem{
  37 + CreditAccountId: param.CreditAccountId,
  38 + ActuallyPaidAmount: param.ActuallyPaidAmount,
  39 + CreditAccountOrderNum: param.CreditAccountOrderNum,
  40 + PaymentStatus: param.PaymentStatus,
  41 + PaymentTime: param.PaymentTime.Unix(),
  42 + SettlementAmount: param.SettlementAmount,
  43 + SettlementTime: param.SettlementTime.Unix(),
  44 + CooperationContractNumber: param.CooperationContractNumber,
  45 + ParticipateType: param.ParticipateType, // 参与类型
  46 + PaymentDocumentAttachment: param.PaymentDocumentAttachment, // 支付凭证附件
  47 + Org: param.Org, // 数据所属组织机构
  48 + Company: param.Company, // 公司
  49 + CreatedAt: param.CreatedAt.Unix(), // 创建时间
  50 + UpdatedAt: param.UpdatedAt.Unix(), // 更新时间
  51 + AccountDetail: param.AccountDetail,
  52 + }
  53 + data.Participator.UserName = param.Participator.UserName
  54 + data.Participator.UserPhone = param.Participator.UserPhone
  55 + data.Participator.UserType = param.Participator.UserType
  56 + return &data
  57 +}
@@ -3,6 +3,7 @@ package service @@ -3,6 +3,7 @@ package service
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/dto"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
8 ) 9 )
@@ -15,14 +16,34 @@ func NewCreditAccountService(option map[string]interface{}) CreditAccountService @@ -15,14 +16,34 @@ func NewCreditAccountService(option map[string]interface{}) CreditAccountService
15 16
16 //ListCreditAccount返回账期结算列表 17 //ListCreditAccount返回账期结算列表
17 func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) { 18 func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) {
18 -  
19 - return 0, nil, nil 19 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listQuery.Operator)
  20 + result, err := creationCooperationGateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
  21 + PageNumber: int64(listQuery.PageNumber),
  22 + PageSize: int64(listQuery.PageSize),
  23 + CreditAccountOrderNum: listQuery.CreditAccountOrderNum,
  24 + ParticipatorName: listQuery.Participator,
  25 + })
  26 + if err != nil {
  27 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  28 + }
  29 + var listData []dto.CreditAccountItem
  30 + for i := range result.Grid.List {
  31 + item := dto.ToCreditAccountItem(&result.Grid.List[i])
  32 + listData = append(listData, *item)
  33 + }
  34 + return int64(result.Grid.Total), listData, nil
20 } 35 }
21 36
22 //GetCreditAccount 返回账期结算详情 37 //GetCreditAccount 返回账期结算详情
23 func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccountQuery) (interface{}, error) { 38 func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccountQuery) (interface{}, error) {
24 -  
25 - return nil, nil 39 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getQuery.Operator)
  40 + result, err := creationCooperationGateway.CreditAccountGet(allied_creation_cooperation.ReqCreditAccountGet{
  41 + CreditAccountId: getQuery.CreditAccountId,
  42 + })
  43 + if err != nil {
  44 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  45 + }
  46 + return dto.ToCreditAccountItem(&result.CreditAccount), nil
26 } 47 }
27 48
28 //PayCreditAccount 支付账期结算 49 //PayCreditAccount 支付账期结算
@@ -7,17 +7,18 @@ import ( @@ -7,17 +7,18 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 8 )
9 9
  10 +//业绩分红 确定预算。。。
10 type EstimateDividendsIncentivesCommand struct { 11 type EstimateDividendsIncentivesCommand struct {
11 //操作人 12 //操作人
12 Operator domain.Operator `json:"-"` 13 Operator domain.Operator `json:"-"`
13 // 分红订单号/退货单号 14 // 分红订单号/退货单号
14 - OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum" valid:"Required"` 15 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
15 // 合约编号 16 // 合约编号
16 - CooperationContractNumber string `json:"cooperationContractNumber" valid:"Required"` 17 + CooperationContractNumber string `json:"cooperationContractNumber" `
17 } 18 }
18 19
19 func (estimateDividendsIncentivesCommand *EstimateDividendsIncentivesCommand) Valid(validation *validation.Validation) { 20 func (estimateDividendsIncentivesCommand *EstimateDividendsIncentivesCommand) Valid(validation *validation.Validation) {
20 - validation.SetError("CustomValid", "未实现的自定义认证") 21 +
21 } 22 }
22 23
23 func (estimateDividendsIncentivesCommand *EstimateDividendsIncentivesCommand) ValidateCommand() error { 24 func (estimateDividendsIncentivesCommand *EstimateDividendsIncentivesCommand) ValidateCommand() error {
@@ -14,10 +14,12 @@ type EstimateMoneyIncentivesCommand struct { @@ -14,10 +14,12 @@ type EstimateMoneyIncentivesCommand struct {
14 CooperationContractNumber string `json:"cooperationContractNumber" valid:"Required"` 14 CooperationContractNumber string `json:"cooperationContractNumber" valid:"Required"`
15 // 承接人UID 15 // 承接人UID
16 UndertakerUid string `json:"undertakerUid,omitempty"` 16 UndertakerUid string `json:"undertakerUid,omitempty"`
  17 + //分红阶段
  18 + DividendsIncentivesStage int `json:"dividendsIncentivesStage"`
17 } 19 }
18 20
19 func (estimateMoneyIncentivesCommand *EstimateMoneyIncentivesCommand) Valid(validation *validation.Validation) { 21 func (estimateMoneyIncentivesCommand *EstimateMoneyIncentivesCommand) Valid(validation *validation.Validation) {
20 - validation.SetError("CustomValid", "未实现的自定义认证") 22 +
21 } 23 }
22 24
23 func (estimateMoneyIncentivesCommand *EstimateMoneyIncentivesCommand) ValidateCommand() error { 25 func (estimateMoneyIncentivesCommand *EstimateMoneyIncentivesCommand) ValidateCommand() error {
1 -package command  
2 -  
3 -import (  
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
8 -)  
9 -  
10 -type UpdateDividendsEstimateCommand struct {  
11 - //操作人  
12 - Operator domain.Operator `json:"-"`  
13 - // 承接人分红预算记录ID  
14 - DividendsEstimateId int64 `json:"dividendsEstimateId" valid:"Required"`  
15 -}  
16 -  
17 -func (updateDividendsEstimateCommand *UpdateDividendsEstimateCommand) Valid(validation *validation.Validation) {  
18 - validation.SetError("CustomValid", "未实现的自定义认证")  
19 -}  
20 -  
21 -func (updateDividendsEstimateCommand *UpdateDividendsEstimateCommand) ValidateCommand() error {  
22 - valid := validation.Validation{}  
23 - b, err := valid.Valid(updateDividendsEstimateCommand)  
24 - if err != nil {  
25 - return err  
26 - }  
27 - if !b {  
28 - for _, validErr := range valid.Errors {  
29 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
30 - }  
31 - }  
32 - return nil  
33 -}  
1 package dto 1 package dto
2 2
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  5 +)
  6 +
3 //MoneyIncentivesItem 金额激励分红列表 7 //MoneyIncentivesItem 金额激励分红列表
4 type MoneyIncentivesItem struct { 8 type MoneyIncentivesItem struct {
5 } 9 }
  10 +
  11 +//业绩分红列表
  12 +type DividendsEstimateDividendItem struct {
  13 + CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号
  14 + CustomerName string `json:"customerName"` //客户名称
  15 + DividendsIncentivesAmount int `json:"dividendsIncentivesAmount"` //业绩激励分红金额
  16 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号
  17 + OrderTime int64 `json:"orderTime"` //订单/退货单日期
  18 + OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
  19 + RegionName string `json:"regionName"` //区域名称
  20 +}
  21 +
  22 +func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem {
  23 + var listdata []DividendsEstimateDividendItem
  24 + for _, v := range param.Grid.List {
  25 + item := DividendsEstimateDividendItem{
  26 + CooperationContractNumber: v.CooperationContractNumber,
  27 + CustomerName: v.CustomerName,
  28 + DividendsIncentivesAmount: v.DividendsIncentivesAmount,
  29 + OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
  30 + OrderTime: v.OrderTime.Unix(),
  31 + OriginalOrderNum: v.OriginalOrderNum,
  32 + RegionName: v.Region.RegionName,
  33 + }
  34 + listdata = append(listdata, item)
  35 + }
  36 +
  37 + return listdata
  38 +}
  39 +
  40 +type DividendsEstimateMoneyItem struct {
  41 + CooperationContractName string `json:"cooperationContractName"` //合约名称
  42 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码
  43 + CooperationMode struct {
  44 + CooperationModeId int `json:"cooperationModeId"`
  45 + CooperationModeName string `json:"cooperationModeName"`
  46 + CooperationModeNumber string `json:"cooperationModeNumber"`
  47 + } `json:"cooperationMode"` //共创模式
  48 + CreatedAt int64 `json:"createdAt"` //合约建立时间
  49 + Department struct {
  50 + DepartmentId int `json:"departmentId"`
  51 + DepartmentName string `json:"departmentName"`
  52 + } `json:"department"` //发起部门
  53 + CooperationContractSponsor struct {
  54 + UserId int `json:"userId"`
  55 + UserBaseId int `json:"userBaseId"`
  56 + UsersName string `json:"userName"`
  57 + Phone string `json:"phone"`
  58 + } `json:"cooperationContractSponsor"` //合约发起人
  59 +}
  60 +
  61 +func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem {
  62 + var listdata []DividendsEstimateMoneyItem
  63 + for _, v := range param.Grid.List {
  64 + item := DividendsEstimateMoneyItem{
  65 + CooperationContractName: v.CooperationContractName,
  66 + CooperationContractNumber: v.CooperationContractNumber,
  67 + CreatedAt: v.CreatedAt.Unix(),
  68 + }
  69 + item.CooperationMode.CooperationModeId = v.CooperationMode.CooperationModeId
  70 + item.CooperationMode.CooperationModeName = v.CooperationMode.CooperationModeName
  71 + item.CooperationMode.CooperationModeNumber = v.CooperationMode.CooperationModeNumber
  72 + item.Department.DepartmentId = v.Department.DepartmentId
  73 + item.Department.DepartmentName = v.Department.DepartmentName
  74 + item.CooperationContractSponsor.UserId = v.CooperationContractSponsor.UserId
  75 + item.CooperationContractSponsor.Phone = v.CooperationContractSponsor.UserInfo.Phone
  76 + item.CooperationContractSponsor.UsersName = v.CooperationContractSponsor.UserInfo.UsersName
  77 + listdata = append(listdata, item)
  78 + }
  79 + return listdata
  80 +}
  81 +
  82 +//合约承接人
  83 +type ContractUndertaker struct {
  84 + UserId int `json:"userId,string,"`
  85 + UsersName string `json:"userName"`
  86 + ContractIncentivesRules []int `json:"contractIncentivesRules"`
  87 +}
  88 +
  89 +// 金额激励规则
  90 +type MoneyIncentivesRule struct {
  91 + MoneyIncentivesStage int //阶段
  92 + MoneyIncentivesStageStart int //阶段开始时间
  93 +}
1 -package query  
2 -  
3 -import (  
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
8 -)  
9 -  
10 -type GetDividendsEstimateQuery struct {  
11 - //操作人  
12 - Operator domain.Operator `json:"-"`  
13 - // 承接人分红预算记录ID  
14 - DividendsEstimateId int64 `json:"dividendsEstimateId" valid:"Required"`  
15 -}  
16 -  
17 -func (getDividendsEstimateQuery *GetDividendsEstimateQuery) Valid(validation *validation.Validation) {  
18 - validation.SetError("CustomValid", "未实现的自定义认证")  
19 -}  
20 -  
21 -func (getDividendsEstimateQuery *GetDividendsEstimateQuery) ValidateQuery() error {  
22 - valid := validation.Validation{}  
23 - b, err := valid.Valid(getDividendsEstimateQuery)  
24 - if err != nil {  
25 - return err  
26 - }  
27 - if !b {  
28 - for _, validErr := range valid.Errors {  
29 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
30 - }  
31 - }  
32 - return nil  
33 -}  
1 -package query  
2 -  
3 -import (  
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
8 -)  
9 -  
10 -type ListDividendsEstimateQuery struct {  
11 - //操作人  
12 - Operator domain.Operator `json:"-"`  
13 - // 查询偏离量  
14 - PageNumber int `json:"pageNumber" `  
15 - // 查询限制  
16 - PageSize int `json:"pageSize"`  
17 -}  
18 -  
19 -func (listDividendsEstimateQuery *ListDividendsEstimateQuery) Valid(validation *validation.Validation) {  
20 -  
21 -}  
22 -  
23 -func (listDividendsEstimateQuery *ListDividendsEstimateQuery) ValidateQuery() error {  
24 - valid := validation.Validation{}  
25 - b, err := valid.Valid(listDividendsEstimateQuery)  
26 - if err != nil {  
27 - return err  
28 - }  
29 - if !b {  
30 - for _, validErr := range valid.Errors {  
31 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
32 - }  
33 - }  
34 - return nil  
35 -}  
1 -package query  
2 -  
3 -import (  
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
8 -)  
9 -  
10 -type ListDividendsIncentivesQuery struct {  
11 - //操作人  
12 - Operator domain.Operator `json:"-"`  
13 - // 查询偏离量  
14 - PageNumber int `json:"pageNumber" `  
15 - // 查询限制  
16 - PageSize int `json:"pageSize" `  
17 -}  
18 -  
19 -func (listDividendsIncentivesQuery *ListDividendsIncentivesQuery) Valid(validation *validation.Validation) {  
20 -  
21 -}  
22 -  
23 -func (listDividendsIncentivesQuery *ListDividendsIncentivesQuery) ValidateQuery() error {  
24 - valid := validation.Validation{}  
25 - b, err := valid.Valid(listDividendsIncentivesQuery)  
26 - if err != nil {  
27 - return err  
28 - }  
29 - if !b {  
30 - for _, validErr := range valid.Errors {  
31 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
32 - }  
33 - }  
34 - return nil  
35 -}  
1 -package query  
2 -  
3 -import (  
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
8 -)  
9 -  
10 -type ListMoneyIncentivesQuery struct {  
11 - //操作人  
12 - Operator domain.Operator `json:"-"`  
13 - // 查询偏离量  
14 - PageNumber int `json:"pageNumber" valid:"Required"`  
15 - // 查询限制  
16 - PageSize int `json:"pageSize" valid:"Required"`  
17 - CooperationContractName string `json:"cooperationContractName"` //合约名称  
18 - DepartmentName string `json:"department"`  
19 -}  
20 -  
21 -func (listMoneyIncentivesQuery *ListMoneyIncentivesQuery) Valid(validation *validation.Validation) {  
22 -  
23 -}  
24 -  
25 -func (listMoneyIncentivesQuery *ListMoneyIncentivesQuery) ValidateQuery() error {  
26 - valid := validation.Validation{}  
27 - b, err := valid.Valid(listMoneyIncentivesQuery)  
28 - if err != nil {  
29 - return err  
30 - }  
31 - if !b {  
32 - for _, validErr := range valid.Errors {  
33 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
34 - }  
35 - }  
36 - return nil  
37 -}  
  1 +package query
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  4 +
  5 +type MoneyIncentiveSelectorQuery struct {
  6 + //操作人
  7 + Operator domain.Operator `json:"-"`
  8 + CooperationContractNumber string `json:"cooperationContractNumber"`
  9 +}
@@ -3,6 +3,7 @@ package service @@ -3,6 +3,7 @@ package service
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/dto"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/query" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/query"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
8 ) 9 )
@@ -25,17 +26,31 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat @@ -25,17 +26,31 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
25 26
26 // 确定预算分红激励 27 // 确定预算分红激励
27 func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.EstimateDividendsIncentivesCommand) (interface{}, error) { 28 func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.EstimateDividendsIncentivesCommand) (interface{}, error) {
28 - // creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(  
29 - // estimateDividendsIncentivesCommand.Operator)  
30 -  
31 - return nil, nil 29 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  30 + estimateDividendsIncentivesCommand.Operator)
  31 + _, err := creationCooperationGateway.DividendsEstimateDividendsIncentives(allied_creation_cooperation.ReqDividendsEstimateDividendsIncentives{
  32 + CooperationContractNumber: estimateDividendsIncentivesCommand.CooperationContractNumber,
  33 + OrderOrReturnedOrderNum: estimateDividendsIncentivesCommand.OrderOrReturnedOrderNum,
  34 + })
  35 + if err != nil {
  36 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  37 + }
  38 + return estimateDividendsIncentivesCommand, nil
32 } 39 }
33 40
34 // 确定预算金额激励分红 41 // 确定预算金额激励分红
35 func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentives(estimateMoneyIncentivesCommand *command.EstimateMoneyIncentivesCommand) (interface{}, error) { 42 func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentives(estimateMoneyIncentivesCommand *command.EstimateMoneyIncentivesCommand) (interface{}, error) {
36 - // creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(  
37 - // estimateMoneyIncentivesCommand.Operator)  
38 - return nil, nil 43 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  44 + estimateMoneyIncentivesCommand.Operator)
  45 + result, err := creationCooperationGateway.DividendsEstimatesEstimateMoneys(allied_creation_cooperation.ReqDividendsEstimateMoneyIncentives{
  46 + CooperationContractNumber: estimateMoneyIncentivesCommand.CooperationContractNumber,
  47 + DividendsIncentivesStage: estimateMoneyIncentivesCommand.DividendsIncentivesStage,
  48 + UndertakerUid: estimateMoneyIncentivesCommand.UndertakerUid,
  49 + })
  50 + if err != nil {
  51 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  52 + }
  53 + return result, nil
39 } 54 }
40 55
41 // 查询分红预算单列表 56 // 查询分红预算单列表
@@ -43,10 +58,8 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat @@ -43,10 +58,8 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
43 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 58 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
44 searchDividendsEstimateQuery.Operator) 59 searchDividendsEstimateQuery.Operator)
45 result, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{ 60 result, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{
46 - //承接人分红预算单号  
47 - DividendsEstimateOrderNumber: searchDividendsEstimateQuery.DividendsEstimateOrderNumber,  
48 - //分红类型,1订单分红,2退货冲销,3金额激励  
49 - DividendsType: searchDividendsEstimateQuery.DividendsType, 61 + DividendsEstimateOrderNumber: searchDividendsEstimateQuery.DividendsEstimateOrderNumber, //承接人分红预算单号
  62 + DividendsType: searchDividendsEstimateQuery.DividendsType, //分红类型,1订单分红,2退货冲销,3金额激励
50 PageNumber: searchDividendsEstimateQuery.PageNumber, 63 PageNumber: searchDividendsEstimateQuery.PageNumber,
51 PageSize: searchDividendsEstimateQuery.PageSize, 64 PageSize: searchDividendsEstimateQuery.PageSize,
52 }) 65 })
@@ -57,7 +70,8 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat @@ -57,7 +70,8 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
57 } 70 }
58 71
59 // 查询业绩分红 72 // 查询业绩分红
60 -func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncentives(searchDividendsIncentivesQuery *query.SearchDividendsIncentivesQuery) (interface{}, error) { 73 +func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncentives(searchDividendsIncentivesQuery *query.SearchDividendsIncentivesQuery) (
  74 + int, interface{}, error) {
61 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 75 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
62 searchDividendsIncentivesQuery.Operator) 76 searchDividendsIncentivesQuery.Operator)
63 result, err := creationCooperationGateway.DividendsEstimateSearchDividends( 77 result, err := creationCooperationGateway.DividendsEstimateSearchDividends(
@@ -68,13 +82,15 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti @@ -68,13 +82,15 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti
68 OrderOrReturnedOrderNum: searchDividendsIncentivesQuery.OrderOrReturnedOrderNum, 82 OrderOrReturnedOrderNum: searchDividendsIncentivesQuery.OrderOrReturnedOrderNum,
69 }) 83 })
70 if err != nil { 84 if err != nil {
71 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 85 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
72 } 86 }
73 - return result, nil 87 + listdata := dto.ToDividendsEstimateDividendItem(result)
  88 + return result.Grid.Total, listdata, nil
74 } 89 }
75 90
76 // 查询金额激励分红 91 // 查询金额激励分红
77 -func (dividendsEmmateService *DividendsEstimateService) SearchMoneyIncentives(searchMoneyIncentivesQuery *query.SearchMoneyIncentivesQuery) (interface{}, error) { 92 +func (dividendsEmmateService *DividendsEstimateService) SearchMoneyIncentives(searchMoneyIncentivesQuery *query.SearchMoneyIncentivesQuery) (
  93 + int, interface{}, error) {
78 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 94 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
79 searchMoneyIncentivesQuery.Operator) 95 searchMoneyIncentivesQuery.Operator)
80 result, err := creationCooperationGateway.DividendsEstimatesSearchMoney(allied_creation_cooperation.ReqDividendsEstimateSearchMoney{ 96 result, err := creationCooperationGateway.DividendsEstimatesSearchMoney(allied_creation_cooperation.ReqDividendsEstimateSearchMoney{
@@ -84,12 +100,63 @@ func (dividendsEmmateService *DividendsEstimateService) SearchMoneyIncentives(se @@ -84,12 +100,63 @@ func (dividendsEmmateService *DividendsEstimateService) SearchMoneyIncentives(se
84 DepartmentName: searchMoneyIncentivesQuery.DepartmentName, 100 DepartmentName: searchMoneyIncentivesQuery.DepartmentName,
85 }) 101 })
86 if err != nil { 102 if err != nil {
87 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 103 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
88 } 104 }
89 - return result, nil 105 + dataList := dto.ToDividendsEstimateMoneyItem(result)
  106 + return result.Grid.Total, dataList, nil
90 } 107 }
91 108
92 func NewDividendsEstimateService(options map[string]interface{}) *DividendsEstimateService { 109 func NewDividendsEstimateService(options map[string]interface{}) *DividendsEstimateService {
93 newDividendsEstimateService := &DividendsEstimateService{} 110 newDividendsEstimateService := &DividendsEstimateService{}
94 return newDividendsEstimateService 111 return newDividendsEstimateService
95 } 112 }
  113 +
  114 +func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(queryParam query.MoneyIncentiveSelectorQuery) (interface{}, error) {
  115 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  116 + queryParam.Operator)
  117 + resultContract, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
  118 + CooperationContractNumber: queryParam.CooperationContractNumber,
  119 + })
  120 + if err != nil {
  121 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  122 + }
  123 + if len(resultContract.Grid.List) == 0 {
  124 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "未找到对应的合约数据")
  125 + }
  126 + contractData := resultContract.Grid.List[0]
  127 + resultDividendsEstimate, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{
  128 + CooperationContractNumber: queryParam.CooperationContractNumber,
  129 + })
  130 + if err != nil {
  131 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  132 + }
  133 + rules := []dto.MoneyIncentivesRule{}
  134 + for _, v := range contractData.MoneyIncentivesRules {
  135 + r := dto.MoneyIncentivesRule{
  136 + MoneyIncentivesStage: v.MoneyIncentivesStage,
  137 + MoneyIncentivesStageStart: int(v.MoneyIncentivesTime.Unix()),
  138 + }
  139 + rules = append(rules, r)
  140 + }
  141 + contractUndertaker := []dto.ContractUndertaker{}
  142 + for _, v := range contractData.Undertakers {
  143 +
  144 + ruleStage := []int{}
  145 + for _, vv := range resultDividendsEstimate.Grid.List {
  146 + if v.UserId == vv.DividendsUser.UserId {
  147 + ruleStage = append(ruleStage, vv.DividendsIncentivesStage)
  148 + }
  149 + }
  150 + temp := dto.ContractUndertaker{
  151 + UserId: v.UserId,
  152 + UsersName: v.UserName,
  153 + ContractIncentivesRules: ruleStage,
  154 + }
  155 + contractUndertaker = append(contractUndertaker, temp)
  156 + }
  157 + data := map[string]interface{}{
  158 + "contractUndertaker": contractUndertaker,
  159 + "moneyIncentivesRule": rules,
  160 + }
  161 + return data, nil
  162 +}
@@ -10,37 +10,6 @@ import ( @@ -10,37 +10,6 @@ import (
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
11 ) 11 )
12 12
13 -// CreditAccountCreate 创建账期结算单  
14 -func (gateway HttplibAlliedCreationCooperation) CreditAccountCreate(param ReqCreditAccountCreate) (*DataCreditAccountCreate, error) {  
15 - url := gateway.baseUrL + "/credit-accounts"  
16 - method := "POST"  
17 - req := gateway.CreateRequest(url, method)  
18 - log.Logger.Debug("向业务模块请求数据:创建账期结算单。", map[string]interface{}{  
19 - "api": method + ":" + url,  
20 - "param": param,  
21 - })  
22 - req, err := req.JSONBody(param)  
23 - if err != nil {  
24 - return nil, fmt.Errorf("请求创建账期结算单失败:%w", err)  
25 - }  
26 -  
27 - byteResult, err := req.Bytes()  
28 - if err != nil {  
29 - return nil, fmt.Errorf("获取创建账期结算单失败:%w", err)  
30 - }  
31 - log.Logger.Debug("获取业务模块请求数据:创建账期结算单。", map[string]interface{}{  
32 - "result": string(byteResult),  
33 - })  
34 - var result service_gateway.GatewayResponse  
35 - err = json.Unmarshal(byteResult, &result)  
36 - if err != nil {  
37 - return nil, fmt.Errorf("解析创建账期结算单:%w", err)  
38 - }  
39 - var data DataCreditAccountCreate  
40 - err = gateway.GetResponseData(result, &data)  
41 - return &data, err  
42 -}  
43 -  
44 // Credit-accountsPay 支付账期结算 13 // Credit-accountsPay 支付账期结算
45 func (gateway HttplibAlliedCreationCooperation) CreditAccountsPay(param ReqCreditAccountsPay) (*DataCreditAccountsPay, error) { 14 func (gateway HttplibAlliedCreationCooperation) CreditAccountsPay(param ReqCreditAccountsPay) (*DataCreditAccountsPay, error) {
46 url := gateway.baseUrL + "/credit-accounts/pay" 15 url := gateway.baseUrL + "/credit-accounts/pay"
@@ -72,37 +41,6 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountsPay(param ReqCredi @@ -72,37 +41,6 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountsPay(param ReqCredi
72 return &data, err 41 return &data, err
73 } 42 }
74 43
75 -// Credit-accounts[creditAccountId} 更新账期结算单  
76 -func (gateway HttplibAlliedCreationCooperation) CreditAccountUpdate(param ReqCreditAccountUpdate) (*DataCreditAccountUpdate, error) {  
77 - url := gateway.baseUrL + "/credit-accounts/{creditAccountId}"  
78 - method := "PUT"  
79 - req := gateway.CreateRequest(url, method)  
80 - log.Logger.Debug("向业务模块请求数据:更新账期结算单。", map[string]interface{}{  
81 - "api": method + ":" + url,  
82 - "param": param,  
83 - })  
84 - req, err := req.JSONBody(param)  
85 - if err != nil {  
86 - return nil, fmt.Errorf("请求更新账期结算单失败:%w", err)  
87 - }  
88 -  
89 - byteResult, err := req.Bytes()  
90 - if err != nil {  
91 - return nil, fmt.Errorf("获取更新账期结算单失败:%w", err)  
92 - }  
93 - log.Logger.Debug("获取业务模块请求数据:更新账期结算单。", map[string]interface{}{  
94 - "result": string(byteResult),  
95 - })  
96 - var result service_gateway.GatewayResponse  
97 - err = json.Unmarshal(byteResult, &result)  
98 - if err != nil {  
99 - return nil, fmt.Errorf("解析更新账期结算单:%w", err)  
100 - }  
101 - var data DataCreditAccountUpdate  
102 - err = gateway.GetResponseData(result, &data)  
103 - return &data, err  
104 -}  
105 -  
106 // Credit-accountsSearch 查询账期结算单 44 // Credit-accountsSearch 查询账期结算单
107 func (gateway HttplibAlliedCreationCooperation) CreditAccountsSearch(param ReqCreditAccountsSearch) (*DataCreditAccountsSearch, error) { 45 func (gateway HttplibAlliedCreationCooperation) CreditAccountsSearch(param ReqCreditAccountsSearch) (*DataCreditAccountsSearch, error) {
108 url := gateway.baseUrL + "/credit-accounts/search" 46 url := gateway.baseUrL + "/credit-accounts/search"
@@ -9,37 +9,6 @@ import ( @@ -9,37 +9,6 @@ import (
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
10 ) 10 )
11 11
12 -// DividendsEstimateUpdate 更新分红预算  
13 -// func (gateway HttplibAlliedCreationCooperation) DividendsEstimateUpdate(param ReqDividendsEstimateUpdate) (*DataDividendsEstimateUpdate, error) {  
14 -// url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"  
15 -// method := "PUT"  
16 -// req := gateway.CreateRequest(url, method)  
17 -// log.Logger.Debug("向业务模块请求数据:更新分红预算。", map[string]interface{}{  
18 -// "api": method + ":" + url,  
19 -// "param": param,  
20 -// })  
21 -// req, err := req.JSONBody(param)  
22 -// if err != nil {  
23 -// return nil, fmt.Errorf("请求更新分红预算失败:%w", err)  
24 -// }  
25 -  
26 -// byteResult, err := req.Bytes()  
27 -// if err != nil {  
28 -// return nil, fmt.Errorf("获取更新分红预算失败:%w", err)  
29 -// }  
30 -// log.Logger.Debug("获取业务模块请求数据:更新分红预算。", map[string]interface{}{  
31 -// "result": string(byteResult),  
32 -// })  
33 -// var result service_gateway.GatewayResponse  
34 -// err = json.Unmarshal(byteResult, &result)  
35 -// if err != nil {  
36 -// return nil, fmt.Errorf("解析更新分红预算:%w", err)  
37 -// }  
38 -// var data DataDividendsEstimateUpdate  
39 -// err = gateway.GetResponseData(result, &data)  
40 -// return &data, err  
41 -// }  
42 -  
43 // Dividends-estimatesSearch-dividends-incentives 查询业绩分红 12 // Dividends-estimatesSearch-dividends-incentives 查询业绩分红
44 func (gateway HttplibAlliedCreationCooperation) DividendsEstimateSearchDividends(param ReqDividendsEstimateSearchDividend) (*DataDividendsEstimateSearchDividend, error) { 13 func (gateway HttplibAlliedCreationCooperation) DividendsEstimateSearchDividends(param ReqDividendsEstimateSearchDividend) (*DataDividendsEstimateSearchDividend, error) {
45 url := gateway.baseUrL + "/dividends-estimates/search-dividends-incentives" 14 url := gateway.baseUrL + "/dividends-estimates/search-dividends-incentives"
@@ -195,157 +164,64 @@ func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesEstimateMoneys @@ -195,157 +164,64 @@ func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesEstimateMoneys
195 return &data, err 164 return &data, err
196 } 165 }
197 166
198 -// DividendsEstimateListDividend 返回业绩激励分红详情  
199 -func (gateway HttplibAlliedCreationCooperation) DividendsEstimateListDividend(param ReqDividendsEstimateListDividend) (*DataDividendsEstimateListDividend, error) {  
200 - url := gateway.baseUrL + "/dividends-estimates/list-dividends-incentives"  
201 - method := "GET"  
202 - req := gateway.CreateRequest(url, method)  
203 - log.Logger.Debug("向业务模块请求数据:返回业绩激励分红详情。", map[string]interface{}{  
204 - "api": method + ":" + url,  
205 - "param": param,  
206 - })  
207 - req, err := req.JSONBody(param)  
208 - if err != nil {  
209 - return nil, fmt.Errorf("请求返回业绩激励分红详情失败:%w", err)  
210 - }  
211 -  
212 - byteResult, err := req.Bytes()  
213 - if err != nil {  
214 - return nil, fmt.Errorf("获取返回业绩激励分红详情失败:%w", err)  
215 - }  
216 - log.Logger.Debug("获取业务模块请求数据:返回业绩激励分红详情。", map[string]interface{}{  
217 - "result": string(byteResult),  
218 - })  
219 - var result service_gateway.GatewayResponse  
220 - err = json.Unmarshal(byteResult, &result)  
221 - if err != nil {  
222 - return nil, fmt.Errorf("解析返回业绩激励分红详情:%w", err)  
223 - }  
224 - var data DataDividendsEstimateListDividend  
225 - err = gateway.GetResponseData(result, &data)  
226 - return &data, err  
227 -}  
228 -  
229 -// DividendsEstimateList 返回分红预算列表  
230 -func (gateway HttplibAlliedCreationCooperation) DividendsEstimateList(param ReqDividendsEstimateList) (*DataDividendsEstimateList, error) {  
231 - url := gateway.baseUrL + "/dividends-estimates"  
232 - method := "GET"  
233 - req := gateway.CreateRequest(url, method)  
234 - log.Logger.Debug("向业务模块请求数据:返回分红预算列表。", map[string]interface{}{  
235 - "api": method + ":" + url,  
236 - "param": param,  
237 - })  
238 - req, err := req.JSONBody(param)  
239 - if err != nil {  
240 - return nil, fmt.Errorf("请求返回分红预算列表失败:%w", err)  
241 - }  
242 -  
243 - byteResult, err := req.Bytes()  
244 - if err != nil {  
245 - return nil, fmt.Errorf("获取返回分红预算列表失败:%w", err)  
246 - }  
247 - log.Logger.Debug("获取业务模块请求数据:返回分红预算列表。", map[string]interface{}{  
248 - "result": string(byteResult),  
249 - })  
250 - var result service_gateway.GatewayResponse  
251 - err = json.Unmarshal(byteResult, &result)  
252 - if err != nil {  
253 - return nil, fmt.Errorf("解析返回分红预算列表:%w", err)  
254 - }  
255 - var data DataDividendsEstimateList  
256 - err = gateway.GetResponseData(result, &data)  
257 - return &data, err  
258 -}  
259 -  
260 -//DividendsEstimateGet 返回分红预算详情  
261 -func (gateway HttplibAlliedCreationCooperation) DividendsEstimateGet(param ReqDividendsEstimateGet) (*DataDividendsEstimateGet, error) {  
262 - url := gateway.baseUrL + "/dividends-estimates/" + strconv.Itoa(param.DividendsEstimateId)  
263 - method := "GET"  
264 - req := gateway.CreateRequest(url, method)  
265 - log.Logger.Debug("向业务模块请求数据:返回分红预算详情。", map[string]interface{}{  
266 - "api": method + ":" + url,  
267 - "param": param,  
268 - })  
269 - req, err := req.JSONBody(param)  
270 - if err != nil {  
271 - return nil, fmt.Errorf("请求返回分红预算详情失败:%w", err)  
272 - }  
273 -  
274 - byteResult, err := req.Bytes()  
275 - if err != nil {  
276 - return nil, fmt.Errorf("获取返回分红预算详情失败:%w", err)  
277 - }  
278 - log.Logger.Debug("获取业务模块请求数据:返回分红预算详情。", map[string]interface{}{  
279 - "result": string(byteResult),  
280 - })  
281 - var result service_gateway.GatewayResponse  
282 - err = json.Unmarshal(byteResult, &result)  
283 - if err != nil {  
284 - return nil, fmt.Errorf("解析返回分红预算详情:%w", err)  
285 - }  
286 - var data DataDividendsEstimateGet  
287 - err = gateway.GetResponseData(result, &data)  
288 - return &data, err  
289 -}  
290 -  
291 -// DividendsEstimatesListMoney 返回金额激励分红列表  
292 -func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesListMoney(param ReqDividendsEstimatesListMoney) (*DataDividendsEstimatesListMoney, error) {  
293 - url := gateway.baseUrL + "/dividends-estimates/list-money-incentives"  
294 - method := "GET" 167 +// DividendsEstimatesBatchCancel 批量取消分红预算
  168 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesBatchCancel(param ReqDividendsEstimateBatchCancel) (*DataDividendsEstimateBatchCancel, error) {
  169 + url := gateway.baseUrL + "/dividends-estimates/batch-cancel"
  170 + method := "POST"
295 req := gateway.CreateRequest(url, method) 171 req := gateway.CreateRequest(url, method)
296 - log.Logger.Debug("向业务模块请求数据:返回金额激励分红列表。", map[string]interface{}{ 172 + log.Logger.Debug("向业务模块请求数据:批量取消分红预算。", map[string]interface{}{
297 "api": method + ":" + url, 173 "api": method + ":" + url,
298 "param": param, 174 "param": param,
299 }) 175 })
300 req, err := req.JSONBody(param) 176 req, err := req.JSONBody(param)
301 if err != nil { 177 if err != nil {
302 - return nil, fmt.Errorf("请求返回金额激励分红列表失败:%w", err) 178 + return nil, fmt.Errorf("请求批量取消分红预算失败:%w", err)
303 } 179 }
304 180
305 byteResult, err := req.Bytes() 181 byteResult, err := req.Bytes()
306 if err != nil { 182 if err != nil {
307 - return nil, fmt.Errorf("获取返回金额激励分红列表失败:%w", err) 183 + return nil, fmt.Errorf("获取批量取消分红预算失败:%w", err)
308 } 184 }
309 - log.Logger.Debug("获取业务模块请求数据:返回金额激励分红列表。", map[string]interface{}{ 185 + log.Logger.Debug("获取业务模块请求数据:批量取消分红预算。", map[string]interface{}{
310 "result": string(byteResult), 186 "result": string(byteResult),
311 }) 187 })
312 var result service_gateway.GatewayResponse 188 var result service_gateway.GatewayResponse
313 err = json.Unmarshal(byteResult, &result) 189 err = json.Unmarshal(byteResult, &result)
314 if err != nil { 190 if err != nil {
315 - return nil, fmt.Errorf("解析返回金额激励分红列表:%w", err) 191 + return nil, fmt.Errorf("解析批量取消分红预算:%w", err)
316 } 192 }
317 - var data DataDividendsEstimatesListMoney 193 + var data DataDividendsEstimateBatchCancel
318 err = gateway.GetResponseData(result, &data) 194 err = gateway.GetResponseData(result, &data)
319 return &data, err 195 return &data, err
320 } 196 }
321 197
322 -// DividendsEstimatesBatchCancel 批量取消分红预算  
323 -func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesBatchCancel(param ReqDividendsEstimateBatchCancel) (*DataDividendsEstimateBatchCancel, error) {  
324 - url := gateway.baseUrL + "/dividends-estimates/batch-cancel" 198 +// DividendsEstimatesEstimateMoneys 确定业绩分红激励
  199 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimateDividendsIncentives(param ReqDividendsEstimateDividendsIncentives) (*DataDividendsEstimateDividendsIncentives, error) {
  200 + url := gateway.baseUrL + "/dividends-estimates/estimate-dividends-incentives"
325 method := "POST" 201 method := "POST"
326 req := gateway.CreateRequest(url, method) 202 req := gateway.CreateRequest(url, method)
327 - log.Logger.Debug("向业务模块请求数据:批量取消分红预算。", map[string]interface{}{ 203 + log.Logger.Debug("向业务模块请求数据:确定预算分红激励。", map[string]interface{}{
328 "api": method + ":" + url, 204 "api": method + ":" + url,
329 "param": param, 205 "param": param,
330 }) 206 })
331 req, err := req.JSONBody(param) 207 req, err := req.JSONBody(param)
332 if err != nil { 208 if err != nil {
333 - return nil, fmt.Errorf("请求批量取消分红预算失败:%w", err) 209 + return nil, fmt.Errorf("请求确定预算分红激励失败:%w", err)
334 } 210 }
335 211
336 byteResult, err := req.Bytes() 212 byteResult, err := req.Bytes()
337 if err != nil { 213 if err != nil {
338 - return nil, fmt.Errorf("获取批量取消分红预算失败:%w", err) 214 + return nil, fmt.Errorf("获取确定预算分红激励失败:%w", err)
339 } 215 }
340 - log.Logger.Debug("获取业务模块请求数据:批量取消分红预算。", map[string]interface{}{ 216 + log.Logger.Debug("获取业务模块请求数据:确定预算分红激励。", map[string]interface{}{
341 "result": string(byteResult), 217 "result": string(byteResult),
342 }) 218 })
343 var result service_gateway.GatewayResponse 219 var result service_gateway.GatewayResponse
344 err = json.Unmarshal(byteResult, &result) 220 err = json.Unmarshal(byteResult, &result)
345 if err != nil { 221 if err != nil {
346 - return nil, fmt.Errorf("解析批量取消分红预算:%w", err) 222 + return nil, fmt.Errorf("解析确定预算分红激励:%w", err)
347 } 223 }
348 - var data DataDividendsEstimateBatchCancel 224 + var data DataDividendsEstimateDividendsIncentives
349 err = gateway.GetResponseData(result, &data) 225 err = gateway.GetResponseData(result, &data)
350 return &data, err 226 return &data, err
351 } 227 }
@@ -200,6 +200,8 @@ type ( @@ -200,6 +200,8 @@ type (
200 PageNumber int `json:"pageNumber"` 200 PageNumber int `json:"pageNumber"`
201 // 查询限制 201 // 查询限制
202 PageSize int `json:"pageSize"` 202 PageSize int `json:"pageSize"`
  203 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
  204 + SponsorName string `json:"sponsorName"` //发起人名字
203 } 205 }
204 206
205 DataCooperationContractSearch struct { 207 DataCooperationContractSearch struct {
@@ -7,7 +7,7 @@ import ( @@ -7,7 +7,7 @@ import (
7 ) 7 )
8 8
9 type CreditAccount struct { 9 type CreditAccount struct {
10 - CreditAccountId int64 `json:"creditAccountId,string"` // 账期结算单ID 10 + CreditAccountId int `json:"creditAccountId,string,"` // 账期结算单ID
11 ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 账期结算实付金额 11 ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 账期结算实付金额
12 CreditAccountOrderNum string `json:"creditAccountOrderNum"` // 账期结算单号 12 CreditAccountOrderNum string `json:"creditAccountOrderNum"` // 账期结算单号
13 PaymentStatus int `json:"paymentStatus"` // 账期结算支付状态,1待支付,2已支付 13 PaymentStatus int `json:"paymentStatus"` // 账期结算支付状态,1待支付,2已支付
@@ -15,46 +15,35 @@ type CreditAccount struct { @@ -15,46 +15,35 @@ type CreditAccount struct {
15 SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额 15 SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额
16 SettlementTime time.Time `json:"settlementTime"` // 共创账期结算时间 16 SettlementTime time.Time `json:"settlementTime"` // 共创账期结算时间
17 CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号 17 CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号
18 - // 参与人uid,包括承接人、推荐人、关联业务员  
19 Participator struct { 18 Participator struct {
20 - UserId int64 `json:"userId,string"` // 用户ID,  
21 - UserBaseId int64 `json:"userBaseId,string"` // 用户基本id  
22 - Org domain.Org `json:"org"` // 用户所属的组织机构  
23 - Department domain.Department `json:"department"` // 用户所属的部门 19 + UserId int `json:"userId,string,"` // 用户ID,
  20 + UserBaseId int `json:"userBaseId,string,"` // 用户基本id
  21 + // Org domain.Org `json:"org"` // 用户所属的组织机构
  22 + // Department domain.Department `json:"department"` // 用户所属的部门
24 UserInfo domain.UserInfo `json:"userInfo"` // 23 UserInfo domain.UserInfo `json:"userInfo"` //
25 UserName string `json:"userName"` // 用户姓名 24 UserName string `json:"userName"` // 用户姓名
26 UserPhone string `json:"userPhone"` // 用户手机号 25 UserPhone string `json:"userPhone"` // 用户手机号
27 - UserType int32 `json:"userType"` // 用户类型,1员工,2共创用户,3公开  
28 - Status int32 `json:"status"` // 状态  
29 - } `json:"participator"`  
30 - // 参与类型  
31 - ParticipateType string `json:"participateType"`  
32 - // 支付凭证附件  
33 - PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"`  
34 - // 数据所属组织机构  
35 - Org domain.Org `json:"org"`  
36 - // 公司  
37 - Company domain.CompanyData `json:"company"`  
38 - // 创建时间  
39 - CreatedAt time.Time `json:"createdAt"`  
40 - // 更新时间  
41 - UpdatedAt time.Time `json:"updatedAt"` 26 + UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开
  27 + Status int `json:"status"` // 状态
  28 + } `json:"participator"` // 参与人
  29 + ParticipateType string `json:"participateType"` // 参与类型
  30 + PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件
  31 + Org domain.Org `json:"org"` // 数据所属组织机构
  32 + Company domain.CompanyData `json:"company"` // 公司
  33 + CreatedAt time.Time `json:"createdAt"` // 创建时间
  34 + UpdatedAt time.Time `json:"updatedAt"` // 更新时间
  35 + AccountDetail []struct {
  36 + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
  37 + DividendsType string `json:"dividendsType"`
  38 + DividendsAmount float64 `json:"dividendsAmount"`
  39 + } `json:"accountDetail"` //结算明细
42 } 40 }
43 41
44 -//创建账期结算单  
45 -type (  
46 - ReqCreditAccountCreate struct {  
47 - }  
48 -  
49 - DataCreditAccountCreate struct {  
50 - }  
51 -)  
52 -  
53 //支付账期结算 42 //支付账期结算
54 type ( 43 type (
55 ReqCreditAccountsPay struct { 44 ReqCreditAccountsPay struct {
56 CreditAccountId int `json:"creditAccountId"` 45 CreditAccountId int `json:"creditAccountId"`
57 - ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` 46 + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际支付金额
58 Remarks string `json:"remarks"` 47 Remarks string `json:"remarks"`
59 Attachment domain.Attachment `json:"attachment"` //附件 48 Attachment domain.Attachment `json:"attachment"` //附件
60 } 49 }
@@ -63,15 +52,6 @@ type ( @@ -63,15 +52,6 @@ type (
63 } 52 }
64 ) 53 )
65 54
66 -//更新账期结算单  
67 -type (  
68 - ReqCreditAccountUpdate struct {  
69 - }  
70 -  
71 - DataCreditAccountUpdate struct {  
72 - }  
73 -)  
74 -  
75 //查询账期结算单 55 //查询账期结算单
76 type ( 56 type (
77 ReqCreditAccountsSearch struct { 57 ReqCreditAccountsSearch struct {
@@ -7,16 +7,25 @@ type ( @@ -7,16 +7,25 @@ type (
7 ReqDividendsEstimateSearchDividend struct { 7 ReqDividendsEstimateSearchDividend struct {
8 PageNumber int `json:"pageNumber"` 8 PageNumber int `json:"pageNumber"`
9 PageSize int `json:"pageSize"` 9 PageSize int `json:"pageSize"`
10 - //合约编号  
11 - CooperationContractNumber string `json:"cooperationContractNumber"`  
12 - //分红订单号/退货单号  
13 - OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` 10 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
  11 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号/退货单号
14 } 12 }
15 13
16 DataDividendsEstimateSearchDividend struct { 14 DataDividendsEstimateSearchDividend struct {
17 Grid struct { 15 Grid struct {
18 Total int `json:"total"` 16 Total int `json:"total"`
19 - List []struct{} `json:"list"` 17 + List []struct {
  18 + CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号
  19 + CustomerName string `json:"customerName"` //客户名称
  20 + DividendsIncentivesAmount int `json:"dividendsIncentivesAmount"` //业绩激励分红金额
  21 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号
  22 + OrderTime time.Time `json:"orderTime"` //订单/退货单日期
  23 + OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
  24 + Region struct {
  25 + RegionName string `json:"regionName"` //区域名称
  26 + RegionNumber string `json:"regionNumber"` //区域编码
  27 + } `json:"region"`
  28 + } `json:"list"`
20 } `json:"grid"` 29 } `json:"grid"`
21 } 30 }
22 ) 31 )
@@ -26,6 +35,7 @@ type ( @@ -26,6 +35,7 @@ type (
26 ReqDividendsEstimateSearch struct { 35 ReqDividendsEstimateSearch struct {
27 //承接人分红预算单号 36 //承接人分红预算单号
28 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 37 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
  38 + CooperationContractNumber string `json:"orderOrReturnedOrderNum"` //合约编号
29 //分红类型,1订单分红,2退货冲销,3金额激励 39 //分红类型,1订单分红,2退货冲销,3金额激励
30 DividendsType int `json:"dividendsType"` 40 DividendsType int `json:"dividendsType"`
31 PageNumber int `json:"pageNumber"` 41 PageNumber int `json:"pageNumber"`
@@ -45,6 +55,7 @@ type ( @@ -45,6 +55,7 @@ type (
45 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励 55 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
46 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号 56 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
47 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号, 57 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
  58 + DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段
48 DividendsUser struct { 59 DividendsUser struct {
49 UserId int `json:"userId,string,"` // 用户ID, 60 UserId int `json:"userId,string,"` // 用户ID,
50 UserBaseId int `json:"userBaseId,string,"` // 用户基本id 61 UserBaseId int `json:"userBaseId,string,"` // 用户基本id
@@ -83,6 +94,7 @@ type ( @@ -83,6 +94,7 @@ type (
83 List []struct { 94 List []struct {
84 CooperationContractName string `json:"cooperationContractName"` //合约名称 95 CooperationContractName string `json:"cooperationContractName"` //合约名称
85 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码 96 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码
  97 + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` //订单编号
86 CooperationMode struct { 98 CooperationMode struct {
87 CooperationModeId int `json:"cooperationModeId"` 99 CooperationModeId int `json:"cooperationModeId"`
88 CooperationModeName string `json:"cooperationModeName"` 100 CooperationModeName string `json:"cooperationModeName"`
@@ -95,10 +107,11 @@ type ( @@ -95,10 +107,11 @@ type (
95 } `json:"department"` //发起部门 107 } `json:"department"` //发起部门
96 CooperationContractSponsor struct { 108 CooperationContractSponsor struct {
97 UserId int `json:"userId"` 109 UserId int `json:"userId"`
  110 + UserBaseId int `json:"userBaseId"`
98 UserInfo struct { 111 UserInfo struct {
99 UsersName string `json:"userName"` 112 UsersName string `json:"userName"`
100 Phone string `json:"phone"` 113 Phone string `json:"phone"`
101 - UsersId int `json:"userId,string"` 114 + UsersId int `json:"userId,string,"`
102 UserCode string `json:"userCode"` 115 UserCode string `json:"userCode"`
103 } `json:"userInfo"` 116 } `json:"userInfo"`
104 } `json:"cooperationContractSponsor"` //合约发起人 117 } `json:"cooperationContractSponsor"` //合约发起人
@@ -121,36 +134,15 @@ type ( @@ -121,36 +134,15 @@ type (
121 type ( 134 type (
122 ReqDividendsEstimateMoneyIncentives struct { 135 ReqDividendsEstimateMoneyIncentives struct {
123 //合约编码 136 //合约编码
124 - CooperationContractNumber string  
125 - // 137 + CooperationContractNumber string `json:"cooperationContractNumber"`
  138 + DividendsIncentivesStage int `json:"dividendsIncentivesStage"`
  139 + UndertakerUid string `json:"undertakerUid"`
126 } 140 }
127 141
128 DataDividendsEstimateMoneyIncentives struct { 142 DataDividendsEstimateMoneyIncentives struct {
129 } 143 }
130 ) 144 )
131 145
132 -//返回业绩激励分红详情  
133 -type (  
134 - ReqDividendsEstimateListDividend struct {  
135 - }  
136 -  
137 - DataDividendsEstimateListDividend struct {  
138 - }  
139 -)  
140 -  
141 -//返回分红预算列表  
142 -type (  
143 - ReqDividendsEstimateList struct {  
144 - }  
145 -  
146 - DataDividendsEstimateList struct {  
147 - Grid struct {  
148 - Total int  
149 - List []struct{}  
150 - }  
151 - }  
152 -)  
153 -  
154 //返回分红预算详情 146 //返回分红预算详情
155 type ( 147 type (
156 ReqDividendsEstimateGet struct { 148 ReqDividendsEstimateGet struct {
@@ -186,25 +178,24 @@ type ( @@ -186,25 +178,24 @@ type (
186 } 178 }
187 ) 179 )
188 180
189 -//返回金额激励分红列表 181 +//批量取消分红预算
190 type ( 182 type (
191 - ReqDividendsEstimatesListMoney struct { 183 + ReqDividendsEstimateBatchCancel struct {
  184 + DividendsEstimateIds []string `json:"dividendsEstimateIds"`
192 } 185 }
193 186
194 - DataDividendsEstimatesListMoney struct {  
195 - Grid struct {  
196 - Total int `json:"total"`  
197 - List []struct{} `json:"list"`  
198 - } `json:"grid"` 187 + DataDividendsEstimateBatchCancel struct {
199 } 188 }
200 ) 189 )
201 190
202 -//取消分红预算 191 +// DividendsEstimateDividendsIncentives
  192 +//确定业绩分红激励
203 type ( 193 type (
204 - ReqDividendsEstimateBatchCancel struct {  
205 - DividendsEstimateIds []string `json:"dividendsEstimateIds"` 194 + ReqDividendsEstimateDividendsIncentives struct {
  195 + CooperationContractNumber string `json:"cooperationContractNumber"`
  196 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
206 } 197 }
207 198
208 - DataDividendsEstimateBatchCancel struct { 199 + DataDividendsEstimateDividendsIncentives struct {
209 } 200 }
210 ) 201 )
@@ -46,8 +46,8 @@ func (controller *DividendsEstimateController) SearchDividendsIncentives() { @@ -46,8 +46,8 @@ func (controller *DividendsEstimateController) SearchDividendsIncentives() {
46 log.Logger.Debug("json err:" + err.Error()) 46 log.Logger.Debug("json err:" + err.Error())
47 } 47 }
48 searchDividendsIncentivesQuery.Operator = controller.GetOperator() 48 searchDividendsIncentivesQuery.Operator = controller.GetOperator()
49 - data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery)  
50 - controller.Response(data, err) 49 + cnt, data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery)
  50 + controller.ReturnPageListData(int64(cnt), data, err, searchDividendsIncentivesQuery.PageNumber)
51 } 51 }
52 52
53 //SearchMoneyIncentives 查询金额激励分红 53 //SearchMoneyIncentives 查询金额激励分红
@@ -59,8 +59,8 @@ func (controller *DividendsEstimateController) SearchMoneyIncentives() { @@ -59,8 +59,8 @@ func (controller *DividendsEstimateController) SearchMoneyIncentives() {
59 log.Logger.Debug("json err:" + err.Error()) 59 log.Logger.Debug("json err:" + err.Error())
60 } 60 }
61 searchMoneyIncentivesQuery.Operator = controller.GetOperator() 61 searchMoneyIncentivesQuery.Operator = controller.GetOperator()
62 - data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery)  
63 - controller.Response(data, err) 62 + cnt, data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery)
  63 + controller.ReturnPageListData(int64(cnt), data, err, searchMoneyIncentivesQuery.PageNumber)
64 } 64 }
65 65
66 //EstimateMoneyIncentives 确定预算金额激励分红 66 //EstimateMoneyIncentives 确定预算金额激励分红