作者 陈志颖

fix:共创合约变更记录

@@ -43,7 +43,7 @@ type UpdateCooperationContractCommand struct { @@ -43,7 +43,7 @@ type UpdateCooperationContractCommand struct {
43 43
44 func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) { 44 func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) {
45 // 激励规则自定义校验 45 // 激励规则自定义校验
46 - if len(updateCooperationContractCommand.DividendsIncentivesRules) <= 0 && len(updateCooperationContractCommand.MoneyIncentivesRules) <= 0 { 46 + if len(updateCooperationContractCommand.DividendsIncentivesRules) < 1 && len(updateCooperationContractCommand.MoneyIncentivesRules) < 1 {
47 validation.Error("激励规则不能为空") 47 validation.Error("激励规则不能为空")
48 } else { 48 } else {
49 for i, _ := range updateCooperationContractCommand.DividendsIncentivesRules { 49 for i, _ := range updateCooperationContractCommand.DividendsIncentivesRules {
@@ -58,7 +58,7 @@ func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid( @@ -58,7 +58,7 @@ func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(
58 } 58 }
59 } 59 }
60 // 承接人列表校验 60 // 承接人列表校验
61 - if len(updateCooperationContractCommand.Undertakers) <= 0 { 61 + if len(updateCooperationContractCommand.Undertakers) < 1 {
62 validation.Error("承接人不能为空") 62 validation.Error("承接人不能为空")
63 } else { 63 } else {
64 for i, _ := range updateCooperationContractCommand.Undertakers { 64 for i, _ := range updateCooperationContractCommand.Undertakers {
@@ -746,7 +746,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper @@ -746,7 +746,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper
746 if err != nil { 746 if err != nil {
747 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 747 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
748 } 748 }
749 - for _, cooperationContractOperated := range cooperationContractsOperated { 749 + for _, cooperationContractOperated := range cooperationContracts {
750 // 新增共创合约变更记录 750 // 新增共创合约变更记录
751 var operationType int32 751 var operationType int32
752 if batchOperateCooperationContractCommand.Action == 1 { 752 if batchOperateCooperationContractCommand.Action == 1 {
@@ -764,6 +764,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper @@ -764,6 +764,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper
764 Org: cooperationContractOperated.Org, 764 Org: cooperationContractOperated.Org,
765 Operator: operator, 765 Operator: operator,
766 CreatedAt: time.Now(), 766 CreatedAt: time.Now(),
  767 + OperatorTime: time.Now(),
767 } 768 }
768 769
769 // 保存共创合约变更记录 770 // 保存共创合约变更记录
@@ -1255,7 +1256,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1255,7 +1256,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1255 // 拼接规则变更 1256 // 拼接规则变更
1256 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp 1257 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
1257 } 1258 }
1258 - } else if cooperationContractFound.IncentivesType == cooperationContractSaved.IncentivesType { // 2.激励规则内容变更 1259 + } else if cooperationContractFound.IncentivesType == cooperationContract.IncentivesType { // 2.激励规则内容变更
1259 if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更 1260 if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更
1260 if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContract.DividendsIncentivesRules) { 1261 if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContract.DividendsIncentivesRules) {
1261 // 业绩分红-->业绩分红 1262 // 业绩分红-->业绩分红
@@ -1357,7 +1358,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1357,7 +1358,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1357 1358
1358 // 变更承接人 1359 // 变更承接人
1359 var undertakersChanged string 1360 var undertakersChanged string
1360 - for i, undertaker := range cooperationContractSaved.Undertakers { 1361 + for i, undertaker := range cooperationContract.Undertakers {
1361 if undertaker.Referrer == nil { 1362 if undertaker.Referrer == nil {
1362 undertaker.Referrer = &domain.Referrer{ 1363 undertaker.Referrer = &domain.Referrer{
1363 UserId: 0, 1364 UserId: 0,