作者 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 @@ -931,7 +931,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
931 } 931 }
932 932
933 // 获取待更新的共创合约 933 // 获取待更新的共创合约
934 - cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": updateCooperationContractCommand.CooperationContractId}) 934 + cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
  935 + "cooperationContractId": updateCooperationContractCommand.CooperationContractId,
  936 + })
935 if err8 != nil { 937 if err8 != nil {
936 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") 938 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
937 } 939 }
@@ -939,6 +941,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -939,6 +941,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
939 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) 941 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
940 } 942 }
941 943
  944 + // 缓存共创合约
942 cooperationContractFound := cooperationContract 945 cooperationContractFound := cooperationContract
943 946
944 // 更新合约基础信息 947 // 更新合约基础信息
@@ -1174,10 +1177,13 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1174,10 +1177,13 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1174 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err19.Error()) 1177 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err19.Error())
1175 } else { 1178 } else {
1176 // 保存共创合约变更记录 1179 // 保存共创合约变更记录
1177 - // 原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】  
1178 var incentivesRuleChange string 1180 var incentivesRuleChange string
1179 var incentivesRuleChangeDetail string 1181 var incentivesRuleChangeDetail string
1180 - if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更 1182 + var undertakerChange string
  1183 +
  1184 + // 规则变更,原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】
  1185 + if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType { // 1.激励规则类型变更
  1186 + if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 业绩分红变更为金额激励
1181 // 业绩分红-->金额激励 1187 // 业绩分红-->金额激励
1182 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1188 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1183 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1189 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
@@ -1206,7 +1212,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1206,7 +1212,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1206 1212
1207 // 拼接规则变更 1213 // 拼接规则变更
1208 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp 1214 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
1209 - } else if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { 1215 + } else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 金额激励变更为业绩分红
1210 // 金额激励-->业绩分红 1216 // 金额激励-->业绩分红
1211 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1217 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1212 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1218 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
@@ -1220,6 +1226,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1220,6 +1226,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1220 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" 1226 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
1221 } 1227 }
1222 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" 1228 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
  1229 +
1223 // 变更后的业绩分红激励规则 1230 // 变更后的业绩分红激励规则
1224 var dividendsIncentivesRuleChanged string 1231 var dividendsIncentivesRuleChanged string
1225 for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { 1232 for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
@@ -1231,10 +1238,12 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1231,10 +1238,12 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1231 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" 1238 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
1232 } 1239 }
1233 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】" 1240 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】"
  1241 +
1234 // 拼接规则变更 1242 // 拼接规则变更
1235 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp 1243 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
1236 - } else { // 2.激励规则变更  
1237 - if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红激励规则变更 1244 + }
  1245 + } else if cooperationContractFound.IncentivesType == cooperationContractSaved.IncentivesType { // 2.激励规则内容变更
  1246 + if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更
1238 if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) { 1247 if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) {
1239 // 业绩分红-->业绩分红 1248 // 业绩分红-->业绩分红
1240 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1249 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
@@ -1264,7 +1273,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1264,7 +1273,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1264 // 拼接规则变更 1273 // 拼接规则变更
1265 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp 1274 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
1266 } 1275 }
1267 - } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则变更 1276 + } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则内容变更
1268 if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) { 1277 if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {
1269 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1278 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1270 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1279 //【第一阶段: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 @@ -1294,9 +1303,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1294 } 1303 }
1295 } 1304 }
1296 1305
1297 - // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】  
1298 - var undertakerChange string  
1299 - if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContractSaved.Undertakers) { // 3.承接人变更 1306 + // 承接人变更
  1307 + if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContractSaved.Undertakers) { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
1300 // 原承接人 1308 // 原承接人
1301 var undertakersOriginal string 1309 var undertakersOriginal string
1302 for i, undertaker := range cooperationContractFound.Undertakers { 1310 for i, undertaker := range cooperationContractFound.Undertakers {
@@ -1374,6 +1382,125 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1374,6 +1382,125 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1374 undertakerChange = undertakerChangeTmp1 + " 变更为 " + undertakerChangeTemp2 1382 undertakerChange = undertakerChangeTmp1 + " 变更为 " + undertakerChangeTemp2
1375 } 1383 }
1376 1384
  1385 + //if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更
  1386 + // // 业绩分红-->金额激励
  1387 + // incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
  1388 + // //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
  1389 + // // 原业绩分红激励规则
  1390 + // var dividendsIncentivesRuleOriginal string
  1391 + // for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
  1392 + // dividendsIncentivesRuleOriginal = dividendsIncentivesRuleOriginal + dividendsIncentivesRule.DividendsIncentivesStageCN +
  1393 + // ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
  1394 + // "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
  1395 + // "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
  1396 + // "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
  1397 + // "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
  1398 + // }
  1399 + // dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
  1400 + //
  1401 + // // 变更后的金额激励规则
  1402 + // var moneyIncentivesRuleChanged string
  1403 + // for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
  1404 + // moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
  1405 + // ":" +
  1406 + // "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
  1407 + // "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
  1408 + // "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
  1409 + // }
  1410 + // moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleChanged + "】"
  1411 + //
  1412 + // // 拼接规则变更
  1413 + // incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
  1414 + //} else if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES {
  1415 + // // 金额激励-->业绩分红
  1416 + // incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
  1417 + // //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
  1418 + // // 原金额激励规则
  1419 + // var moneyIncentivesRuleOriginal string
  1420 + // for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
  1421 + // moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
  1422 + // ":" +
  1423 + // "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
  1424 + // "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
  1425 + // "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
  1426 + // }
  1427 + // moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
  1428 + //
  1429 + // // 变更后的业绩分红激励规则
  1430 + // var dividendsIncentivesRuleChanged string
  1431 + // for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
  1432 + // dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
  1433 + // ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
  1434 + // "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
  1435 + // "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
  1436 + // "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
  1437 + // "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
  1438 + // }
  1439 + // dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】"
  1440 + //
  1441 + // // 拼接规则变更
  1442 + // incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
  1443 + //} else { // 2.激励规则内容变更
  1444 + // if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红激励规则变更
  1445 + // if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) {
  1446 + // // 业绩分红-->业绩分红
  1447 + // incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
  1448 + // //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
  1449 + // // 原业绩分红激励规则
  1450 + // var dividendsIncentivesRuleOriginal string
  1451 + // for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
  1452 + // dividendsIncentivesRuleOriginal = dividendsIncentivesRuleOriginal + dividendsIncentivesRule.DividendsIncentivesStageCN +
  1453 + // ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
  1454 + // "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
  1455 + // "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
  1456 + // "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
  1457 + // "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
  1458 + // }
  1459 + // dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
  1460 + // // 变更后的业绩分红激励规则
  1461 + // var dividendsIncentivesRuleChanged string
  1462 + // for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
  1463 + // dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
  1464 + // ":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
  1465 + // "," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
  1466 + // "~" + dividendsIncentivesRule.DividendsIncentivesStageEnd.Format("2006-01-02") +
  1467 + // "," + fmt.Sprint(dividendsIncentivesRule.ReferrerPercentage) +
  1468 + // "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
  1469 + // }
  1470 + // dividendsIncentivesRuleChangedTmp := "【" + dividendsIncentivesRuleChanged + "】"
  1471 + // // 拼接规则变更
  1472 + // incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
  1473 + // }
  1474 + // } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则变更
  1475 + // if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {
  1476 + // incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
  1477 + // //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
  1478 + // // 原金额激励规则
  1479 + // var moneyIncentivesRuleOriginal string
  1480 + // for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
  1481 + // moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
  1482 + // ":" +
  1483 + // "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
  1484 + // "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
  1485 + // "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
  1486 + // }
  1487 + // moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
  1488 + // // 变更后的激励规则
  1489 + // var moneyIncentivesRuleChanged string
  1490 + // for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
  1491 + // moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
  1492 + // ":" +
  1493 + // "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
  1494 + // "," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
  1495 + // "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
  1496 + // }
  1497 + // moneyIncentivesRuleChangedTmp := "【" + moneyIncentivesRuleChanged + "】"
  1498 + // // 拼接规则变更
  1499 + // incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleChangedTmp
  1500 + // }
  1501 + // }
  1502 + //}
  1503 +
1377 // 新增共创合约变更记录 1504 // 新增共创合约变更记录
1378 newCooperationContractChangeLog := &domain.CooperationContractChangeLog{ 1505 newCooperationContractChangeLog := &domain.CooperationContractChangeLog{
1379 IncentivesRule: incentivesRuleChange, 1506 IncentivesRule: incentivesRuleChange,
@@ -1384,6 +1511,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1384,6 +1511,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1384 Company: company, 1511 Company: company,
1385 Org: organization, 1512 Org: organization,
1386 Operator: operator, 1513 Operator: operator,
  1514 + OperatorTime: time.Now(),
1387 UpdatedAt: time.Time{}, 1515 UpdatedAt: time.Time{},
1388 CreatedAt: time.Now(), 1516 CreatedAt: time.Now(),
1389 } 1517 }
1 package transform 1 package transform
2 2
3 import ( 3 import (
  4 + "github.com/shopspring/decimal"
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
6 ) 7 )
7 8
8 func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) { 9 func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) {
  10 + settlementAmount, _ := decimal.NewFromFloatWithExponent(creditAccountModel.SettlementAmount, -2).Float64()
9 return &domain.CreditAccount{ 11 return &domain.CreditAccount{
10 CreditAccountId: creditAccountModel.CreditAccountId, 12 CreditAccountId: creditAccountModel.CreditAccountId,
11 ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount, 13 ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
12 CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum, 14 CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
13 PaymentStatus: creditAccountModel.PaymentStatus, 15 PaymentStatus: creditAccountModel.PaymentStatus,
14 PaymentTime: creditAccountModel.PaymentTime, 16 PaymentTime: creditAccountModel.PaymentTime,
15 - SettlementAmount: creditAccountModel.SettlementAmount, 17 + SettlementAmount: settlementAmount,
16 SettlementTime: creditAccountModel.SettlementTime, 18 SettlementTime: creditAccountModel.SettlementTime,
17 CooperationContractNumber: creditAccountModel.CooperationContractNumber, 19 CooperationContractNumber: creditAccountModel.CooperationContractNumber,
18 Participator: creditAccountModel.Participator, 20 Participator: creditAccountModel.Participator,