示例#1
0
 /**
  * 单宫6位号码局.
  *
  * @param condition.输入的6个数字串.
  * @return
  */
 public List<Pan> getSixNumPanData(String condition) {
   Map<String, Object> paipanDataMap = new HashMap<String, Object>();
   List<Pan> list = new ArrayList<Pan>();
   ArrayList<String> juType = new ArrayList<String>();
   juType.add("感情");
   juType.add("事业");
   juType.add("健康");
   juType.add("财运");
   juType.add("其他 ");
   paipanDataMap = QiMenUtil.get6NumPan(condition);
   Pan pan = QiMenUtil.setColorPoint4Pan(paipanDataMap, 1);
   pan.setJuType(juType);
   list.add(pan);
   return list;
 }
示例#2
0
  public List<Pan> getShiPanData(String dateStr, int dateType, int conditionType, String option) {
    JSONObject json = null;
    Map<String, Object> paipanParaMap = new HashMap<String, Object>();
    Map<String, Object> paipanDataMap = new HashMap<String, Object>();
    // 原始未着色数据.
    Map<String, Object> originalDataMap = new HashMap<String, Object>();
    // 返回的所有数据.
    List<Pan> allDataList = new ArrayList<Pan>();
    // 四柱.
    Map<String, String> sizhumap = new HashMap<String, String>();
    Pan pan1 = new Pan();
    int ju = -1; // 局数
    int yinyang = -1; // 阴阳.
    String shizhi = "";
    String shizhu = "";
    String kezhu = "";
    int panType = 1;

    sizhumap = Lunar.getSizhu(dateStr);
    // 默认时盘.
    if (conditionType == 0) {

      // 心数
    } else if (conditionType == 1) {
      ju = Lunar.getJuByHeartNum(Integer.parseInt(option));

      // 姓名
    } else if (conditionType == 3) {
      ju = HanDict.getJu(option).get("ju");
      shizhi = QiMenMsg.dizhi[HanDict.getJu(option).get("shizhi") - 1];
      String rizhu = sizhumap.get("nianzhu");
      shizhu = Lunar.getKeZhu(dateStr, shizhi, rizhu.substring(0, 1));
      // 刻盘
    } else if (conditionType == 4) {

      String kezhi = Lunar.getKezhi(dateStr);
      String shigan = Lunar.getSizhu(dateStr).get("shizhu").substring(0, 1);
      kezhu = Lunar.getKeZhu(dateStr, kezhi, shigan);
      shizhu = kezhu;
      sizhumap.put("kezhu", kezhu);
      panType = 0;
    }
    try {
      paipanParaMap = Lunar.getPaiPanParaByDate(dateStr, dateType, panType);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // 如果局数、阴阳、时柱没有被赋值的话,则从map中取出来.
    if (ju == -1) {
      ju = (Integer) paipanParaMap.get("ju");
    }
    if (yinyang == -1) {
      yinyang = (Integer) paipanParaMap.get("yinyang");
    }
    if (shizhu == "") {
      shizhu = sizhumap.get("shizhu");
    }

    originalDataMap = QiMenUtil.getPanData(ju, yinyang, shizhu);

    if (conditionType == 2) {
      pan1 = QiMenUtil.setColorPoint4Pan(originalDataMap, 1);
    } else {
      pan1 = QiMenUtil.setColorPoint4Pan(originalDataMap, 0);
    }

    // 依次是公历  农历 月将 节气
    /*paipanDataMap.put("gongli", paipanParaMap.get("gongli"));
    paipanDataMap.put("nongli", paipanParaMap.get("nongli"));
    paipanDataMap.put("yuejiang", paipanParaMap.get("yuejiang"));
    paipanDataMap.put("jieqi", paipanParaMap.get("jieqi"));
    paipanDataMap.put("sizhu", sizhumap.get("nianzhu")+" "+sizhumap.get("yuezhu")+" "
    +sizhumap.get("rizhu")+" "+shizhu+" "+sizhumap.get("kezhu"));
    paipanDataMap.put("zhifu", originalDataMap.get("zhifu"));
    paipanDataMap.put("zhishi", originalDataMap.get("zhishi"));
    paipanDataMap.put("shikongwang", originalDataMap.get("shikongwang"));
    paipanDataMap.put("maxin", originalDataMap.get("maxin"));*/
    pan1.setNongli((String) paipanParaMap.get("nongli"));
    pan1.setGongli((String) paipanParaMap.get("gongli"));
    pan1.setYuejiang((String) paipanParaMap.get("yuejiang"));
    pan1.setJieqi((String) paipanParaMap.get("jieqi"));
    pan1.setSizhu(
        sizhumap.get("nianzhu")
            + " "
            + sizhumap.get("yuezhu")
            + " "
            + sizhumap.get("rizhu")
            + " "
            + sizhumap.get("shizhu")
            + " "
            + sizhumap.get("kezhu"));
    pan1.setZhifu((String) originalDataMap.get("zhifu"));
    pan1.setZhishi((String) originalDataMap.get("zhishi"));
    pan1.setShikognwang((String) originalDataMap.get("shikongwang"));
    pan1.setMaxin((String) originalDataMap.get("maxin"));
    pan1.setTianmendihu((ArrayList<String>) originalDataMap.get("tianmendihu"));
    pan1.setMa((Map<String, Object>) originalDataMap.get("ma"));

    ArrayList<String> juType = new ArrayList<String>();
    juType.add("感情");
    juType.add("事业");
    juType.add("健康");
    juType.add("财运");
    juType.add("其他 ");
    pan1.setJuType(juType);
    // 不同的条件显示不同的遁局.
    if (conditionType == 1) {
      pan1.setDunju("心数局  " + paipanParaMap.get("dunju").toString().substring(0, 2) + ju + "局");
    } else if (conditionType == 3) {
      pan1.setDunju("姓名局  " + paipanParaMap.get("dunju").toString().substring(0, 2) + ju + "局");
    } else {
      pan1.setDunju(paipanParaMap.get("dunju") + "");
    }

    allDataList.add(pan1);
    for (int i = 1; i < 8; i++) {
      Pan pan = new Pan();
      pan = QiMenUtil.setColorPoint4Pan(QiMenUtil.getShunZhuan(i, originalDataMap), 0);
      allDataList.add(pan);
    }
    System.out.println(
        "所有的:"
            + JSONObject.toJSONString(
                allDataList, SerializerFeature.DisableCircularReferenceDetect));
    return allDataList;
  }