|
@@ -3836,14 +3836,16 @@ func (this *OilSupplierController) markLackCert(file supplierfile.CheckFile) {
|
|
|
|
|
|
|
|
// 查询出已有哪些资质
|
|
// 查询出已有哪些资质
|
|
|
var tableheaderList []qualchange.OilQualChangeDetail1
|
|
var tableheaderList []qualchange.OilQualChangeDetail1
|
|
|
- //whereInfoFile := ""
|
|
|
|
|
- //if file.CertId == "0" {
|
|
|
|
|
- // // 信息变更 不获取 增项和年审审核中的数据
|
|
|
|
|
- // whereInfoFile = " and SupType in (0,1,3,4,5)"
|
|
|
|
|
- //} else {
|
|
|
|
|
- // whereInfoFile = " and SupType in (0,1,2,3,5)"
|
|
|
|
|
- //}
|
|
|
|
|
- fileSql := "SELECT * from OilSupplierFile WHERE SupplierId = " + strconv.Itoa(file.SupplierId)
|
|
|
|
|
|
|
+ where := ""
|
|
|
|
|
+ if file.CertId != "0" {
|
|
|
|
|
+ // 物资服务基建的资质分开判断 2021.06.07
|
|
|
|
|
+ var certInfo suppliercert.OilSupplierCert
|
|
|
|
|
+ supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &certInfo)
|
|
|
|
|
+ if certInfo.Id > 0 {
|
|
|
|
|
+ where = " and SupplierTypeCode in ( '000', '" + certInfo.SupplierTypeCode + "')"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ fileSql := "SELECT * from OilSupplierFile WHERE IsDelete = 0 and SupplierId = " + strconv.Itoa(file.SupplierId) + where
|
|
|
svcHeader := tableheader.GetTableHeaderService(utils.DBE)
|
|
svcHeader := tableheader.GetTableHeaderService(utils.DBE)
|
|
|
svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
|
|
svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
|
|
|
var companyHasHeaders string
|
|
var companyHasHeaders string
|
|
@@ -3972,6 +3974,160 @@ func (this *OilSupplierController) markLackCert(file supplierfile.CheckFile) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (this *OilSupplierController) markLackCertSub(file supplierfile.CheckFile) {
|
|
|
|
|
+ //获取主表信息
|
|
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
|
|
+ supplierService := supplier.GetOilSupplierService(utils.DBE)
|
|
|
|
|
+ supplierService.GetEntityById(file.SupplierId, &supplierEntity)
|
|
|
|
|
+ //获取准入信息表
|
|
|
|
|
+ var certList []suppliercert.OilSupplierCert
|
|
|
|
|
+ supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
|
|
|
|
|
+ certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
|
|
+
|
|
|
|
|
+ // 查询出已有哪些资质
|
|
|
|
|
+ var tableheaderList []qualchange.OilQualChangeDetail1
|
|
|
|
|
+ where := ""
|
|
|
|
|
+ if file.CertId != "0" {
|
|
|
|
|
+ // 物资服务基建的资质分开判断 2021.06.07
|
|
|
|
|
+ var certInfo suppliercert.OilSupplierCert
|
|
|
|
|
+ supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &certInfo)
|
|
|
|
|
+ if certInfo.Id > 0 {
|
|
|
|
|
+ where = " and SupplierTypeCode in ( '000', '" + certInfo.SupplierTypeCode + "')"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ fileSql := "SELECT * from OilSupplierFile WHERE IsDelete = 0 and SupplierId = " + strconv.Itoa(file.SupplierId) + where
|
|
|
|
|
+ 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")
|
|
|
|
|
+
|
|
|
|
|
+ for _, cert := range certList {
|
|
|
|
|
+ if file.CertId != "0" && strconv.Itoa(cert.Id) != file.CertId {
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //对准入范围的判断
|
|
|
|
|
+ var certSubList []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
+ certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
|
|
|
|
|
+ certsubService.GetEntitysByWhere(OilSupplierCertSubName, "SupplierCertId = "+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
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ var needList []supplierfile.FileList
|
|
|
|
|
+ var needList1 []supplierfile.FileList
|
|
|
|
|
+
|
|
|
|
|
+ if cert.SupplierTypeCode == "01" {
|
|
|
|
|
+ //需要的资质
|
|
|
|
|
+ needList1 = filesvc.GetGoodsNeedFileListNew(idString, "2")
|
|
|
|
|
+ if file.Type == 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
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 非制造
|
|
|
|
|
+ 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")
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if cert.SupplierTypeCode == "02" {
|
|
|
|
|
+ needList = filesvc.GetBasicNeedFileListNew(idString)
|
|
|
|
|
+ } else if cert.SupplierTypeCode == "03" {
|
|
|
|
|
+ needList = filesvc.GetTechNeedFileListNew(idString)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for _, needHeader := range needList {
|
|
|
|
|
+ if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
|
|
|
|
|
+ strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
|
|
|
|
|
+ //三证合一或五证合一的证件,不需要验证了
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
|
|
|
|
|
+ var header tableheader.BaseTableheader
|
|
|
|
|
+ where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
|
|
|
|
|
+ if cert.SupplierTypeCode == "01" {
|
|
|
|
|
+ where1 += " and IsManuf != '2'"
|
|
|
|
|
+ }
|
|
|
|
|
+ supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
|
|
|
|
|
+ if header.Code != "" {
|
|
|
|
|
+ where2 := header.Code + " = '1'"
|
|
|
|
|
+ where2 += " and a.SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
|
|
|
|
|
+
|
|
|
|
|
+ var certSub []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
+ if cert.SupplierTypeCode == "01" {
|
|
|
|
|
+ where2 += " and IsManufacturer != 2"
|
|
|
|
|
+ supplierService.GetDeleteSub3(OilGoodsAptitudeName, where2, &certSub, header.Name)
|
|
|
|
|
+ } else if cert.SupplierTypeCode == "02" {
|
|
|
|
|
+ supplierService.GetDeleteSub3(OilBasisBuildName, where2, &certSub, header.Name)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ supplierService.GetDeleteSub3(OilTechnologyServiceName, where2, &certSub, header.Name)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fmt.Print("22222")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for _, needHeader := range needList1 {
|
|
|
|
|
+ // 非制造
|
|
|
|
|
+ if (supplierEntity.CredentialFlag == "1" || supplierEntity.CredentialFlag == "2") &&
|
|
|
|
|
+ strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
|
|
|
|
|
+ //三证合一或五证合一的证件,不需要验证了
|
|
|
|
|
+ continue
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
|
|
|
|
|
+ var header tableheader.BaseTableheader
|
|
|
|
|
+ where1 := "Name = '" + needHeader.FileName + "' and CategoryCode = '" + cert.SupplierTypeCode + "'"
|
|
|
|
|
+ if cert.SupplierTypeCode == "01" {
|
|
|
|
|
+ where1 += " and IsManuf != '1'"
|
|
|
|
|
+ }
|
|
|
|
|
+ supplierService.GetEntityByWhere(BaseTableHeader, where1, &header)
|
|
|
|
|
+ if header.Code != "" {
|
|
|
|
|
+ where2 := header.Code + " = '1'"
|
|
|
|
|
+ where2 += " and a.SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and a.SupplierTypeCode = '" + cert.SupplierTypeCode + "'"
|
|
|
|
|
+ var certSub []suppliercertsub.OilSupplierCertSub
|
|
|
|
|
+ if file.Type == 1 {
|
|
|
|
|
+ where2 += " and IsManufacturer = 2"
|
|
|
|
|
+ }
|
|
|
|
|
+ supplierService.GetDeleteSub3(OilGoodsAptitudeName, where2, &certSub, header.Name)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fmt.Print("22222")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// @Title 对外-招投标系统
|
|
// @Title 对外-招投标系统
|
|
|
// @Description
|
|
// @Description
|
|
|
// @Success 200 {object}
|
|
// @Success 200 {object}
|
|
@@ -4076,3 +4232,43 @@ func (this *OilSupplierController) GetLackCertList() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// @Title 获取所有缺资质的准入范围
|
|
|
|
|
+// @Description
|
|
|
|
|
+// @Success 200 {object}
|
|
|
|
|
+// @router /lackCertSubList [get]
|
|
|
|
|
+func (this *OilSupplierController) GetLackCertSubList() {
|
|
|
|
|
+ secret := this.GetString("secret")
|
|
|
|
|
+ if secret != "scgl-lack-moral" {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ supService := supplier.GetOilSupplierService(utils.DBE)
|
|
|
|
|
+ var supEntity supplier.OilSupplier
|
|
|
|
|
+ certService := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
|
|
+ var allCertList []suppliercert.OilSupplierCert
|
|
|
|
|
+ whereCert := " Status = '8' or Status = '11' "
|
|
|
|
|
+ certService.GetEntitysByWhere(OilSupplierCertName, whereCert, &allCertList)
|
|
|
|
|
+ if len(allCertList) > 0 {
|
|
|
|
|
+ // 重置标识
|
|
|
|
|
+ sql := "update " + OilSupplierCertSubName + " set LackFile1 = '',IsQuestion1 = 0 "
|
|
|
|
|
+ _, _ = certService.DBE.Exec(sql)
|
|
|
|
|
+ log.Println("共查询到准入条数:", len(allCertList))
|
|
|
|
|
+ for _, certEntity := range allCertList {
|
|
|
|
|
+ supService.GetEntityById(certEntity.SupplierId, &supEntity)
|
|
|
|
|
+ var file supplierfile.CheckFile
|
|
|
|
|
+ file.CertId = strconv.Itoa(certEntity.Id)
|
|
|
|
|
+ file.SupplierId = certEntity.SupplierId
|
|
|
|
|
+ file.Grade = supEntity.Grade
|
|
|
|
|
+ if supEntity.OperType == "制造商" {
|
|
|
|
|
+ file.Type = 1
|
|
|
|
|
+ }
|
|
|
|
|
+ if supEntity.OperType == "贸易商" || supEntity.OperType == "代理商" {
|
|
|
|
|
+ file.Type = 2
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其他字段值
|
|
|
|
|
+ this.markLackCertSub(file)
|
|
|
|
|
+ log.Println("标记准入缺资质")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ log.Println("结束")
|
|
|
|
|
+}
|