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

📄 wdscyhswdscblh.java

📁 以前做的一个j2ee的项目
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                                if (ii > 1) {
                                    for (int j = 0; j < ii; j++) {
                                        zbRes = (String) vCurrZb.get(j);
                                        if (zbRes != null) {
                                            try {
                                                Double dou = Double.valueOf(
                                                        zbRes);
                                                tempSum = dou.doubleValue();
                                            } catch (Exception e) {
                                                tempSum = 0.00;
                                            }
                                        }
                                        sum += tempSum;
                                    }
                                    FieldPosition fp = new FieldPosition(0);
                                    NumberFormat nf = NumberFormat.getInstance();
                                    nf.setGroupingUsed(false);
                                    nf.format(sum, sb, fp);

                                    vT.add(sb.toString());
                                    newWdzb.setZB_NR(vT);
                                    newWdzb.setOPER_RESULT(sb.toString());
                                } else {
                                    //vT.add(null);
                                    newWdzb.setZB_NR(null);
                                }
                                //将求和的指标添加到所有指标中进行保存
                                newWdzb.setZB_DM(//tempWdzb.getOPER_KEY() +
                                        tempWdzb.getZB_DM());
                                newWdzb.setOPER_KEY(tempWdzb.getOPER_KEY());
                                vNewZbMsg.add(newWdzb);


                                //System.out.println(tempWdzb.getOPER_TYPE() + "**zbdm=" + tempWdzb.getZB_DM() +
                                 //       "**zbnr=" + tempWdzb.getZB_NR()+ "**oper_key=" +tempWdzb.getOPER_KEY());
                            }
                        } else {
                            if (tempWdzb.getOPER_TYPE().equals(constant.
                                    OPER_TYPE_SUM)) {
                                //将求和的指标添加到所有指标中进行保存
                                newWdzb = new WDSCwdmbzbDAO();
                                newWdzb.setZB_DM(//tempWdzb.getOPER_KEY() +
                                                 tempWdzb.getZB_DM());

                                newWdzb.setOPER_KEY(tempWdzb.getOPER_KEY());
                                newWdzb.setZB_NR(null);
                                vNewZbMsg.add(newWdzb);
                            }
                            vCurrZb = new Vector();
                        }
                        tempWdzb.setZB_NR(vCurrZb);
                    }
                }
                vLoopZb.add(tempWdzb);
            }
            list.add(new Integer(loop));
            list.add(vLoopZb);
            list.add(vNewZbMsg);
        } catch (Exception e) {
            System.out.println("getLoopZbMsg()=" + e.getMessage());
            throw new Exception("YCWDSC21306"); //得到循环数失败e.getMessage());
        }
        return list;
    }


    //给定字符串,得到其中的指标集合
    //USED
    public Vector getLoopZb(StringBuffer str) throws Exception {
        Vector vZb = new Vector();
        String zb = "", temp = "";
        int pos = 0;
        WDSCwdmbzbDAO mbzb = null;//new WDSCwdmbzbDAO();
        if (str == null) {
            return vZb;
        }

        int leftPos = 0, rightPos = 0;
        try {
            while ((leftPos = str.indexOf(WDSCconstant.flagLeft, leftPos)) >= 0) {
                while ((rightPos = str.indexOf(WDSCconstant.flagRight, leftPos)) >= 0) {
                    zb = str.substring(leftPos + WDSCconstant.flagLeft.length(), rightPos);
                    mbzb = new WDSCwdmbzbDAO();
                    if (zb != null) {
                        zb = zb.trim();
                        temp = zb;
                        temp = temp.toUpperCase();
                        pos = temp.indexOf(constant.SUM.toUpperCase());
                        if (pos >= 0) {
                            mbzb.setOPER_TYPE(constant.OPER_TYPE_SUM);//设置操作类型
                            mbzb.setOPER_KEY(zb.substring(pos, pos + constant.SUM.length()));//保存操作关键字
                            zb = zb.substring(pos + constant.SUM.length());//保存指标关键字
                        } else {
                            mbzb.setOPER_TYPE("");//设置操作类型
                            mbzb.setOPER_KEY("");//保存操作关键字
                        }
                    } else {
                        mbzb.setOPER_TYPE("");//设置操作类型
                        mbzb.setOPER_KEY("");//保存操作关键字
                        zb = "";
                    }
                    mbzb.setZB_DM(zb);
                    vZb.add(mbzb);
                    rightPos++;
                    break;
                }
                leftPos = rightPos;
            }
        } catch (Exception e) {
            //e.printStackTrace();
            System.out.println("getLoopZb()=" + e.getMessage());
            throw new Exception("YCWDSC21307"); //得到循环部分指标集合失败e.getMessage());
        }
        return vZb;
    }

    //将一个double的值转化为字符串
    //USED
    public String double2String(double hh) throws Exception {
        BigDecimal bg = null;
        try {
            bg = new BigDecimal(hh);
        } catch (Exception e) {
            //e.printStackTrace();
            throw new Exception("YCWDSC21308"); //double 转换成 字符串失败e.getMessage());
        }
        return bg.toString();
    }


    /////////////////////////////////////////////////////////////////////
    //                              接口函数                            //
    /////////////////////////////////////////////////////////////////////

    //公用的文档提取接口,返回字符串
    //nsrbm:可以是nsrbm+yyyymmdd
    //ny:年月格式为yyyymm
    //USED
    public String getWdString(String nsrbm, String ny) throws
            TaxBaseSystemException {
        String retStr = "";
        StringBuffer strError = new StringBuffer();

        int queryType = 0;
        try {
            queryType = getQueryDataType(ny);
        } catch (Exception e) {
            //e.printStackTrace();
            throw new TaxBaseSystemException(e.getMessage());
        }

        //
        queryType = 0;

        switch (queryType) {
        case 0: //查询最新纪录
            try {
                retStr = getCurrWdString(nsrbm + ny);
                retStr = ((retStr == null) ? "" : retStr);
                if (retStr.equals("")) {
                    log.sysInfo("查询最新纪录失败,查询历史纪录!");
                    retStr = getHistoryWdString(nsrbm + ny);
                }
            } catch (Exception e) {

                strError.append("查询最新纪录");
                strError.append(e.getMessage());
                strError.append("");
                log.bizInfo(strError.toString());
                //e.printStackTrace();
                throw new TaxBaseSystemException(e.getMessage());
            }
            //if (retStr.length() > 0)
            break
                    ;

        case 1: //查询历史纪录
            try {
                retStr = getHistoryWdString(nsrbm + ny);
            } catch (Exception e) {

                strError.append("查询历史纪录");
                strError.append(e.getMessage());
                strError.append("");
                log.bizInfo(strError.toString());
                //e.printStackTrace();
                throw new TaxBaseSystemException(e.getMessage());
            }
            break
                    ;
        default:
            break;
        }
        return retStr;
    }

    //得到当前最新数据
    //参数:nsrbm 纳税人编码,可以是nsrbm+yyyymmdd
    //返回:String 输出文档内容字符串
    //如果nsrbm后面没有yyyymm时值查询所有记录最新的一条
    //USED
    public String getCurrWdString(String nsrbm) throws Exception {
        String retStr = "";
        BufferedInputStream in = null;
        StringBuffer buffer = new StringBuffer();

        StringWriter sw = new StringWriter();
        try {
            WDSCwdDAO wd = new WDSCwdDAO();
            wd.setM_swjg("%");
            wd = wd.getWdByNsrnbm(nsrbm);
            java.sql.Blob blob = null;
            blob = (java.sql.Blob) wd.getM_wdnr();
            if (blob != null) {
                in = new BufferedInputStream(blob.getBinaryStream());

                if (false) { //没有压缩
                    int c = 0;
                    while ((c = in.read()) != -1) {
                        sw.write(c);
                    }
                    in.close();
                    sw.flush();
                    buffer = sw.getBuffer();
                    if (buffer != null) {
                        retStr = StringUtils.isoToGBK(buffer.toString());
                    }
                    sw.close();
                } else { //采用压缩
                    retStr = ZipServer.uncompress(in, (int) blob.length());
                    in.close();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            log.bizInfo("查询当前最新数据失败!");
            throw new Exception("YCWDSC21309"); //查询当前最新一户式文档数据失败e.getMessage());
        }
        return retStr;
    }

    //得到历史数据
    //如果nsrbm后面没有yyyymm时值查询所有记录最新的一条
    //USED
    public String getHistoryWdString(String nsrbm) throws Exception {
        String retStr = "";
        BufferedInputStream in = null;
        StringBuffer buffer = new StringBuffer();

        StringWriter sw = new StringWriter();
        try {
            WDSCyhslsjlDAO wd = new WDSCyhslsjlDAO();
            wd.setTPAYERID(nsrbm);
            wd = wd.selectYhsWd();
            java.sql.Blob blob = null;
            blob = (java.sql.Blob) wd.getFILEDOC();
            if (blob != null) {
                in = new BufferedInputStream(blob.getBinaryStream());
                if (false) { //没有压缩
                    int c = 0;
                    while ((c = in.read()) != -1) {
                        sw.write(c);
                    }
                    in.close();
                    sw.flush();
                    buffer = sw.getBuffer();
                    if (buffer != null) {
                        retStr = StringUtils.isoToGBK(buffer.toString());
                    }
                    sw.close();
                } else { //采用压缩
                    retStr = ZipServer.uncompress(in, (int) blob.length());
                    in.close();
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
            log.bizInfo("查询历史数据失败!");
            //return retStr;
            throw new Exception("YCWDSC21310"); //查询一户式文档历史数据失败e.getMessage());
        }
        return retStr;
    }

    //USED
    public int delWd(String nsrbm) throws Exception {
        int row = 0;
     

⌨️ 快捷键说明

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