首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

线程的根本应用

2013-10-04 
线程的基本应用/*** 保存等级保护定级备案申请信息* @author xiongmin* @time 2013-9-21*/public void sav

线程的基本应用
/** * 保存等级保护定级备案申请信息 * @author xiongmin * @time 2013-9-21 */ public void saveBash() throws Exception { String success = ""; //得到前台传入的验证码 String code = this.getRequest().getParameter("code"); //得到session存入的验证码 String yanZhenMa = this.getRequest().getSession().getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY).toString(); if(!code.equalsIgnoreCase(yanZhenMa)){ renderText("输入的验证码有误"); }else{ //得到请求唯一编号 onlyCode = DummyServer.createOnlyCode("BJBH"); //用于生成业务流水号的xml文件 String xmlFile = DummyServer.createSblshReqXml(onlyCode,"30000031900754268913440300"); //向uplond目录写文件 DummyServer.createReqXmlFile(onlyCode,xmlFile); //线程 Thread thread = new Thread(){ public void run(){ try{ String path = (new ReadXml().getClass().getResource("/").toString()+"data_download/").replace("file:/", "").replace("%20", " "); String fileName = onlyCode+".xml"; File file = new File(path+fileName); if(file.exists()){ //取申办流水号 sblsh = Base.readXml(file); file.delete(); return; } Thread.sleep(200); run(); }catch(Exception e){ e.printStackTrace(); } } }; //开启线程 thread.start(); //线程执行完成后(即file.exists()为ture时,链接下面的代码) thread.join(); //添加受理编号 entity.setSlbh(sblsh); //统一平台列名、列值集合集合 Map<String,String> map = fhMap(entity); //受理状态对象 WjBajv wjBajv = new WjBajv(); wjBajv.setSlbh(sblsh); //保存等级保护定级备案申请信息、向统一平台插入数据 success = manager.saveWjBash(entity,map,wjBajv); if(("1".equals(success))){ renderText("备案成功,受理编号为:"+sblsh); }else{ renderText("服务器出现异常,请重新备案!"); } } }

?

?

热点排行