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

📄 rwglaprwjhblh.java

📁 以前做的一个j2ee的项目
💻 JAVA
字号:
package gov.gdlt.ssgly.taxcore.taxblh.rwgl;

import java.util.ArrayList;
import gov.gdlt.ssgly.taxcore.comm.blh.BaseBizLogicHandler;
import gov.gdlt.ssgly.taxcore.comm.event.ResponseEvent;
import gov.gdlt.ssgly.taxcore.comm.log.LogWritter;
import gov.gdlt.ssgly.taxcore.comm.event.RequestEvent;
import gov.gdlt.ssgly.taxcore.comm.exception.TaxBaseSystemException;
import gov.gdlt.ssgly.taxcore.comm.exception.TaxBaseBizException;
import gov.gdlt.ssgly.taxcore.taxdao.rwgl.RWGLjhapDAO;
import gov.gdlt.ssgly.taxcore.taxdao.rwgl.workflow.SsglyWorkFlow;
import java.math.BigDecimal;
import gov.gdlt.ssgly.taxcore.taxevent.rwgl.*;
import gov.gdlt.ssgly.taxcore.taxblh.wdsc.qtwdsc.WDSCqtwdscBLH;
import gov.gdlt.ssgly.taxcore.taxdao.rwgl.RWGLrwjlDAO;
import gov.gdlt.ssgly.taxcore.taxblh.gzda.TaskManagerImpl;
import gov.gdlt.ssgly.taxcore.taxdao.rwgl.RWGLspecialDAO;
import gov.gdlt.ssgly.taxcore.comm.util.StringUtils;
import gov.gdlt.ssgly.taxcore.taxdao.jkyj.JKYJjkyjsjDAO;

/**
 * <p>Title: </p>
 *
 * <p>Description: 广东地税税收管理员工作平台</p>
 *
 * <p>Copyright: Copyright (c) 2005 广东省地方税务局,广州市地方税务局</p>
 *
 * <p>Company: 广州地税</p>
 *
 * @author 王隽
 * @version 1.0
 */
public class RWGLaprwjhBLH extends BaseBizLogicHandler {
    public RWGLaprwjhBLH() {
    }

    //////////////////    抽象方法实现    /////////////////////
    /**
     * validateData 实现具体的业务数据规则校验
     * req : RequestEvent,   客户端请求数具
     * conn : Connection   数据库连结
     * 返回:boolean   true:数据校验成功   false:数据校验不成功
     */
    protected ResponseEvent validateData(RequestEvent req) throws
            Exception {
        LogWritter.sysDebug("got session");
        ResponseEvent res = new ResponseEvent();
        return res;
    }

    /**
     * 此方法实现了业务逻辑的处理过程,处理具体业务逻辑的过程中,
     * 在出现异常的时侯, 必须向上抛出异常,异常的处理在
     * BaseBizLogicHandler实现异常的处理,事务处理和日志的记录;具体要的异常的定义根据
     * 具体的业务来确定。返回的参数的对象类型必须是ResponseEvent类型的对象实例,
     * 如果捕捉到业务上的异常,并对具体的业务的异常进行处理,如根据TaxBaseBizException
     * 以及它的扩展类的异常,写应用日志信息,异常捕获后,相应地要向上抛以下几种异常
     *  1.TaxBaseSystemException
     *  2.TaxBaseBizException
     *  3.Throwable
     *  输入参数:
     *  req : RequestEvent,  客户端请求的数据对象实例
     *  conn : Connection   数据库的连接句柄
     *  返回:ResponseEvent  返回给客户端的数据对象实例
     */
    protected ResponseEvent performTask(RequestEvent req) throws
            TaxBaseSystemException, TaxBaseBizException {
        String dealMethod = req.getDealMethod(); //业务处理标志
        ResponseEvent resEvn = new ResponseEvent(); //创建ResponseEvent对象resEvn
        //强制造型转换
        RWGLaprwjhReqEvent reqEvent = (RWGLaprwjhReqEvent) req;
        if ("getJhap".equals(dealMethod)) {
            resEvn = this.getJhap(reqEvent);
        } else
        if ("newJhap".equals(dealMethod)) {
            resEvn = this.newJhap(reqEvent);
        } else
        if ("startJhap".equals(dealMethod)) {
            resEvn = this.startJhap(reqEvent);
        } else
        if ("saveJhap".equals(dealMethod)) {
            resEvn = this.saveJhap(reqEvent);
        } else
        if ("getAllObjects".equals(dealMethod)) {
            resEvn = this.getAllObjects(reqEvent);
        }
        return resEvn;
    }

    private ResponseEvent getJhap(RWGLaprwjhReqEvent req) {
        RWGLjhapDAO jhap = new RWGLjhapDAO();
        jhap.setJh_xh(req.getJh_xh());
        RWGLjhrwVO jhrw = jhap.getJhap();
        RWGLaprwjhResEvent res = new RWGLaprwjhResEvent();
        res.setJhrwVO(jhrw);
        return res;
    }

    private ResponseEvent newJhap(RWGLaprwjhReqEvent req) {
        String repCode = "-1";
        BigDecimal jh_xh = SsglyWorkFlow.newJhap(req.getJhrwVO()); //调用工作流引擎生成计划
        RWGLaprwjhResEvent res = new RWGLaprwjhResEvent();
        if (jh_xh != null) {
            repCode = "0"; //计划成功生成
            if (req.isStartNow()) {
                //如果需要立即启动,调用启动方法
                req.setJh_xh(jh_xh);
                this.startJhap(req);
            }
        }
        RWGLjhrwVO jhap = new RWGLjhrwVO();
        jhap.setJh_xh(jh_xh);
        res.setJhrwVO(jhap);
        res.setRepCode(repCode);
        return res;
    }

    private ResponseEvent startJhap(RWGLaprwjhReqEvent req) {
        BigDecimal jh_xh = req.getJh_xh();
        BigDecimal rw_xh = SsglyWorkFlow.startWorkFlow(jh_xh);
        String repCode = "-1";
        if (rw_xh != null && !rw_xh.equals(new BigDecimal(0))) {
            RWGLrwjlDAO rwjl = new RWGLrwjlDAO();
            rwjl.setRw_xh(rw_xh);
            RWGLrwmxVO rwmx = rwjl.getRwmx();
            //增加预警提示
            repCode=this.createYjts(rw_xh,rwmx);
            //调用文档接口,已停用
            //repCode = this.callWdsc(rw_xh, req.getSwry_dm(),rwmx); //启动任务时,调用文档生成模块,生成文档
        }
        RWGLaprwjhResEvent res = new RWGLaprwjhResEvent();
        res.setRw_xh(rw_xh);
        res.setRepCode(repCode);
        return res;
    }

    private ResponseEvent saveJhap(RWGLaprwjhReqEvent req) {
        RWGLjhapDAO jhap = new RWGLjhapDAO();
        int rows = jhap.saveJhap(req.getJhrwVO());
        String repCode = "-1";
        ResponseEvent res = null;
        if (rows == 1) {
            repCode = "0";
            //保存成功之后,需要立即启动任务的,调用方法来启动
            if (req.isStartNow()) {
                res = this.startJhap(req);
            } else {
                res = new RWGLaprwjhResEvent();
                res.setRepCode(repCode);
            }
        } else {
            res = new RWGLaprwjhResEvent();
            res.setRepCode(repCode);
        }
        return res;
    }

    private ResponseEvent getAllObjects(RWGLaprwjhReqEvent req) {
        RWGLaprwjhResEvent res;
        if (req.getJh_xh() != null) {
            res = (RWGLaprwjhResEvent)this.getJhap(req);
        } else {
            res = new RWGLaprwjhResEvent();
        }
        RWGLjhapDAO jhap = new RWGLjhapDAO();
        //一下内容已废止
        //res.setRwlxDmb(jhap.getRwlxDmb());
        jhap.setSwry_dm(req.getSwry_dm());
        res.setSwjgList(jhap.getSwjg());
        res.setSwryList(jhap.getSwry());
        return res;
    }

//    private String callWdsc(BigDecimal rw_xh, String swry_dm,RWGLrwmxVO rwmx) {
//        String repCode = "0";
//        //先判断是否只有一个纳税人,如果不只一个或没有纳税人,则不生成文档
//        ArrayList wdList =(ArrayList) rwmx.getList("wdbh").clone();
//        if ((rwmx.getFl_xh() == null || rwmx.getFl_xh().equals("")) &&
//            rwmx.getNsrList() != null && rwmx.getNsrList().size() == 1 &&
//            wdList != null &&
//            wdList.size() > 0) {
//            rwmx.removeProperty("wdbh");
//            ArrayList fileList=rwmx.getFileList();
//            //准备调用接口
//            String nsrnbm = (String) rwmx.getNsrList().get(0);
//            WDSCqtwdscBLH wdBLH = new WDSCqtwdscBLH();
//            String mbbh, wdnr, url;
//            ArrayList tempList;
//            for (int i = 0; i < wdList.size(); i++) {
//                //取文档编号
//                mbbh = (String) wdList.get(i);
//                LogWritter.sysDebug(mbbh);
//                if (mbbh == null || mbbh.equals("")) continue;
//                tempList=StringUtils.convertStrToArrayList(mbbh,",");
//                mbbh=(String)tempList.get(0);
//                if (mbbh == null || mbbh.equals("")) continue;
//                LogWritter.sysDebug("准备调用文档生成接口,文档模板编号:"+mbbh+" 纳税人内部码:"+nsrnbm);
//                //调用文档生成接口
//                try {
//                    wdnr=StringUtils.gbkToISO(wdBLH.makeQtWd(mbbh,nsrnbm));
//                } catch (Exception ex) {
//                    LogWritter.sysDebug("文档生成接口调用失败,模板编号:"+mbbh+" 纳税人内部码:"+nsrnbm);
//                    ex.printStackTrace();
//                    wdnr = null;
//                }
//                if (wdnr == null || wdnr.equals("")) {
//                    LogWritter.sysDebug("生成的文档无内容,生成失败,模板编号:"+mbbh+" 纳税人内部码:"+nsrnbm);
//                    continue;
//                }
//                LogWritter.sysDebug("文档生成成功,准备调用文档管理接口以保存内容");
//                try {
//                    TaskManagerImpl taskmanagerimpl = new
//                            TaskManagerImpl();
//                    url = taskmanagerimpl.currencySaveFile("HTM",
//                            "FG", "过程文档", "税收管理员平台系统", swry_dm,
//                            nsrnbm.toString(), "系统附加信息", "", "", "文档生成",
//                            wdnr.getBytes());
//                } catch (Exception ex) {
//                    LogWritter.sysDebug("调用文档管理接口失败,无法保存!");
//                    ex.printStackTrace();
//                    url=null;
//                }
//                if (url==null || url.equals("")) {
//                    LogWritter.sysDebug("文档保存返回码为空,保存失败!");
//                    continue;
//                }
//                fileList.add(url);
//                LogWritter.sysDebug("生成的文档保存成功,URL="+url);
//            }
//            rwmx.setFileList(fileList);
//            //重用特殊数据处理的方法保存任务明细信息
//            RWGLspecialDAO dao=new RWGLspecialDAO();
//            RWGLspecialDataVO data=new RWGLspecialDataVO();
//            data.setSpecialString2(rwmx.getRwmxxx());
//            data.setSpecialNumber2(rw_xh);
//            data.setSqlOperation("update");
//            data.setSqlName("setRwmxxx");
//            data=dao.dealSpecialOperation(data);
//            if (data.getSpecialNumber1().equals(new BigDecimal(1))) LogWritter.sysDebug("任务模板生成的文档已添加到任务明细信息中");
//        } else {
//            LogWritter.sysDebug(
//                    "本任务包含超过一个纳税人,不调用文档生成接口");
//        }
//        return repCode;
//    }

    private String createYjts(BigDecimal rw_xh,RWGLrwmxVO rwmx){
        String repCode="0";
        BigDecimal nsrnbm=rwmx.getNsrnbm();
        String zzyq=rwmx.getZzyq();
        String rwxl_dm=rwmx.getRwxl_dm();
        if (nsrnbm==null || nsrnbm.equals(new BigDecimal(0)) || zzyq==null || zzyq.equals("") || rwxl_dm==null || rwxl_dm.equals("")) {
            LogWritter.sysDebug("任务明细信息不完整,不能生成监控台提示信息");
            return repCode;
        }
        String yjjlxh=rwmx.getProperty("yjjlxh");
        if (yjjlxh!=null && !yjjlxh.equals("")){
            LogWritter.sysDebug("本任务已经包含预警提示信息,不再生成新的提示");
            return repCode;
        }
        //使用specialData来查询数据,各属性用法如下:
        //specialString1:提示代码
        //specialString2:参数:职责要求
        RWGLspecialDataVO specialData=new RWGLspecialDataVO();
        specialData.setSpecialString2(zzyq);
        specialData.setSqlName("getYjtsDm");
        specialData.setSqlOperation("select");
        RWGLspecialDAO dao=new RWGLspecialDAO();
        specialData=dao.dealSpecialOperation(specialData);
        String ts_dm=specialData.getSpecialString1();
        String tsms=rwmx.getMemo();
        if (ts_dm==null || ts_dm.equals("") || tsms==null || tsms.equals("")) {
            LogWritter.sysDebug("本任务小类:" + rwxl_dm + "不包含需要提示的信息,不生成提示");
            return repCode;
        }
        JKYJjkyjsjDAO yjDAO=new JKYJjkyjsjDAO();
        LogWritter.sysDebug("开始调用监控台接口生成提示信息,纳税人内部码:"+nsrnbm+" 指标代码:"+ts_dm+" 预警状态编号:"+zzyq+" 预警信息描述:"+tsms+" 任务序号:"+rw_xh);
        BigDecimal yj_xh=yjDAO.saveJkyjsjForRwgl(nsrnbm,ts_dm,zzyq,tsms,rw_xh);
        if (yj_xh==null){
            LogWritter.sysDebug("调用监控台接口失败,保存失败!");
            repCode="-1";
        }else{
            LogWritter.sysDebug("调用监控台接口成功,返回预警提示序号:"+yj_xh);
            rwmx.setProperty("yjjlxh",yj_xh.toString());
            //重用特殊数据处理的方法保存任务明细信息
            specialData.setSpecialString2(rwmx.getRwmxxx());
            specialData.setSpecialNumber2(rw_xh);
            specialData.setSqlOperation("update");
            specialData.setSqlName("setRwmxxx");
            specialData=dao.dealSpecialOperation(specialData);
            if (specialData.getSpecialNumber1().equals(new BigDecimal(1))) {
                LogWritter.sysDebug("生成的提示信息已添加到任务明细信息中");
                repCode="0";
            }else{
                repCode="-1";
                LogWritter.sysDebug("生成的提示信息保存失败!");
            }
        }
        return repCode;
    }
}

⌨️ 快捷键说明

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