作者 陈志颖

refactor:优化合约变更记录

... ... @@ -981,10 +981,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
}
// 获取待更新的共创合约
cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
cooperationContract, err9 := cooperationContractRepository.FindOne(map[string]interface{}{
"cooperationContractId": updateCooperationContractCommand.CooperationContractId,
})
if err8 != nil {
if err9 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
}
if cooperationContract == nil {
... ... @@ -992,8 +992,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
}
// 更新合约基础信息
if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
if err10 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err10 != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err10.Error())
}
// 更新发起人
... ... @@ -1357,7 +1357,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
var moneyIncentivesRuleOriginal string
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
":" +
":" + fmt.Sprint(moneyIncentivesRule.MoneyIncentivesAmount) +
"," + moneyIncentivesRule.MoneyIncentivesTime.Format("2006-01-02") +
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
... ... @@ -1367,7 +1367,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
var moneyIncentivesRuleChanged string
for _, moneyIncentivesRule := range cooperationContract.MoneyIncentivesRules {
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
":" +
":" + fmt.Sprint(moneyIncentivesRule.MoneyIncentivesAmount) +
"," + moneyIncentivesRule.MoneyIncentivesTime.Format("2006-01-02") +
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
... ...
... ... @@ -25,8 +25,8 @@ func TransformToCooperationContractDomainModelFromPgModels(
DividendsIncentivesPercentage: rule.DividendsIncentivesPercentage,
DividendsIncentivesStage: rule.DividendsIncentivesStage,
DividendsIncentivesStageCN: stageString,
DividendsIncentivesStageEnd: rule.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: rule.DividendsIncentivesStageStart,
DividendsIncentivesStageEnd: rule.DividendsIncentivesStageEnd.Local(),
DividendsIncentivesStageStart: rule.DividendsIncentivesStageStart.Local(),
Org: rule.Org,
Company: rule.Company,
UpdatedAt: rule.UpdatedAt,
... ... @@ -47,7 +47,7 @@ func TransformToCooperationContractDomainModelFromPgModels(
MoneyIncentivesStageCN: stageString,
MoneyIncentivesStageEnd: rule.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: rule.MoneyIncentivesStageStart,
MoneyIncentivesTime: rule.MoneyIncentivesTime,
MoneyIncentivesTime: rule.MoneyIncentivesTime.Local(),
ReferrerPercentage: rule.ReferrerPercentage,
SalesmanPercentage: rule.SalesmanPercentage,
Org: rule.Org,
... ...
... ... @@ -1111,7 +1111,7 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string
if err := cooperationContractUndertakerQuery.
Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId).
Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).
Where("cooperation_contract_id = ?", cooperationContractModel.CooperationContractId).
Select(); err != nil {
return nil, fmt.Errorf("合约承接人不存在")
}
... ...