|
|
@@ -342,37 +342,33 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
|
|
|
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)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|