17 Commits

Author SHA1 Message Date
bamanker
06cfebccab 增加探针配置
All checks were successful
Build Push and Deploy Image / build (push) Successful in 22m32s
2026-01-08 13:59:30 +08:00
bamanker
54202d8fd7 Merge remote-tracking branch 'origin/version3-native-localBuild' into version3-native-localBuild 2026-01-08 13:32:16 +08:00
bamanker
21b8d2e6e6 修改原生镜像构建参数 2026-01-08 13:32:04 +08:00
b7b3d44992 更新 README.md 2026-01-08 13:05:09 +08:00
bamanker
1cb7828acf 修改计算日期差的api,增加了结婚纪念日
Some checks failed
Build Push and Deploy Image / build (push) Failing after 33m43s
2026-01-08 13:02:46 +08:00
xue-bamanker
2929e0d1c0 修复jackson序列化/反序列化时出现Cannot construct instance of...的问题
All checks were successful
Build Push and Deploy Image / build (push) Successful in 37m1s
2026-01-07 23:57:12 +08:00
bamanker
02f9c7afdf 修改了公众号推送模板
All checks were successful
Build Push and Deploy Image / build (push) Successful in 19m51s
2026-01-07 12:58:59 +08:00
bamanker
89ebf65b7d 修复了json获取格式错误的问题 2026-01-07 12:39:05 +08:00
bamanker
693939af54 修改deployment文件存活探针的端口 2026-01-06 09:38:32 +08:00
2b9ec9e2be 修复deployment中的nodeport无效问题
All checks were successful
Build Push and Deploy Image / build (push) Successful in 20m39s
2026-01-06 00:27:07 +08:00
bamanker
3352d7efc1 修改deployment文件中namespace属性
Some checks failed
Build Push and Deploy Image / build (push) Failing after 21m34s
2026-01-05 23:40:42 +08:00
bamanker
1118fa6b26 用jackson替换fastjson 2026-01-05 22:58:10 +08:00
bamanker
291e46921d 用jackson替换fastjson
Some checks failed
Build Push and Deploy Image / build (push) Failing after 23m5s
2026-01-05 22:49:53 +08:00
bamanker
740bc07a2b 用jackson替换fastjson 2026-01-05 22:36:44 +08:00
cf29b08d02 更新 deployment-temp.yml
Some checks failed
Build Push and Deploy Image / build (push) Failing after 12m22s
2026-01-05 18:54:34 +08:00
bamanker
8e2281060c 更改构建命令,适应gitea
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2026-01-05 18:08:25 +08:00
bamanker
e2d44f9e89 升级springboot为4.0.1 2026-01-05 17:51:38 +08:00
17 changed files with 677 additions and 263 deletions

170
.gitea/workflows/build.yml Normal file
View File

@@ -0,0 +1,170 @@
name: Build Push and Deploy Image
on:
push:
#tag 触发
tags:
- 'v*'
# 分支触发
# branches:
# - main
workflow_dispatch: #手动构建h
#设置全局环境变量
env:
PATH: /opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
IMAGE_NAMESPACE: bamanker # todo 可以通过读取pom文件获取下面这些属性值
IMAGE_NAME: dailylove
APP_NAME: daily-love
# 构建 Job
jobs:
build:
runs-on: ubuntu-node22 # 如果host构建:linux_amd64
# container:
# image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/catthehacker/ubuntu:act-latest
steps:
- name: Print system info 1
run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
- name: Print system info 2
run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- name: Print system info 3
run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Print env
run: env && blkid
- name: Install dependencies
run: |
apt-get update &&
apt-get install -y gettext &&
apt-get install -y maven &&
apt-get install -y sudo &&
apt-get install -y iptables
- name: Set up Docker
uses: http://139.9.216.111:3000/bamanker/setup-docker-action@v4.6.0
with:
# 版本大于28会有兼容性问题
version: type=archive,channel=stable,version=v27.4.0
daemon-config: |
{
"registry-mirrors":["https://docker.1ms.run"],
"dns": ["8.8.8.8", "114.114.114.114"]
}
- name: Generate maven config
uses: http://139.9.216.111:3000/bamanker/maven-settings-action@v3.1.0
with:
mirrors: '[{"id": "alimaven", "name": "aliyun maven", "mirrorOf": "central", "url": "http://maven.aliyun.com/nexus/content/groups/public/"}]'
# - uses: http://localhost:3000/bamanker/setup-node@v6
# with:
# node-version: 24
# cache: 'npm'
# - run: node -v
# 下载仓库源码依赖node环境因此构建服务器本地需要下载安装node并设置环境变量
- name: Checkout repository code
#使用自定义仓库action
uses: http://139.9.216.111:3000/bamanker/checkout@v4
# 获取 TAG 并设置为环境变量
- name: Get version
id: get_version
# e.g. refs/tags/v1.0.0
run: |
echo "APP_TAG=${GITHUB_REF/refs\/tags\/v}" >> $GITHUB_ENV
# 检查 TAG 并传参
- name: Set envVar
id: set_envar
run: |
echo "The app version is $APP_TAG" && echo "tag=$APP_TAG" >> $GITHUB_OUTPUT &&
echo "now workspace: ${{ github.workspace }}"
# 为其他配置文件注入环境变量
- name: Inject envVar
run: |
envsubst < ./deployment-temp.yml > ./deployment.yml &&
cat ./deployment.yml
# 安装java环境
- name: Set up Java
uses: http://139.9.216.111:3000/bamanker/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '25.0.1'
cache: 'maven'
# maven 构建
- name: Build with Maven
run: mvn clean native:compile -DskipTests -Pnative
# 登录镜像仓库,方便后续上传镜像
- name: Login to Docker Registry
uses: http://139.9.216.111:3000/bamanker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# # 获取时间戳
# - name: Get datetime
# id: datetime
# run: |
# echo "datetime=$(date '+%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT
# 构建并上传镜像
- name: Build and push Docker image
# uses: http://139.9.216.111:3000/bamanker/build-push-action@v4
# 获取上一步截取到的版本号,既 1.0.0
#只能这样接收
env:
TAG: ${{ steps.set_envar.outputs.tag }}
run: |
ls &&
docker build --file Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} . &&
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
# uses: http://139.9.216.111:3000/bamanker/docker-build-push@v5
# with:
# context: .
## platforms: linux/amd64
# file: Dockerfile
# push: true
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
#发布到 k8s
#安装 kubectl
- name: Setup kubectl
run: |
curl -LO "https://dl.k8s.io/release/v1.33.0/bin/linux/amd64/kubectl" &&
chmod +x kubectl &&
mv kubectl /usr/local/bin/
- name: Configure kubeconfig
# 假设您的 KUBE_CONFIG 秘密是 Base64 编码的 kubeconfig 文件内容
run: |
# 1. 创建 ~/.kube 目录
mkdir -p $HOME/.kube
# 2. 将 Base64 编码的 KUBE_CONFIG 秘密解码并写入默认配置文件
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > $HOME/.kube/config
# 3. 确保 kubectl 知道配置文件的位置 (可选, 但安全)
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
- name: Deploy with kubectl
run: |
kubectl apply -f ./deployment.yml
- name: k8s Check Pods Health
run: |
kubectl get pod -n default -l app=${{ env.APP_NAME }}
- name: k8s Update Deployment
run: |
kubectl rollout restart deployment ${{ env.APP_NAME }}

33
.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
HELP.md
target/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

11
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,11 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 已忽略包含查询文件的默认文件夹
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
/.idea/

View File

@@ -1,6 +1,5 @@
FROM ubuntu:jammy-20231004
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/ubuntu:jammy
MAINTAINER bamanker
COPY target/dailylove /home/dailylove/app
COPY target/dailylove /root/dailylove/
EXPOSE 13145
WORKDIR /home/dailylove/out
ENTRYPOINT /home/dailylove/app -XX:StartFlightRecording='filename=recording.jfr,dumponexit=true,duration=10s'
CMD /root/dailylove/dailylove -XX:StartFlightRecording='filename=recording.jfr,dumponexit=true,duration=10s'

View File

@@ -1,37 +1,27 @@
# dailyLove
#### 介绍
公众号每日问候推送
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
# dailyLove
#### 介绍
公众号每日问候推送
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request

View File

@@ -1,79 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: $APP_NAME
version: $TAG
name: $APP_NAME
namespace: dl-proj #一定要写名称空间
spec:
progressDeadlineSeconds: 600
replicas: 1
selector:
matchLabels:
app: $APP_NAME
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
app: $APP_NAME
version: $TAG
spec:
imagePullSecrets:
- name: aliyun-docker-hub #提前在项目下配置访问阿里云的账号密码
containers:
- image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG
readinessProbe:
httpGet:
path: /test
port: 13145
timeoutSeconds: 10
failureThreshold: 30
periodSeconds: 5
imagePullPolicy: Always
name: app
ports:
- containerPort: 13145
protocol: TCP
resources:
limits:
cpu: 99m
memory: 65Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
env:
- name: TZ
value: "Asia/Shanghai"
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
labels:
app: $APP_NAME
name: $APP_NAME
namespace: dl-proj
spec:
ports:
- name: http
port: 13145
protocol: TCP
targetPort: 13145
selector:
app: $APP_NAME
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: $APP_NAME # ServiceAccount的名字
namespace: dl-proj # serviceaccount的namespace
labels:
app: $APP_NAME #ServiceAccount的标签

101
deployment-temp.yml Normal file
View File

@@ -0,0 +1,101 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: $APP_NAME # 标签 用于选择器
version: $APP_TAG
name: $APP_NAME # Deployment名称
namespace: default # 一定要写名称空间
spec:
progressDeadlineSeconds: 600
replicas: 1 # 副本数 1个 pod
revisionHistoryLimit: 2
selector:
matchLabels:
app: $APP_NAME # 选择器 匹配 pod 标签
strategy:
rollingUpdate:
maxSurge: 50%
maxUnavailable: 50%
type: RollingUpdate
template:
metadata:
labels:
app: $APP_NAME # pod 标签
version: $APP_TAG
spec:
imagePullSecrets:
- name: dockerhub-id #提前在项目下配置访问私有镜像仓库的账号密码
containers:
- name: $APP_NAME # 容器名称
image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG # 镜像地址
imagePullPolicy: Always
# 存活探针配置
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
httpGet:
path: /actuator/health/liveness # 探针路径
port: 13145 # 探针端口
scheme: HTTP # 协议
initialDelaySeconds: 20 # 容器启动后延迟 xx秒开始检查
periodSeconds: 10 # 每隔 15秒检查一次
timeoutSeconds: 5 # 10秒未返回结果则超时
# successThreshold: 1 # 成功 1 次就认定为健康
failureThreshold: 3 # 探测失败后的重试次数,当达到这个次数后就判定结果为失败,重启容器
#就绪探针配置
readinessProbe:
httpGet:
path: /actuator/health/readiness # 探针路径
port: 13145 # 探针端口
scheme: HTTP # 协议
initialDelaySeconds: 10 # 容器启动后等 30 秒再开始检查
periodSeconds: 5 # 每 5 秒检查一次,比存活探针频繁
timeoutSeconds: 5 # 超时时间 3 秒
# successThreshold: 1 # 成功 1 次就认为就绪
failureThreshold: 2 # 失败 3 次才认为未就绪,会从负载均衡摘掉
# 启动探针配置(可选,启动慢的应用必须配)
# startupProbe:
# httpGet:
# path: /actuator/health/liveness # 用存活探针的路径
# port: 13145
# scheme: HTTP
# initialDelaySeconds: 0 # 立即开始检查
# periodSeconds: 5 # 每 5 秒检查一次
# timeoutSeconds: 3 # 超时时间 3 秒
# successThreshold: 1 # 成功 1 次就认为启动完成
# failureThreshold: 30 # 失败 30 次150 秒)才认为启动失败
# 生命周期钩子,优雅关闭
lifecycle:
preStop:
sleep:
seconds: 10 #容器停止前先等 10 秒,让流量切走
ports:
- containerPort: 13145 # 应用端口
protocol: TCP
# 资源限制
resources:
limits:
cpu: 99m # 最多 0.1核 CPU
memory: 65Mi # 最多 65m 内存
# 环境变量配置
env:
- name: TZ
value: "Asia/Shanghai"
---
apiVersion: v1
kind: Service
metadata:
labels:
app: $APP_NAME
name: $APP_NAME
namespace: default
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: http
protocol: TCP
port: 13145
nodePort: 30045
selector:
app: $APP_NAME

139
pom.xml
View File

@@ -5,25 +5,38 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<version>4.0.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<groupId>com.bamanker</groupId>
<artifactId>dailylove</artifactId>
<version>v2.3-local</version>
<name>dailyLove</name>
<version>v2.4.0-native</version>
<name>dailylove</name>
<description>dailylove-forK8S</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<fastjson.version>2.0.25</fastjson.version>
<openfeign.version>4.0.4</openfeign.version>
<hutool.version>5.8.18</hutool.version>
<java.version>25</java.version>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<!-- <fastjson.version>2.0.60</fastjson.version>-->
<openfeign.version>5.0.0</openfeign.version>
<hutool.version>5.8.25</hutool.version>
<docker.private.repository>registry.cn-chengdu.aliyuncs.com/bamanker</docker.private.repository>
<!-- <docker.private.repository>172.17.0.1:10888/my_work</docker.private.repository>-->
<!-- <docker.private.repository>172.17.0.1:10888/my_work</docker.private.repository>-->
</properties>
<dependencies>
<dependency>
@@ -31,20 +44,32 @@
<artifactId>hutool-core</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>${openfeign.version}</version>
</dependency>
<!-- 如果需要显式指定 Jackson 3 -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.alibaba.fastjson2</groupId>-->
<!-- <artifactId>fastjson2</artifactId>-->
<!-- <version>${fastjson.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -62,28 +87,44 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<!-- Spring Boot Actuator提供健康检查端点 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<finalName>dailylove</finalName>
<!--指定filtering=true.maven的占位符解析表达式就可以用于它里面的文件-->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.27</version>
<!--为本机映像程序添加配置,生成的配置文件位于
META-INF/native-image/groupID/artifactID/native-image.properties
也可以手动配置-->
<configuration>
<mainClass>com.bamanker.dailylove.DailyLoveApplication</mainClass>
<buildArgs>
<!--开启dashboard-->
<!-- <arg>-H:DashboardDump=dailylove -H:+DashboardAll</arg>-->
<arg->-H:+ReportExceptionStackTraces</arg->
<!--开启JFR-->
<arg>--enable-monitoring=jfr</arg>
<arg>--gc=G1</arg>
<!-- <arg>&#45;&#45;pgo</arg>-->
<arg>-Ob</arg>
<!-- <arg>-march=native</arg>-->
<arg>-H:+BuildReport</arg>
<!-- <arg>-H:DashboardDump=dailylove -H:+DashboardAll</arg>-->
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
<!--生成诊断报告-->
<buildArg>-H:+PrintAnalysisCallTree</buildArg>
<!--开启监控代理-->
<buildArg>--enable-monitoring=jfr,heapdump,jvmstat</buildArg>
<!-- <arg>&#45;&#45;pgo</arg>-->
<!---Ob: 快速构建模式,编译快但性能差点,适合开发调试-->
<buildArg>-Ob</buildArg>
<!-- <buildArg>&#45;&#45;gc=G1</buildArg>-->
<!-- <arg>-march=native</arg>-->
<!-- <arg>-H:+BuildReport</arg>-->
</buildArgs>
<!--启动详细输出-->
<verbose>true</verbose>
@@ -97,34 +138,40 @@
</options>
</agent>-->
</configuration>
</plugin>
<plugin>
<!--支持yaml读取pom的参数-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>25</release>
<annotationProcessors>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor
</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.xenoamess.docker</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>default</id>
<phase>package</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- <username>bamanker</username>-->
<!-- <password>Fz8803101</password>-->
<repository>${docker.private.repository}/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<NATIVE_FILE>${project.artifactId}</NATIVE_FILE>
</buildArgs>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>

View File

@@ -44,6 +44,7 @@ public class ClassReflectConfig {
begin = false;
executorService.submit(() -> {
// {
// // 先抓取上一次的文件,生成
// try {

View File

@@ -4,6 +4,12 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/**
* @descriptions
* @author bamanker
* @date 2026/1/8 12:12
* @return
*/
@Component
public class DailyLoveConfigure {
// public static String Access_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";
@@ -26,6 +32,7 @@ public class DailyLoveConfigure {
public static String Color_bbir;
public static String Color_cbir;
public static String Color_loveDay;
public static String Color_weddingDay;
public static String Color_remark;
@Value("${wechat.color.tomorrow:null}")
@@ -113,6 +120,11 @@ public class DailyLoveConfigure {
Color_loveDay = color_loveDay;
}
@Value("${wechat.color.weddingDay:null}")
public void setColor_weddingDay(String color_weddingDay) {
Color_loveDay = color_weddingDay;
}
@Value("${wechat.color.remark:null}")
public void setColor_remark(String color_remark) {
Color_remark = color_remark;
@@ -182,28 +194,35 @@ public class DailyLoveConfigure {
public static String Boy_Birthday;
@Value("${DL.boy-birthday}")
public void setBoyBirthday(String BoyBirthday) {
Boy_Birthday = BoyBirthday;
public void setBoyBirthday(String boyBirthday) {
Boy_Birthday = boyBirthday;
}
public static String Girl_Birthday;
@Value("${DL.girl-birthday}")
public void setGirlBirthday(String GirlBirthday) {
Girl_Birthday = GirlBirthday;
public void setGirlBirthday(String girlBirthday) {
Girl_Birthday = girlBirthday;
}
public static String Cat_Birthday;
@Value("${DL.cat-birthday}")
public void setCatBirthday(String CatBirthday) {
Cat_Birthday = CatBirthday;
public void setCatBirthday(String catBirthday) {
Cat_Birthday = catBirthday;
}
public static String Love_Day;
@Value("${DL.love-day}")
public void setLoveDay(String LoveDay) {
Love_Day = LoveDay;
public void setLoveDay(String loveDay) {
Love_Day = loveDay;
}
public static String Wedding_Day;
@Value("${DL.wedding-day}")
public void setWeddingDay(String weddingDay) {
Wedding_Day = weddingDay;
}
}

View File

@@ -2,34 +2,45 @@ package com.bamanker.dailylove.controller;
import cn.hutool.core.date.ChineseDate;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONObject;
import com.bamanker.dailylove.config.DailyLoveConfigure;
import com.bamanker.dailylove.domain.*;
import com.bamanker.dailylove.service.DataRemoteClient;
import com.bamanker.dailylove.service.WechatRequestClient;
import com.bamanker.dailylove.utils.DataUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author bamanker
* @descriptions
* @date 2026/1/8 12:04
* @return
*/
@Slf4j
@RestController
public class PushDailyController {
final
ObjectMapper mapper;
final
DataRemoteClient dataRemoteClient;
final
WechatRequestClient wechatRequestClient;
public PushDailyController(DataRemoteClient dataRemoteClient, WechatRequestClient wechatRequestClient) {
public PushDailyController(DataRemoteClient dataRemoteClient, WechatRequestClient wechatRequestClient, ObjectMapper mapper) {
this.dataRemoteClient = dataRemoteClient;
this.wechatRequestClient = wechatRequestClient;
this.mapper = mapper;
}
/**
@@ -38,6 +49,7 @@ public class PushDailyController {
* @return
*/
@GetMapping("/pushNight")
@RegisterReflectionForBinding(Weather.class)
public String pushNight() {
ResultVo resultVo = ResultVo.initializeResultVo(DailyLoveConfigure.Open_ID,
@@ -49,9 +61,9 @@ public class PushDailyController {
param1.setCity(DailyLoveConfigure.City_ID);
param1.setType("7");
String weatherResp = dataRemoteClient.getWeather(param1);
JSONObject weatherJson = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(1);
String city = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).getString("area");
Weather weather = weatherJson.toJavaObject(Weather.class);
JsonNode weatherJson = mapper.readTree(weatherResp).get("result").get("list").get(1);
String city = mapper.readTree(weatherResp).get("result").get("area").asString();
Weather weather = mapper.treeToValue(weatherJson, Weather.class);
resultVo.setAttribute("tomorrow", new DataItem(weather.getDate() + " " + weather.getWeek(), DailyLoveConfigure.Color_tomorrow));
resultVo.setAttribute("city", new DataItem(city, DailyLoveConfigure.Color_city));
@@ -65,15 +77,15 @@ public class PushDailyController {
param2.setKey(DailyLoveConfigure.TianXin_Key);
String tipsResp = dataRemoteClient.getTips(param2);
String tips = JSONObject.parseObject(tipsResp).getJSONArray("result").getJSONObject(0).getString("content");
String tips = mapper.readTree(tipsResp).get("result").get("content").asString();
resultVo.setAttribute("tips", new DataItem(tips, DailyLoveConfigure.Color_tips));
String nightResp = dataRemoteClient.getNight(param2);
String night = JSONObject.parseObject(nightResp).getJSONArray("result").getJSONObject(0).getString("content");
String night = mapper.readTree(nightResp).get("result").get("content").asString();
resultVo.setAttribute("night", new DataItem(night, DailyLoveConfigure.Color_night));
String rainbowResp = dataRemoteClient.getRainbow(param2);
String rainbow = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
String rainbow = mapper.readTree(rainbowResp).get("result").get("content").asString();
resultVo.setAttribute("rainbow", new DataItem(rainbow, DailyLoveConfigure.Color_dailyCn));
// String englishResp = dataRemoteClient.getDailyEnglish(param2);
@@ -89,47 +101,53 @@ public class PushDailyController {
int girlBirthdays = DataUtils.getBirthdays(DailyLoveConfigure.Girl_Birthday);
log.debug("gbir_day:{}", girlBirthdays);
log.info("gbir_days:{}", girlBirthdays);
resultVo.setAttribute("gbir_day", new DataItem(girlBirthdays - 1 + "", DailyLoveConfigure.Color_gbir));
int boyBirthdays = DataUtils.getChineseBirthdays(DailyLoveConfigure.Boy_Birthday);
log.debug("bbir_day:{}", boyBirthdays);
log.info("bbir_days:{}", boyBirthdays);
resultVo.setAttribute("bbir_day", new DataItem(boyBirthdays - 1 + "", DailyLoveConfigure.Color_bbir));
int catBirthdays = DataUtils.getBirthdays(DailyLoveConfigure.Cat_Birthday);
log.debug("cbir_day:{}", catBirthdays);
log.info("cbir_days:{}", catBirthdays);
resultVo.setAttribute("cbir_day", new DataItem(catBirthdays - 1 + "", DailyLoveConfigure.Color_cbir));
String words = "普通的一天";
if (DataUtils.getBirthdays(DailyLoveConfigure.Love_Day) == 1) {
words = "明天是恋爱周年纪念日!永远爱你~mua";
} else if ((DataUtils.getLoveDays(DailyLoveConfigure.Love_Day)) % 100 == 99) {
} else if ((DataUtils.getDayDiff(DailyLoveConfigure.Love_Day)) % 100 == 99) {
words = "明天是恋爱百日纪念日!提前庆祝哦~";
} else if (DataUtils.getBirthdays(DailyLoveConfigure.Wedding_Day) == 1) {
words = "明天是结婚周年纪念日!提前庆祝哦~";
} else if (girlBirthdays == 1) {
words = "明天是lili大宝贝的生日啦";
} else if (boyBirthdays == 1) {
words = "明天是ss的生日!别忘了哦~";
words = "明天是菘菘的生日!别忘了哦~";
} else if (catBirthdays == 1) {
words = "明天是小离谱的生日!别忘了小鱼干!";
}
resultVo.setAttribute("words", new DataItem(words, DailyLoveConfigure.Color_remark));
int loveDays = DataUtils.getLoveDays(DailyLoveConfigure.Love_Day);
log.debug("love_day:{}", loveDays);
int loveDays = DataUtils.getDayDiff(DailyLoveConfigure.Love_Day);
log.info("love_days:{}", loveDays);
resultVo.setAttribute("love_day", new DataItem(loveDays + 1 + "", DailyLoveConfigure.Color_loveDay));
log.debug("resultVo:{}", resultVo);
int weddingDays = DataUtils.getDayDiff(DailyLoveConfigure.Wedding_Day);
log.info("wedding_days:{}", weddingDays);
resultVo.setAttribute("wedding_day", new DataItem(weddingDays + 1 + "", DailyLoveConfigure.Color_weddingDay));
log.info("resultVo:{}", resultVo);
WechatTokenParam wechatTokenParam = new WechatTokenParam();
wechatTokenParam.setAppid(DailyLoveConfigure.App_ID);
wechatTokenParam.setSecret(DailyLoveConfigure.App_Secret);
String accessTokenResp = wechatRequestClient.getAccessToken(wechatTokenParam);
log.debug("accessTokenJson:{}", accessTokenResp);
String token = JSONObject.parseObject(accessTokenResp).getString("access_token");
String responseStr = wechatRequestClient.sendMsg(resultVo, token);
return responseStr;
log.info("accessTokenJson:{}", accessTokenResp);
String token = mapper.readTree(accessTokenResp).get("access_token").asString();
// String token1 = JSONObject.parseObject(accessTokenResp).getString("access_token");
return wechatRequestClient.sendMsg(resultVo, token);
}
@@ -137,6 +155,7 @@ public class PushDailyController {
* 推送早安
*/
@GetMapping("/pushMorning")
@RegisterReflectionForBinding(Weather.class)
public String pushMorning() {
TianXinReqParam param1 = new TianXinReqParam();
@@ -144,9 +163,10 @@ public class PushDailyController {
param1.setCity(DailyLoveConfigure.City_ID);
param1.setType("1");
String weatherResp = dataRemoteClient.getWeather(param1);
JsonNode weatherJson = mapper.readTree(weatherResp).get("result");
Weather weather = mapper.treeToValue(weatherJson, Weather.class);
Weather weather = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).toJavaObject(Weather.class);
// Weather weather1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).toJavaObject(Weather.class);
ResultVo resultVo = ResultVo.initializeResultVo(DailyLoveConfigure.Open_ID,
DailyLoveConfigure.Template_ID_Morning,
@@ -168,11 +188,13 @@ public class PushDailyController {
// resultVo.setAttribute("tips", new DataItem(tips, DailyLoveConfigure.Color_tips));
String morningResp = dataRemoteClient.getMorning(param2);
String morning = JSONObject.parseObject(morningResp).getJSONArray("result").getJSONObject(0).getString("content");
String morning = mapper.readTree(morningResp).get("result").get("content").asString();
// String morning1 = JSONObject.parseObject(morningResp).getJSONArray("result").getJSONObject(0).getString("content");
resultVo.setAttribute("morning", new DataItem(morning, DailyLoveConfigure.Color_morning));
String rainbowResp = dataRemoteClient.getRainbow(param2);
String rainbow = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
String rainbow = mapper.readTree(rainbowResp).get("result").get("content").asString();
// String rainbow1 = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
resultVo.setAttribute("rainbow", new DataItem(rainbow, DailyLoveConfigure.Color_dailyCn));
// String englishResp = dataRemoteClient.getDailyEnglish(param2);
@@ -190,37 +212,43 @@ public class PushDailyController {
int girlBirthdays = DataUtils.getBirthdays(DailyLoveConfigure.Girl_Birthday);
log.debug("gbir_day:{}", girlBirthdays);
log.info("gbir_days:{}", girlBirthdays);
resultVo.setAttribute("gbir_day", new DataItem(girlBirthdays + "", DailyLoveConfigure.Color_gbir));
int boyBirthdays = DataUtils.getChineseBirthdays(DailyLoveConfigure.Boy_Birthday);
log.debug("bbir_day:{}", boyBirthdays);
log.info("bbir_days:{}", boyBirthdays);
resultVo.setAttribute("bbir_day", new DataItem(boyBirthdays + "", DailyLoveConfigure.Color_bbir));
int catBirthdays = DataUtils.getBirthdays(DailyLoveConfigure.Cat_Birthday);
log.debug("cbir_day:{}", catBirthdays);
log.info("cbir_days:{}", catBirthdays);
resultVo.setAttribute("cbir_day", new DataItem(catBirthdays + "", DailyLoveConfigure.Color_cbir));
String words = "普通的一天";
if (DataUtils.getBirthdays(DailyLoveConfigure.Love_Day) == 0) {
words = "今天是恋爱周年纪念日!永远爱你~mua";
} else if ((DataUtils.getLoveDays(DailyLoveConfigure.Love_Day)) % 100 == 0) {
} else if ((DataUtils.getDayDiff(DailyLoveConfigure.Love_Day)) % 100 == 0) {
words = "今天是恋爱百日纪念日!永远爱你~";
} else if (DataUtils.getBirthdays(DailyLoveConfigure.Wedding_Day) == 0) {
words = "今天是结婚周年纪念日!永远爱你~";
} else if (girlBirthdays == 0) {
words = "今天是lili宝贝的生日生日快乐哟~";
} else if (boyBirthdays == 0) {
words = "今天是ss的生日!别忘了好好爱他~";
words = "今天是菘菘的生日!别忘了好好爱他~";
} else if (catBirthdays == 0) {
words = "今天是小离谱的生日!别忘了小鱼干!";
}
resultVo.setAttribute("words", new DataItem(words, DailyLoveConfigure.Color_remark));
int loveDays = DataUtils.getLoveDays(DailyLoveConfigure.Love_Day);
log.debug("love_day:{}", loveDays);
int loveDays = DataUtils.getDayDiff(DailyLoveConfigure.Love_Day);
log.info("love_days:{}", loveDays);
resultVo.setAttribute("love_day", new DataItem(loveDays + "", DailyLoveConfigure.Color_loveDay));
int weddingDays = DataUtils.getDayDiff(DailyLoveConfigure.Wedding_Day);
log.info("wedding_days:{}", weddingDays);
resultVo.setAttribute("wedding_day", new DataItem(weddingDays + "", DailyLoveConfigure.Color_weddingDay));
log.debug("resultVo:{}", resultVo);
WechatTokenParam wechatTokenParam = new WechatTokenParam();
wechatTokenParam.setAppid(DailyLoveConfigure.App_ID);
@@ -228,9 +256,9 @@ public class PushDailyController {
String accessTokenResp = wechatRequestClient.getAccessToken(wechatTokenParam);
log.debug("accessTokenJson:{}", accessTokenResp);
String token = JSONObject.parseObject(accessTokenResp).getString("access_token");
String responseStr = wechatRequestClient.sendMsg(resultVo, token);
return responseStr;
String token = mapper.readTree(accessTokenResp).get("access_token").asString();
// String token1 = JSONObject.parseObject(accessTokenResp).getString("access_token");
return wechatRequestClient.sendMsg(resultVo, token);
}
@@ -240,9 +268,12 @@ public class PushDailyController {
* @param responseStr
*/
private void printPushLog(String responseStr) {
JSONObject jsonObject = JSONObject.parseObject(responseStr);
String msgCode = jsonObject.getString("errcode");
String msgContent = jsonObject.getString("errmsg");
JsonNode jsonNode = mapper.readTree(responseStr);
String msgCode = jsonNode.get("errcode").asString();
String msgContent = jsonNode.get("errmsg").asString();
// JSONObject jsonObject = JSONObject.parseObject(responseStr);
// String msgCode1 = jsonObject.getString("errcode");
// String msgContent1 = jsonObject.getString("errmsg");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("[ " + dateFormat.format(new Date()) + " ] : messageCode=" + msgCode + ",messageContent=" + msgContent);
}

View File

@@ -10,9 +10,18 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
public class TestController {
/**
* 处理GET请求的测试方法。
*
* @return 返回一个字符串,内容为"test ok!!!!!!!!",用于验证功能的正常运行。
*/
@GetMapping("/test")
public String test(){
return "test ok!!!!!!!!";
}
}

View File

@@ -4,6 +4,9 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author bamanker
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@@ -11,4 +14,8 @@ public class DataItem {
private String value;
private String color;
}

View File

@@ -9,6 +9,9 @@ import org.bouncycastle.util.Strings;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.util.Calendar;
import java.util.Date;
@@ -35,7 +38,7 @@ public class DataUtils {
Calendar dateToday = Calendar.getInstance();
int todayYear = dateToday.get(Calendar.YEAR);
//把生日的年改为今年,方便计算
ChineseDate chineseDate = new ChineseDate(todayYear, chineseMonth, chineseDay,false);
ChineseDate chineseDate = new ChineseDate(todayYear, chineseMonth, chineseDay, false);
//农历日期对应的阳历日期
int gregorianDay = chineseDate.getGregorianDay();
//计算时间差
@@ -121,22 +124,36 @@ public class DataUtils {
return days;
}
/**
* 计算恋爱天数 days
*
* @param loveday
* @return
*/
public static int getLoveDays(String loveday) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
int days = 0;
try {
long time = System.currentTimeMillis() - dateFormat.parse(loveday).getTime();
days = (int) (time / (24 * 60 * 60 * 1000));
// /**
// * 计算恋爱天数 days
// *
// * @param loveDay
// * @return
// */
// public static int getLoveDays(String loveDay) {
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// int days = 0;
// try {
// long time = System.currentTimeMillis() - dateFormat.parse(loveDay).getTime();
// days = (int) (time / (24 * 60 * 60 * 1000));
//
// } catch (ParseException e) {
// e.printStackTrace();
// }
// return days;
// }
} catch (ParseException e) {
e.printStackTrace();
}
return days;
/**
* @param startDay
* @return int
* @descriptions 计算日期茶 days
* @author bamanker
* @date 2026/1/8 12:38
*/
public static int getDayDiff(String startDay) {
LocalDate dateNow = LocalDate.now();
LocalDate dateStart = LocalDate.parse(startDay);
return (int) ChronoUnit.DAYS.between(dateStart, dateNow);
}
}

View File

@@ -15,15 +15,16 @@ DL:
boy-birthday: 1995-3-30
love-day: 2022-07-16
cat-birthday: 2022-10-23
wedding-day: 2025-10-08
wechat:
app-id: wxba68702957f8b93e
app-secret: 834078bb149409bfca4fe693ea7c4c1c
#ME: oo5bL6bK_4TC0tb-Wa5oiugTPVeQ
# ME: oo5bL6bK_4TC0tb-Wa5oiugTPVeQ
#LILI: oo5bL6QafHJa9zQNYKS0fIhFC0zM
open-id: oo5bL6QafHJa9zQNYKS0fIhFC0zM
template-id-morning: 1yx1fahCs923nOmMh0_KLWN0nXGKd8_pHQrfpdMblrQ
template-id-night: QG-5NBX-jip46ulGVsaE3Uhl30GUxvNmtKOxwMHFkx0
template-id-morning: dWNAL-ZOzpBhnByFoTamt9DlJQYLB5z3ldKLvQstyU4
template-id-night: oraLiXC-8740stYc1a7mpzUFHiAIRaM3JikqibZ2grE
color:
now: '#99CCCC'
@@ -39,6 +40,7 @@ wechat:
bbir: '#FF3399'
cbir: '#FF3399'
loveDay: '#FF3399'
weddingDay: '#FF3399'
remark: '#FF6666'
city: ""
tips: ""
@@ -54,4 +56,25 @@ logging:
level:
com.bamanker.dailylove.service: debug #指定openfeign日志以什么级别监控哪个接口可多个
scanclass: false
scanclass: false
# Actuator 配置
management:
# 端点配置
endpoints:
web:
exposure:
# 暴露健康端点,生产环境要慎重,别把敏感信息暴露了
include: health,info
# 健康端点配置
endpoint:
health:
# 显示详细的健康信息,方便调试
# 生产环境建议设为 when-authorized需要认证才能看详情
show-details: always
# 开启探针支持,这个必须设置
probes:
enabled: true
# 在主端口上也暴露探针路径
# 这样 K8s 探针可以直接访问应用端口,不用单独配置 management 端口
add-additional-paths: true

View File

@@ -1,25 +1,19 @@
package com.bamanker.dailylove;
import cn.hutool.core.date.ChineseDate;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONObject;
import com.bamanker.dailylove.config.DailyLoveConfigure;
import com.bamanker.dailylove.domain.DataItem;
import com.bamanker.dailylove.domain.TianXinReqParam;
import com.bamanker.dailylove.domain.Weather;
import com.bamanker.dailylove.service.DataRemoteClient;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.Strings;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import com.bamanker.dailylove.utils.DataUtils;
import jakarta.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import static com.bamanker.dailylove.utils.DataUtils.getBirthdays;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import com.bamanker.dailylove.domain.*;
@SpringBootTest
@Slf4j
@@ -28,6 +22,10 @@ class DailyLoveApplicationTests {
// @Resource
// DataRemoteClient dataRemoteClient;
//
// @Autowired
// ObjectMapper mapper;
//
// String remark = "❤";
//
// @Test
@@ -106,30 +104,67 @@ class DailyLoveApplicationTests {
//
// @Test
// void test2() {
// ResultVo resultVo = ResultVo.initializeResultVo(DailyLoveConfigure.Open_ID,
// DailyLoveConfigure.Template_ID_Night,
// DailyLoveConfigure.Color_Top);
//
// TianXinReqParam param1 = new TianXinReqParam();
// param1.setKey(DailyLoveConfigure.TianXin_Key);
// param1.setCity(DailyLoveConfigure.City_ID);
// param1.setType("7");
// String weatherJson = dataRemoteClient.getWeather(param1);
// log.info("weather:{}", weatherJson);
// JSONObject resWeather = JSONObject.parseObject(weatherJson);
// JSONObject result = resWeather.getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(2);
// String weatherResp = dataRemoteClient.getWeather(param1);
//// log.info("weather:{}", weatherResp);
// JsonNode weatherJson = mapper.readTree(weatherResp).get("result").get("list").get(1);
// System.out.println("-----------------------------");
// System.out.println(weatherJson);
// String city = mapper.readTree(weatherResp).get("result").get("area").asString();
// System.out.println("-----------------------------");
// System.out.println(city);
// Weather weather = mapper.treeToValue(weatherJson, Weather.class);
// System.out.println("-----------------------------");
// System.out.println(weather);
//
// resultVo.setAttribute("tomorrow", new DataItem(weather.getDate() + " " + weather.getWeek(), DailyLoveConfigure.Color_tomorrow));
// resultVo.setAttribute("city", new DataItem(city, DailyLoveConfigure.Color_city));
// resultVo.setAttribute("weather", new DataItem(weather.getWeather(), DailyLoveConfigure.Color_weather));
// resultVo.setAttribute("min_temperature", new DataItem(weather.getLowest(), DailyLoveConfigure.Color_minTem));
// resultVo.setAttribute("max_temperature", new DataItem(weather.getHighest(), DailyLoveConfigure.Color_maxTem));
// resultVo.setAttribute("quality", new DataItem(weather.getVis(), DailyLoveConfigure.Color_quality));
//
// System.out.println("-----------------------------");
// System.out.println(resultVo);
// TianXinReqParam param2 = new TianXinReqParam();
// param2.setKey(DailyLoveConfigure.TianXin_Key);
//
// String tipsResp = dataRemoteClient.getTips(param2);
// String tips = mapper.readTree(tipsResp).get("result").get("content").asString();
//
// System.out.println("-----------------------------");
// System.out.println(tips);
//
// TianXinReqParam param1 = new TianXinReqParam();
// param1.setKey(DailyLoveConfigure.TianXin_Key);
// param1.setCity(DailyLoveConfigure.City_ID);
// param1.setType("1");
// String weatherResp = dataRemoteClient.getWeather(param1);
// JsonNode weatherJson = mapper.readTree(weatherResp).get("result");
// Weather weather = mapper.treeToValue(weatherJson, Weather.class);
//
// System.out.println("-----------------------------");
// System.out.println(weather);
// log.info("----result----:{}", result);
// Weather weather = result.toJavaObject(Weather.class);
// log.info("weather:{}", weather);
// ChineseDate chineseDate = new ChineseDate(DateUtil.parseDate(weather.getDate()));
// System.out.println("--------------55555----------"+weather.getDate());
// System.out.println("------------------------"+chineseDate);
//
//
// }
//}
//
//
// @Test
// void test1() {
// int loveDays = getBirthdays("2023-05-14");
// log.info("-------------------------------{}", loveDays);
// int weddingDays = DataUtils.getWeddingDays("2025-10-08");
// log.info("wedding_days:{}", weddingDays);
// }
//
// public static int getLoveDays(String loveday) {

Binary file not shown.