作者 tangxuhui

日常存档

@@ -62,7 +62,7 @@ func (srv UserService) ChangePassword(changePasswordCommand *command.ChangePassw @@ -62,7 +62,7 @@ func (srv UserService) ChangePassword(changePasswordCommand *command.ChangePassw
62 if err != nil { 62 if err != nil {
63 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 63 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
64 } 64 }
65 - return struct{}{}, nil 65 + return changePasswordCommand, nil
66 } 66 }
67 67
68 //ChangePhone 修改手机号 68 //ChangePhone 修改手机号
@@ -82,7 +82,7 @@ func (srv UserService) ChangePhone(resetPhoneCommand *command.ResetPhoneCommand) @@ -82,7 +82,7 @@ func (srv UserService) ChangePhone(resetPhoneCommand *command.ResetPhoneCommand)
82 if err != nil { 82 if err != nil {
83 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 83 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
84 } 84 }
85 - return struct{}{}, nil 85 + return resetPhoneCommand, nil
86 } 86 }
87 87
88 //UpdateUserBaseInfo 更新用户信息 88 //UpdateUserBaseInfo 更新用户信息
@@ -5,13 +5,70 @@ import ( @@ -5,13 +5,70 @@ import (
5 5
6 "github.com/beego/beego/v2/core/validation" 6 "github.com/beego/beego/v2/core/validation"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"  
9 ) 8 )
10 9
11 type CreateCooperationContractCommand struct { 10 type CreateCooperationContractCommand struct {
12 //操作人 11 //操作人
13 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
14 - allied_creation_cooperation.ReqCooperationContractAdd 13 + // 共创合约描述
  14 + CooperationContractDescription string `json:"cooperationContractDescription"`
  15 + // 共创合约编号
  16 + CooperationContractNumber string `json:"cooperationContractNumber"`
  17 + // 共创项目编号,
  18 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
  19 + // 共创合约发起部门id
  20 + DepartmentId string `json:"departmentId"`
  21 + // 共创合约承接对象,1员工,2共创用户,3公开
  22 + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`
  23 + // 共创合约名称
  24 + CooperationContractName string `json:"cooperationContractName"`
  25 + // 共创模式编码,
  26 + CooperationModeNumber string `json:"cooperationModeNumber"`
  27 + // 共创合约发起人uid
  28 + SponsorUid string `json:"sponsorUid"`
  29 + // 业绩分红激励规则列表
  30 + DividendsIncentivesRules []struct {
  31 + // 关联的项目合约编号
  32 + CooperationContractNumber string `json:"cooperationContractNumber"`
  33 + // 推荐人抽成比例
  34 + ReferrerPercentage float64 `json:"referrerPercentage"`
  35 + // 业务员抽成比例
  36 + SalesmanPercentage float64 `json:"salesmanPercentage"`
  37 + // 分红规则激励百分点
  38 + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"`
  39 + // 分红规则激励阶段,
  40 + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string"`
  41 + // 分红规则激励阶段结束
  42 + DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"`
  43 + // 分红规则激励阶段开始
  44 + DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"`
  45 + } `json:"dividendsIncentivesRules"`
  46 + // 金额激励规则列表
  47 + MoneyIncentivesRules []struct {
  48 + // 金额激励规则ID
  49 + MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string"`
  50 + // 关联的共创合约编号
  51 + CooperationContractNumber string `json:"cooperationContractNumber"`
  52 + // 激励金额
  53 + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"`
  54 + // 金额激励阶段
  55 + MoneyIncentivesStage int `json:"moneyIncentivesStage"`
  56 + // 金额激励规则时间
  57 + MoneyIncentivesTime int `json:"moneyIncentivesTime"`
  58 + // 推荐人抽成比例
  59 + ReferrerPercentage float64 `json:"referrerPercentage"`
  60 + // 业务员抽成比例
  61 + SalesmanPercentage float64 `json:"salesmanPercentage"`
  62 + } `json:"moneyIncentivesRules"`
  63 + // 承接方列表
  64 + Undertakers []struct {
  65 + UndertakerId string `json:"undertakerId"` //承接人用户id
  66 + RerferrerId string `json:"rerferrerId"` //推荐人用户id
  67 + SalesmanId string `json:"salesmanId"` //关联业务员id
  68 + Attachment domain.Attachment `json:"attachment"`
  69 + } `json:"undertakers"`
  70 + //关联业务员
  71 + RelevantIds []string `json:"relevantIds"`
15 } 72 }
16 73
17 func (createCooperationContractCommand *CreateCooperationContractCommand) Valid(validation *validation.Validation) { 74 func (createCooperationContractCommand *CreateCooperationContractCommand) Valid(validation *validation.Validation) {
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "time"
  5 +
4 "github.com/linmadan/egglib-go/core/application" 6 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query"
@@ -17,7 +19,23 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -17,7 +19,23 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
17 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 19 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
18 } 20 }
19 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationContractCommand.Operator) 21 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationContractCommand.Operator)
20 - _, err := creationCooperationGateway.CooperationContractAdd(createCooperationContractCommand.ReqCooperationContractAdd) 22 +
  23 + rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
  24 + for _, v := range createCooperationContractCommand.DividendsIncentivesRules {
  25 + r := allied_creation_cooperation.DividendsIncentivesRule{
  26 + CooperationContractNumber: v.CooperationContractNumber,
  27 + ReferrerPercentage: v.ReferrerPercentage,
  28 + SalesmanPercentage: v.SalesmanPercentage,
  29 + DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
  30 + DividendsIncentivesStage: v.DividendsIncentivesStage,
  31 + DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd), 0),
  32 + DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart), 0),
  33 + }
  34 + rules1 = append(rules1, r)
  35 + }
  36 + // rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}
  37 +
  38 + _, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{})
21 if err != nil { 39 if err != nil {
22 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 40 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
23 } 41 }
@@ -16,18 +16,12 @@ type UpdateDividendsOrderCommand struct { @@ -16,18 +16,12 @@ type UpdateDividendsOrderCommand struct {
16 CustomerName string `json:"customerName" valid:"Required"` 16 CustomerName string `json:"customerName" valid:"Required"`
17 //分红订单金额 17 //分红订单金额
18 DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"` 18 DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"`
19 - //分红订单号  
20 - DividendsOrderNumber string `json:"dividendsOrderNumber" valid:"Required"`  
21 //分红订单原单号 19 //分红订单原单号
22 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"` 20 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"`
23 //订单产生时间 21 //订单产生时间
24 OrderTime int64 `json:"orderTime" valid:"Required"` 22 OrderTime int64 `json:"orderTime" valid:"Required"`
25 //备注 23 //备注
26 Remarks string `json:"remarks" valid:"Required"` 24 Remarks string `json:"remarks" valid:"Required"`
27 - //订单业务员uid  
28 - SalesmanUid string `json:"salesmanUid"`  
29 - //订单操作人uid  
30 - OperatorUid string `json:"operatorUid"`  
31 //区域名称 25 //区域名称
32 RegionName string `json:"regionName"` 26 RegionName string `json:"regionName"`
33 //订单产品列表 27 //订单产品列表
@@ -131,12 +131,10 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD @@ -131,12 +131,10 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
131 CompanyId: int(updateDividendsOrderCommand.Operator.CompanyId), 131 CompanyId: int(updateDividendsOrderCommand.Operator.CompanyId),
132 CustomerName: updateDividendsOrderCommand.CustomerName, 132 CustomerName: updateDividendsOrderCommand.CustomerName,
133 DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount, 133 DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount,
134 - DividendsOrderNumber: updateDividendsOrderCommand.DividendsOrderNumber,  
135 DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum, 134 DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum,
136 OperatorUid: int(updateDividendsOrderCommand.Operator.UserId), 135 OperatorUid: int(updateDividendsOrderCommand.Operator.UserId),
137 OrderTime: t, 136 OrderTime: t,
138 Remarks: updateDividendsOrderCommand.Remarks, 137 Remarks: updateDividendsOrderCommand.Remarks,
139 - SalesmanUid: updateDividendsOrderCommand.SalesmanUid,  
140 RegionName: updateDividendsOrderCommand.RegionName, 138 RegionName: updateDividendsOrderCommand.RegionName,
141 OrderGoods: orderGoods, 139 OrderGoods: orderGoods,
142 }) 140 })