package weaver.interfaces.htxc.cgglpt;

import com.engine.htxc.tycgrwd.judgeTheProcessInTransit.JudgeTheProcessInTransit;
import weaver.conn.RecordSet;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class CheckComplete implements JudgeTheProcessInTransit {
    @Override
    public boolean isComplete(String table, String xmid) {
        return false;
    }

    @Override
    public boolean isComplete(String requestid) {
        try{
            RecordSet rs = new RecordSet();
            ArrayList<String> list = new ArrayList<String>();
            String stopSql = "select a.isremark,a.iscomplete ,b.isstopped from workflow_currentoperator   a right join workflow_requestbase b " +
                    "on a.requestid = b.requestid  where  a.requestid = "+requestid;
            rs.execute(stopSql);
            while(rs.next()){
                String iscomplete = rs.getString("iscomplete");
                list.add(iscomplete);
            }
            List<String> collect = list.stream().filter((item) -> {
                return Integer.parseInt(item) > 0;
            }).collect(Collectors.toList());
            if(collect.size()>0){
                return true;
            }else {
                return false;
            }
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }

    }
}
