老哥这点建议换成表驱动
`
String d = lunarDTO.getMonth() + (lunarDTO.getMonth().length() < 2 ? "月" : "") + lunarDTO.getDay();
| if (!lunarDTO.getLeapMonth()) { | if ("正月初一".equals(d)) { | happyDay += "春节 "; | flag = 1; | } | if ("正月初二".equals(d)) { | majorDay += "大年初二 "; | flag = 1; | } | if ("五月初五".equals(d)) { | happyDay += "端午节 "; | flag = 1; | } | if ("八月十五".equals(d)) { | happyDay += "中秋节 "; | flag = 1; | } | if ("腊月初八".equals(d)) { | majorDay += "腊八节 "; | } | if ("正月十五".equals(d)) { | happyDay += "元宵节 "; | majorDay += "上元节 "; | otherDay += "壮族歌墟节 苗族踩山节 达斡尔族卡钦 "; | } | if ("正月十六".equals(d)) { | otherDay += "侗族芦笙节(至正月二十) "; | } | if ("正月廿五".equals(d)) { | otherDay += "填仓节 "; | } | if ("正月廿九".equals(d)) { | otherDay += "送穷日 "; | } | if ("二月初一".equals(d)) { | otherDay += "瑶族忌鸟节 "; | } | if ("二月初二".equals(d)) { | majorDay += "春龙节(龙抬头) "; | otherDay += "畲族会亲节 "; | } | if ("二月初八".equals(d)) { | otherDay += "傈傈族刀杆节 "; | } | if ("三月初三".equals(d)) { | majorDay += "北帝诞 "; | otherDay += "苗族黎族歌墟节 "; | } | if ("三月十五".equals(d)) { | otherDay += "白族三月街(至三月二十) "; | } | if ("三月廿三".equals(d)) { | majorDay += "天后诞 妈祖诞 "; | } | if ("四月初八".equals(d)) { | majorDay += "牛王诞 "; | } | if ("四月十八".equals(d)) { | otherDay += "锡伯族西迁节 "; | } | if ("五月十三".equals(d)) { | majorDay += "关帝诞 "; | otherDay += "阿昌族泼水节 "; | } | if ("五月廿二".equals(d)) { | otherDay += "鄂温克族米阔鲁节 "; | } | if ("五月廿九".equals(d)) { | otherDay += "瑶族达努节 "; | } | if ("六月初六".equals(d)) { | majorDay += "姑姑节 天贶节 "; | otherDay += "壮族祭田节 瑶族尝新节 "; | } | if ("六月廿四".equals(d)) { | otherDay += "火把节、星回节(彝、白、佤、阿昌、纳西、基诺族 ) "; | } | if ("七月初七".equals(d)) { | majorDay += "七夕(中国情人节,乞巧节,女儿节 ) "; | } | if ("七月十三".equals(d)) { | otherDay += "侗族吃新节 "; | } | if ("七月十五".equals(d)) { | majorDay += "中元节 鬼节"; | } | if ("九月初九".equals(d)) { | majorDay += "重阳节 "; | } | if ("十月初一".equals(d)) { | majorDay += "祭祖节(十月朝) "; | } | if ("十月十五".equals(d)) { | majorDay += "下元节 "; | } | if ("十月十六".equals(d)) { | otherDay += "瑶族盘王节 "; | } | if ("十二初八".equals(d)) { | majorDay += "腊八节 "; | } | } | if ("正".equals(lunarDTO.getNextMonth())) { // 最后一月 | if ("十二三十".equals(d) && lunarDTO.getDaysOfMonth() == 30) { | happyDay += "除夕 "; | flag = 1; | } | if ("十二廿九".equals(d) && lunarDTO.getDaysOfMonth() == 29) { | happyDay += "除夕 "; | flag = 1; | } | if ("十二廿三".equals(d)) { | majorDay += "小年 "; | } | } | if (solarTermDTO.getName() != null && !"".equals(solarTermDTO.getName())) { | if ("清明".equals(solarTermDTO.getName())) { | happyDay += solarTermDTO.getName() + " "; | flag = 1; | } else { | majorDay += solarTermDTO.getName() + " "; | }
`
嗯,有计划重构一下。欢迎提PR
好的好的 哈哈