|
|
@@ -309,20 +309,15 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
|
|
|
var jsonblob = this.Ctx.Input.RequestBody
|
|
|
var datamain suppliercertsub.OilSupplierCertSub
|
|
|
var dataother suppliercertsub.SupplierCertSubModel
|
|
|
- var supplierCertModel suppliercert.OilSupplierCert
|
|
|
+
|
|
|
json.Unmarshal(jsonblob, &datamain)
|
|
|
json.Unmarshal(jsonblob, &dataother)
|
|
|
+
|
|
|
+ var supplierCertModel suppliercert.OilSupplierCert
|
|
|
svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
|
|
|
|
|
|
- var errinfo ErrorDataInfo
|
|
|
- for n := 0; ; n++ {
|
|
|
- if n == len(dataother.CheckList) {
|
|
|
- errinfo.Message = "操作成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
+ 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 + "'"
|
|
|
@@ -380,6 +375,12 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ errinfo.Message = "操作成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
// @Title 批量添加准入范围--技术服务类
|
|
|
@@ -393,14 +394,11 @@ func (this *OilSupplierCertSubController) AddTechBus() {
|
|
|
json.Unmarshal(jsonblob, &datamain)
|
|
|
json.Unmarshal(jsonblob, &dataother)
|
|
|
|
|
|
- var errinfo ErrorDataInfo
|
|
|
- for n := 0; ; n++ {
|
|
|
- if n == len(dataother.CheckList) {
|
|
|
- errinfo.Message = "操作成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
+ var supplierCertModel suppliercert.OilSupplierCert
|
|
|
+ svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ svcCert.GetEntityById(datamain.SupplierCertId, &supplierCertModel)
|
|
|
+
|
|
|
+ for n := 0; n < len(dataother.CheckList); n++ {
|
|
|
where_sub := "SupplierTypeCode = 03 and SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
where_sub += " and SupplierCertId = '" + strconv.Itoa(dataother.SupplierCertId) + "'"
|
|
|
where_sub += " and SubClassId = '" + strconv.Itoa(dataother.CheckList[n].Id) + "'"
|
|
|
@@ -421,42 +419,50 @@ func (this *OilSupplierCertSubController) AddTechBus() {
|
|
|
filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
needList := filesvc.GetTechNeedFileList(dataother.CheckList[n].Id)
|
|
|
|
|
|
+ if supplierCertModel.InStyle == "4" {
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ needFile.FileName = "战略合作协议扫描件"
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+
|
|
|
var list []supplierfile.OilSupplierFile
|
|
|
where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
|
|
|
svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
- if len(list) == 0 { //第一次添加准入项,将共有必备资质写入文件表
|
|
|
- for i := 0; i < len(needList); i++ {
|
|
|
- var entity supplierfile.OilSupplierFile
|
|
|
- entity.SupplierId = dataother.SupplierId
|
|
|
- if i < 4 {
|
|
|
- entity.SupplierTypeCode = "000"
|
|
|
- } 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()
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
+ hasField := ""
|
|
|
+ for i := 0; i < len(list); i++ {
|
|
|
+ hasField += list[i].NeedFileType + ","
|
|
|
+ }
|
|
|
+ mustField := "营业执照,组织代码,税务登记,开户许可,银行开户许可证,承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ for i := 0; i < len(needList); i++ {
|
|
|
+ var entity supplierfile.OilSupplierFile
|
|
|
+ entity.SupplierId = dataother.SupplierId
|
|
|
+
|
|
|
+ if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
+ entity.SupplierTypeCode = "000"
|
|
|
+ } else {
|
|
|
+ entity.SupplierTypeCode = dataother.SupplierTypeCode
|
|
|
}
|
|
|
- } else {
|
|
|
- if len(needList) > 4 {
|
|
|
- for i := 4; i < len(needList); i++ {
|
|
|
- var entity supplierfile.OilSupplierFile
|
|
|
- entity.SupplierId = dataother.SupplierId
|
|
|
- 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()
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
- }
|
|
|
+ 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()
|
|
|
+
|
|
|
+ if strings.Contains(hasField, needList[i].FileName+",") {
|
|
|
+ //已存在,不能重复添加
|
|
|
+ continue
|
|
|
}
|
|
|
+ svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ errinfo.Message = "操作成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
// @Title 新增准入范围
|
|
|
@@ -472,6 +478,10 @@ func (this *OilSupplierCertSubController) AddBusiness() {
|
|
|
svc := suppliercertsub.GetOilSupplierCertSubService(utils.DBE)
|
|
|
_, err := svc.InsertEntityBytbl(OilSupplierCertSubName, &model)
|
|
|
|
|
|
+ var supplierCertModel suppliercert.OilSupplierCert
|
|
|
+ svcCert := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ svcCert.GetEntityById(model.SupplierCertId, &supplierCertModel)
|
|
|
+
|
|
|
filesvc := supplierfile.GetSupplierfileService(utils.DBE)
|
|
|
var needList []supplierfile.FileList
|
|
|
if model.SupplierTypeCode == "01" {
|
|
|
@@ -482,42 +492,44 @@ func (this *OilSupplierCertSubController) AddBusiness() {
|
|
|
// needList = filesvc.GetTechNeedFileList(model.SubClassId)
|
|
|
}
|
|
|
|
|
|
+ if supplierCertModel.InStyle == "4" {
|
|
|
+ var needFile supplierfile.FileList
|
|
|
+ needFile.FileName = "战略合作协议扫描件"
|
|
|
+ needList = append(needList, needFile)
|
|
|
+ }
|
|
|
+
|
|
|
if err == nil {
|
|
|
var list []supplierfile.OilSupplierFile
|
|
|
where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
|
|
|
svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
|
|
|
|
|
|
- if len(list) == 0 { //第一次添加准入项,将共有必备资质写入文件表
|
|
|
- for i := 0; i < len(needList); i++ {
|
|
|
- var entity supplierfile.OilSupplierFile
|
|
|
- entity.SupplierId = model.SupplierId
|
|
|
- if i < 4 {
|
|
|
- entity.SupplierTypeCode = "000"
|
|
|
- } 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()
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
+ hasField := ""
|
|
|
+ for i := 0; i < len(list); i++ {
|
|
|
+ hasField += list[i].NeedFileType + ","
|
|
|
+ }
|
|
|
+ mustField := "营业执照,组织代码,税务登记,开户许可,银行开户许可证,承诺书,企业信息系统截图,战略合作协议扫描件,"
|
|
|
+ for i := 0; i < len(needList); i++ {
|
|
|
+ var entity supplierfile.OilSupplierFile
|
|
|
+ entity.SupplierId = model.SupplierId
|
|
|
+
|
|
|
+ if strings.Contains(mustField, needList[i].FileName+",") {
|
|
|
+ entity.SupplierTypeCode = "000"
|
|
|
+ } else {
|
|
|
+ entity.SupplierTypeCode = model.SupplierTypeCode
|
|
|
}
|
|
|
- } else {
|
|
|
- if len(needList) > 4 {
|
|
|
- for i := 4; i < len(needList); i++ {
|
|
|
- var entity supplierfile.OilSupplierFile
|
|
|
- entity.SupplierId = model.SupplierId
|
|
|
- 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()
|
|
|
- svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
- }
|
|
|
+ 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()
|
|
|
+
|
|
|
+ if strings.Contains(hasField, needList[i].FileName+",") {
|
|
|
+ //已存在,不能重复添加
|
|
|
+ continue
|
|
|
}
|
|
|
+ svc.InsertEntityBytbl(OilSupplierFileName, &entity)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
var errinfo ErrorDataInfo
|
|
|
if err == nil {
|