2
3
dubch 4 rokov pred
rodič
commit
640557d857

+ 38 - 11
src/dashoo.cn/backend/api/business/oilsupplier/suppliercert/oilsuppliercertService.go

@@ -194,17 +194,26 @@ func (s *OilSupplierCertService) IsSupplierCertCanSubmit(supplierId, supplierCer
 	IsManufacturer := 0
 	mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
 
-	var ids suppliercertsub.Ids
-	certsubService.GetIds(supplierCertId, supplierTypeCode, &ids, 1)
-	var ids1 suppliercertsub.Ids
-	certsubService.GetIds(supplierCertId, supplierTypeCode, &ids1, 2)
+	idString := ""
+	idString1 := ""
+	for i := 0; i < len(certSubList); i = i+1000 {
+		var ids suppliercertsub.Ids
+		certsubService.GetIds(strconv.Itoa(supplierCertEntity.Id), supplierCertEntity.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
+		if ids.Id != "" {
+			idString += "," + ids.Id
+		} else {
+			break
+		}
+	}
+	var needList []supplierfile.FileList
+	var needList1 []supplierfile.FileList
 
 	gradeTotal := certsubService.GetCountGrade(supplierCertId)
 	if supplierEntity.Grade == "2" && gradeTotal > 0 {
 	//if certSubItem.GoodsLevel == supplier.GOODS_LEVEL_1 && supplierEntity.Grade == supplier.GOODS_LEVEL_2{
 		panic("二级供应商不能准入一级物资!")
 	}
-	var needList []supplierfile.FileList
+
 	if supplierTypeCode == "01" {
 		if supplierEntity.OperType == "制造商" {
 			IsManufacturer = 1
@@ -216,17 +225,35 @@ func (s *OilSupplierCertService) IsSupplierCertCanSubmit(supplierId, supplierCer
 			}
 		}
 		//需要的资质
-		//needList = filesvc.GetGoodsNeedFileListNew(ids.Id, strconv.Itoa(IsManufacturer))
-		needList = filesvc.GetGoodsNeedFileListNew(ids.Id, "1")
-		var needList1 []supplierfile.FileList
-		needList1 = filesvc.GetGoodsNeedFileListNew(ids1.Id, "2")
+		idString = ""
+		for i := 0; i < len(certSubList); i = i+1000 {
+			var ids suppliercertsub.Ids
+			certsubService.GetIds(strconv.Itoa(supplierCertEntity.Id), supplierCertEntity.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
+			if ids.Id != "" {
+				idString += "," + ids.Id
+			} else {
+				break
+			}
+		}
+		// 非制造
+		for i := 0; i < len(certSubList); i = i+1000 {
+			var ids1 suppliercertsub.Ids
+			certsubService.GetIds(strconv.Itoa(supplierCertEntity.Id), supplierCertEntity.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
+			if ids1.Id != "" {
+				idString1 += "," + ids1.Id
+			} else {
+				break
+			}
+		}
+		needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
+		needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
 		for _, need := range needList1 {
 			needList = append(needList, need)
 		}
 	} else if supplierTypeCode == "02" {
-		needList = filesvc.GetBasicNeedFileListNew(ids.Id)
+		needList = filesvc.GetBasicNeedFileListNew(idString)
 	} else if supplierTypeCode == "03" {
-		needList = filesvc.GetTechNeedFileListNew(ids.Id)
+		needList = filesvc.GetTechNeedFileListNew(idString)
 	}
 
 	if IsManufacturer == 1 { //制造商

+ 3 - 2
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertsub/oilsuppliercertsubService.go

@@ -97,14 +97,15 @@ func (s *OilSupplierCertSubService) GetListByAppendId (appendId string, supplier
 	s.GetEntitysByWhere("OilSupplierCertSub", queryWhere, supplierCertSubs)
 }
 
-func (s *OilSupplierCertSubService) GetIds (certId string, typeCode string, entitiesPtr interface{}, isManufacturer int) {
-	sql := "SELECT GROUP_CONCAT(SubClassId) as Id FROM OilSupplierCertSub WHERE SupplierCertId = " + certId + " AND SupplierTypeCode = '" + typeCode + "'"
+func (s *OilSupplierCertSubService) GetIds (certId string, typeCode string, entitiesPtr interface{}, isManufacturer int, i string) {
+	sql := "SELECT GROUP_CONCAT(t.SubClassId) as Id FROM (SELECT SubClassId from OilSupplierCertSub WHERE SupplierCertId = " + certId + " AND SupplierTypeCode = '" + typeCode + "'"
 	if isManufacturer == 1 {
 		// 0 和 1
 		sql += " and IsManufacturer != 2"
 	} else if isManufacturer == 2 {
 		sql += " and IsManufacturer = 2"
 	}
+	sql += " ORDER BY Id ASC limit " + i + ",1000) t"
 	s.DBE.SQL(sql).Get(entitiesPtr)
 }
 

+ 3 - 3
src/dashoo.cn/backend/api/business/oilsupplier/supplierfile/supplierfileService.go

@@ -80,7 +80,7 @@ func (s *SupplierfileService) GetGoodsNeedFileListNew(classid string,IsManuf ...
 	sql += "max(F21) as F21,max(F22) as F22,max(F23) as F23,max(F24) as F24,max(F25) as F25,max(F26) as F26,max(F27) as F27,max(F28) as F28,max(F29) as F29,max(F30) as F30,"
 	sql += "max(F31) as F31,max(F32) as F32,max(F33) as F33,max(F34) as F34,max(F35) as F35,max(F36) as F36,max(F37) as F37,max(F38) as F38,max(F39) as F39,max(F40) as F40,"
 	sql += "max(F41) as F41,max(F42) as F42,max(F43) as F43,max(F44) as F44,max(F45) as F45,max(F46) as F46"
-	sql += " from OilGoodsAptitude where ClassId in (" + classid + ")"
+	sql += " from OilGoodsAptitude where ClassId in (" + strings.TrimLeft(classid, ",") + ")"
 	s.DBE.Sql(sql).Get(&entity)
 
 	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
@@ -129,7 +129,7 @@ func (s *SupplierfileService) GetBasicNeedFileListNew(classid string) (needList
 	sql := "select max(F01) as F01,max(F02) as F02,max(F03) as F03,max(F04) as F04,max(F05) as F05,max(F06) as F06,max(F07) as F07,max(F08) as F08,max(F09) as F09,max(F10) as F10,"
 	sql += "max(F11) as F11,max(F12) as F12,max(F13) as F13,max(F14) as F14,max(F15) as F15,max(F16) as F16,max(F17) as F17,max(F18) as F18,max(F19) as F19,max(F20) as F20,"
 	sql += "max(F21) as F21,max(F22) as F22,max(F23) as F23,max(F24) as F24,max(F25) as F25"
-	sql += " from OilBasisBuild where Id in (" + classid + ")"
+	sql += " from OilBasisBuild where Id in (" + strings.TrimLeft(classid, ",") + ")"
 	s.DBE.Sql(sql).Get(&entity)
 
 	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
@@ -175,7 +175,7 @@ func (s *SupplierfileService) GetTechNeedFileListNew(classid string) (needList [
 	sql += "max(F31) as F31,max(F32) as F32,max(F33) as F33,max(F34) as F34,max(F35) as F35,max(F36) as F36,max(F37) as F37,max(F38) as F38,max(F39) as F39,max(F40) as F40,"
 	sql += "max(F41) as F41,max(F42) as F42,max(F43) as F43,max(F44) as F44,max(F45) as F45,max(F46) as F46,max(F47) as F47,max(F48) as F48,max(F49) as F49,max(F50) as F50,"
 	sql += "max(F51) as F51,max(F52) as F52"
-	sql += " from OilTechnologyService where ClassId in (" + classid + ")"
+	sql += " from OilTechnologyService where ClassId in (" + strings.TrimLeft(classid, ",") + ")"
 	s.DBE.Sql(sql).Get(&entity)
 
 	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)

+ 112 - 34
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -2654,23 +2654,48 @@ func (this *OilSupplierController) CheckSupplierFile() {
 		filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 		mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
 
-		var ids suppliercertsub.Ids
-		var ids1 suppliercertsub.Ids
-		certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3)
+		idString := ""
+		idString1 := ""
+		for i := 0; i < len(certSubList); i = i+1000 {
+			var ids suppliercertsub.Ids
+			certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
+			if ids.Id != "" {
+				idString += "," + ids.Id
+			} else {
+				break
+			}
+		}
 
 		var needList []supplierfile.FileList
 		var needList1 []supplierfile.FileList
 
 		if cert.SupplierTypeCode == "01" {
 			//需要的资质
-			needList = filesvc.GetGoodsNeedFileListNew(ids.Id, "2")
+			needList = filesvc.GetGoodsNeedFileListNew(idString, "2")
 			if file.Type == 1 { //制造商
+				idString = ""
 				//如果是制造商,准入范围按照各项准入范围的类型判断
-				var ids suppliercertsub.Ids
-				certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1)
-				certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2)
-				needList = filesvc.GetGoodsNeedFileListNew(ids.Id, "1")
-				needList1 = filesvc.GetGoodsNeedFileListNew(ids1.Id, "2")
+				for i := 0; i < len(certSubList); i = i+1000 {
+					var ids suppliercertsub.Ids
+					certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
+
+					if ids.Id != "" {
+						idString += "," + ids.Id
+					} else {
+						break
+					}
+				}
+				for i := 0; i < len(certSubList); i = i+1000 {
+					var ids1 suppliercertsub.Ids
+					certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
+					if ids1.Id != "" {
+						idString1 += "," + ids1.Id
+					} else {
+						break
+					}
+				}
+				needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
+				needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
 				var needFile supplierfile.FileList
 				// 质量管理体系认证证书
 				CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
@@ -2681,9 +2706,9 @@ func (this *OilSupplierController) CheckSupplierFile() {
 				}
 			}
 		} else if cert.SupplierTypeCode == "02" {
-			needList = filesvc.GetBasicNeedFileListNew(ids.Id)
+			needList = filesvc.GetBasicNeedFileListNew(idString)
 		} else if cert.SupplierTypeCode == "03" {
-			needList = filesvc.GetTechNeedFileListNew(ids.Id)
+			needList = filesvc.GetTechNeedFileListNew(idString)
 		}
 
 		//if cert.InStyle == "4" {
@@ -2769,11 +2794,21 @@ func (this *OilSupplierController) CheckSupplierFileNew() {
 	filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 	mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
 
-	var ids suppliercertsub.Ids
+	var certSubList []suppliercertsub.OilSupplierCertSub
 	certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
-	certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3)
+	certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
+	idString := ""
+	idString1 := ""
+	for i := 0; i < len(certSubList); i = i+1000 {
+		var ids suppliercertsub.Ids
+		certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
+		if ids.Id != "" {
+			idString += "," + ids.Id
+		} else {
+			break
+		}
+	}
 	//certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1)
-	var ids1 suppliercertsub.Ids
 	//certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2)
 	var needList []supplierfile.FileList
 	var needList1 []supplierfile.FileList
@@ -2798,13 +2833,29 @@ func (this *OilSupplierController) CheckSupplierFileNew() {
 			this.ServeJSON()
 			return
 		}
-		needList = filesvc.GetGoodsNeedFileListNew(ids.Id, "2")
+		needList = filesvc.GetGoodsNeedFileListNew(idString, "2")
 		if file.Type == 1 { //制造商
-			var ids suppliercertsub.Ids
-			certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1)
-			certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2)
-			needList = filesvc.GetGoodsNeedFileListNew(ids.Id, "1")
-			needList1 = filesvc.GetGoodsNeedFileListNew(ids1.Id, "2")
+			idString = ""
+			for i := 0; i < len(certSubList); i = i+1000 {
+				var ids suppliercertsub.Ids
+				certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
+				if ids.Id != "" {
+					idString += "," + ids.Id
+				} else {
+					break
+				}
+			}
+			for i := 0; i < len(certSubList); i = i+1000 {
+				var ids1 suppliercertsub.Ids
+				certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
+				if ids1.Id != "" {
+					idString1 += "," + ids1.Id
+				} else {
+					break
+				}
+			}
+			needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
+			needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
 			var needFile supplierfile.FileList
 			// 质量管理体系认证证书
 			CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
@@ -2815,9 +2866,9 @@ func (this *OilSupplierController) CheckSupplierFileNew() {
 			}
 		}
 	} else if cert.SupplierTypeCode == "02" {
-		needList = filesvc.GetBasicNeedFileListNew(ids.Id)
+		needList = filesvc.GetBasicNeedFileListNew(idString)
 	} else if cert.SupplierTypeCode == "03" {
-		needList = filesvc.GetTechNeedFileListNew(ids.Id)
+		needList = filesvc.GetTechNeedFileListNew(idString)
 	}
 
 	//2021-02-04企管法规处去掉这一限制
@@ -2903,6 +2954,10 @@ func (this *OilSupplierController) CheckSupplierFileDelete() {
 		var supplierCertEntity []suppliercert.OilSupplierCert
 		supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(supplier.Id), &supplierCertEntity)
 		for _, cert := range supplierCertEntity {
+			if cert.SupplierTypeCode == "01" {
+				continue
+			}
+
 			where2 := "("
 			where3 := "("
 			//对准入范围的判断
@@ -2923,33 +2978,56 @@ func (this *OilSupplierController) CheckSupplierFileDelete() {
 			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
 			mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
 
-			var ids suppliercertsub.Ids
-			var ids1 suppliercertsub.Ids
-			certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3)
-
+			idString := ""
+			idString1 := ""
+			for i := 0; i < len(certSubList); i = i+1000 {
+				var ids suppliercertsub.Ids
+				certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 3, strconv.Itoa(i))
+				if ids.Id != "" {
+					idString += "," + ids.Id
+				} else {
+					break
+				}
+			}
 			var needList []supplierfile.FileList
 			var needList1 []supplierfile.FileList
 
 			if cert.SupplierTypeCode == "01" {
 				//需要的资质
-				needList1 = filesvc.GetGoodsNeedFileListNew(ids.Id, "2")
+				needList1 = filesvc.GetGoodsNeedFileListNew(idString, "2")
 				if supplier.OperType == "制造商" { //制造商
 					//如果是制造商,准入范围按照各项准入范围的类型判断
-					var ids suppliercertsub.Ids
 					// 制造
-					certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1)
+					idString = ""
+					for i := 0; i < len(certSubList); i = i+1000 {
+						var ids suppliercertsub.Ids
+						certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids, 1, strconv.Itoa(i))
+						if ids.Id != "" {
+							idString += "," + ids.Id
+						} else {
+							break
+						}
+					}
 					// 非制造
-					certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2)
-					needList = filesvc.GetGoodsNeedFileListNew(ids.Id, "1")
-					needList1 = filesvc.GetGoodsNeedFileListNew(ids1.Id, "2")
+					for i := 0; i < len(certSubList); i = i+1000 {
+						var ids1 suppliercertsub.Ids
+						certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids1, 2, strconv.Itoa(i))
+						if ids1.Id != "" {
+							idString1 += "," + ids1.Id
+						} else {
+							break
+						}
+					}
+					needList = filesvc.GetGoodsNeedFileListNew(idString, "1")
+					needList1 = filesvc.GetGoodsNeedFileListNew(idString1, "2")
 					//for _, need := range needList1 {
 					//	needList = append(needList, need)
 					//}
 				}
 			} else if cert.SupplierTypeCode == "02" {
-				needList = filesvc.GetBasicNeedFileListNew(ids.Id)
+				needList = filesvc.GetBasicNeedFileListNew(idString)
 			} else if cert.SupplierTypeCode == "03" {
-				needList = filesvc.GetTechNeedFileListNew(ids.Id)
+				needList = filesvc.GetTechNeedFileListNew(idString)
 			}
 
 			needName := ""