Browse Source

后:信息变更提交检查资质优化

dubch 5 years ago
parent
commit
895fdcd308

+ 4 - 0
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertsub/oilsuppliercertsub.go

@@ -246,3 +246,7 @@ type OilCompare struct {
 	ManufacturerName   string //代理的制造商名称
 	ManufacturerName   string //代理的制造商名称
 	Diff			   string //是否为比对出的不同项
 	Diff			   string //是否为比对出的不同项
 }
 }
+
+type Ids struct {
+	Id         string
+}

+ 5 - 0
src/dashoo.cn/backend/api/business/oilsupplier/suppliercertsub/oilsuppliercertsubService.go

@@ -95,4 +95,9 @@ func (s *OilSupplierCertSubService) GetListByCertId (certId string, supplierCert
 func (s *OilSupplierCertSubService) GetListByAppendId (appendId string, supplierCertSubs *[]OilSupplierCertSub) {
 func (s *OilSupplierCertSubService) GetListByAppendId (appendId string, supplierCertSubs *[]OilSupplierCertSub) {
 	queryWhere := "SupplierCertAppendId='" + appendId + "'"
 	queryWhere := "SupplierCertAppendId='" + appendId + "'"
 	s.GetEntitysByWhere("OilSupplierCertSub", queryWhere, supplierCertSubs)
 	s.GetEntitysByWhere("OilSupplierCertSub", queryWhere, supplierCertSubs)
+}
+
+func (s *OilSupplierCertSubService) GetIds (certId string, typeCode string, entitiesPtr interface{}) {
+	sql := "SELECT GROUP_CONCAT(SubClassId) as Id FROM OilSupplierCertSub WHERE SupplierCertId = " + certId + " AND SupplierTypeCode = '" + typeCode + "'"
+	s.DBE.SQL(sql).Get(entitiesPtr)
 }
 }

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

@@ -67,6 +67,43 @@ func (s *SupplierfileService) GetGoodsNeedFileList(classid string,IsManuf ...str
 	return needList
 	return needList
 }
 }
 
 
+func (s *SupplierfileService) GetGoodsNeedFileListNew(classid string,IsManuf ...string) (needList []FileList) {
+	search := ""
+	if len(IsManuf) == 0 {
+		search = ""
+	} else {
+		search = IsManuf[0]
+	}
+	var entity goodsaptitude.OilGoodsAptitude
+	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,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 + ")"
+	s.DBE.Sql(sql).Get(&entity)
+
+	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
+	var headerList []tableheader.BaseTableheader
+	tbHeaderSvc.ListGoodTableHeader(&headerList)
+	for _, header := range headerList {
+		curCertConfig := reflect.ValueOf(entity)
+		setValue := curCertConfig.FieldByName(header.Code).String()
+		//if setValue != "" && setValue != "0" {
+		if setValue == "1" {
+			if search != "" {
+				if header.IsManuf == search || header.IsManuf == "0" {
+					needList = append(needList, FileList{FileName: header.Name})
+				}
+			} else {
+				needList = append(needList, FileList{FileName: header.Name})
+			}
+		}
+	}
+
+	return needList
+}
+
 func (s *SupplierfileService) GetBasicNeedFileList(classid string) (needList []FileList) {
 func (s *SupplierfileService) GetBasicNeedFileList(classid string) (needList []FileList) {
 	var entity basisbuild.OilBasisBuild
 	var entity basisbuild.OilBasisBuild
 	sql := "select * from OilBasisBuild where Id in (" + classid + ")"
 	sql := "select * from OilBasisBuild where Id in (" + classid + ")"
@@ -87,6 +124,29 @@ func (s *SupplierfileService) GetBasicNeedFileList(classid string) (needList []F
 	return needList
 	return needList
 }
 }
 
 
+func (s *SupplierfileService) GetBasicNeedFileListNew(classid string) (needList []FileList) {
+	var entity basisbuild.OilBasisBuild
+	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 + ")"
+	s.DBE.Sql(sql).Get(&entity)
+
+	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
+	var headerList []tableheader.BaseTableheader
+	tbHeaderSvc.ListBbTableHeader(&headerList)
+	for _, header := range headerList {
+		curCertConfig := reflect.ValueOf(entity)
+		setValue := curCertConfig.FieldByName(header.Code).String()
+		//if setValue != "" && setValue != "0" {
+		if setValue == "1"  {
+			needList = append(needList, FileList{FileName: header.Name})
+		}
+	}
+
+	return needList
+}
+
 func (s *SupplierfileService) GetTechNeedFileList(classid string) (needList []FileList) {
 func (s *SupplierfileService) GetTechNeedFileList(classid string) (needList []FileList) {
 	var entity technologyservice.OilTechnologyService
 	var entity technologyservice.OilTechnologyService
 	sql := "select * from OilTechnologyService where ClassId in (" + classid + ")"
 	sql := "select * from OilTechnologyService where ClassId in (" + classid + ")"
@@ -106,6 +166,32 @@ func (s *SupplierfileService) GetTechNeedFileList(classid string) (needList []Fi
 
 
 	return needList
 	return needList
 }
 }
+
+func (s *SupplierfileService) GetTechNeedFileListNew(classid string) (needList []FileList) {
+	var entity technologyservice.OilTechnologyService
+	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,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,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 + ")"
+	s.DBE.Sql(sql).Get(&entity)
+
+	tbHeaderSvc := tableheader.GetTableHeaderService(s.DBE)
+	var headerList []tableheader.BaseTableheader
+	tbHeaderSvc.ListTsTableHeader(&headerList)
+	for _, header := range headerList {
+		curCertConfig := reflect.ValueOf(entity)
+		setValue := curCertConfig.FieldByName(header.Code).String()
+		//if setValue != "" && setValue != "0" {
+		if setValue == "1" {
+			needList = append(needList, FileList{FileName: header.Name})
+		}
+	}
+
+	return needList
+}
 //查看是否为制造商
 //查看是否为制造商
 func (s *SupplierfileService) CheckIsManuf(id string) (IsManufacturer string) {
 func (s *SupplierfileService) CheckIsManuf(id string) (IsManufacturer string) {
 	var entity suppliercertsub.OilSupplierCertSub
 	var entity suppliercertsub.OilSupplierCertSub

+ 79 - 60
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -2614,7 +2614,7 @@ func (this *OilSupplierController) GetCommercialNoIsExist() {
 	}
 	}
 }
 }
 
 
-// @Title 信息变更-物资类改变供应商类型检查资质
+// @Title 信息变更检查资质
 // @Description
 // @Description
 // @Success	200	{object} controllers.Request
 // @Success	200	{object} controllers.Request
 // @router /checkSupplierFile [post]
 // @router /checkSupplierFile [post]
@@ -2631,68 +2631,87 @@ func (this *OilSupplierController) CheckSupplierFile() {
 	var supplierCertEntity []suppliercert.OilSupplierCert
 	var supplierCertEntity []suppliercert.OilSupplierCert
 	supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &supplierCertEntity)
 	supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &supplierCertEntity)
 	for _, cert := range supplierCertEntity {
 	for _, cert := range supplierCertEntity {
+		//对准入范围的判断
+		var certSubList []suppliercertsub.OilSupplierCertSub
+		certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
+		certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
+
+		// 查询出已有哪些资质
+		var tableheaderList []qualchange.OilQualChangeDetail1
+		fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
+		svcHeader := tableheader.GetTableHeaderService(utils.DBE)
+		svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
+		var companyHasHeaders string
+		for _, tableheader := range tableheaderList {
+			companyHasHeaders += tableheader.NeedFileType + ","
+		}
+		paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
+		filesvc := supplierfile.GetSupplierfileService(utils.DBE)
+		mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
+
+		var ids suppliercertsub.Ids
+		certsubService.GetIds(strconv.Itoa(cert.Id), cert.SupplierTypeCode, &ids)
+		var needList []supplierfile.FileList
+
 		if cert.SupplierTypeCode == "01" {
 		if cert.SupplierTypeCode == "01" {
-			//对准入范围的判断
-			var certSubList []suppliercertsub.OilSupplierCertSub
-			certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
-			certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
-
-			// 查询出已有哪些资质
-			var tableheaderList []qualchange.OilQualChangeDetail1
-			fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
-			svcHeader := tableheader.GetTableHeaderService(utils.DBE)
-			svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
-			var companyHasHeaders string
-			for _, tableheader := range tableheaderList {
-				companyHasHeaders += tableheader.NeedFileType + ","
+			//需要的资质
+			needList = filesvc.GetGoodsNeedFileListNew(ids.Id, strconv.Itoa(file.Type))
+			if file.Type == 1 { //制造商
+				var needFile supplierfile.FileList
+				// 质量管理体系认证证书
+				CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
+				needFile.FileName = CNPCrenkezhengshu
+				needList = append(needList, needFile)
 			}
 			}
-			paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
-			filesvc := supplierfile.GetSupplierfileService(utils.DBE)
-			mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
-			for _, certSubItem := range certSubList {
-				var needList []supplierfile.FileList
-				//需要的资质
-				needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(certSubItem.SubClassId), strconv.Itoa(file.Type))
-
-				if file.Type == 1 { //制造商
-					var needFile supplierfile.FileList
-					// 质量管理体系认证证书
-					CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
-					needFile.FileName = CNPCrenkezhengshu
-					needList = append(needList, needFile)
-				}
+		} else if cert.SupplierTypeCode == "02" {
+			needList = filesvc.GetBasicNeedFileListNew(ids.Id)
+		} else if cert.SupplierTypeCode == "03"{
+			needList = filesvc.GetTechNeedFileListNew(ids.Id)
+		}
 
 
-				for _, needHeader := range needList {
-					if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
-						strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
-						//三证合一或五证合一的证件,不需要验证了
-						continue
-					}
-					var fileist1 supplierfile.OilSupplierFile
-					where1 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
-					filesvc.GetEntityByWhere("OilSupplierFile", where1, &fileist1)
-
-					var filelist2 suppliercertappendsub.OilAppendChangeDetail
-					where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
-					svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
-					svc2.GetEntityByWhere("OilQualChangeDetail", where2, &filelist2)
-
-					if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
-						errinfo.Message = "请上传!" + needHeader.FileName + "!"
-						errinfo.Code = 0
-						this.Data["json"] = &errinfo
-						this.ServeJSON()
-						return
-					} else {
-						if filelist2.FileName == "" && fileist1.FileName == "" {
-							//缺少的资质
-							errinfo.Message = "请上传!" + needHeader.FileName + "!"
-							errinfo.Code = 0
-							this.Data["json"] = &errinfo
-							this.ServeJSON()
-							return
-						}
-					}
+		if cert.InStyle == "4" {
+			var needFile supplierfile.FileList
+			//战略合作协议扫描件
+			needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
+			needList = append(needList, needFile)
+		}
+
+		if cert.InStyle == "6" {
+			var needFile supplierfile.FileList
+			//招标准入需提供招标中标结果
+			needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "TheTender")
+			needList = append(needList, needFile)
+		}
+
+		for _, needHeader := range needList {
+			if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
+				strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
+				//三证合一或五证合一的证件,不需要验证了
+				continue
+			}
+			var fileist1 supplierfile.OilSupplierFile
+			where1 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
+			filesvc.GetEntityByWhere("OilSupplierFile", where1, &fileist1)
+
+			var filelist2 suppliercertappendsub.OilAppendChangeDetail
+			where2 := " SupplierId = '" + strconv.Itoa(file.SupplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
+			svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService(utils.DBE)
+			svc2.GetEntityByWhere("OilQualChangeDetail", where2, &filelist2)
+
+			if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
+				errinfo.Message = "请上传!" + needHeader.FileName + "!"
+				errinfo.Code = 0
+				this.Data["json"] = &errinfo
+				this.ServeJSON()
+				return
+			} else {
+				if filelist2.FileName == "" && fileist1.FileName == "" {
+					//缺少的资质
+					errinfo.Message = "请上传!" + needHeader.FileName + "!"
+					errinfo.Code = 0
+					this.Data["json"] = &errinfo
+					this.ServeJSON()
+					return
 				}
 				}
 			}
 			}
 		}
 		}