Web:首先定义全局变量,创建hashmap存放值
HashMap mapCountDown=new HashMap(); int hour;//时 int minute;//分 int second;//秒倒计时方法,获取限时竞价时间,将时间分割成时分秒,赋值给三个全局变量,通过while()循环实现倒计时
/** * 拍卖开始,进入限时竞价时间,倒计时 * 将倒计时值传入mapCountDown中 * 后台-拍卖管理-拍卖大厅 * @param req * @param pw * @param resp * @throws InterruptedException */@RequestMapping("/auctionStart")public void auctionStart(HttpServletRequest req,PrintWriter pw,HttpServletResponse resp) throws InterruptedException{req.getSession().setAttribute("auctionSwitch", "开始");//拍卖idString id=req.getParameter("id");//限时竞价时间String datetime=req.getParameter("datetime");//po类AuctionPo auctionPo=new AuctionPo();auctionPo.setAuctionid(Integer.parseInt(id));auctionPo.setAuctionstatus("正在进行");//修改拍卖状态int returnInt=iActionSerivce.updateByPrimaryKeySelective(auctionPo);if(returnInt>0){//countDown(req,datetime,id);//分割String[] str=datetime.split(":");hour=Integer.parseInt(str[0]);//时minute=Integer.parseInt(str[1]);//分second=Integer.parseInt(str[2]);//秒while (hour!=0||minute!=0||second!=0) {if("开始".equals(req.getSession().getAttribute("auctionSwitch"))){String h="";String m="";String s="";if(second==0){if(minute==0){if(hour==0){mapCountDown.put(Integer.parseInt(id), "等待拍卖师操作");//strCountDown="等待拍卖师操作";//req.getSession().setAttribute("countDown"+id, "等待拍卖师操作");return;}else{hour--;minute=59;second=59;if(hour