|
@@ -4,6 +4,7 @@ import java.util.*;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.miaxis.common.config.ShiShenConfig;
|
|
|
+import com.miaxis.common.utils.DateUtils;
|
|
|
import com.miaxis.disease.domain.DiseasePart;
|
|
|
import com.miaxis.disease.dto.DiseasePartDto;
|
|
|
import com.miaxis.disease.mapper.DiseasePartMapper;
|
|
@@ -11,8 +12,11 @@ import com.miaxis.gan.dto.GanZhiDto;
|
|
|
import com.miaxis.gan.vo.GanZhiKongWangVo;
|
|
|
import com.miaxis.gan.vo.GanZhiNaYinVo;
|
|
|
import com.miaxis.gan.vo.GanZhiRowVo;
|
|
|
+import com.miaxis.jie.mapper.JieQiMapper;
|
|
|
+import com.miaxis.jie.vo.JieQiVo;
|
|
|
import com.miaxis.number.domain.NumberYun;
|
|
|
import com.miaxis.number.mapper.NumberYunMapper;
|
|
|
+import com.nlf.calendar.Lunar;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -40,6 +44,10 @@ public class GanZhiServiceImpl extends ServiceImpl<GanZhiMapper, GanZhi> impleme
|
|
|
@Autowired
|
|
|
private ShiShenConfig shiShenConfig;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private JieQiMapper jieQiMapper;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 查询天干地支列表
|
|
|
*
|
|
@@ -591,17 +599,17 @@ public class GanZhiServiceImpl extends ServiceImpl<GanZhiMapper, GanZhi> impleme
|
|
|
|
|
|
//五行得出疾病
|
|
|
List<DiseasePart> fivePartList = new ArrayList<DiseasePart>();
|
|
|
- Map<String,Integer> fiveCount = this.getGanZhiRowVoCount(ganZhiDto);
|
|
|
+ Map<String, Integer> fiveCount = this.getGanZhiRowVoCount(ganZhiDto);
|
|
|
for (String key : fiveCount.keySet()) {
|
|
|
- int count = fiveCount.get(key);
|
|
|
- if(count>=3) {
|
|
|
- List<String> partList = shiShenConfig.getFiveBuWei().get(key);
|
|
|
- DiseasePartDto fivePartDto = new DiseasePartDto();
|
|
|
- fivePartDto.setSex(sex);
|
|
|
- fivePartDto.setParts(partList);
|
|
|
- fivePartList = diseasePartMapper.selectDiseasePartList(fivePartDto);
|
|
|
- diseasePartAllList.addAll(fivePartList);
|
|
|
- }
|
|
|
+ int count = fiveCount.get(key);
|
|
|
+ if (count >= 3) {
|
|
|
+ List<String> partList = shiShenConfig.getFiveBuWei().get(key);
|
|
|
+ DiseasePartDto fivePartDto = new DiseasePartDto();
|
|
|
+ fivePartDto.setSex(sex);
|
|
|
+ fivePartDto.setParts(partList);
|
|
|
+ fivePartList = diseasePartMapper.selectDiseasePartList(fivePartDto);
|
|
|
+ diseasePartAllList.addAll(fivePartList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return diseasePartAllList;
|
|
@@ -638,6 +646,65 @@ public class GanZhiServiceImpl extends ServiceImpl<GanZhiMapper, GanZhi> impleme
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断出生日期是否在节气内
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GanZhiDto getDaYun(GanZhiDto ganZhiDto) {
|
|
|
+
|
|
|
+ int daYun = 0;
|
|
|
+ String tianGan = ganZhiDto.getYearGan();
|
|
|
+ String yy = shiShenConfig.getTianGanYY().get(tianGan);
|
|
|
+
|
|
|
+ if ("阳".equals(yy)) {
|
|
|
+ if (ganZhiDto.getSex() == 1) {
|
|
|
+ //顺行
|
|
|
+ daYun = 1;
|
|
|
+ } else if (ganZhiDto.getSex() == 2) {
|
|
|
+ //逆行
|
|
|
+ daYun = 2;
|
|
|
+ }
|
|
|
+ } else if ("阴".equals(yy)) {
|
|
|
+ if (ganZhiDto.getSex() == 1) {
|
|
|
+ //逆行
|
|
|
+ daYun = 2;
|
|
|
+ } else if (ganZhiDto.getSex() == 2) {
|
|
|
+ //顺行
|
|
|
+ daYun = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (daYun == 1) { //大运顺
|
|
|
+
|
|
|
+ } else if (daYun == 2) { //大运逆
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //判断当天是否是节气,如果在节前前, 月柱修改
|
|
|
+ Date d1 = DateUtils.parseDate(ganZhiDto.getBirthDay());
|
|
|
+ Lunar lunar = Lunar.fromDate(d1);
|
|
|
+ List<JieQiVo> list = jieQiMapper.selectJiiQiFb(d1);
|
|
|
+ if (lunar.getJieQi() != null && !"".equals(lunar.getJieQi())) {
|
|
|
+ //存在节气,如果第二个节气刚好当天相同
|
|
|
+ if(list.get(1).getJieqiName().equals(lunar.getJieQi())){
|
|
|
+ //把月时间清空,再取一次月柱
|
|
|
+ String birthday2 = ganZhiDto.getBirthDay().substring(0,10);
|
|
|
+ Date d2 = DateUtils.parseDate(birthday2);
|
|
|
+ Lunar lunar2 = Lunar.fromDate(d2);
|
|
|
+ ganZhiDto.setMonthGan(lunar2.getMonthGan());
|
|
|
+ ganZhiDto.setMonthZhi(lunar2.getMonthZhi());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 干支组装
|
|
|
*
|
|
@@ -728,6 +795,7 @@ public class GanZhiServiceImpl extends ServiceImpl<GanZhiMapper, GanZhi> impleme
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取五行数量
|
|
|
*
|
|
@@ -814,4 +882,5 @@ public class GanZhiServiceImpl extends ServiceImpl<GanZhiMapper, GanZhi> impleme
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|