• 时间日期循环


    public static Chart getStatisticalData(List<AdminIndexData> listAdminIndex, String name,String startTime,String endTime,AdminIndexService adminIndexService,AdminIndexData ad) {
    		Chart chart = new Chart();
    		Calendar star = Calendar.getInstance();
    		star.setTime(DateUtils.parseDate(startTime));
    		
    		Calendar end = Calendar.getInstance();
    		end.setTime(DateUtils.parseDate(endTime));
    		
    		List<Integer> datas = new ArrayList<Integer>();
    		//int total=0;
    		int countZhuBanFan=adminIndexService.getCountZhuBanFan(ad);
    		int countDaiLiShang=adminIndexService.getCountDaiLiShang(ad);
    		int countAccount=adminIndexService.getCountAccount(ad);
    		int countExhiMain=adminIndexService.getCountExhiMain(ad);
    		int countHuiYiMain=adminIndexService.getCountHuiYiMain(ad);
            int countOrder=adminIndexService.getCountOrder(ad);
    		
    		
    		String month="";
    		for (;star.getTime().getTime()<=end.getTime().getTime();star.add(Calendar.MONTH, 1)){
    			month = DateUtils.formatDate(star.getTime(), "yyyy-MM");
    			int number = 0;;
    			for (AdminIndexData adminIndexData : listAdminIndex) {
    				if (month.equals(adminIndexData.getMonthTime())) {
    					number = adminIndexData.getNumber();
    					//total = total+number;
    				}
    			}
    			datas.add(number);
    			//chart.setName(name+"<br/>"+String.valueOf(total));
    			
    			if("展会主办方".equals(name)){
    				chart.setName(name+"<br/>"+String.valueOf(countZhuBanFan));
    			}else if("展会代理商".equals(name)){
    				chart.setName(name+"<br/>"+String.valueOf(countDaiLiShang));
    			}else if("用户账号".equals(name)){
    				chart.setName(name+"<br/>"+String.valueOf(countAccount));
    			}else if("展览".equals(name)){
    				chart.setName(name+"<br/>"+String.valueOf(countExhiMain));
    			}else if("会议".equals(name)){
    				chart.setName(name+"<br/>"+String.valueOf(countHuiYiMain));
    			}else if("订单".equals(name)){
    				chart.setName(name+"<br/>"+String.valueOf(countOrder));
    			}
    
    			chart.setData(datas);
    		}
    		
    		return chart;
    		
    	}
    }
    

      

  • 相关阅读:
    struts2防止表单重复提交的解决方案
    从调试角度理解ActionContext、OgnlContext、OgnlValueStack的关系
    Struts2输入校验
    struts2异常处理机制
    struts2拦截器的实现原理及源码剖析
    设计模式六大原则(二):里氏替换原则
    设计模式六大原则(一):单一职责原则
    java中的对象、类、包、模块、组件、容器、框架、架构的概念入门
    jwt入门
    ubuntu18.04.2下编译openjdk9源码
  • 原文地址:https://www.cnblogs.com/SHMILYHP/p/5121868.html
Copyright © 2020-2023  润新知