Package loxia.utils

Examples of loxia.utils.ChineseCalendarGB


  }
 
  @Test
  public void testGenerateCalendar() throws Exception{
    List<Map<String, Object>> listBeans = new ArrayList<Map<String,Object>>();   
    ChineseCalendarGB cc = new ChineseCalendarGB();
    cc.setGregorian(2013, 1, 1);
    cc.computeChineseFields();
    cc.computeSolarTerms();
    Calendar c = cc.getGregorianCalendar();
    Map<String, Object> bean = null;
    Map<String, Object> oneweek = null;
    while(c.get(Calendar.YEAR) < 2014){
      if(c.get(Calendar.DAY_OF_MONTH) == 1){
        bean = new HashMap<String, Object>();
        bean.put("year", c.get(Calendar.YEAR));
        bean.put("month", c.get(Calendar.MONTH)+1);
        bean.put("sheetName", "" + (c.get(Calendar.MONTH)+1) + "月");
        List<Map<String,Object>> weeks = new ArrayList<Map<String,Object>>();
        bean.put("weeks", weeks)
        listBeans.add(bean);
      }
      if(c.get(Calendar.DAY_OF_MONTH) == 1 || c.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){
        oneweek = new HashMap<String, Object>();
        List<Map<String,Object>> weeks = (List<Map<String,Object>>)bean.get("weeks");
        weeks.add(oneweek);
      }
      Map<String,Object> day = new HashMap<String, Object>();
      day.put("date", c.get(Calendar.DAY_OF_MONTH));
      day.put("cdate", cc.getShortChineseDayNameWithMonth());
      day.put("terms", cc.getSolarTerms());
      oneweek.put("d" + c.get(Calendar.DAY_OF_WEEK), day);
      cc.rollUpOneDay();
      c.add(Calendar.DATE, 1);
    }
    WriteStatus ws = calendarWriter.writePerSheet(new FileOutputStream(new File("D:/calendar.xlsx")), listBeans);
    for(String str: ExcelKit.getInstance().getWriteStatusMessages(ws, Locale.CHINESE))
      System.out.println(str);
View Full Code Here

TOP

Related Classes of loxia.utils.ChineseCalendarGB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.