package weaver.interfaces.htsc.workflow.action;

import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

/**
 * 总部通用报销Action 更新建模表
 uf_zbygyhxx 总部员工银行卡信息
 */
public class HeadReimbursementAction extends BaseBean implements Action {

    BaseBean bb = new BaseBean();


    @Override
    public String execute(RequestInfo requestInfo) {
        RecordSetTrans rst = new RecordSetTrans();
        String requestid = requestInfo.getRequestid();
        try{
            RecordSet rs = new RecordSet();
            rst.setAutoCommit(false);
            //1.获取明细表11银行卡信息
            rs.executeQuery("select d.ygxm,d.yxzh,d.khxmc  from formtable_main_247 t,formtable_main_247_dt11 d " +
                    " where t.id = d.mainid and t.requestid = ?",requestid);
            //2.更新
            while (rs.next()){
                Integer ygxm = Util.getIntValue("ygxm");
                String yxzh = Util.null2String(rs.getString("yxzh"));
                String khxmc = Util.null2String(rs.getString("khxmc"));
                rst.executeUpdate("update uf_zbygyhxx set yxzh = ?,khxmc = ? " +
                        " where ygxm = ?",yxzh,khxmc,ygxm);
            }
            rst.commit();
            bb.infoLog("总部员工银行卡信息节点后更新成功",requestInfo);

        }catch (Exception e){
            rst.rollback();
            bb.errorLog("总部员工银行卡信息节点后更新失败",e);
            e.printStackTrace();
        }
        return null;
    }
}
