package weaver.interfaces.htsc.cus;

import com.engine.htsc.trip.util.LogUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;

/**
 * author: k1810012
 * description: 报销拟稿节点后
 * 保存生成的流程编号至workflow_requestbase表中requestmark字段
 */
public class ReimUpdateRequestMarkAction extends BaseBean implements Action {

	@Override
	public String execute(RequestInfo requestInfo) {
		RecordSet rs = new RecordSet();
		RequestManager requestManager = requestInfo.getRequestManager();
		String requestId = Util.null2String(requestInfo.getRequestid());
		String mainTable = Util.null2String(requestManager.getBillTableName());
		try {
			rs.executeQuery("select lcbh from " + mainTable + " where requestid=" + requestId);
			String requestMark = "";
			if (rs.next()) {
				requestMark = rs.getString("lcbh");
			}
			rs.executeUpdate("update workflow_requestbase set requestmark='" + requestMark + "' where requestid=" + requestId);
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			requestManager.setMessagecontent("缺失有效参数,请检查CcsqFinishNodeAction接口");
			requestManager.setMessageid("500");
			return FAILURE_AND_CONTINUE;
		}
	}
}
