校验唯一任务添加时间
优化续约代办请求次数
This commit is contained in:
+6
-9
@@ -583,22 +583,19 @@ class YDToJDYRenewalToDo(object):
|
||||
print(f"读取历史文件失败: {e}")
|
||||
df_last = pd.DataFrame()
|
||||
else:
|
||||
df_last = pd.DataFrame()
|
||||
df_last = None # 明确标记:无历史文件
|
||||
|
||||
# 假设唯一标识字段为 'instanceId',请根据实际字段名调整
|
||||
id_col = 'processInstanceId'
|
||||
if not df_last.empty and not df_current.empty and id_col in df_current.columns and id_col in df_last.columns:
|
||||
# 转为字符串确保可比
|
||||
|
||||
if df_last is not None and not df_last.empty and not df_current.empty and id_col in df_current.columns and id_col in df_last.columns:
|
||||
# 有历史文件,计算新增
|
||||
last_ids = set(df_last[id_col].astype(str))
|
||||
current_ids = set(df_current[id_col].astype(str))
|
||||
new_ids = current_ids - last_ids
|
||||
diff_records = df_current[df_current[id_col].astype(str).isin(new_ids)].to_dict('records')
|
||||
else:
|
||||
# 没有历史文件 或 无唯一ID → 返回空 list(按你要求)
|
||||
diff_records = []
|
||||
|
||||
# 保存当前全量数据(覆盖)
|
||||
df_current.to_csv(current_file, index=False)
|
||||
# 没有历史文件 或 无法比对 → 返回全部当前数据
|
||||
diff_records = df_current.to_dict('records') # ← 关键修改点
|
||||
|
||||
return diff_records
|
||||
|
||||
|
||||
Reference in New Issue
Block a user