|
|
@@ -344,147 +344,6 @@ func (this *OilSupplierCertSubController) DeleteEntity() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @Title 批量添加准入范围--物资类
|
|
|
-// @Description 批量添加准入范围
|
|
|
-// @Success 200 {object} business.device.DeviceChannels
|
|
|
-// @router /addgoodsbus [post]
|
|
|
-func (this *OilSupplierCertSubController) AddGoodsBus() {
|
|
|
- var jsonblob = this.Ctx.Input.RequestBody
|
|
|
- var datamain suppliercertsub.OilSupplierCertSub
|
|
|
- var dataother suppliercertsub.SupplierCertSubModel
|
|
|
-
|
|
|
- json.Unmarshal(jsonblob, &datamain)
|
|
|
- json.Unmarshal(jsonblob, &dataother)
|
|
|
-
|
|
|
- var supplierCertModel suppliercert.OilSupplierCert
|
|
|
- svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
- svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
|
|
|
-
|
|
|
- var supplierModel supplier.OilSupplier
|
|
|
- svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- svcSupplier.GetEntityById(datamain.SupplierId, &supplierModel)
|
|
|
-
|
|
|
- for n := 0; n < len(dataother.CheckList); n++ {
|
|
|
- where_sub := "SupplierTypeCode = 01 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
- where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
|
|
|
- where_sub += " and SubClassId = '" + dataother.CheckList[n].Id + "'"
|
|
|
- var model suppliercertsub.OilSupplierCertSub
|
|
|
- svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
- has := svc.GetEntityByWhere(OilSupplierCertSubName, where_sub, &model)
|
|
|
-
|
|
|
- if !has {
|
|
|
- if supplierModel.OperType == "制造商" {
|
|
|
- datamain.IsManufacturer = 1
|
|
|
- } else {
|
|
|
- datamain.IsManufacturer = 2
|
|
|
- }
|
|
|
- datamain.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
|
|
|
- datamain.Code = dataother.CheckList[n].Code
|
|
|
- datamain.Name = dataother.CheckList[n].Name
|
|
|
- datamain.GoodsLevel = dataother.CheckList[n].GoodsLevel
|
|
|
- datamain.Remark = dataother.Remark
|
|
|
- datamain.IsDelete = 0
|
|
|
- datamain.CreateBy = this.User.Realname
|
|
|
- datamain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- unitsvc := organize.GetOrganizeService(utils.DBE)
|
|
|
- unitid := unitsvc.GetMyUnitDepartmentId(this.User.DepartmentId)
|
|
|
- if unitid == "100000095" { // 100000095 企管法规处(内控与风险管理处)
|
|
|
- datamain.CertSubStatus = "1"
|
|
|
- }
|
|
|
-
|
|
|
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
- needList := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id, strconv.Itoa(datamain.IsManufacturer)) // 需要的资质
|
|
|
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
-
|
|
|
- isContinue := false
|
|
|
- if datamain.IsManufacturer == 2 {
|
|
|
- needList1 := filesvc.GetGoodsNeedFileList(dataother.CheckList[n].Id, "1") // 需要的资质--制造类
|
|
|
- // 中油集团公司产品质量认可证书
|
|
|
- CNPCrenkezhengshu := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CNPCrenkezhengshu")
|
|
|
- for _, item := range needList1 {
|
|
|
- if item.FileName == CNPCrenkezhengshu {
|
|
|
- isContinue = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if isContinue {
|
|
|
- break
|
|
|
- }
|
|
|
- svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
|
|
|
-
|
|
|
- if supplierCertModel.InStyle == "4" {
|
|
|
- var needFile supplierfile.FileList
|
|
|
- //战略合作协议扫描件
|
|
|
- needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
|
|
|
- needList = append(needList, needFile)
|
|
|
- }
|
|
|
-
|
|
|
- var Havelist []supplierfile.OilSupplierFile // 已经有的资质
|
|
|
- where := "SupplierTypeCode in (01,000) and IsManuf in ('0','" + strconv.Itoa(datamain.IsManufacturer) + "', '') and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
- svc.GetEntitysByWhere(OilSupplierFileName, where, &Havelist)
|
|
|
-
|
|
|
- //三证合一或五证合一不需要的字段
|
|
|
- mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
- //"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
- mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
-
|
|
|
- for i := 0; i < len(needList); i++ {
|
|
|
- var entity supplierfile.OilSupplierFile
|
|
|
- entity.SupplierId = dataother.SupplierId
|
|
|
-
|
|
|
- if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
- continue
|
|
|
- }
|
|
|
- //加入对应表OilSupplierCert2File
|
|
|
- var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
- cert2File.SupplierId = dataother.SupplierId
|
|
|
- cert2File.SupplierCertId = dataother.SupplierCertId
|
|
|
- cert2File.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
- cert2File.IsManuf = strconv.Itoa(datamain.IsManufacturer)
|
|
|
- cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
|
|
|
- cert2File.Code = dataother.CheckList[n].Code
|
|
|
- cert2File.Name = dataother.CheckList[n].Name
|
|
|
- cert2File.NeedFileType = needList[i].FileName
|
|
|
- svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
-
|
|
|
- if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
- entity.SupplierTypeCode = "000"
|
|
|
- entity.IsManuf = "0"
|
|
|
- } else {
|
|
|
- entity.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
- entity.IsManuf = strconv.Itoa(datamain.IsManufacturer)
|
|
|
- }
|
|
|
- entity.NeedFileType = needList[i].FileName
|
|
|
- entity.FileType = 1
|
|
|
- //entity.EffectDate = time.Now()
|
|
|
- entity.CreateBy = this.User.Realname
|
|
|
- entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- entity.SupType = 1
|
|
|
-
|
|
|
- isRepeat := false
|
|
|
- for j := 0; j < len(Havelist); j++ {
|
|
|
- if Havelist[j].NeedFileType == needList[i].FileName {
|
|
|
- isRepeat = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if isRepeat == true {
|
|
|
- continue
|
|
|
- }
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var errinfo ErrorDataInfo
|
|
|
- errinfo.Message = "操作成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
-}
|
|
|
-
|
|
|
// @Title 批量添加准入范围--物资类
|
|
|
// @Description 批量添加准入范围
|
|
|
// @Success 200 {object} business.device.DeviceChannels
|
|
|
@@ -662,17 +521,6 @@ func (this *OilSupplierCertSubController) AddGoodsByFilter() {
|
|
|
certsValid = false
|
|
|
break
|
|
|
}
|
|
|
- //加入对应表OilSupplierCert2File, 保存准入项所需的资质关系
|
|
|
- var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
- cert2File.SupplierId = dataother.SupplierId
|
|
|
- cert2File.SupplierCertId = dataother.SupplierCertId
|
|
|
- cert2File.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
- cert2File.IsManuf = strconv.Itoa(datamain.IsManufacturer)
|
|
|
- cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
|
|
|
- cert2File.Code = dataother.CheckList[n].Code
|
|
|
- cert2File.Name = dataother.CheckList[n].Name
|
|
|
- cert2File.NeedFileType = needHeader.FileName
|
|
|
- svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
}
|
|
|
if !certsValid {
|
|
|
//缺少资质,不会保存
|
|
|
@@ -691,7 +539,28 @@ func (this *OilSupplierCertSubController) AddGoodsByFilter() {
|
|
|
if unitid == "100000095" { // 100000095 企管法规处(内控与风险管理处)
|
|
|
datamain.CertSubStatus = "1"
|
|
|
}
|
|
|
+ //插入准入范围表
|
|
|
svc.InsertEntityBytbl(OilSupplierCertSubName, &datamain)
|
|
|
+ //插入准入范围所需资质记录表
|
|
|
+ for _, needHeader := range needList {
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") &&
|
|
|
+ strings.Contains(mergerCertSkipField, needHeader.FileName+",") {
|
|
|
+ //三证合一或五证合一的证件,不需要保存
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ //加入对应表OilSupplierCert2File, 保存准入项所需的资质关系
|
|
|
+ var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
+ cert2File.SupplierId = dataother.SupplierId
|
|
|
+ cert2File.SupplierCertId = dataother.SupplierCertId
|
|
|
+ cert2File.SupplierCertSubId = datamain.Id
|
|
|
+ cert2File.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
+ cert2File.IsManuf = strconv.Itoa(datamain.IsManufacturer)
|
|
|
+ cert2File.SubClassId, _ = utils.StrTo(dataother.CheckList[n].Id).Int()
|
|
|
+ cert2File.Code = dataother.CheckList[n].Code
|
|
|
+ cert2File.Name = dataother.CheckList[n].Name
|
|
|
+ cert2File.NeedFileType = needHeader.FileName
|
|
|
+ svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
+ }
|
|
|
vaildCnt++
|
|
|
}
|
|
|
}
|
|
|
@@ -710,11 +579,86 @@ func (this *OilSupplierCertSubController) AddGoodsByFilter() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// @Title 批量添加准入范围--技术服务类
|
|
|
+// @Description 批量添加准入范围
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /tech-cert-lost [post]
|
|
|
+func (this *OilSupplierCertSubController) CheckTechCertLost() {
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ var datamain suppliercertsub.OilSupplierCertSub
|
|
|
+ var dataother suppliercertsub.TechnologySubModel
|
|
|
+ json.Unmarshal(jsonblob, &datamain)
|
|
|
+ json.Unmarshal(jsonblob, &dataother)
|
|
|
+
|
|
|
+ var supplierCertModel suppliercert.OilSupplierCert
|
|
|
+ svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
|
|
|
+
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(datamain.SupplierId, &supplierModel)
|
|
|
+
|
|
|
+ var lostCertList []LostCertFiles
|
|
|
+
|
|
|
+ for n := 0; n < len(dataother.CheckList); n++ {
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
+ needList := filesvc.GetTechNeedFileList(strconv.Itoa(dataother.CheckList[n].Id))
|
|
|
+
|
|
|
+ if supplierCertModel.InStyle == "4" {
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+
|
|
|
+ var fileist []supplierfile.OilSupplierFile
|
|
|
+ where := "SupplierTypeCode in (03,000) and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
+ svcSupplier.GetEntitysByWhere(OilSupplierFileName, where, &fileist)
|
|
|
+
|
|
|
+ var companyHasHeaders string
|
|
|
+ for _, tableheader := range fileist {
|
|
|
+ companyHasHeaders += tableheader.NeedFileType + ","
|
|
|
+ }
|
|
|
+
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+ for i := 0; i < len(needList); i++ {
|
|
|
+ var entity supplierfile.OilSupplierFile
|
|
|
+ entity.SupplierId = dataother.SupplierId
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if !strings.Contains(companyHasHeaders, needList[i].FileName+",") {
|
|
|
+ //缺少的资质
|
|
|
+ var tmpLostCert LostCertFiles
|
|
|
+ tmpLostCert.Code = dataother.CheckList[n].Code
|
|
|
+ tmpLostCert.Name = dataother.CheckList[n].Name
|
|
|
+ tmpLostCert.CertFileName = needList[i].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()
|
|
|
+}
|
|
|
+
|
|
|
// @Title 批量添加准入范围--技术服务类
|
|
|
// @Description 批量添加准入范围
|
|
|
// @Success 200 {object} business.device.DeviceChannels
|
|
|
// @router /addtechbus [post]
|
|
|
func (this *OilSupplierCertSubController) AddTechBus() {
|
|
|
+ //TODO: 没有像AddGoodsByFilter一样,保存时做合法性验证,因为在保存之前已经在前台调用了CheckTechCertLost验证过了,
|
|
|
+ // 以后有时间再加上
|
|
|
var jsonblob = this.Ctx.Input.RequestBody
|
|
|
var datamain suppliercertsub.OilSupplierCertSub
|
|
|
var dataother suppliercertsub.TechnologySubModel
|
|
|
@@ -769,8 +713,8 @@ func (this *OilSupplierCertSubController) AddTechBus() {
|
|
|
//三证合一或五证合一不需要的字段
|
|
|
mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
|
|
|
- //"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
- mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
+ // "营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ // mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
for i := 0; i < len(needList); i++ {
|
|
|
var entity supplierfile.OilSupplierFile
|
|
|
entity.SupplierId = dataother.SupplierId
|
|
|
@@ -782,39 +726,14 @@ func (this *OilSupplierCertSubController) AddTechBus() {
|
|
|
var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
cert2File.SupplierId = dataother.SupplierId
|
|
|
cert2File.SupplierCertId = dataother.SupplierCertId
|
|
|
+ cert2File.SupplierCertSubId = datamain.Id
|
|
|
cert2File.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
cert2File.SubClassId = dataother.CheckList[n].Id
|
|
|
cert2File.Code = dataother.CheckList[n].Code
|
|
|
cert2File.Name = dataother.CheckList[n].Name
|
|
|
cert2File.NeedFileType = needList[i].FileName
|
|
|
svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
- if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
- entity.SupplierTypeCode = "000"
|
|
|
- entity.IsManuf = "0"
|
|
|
- } else {
|
|
|
- entity.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
- }
|
|
|
- entity.NeedFileType = needList[i].FileName
|
|
|
- entity.FileType = 1
|
|
|
- //entity.EffectDate = time.Now()
|
|
|
- entity.CreateBy = this.User.Realname
|
|
|
- entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- entity.SupType = 1
|
|
|
-
|
|
|
- isRepeat := false
|
|
|
- for j := 0; j < len(list); j++ {
|
|
|
- if list[j].NeedFileType == needList[i].FileName {
|
|
|
- isRepeat = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if isRepeat == true {
|
|
|
- continue
|
|
|
- }
|
|
|
-
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -825,8 +744,81 @@ func (this *OilSupplierCertSubController) AddTechBus() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-// @Title 新增准入范围
|
|
|
-// @Description 新增准入范围
|
|
|
+// @Title 检查资质是否完整--基建类
|
|
|
+// @Description 批量添加准入范围
|
|
|
+// @Success 200 {object} lostCertList []LostCertFiles
|
|
|
+// @router /check-basis-lost [post]
|
|
|
+func (this *OilSupplierCertSubController) CheckBasisBusinessLost() {
|
|
|
+ var model suppliercertsub.OilSupplierCertSub
|
|
|
+ var err error
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+
|
|
|
+ var supplierCertModel suppliercert.OilSupplierCert
|
|
|
+ svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ svcCert.GetEntityById(model.SupplierCertId, &supplierCertModel)
|
|
|
+
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ svcSupplier := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ svcSupplier.GetEntityById(model.SupplierId, &supplierModel)
|
|
|
+
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
+ var needList []supplierfile.FileList
|
|
|
+
|
|
|
+ var lostCertList []LostCertFiles
|
|
|
+
|
|
|
+ needList = filesvc.GetBasicNeedFileList(strconv.Itoa(model.SubClassId))
|
|
|
+
|
|
|
+ if supplierCertModel.InStyle == "4" {
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ needFile.FileName = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "CooperationFile")
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+
|
|
|
+ if err == nil {
|
|
|
+ var list []supplierfile.OilSupplierFile
|
|
|
+ where := "SupplierTypeCode in (02,000) and SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
|
|
|
+ svcCert.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
+ var companyHasHeaders string
|
|
|
+ for _, tableheader := range list {
|
|
|
+ companyHasHeaders += tableheader.NeedFileType + ","
|
|
|
+ }
|
|
|
+
|
|
|
+ //三证合一或五证合一不需要的字段
|
|
|
+ mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
+
|
|
|
+ //"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ // mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
+ for i := 0; i < len(needList); i++ {
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if !strings.Contains(companyHasHeaders, needList[i].FileName+",") {
|
|
|
+ //缺少的资质
|
|
|
+ var tmpLostCert LostCertFiles
|
|
|
+ tmpLostCert.Code = model.Code
|
|
|
+ tmpLostCert.Name = model.Name
|
|
|
+ tmpLostCert.CertFileName = needList[i].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()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 新增准入范围 --基建类
|
|
|
+// @Description 新增准入范围 --基建类
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /addbusiness [post]
|
|
|
func (this *OilSupplierCertSubController) AddBusiness() {
|
|
|
@@ -888,49 +880,25 @@ func (this *OilSupplierCertSubController) AddBusiness() {
|
|
|
mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
|
|
|
|
|
|
//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
- mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
+ // mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
|
|
|
|
|
|
for i := 0; i < len(needList); i++ {
|
|
|
+ if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
+ continue
|
|
|
+ }
|
|
|
var entity supplierfile.OilSupplierFile
|
|
|
entity.SupplierId = model.SupplierId
|
|
|
//加入对应表OilSupplierCert2File
|
|
|
var cert2File suppliercertsub.OilSupplierCert2File //创建结构体
|
|
|
cert2File.SupplierId = model.SupplierId
|
|
|
cert2File.SupplierCertId = model.SupplierCertId
|
|
|
+ cert2File.SupplierCertSubId = model.Id
|
|
|
cert2File.SupplierTypeCode = model.SupplierTypeCode
|
|
|
cert2File.SubClassId = model.SubClassId
|
|
|
cert2File.Code = model.Code
|
|
|
cert2File.Name = model.Name
|
|
|
cert2File.NeedFileType = needList[i].FileName
|
|
|
svc.InsertEntityBytbl(OilSupplierCert2FileName, &cert2File)
|
|
|
- if (supplierModel.CredentialFlag == "1" || supplierModel.CredentialFlag == "2") && strings.Contains(mergerCertSkipField, needList[i].FileName+",") { //三证合一或五证合一了
|
|
|
- continue
|
|
|
- }
|
|
|
-
|
|
|
- if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
- entity.SupplierTypeCode = "000"
|
|
|
- entity.IsManuf = "0"
|
|
|
- } else {
|
|
|
- entity.SupplierTypeCode = model.SupplierTypeCode
|
|
|
- }
|
|
|
- entity.NeedFileType = needList[i].FileName
|
|
|
- entity.FileType = 1
|
|
|
- //entity.EffectDate = time.Now()
|
|
|
- entity.CreateBy = this.User.Realname
|
|
|
- entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- entity.SupType = 1
|
|
|
-
|
|
|
- isRepeat := false
|
|
|
- for j := 0; j < len(list); j++ {
|
|
|
- if list[j].NeedFileType == needList[i].FileName {
|
|
|
- isRepeat = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if isRepeat == true {
|
|
|
- continue
|
|
|
- }
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -957,9 +925,6 @@ func (this *OilSupplierCertSubController) AddBusiness() {
|
|
|
func (this *OilSupplierCertSubController) BusinessDelete() {
|
|
|
Id := this.Ctx.Input.Param(":Id")
|
|
|
//SupplierCertId := this.GetString("SupplierCertId")
|
|
|
- SupplierId := this.GetString("SupplierId")
|
|
|
- SupplierTypeCode := this.GetString("SupplierTypeCode")
|
|
|
- var IsManufacturer string
|
|
|
var errinfo ErrorInfo
|
|
|
if Id == "" {
|
|
|
errinfo.Message = "操作失败!请求信息不完整"
|
|
|
@@ -968,141 +933,18 @@ func (this *OilSupplierCertSubController) BusinessDelete() {
|
|
|
this.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- Ids := strings.Split(Id, ",")
|
|
|
|
|
|
//根据Id查出OilSupplierCertSub的SubClassId
|
|
|
svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE) //获得数据库引擎
|
|
|
- filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
-
|
|
|
- //
|
|
|
- var CertSublList []suppliercertsub.OilSupplierCertSub
|
|
|
- where := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode // 没有删除的准入范围
|
|
|
- svc.GetEntities(&CertSublList, where)
|
|
|
- SubClassIds := ""
|
|
|
- for _, CertSub := range CertSublList {
|
|
|
-
|
|
|
- SubClassIds += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
- }
|
|
|
- var SurplusList []supplierfile.FileList
|
|
|
- SubClassIds = strings.Trim(SubClassIds, ",")
|
|
|
- if SubClassIds != "" {
|
|
|
- if SupplierTypeCode == "01" {
|
|
|
- //SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds, IsManufacturer)
|
|
|
- } else if SupplierTypeCode == "02" {
|
|
|
- SurplusList = filesvc.GetBasicNeedFileList(SubClassIds)
|
|
|
- } else if SupplierTypeCode == "03" {
|
|
|
- SurplusList = filesvc.GetTechNeedFileList(SubClassIds)
|
|
|
- }
|
|
|
- }
|
|
|
- fileNames := ""
|
|
|
- for _, CertSub := range SurplusList {
|
|
|
- fileNames += CertSub.FileName + ","
|
|
|
- }
|
|
|
-
|
|
|
- for i := 0; i < len(Ids); i++ {
|
|
|
- IsManufacturer = filesvc.CheckIsManuf(Ids[i])
|
|
|
- if SubClassIds != "" {
|
|
|
- if SupplierTypeCode == "01" {
|
|
|
- var CertSublList2 []suppliercertsub.OilSupplierCertSub
|
|
|
- wheregood := "SupplierId=" + SupplierId + " and Id not in (" + Id + ") and SupplierTypeCode =" + SupplierTypeCode + " and IsManufacturer =" + IsManufacturer // 没有删除的准入范围
|
|
|
- svc.GetEntities(&CertSublList2, wheregood)
|
|
|
- SubClassIds2 := ""
|
|
|
- for _, CertSub := range CertSublList2 {
|
|
|
- SubClassIds2 += strconv.Itoa(CertSub.SubClassId) + ","
|
|
|
- }
|
|
|
- SubClassIds2 = strings.Trim(SubClassIds2, ",")
|
|
|
- SurplusList = filesvc.GetGoodsNeedFileList(SubClassIds2, IsManufacturer)
|
|
|
- }
|
|
|
- }
|
|
|
- if fileNames == "" {
|
|
|
- for _, CertSub := range SurplusList {
|
|
|
- fileNames += CertSub.FileName + ","
|
|
|
- }
|
|
|
- }
|
|
|
- var datamain suppliercertsub.OilSupplierCertSub //创建OilSupplierCertSub结构体(映射用)
|
|
|
- var datamain2 []suppliercertsub.OilSupplierCertSub //空的查询用
|
|
|
-
|
|
|
- where := " Id= " + Ids[i]
|
|
|
- svc.GetEntity(&datamain, where) //根据Id查找,映射结构体
|
|
|
-
|
|
|
- //再根据企业id查找这个企业有几个准入范围(如果只有一个准入范围了,基本资质也删除)
|
|
|
-
|
|
|
- supplierId := datamain.SupplierId
|
|
|
- where = "SupplierId=" + strconv.Itoa(supplierId)
|
|
|
- svc.GetEntities(&datamain2, where)
|
|
|
- flag := 0
|
|
|
- if len(datamain2) == 1 {
|
|
|
- flag = 1
|
|
|
- }
|
|
|
- subClassId := datamain.SubClassId //4.拿到结构体中的准入范围SubClassId
|
|
|
- //根据SubClassId查出此准入范围所拥有的资质名称
|
|
|
- var needList []supplierfile.FileList //定义存储所拥有资质名称的数组
|
|
|
- if datamain.SupplierTypeCode == "01" {
|
|
|
- needList = filesvc.GetGoodsNeedFileList(strconv.Itoa(subClassId), IsManufacturer) //通过准入范围Id获得资质名称并填充数组
|
|
|
- } else if datamain.SupplierTypeCode == "02" {
|
|
|
- needList = filesvc.GetBasicNeedFileList(strconv.Itoa(subClassId))
|
|
|
- } else {
|
|
|
- needList = filesvc.GetTechNeedFileList(strconv.Itoa(subClassId))
|
|
|
- }
|
|
|
+ where := "delete from " + OilSupplierCertSubName + " where Id in (" + Id + ")" // 没有删除的准入范围
|
|
|
+ whereCert2File := "delete from " + OilSupplierCert2FileName + " where SupplierCertSubId in (" + Id + ")" // 没有删除的准入范围
|
|
|
+ svc.DBE.Exec(where)
|
|
|
+ svc.DBE.Exec(whereCert2File)
|
|
|
|
|
|
- var mustField string
|
|
|
- mustField = paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName") //必需的资质
|
|
|
-
|
|
|
- //根据企业ID(SupplierId)和此准入范围所拥有的资质名称删除OilSupplierFile表中对应的资质
|
|
|
- for j := 0; j < len(needList); j++ { //循环遍历资质名称数组,逐条删除
|
|
|
-
|
|
|
- if flag == 0 && strings.Contains(mustField, needList[j].FileName+",") {
|
|
|
- continue
|
|
|
- }
|
|
|
- if flag == 0 && strings.Contains(fileNames, needList[j].FileName+",") {
|
|
|
- continue
|
|
|
- }
|
|
|
- if datamain.SupplierTypeCode == "01" {
|
|
|
- where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and IsManuf='" + IsManufacturer + "' and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
- } else {
|
|
|
- where = " SupplierId= '" + strconv.Itoa(datamain.SupplierId) + "' and SupplierTypeCode =" + SupplierTypeCode + " and NeedFileType='" + needList[j].FileName + "'" //拼接删除sql
|
|
|
- }
|
|
|
- err := svc.DeleteEntityBytbl(OilSupplierFileName, where) //删除第j条资质数据
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = "删除成功"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
- }
|
|
|
- where = " SupplierId=" + strconv.Itoa(datamain.SupplierId) + " and SupplierTypeCode =" + SupplierTypeCode + " and SubClassId=" + strconv.Itoa(subClassId)
|
|
|
- err1 := svc.DeleteEntityBytbl(OilSupplierCert2FileName, where)
|
|
|
- if err1 == nil {
|
|
|
- errinfo.Message = "删除成功"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "删除失败!" + utils.AlertProcess(err1.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
- where = " Id= " + Ids[i] + " and SupplierTypeCode =" + SupplierTypeCode
|
|
|
- err2 := svc.DeleteEntityBytbl(OilSupplierCertSubName, where) //删除OilSupplierCertSub单条准入范围
|
|
|
- if err2 == nil {
|
|
|
- errinfo.Message = "删除成功"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "删除失败!" + utils.AlertProcess(err2.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
- }
|
|
|
+ errinfo.Message = "删除成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
// @Title 获取待审核业务列表
|