feat(admin): 添加用户管理相关文件

添加用户管理视图、API和状态管理文件
This commit is contained in:
张翔
2026-03-28 14:37:29 +08:00
commit 08ea5fbe98
1643 changed files with 255646 additions and 0 deletions
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.destiny</groupId>
<artifactId>everything-is-suitable-api</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>everything-is-suitable-biz</artifactId>
<packaging>jar</packaging>
<name>Everything Is Suitable Biz</name>
<description>Business module for Everything Is Suitable API</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.destiny</groupId>
<artifactId>everything-is-suitable-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.destiny</groupId>
<artifactId>everything-is-suitable-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,15 @@
package io.destiny.biz.config;
import io.destiny.biz.exception.AlmanacExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.server.WebExceptionHandler;
@Configuration
public class AlmanacExceptionHandlerConfig {
@Bean
public WebExceptionHandler almanacExceptionHandler() {
return new AlmanacExceptionHandler();
}
}
@@ -0,0 +1,51 @@
package io.destiny.biz.config;
import io.destiny.biz.handler.AlmanacHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.RouterOperation;
import org.springdoc.core.annotations.RouterOperations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.accept;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
@Configuration
@Tag(name = "黄历", description = "黄历相关接口")
public class AlmanacRouter {
private final AlmanacHandler almanacHandler;
public AlmanacRouter(AlmanacHandler almanacHandler) {
this.almanacHandler = almanacHandler;
}
@Bean
@RouterOperations({
@RouterOperation(
path = "/almanac/range",
method = RequestMethod.GET,
beanClass = AlmanacHandler.class,
beanMethod = "getAlmanacsByRange"
),
@RouterOperation(
path = "/almanac/{date}",
method = RequestMethod.GET,
beanClass = AlmanacHandler.class,
beanMethod = "getAlmanacByDate"
)
})
@Operation(summary = "黄历路由配置")
public RouterFunction<ServerResponse> almanacRoutes() {
return route()
.path("/almanac", builder -> builder
.GET("/range", accept(MediaType.APPLICATION_JSON), almanacHandler::getAlmanacsByRange)
.GET("/{date}", accept(MediaType.APPLICATION_JSON), almanacHandler::getAlmanacByDate))
.build();
}
}
@@ -0,0 +1,44 @@
package io.destiny.biz.config;
import io.destiny.biz.handler.AlmanacSearchHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.RouterOperation;
import org.springdoc.core.annotations.RouterOperations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.accept;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
@Configuration
@Tag(name = "黄历搜索", description = "黄历高级搜索相关接口")
public class AlmanacSearchRouter {
private final AlmanacSearchHandler almanacSearchHandler;
public AlmanacSearchRouter(AlmanacSearchHandler almanacSearchHandler) {
this.almanacSearchHandler = almanacSearchHandler;
}
@Bean
@RouterOperations({
@RouterOperation(
path = "/almanac/search",
method = RequestMethod.POST,
beanClass = AlmanacSearchHandler.class,
beanMethod = "search"
)
})
@Operation(summary = "黄历搜索路由配置")
public RouterFunction<ServerResponse> almanacSearchRoutes() {
return route()
.path("/almanac", builder -> builder
.POST("/search", accept(MediaType.APPLICATION_JSON), almanacSearchHandler::search))
.build();
}
}
@@ -0,0 +1,38 @@
package io.destiny.biz.config;
import io.destiny.biz.handler.CalendarHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.RouterOperation;
import org.springdoc.core.annotations.RouterOperations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.accept;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
@Configuration
@Tag(name = "日历转换", description = "日历转换相关接口")
public class CalendarRouter {
@Bean
@RouterOperations({
@RouterOperation(
path = "/calendar/convert",
method = RequestMethod.POST,
beanClass = CalendarHandler.class,
beanMethod = "convertToLunar"
)
})
@Operation(summary = "日历转换路由配置")
public RouterFunction<ServerResponse> calendarRoutes(CalendarHandler calendarHandler) {
return route()
.path("/calendar", builder -> builder
.POST("/convert", accept(MediaType.APPLICATION_JSON), calendarHandler::convertToLunar))
.build();
}
}
@@ -0,0 +1,128 @@
package io.destiny.biz.config;
import io.destiny.biz.handler.FortuneHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.RouterOperation;
import org.springdoc.core.annotations.RouterOperations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.*;
@Configuration
@Tag(name = "运势分析", description = "运势分析相关接口")
public class FortuneRouter {
private final FortuneHandler fortuneHandler;
public FortuneRouter(FortuneHandler fortuneHandler) {
this.fortuneHandler = fortuneHandler;
}
@Bean
@RouterOperations({
@RouterOperation(
path = "/fortune/daily",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getDailyFortune"
),
@RouterOperation(
path = "/fortune/monthly",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getMonthlyFortune"
),
@RouterOperation(
path = "/fortune/yearly",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getYearlyFortune"
),
@RouterOperation(
path = "/fortune/overall",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getOverallFortune"
),
@RouterOperation(
path = "/fortune/batch/daily",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "batchDailyFortune"
),
@RouterOperation(
path = "/fortune/batch/monthly",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "batchMonthlyFortune"
),
@RouterOperation(
path = "/fortune/batch/yearly",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "batchYearlyFortune"
),
@RouterOperation(
path = "/fortune/history",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getFortuneHistory"
),
@RouterOperation(
path = "/fortune/trend",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getFortuneTrend"
),
@RouterOperation(
path = "/fortune/love",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getLoveFortune"
),
@RouterOperation(
path = "/fortune/study",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getStudyFortune"
),
@RouterOperation(
path = "/fortune/social",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getSocialFortune"
),
@RouterOperation(
path = "/fortune/travel",
method = RequestMethod.POST,
beanClass = FortuneHandler.class,
beanMethod = "getTravelFortune"
)
})
@Operation(summary = "运势分析路由配置")
public RouterFunction<ServerResponse> fortuneRoutes() {
return RouterFunctions.route()
.path("/fortune", builder -> builder
.POST("/daily", accept(MediaType.APPLICATION_JSON), fortuneHandler::getDailyFortune)
.POST("/monthly", accept(MediaType.APPLICATION_JSON), fortuneHandler::getMonthlyFortune)
.POST("/yearly", accept(MediaType.APPLICATION_JSON), fortuneHandler::getYearlyFortune)
.POST("/overall", accept(MediaType.APPLICATION_JSON), fortuneHandler::getOverallFortune)
.POST("/batch/daily", accept(MediaType.APPLICATION_JSON), fortuneHandler::batchDailyFortune)
.POST("/batch/monthly", accept(MediaType.APPLICATION_JSON), fortuneHandler::batchMonthlyFortune)
.POST("/batch/yearly", accept(MediaType.APPLICATION_JSON), fortuneHandler::batchYearlyFortune)
.POST("/history", accept(MediaType.APPLICATION_JSON), fortuneHandler::getFortuneHistory)
.POST("/trend", accept(MediaType.APPLICATION_JSON), fortuneHandler::getFortuneTrend)
.POST("/love", accept(MediaType.APPLICATION_JSON), fortuneHandler::getLoveFortune)
.POST("/study", accept(MediaType.APPLICATION_JSON), fortuneHandler::getStudyFortune)
.POST("/social", accept(MediaType.APPLICATION_JSON), fortuneHandler::getSocialFortune)
.POST("/travel", accept(MediaType.APPLICATION_JSON), fortuneHandler::getTravelFortune))
.build();
}
}
@@ -0,0 +1,59 @@
package io.destiny.biz.config;
import io.destiny.biz.handler.LunarCalendarHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.RouterOperation;
import org.springdoc.core.annotations.RouterOperations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.accept;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
@Configuration
@Tag(name = "农历日历", description = "农历日历相关接口")
public class LunarCalendarRouter {
@Bean
@RouterOperations({
@RouterOperation(
path = "/lunar-calendar/convert",
method = RequestMethod.POST,
beanClass = LunarCalendarHandler.class,
beanMethod = "convertSolarToLunar"
),
@RouterOperation(
path = "/lunar-calendar/zodiac",
method = RequestMethod.POST,
beanClass = LunarCalendarHandler.class,
beanMethod = "getZodiac"
),
@RouterOperation(
path = "/lunar-calendar/solar-term",
method = RequestMethod.POST,
beanClass = LunarCalendarHandler.class,
beanMethod = "getSolarTerm"
),
@RouterOperation(
path = "/lunar-calendar/is-leap-month",
method = RequestMethod.POST,
beanClass = LunarCalendarHandler.class,
beanMethod = "isLeapMonth"
)
})
@Operation(summary = "农历日历路由配置")
public RouterFunction<ServerResponse> lunarCalendarRoutes(LunarCalendarHandler lunarCalendarHandler) {
return route()
.path("/lunar-calendar", builder -> builder
.POST("/convert", accept(MediaType.APPLICATION_JSON), lunarCalendarHandler::convertSolarToLunar)
.POST("/zodiac", accept(MediaType.APPLICATION_JSON), lunarCalendarHandler::getZodiac)
.POST("/solar-term", accept(MediaType.APPLICATION_JSON), lunarCalendarHandler::getSolarTerm)
.POST("/is-leap-month", accept(MediaType.APPLICATION_JSON), lunarCalendarHandler::isLeapMonth))
.build();
}
}
@@ -0,0 +1,86 @@
package io.destiny.biz.config;
import io.destiny.biz.handler.ZiweiHandler;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.RouterOperation;
import org.springdoc.core.annotations.RouterOperations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;
import static org.springframework.web.reactive.function.server.RequestPredicates.*;
@Configuration
@Tag(name = "紫微斗数", description = "紫微斗数相关接口")
public class ZiweiRouter {
private final ZiweiHandler ziweiHandler;
public ZiweiRouter(ZiweiHandler ziweiHandler) {
this.ziweiHandler = ziweiHandler;
}
@Bean
@RouterOperations({
@RouterOperation(
path = "/ziwei/chart",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "generateChart"
),
@RouterOperation(
path = "/ziwei/palaces",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "getAllPalaces"
),
@RouterOperation(
path = "/ziwei/palace/{palaceType}",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "getPalaceByType"
),
@RouterOperation(
path = "/ziwei/ming-shen-gong",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "getMingShenGong"
),
@RouterOperation(
path = "/ziwei/palace/{palaceType}/stars",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "getPalaceStars"
),
@RouterOperation(
path = "/ziwei/palace/luck",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "analyzePalaceLuck"
),
@RouterOperation(
path = "/ziwei/palace/branch/{branch}",
method = RequestMethod.POST,
beanClass = ZiweiHandler.class,
beanMethod = "getPalaceByBranch"
)
})
@Operation(summary = "紫微斗数路由配置")
public RouterFunction<ServerResponse> ziweiRoutes() {
return RouterFunctions.route()
.path("/ziwei", builder -> builder
.POST("/chart", accept(MediaType.APPLICATION_JSON), ziweiHandler::generateChart)
.POST("/palaces", accept(MediaType.APPLICATION_JSON), ziweiHandler::getAllPalaces)
.POST("/palace/{palaceType}", accept(MediaType.APPLICATION_JSON), ziweiHandler::getPalaceByType)
.POST("/ming-shen-gong", accept(MediaType.APPLICATION_JSON), ziweiHandler::getMingShenGong)
.POST("/palace/{palaceType}/stars", accept(MediaType.APPLICATION_JSON), ziweiHandler::getPalaceStars)
.POST("/palace/luck", accept(MediaType.APPLICATION_JSON), ziweiHandler::analyzePalaceLuck)
.POST("/palace/branch/{branch}", accept(MediaType.APPLICATION_JSON), ziweiHandler::getPalaceByBranch))
.build();
}
}
@@ -0,0 +1,353 @@
package io.destiny.biz.domain;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
import java.util.List;
public class Almanac {
private LocalDateTime solarDate;
private LunarDate lunarDate;
private List<String> suitable;
private List<String> unsuitable;
private String godDirection;
private String joyDirection;
private String fortuneDirection;
private String nobleDirection;
private String clash;
private String evil;
private String jianChu;
private String starGod;
private String naYin;
private String fetusGod;
private String pengzuTaboo;
public Almanac() {
}
public Almanac(LocalDateTime solarDate, LunarDate lunarDate, List<String> suitable, List<String> unsuitable, String godDirection, String joyDirection, String fortuneDirection, String nobleDirection, String clash, String evil, String jianChu, String starGod, String naYin, String fetusGod, String pengzuTaboo) {
this.solarDate = solarDate;
this.lunarDate = lunarDate;
this.suitable = suitable;
this.unsuitable = unsuitable;
this.godDirection = godDirection;
this.joyDirection = joyDirection;
this.fortuneDirection = fortuneDirection;
this.nobleDirection = nobleDirection;
this.clash = clash;
this.evil = evil;
this.jianChu = jianChu;
this.starGod = starGod;
this.naYin = naYin;
this.fetusGod = fetusGod;
this.pengzuTaboo = pengzuTaboo;
}
public LocalDateTime getSolarDate() {
return solarDate;
}
public void setSolarDate(LocalDateTime solarDate) {
this.solarDate = solarDate;
}
public LunarDate getLunarDate() {
return lunarDate;
}
public void setLunarDate(LunarDate lunarDate) {
this.lunarDate = lunarDate;
}
public List<String> getSuitable() {
return suitable;
}
public void setSuitable(List<String> suitable) {
this.suitable = suitable;
}
public List<String> getUnsuitable() {
return unsuitable;
}
public void setUnsuitable(List<String> unsuitable) {
this.unsuitable = unsuitable;
}
public String getGodDirection() {
return godDirection;
}
public void setGodDirection(String godDirection) {
this.godDirection = godDirection;
}
public String getJoyDirection() {
return joyDirection;
}
public void setJoyDirection(String joyDirection) {
this.joyDirection = joyDirection;
}
public String getFortuneDirection() {
return fortuneDirection;
}
public void setFortuneDirection(String fortuneDirection) {
this.fortuneDirection = fortuneDirection;
}
public String getNobleDirection() {
return nobleDirection;
}
public void setNobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
}
public String getClash() {
return clash;
}
public void setClash(String clash) {
this.clash = clash;
}
public String getEvil() {
return evil;
}
public void setEvil(String evil) {
this.evil = evil;
}
public String getJianChu() {
return jianChu;
}
public void setJianChu(String jianChu) {
this.jianChu = jianChu;
}
public String getStarGod() {
return starGod;
}
public void setStarGod(String starGod) {
this.starGod = starGod;
}
public String getNaYin() {
return naYin;
}
public void setNaYin(String naYin) {
this.naYin = naYin;
}
public String getFetusGod() {
return fetusGod;
}
public void setFetusGod(String fetusGod) {
this.fetusGod = fetusGod;
}
public String getPengzuTaboo() {
return pengzuTaboo;
}
public void setPengzuTaboo(String pengzuTaboo) {
this.pengzuTaboo = pengzuTaboo;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Almanac almanac = (Almanac) o;
return new EqualsBuilder()
.append(solarDate, almanac.solarDate)
.append(lunarDate, almanac.lunarDate)
.append(suitable, almanac.suitable)
.append(unsuitable, almanac.unsuitable)
.append(godDirection, almanac.godDirection)
.append(joyDirection, almanac.joyDirection)
.append(fortuneDirection, almanac.fortuneDirection)
.append(nobleDirection, almanac.nobleDirection)
.append(clash, almanac.clash)
.append(evil, almanac.evil)
.append(jianChu, almanac.jianChu)
.append(starGod, almanac.starGod)
.append(naYin, almanac.naYin)
.append(fetusGod, almanac.fetusGod)
.append(pengzuTaboo, almanac.pengzuTaboo)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(solarDate)
.append(lunarDate)
.append(suitable)
.append(unsuitable)
.append(godDirection)
.append(joyDirection)
.append(fortuneDirection)
.append(nobleDirection)
.append(clash)
.append(evil)
.append(jianChu)
.append(starGod)
.append(naYin)
.append(fetusGod)
.append(pengzuTaboo)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("solarDate", solarDate)
.append("lunarDate", lunarDate)
.append("suitable", suitable)
.append("unsuitable", unsuitable)
.append("godDirection", godDirection)
.append("joyDirection", joyDirection)
.append("fortuneDirection", fortuneDirection)
.append("nobleDirection", nobleDirection)
.append("clash", clash)
.append("evil", evil)
.append("jianChu", jianChu)
.append("starGod", starGod)
.append("naYin", naYin)
.append("fetusGod", fetusGod)
.append("pengzuTaboo", pengzuTaboo)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private LocalDateTime solarDate;
private LunarDate lunarDate;
private List<String> suitable;
private List<String> unsuitable;
private String godDirection;
private String joyDirection;
private String fortuneDirection;
private String nobleDirection;
private String clash;
private String evil;
private String jianChu;
private String starGod;
private String naYin;
private String fetusGod;
private String pengzuTaboo;
public Builder solarDate(LocalDateTime solarDate) {
this.solarDate = solarDate;
return this;
}
public Builder lunarDate(LunarDate lunarDate) {
this.lunarDate = lunarDate;
return this;
}
public Builder suitable(List<String> suitable) {
this.suitable = suitable;
return this;
}
public Builder unsuitable(List<String> unsuitable) {
this.unsuitable = unsuitable;
return this;
}
public Builder godDirection(String godDirection) {
this.godDirection = godDirection;
return this;
}
public Builder joyDirection(String joyDirection) {
this.joyDirection = joyDirection;
return this;
}
public Builder fortuneDirection(String fortuneDirection) {
this.fortuneDirection = fortuneDirection;
return this;
}
public Builder nobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
return this;
}
public Builder clash(String clash) {
this.clash = clash;
return this;
}
public Builder evil(String evil) {
this.evil = evil;
return this;
}
public Builder jianChu(String jianChu) {
this.jianChu = jianChu;
return this;
}
public Builder starGod(String starGod) {
this.starGod = starGod;
return this;
}
public Builder naYin(String naYin) {
this.naYin = naYin;
return this;
}
public Builder fetusGod(String fetusGod) {
this.fetusGod = fetusGod;
return this;
}
public Builder pengzuTaboo(String pengzuTaboo) {
this.pengzuTaboo = pengzuTaboo;
return this;
}
public Almanac build() {
return new Almanac(solarDate, lunarDate, suitable, unsuitable, godDirection, joyDirection, fortuneDirection, nobleDirection, clash, evil, jianChu, starGod, naYin, fetusGod, pengzuTaboo);
}
}
}
@@ -0,0 +1,797 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.EarthlyBranch;
import io.destiny.biz.enums.HeavenlyStem;
import io.destiny.biz.util.TrueSolarTimeUtil;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
/**
* 出生信息类,用于表示命主的出生信息
* 包含出生时间、天干地支、性别、时区、经纬度、真太阳时等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class BirthInfo {
/** 主键ID */
private Long id;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 出生时间 */
private LocalDateTime birthTime;
/** 年干 */
private HeavenlyStem yearStem;
/** 月干 */
private HeavenlyStem monthStem;
/** 日干 */
private HeavenlyStem dayStem;
/** 时干 */
private HeavenlyStem hourStem;
/** 年支 */
private EarthlyBranch yearBranch;
/** 月支 */
private EarthlyBranch monthBranch;
/** 日支 */
private EarthlyBranch dayBranch;
/** 时支 */
private EarthlyBranch hourBranch;
/** 性别(MALE:男,FEMALE:女) */
private String gender;
/** 时区 */
private String timezone;
/** 经度 */
private Double longitude;
/** 纬度 */
private Double latitude;
/** 真太阳时 */
private LocalDateTime trueSolarTime;
/** 农历日期信息 */
private LunarDate lunarDate;
/**
* 默认构造函数
*/
public BirthInfo() {
}
/**
* 生成主键ID
*
* @return 主键ID
*/
public Long generateId() {
this.id = SnowflakeId.nextId();
return this.id;
}
/**
* 删除出生信息
*/
public void delete() {
this.deletedAt = LocalDateTime.now();
}
/**
* 获取主键ID
*
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
*
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
*
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
/**
* 根据出生时间和天干地支创建出生信息
*
* @param birthTime 出生时间
* @param yearStem 年干
* @param monthStem 月干
* @param dayStem 日干
* @param hourStem 时干
* @param yearBranch 年支
* @param monthBranch 月支
* @param dayBranch 日支
* @param hourBranch 时支
* @param gender 性别
* @param timezone 时区
*/
public BirthInfo(LocalDateTime birthTime, HeavenlyStem yearStem, HeavenlyStem monthStem, HeavenlyStem dayStem,
HeavenlyStem hourStem, EarthlyBranch yearBranch, EarthlyBranch monthBranch, EarthlyBranch dayBranch,
EarthlyBranch hourBranch, String gender, String timezone) {
this.birthTime = birthTime;
this.yearStem = yearStem;
this.monthStem = monthStem;
this.dayStem = dayStem;
this.hourStem = hourStem;
this.yearBranch = yearBranch;
this.monthBranch = monthBranch;
this.dayBranch = dayBranch;
this.hourBranch = hourBranch;
this.gender = gender;
this.timezone = timezone;
}
/**
* 根据出生时间、天干地支和经纬度创建出生信息
*
* @param birthTime 出生时间
* @param yearStem 年干
* @param monthStem 月干
* @param dayStem 日干
* @param hourStem 时干
* @param yearBranch 年支
* @param monthBranch 月支
* @param dayBranch 日支
* @param hourBranch 时支
* @param gender 性别
* @param timezone 时区
* @param longitude 经度
* @param latitude 纬度
*/
public BirthInfo(LocalDateTime birthTime, HeavenlyStem yearStem, HeavenlyStem monthStem, HeavenlyStem dayStem,
HeavenlyStem hourStem, EarthlyBranch yearBranch, EarthlyBranch monthBranch, EarthlyBranch dayBranch,
EarthlyBranch hourBranch, String gender, String timezone, Double longitude, Double latitude) {
this.birthTime = birthTime;
this.yearStem = yearStem;
this.monthStem = monthStem;
this.dayStem = dayStem;
this.hourStem = hourStem;
this.yearBranch = yearBranch;
this.monthBranch = monthBranch;
this.dayBranch = dayBranch;
this.hourBranch = hourBranch;
this.gender = gender;
this.timezone = timezone;
this.longitude = longitude;
this.latitude = latitude;
if (longitude != null) {
this.trueSolarTime = TrueSolarTimeUtil.calculateTrueSolarDateTime(birthTime, longitude);
}
}
/**
* 根据出生时间和性别创建出生信息
*
* @param birthTime 出生时间
* @param gender 性别
*/
public BirthInfo(LocalDateTime birthTime, String gender) {
this.birthTime = birthTime;
this.gender = gender;
}
/**
* 获取出生时间
*
* @return 出生时间
*/
public LocalDateTime getBirthTime() {
return birthTime;
}
/**
* 设置出生时间
*
* @param birthTime 出生时间
*/
public void setBirthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
}
/**
* 获取年干
*
* @return 年干
*/
public HeavenlyStem getYearStem() {
return yearStem;
}
/**
* 设置年干
*
* @param yearStem 年干
*/
public void setYearStem(HeavenlyStem yearStem) {
this.yearStem = yearStem;
}
/**
* 获取月干
*
* @return 月干
*/
public HeavenlyStem getMonthStem() {
return monthStem;
}
/**
* 设置月干
*
* @param monthStem 月干
*/
public void setMonthStem(HeavenlyStem monthStem) {
this.monthStem = monthStem;
}
/**
* 获取日干
*
* @return 日干
*/
public HeavenlyStem getDayStem() {
return dayStem;
}
/**
* 设置日干
*
* @param dayStem 日干
*/
public void setDayStem(HeavenlyStem dayStem) {
this.dayStem = dayStem;
}
/**
* 获取时干
*
* @return 时干
*/
public HeavenlyStem getHourStem() {
return hourStem;
}
/**
* 设置时干
*
* @param hourStem 时干
*/
public void setHourStem(HeavenlyStem hourStem) {
this.hourStem = hourStem;
}
/**
* 获取年支
*
* @return 年支
*/
public EarthlyBranch getYearBranch() {
return yearBranch;
}
/**
* 设置年支
*
* @param yearBranch 年支
*/
public void setYearBranch(EarthlyBranch yearBranch) {
this.yearBranch = yearBranch;
}
/**
* 获取月支
*
* @return 月支
*/
public EarthlyBranch getMonthBranch() {
return monthBranch;
}
/**
* 设置月支
*
* @param monthBranch 月支
*/
public void setMonthBranch(EarthlyBranch monthBranch) {
this.monthBranch = monthBranch;
}
/**
* 获取日支
*
* @return 日支
*/
public EarthlyBranch getDayBranch() {
return dayBranch;
}
/**
* 设置日支
*
* @param dayBranch 日支
*/
public void setDayBranch(EarthlyBranch dayBranch) {
this.dayBranch = dayBranch;
}
/**
* 获取时支
*
* @return 时支
*/
public EarthlyBranch getHourBranch() {
return hourBranch;
}
/**
* 设置时支
*
* @param hourBranch 时支
*/
public void setHourBranch(EarthlyBranch hourBranch) {
this.hourBranch = hourBranch;
}
/**
* 获取性别
*
* @return 性别(MALE:男,FEMALE:女)
*/
public String getGender() {
return gender;
}
/**
* 设置性别
*
* @param gender 性别(MALE:男,FEMALE:女)
*/
public void setGender(String gender) {
this.gender = gender;
}
/**
* 获取时区
*
* @return 时区
*/
public String getTimezone() {
return timezone;
}
/**
* 设置时区
*
* @param timezone 时区
*/
public void setTimezone(String timezone) {
this.timezone = timezone;
}
/**
* 获取经度
*
* @return 经度
*/
public Double getLongitude() {
return longitude;
}
/**
* 设置经度,并自动计算真太阳时
*
* @param longitude 经度
*/
public void setLongitude(Double longitude) {
this.longitude = longitude;
if (longitude != null && birthTime != null) {
this.trueSolarTime = TrueSolarTimeUtil.calculateTrueSolarDateTime(birthTime, longitude);
}
}
/**
* 获取纬度
*
* @return 纬度
*/
public Double getLatitude() {
return latitude;
}
/**
* 设置纬度
*
* @param latitude 纬度
*/
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
/**
* 获取真太阳时
*
* @return 真太阳时
*/
public LocalDateTime getTrueSolarTime() {
return trueSolarTime;
}
/**
* 设置真太阳时
*
* @param trueSolarTime 真太阳时
*/
public void setTrueSolarTime(LocalDateTime trueSolarTime) {
this.trueSolarTime = trueSolarTime;
}
/**
* 获取农历日期信息
*
* @return 农历日期信息
*/
public LunarDate getLunarDate() {
return lunarDate;
}
/**
* 设置农历日期信息
*
* @param lunarDate 农历日期信息
*/
public void setLunarDate(LunarDate lunarDate) {
this.lunarDate = lunarDate;
}
/**
* 获取紫微斗数时支
*
* @return 时支名称,如果无法计算则返回"未知时辰"
*/
public String getZiweiHourBranch() {
if (trueSolarTime != null) {
return TrueSolarTimeUtil.getZiweiHourBranch(trueSolarTime.toLocalTime());
} else if (birthTime != null) {
return TrueSolarTimeUtil.getZiweiHourBranch(birthTime.toLocalTime());
}
return "未知时辰";
}
/**
* 获取时差描述
*
* @return 时差描述,如果未设置经度则返回"未设置经度,无法计算时差"
*/
public String getTimeDifferenceDescription() {
if (longitude != null) {
return TrueSolarTimeUtil.getTimeDifferenceDescription(longitude);
}
return "未设置经度,无法计算时差";
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
BirthInfo birthInfo = (BirthInfo) o;
return new EqualsBuilder()
.append(gender, birthInfo.gender)
.append(birthTime, birthInfo.birthTime)
.append(yearStem, birthInfo.yearStem)
.append(monthStem, birthInfo.monthStem)
.append(dayStem, birthInfo.dayStem)
.append(hourStem, birthInfo.hourStem)
.append(yearBranch, birthInfo.yearBranch)
.append(monthBranch, birthInfo.monthBranch)
.append(dayBranch, birthInfo.dayBranch)
.append(hourBranch, birthInfo.hourBranch)
.append(timezone, birthInfo.timezone)
.append(longitude, birthInfo.longitude)
.append(latitude, birthInfo.latitude)
.append(trueSolarTime, birthInfo.trueSolarTime)
.append(lunarDate, birthInfo.lunarDate)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(birthTime)
.append(yearStem)
.append(monthStem)
.append(dayStem)
.append(hourStem)
.append(yearBranch)
.append(monthBranch)
.append(dayBranch)
.append(hourBranch)
.append(gender)
.append(timezone)
.append(longitude)
.append(latitude)
.append(trueSolarTime)
.append(lunarDate)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("birthTime", birthTime)
.append("yearStem", yearStem)
.append("monthStem", monthStem)
.append("dayStem", dayStem)
.append("hourStem", hourStem)
.append("yearBranch", yearBranch)
.append("monthBranch", monthBranch)
.append("dayBranch", dayBranch)
.append("hourBranch", hourBranch)
.append("gender", gender)
.append("timezone", timezone)
.append("longitude", longitude)
.append("latitude", latitude)
.append("trueSolarTime", trueSolarTime)
.append("lunarDate", lunarDate)
.toString();
}
/**
* 获取Builder实例
*
* @return Builder实例
*/
public static Builder builder() {
return new Builder();
}
/**
* Builder类,用于构建BirthInfo实例
*/
public static class Builder {
private LocalDateTime birthTime;
private HeavenlyStem yearStem;
private HeavenlyStem monthStem;
private HeavenlyStem dayStem;
private HeavenlyStem hourStem;
private EarthlyBranch yearBranch;
private EarthlyBranch monthBranch;
private EarthlyBranch dayBranch;
private EarthlyBranch hourBranch;
private String gender;
private String timezone;
private Double longitude;
private Double latitude;
private LunarDate lunarDate;
/**
* 设置出生时间
*
* @param birthTime 出生时间
* @return Builder实例
*/
public Builder birthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
return this;
}
/**
* 设置年干
*
* @param yearStem 年干
* @return Builder实例
*/
public Builder yearStem(HeavenlyStem yearStem) {
this.yearStem = yearStem;
return this;
}
/**
* 设置月干
*
* @param monthStem 月干
* @return Builder实例
*/
public Builder monthStem(HeavenlyStem monthStem) {
this.monthStem = monthStem;
return this;
}
/**
* 设置日干
*
* @param dayStem 日干
* @return Builder实例
*/
public Builder dayStem(HeavenlyStem dayStem) {
this.dayStem = dayStem;
return this;
}
/**
* 设置时干
*
* @param hourStem 时干
* @return Builder实例
*/
public Builder hourStem(HeavenlyStem hourStem) {
this.hourStem = hourStem;
return this;
}
/**
* 设置年支
*
* @param yearBranch 年支
* @return Builder实例
*/
public Builder yearBranch(EarthlyBranch yearBranch) {
this.yearBranch = yearBranch;
return this;
}
/**
* 设置月支
*
* @param monthBranch 月支
* @return Builder实例
*/
public Builder monthBranch(EarthlyBranch monthBranch) {
this.monthBranch = monthBranch;
return this;
}
/**
* 设置日支
*
* @param dayBranch 日支
* @return Builder实例
*/
public Builder dayBranch(EarthlyBranch dayBranch) {
this.dayBranch = dayBranch;
return this;
}
/**
* 设置时支
*
* @param hourBranch 时支
* @return Builder实例
*/
public Builder hourBranch(EarthlyBranch hourBranch) {
this.hourBranch = hourBranch;
return this;
}
/**
* 设置性别
*
* @param gender 性别
* @return Builder实例
*/
public Builder gender(String gender) {
this.gender = gender;
return this;
}
/**
* 设置时区
*
* @param timezone 时区
* @return Builder实例
*/
public Builder timezone(String timezone) {
this.timezone = timezone;
return this;
}
/**
* 设置经度
*
* @param longitude 经度
* @return Builder实例
*/
public Builder longitude(Double longitude) {
this.longitude = longitude;
return this;
}
/**
* 设置纬度
*
* @param latitude 纬度
* @return Builder实例
*/
public Builder latitude(Double latitude) {
this.latitude = latitude;
return this;
}
/**
* 设置农历日期信息
*
* @param lunarDate 农历日期信息
* @return Builder实例
*/
public Builder lunarDate(LunarDate lunarDate) {
this.lunarDate = lunarDate;
return this;
}
/**
* 构建BirthInfo实例
*
* @return BirthInfo实例
*/
public BirthInfo build() {
BirthInfo birthInfo = new BirthInfo(birthTime, yearStem, monthStem, dayStem, hourStem, yearBranch,
monthBranch, dayBranch,
hourBranch, gender, timezone, longitude, latitude);
birthInfo.setLunarDate(lunarDate);
return birthInfo;
}
}
}
@@ -0,0 +1,798 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.PalaceType;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;
/**
* 每日运势类,用于表示命主的每日运势分析结果
* 包含整体运势、各宫位运势、建议和幸运元素等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class DailyFortune {
/** 主键ID */
private Long id;
/** 用户ID */
private Long userId;
/** 运势日期 */
private LocalDate fortuneDate;
/** 整体运势描述 */
private String overallLuck;
/** 整体运势评分 */
private int overallScore;
/** 各宫位运势映射表 */
private Map<PalaceType, PalaceFortune> palaceFortunes;
/** 事业建议 */
private String careerAdvice;
/** 财运建议 */
private String wealthAdvice;
/** 感情建议 */
private String relationshipAdvice;
/** 健康建议 */
private String healthAdvice;
/** 幸运颜色 */
private String luckyColor;
/** 幸运数字 */
private String luckyNumber;
/** 幸运方位 */
private String luckyDirection;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 爱情运势评分 */
private int loveScore;
/** 整体爱情运势 */
private String overallLoveLuck;
/** 桃花指数 */
private String peachBlossomIndex;
/** 单身建议 */
private String singleAdvice;
/** 恋爱建议 */
private String datingAdvice;
/** 婚姻建议 */
private String marriageAdvice;
/** 最佳约会时间 */
private String bestDatingTime;
/** 学业运势评分 */
private int studyScore;
/** 整体学业运势 */
private String overallStudyLuck;
/** 专注力指数 */
private String focusIndex;
/** 记忆力指数 */
private String memoryIndex;
/** 学习建议 */
private String studyAdvice;
/** 考试运 */
private String examLuck;
/** 最佳学习时间 */
private String bestStudyTime;
/** 适合科目 */
private String suitableSubjects;
/** 学习环境建议 */
private String studyEnvironmentAdvice;
/** 社交运势评分 */
private int socialScore;
/** 整体社交运势 */
private String overallSocialLuck;
/** 人缘指数 */
private String popularityIndex;
/** 沟通能力 */
private String communicationAbility;
/** 社交建议 */
private String socialAdvice;
/** 贵人运 */
private String nobleLuck;
/** 最佳社交时间 */
private String bestSocialTime;
/** 适合社交场合 */
private String suitableOccasion;
/** 人际建议 */
private String interpersonalAdvice;
/** 出行运势评分 */
private int travelScore;
/** 整体出行运势 */
private String overallTravelLuck;
/** 安全指数 */
private String safetyIndex;
/** 顺利指数 */
private String smoothnessIndex;
/** 出行建议 */
private String travelAdvice;
/** 最佳出行时间 */
private String bestTravelTime;
/** 适合交通方式 */
private String suitableTransport;
/** 注意事项 */
private String precautions;
/** 贵人方位 */
private String nobleDirection;
/**
* 默认构造函数
*/
public DailyFortune() {
}
/**
* 全参构造函数
*
* @param userId 用户ID
* @param fortuneDate 运势日期
* @param overallLuck 整体运势描述
* @param overallScore 整体运势评分
* @param palaceFortunes 各宫位运势映射表
* @param careerAdvice 事业建议
* @param wealthAdvice 财运建议
* @param relationshipAdvice 感情建议
* @param healthAdvice 健康建议
* @param luckyColor 幸运颜色
* @param luckyNumber 幸运数字
* @param luckyDirection 幸运方位
*/
public DailyFortune(Long id, Long userId, LocalDate fortuneDate, String overallLuck, int overallScore,
Map<PalaceType, PalaceFortune> palaceFortunes, String careerAdvice, String wealthAdvice,
String relationshipAdvice, String healthAdvice, String luckyColor, String luckyNumber,
String luckyDirection) {
this.id = id;
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallLuck = overallLuck;
this.overallScore = overallScore;
this.palaceFortunes = palaceFortunes;
this.careerAdvice = careerAdvice;
this.wealthAdvice = wealthAdvice;
this.relationshipAdvice = relationshipAdvice;
this.healthAdvice = healthAdvice;
this.luckyColor = luckyColor;
this.luckyNumber = luckyNumber;
this.luckyDirection = luckyDirection;
}
/**
* 获取主键ID
*
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 生成主键ID
*
* @return 主键ID
*/
public Long generateId() {
return SnowflakeId.nextId();
}
/**
* 获取用户ID
*
* @return 用户ID
*/
public Long getUserId() {
return userId;
}
/**
* 设置用户ID
*
* @param userId 用户ID
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 获取运势日期
*
* @return 运势日期
*/
public LocalDate getFortuneDate() {
return fortuneDate;
}
/**
* 设置运势日期
*
* @param fortuneDate 运势日期
*/
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
/**
* 获取整体运势描述
*
* @return 整体运势描述
*/
public String getOverallLuck() {
return overallLuck;
}
/**
* 设置整体运势描述
*
* @param overallLuck 整体运势描述
*/
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
/**
* 获取整体运势评分
*
* @return 整体运势评分
*/
public int getOverallScore() {
return overallScore;
}
/**
* 设置整体运势评分
*
* @param overallScore 整体运势评分
*/
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
/**
* 获取各宫位运势映射表
*
* @return 各宫位运势映射表
*/
public Map<PalaceType, PalaceFortune> getPalaceFortunes() {
return palaceFortunes;
}
/**
* 设置各宫位运势映射表
*
* @param palaceFortunes 各宫位运势映射表
*/
public void setPalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
/**
* 获取事业建议
*
* @return 事业建议
*/
public String getCareerAdvice() {
return careerAdvice;
}
/**
* 设置事业建议
*
* @param careerAdvice 事业建议
*/
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
/**
* 获取财运建议
*
* @return 财运建议
*/
public String getWealthAdvice() {
return wealthAdvice;
}
/**
* 设置财运建议
*
* @param wealthAdvice 财运建议
*/
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
/**
* 获取感情建议
*
* @return 感情建议
*/
public String getRelationshipAdvice() {
return relationshipAdvice;
}
/**
* 设置感情建议
*
* @param relationshipAdvice 感情建议
*/
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
/**
* 获取健康建议
*
* @return 健康建议
*/
public String getHealthAdvice() {
return healthAdvice;
}
/**
* 设置健康建议
*
* @param healthAdvice 健康建议
*/
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
/**
* 获取幸运颜色
*
* @return 幸运颜色
*/
public String getLuckyColor() {
return luckyColor;
}
/**
* 设置幸运颜色
*
* @param luckyColor 幸运颜色
*/
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
/**
* 获取幸运数字
*
* @return 幸运数字
*/
public String getLuckyNumber() {
return luckyNumber;
}
/**
* 设置幸运数字
*
* @param luckyNumber 幸运数字
*/
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
/**
* 获取幸运方位
*
* @return 幸运方位
*/
public String getLuckyDirection() {
return luckyDirection;
}
/**
* 设置幸运方位
*
* @param luckyDirection 幸运方位
*/
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
*
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
*
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
public int getLoveScore() {
return loveScore;
}
public void setLoveScore(int loveScore) {
this.loveScore = loveScore;
}
public String getOverallLoveLuck() {
return overallLoveLuck;
}
public void setOverallLoveLuck(String overallLoveLuck) {
this.overallLoveLuck = overallLoveLuck;
}
public String getPeachBlossomIndex() {
return peachBlossomIndex;
}
public void setPeachBlossomIndex(String peachBlossomIndex) {
this.peachBlossomIndex = peachBlossomIndex;
}
public String getSingleAdvice() {
return singleAdvice;
}
public void setSingleAdvice(String singleAdvice) {
this.singleAdvice = singleAdvice;
}
public String getDatingAdvice() {
return datingAdvice;
}
public void setDatingAdvice(String datingAdvice) {
this.datingAdvice = datingAdvice;
}
public String getMarriageAdvice() {
return marriageAdvice;
}
public void setMarriageAdvice(String marriageAdvice) {
this.marriageAdvice = marriageAdvice;
}
public String getBestDatingTime() {
return bestDatingTime;
}
public void setBestDatingTime(String bestDatingTime) {
this.bestDatingTime = bestDatingTime;
}
public int getStudyScore() {
return studyScore;
}
public void setStudyScore(int studyScore) {
this.studyScore = studyScore;
}
public String getOverallStudyLuck() {
return overallStudyLuck;
}
public void setOverallStudyLuck(String overallStudyLuck) {
this.overallStudyLuck = overallStudyLuck;
}
public String getFocusIndex() {
return focusIndex;
}
public void setFocusIndex(String focusIndex) {
this.focusIndex = focusIndex;
}
public String getMemoryIndex() {
return memoryIndex;
}
public void setMemoryIndex(String memoryIndex) {
this.memoryIndex = memoryIndex;
}
public String getStudyAdvice() {
return studyAdvice;
}
public void setStudyAdvice(String studyAdvice) {
this.studyAdvice = studyAdvice;
}
public String getExamLuck() {
return examLuck;
}
public void setExamLuck(String examLuck) {
this.examLuck = examLuck;
}
public String getBestStudyTime() {
return bestStudyTime;
}
public void setBestStudyTime(String bestStudyTime) {
this.bestStudyTime = bestStudyTime;
}
public String getSuitableSubjects() {
return suitableSubjects;
}
public void setSuitableSubjects(String suitableSubjects) {
this.suitableSubjects = suitableSubjects;
}
public String getStudyEnvironmentAdvice() {
return studyEnvironmentAdvice;
}
public void setStudyEnvironmentAdvice(String studyEnvironmentAdvice) {
this.studyEnvironmentAdvice = studyEnvironmentAdvice;
}
public int getSocialScore() {
return socialScore;
}
public void setSocialScore(int socialScore) {
this.socialScore = socialScore;
}
public String getOverallSocialLuck() {
return overallSocialLuck;
}
public void setOverallSocialLuck(String overallSocialLuck) {
this.overallSocialLuck = overallSocialLuck;
}
public String getPopularityIndex() {
return popularityIndex;
}
public void setPopularityIndex(String popularityIndex) {
this.popularityIndex = popularityIndex;
}
public String getCommunicationAbility() {
return communicationAbility;
}
public void setCommunicationAbility(String communicationAbility) {
this.communicationAbility = communicationAbility;
}
public String getSocialAdvice() {
return socialAdvice;
}
public void setSocialAdvice(String socialAdvice) {
this.socialAdvice = socialAdvice;
}
public String getNobleLuck() {
return nobleLuck;
}
public void setNobleLuck(String nobleLuck) {
this.nobleLuck = nobleLuck;
}
public String getBestSocialTime() {
return bestSocialTime;
}
public void setBestSocialTime(String bestSocialTime) {
this.bestSocialTime = bestSocialTime;
}
public String getSuitableOccasion() {
return suitableOccasion;
}
public void setSuitableOccasion(String suitableOccasion) {
this.suitableOccasion = suitableOccasion;
}
public String getInterpersonalAdvice() {
return interpersonalAdvice;
}
public void setInterpersonalAdvice(String interpersonalAdvice) {
this.interpersonalAdvice = interpersonalAdvice;
}
public int getTravelScore() {
return travelScore;
}
public void setTravelScore(int travelScore) {
this.travelScore = travelScore;
}
public String getOverallTravelLuck() {
return overallTravelLuck;
}
public void setOverallTravelLuck(String overallTravelLuck) {
this.overallTravelLuck = overallTravelLuck;
}
public String getSafetyIndex() {
return safetyIndex;
}
public void setSafetyIndex(String safetyIndex) {
this.safetyIndex = safetyIndex;
}
public String getSmoothnessIndex() {
return smoothnessIndex;
}
public void setSmoothnessIndex(String smoothnessIndex) {
this.smoothnessIndex = smoothnessIndex;
}
public String getTravelAdvice() {
return travelAdvice;
}
public void setTravelAdvice(String travelAdvice) {
this.travelAdvice = travelAdvice;
}
public String getBestTravelTime() {
return bestTravelTime;
}
public void setBestTravelTime(String bestTravelTime) {
this.bestTravelTime = bestTravelTime;
}
public String getSuitableTransport() {
return suitableTransport;
}
public void setSuitableTransport(String suitableTransport) {
this.suitableTransport = suitableTransport;
}
public String getPrecautions() {
return precautions;
}
public void setPrecautions(String precautions) {
this.precautions = precautions;
}
public String getNobleDirection() {
return nobleDirection;
}
public void setNobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
}
/**
* 删除运势
*/
public void delete() {
deletedAt = LocalDateTime.now();
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
DailyFortune that = (DailyFortune) o;
return new EqualsBuilder()
.append(overallScore, that.overallScore)
.append(userId, that.userId)
.append(fortuneDate, that.fortuneDate)
.append(overallLuck, that.overallLuck)
.append(palaceFortunes, that.palaceFortunes)
.append(careerAdvice, that.careerAdvice)
.append(wealthAdvice, that.wealthAdvice)
.append(relationshipAdvice, that.relationshipAdvice)
.append(healthAdvice, that.healthAdvice)
.append(luckyColor, that.luckyColor)
.append(luckyNumber, that.luckyNumber)
.append(luckyDirection, that.luckyDirection)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(fortuneDate)
.append(overallLuck)
.append(overallScore)
.append(palaceFortunes)
.append(careerAdvice)
.append(wealthAdvice)
.append(relationshipAdvice)
.append(healthAdvice)
.append(luckyColor)
.append(luckyNumber)
.append(luckyDirection)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("userId", userId)
.append("fortuneDate", fortuneDate)
.append("overallLuck", overallLuck)
.append("overallScore", overallScore)
.append("palaceFortunes", palaceFortunes)
.append("careerAdvice", careerAdvice)
.append("wealthAdvice", wealthAdvice)
.append("relationshipAdvice", relationshipAdvice)
.append("healthAdvice", healthAdvice)
.append("luckyColor", luckyColor)
.append("luckyNumber", luckyNumber)
.append("luckyDirection", luckyDirection)
.toString();
}
}
@@ -0,0 +1,98 @@
package io.destiny.biz.domain;
import java.time.LocalDate;
/**
* 历史运势记录领域模型
* <p>
* 用于存储用户的历史运势查询记录
* 支持运势趋势分析和历史数据回溯
* </p>
*
* @author 张翔
* @date 2026-01-05
*/
public class HistoryFortuneRecord {
private Long id;
private Long userId;
private String fortuneType;
private LocalDate fortuneDate;
private LocalDate queryDate;
private int overallScore;
private String fortuneDescription;
private String keyPoints;
public HistoryFortuneRecord() {
}
public HistoryFortuneRecord(Long userId, String fortuneType, LocalDate fortuneDate) {
this.userId = userId;
this.fortuneType = fortuneType;
this.fortuneDate = fortuneDate;
this.queryDate = LocalDate.now();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public LocalDate getQueryDate() {
return queryDate;
}
public void setQueryDate(LocalDate queryDate) {
this.queryDate = queryDate;
}
public int getOverallScore() {
return overallScore;
}
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
public String getFortuneDescription() {
return fortuneDescription;
}
public void setFortuneDescription(String fortuneDescription) {
this.fortuneDescription = fortuneDescription;
}
public String getKeyPoints() {
return keyPoints;
}
public void setKeyPoints(String keyPoints) {
this.keyPoints = keyPoints;
}
}
@@ -0,0 +1,506 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.PalaceType;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
import java.util.Map;
/**
* 每时运势类,用于表示命主的每时运势分析结果
* 包含整体运势、各宫位运势、建议和幸运元素等信息
*
* @author 张翔
* @date 2026-01-13
*/
public class HourlyFortune {
/** 主键ID */
private Long id;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 用户ID */
private Long userId;
/** 运势时间 */
private LocalDateTime fortuneTime;
/** 整体运势描述 */
private String overallLuck;
/** 整体运势评分 */
private int overallScore;
/** 各宫位运势映射表 */
private Map<PalaceType, PalaceFortune> palaceFortunes;
/** 事业建议 */
private String careerAdvice;
/** 财运建议 */
private String wealthAdvice;
/** 感情建议 */
private String relationshipAdvice;
/** 健康建议 */
private String healthAdvice;
/** 幸运颜色 */
private String luckyColor;
/** 幸运数字 */
private String luckyNumber;
/** 幸运方位 */
private String luckyDirection;
/** 本时重点 */
private String keyFocus;
/** 注意事项 */
private String cautionAdvice;
/**
* 默认构造函数
*/
public HourlyFortune() {
}
/**
* 生成主键ID
*
* @return 主键ID
*/
public Long generateId() {
this.id = SnowflakeId.nextId();
return this.id;
}
/**
* 删除运势
*/
public void delete() {
this.deletedAt = LocalDateTime.now();
}
/**
* 获取主键ID
*
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
*
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
*
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
/**
* 全参构造函数
*
* @param userId 用户ID
* @param fortuneTime 运势时间
* @param overallLuck 整体运势描述
* @param overallScore 整体运势评分
* @param palaceFortunes 各宫位运势映射表
* @param careerAdvice 事业建议
* @param wealthAdvice 财运建议
* @param relationshipAdvice 感情建议
* @param healthAdvice 健康建议
* @param luckyColor 幸运颜色
* @param luckyNumber 幸运数字
* @param luckyDirection 幸运方位
* @param keyFocus 本时重点
* @param cautionAdvice 注意事项
*/
public HourlyFortune(Long userId, LocalDateTime fortuneTime, String overallLuck, int overallScore,
Map<PalaceType, PalaceFortune> palaceFortunes, String careerAdvice, String wealthAdvice,
String relationshipAdvice, String healthAdvice, String luckyColor, String luckyNumber,
String luckyDirection, String keyFocus, String cautionAdvice) {
this.userId = userId;
this.fortuneTime = fortuneTime;
this.overallLuck = overallLuck;
this.overallScore = overallScore;
this.palaceFortunes = palaceFortunes;
this.careerAdvice = careerAdvice;
this.wealthAdvice = wealthAdvice;
this.relationshipAdvice = relationshipAdvice;
this.healthAdvice = healthAdvice;
this.luckyColor = luckyColor;
this.luckyNumber = luckyNumber;
this.luckyDirection = luckyDirection;
this.keyFocus = keyFocus;
this.cautionAdvice = cautionAdvice;
}
/**
* 获取用户ID
*
* @return 用户ID
*/
public Long getUserId() {
return userId;
}
/**
* 设置用户ID
*
* @param userId 用户ID
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 获取运势时间
*
* @return 运势时间
*/
public LocalDateTime getFortuneTime() {
return fortuneTime;
}
/**
* 设置运势时间
*
* @param fortuneTime 运势时间
*/
public void setFortuneTime(LocalDateTime fortuneTime) {
this.fortuneTime = fortuneTime;
}
/**
* 获取整体运势描述
*
* @return 整体运势描述
*/
public String getOverallLuck() {
return overallLuck;
}
/**
* 设置整体运势描述
*
* @param overallLuck 整体运势描述
*/
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
/**
* 获取整体运势评分
*
* @return 整体运势评分
*/
public int getOverallScore() {
return overallScore;
}
/**
* 设置整体运势评分
*
* @param overallScore 整体运势评分
*/
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
/**
* 获取各宫位运势映射表
*
* @return 各宫位运势映射表
*/
public Map<PalaceType, PalaceFortune> getPalaceFortunes() {
return palaceFortunes;
}
/**
* 设置各宫位运势映射表
*
* @param palaceFortunes 各宫位运势映射表
*/
public void setPalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
/**
* 获取事业建议
*
* @return 事业建议
*/
public String getCareerAdvice() {
return careerAdvice;
}
/**
* 设置事业建议
*
* @param careerAdvice 事业建议
*/
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
/**
* 获取财运建议
*
* @return 财运建议
*/
public String getWealthAdvice() {
return wealthAdvice;
}
/**
* 设置财运建议
*
* @param wealthAdvice 财运建议
*/
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
/**
* 获取感情建议
*
* @return 感情建议
*/
public String getRelationshipAdvice() {
return relationshipAdvice;
}
/**
* 设置感情建议
*
* @param relationshipAdvice 感情建议
*/
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
/**
* 获取健康建议
*
* @return 健康建议
*/
public String getHealthAdvice() {
return healthAdvice;
}
/**
* 设置健康建议
*
* @param healthAdvice 健康建议
*/
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
/**
* 获取幸运颜色
*
* @return 幸运颜色
*/
public String getLuckyColor() {
return luckyColor;
}
/**
* 设置幸运颜色
*
* @param luckyColor 幸运颜色
*/
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
/**
* 获取幸运数字
*
* @return 幸运数字
*/
public String getLuckyNumber() {
return luckyNumber;
}
/**
* 设置幸运数字
*
* @param luckyNumber 幸运数字
*/
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
/**
* 获取幸运方位
*
* @return 幸运方位
*/
public String getLuckyDirection() {
return luckyDirection;
}
/**
* 设置幸运方位
*
* @param luckyDirection 幸运方位
*/
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
/**
* 获取本时重点
*
* @return 本时重点
*/
public String getKeyFocus() {
return keyFocus;
}
/**
* 设置本时重点
*
* @param keyFocus 本时重点
*/
public void setKeyFocus(String keyFocus) {
this.keyFocus = keyFocus;
}
/**
* 获取注意事项
*
* @return 注意事项
*/
public String getCautionAdvice() {
return cautionAdvice;
}
/**
* 设置注意事项
*
* @param cautionAdvice 注意事项
*/
public void setCautionAdvice(String cautionAdvice) {
this.cautionAdvice = cautionAdvice;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
HourlyFortune that = (HourlyFortune) o;
return new EqualsBuilder()
.append(overallScore, that.overallScore)
.append(userId, that.userId)
.append(fortuneTime, that.fortuneTime)
.append(overallLuck, that.overallLuck)
.append(palaceFortunes, that.palaceFortunes)
.append(careerAdvice, that.careerAdvice)
.append(wealthAdvice, that.wealthAdvice)
.append(relationshipAdvice, that.relationshipAdvice)
.append(healthAdvice, that.healthAdvice)
.append(luckyColor, that.luckyColor)
.append(luckyNumber, that.luckyNumber)
.append(luckyDirection, that.luckyDirection)
.append(keyFocus, that.keyFocus)
.append(cautionAdvice, that.cautionAdvice)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(fortuneTime)
.append(overallLuck)
.append(overallScore)
.append(palaceFortunes)
.append(careerAdvice)
.append(wealthAdvice)
.append(relationshipAdvice)
.append(healthAdvice)
.append(luckyColor)
.append(luckyNumber)
.append(luckyDirection)
.append(keyFocus)
.append(cautionAdvice)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("userId", userId)
.append("fortuneTime", fortuneTime)
.append("overallLuck", overallLuck)
.append("overallScore", overallScore)
.append("careerAdvice", careerAdvice)
.append("wealthAdvice", wealthAdvice)
.append("relationshipAdvice", relationshipAdvice)
.append("healthAdvice", healthAdvice)
.append("luckyColor", luckyColor)
.append("luckyNumber", luckyNumber)
.append("luckyDirection", luckyDirection)
.append("keyFocus", keyFocus)
.append("cautionAdvice", cautionAdvice)
.toString();
}
}
@@ -0,0 +1,123 @@
package io.destiny.biz.domain;
import java.time.LocalDate;
/**
* 爱情运势领域模型
* <p>
* 基于紫微斗数命盘分析用户的爱情运势
* 包含整体运势评分、桃花指数、各类建议等信息
* </p>
*
* @author 张翔
* @date 2026-01-05
*/
public class LoveFortune {
private Long userId;
private LocalDate fortuneDate;
private String overallLoveLuck;
private int loveScore;
private String peachBlossomIndex;
private String singleAdvice;
private String datingAdvice;
private String marriageAdvice;
private String bestMatchSign;
private String luckyColor;
private String luckyNumber;
public LoveFortune() {
}
public LoveFortune(Long userId, LocalDate fortuneDate) {
this.userId = userId;
this.fortuneDate = fortuneDate;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallLoveLuck() {
return overallLoveLuck;
}
public void setOverallLoveLuck(String overallLoveLuck) {
this.overallLoveLuck = overallLoveLuck;
}
public int getLoveScore() {
return loveScore;
}
public void setLoveScore(int loveScore) {
this.loveScore = loveScore;
}
public String getPeachBlossomIndex() {
return peachBlossomIndex;
}
public void setPeachBlossomIndex(String peachBlossomIndex) {
this.peachBlossomIndex = peachBlossomIndex;
}
public String getSingleAdvice() {
return singleAdvice;
}
public void setSingleAdvice(String singleAdvice) {
this.singleAdvice = singleAdvice;
}
public String getDatingAdvice() {
return datingAdvice;
}
public void setDatingAdvice(String datingAdvice) {
this.datingAdvice = datingAdvice;
}
public String getMarriageAdvice() {
return marriageAdvice;
}
public void setMarriageAdvice(String marriageAdvice) {
this.marriageAdvice = marriageAdvice;
}
public String getBestMatchSign() {
return bestMatchSign;
}
public void setBestMatchSign(String bestMatchSign) {
this.bestMatchSign = bestMatchSign;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
}
@@ -0,0 +1,197 @@
package io.destiny.biz.domain;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* 农历日期信息类
* 用于表示农历日期、生肖、节气等信息
*
* @author 张翔
* @date 2026-01-02
*/
public class LunarDate {
private String lunarYear;
private String lunarMonth;
private String lunarDay;
private Boolean isLeapMonth;
private String zodiac;
private String solarTerm;
private String weekday;
public LunarDate() {
}
public LunarDate(String lunarYear, String lunarMonth, String lunarDay, Boolean isLeapMonth, String zodiac, String solarTerm, String weekday) {
this.lunarYear = lunarYear;
this.lunarMonth = lunarMonth;
this.lunarDay = lunarDay;
this.isLeapMonth = isLeapMonth;
this.zodiac = zodiac;
this.solarTerm = solarTerm;
this.weekday = weekday;
}
public String getLunarYear() {
return lunarYear;
}
public void setLunarYear(String lunarYear) {
this.lunarYear = lunarYear;
}
public String getLunarMonth() {
return lunarMonth;
}
public void setLunarMonth(String lunarMonth) {
this.lunarMonth = lunarMonth;
}
public String getLunarDay() {
return lunarDay;
}
public void setLunarDay(String lunarDay) {
this.lunarDay = lunarDay;
}
public Boolean getIsLeapMonth() {
return isLeapMonth;
}
public void setIsLeapMonth(Boolean isLeapMonth) {
this.isLeapMonth = isLeapMonth;
}
public String getZodiac() {
return zodiac;
}
public void setZodiac(String zodiac) {
this.zodiac = zodiac;
}
public String getSolarTerm() {
return solarTerm;
}
public void setSolarTerm(String solarTerm) {
this.solarTerm = solarTerm;
}
public String getWeekday() {
return weekday;
}
public void setWeekday(String weekday) {
this.weekday = weekday;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LunarDate lunarDate = (LunarDate) o;
return new EqualsBuilder()
.append(lunarYear, lunarDate.lunarYear)
.append(lunarMonth, lunarDate.lunarMonth)
.append(lunarDay, lunarDate.lunarDay)
.append(isLeapMonth, lunarDate.isLeapMonth)
.append(zodiac, lunarDate.zodiac)
.append(solarTerm, lunarDate.solarTerm)
.append(weekday, lunarDate.weekday)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(lunarYear)
.append(lunarMonth)
.append(lunarDay)
.append(isLeapMonth)
.append(zodiac)
.append(solarTerm)
.append(weekday)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("lunarYear", lunarYear)
.append("lunarMonth", lunarMonth)
.append("lunarDay", lunarDay)
.append("isLeapMonth", isLeapMonth)
.append("zodiac", zodiac)
.append("solarTerm", solarTerm)
.append("weekday", weekday)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String lunarYear;
private String lunarMonth;
private String lunarDay;
private Boolean isLeapMonth;
private String zodiac;
private String solarTerm;
private String weekday;
public Builder lunarYear(String lunarYear) {
this.lunarYear = lunarYear;
return this;
}
public Builder lunarMonth(String lunarMonth) {
this.lunarMonth = lunarMonth;
return this;
}
public Builder lunarDay(String lunarDay) {
this.lunarDay = lunarDay;
return this;
}
public Builder isLeapMonth(Boolean isLeapMonth) {
this.isLeapMonth = isLeapMonth;
return this;
}
public Builder zodiac(String zodiac) {
this.zodiac = zodiac;
return this;
}
public Builder solarTerm(String solarTerm) {
this.solarTerm = solarTerm;
return this;
}
public Builder weekday(String weekday) {
this.weekday = weekday;
return this;
}
public LunarDate build() {
return new LunarDate(lunarYear, lunarMonth, lunarDay, isLeapMonth, zodiac, solarTerm, weekday);
}
}
}
@@ -0,0 +1,873 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.PalaceType;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.List;
import java.util.Map;
/**
* 每月运势类,用于表示命主的每月运势分析结果
* 包含整体运势、各宫位运势、每日运势、建议和幸运元素等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class MonthlyFortune {
/** 主键ID */
private Long id;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 爱情运势评分 */
private int loveScore;
/** 整体爱情运势 */
private String overallLoveLuck;
/** 桃花指数 */
private String peachBlossomIndex;
/** 单身建议 */
private String singleAdvice;
/** 恋爱建议 */
private String datingAdvice;
/** 婚姻建议 */
private String marriageAdvice;
/** 最佳约会时间 */
private String bestDatingTime;
/** 学业运势评分 */
private int studyScore;
/** 整体学业运势 */
private String overallStudyLuck;
/** 专注力指数 */
private String focusIndex;
/** 记忆力指数 */
private String memoryIndex;
/** 学习建议 */
private String studyAdvice;
/** 考试运 */
private String examLuck;
/** 最佳学习时间 */
private String bestStudyTime;
/** 适合科目 */
private String suitableSubjects;
/** 学习环境建议 */
private String studyEnvironmentAdvice;
/** 社交运势评分 */
private int socialScore;
/** 整体社交运势 */
private String overallSocialLuck;
/** 人缘指数 */
private String popularityIndex;
/** 沟通能力 */
private String communicationAbility;
/** 社交建议 */
private String socialAdvice;
/** 贵人运 */
private String nobleLuck;
/** 最佳社交时间 */
private String bestSocialTime;
/** 适合社交场合 */
private String suitableOccasion;
/** 人际建议 */
private String interpersonalAdvice;
/** 出行运势评分 */
private int travelScore;
/** 整体出行运势 */
private String overallTravelLuck;
/** 安全指数 */
private String safetyIndex;
/** 顺利指数 */
private String smoothnessIndex;
/** 出行建议 */
private String travelAdvice;
/** 最佳出行时间 */
private String bestTravelTime;
/** 适合交通方式 */
private String suitableTransport;
/** 注意事项 */
private String precautions;
/** 贵人方位 */
private String nobleDirection;
/** 用户ID */
private Long userId;
/** 运势月份 */
private YearMonth fortuneMonth;
/** 整体运势描述 */
private String overallLuck;
/** 整体运势评分 */
private int overallScore;
/** 各宫位运势映射表 */
private Map<PalaceType, PalaceFortune> palaceFortunes;
/** 每日运势列表 */
private List<DailyFortune> dailyFortunes;
/** 事业建议 */
private String careerAdvice;
/** 财运建议 */
private String wealthAdvice;
/** 感情建议 */
private String relationshipAdvice;
/** 健康建议 */
private String healthAdvice;
/** 幸运颜色 */
private String luckyColor;
/** 幸运数字 */
private String luckyNumber;
/** 幸运方位 */
private String luckyDirection;
/** 本月重点 */
private String keyFocus;
/** 注意事项 */
private String cautionAdvice;
/**
* 默认构造函数
*/
public MonthlyFortune() {
}
/**
* 生成主键ID
*
* @return 主键ID
*/
public Long generateId() {
this.id = SnowflakeId.nextId();
return this.id;
}
/**
* 删除运势
*/
public void delete() {
this.deletedAt = LocalDateTime.now();
}
/**
* 获取主键ID
*
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
*
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
*
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
/**
* 全参构造函数
*
* @param userId 用户ID
* @param fortuneMonth 运势月份
* @param overallLuck 整体运势描述
* @param overallScore 整体运势评分
* @param palaceFortunes 各宫位运势映射表
* @param dailyFortunes 每日运势列表
* @param careerAdvice 事业建议
* @param wealthAdvice 财运建议
* @param relationshipAdvice 感情建议
* @param healthAdvice 健康建议
* @param luckyColor 幸运颜色
* @param luckyNumber 幸运数字
* @param luckyDirection 幸运方位
* @param keyFocus 本月重点
* @param cautionAdvice 注意事项
*/
public MonthlyFortune(Long userId, YearMonth fortuneMonth, String overallLuck, int overallScore,
Map<PalaceType, PalaceFortune> palaceFortunes, List<DailyFortune> dailyFortunes, String careerAdvice,
String wealthAdvice, String relationshipAdvice, String healthAdvice, String luckyColor, String luckyNumber,
String luckyDirection, String keyFocus, String cautionAdvice) {
this.userId = userId;
this.fortuneMonth = fortuneMonth;
this.overallLuck = overallLuck;
this.overallScore = overallScore;
this.palaceFortunes = palaceFortunes;
this.dailyFortunes = dailyFortunes;
this.careerAdvice = careerAdvice;
this.wealthAdvice = wealthAdvice;
this.relationshipAdvice = relationshipAdvice;
this.healthAdvice = healthAdvice;
this.luckyColor = luckyColor;
this.luckyNumber = luckyNumber;
this.luckyDirection = luckyDirection;
this.keyFocus = keyFocus;
this.cautionAdvice = cautionAdvice;
}
/**
* 获取用户ID
*
* @return 用户ID
*/
public Long getUserId() {
return userId;
}
/**
* 设置用户ID
*
* @param userId 用户ID
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 获取运势月份
*
* @return 运势月份
*/
public YearMonth getFortuneMonth() {
return fortuneMonth;
}
/**
* 设置运势月份
*
* @param fortuneMonth 运势月份
*/
public void setFortuneMonth(YearMonth fortuneMonth) {
this.fortuneMonth = fortuneMonth;
}
/**
* 获取整体运势描述
*
* @return 整体运势描述
*/
public String getOverallLuck() {
return overallLuck;
}
/**
* 设置整体运势描述
*
* @param overallLuck 整体运势描述
*/
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
/**
* 获取整体运势评分
*
* @return 整体运势评分
*/
public int getOverallScore() {
return overallScore;
}
/**
* 设置整体运势评分
*
* @param overallScore 整体运势评分
*/
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
/**
* 获取各宫位运势映射表
*
* @return 各宫位运势映射表
*/
public Map<PalaceType, PalaceFortune> getPalaceFortunes() {
return palaceFortunes;
}
/**
* 设置各宫位运势映射表
*
* @param palaceFortunes 各宫位运势映射表
*/
public void setPalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
/**
* 获取每日运势列表
*
* @return 每日运势列表
*/
public List<DailyFortune> getDailyFortunes() {
return dailyFortunes;
}
/**
* 设置每日运势列表
*
* @param dailyFortunes 每日运势列表
*/
public void setDailyFortunes(List<DailyFortune> dailyFortunes) {
this.dailyFortunes = dailyFortunes;
}
/**
* 获取事业建议
*
* @return 事业建议
*/
public String getCareerAdvice() {
return careerAdvice;
}
/**
* 设置事业建议
*
* @param careerAdvice 事业建议
*/
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
/**
* 获取财运建议
*
* @return 财运建议
*/
public String getWealthAdvice() {
return wealthAdvice;
}
/**
* 设置财运建议
*
* @param wealthAdvice 财运建议
*/
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
/**
* 获取感情建议
*
* @return 感情建议
*/
public String getRelationshipAdvice() {
return relationshipAdvice;
}
/**
* 设置感情建议
*
* @param relationshipAdvice 感情建议
*/
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
/**
* 获取健康建议
*
* @return 健康建议
*/
public String getHealthAdvice() {
return healthAdvice;
}
/**
* 设置健康建议
*
* @param healthAdvice 健康建议
*/
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
/**
* 获取幸运颜色
*
* @return 幸运颜色
*/
public String getLuckyColor() {
return luckyColor;
}
/**
* 设置幸运颜色
*
* @param luckyColor 幸运颜色
*/
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
/**
* 获取幸运数字
*
* @return 幸运数字
*/
public String getLuckyNumber() {
return luckyNumber;
}
/**
* 设置幸运数字
*
* @param luckyNumber 幸运数字
*/
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
/**
* 获取幸运方位
*
* @return 幸运方位
*/
public String getLuckyDirection() {
return luckyDirection;
}
/**
* 设置幸运方位
*
* @param luckyDirection 幸运方位
*/
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
/**
* 获取本月重点
*
* @return 本月重点
*/
public String getKeyFocus() {
return keyFocus;
}
/**
* 设置本月重点
*
* @param keyFocus 本月重点
*/
public void setKeyFocus(String keyFocus) {
this.keyFocus = keyFocus;
}
/**
* 获取注意事项
*
* @return 注意事项
*/
public String getCautionAdvice() {
return cautionAdvice;
}
/**
* 设置注意事项
*
* @param cautionAdvice 注意事项
*/
public void setCautionAdvice(String cautionAdvice) {
this.cautionAdvice = cautionAdvice;
}
public int getLoveScore() {
return loveScore;
}
public void setLoveScore(int loveScore) {
this.loveScore = loveScore;
}
public String getOverallLoveLuck() {
return overallLoveLuck;
}
public void setOverallLoveLuck(String overallLoveLuck) {
this.overallLoveLuck = overallLoveLuck;
}
public String getPeachBlossomIndex() {
return peachBlossomIndex;
}
public void setPeachBlossomIndex(String peachBlossomIndex) {
this.peachBlossomIndex = peachBlossomIndex;
}
public String getSingleAdvice() {
return singleAdvice;
}
public void setSingleAdvice(String singleAdvice) {
this.singleAdvice = singleAdvice;
}
public String getDatingAdvice() {
return datingAdvice;
}
public void setDatingAdvice(String datingAdvice) {
this.datingAdvice = datingAdvice;
}
public String getMarriageAdvice() {
return marriageAdvice;
}
public void setMarriageAdvice(String marriageAdvice) {
this.marriageAdvice = marriageAdvice;
}
public String getBestDatingTime() {
return bestDatingTime;
}
public void setBestDatingTime(String bestDatingTime) {
this.bestDatingTime = bestDatingTime;
}
public int getStudyScore() {
return studyScore;
}
public void setStudyScore(int studyScore) {
this.studyScore = studyScore;
}
public String getOverallStudyLuck() {
return overallStudyLuck;
}
public void setOverallStudyLuck(String overallStudyLuck) {
this.overallStudyLuck = overallStudyLuck;
}
public String getFocusIndex() {
return focusIndex;
}
public void setFocusIndex(String focusIndex) {
this.focusIndex = focusIndex;
}
public String getMemoryIndex() {
return memoryIndex;
}
public void setMemoryIndex(String memoryIndex) {
this.memoryIndex = memoryIndex;
}
public String getStudyAdvice() {
return studyAdvice;
}
public void setStudyAdvice(String studyAdvice) {
this.studyAdvice = studyAdvice;
}
public String getExamLuck() {
return examLuck;
}
public void setExamLuck(String examLuck) {
this.examLuck = examLuck;
}
public String getBestStudyTime() {
return bestStudyTime;
}
public void setBestStudyTime(String bestStudyTime) {
this.bestStudyTime = bestStudyTime;
}
public String getSuitableSubjects() {
return suitableSubjects;
}
public void setSuitableSubjects(String suitableSubjects) {
this.suitableSubjects = suitableSubjects;
}
public String getStudyEnvironmentAdvice() {
return studyEnvironmentAdvice;
}
public void setStudyEnvironmentAdvice(String studyEnvironmentAdvice) {
this.studyEnvironmentAdvice = studyEnvironmentAdvice;
}
public int getSocialScore() {
return socialScore;
}
public void setSocialScore(int socialScore) {
this.socialScore = socialScore;
}
public String getOverallSocialLuck() {
return overallSocialLuck;
}
public void setOverallSocialLuck(String overallSocialLuck) {
this.overallSocialLuck = overallSocialLuck;
}
public String getPopularityIndex() {
return popularityIndex;
}
public void setPopularityIndex(String popularityIndex) {
this.popularityIndex = popularityIndex;
}
public String getCommunicationAbility() {
return communicationAbility;
}
public void setCommunicationAbility(String communicationAbility) {
this.communicationAbility = communicationAbility;
}
public String getSocialAdvice() {
return socialAdvice;
}
public void setSocialAdvice(String socialAdvice) {
this.socialAdvice = socialAdvice;
}
public String getNobleLuck() {
return nobleLuck;
}
public void setNobleLuck(String nobleLuck) {
this.nobleLuck = nobleLuck;
}
public String getBestSocialTime() {
return bestSocialTime;
}
public void setBestSocialTime(String bestSocialTime) {
this.bestSocialTime = bestSocialTime;
}
public String getSuitableOccasion() {
return suitableOccasion;
}
public void setSuitableOccasion(String suitableOccasion) {
this.suitableOccasion = suitableOccasion;
}
public String getInterpersonalAdvice() {
return interpersonalAdvice;
}
public void setInterpersonalAdvice(String interpersonalAdvice) {
this.interpersonalAdvice = interpersonalAdvice;
}
public int getTravelScore() {
return travelScore;
}
public void setTravelScore(int travelScore) {
this.travelScore = travelScore;
}
public String getOverallTravelLuck() {
return overallTravelLuck;
}
public void setOverallTravelLuck(String overallTravelLuck) {
this.overallTravelLuck = overallTravelLuck;
}
public String getSafetyIndex() {
return safetyIndex;
}
public void setSafetyIndex(String safetyIndex) {
this.safetyIndex = safetyIndex;
}
public String getSmoothnessIndex() {
return smoothnessIndex;
}
public void setSmoothnessIndex(String smoothnessIndex) {
this.smoothnessIndex = smoothnessIndex;
}
public String getTravelAdvice() {
return travelAdvice;
}
public void setTravelAdvice(String travelAdvice) {
this.travelAdvice = travelAdvice;
}
public String getBestTravelTime() {
return bestTravelTime;
}
public void setBestTravelTime(String bestTravelTime) {
this.bestTravelTime = bestTravelTime;
}
public String getSuitableTransport() {
return suitableTransport;
}
public void setSuitableTransport(String suitableTransport) {
this.suitableTransport = suitableTransport;
}
public String getPrecautions() {
return precautions;
}
public void setPrecautions(String precautions) {
this.precautions = precautions;
}
public String getNobleDirection() {
return nobleDirection;
}
public void setNobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MonthlyFortune that = (MonthlyFortune) o;
return new EqualsBuilder()
.append(overallScore, that.overallScore)
.append(userId, that.userId)
.append(fortuneMonth, that.fortuneMonth)
.append(overallLuck, that.overallLuck)
.append(palaceFortunes, that.palaceFortunes)
.append(dailyFortunes, that.dailyFortunes)
.append(careerAdvice, that.careerAdvice)
.append(wealthAdvice, that.wealthAdvice)
.append(relationshipAdvice, that.relationshipAdvice)
.append(healthAdvice, that.healthAdvice)
.append(luckyColor, that.luckyColor)
.append(luckyNumber, that.luckyNumber)
.append(luckyDirection, that.luckyDirection)
.append(keyFocus, that.keyFocus)
.append(cautionAdvice, that.cautionAdvice)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(fortuneMonth)
.append(overallLuck)
.append(overallScore)
.append(palaceFortunes)
.append(dailyFortunes)
.append(careerAdvice)
.append(wealthAdvice)
.append(relationshipAdvice)
.append(healthAdvice)
.append(luckyColor)
.append(luckyNumber)
.append(luckyDirection)
.append(keyFocus)
.append(cautionAdvice)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("userId", userId)
.append("fortuneMonth", fortuneMonth)
.append("overallLuck", overallLuck)
.append("overallScore", overallScore)
.append("palaceFortunes", palaceFortunes)
.append("dailyFortunes", dailyFortunes)
.append("careerAdvice", careerAdvice)
.append("wealthAdvice", wealthAdvice)
.append("relationshipAdvice", relationshipAdvice)
.append("healthAdvice", healthAdvice)
.append("luckyColor", luckyColor)
.append("luckyNumber", luckyNumber)
.append("luckyDirection", luckyDirection)
.append("keyFocus", keyFocus)
.append("cautionAdvice", cautionAdvice)
.toString();
}
}
@@ -0,0 +1,324 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.EarthlyBranch;
import io.destiny.biz.enums.PalaceType;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 宫位类,用于表示紫微斗数中的十二宫位
* 包含宫位类型、地支、星曜信息、分析结果和评分
*
* @author 张翔
* @date 2025-12-29
*/
public class Palace {
/** 主键ID */
private Long id;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 宫位类型 */
private PalaceType palaceType;
/** 地支 */
private EarthlyBranch earthlyBranch;
/** 主星列表 */
private List<StarInfo> majorStars;
/** 辅星列表 */
private List<String> minorStars;
/** 宫位分析 */
private String analysis;
/** 宫位评分 */
private int score;
/**
* 默认构造函数
*/
public Palace() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}
/**
* 全参构造函数
* @param palaceType 宫位类型
* @param earthlyBranch 地支
* @param majorStars 主星列表
* @param minorStars 辅星列表
* @param analysis 宫位分析
* @param score 宫位评分
*/
public Palace(PalaceType palaceType, EarthlyBranch earthlyBranch, List<StarInfo> majorStars, List<String> minorStars, String analysis, int score) {
this.palaceType = palaceType;
this.earthlyBranch = earthlyBranch;
this.majorStars = majorStars;
this.minorStars = minorStars;
this.analysis = analysis;
this.score = score;
}
/**
* 根据宫位类型和地支创建宫位
* @param palaceType 宫位类型
* @param earthlyBranch 地支
*/
public Palace(PalaceType palaceType, EarthlyBranch earthlyBranch) {
this.palaceType = palaceType;
this.earthlyBranch = earthlyBranch;
this.majorStars = new ArrayList<>();
this.minorStars = new ArrayList<>();
this.score = 50;
}
/**
* 获取宫位类型
* @return 宫位类型
*/
public PalaceType getPalaceType() {
return palaceType;
}
/**
* 设置宫位类型
* @param palaceType 宫位类型
*/
public void setPalaceType(PalaceType palaceType) {
this.palaceType = palaceType;
}
/**
* 获取地支
* @return 地支
*/
public EarthlyBranch getEarthlyBranch() {
return earthlyBranch;
}
/**
* 设置地支
* @param earthlyBranch 地支
*/
public void setEarthlyBranch(EarthlyBranch earthlyBranch) {
this.earthlyBranch = earthlyBranch;
}
/**
* 获取主星列表
* @return 主星列表
*/
public List<StarInfo> getMajorStars() {
return majorStars;
}
/**
* 设置主星列表
* @param majorStars 主星列表
*/
public void setMajorStars(List<StarInfo> majorStars) {
this.majorStars = majorStars;
}
/**
* 获取辅星列表
* @return 辅星列表
*/
public List<String> getMinorStars() {
return minorStars;
}
/**
* 设置辅星列表
* @param minorStars 辅星列表
*/
public void setMinorStars(List<String> minorStars) {
this.minorStars = minorStars;
}
/**
* 获取宫位分析
* @return 宫位分析
*/
public String getAnalysis() {
return analysis;
}
/**
* 设置宫位分析
* @param analysis 宫位分析
*/
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
/**
* 获取宫位评分
* @return 宫位评分
*/
public int getScore() {
return score;
}
/**
* 设置宫位评分
* @param score 宫位评分
*/
public void setScore(int score) {
this.score = score;
}
/**
* 获取主键ID
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取创建时间
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
/**
* 生成主键ID
* @return 主键ID
*/
public Long generateId() {
this.id = SnowflakeId.nextId();
return this.id;
}
/**
* 删除宫位
*/
public void delete() {
this.deletedAt = LocalDateTime.now();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Palace palace = (Palace) o;
return new EqualsBuilder()
.append(id, palace.id)
.append(score, palace.score)
.append(palaceType, palace.palaceType)
.append(earthlyBranch, palace.earthlyBranch)
.append(majorStars, palace.majorStars)
.append(minorStars, palace.minorStars)
.append(analysis, palace.analysis)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(id)
.append(palaceType)
.append(earthlyBranch)
.append(majorStars)
.append(minorStars)
.append(analysis)
.append(score)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("createdAt", createdAt)
.append("updatedAt", updatedAt)
.append("deletedAt", deletedAt)
.append("palaceType", palaceType)
.append("earthlyBranch", earthlyBranch)
.append("majorStars", majorStars)
.append("minorStars", minorStars)
.append("analysis", analysis)
.append("score", score)
.toString();
}
/**
* 添加主星
* @param starInfo 主星信息
*/
public void addMajorStar(StarInfo starInfo) {
if (this.majorStars == null) {
this.majorStars = new ArrayList<>();
}
this.majorStars.add(starInfo);
}
/**
* 添加辅星
* @param starName 辅星名称
*/
public void addMinorStar(String starName) {
if (this.minorStars == null) {
this.minorStars = new ArrayList<>();
}
this.minorStars.add(starName);
}
}
@@ -0,0 +1,164 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.PalaceType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* 宫位运势类,用于表示特定宫位的运势分析结果
* 包含宫位类型、运势评分、运势等级、分析和建议等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class PalaceFortune {
/** 宫位类型 */
private PalaceType palaceType;
/** 运势评分 */
private int score;
/** 运势等级 */
private String luckLevel;
/** 运势分析 */
private String analysis;
/** 建议 */
private String advice;
/**
* 默认构造函数
*/
public PalaceFortune() {
}
/**
* 全参构造函数
* @param palaceType 宫位类型
* @param score 运势评分
* @param luckLevel 运势等级
* @param analysis 运势分析
* @param advice 建议
*/
public PalaceFortune(PalaceType palaceType, int score, String luckLevel, String analysis, String advice) {
this.palaceType = palaceType;
this.score = score;
this.luckLevel = luckLevel;
this.analysis = analysis;
this.advice = advice;
}
/**
* 获取宫位类型
* @return 宫位类型
*/
public PalaceType getPalaceType() {
return palaceType;
}
/**
* 设置宫位类型
* @param palaceType 宫位类型
*/
public void setPalaceType(PalaceType palaceType) {
this.palaceType = palaceType;
}
/**
* 获取运势评分
* @return 运势评分
*/
public int getScore() {
return score;
}
/**
* 设置运势评分
* @param score 运势评分
*/
public void setScore(int score) {
this.score = score;
}
/**
* 获取运势等级
* @return 运势等级
*/
public String getLuckLevel() {
return luckLevel;
}
/**
* 设置运势等级
* @param luckLevel 运势等级
*/
public void setLuckLevel(String luckLevel) {
this.luckLevel = luckLevel;
}
/**
* 获取运势分析
* @return 运势分析
*/
public String getAnalysis() {
return analysis;
}
/**
* 设置运势分析
* @param analysis 运势分析
*/
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
/**
* 获取建议
* @return 建议
*/
public String getAdvice() {
return advice;
}
/**
* 设置建议
* @param advice 建议
*/
public void setAdvice(String advice) {
this.advice = advice;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PalaceFortune that = (PalaceFortune) o;
return new EqualsBuilder()
.append(score, that.score)
.append(palaceType, that.palaceType)
.append(luckLevel, that.luckLevel)
.append(analysis, that.analysis)
.append(advice, that.advice)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(palaceType)
.append(score)
.append(luckLevel)
.append(analysis)
.append(advice)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("palaceType", palaceType)
.append("score", score)
.append("luckLevel", luckLevel)
.append("analysis", analysis)
.append("advice", advice)
.toString();
}
}
@@ -0,0 +1,123 @@
package io.destiny.biz.domain;
import java.time.LocalDate;
/**
* 社交运势领域模型
* <p>
* 基于紫微斗数命盘分析用户的社交运势
* 包含人际交往、社交活动、贵人运势等信息
* </p>
*
* @author 张翔
* @date 2026-01-05
*/
public class SocialFortune {
private Long userId;
private LocalDate fortuneDate;
private String overallSocialLuck;
private int socialScore;
private String interpersonalLuck;
private String socialActivityLuck;
private String noblePersonLuck;
private String bestSocialType;
private String luckyColor;
private String luckyNumber;
private String advice;
public SocialFortune() {
}
public SocialFortune(Long userId, LocalDate fortuneDate) {
this.userId = userId;
this.fortuneDate = fortuneDate;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallSocialLuck() {
return overallSocialLuck;
}
public void setOverallSocialLuck(String overallSocialLuck) {
this.overallSocialLuck = overallSocialLuck;
}
public int getSocialScore() {
return socialScore;
}
public void setSocialScore(int socialScore) {
this.socialScore = socialScore;
}
public String getInterpersonalLuck() {
return interpersonalLuck;
}
public void setInterpersonalLuck(String interpersonalLuck) {
this.interpersonalLuck = interpersonalLuck;
}
public String getSocialActivityLuck() {
return socialActivityLuck;
}
public void setSocialActivityLuck(String socialActivityLuck) {
this.socialActivityLuck = socialActivityLuck;
}
public String getNoblePersonLuck() {
return noblePersonLuck;
}
public void setNoblePersonLuck(String noblePersonLuck) {
this.noblePersonLuck = noblePersonLuck;
}
public String getBestSocialType() {
return bestSocialType;
}
public void setBestSocialType(String bestSocialType) {
this.bestSocialType = bestSocialType;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
}
@@ -0,0 +1,177 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.MajorStar;
import io.destiny.biz.enums.StarNature;
import io.destiny.biz.enums.TransformationType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* 星曜信息类,用于表示紫微斗数中的星曜详细信息
* 包含星曜类型、星曜性质、化禄、亮度等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class StarInfo {
/** 星曜 */
private MajorStar star;
/** 星曜性质 */
private StarNature nature;
/** 化禄类型 */
private TransformationType transformation;
/** 亮度 */
private int brightness;
/** 星曜描述 */
private String description;
/**
* 默认构造函数
*/
public StarInfo() {
}
/**
* 全参构造函数
* @param star 星曜
* @param nature 星曜性质
* @param transformation 化禄类型
* @param brightness 亮度
* @param description 星曜描述
*/
public StarInfo(MajorStar star, StarNature nature, TransformationType transformation, int brightness, String description) {
this.star = star;
this.nature = nature;
this.transformation = transformation;
this.brightness = brightness;
this.description = description;
}
/**
* 根据星曜和性质创建星曜信息
* @param star 星曜
* @param nature 星曜性质
*/
public StarInfo(MajorStar star, StarNature nature) {
this.star = star;
this.nature = nature;
this.brightness = 100;
}
/**
* 获取星曜
* @return 星曜
*/
public MajorStar getStar() {
return star;
}
/**
* 设置星曜
* @param star 星曜
*/
public void setStar(MajorStar star) {
this.star = star;
}
/**
* 获取星曜性质
* @return 星曜性质
*/
public StarNature getNature() {
return nature;
}
/**
* 设置星曜性质
* @param nature 星曜性质
*/
public void setNature(StarNature nature) {
this.nature = nature;
}
/**
* 获取化禄类型
* @return 化禄类型
*/
public TransformationType getTransformation() {
return transformation;
}
/**
* 设置化禄类型
* @param transformation 化禄类型
*/
public void setTransformation(TransformationType transformation) {
this.transformation = transformation;
}
/**
* 获取亮度
* @return 亮度
*/
public int getBrightness() {
return brightness;
}
/**
* 设置亮度
* @param brightness 亮度
*/
public void setBrightness(int brightness) {
this.brightness = brightness;
}
/**
* 获取星曜描述
* @return 星曜描述
*/
public String getDescription() {
return description;
}
/**
* 设置星曜描述
* @param description 星曜描述
*/
public void setDescription(String description) {
this.description = description;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StarInfo starInfo = (StarInfo) o;
return new EqualsBuilder()
.append(brightness, starInfo.brightness)
.append(star, starInfo.star)
.append(nature, starInfo.nature)
.append(transformation, starInfo.transformation)
.append(description, starInfo.description)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(star)
.append(nature)
.append(transformation)
.append(brightness)
.append(description)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("star", star)
.append("nature", nature)
.append("transformation", transformation)
.append("brightness", brightness)
.append("description", description)
.toString();
}
}
@@ -0,0 +1,123 @@
package io.destiny.biz.domain;
import java.time.LocalDate;
/**
* 学业运势领域模型
* <p>
* 基于紫微斗数命盘分析用户的学业运势
* 包含学习状态、考试运势、适合的学习方向等信息
* </p>
*
* @author 张翔
* @date 2026-01-05
*/
public class StudyFortune {
private Long userId;
private LocalDate fortuneDate;
private String overallStudyLuck;
private int studyScore;
private String learningState;
private String examLuck;
private String studyDirection;
private String bestStudyTime;
private String luckyColor;
private String luckyNumber;
private String advice;
public StudyFortune() {
}
public StudyFortune(Long userId, LocalDate fortuneDate) {
this.userId = userId;
this.fortuneDate = fortuneDate;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallStudyLuck() {
return overallStudyLuck;
}
public void setOverallStudyLuck(String overallStudyLuck) {
this.overallStudyLuck = overallStudyLuck;
}
public int getStudyScore() {
return studyScore;
}
public void setStudyScore(int studyScore) {
this.studyScore = studyScore;
}
public String getLearningState() {
return learningState;
}
public void setLearningState(String learningState) {
this.learningState = learningState;
}
public String getExamLuck() {
return examLuck;
}
public void setExamLuck(String examLuck) {
this.examLuck = examLuck;
}
public String getStudyDirection() {
return studyDirection;
}
public void setStudyDirection(String studyDirection) {
this.studyDirection = studyDirection;
}
public String getBestStudyTime() {
return bestStudyTime;
}
public void setBestStudyTime(String bestStudyTime) {
this.bestStudyTime = bestStudyTime;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
}
@@ -0,0 +1,114 @@
package io.destiny.biz.domain;
import java.time.LocalDate;
/**
* 出行运势领域模型
* <p>
* 基于紫微斗数命盘分析用户的出行运势
* 包含出行安全、旅途顺利程度、适合的出行方式等信息
* </p>
*
* @author 张翔
* @date 2026-01-05
*/
public class TravelFortune {
private Long userId;
private LocalDate fortuneDate;
private String overallTravelLuck;
private int travelScore;
private String travelSafety;
private String journeySmoothness;
private String bestTravelMode;
private String luckyColor;
private String luckyNumber;
private String advice;
public TravelFortune() {
}
public TravelFortune(Long userId, LocalDate fortuneDate) {
this.userId = userId;
this.fortuneDate = fortuneDate;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallTravelLuck() {
return overallTravelLuck;
}
public void setOverallTravelLuck(String overallTravelLuck) {
this.overallTravelLuck = overallTravelLuck;
}
public int getTravelScore() {
return travelScore;
}
public void setTravelScore(int travelScore) {
this.travelScore = travelScore;
}
public String getTravelSafety() {
return travelSafety;
}
public void setTravelSafety(String travelSafety) {
this.travelSafety = travelSafety;
}
public String getJourneySmoothness() {
return journeySmoothness;
}
public void setJourneySmoothness(String journeySmoothness) {
this.journeySmoothness = journeySmoothness;
}
public String getBestTravelMode() {
return bestTravelMode;
}
public void setBestTravelMode(String bestTravelMode) {
this.bestTravelMode = bestTravelMode;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
}
@@ -0,0 +1,949 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.PalaceType;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
import java.time.Year;
import java.util.List;
import java.util.Map;
/**
* 每年运势类,用于表示命主的每年运势分析结果
* 包含整体运势、各宫位运势、每月运势、建议和幸运元素等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class YearlyFortune {
/** 主键ID */
private Long id;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 爱情运势评分 */
private int loveScore;
/** 整体爱情运势 */
private String overallLoveLuck;
/** 桃花指数 */
private String peachBlossomIndex;
/** 单身建议 */
private String singleAdvice;
/** 恋爱建议 */
private String datingAdvice;
/** 婚姻建议 */
private String marriageAdvice;
/** 最佳约会时间 */
private String bestDatingTime;
/** 学业运势评分 */
private int studyScore;
/** 整体学业运势 */
private String overallStudyLuck;
/** 专注力指数 */
private String focusIndex;
/** 记忆力指数 */
private String memoryIndex;
/** 学习建议 */
private String studyAdvice;
/** 考试运 */
private String examLuck;
/** 最佳学习时间 */
private String bestStudyTime;
/** 适合科目 */
private String suitableSubjects;
/** 学习环境建议 */
private String studyEnvironmentAdvice;
/** 社交运势评分 */
private int socialScore;
/** 整体社交运势 */
private String overallSocialLuck;
/** 人缘指数 */
private String popularityIndex;
/** 沟通能力 */
private String communicationAbility;
/** 社交建议 */
private String socialAdvice;
/** 贵人运 */
private String nobleLuck;
/** 最佳社交时间 */
private String bestSocialTime;
/** 适合社交场合 */
private String suitableOccasion;
/** 人际建议 */
private String interpersonalAdvice;
/** 出行运势评分 */
private int travelScore;
/** 整体出行运势 */
private String overallTravelLuck;
/** 安全指数 */
private String safetyIndex;
/** 顺利指数 */
private String smoothnessIndex;
/** 出行建议 */
private String travelAdvice;
/** 最佳出行时间 */
private String bestTravelTime;
/** 适合交通方式 */
private String suitableTransport;
/** 注意事项 */
private String precautions;
/** 贵人方位 */
private String nobleDirection;
/** 用户ID */
private Long userId;
/** 运势年份 */
private Year fortuneYear;
/** 整体运势描述 */
private String overallLuck;
/** 整体运势评分 */
private int overallScore;
/** 各宫位运势映射表 */
private Map<PalaceType, PalaceFortune> palaceFortunes;
/** 每月运势列表 */
private List<MonthlyFortune> monthlyFortunes;
/** 事业建议 */
private String careerAdvice;
/** 财运建议 */
private String wealthAdvice;
/** 感情建议 */
private String relationshipAdvice;
/** 健康建议 */
private String healthAdvice;
/** 幸运颜色 */
private String luckyColor;
/** 幸运数字 */
private String luckyNumber;
/** 幸运方位 */
private String luckyDirection;
/** 本年重点 */
private String keyFocus;
/** 注意事项 */
private String cautionAdvice;
/** 年度主题 */
private String yearlyTheme;
/** 主要机遇 */
private String majorOpportunity;
/** 主要挑战 */
private String majorChallenge;
/**
* 默认构造函数
*/
public YearlyFortune() {
}
/**
* 生成主键ID
*
* @return 主键ID
*/
public Long generateId() {
this.id = SnowflakeId.nextId();
return this.id;
}
/**
* 删除运势
*/
public void delete() {
this.deletedAt = LocalDateTime.now();
}
/**
* 获取主键ID
*
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
*
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
*
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
/**
* 全参构造函数
*
* @param userId 用户ID
* @param fortuneYear 运势年份
* @param overallLuck 整体运势描述
* @param overallScore 整体运势评分
* @param palaceFortunes 各宫位运势映射表
* @param monthlyFortunes 每月运势列表
* @param careerAdvice 事业建议
* @param wealthAdvice 财运建议
* @param relationshipAdvice 感情建议
* @param healthAdvice 健康建议
* @param luckyColor 幸运颜色
* @param luckyNumber 幸运数字
* @param luckyDirection 幸运方位
* @param keyFocus 本年重点
* @param cautionAdvice 注意事项
* @param yearlyTheme 年度主题
* @param majorOpportunity 主要机遇
* @param majorChallenge 主要挑战
*/
public YearlyFortune(Long userId, Year fortuneYear, String overallLuck, int overallScore,
Map<PalaceType, PalaceFortune> palaceFortunes, List<MonthlyFortune> monthlyFortunes, String careerAdvice,
String wealthAdvice, String relationshipAdvice, String healthAdvice, String luckyColor, String luckyNumber,
String luckyDirection, String keyFocus, String cautionAdvice, String yearlyTheme, String majorOpportunity,
String majorChallenge) {
this.userId = userId;
this.fortuneYear = fortuneYear;
this.overallLuck = overallLuck;
this.overallScore = overallScore;
this.palaceFortunes = palaceFortunes;
this.monthlyFortunes = monthlyFortunes;
this.careerAdvice = careerAdvice;
this.wealthAdvice = wealthAdvice;
this.relationshipAdvice = relationshipAdvice;
this.healthAdvice = healthAdvice;
this.luckyColor = luckyColor;
this.luckyNumber = luckyNumber;
this.luckyDirection = luckyDirection;
this.keyFocus = keyFocus;
this.cautionAdvice = cautionAdvice;
this.yearlyTheme = yearlyTheme;
this.majorOpportunity = majorOpportunity;
this.majorChallenge = majorChallenge;
}
/**
* 获取用户ID
*
* @return 用户ID
*/
public Long getUserId() {
return userId;
}
/**
* 设置用户ID
*
* @param userId 用户ID
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 获取运势年份
*
* @return 运势年份
*/
public Year getFortuneYear() {
return fortuneYear;
}
/**
* 设置运势年份
*
* @param fortuneYear 运势年份
*/
public void setFortuneYear(Year fortuneYear) {
this.fortuneYear = fortuneYear;
}
/**
* 获取整体运势描述
*
* @return 整体运势描述
*/
public String getOverallLuck() {
return overallLuck;
}
/**
* 设置整体运势描述
*
* @param overallLuck 整体运势描述
*/
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
/**
* 获取整体运势评分
*
* @return 整体运势评分
*/
public int getOverallScore() {
return overallScore;
}
/**
* 设置整体运势评分
*
* @param overallScore 整体运势评分
*/
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
/**
* 获取各宫位运势映射表
*
* @return 各宫位运势映射表
*/
public Map<PalaceType, PalaceFortune> getPalaceFortunes() {
return palaceFortunes;
}
/**
* 设置各宫位运势映射表
*
* @param palaceFortunes 各宫位运势映射表
*/
public void setPalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
/**
* 获取每月运势列表
*
* @return 每月运势列表
*/
public List<MonthlyFortune> getMonthlyFortunes() {
return monthlyFortunes;
}
/**
* 设置每月运势列表
*
* @param monthlyFortunes 每月运势列表
*/
public void setMonthlyFortunes(List<MonthlyFortune> monthlyFortunes) {
this.monthlyFortunes = monthlyFortunes;
}
/**
* 获取事业建议
*
* @return 事业建议
*/
public String getCareerAdvice() {
return careerAdvice;
}
/**
* 设置事业建议
*
* @param careerAdvice 事业建议
*/
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
/**
* 获取财运建议
*
* @return 财运建议
*/
public String getWealthAdvice() {
return wealthAdvice;
}
/**
* 设置财运建议
*
* @param wealthAdvice 财运建议
*/
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
/**
* 获取感情建议
*
* @return 感情建议
*/
public String getRelationshipAdvice() {
return relationshipAdvice;
}
/**
* 设置感情建议
*
* @param relationshipAdvice 感情建议
*/
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
/**
* 获取健康建议
*
* @return 健康建议
*/
public String getHealthAdvice() {
return healthAdvice;
}
/**
* 设置健康建议
*
* @param healthAdvice 健康建议
*/
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
/**
* 获取幸运颜色
*
* @return 幸运颜色
*/
public String getLuckyColor() {
return luckyColor;
}
/**
* 设置幸运颜色
*
* @param luckyColor 幸运颜色
*/
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
/**
* 获取幸运数字
*
* @return 幸运数字
*/
public String getLuckyNumber() {
return luckyNumber;
}
/**
* 设置幸运数字
*
* @param luckyNumber 幸运数字
*/
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
/**
* 获取幸运方位
*
* @return 幸运方位
*/
public String getLuckyDirection() {
return luckyDirection;
}
/**
* 设置幸运方位
*
* @param luckyDirection 幸运方位
*/
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
/**
* 获取本年重点
*
* @return 本年重点
*/
public String getKeyFocus() {
return keyFocus;
}
/**
* 设置本年重点
*
* @param keyFocus 本年重点
*/
public void setKeyFocus(String keyFocus) {
this.keyFocus = keyFocus;
}
/**
* 获取注意事项
*
* @return 注意事项
*/
public String getCautionAdvice() {
return cautionAdvice;
}
/**
* 设置注意事项
*
* @param cautionAdvice 注意事项
*/
public void setCautionAdvice(String cautionAdvice) {
this.cautionAdvice = cautionAdvice;
}
/**
* 获取年度主题
*
* @return 年度主题
*/
public String getYearlyTheme() {
return yearlyTheme;
}
/**
* 设置年度主题
*
* @param yearlyTheme 年度主题
*/
public void setYearlyTheme(String yearlyTheme) {
this.yearlyTheme = yearlyTheme;
}
/**
* 获取主要机遇
*
* @return 主要机遇
*/
public String getMajorOpportunity() {
return majorOpportunity;
}
/**
* 设置主要机遇
*
* @param majorOpportunity 主要机遇
*/
public void setMajorOpportunity(String majorOpportunity) {
this.majorOpportunity = majorOpportunity;
}
/**
* 获取主要挑战
*
* @return 主要挑战
*/
public String getMajorChallenge() {
return majorChallenge;
}
/**
* 设置主要挑战
*
* @param majorChallenge 主要挑战
*/
public void setMajorChallenge(String majorChallenge) {
this.majorChallenge = majorChallenge;
}
public int getLoveScore() {
return loveScore;
}
public void setLoveScore(int loveScore) {
this.loveScore = loveScore;
}
public String getOverallLoveLuck() {
return overallLoveLuck;
}
public void setOverallLoveLuck(String overallLoveLuck) {
this.overallLoveLuck = overallLoveLuck;
}
public String getPeachBlossomIndex() {
return peachBlossomIndex;
}
public void setPeachBlossomIndex(String peachBlossomIndex) {
this.peachBlossomIndex = peachBlossomIndex;
}
public String getSingleAdvice() {
return singleAdvice;
}
public void setSingleAdvice(String singleAdvice) {
this.singleAdvice = singleAdvice;
}
public String getDatingAdvice() {
return datingAdvice;
}
public void setDatingAdvice(String datingAdvice) {
this.datingAdvice = datingAdvice;
}
public String getMarriageAdvice() {
return marriageAdvice;
}
public void setMarriageAdvice(String marriageAdvice) {
this.marriageAdvice = marriageAdvice;
}
public String getBestDatingTime() {
return bestDatingTime;
}
public void setBestDatingTime(String bestDatingTime) {
this.bestDatingTime = bestDatingTime;
}
public int getStudyScore() {
return studyScore;
}
public void setStudyScore(int studyScore) {
this.studyScore = studyScore;
}
public String getOverallStudyLuck() {
return overallStudyLuck;
}
public void setOverallStudyLuck(String overallStudyLuck) {
this.overallStudyLuck = overallStudyLuck;
}
public String getFocusIndex() {
return focusIndex;
}
public void setFocusIndex(String focusIndex) {
this.focusIndex = focusIndex;
}
public String getMemoryIndex() {
return memoryIndex;
}
public void setMemoryIndex(String memoryIndex) {
this.memoryIndex = memoryIndex;
}
public String getStudyAdvice() {
return studyAdvice;
}
public void setStudyAdvice(String studyAdvice) {
this.studyAdvice = studyAdvice;
}
public String getExamLuck() {
return examLuck;
}
public void setExamLuck(String examLuck) {
this.examLuck = examLuck;
}
public String getBestStudyTime() {
return bestStudyTime;
}
public void setBestStudyTime(String bestStudyTime) {
this.bestStudyTime = bestStudyTime;
}
public String getSuitableSubjects() {
return suitableSubjects;
}
public void setSuitableSubjects(String suitableSubjects) {
this.suitableSubjects = suitableSubjects;
}
public String getStudyEnvironmentAdvice() {
return studyEnvironmentAdvice;
}
public void setStudyEnvironmentAdvice(String studyEnvironmentAdvice) {
this.studyEnvironmentAdvice = studyEnvironmentAdvice;
}
public int getSocialScore() {
return socialScore;
}
public void setSocialScore(int socialScore) {
this.socialScore = socialScore;
}
public String getOverallSocialLuck() {
return overallSocialLuck;
}
public void setOverallSocialLuck(String overallSocialLuck) {
this.overallSocialLuck = overallSocialLuck;
}
public String getPopularityIndex() {
return popularityIndex;
}
public void setPopularityIndex(String popularityIndex) {
this.popularityIndex = popularityIndex;
}
public String getCommunicationAbility() {
return communicationAbility;
}
public void setCommunicationAbility(String communicationAbility) {
this.communicationAbility = communicationAbility;
}
public String getSocialAdvice() {
return socialAdvice;
}
public void setSocialAdvice(String socialAdvice) {
this.socialAdvice = socialAdvice;
}
public String getNobleLuck() {
return nobleLuck;
}
public void setNobleLuck(String nobleLuck) {
this.nobleLuck = nobleLuck;
}
public String getBestSocialTime() {
return bestSocialTime;
}
public void setBestSocialTime(String bestSocialTime) {
this.bestSocialTime = bestSocialTime;
}
public String getSuitableOccasion() {
return suitableOccasion;
}
public void setSuitableOccasion(String suitableOccasion) {
this.suitableOccasion = suitableOccasion;
}
public String getInterpersonalAdvice() {
return interpersonalAdvice;
}
public void setInterpersonalAdvice(String interpersonalAdvice) {
this.interpersonalAdvice = interpersonalAdvice;
}
public int getTravelScore() {
return travelScore;
}
public void setTravelScore(int travelScore) {
this.travelScore = travelScore;
}
public String getOverallTravelLuck() {
return overallTravelLuck;
}
public void setOverallTravelLuck(String overallTravelLuck) {
this.overallTravelLuck = overallTravelLuck;
}
public String getSafetyIndex() {
return safetyIndex;
}
public void setSafetyIndex(String safetyIndex) {
this.safetyIndex = safetyIndex;
}
public String getSmoothnessIndex() {
return smoothnessIndex;
}
public void setSmoothnessIndex(String smoothnessIndex) {
this.smoothnessIndex = smoothnessIndex;
}
public String getTravelAdvice() {
return travelAdvice;
}
public void setTravelAdvice(String travelAdvice) {
this.travelAdvice = travelAdvice;
}
public String getBestTravelTime() {
return bestTravelTime;
}
public void setBestTravelTime(String bestTravelTime) {
this.bestTravelTime = bestTravelTime;
}
public String getSuitableTransport() {
return suitableTransport;
}
public void setSuitableTransport(String suitableTransport) {
this.suitableTransport = suitableTransport;
}
public String getPrecautions() {
return precautions;
}
public void setPrecautions(String precautions) {
this.precautions = precautions;
}
public String getNobleDirection() {
return nobleDirection;
}
public void setNobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
YearlyFortune that = (YearlyFortune) o;
return new EqualsBuilder()
.append(overallScore, that.overallScore)
.append(userId, that.userId)
.append(fortuneYear, that.fortuneYear)
.append(overallLuck, that.overallLuck)
.append(palaceFortunes, that.palaceFortunes)
.append(monthlyFortunes, that.monthlyFortunes)
.append(careerAdvice, that.careerAdvice)
.append(wealthAdvice, that.wealthAdvice)
.append(relationshipAdvice, that.relationshipAdvice)
.append(healthAdvice, that.healthAdvice)
.append(luckyColor, that.luckyColor)
.append(luckyNumber, that.luckyNumber)
.append(luckyDirection, that.luckyDirection)
.append(keyFocus, that.keyFocus)
.append(cautionAdvice, that.cautionAdvice)
.append(yearlyTheme, that.yearlyTheme)
.append(majorOpportunity, that.majorOpportunity)
.append(majorChallenge, that.majorChallenge)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(fortuneYear)
.append(overallLuck)
.append(overallScore)
.append(palaceFortunes)
.append(monthlyFortunes)
.append(careerAdvice)
.append(wealthAdvice)
.append(relationshipAdvice)
.append(healthAdvice)
.append(luckyColor)
.append(luckyNumber)
.append(luckyDirection)
.append(keyFocus)
.append(cautionAdvice)
.append(yearlyTheme)
.append(majorOpportunity)
.append(majorChallenge)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("userId", userId)
.append("fortuneYear", fortuneYear)
.append("overallLuck", overallLuck)
.append("overallScore", overallScore)
.append("palaceFortunes", palaceFortunes)
.append("monthlyFortunes", monthlyFortunes)
.append("careerAdvice", careerAdvice)
.append("wealthAdvice", wealthAdvice)
.append("relationshipAdvice", relationshipAdvice)
.append("healthAdvice", healthAdvice)
.append("luckyColor", luckyColor)
.append("luckyNumber", luckyNumber)
.append("luckyDirection", luckyDirection)
.append("keyFocus", keyFocus)
.append("cautionAdvice", cautionAdvice)
.append("yearlyTheme", yearlyTheme)
.append("majorOpportunity", majorOpportunity)
.append("majorChallenge", majorChallenge)
.toString();
}
}
@@ -0,0 +1,483 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.EarthlyBranch;
import io.destiny.biz.enums.HeavenlyStem;
import io.destiny.biz.util.PatternRecognitionUtil;
import io.destiny.biz.util.SanFangSiZhengUtil;
import io.destiny.common.utils.SnowflakeId;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 紫微盘类,用于表示紫微斗数命盘
* 包含命主的出生信息、十二宫位、天干地支等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class ZiweiChart {
/** 主键ID */
private Long id;
/** 创建时间 */
private LocalDateTime createdAt;
/** 更新时间 */
private LocalDateTime updatedAt;
/** 删除时间 */
private LocalDateTime deletedAt;
/** 出生信息 */
private BirthInfo birthInfo;
/** 十二宫位列表 */
private List<Palace> palaces;
/** 年干 */
private HeavenlyStem yearStem;
/** 命宫地支 */
private EarthlyBranch mingGongBranch;
/** 身宫地支 */
private EarthlyBranch shenGongBranch;
/** 命盘总结 */
private String summary;
/** 整体运势 */
private String overallLuck;
/** 三方四正信息 */
private SanFangSiZhengUtil.SanFangSiZheng sanFangSiZheng;
/** 格局列表 */
private List<PatternRecognitionUtil.Pattern> patterns;
/**
* 默认构造函数
*/
public ZiweiChart() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
this.palaces = new ArrayList<>();
}
/**
* 全参构造函数
*
* @param birthInfo 出生信息
* @param palaces 十二宫位列表
* @param yearStem 年干
* @param mingGongBranch 命宫地支
* @param shenGongBranch 身宫地支
* @param summary 命盘总结
* @param overallLuck 整体运势
*/
public ZiweiChart(BirthInfo birthInfo, List<Palace> palaces, HeavenlyStem yearStem, EarthlyBranch mingGongBranch,
EarthlyBranch shenGongBranch, String summary, String overallLuck) {
this.birthInfo = birthInfo;
this.palaces = palaces;
this.yearStem = yearStem;
this.mingGongBranch = mingGongBranch;
this.shenGongBranch = shenGongBranch;
this.summary = summary;
this.overallLuck = overallLuck;
}
/**
* 根据出生信息创建紫微盘
*
* @param birthInfo 出生信息
*/
public ZiweiChart(BirthInfo birthInfo) {
this.birthInfo = birthInfo;
this.palaces = new ArrayList<>();
this.yearStem = birthInfo.getYearStem();
}
/**
* 获取出生信息
*
* @return 出生信息
*/
public BirthInfo getBirthInfo() {
return birthInfo;
}
/**
* 设置出生信息
*
* @param birthInfo 出生信息
*/
public void setBirthInfo(BirthInfo birthInfo) {
this.birthInfo = birthInfo;
}
/**
* 获取十二宫位列表
*
* @return 宫位列表
*/
public List<Palace> getPalaces() {
return palaces;
}
/**
* 设置十二宫位列表
*
* @param palaces 宫位列表
*/
public void setPalaces(List<Palace> palaces) {
this.palaces = palaces;
}
/**
* 获取年干
*
* @return 年干
*/
public HeavenlyStem getYearStem() {
return yearStem;
}
/**
* 设置年干
*
* @param yearStem 年干
*/
public void setYearStem(HeavenlyStem yearStem) {
this.yearStem = yearStem;
}
/**
* 获取命宫地支
*
* @return 命宫地支
*/
public EarthlyBranch getMingGongBranch() {
return mingGongBranch;
}
/**
* 设置命宫地支
*
* @param mingGongBranch 命宫地支
*/
public void setMingGongBranch(EarthlyBranch mingGongBranch) {
this.mingGongBranch = mingGongBranch;
}
/**
* 获取身宫地支
*
* @return 身宫地支
*/
public EarthlyBranch getShenGongBranch() {
return shenGongBranch;
}
/**
* 设置身宫地支
*
* @param shenGongBranch 身宫地支
*/
public void setShenGongBranch(EarthlyBranch shenGongBranch) {
this.shenGongBranch = shenGongBranch;
}
/**
* 获取命盘总结
*
* @return 命盘总结
*/
public String getSummary() {
return summary;
}
/**
* 设置命盘总结
*
* @param summary 命盘总结
*/
public void setSummary(String summary) {
this.summary = summary;
}
/**
* 获取整体运势
*
* @return 整体运势
*/
public String getOverallLuck() {
return overallLuck;
}
/**
* 设置整体运势
*
* @param overallLuck 整体运势
*/
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
/**
* 获取三方四正信息
*
* @return 三方四正信息
*/
public SanFangSiZhengUtil.SanFangSiZheng getSanFangSiZheng() {
return sanFangSiZheng;
}
/**
* 设置三方四正信息
*
* @param sanFangSiZheng 三方四正信息
*/
public void setSanFangSiZheng(SanFangSiZhengUtil.SanFangSiZheng sanFangSiZheng) {
this.sanFangSiZheng = sanFangSiZheng;
}
/**
* 获取格局列表
*
* @return 格局列表
*/
public List<PatternRecognitionUtil.Pattern> getPatterns() {
return patterns;
}
/**
* 设置格局列表
*
* @param patterns 格局列表
*/
public void setPatterns(List<PatternRecognitionUtil.Pattern> patterns) {
this.patterns = patterns;
}
/**
* 获取主键ID
*
* @return 主键ID
*/
public Long getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public LocalDateTime getCreatedAt() {
return createdAt;
}
/**
* 设置创建时间
*
* @param createdAt 创建时间
*/
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
/**
* 获取更新时间
*
* @return 更新时间
*/
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
/**
* 设置更新时间
*
* @param updatedAt 更新时间
*/
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
/**
* 获取删除时间
*
* @return 删除时间
*/
public LocalDateTime getDeletedAt() {
return deletedAt;
}
/**
* 设置删除时间
*
* @param deletedAt 删除时间
*/
public void setDeletedAt(LocalDateTime deletedAt) {
this.deletedAt = deletedAt;
}
/**
* 生成主键ID
*
* @return 主键ID
*/
public Long generateId() {
this.id = SnowflakeId.nextId();
return this.id;
}
/**
* 删除紫微盘
*/
public void delete() {
this.deletedAt = LocalDateTime.now();
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ZiweiChart that = (ZiweiChart) o;
return new EqualsBuilder()
.append(id, that.id)
.append(birthInfo, that.birthInfo)
.append(palaces, that.palaces)
.append(yearStem, that.yearStem)
.append(mingGongBranch, that.mingGongBranch)
.append(shenGongBranch, that.shenGongBranch)
.append(summary, that.summary)
.append(overallLuck, that.overallLuck)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(id)
.append(birthInfo)
.append(palaces)
.append(yearStem)
.append(mingGongBranch)
.append(shenGongBranch)
.append(summary)
.append(overallLuck)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("createdAt", createdAt)
.append("updatedAt", updatedAt)
.append("deletedAt", deletedAt)
.append("birthInfo", birthInfo)
.append("palaces", palaces)
.append("yearStem", yearStem)
.append("mingGongBranch", mingGongBranch)
.append("shenGongBranch", shenGongBranch)
.append("summary", summary)
.append("overallLuck", overallLuck)
.toString();
}
/**
* 根据宫位类型获取宫位
*
* @param palaceType 宫位类型名称
* @return 对应的宫位,如果未找到则返回null
*/
public Palace getPalaceByType(String palaceType) {
return palaces.stream()
.filter(p -> p.getPalaceType().getName().equals(palaceType))
.findFirst()
.orElse(null);
}
/**
* 根据地支获取宫位
*
* @param branch 地支
* @return 对应的宫位,如果未找到则返回null
*/
public Palace getPalaceByBranch(EarthlyBranch branch) {
return palaces.stream()
.filter(p -> p.getEarthlyBranch() == branch)
.findFirst()
.orElse(null);
}
/**
* 验证紫微盘数据的完整性和一致性
*
* @throws IllegalStateException 当数据验证失败时抛出
*/
public void validate() {
List<String> errors = new ArrayList<>();
if (palaces == null || palaces.isEmpty()) {
errors.add("宫位列表不能为空");
} else {
if (palaces.size() != 12) {
errors.add("宫位数量必须为12个,当前为" + palaces.size() + "");
}
Set<EarthlyBranch> branches = new HashSet<>();
Set<String> palaceTypes = new HashSet<>();
for (Palace palace : palaces) {
if (palace == null) {
errors.add("宫位列表中包含null元素");
continue;
}
EarthlyBranch branch = palace.getEarthlyBranch();
if (branch != null) {
if (branches.contains(branch)) {
errors.add("地支" + branch.getName() + "重复出现在多个宫位中");
}
branches.add(branch);
} else {
errors.add("宫位" + palace.getPalaceType().getName() + "的地支为空");
}
String palaceType = palace.getPalaceType().getName();
if (palaceTypes.contains(palaceType)) {
errors.add("宫位类型" + palaceType + "重复出现");
}
palaceTypes.add(palaceType);
}
}
if (mingGongBranch == null) {
errors.add("命宫地支不能为空");
}
if (shenGongBranch == null) {
errors.add("身宫地支不能为空");
}
if (mingGongBranch != null && shenGongBranch != null && mingGongBranch == shenGongBranch) {
errors.add("命宫和身宫不能为同一地支:" + mingGongBranch.getName());
}
if (birthInfo == null) {
errors.add("出生信息不能为空");
}
if (!errors.isEmpty()) {
throw new IllegalStateException("紫微盘数据验证失败:" + String.join("; ", errors));
}
}
}
@@ -0,0 +1,43 @@
package io.destiny.biz.domain;
import io.destiny.biz.enums.EarthlyBranch;
import java.util.HashMap;
import java.util.Map;
public class ZiweiStarPlacementTable {
private static final Map<Integer, Map<Integer, EarthlyBranch>> PLACEMENT_TABLE = new HashMap<>();
static {
initializePlacementTable();
}
private static void initializePlacementTable() {
for (int day = 1; day <= 30; day++) {
Map<Integer, EarthlyBranch> dayPlacement = new HashMap<>();
for (int shiIndex = 1; shiIndex <= 12; shiIndex++) {
dayPlacement.put(shiIndex, calculateZiweiPosition(day, shiIndex));
}
PLACEMENT_TABLE.put(day, dayPlacement);
}
}
public static EarthlyBranch getZiweiPosition(int day, int shiIndex) {
if (day < 1 || day > 30) {
throw new IllegalArgumentException("出生日必须在1-30之间");
}
if (shiIndex < 1 || shiIndex > 12) {
throw new IllegalArgumentException("时辰索引必须在1-12之间");
}
return PLACEMENT_TABLE.get(day).get(shiIndex);
}
private static EarthlyBranch calculateZiweiPosition(int day, int shiIndex) {
int ziweiIndex = (day + shiIndex) % 12;
if (ziweiIndex == 0) {
ziweiIndex = 12;
}
return EarthlyBranch.fromIndex(ziweiIndex);
}
}
@@ -0,0 +1,409 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.Almanac;
import io.destiny.biz.domain.LunarDate;
import io.destiny.biz.enums.EarthlyBranch;
import io.destiny.biz.enums.HeavenlyStem;
import io.destiny.biz.service.ICalendarService;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Schema(description = "黄历信息响应DTO")
public class AlmanacResponse {
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static final String[] CHINESE_NUMBERS = { "", "", "", "", "", "", "", "", "", "", "" };
@Schema(description = "阳历日期", example = "2024-01-01")
private String solarDate;
@Schema(description = "农历日期", example = "二〇二三年十一月二十日")
private String lunarDate;
@Schema(description = "年干支", example = "癸卯")
private String yearGanZhi;
@Schema(description = "月干支", example = "甲子")
private String monthGanZhi;
@Schema(description = "日干支", example = "庚子")
private String dayGanZhi;
@Schema(description = "宜事项", example = "[\"祭祀\", \"祈福\", \"求嗣\"]")
private List<String> suitable;
@Schema(description = "忌事项", example = "[\"嫁娶\", \"开市\", \"动土\"]")
private List<String> unsuitable;
@Schema(description = "贵人方位", example = "丑、未")
private String nobleDirection;
@Schema(description = "", example = "")
private String clash;
@Schema(description = "", example = "")
private String evil;
@Schema(description = "建除十二神", example = "")
private String jianChu;
@Schema(description = "值日星神", example = "天德")
private String dailyStar;
@Schema(description = "纳音五行", example = "壁上土")
private String naYin;
@Schema(description = "胎神方位", example = "占房床")
private String fetusGod;
@Schema(description = "彭祖百忌", example = "庚不开仓 辰不哭泣")
private String pengzuTaboo;
@Schema(description = "财神方位", example = "正北")
private String fortuneDirection;
public AlmanacResponse() {
}
public AlmanacResponse(String solarDate, String lunarDate, String yearGanZhi, String monthGanZhi, String dayGanZhi,
List<String> suitable, List<String> unsuitable, String nobleDirection, String clash, String evil,
String jianChu, String dailyStar, String naYin, String fetusGod, String pengzuTaboo,
String fortuneDirection) {
this.solarDate = solarDate;
this.lunarDate = lunarDate;
this.yearGanZhi = yearGanZhi;
this.monthGanZhi = monthGanZhi;
this.dayGanZhi = dayGanZhi;
this.suitable = suitable;
this.unsuitable = unsuitable;
this.nobleDirection = nobleDirection;
this.clash = clash;
this.evil = evil;
this.jianChu = jianChu;
this.dailyStar = dailyStar;
this.naYin = naYin;
this.fetusGod = fetusGod;
this.pengzuTaboo = pengzuTaboo;
this.fortuneDirection = fortuneDirection;
}
public String getSolarDate() {
return solarDate;
}
public void setSolarDate(String solarDate) {
this.solarDate = solarDate;
}
public String getLunarDate() {
return lunarDate;
}
public void setLunarDate(String lunarDate) {
this.lunarDate = lunarDate;
}
public String getYearGanZhi() {
return yearGanZhi;
}
public void setYearGanZhi(String yearGanZhi) {
this.yearGanZhi = yearGanZhi;
}
public String getMonthGanZhi() {
return monthGanZhi;
}
public void setMonthGanZhi(String monthGanZhi) {
this.monthGanZhi = monthGanZhi;
}
public String getDayGanZhi() {
return dayGanZhi;
}
public void setDayGanZhi(String dayGanZhi) {
this.dayGanZhi = dayGanZhi;
}
public List<String> getSuitable() {
return suitable;
}
public void setSuitable(List<String> suitable) {
this.suitable = suitable;
}
public List<String> getUnsuitable() {
return unsuitable;
}
public void setUnsuitable(List<String> unsuitable) {
this.unsuitable = unsuitable;
}
public String getNobleDirection() {
return nobleDirection;
}
public void setNobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
}
public String getClash() {
return clash;
}
public void setClash(String clash) {
this.clash = clash;
}
public String getEvil() {
return evil;
}
public void setEvil(String evil) {
this.evil = evil;
}
public String getJianChu() {
return jianChu;
}
public void setJianChu(String jianChu) {
this.jianChu = jianChu;
}
public String getDailyStar() {
return dailyStar;
}
public void setDailyStar(String dailyStar) {
this.dailyStar = dailyStar;
}
public String getNaYin() {
return naYin;
}
public void setNaYin(String naYin) {
this.naYin = naYin;
}
public String getFetusGod() {
return fetusGod;
}
public void setFetusGod(String fetusGod) {
this.fetusGod = fetusGod;
}
public String getPengzuTaboo() {
return pengzuTaboo;
}
public void setPengzuTaboo(String pengzuTaboo) {
this.pengzuTaboo = pengzuTaboo;
}
public String getFortuneDirection() {
return fortuneDirection;
}
public void setFortuneDirection(String fortuneDirection) {
this.fortuneDirection = fortuneDirection;
}
public static Builder builder() {
return new Builder();
}
public static AlmanacResponse fromAlmanac(Almanac almanac, ICalendarService calendarService) {
LocalDateTime solarDate = almanac.getSolarDate();
LunarDate lunarDate = almanac.getLunarDate();
int lunarYear = Integer.parseInt(lunarDate.getLunarYear());
int lunarMonth = Integer.parseInt(lunarDate.getLunarMonth());
HeavenlyStem yearStem = calendarService.getYearStem(lunarYear);
EarthlyBranch yearBranch = calendarService.getYearBranch(lunarYear);
HeavenlyStem monthStem = calendarService.getMonthStem(yearStem, lunarMonth);
EarthlyBranch monthBranch = calendarService.getMonthBranch(lunarMonth);
HeavenlyStem dayStem = calendarService.getDayStem(solarDate);
EarthlyBranch dayBranch = calendarService.getDayBranch(solarDate);
return builder()
.solarDate(solarDate.format(DATE_FORMATTER))
.lunarDate(formatLunarDate(lunarDate))
.yearGanZhi(yearStem.getName() + yearBranch.getName())
.monthGanZhi(monthStem.getName() + monthBranch.getName())
.dayGanZhi(dayStem.getName() + dayBranch.getName())
.suitable(almanac.getSuitable())
.unsuitable(almanac.getUnsuitable())
.nobleDirection(almanac.getNobleDirection())
.clash(almanac.getClash())
.evil(almanac.getEvil())
.jianChu(almanac.getJianChu())
.dailyStar(almanac.getStarGod())
.naYin(almanac.getNaYin())
.fetusGod(almanac.getFetusGod())
.pengzuTaboo(almanac.getPengzuTaboo())
.fortuneDirection(almanac.getFortuneDirection())
.build();
}
private static String formatLunarDate(LunarDate lunarDate) {
String year = convertToChineseNumber(lunarDate.getLunarYear());
String month = formatChineseMonth(lunarDate.getLunarMonth());
String day = formatChineseDay(lunarDate.getLunarDay());
return year + "" + month + day;
}
private static String convertToChineseNumber(String number) {
StringBuilder result = new StringBuilder();
for (char c : number.toCharArray()) {
int digit = c - '0';
result.append(CHINESE_NUMBERS[digit]);
}
return result.toString();
}
private static String formatChineseMonth(String month) {
int monthNum = Integer.parseInt(month);
if (monthNum == 1) {
return "正月";
} else if (monthNum == 11) {
return "冬月";
} else if (monthNum == 12) {
return "腊月";
} else {
return CHINESE_NUMBERS[monthNum] + "";
}
}
private static String formatChineseDay(String day) {
int dayNum = Integer.parseInt(day);
if (dayNum <= 10) {
return "" + CHINESE_NUMBERS[dayNum];
} else if (dayNum == 20) {
return "二十";
} else if (dayNum == 30) {
return "三十";
} else if (dayNum < 20) {
return "" + CHINESE_NUMBERS[dayNum % 10];
} else {
return "廿" + CHINESE_NUMBERS[dayNum % 10];
}
}
public static class Builder {
private String solarDate;
private String lunarDate;
private String yearGanZhi;
private String monthGanZhi;
private String dayGanZhi;
private List<String> suitable;
private List<String> unsuitable;
private String nobleDirection;
private String clash;
private String evil;
private String jianChu;
private String dailyStar;
private String naYin;
private String fetusGod;
private String pengzuTaboo;
private String fortuneDirection;
public Builder solarDate(String solarDate) {
this.solarDate = solarDate;
return this;
}
public Builder lunarDate(String lunarDate) {
this.lunarDate = lunarDate;
return this;
}
public Builder yearGanZhi(String yearGanZhi) {
this.yearGanZhi = yearGanZhi;
return this;
}
public Builder monthGanZhi(String monthGanZhi) {
this.monthGanZhi = monthGanZhi;
return this;
}
public Builder dayGanZhi(String dayGanZhi) {
this.dayGanZhi = dayGanZhi;
return this;
}
public Builder suitable(List<String> suitable) {
this.suitable = suitable;
return this;
}
public Builder unsuitable(List<String> unsuitable) {
this.unsuitable = unsuitable;
return this;
}
public Builder nobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
return this;
}
public Builder clash(String clash) {
this.clash = clash;
return this;
}
public Builder evil(String evil) {
this.evil = evil;
return this;
}
public Builder jianChu(String jianChu) {
this.jianChu = jianChu;
return this;
}
public Builder dailyStar(String dailyStar) {
this.dailyStar = dailyStar;
return this;
}
public Builder naYin(String naYin) {
this.naYin = naYin;
return this;
}
public Builder fetusGod(String fetusGod) {
this.fetusGod = fetusGod;
return this;
}
public Builder pengzuTaboo(String pengzuTaboo) {
this.pengzuTaboo = pengzuTaboo;
return this;
}
public Builder fortuneDirection(String fortuneDirection) {
this.fortuneDirection = fortuneDirection;
return this;
}
public AlmanacResponse build() {
return new AlmanacResponse(solarDate, lunarDate, yearGanZhi, monthGanZhi, dayGanZhi, suitable, unsuitable,
nobleDirection, clash, evil, jianChu, dailyStar, naYin, fetusGod, pengzuTaboo, fortuneDirection);
}
}
}
@@ -0,0 +1,63 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
import java.util.List;
@Schema(description = "批量日运势请求DTO")
public class BatchDailyFortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期列表")
private List<LocalDate> fortuneDates;
public BatchDailyFortuneRequest() {
}
public BatchDailyFortuneRequest(Long userId, String birthTime, String gender, List<LocalDate> fortuneDates) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDates = fortuneDates;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public List<LocalDate> getFortuneDates() {
return fortuneDates;
}
public void setFortuneDates(List<LocalDate> fortuneDates) {
this.fortuneDates = fortuneDates;
}
}
@@ -0,0 +1,42 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.DailyFortune;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.stream.Collectors;
@Schema(description = "批量日运势响应DTO")
public class BatchDailyFortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "日运势列表")
private List<DailyFortuneResponse> dailyFortunes;
public BatchDailyFortuneResponse() {
}
public BatchDailyFortuneResponse(Long userId, List<DailyFortune> dailyFortunes) {
this.userId = userId;
this.dailyFortunes = dailyFortunes.stream()
.map(DailyFortuneResponse::fromDailyFortune)
.collect(Collectors.toList());
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public List<DailyFortuneResponse> getDailyFortunes() {
return dailyFortunes;
}
public void setDailyFortunes(List<DailyFortuneResponse> dailyFortunes) {
this.dailyFortunes = dailyFortunes;
}
}
@@ -0,0 +1,63 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.YearMonth;
import java.util.List;
@Schema(description = "批量月运势请求DTO")
public class BatchMonthlyFortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势月份列表")
private List<YearMonth> fortuneMonths;
public BatchMonthlyFortuneRequest() {
}
public BatchMonthlyFortuneRequest(Long userId, String birthTime, String gender, List<YearMonth> fortuneMonths) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneMonths = fortuneMonths;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public List<YearMonth> getFortuneMonths() {
return fortuneMonths;
}
public void setFortuneMonths(List<YearMonth> fortuneMonths) {
this.fortuneMonths = fortuneMonths;
}
}
@@ -0,0 +1,42 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.MonthlyFortune;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.stream.Collectors;
@Schema(description = "批量月运势响应DTO")
public class BatchMonthlyFortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "月运势列表")
private List<MonthlyFortuneResponse> monthlyFortunes;
public BatchMonthlyFortuneResponse() {
}
public BatchMonthlyFortuneResponse(Long userId, List<MonthlyFortune> monthlyFortunes) {
this.userId = userId;
this.monthlyFortunes = monthlyFortunes.stream()
.map(MonthlyFortuneResponse::fromMonthlyFortune)
.collect(Collectors.toList());
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public List<MonthlyFortuneResponse> getMonthlyFortunes() {
return monthlyFortunes;
}
public void setMonthlyFortunes(List<MonthlyFortuneResponse> monthlyFortunes) {
this.monthlyFortunes = monthlyFortunes;
}
}
@@ -0,0 +1,62 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "批量年运势请求DTO")
public class BatchYearlyFortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势年份列表")
private List<Integer> fortuneYears;
public BatchYearlyFortuneRequest() {
}
public BatchYearlyFortuneRequest(Long userId, String birthTime, String gender, List<Integer> fortuneYears) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneYears = fortuneYears;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public List<Integer> getFortuneYears() {
return fortuneYears;
}
public void setFortuneYears(List<Integer> fortuneYears) {
this.fortuneYears = fortuneYears;
}
}
@@ -0,0 +1,42 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.YearlyFortune;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.stream.Collectors;
@Schema(description = "批量年运势响应DTO")
public class BatchYearlyFortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "年运势列表")
private List<YearlyFortuneResponse> yearlyFortunes;
public BatchYearlyFortuneResponse() {
}
public BatchYearlyFortuneResponse(Long userId, List<YearlyFortune> yearlyFortunes) {
this.userId = userId;
this.yearlyFortunes = yearlyFortunes.stream()
.map(YearlyFortuneResponse::fromYearlyFortune)
.collect(Collectors.toList());
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public List<YearlyFortuneResponse> getYearlyFortunes() {
return yearlyFortunes;
}
public void setYearlyFortunes(List<YearlyFortuneResponse> yearlyFortunes) {
this.yearlyFortunes = yearlyFortunes;
}
}
@@ -0,0 +1,98 @@
package io.destiny.biz.dto;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
/**
* 历法转换请求DTO
* 用于接收阳历转阴历的请求
*
* @author 张翔
* @date 2026-01-04
*/
public class CalendarRequest {
@NotNull(message = "出生时间不能为空")
private LocalDateTime birthTime;
@NotNull(message = "性别不能为空")
private String gender;
public CalendarRequest() {
}
public CalendarRequest(LocalDateTime birthTime, String gender) {
this.birthTime = birthTime;
this.gender = gender;
}
public LocalDateTime getBirthTime() {
return birthTime;
}
public void setBirthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CalendarRequest that = (CalendarRequest) o;
return new EqualsBuilder()
.append(birthTime, that.birthTime)
.append(gender, that.gender)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(birthTime)
.append(gender)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("birthTime", birthTime)
.append("gender", gender)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private LocalDateTime birthTime;
private String gender;
public Builder birthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
return this;
}
public Builder gender(String gender) {
this.gender = gender;
return this;
}
public CalendarRequest build() {
return new CalendarRequest(birthTime, gender);
}
}
}
@@ -0,0 +1,261 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.BirthInfo;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
/**
* 历法转换响应DTO
* 用于返回阳历转阴历的结果,包含天干地支信息
*
* @author 张翔
* @date 2026-01-04
*/
public class CalendarResponse {
private LocalDateTime birthTime;
private String yearStem;
private String yearBranch;
private String monthStem;
private String monthBranch;
private String dayStem;
private String dayBranch;
private String hourStem;
private String hourBranch;
private String gender;
public CalendarResponse() {
}
public CalendarResponse(LocalDateTime birthTime, String yearStem, String yearBranch, String monthStem, String monthBranch, String dayStem, String dayBranch, String hourStem, String hourBranch, String gender) {
this.birthTime = birthTime;
this.yearStem = yearStem;
this.yearBranch = yearBranch;
this.monthStem = monthStem;
this.monthBranch = monthBranch;
this.dayStem = dayStem;
this.dayBranch = dayBranch;
this.hourStem = hourStem;
this.hourBranch = hourBranch;
this.gender = gender;
}
public LocalDateTime getBirthTime() {
return birthTime;
}
public void setBirthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
}
public String getYearStem() {
return yearStem;
}
public void setYearStem(String yearStem) {
this.yearStem = yearStem;
}
public String getYearBranch() {
return yearBranch;
}
public void setYearBranch(String yearBranch) {
this.yearBranch = yearBranch;
}
public String getMonthStem() {
return monthStem;
}
public void setMonthStem(String monthStem) {
this.monthStem = monthStem;
}
public String getMonthBranch() {
return monthBranch;
}
public void setMonthBranch(String monthBranch) {
this.monthBranch = monthBranch;
}
public String getDayStem() {
return dayStem;
}
public void setDayStem(String dayStem) {
this.dayStem = dayStem;
}
public String getDayBranch() {
return dayBranch;
}
public void setDayBranch(String dayBranch) {
this.dayBranch = dayBranch;
}
public String getHourStem() {
return hourStem;
}
public void setHourStem(String hourStem) {
this.hourStem = hourStem;
}
public String getHourBranch() {
return hourBranch;
}
public void setHourBranch(String hourBranch) {
this.hourBranch = hourBranch;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CalendarResponse that = (CalendarResponse) o;
return new EqualsBuilder()
.append(birthTime, that.birthTime)
.append(yearStem, that.yearStem)
.append(yearBranch, that.yearBranch)
.append(monthStem, that.monthStem)
.append(monthBranch, that.monthBranch)
.append(dayStem, that.dayStem)
.append(dayBranch, that.dayBranch)
.append(hourStem, that.hourStem)
.append(hourBranch, that.hourBranch)
.append(gender, that.gender)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(birthTime)
.append(yearStem)
.append(yearBranch)
.append(monthStem)
.append(monthBranch)
.append(dayStem)
.append(dayBranch)
.append(hourStem)
.append(hourBranch)
.append(gender)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("birthTime", birthTime)
.append("yearStem", yearStem)
.append("yearBranch", yearBranch)
.append("monthStem", monthStem)
.append("monthBranch", monthBranch)
.append("dayStem", dayStem)
.append("dayBranch", dayBranch)
.append("hourStem", hourStem)
.append("hourBranch", hourBranch)
.append("gender", gender)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private LocalDateTime birthTime;
private String yearStem;
private String yearBranch;
private String monthStem;
private String monthBranch;
private String dayStem;
private String dayBranch;
private String hourStem;
private String hourBranch;
private String gender;
public Builder birthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
return this;
}
public Builder yearStem(String yearStem) {
this.yearStem = yearStem;
return this;
}
public Builder yearBranch(String yearBranch) {
this.yearBranch = yearBranch;
return this;
}
public Builder monthStem(String monthStem) {
this.monthStem = monthStem;
return this;
}
public Builder monthBranch(String monthBranch) {
this.monthBranch = monthBranch;
return this;
}
public Builder dayStem(String dayStem) {
this.dayStem = dayStem;
return this;
}
public Builder dayBranch(String dayBranch) {
this.dayBranch = dayBranch;
return this;
}
public Builder hourStem(String hourStem) {
this.hourStem = hourStem;
return this;
}
public Builder hourBranch(String hourBranch) {
this.hourBranch = hourBranch;
return this;
}
public Builder gender(String gender) {
this.gender = gender;
return this;
}
public CalendarResponse build() {
return new CalendarResponse(birthTime, yearStem, yearBranch, monthStem, monthBranch, dayStem, dayBranch, hourStem, hourBranch, gender);
}
}
public static CalendarResponse fromBirthInfo(BirthInfo birthInfo) {
return CalendarResponse.builder()
.birthTime(birthInfo.getBirthTime())
.yearStem(birthInfo.getYearStem() != null ? birthInfo.getYearStem().getName() : null)
.yearBranch(birthInfo.getYearBranch() != null ? birthInfo.getYearBranch().getName() : null)
.monthStem(birthInfo.getMonthStem() != null ? birthInfo.getMonthStem().getName() : null)
.monthBranch(birthInfo.getMonthBranch() != null ? birthInfo.getMonthBranch().getName() : null)
.dayStem(birthInfo.getDayStem() != null ? birthInfo.getDayStem().getName() : null)
.dayBranch(birthInfo.getDayBranch() != null ? birthInfo.getDayBranch().getName() : null)
.hourStem(birthInfo.getHourStem() != null ? birthInfo.getHourStem().getName() : null)
.hourBranch(birthInfo.getHourBranch() != null ? birthInfo.getHourBranch().getName() : null)
.gender(birthInfo.getGender())
.build();
}
}
@@ -0,0 +1,86 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "事业运势请求DTO")
public class CareerFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "职业阶段", example = "初级")
private String careerStage;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public CareerFortuneRequest() {
}
public CareerFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String careerStage, String timeZone) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.careerStage = careerStage;
this.timeZone = timeZone;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getCareerStage() {
return careerStage;
}
public void setCareerStage(String careerStage) {
this.careerStage = careerStage;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,132 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "事业运势响应DTO")
public class CareerFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体事业运势", example = "事业运势上升")
private String overallCareerLuck;
@Schema(description = "事业运势评分", example = "85")
private int careerScore;
@Schema(description = "晋升机会", example = "有机会")
private String promotionOpportunity;
@Schema(description = "职业发展建议", example = "适合学习新技能")
private String careerAdvice;
@Schema(description = "最佳工作时间", example = "上午")
private String bestWorkTime;
@Schema(description = "幸运方位", example = "东南方")
private String luckyDirection;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public CareerFortuneResponse() {
}
public CareerFortuneResponse(Long userId, LocalDate fortuneDate, String overallCareerLuck, int careerScore, String promotionOpportunity, String careerAdvice, String bestWorkTime, String luckyDirection) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallCareerLuck = overallCareerLuck;
this.careerScore = careerScore;
this.promotionOpportunity = promotionOpportunity;
this.careerAdvice = careerAdvice;
this.bestWorkTime = bestWorkTime;
this.luckyDirection = luckyDirection;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallCareerLuck() {
return overallCareerLuck;
}
public void setOverallCareerLuck(String overallCareerLuck) {
this.overallCareerLuck = overallCareerLuck;
}
public int getCareerScore() {
return careerScore;
}
public void setCareerScore(int careerScore) {
this.careerScore = careerScore;
}
public String getPromotionOpportunity() {
return promotionOpportunity;
}
public void setPromotionOpportunity(String promotionOpportunity) {
this.promotionOpportunity = promotionOpportunity;
}
public String getCareerAdvice() {
return careerAdvice;
}
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
public String getBestWorkTime() {
return bestWorkTime;
}
public void setBestWorkTime(String bestWorkTime) {
this.bestWorkTime = bestWorkTime;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,122 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "图表数据请求DTO")
public class ChartDataRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "图表类型", example = "trend")
private String chartType;
@Schema(description = "运势类型", example = "career")
private String fortuneType;
@Schema(description = "开始日期")
private LocalDate startDate;
@Schema(description = "结束日期")
private LocalDate endDate;
@Schema(description = "对比用户ID列表", example = "[123, 456]")
private String[] compareUserIds;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public ChartDataRequest() {
}
public ChartDataRequest(Long userId, String birthTime, String gender, String chartType, String fortuneType, LocalDate startDate, LocalDate endDate, String[] compareUserIds, String timeZone) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.chartType = chartType;
this.fortuneType = fortuneType;
this.startDate = startDate;
this.endDate = endDate;
this.compareUserIds = compareUserIds;
this.timeZone = timeZone;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getChartType() {
return chartType;
}
public void setChartType(String chartType) {
this.chartType = chartType;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public String[] getCompareUserIds() {
return compareUserIds;
}
public void setCompareUserIds(String[] compareUserIds) {
this.compareUserIds = compareUserIds;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,294 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.Map;
@Schema(description = "图表数据响应DTO")
public class ChartDataResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "图表类型", example = "trend")
private String chartType;
@Schema(description = "运势类型", example = "career")
private String fortuneType;
@Schema(description = "开始日期", example = "2026-01-01")
private String startDate;
@Schema(description = "结束日期", example = "2026-01-31")
private String endDate;
@Schema(description = "图表标题", example = "事业运势趋势图")
private String chartTitle;
@Schema(description = "X轴标签", example = "日期")
private String xAxisLabel;
@Schema(description = "Y轴标签", example = "运势评分")
private String yAxisLabel;
@Schema(description = "数据系列列表")
private List<DataSeries> dataSeries;
@Schema(description = "雷达图维度")
private List<RadarDimension> radarDimensions;
@Schema(description = "元数据")
private Map<String, Object> metadata;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public ChartDataResponse() {
}
public ChartDataResponse(Long userId, String chartType, String fortuneType, String startDate, String endDate, String chartTitle, String xAxisLabel, String yAxisLabel, List<DataSeries> dataSeries, List<RadarDimension> radarDimensions, Map<String, Object> metadata, String timeZone) {
this.userId = userId;
this.chartType = chartType;
this.fortuneType = fortuneType;
this.startDate = startDate;
this.endDate = endDate;
this.chartTitle = chartTitle;
this.xAxisLabel = xAxisLabel;
this.yAxisLabel = yAxisLabel;
this.dataSeries = dataSeries;
this.radarDimensions = radarDimensions;
this.metadata = metadata;
this.timeZone = timeZone;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getChartType() {
return chartType;
}
public void setChartType(String chartType) {
this.chartType = chartType;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getChartTitle() {
return chartTitle;
}
public void setChartTitle(String chartTitle) {
this.chartTitle = chartTitle;
}
public String getXAxisLabel() {
return xAxisLabel;
}
public void setXAxisLabel(String xAxisLabel) {
this.xAxisLabel = xAxisLabel;
}
public String getYAxisLabel() {
return yAxisLabel;
}
public void setYAxisLabel(String yAxisLabel) {
this.yAxisLabel = yAxisLabel;
}
public List<DataSeries> getDataSeries() {
return dataSeries;
}
public void setDataSeries(List<DataSeries> dataSeries) {
this.dataSeries = dataSeries;
}
public List<RadarDimension> getRadarDimensions() {
return radarDimensions;
}
public void setRadarDimensions(List<RadarDimension> radarDimensions) {
this.radarDimensions = radarDimensions;
}
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
this.metadata = metadata;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
@Schema(description = "数据系列")
public static class DataSeries {
@Schema(description = "系列名称", example = "事业运势")
private String name;
@Schema(description = "数据点列表")
private List<DataPoint> dataPoints;
@Schema(description = "颜色", example = "#FF6B6B")
private String color;
public DataSeries() {
}
public DataSeries(String name, List<DataPoint> dataPoints, String color) {
this.name = name;
this.dataPoints = dataPoints;
this.color = color;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<DataPoint> getDataPoints() {
return dataPoints;
}
public void setDataPoints(List<DataPoint> dataPoints) {
this.dataPoints = dataPoints;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
@Schema(description = "数据点")
public static class DataPoint {
@Schema(description = "X轴值", example = "2026-01-01")
private String x;
@Schema(description = "Y轴值", example = "85")
private Double y;
@Schema(description = "标签", example = "85分")
private String label;
public DataPoint() {
}
public DataPoint(String x, Double y, String label) {
this.x = x;
this.y = y;
this.label = label;
}
public String getX() {
return x;
}
public void setX(String x) {
this.x = x;
}
public Double getY() {
return y;
}
public void setY(Double y) {
this.y = y;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}
@Schema(description = "雷达图维度")
public static class RadarDimension {
@Schema(description = "维度名称", example = "事业")
private String dimension;
@Schema(description = "维度值", example = "85")
private Double value;
@Schema(description = "最大值", example = "100")
private Double maxValue;
public RadarDimension() {
}
public RadarDimension(String dimension, Double value, Double maxValue) {
this.dimension = dimension;
this.value = value;
this.maxValue = maxValue;
}
public String getDimension() {
return dimension;
}
public void setDimension(String dimension) {
this.dimension = dimension;
}
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
public Double getMaxValue() {
return maxValue;
}
public void setMaxValue(Double maxValue) {
this.maxValue = maxValue;
}
}
}
@@ -0,0 +1,140 @@
package io.destiny.biz.dto;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDate;
/**
* 日运请求DTO
* 用于接收日运生成请求
*
* @author 张翔
* @date 2026-01-04
*/
public class DailyFortuneRequest {
@NotNull(message = "用户ID不能为空")
private Long userId;
@NotNull(message = "出生时间不能为空")
private String birthTime;
@NotNull(message = "性别不能为空")
private String gender;
@NotNull(message = "运势日期不能为空")
private LocalDate fortuneDate;
public DailyFortuneRequest() {
}
public DailyFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DailyFortuneRequest that = (DailyFortuneRequest) o;
return new EqualsBuilder()
.append(userId, that.userId)
.append(birthTime, that.birthTime)
.append(gender, that.gender)
.append(fortuneDate, that.fortuneDate)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(birthTime)
.append(gender)
.append(fortuneDate)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("userId", userId)
.append("birthTime", birthTime)
.append("gender", gender)
.append("fortuneDate", fortuneDate)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long userId;
private String birthTime;
private String gender;
private LocalDate fortuneDate;
public Builder userId(Long userId) {
this.userId = userId;
return this;
}
public Builder birthTime(String birthTime) {
this.birthTime = birthTime;
return this;
}
public Builder gender(String gender) {
this.gender = gender;
return this;
}
public Builder fortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
return this;
}
public DailyFortuneRequest build() {
return new DailyFortuneRequest(userId, birthTime, gender, fortuneDate);
}
}
}
@@ -0,0 +1,304 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.DailyFortune;
import io.destiny.biz.domain.PalaceFortune;
import io.destiny.biz.enums.PalaceType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDate;
import java.util.Map;
/**
* 日运响应DTO
* 用于返回日运分析结果
*
* @author 张翔
* @date 2026-01-04
*/
public class DailyFortuneResponse {
private Long userId;
private LocalDate fortuneDate;
private String overallLuck;
private int overallScore;
private Map<PalaceType, PalaceFortune> palaceFortunes;
private String careerAdvice;
private String wealthAdvice;
private String relationshipAdvice;
private String healthAdvice;
private String luckyColor;
private String luckyNumber;
private String luckyDirection;
public DailyFortuneResponse() {
}
public DailyFortuneResponse(Long userId, LocalDate fortuneDate, String overallLuck, int overallScore, Map<PalaceType, PalaceFortune> palaceFortunes, String careerAdvice, String wealthAdvice, String relationshipAdvice, String healthAdvice, String luckyColor, String luckyNumber, String luckyDirection) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallLuck = overallLuck;
this.overallScore = overallScore;
this.palaceFortunes = palaceFortunes;
this.careerAdvice = careerAdvice;
this.wealthAdvice = wealthAdvice;
this.relationshipAdvice = relationshipAdvice;
this.healthAdvice = healthAdvice;
this.luckyColor = luckyColor;
this.luckyNumber = luckyNumber;
this.luckyDirection = luckyDirection;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallLuck() {
return overallLuck;
}
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
public int getOverallScore() {
return overallScore;
}
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
public Map<PalaceType, PalaceFortune> getPalaceFortunes() {
return palaceFortunes;
}
public void setPalaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
public String getCareerAdvice() {
return careerAdvice;
}
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
public String getWealthAdvice() {
return wealthAdvice;
}
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
public String getRelationshipAdvice() {
return relationshipAdvice;
}
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
public String getHealthAdvice() {
return healthAdvice;
}
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DailyFortuneResponse that = (DailyFortuneResponse) o;
return new EqualsBuilder()
.append(userId, that.userId)
.append(fortuneDate, that.fortuneDate)
.append(overallLuck, that.overallLuck)
.append(overallScore, that.overallScore)
.append(palaceFortunes, that.palaceFortunes)
.append(careerAdvice, that.careerAdvice)
.append(wealthAdvice, that.wealthAdvice)
.append(relationshipAdvice, that.relationshipAdvice)
.append(healthAdvice, that.healthAdvice)
.append(luckyColor, that.luckyColor)
.append(luckyNumber, that.luckyNumber)
.append(luckyDirection, that.luckyDirection)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(fortuneDate)
.append(overallLuck)
.append(overallScore)
.append(palaceFortunes)
.append(careerAdvice)
.append(wealthAdvice)
.append(relationshipAdvice)
.append(healthAdvice)
.append(luckyColor)
.append(luckyNumber)
.append(luckyDirection)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("userId", userId)
.append("fortuneDate", fortuneDate)
.append("overallLuck", overallLuck)
.append("overallScore", overallScore)
.append("palaceFortunes", palaceFortunes)
.append("careerAdvice", careerAdvice)
.append("wealthAdvice", wealthAdvice)
.append("relationshipAdvice", relationshipAdvice)
.append("healthAdvice", healthAdvice)
.append("luckyColor", luckyColor)
.append("luckyNumber", luckyNumber)
.append("luckyDirection", luckyDirection)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long userId;
private LocalDate fortuneDate;
private String overallLuck;
private int overallScore;
private Map<PalaceType, PalaceFortune> palaceFortunes;
private String careerAdvice;
private String wealthAdvice;
private String relationshipAdvice;
private String healthAdvice;
private String luckyColor;
private String luckyNumber;
private String luckyDirection;
public Builder userId(Long userId) {
this.userId = userId;
return this;
}
public Builder fortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
return this;
}
public Builder overallLuck(String overallLuck) {
this.overallLuck = overallLuck;
return this;
}
public Builder overallScore(int overallScore) {
this.overallScore = overallScore;
return this;
}
public Builder palaceFortunes(Map<PalaceType, PalaceFortune> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
return this;
}
public Builder careerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
return this;
}
public Builder wealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
return this;
}
public Builder relationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
return this;
}
public Builder healthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
return this;
}
public Builder luckyColor(String luckyColor) {
this.luckyColor = luckyColor;
return this;
}
public Builder luckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
return this;
}
public Builder luckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
return this;
}
public DailyFortuneResponse build() {
return new DailyFortuneResponse(userId, fortuneDate, overallLuck, overallScore, palaceFortunes, careerAdvice, wealthAdvice, relationshipAdvice, healthAdvice, luckyColor, luckyNumber, luckyDirection);
}
}
public static DailyFortuneResponse fromDailyFortune(DailyFortune dailyFortune) {
return DailyFortuneResponse.builder()
.userId(dailyFortune.getUserId())
.fortuneDate(dailyFortune.getFortuneDate())
.overallLuck(dailyFortune.getOverallLuck())
.overallScore(dailyFortune.getOverallScore())
.palaceFortunes(dailyFortune.getPalaceFortunes())
.careerAdvice(dailyFortune.getCareerAdvice())
.wealthAdvice(dailyFortune.getWealthAdvice())
.relationshipAdvice(dailyFortune.getRelationshipAdvice())
.healthAdvice(dailyFortune.getHealthAdvice())
.luckyColor(dailyFortune.getLuckyColor())
.luckyNumber(dailyFortune.getLuckyNumber())
.luckyDirection(dailyFortune.getLuckyDirection())
.build();
}
}
@@ -0,0 +1,63 @@
package io.destiny.biz.dto;
import io.destiny.biz.enums.FortuneType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "历史运势查询请求DTO")
public class FortuneHistoryRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "开始日期")
private LocalDate startDate;
@Schema(description = "结束日期")
private LocalDate endDate;
@Schema(description = "运势类型")
private FortuneType fortuneType;
public FortuneHistoryRequest() {
}
public FortuneHistoryRequest(Long userId, LocalDate startDate, LocalDate endDate, FortuneType fortuneType) {
this.userId = userId;
this.startDate = startDate;
this.endDate = endDate;
this.fortuneType = fortuneType;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public FortuneType getFortuneType() {
return fortuneType;
}
public void setFortuneType(FortuneType fortuneType) {
this.fortuneType = fortuneType;
}
}
@@ -0,0 +1,121 @@
package io.destiny.biz.dto;
import io.destiny.biz.enums.FortuneType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
import java.util.List;
@Schema(description = "历史运势查询响应DTO")
public class FortuneHistoryResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势类型", example = "DAILY")
private FortuneType fortuneType;
@Schema(description = "开始日期", example = "2026-01-01")
private LocalDate startDate;
@Schema(description = "结束日期", example = "2026-12-31")
private LocalDate endDate;
@Schema(description = "运势记录列表")
private List<FortuneRecord> records;
public FortuneHistoryResponse() {
}
public FortuneHistoryResponse(Long userId, FortuneType fortuneType, LocalDate startDate, LocalDate endDate, List<FortuneRecord> records) {
this.userId = userId;
this.fortuneType = fortuneType;
this.startDate = startDate;
this.endDate = endDate;
this.records = records;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public FortuneType getFortuneType() {
return fortuneType;
}
public void setFortuneType(FortuneType fortuneType) {
this.fortuneType = fortuneType;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public List<FortuneRecord> getRecords() {
return records;
}
public void setRecords(List<FortuneRecord> records) {
this.records = records;
}
@Schema(description = "运势记录")
public static class FortuneRecord {
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体评分", example = "85")
private int overallScore;
@Schema(description = "整体运势", example = "运势较好")
private String overallLuck;
public FortuneRecord() {
}
public FortuneRecord(LocalDate fortuneDate, int overallScore, String overallLuck) {
this.fortuneDate = fortuneDate;
this.overallScore = overallScore;
this.overallLuck = overallLuck;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public int getOverallScore() {
return overallScore;
}
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
public String getOverallLuck() {
return overallLuck;
}
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
}
}
@@ -0,0 +1,7 @@
package io.destiny.biz.dto;
public interface FortuneRequest {
Long getUserId();
String getBirthTime();
String getGender();
}
@@ -0,0 +1,6 @@
package io.destiny.biz.dto;
public interface FortuneResponse {
Long getUserId();
void setUserId(Long userId);
}
@@ -0,0 +1,74 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "运势趋势分析请求DTO")
public class FortuneTrendAnalysisRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "开始日期")
private LocalDate startDate;
@Schema(description = "结束日期")
private LocalDate endDate;
@Schema(description = "运势类型")
private String fortuneType;
@Schema(description = "分析维度")
private String analysisDimension;
public FortuneTrendAnalysisRequest() {
}
public FortuneTrendAnalysisRequest(Long userId, LocalDate startDate, LocalDate endDate, String fortuneType, String analysisDimension) {
this.userId = userId;
this.startDate = startDate;
this.endDate = endDate;
this.fortuneType = fortuneType;
this.analysisDimension = analysisDimension;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public String getAnalysisDimension() {
return analysisDimension;
}
public void setAnalysisDimension(String analysisDimension) {
this.analysisDimension = analysisDimension;
}
}
@@ -0,0 +1,167 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "运势趋势分析响应DTO")
public class FortuneTrendAnalysisResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势类型", example = "DAILY")
private String fortuneType;
@Schema(description = "分析维度", example = "OVERALL")
private String analysisDimension;
@Schema(description = "趋势数据")
private List<TrendData> trendData;
@Schema(description = "平均分", example = "85")
private double averageScore;
@Schema(description = "最高分", example = "95")
private int maxScore;
@Schema(description = "最低分", example = "70")
private int minScore;
@Schema(description = "趋势方向", example = "上升")
private String trendDirection;
@Schema(description = "建议", example = "整体运势呈上升趋势")
private String advice;
public FortuneTrendAnalysisResponse() {
}
public FortuneTrendAnalysisResponse(Long userId, String fortuneType, String analysisDimension, List<TrendData> trendData, double averageScore, int maxScore, int minScore, String trendDirection, String advice) {
this.userId = userId;
this.fortuneType = fortuneType;
this.analysisDimension = analysisDimension;
this.trendData = trendData;
this.averageScore = averageScore;
this.maxScore = maxScore;
this.minScore = minScore;
this.trendDirection = trendDirection;
this.advice = advice;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public String getAnalysisDimension() {
return analysisDimension;
}
public void setAnalysisDimension(String analysisDimension) {
this.analysisDimension = analysisDimension;
}
public List<TrendData> getTrendData() {
return trendData;
}
public void setTrendData(List<TrendData> trendData) {
this.trendData = trendData;
}
public double getAverageScore() {
return averageScore;
}
public void setAverageScore(double averageScore) {
this.averageScore = averageScore;
}
public int getMaxScore() {
return maxScore;
}
public void setMaxScore(int maxScore) {
this.maxScore = maxScore;
}
public int getMinScore() {
return minScore;
}
public void setMinScore(int minScore) {
this.minScore = minScore;
}
public String getTrendDirection() {
return trendDirection;
}
public void setTrendDirection(String trendDirection) {
this.trendDirection = trendDirection;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
@Schema(description = "趋势数据")
public static class TrendData {
@Schema(description = "日期")
private String date;
@Schema(description = "分数")
private int score;
@Schema(description = "运势描述")
private String luck;
public TrendData() {
}
public TrendData(String date, int score, String luck) {
this.date = date;
this.score = score;
this.luck = luck;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getLuck() {
return luck;
}
public void setLuck(String luck) {
this.luck = luck;
}
}
}
@@ -0,0 +1,63 @@
package io.destiny.biz.dto;
import io.destiny.biz.enums.FortuneType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "运势趋势查询请求DTO")
public class FortuneTrendRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "开始日期")
private LocalDate startDate;
@Schema(description = "结束日期")
private LocalDate endDate;
@Schema(description = "运势类型")
private FortuneType fortuneType;
public FortuneTrendRequest() {
}
public FortuneTrendRequest(Long userId, LocalDate startDate, LocalDate endDate, FortuneType fortuneType) {
this.userId = userId;
this.startDate = startDate;
this.endDate = endDate;
this.fortuneType = fortuneType;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public FortuneType getFortuneType() {
return fortuneType;
}
public void setFortuneType(FortuneType fortuneType) {
this.fortuneType = fortuneType;
}
}
@@ -0,0 +1,190 @@
package io.destiny.biz.dto;
import io.destiny.biz.enums.FortuneType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
import java.util.List;
@Schema(description = "运势趋势查询响应DTO")
public class FortuneTrendResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势类型", example = "DAILY")
private FortuneType fortuneType;
@Schema(description = "开始日期", example = "2026-01-01")
private LocalDate startDate;
@Schema(description = "结束日期", example = "2026-12-31")
private LocalDate endDate;
@Schema(description = "趋势点列表")
private List<TrendPoint> trendPoints;
@Schema(description = "趋势分析")
private TrendAnalysis analysis;
public FortuneTrendResponse() {
}
public FortuneTrendResponse(Long userId, FortuneType fortuneType, LocalDate startDate, LocalDate endDate, List<TrendPoint> trendPoints, TrendAnalysis analysis) {
this.userId = userId;
this.fortuneType = fortuneType;
this.startDate = startDate;
this.endDate = endDate;
this.trendPoints = trendPoints;
this.analysis = analysis;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public FortuneType getFortuneType() {
return fortuneType;
}
public void setFortuneType(FortuneType fortuneType) {
this.fortuneType = fortuneType;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public List<TrendPoint> getTrendPoints() {
return trendPoints;
}
public void setTrendPoints(List<TrendPoint> trendPoints) {
this.trendPoints = trendPoints;
}
public TrendAnalysis getAnalysis() {
return analysis;
}
public void setAnalysis(TrendAnalysis analysis) {
this.analysis = analysis;
}
@Schema(description = "趋势点")
public static class TrendPoint {
@Schema(description = "日期", example = "2026-01-05")
private LocalDate date;
@Schema(description = "分数", example = "85")
private int score;
public TrendPoint() {
}
public TrendPoint(LocalDate date, int score) {
this.date = date;
this.score = score;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
}
@Schema(description = "趋势分析")
public static class TrendAnalysis {
@Schema(description = "平均分", example = "85.5")
private double averageScore;
@Schema(description = "最高分", example = "95")
private double maxScore;
@Schema(description = "最低分", example = "70")
private double minScore;
@Schema(description = "趋势方向", example = "上升")
private String trendDirection;
@Schema(description = "总结", example = "整体运势呈上升趋势")
private String summary;
public TrendAnalysis() {
}
public TrendAnalysis(double averageScore, double maxScore, double minScore, String trendDirection, String summary) {
this.averageScore = averageScore;
this.maxScore = maxScore;
this.minScore = minScore;
this.trendDirection = trendDirection;
this.summary = summary;
}
public double getAverageScore() {
return averageScore;
}
public void setAverageScore(double averageScore) {
this.averageScore = averageScore;
}
public double getMaxScore() {
return maxScore;
}
public void setMaxScore(double maxScore) {
this.maxScore = maxScore;
}
public double getMinScore() {
return minScore;
}
public void setMinScore(double minScore) {
this.minScore = minScore;
}
public String getTrendDirection() {
return trendDirection;
}
public void setTrendDirection(String trendDirection) {
this.trendDirection = trendDirection;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
}
}
@@ -0,0 +1,86 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "健康运势请求DTO")
public class HealthFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "健康关注点", example = "睡眠")
private String healthFocus;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public HealthFortuneRequest() {
}
public HealthFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String healthFocus, String timeZone) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.healthFocus = healthFocus;
this.timeZone = timeZone;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getHealthFocus() {
return healthFocus;
}
public void setHealthFocus(String healthFocus) {
this.healthFocus = healthFocus;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,156 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "健康运势响应DTO")
public class HealthFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体健康运势", example = "健康状况良好")
private String overallHealthLuck;
@Schema(description = "健康运势评分", example = "85")
private int healthScore;
@Schema(description = "体力状况", example = "精力充沛")
private String physicalCondition;
@Schema(description = "精神状态", example = "心情愉悦")
private String mentalState;
@Schema(description = "健康建议", example = "注意休息")
private String healthAdvice;
@Schema(description = "运动建议", example = "适合有氧运动")
private String exerciseAdvice;
@Schema(description = "饮食建议", example = "清淡饮食")
private String dietAdvice;
@Schema(description = "最佳休息时间", example = "晚上10点")
private String bestRestTime;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public HealthFortuneResponse() {
}
public HealthFortuneResponse(Long userId, LocalDate fortuneDate, String overallHealthLuck, int healthScore, String physicalCondition, String mentalState, String healthAdvice, String exerciseAdvice, String dietAdvice, String bestRestTime) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallHealthLuck = overallHealthLuck;
this.healthScore = healthScore;
this.physicalCondition = physicalCondition;
this.mentalState = mentalState;
this.healthAdvice = healthAdvice;
this.exerciseAdvice = exerciseAdvice;
this.dietAdvice = dietAdvice;
this.bestRestTime = bestRestTime;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallHealthLuck() {
return overallHealthLuck;
}
public void setOverallHealthLuck(String overallHealthLuck) {
this.overallHealthLuck = overallHealthLuck;
}
public int getHealthScore() {
return healthScore;
}
public void setHealthScore(int healthScore) {
this.healthScore = healthScore;
}
public String getPhysicalCondition() {
return physicalCondition;
}
public void setPhysicalCondition(String physicalCondition) {
this.physicalCondition = physicalCondition;
}
public String getMentalState() {
return mentalState;
}
public void setMentalState(String mentalState) {
this.mentalState = mentalState;
}
public String getHealthAdvice() {
return healthAdvice;
}
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
public String getExerciseAdvice() {
return exerciseAdvice;
}
public void setExerciseAdvice(String exerciseAdvice) {
this.exerciseAdvice = exerciseAdvice;
}
public String getDietAdvice() {
return dietAdvice;
}
public void setDietAdvice(String dietAdvice) {
this.dietAdvice = dietAdvice;
}
public String getBestRestTime() {
return bestRestTime;
}
public void setBestRestTime(String bestRestTime) {
this.bestRestTime = bestRestTime;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,86 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "历史运势查询请求DTO")
public class HistoryFortuneQueryRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "开始日期")
private LocalDate startDate;
@Schema(description = "结束日期")
private LocalDate endDate;
@Schema(description = "运势类型")
private String fortuneType;
@Schema(description = "页码", example = "1")
private Integer pageNum;
@Schema(description = "每页大小", example = "10")
private Integer pageSize;
public HistoryFortuneQueryRequest() {
}
public HistoryFortuneQueryRequest(Long userId, LocalDate startDate, LocalDate endDate, String fortuneType, Integer pageNum, Integer pageSize) {
this.userId = userId;
this.startDate = startDate;
this.endDate = endDate;
this.fortuneType = fortuneType;
this.pageNum = pageNum;
this.pageSize = pageSize;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}
@@ -0,0 +1,155 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "历史运势查询响应DTO")
public class HistoryFortuneQueryResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势类型", example = "DAILY")
private String fortuneType;
@Schema(description = "运势记录列表")
private List<FortuneRecord> records;
@Schema(description = "总记录数", example = "100")
private Long total;
@Schema(description = "当前页码", example = "1")
private Integer pageNum;
@Schema(description = "每页大小", example = "10")
private Integer pageSize;
@Schema(description = "总页数", example = "10")
private Integer totalPages;
public HistoryFortuneQueryResponse() {
}
public HistoryFortuneQueryResponse(Long userId, String fortuneType, List<FortuneRecord> records, Long total, Integer pageNum, Integer pageSize, Integer totalPages) {
this.userId = userId;
this.fortuneType = fortuneType;
this.records = records;
this.total = total;
this.pageNum = pageNum;
this.pageSize = pageSize;
this.totalPages = totalPages;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getFortuneType() {
return fortuneType;
}
public void setFortuneType(String fortuneType) {
this.fortuneType = fortuneType;
}
public List<FortuneRecord> getRecords() {
return records;
}
public void setRecords(List<FortuneRecord> records) {
this.records = records;
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotalPages() {
return totalPages;
}
public void setTotalPages(Integer totalPages) {
this.totalPages = totalPages;
}
@Schema(description = "运势记录")
public static class FortuneRecord {
@Schema(description = "运势日期")
private String fortuneDate;
@Schema(description = "整体运势")
private String overallLuck;
@Schema(description = "运势评分")
private int score;
@Schema(description = "创建时间")
private String createdAt;
public FortuneRecord() {
}
public FortuneRecord(String fortuneDate, String overallLuck, int score, String createdAt) {
this.fortuneDate = fortuneDate;
this.overallLuck = overallLuck;
this.score = score;
this.createdAt = createdAt;
}
public String getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(String fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallLuck() {
return overallLuck;
}
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
}
}
@@ -0,0 +1,86 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "爱情运势请求DTO")
public class LoveFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "关系状态", example = "单身")
private String relationshipStatus;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public LoveFortuneRequest() {
}
public LoveFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String relationshipStatus, String timeZone) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.relationshipStatus = relationshipStatus;
this.timeZone = timeZone;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getRelationshipStatus() {
return relationshipStatus;
}
public void setRelationshipStatus(String relationshipStatus) {
this.relationshipStatus = relationshipStatus;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,168 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "爱情运势响应DTO")
public class LoveFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体爱情运势", example = "桃花运旺盛")
private String overallLoveLuck;
@Schema(description = "爱情运势评分", example = "85")
private int loveScore;
@Schema(description = "桃花指数", example = "")
private String peachBlossomIndex;
@Schema(description = "单身建议", example = "适合参加社交活动")
private String singleAdvice;
@Schema(description = "恋爱建议", example = "适合深入交流")
private String datingAdvice;
@Schema(description = "婚姻建议", example = "适合谈论未来")
private String marriageAdvice;
@Schema(description = "最佳约会时间", example = "周末下午")
private String bestDatingTime;
@Schema(description = "幸运颜色", example = "粉色")
private String luckyColor;
@Schema(description = "幸运方位", example = "东南方")
private String luckyDirection;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public LoveFortuneResponse() {
}
public LoveFortuneResponse(Long userId, LocalDate fortuneDate, String overallLoveLuck, int loveScore, String peachBlossomIndex, String singleAdvice, String datingAdvice, String marriageAdvice, String bestDatingTime, String luckyColor, String luckyDirection) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallLoveLuck = overallLoveLuck;
this.loveScore = loveScore;
this.peachBlossomIndex = peachBlossomIndex;
this.singleAdvice = singleAdvice;
this.datingAdvice = datingAdvice;
this.marriageAdvice = marriageAdvice;
this.bestDatingTime = bestDatingTime;
this.luckyColor = luckyColor;
this.luckyDirection = luckyDirection;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallLoveLuck() {
return overallLoveLuck;
}
public void setOverallLoveLuck(String overallLoveLuck) {
this.overallLoveLuck = overallLoveLuck;
}
public int getLoveScore() {
return loveScore;
}
public void setLoveScore(int loveScore) {
this.loveScore = loveScore;
}
public String getPeachBlossomIndex() {
return peachBlossomIndex;
}
public void setPeachBlossomIndex(String peachBlossomIndex) {
this.peachBlossomIndex = peachBlossomIndex;
}
public String getSingleAdvice() {
return singleAdvice;
}
public void setSingleAdvice(String singleAdvice) {
this.singleAdvice = singleAdvice;
}
public String getDatingAdvice() {
return datingAdvice;
}
public void setDatingAdvice(String datingAdvice) {
this.datingAdvice = datingAdvice;
}
public String getMarriageAdvice() {
return marriageAdvice;
}
public void setMarriageAdvice(String marriageAdvice) {
this.marriageAdvice = marriageAdvice;
}
public String getBestDatingTime() {
return bestDatingTime;
}
public void setBestDatingTime(String bestDatingTime) {
this.bestDatingTime = bestDatingTime;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,77 @@
package io.destiny.biz.dto;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
/**
* 农历日历请求DTO
* 用于接收阳历转农历的请求
*
* @author 张翔
* @date 2026-01-04
*/
public class LunarCalendarRequest {
@NotNull(message = "日期时间不能为空")
private LocalDateTime dateTime;
public LunarCalendarRequest() {
}
public LunarCalendarRequest(LocalDateTime dateTime) {
this.dateTime = dateTime;
}
public LocalDateTime getDateTime() {
return dateTime;
}
public void setDateTime(LocalDateTime dateTime) {
this.dateTime = dateTime;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LunarCalendarRequest that = (LunarCalendarRequest) o;
return new EqualsBuilder()
.append(dateTime, that.dateTime)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(dateTime)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("dateTime", dateTime)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private LocalDateTime dateTime;
public Builder dateTime(LocalDateTime dateTime) {
this.dateTime = dateTime;
return this;
}
public LunarCalendarRequest build() {
return new LunarCalendarRequest(dateTime);
}
}
}
@@ -0,0 +1,199 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.LunarDate;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* 农历日历响应DTO
* 用于返回阳历转农历的结果,包含农历年月日、生肖、节气等信息
*
* @author 张翔
* @date 2026-01-04
*/
public class LunarCalendarResponse {
private String lunarYear;
private String lunarMonth;
private String lunarDay;
private Boolean isLeapMonth;
private String zodiac;
private String solarTerm;
private String weekday;
public LunarCalendarResponse() {
}
public LunarCalendarResponse(String lunarYear, String lunarMonth, String lunarDay, Boolean isLeapMonth, String zodiac, String solarTerm, String weekday) {
this.lunarYear = lunarYear;
this.lunarMonth = lunarMonth;
this.lunarDay = lunarDay;
this.isLeapMonth = isLeapMonth;
this.zodiac = zodiac;
this.solarTerm = solarTerm;
this.weekday = weekday;
}
public String getLunarYear() {
return lunarYear;
}
public void setLunarYear(String lunarYear) {
this.lunarYear = lunarYear;
}
public String getLunarMonth() {
return lunarMonth;
}
public void setLunarMonth(String lunarMonth) {
this.lunarMonth = lunarMonth;
}
public String getLunarDay() {
return lunarDay;
}
public void setLunarDay(String lunarDay) {
this.lunarDay = lunarDay;
}
public Boolean getIsLeapMonth() {
return isLeapMonth;
}
public void setIsLeapMonth(Boolean isLeapMonth) {
this.isLeapMonth = isLeapMonth;
}
public String getZodiac() {
return zodiac;
}
public void setZodiac(String zodiac) {
this.zodiac = zodiac;
}
public String getSolarTerm() {
return solarTerm;
}
public void setSolarTerm(String solarTerm) {
this.solarTerm = solarTerm;
}
public String getWeekday() {
return weekday;
}
public void setWeekday(String weekday) {
this.weekday = weekday;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LunarCalendarResponse that = (LunarCalendarResponse) o;
return new EqualsBuilder()
.append(lunarYear, that.lunarYear)
.append(lunarMonth, that.lunarMonth)
.append(lunarDay, that.lunarDay)
.append(isLeapMonth, that.isLeapMonth)
.append(zodiac, that.zodiac)
.append(solarTerm, that.solarTerm)
.append(weekday, that.weekday)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(lunarYear)
.append(lunarMonth)
.append(lunarDay)
.append(isLeapMonth)
.append(zodiac)
.append(solarTerm)
.append(weekday)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("lunarYear", lunarYear)
.append("lunarMonth", lunarMonth)
.append("lunarDay", lunarDay)
.append("isLeapMonth", isLeapMonth)
.append("zodiac", zodiac)
.append("solarTerm", solarTerm)
.append("weekday", weekday)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String lunarYear;
private String lunarMonth;
private String lunarDay;
private Boolean isLeapMonth;
private String zodiac;
private String solarTerm;
private String weekday;
public Builder lunarYear(String lunarYear) {
this.lunarYear = lunarYear;
return this;
}
public Builder lunarMonth(String lunarMonth) {
this.lunarMonth = lunarMonth;
return this;
}
public Builder lunarDay(String lunarDay) {
this.lunarDay = lunarDay;
return this;
}
public Builder isLeapMonth(Boolean isLeapMonth) {
this.isLeapMonth = isLeapMonth;
return this;
}
public Builder zodiac(String zodiac) {
this.zodiac = zodiac;
return this;
}
public Builder solarTerm(String solarTerm) {
this.solarTerm = solarTerm;
return this;
}
public Builder weekday(String weekday) {
this.weekday = weekday;
return this;
}
public LunarCalendarResponse build() {
return new LunarCalendarResponse(lunarYear, lunarMonth, lunarDay, isLeapMonth, zodiac, solarTerm, weekday);
}
}
public static LunarCalendarResponse fromLunarDate(LunarDate lunarDate) {
return LunarCalendarResponse.builder()
.lunarYear(lunarDate.getLunarYear())
.lunarMonth(lunarDate.getLunarMonth())
.lunarDay(lunarDate.getLunarDay())
.isLeapMonth(lunarDate.getIsLeapMonth())
.zodiac(lunarDate.getZodiac())
.solarTerm(lunarDate.getSolarTerm())
.weekday(lunarDate.getWeekday())
.build();
}
}
@@ -0,0 +1,39 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "匹配的事项")
public class MatchedItems {
@Schema(description = "匹配的宜事项")
private List<String> suitable;
@Schema(description = "匹配的忌事项")
private List<String> unsuitable;
public MatchedItems() {
}
public MatchedItems(List<String> suitable, List<String> unsuitable) {
this.suitable = suitable;
this.unsuitable = unsuitable;
}
public List<String> getSuitable() {
return suitable;
}
public void setSuitable(List<String> suitable) {
this.suitable = suitable;
}
public List<String> getUnsuitable() {
return unsuitable;
}
public void setUnsuitable(List<String> unsuitable) {
this.unsuitable = unsuitable;
}
}
@@ -0,0 +1,60 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "命宫身宫响应")
public class MingShenGongResponse {
@Schema(description = "命宫地支")
private String mingGong;
@Schema(description = "身宫地支")
private String shenGong;
public MingShenGongResponse() {
}
public MingShenGongResponse(String mingGong, String shenGong) {
this.mingGong = mingGong;
this.shenGong = shenGong;
}
public String getMingGong() {
return mingGong;
}
public void setMingGong(String mingGong) {
this.mingGong = mingGong;
}
public String getShenGong() {
return shenGong;
}
public void setShenGong(String shenGong) {
this.shenGong = shenGong;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String mingGong;
private String shenGong;
public Builder mingGong(String mingGong) {
this.mingGong = mingGong;
return this;
}
public Builder shenGong(String shenGong) {
this.shenGong = shenGong;
return this;
}
public MingShenGongResponse build() {
return new MingShenGongResponse(mingGong, shenGong);
}
}
}
@@ -0,0 +1,140 @@
package io.destiny.biz.dto;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.YearMonth;
/**
* 月运请求DTO
* 用于接收月运生成请求
*
* @author 张翔
* @date 2026-01-04
*/
public class MonthlyFortuneRequest {
@NotNull(message = "用户ID不能为空")
private Long userId;
@NotNull(message = "出生时间不能为空")
private String birthTime;
@NotNull(message = "性别不能为空")
private String gender;
@NotNull(message = "运势月份不能为空")
private YearMonth fortuneMonth;
public MonthlyFortuneRequest() {
}
public MonthlyFortuneRequest(Long userId, String birthTime, String gender, YearMonth fortuneMonth) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneMonth = fortuneMonth;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public YearMonth getFortuneMonth() {
return fortuneMonth;
}
public void setFortuneMonth(YearMonth fortuneMonth) {
this.fortuneMonth = fortuneMonth;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MonthlyFortuneRequest that = (MonthlyFortuneRequest) o;
return new EqualsBuilder()
.append(userId, that.userId)
.append(birthTime, that.birthTime)
.append(gender, that.gender)
.append(fortuneMonth, that.fortuneMonth)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(userId)
.append(birthTime)
.append(gender)
.append(fortuneMonth)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("userId", userId)
.append("birthTime", birthTime)
.append("gender", gender)
.append("fortuneMonth", fortuneMonth)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long userId;
private String birthTime;
private String gender;
private YearMonth fortuneMonth;
public Builder userId(Long userId) {
this.userId = userId;
return this;
}
public Builder birthTime(String birthTime) {
this.birthTime = birthTime;
return this;
}
public Builder gender(String gender) {
this.gender = gender;
return this;
}
public Builder fortuneMonth(YearMonth fortuneMonth) {
this.fortuneMonth = fortuneMonth;
return this;
}
public MonthlyFortuneRequest build() {
return new MonthlyFortuneRequest(userId, birthTime, gender, fortuneMonth);
}
}
}
@@ -0,0 +1,253 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.MonthlyFortune;
import io.destiny.biz.enums.PalaceType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.YearMonth;
import java.util.Map;
/**
* 月运响应DTO
* 用于返回月运分析结果
*
* @author 张翔
* @date 2026-01-04
*/
public class MonthlyFortuneResponse {
private Long id;
private YearMonth fortuneMonth;
private String overallLuck;
private int overallScore;
private Map<PalaceType, PalaceFortuneResponse> palaceFortunes;
private String careerAdvice;
private String wealthAdvice;
private String relationshipAdvice;
private String healthAdvice;
private String luckyColor;
private String luckyNumber;
private String luckyDirection;
private String keyFocus;
private String cautionAdvice;
public MonthlyFortuneResponse() {
}
public MonthlyFortuneResponse(Long id, YearMonth fortuneMonth, String overallLuck, int overallScore,
Map<PalaceType, PalaceFortuneResponse> palaceFortunes, String careerAdvice,
String wealthAdvice, String relationshipAdvice, String healthAdvice,
String luckyColor, String luckyNumber, String luckyDirection,
String keyFocus, String cautionAdvice) {
this.id = id;
this.fortuneMonth = fortuneMonth;
this.overallLuck = overallLuck;
this.overallScore = overallScore;
this.palaceFortunes = palaceFortunes;
this.careerAdvice = careerAdvice;
this.wealthAdvice = wealthAdvice;
this.relationshipAdvice = relationshipAdvice;
this.healthAdvice = healthAdvice;
this.luckyColor = luckyColor;
this.luckyNumber = luckyNumber;
this.luckyDirection = luckyDirection;
this.keyFocus = keyFocus;
this.cautionAdvice = cautionAdvice;
}
public static MonthlyFortuneResponse fromMonthlyFortune(MonthlyFortune monthlyFortune) {
return new MonthlyFortuneResponse(
monthlyFortune.getId(),
monthlyFortune.getFortuneMonth(),
monthlyFortune.getOverallLuck(),
monthlyFortune.getOverallScore(),
null,
monthlyFortune.getCareerAdvice(),
monthlyFortune.getWealthAdvice(),
monthlyFortune.getRelationshipAdvice(),
monthlyFortune.getHealthAdvice(),
monthlyFortune.getLuckyColor(),
monthlyFortune.getLuckyNumber(),
monthlyFortune.getLuckyDirection(),
monthlyFortune.getKeyFocus(),
monthlyFortune.getCautionAdvice()
);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public YearMonth getFortuneMonth() {
return fortuneMonth;
}
public void setFortuneMonth(YearMonth fortuneMonth) {
this.fortuneMonth = fortuneMonth;
}
public String getOverallLuck() {
return overallLuck;
}
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
public int getOverallScore() {
return overallScore;
}
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
public Map<PalaceType, PalaceFortuneResponse> getPalaceFortunes() {
return palaceFortunes;
}
public void setPalaceFortunes(Map<PalaceType, PalaceFortuneResponse> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
public String getCareerAdvice() {
return careerAdvice;
}
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
public String getWealthAdvice() {
return wealthAdvice;
}
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
public String getRelationshipAdvice() {
return relationshipAdvice;
}
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
public String getHealthAdvice() {
return healthAdvice;
}
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getKeyFocus() {
return keyFocus;
}
public void setKeyFocus(String keyFocus) {
this.keyFocus = keyFocus;
}
public String getCautionAdvice() {
return cautionAdvice;
}
public void setCautionAdvice(String cautionAdvice) {
this.cautionAdvice = cautionAdvice;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MonthlyFortuneResponse that = (MonthlyFortuneResponse) o;
return new EqualsBuilder()
.append(overallScore, that.overallScore)
.append(id, that.id)
.append(fortuneMonth, that.fortuneMonth)
.append(overallLuck, that.overallLuck)
.append(palaceFortunes, that.palaceFortunes)
.append(careerAdvice, that.careerAdvice)
.append(wealthAdvice, that.wealthAdvice)
.append(relationshipAdvice, that.relationshipAdvice)
.append(healthAdvice, that.healthAdvice)
.append(luckyColor, that.luckyColor)
.append(luckyNumber, that.luckyNumber)
.append(luckyDirection, that.luckyDirection)
.append(keyFocus, that.keyFocus)
.append(cautionAdvice, that.cautionAdvice)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(id)
.append(fortuneMonth)
.append(overallLuck)
.append(overallScore)
.append(palaceFortunes)
.append(careerAdvice)
.append(wealthAdvice)
.append(relationshipAdvice)
.append(healthAdvice)
.append(luckyColor)
.append(luckyNumber)
.append(luckyDirection)
.append(keyFocus)
.append(cautionAdvice)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("fortuneMonth", fortuneMonth)
.append("overallLuck", overallLuck)
.append("overallScore", overallScore)
.append("palaceFortunes", palaceFortunes)
.append("careerAdvice", careerAdvice)
.append("wealthAdvice", wealthAdvice)
.append("relationshipAdvice", relationshipAdvice)
.append("healthAdvice", healthAdvice)
.append("luckyColor", luckyColor)
.append("luckyNumber", luckyNumber)
.append("luckyDirection", luckyDirection)
.append("keyFocus", keyFocus)
.append("cautionAdvice", cautionAdvice)
.toString();
}
}
@@ -0,0 +1,205 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.PalaceFortune;
import io.destiny.biz.enums.PalaceType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* 宫位运势响应DTO
*/
@Schema(description = "宫位运势响应")
public class PalaceFortuneResponse {
@Schema(description = "宫位类型")
private PalaceType palaceType;
@Schema(description = "宫位名称")
private String palaceName;
@Schema(description = "主星列表")
private List<String> mainStars;
@Schema(description = "辅星列表")
private List<String> assistantStars;
@Schema(description = "四化星列表")
private List<String> transformationStars;
@Schema(description = "吉凶评分(1-10分)")
private Integer fortuneScore;
@Schema(description = "运势描述")
private String fortuneDescription;
@Schema(description = "建议")
private String advice;
public PalaceFortuneResponse() {
}
public static PalaceFortuneResponse fromPalaceFortune(PalaceFortune palaceFortune) {
PalaceFortuneResponse response = new PalaceFortuneResponse();
response.setPalaceType(palaceFortune.getPalaceType());
response.setPalaceName(palaceFortune.getPalaceType().getName());
response.setFortuneScore(palaceFortune.getScore());
response.setFortuneDescription(palaceFortune.getAnalysis());
response.setAdvice(palaceFortune.getAdvice());
return response;
}
public PalaceFortuneResponse(
PalaceType palaceType,
String palaceName,
List<String> mainStars,
List<String> assistantStars,
List<String> transformationStars,
Integer fortuneScore,
String fortuneDescription,
String advice) {
this.palaceType = palaceType;
this.palaceName = palaceName;
this.mainStars = mainStars;
this.assistantStars = assistantStars;
this.transformationStars = transformationStars;
this.fortuneScore = fortuneScore;
this.fortuneDescription = fortuneDescription;
this.advice = advice;
}
public static PalaceFortuneResponseBuilder builder() {
return new PalaceFortuneResponseBuilder();
}
@Schema(description = "获取宫位类型")
public PalaceType getPalaceType() {
return palaceType;
}
public void setPalaceType(PalaceType palaceType) {
this.palaceType = palaceType;
}
@Schema(description = "获取宫位名称")
public String getPalaceName() {
return palaceName;
}
public void setPalaceName(String palaceName) {
this.palaceName = palaceName;
}
@Schema(description = "获取主星列表")
public List<String> getMainStars() {
return mainStars;
}
public void setMainStars(List<String> mainStars) {
this.mainStars = mainStars;
}
@Schema(description = "获取辅星列表")
public List<String> getAssistantStars() {
return assistantStars;
}
public void setAssistantStars(List<String> assistantStars) {
this.assistantStars = assistantStars;
}
@Schema(description = "获取四化星列表")
public List<String> getTransformationStars() {
return transformationStars;
}
public void setTransformationStars(List<String> transformationStars) {
this.transformationStars = transformationStars;
}
@Schema(description = "获取吉凶评分")
public Integer getFortuneScore() {
return fortuneScore;
}
public void setFortuneScore(Integer fortuneScore) {
this.fortuneScore = fortuneScore;
}
@Schema(description = "获取运势描述")
public String getFortuneDescription() {
return fortuneDescription;
}
public void setFortuneDescription(String fortuneDescription) {
this.fortuneDescription = fortuneDescription;
}
@Schema(description = "获取建议")
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
public static class PalaceFortuneResponseBuilder {
private PalaceType palaceType;
private String palaceName;
private List<String> mainStars;
private List<String> assistantStars;
private List<String> transformationStars;
private Integer fortuneScore;
private String fortuneDescription;
private String advice;
PalaceFortuneResponseBuilder() {
}
public PalaceFortuneResponseBuilder palaceType(PalaceType palaceType) {
this.palaceType = palaceType;
return this;
}
public PalaceFortuneResponseBuilder palaceName(String palaceName) {
this.palaceName = palaceName;
return this;
}
public PalaceFortuneResponseBuilder mainStars(List<String> mainStars) {
this.mainStars = mainStars;
return this;
}
public PalaceFortuneResponseBuilder assistantStars(List<String> assistantStars) {
this.assistantStars = assistantStars;
return this;
}
public PalaceFortuneResponseBuilder transformationStars(List<String> transformationStars) {
this.transformationStars = transformationStars;
return this;
}
public PalaceFortuneResponseBuilder fortuneScore(Integer fortuneScore) {
this.fortuneScore = fortuneScore;
return this;
}
public PalaceFortuneResponseBuilder fortuneDescription(String fortuneDescription) {
this.fortuneDescription = fortuneDescription;
return this;
}
public PalaceFortuneResponseBuilder advice(String advice) {
this.advice = advice;
return this;
}
public PalaceFortuneResponse build() {
return new PalaceFortuneResponse(
palaceType, palaceName, mainStars, assistantStars, transformationStars, fortuneScore, fortuneDescription, advice);
}
}
}
@@ -0,0 +1,79 @@
package io.destiny.biz.dto;
import io.destiny.biz.enums.PalaceType;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "宫位运势分析请求")
public class PalaceLuckRequest {
@Schema(description = "出生时间(ISO 8601格式)", example = "1990-06-15T08:30:00")
private String birthTime;
@Schema(description = "性别(男/女)", example = "")
private String gender;
@Schema(description = "宫位类型", example = "MING_GONG")
private PalaceType palaceType;
public PalaceLuckRequest() {
}
public PalaceLuckRequest(String birthTime, String gender, PalaceType palaceType) {
this.birthTime = birthTime;
this.gender = gender;
this.palaceType = palaceType;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public PalaceType getPalaceType() {
return palaceType;
}
public void setPalaceType(PalaceType palaceType) {
this.palaceType = palaceType;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String birthTime;
private String gender;
private PalaceType palaceType;
public Builder birthTime(String birthTime) {
this.birthTime = birthTime;
return this;
}
public Builder gender(String gender) {
this.gender = gender;
return this;
}
public Builder palaceType(PalaceType palaceType) {
this.palaceType = palaceType;
return this;
}
public PalaceLuckRequest build() {
return new PalaceLuckRequest(birthTime, gender, palaceType);
}
}
}
@@ -0,0 +1,60 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "宫位运势分析响应")
public class PalaceLuckResponse {
@Schema(description = "宫位类型")
private String palaceType;
@Schema(description = "运势分析文本")
private String luckAnalysis;
public PalaceLuckResponse() {
}
public PalaceLuckResponse(String palaceType, String luckAnalysis) {
this.palaceType = palaceType;
this.luckAnalysis = luckAnalysis;
}
public String getPalaceType() {
return palaceType;
}
public void setPalaceType(String palaceType) {
this.palaceType = palaceType;
}
public String getLuckAnalysis() {
return luckAnalysis;
}
public void setLuckAnalysis(String luckAnalysis) {
this.luckAnalysis = luckAnalysis;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String palaceType;
private String luckAnalysis;
public Builder palaceType(String palaceType) {
this.palaceType = palaceType;
return this;
}
public Builder luckAnalysis(String luckAnalysis) {
this.luckAnalysis = luckAnalysis;
return this;
}
public PalaceLuckResponse build() {
return new PalaceLuckResponse(palaceType, luckAnalysis);
}
}
}
@@ -0,0 +1,346 @@
package io.destiny.biz.dto;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.destiny.biz.domain.Palace;
import java.util.List;
import java.util.stream.Collectors;
/**
* 宫位响应DTO,用于返回宫位信息
* 包含宫位类型、地支、主星、辅星、分析和评分等信息
*
* @author 张翔
* @date 2025-12-29
*/
public class PalaceResponse {
/** 宫位类型 */
private String palaceType;
/** 地支 */
private String earthlyBranch;
/** 主星列表 */
private List<StarInfoResponse> majorStars;
/** 辅星列表 */
private List<String> minorStars;
/** 宫位分析 */
private String analysis;
/** 宫位评分 */
private Integer score;
/**
* 默认构造函数
*/
public PalaceResponse() {
}
/**
* 全参构造函数
*
* @param palaceType 宫位类型
* @param earthlyBranch 地支
* @param majorStars 主星列表
* @param minorStars 辅星列表
* @param analysis 宫位分析
* @param score 宫位评分
*/
public PalaceResponse(String palaceType, String earthlyBranch, List<StarInfoResponse> majorStars,
List<String> minorStars, String analysis, Integer score) {
this.palaceType = palaceType;
this.earthlyBranch = earthlyBranch;
this.majorStars = majorStars;
this.minorStars = minorStars;
this.analysis = analysis;
this.score = score;
}
/**
* 获取宫位类型
*
* @return 宫位类型
*/
public String getPalaceType() {
return palaceType;
}
/**
* 设置宫位类型
*
* @param palaceType 宫位类型
*/
public void setPalaceType(String palaceType) {
this.palaceType = palaceType;
}
/**
* 获取地支
*
* @return 地支
*/
public String getEarthlyBranch() {
return earthlyBranch;
}
/**
* 设置地支
*
* @param earthlyBranch 地支
*/
public void setEarthlyBranch(String earthlyBranch) {
this.earthlyBranch = earthlyBranch;
}
/**
* 获取主星列表
*
* @return 主星列表
*/
public List<StarInfoResponse> getMajorStars() {
return majorStars;
}
/**
* 设置主星列表
*
* @param majorStars 主星列表
*/
public void setMajorStars(List<StarInfoResponse> majorStars) {
this.majorStars = majorStars;
}
/**
* 获取辅星列表
*
* @return 辅星列表
*/
public List<String> getMinorStars() {
return minorStars;
}
/**
* 设置辅星列表
*
* @param minorStars 辅星列表
*/
public void setMinorStars(List<String> minorStars) {
this.minorStars = minorStars;
}
/**
* 获取宫位分析
*
* @return 宫位分析
*/
public String getAnalysis() {
return analysis;
}
/**
* 设置宫位分析
*
* @param analysis 宫位分析
*/
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
/**
* 获取宫位评分
*
* @return 宫位评分
*/
public Integer getScore() {
return score;
}
/**
* 设置宫位评分
*
* @param score 宫位评分
*/
public void setScore(Integer score) {
this.score = score;
}
/**
* 判断对象是否相等
*
* @param o 比较对象
* @return 是否相等
*/
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
PalaceResponse that = (PalaceResponse) o;
return new EqualsBuilder()
.append(palaceType, that.palaceType)
.append(earthlyBranch, that.earthlyBranch)
.append(majorStars, that.majorStars)
.append(minorStars, that.minorStars)
.append(analysis, that.analysis)
.append(score, that.score)
.isEquals();
}
/**
* 计算对象哈希值
*
* @return 哈希值
*/
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(palaceType)
.append(earthlyBranch)
.append(majorStars)
.append(minorStars)
.append(analysis)
.append(score)
.toHashCode();
}
/**
* 转换为字符串
*
* @return 字符串表示
*/
@Override
public String toString() {
return new ToStringBuilder(this)
.append("palaceType", palaceType)
.append("earthlyBranch", earthlyBranch)
.append("majorStars", majorStars)
.append("minorStars", minorStars)
.append("analysis", analysis)
.append("score", score)
.toString();
}
/**
* 获取Builder实例
*
* @return Builder实例
*/
public static Builder builder() {
return new Builder();
}
/**
* Builder类,用于构建PalaceResponse实例
*/
public static class Builder {
/** 宫位类型 */
private String palaceType;
/** 地支 */
private String earthlyBranch;
/** 主星列表 */
private List<StarInfoResponse> majorStars;
/** 辅星列表 */
private List<String> minorStars;
/** 宫位分析 */
private String analysis;
/** 宫位评分 */
private Integer score;
/**
* 设置宫位类型
*
* @param palaceType 宫位类型
* @return Builder实例
*/
public Builder palaceType(String palaceType) {
this.palaceType = palaceType;
return this;
}
/**
* 设置地支
*
* @param earthlyBranch 地支
* @return Builder实例
*/
public Builder earthlyBranch(String earthlyBranch) {
this.earthlyBranch = earthlyBranch;
return this;
}
/**
* 设置主星列表
*
* @param majorStars 主星列表
* @return Builder实例
*/
public Builder majorStars(List<StarInfoResponse> majorStars) {
this.majorStars = majorStars;
return this;
}
/**
* 设置辅星列表
*
* @param minorStars 辅星列表
* @return Builder实例
*/
public Builder minorStars(List<String> minorStars) {
this.minorStars = minorStars;
return this;
}
/**
* 设置宫位分析
*
* @param analysis 宫位分析
* @return Builder实例
*/
public Builder analysis(String analysis) {
this.analysis = analysis;
return this;
}
/**
* 设置宫位评分
*
* @param score 宫位评分
* @return Builder实例
*/
public Builder score(Integer score) {
this.score = score;
return this;
}
/**
* 构建PalaceResponse实例
*
* @return PalaceResponse实例
*/
public PalaceResponse build() {
return new PalaceResponse(palaceType, earthlyBranch, majorStars, minorStars, analysis, score);
}
}
/**
* 从Palace对象转换为PalaceResponse对象
*
* @param palace 宫位对象
* @return 宫位响应DTO对象
*/
public static PalaceResponse fromPalace(Palace palace) {
List<StarInfoResponse> starInfoResponses = palace.getMajorStars().stream()
.map(StarInfoResponse::fromStarInfo)
.collect(Collectors.toList());
return PalaceResponse.builder()
.palaceType(palace.getPalaceType().getName())
.earthlyBranch(palace.getEarthlyBranch().getName())
.majorStars(starInfoResponses)
.minorStars(palace.getMinorStars())
.analysis(palace.getAnalysis())
.score(palace.getScore())
.build();
}
}
@@ -0,0 +1,53 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "黄历搜索条件")
public class SearchCondition {
@Schema(description = "条件类型:suitable-宜,unsuitable-忌", example = "suitable")
private String type;
@Schema(description = "事项列表", example = "[\"动土\", \"修造\"]")
private List<String> items;
@Schema(description = "运算符:and-与,or-或", example = "or")
private String operator;
@Schema(description = "是否排除", example = "false")
private Boolean exclude;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<String> getItems() {
return items;
}
public void setItems(List<String> items) {
this.items = items;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public Boolean getExclude() {
return exclude;
}
public void setExclude(Boolean exclude) {
this.exclude = exclude;
}
}
@@ -0,0 +1,53 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "黄历搜索请求")
public class SearchRequest {
@Schema(description = "搜索条件列表")
private List<SearchCondition> conditions;
@Schema(description = "查询天数(1-365", example = "30")
private Integer days;
@Schema(description = "排序字段:date-日期,matchCount-匹配数", example = "date")
private String sortBy;
@Schema(description = "排序方式:asc-升序,desc-降序", example = "asc")
private String sortOrder;
public List<SearchCondition> getConditions() {
return conditions;
}
public void setConditions(List<SearchCondition> conditions) {
this.conditions = conditions;
}
public Integer getDays() {
return days;
}
public void setDays(Integer days) {
this.days = days;
}
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
}
@@ -0,0 +1,73 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "黄历搜索结果")
public class SearchResult {
@Schema(description = "日期", example = "2024-01-01")
private String date;
@Schema(description = "农历日期", example = "农历二零二三年十一月二十")
private String lunarDate;
@Schema(description = "星期", example = "星期一")
private String weekday;
@Schema(description = "匹配的事项")
private MatchedItems matchedItems;
@Schema(description = "匹配数量", example = "2")
private Integer matchCount;
@Schema(description = "黄历数据")
private AlmanacResponse almanacData;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getLunarDate() {
return lunarDate;
}
public void setLunarDate(String lunarDate) {
this.lunarDate = lunarDate;
}
public String getWeekday() {
return weekday;
}
public void setWeekday(String weekday) {
this.weekday = weekday;
}
public MatchedItems getMatchedItems() {
return matchedItems;
}
public void setMatchedItems(MatchedItems matchedItems) {
this.matchedItems = matchedItems;
}
public Integer getMatchCount() {
return matchCount;
}
public void setMatchCount(Integer matchCount) {
this.matchCount = matchCount;
}
public AlmanacResponse getAlmanacData() {
return almanacData;
}
public void setAlmanacData(AlmanacResponse almanacData) {
this.almanacData = almanacData;
}
}
@@ -0,0 +1,85 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "社交运势请求DTO")
public class SocialFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "社交类型", example = "商务社交")
private String socialType;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public SocialFortuneRequest() {
}
public SocialFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String socialType) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.socialType = socialType;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getSocialType() {
return socialType;
}
public void setSocialType(String socialType) {
this.socialType = socialType;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,223 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "社交运势响应DTO")
public class SocialFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体社交运势", example = "人缘极佳")
private String overallSocialLuck;
@Schema(description = "社交运势评分", example = "88")
private int socialScore;
@Schema(description = "人缘指数", example = "")
private String popularityIndex;
@Schema(description = "沟通能力", example = "")
private String communicationAbility;
@Schema(description = "社交建议", example = "适合参加聚会")
private String socialAdvice;
@Schema(description = "贵人运", example = "贵人运佳")
private String nobleLuck;
@Schema(description = "最佳社交时间", example = "周末晚上")
private String bestSocialTime;
@Schema(description = "适合社交场合", example = "商务酒会")
private String suitableOccasion;
@Schema(description = "人际建议", example = "多与贵人接触")
private String interpersonalAdvice;
@Schema(description = "人脉建议", example = "多参加行业活动")
private String networkingAdvice;
@Schema(description = "沟通建议", example = "保持真诚沟通")
private String communicationAdvice;
@Schema(description = "团队合作建议", example = "发挥团队协作优势")
private String teamworkAdvice;
@Schema(description = "幸运颜色", example = "红色")
private String luckyColor;
@Schema(description = "幸运方位", example = "东方")
private String luckyDirection;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public SocialFortuneResponse() {
}
public SocialFortuneResponse(Long userId, LocalDate fortuneDate, String overallSocialLuck, int socialScore, String popularityIndex, String communicationAbility, String socialAdvice, String nobleLuck, String bestSocialTime, String suitableOccasion, String interpersonalAdvice) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallSocialLuck = overallSocialLuck;
this.socialScore = socialScore;
this.popularityIndex = popularityIndex;
this.communicationAbility = communicationAbility;
this.socialAdvice = socialAdvice;
this.nobleLuck = nobleLuck;
this.bestSocialTime = bestSocialTime;
this.suitableOccasion = suitableOccasion;
this.interpersonalAdvice = interpersonalAdvice;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallSocialLuck() {
return overallSocialLuck;
}
public void setOverallSocialLuck(String overallSocialLuck) {
this.overallSocialLuck = overallSocialLuck;
}
public int getSocialScore() {
return socialScore;
}
public void setSocialScore(int socialScore) {
this.socialScore = socialScore;
}
public String getPopularityIndex() {
return popularityIndex;
}
public void setPopularityIndex(String popularityIndex) {
this.popularityIndex = popularityIndex;
}
public String getCommunicationAbility() {
return communicationAbility;
}
public void setCommunicationAbility(String communicationAbility) {
this.communicationAbility = communicationAbility;
}
public String getSocialAdvice() {
return socialAdvice;
}
public void setSocialAdvice(String socialAdvice) {
this.socialAdvice = socialAdvice;
}
public String getNobleLuck() {
return nobleLuck;
}
public void setNobleLuck(String nobleLuck) {
this.nobleLuck = nobleLuck;
}
public String getBestSocialTime() {
return bestSocialTime;
}
public void setBestSocialTime(String bestSocialTime) {
this.bestSocialTime = bestSocialTime;
}
public String getSuitableOccasion() {
return suitableOccasion;
}
public void setSuitableOccasion(String suitableOccasion) {
this.suitableOccasion = suitableOccasion;
}
public String getInterpersonalAdvice() {
return interpersonalAdvice;
}
public void setInterpersonalAdvice(String interpersonalAdvice) {
this.interpersonalAdvice = interpersonalAdvice;
}
public String getNetworkingAdvice() {
return networkingAdvice;
}
public void setNetworkingAdvice(String networkingAdvice) {
this.networkingAdvice = networkingAdvice;
}
public String getCommunicationAdvice() {
return communicationAdvice;
}
public void setCommunicationAdvice(String communicationAdvice) {
this.communicationAdvice = communicationAdvice;
}
public String getTeamworkAdvice() {
return teamworkAdvice;
}
public void setTeamworkAdvice(String teamworkAdvice) {
this.teamworkAdvice = teamworkAdvice;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,226 @@
package io.destiny.biz.dto;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.destiny.biz.domain.StarInfo;
/**
* 星星信息响应DTO,用于返回星星的详细信息
* 包含星星名称、性质、化禄、亮度和描述等信息
*/
public class StarInfoResponse {
/** 星星名称 */
private String starName;
/** 星星性质 */
private String nature;
/** 化禄 */
private String transformation;
/** 亮度 */
private Integer brightness;
/** 描述 */
private String description;
/**
* 默认构造函数
*/
public StarInfoResponse() {
}
/**
* 全参构造函数
* @param starName 星星名称
* @param nature 星星性质
* @param transformation 化禄
* @param brightness 亮度
* @param description 描述
*/
public StarInfoResponse(String starName, String nature, String transformation, Integer brightness, String description) {
this.starName = starName;
this.nature = nature;
this.transformation = transformation;
this.brightness = brightness;
this.description = description;
}
/**
* 获取星星名称
* @return 星星名称
*/
public String getStarName() {
return starName;
}
/**
* 设置星星名称
* @param starName 星星名称
*/
public void setStarName(String starName) {
this.starName = starName;
}
/**
* 获取星星性质
* @return 星星性质
*/
public String getNature() {
return nature;
}
/**
* 设置星星性质
* @param nature 星星性质
*/
public void setNature(String nature) {
this.nature = nature;
}
/**
* 获取化禄
* @return 化禄
*/
public String getTransformation() {
return transformation;
}
/**
* 设置化禄
* @param transformation 化禄
*/
public void setTransformation(String transformation) {
this.transformation = transformation;
}
/**
* 获取亮度
* @return 亮度
*/
public Integer getBrightness() {
return brightness;
}
/**
* 设置亮度
* @param brightness 亮度
*/
public void setBrightness(Integer brightness) {
this.brightness = brightness;
}
/**
* 获取描述
* @return 描述
*/
public String getDescription() {
return description;
}
/**
* 设置描述
* @param description 描述
*/
public void setDescription(String description) {
this.description = description;
}
/**
* 判断对象是否相等
* @param o 比较对象
* @return 是否相等
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StarInfoResponse that = (StarInfoResponse) o;
return new EqualsBuilder()
.append(starName, that.starName)
.append(nature, that.nature)
.append(transformation, that.transformation)
.append(brightness, that.brightness)
.append(description, that.description)
.isEquals();
}
/**
* 计算对象哈希值
* @return 哈希值
*/
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(starName)
.append(nature)
.append(transformation)
.append(brightness)
.append(description)
.toHashCode();
}
/**
* 转换为字符串
* @return 字符串表示
*/
@Override
public String toString() {
return new ToStringBuilder(this)
.append("starName", starName)
.append("nature", nature)
.append("transformation", transformation)
.append("brightness", brightness)
.append("description", description)
.toString();
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String starName;
private String nature;
private String transformation;
private Integer brightness;
private String description;
public Builder starName(String starName) {
this.starName = starName;
return this;
}
public Builder nature(String nature) {
this.nature = nature;
return this;
}
public Builder transformation(String transformation) {
this.transformation = transformation;
return this;
}
public Builder brightness(Integer brightness) {
this.brightness = brightness;
return this;
}
public Builder description(String description) {
this.description = description;
return this;
}
public StarInfoResponse build() {
return new StarInfoResponse(starName, nature, transformation, brightness, description);
}
}
public static StarInfoResponse fromStarInfo(StarInfo starInfo) {
return StarInfoResponse.builder()
.starName(starInfo.getStar().getName())
.nature(starInfo.getNature() != null ? starInfo.getNature().getName() : null)
.transformation(starInfo.getTransformation() != null ? starInfo.getTransformation().getName() : null)
.brightness(starInfo.getBrightness())
.description(starInfo.getDescription())
.build();
}
}
@@ -0,0 +1,75 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.StarInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.stream.Collectors;
@Schema(description = "星曜信息响应")
public class StarsResponse {
@Schema(description = "主星列表")
private List<StarInfoResponse> majorStars;
@Schema(description = "辅星列表")
private List<String> minorStars;
public StarsResponse() {
}
public StarsResponse(List<StarInfoResponse> majorStars, List<String> minorStars) {
this.majorStars = majorStars;
this.minorStars = minorStars;
}
public List<StarInfoResponse> getMajorStars() {
return majorStars;
}
public void setMajorStars(List<StarInfoResponse> majorStars) {
this.majorStars = majorStars;
}
public List<String> getMinorStars() {
return minorStars;
}
public void setMinorStars(List<String> minorStars) {
this.minorStars = minorStars;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private List<StarInfoResponse> majorStars;
private List<String> minorStars;
public Builder majorStars(List<StarInfoResponse> majorStars) {
this.majorStars = majorStars;
return this;
}
public Builder minorStars(List<String> minorStars) {
this.minorStars = minorStars;
return this;
}
public StarsResponse build() {
return new StarsResponse(majorStars, minorStars);
}
}
public static StarsResponse fromStarLists(List<StarInfo> majorStars, List<String> minorStars) {
List<StarInfoResponse> majorStarResponses = majorStars.stream()
.map(StarInfoResponse::fromStarInfo)
.collect(Collectors.toList());
return StarsResponse.builder()
.majorStars(majorStarResponses)
.minorStars(minorStars)
.build();
}
}
@@ -0,0 +1,97 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "学业运势请求DTO")
public class StudyFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "学习阶段", example = "大学")
private String studyStage;
@Schema(description = "专业领域", example = "计算机科学")
private String major;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public StudyFortuneRequest() {
}
public StudyFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String studyStage, String major) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.studyStage = studyStage;
this.major = major;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getStudyStage() {
return studyStage;
}
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,234 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "学业运势响应DTO")
public class StudyFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体学业运势", example = "学习状态良好")
private String overallStudyLuck;
@Schema(description = "学业运势评分", example = "90")
private int studyScore;
@Schema(description = "专注力指数", example = "")
private String focusIndex;
@Schema(description = "记忆力指数", example = "")
private String memoryIndex;
@Schema(description = "学习建议", example = "适合深入学习新知识")
private String studyAdvice;
@Schema(description = "考试运", example = "考试运佳")
private String examLuck;
@Schema(description = "最佳学习时间", example = "上午9-11点")
private String bestStudyTime;
@Schema(description = "适合科目", example = "理科类科目")
private String suitableSubjects;
@Schema(description = "学习环境建议", example = "安静的环境")
private String studyEnvironmentAdvice;
@Schema(description = "专注力水平", example = "")
private String concentrationLevel;
@Schema(description = "记忆力水平", example = "")
private String memoryLevel;
@Schema(description = "学习建议", example = "适合深入学习新知识")
private String learningAdvice;
@Schema(description = "考试建议", example = "考试前保持冷静")
private String examAdvice;
@Schema(description = "复习建议", example = "重点复习错题")
private String reviewAdvice;
@Schema(description = "幸运方位", example = "南方")
private String luckyDirection;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public StudyFortuneResponse() {
}
public StudyFortuneResponse(Long userId, LocalDate fortuneDate, String overallStudyLuck, int studyScore, String focusIndex, String memoryIndex, String studyAdvice, String examLuck, String bestStudyTime, String suitableSubjects, String studyEnvironmentAdvice) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallStudyLuck = overallStudyLuck;
this.studyScore = studyScore;
this.focusIndex = focusIndex;
this.memoryIndex = memoryIndex;
this.studyAdvice = studyAdvice;
this.examLuck = examLuck;
this.bestStudyTime = bestStudyTime;
this.suitableSubjects = suitableSubjects;
this.studyEnvironmentAdvice = studyEnvironmentAdvice;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallStudyLuck() {
return overallStudyLuck;
}
public void setOverallStudyLuck(String overallStudyLuck) {
this.overallStudyLuck = overallStudyLuck;
}
public int getStudyScore() {
return studyScore;
}
public void setStudyScore(int studyScore) {
this.studyScore = studyScore;
}
public String getFocusIndex() {
return focusIndex;
}
public void setFocusIndex(String focusIndex) {
this.focusIndex = focusIndex;
}
public String getMemoryIndex() {
return memoryIndex;
}
public void setMemoryIndex(String memoryIndex) {
this.memoryIndex = memoryIndex;
}
public String getStudyAdvice() {
return studyAdvice;
}
public void setStudyAdvice(String studyAdvice) {
this.studyAdvice = studyAdvice;
}
public String getExamLuck() {
return examLuck;
}
public void setExamLuck(String examLuck) {
this.examLuck = examLuck;
}
public String getBestStudyTime() {
return bestStudyTime;
}
public void setBestStudyTime(String bestStudyTime) {
this.bestStudyTime = bestStudyTime;
}
public String getSuitableSubjects() {
return suitableSubjects;
}
public void setSuitableSubjects(String suitableSubjects) {
this.suitableSubjects = suitableSubjects;
}
public String getStudyEnvironmentAdvice() {
return studyEnvironmentAdvice;
}
public void setStudyEnvironmentAdvice(String studyEnvironmentAdvice) {
this.studyEnvironmentAdvice = studyEnvironmentAdvice;
}
public String getConcentrationLevel() {
return concentrationLevel;
}
public void setConcentrationLevel(String concentrationLevel) {
this.concentrationLevel = concentrationLevel;
}
public String getMemoryLevel() {
return memoryLevel;
}
public void setMemoryLevel(String memoryLevel) {
this.memoryLevel = memoryLevel;
}
public String getLearningAdvice() {
return learningAdvice;
}
public void setLearningAdvice(String learningAdvice) {
this.learningAdvice = learningAdvice;
}
public String getExamAdvice() {
return examAdvice;
}
public void setExamAdvice(String examAdvice) {
this.examAdvice = examAdvice;
}
public String getReviewAdvice() {
return reviewAdvice;
}
public void setReviewAdvice(String reviewAdvice) {
this.reviewAdvice = reviewAdvice;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,109 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "出行运势请求DTO")
public class TravelFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "出行类型", example = "商务出行")
private String travelType;
@Schema(description = "目的地", example = "北京")
private String destination;
@Schema(description = "出行天数", example = "3")
private Integer travelDays;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public TravelFortuneRequest() {
}
public TravelFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String travelType, String destination, Integer travelDays) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.travelType = travelType;
this.destination = destination;
this.travelDays = travelDays;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getTravelType() {
return travelType;
}
public void setTravelType(String travelType) {
this.travelType = travelType;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public Integer getTravelDays() {
return travelDays;
}
public void setTravelDays(Integer travelDays) {
this.travelDays = travelDays;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,257 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "出行运势响应DTO")
public class TravelFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体出行运势", example = "出行顺利")
private String overallTravelLuck;
@Schema(description = "出行运势评分", example = "92")
private int travelScore;
@Schema(description = "安全指数", example = "")
private String safetyIndex;
@Schema(description = "顺利指数", example = "")
private String smoothnessIndex;
@Schema(description = "出行建议", example = "适合短途出行")
private String travelAdvice;
@Schema(description = "最佳出行时间", example = "上午出发")
private String bestTravelTime;
@Schema(description = "幸运方位", example = "南方")
private String luckyDirection;
@Schema(description = "适合交通方式", example = "高铁")
private String suitableTransport;
@Schema(description = "注意事项", example = "注意天气变化")
private String precautions;
@Schema(description = "贵人方位", example = "东南方")
private String nobleDirection;
@Schema(description = "安全水平", example = "")
private String safetyLevel;
@Schema(description = "目的地建议", example = "适合去南方城市")
private String destinationAdvice;
@Schema(description = "时间建议", example = "上午出发最佳")
private String timingAdvice;
@Schema(description = "准备建议", example = "提前准备好证件")
private String preparationAdvice;
@Schema(description = "最佳出行方位", example = "南方")
private String bestTravelDirection;
@Schema(description = "幸运颜色", example = "蓝色")
private String luckyColor;
@Schema(description = "避免方位", example = "北方")
private String avoidDirection;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public TravelFortuneResponse() {
}
public TravelFortuneResponse(Long userId, LocalDate fortuneDate, String overallTravelLuck, int travelScore, String safetyIndex, String smoothnessIndex, String travelAdvice, String bestTravelTime, String luckyDirection, String suitableTransport, String precautions, String nobleDirection) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallTravelLuck = overallTravelLuck;
this.travelScore = travelScore;
this.safetyIndex = safetyIndex;
this.smoothnessIndex = smoothnessIndex;
this.travelAdvice = travelAdvice;
this.bestTravelTime = bestTravelTime;
this.luckyDirection = luckyDirection;
this.suitableTransport = suitableTransport;
this.precautions = precautions;
this.nobleDirection = nobleDirection;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallTravelLuck() {
return overallTravelLuck;
}
public void setOverallTravelLuck(String overallTravelLuck) {
this.overallTravelLuck = overallTravelLuck;
}
public int getTravelScore() {
return travelScore;
}
public void setTravelScore(int travelScore) {
this.travelScore = travelScore;
}
public String getSafetyIndex() {
return safetyIndex;
}
public void setSafetyIndex(String safetyIndex) {
this.safetyIndex = safetyIndex;
}
public String getSmoothnessIndex() {
return smoothnessIndex;
}
public void setSmoothnessIndex(String smoothnessIndex) {
this.smoothnessIndex = smoothnessIndex;
}
public String getTravelAdvice() {
return travelAdvice;
}
public void setTravelAdvice(String travelAdvice) {
this.travelAdvice = travelAdvice;
}
public String getBestTravelTime() {
return bestTravelTime;
}
public void setBestTravelTime(String bestTravelTime) {
this.bestTravelTime = bestTravelTime;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getSuitableTransport() {
return suitableTransport;
}
public void setSuitableTransport(String suitableTransport) {
this.suitableTransport = suitableTransport;
}
public String getPrecautions() {
return precautions;
}
public void setPrecautions(String precautions) {
this.precautions = precautions;
}
public String getNobleDirection() {
return nobleDirection;
}
public void setNobleDirection(String nobleDirection) {
this.nobleDirection = nobleDirection;
}
public String getSafetyLevel() {
return safetyLevel;
}
public void setSafetyLevel(String safetyLevel) {
this.safetyLevel = safetyLevel;
}
public String getDestinationAdvice() {
return destinationAdvice;
}
public void setDestinationAdvice(String destinationAdvice) {
this.destinationAdvice = destinationAdvice;
}
public String getTimingAdvice() {
return timingAdvice;
}
public void setTimingAdvice(String timingAdvice) {
this.timingAdvice = timingAdvice;
}
public String getPreparationAdvice() {
return preparationAdvice;
}
public void setPreparationAdvice(String preparationAdvice) {
this.preparationAdvice = preparationAdvice;
}
public String getBestTravelDirection() {
return bestTravelDirection;
}
public void setBestTravelDirection(String bestTravelDirection) {
this.bestTravelDirection = bestTravelDirection;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getAvoidDirection() {
return avoidDirection;
}
public void setAvoidDirection(String avoidDirection) {
this.avoidDirection = avoidDirection;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,86 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "财运请求DTO")
public class WealthFortuneRequest implements FortuneRequest {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "出生时间")
private String birthTime;
@Schema(description = "性别")
private String gender;
@Schema(description = "运势日期")
private LocalDate fortuneDate;
@Schema(description = "投资类型", example = "股票")
private String investmentType;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public WealthFortuneRequest() {
}
public WealthFortuneRequest(Long userId, String birthTime, String gender, LocalDate fortuneDate, String investmentType, String timeZone) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneDate = fortuneDate;
this.investmentType = investmentType;
this.timeZone = timeZone;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getInvestmentType() {
return investmentType;
}
public void setInvestmentType(String investmentType) {
this.investmentType = investmentType;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,168 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
@Schema(description = "财运响应DTO")
public class WealthFortuneResponse implements FortuneResponse {
@Schema(description = "用户ID", example = "123456789")
private Long userId;
@Schema(description = "运势日期", example = "2026-01-05")
private LocalDate fortuneDate;
@Schema(description = "整体财运", example = "财运旺盛")
private String overallWealthLuck;
@Schema(description = "财运评分", example = "85")
private int wealthScore;
@Schema(description = "正财运势", example = "收入稳定")
private String regularIncomeLuck;
@Schema(description = "偏财运势", example = "有意外之财")
private String windfallLuck;
@Schema(description = "投资建议", example = "适合稳健投资")
private String investmentAdvice;
@Schema(description = "理财建议", example = "分散投资")
private String financialAdvice;
@Schema(description = "最佳理财时间", example = "月初")
private String bestFinancialTime;
@Schema(description = "幸运数字", example = "8")
private String luckyNumber;
@Schema(description = "幸运颜色", example = "金色")
private String luckyColor;
@Schema(description = "格式化日期", example = "2026-01-05")
private String formattedDate;
@Schema(description = "时区", example = "Asia/Shanghai")
private String timeZone;
public WealthFortuneResponse() {
}
public WealthFortuneResponse(Long userId, LocalDate fortuneDate, String overallWealthLuck, int wealthScore, String regularIncomeLuck, String windfallLuck, String investmentAdvice, String financialAdvice, String bestFinancialTime, String luckyNumber, String luckyColor) {
this.userId = userId;
this.fortuneDate = fortuneDate;
this.overallWealthLuck = overallWealthLuck;
this.wealthScore = wealthScore;
this.regularIncomeLuck = regularIncomeLuck;
this.windfallLuck = windfallLuck;
this.investmentAdvice = investmentAdvice;
this.financialAdvice = financialAdvice;
this.bestFinancialTime = bestFinancialTime;
this.luckyNumber = luckyNumber;
this.luckyColor = luckyColor;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public LocalDate getFortuneDate() {
return fortuneDate;
}
public void setFortuneDate(LocalDate fortuneDate) {
this.fortuneDate = fortuneDate;
}
public String getOverallWealthLuck() {
return overallWealthLuck;
}
public void setOverallWealthLuck(String overallWealthLuck) {
this.overallWealthLuck = overallWealthLuck;
}
public int getWealthScore() {
return wealthScore;
}
public void setWealthScore(int wealthScore) {
this.wealthScore = wealthScore;
}
public String getRegularIncomeLuck() {
return regularIncomeLuck;
}
public void setRegularIncomeLuck(String regularIncomeLuck) {
this.regularIncomeLuck = regularIncomeLuck;
}
public String getWindfallLuck() {
return windfallLuck;
}
public void setWindfallLuck(String windfallLuck) {
this.windfallLuck = windfallLuck;
}
public String getInvestmentAdvice() {
return investmentAdvice;
}
public void setInvestmentAdvice(String investmentAdvice) {
this.investmentAdvice = investmentAdvice;
}
public String getFinancialAdvice() {
return financialAdvice;
}
public void setFinancialAdvice(String financialAdvice) {
this.financialAdvice = financialAdvice;
}
public String getBestFinancialTime() {
return bestFinancialTime;
}
public void setBestFinancialTime(String bestFinancialTime) {
this.bestFinancialTime = bestFinancialTime;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getFormattedDate() {
return formattedDate;
}
public void setFormattedDate(String formattedDate) {
this.formattedDate = formattedDate;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
}
@@ -0,0 +1,70 @@
package io.destiny.biz.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Year;
/**
* 年运势请求DTO
* 用于接收年运势分析请求
*
* @author 张翔
* @date 2026-01-04
*/
@Schema(description = "年运势请求")
public class YearlyFortuneRequest {
@Schema(description = "用户ID", example = "1234567890123456789")
private Long userId;
@Schema(description = "出生时间(ISO 8601格式)", example = "1990-01-01T12:00:00")
private String birthTime;
@Schema(description = "性别(男/女)", example = "")
private String gender;
@Schema(description = "运势年份", example = "2026")
private Year fortuneYear;
public YearlyFortuneRequest() {
}
public YearlyFortuneRequest(Long userId, String birthTime, String gender, Year fortuneYear) {
this.userId = userId;
this.birthTime = birthTime;
this.gender = gender;
this.fortuneYear = fortuneYear;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBirthTime() {
return birthTime;
}
public void setBirthTime(String birthTime) {
this.birthTime = birthTime;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public Year getFortuneYear() {
return fortuneYear;
}
public void setFortuneYear(Year fortuneYear) {
this.fortuneYear = fortuneYear;
}
}
@@ -0,0 +1,260 @@
package io.destiny.biz.dto;
import io.destiny.biz.domain.YearlyFortune;
import io.destiny.biz.enums.PalaceType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Year;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 年运势响应DTO
* 用于返回年运势分析结果
*
* @author 张翔
* @date 2026-01-04
*/
@Schema(description = "年运势响应")
public class YearlyFortuneResponse {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "运势年份")
private Year fortuneYear;
@Schema(description = "整体运势描述")
private String overallLuck;
@Schema(description = "整体运势评分")
private int overallScore;
@Schema(description = "各宫位运势映射表")
private Map<PalaceType, PalaceFortuneResponse> palaceFortunes;
@Schema(description = "每月运势列表")
private List<MonthlyFortuneResponse> monthlyFortunes;
@Schema(description = "事业建议")
private String careerAdvice;
@Schema(description = "财运建议")
private String wealthAdvice;
@Schema(description = "感情建议")
private String relationshipAdvice;
@Schema(description = "健康建议")
private String healthAdvice;
@Schema(description = "幸运颜色")
private String luckyColor;
@Schema(description = "幸运数字")
private String luckyNumber;
@Schema(description = "幸运方位")
private String luckyDirection;
@Schema(description = "本年重点")
private String keyFocus;
@Schema(description = "注意事项")
private String cautionAdvice;
@Schema(description = "年度主题")
private String yearlyTheme;
@Schema(description = "主要机遇")
private String majorOpportunity;
@Schema(description = "主要挑战")
private String majorChallenge;
public YearlyFortuneResponse() {
}
public static YearlyFortuneResponse fromYearlyFortune(YearlyFortune yearlyFortune) {
YearlyFortuneResponse response = new YearlyFortuneResponse();
response.setUserId(yearlyFortune.getUserId());
response.setFortuneYear(yearlyFortune.getFortuneYear());
response.setOverallLuck(yearlyFortune.getOverallLuck());
response.setOverallScore(yearlyFortune.getOverallScore());
response.setCareerAdvice(yearlyFortune.getCareerAdvice());
response.setWealthAdvice(yearlyFortune.getWealthAdvice());
response.setRelationshipAdvice(yearlyFortune.getRelationshipAdvice());
response.setHealthAdvice(yearlyFortune.getHealthAdvice());
response.setLuckyColor(yearlyFortune.getLuckyColor());
response.setLuckyNumber(yearlyFortune.getLuckyNumber());
response.setLuckyDirection(yearlyFortune.getLuckyDirection());
response.setKeyFocus(yearlyFortune.getKeyFocus());
response.setCautionAdvice(yearlyFortune.getCautionAdvice());
response.setYearlyTheme(yearlyFortune.getYearlyTheme());
response.setMajorOpportunity(yearlyFortune.getMajorOpportunity());
response.setMajorChallenge(yearlyFortune.getMajorChallenge());
if (yearlyFortune.getPalaceFortunes() != null) {
Map<PalaceType, PalaceFortuneResponse> palaceFortuneResponses = yearlyFortune.getPalaceFortunes().entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
entry -> PalaceFortuneResponse.fromPalaceFortune(entry.getValue())
));
response.setPalaceFortunes(palaceFortuneResponses);
}
if (yearlyFortune.getMonthlyFortunes() != null) {
List<MonthlyFortuneResponse> monthlyFortuneResponses = yearlyFortune.getMonthlyFortunes().stream()
.map(MonthlyFortuneResponse::fromMonthlyFortune)
.collect(Collectors.toList());
response.setMonthlyFortunes(monthlyFortuneResponses);
}
return response;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Year getFortuneYear() {
return fortuneYear;
}
public void setFortuneYear(Year fortuneYear) {
this.fortuneYear = fortuneYear;
}
public String getOverallLuck() {
return overallLuck;
}
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
public int getOverallScore() {
return overallScore;
}
public void setOverallScore(int overallScore) {
this.overallScore = overallScore;
}
public Map<PalaceType, PalaceFortuneResponse> getPalaceFortunes() {
return palaceFortunes;
}
public void setPalaceFortunes(Map<PalaceType, PalaceFortuneResponse> palaceFortunes) {
this.palaceFortunes = palaceFortunes;
}
public List<MonthlyFortuneResponse> getMonthlyFortunes() {
return monthlyFortunes;
}
public void setMonthlyFortunes(List<MonthlyFortuneResponse> monthlyFortunes) {
this.monthlyFortunes = monthlyFortunes;
}
public String getCareerAdvice() {
return careerAdvice;
}
public void setCareerAdvice(String careerAdvice) {
this.careerAdvice = careerAdvice;
}
public String getWealthAdvice() {
return wealthAdvice;
}
public void setWealthAdvice(String wealthAdvice) {
this.wealthAdvice = wealthAdvice;
}
public String getRelationshipAdvice() {
return relationshipAdvice;
}
public void setRelationshipAdvice(String relationshipAdvice) {
this.relationshipAdvice = relationshipAdvice;
}
public String getHealthAdvice() {
return healthAdvice;
}
public void setHealthAdvice(String healthAdvice) {
this.healthAdvice = healthAdvice;
}
public String getLuckyColor() {
return luckyColor;
}
public void setLuckyColor(String luckyColor) {
this.luckyColor = luckyColor;
}
public String getLuckyNumber() {
return luckyNumber;
}
public void setLuckyNumber(String luckyNumber) {
this.luckyNumber = luckyNumber;
}
public String getLuckyDirection() {
return luckyDirection;
}
public void setLuckyDirection(String luckyDirection) {
this.luckyDirection = luckyDirection;
}
public String getKeyFocus() {
return keyFocus;
}
public void setKeyFocus(String keyFocus) {
this.keyFocus = keyFocus;
}
public String getCautionAdvice() {
return cautionAdvice;
}
public void setCautionAdvice(String cautionAdvice) {
this.cautionAdvice = cautionAdvice;
}
public String getYearlyTheme() {
return yearlyTheme;
}
public void setYearlyTheme(String yearlyTheme) {
this.yearlyTheme = yearlyTheme;
}
public String getMajorOpportunity() {
return majorOpportunity;
}
public void setMajorOpportunity(String majorOpportunity) {
this.majorOpportunity = majorOpportunity;
}
public String getMajorChallenge() {
return majorChallenge;
}
public void setMajorChallenge(String majorChallenge) {
this.majorChallenge = majorChallenge;
}
}
@@ -0,0 +1,147 @@
package io.destiny.biz.dto;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.LocalDateTime;
/**
* 紫微盘请求DTO,用于接收紫微盘计算请求
* 包含出生时间和性别等必要信息
*
* @author 张翔
* @date 2025-12-29
*/
public class ZiweiChartRequest {
/** 出生时间(必填) */
@NotNull(message = "出生时间不能为空")
private LocalDateTime birthTime;
/** 性别(必填,MALE:男,FEMALE:女) */
@NotNull(message = "性别不能为空")
private String gender;
/**
* 默认构造函数
*/
public ZiweiChartRequest() {
}
/**
* 全参构造函数
* @param birthTime 出生时间
* @param gender 性别
*/
public ZiweiChartRequest(LocalDateTime birthTime, String gender) {
this.birthTime = birthTime;
this.gender = gender;
}
/**
* 获取出生时间
* @return 出生时间
*/
public LocalDateTime getBirthTime() {
return birthTime;
}
/**
* 设置出生时间
* @param birthTime 出生时间
*/
public void setBirthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
}
/**
* 获取性别
* @return 性别
*/
public String getGender() {
return gender;
}
/**
* 设置性别
* @param gender 性别
*/
public void setGender(String gender) {
this.gender = gender;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ZiweiChartRequest that = (ZiweiChartRequest) o;
return new EqualsBuilder()
.append(birthTime, that.birthTime)
.append(gender, that.gender)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(birthTime)
.append(gender)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("birthTime", birthTime)
.append("gender", gender)
.toString();
}
/**
* 获取Builder实例
* @return Builder实例
*/
public static Builder builder() {
return new Builder();
}
/**
* Builder类,用于构建ZiweiChartRequest实例
*/
public static class Builder {
/** 出生时间 */
private LocalDateTime birthTime;
/** 性别 */
private String gender;
/**
* 设置出生时间
* @param birthTime 出生时间
* @return Builder实例
*/
public Builder birthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
return this;
}
/**
* 设置性别
* @param gender 性别
* @return Builder实例
*/
public Builder gender(String gender) {
this.gender = gender;
return this;
}
/**
* 构建ZiweiChartRequest实例
* @return ZiweiChartRequest实例
*/
public ZiweiChartRequest build() {
return new ZiweiChartRequest(birthTime, gender);
}
}
}
@@ -0,0 +1,633 @@
package io.destiny.biz.dto;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import io.destiny.biz.domain.BirthInfo;
import io.destiny.biz.domain.ZiweiChart;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* 紫微盘响应DTO,用于返回紫微盘计算结果
* 包含出生信息、天干地支、宫位信息、命盘总结和整体运势等
*
* @author 张翔
* @date 2025-12-29
*/
public class ZiweiChartResponse {
/** 出生时间 */
private LocalDateTime birthTime;
/** 年干 */
private String yearStem;
/** 年支 */
private String yearBranch;
/** 月干 */
private String monthStem;
/** 月支 */
private String monthBranch;
/** 日干 */
private String dayStem;
/** 日支 */
private String dayBranch;
/** 时干 */
private String hourStem;
/** 时支 */
private String hourBranch;
/** 性别 */
private String gender;
/** 命宫地支 */
private String mingGongBranch;
/** 身宫地支 */
private String shenGongBranch;
/** 十二宫位列表 */
private List<PalaceResponse> palaces;
/** 命盘总结 */
private String summary;
/** 整体运势 */
private String overallLuck;
/**
* 默认构造函数
*/
public ZiweiChartResponse() {
}
/**
* 全参构造函数
* @param birthTime 出生时间
* @param yearStem 年干
* @param yearBranch 年支
* @param monthStem 月干
* @param monthBranch 月支
* @param dayStem 日干
* @param dayBranch 日支
* @param hourStem 时干
* @param hourBranch 时支
* @param gender 性别
* @param mingGongBranch 命宫地支
* @param shenGongBranch 身宫地支
* @param palaces 十二宫位列表
* @param summary 命盘总结
* @param overallLuck 整体运势
*/
public ZiweiChartResponse(LocalDateTime birthTime, String yearStem, String yearBranch, String monthStem, String monthBranch, String dayStem, String dayBranch, String hourStem, String hourBranch, String gender, String mingGongBranch, String shenGongBranch, List<PalaceResponse> palaces, String summary, String overallLuck) {
this.birthTime = birthTime;
this.yearStem = yearStem;
this.yearBranch = yearBranch;
this.monthStem = monthStem;
this.monthBranch = monthBranch;
this.dayStem = dayStem;
this.dayBranch = dayBranch;
this.hourStem = hourStem;
this.hourBranch = hourBranch;
this.gender = gender;
this.mingGongBranch = mingGongBranch;
this.shenGongBranch = shenGongBranch;
this.palaces = palaces;
this.summary = summary;
this.overallLuck = overallLuck;
}
/**
* 获取出生时间
* @return 出生时间
*/
public LocalDateTime getBirthTime() {
return birthTime;
}
/**
* 设置出生时间
* @param birthTime 出生时间
*/
public void setBirthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
}
/**
* 获取年干
* @return 年干
*/
public String getYearStem() {
return yearStem;
}
/**
* 设置年干
* @param yearStem 年干
*/
public void setYearStem(String yearStem) {
this.yearStem = yearStem;
}
/**
* 获取年支
* @return 年支
*/
public String getYearBranch() {
return yearBranch;
}
/**
* 设置年支
* @param yearBranch 年支
*/
public void setYearBranch(String yearBranch) {
this.yearBranch = yearBranch;
}
/**
* 获取月干
* @return 月干
*/
public String getMonthStem() {
return monthStem;
}
/**
* 设置月干
* @param monthStem 月干
*/
public void setMonthStem(String monthStem) {
this.monthStem = monthStem;
}
/**
* 获取月支
* @return 月支
*/
public String getMonthBranch() {
return monthBranch;
}
/**
* 设置月支
* @param monthBranch 月支
*/
public void setMonthBranch(String monthBranch) {
this.monthBranch = monthBranch;
}
/**
* 获取日干
* @return 日干
*/
public String getDayStem() {
return dayStem;
}
/**
* 设置日干
* @param dayStem 日干
*/
public void setDayStem(String dayStem) {
this.dayStem = dayStem;
}
/**
* 获取日支
* @return 日支
*/
public String getDayBranch() {
return dayBranch;
}
/**
* 设置日支
* @param dayBranch 日支
*/
public void setDayBranch(String dayBranch) {
this.dayBranch = dayBranch;
}
/**
* 获取时干
* @return 时干
*/
public String getHourStem() {
return hourStem;
}
/**
* 设置时干
* @param hourStem 时干
*/
public void setHourStem(String hourStem) {
this.hourStem = hourStem;
}
/**
* 获取时支
* @return 时支
*/
public String getHourBranch() {
return hourBranch;
}
/**
* 设置时支
* @param hourBranch 时支
*/
public void setHourBranch(String hourBranch) {
this.hourBranch = hourBranch;
}
/**
* 获取性别
* @return 性别
*/
public String getGender() {
return gender;
}
/**
* 设置性别
* @param gender 性别
*/
public void setGender(String gender) {
this.gender = gender;
}
/**
* 获取命宫地支
* @return 命宫地支
*/
public String getMingGongBranch() {
return mingGongBranch;
}
/**
* 设置命宫地支
* @param mingGongBranch 命宫地支
*/
public void setMingGongBranch(String mingGongBranch) {
this.mingGongBranch = mingGongBranch;
}
/**
* 获取身宫地支
* @return 身宫地支
*/
public String getShenGongBranch() {
return shenGongBranch;
}
/**
* 设置身宫地支
* @param shenGongBranch 身宫地支
*/
public void setShenGongBranch(String shenGongBranch) {
this.shenGongBranch = shenGongBranch;
}
/**
* 获取十二宫位列表
* @return 十二宫位列表
*/
public List<PalaceResponse> getPalaces() {
return palaces;
}
/**
* 设置十二宫位列表
* @param palaces 十二宫位列表
*/
public void setPalaces(List<PalaceResponse> palaces) {
this.palaces = palaces;
}
/**
* 获取命盘总结
* @return 命盘总结
*/
public String getSummary() {
return summary;
}
/**
* 设置命盘总结
* @param summary 命盘总结
*/
public void setSummary(String summary) {
this.summary = summary;
}
/**
* 获取整体运势
* @return 整体运势
*/
public String getOverallLuck() {
return overallLuck;
}
/**
* 设置整体运势
* @param overallLuck 整体运势
*/
public void setOverallLuck(String overallLuck) {
this.overallLuck = overallLuck;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ZiweiChartResponse that = (ZiweiChartResponse) o;
return new EqualsBuilder()
.append(birthTime, that.birthTime)
.append(yearStem, that.yearStem)
.append(yearBranch, that.yearBranch)
.append(monthStem, that.monthStem)
.append(monthBranch, that.monthBranch)
.append(dayStem, that.dayStem)
.append(dayBranch, that.dayBranch)
.append(hourStem, that.hourStem)
.append(hourBranch, that.hourBranch)
.append(gender, that.gender)
.append(mingGongBranch, that.mingGongBranch)
.append(shenGongBranch, that.shenGongBranch)
.append(palaces, that.palaces)
.append(summary, that.summary)
.append(overallLuck, that.overallLuck)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(birthTime)
.append(yearStem)
.append(yearBranch)
.append(monthStem)
.append(monthBranch)
.append(dayStem)
.append(dayBranch)
.append(hourStem)
.append(hourBranch)
.append(gender)
.append(mingGongBranch)
.append(shenGongBranch)
.append(palaces)
.append(summary)
.append(overallLuck)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("birthTime", birthTime)
.append("yearStem", yearStem)
.append("yearBranch", yearBranch)
.append("monthStem", monthStem)
.append("monthBranch", monthBranch)
.append("dayStem", dayStem)
.append("dayBranch", dayBranch)
.append("hourStem", hourStem)
.append("hourBranch", hourBranch)
.append("gender", gender)
.append("mingGongBranch", mingGongBranch)
.append("shenGongBranch", shenGongBranch)
.append("palaces", palaces)
.append("summary", summary)
.append("overallLuck", overallLuck)
.toString();
}
/**
* 获取Builder实例
* @return Builder实例
*/
public static Builder builder() {
return new Builder();
}
/**
* Builder类,用于构建ZiweiChartResponse实例
*/
public static class Builder {
/** 出生时间 */
private LocalDateTime birthTime;
/** 年干 */
private String yearStem;
/** 年支 */
private String yearBranch;
/** 月干 */
private String monthStem;
/** 月支 */
private String monthBranch;
/** 日干 */
private String dayStem;
/** 日支 */
private String dayBranch;
/** 时干 */
private String hourStem;
/** 时支 */
private String hourBranch;
/** 性别 */
private String gender;
/** 命宫地支 */
private String mingGongBranch;
/** 身宫地支 */
private String shenGongBranch;
/** 十二宫位列表 */
private List<PalaceResponse> palaces;
/** 命盘总结 */
private String summary;
/** 整体运势 */
private String overallLuck;
/**
* 设置出生时间
* @param birthTime 出生时间
* @return Builder实例
*/
public Builder birthTime(LocalDateTime birthTime) {
this.birthTime = birthTime;
return this;
}
/**
* 设置年干
* @param yearStem 年干
* @return Builder实例
*/
public Builder yearStem(String yearStem) {
this.yearStem = yearStem;
return this;
}
/**
* 设置年支
* @param yearBranch 年支
* @return Builder实例
*/
public Builder yearBranch(String yearBranch) {
this.yearBranch = yearBranch;
return this;
}
/**
* 设置月干
* @param monthStem 月干
* @return Builder实例
*/
public Builder monthStem(String monthStem) {
this.monthStem = monthStem;
return this;
}
/**
* 设置月支
* @param monthBranch 月支
* @return Builder实例
*/
public Builder monthBranch(String monthBranch) {
this.monthBranch = monthBranch;
return this;
}
/**
* 设置日干
* @param dayStem 日干
* @return Builder实例
*/
public Builder dayStem(String dayStem) {
this.dayStem = dayStem;
return this;
}
/**
* 设置日支
* @param dayBranch 日支
* @return Builder实例
*/
public Builder dayBranch(String dayBranch) {
this.dayBranch = dayBranch;
return this;
}
/**
* 设置时干
* @param hourStem 时干
* @return Builder实例
*/
public Builder hourStem(String hourStem) {
this.hourStem = hourStem;
return this;
}
/**
* 设置时支
* @param hourBranch 时支
* @return Builder实例
*/
public Builder hourBranch(String hourBranch) {
this.hourBranch = hourBranch;
return this;
}
/**
* 设置性别
* @param gender 性别
* @return Builder实例
*/
public Builder gender(String gender) {
this.gender = gender;
return this;
}
/**
* 设置命宫地支
* @param mingGongBranch 命宫地支
* @return Builder实例
*/
public Builder mingGongBranch(String mingGongBranch) {
this.mingGongBranch = mingGongBranch;
return this;
}
/**
* 设置身宫地支
* @param shenGongBranch 身宫地支
* @return Builder实例
*/
public Builder shenGongBranch(String shenGongBranch) {
this.shenGongBranch = shenGongBranch;
return this;
}
/**
* 设置十二宫位列表
* @param palaces 十二宫位列表
* @return Builder实例
*/
public Builder palaces(List<PalaceResponse> palaces) {
this.palaces = palaces;
return this;
}
/**
* 设置命盘总结
* @param summary 命盘总结
* @return Builder实例
*/
public Builder summary(String summary) {
this.summary = summary;
return this;
}
/**
* 设置整体运势
* @param overallLuck 整体运势
* @return Builder实例
*/
public Builder overallLuck(String overallLuck) {
this.overallLuck = overallLuck;
return this;
}
/**
* 构建ZiweiChartResponse实例
* @return ZiweiChartResponse实例
*/
public ZiweiChartResponse build() {
return new ZiweiChartResponse(birthTime, yearStem, yearBranch, monthStem, monthBranch, dayStem, dayBranch, hourStem, hourBranch, gender, mingGongBranch, shenGongBranch, palaces, summary, overallLuck);
}
}
/**
* 从ZiweiChart对象转换为ZiweiChartResponse对象
* @param chart 紫微盘对象
* @return 紫微盘响应DTO对象
*/
public static ZiweiChartResponse fromChart(ZiweiChart chart) {
BirthInfo birthInfo = chart.getBirthInfo();
List<PalaceResponse> palaceResponses = chart.getPalaces().stream()
.map(PalaceResponse::fromPalace)
.collect(Collectors.toList());
return ZiweiChartResponse.builder()
.birthTime(birthInfo.getBirthTime())
.yearStem(birthInfo.getYearStem() != null ? birthInfo.getYearStem().getName() : null)
.yearBranch(birthInfo.getYearBranch() != null ? birthInfo.getYearBranch().getName() : null)
.monthStem(birthInfo.getMonthStem() != null ? birthInfo.getMonthStem().getName() : null)
.monthBranch(birthInfo.getMonthBranch() != null ? birthInfo.getMonthBranch().getName() : null)
.dayStem(birthInfo.getDayStem() != null ? birthInfo.getDayStem().getName() : null)
.dayBranch(birthInfo.getDayBranch() != null ? birthInfo.getDayBranch().getName() : null)
.hourStem(birthInfo.getHourStem() != null ? birthInfo.getHourStem().getName() : null)
.hourBranch(birthInfo.getHourBranch() != null ? birthInfo.getHourBranch().getName() : null)
.gender(birthInfo.getGender())
.mingGongBranch(chart.getMingGongBranch() != null ? chart.getMingGongBranch().getName() : null)
.shenGongBranch(chart.getShenGongBranch() != null ? chart.getShenGongBranch().getName() : null)
.palaces(palaceResponses)
.summary(chart.getSummary())
.overallLuck(chart.getOverallLuck())
.build();
}
}
@@ -0,0 +1,48 @@
package io.destiny.biz.enums;
/**
* 方位枚举
* 用于表示黄历中的吉凶方位
* 包括八个主要方位:正东、正南、正西、正北、东南、东北、西南、西北
*
* @author 张翔
* @date 2026-01-04
*/
public enum Direction {
EAST("正东", 0),
SOUTHEAST("东南", 45),
SOUTH("正南", 90),
SOUTHWEST("西南", 135),
WEST("正西", 180),
NORTHWEST("西北", 225),
NORTH("正北", 270),
NORTHEAST("东北", 315);
/** 方位名称 */
private final String name;
/** 方位角度 */
private final int degree;
Direction(String name, int degree) {
this.name = name;
this.degree = degree;
}
public String getName() {
return name;
}
public int getDegree() {
return degree;
}
public static Direction fromDegree(int degree) {
int normalizedDegree = ((degree % 360) + 360) % 360;
for (Direction direction : values()) {
if (direction.degree == normalizedDegree) {
return direction;
}
}
return null;
}
}
@@ -0,0 +1,36 @@
package io.destiny.biz.enums;
public enum EarthlyBranch {
ZI("", 1),
CHOU("", 2),
YIN("", 3),
MAO("", 4),
CHEN("", 5),
SI("", 6),
WU("", 7),
WEI("", 8),
SHEN("", 9),
YOU("", 10),
XU("", 11),
HAI("", 12);
private final String name;
private final int index;
EarthlyBranch(String name, int index) {
this.name = name;
this.index = index;
}
public String getName() {
return name;
}
public int getIndex() {
return index;
}
public static EarthlyBranch fromIndex(int index) {
return values()[(index - 1) % 12];
}
}
@@ -0,0 +1,14 @@
package io.destiny.biz.enums;
public enum FortuneType {
DAILY,
MONTHLY,
YEARLY,
CAREER,
WEALTH,
LOVE,
HEALTH,
STUDY,
SOCIAL,
TRAVEL
}
@@ -0,0 +1,62 @@
package io.destiny.biz.enums;
/**
* 天干枚举
* 包含十天干的详细信息
* 天干是中国传统历法中的十个符号,用于表示年份、月份、日期、时辰
*
* @author 张翔
* @date 2025-12-29
*/
public enum HeavenlyStem {
JIA("", 1),
YI("", 2),
BING("", 3),
DING("", 4),
WU("", 5),
JI("", 6),
GENG("", 7),
XIN("", 8),
REN("", 9),
GUI("", 10);
/** 天干名称 */
private final String name;
/** 天干索引 */
private final int index;
/**
* 构造函数
* @param name 天干名称
* @param index 天干索引
*/
HeavenlyStem(String name, int index) {
this.name = name;
this.index = index;
}
/**
* 获取天干名称
* @return 天干名称
*/
public String getName() {
return name;
}
/**
* 获取天干索引
* @return 天干索引
*/
public int getIndex() {
return index;
}
/**
* 根据索引获取天干
* @param index 天干索引(1-10
* @return 天干枚举值
*/
public static HeavenlyStem fromIndex(int index) {
return values()[(index - 1) % 10];
}
}
@@ -0,0 +1,62 @@
package io.destiny.biz.enums;
/**
* 建除十二神枚举
* 建除十二神是中国传统历法中的重要概念,用于判断每日的宜忌
* 顺序为:建、除、满、平、定、执、破、危、成、收、开、闭
*
* @author 张翔
* @date 2026-01-04
*/
public enum JianChuDeity {
JIAN("", 1, "建日: 万物生育之始,宜开业、嫁娶、出行"),
CHU("", 2, "除日: 去旧迎新,宜扫除、治病、破土"),
MAN("", 3, "满日: 圆满之意,宜祈福、祭祀、安葬"),
PING("", 4, "平日: 平稳之意,宜修造、动土、交易"),
DING("", 5, "定日: 稳定之意,宜纳财、签约、安床"),
ZHI("", 6, "执日: 执掌之意,宜上任、出行、求医"),
PO("", 7, "破日: 破坏之意,宜破屋、坏垣、拆卸"),
WEI("", 8, "危日: 危险之意,宜安葬、破土、修坟"),
CHENG("", 9, "成日: 成功之意,宜嫁娶、开市、交易"),
SHOU("", 10, "收日: 收藏之意,宜纳财、买田、置业"),
KAI("", 11, "开日: 开启之意,宜开业、开工、开张"),
BI("", 12, "闭日: 关闭之意,宜塞穴、断蚁、筑堤");
/** 建除神名称 */
private final String name;
/** 建除神索引 */
private final int index;
/** 建除神说明 */
private final String description;
JianChuDeity(String name, int index, String description) {
this.name = name;
this.index = index;
this.description = description;
}
public String getName() {
return name;
}
public int getIndex() {
return index;
}
public String getDescription() {
return description;
}
public static JianChuDeity fromIndex(int index) {
return values()[(index - 1) % 12];
}
public static JianChuDeity fromName(String name) {
for (JianChuDeity deity : values()) {
if (deity.name.equals(name)) {
return deity;
}
}
throw new IllegalArgumentException("未知的建除十二神名称:" + name);
}
}
@@ -0,0 +1,93 @@
package io.destiny.biz.enums;
/**
* 紫微斗数主星枚举
* 包含紫微斗数十四颗主星的详细信息
* 每颗主星都有名称、索引、性质、别称和描述
*
* @author 张翔
* @date 2025-12-29
*/
public enum MajorStar {
ZIWEI("紫微", 1, StarNature.JI, "帝星", "领导、权威、尊贵"),
TIANJI("天机", 2, StarNature.JI, "智星", "智慧、谋略、变通"),
TAIYANG("太阳", 3, StarNature.JI, "贵星", "光明、热情、慷慨"),
WUQU("武曲", 4, StarNature.XIONG, "财星", "刚毅、务实、财帛"),
TIANTONG("天同", 5, StarNature.JI, "福星", "温和、福气、享受"),
LIANCHEN("廉贞", 6, StarNature.XIONG, "情星", "感情、才华、是非"),
TIANFU("天府", 7, StarNature.JI, "库星", "稳重、保守、财富"),
TAIYIN("太阴", 8, StarNature.ZHONGHE, "母星", "温柔、内敛、母性"),
TANLANG("贪狼", 9, StarNature.XIONG, "欲星", "欲望、魅力、桃花"),
JUMEN("巨门", 10, StarNature.XIONG, "口星", "口才、是非、沟通"),
TIANXIANG("天相", 11, StarNature.JI, "印星", "辅佐、稳重、贵人"),
TIANLIANG("天梁", 12, StarNature.ZHONGHE, "荫星", "恩泽、稳重、长辈"),
QISHA("七杀", 13, StarNature.XIONG, "将星", "威猛、果断、开创"),
POJUN("破军", 14, StarNature.XIONG, "耗星", "破旧立新、变动、消耗");
/** 星星名称 */
private final String name;
/** 星星索引 */
private final int index;
/** 星星性质 */
private final StarNature nature;
/** 星星别称 */
private final String alias;
/** 星星描述 */
private final String description;
/**
* 构造函数
* @param name 星星名称
* @param index 星星索引
* @param nature 星星性质
* @param alias 星星别称
* @param description 星星描述
*/
MajorStar(String name, int index, StarNature nature, String alias, String description) {
this.name = name;
this.index = index;
this.nature = nature;
this.alias = alias;
this.description = description;
}
/**
* 获取星星名称
* @return 星星名称
*/
public String getName() {
return name;
}
/**
* 获取星星索引
* @return 星星索引
*/
public int getIndex() {
return index;
}
/**
* 获取星星性质
* @return 星星性质
*/
public StarNature getNature() {
return nature;
}
/**
* 获取星星别称
* @return 星星别称
*/
public String getAlias() {
return alias;
}
/**
* 获取星星描述
* @return 星星描述
*/
public String getDescription() {
return description;
}
}
@@ -0,0 +1,89 @@
package io.destiny.biz.enums;
/**
* 紫微斗数辅星枚举
* 包含紫微斗数辅星的详细信息
* 辅星分为吉星、煞星和其他类型,每颗辅星都有名称、类型、别称和描述
*
* @author 张翔
* @date 2025-12-29
*/
public enum MinorStar {
ZUOFU("左辅", MinorStarType.LUCKY, "左辅星", "主辅佐、助力、贵人"),
YOUBI("右弼", MinorStarType.LUCKY, "右弼星", "主辅佐、助力、贵人"),
TIANKUI("天魁", MinorStarType.LUCKY, "天魁星", "主贵人、助力、机遇"),
TIANYUE("天钺", MinorStarType.LUCKY, "天钺星", "主贵人、助力、机遇"),
WENCHANG("文昌", MinorStarType.LUCKY, "文昌星", "主科名、文采、学业"),
WENQU("文曲", MinorStarType.LUCKY, "文曲星", "主口才、艺术、才华"),
QINGYANG("擎羊", MinorStarType.EVIL, "羊刃星", "主刑伤、是非、血光"),
TUOLUO("陀罗", MinorStarType.EVIL, "陀罗星", "主拖延、迟滞、纠结"),
HUOXING("火星", MinorStarType.EVIL, "火星", "主急躁、突发、灾难"),
LINGXING("铃星", MinorStarType.EVIL, "铃星", "主突发、灾难、变动"),
DIKONG("地空", MinorStarType.EVIL, "地空星", "主空亡、损失、虚耗"),
DIJIE("地劫", MinorStarType.EVIL, "地劫星", "主劫夺、损失、破财"),
TIANXING("天刑", MinorStarType.EVIL, "天刑星", "主刑伤、官非、诉讼"),
LUCUN("禄存", MinorStarType.OTHER, "禄存星", "主财帛、福气"),
TIANMA("天马", MinorStarType.OTHER, "天马星", "主迁移、奔波、变动"),
HUAGAI("华盖", MinorStarType.OTHER, "华盖星", "主孤独、艺术、宗教"),
LONGCHI("龙池", MinorStarType.OTHER, "龙池星", "主才华、艺术、文采"),
FENGGU("凤阁", MinorStarType.OTHER, "凤阁星", "主才华、艺术、文采"),
HONGLUAN("红鸾", MinorStarType.OTHER, "红鸾星", "主桃花、婚姻、感情"),
TIANXI("天喜", MinorStarType.OTHER, "天喜星", "主桃花、婚姻、感情"),
GUCHEN("孤辰", MinorStarType.OTHER, "孤辰星", "主孤独、寂寞、寡居"),
GUAKU("寡宿", MinorStarType.OTHER, "寡宿星", "主孤独、寂寞、寡居");
/** 星星名称 */
private final String name;
/** 星星类型 */
private final MinorStarType type;
/** 星星别称 */
private final String alias;
/** 星星描述 */
private final String description;
/**
* 构造函数
* @param name 星星名称
* @param type 星星类型
* @param alias 星星别称
* @param description 星星描述
*/
MinorStar(String name, MinorStarType type, String alias, String description) {
this.name = name;
this.type = type;
this.alias = alias;
this.description = description;
}
/**
* 获取星星名称
* @return 星星名称
*/
public String getName() {
return name;
}
/**
* 获取星星类型
* @return 星星类型
*/
public MinorStarType getType() {
return type;
}
/**
* 获取星星别称
* @return 星星别称
*/
public String getAlias() {
return alias;
}
/**
* 获取星星描述
* @return 星星描述
*/
public String getDescription() {
return description;
}
}
@@ -0,0 +1,17 @@
package io.destiny.biz.enums;
public enum MinorStarType {
LUCKY("吉星"),
EVIL("煞星"),
OTHER("其他");
private final String description;
MinorStarType(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
@@ -0,0 +1,67 @@
package io.destiny.biz.enums;
/**
* 纳音五行枚举
* 定义六十甲子的纳音五行属性
* 纳音五行是中国传统命理学中的重要概念
*
* @author 张翔
* @date 2026-01-04
*/
public enum NaYin {
HAI_ZHONG_JIN("海中金", "甲子、乙丑"),
LU_ZHONG_HUO("炉中火", "丙寅、丁卯"),
DA_LIN_MU("大林木", "戊辰、己巳"),
LU_PAN_SHUI("路旁水", "庚午、辛未"),
JIAN_XIA_JIN("剑锋金", "壬申、癸酉"),
SHAN_TOU_HUO("山头火", "甲戌、乙亥"),
SHAN_XIA_SHUI("山下火", "丙子、丁丑"),
DI_SHANG_MU("地上木", "戊寅、己卯"),
QIAO_TOU_JIN("墙头金", "庚辰、辛巳"),
BAI_LA_SHUI("白蜡金", "壬午、癸未"),
YANG_LIU_MU("杨柳木", "甲申、乙酉"),
QUAN_ZHONG_SHUI("泉中水", "丙戌、丁亥"),
DING_TOU_HUO("屋上土", "戊子、己丑"),
LEI_TING_HUO("霹雳火", "庚寅、辛卯"),
SONG_BAI_MU("松柏木", "壬辰、癸巳"),
CHANG_LIU_SHUI("长流水", "甲午、乙未"),
SHA_ZHONG_JIN("沙中金", "丙申、丁酉"),
SHAN_XIA_HUO("山下火", "戊戌、己亥"),
PING_DI_MU("平地木", "庚子、辛丑"),
BI_DENG_JIN("壁上土", "壬寅、癸卯"),
JIN_BO_JIN("金箔金", "甲辰、乙巳"),
FU_DENG_HUO("覆灯火", "丙午、丁未"),
TIAN_HE_SHUI("天河水", "戊申、己酉"),
DA_YI_TU("大驿土", "庚戌、辛亥"),
CHA_YANG_JIN("钗钏金", "壬子、癸丑"),
SANG_ZHE_MU("桑柘木", "甲寅、乙卯"),
DA_CHUAN_SHUI("大溪水", "丙辰、丁巳"),
SHA_ZHONG_TU("沙中土", "戊午、己未"),
TIAN_SHANG_HUO("天上火", "庚申、辛酉"),
SHI_ZHONG_JIN("石榴木", "壬戌、癸亥");
private final String name;
private final String ganZhi;
NaYin(String name, String ganZhi) {
this.name = name;
this.ganZhi = ganZhi;
}
public String getName() {
return name;
}
public String getGanZhi() {
return ganZhi;
}
public static NaYin fromName(String name) {
for (NaYin naYin : values()) {
if (naYin.name.equals(name)) {
return naYin;
}
}
return null;
}
}
@@ -0,0 +1,43 @@
package io.destiny.biz.enums;
/**
* 紫微斗数宫位类型枚举
* 包含紫微斗数十二宫位的类型定义
* 每个宫位都有对应的名称,用于表示人生不同方面的运势
*
* @author 张翔
* @date 2025-12-29
*/
public enum PalaceType {
MING("命宫"),
XIONG("兄弟宫"),
FUQI("夫妻宫"),
ZINV("子女宫"),
CAI("财帛宫"),
JILU("疾厄宫"),
QIAN("迁移宫"),
GUANLU("官禄宫"),
TUDI("田宅宫"),
FUBEN("福德宫"),
FU("父母宫"),
SHEN("身宫");
/** 宫位名称 */
private final String name;
/**
* 构造函数
* @param name 宫位名称
*/
PalaceType(String name) {
this.name = name;
}
/**
* 获取宫位名称
* @return 宫位名称
*/
public String getName() {
return name;
}
}
@@ -0,0 +1,63 @@
package io.destiny.biz.enums;
/**
* 值日星神枚举
* 定义黄历中的值日星神
* 值日星神是每日值班的主神,影响当日的吉凶
*
* @author 张翔
* @date 2026-01-04
*/
public enum StarGod {
TIAN_DE("天德", "天德星: 吉星,宜嫁娶、出行、交易"),
YUE_DE("月德", "月德星: 吉星,宜祈福、祭祀、安葬"),
TIAN_DE_HE("天德合", "天德合星: 吉星,宜嫁娶、出行、交易"),
YUE_DE_HE("月德合", "月德合星: 吉星,宜祈福、祭祀、安葬"),
TIAN_EN("天恩", "天恩星: 吉星,宜施恩、布施、祈福"),
SI_MING("四相", "四相星: 吉星,宜上任、出行、求财"),
SAN_HE("三合", "三合星: 吉星,宜嫁娶、开业、交易"),
LIU_HE("六合", "六合星: 吉星,宜嫁娶、出行、交友"),
TIAN_YI("天乙", "天乙星: 吉星,宜嫁娶、出行、求财"),
FU_XING("福星", "福星: 吉星,宜祈福、祭祀、安葬"),
LU_XING("禄星", "禄星: 吉星,宜求财、上任、交易"),
SHOU_XING("寿星", "寿星: 吉星,宜祈福、祭祀、安葬"),
WEN_CHANG("文昌", "文昌星: 吉星,宜读书、考试、求学"),
TIAN_MA("天马", "天马星: 吉星,宜出行、求财、交易"),
JIN_TANG("金堂", "金堂星: 吉星,宜嫁娶、开业、交易"),
FU_SHEN("福神", "福神: 吉星,宜祈福、祭祀、安葬"),
GUI_REN("贵人", "贵人星: 吉星,宜求财、上任、交友"),
YI_MA("驿马", "驿马星: 吉星,宜出行、求财、交易"),
HUA_GAI("华盖", "华盖星: 吉星,宜读书、考试、求学"),
TIAN_XI("天喜", "天喜星: 吉星,宜嫁娶、开业、交易"),
TIAN_YU("天狱", "天狱星: 凶星,宜静养、祈福、祭祀"),
TIAN_ZAI("天贼", "天贼星: 凶星,宜防盗、守财、祈福"),
TIAN_SHA("天煞", "天煞星: 凶星,宜静养、祈福、祭祀"),
YUE_SHA("月煞", "月煞星: 凶星,宜静养、祈福、祭祀"),
RI_SHA("日煞", "日煞星: 凶星,宜静养、祈福、祭祀"),
SHI_SHA("时煞", "时煞星: 凶星,宜静养、祈福、祭祀");
private final String name;
private final String description;
StarGod(String name, String description) {
this.name = name;
this.description = description;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public static StarGod fromName(String name) {
for (StarGod starGod : values()) {
if (starGod.name.equals(name)) {
return starGod;
}
}
return null;
}
}
@@ -0,0 +1,26 @@
package io.destiny.biz.enums;
public enum StarNature {
JI("", "吉星"),
XIONG("", "凶星"),
ZHONGHE("", "中性"),
AUSPICIOUS("", "吉星"),
NEUTRAL("", "中性"),
INAUSPICIOUS("", "凶星");
private final String name;
private final String description;
StarNature(String name, String description) {
this.name = name;
this.description = description;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
}
@@ -0,0 +1,67 @@
package io.destiny.biz.enums;
/**
* 宜事项枚举
* 定义黄历中适合进行的活动
*
* @author 张翔
* @date 2026-01-04
*/
public enum SuitableActivity {
JIE_HUN("结婚", "嫁娶"),
KAI_YE("开业", "开市"),
CHU_XING("出行", "出行"),
QIU_CAI("求财", "求财"),
JIAN_FANG("建房", "修造"),
AN_ZANG("安葬", "安葬"),
JI_SI("祭祀", "祭祀"),
QI_FU("祈福", "祈福"),
QIAN_YI("迁移", "迁移"),
JIAO_YI("交易", "交易"),
NONG_TIAN("农事", "种田"),
ZHI_BING("治病", "求医"),
SHANG_FANG("上房", "上梁"),
PO_TU("破土", "破土"),
AN_CHUANG("安床", "安床"),
QIAN_YIN("迁入", "入宅"),
JIAO_YOU("交友", "会友"),
CHU_FA("出发", "出行"),
DING_QIN("定亲", "订婚"),
CHU_YU("出浴", "沐浴"),
XI_TOU("洗头", "理发"),
JIAN_ZAO("建造", "修造"),
SHANG_LIANG("上梁", "上梁"),
AN_MEN("安门", "安门"),
KAI_JING("开井", "开井"),
ZAO_CHU("造厨", "作灶"),
ZAO_CHUAN("造船", "造船"),
AN_JI("安机", "安机"),
BU_LU("补路", "补路"),
PO_WU("破屋", "破屋"),
HUAI_YUAN("坏垣", "坏垣");
private final String name;
private final String alias;
SuitableActivity(String name, String alias) {
this.name = name;
this.alias = alias;
}
public String getName() {
return name;
}
public String getAlias() {
return alias;
}
public static SuitableActivity fromName(String name) {
for (SuitableActivity activity : values()) {
if (activity.name.equals(name) || activity.alias.equals(name)) {
return activity;
}
}
return null;
}
}
@@ -0,0 +1,18 @@
package io.destiny.biz.enums;
public enum TransformationType {
LU(""),
QUAN(""),
KE(""),
JI("");
private final String name;
TransformationType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
@@ -0,0 +1,67 @@
package io.destiny.biz.enums;
/**
* 忌事项枚举
* 定义黄历中不适合进行的活动
*
* @author 张翔
* @date 2026-01-04
*/
public enum UnsuitableActivity {
JIE_HUN("结婚", "嫁娶"),
KAI_YE("开业", "开市"),
CHU_XING("出行", "出行"),
QIU_CAI("求财", "求财"),
JIAN_FANG("建房", "修造"),
AN_ZANG("安葬", "安葬"),
JI_SI("祭祀", "祭祀"),
QI_FU("祈福", "祈福"),
QIAN_YI("迁移", "迁移"),
JIAO_YI("交易", "交易"),
NONG_TIAN("农事", "种田"),
ZHI_BING("治病", "求医"),
SHANG_FANG("上房", "上梁"),
PO_TU("破土", "破土"),
AN_CHUANG("安床", "安床"),
QIAN_YIN("迁入", "入宅"),
JIAO_YOU("交友", "会友"),
CHU_FA("出发", "出行"),
DING_QIN("定亲", "订婚"),
CHU_YU("出浴", "沐浴"),
XI_TOU("洗头", "理发"),
JIAN_ZAO("建造", "修造"),
SHANG_LIANG("上梁", "上梁"),
AN_MEN("安门", "安门"),
KAI_JING("开井", "开井"),
ZAO_CHU("造厨", "作灶"),
ZAO_CHUAN("造船", "造船"),
AN_JI("安机", "安机"),
BU_LU("补路", "补路"),
PO_WU("破屋", "破屋"),
HUAI_YUAN("坏垣", "坏垣");
private final String name;
private final String alias;
UnsuitableActivity(String name, String alias) {
this.name = name;
this.alias = alias;
}
public String getName() {
return name;
}
public String getAlias() {
return alias;
}
public static UnsuitableActivity fromName(String name) {
for (UnsuitableActivity activity : values()) {
if (activity.name.equals(name) || activity.alias.equals(name)) {
return activity;
}
}
return null;
}
}
@@ -0,0 +1,22 @@
package io.destiny.biz.exception;
public class AlmanacException extends RuntimeException {
private static final long serialVersionUID = 1L;
private final String errorCode;
public AlmanacException(String errorCode, String message) {
super(message);
this.errorCode = errorCode;
}
public AlmanacException(String errorCode, String message, Throwable cause) {
super(message, cause);
this.errorCode = errorCode;
}
public String getErrorCode() {
return errorCode;
}
}
@@ -0,0 +1,45 @@
package io.destiny.biz.exception;
import io.destiny.common.response.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebExceptionHandler;
import reactor.core.publisher.Mono;
public class AlmanacExceptionHandler implements WebExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(AlmanacExceptionHandler.class);
@Override
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
if (ex instanceof AlmanacException) {
return handleAlmanacException(exchange, (AlmanacException) ex);
}
return Mono.error(ex);
}
private Mono<Void> handleAlmanacException(ServerWebExchange exchange, AlmanacException ex) {
String businessCode = ex.getErrorCode();
String message = ex.getMessage();
logger.warn("Almanac exception: Code={}, Message={}", businessCode, message);
HttpStatus status = determineHttpStatus(businessCode);
exchange.getResponse().setStatusCode(status);
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON);
Result<Void> result = Result.error(businessCode, message);
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse()
.bufferFactory()
.wrap(result.toString().getBytes())));
}
private HttpStatus determineHttpStatus(String errorCode) {
if ("SEARCH_FAILED".equals(errorCode)) {
return HttpStatus.INTERNAL_SERVER_ERROR;
}
return HttpStatus.BAD_REQUEST;
}
}
@@ -0,0 +1,130 @@
package io.destiny.biz.filter;
import io.destiny.client.core.domain.Subscription;
import io.destiny.client.core.repository.ISubscriptionRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.List;
@Component
@Order(3)
public class BizSubscriptionFilter implements WebFilter {
private static final Logger logger = LoggerFactory.getLogger(BizSubscriptionFilter.class);
private static final String USER_ID_HEADER = "X-User-Id";
private final ISubscriptionRepository subscriptionRepository;
private final List<String> protectedPaths;
public BizSubscriptionFilter(ISubscriptionRepository subscriptionRepository) {
this.subscriptionRepository = subscriptionRepository;
this.protectedPaths = List.of(
"/ziwei",
"/fortune"
);
}
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
String path = exchange.getRequest().getPath().value();
if (!isProtectedPath(path)) {
logger.debug("Public path, skipping subscription check: {}", path);
return chain.filter(exchange);
}
String userIdHeader = exchange.getRequest().getHeaders().getFirst(USER_ID_HEADER);
if (userIdHeader == null) {
logger.warn("Missing user ID header for protected path: {}", path);
return unauthorized(exchange, "User authentication required");
}
try {
Long userId = Long.parseLong(userIdHeader);
return subscriptionRepository.findByClientUserId(userId)
.next()
.switchIfEmpty(Mono.error(new RuntimeException("No subscription found")))
.flatMap(subscription -> {
if (hasValidSubscription(subscription)) {
logger.debug("Subscription valid for user {} accessing {}", userId, path);
return chain.filter(exchange);
} else {
logger.warn("Subscription expired or inactive for user {} accessing {}", userId, path);
return forbidden(exchange, "Subscription expired or inactive");
}
})
.onErrorResume(e -> {
logger.error("Error during subscription check for {}", path, e);
if (e.getMessage().contains("No subscription found")) {
return forbidden(exchange, "No subscription found");
}
return forbidden(exchange, "Subscription check failed");
});
} catch (NumberFormatException e) {
logger.error("Invalid user ID format: {}", userIdHeader);
return unauthorized(exchange, "Invalid user ID format");
}
}
private boolean isProtectedPath(String path) {
return protectedPaths.stream().anyMatch(path::startsWith);
}
private boolean hasValidSubscription(Subscription subscription) {
if (subscription == null) {
return false;
}
String status = subscription.getStatus();
LocalDate endDate = subscription.getEndDate();
if ("ACTIVE".equals(status) && endDate != null && endDate.isAfter(LocalDate.now())) {
return true;
}
if ("TRIAL".equals(status) && endDate != null && endDate.isAfter(LocalDate.now())) {
return true;
}
return false;
}
private Mono<Void> unauthorized(ServerWebExchange exchange, String message) {
exchange.getResponse().setStatusCode(HttpStatus.UNAUTHORIZED);
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON);
String body = String.format("{\"code\":\"UNAUTHORIZED\",\"message\":\"%s\"}", message);
return exchange.getResponse().writeWith(
reactor.core.publisher.Flux.just(
exchange.getResponse().bufferFactory().wrap(body.getBytes(StandardCharsets.UTF_8))));
}
private Mono<Void> forbidden(ServerWebExchange exchange, String message) {
exchange.getResponse().setStatusCode(HttpStatus.FORBIDDEN);
exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON);
String body = String.format("{\"code\":\"FORBIDDEN\",\"message\":\"%s\"}", message);
return exchange.getResponse().writeWith(
reactor.core.publisher.Flux.just(
exchange.getResponse().bufferFactory().wrap(body.getBytes(StandardCharsets.UTF_8))));
}
}
@@ -0,0 +1,134 @@
package io.destiny.biz.handler;
import io.destiny.biz.domain.Almanac;
import io.destiny.biz.dto.AlmanacResponse;
import io.destiny.biz.exception.AlmanacException;
import io.destiny.biz.service.IAlmanacService;
import io.destiny.biz.service.ICalendarService;
import io.destiny.common.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.List;
import java.util.stream.Collectors;
import static org.springframework.http.MediaType.APPLICATION_JSON;
@Component
@Tag(name = "黄历接口", description = "黄历信息查询相关接口")
public class AlmanacHandler {
private static final Logger log = LoggerFactory.getLogger(AlmanacHandler.class);
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private final IAlmanacService almanacService;
private final ICalendarService calendarService;
public AlmanacHandler(IAlmanacService almanacService, ICalendarService calendarService) {
this.almanacService = almanacService;
this.calendarService = calendarService;
}
@Operation(summary = "查询指定日期的黄历信息", description = "根据阳历日期查询黄历信息,包括宜忌事项、吉凶方位、冲煞信息、建除十二神、值日星神、纳音五行、胎神方位、彭祖百忌等")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "查询成功", content = @Content(schema = @Schema(implementation = Result.class))),
@ApiResponse(responseCode = "400", description = "请求参数错误"),
@ApiResponse(responseCode = "500", description = "服务器内部错误")
})
public Mono<ServerResponse> getAlmanacByDate(
@Parameter(description = "服务器请求对象", hidden = true) ServerRequest request) {
String dateStr = request.pathVariable("date");
log.info("接收到黄历查询请求:date={}", dateStr);
try {
LocalDate date = LocalDate.parse(dateStr, DATE_FORMATTER);
LocalDateTime dateTime = date.atStartOfDay();
Almanac almanac = almanacService.getAlmanac(dateTime);
log.info("黄历查询成功:{}", almanac);
AlmanacResponse response = AlmanacResponse.fromAlmanac(almanac, calendarService);
log.info("黄历响应生成成功");
return ServerResponse.ok()
.contentType(APPLICATION_JSON)
.bodyValue(Result.success(response));
} catch (DateTimeParseException e) {
log.error("日期格式错误:{}", dateStr, e);
throw new AlmanacException("INVALID_DATE_FORMAT", "日期格式错误,请使用 yyyy-MM-dd 格式", e);
} catch (IllegalArgumentException e) {
log.error("参数错误:{}", e.getMessage(), e);
throw new AlmanacException("INVALID_PARAMETER", e.getMessage(), e);
} catch (Exception e) {
log.error("查询黄历信息失败", e);
throw new AlmanacException("QUERY_FAILED", "查询黄历信息失败:" + e.getMessage(), e);
}
}
@Operation(summary = "查询日期范围内的黄历信息", description = "根据日期范围查询黄历信息列表,按日期升序排列")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "查询成功", content = @Content(schema = @Schema(implementation = Result.class))),
@ApiResponse(responseCode = "400", description = "请求参数错误"),
@ApiResponse(responseCode = "500", description = "服务器内部错误")
})
public Mono<ServerResponse> getAlmanacsByRange(
@Parameter(description = "服务器请求对象", hidden = true) ServerRequest request) {
String startDateStr = request.queryParam("startDate")
.orElseThrow(() -> new AlmanacException("MISSING_PARAMETER", "缺少必需参数:startDate"));
String endDateStr = request.queryParam("endDate")
.orElseThrow(() -> new AlmanacException("MISSING_PARAMETER", "缺少必需参数:endDate"));
log.info("接收到黄历范围查询请求:startDate={}, endDate={}", startDateStr, endDateStr);
try {
LocalDate startDate = LocalDate.parse(startDateStr, DATE_FORMATTER);
LocalDate endDate = LocalDate.parse(endDateStr, DATE_FORMATTER);
if (startDate.isAfter(endDate)) {
log.error("开始日期不能晚于结束日期:startDate={}, endDate={}", startDateStr, endDateStr);
throw new IllegalArgumentException("开始日期不能晚于结束日期");
}
LocalDateTime startDateTime = startDate.atStartOfDay();
LocalDateTime endDateTime = endDate.atTime(23, 59, 59);
List<Almanac> almanacs = almanacService.getAlmanacs(startDateTime, endDateTime);
log.info("黄历范围查询成功,共查询到{}条记录", almanacs.size());
List<AlmanacResponse> responses = almanacs.stream()
.map(almanac -> AlmanacResponse.fromAlmanac(almanac, calendarService))
.collect(Collectors.toList());
log.info("黄历响应生成成功,共{}条记录", responses.size());
return ServerResponse.ok()
.contentType(APPLICATION_JSON)
.bodyValue(Result.success(responses));
} catch (DateTimeParseException e) {
log.error("日期格式错误:startDate={}, endDate={}", startDateStr, endDateStr, e);
throw new AlmanacException("INVALID_DATE_FORMAT", "日期格式错误,请使用 yyyy-MM-dd 格式", e);
} catch (IllegalArgumentException e) {
log.error("参数错误:{}", e.getMessage(), e);
throw new AlmanacException("INVALID_PARAMETER", e.getMessage(), e);
} catch (Exception e) {
log.error("查询黄历信息列表失败", e);
throw new AlmanacException("QUERY_FAILED", "查询黄历信息列表失败:" + e.getMessage(), e);
}
}
}

Some files were not shown because too many files have changed in this diff Show More