作者 陈志颖

feat:调整阶段中文生成方法

@@ -3,9 +3,11 @@ package transform @@ -3,9 +3,11 @@ package transform
3 import ( 3 import (
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
6 ) 7 )
7 8
8 func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentivesRuleModel *models.DividendsIncentivesRule) (*domain.DividendsIncentivesRule, error) { 9 func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentivesRuleModel *models.DividendsIncentivesRule) (*domain.DividendsIncentivesRule, error) {
  10 + stageString := utils.NumberToCNNumber(int(dividendsIncentivesRuleModel.DividendsIncentivesStage))
9 return &domain.DividendsIncentivesRule{ 11 return &domain.DividendsIncentivesRule{
10 DividendsIncentivesRuleId: dividendsIncentivesRuleModel.DividendsIncentivesRuleId, 12 DividendsIncentivesRuleId: dividendsIncentivesRuleModel.DividendsIncentivesRuleId,
11 CooperationContractNumber: dividendsIncentivesRuleModel.CooperationContractNumber, 13 CooperationContractNumber: dividendsIncentivesRuleModel.CooperationContractNumber,
@@ -13,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv @@ -13,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv
13 SalesmanPercentage: dividendsIncentivesRuleModel.SalesmanPercentage, 15 SalesmanPercentage: dividendsIncentivesRuleModel.SalesmanPercentage,
14 DividendsIncentivesPercentage: dividendsIncentivesRuleModel.DividendsIncentivesPercentage, 16 DividendsIncentivesPercentage: dividendsIncentivesRuleModel.DividendsIncentivesPercentage,
15 DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage, 17 DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage,
  18 + DividendsIncentivesStageCN: stageString,
16 DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd, 19 DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd,
17 DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart, 20 DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart,
18 Remarks: dividendsIncentivesRuleModel.Remarks, 21 Remarks: dividendsIncentivesRuleModel.Remarks,
@@ -3,14 +3,17 @@ package transform @@ -3,14 +3,17 @@ package transform
3 import ( 3 import (
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
6 ) 7 )
7 8
8 func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel *models.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { 9 func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel *models.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) {
  10 + stageString := utils.NumberToCNNumber(int(moneyIncentivesRuleModel.MoneyIncentivesStage))
9 return &domain.MoneyIncentivesRule{ 11 return &domain.MoneyIncentivesRule{
10 MoneyIncentivesRuleId: moneyIncentivesRuleModel.MoneyIncentivesRuleId, 12 MoneyIncentivesRuleId: moneyIncentivesRuleModel.MoneyIncentivesRuleId,
11 CooperationContractNumber: moneyIncentivesRuleModel.CooperationContractNumber, 13 CooperationContractNumber: moneyIncentivesRuleModel.CooperationContractNumber,
12 MoneyIncentivesAmount: moneyIncentivesRuleModel.MoneyIncentivesAmount, 14 MoneyIncentivesAmount: moneyIncentivesRuleModel.MoneyIncentivesAmount,
13 MoneyIncentivesStage: moneyIncentivesRuleModel.MoneyIncentivesStage, 15 MoneyIncentivesStage: moneyIncentivesRuleModel.MoneyIncentivesStage,
  16 + MoneyIncentivesStageCN: stageString,
14 MoneyIncentivesStageEnd: moneyIncentivesRuleModel.MoneyIncentivesStageEnd, 17 MoneyIncentivesStageEnd: moneyIncentivesRuleModel.MoneyIncentivesStageEnd,
15 MoneyIncentivesStageStart: moneyIncentivesRuleModel.MoneyIncentivesStageStart, 18 MoneyIncentivesStageStart: moneyIncentivesRuleModel.MoneyIncentivesStageStart,
16 MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime, 19 MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime,
@@ -27,23 +27,6 @@ func Intersect(nums1 []int64, nums2 []int64) []int64 { @@ -27,23 +27,6 @@ func Intersect(nums1 []int64, nums2 []int64) []int64 {
27 return intersection 27 return intersection
28 } 28 }
29 29
30 -////求交集  
31 -//func intersect(slice1, slice2 []int64) []int64 {  
32 -// m := make(map[int64]int)  
33 -// nn := make([]int64, 0)  
34 -// for _, v := range slice1 {  
35 -// m[v]++  
36 -// }  
37 -//  
38 -// for _, v := range slice2 {  
39 -// times, _ := m[v]  
40 -// if times == 1 {  
41 -// nn = append(nn, v)  
42 -// }  
43 -// }  
44 -// return nn  
45 -//}  
46 -  
47 // Difference 求差集 slice1-并集 30 // Difference 求差集 slice1-并集
48 func Difference(slice1, slice2 []int64) []int64 { 31 func Difference(slice1, slice2 []int64) []int64 {
49 m := make(map[int64]int) 32 m := make(map[int64]int)
@@ -83,7 +66,7 @@ func Round(value float64, places int32) float64 { @@ -83,7 +66,7 @@ func Round(value float64, places int32) float64 {
83 66
84 // NumberToCNNumber 数字转中文数字 67 // NumberToCNNumber 数字转中文数字
85 func NumberToCNNumber(num int) string { 68 func NumberToCNNumber(num int) string {
86 - chineseMap := []string{"阶段", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"} 69 + chineseMap := []string{"", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"}
87 chineseNum := []string{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"} 70 chineseNum := []string{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"}
88 var listNum []int 71 var listNum []int
89 for ; num > 0; num = num / 10 { 72 for ; num > 0; num = num / 10 {
@@ -103,8 +86,9 @@ func NumberToCNNumber(num int) string { @@ -103,8 +86,9 @@ func NumberToCNNumber(num int) string {
103 copyChinese = strings.Replace(copyChinese, "零十", "零", 1) 86 copyChinese = strings.Replace(copyChinese, "零十", "零", 1)
104 copyChinese = strings.Replace(copyChinese, "零百", "零", 1) 87 copyChinese = strings.Replace(copyChinese, "零百", "零", 1)
105 copyChinese = strings.Replace(copyChinese, "零千", "零", 1) 88 copyChinese = strings.Replace(copyChinese, "零千", "零", 1)
106 - copyChinese = strings.Replace(copyChinese, "零零", "零", 1)  
107 - copyChinese = strings.Replace(copyChinese, "零圆", "圆", 1) 89 + copyChinese = strings.Replace(copyChinese, "零零", "", 1)
  90 + //copyChinese = strings.Replace(copyChinese, "零圆", "", 1)
  91 + //copyChinese = strings.Replace(copyChinese, "零", "", 1)
108 92
109 if copyChinese == chinese { 93 if copyChinese == chinese {
110 break 94 break
@@ -113,6 +97,6 @@ func NumberToCNNumber(num int) string { @@ -113,6 +97,6 @@ func NumberToCNNumber(num int) string {
113 } 97 }
114 } 98 }
115 99
116 - return "第" + chinese 100 + return "第" + chinese + "阶段"
117 101
118 } 102 }