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

📄 sjwhzbsjmbean.java

📁 以前做的一个j2ee的项目
💻 JAVA
字号:
package gov.gdlt.ssgly.taxweb.mbean.sjwh;

import java.math.*;
import java.util.*;

import javax.faces.model.*;

import gov.gdlt.ssgly.taxcore.comm.bizdelegate.*;
import gov.gdlt.ssgly.taxcore.comm.bizinterface.*;
import gov.gdlt.ssgly.taxcore.comm.event.*;
import gov.gdlt.ssgly.taxcore.taxevent.flgl.*;
import gov.gdlt.ssgly.taxcore.taxevent.sjwh.*;
import gov.gdlt.ssgly.taxweb.comm.mbean.*;
import gov.gdlt.ssgly.taxweb.comm.util.*;
import gov.gdlt.ssgly.taxcore.comm.util.DateUtils;

public class SJWHzbsjMBean extends BaseManagedBean {
    private String lrry_dm;
    private FLGLnsrflxxVO nsrvo;
    private BigDecimal nsrnbm;
    private SJWHcjsjVO cjsjvo;
    private List allCjsj;
    private String outcome;
    private List zlb;
    private String tips;
    private String nsr_mc = "";
    private String nsrbm = "";
    public static final String EMPTY_STRING = "";
    private SJWHcjsjResEvent res = null;
    private int half_rows = 0;

    public SJWHzbsjMBean() {
        System.out.println("----zbmbean start initial :" + System.currentTimeMillis());
        allCjsj = new ArrayList();
        zlb = new ArrayList();
        this.lrry_dm = (String) WebUtil.eval("#{user.userID}");
        nsrbm = WebUtil.getParameterFromContextMap("nsrbm");
        nsr_mc = WebUtil.getParameterFromContextMap("nsr_mc");
        System.out.println("----zbmbean   end initial :" + System.currentTimeMillis());
    }

    /**
     * 保存数据action
     * @return String
     * @throws Exception
     */
    public String saveAction() throws Exception {
        List saveList = new ArrayList();
        for (int i = 0; i < allCjsj.size(); i++) {
            SJWHcjsjVO cjsjvo = (SJWHcjsjVO) allCjsj.get(i);
            if (!cjsjvo.isReadOnly()) {
                cjsjvo.setLrry_dm(lrry_dm);
                cjsjvo.setNsrnbm(nsrnbm);
                cjsjvo.setSjly("3");
                if (cjsjvo.isCheckBoxFlag()) {
                    if (cjsjvo.isZbzFlag()) {
                        cjsjvo.setZbz("是");
//                        cjsjvo.setZbz("1");
                    } else {
//                        cjsjvo.setZbz("0");
                        cjsjvo.setZbz("否");
                    }
                    cjsjvo.setHh(new BigDecimal(1));
                    saveList.add(cjsjvo);
                } else if (cjsjvo.isInputTextFlag()) {
                    if (cjsjvo.getZbz().trim().length() > 0) {
                        cjsjvo.setHh(new BigDecimal(1));
                        saveList.add(cjsjvo);
                    }
                } else if (cjsjvo.isSelectManyFlag()) {
                    String[] zbzs = cjsjvo.getZbzs();
                    if (zbzs != null) {
                        StringBuffer sb = new StringBuffer();
                        for (int l = 0; l < zbzs.length; l++) {
                            sb.append(zbzs[l]);
                            if (l < zbzs.length - 1) {
                                sb.append(",");
                            }
                        }
                        if (sb.toString().trim().length() > 0) {
                            cjsjvo.setZbz(sb.toString());
                            cjsjvo.setHh(new BigDecimal(1));
                            saveList.add(cjsjvo);
                        }
                    }
                } else if (cjsjvo.isSelectItemFlag()) {
                    cjsjvo.setHh(new BigDecimal(1));
                    saveList.add(cjsjvo);
                }
            }
        }
        if (saveList.size() > 0) {
            SJWHcjsjReqEvent cjsjReq = new SJWHcjsjReqEvent();
            cjsjReq.setCjsjList(saveList);
            cjsjReq.setDealMethod("insertCjsjList");
            try {
                ISsglyService service = new SsglyDelegate();
                ResponseEvent resp = service.invokeTask(cjsjReq);
                SJWHcjsjResEvent cjsjResp = (SJWHcjsjResEvent) resp;
                int flag = cjsjResp.getFlag();
                StringBuffer output = new StringBuffer();
                String nums = cjsjResp.getMsg();
                if (flag == 1) {
                    String alertMsg = "XXSJWH-001:保存成功!";
                    output.append(
                            "<script language=\"javascript\" type=\"text/javascript\">");
                    output.append("alert('")
                            .append(alertMsg)
                            .append("')");
                    output.append("</script>");
                    this.tips = new String(output);
                    outcome = "success";
                } else {
                    String alertMsg = "XXSJWH-002:保存失败!";
                    output.append(
                            "<script language=\"javascript\" type=\"text/javascript\">");
                    output.append("alert('")
                            .append(alertMsg).append("')");
                    output.append("</script>");
                    this.tips = new String(output);
                    outcome = "failure";
                }
            } catch (Exception e) {
                e.printStackTrace();
                outcome = "failure";
            }
        }
        return outcome;
    }

    public String reload() {
        try {
            allCjsj = getAllData(nsrnbm);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return "success";
    }

    /**
     * 读取纳税人的所有指标数据
     * @param nsrnbm BigDecimal
     * @return List
     * @throws Exception
     */
    private List getAllData(BigDecimal nsrnbm) throws Exception {
        System.out.println("----zbmbean before get alldata :" + System.currentTimeMillis());
        SJWHcjsjReqEvent cjsjReq = new SJWHcjsjReqEvent();
        cjsjReq.setNsrnbm(nsrnbm);
//        cjsjReq.setDealMethod("getAllLastCjsj");
        cjsjReq.setDealMethod("getAllZbsj");
        List packList = new ArrayList();
        int length = 0;
        try {
            ISsglyService service = new SsglyDelegate();
            ResponseEvent resp = service.invokeTask(cjsjReq);
            SJWHcjsjResEvent cjsjResp = (SJWHcjsjResEvent) resp;
            List cjsjList = cjsjResp.getCjsj();
            for (int i = 0; i < cjsjList.size(); i++) {
                List zlbList = new ArrayList();
                SJWHcjsjVO cjsjvo = (SJWHcjsjVO) cjsjList.get(i);
                if ("0".equals(cjsjvo.getLr_bj())) {
                    cjsjvo.setReadOnly(true);
                    if (cjsjvo.isCheckBoxFlag() &&
                        cjsjvo.getZbz().equals("1")) {
                        cjsjvo.setZbz("是");
                    } else if (cjsjvo.isCheckBoxFlag() &&
                              cjsjvo.getZbz().equals("0")) {
                        cjsjvo.setZbz("否");
                    }
                }
                if (cjsjvo.isCheckBoxFlag()) {
//                    if (cjsjvo.getZbz().equals("1")) {
                    if (cjsjvo.getZbz().equals("是") ||
                        cjsjvo.getZbz().equals("1")) {
                        cjsjvo.setZbzFlag(true);
                    } else {
                        cjsjvo.setZbzFlag(false);
                    }
                }
                List tempzlb = cjsjvo.getZbzList();
                if (cjsjvo.isSelectManyFlag()) {
                    length = length + 3;
                }
                if (tempzlb != null) {
//                    HashMap hm = new HashMap();
                    for (int j = 0; j < tempzlb.size(); j++) {
                        SJWHzbzVO zbz = (SJWHzbzVO) tempzlb.get(j);
                        if ("USER_SYFGFL".equals(cjsjvo.getZb_dm())) {
                            zlbList.add(new SelectItem(zbz.getDml_mc(),
                                    zbz.getMc()));  //"适用法规分类"指标的多选框需要代码和名称的对应关系
                        } else {
                            zlbList.add(new SelectItem(zbz.getMc(), zbz.getMc())); //下拉框中key和value都为指标代码对应的名称
                        }
//                        hm.put(zbz.getDml_mc(),zbz.getMc());
                    }
//                    if (cjsjvo.isReadOnly()){   //只读字段有代码表时使用
//                       String tempZbz = cjsjvo.getZbz();
//                       String temp=(String) hm.get(tempZbz);
//                       cjsjvo.setZbz(temp);
//                    }
                    cjsjvo.setZbzList(zlbList);
                }
                length++;
                packList.add(cjsjvo);
            }
            if (length > 1) {
                half_rows = length / 2;
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {

        System.out.println("----zbmbean   end get alldata :" + System.currentTimeMillis());
            return packList;
        }
    }


    public String resetAction() throws Exception {
        SJWHcjsjReqEvent cjsjReq = new SJWHcjsjReqEvent();
        cjsjReq.setNsrnbm(nsrnbm);
        cjsjReq.setDealMethod("forceUpdate");
        try {
            ISsglyService service = new SsglyDelegate();
            ResponseEvent resp = service.invokeTask(cjsjReq);
            SJWHcjsjResEvent cjsjResp = (SJWHcjsjResEvent) resp;
        } catch (Exception e) {
            throw new Exception(e.getMessage());
        }
        return "success";
    }


    public List getAllCjsj() throws Exception {
        System.out.println("----zbmbean before get allcjsj :" + System.currentTimeMillis());
        if (allCjsj == null || allCjsj.isEmpty()) {
            if (nsrnbm == null) {
                String temp = WebUtil.getParameterFromContextMap("nsrnbm");
                if (temp != null) {
                    if (temp.trim().length() > 0) {
                        nsrnbm = new BigDecimal(temp);
                        allCjsj = getAllData(nsrnbm);
                    }
                }
            }
        }
        System.out.println("----zbmbean   end get allcjsj :" + System.currentTimeMillis());
        return allCjsj;
    }


    public SJWHcjsjVO getCjsjvo() {
        return cjsjvo;
    }

    public int getHalf_rows() {
        return half_rows;
    }

    public String getNsr_mc() {
        return nsr_mc;
    }

    public String getNsrbm() {
        return nsrbm;
    }

    public BigDecimal getNsrnbm() {
        return nsrnbm;
    }

    public FLGLnsrflxxVO getNsrvo() {
        return nsrvo;
    }

    public String getOutcome() {
        return outcome;
    }

    public SJWHcjsjResEvent getRes() {
        return res;
    }

    public String getTips() {
        return tips;
    }

    public List getZlb() {
        return zlb;
    }

    public String getLrry_dm() {
        return lrry_dm;
    }

    public void setTips(String tips) {
        this.tips = tips;
    }

    public void setZlb(List zlb) {
        this.zlb = zlb;
    }

    public void setRes(SJWHcjsjResEvent res) {
        this.res = res;
    }

    public void setOutcome(String outcome) {
        this.outcome = outcome;
    }

    public void setNsrvo(FLGLnsrflxxVO nsrvo) {
        this.nsrvo = nsrvo;
    }

    public void setNsrnbm(BigDecimal nsrnbm) {
        this.nsrnbm = nsrnbm;
    }

    public void setNsrbm(String nsrbm) {
        this.nsrbm = nsrbm;
    }

    public void setNsr_mc(String nsr_mc) {
        this.nsr_mc = nsr_mc;
    }

    public void setHalf_rows(int half_rows) {
        this.half_rows = half_rows;
    }

    public void setCjsjvo(SJWHcjsjVO cjsjvo) {
        this.cjsjvo = cjsjvo;
    }

    public void setAllCjsj(List allCjsj) {
        this.allCjsj = allCjsj;
    }

    public void setLrry_dm(String lrry_dm) {
        this.lrry_dm = lrry_dm;
    }

}

⌨️ 快捷键说明

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