作者 陈志颖

feat:创建合约接口调试

@@ -2,46 +2,85 @@ package command @@ -2,46 +2,85 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"  
6 "reflect" 5 "reflect"
7 "strings" 6 "strings"
  7 + "time"
8 8
9 "github.com/beego/beego/v2/core/validation" 9 "github.com/beego/beego/v2/core/validation"
10 ) 10 )
11 11
  12 +type CreateDividendsIncentivesRulesCommand struct {
  13 + DividendsIncentivesRuleId string `cname:"分红激励规则ID" json:"dividendsIncentivesRuleId"`
  14 + CooperationContractNumber string `cname:"共创合约编号" json:"cooperationContractNumber"`
  15 + ReferrerPercentage float64 `cname:"推荐人抽成" json:"referrerPercentage"`
  16 + SalesmanPercentage float64 `cname:"业务员抽成" json:"salesmanPercentage"`
  17 + DividendsIncentivesPercentage float64 `cname:"分红规则激励百分点" json:"dividendsIncentivesPercentage"`
  18 + DividendsIncentivesStage int `cname:"分红激励阶段" json:"dividendsIncentivesStage"`
  19 + DividendsIncentivesStageEnd time.Time `cname:"" json:"dividendsIncentivesStageEnd"`
  20 + DividendsIncentivesStageStart time.Time `cname:"" json:"dividendsIncentivesStageStart"`
  21 +}
  22 +
  23 +type CreateMoneyIncentivesRulesCommand struct {
  24 + MoneyIncentivesRuleIdString string `cname:"" json:"moneyIncentivesRuleId,string"`
  25 + CooperationContractNumber string `cname:"" json:"cooperationContractNumber"`
  26 + MoneyIncentivesAmount int `cname:"" json:"moneyIncentivesAmount"`
  27 + MoneyIncentivesStage int `cname:"" json:"moneyIncentivesStage"`
  28 + MoneyIncentivesStageEnd time.Time `cname:"" json:"moneyIncentivesStageEnd"`
  29 + MoneyIncentivesStageStart time.Time `cname:"" json:"moneyIncentivesStageStart"`
  30 + MoneyIncentivesTime time.Time `cname:"" json:"moneyIncentivesTime"`
  31 + ReferrerPercentage float64 `cname:"" json:"referrerPercentage"`
  32 + SalesmanPercentage float64 `cname:"" json:"salesmanPercentage"`
  33 +}
  34 +
  35 +type CreateUndertakersCommand struct {
  36 + UserId string `cname:"承接人UID" json:"userId"`
  37 + ContractAttachment []struct {
  38 + FileType string `json:"fileType"`
  39 + Name string `json:"name"`
  40 + Url string `json:"url"`
  41 + FileSize int64 `json:"fileSize"`
  42 + } `json:"contractAttachment"`
  43 + ReferrerId string `json:"referrerId"`
  44 + SalesmanId string `json:"salesmanId"`
  45 +}
  46 +
  47 +type CreateRelevantPeopleCommand struct {
  48 + UserId string `json:"userId"`
  49 +}
  50 +
12 type CreateCooperationContractCommand struct { 51 type CreateCooperationContractCommand struct {
13 // 共创合约描述 52 // 共创合约描述
14 CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription" valid:"Required"` 53 CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription" valid:"Required"`
15 // 共创合约编号 54 // 共创合约编号
16 CooperationContractNumber string `cname:"共创合约编号" json:"cooperationContractNumber" valid:"Required"` 55 CooperationContractNumber string `cname:"共创合约编号" json:"cooperationContractNumber" valid:"Required"`
17 // 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 56 // 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001
18 - CooperationProjectNumber string `cname:"共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001" json:"cooperationProjectNumber" valid:"Required"` 57 + CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber" valid:"Required"`
19 // 共创合约发起部门编码 58 // 共创合约发起部门编码
20 - DepartmentNumber string `cname:"共创合约发起部门编码" json:"departmentNumber" valid:"Required"` 59 + DepartmentId string `cname:"共创合约发起部门ID" json:"departmentId" valid:"Required"`
21 // 共创合约承接对象,1员工,2共创用户,3公开 60 // 共创合约承接对象,1员工,2共创用户,3公开
22 - CooperationContractUndertakerType []int32 `cname:"共创合约承接对象,1员工,2共创用户,3公开" json:"cooperationContractUndertakerType" valid:"Required"` 61 + CooperationContractUndertakerTypes []int32 `cname:"共创合约承接对象" json:"cooperationContractUndertakerTypes" valid:"Required"`
23 // 共创合约名称 62 // 共创合约名称
24 CooperationContractName string `cname:"共创合约名称" json:"cooperationContractName" valid:"Required"` 63 CooperationContractName string `cname:"共创合约名称" json:"cooperationContractName" valid:"Required"`
25 - // 共创模式编码,手动输入,唯一确定  
26 - CooperationModeNumber string `cname:"共创模式编码,手动输入,唯一确定" json:"cooperationModeNumber" valid:"Required"` 64 + // 共创模式编码
  65 + CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"`
27 // 共创合约发起人uid 66 // 共创合约发起人uid
28 SponsorUid string `cname:"共创合约发起人uid" json:"sponsorUid,omitempty"` 67 SponsorUid string `cname:"共创合约发起人uid" json:"sponsorUid,omitempty"`
29 // 业绩分红激励规则列表 68 // 业绩分红激励规则列表
30 - DividendsIncentivesRules []*domain.DividendsIncentivesRule `cname:"业绩分红激励规则列表" json:"dividendsIncentivesRules,omitempty"` 69 + DividendsIncentivesRules []*CreateDividendsIncentivesRulesCommand `cname:"业绩分红激励规则列表" json:"dividendsIncentivesRules,omitempty"`
31 // 金额激励规则列表 70 // 金额激励规则列表
32 - MoneyIncentivesRules []*domain.MoneyIncentivesRule `cname:"金额激励规则列表" json:"moneyIncentivesRules,omitempty"` 71 + MoneyIncentivesRules []*CreateMoneyIncentivesRulesCommand `cname:"金额激励规则列表" json:"moneyIncentivesRules,omitempty"`
33 // 承接方列表 72 // 承接方列表
34 - Undertakers []*domain.Undertaker `cname:"承接方列表" json:"undertakers,omitempty"` 73 + Undertakers []*CreateUndertakersCommand `cname:"承接方列表" json:"undertakers,omitempty"`
35 // 相关人列表 74 // 相关人列表
36 - RelevantPeople []*domain.Relevant `cname:"相关人列表" json:"relevantPeople,omitempty"` 75 + RelevantPeople []string `cname:"相关人列表" json:"relevantPeople,omitempty"`
37 // 公司ID,通过集成REST上下文获取 76 // 公司ID,通过集成REST上下文获取
38 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 77 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
39 // 组织机构ID 78 // 组织机构ID
40 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 79 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
41 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 80 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
42 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 81 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
43 // 用户基础数据id 82 // 用户基础数据id
44 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 83 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
45 } 84 }
46 85
47 func (createCooperationContractCommand *CreateCooperationContractCommand) Valid(validation *validation.Validation) { 86 func (createCooperationContractCommand *CreateCooperationContractCommand) Valid(validation *validation.Validation) {
@@ -8,7 +8,9 @@ import ( @@ -8,7 +8,9 @@ import (
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
  11 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
11 "strconv" 12 "strconv"
  13 + "time"
12 ) 14 )
13 15
14 // CooperationContractService 共创合约服务 16 // CooperationContractService 共创合约服务
@@ -31,90 +33,234 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -31,90 +33,234 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
31 _ = transactionContext.RollbackTransaction() 33 _ = transactionContext.RollbackTransaction()
32 }() 34 }()
33 35
34 - //userServiceGateway, err := factory.CreateUserServiceGateway(nil)  
35 - //if err != nil {  
36 - // fmt.Println(err.Error())  
37 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
38 - //} 36 + // 用户REST服务初始化
  37 + var userService service.UserService
  38 + if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
  39 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  40 + } else {
  41 + userService = value
  42 + }
39 43
40 - //userServiceGateway.GetUser(createCooperationContractCommand.SponsorUid) 44 + // 获取操作人
  45 + var operator *domain.User
  46 + if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, createCooperationContractCommand.UserId); err != nil {
  47 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  48 + } else {
  49 + operator = data
  50 + }
41 51
42 - newCooperationContract := &domain.CooperationContract{  
43 - CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription,  
44 - CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,  
45 - //CooperationProjectNumber: createCooperationContractCommand.CooperationProjectNumber,  
46 - //DepartmentNumber: createCooperationContractCommand.DepartmentNumber,  
47 - CooperationContractUndertakerTypes: createCooperationContractCommand.CooperationContractUndertakerType,  
48 - CooperationContractName: createCooperationContractCommand.CooperationContractName,  
49 - //CooperationModeNumber: createCooperationContractCommand.CooperationModeNumber,  
50 - //SponsorUid: createCooperationContractCommand.SponsorUid,  
51 - //DividendsIncentivesRules: createCooperationContractCommand.DividendsIncentivesRules,  
52 - //MoneyIncentivesRules: createCooperationContractCommand.MoneyIncentivesRules,  
53 - //Undertakers: createCooperationContractCommand.Undertakers,  
54 - //RelevantPeople: createCooperationContractCommand.RelevantPeople,  
55 - //CompanyId: createCooperationContractCommand.CompanyId,  
56 - //OrgId: createCooperationContractCommand.OrgId,  
57 - //UserId: createCooperationContractCommand.UserId, 52 + // 获取发起人
  53 + var sponsor *domain.User
  54 + sponsorUid, _ := strconv.ParseInt(createCooperationContractCommand.SponsorUid, 10, 64)
  55 + if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, sponsorUid); err != nil {
  56 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  57 + } else {
  58 + sponsor = data
58 } 59 }
59 60
60 - // 共创合约仓储初始化  
61 - var cooperationContractRepository domain.CooperationContractRepository  
62 - if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{  
63 - "transactionContext": transactionContext,  
64 - }); err != nil { 61 + // 公司REST服务初始化
  62 + var companyService service.CompanyService
  63 + if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil {
65 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 64 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
66 } else { 65 } else {
67 - cooperationContractRepository = value 66 + companyService = value
  67 + }
  68 +
  69 + // 获取公司信息
  70 + var company *domain.Company
  71 + if data, err := companyService.CompanyFrom(createCooperationContractCommand.CompanyId); err != nil {
  72 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  73 + } else {
  74 + company = data
  75 + }
  76 +
  77 + // 组织机构REST服务初始化
  78 + var organizationService service.OrgService
  79 + if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil {
  80 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  81 + } else {
  82 + organizationService = value
  83 + }
  84 +
  85 + // 获取组织机构信息
  86 + var organization *domain.Org
  87 + if data, err := organizationService.OrgFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId); err != nil {
  88 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  89 + } else {
  90 + organization = data
68 } 91 }
69 92
70 - //// 共创合约承接人仓储初始化  
71 - //var cooperationContractUndertakerRepository domain.CooperationContractUndertakerRepository  
72 - //if value, err := factory.CreateCooperationContractUndertakerRepository(map[string]interface{}{  
73 - // "transactionContext": transactionContext,  
74 - //}); err != nil {  
75 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
76 - //} else {  
77 - // cooperationContractUndertakerRepository = value  
78 - //} 93 + // 获取承接人
  94 + var undertakers []*domain.Undertaker
  95 + for _, undertaker := range createCooperationContractCommand.Undertakers {
  96 + var undertakerDomain *domain.Undertaker
  97 + undertakerUid, _ := strconv.ParseInt(undertaker.UserId, 10, 64)
  98 + if data, err := userService.UndertakerFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, undertakerUid); err != nil {
  99 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  100 + } else {
  101 + undertakerDomain = data
  102 + }
79 103
80 - //// 共创合约相关人仓储初始化  
81 - //var cooperationContractRelevantRepository domain.CooperationContractRelevantRepository  
82 - //if value, err := factory.CreateCooperationContractRelevantRepository(map[string]interface{}{  
83 - // "transactionContext": transactionContext,  
84 - //}); err != nil {  
85 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
86 - //} else {  
87 - // cooperationContractRelevantRepository = value  
88 - //} 104 + // 获取推荐人
  105 + var referrerDomain *domain.Referrer
  106 + referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64)
  107 + if data, err := userService.ReferrerFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, referrerUid); err != nil {
  108 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  109 + } else {
  110 + referrerDomain = data
  111 + }
89 112
90 - //// 分红激励规则仓储初始化  
91 - //var dividendsIncentivesRuleRepository domain.DividendsIncentivesRuleRepository  
92 - //if value, err := factory.CreateDividendsIncentivesRuleRepository(map[string]interface{}{  
93 - // "transactionContext": transactionContext,  
94 - //}); err != nil {  
95 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
96 - //} else {  
97 - // dividendsIncentivesRuleRepository = value  
98 - //} 113 + // 获取业务员
  114 + var salesmanDomain *domain.Salesman
  115 + salesmanUid, _ := strconv.ParseInt(undertaker.SalesmanId, 10, 64)
  116 + if data, err := userService.SalesmanFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, salesmanUid); err != nil {
  117 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  118 + } else {
  119 + salesmanDomain = data
  120 + }
99 121
100 - //// 金额激励规则仓储初始化  
101 - //var moneyIncentivesRuleRepository domain.MoneyIncentivesRuleRepository  
102 - //if value, err := factory.CreateMoneyIncentivesRuleRepository(map[string]interface{}{  
103 - // "transactionContext": transactionContext,  
104 - //}); err != nil {  
105 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
106 - //} else {  
107 - // moneyIncentivesRuleRepository = value  
108 - //} 122 + undertakers = append(undertakers, &domain.Undertaker{
  123 + UndertakerId: 0,
  124 + UserId: undertakerDomain.UserId,
  125 + CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
  126 + UserBaseId: undertakerDomain.UserBaseId,
  127 + Org: undertakerDomain.Org,
  128 + Orgs: undertakerDomain.Orgs,
  129 + Department: undertakerDomain.Department,
  130 + Roles: undertakerDomain.Roles,
  131 + UserInfo: undertakerDomain.UserInfo,
  132 + UserType: undertakerDomain.UserType,
  133 + Referrer: referrerDomain,
  134 + Salesman: salesmanDomain,
  135 + Status: 0,
  136 + Company: company,
  137 + ContractAttachment: nil,
  138 + })
  139 + }
  140 +
  141 + // 获取相关人
  142 + var relevantPeople []*domain.Relevant
  143 + for _, relevantPersonUid := range createCooperationContractCommand.RelevantPeople {
  144 + var relevantDomain *domain.Relevant
  145 + relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64)
  146 + if data, err := userService.RelevantFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, relevantUid); err != nil {
  147 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  148 + } else {
  149 + relevantDomain = data
  150 + }
  151 + relevantPeople = append(relevantPeople, &domain.Relevant{
  152 + RelevantId: 0,
  153 + CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
  154 + UserId: relevantDomain.UserId,
  155 + UserBaseId: relevantDomain.UserBaseId,
  156 + Org: relevantDomain.Org,
  157 + Orgs: relevantDomain.Orgs,
  158 + Department: relevantDomain.Department,
  159 + Roles: relevantDomain.Roles,
  160 + UserInfo: relevantDomain.UserInfo,
  161 + UserType: relevantDomain.UserType,
  162 + Status: relevantDomain.Status,
  163 + Company: relevantDomain.Company,
  164 + })
  165 + }
109 166
110 - if cooperationContract, err := cooperationContractRepository.Save(newCooperationContract); err != nil { 167 + // 获取分红激励规则列表
  168 + var dividendsIncentivesRules []*domain.DividendsIncentivesRule
  169 + for _, dividendsIncentivesRule := range createCooperationContractCommand.DividendsIncentivesRules {
  170 + dividendsIncentivesRules = append(dividendsIncentivesRules, &domain.DividendsIncentivesRule{
  171 + DividendsIncentivesRuleId: 0,
  172 + CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
  173 + ReferrerPercentage: dividendsIncentivesRule.ReferrerPercentage,
  174 + SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage,
  175 + DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage,
  176 + DividendsIncentivesStage: int64(dividendsIncentivesRule.DividendsIncentivesStage),
  177 + DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd,
  178 + DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart,
  179 + Org: organization,
  180 + Company: company,
  181 + UpdatedAt: time.Time{},
  182 + DeletedAt: time.Time{},
  183 + CreatedAt: time.Now(),
  184 + })
  185 + }
  186 +
  187 + // 获取金额激励规则
  188 + var moneyIncentivesRules []*domain.MoneyIncentivesRule
  189 + for _, moneyIncentivesRule := range createCooperationContractCommand.MoneyIncentivesRules {
  190 + moneyIncentivesRules = append(moneyIncentivesRules, &domain.MoneyIncentivesRule{
  191 + MoneyIncentivesRuleId: 0,
  192 + CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
  193 + MoneyIncentivesAmount: float64(moneyIncentivesRule.MoneyIncentivesAmount),
  194 + MoneyIncentivesStage: int64(moneyIncentivesRule.MoneyIncentivesStage),
  195 + MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd,
  196 + MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart,
  197 + MoneyIncentivesTime: time.Now(),
  198 + ReferrerPercentage: moneyIncentivesRule.ReferrerPercentage,
  199 + SalesmanPercentage: moneyIncentivesRule.SalesmanPercentage,
  200 + Org: organization,
  201 + Company: company,
  202 + UpdatedAt: time.Time{},
  203 + DeletedAt: time.Time{},
  204 + CreatedAt: time.Now(),
  205 + })
  206 + }
  207 +
  208 + // 查找共创模式
  209 + var cooperationModeRepository domain.CooperationModeRepository
  210 + if value, err := factory.CreateCooperationModeRepository(map[string]interface{}{
  211 + "transactionContext": transactionContext,
  212 + }); err != nil {
111 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 213 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
112 } else { 214 } else {
113 - //  
114 - if err := transactionContext.CommitTransaction(); err != nil {  
115 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 215 + cooperationModeRepository = value
  216 + }
  217 + cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeNumber": createCooperationContractCommand.CooperationModeNumber})
  218 + if err != nil {
  219 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  220 + }
  221 + if cooperationMode == nil {
  222 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationContractCommand.CooperationModeNumber))
  223 + } else {
  224 + newCooperationContract := &domain.CooperationContract{
  225 + CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription,
  226 + CooperationContractName: createCooperationContractCommand.CooperationContractName,
  227 + CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
  228 + CooperationContractUndertakerTypes: createCooperationContractCommand.CooperationContractUndertakerTypes,
  229 + CooperationContractSponsor: sponsor,
  230 + CooperationMode: cooperationMode,
  231 + Status: 1,
  232 + Org: organization,
  233 + Company: company,
  234 + Operator: operator,
  235 + DividendsIncentivesRules: dividendsIncentivesRules,
  236 + MoneyIncentivesRules: moneyIncentivesRules,
  237 + Undertakers: undertakers,
  238 + RelevantPeople: relevantPeople,
  239 + OperateTime: time.Now(),
  240 + CreatedAt: time.Now(),
  241 + DeletedAt: time.Time{},
  242 + UpdatedAt: time.Time{},
  243 + }
  244 +
  245 + // 共创合约仓储初始化
  246 + var cooperationContractRepository domain.CooperationContractRepository
  247 + if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
  248 + "transactionContext": transactionContext,
  249 + }); err != nil {
  250 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  251 + } else {
  252 + cooperationContractRepository = value
  253 + }
  254 +
  255 + if cooperationContract, err := cooperationContractRepository.Save(newCooperationContract); err != nil {
  256 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  257 + } else {
  258 + //
  259 + if err := transactionContext.CommitTransaction(); err != nil {
  260 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  261 + }
  262 + return cooperationContract, nil
116 } 263 }
117 - return cooperationContract, nil  
118 } 264 }
119 } 265 }
120 266
@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 10
11 type BatchOperateCooperationModeCommand struct { 11 type BatchOperateCooperationModeCommand struct {
12 // 共创模式ID 12 // 共创模式ID
13 - CooperationModeIds []string `cname:"共创模式id" json:"cooperationModeIds" valid:"Required"` 13 + CooperationModeIds []string `cname:"共创模式id" json:"cooperationModeIds"`
14 // 共创模式状态,1启用,2禁用 14 // 共创模式状态,1启用,2禁用
15 Status int32 `cname:"状态" json:"status" valid:"Required"` 15 Status int32 `cname:"状态" json:"status" valid:"Required"`
16 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
@@ -42,7 +42,7 @@ func (cooperationModeService *CooperationModeService) CreateCooperationMode(crea @@ -42,7 +42,7 @@ func (cooperationModeService *CooperationModeService) CreateCooperationMode(crea
42 userService = value 42 userService = value
43 } 43 }
44 44
45 - // 获取承接 45 + // 获取操作
46 var operator *domain.User 46 var operator *domain.User
47 if data, err := userService.OperatorFrom(createCooperationModeCommand.CompanyId, createCooperationModeCommand.OrgId, createCooperationModeCommand.UserId); err != nil { 47 if data, err := userService.OperatorFrom(createCooperationModeCommand.CompanyId, createCooperationModeCommand.OrgId, createCooperationModeCommand.UserId); err != nil {
48 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 48 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "reflect"
  6 + "strings"
  7 +
  8 + "github.com/beego/beego/v2/core/validation"
  9 +)
  10 +
  11 +type BatchEndCooperationProjectCommand struct {
  12 + // 共创项目ID
  13 + CooperationProjectIds []string `cname:"共创项目ID数组" json:"cooperationProjectIds" valid:"Required"`
  14 + // 公司ID,通过集成REST上下文获取
  15 + CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"`
  16 + // 组织机构ID
  17 + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
  18 + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  19 + UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"`
  20 + // 用户基础数据id
  21 + UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"`
  22 +}
  23 +
  24 +func (batchEndCooperationProjectCommand *BatchEndCooperationProjectCommand) Valid(validation *validation.Validation) {
  25 + //validation.SetError("CustomValid", "未实现的自定义认证")
  26 +}
  27 +
  28 +func (batchEndCooperationProjectCommand *BatchEndCooperationProjectCommand) ValidateCommand() error {
  29 + valid := validation.Validation{}
  30 + b, err := valid.Valid(batchEndCooperationProjectCommand)
  31 + if err != nil {
  32 + return err
  33 + }
  34 + if !b {
  35 + elem := reflect.TypeOf(batchEndCooperationProjectCommand).Elem()
  36 + for _, validErr := range valid.Errors {
  37 + field, isExist := elem.FieldByName(validErr.Field)
  38 + if isExist {
  39 + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
  40 + } else {
  41 + return fmt.Errorf(validErr.Message)
  42 + }
  43 + }
  44 + }
  45 + return nil
  46 +}
@@ -20,13 +20,13 @@ type CreateCooperationProjectCommand struct { @@ -20,13 +20,13 @@ type CreateCooperationProjectCommand struct {
20 // 共创项目描述 20 // 共创项目描述
21 CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription,omitempty"` 21 CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription,omitempty"`
22 // 公司ID,通过集成REST上下文获取 22 // 公司ID,通过集成REST上下文获取
23 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 23 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
24 // 组织机构ID 24 // 组织机构ID
25 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 25 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
27 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 27 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
28 // 用户基础数据id 28 // 用户基础数据id
29 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 29 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
30 } 30 }
31 31
32 func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) { 32 func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) {
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "reflect"
  6 + "strings"
  7 +
  8 + "github.com/beego/beego/v2/core/validation"
  9 +)
  10 +
  11 +type EndCooperationProjectCommand struct {
  12 + // 共创项目ID
  13 + CooperationProjectId string `cname:"共创项目ID" json:"cooperationProjectId" valid:"Required"`
  14 + // 公司ID,通过集成REST上下文获取
  15 + CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"`
  16 + // 组织机构ID
  17 + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
  18 + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  19 + UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"`
  20 + // 用户基础数据id
  21 + UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"`
  22 +}
  23 +
  24 +func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) {
  25 + //validation.SetError("CustomValid", "未实现的自定义认证")
  26 +}
  27 +
  28 +func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error {
  29 + valid := validation.Validation{}
  30 + b, err := valid.Valid(endCooperationProjectCommand)
  31 + if err != nil {
  32 + return err
  33 + }
  34 + if !b {
  35 + elem := reflect.TypeOf(endCooperationProjectCommand).Elem()
  36 + for _, validErr := range valid.Errors {
  37 + field, isExist := elem.FieldByName(validErr.Field)
  38 + if isExist {
  39 + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
  40 + } else {
  41 + return fmt.Errorf(validErr.Message)
  42 + }
  43 + }
  44 + }
  45 + return nil
  46 +}
@@ -17,7 +17,7 @@ type Undertaker struct { @@ -17,7 +17,7 @@ type Undertaker struct {
17 // 用户所属的部门 17 // 用户所属的部门
18 Department *Department `json:"department"` 18 Department *Department `json:"department"`
19 // 用户角色 19 // 用户角色
20 - Role *Role `json:"role"` 20 + Roles []*Role `json:"role"`
21 // 冗余字段,jsonb格式,不限制存放内容 21 // 冗余字段,jsonb格式,不限制存放内容
22 UserInfo *UserInfo `json:"userInfo"` 22 UserInfo *UserInfo `json:"userInfo"`
23 // 用户类型,1员工,2共创用户,3公开 23 // 用户类型,1员工,2共创用户,3公开
@@ -20,10 +20,20 @@ func (service *UserService) UserFrom(companyId int64, orgId int64, userId int64) @@ -20,10 +20,20 @@ func (service *UserService) UserFrom(companyId int64, orgId int64, userId int64)
20 return nil, err 20 return nil, err
21 } else { 21 } else {
22 if user != nil { 22 if user != nil {
23 - err := json.Unmarshal(user.([]byte), returnData)  
24 - if err != nil { 23 + log.Logger.Debug("普通用户", map[string]interface{}{
  24 + "user interface": user,
  25 + })
  26 + userJson, err1 := json.Marshal(user)
  27 + if err1 != nil {
25 return nil, err 28 return nil, err
26 } 29 }
  30 + log.Logger.Debug("普通用户", map[string]interface{}{
  31 + "user json": userJson,
  32 + })
  33 + err2 := json.Unmarshal(userJson, &returnData)
  34 + if err2 != nil {
  35 + return nil, err2
  36 + }
27 } 37 }
28 return returnData, nil 38 return returnData, nil
29 } 39 }
@@ -40,10 +50,20 @@ func (service *UserService) ReferrerFrom(companyId int64, orgId int64, userId in @@ -40,10 +50,20 @@ func (service *UserService) ReferrerFrom(companyId int64, orgId int64, userId in
40 return nil, err 50 return nil, err
41 } else { 51 } else {
42 if referrer != nil { 52 if referrer != nil {
43 - err := json.Unmarshal(referrer.([]byte), returnData)  
44 - if err != nil { 53 + log.Logger.Debug("推荐人", map[string]interface{}{
  54 + "referrer interface": referrer,
  55 + })
  56 + referrerJson, err1 := json.Marshal(referrer)
  57 + if err1 != nil {
45 return nil, err 58 return nil, err
46 } 59 }
  60 + log.Logger.Debug("推荐人", map[string]interface{}{
  61 + "referrer json": referrerJson,
  62 + })
  63 + err2 := json.Unmarshal(referrerJson, &returnData)
  64 + if err2 != nil {
  65 + return nil, err2
  66 + }
47 } 67 }
48 return returnData, nil 68 return returnData, nil
49 } 69 }
@@ -60,10 +80,20 @@ func (service *UserService) UndertakerFrom(companyId int64, orgId int64, userId @@ -60,10 +80,20 @@ func (service *UserService) UndertakerFrom(companyId int64, orgId int64, userId
60 return nil, err 80 return nil, err
61 } else { 81 } else {
62 if undertaker != nil { 82 if undertaker != nil {
63 - err := json.Unmarshal(undertaker.([]byte), returnData)  
64 - if err != nil { 83 + log.Logger.Debug("承接人", map[string]interface{}{
  84 + "undertaker interface": undertaker,
  85 + })
  86 + undertakerJson, err1 := json.Marshal(undertaker)
  87 + if err1 != nil {
65 return nil, err 88 return nil, err
66 } 89 }
  90 + log.Logger.Debug("承接人", map[string]interface{}{
  91 + "undertaker json": undertakerJson,
  92 + })
  93 + err2 := json.Unmarshal(undertakerJson, &returnData)
  94 + if err2 != nil {
  95 + return nil, err2
  96 + }
67 } 97 }
68 return returnData, nil 98 return returnData, nil
69 } 99 }
@@ -80,10 +110,20 @@ func (service *UserService) RelevantFrom(companyId int64, orgId int64, userId in @@ -80,10 +110,20 @@ func (service *UserService) RelevantFrom(companyId int64, orgId int64, userId in
80 return nil, err 110 return nil, err
81 } else { 111 } else {
82 if relevant != nil { 112 if relevant != nil {
83 - err := json.Unmarshal(relevant.([]byte), returnData)  
84 - if err != nil { 113 + log.Logger.Debug("相关人", map[string]interface{}{
  114 + "relevant interface": relevant,
  115 + })
  116 + relevantJson, err1 := json.Marshal(relevant)
  117 + if err1 != nil {
85 return nil, err 118 return nil, err
86 } 119 }
  120 + log.Logger.Debug("相关人", map[string]interface{}{
  121 + "relevant json": relevantJson,
  122 + })
  123 + err2 := json.Unmarshal(relevantJson, &returnData)
  124 + if err2 != nil {
  125 + return nil, err2
  126 + }
87 } 127 }
88 return returnData, nil 128 return returnData, nil
89 } 129 }
@@ -100,10 +140,20 @@ func (service *UserService) SalesmanFrom(companyId int64, orgId int64, userId in @@ -100,10 +140,20 @@ func (service *UserService) SalesmanFrom(companyId int64, orgId int64, userId in
100 return nil, err 140 return nil, err
101 } else { 141 } else {
102 if salesman != nil { 142 if salesman != nil {
103 - err := json.Unmarshal(salesman.([]byte), returnData)  
104 - if err != nil { 143 + log.Logger.Debug("业务员", map[string]interface{}{
  144 + "salesman interface": salesman,
  145 + })
  146 + salesmanJson, err1 := json.Marshal(salesman)
  147 + if err1 != nil {
105 return nil, err 148 return nil, err
106 } 149 }
  150 + log.Logger.Debug("业务员", map[string]interface{}{
  151 + "salesman json": salesmanJson,
  152 + })
  153 + err2 := json.Unmarshal(salesmanJson, &returnData)
  154 + if err2 != nil {
  155 + return nil, err2
  156 + }
107 } 157 }
108 return returnData, nil 158 return returnData, nil
109 } 159 }
@@ -22,7 +22,7 @@ type CooperationContractUndertaker struct { @@ -22,7 +22,7 @@ type CooperationContractUndertaker struct {
22 // 用户所属部门 22 // 用户所属部门
23 Department *domain.Department `comment:"用户所属部门"` 23 Department *domain.Department `comment:"用户所属部门"`
24 // 用户角色 24 // 用户角色
25 - Role *domain.Role `comment:"用户角色"` 25 + Roles []*domain.Role `comment:"用户角色"`
26 // 用户信息 26 // 用户信息
27 UserInfo *domain.UserInfo `comment:"用户信息"` 27 UserInfo *domain.UserInfo `comment:"用户信息"`
28 // 用户类型 28 // 用户类型
@@ -76,7 +76,7 @@ func TransformToCooperationContractDomainModelFromPgModels( @@ -76,7 +76,7 @@ func TransformToCooperationContractDomainModelFromPgModels(
76 Org: undertaker.Org, 76 Org: undertaker.Org,
77 Orgs: undertaker.Orgs, 77 Orgs: undertaker.Orgs,
78 Department: undertaker.Department, 78 Department: undertaker.Department,
79 - Role: undertaker.Role, 79 + Roles: undertaker.Roles,
80 UserInfo: undertaker.UserInfo, 80 UserInfo: undertaker.UserInfo,
81 UserType: undertaker.UserType, 81 UserType: undertaker.UserType,
82 Status: undertaker.Status, 82 Status: undertaker.Status,
@@ -15,7 +15,7 @@ func TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperation @@ -15,7 +15,7 @@ func TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperation
15 Org: cooperationContractUndertakerModel.Org, 15 Org: cooperationContractUndertakerModel.Org,
16 Orgs: cooperationContractUndertakerModel.Orgs, 16 Orgs: cooperationContractUndertakerModel.Orgs,
17 Department: cooperationContractUndertakerModel.Department, 17 Department: cooperationContractUndertakerModel.Department,
18 - Role: cooperationContractUndertakerModel.Role, 18 + Roles: cooperationContractUndertakerModel.Roles,
19 UserInfo: cooperationContractUndertakerModel.UserInfo, 19 UserInfo: cooperationContractUndertakerModel.UserInfo,
20 UserType: cooperationContractUndertakerModel.UserType, 20 UserType: cooperationContractUndertakerModel.UserType,
21 Referrer: cooperationContractUndertakerModel.Referrer, 21 Referrer: cooperationContractUndertakerModel.Referrer,
@@ -32,8 +32,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -32,8 +32,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
32 "cooperation_contract_description", 32 "cooperation_contract_description",
33 "cooperation_contract_name", 33 "cooperation_contract_name",
34 "cooperation_contract_number", 34 "cooperation_contract_number",
35 - "cooperation_contract_referrer",  
36 - "cooperation_contract_salesman",  
37 "cooperation_contract_undertaker_types", 35 "cooperation_contract_undertaker_types",
38 "cooperation_contract_sponsor", 36 "cooperation_contract_sponsor",
39 "cooperation_mode_number", 37 "cooperation_mode_number",
@@ -91,7 +89,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -91,7 +89,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
91 cooperationContract.Operator, 89 cooperationContract.Operator,
92 cooperationContract.OperateTime, 90 cooperationContract.OperateTime,
93 cooperationContract.CreatedAt, 91 cooperationContract.CreatedAt,
94 - cooperationContract.DeletedAt, 92 + nil,
95 cooperationContract.UpdatedAt, 93 cooperationContract.UpdatedAt,
96 ); err != nil { 94 ); err != nil {
97 return cooperationContract, err 95 return cooperationContract, err
@@ -130,7 +128,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -130,7 +128,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
130 Org: undertaker.Org, 128 Org: undertaker.Org,
131 Orgs: undertaker.Orgs, 129 Orgs: undertaker.Orgs,
132 Department: undertaker.Department, 130 Department: undertaker.Department,
133 - Role: undertaker.Role, 131 + Roles: undertaker.Roles,
134 UserInfo: undertaker.UserInfo, 132 UserInfo: undertaker.UserInfo,
135 UserType: undertaker.UserType, 133 UserType: undertaker.UserType,
136 Referrer: undertaker.Referrer, 134 Referrer: undertaker.Referrer,
@@ -223,7 +221,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -223,7 +221,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
223 cooperationContract.Operator, 221 cooperationContract.Operator,
224 cooperationContract.OperateTime, 222 cooperationContract.OperateTime,
225 cooperationContract.CreatedAt, 223 cooperationContract.CreatedAt,
226 - cooperationContract.DeletedAt, 224 + nil,
227 cooperationContract.UpdatedAt, 225 cooperationContract.UpdatedAt,
228 cooperationContract.Identify(), 226 cooperationContract.Identify(),
229 ); err != nil { 227 ); err != nil {
@@ -352,7 +350,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -352,7 +350,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
352 Org: undertakerDomain.Org, 350 Org: undertakerDomain.Org,
353 Orgs: undertakerDomain.Orgs, 351 Orgs: undertakerDomain.Orgs,
354 Department: undertakerDomain.Department, 352 Department: undertakerDomain.Department,
355 - Role: undertakerDomain.Role, 353 + Roles: undertakerDomain.Roles,
356 UserInfo: undertakerDomain.UserInfo, 354 UserInfo: undertakerDomain.UserInfo,
357 UserType: undertakerDomain.UserType, 355 UserType: undertakerDomain.UserType,
358 Status: undertakerDomain.Status, 356 Status: undertakerDomain.Status,
@@ -67,7 +67,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr @@ -67,7 +67,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr
67 &cooperationContractUndertaker.Undertaker.Org, 67 &cooperationContractUndertaker.Undertaker.Org,
68 &cooperationContractUndertaker.Undertaker.Orgs, 68 &cooperationContractUndertaker.Undertaker.Orgs,
69 &cooperationContractUndertaker.Undertaker.Department, 69 &cooperationContractUndertaker.Undertaker.Department,
70 - &cooperationContractUndertaker.Undertaker.Role, 70 + &cooperationContractUndertaker.Undertaker.Roles,
71 &cooperationContractUndertaker.Undertaker.UserInfo, 71 &cooperationContractUndertaker.Undertaker.UserInfo,
72 &cooperationContractUndertaker.Undertaker.UserType, 72 &cooperationContractUndertaker.Undertaker.UserType,
73 &cooperationContractUndertaker.Undertaker.Referrer, 73 &cooperationContractUndertaker.Undertaker.Referrer,
@@ -87,7 +87,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr @@ -87,7 +87,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr
87 &cooperationContractUndertaker.Undertaker.Org, 87 &cooperationContractUndertaker.Undertaker.Org,
88 &cooperationContractUndertaker.Undertaker.Orgs, 88 &cooperationContractUndertaker.Undertaker.Orgs,
89 &cooperationContractUndertaker.Undertaker.Department, 89 &cooperationContractUndertaker.Undertaker.Department,
90 - &cooperationContractUndertaker.Undertaker.Role, 90 + &cooperationContractUndertaker.Undertaker.Roles,
91 &cooperationContractUndertaker.Undertaker.UserInfo, 91 &cooperationContractUndertaker.Undertaker.UserInfo,
92 &cooperationContractUndertaker.Undertaker.UserType, 92 &cooperationContractUndertaker.Undertaker.UserType,
93 &cooperationContractUndertaker.Undertaker.Referrer, 93 &cooperationContractUndertaker.Undertaker.Referrer,
@@ -111,7 +111,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr @@ -111,7 +111,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr
111 &cooperationContractUndertaker.Undertaker.Org, 111 &cooperationContractUndertaker.Undertaker.Org,
112 &cooperationContractUndertaker.Undertaker.Orgs, 112 &cooperationContractUndertaker.Undertaker.Orgs,
113 &cooperationContractUndertaker.Undertaker.Department, 113 &cooperationContractUndertaker.Undertaker.Department,
114 - &cooperationContractUndertaker.Undertaker.Role, 114 + &cooperationContractUndertaker.Undertaker.Roles,
115 &cooperationContractUndertaker.Undertaker.UserInfo, 115 &cooperationContractUndertaker.Undertaker.UserInfo,
116 &cooperationContractUndertaker.Undertaker.UserType, 116 &cooperationContractUndertaker.Undertaker.UserType,
117 &cooperationContractUndertaker.Undertaker.Referrer, 117 &cooperationContractUndertaker.Undertaker.Referrer,
@@ -131,7 +131,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr @@ -131,7 +131,7 @@ func (repository *CooperationContractUndertakerRepository) Save(cooperationContr
131 cooperationContractUndertaker.Undertaker.Org, 131 cooperationContractUndertaker.Undertaker.Org,
132 cooperationContractUndertaker.Undertaker.Orgs, 132 cooperationContractUndertaker.Undertaker.Orgs,
133 cooperationContractUndertaker.Undertaker.Department, 133 cooperationContractUndertaker.Undertaker.Department,
134 - cooperationContractUndertaker.Undertaker.Role, 134 + cooperationContractUndertaker.Undertaker.Roles,
135 cooperationContractUndertaker.Undertaker.UserInfo, 135 cooperationContractUndertaker.Undertaker.UserInfo,
136 cooperationContractUndertaker.Undertaker.UserType, 136 cooperationContractUndertaker.Undertaker.UserType,
137 cooperationContractUndertaker.Undertaker.Referrer, 137 cooperationContractUndertaker.Undertaker.Referrer,
@@ -94,7 +94,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -94,7 +94,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
94 cooperationProject.OperateTime, 94 cooperationProject.OperateTime,
95 cooperationProject.Status, 95 cooperationProject.Status,
96 cooperationProject.UpdatedAt, 96 cooperationProject.UpdatedAt,
97 - cooperationProject.DeletedAt, 97 + nil,
98 cooperationProject.CreatedAt, 98 cooperationProject.CreatedAt,
99 ); err != nil { 99 ); err != nil {
100 return cooperationProject, err 100 return cooperationProject, err
@@ -136,7 +136,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -136,7 +136,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
136 cooperationProject.OperateTime, 136 cooperationProject.OperateTime,
137 cooperationProject.Status, 137 cooperationProject.Status,
138 cooperationProject.UpdatedAt, 138 cooperationProject.UpdatedAt,
139 - cooperationProject.DeletedAt, 139 + nil,
140 cooperationProject.CreatedAt, 140 cooperationProject.CreatedAt,
141 cooperationProject.Identify(), 141 cooperationProject.Identify(),
142 ); err != nil { 142 ); err != nil {
@@ -136,7 +136,7 @@ func (translator *UserTranslator) ToUndertakerFromRepresentation(user *UserDetai @@ -136,7 +136,7 @@ func (translator *UserTranslator) ToUndertakerFromRepresentation(user *UserDetai
136 Org: nil, 136 Org: nil,
137 Orgs: nil, 137 Orgs: nil,
138 Department: nil, 138 Department: nil,
139 - Role: nil, 139 + Roles: nil,
140 UserInfo: nil, 140 UserInfo: nil,
141 UserType: 0, 141 UserType: 0,
142 Status: 0, 142 Status: 0,
@@ -14,7 +14,6 @@ func (controller *CooperationModeController) CreateCooperationMode() { @@ -14,7 +14,6 @@ func (controller *CooperationModeController) CreateCooperationMode() {
14 cooperationModeService := service.NewCooperationModeService(nil) 14 cooperationModeService := service.NewCooperationModeService(nil)
15 createCooperationModeCommand := &command.CreateCooperationModeCommand{} 15 createCooperationModeCommand := &command.CreateCooperationModeCommand{}
16 _ = controller.Unmarshal(createCooperationModeCommand) 16 _ = controller.Unmarshal(createCooperationModeCommand)
17 - // 解析头部信息  
18 header := controller.GetRequestHeader(controller.Ctx) 17 header := controller.GetRequestHeader(controller.Ctx)
19 createCooperationModeCommand.CompanyId = header.CompanyId 18 createCooperationModeCommand.CompanyId = header.CompanyId
20 createCooperationModeCommand.OrgId = header.OrgId 19 createCooperationModeCommand.OrgId = header.OrgId
@@ -28,7 +27,6 @@ func (controller *CooperationModeController) UpdateCooperationMode() { @@ -28,7 +27,6 @@ func (controller *CooperationModeController) UpdateCooperationMode() {
28 cooperationModeService := service.NewCooperationModeService(nil) 27 cooperationModeService := service.NewCooperationModeService(nil)
29 updateCooperationModeCommand := &command.UpdateCooperationModeCommand{} 28 updateCooperationModeCommand := &command.UpdateCooperationModeCommand{}
30 _ = controller.Unmarshal(updateCooperationModeCommand) 29 _ = controller.Unmarshal(updateCooperationModeCommand)
31 - // 解析头部信息  
32 header := controller.GetRequestHeader(controller.Ctx) 30 header := controller.GetRequestHeader(controller.Ctx)
33 updateCooperationModeCommand.CompanyId = header.CompanyId 31 updateCooperationModeCommand.CompanyId = header.CompanyId
34 updateCooperationModeCommand.OrgId = header.OrgId 32 updateCooperationModeCommand.OrgId = header.OrgId
@@ -43,7 +41,6 @@ func (controller *CooperationModeController) UpdateCooperationMode() { @@ -43,7 +41,6 @@ func (controller *CooperationModeController) UpdateCooperationMode() {
43 func (controller *CooperationModeController) GetCooperationMode() { 41 func (controller *CooperationModeController) GetCooperationMode() {
44 cooperationModeService := service.NewCooperationModeService(nil) 42 cooperationModeService := service.NewCooperationModeService(nil)
45 getCooperationModeQuery := &query.GetCooperationModeQuery{} 43 getCooperationModeQuery := &query.GetCooperationModeQuery{}
46 - // 解析头部信息  
47 header := controller.GetRequestHeader(controller.Ctx) 44 header := controller.GetRequestHeader(controller.Ctx)
48 getCooperationModeQuery.CompanyId = header.CompanyId 45 getCooperationModeQuery.CompanyId = header.CompanyId
49 getCooperationModeQuery.OrgId = header.OrgId 46 getCooperationModeQuery.OrgId = header.OrgId
@@ -59,7 +56,6 @@ func (controller *CooperationModeController) RemoveCooperationMode() { @@ -59,7 +56,6 @@ func (controller *CooperationModeController) RemoveCooperationMode() {
59 cooperationModeService := service.NewCooperationModeService(nil) 56 cooperationModeService := service.NewCooperationModeService(nil)
60 removeCooperationModeCommand := &command.RemoveCooperationModeCommand{} 57 removeCooperationModeCommand := &command.RemoveCooperationModeCommand{}
61 _ = controller.Unmarshal(removeCooperationModeCommand) 58 _ = controller.Unmarshal(removeCooperationModeCommand)
62 - // 解析头部信息  
63 header := controller.GetRequestHeader(controller.Ctx) 59 header := controller.GetRequestHeader(controller.Ctx)
64 removeCooperationModeCommand.CompanyId = header.CompanyId 60 removeCooperationModeCommand.CompanyId = header.CompanyId
65 removeCooperationModeCommand.OrgId = header.OrgId 61 removeCooperationModeCommand.OrgId = header.OrgId
@@ -75,7 +71,6 @@ func (controller *CooperationModeController) BatchRemoveCooperationMode() { @@ -75,7 +71,6 @@ func (controller *CooperationModeController) BatchRemoveCooperationMode() {
75 cooperationModeService := service.NewCooperationModeService(nil) 71 cooperationModeService := service.NewCooperationModeService(nil)
76 batchRemoveCooperationModeCommand := &command.BatchRemoveCooperationModeCommand{} 72 batchRemoveCooperationModeCommand := &command.BatchRemoveCooperationModeCommand{}
77 _ = controller.Unmarshal(batchRemoveCooperationModeCommand) 73 _ = controller.Unmarshal(batchRemoveCooperationModeCommand)
78 - // 解析头部信息  
79 header := controller.GetRequestHeader(controller.Ctx) 74 header := controller.GetRequestHeader(controller.Ctx)
80 batchRemoveCooperationModeCommand.CompanyId = header.CompanyId 75 batchRemoveCooperationModeCommand.CompanyId = header.CompanyId
81 batchRemoveCooperationModeCommand.OrgId = header.OrgId 76 batchRemoveCooperationModeCommand.OrgId = header.OrgId
@@ -89,7 +84,6 @@ func (controller *CooperationModeController) SearchCooperationMode() { @@ -89,7 +84,6 @@ func (controller *CooperationModeController) SearchCooperationMode() {
89 cooperationModeService := service.NewCooperationModeService(nil) 84 cooperationModeService := service.NewCooperationModeService(nil)
90 searchCooperationModeQuery := &query.SearchCooperationModeQuery{} 85 searchCooperationModeQuery := &query.SearchCooperationModeQuery{}
91 _ = controller.Unmarshal(searchCooperationModeQuery) 86 _ = controller.Unmarshal(searchCooperationModeQuery)
92 - // 解析头部信息  
93 header := controller.GetRequestHeader(controller.Ctx) 87 header := controller.GetRequestHeader(controller.Ctx)
94 searchCooperationModeQuery.CompanyId = header.CompanyId 88 searchCooperationModeQuery.CompanyId = header.CompanyId
95 searchCooperationModeQuery.OrgId = header.OrgId 89 searchCooperationModeQuery.OrgId = header.OrgId
@@ -102,7 +96,6 @@ func (controller *CooperationModeController) SearchCooperationMode() { @@ -102,7 +96,6 @@ func (controller *CooperationModeController) SearchCooperationMode() {
102 func (controller *CooperationModeController) ListCooperationMode() { 96 func (controller *CooperationModeController) ListCooperationMode() {
103 cooperationModeService := service.NewCooperationModeService(nil) 97 cooperationModeService := service.NewCooperationModeService(nil)
104 listCooperationModeQuery := &query.ListCooperationModeQuery{} 98 listCooperationModeQuery := &query.ListCooperationModeQuery{}
105 - // 解析头部信息  
106 header := controller.GetRequestHeader(controller.Ctx) 99 header := controller.GetRequestHeader(controller.Ctx)
107 listCooperationModeQuery.CompanyId = header.CompanyId 100 listCooperationModeQuery.CompanyId = header.CompanyId
108 listCooperationModeQuery.OrgId = header.OrgId 101 listCooperationModeQuery.OrgId = header.OrgId
@@ -120,7 +113,6 @@ func (controller *CooperationModeController) OperateCooperationMode() { @@ -120,7 +113,6 @@ func (controller *CooperationModeController) OperateCooperationMode() {
120 cooperationModeService := service.NewCooperationModeService(nil) 113 cooperationModeService := service.NewCooperationModeService(nil)
121 operateCooperationModeCommand := &command.OperateCooperationModeCommand{} 114 operateCooperationModeCommand := &command.OperateCooperationModeCommand{}
122 _ = controller.Unmarshal(operateCooperationModeCommand) 115 _ = controller.Unmarshal(operateCooperationModeCommand)
123 - // 解析头部信息  
124 header := controller.GetRequestHeader(controller.Ctx) 116 header := controller.GetRequestHeader(controller.Ctx)
125 operateCooperationModeCommand.CompanyId = header.CompanyId 117 operateCooperationModeCommand.CompanyId = header.CompanyId
126 operateCooperationModeCommand.OrgId = header.OrgId 118 operateCooperationModeCommand.OrgId = header.OrgId
@@ -134,7 +126,6 @@ func (controller *CooperationModeController) BatchOperateCooperationMode() { @@ -134,7 +126,6 @@ func (controller *CooperationModeController) BatchOperateCooperationMode() {
134 cooperationModeService := service.NewCooperationModeService(nil) 126 cooperationModeService := service.NewCooperationModeService(nil)
135 batchOperateCooperationModeCommand := &command.BatchOperateCooperationModeCommand{} 127 batchOperateCooperationModeCommand := &command.BatchOperateCooperationModeCommand{}
136 _ = controller.Unmarshal(batchOperateCooperationModeCommand) 128 _ = controller.Unmarshal(batchOperateCooperationModeCommand)
137 - // 解析头部信息  
138 header := controller.GetRequestHeader(controller.Ctx) 129 header := controller.GetRequestHeader(controller.Ctx)
139 batchOperateCooperationModeCommand.CompanyId = header.CompanyId 130 batchOperateCooperationModeCommand.CompanyId = header.CompanyId
140 batchOperateCooperationModeCommand.OrgId = header.OrgId 131 batchOperateCooperationModeCommand.OrgId = header.OrgId