package weaver.interfaces.secondev.zjpicc;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 生成逻辑运算出对应的权限调整清单
 */
public class CreateWFAction extends BaseBean implements Action {
    Log log = LogFactory.getLog(CreateWFAction.class);

    /**
     *
     * @param requestInfo
     * @return
     */
    @Override
    public String execute(RequestInfo requestInfo) {
        String requestid = Util.null2String(requestInfo.getRequestid());

        Map mainTableDataMap = new HashMap();
        Property[] props = requestInfo.getMainTableInfo().getProperty();
        for (int i = 0; i < props.length; i++) {
            String fieldname = props[i].getName().toLowerCase();
            String fieldval = Util.null2String(props[i].getValue());
            mainTableDataMap.put(fieldname, fieldval);
        }

        RecordSet rs = new RecordSet();
        String hrcode = Util.null2String((String) mainTableDataMap.get("hrcode"));
        String ylcid = Util.null2String((String) mainTableDataMap.get("ylcid"));
        rs.execute("update uf_qxtzqd set CFBJW='触发' where YLCID="+ylcid + " AND hrcode="+hrcode+" and (CFBJW='' or CFBJW is null) ");
        writeLog("update uf_qxtzqd set CFBJW='触发' where YLCID="+ylcid + " AND hrcode="+hrcode+" and (CFBJW='' or CFBJW is null) ");



        return Action.SUCCESS;
    }


}
