package weaver.interfaces.htsc.aqrwfblc;

import com.alibaba.fastjson.JSON;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;

import java.util.HashMap;
import java.util.Map;

public class ChangeSFFK extends AbstractModeExpandJavaCodeNew {
    @Override
    public Map<String, String> doModeExpand(Map<String, Object> param) {
        BaseBean bb = new BaseBean();
        bb.writeLog("param中的数据是：");
        bb.writeLog(JSON.toJSONString(param));
        Map<String, String> result = new HashMap<String, String>();
        try {
            User user = (User)param.get("user");
            int billid = -1;//数据id
            int modeid = -1;//模块id
            RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
            if(requestInfo!=null){
                billid = Util.getIntValue(requestInfo.getRequestid());
                modeid = Util.getIntValue(requestInfo.getWorkflowid());
                if(billid>0&&modeid>0){
                    //------请在下面编写业务逻辑代码------
                    String aqscglbm = Util.null2String(param.get("field162493"));
                    RecordSet rs = new RecordSet();
                    String sql = "update uf_aqscglbm set sffk = '1',TBHLJ = '"+billid+"' where id = '"+aqscglbm+"'";
                    bb.writeLog("更新SFFK的SQL："+sql);
                    if (!rs.executeUpdate(sql)){
                        result.put("errmsg","自定义出错信息");
                        result.put("flag", "false");
                    }
                }
            }
        } catch (Exception e) {
            result.put("errmsg","自定义出错信息");
            result.put("flag", "false");
        }
        return result;
    }
}
