|
|
@@ -3806,6 +3806,184 @@ func (this *OilSupplierController) CheckSupplierFileList() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+// @Title 标记缺资质的准入
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /statistic-lack-cert [post]
|
|
|
+func (this *OilSupplierController) GetLackCertList() {
|
|
|
+ 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 certList []suppliercert.OilSupplierCert
|
|
|
+ supplierService.GetEntitysByWhere("OilSupplierCert", "SupplierId = "+strconv.Itoa(file.SupplierId), &certList)
|
|
|
+ certsubService := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
+
|
|
|
+ // 查询出已有哪些资质
|
|
|
+ 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)
|
|
|
+ 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")
|
|
|
+
|
|
|
+ certService := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ for _, cert := range certList {
|
|
|
+ if file.CertId != "0" && strconv.Itoa(cert.Id) != file.CertId {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ whereInfo := ""
|
|
|
+ if file.CertId == "0" {
|
|
|
+ // 信息变更 不获取 增项审核中的数据
|
|
|
+ whereInfo = " and Type != '2'"
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 = "+strconv.Itoa(cert.Id)+whereInfo)
|
|
|
+
|
|
|
+ //对准入范围的判断
|
|
|
+ var certSubList []suppliercertsub.OilSupplierCertSub
|
|
|
+ certsubService.GetListByCertId(strconv.Itoa(cert.Id), &certSubList)
|
|
|
+ certsubService.GetEntitysByWhere(OilSupplierCertSubName, "SupplierCertId = "+strconv.Itoa(cert.Id)+whereInfo, &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 != "" {
|
|
|
+ var certEntity suppliercert.OilSupplierCert
|
|
|
+ certCols := []string{
|
|
|
+ "IsLack",
|
|
|
+ }
|
|
|
+ certEntity.IsLack = 2
|
|
|
+ certService.UpdateEntityBywheretbl(OilSupplierCertName, &certEntity, certCols, " Id ="+file.CertId)
|
|
|
+ break
|
|
|
+ } 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 != "" {
|
|
|
+ var certEntity1 suppliercert.OilSupplierCert
|
|
|
+ certCols := []string{
|
|
|
+ "IsLack",
|
|
|
+ }
|
|
|
+ certEntity1.IsLack = 2
|
|
|
+ certService.UpdateEntityBywheretbl(OilSupplierCertName, &certEntity1, certCols, " Id ="+file.CertId)
|
|
|
+ break
|
|
|
+ } else {
|
|
|
+ fmt.Print("22222")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ var certList1 []suppliercert.OilSupplierCert
|
|
|
+ var total int64
|
|
|
+ where3 := "IsLack = 2 "
|
|
|
+
|
|
|
+ total = certService.GetPagingEntitiesWithOrderBytbl("", file.CurrentPage, file.Size, "Id", true, &certList1, where3)
|
|
|
+
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ datainfo.PageIndex = file.CurrentPage
|
|
|
+ datainfo.ItemsPerPage = file.Size
|
|
|
+ datainfo.Items = certList1
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
// @Title 对外-招投标系统
|
|
|
// @Description
|
|
|
// @Success 200 {object}
|