作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creat…

…ion-cooperation into dev
正在显示 30 个修改的文件 包含 134 行增加82 行删除
@@ -14,7 +14,7 @@ type SearchContractUndertakerFeedbackQuery struct { @@ -14,7 +14,7 @@ type SearchContractUndertakerFeedbackQuery struct {
14 // 组织机构ID 14 // 组织机构ID
15 OrgId int64 `cname:"组织机构ID" json:"orgId"` 15 OrgId int64 `cname:"组织机构ID" json:"orgId"`
16 // 关联的组织机构ID列表 16 // 关联的组织机构ID列表
17 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 17 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 UserId int64 `cname:"用户ID" json:"userId"` 19 UserId int64 `cname:"用户ID" json:"userId"`
20 // 用户基础数据id 20 // 用户基础数据id
@@ -26,7 +26,7 @@ type SearchCooperationApplicationQuery struct { @@ -26,7 +26,7 @@ type SearchCooperationApplicationQuery struct {
26 // 组织机构ID 26 // 组织机构ID
27 OrgId int64 `cname:"组织机构ID" json:"orgId"` 27 OrgId int64 `cname:"组织机构ID" json:"orgId"`
28 // 关联的组织机构ID列表 28 // 关联的组织机构ID列表
29 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 29 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
30 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 30 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
31 UserId int64 `cname:"用户ID" json:"userId"` 31 UserId int64 `cname:"用户ID" json:"userId"`
32 // 用户基础数据id 32 // 用户基础数据id
@@ -21,6 +21,8 @@ type SearchCooperationContractQuery struct { @@ -21,6 +21,8 @@ type SearchCooperationContractQuery struct {
21 CompanyId int64 `cname:"公司ID" json:"companyId"` 21 CompanyId int64 `cname:"公司ID" json:"companyId"`
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId"`
  24 + // 关联的组织机构ID列表
  25 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
25 UserId int64 `cname:"用户ID" json:"userId"` 27 UserId int64 `cname:"用户ID" json:"userId"`
26 // 用户基础数据id 28 // 用户基础数据id
@@ -21,6 +21,8 @@ type SearchCooperationContractByUndertakerQuery struct { @@ -21,6 +21,8 @@ type SearchCooperationContractByUndertakerQuery struct {
21 CompanyId int64 `cname:"公司ID" json:"companyId"` 21 CompanyId int64 `cname:"公司ID" json:"companyId"`
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId"`
  24 + // 关联的组织机构ID列表
  25 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
25 UserId int64 `cname:"用户ID" json:"userId"` 27 UserId int64 `cname:"用户ID" json:"userId"`
26 // 用户基础数据id 28 // 用户基础数据id
@@ -1056,6 +1056,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1056,6 +1056,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1056 UpdatedAt: time.Time{}, 1056 UpdatedAt: time.Time{},
1057 DeletedAt: time.Time{}, 1057 DeletedAt: time.Time{},
1058 CreatedAt: time.Now(), 1058 CreatedAt: time.Now(),
  1059 + Remarks: dividendsIncentivesRule.Remarks,
1059 }) 1060 })
1060 } 1061 }
1061 1062
@@ -1084,6 +1085,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1084,6 +1085,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1084 UpdatedAt: time.Time{}, 1085 UpdatedAt: time.Time{},
1085 DeletedAt: time.Time{}, 1086 DeletedAt: time.Time{},
1086 CreatedAt: time.Now(), 1087 CreatedAt: time.Now(),
  1088 + Remarks: moneyIncentivesRule.Remarks,
1087 }) 1089 })
1088 } 1090 }
1089 1091
@@ -22,7 +22,7 @@ type SearchCooperationContractChangeLogQuery struct { @@ -22,7 +22,7 @@ type SearchCooperationContractChangeLogQuery struct {
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId"`
24 // 关联的组织机构ID列表 24 // 关联的组织机构ID列表
25 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 25 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
27 UserId int64 `cname:"用户ID" json:"userId"` 27 UserId int64 `cname:"用户ID" json:"userId"`
28 // 用户基础数据id 28 // 用户基础数据id
@@ -22,7 +22,7 @@ type SearchCooperationModeQuery struct { @@ -22,7 +22,7 @@ type SearchCooperationModeQuery struct {
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId"`
24 // 关联的组织机构ID列表 24 // 关联的组织机构ID列表
25 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 25 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
27 UserId int64 `cname:"用户ID" json:"userId"` 27 UserId int64 `cname:"用户ID" json:"userId"`
28 // 用户基础数据id 28 // 用户基础数据id
@@ -24,7 +24,7 @@ type SearchCooperationProjectQuery struct { @@ -24,7 +24,7 @@ type SearchCooperationProjectQuery struct {
24 // 组织机构ID 24 // 组织机构ID
25 OrgId int64 `cname:"组织机构ID" json:"orgId"` 25 OrgId int64 `cname:"组织机构ID" json:"orgId"`
26 // 关联的组织机构ID列表 26 // 关联的组织机构ID列表
27 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 27 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
28 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 28 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
29 UserId int64 `cname:"用户ID" json:"userId"` 29 UserId int64 `cname:"用户ID" json:"userId"`
30 // 用户基础数据id 30 // 用户基础数据id
@@ -27,7 +27,7 @@ type SearchCreditAccountQuery struct { @@ -27,7 +27,7 @@ type SearchCreditAccountQuery struct {
27 // 组织机构ID 27 // 组织机构ID
28 OrgId int64 `cname:"组织机构ID" json:"orgId"` 28 OrgId int64 `cname:"组织机构ID" json:"orgId"`
29 // 关联的组织机构ID列表 29 // 关联的组织机构ID列表
30 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 30 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
31 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 31 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
32 UserId int64 `cname:"用户ID" json:"userId"` 32 UserId int64 `cname:"用户ID" json:"userId"`
33 // 用户基础数据id 33 // 用户基础数据id
@@ -19,7 +19,7 @@ type SearchDividendsEstimateQuery struct { @@ -19,7 +19,7 @@ type SearchDividendsEstimateQuery struct {
19 // 组织机构ID 19 // 组织机构ID
20 OrgId int64 `cname:"组织机构ID" json:"orgId"` 20 OrgId int64 `cname:"组织机构ID" json:"orgId"`
21 // 关联的组织机构ID列表 21 // 关联的组织机构ID列表
22 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 22 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
23 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 23 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
24 UserId int64 `cname:"用户ID" json:"userId"` 24 UserId int64 `cname:"用户ID" json:"userId"`
25 // 用户基础数据id 25 // 用户基础数据id
@@ -19,7 +19,7 @@ type SearchDividendsIncentivesEstimateQuery struct { @@ -19,7 +19,7 @@ type SearchDividendsIncentivesEstimateQuery struct {
19 // 组织机构ID 19 // 组织机构ID
20 OrgId int64 `cname:"组织机构ID" json:"orgId"` 20 OrgId int64 `cname:"组织机构ID" json:"orgId"`
21 // 关联的组织机构ID列表 21 // 关联的组织机构ID列表
22 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 22 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
23 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 23 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
24 UserId int64 `cname:"用户ID" json:"userId"` 24 UserId int64 `cname:"用户ID" json:"userId"`
25 // 用户基础数据id 25 // 用户基础数据id
@@ -19,7 +19,7 @@ type SearchMoneyIncentivesEstimateQuery struct { @@ -19,7 +19,7 @@ type SearchMoneyIncentivesEstimateQuery struct {
19 // 组织机构ID 19 // 组织机构ID
20 OrgId int64 `cname:"组织机构ID" json:"orgId"` 20 OrgId int64 `cname:"组织机构ID" json:"orgId"`
21 // 关联的组织机构ID列表 21 // 关联的组织机构ID列表
22 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 22 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
23 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 23 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
24 UserId int64 `cname:"用户ID" json:"userId"` 24 UserId int64 `cname:"用户ID" json:"userId"`
25 // 用户基础数据id 25 // 用户基础数据id
@@ -22,7 +22,7 @@ type SearchDividendsOrderQuery struct { @@ -22,7 +22,7 @@ type SearchDividendsOrderQuery struct {
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId"`
24 // 关联的组织机构ID列表 24 // 关联的组织机构ID列表
25 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 25 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
27 UserId int64 `cname:"用户ID" json:"userId"` 27 UserId int64 `cname:"用户ID" json:"userId"`
28 // 用户基础数据id 28 // 用户基础数据id
@@ -16,7 +16,7 @@ type SearchDividendsOrderNumberQuery struct { @@ -16,7 +16,7 @@ type SearchDividendsOrderNumberQuery struct {
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId"`
18 // 关联的组织机构ID列表 18 // 关联的组织机构ID列表
19 - OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"` 19 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
21 UserId int64 `cname:"用户ID" json:"userId"` 21 UserId int64 `cname:"用户ID" json:"userId"`
22 // 用户基础数据id 22 // 用户基础数据id
@@ -19,6 +19,8 @@ type SearchDividendsReturnedOrderQuery struct { @@ -19,6 +19,8 @@ type SearchDividendsReturnedOrderQuery struct {
19 PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` 19 PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"`
20 // 公司ID,通过集成REST上下文获取 20 // 公司ID,通过集成REST上下文获取
21 CompanyId int64 `cname:"公司ID" json:"companyId"` 21 CompanyId int64 `cname:"公司ID" json:"companyId"`
  22 + // 关联的组织机构ID列表
  23 + OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
22 // 组织机构ID 24 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId"` 25 OrgId int64 `cname:"组织机构ID" json:"orgId"`
24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 26 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
@@ -162,7 +162,7 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st @@ -162,7 +162,7 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st
162 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 162 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
163 query.Where("org->>'orgId' = '?'", orgId) 163 query.Where("org->>'orgId' = '?'", orgId)
164 } 164 }
165 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 165 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
166 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 166 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
167 } 167 }
168 // 搜索内容包括项目合约名称、承接人姓名、承接内容关键字 168 // 搜索内容包括项目合约名称、承接人姓名、承接内容关键字
@@ -243,7 +243,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -243,7 +243,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
243 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 243 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
244 query.Where("org->>'orgId' = '?'", orgId) 244 query.Where("org->>'orgId' = '?'", orgId)
245 } 245 }
246 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 246 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
247 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 247 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
248 } 248 }
249 offsetLimitFlag := true 249 offsetLimitFlag := true
@@ -171,7 +171,7 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[ @@ -171,7 +171,7 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[
171 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 171 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
172 query.Where("org->>'orgId' = '?'", orgId) 172 query.Where("org->>'orgId' = '?'", orgId)
173 } 173 }
174 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 174 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
175 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 175 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
176 } 176 }
177 if offsetLimitFlag { 177 if offsetLimitFlag {
@@ -176,7 +176,7 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s @@ -176,7 +176,7 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s
176 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 176 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
177 query.Where("org->>'orgId' = '?'", orgId) 177 query.Where("org->>'orgId' = '?'", orgId)
178 } 178 }
179 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 179 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
180 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 180 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
181 } 181 }
182 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 { 182 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
@@ -167,7 +167,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -167,7 +167,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
167 var dividendsIncentivesRulesModel []*models.DividendsIncentivesRule 167 var dividendsIncentivesRulesModel []*models.DividendsIncentivesRule
168 for _, rule := range cooperationContract.DividendsIncentivesRules { 168 for _, rule := range cooperationContract.DividendsIncentivesRules {
169 dividendsIncentivesRulesModel = append(dividendsIncentivesRulesModel, &models.DividendsIncentivesRule{ 169 dividendsIncentivesRulesModel = append(dividendsIncentivesRulesModel, &models.DividendsIncentivesRule{
170 - DividendsIncentivesRuleId: 0,  
171 CooperationContractNumber: cooperationContract.CooperationContractNumber, 170 CooperationContractNumber: cooperationContract.CooperationContractNumber,
172 ReferrerPercentage: rule.ReferrerPercentage, 171 ReferrerPercentage: rule.ReferrerPercentage,
173 SalesmanPercentage: rule.SalesmanPercentage, 172 SalesmanPercentage: rule.SalesmanPercentage,
@@ -193,7 +192,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -193,7 +192,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
193 var moneyIncentivesRulesModel []*models.MoneyIncentivesRule 192 var moneyIncentivesRulesModel []*models.MoneyIncentivesRule
194 for _, rule := range cooperationContract.MoneyIncentivesRules { 193 for _, rule := range cooperationContract.MoneyIncentivesRules {
195 moneyIncentivesRulesModel = append(moneyIncentivesRulesModel, &models.MoneyIncentivesRule{ 194 moneyIncentivesRulesModel = append(moneyIncentivesRulesModel, &models.MoneyIncentivesRule{
196 - MoneyIncentivesRuleId: 0,  
197 CooperationContractNumber: cooperationContract.CooperationContractNumber, 195 CooperationContractNumber: cooperationContract.CooperationContractNumber,
198 MoneyIncentivesAmount: rule.MoneyIncentivesAmount, 196 MoneyIncentivesAmount: rule.MoneyIncentivesAmount,
199 MoneyIncentivesStage: rule.MoneyIncentivesStage, 197 MoneyIncentivesStage: rule.MoneyIncentivesStage,
@@ -292,21 +290,20 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -292,21 +290,20 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
292 var cooperationContractRelevantPeopleToAddModels []*models.CooperationContractRelevant 290 var cooperationContractRelevantPeopleToAddModels []*models.CooperationContractRelevant
293 for _, relevantDomain := range cooperationContractRelevantPeopleToAdd { 291 for _, relevantDomain := range cooperationContractRelevantPeopleToAdd {
294 cooperationContractRelevantPeopleToAddModels = append(cooperationContractRelevantPeopleToAddModels, &models.CooperationContractRelevant{ 292 cooperationContractRelevantPeopleToAddModels = append(cooperationContractRelevantPeopleToAddModels, &models.CooperationContractRelevant{
295 - CooperationContractRelevantId: 0,  
296 - CooperationContractNumber: relevantDomain.CooperationContractNumber,  
297 - UserId: relevantDomain.UserId,  
298 - UserBaseId: relevantDomain.UserBaseId,  
299 - Org: relevantDomain.Org,  
300 - Orgs: relevantDomain.Orgs,  
301 - Department: relevantDomain.Department,  
302 - Roles: relevantDomain.Roles,  
303 - UserInfo: relevantDomain.UserInfo,  
304 - UserType: relevantDomain.UserType,  
305 - Status: relevantDomain.Status,  
306 - Company: relevantDomain.Company,  
307 - UpdatedAt: time.Time{},  
308 - DeletedAt: time.Time{},  
309 - CreatedAt: time.Now(), 293 + CooperationContractNumber: relevantDomain.CooperationContractNumber,
  294 + UserId: relevantDomain.UserId,
  295 + UserBaseId: relevantDomain.UserBaseId,
  296 + Org: relevantDomain.Org,
  297 + Orgs: relevantDomain.Orgs,
  298 + Department: relevantDomain.Department,
  299 + Roles: relevantDomain.Roles,
  300 + UserInfo: relevantDomain.UserInfo,
  301 + UserType: relevantDomain.UserType,
  302 + Status: relevantDomain.Status,
  303 + Company: relevantDomain.Company,
  304 + UpdatedAt: time.Time{},
  305 + DeletedAt: time.Time{},
  306 + CreatedAt: time.Now(),
310 }) 307 })
311 } 308 }
312 309
@@ -437,27 +434,27 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -437,27 +434,27 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
437 "待更新的承接人": undertakerModelsToUpdate, 434 "待更新的承接人": undertakerModelsToUpdate,
438 }) 435 })
439 for i, undertakerModelToUpdate := range undertakerModelsToUpdate { 436 for i, undertakerModelToUpdate := range undertakerModelsToUpdate {
440 - for j, undertaker := range cooperationContract.Undertakers { 437 + for _, undertaker := range cooperationContract.Undertakers {
441 if undertaker.UndertakerId == undertakerModelToUpdate.CooperationContractUndertakerId { 438 if undertaker.UndertakerId == undertakerModelToUpdate.CooperationContractUndertakerId {
442 undertakerModelsToUpdate[i] = &models.CooperationContractUndertaker{ 439 undertakerModelsToUpdate[i] = &models.CooperationContractUndertaker{
443 - CooperationContractUndertakerId: cooperationContract.Undertakers[j].UndertakerId,  
444 - CooperationContractNumber: cooperationContract.Undertakers[j].CooperationContractNumber,  
445 - UserId: cooperationContract.Undertakers[j].UserId,  
446 - UserBaseId: cooperationContract.Undertakers[j].UserBaseId,  
447 - Org: cooperationContract.Undertakers[j].Org,  
448 - Orgs: cooperationContract.Undertakers[j].Orgs,  
449 - Department: cooperationContract.Undertakers[j].Department,  
450 - Roles: cooperationContract.Undertakers[j].Roles,  
451 - UserInfo: cooperationContract.Undertakers[j].UserInfo,  
452 - UserType: cooperationContract.Undertakers[j].UserType,  
453 - Referrer: cooperationContract.Undertakers[j].Referrer,  
454 - Salesman: cooperationContract.Undertakers[j].Salesman,  
455 - Status: cooperationContract.Undertakers[j].Status,  
456 - Company: cooperationContract.Undertakers[j].Company,  
457 - ContractAttachment: cooperationContract.Undertakers[j].ContractAttachment,  
458 - CreatedAt: undertakerModelsToUpdate[i].CreatedAt, 440 + CooperationContractUndertakerId: undertaker.UndertakerId,
  441 + CooperationContractNumber: undertaker.CooperationContractNumber,
  442 + UserId: undertaker.UserId,
  443 + UserBaseId: undertaker.UserBaseId,
  444 + Org: undertaker.Org,
  445 + Orgs: undertaker.Orgs,
  446 + Department: undertaker.Department,
  447 + Roles: undertaker.Roles,
  448 + UserInfo: undertaker.UserInfo,
  449 + UserType: undertaker.UserType,
  450 + Referrer: undertaker.Referrer,
  451 + Salesman: undertaker.Salesman,
  452 + Status: undertaker.Status,
  453 + Company: undertaker.Company,
  454 + ContractAttachment: undertaker.ContractAttachment,
  455 + CreatedAt: undertakerModelToUpdate.CreatedAt,
459 UpdatedAt: time.Now(), 456 UpdatedAt: time.Now(),
460 - DeletedAt: undertakerModelsToUpdate[i].DeletedAt, 457 + DeletedAt: undertakerModelToUpdate.DeletedAt,
461 } 458 }
462 } 459 }
463 } 460 }
@@ -561,7 +558,30 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -561,7 +558,30 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
561 log.Logger.Info("待更新的分红激励规则", map[string]interface{}{ 558 log.Logger.Info("待更新的分红激励规则", map[string]interface{}{
562 "dividendsRuleModelsToUpdate": dividendsRuleModelsToUpdate, 559 "dividendsRuleModelsToUpdate": dividendsRuleModelsToUpdate,
563 }) 560 })
  561 +
564 if len(dividendsRuleModelsToUpdate) > 0 { 562 if len(dividendsRuleModelsToUpdate) > 0 {
  563 + for i, dividendsRuleModelToUpdate := range dividendsRuleModelsToUpdate {
  564 + for _, dividendsRule := range cooperationContract.DividendsIncentivesRules {
  565 + if dividendsRule.DividendsIncentivesRuleId == dividendsRuleModelToUpdate.DividendsIncentivesRuleId {
  566 + dividendsRuleModelsToUpdate[i] = &models.DividendsIncentivesRule{
  567 + DividendsIncentivesRuleId: dividendsRuleModelToUpdate.DividendsIncentivesRuleId,
  568 + CooperationContractNumber: dividendsRuleModelToUpdate.CooperationContractNumber,
  569 + ReferrerPercentage: dividendsRuleModelToUpdate.ReferrerPercentage,
  570 + SalesmanPercentage: dividendsRuleModelToUpdate.SalesmanPercentage,
  571 + DividendsIncentivesPercentage: dividendsRuleModelToUpdate.DividendsIncentivesPercentage,
  572 + DividendsIncentivesStage: dividendsRuleModelToUpdate.DividendsIncentivesStage,
  573 + DividendsIncentivesStageEnd: dividendsRuleModelToUpdate.DividendsIncentivesStageEnd,
  574 + DividendsIncentivesStageStart: dividendsRuleModelToUpdate.DividendsIncentivesStageStart,
  575 + Remarks: dividendsRuleModelToUpdate.Remarks,
  576 + Org: dividendsRuleModelToUpdate.Org,
  577 + Company: dividendsRuleModelToUpdate.Company,
  578 + UpdatedAt: time.Now(),
  579 + DeletedAt: dividendsRuleModelToUpdate.DeletedAt,
  580 + CreatedAt: dividendsRuleModelToUpdate.CreatedAt,
  581 + }
  582 + }
  583 + }
  584 + }
565 if _, err := tx.Model(&dividendsRuleModelsToUpdate).WherePK().Update(); err != nil { 585 if _, err := tx.Model(&dividendsRuleModelsToUpdate).WherePK().Update(); err != nil {
566 return nil, err 586 return nil, err
567 } 587 }
@@ -659,6 +679,29 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai @@ -659,6 +679,29 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
659 "moneyRuleModelsToUpdate": moneyRuleModelsToUpdate, 679 "moneyRuleModelsToUpdate": moneyRuleModelsToUpdate,
660 }) 680 })
661 if len(moneyRuleModelsToUpdate) > 0 { 681 if len(moneyRuleModelsToUpdate) > 0 {
  682 + for i, moneyRuleModelToUpdate := range moneyRuleModelsToUpdate {
  683 + for _, moneyRule := range cooperationContract.MoneyIncentivesRules {
  684 + if moneyRule.MoneyIncentivesRuleId == moneyRuleModelToUpdate.MoneyIncentivesRuleId {
  685 + moneyRuleModelsToUpdate[i] = &models.MoneyIncentivesRule{
  686 + MoneyIncentivesRuleId: moneyRule.MoneyIncentivesRuleId,
  687 + CooperationContractNumber: moneyRule.CooperationContractNumber,
  688 + MoneyIncentivesAmount: moneyRule.MoneyIncentivesAmount,
  689 + MoneyIncentivesStage: moneyRule.MoneyIncentivesStage,
  690 + MoneyIncentivesStageEnd: moneyRule.MoneyIncentivesStageEnd,
  691 + MoneyIncentivesStageStart: moneyRule.MoneyIncentivesStageStart,
  692 + MoneyIncentivesTime: moneyRule.MoneyIncentivesTime,
  693 + ReferrerPercentage: moneyRule.MoneyIncentivesAmount,
  694 + SalesmanPercentage: moneyRule.MoneyIncentivesAmount,
  695 + Remarks: moneyRule.Remarks,
  696 + Org: moneyRule.Org,
  697 + Company: moneyRule.Company,
  698 + UpdatedAt: time.Now(),
  699 + DeletedAt: moneyRuleModelToUpdate.DeletedAt,
  700 + CreatedAt: moneyRuleModelToUpdate.CreatedAt,
  701 + }
  702 + }
  703 + }
  704 + }
662 if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil { 705 if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil {
663 return nil, err 706 return nil, err
664 } 707 }
@@ -952,7 +995,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -952,7 +995,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
952 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 995 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
953 query.Where("org->>'orgId' = '?'", orgId) 996 query.Where("org->>'orgId' = '?'", orgId)
954 } 997 }
955 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 998 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
956 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 999 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
957 } 1000 }
958 if incentivesType, ok := queryOptions["incentivesType"]; ok && incentivesType.(int32) != 0 { 1001 if incentivesType, ok := queryOptions["incentivesType"]; ok && incentivesType.(int32) != 0 {
@@ -187,7 +187,7 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map @@ -187,7 +187,7 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map
187 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 187 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
188 query.Where("org->>'orgId' = '?'", orgId) 188 query.Where("org->>'orgId' = '?'", orgId)
189 } 189 }
190 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 190 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
191 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 191 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
192 } 192 }
193 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 { 193 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
@@ -187,7 +187,7 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf @@ -187,7 +187,7 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf
187 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 187 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
188 query.Where("org->>'orgId' = '?'", orgId) 188 query.Where("org->>'orgId' = '?'", orgId)
189 } 189 }
190 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 190 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
191 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 191 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
192 } 192 }
193 offsetLimitFlag := true 193 offsetLimitFlag := true
@@ -249,7 +249,7 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -249,7 +249,7 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
249 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 249 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
250 query.Where("org->>'orgId' = '?'", orgId) 250 query.Where("org->>'orgId' = '?'", orgId)
251 } 251 }
252 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 252 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
253 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 253 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
254 } 254 }
255 if v, ok := queryOptions["status"]; ok && v.(int32) > 0 { 255 if v, ok := queryOptions["status"]; ok && v.(int32) > 0 {
@@ -218,7 +218,7 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac @@ -218,7 +218,7 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac
218 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 218 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
219 query.Where("org->>'orgId' = '?'", orgId) 219 query.Where("org->>'orgId' = '?'", orgId)
220 } 220 }
221 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 221 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
222 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 222 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
223 } 223 }
224 offsetLimitFlag := true 224 offsetLimitFlag := true
@@ -301,7 +301,7 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte @@ -301,7 +301,7 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
301 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 301 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
302 query.Where("org->>'orgId' = '?'", orgId) 302 query.Where("org->>'orgId' = '?'", orgId)
303 } 303 }
304 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 304 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
305 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 305 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
306 } 306 }
307 offsetLimitFlag := true 307 offsetLimitFlag := true
@@ -171,7 +171,7 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin @@ -171,7 +171,7 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin
171 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 171 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
172 query.Where("org->>'orgId' = '?'", orgId) 172 query.Where("org->>'orgId' = '?'", orgId)
173 } 173 }
174 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 174 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
175 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 175 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
176 } 176 }
177 offsetLimitFlag := true 177 offsetLimitFlag := true
@@ -243,30 +243,31 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend @@ -243,30 +243,31 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
243 log.Logger.Info("待更新的分红订单产品", map[string]interface{}{ 243 log.Logger.Info("待更新的分红订单产品", map[string]interface{}{
244 "orderGoodModelsToUpdate": orderGoodModelsToUpdate, 244 "orderGoodModelsToUpdate": orderGoodModelsToUpdate,
245 }) 245 })
246 - for i, orderGoodModelToUpdate := range orderGoodModelsToUpdate {  
247 - for j, orderGood := range dividendsOrder.Goods {  
248 - if orderGood.OrderGoodId == orderGoodModelToUpdate.OrderGoodId {  
249 - orderGoodModelsToUpdate[i] = &models.OrderGood{  
250 - OrderGoodId: dividendsOrder.Goods[j].OrderGoodId,  
251 - OrderGoodAmount: dividendsOrder.Goods[j].OrderGoodAmount,  
252 - OrderGoodName: dividendsOrder.Goods[j].OrderGoodName,  
253 - OrderGoodPrice: dividendsOrder.Goods[j].OrderGoodPrice,  
254 - OrderGoodQuantity: dividendsOrder.Goods[j].OrderGoodQuantity,  
255 - DividendsOrderNumber: dividendsOrder.Goods[j].DividendsOrderNumber,  
256 - DividendsReturnedOrderNumber: dividendsOrder.Goods[j].DividendsReturnedOrderNumber,  
257 - CooperationContractNumber: dividendsOrder.Goods[j].CooperationContractNumber,  
258 - OrgId: dividendsOrder.Goods[j].OrgId,  
259 - CompanyId: dividendsOrder.Goods[j].CompanyId,  
260 - OrderGoodExpense: dividendsOrder.Goods[j].OrderGoodExpense,  
261 - OrderGoodDividendsStatus: dividendsOrder.Goods[j].OrderGoodDividendsStatus,  
262 - CreatedAt: orderGoodModelsToUpdate[i].CreatedAt,  
263 - DeletedAt: orderGoodModelsToUpdate[i].DeletedAt,  
264 - UpdatedAt: time.Now(), 246 +
  247 + if len(orderGoodModelsToUpdate) > 0 {
  248 + for i, orderGoodModelToUpdate := range orderGoodModelsToUpdate {
  249 + for _, orderGood := range dividendsOrder.Goods {
  250 + if orderGood.OrderGoodId == orderGoodModelToUpdate.OrderGoodId {
  251 + orderGoodModelsToUpdate[i] = &models.OrderGood{
  252 + OrderGoodId: orderGoodModelToUpdate.OrderGoodId,
  253 + OrderGoodAmount: orderGoodModelToUpdate.OrderGoodAmount,
  254 + OrderGoodName: orderGoodModelToUpdate.OrderGoodName,
  255 + OrderGoodPrice: orderGoodModelToUpdate.OrderGoodPrice,
  256 + OrderGoodQuantity: orderGoodModelToUpdate.OrderGoodQuantity,
  257 + DividendsOrderNumber: orderGoodModelToUpdate.DividendsOrderNumber,
  258 + DividendsReturnedOrderNumber: orderGoodModelToUpdate.DividendsReturnedOrderNumber,
  259 + CooperationContractNumber: orderGoodModelToUpdate.CooperationContractNumber,
  260 + OrgId: orderGoodModelToUpdate.OrgId,
  261 + CompanyId: orderGoodModelToUpdate.CompanyId,
  262 + OrderGoodExpense: orderGoodModelToUpdate.OrderGoodExpense,
  263 + OrderGoodDividendsStatus: orderGoodModelToUpdate.OrderGoodDividendsStatus,
  264 + CreatedAt: orderGoodModelToUpdate.CreatedAt,
  265 + DeletedAt: orderGoodModelToUpdate.DeletedAt,
  266 + UpdatedAt: time.Now(),
  267 + }
265 } 268 }
266 } 269 }
267 } 270 }
268 - }  
269 - if len(orderGoodModelsToUpdate) > 0 {  
270 if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil { 271 if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
271 return nil, err 272 return nil, err
272 } 273 }
@@ -412,7 +413,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa @@ -412,7 +413,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
412 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 413 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
413 query.Where("org->>'orgId' = '?'", orgId) 414 query.Where("org->>'orgId' = '?'", orgId)
414 } 415 }
415 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 416 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
416 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 417 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
417 } 418 }
418 offsetLimitFlag := true 419 offsetLimitFlag := true
@@ -415,7 +415,7 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string @@ -415,7 +415,7 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
415 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 415 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
416 query.Where("org->>'orgId' = '?'", orgId) 416 query.Where("org->>'orgId' = '?'", orgId)
417 } 417 }
418 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 418 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
419 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 419 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
420 } 420 }
421 offsetLimitFlag := true 421 offsetLimitFlag := true
@@ -171,7 +171,7 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in @@ -171,7 +171,7 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in
171 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 171 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
172 query.Where("org->>'orgId' = '?'", orgId) 172 query.Where("org->>'orgId' = '?'", orgId)
173 } 173 }
174 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 174 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
175 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 175 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
176 } 176 }
177 offsetLimitFlag := true 177 offsetLimitFlag := true
@@ -184,7 +184,7 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) @@ -184,7 +184,7 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{})
184 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 184 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
185 query.Where("org_id = '?'", orgId) 185 query.Where("org_id = '?'", orgId)
186 } 186 }
187 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 187 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
188 query.Where("org_id in (?)", pg.In(orgIds)) 188 query.Where("org_id in (?)", pg.In(orgIds))
189 } 189 }
190 offsetLimitFlag := true 190 offsetLimitFlag := true