|
|
@@ -3119,6 +3119,143 @@ func (this *OilSupplierController) CheckSupplierFileDelete() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+// @Title 检查缺资质列表
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /checkSupplierFileList [post]
|
|
|
+func (this *OilSupplierController) CheckSupplierFileList() {
|
|
|
+ var file supplierfile.CheckFile
|
|
|
+ var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonBlob, &file)
|
|
|
+ //获取主表信息
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
+ supplierService := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ supplierService.GetEntityById(file.SupplierId, &supplierEntity)
|
|
|
+ //获取准入信息表
|
|
|
+ var cert suppliercert.OilSupplierCert
|
|
|
+ supplierService.GetEntityByWhere("OilSupplierCert", "Id = "+file.CertId, &cert)
|
|
|
+
|
|
|
+ // 查询出已有哪些资质
|
|
|
+ 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 certSubList2 suppliercertsub.OilSupplierCertSub
|
|
|
+ certSubList2.LackFile = ""
|
|
|
+ certSubList2.IsQuestion = 0
|
|
|
+ svcHeader.UpdateEntityBywheretbl(OilSupplierCertSubName, &certSubList2, []string{"LackFile", "IsQuestion"}, "IsQuestion = 2 and SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and SupplierCertId = " + file.CertId)
|
|
|
+
|
|
|
+ //对准入范围的判断
|
|
|
+ var certSubList []suppliercertsub.OilSupplierCertSub
|
|
|
+ certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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")
|
|
|
+ for _, need := range needList1 {
|
|
|
+ needList = append(needList, need)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } 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" {
|
|
|
+ if file.Type == 1 {
|
|
|
+ where2 += " and IsManufacturer != 2"
|
|
|
+ supplierService.GetDeleteSub2(OilGoodsAptitudeName, where2, &certSub, header.Name)
|
|
|
+ } else {
|
|
|
+ where2 += " and IsManufacturer == 2"
|
|
|
+ supplierService.GetDeleteSub2(OilGoodsAptitudeName, where2, &certSub, header.Name)
|
|
|
+ }
|
|
|
+ } else if cert.SupplierTypeCode == "02" {
|
|
|
+ supplierService.GetDeleteSub2(OilBasisBuildName, where2, &certSub, header.Name)
|
|
|
+ } else {
|
|
|
+ supplierService.GetDeleteSub2(OilTechnologyServiceName, where2, &certSub, header.Name)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ fmt.Print("22222")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var certSubList1 []suppliercertsub.OilSupplierCertSub
|
|
|
+ certsubService.GetEntitysByWhere(OilSupplierCertSubName, "IsQuestion = 2 and SupplierId = " + strconv.Itoa(supplierEntity.Id) + " and SupplierCertId = " + file.CertId, &certSubList1)
|
|
|
+
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = certSubList1
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
// @Title 对外-招投标系统
|
|
|
// @Description
|
|
|
// @Success 200 {object}
|