作者 陈志颖

refactor:优化合约变更记录

@@ -1195,10 +1195,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1195,10 +1195,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1195 var undertakerChange string 1195 var undertakerChange string
1196 1196
1197 // 规则变更,原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】 1197 // 规则变更,原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】
1198 - if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType { // 1.激励规则类型变更  
1199 - if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 业绩分红变更为金额激励 1198 + if cooperationContractFound.IncentivesType != cooperationContract.IncentivesType { // 1.激励规则类型变更
  1199 + if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContract.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 业绩分红变更为金额激励
1200 // 业绩分红-->金额激励 1200 // 业绩分红-->金额激励
1201 - incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1201 + incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
1202 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1202 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1203 // 原业绩分红激励规则 1203 // 原业绩分红激励规则
1204 var dividendsIncentivesRuleOriginal string 1204 var dividendsIncentivesRuleOriginal string
@@ -1214,7 +1214,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1214,7 +1214,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1214 1214
1215 // 变更后的金额激励规则 1215 // 变更后的金额激励规则
1216 var moneyIncentivesRuleChanged string 1216 var moneyIncentivesRuleChanged string
1217 - for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules { 1217 + for _, moneyIncentivesRule := range cooperationContract.MoneyIncentivesRules {
1218 moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN + 1218 moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
1219 ":" + 1219 ":" +
1220 "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") + 1220 "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
@@ -1225,9 +1225,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1225,9 +1225,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1225 1225
1226 // 拼接规则变更 1226 // 拼接规则变更
1227 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp 1227 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
1228 - } else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 金额激励变更为业绩分红 1228 + } else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContract.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 金额激励变更为业绩分红
1229 // 金额激励-->业绩分红 1229 // 金额激励-->业绩分红
1230 - incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1230 + incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
1231 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1231 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1232 // 原金额激励规则 1232 // 原金额激励规则
1233 var moneyIncentivesRuleOriginal string 1233 var moneyIncentivesRuleOriginal string
@@ -1242,7 +1242,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1242,7 +1242,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1242 1242
1243 // 变更后的业绩分红激励规则 1243 // 变更后的业绩分红激励规则
1244 var dividendsIncentivesRuleChanged string 1244 var dividendsIncentivesRuleChanged string
1245 - for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { 1245 + for _, dividendsIncentivesRule := range cooperationContract.DividendsIncentivesRules {
1246 dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN + 1246 dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
1247 ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) + 1247 ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
1248 "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") + 1248 "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
@@ -1257,9 +1257,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1257,9 +1257,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1257 } 1257 }
1258 } else if cooperationContractFound.IncentivesType == cooperationContractSaved.IncentivesType { // 2.激励规则内容变更 1258 } else if cooperationContractFound.IncentivesType == cooperationContractSaved.IncentivesType { // 2.激励规则内容变更
1259 if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更 1259 if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更
1260 - if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) { 1260 + if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContract.DividendsIncentivesRules) {
1261 // 业绩分红-->业绩分红 1261 // 业绩分红-->业绩分红
1262 - incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1262 + incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
1263 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1263 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1264 // 原业绩分红激励规则 1264 // 原业绩分红激励规则
1265 var dividendsIncentivesRuleOriginal string 1265 var dividendsIncentivesRuleOriginal string
@@ -1274,7 +1274,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1274,7 +1274,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1274 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】" 1274 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
1275 // 变更后的业绩分红激励规则 1275 // 变更后的业绩分红激励规则
1276 var dividendsIncentivesRuleChanged string 1276 var dividendsIncentivesRuleChanged string
1277 - for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { 1277 + for _, dividendsIncentivesRule := range cooperationContract.DividendsIncentivesRules {
1278 dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN + 1278 dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
1279 ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) + 1279 ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
1280 "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") + 1280 "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
@@ -1287,8 +1287,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1287,8 +1287,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1287 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp 1287 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
1288 } 1288 }
1289 } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则内容变更 1289 } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则内容变更
1290 - if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {  
1291 - incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1290 + if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContract.MoneyIncentivesRules) {
  1291 + incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
1292 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1292 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1293 // 原金额激励规则 1293 // 原金额激励规则
1294 var moneyIncentivesRuleOriginal string 1294 var moneyIncentivesRuleOriginal string
@@ -1302,7 +1302,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1302,7 +1302,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1302 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" 1302 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
1303 // 变更后的激励规则 1303 // 变更后的激励规则
1304 var moneyIncentivesRuleChanged string 1304 var moneyIncentivesRuleChanged string
1305 - for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules { 1305 + for _, moneyIncentivesRule := range cooperationContract.MoneyIncentivesRules {
1306 moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN + 1306 moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
1307 ":" + 1307 ":" +
1308 "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") + 1308 "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
@@ -1317,7 +1317,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1317,7 +1317,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1317 } 1317 }
1318 1318
1319 // 承接人变更 1319 // 承接人变更
1320 - if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContractSaved.Undertakers) { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】 1320 + if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContract.Undertakers) { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
1321 // 原承接人 1321 // 原承接人
1322 var undertakersOriginal string 1322 var undertakersOriginal string
1323 for i, undertaker := range cooperationContractFound.Undertakers { 1323 for i, undertaker := range cooperationContractFound.Undertakers {
@@ -1401,7 +1401,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1401,7 +1401,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1401 IncentivesRuleDetail: incentivesRuleChangeDetail, 1401 IncentivesRuleDetail: incentivesRuleChangeDetail,
1402 OperationType: domain.EDIT, 1402 OperationType: domain.EDIT,
1403 Undertakers: undertakerChange, 1403 Undertakers: undertakerChange,
1404 - CooperationContractNumber: cooperationContractSaved.CooperationContractNumber, 1404 + CooperationContractNumber: cooperationContract.CooperationContractNumber,
1405 Company: company, 1405 Company: company,
1406 Org: organization, 1406 Org: organization,
1407 Operator: operator, 1407 Operator: operator,