|
|
|
|
@@ -20,6 +20,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static com.peanut.config.TGDZ.*;
|
|
|
|
|
|
|
|
|
|
@Service("pointService")
|
|
|
|
|
public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> implements PointService {
|
|
|
|
|
|
|
|
|
|
@@ -80,9 +82,6 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
Map<String, Integer> ct = myCalendar.getCT();
|
|
|
|
|
Integer tg_year = ct.get("tg_year");
|
|
|
|
|
Integer tg_month = ct.get("tg_month");
|
|
|
|
|
String[] tg = TGDZ.tg;
|
|
|
|
|
String[] dz = TGDZ.dz;
|
|
|
|
|
String[] dzz = TGDZ.dzz;
|
|
|
|
|
|
|
|
|
|
//年份天干地支
|
|
|
|
|
Integer ty_c = tg_year%10;
|
|
|
|
|
@@ -129,28 +128,45 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
}
|
|
|
|
|
flagMap.put("hour",tg[dcc]+dzz[s_d-1]);
|
|
|
|
|
|
|
|
|
|
//获取五运相关
|
|
|
|
|
boolean check_dh;
|
|
|
|
|
if(month==1&&getSolarTerm(year, 1, 2)>day){
|
|
|
|
|
check_dh = false;
|
|
|
|
|
}else {
|
|
|
|
|
check_dh = true;
|
|
|
|
|
}
|
|
|
|
|
return flagMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Object> yearWY = getYearWY(check_dh?year:year-1);
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> WYLQForDate(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);
|
|
|
|
|
HashMap<String, Object> flagMap = new HashMap<>();
|
|
|
|
|
if(month==1&&getSolarTerm(year, 1, 2)>day){
|
|
|
|
|
year--;
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> yearWY = getYearWY(year,month,day);
|
|
|
|
|
flagMap.put("wy",yearWY);
|
|
|
|
|
|
|
|
|
|
//获取六气相关
|
|
|
|
|
Map<String, Object> yearLQ = getYearLQ(check_dh?year:year-1);
|
|
|
|
|
Map<String, Object> yearLQ = getYearLQ(year,month,day);
|
|
|
|
|
flagMap.put("lq",yearLQ);
|
|
|
|
|
|
|
|
|
|
//杂项
|
|
|
|
|
Integer ty_c = year%10;
|
|
|
|
|
Integer ty = ty_c<=3?ty_c+10-3:ty_c-3;
|
|
|
|
|
String c_year_t = tg[ty-1];
|
|
|
|
|
Integer d = (year+7)%12;
|
|
|
|
|
if(d==0){
|
|
|
|
|
d=12;
|
|
|
|
|
}
|
|
|
|
|
String c_year_d = dz[d - 1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return flagMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String,Object> getYearLQ(Integer year){
|
|
|
|
|
String[] dz = TGDZ.dz;
|
|
|
|
|
private Map<String,Object> getYearLQ(Integer year,Integer month,Integer day){
|
|
|
|
|
Integer d = (year+7)%12;
|
|
|
|
|
if(d==0){
|
|
|
|
|
d=12;
|
|
|
|
|
@@ -182,7 +198,6 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
flag.put("time",time);
|
|
|
|
|
String[] zhuqi = {"厥阴","少阴","少阳","太阴","阳明","太阳"};
|
|
|
|
|
flag.put("zhuqi",zhuqi);
|
|
|
|
|
String[] lq = TGDZ.lq;
|
|
|
|
|
String sitian;
|
|
|
|
|
if(c_year_d=="子"||c_year_d=="午"){
|
|
|
|
|
sitian = "少阴";
|
|
|
|
|
@@ -203,12 +218,31 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
keqi.add(myAddLQ(i-2));keqi.add(myAddLQ(i-1));keqi.add(myAddLQ(i));keqi.add(myAddLQ(i+1));keqi.add(myAddLQ(i+2));keqi.add(myAddLQ(i+3));
|
|
|
|
|
flag.put("keqi",keqi);
|
|
|
|
|
|
|
|
|
|
//判断第几个是当前项目
|
|
|
|
|
int now_key;
|
|
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
|
|
now.set(year,month-1,day);
|
|
|
|
|
long timeInMillis = now.getTimeInMillis();
|
|
|
|
|
if(timeInMillis<chunFen.getTimeInMillis()){
|
|
|
|
|
now_key = 0;
|
|
|
|
|
} else if (timeInMillis<xiaoMan.getTimeInMillis()) {
|
|
|
|
|
now_key = 1;
|
|
|
|
|
} else if (timeInMillis<daShu.getTimeInMillis()) {
|
|
|
|
|
now_key = 2;
|
|
|
|
|
} else if (timeInMillis<qiufen.getTimeInMillis()) {
|
|
|
|
|
now_key = 3;
|
|
|
|
|
} else if (timeInMillis<xiaoxue.getTimeInMillis()){
|
|
|
|
|
now_key = 4;
|
|
|
|
|
} else {
|
|
|
|
|
now_key = 5;
|
|
|
|
|
}
|
|
|
|
|
flag.put("now",now_key);
|
|
|
|
|
|
|
|
|
|
return flag;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String myAddLQ(int i){
|
|
|
|
|
String[] lq = TGDZ.lq;
|
|
|
|
|
if(i<0){
|
|
|
|
|
return lq[i+6];
|
|
|
|
|
} else if (i>5) {
|
|
|
|
|
@@ -223,8 +257,7 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
* @param year 年2013
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private Map<String,Object> getYearWY(Integer year){
|
|
|
|
|
String[] tg = TGDZ.tg;
|
|
|
|
|
private Map<String,Object> getYearWY(Integer year,Integer month,Integer day){
|
|
|
|
|
Integer ty_c = year%10;
|
|
|
|
|
Integer ty = ty_c<=3?ty_c+10-3:ty_c-3;
|
|
|
|
|
String c_year_t = tg[ty-1];
|
|
|
|
|
@@ -270,7 +303,24 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
}else {
|
|
|
|
|
nianYun = "火";
|
|
|
|
|
}
|
|
|
|
|
String[] wx = TGDZ.wx;
|
|
|
|
|
|
|
|
|
|
//判断第几个是当前项目
|
|
|
|
|
int now_key;
|
|
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
|
|
now.set(year,month-1,day);
|
|
|
|
|
long timeInMillis = now.getTimeInMillis();
|
|
|
|
|
if(timeInMillis<chunFen.getTimeInMillis()){
|
|
|
|
|
now_key = 0;
|
|
|
|
|
} else if (timeInMillis<mangZhong.getTimeInMillis()) {
|
|
|
|
|
now_key = 1;
|
|
|
|
|
} else if (timeInMillis<chuShu.getTimeInMillis()) {
|
|
|
|
|
now_key = 2;
|
|
|
|
|
} else if (timeInMillis<liDong.getTimeInMillis()) {
|
|
|
|
|
now_key = 3;
|
|
|
|
|
} else {
|
|
|
|
|
now_key = 4;
|
|
|
|
|
}
|
|
|
|
|
flag.put("now",now_key);
|
|
|
|
|
flag.put("nianYun",nianYun);
|
|
|
|
|
flag.put("zhuYun",wx);
|
|
|
|
|
List<String> list = Arrays.asList(wx);
|
|
|
|
|
@@ -287,7 +337,6 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String mygetWx(int i){
|
|
|
|
|
String[] wx = TGDZ.wx;
|
|
|
|
|
if(i>=5){
|
|
|
|
|
return wx[i-5];
|
|
|
|
|
}else{
|
|
|
|
|
@@ -310,7 +359,6 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
if(year==2024&&month==1&&day==1){
|
|
|
|
|
return "甲子";
|
|
|
|
|
}
|
|
|
|
|
String[] dzr = TGDZ.dzr;
|
|
|
|
|
Calendar basedate = Calendar.getInstance();
|
|
|
|
|
basedate.set(2024, 1 - 1, 1);
|
|
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
|
|
@@ -335,14 +383,11 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private int getSolarTerm(Integer year,Integer month,Integer num){
|
|
|
|
|
double D = TGDZ.D;
|
|
|
|
|
double[] s20 = TGDZ.S20;
|
|
|
|
|
double[] s21 = TGDZ.S21;
|
|
|
|
|
double[] sc = null;
|
|
|
|
|
if (year >= 1901 && year <= 2000) {// 20世纪
|
|
|
|
|
sc =s20;
|
|
|
|
|
sc =S20;
|
|
|
|
|
} else if (year >= 2001 && year <= 2100) {// 21世纪
|
|
|
|
|
sc =s21;
|
|
|
|
|
sc =S21;
|
|
|
|
|
}
|
|
|
|
|
double C=num==1?sc[(month) * 2 - 1 - 1]:sc[month * 2 - 1];
|
|
|
|
|
int Y = year % 100;
|
|
|
|
|
|