yuedefeng 6 years ago
parent
commit
be1313df41
1 changed files with 40 additions and 9 deletions
  1. 40 9
      src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

+ 40 - 9
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertsub.go

@@ -354,10 +354,10 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 			var list []supplierfile.OilSupplierFile
 			where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
-			hasField := ""
+			/*hasField := ""
 			for i := 0; i < len(list); i++ {
 				hasField += list[i].NeedFileType + ","
-			}
+			}*/
 			//三证合一或五证合一不需要的字段
 			mergerCertSkipField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MergerCertSkipFieldName")
 			//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
@@ -381,10 +381,21 @@ func (this *OilSupplierCertSubController) AddGoodsBus() {
 				entity.CreateBy = this.User.Realname
 				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 				entity.SupType = 1
-				if strings.Contains(hasField, needList[i].FileName+",") {
+				/*if strings.Contains(hasField, needList[i].FileName+",") {
 					//已存在,不能重复添加
 					continue
+				}*/
+				isRepeat := false
+				for idx := 0; idx < len(list); idx++ {
+					if list[idx].NeedFileType == needList[i].FileName {
+						isRepeat = true
+						break
+					}
+				}
+				if isRepeat == true {
+					continue
 				}
+
 				svc.InsertEntityBytbl(OilSupplierFileName, &entity)
 			}
 
@@ -444,10 +455,10 @@ func (this *OilSupplierCertSubController) AddTechBus() {
 			var list []supplierfile.OilSupplierFile
 			where := "SupplierId = '" + strconv.Itoa(dataother.SupplierId) + "'"
 			svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
-			hasField := ""
+			/*hasField := ""
 			for i := 0; i < len(list); i++ {
 				hasField += list[i].NeedFileType + ","
-			}
+			}*/
 			//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
 			mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
 			for i := 0; i < len(needList); i++ {
@@ -465,9 +476,19 @@ func (this *OilSupplierCertSubController) AddTechBus() {
 				entity.CreateBy = this.User.Realname
 				entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 				entity.SupType = 1
-				if strings.Contains(hasField, needList[i].FileName+",") {
+				/*if strings.Contains(hasField, needList[i].FileName+",") {
 					//已存在,不能重复添加
 					continue
+				}*/
+				isRepeat := false
+				for idx := 0; idx < len(list); idx++ {
+					if list[idx].NeedFileType == needList[i].FileName {
+						isRepeat = true
+						break
+					}
+				}
+				if isRepeat == true {
+					continue
 				}
 				svc.InsertEntityBytbl(OilSupplierFileName, &entity)
 			}
@@ -532,10 +553,10 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 		where := "SupplierId = '" + strconv.Itoa(model.SupplierId) + "'"
 		svc.GetEntitysByWhere(OilSupplierFileName, where, &list)
 
-		hasField := ""
+		/*hasField := ""
 		for i := 0; i < len(list); i++ {
 			hasField += list[i].NeedFileType + ","
-		}
+		}*/
 		//"营业执照,组织代码,组织机构代码证,税务登记证,税务登记,开户许可,银行开户许可证,承诺书,诚信合规承诺书,企业信息系统截图,战略合作协议扫描件,"
 		mustField := paramSvc.GetBaseparameterMessage("GFGL", "paramset", "MustFieldName")
 		for i := 0; i < len(needList); i++ {
@@ -553,9 +574,19 @@ func (this *OilSupplierCertSubController) AddBusiness() {
 			entity.CreateBy = this.User.Realname
 			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 			entity.SupType = 1
-			if strings.Contains(hasField, needList[i].FileName+",") {
+			/*if strings.Contains(hasField, needList[i].FileName+",") {
 				//已存在,不能重复添加
 				continue
+			}*/
+			isRepeat := false
+			for idx := 0; idx < len(list); idx++ {
+				if list[idx].NeedFileType == needList[i].FileName {
+					isRepeat = true
+					break
+				}
+			}
+			if isRepeat == true {
+				continue
 			}
 			svc.InsertEntityBytbl(OilSupplierFileName, &entity)
 		}