bug
This commit is contained in:
@@ -180,8 +180,8 @@ public class PointController {
|
||||
Date parse = simpleDateFormat.parse(date);
|
||||
|
||||
|
||||
String[] strings = pointService.TGDZForYear(parse);
|
||||
return R.ok().put("tgdz",strings);
|
||||
Map<String, String> stringStringMap = pointService.TGDZForYear(parse);
|
||||
return R.ok().put("tgdz",stringStringMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@ public interface PointService extends IService<PointEntity> {
|
||||
|
||||
List<PointEntity> searchPoint(String keywords);
|
||||
|
||||
String[] TGDZForYear(Date year);
|
||||
Map<String,String> TGDZForYear(Date year);
|
||||
}
|
||||
|
||||
@@ -66,103 +66,38 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] TGDZForYear(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
Integer year = calendar.get(Calendar.YEAR);
|
||||
int kkk = calendar.get(Calendar.MONTH);
|
||||
Integer month = kkk + 1;
|
||||
Integer day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
MyCalendar mc = new MyCalendar();
|
||||
mc.setyear(year);
|
||||
mc.setmonth(month);
|
||||
mc.getfirstday(day);
|
||||
|
||||
System.out.println(mc.getChinaYearString());
|
||||
System.out.println(mc.getChinaMonthString());
|
||||
System.out.println(mc.getCalendar().toString());
|
||||
|
||||
|
||||
// String[] day = mc.getCalendar();// 阳历日期
|
||||
// String[] chineseday = mc.getchineseCalendar_festival_solarterms();// 农历日期
|
||||
|
||||
// 以下为输出
|
||||
// System.out.println(mc.getyear() + "年" + mc.getmonth() + "月");
|
||||
// System.out.println();
|
||||
// String[] week = {"日", "一", "二", "三", "四", "五", "六"};
|
||||
// for (String str : week) {
|
||||
// System.out.printf("%-7s", " " + str);
|
||||
// }
|
||||
// System.out.println();
|
||||
// ArrayList<String> listYl = new ArrayList<>();
|
||||
// ArrayList<String> listNl = new ArrayList<>();
|
||||
// boolean bool = false;
|
||||
// int n = 0;
|
||||
// for (int i = 0; i < day.length; i++) {
|
||||
// System.out.printf("%-5s", " " + day[i]);
|
||||
// listYl.add(day[i]);
|
||||
// n++;
|
||||
// if (n == 7) {
|
||||
// System.out.println();
|
||||
// int k = mc.getweekDay();
|
||||
// for (int j = 0; j < k; j++) {
|
||||
// System.out.printf("%9s", "");
|
||||
// listNl.add("");
|
||||
// }
|
||||
// for (int j = k; j < 7; j++) {
|
||||
// System.out.printf("%4s", chineseday[j]);
|
||||
// listNl.add(chineseday[j]);
|
||||
// }
|
||||
// System.out.println();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (n % 7 == 0 && n != 7) {
|
||||
// System.out.println();
|
||||
// bool = true;
|
||||
// }
|
||||
// if (bool == true) {
|
||||
// for (int j = (n - 7); j < n; j++) {
|
||||
// System.out.printf("%4s", chineseday[j]);
|
||||
// listNl.add(chineseday[j]);
|
||||
// }
|
||||
// if (n != day.length) {
|
||||
// System.out.println();
|
||||
// }
|
||||
// bool = false;
|
||||
// }
|
||||
// if (n == day.length && n % 7 != 0) {
|
||||
// System.out.println();
|
||||
// for (int j = (n - n % 7); j < n; j++) {
|
||||
// System.out.printf("%4s", chineseday[j]);
|
||||
// listNl.add(chineseday[j]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// System.out.println();
|
||||
// System.out.println(listYl);
|
||||
// System.out.println(listNl);
|
||||
// ArrayList<Object> list = new ArrayList<>();
|
||||
// for (int k = 0; k < listYl.size(); k++) {
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// if (listYl.get(k) == "") {
|
||||
// jsonObject.put("yl", "");
|
||||
// jsonObject.put("nl", "");
|
||||
// } else {
|
||||
// jsonObject.put("yl", listYl.get(k));
|
||||
// jsonObject.put("nl", listNl.get(k));
|
||||
// }
|
||||
// list.add(jsonObject);
|
||||
// }
|
||||
// System.out.println(list);
|
||||
public Map<String,String> TGDZForYear(Date date) {
|
||||
MyCalendar myCalendar = new MyCalendar();
|
||||
myCalendar.setDate(date);
|
||||
Map<String, Integer> ct = myCalendar.getCT();
|
||||
System.out.println(ct);
|
||||
System.out.println(Arrays.toString(myCalendar.getchineseCalendar_festival_solarterms()));
|
||||
Integer year = ct.get("year");
|
||||
Integer month = ct.get("month");
|
||||
Integer day = ct.get("day");
|
||||
|
||||
|
||||
|
||||
String[] strings = mc.getchineseCalendar_festival_solarterms();
|
||||
return strings;
|
||||
// Integer day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
// String[] tg = TGDZ.tg;
|
||||
// String[] dz = TGDZ.dz;
|
||||
String[] tg = TGDZ.tg;
|
||||
String[] dz = TGDZ.dz;
|
||||
|
||||
//年份天干地支
|
||||
String c_year = myCalendar.getChinaYearString();
|
||||
|
||||
//月份天干地支
|
||||
Integer ty_c = year%10;
|
||||
Integer ty = ty_c<=3?ty_c+10-3:ty_c-3;
|
||||
Integer tm = ((ty*2 +month)%10)==0?10:((ty*2 +month)%10);
|
||||
String c_month = tg[tm-1]+dz[month-1];
|
||||
|
||||
HashMap<String, String> flagMap = new HashMap<>();
|
||||
flagMap.put("year",c_year);
|
||||
flagMap.put("month",c_month);
|
||||
|
||||
|
||||
|
||||
return flagMap;
|
||||
|
||||
// Integer y = year % 10;
|
||||
// if(y<=3){
|
||||
// y += 10;
|
||||
@@ -178,6 +113,9 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
||||
// String y_d = dz[month-1];
|
||||
//
|
||||
// return s+s1+"年 "+y_s+y_d+"月 ";
|
||||
|
||||
|
||||
// return null;
|
||||
}
|
||||
|
||||
private void createIds(Integer id, List<Integer> list){
|
||||
|
||||
Reference in New Issue
Block a user