浏览代码

Merge branch 'develop' of http://code.dashoo.cn/chengjian/opms_backend into develop

liuyaqi 2 年之前
父节点
当前提交
7a907d60b8

+ 34 - 8
opms_libary/micro_srv/micro_srv.go

@@ -6,6 +6,7 @@ import (
 	"dashoo.cn/opms_libary/multipart"
 	"encoding/json"
 	"errors"
+	"fmt"
 	"github.com/gogf/gf/util/gconv"
 	"io/ioutil"
 	"net"
@@ -146,9 +147,13 @@ func streamHandler(conn net.Conn, args *share.StreamServiceArgs) {
 
 			// 读取文件名
 			fileHeader := make([]byte, length)
-			_, err = conn.Read(fileHeader)
+			_, err := conn.Read(fileHeader)
 
 			headers := strings.Split(string(fileHeader), " ")
+			if len(headers) != 3 {
+				fmt.Println(form, "111111")
+				break
+			}
 			paramName := headers[0]
 			fileName := headers[1]
 			fileSize := headers[2]
@@ -163,24 +168,45 @@ func streamHandler(conn net.Conn, args *share.StreamServiceArgs) {
 			defer os.Remove(tmpFile.Name())
 
 			size, _ := strconv.Atoi(fileSize)
+			curSize := 0
+			for {
+				if curSize+1024 > size {
+					buf = make([]byte, size-curSize)
+					curSize = size
+				} else {
+					buf = make([]byte, 1024)
+					curSize = curSize + 1024
+				}
+				conn.Read(buf)
+				tmpFile.Write(buf)
+				if curSize == size {
+					break
+				}
+			}
 
-			buf = make([]byte, size)
-			conn.Read(buf)
-			tmpFile.Write(buf)
+			fmt.Println("1==============================")
 
 			form.File[paramName] = &multipart.FileHeader{FileName: fileName, FileSize: int64(size), File: tmpFile}
-
+			fmt.Println(form)
 			// 判断是否结束
 			isEnd := make([]byte, 1)
-			_, err = conn.Read(isEnd)
-			if err != nil || isEnd[0] == '1' {
+			conn.Read(isEnd)
+			fmt.Println(gconv.String(isEnd))
+			if gconv.String(isEnd) == "1" {
+				fmt.Println("2==============================")
 				continue
 			}
-			if isEnd[0] == '2' {
+			if gconv.String(isEnd) == "2" {
+				fmt.Println("3==============================")
 				break
 			}
+			fmt.Println("4==============================")
+
 		}
+		fmt.Println("5==============================")
+
 	}
+	fmt.Println("6==============================")
 
 	result := make([]byte, 0)
 	className, _ := args.Meta["reqService"]

+ 10 - 8
opms_parent/app/dao/base/internal/base_distributor.go

@@ -872,15 +872,17 @@ func (d *BaseDistributorDao) checkColumnsName(dataScope map[string]interface{},
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	for k, v := range dataScope {
-		if data, ok := colsContrast[k]; ok {
-			dataScope[data.(string)] = v
+	if specialFlag && len(args) == 1 {
+		for k, v := range dataScope {
+			if data, ok := colsContrast[k]; ok {
+				dataScope[data.(string)] = v
+			}
+			delete(dataScope, k)
+			delete(colsContrast, k)
+		}
+		for k, v := range colsContrast {
+			dataScope[k] = v
 		}
-		delete(dataScope, k)
-		delete(colsContrast, k)
-	}
-	for k, v := range colsContrast {
-		dataScope[k] = v
 	}
 	return specialFlag, userCols, orColsMap
 }

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_contact.go

@@ -820,7 +820,7 @@ func (d *BaseDistributorContactDao) checkColumnsName(dataScope map[string]interf
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_dynamics.go

@@ -814,7 +814,7 @@ func (d *BaseDistributorDynamicsDao) checkColumnsName(dataScope map[string]inter
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_record.go

@@ -829,7 +829,7 @@ func (d *BaseDistributorRecordDao) checkColumnsName(dataScope map[string]interfa
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 1 - 1
opms_parent/app/dao/base/internal/base_distributor_target.go

@@ -817,7 +817,7 @@ func (d *BaseDistributorTargetDao) checkColumnsName(dataScope map[string]interfa
 	delete(dataScope, "roles")
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
-	if len(colsContrast) > 0 {
+	if specialFlag && len(args) == 1 {
 		for k, v := range dataScope {
 			if data, ok := colsContrast[k]; ok {
 				dataScope[data.(string)] = v

+ 12 - 0
opms_parent/app/dao/contract/internal/ctr_contract.go

@@ -8,6 +8,7 @@ import (
 	"context"
 	"database/sql"
 	"fmt"
+	"github.com/gogf/gf/text/gstr"
 	"strings"
 	"time"
 
@@ -905,5 +906,16 @@ func (d *CtrContractDao) checkColumnsName(dataScope map[string]interface{}, args
 			dataScope[k] = v
 		}
 	}
+	if tableAs != "" && len(dataScope) > 0 {
+		specialFlag = true
+		for k, v := range dataScope {
+			if gstr.HasPrefix(k, tableAs) {
+				continue
+			}
+			dataScope[tableAs+k] = v
+			delete(dataScope, k)
+		}
+	}
+
 	return specialFlag, userCols, orColsMap
 }

+ 8 - 6
opms_parent/app/dao/work/internal/work_order.go

@@ -839,13 +839,15 @@ func (d *WorkOrderDao) checkColumnsName(dataScope map[string]interface{}, args .
 	delete(dataScope, "posts")
 	delete(dataScope, bigColumns)
 	if specialFlag && len(args) == 1 {
-		for k, v := range colsContrast {
-			if data, ok := dataScope[k]; ok {
-				dataScope[v.(string)] = data
-				delete(dataScope, k)
-			} else {
-				dataScope[k] = v
+		for k, v := range dataScope {
+			if data, ok := colsContrast[k]; ok {
+				dataScope[data.(string)] = v
 			}
+			delete(dataScope, k)
+			delete(colsContrast, k)
+		}
+		for k, v := range colsContrast {
+			dataScope[k] = v
 		}
 	}
 	return specialFlag, userCols, orColsMap