|
|
@@ -1319,3 +1319,117 @@ func (this *OilSupplierCertSubController) UpdateStatusWithLog() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// @Title 物资类准入提交审核检查资质
|
|
|
+// @Description 物资类准入提交审核检查资质
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /checkSubFile [post]
|
|
|
+func (this *OilSupplierCertSubController) CheckSubFile () {
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ var datamain suppliercertsub.OilSupplierCertSub
|
|
|
+ var dataother []suppliercertsub.OilSupplierCertSub
|
|
|
+
|
|
|
+ json.Unmarshal(jsonblob, &datamain)
|
|
|
+
|
|
|
+ var supplierCertModel suppliercert.OilSupplierCert
|
|
|
+ svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
|
|
|
+
|
|
|
+ var lostCertList []LostCertFiles
|
|
|
+ // 查询出已有哪些资质
|
|
|
+ supplierId := datamain.SupplierId
|
|
|
+ supplierTypeCode := datamain.SupplierTypeCode
|
|
|
+ var tableheaderList []supplierfile.OilSupplierFile
|
|
|
+
|
|
|
+ fileSql := "SELECT * from OilSupplierFile WHERE SupplierId='" + strconv.Itoa(supplierId) + "'"
|
|
|
+ fileSql += " AND (SupplierTypeCode='" + supplierTypeCode + "' or SupplierTypeCode='000')"
|
|
|
+
|
|
|
+ svcHeader := tableheader.GetTableHeaderService(utils.DBE)
|
|
|
+ svcHeader.DBE.SQL(fileSql).Find(&tableheaderList)
|
|
|
+ var companyHasHeaders string
|
|
|
+ for _, tableheader := range tableheaderList {
|
|
|
+ companyHasHeaders += tableheader.NeedFileType + ","
|
|
|
+ }
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(supplierId, &supplierModel)
|
|
|
+ where := "SupplierId = " + strconv.Itoa(supplierId) + " and SupplierCertId = "+ strconv.Itoa(datamain.SupplierCertId) + " and SupplierTypeCode = "+ supplierTypeCode
|
|
|
+ svcSupplier.GetEntitysByWhere(OilSupplierCertSubName, where, &dataother)
|
|
|
+
|
|
|
+ //逐条检查需要的资质
|
|
|
+ for _,sub := range dataother {
|
|
|
+ if supplierModel.OperType == "制造商" {
|
|
|
+ datamain.IsManufacturer = 1
|
|
|
+ } else {
|
|
|
+ datamain.IsManufacturer = 2
|
|
|
+ }
|
|
|
+ //检查是否资质全面
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
+ needList := filesvc.GetGoodsNeedFileList(strconv.Itoa(sub.SubClassId), strconv.Itoa(datamain.IsManufacturer)) // 需要的资质
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+ if supplierCertModel.InStyle == "4" {
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ //战略合作协议扫描件
|
|
|
+ needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+ if supplierCertModel.InStyle == "6" {
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ //招标中标结果
|
|
|
+ needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "TheTender")
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+ if datamain.IsManufacturer == 1 { //制造商
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ // 质量管理体系认证证书
|
|
|
+ CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
|
|
|
+ needFile.FileName = CNPCrenkezhengshu
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+ for _, needHeader := range needList {
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") &&
|
|
|
+ strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
|
|
|
+ //三证合一或五证合一的证件,不需要验证了
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ var fileist1 supplierfile.OilSupplierFile
|
|
|
+ where1 := " SupplierId = '" + strconv.Itoa(supplierId) + "' and NeedFileType = '" + needHeader.FileName + "'"
|
|
|
+ filesvc.GetEntityByWhere(OilSupplierFileName, where1, &fileist1)
|
|
|
+
|
|
|
+ var filelist2 suppliercertappendsub.OilAppendChangeDetail
|
|
|
+ where2 := " SupplierId = '" + strconv.Itoa(supplierId) + "' and NeedFileType = '" +needHeader.FileName + "'"
|
|
|
+ svc2 := suppliercertappendsub.GetOilSupplierCertAppendSubService (utils.DBE)
|
|
|
+ svc2.GetEntityByWhere(OilAppendChangeDetailName, where2, &filelist2)
|
|
|
+
|
|
|
+ if !strings.Contains(companyHasHeaders, needHeader.FileName+",") {
|
|
|
+ var tmpLostCert LostCertFiles
|
|
|
+ tmpLostCert.Code = sub.Code
|
|
|
+ tmpLostCert.Name = sub.Name
|
|
|
+ tmpLostCert.CertFileName = needHeader.FileName
|
|
|
+ lostCertList = append(lostCertList, tmpLostCert)
|
|
|
+ } else {
|
|
|
+ if filelist2.FileName == "" && fileist1.FileName == "" {
|
|
|
+ //缺少的资质
|
|
|
+ var tmpLostCert LostCertFiles
|
|
|
+ tmpLostCert.Code = sub.Code
|
|
|
+ tmpLostCert.Name = sub.Name
|
|
|
+ tmpLostCert.CertFileName = needHeader.FileName
|
|
|
+ lostCertList = append(lostCertList, tmpLostCert)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ if len(lostCertList) <= 0 {
|
|
|
+ errinfo.Code = 0
|
|
|
+ errinfo.Message = "验证通过!"
|
|
|
+ this.Data["json"] = nil
|
|
|
+ } else {
|
|
|
+ errinfo.Code = -1
|
|
|
+ errinfo.Message = "缺少资质!"
|
|
|
+ this.Data["json"] = &lostCertList
|
|
|
+ }
|
|
|
+ this.ServeJSON()
|
|
|
+}
|