作者 yangfu

Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/allied-crea…

…tion-cooperation into test
... ... @@ -931,7 +931,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
}
// 获取待更新的共创合约
cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": updateCooperationContractCommand.CooperationContractId})
cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
"cooperationContractId": updateCooperationContractCommand.CooperationContractId,
})
if err8 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
}
... ... @@ -939,6 +941,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
}
// 缓存共创合约
cooperationContractFound := cooperationContract
// 更新合约基础信息
... ... @@ -1174,67 +1177,73 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err19.Error())
} else {
// 保存共创合约变更记录
// 原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】
var incentivesRuleChange string
var incentivesRuleChangeDetail string
if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更
// 业绩分红-->金额激励
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// 原业绩分红激励规则
var dividendsIncentivesRuleOriginal string
for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
dividendsIncentivesRuleOriginal = dividendsIncentivesRuleOriginal + dividendsIncentivesRule.DividendsIncentivesStageCN +
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
"~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
"," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
}
dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
// 变更后的金额激励规则
var moneyIncentivesRuleChanged string
for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
":" +
"," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
}
moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleChanged + "】"
// 拼接规则变更
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
} else if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES {
// 金额激励-->业绩分红
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// 原金额激励规则
var moneyIncentivesRuleOriginal string
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
":" +
"," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
}
moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
// 变更后的业绩分红激励规则
var dividendsIncentivesRuleChanged string
for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
"~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
"," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
var undertakerChange string
// 规则变更,原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】
if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType { // 1.激励规则类型变更
if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 业绩分红变更为金额激励
// 业绩分红-->金额激励
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// 原业绩分红激励规则
var dividendsIncentivesRuleOriginal string
for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
dividendsIncentivesRuleOriginal = dividendsIncentivesRuleOriginal + dividendsIncentivesRule.DividendsIncentivesStageCN +
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
"~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
"," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
}
dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
// 变更后的金额激励规则
var moneyIncentivesRuleChanged string
for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
":" +
"," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
}
moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleChanged + "】"
// 拼接规则变更
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
} else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 金额激励变更为业绩分红
// 金额激励-->业绩分红
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// 原金额激励规则
var moneyIncentivesRuleOriginal string
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
":" +
"," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
}
moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
// 变更后的业绩分红激励规则
var dividendsIncentivesRuleChanged string
for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
"~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
"," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
"," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
}
dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】"
// 拼接规则变更
incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
}
dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】"
// 拼接规则变更
incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
} else { // 2.激励规则变更
if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红激励规则变更
} else if cooperationContractFound.IncentivesType == cooperationContractSaved.IncentivesType { // 2.激励规则内容变更
if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更
if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) {
// 业绩分红-->业绩分红
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
... ... @@ -1264,7 +1273,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
// 拼接规则变更
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
}
} else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则变更
} else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则内容变更
if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
... ... @@ -1294,9 +1303,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
}
}
// 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
var undertakerChange string
if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContractSaved.Undertakers) { // 3.承接人变更
// 承接人变更
if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContractSaved.Undertakers) { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
// 原承接人
var undertakersOriginal string
for i, undertaker := range cooperationContractFound.Undertakers {
... ... @@ -1374,6 +1382,125 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
undertakerChange = undertakerChangeTmp1 + " 变更为 " + undertakerChangeTemp2
}
//if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更
// // 业绩分红-->金额激励
// incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
// //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// // 原业绩分红激励规则
// var dividendsIncentivesRuleOriginal string
// for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
// dividendsIncentivesRuleOriginal = dividendsIncentivesRuleOriginal + dividendsIncentivesRule.DividendsIncentivesStageCN +
// ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
// "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
// "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
// "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
// }
// dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
//
// // 变更后的金额激励规则
// var moneyIncentivesRuleChanged string
// for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
// moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
// ":" +
// "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
// "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
// }
// moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleChanged + "】"
//
// // 拼接规则变更
// incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
//} else if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES {
// // 金额激励-->业绩分红
// incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
// //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// // 原金额激励规则
// var moneyIncentivesRuleOriginal string
// for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
// moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
// ":" +
// "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
// "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
// }
// moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
//
// // 变更后的业绩分红激励规则
// var dividendsIncentivesRuleChanged string
// for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
// dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
// ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
// "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
// "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
// "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
// }
// dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】"
//
// // 拼接规则变更
// incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
//} else { // 2.激励规则内容变更
// if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红激励规则变更
// if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) {
// // 业绩分红-->业绩分红
// incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
// //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// // 原业绩分红激励规则
// var dividendsIncentivesRuleOriginal string
// for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
// dividendsIncentivesRuleOriginal = dividendsIncentivesRuleOriginal + dividendsIncentivesRule.DividendsIncentivesStageCN +
// ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
// "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
// "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
// "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
// }
// dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
// // 变更后的业绩分红激励规则
// var dividendsIncentivesRuleChanged string
// for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
// dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
// ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
// "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
// "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
// "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
// }
// dividendsIncentivesRuleChangedTmp := "【" + dividendsIncentivesRuleChanged + "】"
// // 拼接规则变更
// incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
// }
// } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则变更
// if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {
// incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
// //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
// // 原金额激励规则
// var moneyIncentivesRuleOriginal string
// for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
// moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
// ":" +
// "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
// "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
// }
// moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
// // 变更后的激励规则
// var moneyIncentivesRuleChanged string
// for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
// moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
// ":" +
// "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
// "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
// "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
// }
// moneyIncentivesRuleChangedTmp := "【" + moneyIncentivesRuleChanged + "】"
// // 拼接规则变更
// incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleChangedTmp
// }
// }
//}
// 新增共创合约变更记录
newCooperationContractChangeLog := &domain.CooperationContractChangeLog{
IncentivesRule: incentivesRuleChange,
... ... @@ -1384,6 +1511,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
Company: company,
Org: organization,
Operator: operator,
OperatorTime: time.Now(),
UpdatedAt: time.Time{},
CreatedAt: time.Now(),
}
... ...
package transform
import (
"github.com/shopspring/decimal"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) {
settlementAmount, _ := decimal.NewFromFloatWithExponent(creditAccountModel.SettlementAmount, -2).Float64()
return &domain.CreditAccount{
CreditAccountId: creditAccountModel.CreditAccountId,
ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
PaymentStatus: creditAccountModel.PaymentStatus,
PaymentTime: creditAccountModel.PaymentTime,
SettlementAmount: creditAccountModel.SettlementAmount,
SettlementAmount: settlementAmount,
SettlementTime: creditAccountModel.SettlementTime,
CooperationContractNumber: creditAccountModel.CooperationContractNumber,
Participator: creditAccountModel.Participator,
... ...