作者 唐旭辉

Merge branch 'dev' into test

@@ -12,5 +12,5 @@ ENV GO111MODULE on @@ -12,5 +12,5 @@ ENV GO111MODULE on
12 ENV GOPROXY https://goproxy.cn 12 ENV GOPROXY https://goproxy.cn
13 # RUN ["go","mod","tidy"] 13 # RUN ["go","mod","tidy"]
14 RUN ["go","build","-mod=vendor"] 14 RUN ["go","build","-mod=vendor"]
15 -EXPOSE 8082 15 +EXPOSE 8082 443
16 ENTRYPOINT ["./partnermg"] 16 ENTRYPOINT ["./partnermg"]
  1 +-----BEGIN RSA PRIVATE KEY-----
  2 +MIIEowIBAAKCAQEAjlYTMGgbnNvRnlNpSBXkXCC9FGcRjHnZb5ez/bgatsUawan9
  3 +Ou4a92X2cF1xQvALrvV8FgNpkUL4o8XUeWAN4DWOpSNKNUyEYy68jXr4FSUFSBEt
  4 +UytZrAWd5K+nvdNiACZFUfNyCDy2vs1mBtsA9TVyJEjk2MU+xMjCg8Jiv4LwGJze
  5 +33x7VDi/qurbaWQpLHvpsrDTtaC51s+JWu5etK1rDO45gjpo6QmaSuNxkuPAjJVO
  6 +1qwCf0Fz5H3EHiVFmz09nVbFCH/7a/d8WB1NMNRZAEOkOLUdVFLkrINMawcWBqx4
  7 +dl+ODIa8D50IiHuAbx4j6kXbNkDpQAYz+zOmNQIDAQABAoIBAB+bfyLgd4NHcB7V
  8 +vHsgu2d28K37blLwywdkG3jj3XDJR9YKMtzXe58FIirVIT3hUuLdChtUUijLA65Q
  9 +k8yJN0Oa+Qx0T/oSfhKNUhsj27vMTwYwJE3EAmN4EtYx6JC3hFtupDWc1y17mAQ6
  10 +VeX/U5DgN7LVihYWBQiLYWCDdcy7iBCCdgODHv1Zp6/Y1XLv5L9vUU1XK1GcIgZb
  11 +Ubbql6np6tzQm3LMS1xyhl4vwFSRDx9sSZ9C6dWlNT+3qLNjnPCsvY6709DgGgYz
  12 +Qu3C31uxDLzjS4KAYbOMmJl/knzyyhXHvRb1hz7kOsdmzUGOZl9ga/bcIbzDmp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QcDAQYIKwYBBQUHAwIwNQYDVR0fBC4w
  51 +LDAqoCigJoYkaHR0cDovL3N1YmNhLmNybC5jZXJ0dW0ucGwvY3RuY2EuY3JsMGsG
  52 +CCsGAQUFBwEBBF8wXTAoBggrBgEFBQcwAYYcaHR0cDovL3N1YmNhLm9jc3AtY2Vy
  53 +dHVtLmNvbTAxBggrBgEFBQcwAoYlaHR0cDovL3JlcG9zaXRvcnkuY2VydHVtLnBs
  54 +L2N0bmNhLmNlcjA5BgNVHSAEMjAwMC4GBFUdIAAwJjAkBggrBgEFBQcCARYYaHR0
  55 +cDovL3d3dy5jZXJ0dW0ucGwvQ1BTMA0GCSqGSIb3DQEBCwUAA4IBAQCLBeq0MMgd
  56 +qULSuAua1YwHNgbFAAnMXd9iiSxbIKoSfYKsrFggNCFX73ex4b64iIhQ2BBr82/B
  57 +MNpC4rEvnr1x0oFv8DBO1GYimQaq8E9hjnO1UYYEPelVsykOpnDLklTsBZ4vhhq/
  58 +hq1mbs+6G+vsAjO9jVnuxP6toOTNBqvURRumMF0P165MoFdh0kzSjUts+1d8Llnb
  59 +DJaZht0O19k1ZdBBmPD3cwbTI+tChOELAVt4Nb5dDGPWqSxc5Nl2j95T3aK1KL2d
  60 +2vV16DSVShJIz04QHatcJlNZLJDbSu70c5fPU8YiJdRpfkubANAmwcDB+uNhtYz+
  61 +zEji0KnE2oNA
  62 +-----END CERTIFICATE-----
  63 +-----BEGIN CERTIFICATE-----
  64 +MIIEtDCCA5ygAwIBAgIRAJOShUABZXFflH8oj+/JmygwDQYJKoZIhvcNAQELBQAw
  65 +PjELMAkGA1UEBhMCUEwxGzAZBgNVBAoTElVuaXpldG8gU3AuIHogby5vLjESMBAG
  66 +A1UEAxMJQ2VydHVtIENBMB4XDTA4MTAyMjEyMDczN1oXDTI3MDYxMDEwNDYzOVow
  67 +fjELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu
  68 +QS4xJzAlBgNVB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BQADggEBAI3m/UBmo0yc
  84 +p6uh2oTdHDAH5tvHLeyDoVbkHTwmoaUJK+h9Yr6ydZTdCPJ/KEHkgGcCToqPwzXQ
  85 +1aknKOrS9KsGhkOujOP5iH3g271CgYACEnWy6BdxqyGVMUZCDYgQOdNv7C9C6kBT
  86 +Yr/rynieq6LVLgXqM6vp1peUQl4E7Sztapx6lX0FKgV/CF1mrWHUdqx1lpdzY70a
  87 +QVkppV4ig8OLWfqaova9ML9yHRyZhpzyhTwd9yaWLy75ArG1qVDoOPqbCl60BMDO
  88 +TjksygtbYvBNWFA0meaaLNKQ1wmB1sCqXs7+0vehukvZ1oaOGR+mBkdCcuBWCgAc
  89 +eLmNzJkEN0k=
  90 +-----END CERTIFICATE-----
1 appname = partnermg 1 appname = partnermg
2 runmode = "${RUN_MODE||dev}" 2 runmode = "${RUN_MODE||dev}"
3 httpport = "${HTTP_PORT||8082}" 3 httpport = "${HTTP_PORT||8082}"
4 - 4 +EnableHTTPS = true
  5 +HTTPSPort = "443"
  6 +HTTPSCertFile = "conf/_.fjmaimaimai.com_bundle.crt"
  7 +HTTPSKeyFile = "conf/_.fjmaimaimai.com.key"
5 #开启监控 8 #开启监控
6 EnableAdmin = false 9 EnableAdmin = false
7 #开启JSON请求 10 #开启JSON请求
@@ -10,6 +13,7 @@ copyrequestbody = true @@ -10,6 +13,7 @@ copyrequestbody = true
10 enablexsrf = false 13 enablexsrf = false
11 xsrfkey = asdfioerjlasdfmFADFOEJF2323SDFF 14 xsrfkey = asdfioerjlasdfmFADFOEJF2323SDFF
12 xsrfexpire = 3600 15 xsrfexpire = 3600
  16 +
13 #是否将错误信息进行渲染 17 #是否将错误信息进行渲染
14 EnableErrorsRender =false 18 EnableErrorsRender =false
15 [lang] 19 [lang]
@@ -10,6 +10,9 @@ spec: @@ -10,6 +10,9 @@ spec:
10 - name: "http" 10 - name: "http"
11 port: 80 11 port: 80
12 targetPort: 8082 12 targetPort: 8082
  13 + - name: "https"
  14 + port: 443
  15 + targetPort: 443
13 selector: 16 selector:
14 k8s-app: mmm-partnermg 17 k8s-app: mmm-partnermg
15 --- 18 ---
@@ -48,6 +51,7 @@ spec: @@ -48,6 +51,7 @@ spec:
48 imagePullPolicy: Always 51 imagePullPolicy: Always
49 ports: 52 ports:
50 - containerPort: 8082 53 - containerPort: 8082
  54 + - containerPort: 443
51 volumeMounts: 55 volumeMounts:
52 - mountPath: /opt/logs 56 - mountPath: /opt/logs
53 name: accesslogs 57 name: accesslogs
@@ -86,6 +90,8 @@ spec: @@ -86,6 +90,8 @@ spec:
86 value: "dev" 90 value: "dev"
87 - name: Log_PREFIX 91 - name: Log_PREFIX
88 value: "[partnermg_dev]" 92 value: "[partnermg_dev]"
  93 + - name: APP_NAME
  94 + value: ""
89 volumes: 95 volumes:
90 - name: accesslogs 96 - name: accesslogs
91 emptyDir: {} 97 emptyDir: {}
@@ -10,6 +10,9 @@ spec: @@ -10,6 +10,9 @@ spec:
10 - name: "http" 10 - name: "http"
11 port: 80 11 port: 80
12 targetPort: 8082 12 targetPort: 8082
  13 + - name: "https"
  14 + port: 443
  15 + targetPort: 443
13 selector: 16 selector:
14 k8s-app: mmm-partnermg 17 k8s-app: mmm-partnermg
15 --- 18 ---
@@ -45,6 +48,7 @@ spec: @@ -45,6 +48,7 @@ spec:
45 imagePullPolicy: Always 48 imagePullPolicy: Always
46 ports: 49 ports:
47 - containerPort: 8082 50 - containerPort: 8082
  51 + - containerPort: 443
48 volumeMounts: 52 volumeMounts:
49 - mountPath: /opt/logs 53 - mountPath: /opt/logs
50 name: accesslogs 54 name: accesslogs
@@ -83,6 +87,8 @@ spec: @@ -83,6 +87,8 @@ spec:
83 value: "dev" 87 value: "dev"
84 - name: Log_PREFIX 88 - name: Log_PREFIX
85 value: "[partnermg_prd]" 89 value: "[partnermg_prd]"
  90 + - name: APP_NAME
  91 + value: "mmm-partnermg"
86 volumes: 92 volumes:
87 - name: accesslogs 93 - name: accesslogs
88 emptyDir: {} 94 emptyDir: {}
@@ -10,6 +10,9 @@ spec: @@ -10,6 +10,9 @@ spec:
10 - name: "http" 10 - name: "http"
11 port: 80 11 port: 80
12 targetPort: 8082 12 targetPort: 8082
  13 + - name: "https"
  14 + port: 443
  15 + targetPort: 443
13 selector: 16 selector:
14 k8s-app: mmm-partnermg 17 k8s-app: mmm-partnermg
15 --- 18 ---
@@ -45,6 +48,7 @@ spec: @@ -45,6 +48,7 @@ spec:
45 imagePullPolicy: Always 48 imagePullPolicy: Always
46 ports: 49 ports:
47 - containerPort: 8082 50 - containerPort: 8082
  51 + - containerPort: 443
48 volumeMounts: 52 volumeMounts:
49 - mountPath: /opt/logs 53 - mountPath: /opt/logs
50 name: accesslogs 54 name: accesslogs
@@ -83,6 +87,8 @@ spec: @@ -83,6 +87,8 @@ spec:
83 value: "dev" 87 value: "dev"
84 - name: Log_PREFIX 88 - name: Log_PREFIX
85 value: "[partnermg_test]" 89 value: "[partnermg_test]"
  90 + - name: APP_NAME
  91 + value: "partnermg"
86 volumes: 92 volumes:
87 - name: accesslogs 93 - name: accesslogs
88 emptyDir: {} 94 emptyDir: {}
@@ -196,6 +196,7 @@ func (service SyncEmployeeService) addEmployeeData(datas []EmployeeData) error { @@ -196,6 +196,7 @@ func (service SyncEmployeeService) addEmployeeData(datas []EmployeeData) error {
196 Permission: []domain.AdminPermissionBase{}, //初始化权限 196 Permission: []domain.AdminPermissionBase{}, //初始化权限
197 AccessPartners: []domain.Partner{}, //默认初始化 197 AccessPartners: []domain.Partner{}, //默认初始化
198 AdminType: data.AdminType, 198 AdminType: data.AdminType,
  199 + IsSenior: 2,
199 } 200 }
200 newUser.EntryTime, _ = time.Parse("2006-01-02", data.EntryTime) 201 newUser.EntryTime, _ = time.Parse("2006-01-02", data.EntryTime)
201 if err = usersRepository.Add(&newUser); err != nil { 202 if err = usersRepository.Add(&newUser); err != nil {
@@ -8,6 +8,7 @@ var LOG_LEVEL = "debug" @@ -8,6 +8,7 @@ var LOG_LEVEL = "debug"
8 var LOG_File = "./logs/partnermg.log" 8 var LOG_File = "./logs/partnermg.log"
9 var IMPORT_EXCEL = "./download/订单数据模板.xlsx" 9 var IMPORT_EXCEL = "./download/订单数据模板.xlsx"
10 var Log_PREFIX = "[partnermg_dev]" 10 var Log_PREFIX = "[partnermg_dev]"
  11 +var APP_NAME = ""
11 var ( 12 var (
12 UCENTER_HOST = "https://suplus-ucenter-test.fjmaimaimai.com" //统一用户中心地址 13 UCENTER_HOST = "https://suplus-ucenter-test.fjmaimaimai.com" //统一用户中心地址
13 UCENTER_SECRET = "cykbjnfqgctn" 14 UCENTER_SECRET = "cykbjnfqgctn"
@@ -43,4 +44,7 @@ func init() { @@ -43,4 +44,7 @@ func init() {
43 if os.Getenv("Log_PREFIX") != "" { 44 if os.Getenv("Log_PREFIX") != "" {
44 Log_PREFIX = os.Getenv("Log_PREFIX") 45 Log_PREFIX = os.Getenv("Log_PREFIX")
45 } 46 }
  47 + if os.Getenv("APP_NAME") != "" {
  48 + APP_NAME = os.Getenv("APP_NAME")
  49 + }
46 } 50 }
@@ -682,7 +682,7 @@ func (c *OrderInfoController) DownloadTemplate() { @@ -682,7 +682,7 @@ func (c *OrderInfoController) DownloadTemplate() {
682 } else { 682 } else {
683 logs.Info(resp) 683 logs.Info(resp)
684 ret = map[string]interface{}{ 684 ret = map[string]interface{}{
685 - "url": "http://" + c.Ctx.Request.Host + "/download/订单数据模板.xlsx", 685 + "url": "http://" + c.Ctx.Request.Host + "/" + constant.APP_NAME + "/download/订单数据模板.xlsx",
686 } 686 }
687 c.ResponseData(ret) 687 c.ResponseData(ret)
688 } 688 }
@@ -690,7 +690,7 @@ func (c *OrderInfoController) DownloadTemplate() { @@ -690,7 +690,7 @@ func (c *OrderInfoController) DownloadTemplate() {
690 690
691 /** 691 /**
692 * @Author SteveChan 692 * @Author SteveChan
693 - * @Description //TODO 导入excel订单 693 + * @Description // 导入excel订单
694 * @Date 10:52 2021/1/6 694 * @Date 10:52 2021/1/6
695 * @Param 695 * @Param
696 * @return 696 * @return
@@ -701,14 +701,6 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -701,14 +701,6 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
701 file, h, _ := c.GetFile("file") 701 file, h, _ := c.GetFile("file")
702 companyId := c.GetUserCompany() 702 companyId := c.GetUserCompany()
703 703
704 - // Json数据解析  
705 - //jsonMap := make(map[string]interface{})  
706 - //err := json.Unmarshal([]byte(where), &jsonMap)  
707 - //if err != nil {  
708 - // logs.Error(err)  
709 - // c.ResponseError(errors.New("json数据解析失败"))  
710 - //}  
711 -  
712 if typeCode != "PARTNER_ORDER_FILE" { 704 if typeCode != "PARTNER_ORDER_FILE" {
713 c.ResponseError(errors.New("类型编码错误")) 705 c.ResponseError(errors.New("类型编码错误"))
714 } 706 }
@@ -716,8 +708,8 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -716,8 +708,8 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
716 // 返回字段定义 708 // 返回字段定义
717 ret := map[string]interface{}{} 709 ret := map[string]interface{}{}
718 710
719 - // 返回信息表头定义 0: 订单号, 1: 发货单号, 2: 客户名称, 3: 订单区域, 4: 编号, 5: 合伙人, 6: 类型, 7: 业务抽成比例, 8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例  
720 - var tableHeader = []string{"错误详情", "行号", "订单号", "发货单号", "客户名称", "订单区域", "编号", "合伙人", "类型", "业务抽成比例", "产品名称", "数量", "单价", "合伙人分红比例"} 711 + // 返回信息表头定义 0: 订单号, 1: 发货单号, 2: 客户名称, 3: 订单区域, 4: 编号, 5: 合伙人, 6: 类型, 7: 业务员抽成比例, 8: 产品名称, 9: 数量, 10: 单价, 11: 合伙人分红比例
  712 + var tableHeader = []string{"错误详情", "行号", "订单号", "发货单号", "客户名称", "订单区域", "编号", "合伙人", "类型", "业务员抽成比例", "产品名称", "数量", "单价", "合伙人分红比例"}
721 713
722 // 文件后缀名校验 714 // 文件后缀名校验
723 ext := path.Ext(h.Filename) 715 ext := path.Ext(h.Filename)
@@ -743,6 +735,32 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -743,6 +735,32 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
743 return 735 return
744 } 736 }
745 737
  738 + // 文件列数据校验
  739 + overColumnLine := make([]interface{}, 0)
  740 + for i, row := range rows {
  741 + if i > 2 && row != nil {
  742 + if len(row) > constant.EXCEL_COLUMN {
  743 + var tmpRow []string
  744 + tmpRow = append(tmpRow, "存在无效的数据列,请删除无效的列数据") // 错误信息
  745 + s := strconv.Itoa(i + 1)
  746 + tmpRow = append(tmpRow, s) // 行号
  747 + tmpRow = append(tmpRow, row...) // 错误行数据
  748 + overColumnLine = append(overColumnLine, tmpRow)
  749 + }
  750 + }
  751 + }
  752 + if len(overColumnLine) > 0 {
  753 + ret = map[string]interface{}{
  754 + "successCount": 0,
  755 + "fail": map[string]interface{}{
  756 + "tableHeader": tableHeader,
  757 + "tableData": overColumnLine,
  758 + },
  759 + }
  760 + c.ResponseData(ret)
  761 + return
  762 + }
  763 +
746 // 数据行计数 764 // 数据行计数
747 rowCnt := 0 765 rowCnt := 0
748 766
@@ -753,38 +771,52 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -753,38 +771,52 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
753 771
754 // 必填项校验 772 // 必填项校验
755 nullLine := make([]interface{}, 0) 773 nullLine := make([]interface{}, 0)
  774 +
756 nullFlag := false 775 nullFlag := false
757 for i, row := range rows { 776 for i, row := range rows {
758 if i > 2 && row != nil { 777 if i > 2 && row != nil {
759 rowCnt++ 778 rowCnt++
760 - if len(row) == constant.EXCEL_COLUMN { // 中间空字符校验 779 + if len(row) == constant.EXCEL_COLUMN { // 必填项内容为空
761 var tmpRow = row 780 var tmpRow = row
  781 + nullCell := make([]interface{}, 0)
762 var myRow []string 782 var myRow []string
763 - for j, cell := range row {  
764 - if j != 8 { // 业务员抽成比例非必填  
765 - if cell == "" || cell == " " { // 空字符串填充  
766 - tmpRow[j] = "null" 783 + for j, _ := range row {
  784 + if j != 7 { // 业务员抽成比例非必填
  785 + if row[j] == "" || row[j] == " " { // 空字符补位
  786 + tmpRow[j] = ""
  787 + col := strconv.Itoa(j + 1)
  788 + nullCell = append(nullCell, col)
767 nullFlag = true 789 nullFlag = true
768 } 790 }
769 } 791 }
770 } 792 }
771 if nullFlag { 793 if nullFlag {
772 - myRow = append(myRow, "必填项不能为空") // 错误信息  
773 s := strconv.Itoa(i + 1) 794 s := strconv.Itoa(i + 1)
774 - myRow = append(myRow, s) // 行号  
775 - myRow = append(myRow, tmpRow...) // 错误行数据 795 + b := strings.Replace(strings.Trim(fmt.Sprint(nullCell), "[]"), " ", ",", -1)
  796 + myRow = append(myRow, "第"+s+"行的第"+b+"列必填项为空") // 错误信息
  797 + myRow = append(myRow, s) // 行号
  798 + myRow = append(myRow, tmpRow...) // 错误行数据
776 nullLine = append(nullLine, myRow) 799 nullLine = append(nullLine, myRow)
777 nullFlag = false 800 nullFlag = false
778 } 801 }
779 - } else if len(row) > 0 && len(row) < constant.EXCEL_COLUMN { // 尾部空字符校验 802 + } else if len(row) > 0 && len(row) < constant.EXCEL_COLUMN { // 必填项不存在
780 var myRow []string 803 var myRow []string
781 - for i := 0; i < constant.EXCEL_COLUMN-len(row); i++ { // null补位  
782 - myRow = append(myRow, "null")  
783 - }  
784 - myRow = append(myRow, "必填项不能为空") // 错误信息 804 + myRow = append(myRow, "必填项为空")
785 s := strconv.Itoa(i + 1) 805 s := strconv.Itoa(i + 1)
786 myRow = append(myRow, s) // 行号 806 myRow = append(myRow, s) // 行号
787 myRow = append(myRow, row...) // 错误行数据 807 myRow = append(myRow, row...) // 错误行数据
  808 + emptyCell := make([]interface{}, 0)
  809 + // 错误信息
  810 + for k := 0; k < constant.EXCEL_COLUMN-len(row); k++ { // 空字符补位
  811 + myRow = append(myRow, "")
  812 + }
  813 + for k, cell := range myRow {
  814 + if k != 0 && cell == "" {
  815 + emptyCell = append(emptyCell, k-1)
  816 + }
  817 + }
  818 + b := strings.Replace(strings.Trim(fmt.Sprint(emptyCell), "[]"), " ", ",", -1)
  819 + myRow[0] = "第" + s + "行的第" + b + "列必填项为空"
788 nullLine = append(nullLine, myRow) 820 nullLine = append(nullLine, myRow)
789 } 821 }
790 } 822 }
@@ -810,17 +842,21 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -810,17 +842,21 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
810 if i > 2 && row != nil && len(row) == constant.EXCEL_COLUMN { // 数据行 842 if i > 2 && row != nil && len(row) == constant.EXCEL_COLUMN { // 数据行
811 var myRow []string 843 var myRow []string
812 for j, cell := range row { 844 for j, cell := range row {
  845 +
  846 + r := strconv.Itoa(i + 1)
  847 + col := strconv.Itoa(j + 1)
  848 +
813 switch j { 849 switch j {
814 case 0, 1, 2, 3, 4, 5, 8: // 订单号、发货单号、客户名称、订单区域、编号、合伙人、产品名称长度校验 850 case 0, 1, 2, 3, 4, 5, 8: // 订单号、发货单号、客户名称、订单区域、编号、合伙人、产品名称长度校验
815 { 851 {
816 cellStr := strings.TrimSpace(cell) 852 cellStr := strings.TrimSpace(cell)
817 lenCellStr := utf8.RuneCountInString(cellStr) 853 lenCellStr := utf8.RuneCountInString(cellStr)
  854 +
818 if lenCellStr > 50 { 855 if lenCellStr > 50 {
819 var tmpRow []string 856 var tmpRow []string
820 - tmpRow = append(tmpRow, tableHeader[j+2]+"长度超过50位,请重新输入") // 错误信息  
821 - s := strconv.Itoa(i + 1)  
822 - tmpRow = append(tmpRow, s) // 行号  
823 - tmpRow = append(tmpRow, row...) // 错误行数据 857 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列"+tableHeader[j+2]+"长度超过50位,请重新输入") // 错误信息
  858 + tmpRow = append(tmpRow, r) // 行号
  859 + tmpRow = append(tmpRow, row...) // 错误行数据
824 myRow = tmpRow 860 myRow = tmpRow
825 } 861 }
826 } 862 }
@@ -828,139 +864,120 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -828,139 +864,120 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
828 { 864 {
829 if !utils.IsContain(partnerType, cell) { 865 if !utils.IsContain(partnerType, cell) {
830 var tmpRow []string 866 var tmpRow []string
831 - tmpRow = append(tmpRow, "合伙人类型须为以下类型:事业合伙、业务合伙、研发合伙、业务-产品应用合伙") // 错误信息  
832 - s := strconv.Itoa(i + 1)  
833 - tmpRow = append(tmpRow, s) // 行号  
834 - tmpRow = append(tmpRow, row...) // 错误行数据 867 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列合伙人类型错误,合伙人类型必须为以下类型:事业合伙、业务合伙、研发合伙、业务-产品应用合伙") // 错误信息
  868 + tmpRow = append(tmpRow, r) // 行号
  869 + tmpRow = append(tmpRow, row...) // 错误行数据
835 myRow = tmpRow 870 myRow = tmpRow
836 } 871 }
837 } 872 }
838 case 7: // 业务员抽成比例,非必填,精确到小数点后两位 873 case 7: // 业务员抽成比例,非必填,精确到小数点后两位
839 { 874 {
840 - var (  
841 - typeErrFlag bool  
842 - lenErrFlag bool  
843 - ratioErrFlag bool  
844 - )  
845 if len(cell) > 0 { 875 if len(cell) > 0 {
  876 +
846 // 参数类型转换 877 // 参数类型转换
847 shareRatio, err := strconv.ParseFloat(cell, 64) 878 shareRatio, err := strconv.ParseFloat(cell, 64)
848 if err != nil { 879 if err != nil {
849 - typeErrFlag = true 880 + var tmpRow []string
  881 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列业务员抽成比例格式错误,业务员抽成比例必须为数字") // 错误信息
  882 + tmpRow = append(tmpRow, r) // 行号
  883 + tmpRow = append(tmpRow, row...) // 错误行数据
  884 + myRow = tmpRow
850 } 885 }
851 886
852 // 比例不能超过100% 887 // 比例不能超过100%
853 if shareRatio > 100 { 888 if shareRatio > 100 {
854 - ratioErrFlag = true 889 + var tmpRow []string
  890 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列业务员抽成比例超过限额,请输入正确的业务员抽成比例,并保留两位小数") // 错误信息
  891 + tmpRow = append(tmpRow, r) // 行号
  892 + tmpRow = append(tmpRow, row...) // 错误行数据
  893 + myRow = tmpRow
855 } 894 }
856 895
857 // 长度校验 896 // 长度校验
858 regexpStr := `^(100|[1-9]\d|\d)(.\d{1,2})?$` 897 regexpStr := `^(100|[1-9]\d|\d)(.\d{1,2})?$`
859 ok := regexp.MustCompile(regexpStr).MatchString(cell) 898 ok := regexp.MustCompile(regexpStr).MatchString(cell)
860 if !ok { 899 if !ok {
861 - lenErrFlag = true  
862 - }  
863 -  
864 - if typeErrFlag || lenErrFlag || ratioErrFlag {  
865 var tmpRow []string 900 var tmpRow []string
866 - tmpRow = append(tmpRow, "业务员抽成比例格式错误,请输入正确的业务员抽成比例比例,保留两位小数") // 错误信息  
867 - s := strconv.Itoa(i + 1)  
868 - tmpRow = append(tmpRow, s) // 行号  
869 - tmpRow = append(tmpRow, row...) // 错误行数据 901 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列业务员抽成比例超过最大长度,请输入正确的业务员抽成比例,并保留两位小数") // 错误信息
  902 + tmpRow = append(tmpRow, r) // 行号
  903 + tmpRow = append(tmpRow, row...) // 错误行数据
870 myRow = tmpRow 904 myRow = tmpRow
871 - typeErrFlag = false  
872 - lenErrFlag = false  
873 - ratioErrFlag = false  
874 } 905 }
875 } 906 }
876 } 907 }
877 case 9: // 数量不超过16位正整数 908 case 9: // 数量不超过16位正整数
878 { 909 {
879 - var (  
880 - typeErrFlag bool  
881 - lenErrFlag bool  
882 - )  
883 -  
884 //参数类型转换 910 //参数类型转换
885 orderNum, err := strconv.ParseInt(cell, 10, 64) 911 orderNum, err := strconv.ParseInt(cell, 10, 64)
886 if err != nil { 912 if err != nil {
887 - typeErrFlag = true 913 + var tmpRow []string
  914 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列产品数量格式错误,产品数量必须整数") // 错误信息
  915 + tmpRow = append(tmpRow, r) // 行号
  916 + tmpRow = append(tmpRow, row...) // 错误行数据
  917 + myRow = tmpRow
888 } 918 }
889 919
890 // 长度校验 920 // 长度校验
891 if orderNum > 1e16 { 921 if orderNum > 1e16 {
892 - lenErrFlag = true  
893 - }  
894 -  
895 - if typeErrFlag || lenErrFlag {  
896 var tmpRow []string 922 var tmpRow []string
897 - tmpRow = append(tmpRow, "数量长度超过最大限制十六位整数,请重新填写") // 错误信息  
898 - s := strconv.Itoa(i + 1)  
899 - tmpRow = append(tmpRow, s) // 行号  
900 - tmpRow = append(tmpRow, row...) // 错误行数据 923 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列产品数量长度超过最大限制十六位整数,请重新填写") // 错误信息
  924 + tmpRow = append(tmpRow, r) // 行号
  925 + tmpRow = append(tmpRow, row...) // 错误行数据
901 myRow = tmpRow 926 myRow = tmpRow
902 - typeErrFlag = false  
903 - lenErrFlag = false  
904 } 927 }
905 } 928 }
906 case 10: // 单价,精确到小数点后两位,小数点左侧最多可输入16位数字 929 case 10: // 单价,精确到小数点后两位,小数点左侧最多可输入16位数字
907 { 930 {
  931 +
908 // 参数类型转换 932 // 参数类型转换
909 - univalent, err := strconv.ParseFloat(cell, 64)  
910 - if err != nil { 933 + univalent, typeErr := strconv.ParseFloat(cell, 64)
  934 + if typeErr != nil {
911 var tmpRow []string 935 var tmpRow []string
912 - tmpRow = append(tmpRow, "单价格式错误,请输入正确的单价,保留两位小数点,小数点前面不能超过十六位数字") // 错误信息  
913 - s := strconv.Itoa(i + 1)  
914 - tmpRow = append(tmpRow, s) // 行号  
915 - tmpRow = append(tmpRow, row...) // 错误行数据 936 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列单价格式错误,产品单价必须为数字类型") // 错误信息
  937 + tmpRow = append(tmpRow, r) // 行号
  938 + tmpRow = append(tmpRow, row...) // 错误行数据
916 myRow = tmpRow 939 myRow = tmpRow
917 } 940 }
  941 +
918 // 长度校验 942 // 长度校验
919 if univalent >= 1e16 { 943 if univalent >= 1e16 {
920 var tmpRow []string 944 var tmpRow []string
921 - tmpRow = append(tmpRow, "单价格式错误,请输入正确的单价,保留两位小数点,小数点前面不能超过十六位数字") // 错误信息  
922 - s := strconv.Itoa(i + 1)  
923 - tmpRow = append(tmpRow, s) // 行号  
924 - tmpRow = append(tmpRow, row...) // 错误行数据 945 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列产品单价超过最大限制,产品单价小数点前面不能超过十六位数字,并保留两位小数") // 错误信息
  946 + tmpRow = append(tmpRow, r) // 行号
  947 + tmpRow = append(tmpRow, row...) // 错误行数据
925 myRow = tmpRow 948 myRow = tmpRow
926 } 949 }
927 } 950 }
928 case 11: // 合伙人分红比例,精确到小数点后两位 951 case 11: // 合伙人分红比例,精确到小数点后两位
929 { 952 {
930 - var (  
931 - typeErrFlag bool  
932 - lenErrFlag bool  
933 - ratioErrFlag bool  
934 - )  
935 -  
936 //参数类型转换 953 //参数类型转换
937 - partnerRatio, err := strconv.ParseFloat(cell, 64)  
938 - if err != nil {  
939 - typeErrFlag = true 954 + partnerRatio, parseErr := strconv.ParseFloat(cell, 64)
  955 + if parseErr != nil {
  956 + var tmpRow []string
  957 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列合伙人分红比例类型错误,合伙人分红比例必须为数字") // 错误信息
  958 + tmpRow = append(tmpRow, r) // 行号
  959 + tmpRow = append(tmpRow, row...) // 错误行数据
  960 + myRow = tmpRow
940 } 961 }
941 962
942 // 合伙人分红比例超额 963 // 合伙人分红比例超额
943 if partnerRatio > 100 { 964 if partnerRatio > 100 {
944 - ratioErrFlag = true 965 + var tmpRow []string
  966 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列合伙人分红比例超过限额,请输入正确的合伙人分红比例,并保留两位小数") // 错误信息
  967 + tmpRow = append(tmpRow, r) // 行号
  968 + tmpRow = append(tmpRow, row...) // 错误行数据
  969 + myRow = tmpRow
945 } 970 }
946 971
947 // 长度判断 972 // 长度判断
948 regexpStr := `^(100|[1-9]\d|\d)(.\d{1,2})?$` 973 regexpStr := `^(100|[1-9]\d|\d)(.\d{1,2})?$`
949 ok := regexp.MustCompile(regexpStr).MatchString(cell) 974 ok := regexp.MustCompile(regexpStr).MatchString(cell)
950 if !ok { 975 if !ok {
951 - lenErrFlag = true  
952 - }  
953 -  
954 - if typeErrFlag || lenErrFlag || ratioErrFlag {  
955 var tmpRow []string 976 var tmpRow []string
956 - tmpRow = append(tmpRow, "合伙人分红比例格式错误,请输入正确的合伙人分红比例,保留两位小数") // 错误信息  
957 - s := strconv.Itoa(i + 1)  
958 - tmpRow = append(tmpRow, s) // 行号  
959 - tmpRow = append(tmpRow, row...) // 错误行数据 977 + tmpRow = append(tmpRow, "第"+r+"行第"+col+"列合伙人分红比例超过最大长度,请输入正确的合伙人分红比例,并保留两位小数") // 错误信息
  978 + tmpRow = append(tmpRow, r) // 行号
  979 + tmpRow = append(tmpRow, row...) // 错误行数据
960 myRow = tmpRow 980 myRow = tmpRow
961 - typeErrFlag = false  
962 - lenErrFlag = false  
963 - ratioErrFlag = false  
964 } 981 }
965 } 982 }
966 } 983 }
@@ -1006,6 +1023,29 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -1006,6 +1023,29 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
1006 price, _ := strconv.ParseFloat(row[10], 64) // 单价 1023 price, _ := strconv.ParseFloat(row[10], 64) // 单价
1007 percent, _ := strconv.ParseFloat(row[11], 64) // 合伙人分红比例 1024 percent, _ := strconv.ParseFloat(row[11], 64) // 合伙人分红比例
1008 1025
  1026 + // 获取partnerId
  1027 + var partnerInfo *domain.PartnerInfo
  1028 +
  1029 + orderQueryData := orderQuery.GetPartnerIdQuery{
  1030 + Code: row[4],
  1031 + PartnerCategory: 0,
  1032 + CompanyId: companyId,
  1033 + }
  1034 +
  1035 + // 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙
  1036 + switch row[6] {
  1037 + case "事业合伙":
  1038 + orderQueryData.PartnerCategory = 1
  1039 + case "业务合伙":
  1040 + orderQueryData.PartnerCategory = 2
  1041 + case "研发合伙":
  1042 + orderQueryData.PartnerCategory = 3
  1043 + case "业务-产品应用合伙":
  1044 + orderQueryData.PartnerCategory = 4
  1045 + default:
  1046 + orderQueryData.PartnerCategory = 0
  1047 + }
  1048 +
1009 // 初始化建订单命令集 1049 // 初始化建订单命令集
1010 orderCommands[hashString] = &orderCmd.CreateOrderCommand{ 1050 orderCommands[hashString] = &orderCmd.CreateOrderCommand{
1011 OrderType: 0, 1051 OrderType: 0,
@@ -1025,30 +1065,10 @@ func (c *OrderInfoController) ImportOrderFromExcel() { @@ -1025,30 +1065,10 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
1025 }, 1065 },
1026 }, 1066 },
1027 CompanyId: companyId, 1067 CompanyId: companyId,
1028 - PartnerCategory: 1, 1068 + PartnerCategory: int64(orderQueryData.PartnerCategory),
1029 LineNumbers: []int{i}, // 记录行号 1069 LineNumbers: []int{i}, // 记录行号
1030 } 1070 }
1031 1071
1032 - // 获取partnerId  
1033 - var partnerInfo *domain.PartnerInfo  
1034 - orderQueryData := orderQuery.GetPartnerIdQuery{  
1035 - Code: row[4],  
1036 - PartnerCategory: 0,  
1037 - CompanyId: companyId,  
1038 - }  
1039 - // 1: 事业合伙、2: 业务合伙、3: 研发合伙、4: 业务-产品应用合伙  
1040 - switch row[6] {  
1041 - case "事业合伙":  
1042 - orderQueryData.PartnerCategory = 1  
1043 - case "业务合伙":  
1044 - orderQueryData.PartnerCategory = 2  
1045 - case "研发合伙":  
1046 - orderQueryData.PartnerCategory = 3  
1047 - case "业务-产品应用合伙":  
1048 - orderQueryData.PartnerCategory = 4  
1049 - default:  
1050 - orderQueryData.PartnerCategory = 0  
1051 - }  
1052 partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQueryData) 1072 partnerInfo, err = orderSrv.GetPartnerIdByCodeAndCategory(orderQueryData)
1053 if err != nil || partnerInfo == nil { // 检索合伙人错误 1073 if err != nil || partnerInfo == nil { // 检索合伙人错误
1054 var tmpRow []string 1074 var tmpRow []string