⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htdltjrwmbean.java

📁 以前做的一个j2ee的项目
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
package gov.gdlt.ssgly.taxweb.mbean.htdl;

import java.util.*;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;

import gov.gdlt.ssgly.taxcore.comm.bizdelegate.SsglyDelegate;
import gov.gdlt.ssgly.taxcore.comm.bizinterface.ISsglyService;
import gov.gdlt.ssgly.taxcore.comm.event.ResponseEvent;
import gov.gdlt.ssgly.taxcore.comm.log.LogWritter;
import gov.gdlt.ssgly.taxcore.taxevent.htdl.*;
import gov.gdlt.ssgly.taxweb.comm.util.WebUtil;
import gov.gdlt.ssgly.taxweb.tag.PagedBaseBean;


/**
 *
 * <p>Title: 封装调度任务维护界面所使用的数据</p>
 *
 * <p>Description: 广东地税税收管理员工作平台</p>
 *
 * <p>Copyright: Copyright (c) 2005 广东省地方税务局,广州市地方税务局</p>
 *
 * <p>Company: 广州地税</p>
 *
 * @author 肖雪莲
 * @version 1.0
 */
public class HTDLtjrwMBean extends PagedBaseBean {
    public final static String EMPTY_STRING = "";
    private static final int PAGE_SIZE = 13;

    private String rw_mc; //用户输入的任务名称
    private String blh_mc; //用户选择的blh功能
    private ArrayList blhList = null; //可供选择的执行功能列表,来自数据库
    private String zxpl; //用户选择的执行频率
    private String zl_lx; //用户选择的增量类型  前("0")or后("1")
    private int zlsj; //用户选择的增量时间
    private String fz; //用户输入的所属分组
    private int zxyxj; //用户选择的执行优先级
    private String csl; //用户输入的参数序列

    private ArrayList ybsrwVOList = null; //用于页面上显示的已部署任务列表
    private int formatZlsj; //处理后的增量时间

    private String addTips;
    private String updateTips;
    private String delTips;

    private String searchBLH; //用户选择的要查询的blh名称
    private String keyWords;
    private ArrayList searchBLHList; //供用户查询时选择的blh列表

    private ArrayList remarkList; //每个功能所需要的参数说明

    private String selectedRw;   //修改任务时选择的任务
    //for parameter input tips

    //构造函数时,取数
    public HTDLtjrwMBean() throws Exception {
        try {
            blhList = getRwdmList();
//            fillBlhList();
//            ybsrwVOList = null;
        } catch (Exception e) {
            throw new Exception(e.toString());
        }
    }

    private HashMap getCondition() throws Exception {
//        String input = searchBLH;
        HashMap para = new HashMap();
        try {
//            String selected = WebUtil.getParameterFromContextMap("update:searchBLH");
//            if (("0".equals(selected)) || (EMPTY_STRING.equals(selected)) || (selected==null)) {
//                input = null;
//            } else {
//                input.put("blh_mc",new String(selected));
//            }
            keyWords = WebUtil.getParameterFromContextMap("update:keyword");
            if ((keyWords != null) && (!EMPTY_STRING.equals(keyWords))) {
                String input = keyWords.trim();

                if ("人工调度".equals(input)) {
                    para.put("zxpl", new String("6"));
                }
                if ("每天".equals(input)) {
                    para.put("zxpl", new String("1"));
                }
                if ("调度中".equals(input)) {
                    para.put("dq_zt", new String("0"));
                }
                if ("暂停调度".equals(input)) {
                    para.put("dq_zt", new String("1"));
                }
                if ("执行中".equals(input)) {
                    para.put("dq_zt", new String("3"));
                }
                para.put("rw_mc", new String(input));
                para.put("blh_mc", new String(input));
                para.put("zb", new String(input));
                para.put("rw_xh", new String(input));
            }

        } catch (Exception e) {
            throw new Exception("YCHTDL02002:MBean中获取查询条件时异常\u2014\u2014" +
                                e.getMessage());
        }
        return para;
    }

    protected void refreshObjectList(int currentPage) throws Exception {
        ybsrwVOList = (ArrayList) getSplitTable( //getYbsrwFuzzy
//                "T_HTDL_YBSDSRW.selectAllYbsdsrw", getCondition(), PAGE_SIZE, currentPage);
                "T_HTDL_YBSDSRW.getYbsrwFuzzy", getCondition(), PAGE_SIZE,
                currentPage);
    }

    // 执行有关的预处理
    protected void runExtraRoutine() {};

    protected void getTotalPage() throws Exception {
//        this.totalPageCount = MathTotalAsCount("T_HTDL_YBSDSRW.selectCount", getCondition(),                                               PAGE_SIZE);
        this.totalPageCount = MathTotalAsCount("T_HTDL_YBSDSRW.countYbsrwFuzzy",
                                               getCondition(), PAGE_SIZE);
    }


//实现父类的抽象方法:排序
    protected void sort(final String column, final boolean ascending) {
        Comparator comparator = new Comparator() {
            public int compare(Object o1, Object o2) {
                HTDLybsdsrwVO c1 = (HTDLybsdsrwVO) o1;
                HTDLybsdsrwVO c2 = (HTDLybsdsrwVO) o2;
                if (column == null) {
                    return 0;
                }
                if (column.equals("rw_xh")) {
                    Integer cint1 = new Integer(c1.getRw_xh());
                    Integer cint2 = new Integer(c2.getRw_xh());
                    return ascending ? cint1.compareTo(cint2) :
                            cint2.compareTo(cint1);
                } else {
                    return 0;
                }
            }
        };
        Collections.sort(ybsrwVOList, comparator);

    }


//一次获得所有的任务代码和已部署任务列表的内容,
//加入分页功能后该函数不再使用
//    private String getAll() throws Exception {
//
//        ArrayList tmpList = new ArrayList();
//        HTDLglddrwReqEvent req = new HTDLglddrwReqEvent();
//        req.setDealMethod("getRwlb&Ybsrwlb"); //一次获得任务代码和已部署任务
//        try {
////            SsglyDelegateRemote service = new SsglyDelegateRemote();
//            ISsglyService service = new SsglyDelegate();
//            ResponseEvent resp = service.invokeTask(req);
//
//            HTDLglddrwResEvent res = (HTDLglddrwResEvent) resp;
////分页后注释
//            //           this.setYbsrwVOList(res.getYbsrwlbVOList()); //获取已部署任务
//
//            //处理任务代码
//            ArrayList dsrwVOList = res.getDsrwlbVOList();
//            tmpList.add(new SelectItem("", "--请选择要执行的功能--"));
//            for (int i = 0; i < dsrwVOList.size(); i++) {
//                HTDLdsrwlbVO dsrwVO = (HTDLdsrwlbVO) dsrwVOList.get(i);
//                tmpList.add(new SelectItem(dsrwVO.getBlh_mc(),
//                                           dsrwVO.getBlh_mc() + "||" +
//                                           dsrwVO.getBlh_mc_j()));
//            }
//            this.setBlhList(tmpList);
//        } catch (Exception e) {
//            throw new Exception(e.toString());
//        }
//
//        return "success";
//    }

//调用后台程序获得定时任务代码表
    private ArrayList getRwdmList() throws Exception {

        ArrayList retList = new ArrayList();
        HTDLglddrwReqEvent req = new HTDLglddrwReqEvent();
        req.setDealMethod("getDsrwlb");
        try {
//            SsglyDelegateRemote service = new SsglyDelegateRemote();
            ISsglyService service = new SsglyDelegate();
            ResponseEvent resp = service.invokeTask(req);

            HTDLglddrwResEvent getDsrwResp = (HTDLglddrwResEvent) resp;

            ArrayList dsrwVOList = getDsrwResp.getDsrwlbVOList();
            remarkList = dsrwVOList;
            retList.add(new SelectItem("", "-------请选择-------"));
            //构造下拉列表,找到最大长度的代码的长度,并以此为标准
//            int length=0;
//            for (int i=0; i<dsrwVOList.size();i++) {
//                HTDLdsrwlbVO dsrwVO = (HTDLdsrwlbVO) dsrwVOList.get(i);
//                int tmpLen = dsrwVO.getBlh_mc().length();
//                if(tmpLen>length){
//                    length = tmpLen;
//                }
//            }
//            length = length +2;  //加一个空格
//            System.out.println("++++++++++length: "+ length);

            for (int i = 0; i < dsrwVOList.size(); i++) {
                HTDLdsrwlbVO dsrwVO = (HTDLdsrwlbVO) dsrwVOList.get(i);
//                String tmpBlh = dsrwVO.getBlh_mc();
//                int emptyLen = length-tmpBlh.length();
//                String emptyStr="";
//                for (int j=0; j<emptyLen/2; j++) {
//                    emptyStr=emptyStr+"\uE5E5";
//                }
//                tmpBlh= tmpBlh+emptyStr;
////                tmpBlh = tmpBlh+emptyStr.substring(0,emptyLen)+dsrwVO.getBlh_mc_j();
//                tmpBlh = tmpBlh + dsrwVO.getBlh_mc_j();
//                System.out.println("tmpBlh:"+tmpBlh);
                retList.add(new SelectItem(dsrwVO.getBlh_mc(), //tmpBlh));
                                           dsrwVO.getBlh_mc() + ":" +
                                           dsrwVO.getBlh_mc_j()));
            }
        } catch (Exception e) {
            throw new Exception(e.getMessage());
        }
        return retList;
    }

//调用后台从数据库中获取所有的有效的blh_mc
    private ArrayList readBlhList() throws Exception {
        ArrayList retList = new ArrayList();

        HTDLglddrwReqEvent req = new HTDLglddrwReqEvent();
        req.setDealMethod("getDsrwlb");
        ISsglyService service = new SsglyDelegate();
        ResponseEvent resp = service.invokeTask(req);

        HTDLglddrwResEvent getDsrwResp = (HTDLglddrwResEvent) resp;
        retList = getDsrwResp.getDsrwlbVOList();
//        System.out.println("----------"+retList.size()+"---------------");
        return retList;
    }

//构造blh下拉列表中的内容
    private void fillBlhList() throws Exception {
        try {
            ArrayList dsrwVOList = readBlhList();
            remarkList = dsrwVOList;

            this.blhList = new ArrayList(); //插入时候的下拉列表
            this.searchBLHList = new ArrayList(); //查询时候的下拉列表
            this.blhList.add(new SelectItem("", "--请选择--"));
            this.searchBLHList.add(new SelectItem("", "--请选择--"));
            this.searchBLHList.add(new SelectItem("0", "--全部功能--"));

            if (dsrwVOList != null ) {
                for (int i = 0; i < dsrwVOList.size(); i++) {
                    HTDLdsrwlbVO dsrwVO = (HTDLdsrwlbVO) dsrwVOList.get(i);
                    blhList.add(new SelectItem(dsrwVO.getBlh_mc(),
                                               dsrwVO.getBlh_mc() + "||" +
                                               dsrwVO.getBlh_mc_j()));
                    searchBLHList.add(new SelectItem(dsrwVO.getBlh_mc(),
                                                     dsrwVO.getBlh_mc() + "||" +
                                                     dsrwVO.getBlh_mc_j()));
                }
            }
        } catch (Exception e) {
            throw new Exception("YCHTDL02001:MBean中构造下拉列表异常\u2014\u2014" +
                                e.getMessage()); //mod
        }
    }

// 调用后台获得已部署任务列表的内容
//加入分页功能后该函数不再使用
    private ArrayList getYbsrwList() throws Exception {
        ArrayList tempList = new ArrayList();
        HTDLglddrwReqEvent req = new HTDLglddrwReqEvent();
        req.setDealMethod("getYbsrwlb");
        System.out.println("getYbsrwlb");
        try {
            ISsglyService service = new SsglyDelegate();
            ResponseEvent resp = service.invokeTask(req);
            HTDLglddrwResEvent getDsrwResp = (HTDLglddrwResEvent) resp;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -