package weaver.interfaces.htsc.gwAction;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

public class UpdateLcbt extends BaseBean implements Action {
    @Override
    public String execute(RequestInfo requesInfo) {
        JAVATools.SetCmdwritelog("公文requestName更新lcbt开始");
        String tablename = requesInfo.getRequestManager().getBillTableName();
        JAVATools.SetCmdwritelog("tablename公文数据库名=" + tablename);
//        String tablename = "formtable_main_188";
        String requestid = requesInfo.getRequestid();
        JAVATools.SetCmdwritelog("requestid公文请求=" + requestid);
//        String requestid = "4494529";
        String requestname = requesInfo.getRequestManager().getRequestname();//请求标题
        JAVATools.SetCmdwritelog("requestname公文请求名称" + requestname);
//        String requestname = "666";
        String sql = "select * from  " + tablename + " where requestid = " +requestid;
        JAVATools.SetCmdwritelog("公文查询sql" + sql);
        RecordSet rs = new RecordSet();

        rs.execute(sql);
        RecordSet uprs = new RecordSet();
        while(rs.next()){
            String id = rs.getString("id");
            String updateSql = " update  " +  tablename +  " set lcbt = '" + requestname +"' where  id = " + id;
            JAVATools.SetCmdwritelog("公文更新updateSql" + updateSql);

            uprs.execute(updateSql);
        }
        JAVATools.SetCmdwritelog("公文requestName更新lcbt结束");
        return Action.SUCCESS;
    }

}
