package weaver.interfaces.htsc.cgrwd;

import com.weaver.general.BaseBean;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * @Title: ecology-9-demo
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2020-09-24
 * @Description: 申请节点提交后删除明细表数据
 * @ModifyLog:
 *
 * 总部重要事项 拟稿节点提交执行
 **/

public class cgrwdThFjAction extends BaseBean implements Action {

    @Override
    public String execute(RequestInfo requestInfo) {
        RecordSet rs = new RecordSet();
        BaseBean bb = new BaseBean();
        String requestid = requestInfo.getRequestid();
        bb.writeLog( "----cgrwdThFjAction-------" + requestid );
        String tablename = requestInfo.getRequestManager().getBillTableName();//主表

        try {
            String sql = " update " + tablename + " set zdfj = null where requestid='" + requestid + "'";
            bb.writeLog( "----sql-------" + sql );
            boolean flag = rs.executeUpdate( sql );
            bb.writeLog( "----flag-------" + flag );
            if(!flag){
                requestInfo.getRequestManager().setMessageid( "111111" );
                requestInfo.getRequestManager().setMessagecontent( "更新附件信息失败" );
                return Action.FAILURE_AND_CONTINUE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            writeLog( "异常参考:" + e );
            requestInfo.getRequestManager().setMessageid( "111111" );
            requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
            return Action.FAILURE_AND_CONTINUE;
        }

        return  Action.SUCCESS;
    }
}
