2
3
Эх сурвалжийг харах

信息变更恢复准入要先删除deleted=1的

wd 4 жил өмнө
parent
commit
65d499b66e

+ 10 - 8
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -1934,8 +1934,6 @@ func (this *InfoChangeController) CommonAuditEntity() {
 		}
 
 		this.updateChangeInfo(infoChangeEntityAfterUpdate.SupplierId, infoId)
-		where := "SupplierId = " + strconv.Itoa(infoChangeEntityAfterUpdate.SupplierId) + " and IsDelete = 1"
-		svc.DeleteEntityBytbl(OilSupplierFileName, where)
 	}
 }
 
@@ -2223,17 +2221,21 @@ func (this *InfoChangeController) updateChangeInfo(supplierId int, infoId string
 			svc.UpdateEntityBytbl(OilSupplierFileName, qualDetail[i].FileId, &supFileModel, []string{"FileName", "FileUrl", "EffectDate", "SupType"})
 		}
 	}
+
+	// 删除要删除的资质
+	svc.DeleteEntityBytbl(OilSupplierFileName, "SupplierId = " + utils.ToStr(supplierId) + " and IsDelete = 1")
+
 	// 资质文件有效期延长and年审不过期,暂停状态改为准入
-	var file supplierfile.OilSupplierFile
-	svc.GetEntityByWhere(OilSupplierFileName, "SupplierTypeCode = '000' and SupplierId = "+strconv.Itoa(supplierId)+" and EffectDate <= '"+time.Now().Format("2006-01-02")+"'", &file)
-	if file.Id == 0 {
+	var file[] supplierfile.OilSupplierFile
+	svc.GetEntitysByWhere(OilSupplierFileName, "SupplierTypeCode = '000' and SupplierId = "+strconv.Itoa(supplierId)+" and EffectDate <= '"+time.Now().Format("2006-01-02")+"'", &file)
+	if len(file) == 0 {
 		var certList []suppliercert.OilSupplierCert
 		svc.GetEntitysByWhere(OilSupplierCertName, "SupplierId = "+strconv.Itoa(supplierId), &certList)
 		for _, cert := range certList {
-			var file1 supplierfile.OilSupplierFile
+			var file1[] supplierfile.OilSupplierFile
 			var certInfo suppliercert.OilSupplierCert
-			svc.GetEntityByWhere(OilSupplierFileName, "SupplierTypeCode = '"+cert.SupplierTypeCode+"' and SupplierId = "+strconv.Itoa(supplierId)+" and EffectDate <= '"+time.Now().Format("2006-01-02")+"'", &file1)
-			if file1.Id == 0 {
+			svc.GetEntitysByWhere(OilSupplierFileName, "SupplierTypeCode = '"+cert.SupplierTypeCode+"' and SupplierId = "+strconv.Itoa(supplierId)+" and EffectDate <= '"+time.Now().Format("2006-01-02")+"'", &file1)
+			if len(file1) == 0 {
 				if cert.InFlag == "2" && cert.ApplyTime.After(time.Now()) {
 					certInfo.InFlag = "1"
 					svc.UpdateEntityByIdCols(cert.Id, &certInfo, []string{"InFlag"})