浏览代码

后:信息变更后文件有效期延长,改成准入

dubch 4 年之前
父节点
当前提交
492d41059c
共有 1 个文件被更改,包括 19 次插入1 次删除
  1. 19 1
      src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

+ 19 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -2174,7 +2174,7 @@ func (this *InfoChangeController) updateChangeInfo(supplierId int, infoId string
 		}
 	}
 
-	this.FileDelete(strconv.Itoa(supplierId))
+	//this.FileDelete(strconv.Itoa(supplierId))
 	t := time.Now()
 	s := time.Since(t)
 	log.Println(s, "============================")
@@ -2193,4 +2193,22 @@ func (this *InfoChangeController) updateChangeInfo(supplierId int, infoId string
 			svc.UpdateEntityBytbl(OilSupplierFileName, qualDetail[i].FileId, &supFileModel, []string{"FileName", "FileUrl", "EffectDate", "SupType"})
 		}
 	}
+	// 资质文件有效期延长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 certList []suppliercert.OilSupplierCert
+		svc.GetEntitysByWhere(OilSupplierCertName, "SupplierId = " + strconv.Itoa(supplierId), &certList)
+		for _, cert := range certList {
+			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 {
+				if cert.InFlag == "2" && cert.ApplyTime.After(time.Now()){
+					certInfo.InFlag = "1"
+					svc.UpdateEntityByIdCols(cert.Id, &certInfo, []string{"InFlag"})
+				}
+			}
+		}
+	}
 }