删除流程台账数据

删除流程台账数据

workflow.data.clear.by.inst_id

流程数据涉及到多个表,清理不能直接使用框架remove方法,需要使用流程这边接口处理

   def execute(self, param):
        """
        正式执行方法
        """
        list_ = CustomerUtil.call_open_api('hcm.model.list', {
              # 模型名称
              "model": "WorkFlowInstance",
              #  查询字符串, 可进行模糊搜索
              "filter_str": "过滤内容",
              # 指定字段过滤规则
              "filter_dict": {
                "create_time": {
                  "lt": "2021-11-22"
                },
                # 流程id
                "business_id":8704
              },
              "page_index": 1,
              "page_size": 47,
              "extra_property": {
                # 流程台账的场景
                "state": "sys-manager",
                "sorts": [
                  {
                    "key": "create_time",
                    "type": "desc"
                  }
                ]
              }
            })['list']
        ids_ = [item_.get('id') for item_ in list_]
        CustomerUtil.call_open_api('workflow.data.clear.by.inst_id', {
            "inst_ids":ids_,
            "is_clear":True
        })
        return "删除成功!"


    def test(self, **param):
        """
        测试执行方法
        """
        self.execute(param)