Compare commits
2 Commits
version2-n
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12bbeaa39f | ||
|
|
f297aa823a |
@@ -1,3 +0,0 @@
|
|||||||
*
|
|
||||||
!target/dailylove*
|
|
||||||
!Dockerfile
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
FROM ubuntu:latest
|
|
||||||
MAINTAINER bamanker
|
|
||||||
ARG NATIVE_FILE
|
|
||||||
COPY target/${NATIVE_FILE} /home/dailylove/app
|
|
||||||
EXPOSE 13145
|
|
||||||
ENTRYPOINT ["/home/dailylove/app"]
|
|
||||||
12
LICENSE
Normal file
12
LICENSE
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Copyright (c) 2023 bamanker
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
# dailyLove
|
# dailyLove
|
||||||
|
|
||||||
#### 介绍
|
#### 介绍
|
||||||
公众号每日问候推送
|
|
||||||
|
|
||||||
#### 软件架构
|
#### 软件架构
|
||||||
软件架构说明
|
软件架构说明
|
||||||
|
|||||||
78
pom.xml
78
pom.xml
@@ -5,24 +5,22 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.1.5</version>
|
<version>2.4.3</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.bamanker</groupId>
|
<groupId>com.bamanker</groupId>
|
||||||
<artifactId>dailylove</artifactId>
|
<artifactId>dailyLove</artifactId>
|
||||||
<version>v2.1</version>
|
<version>0.1.3</version>
|
||||||
<name>dailyLove</name>
|
<name>dailyLove</name>
|
||||||
<description>dailylove</description>
|
<description>dailyLove</description>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>17</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<fastjson.version>2.0.21</fastjson.version>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<openfeign.version>3.1.5</openfeign.version>
|
||||||
<fastjson.version>2.0.25</fastjson.version>
|
<nacos.version>2021.1</nacos.version>
|
||||||
<openfeign.version>4.0.4</openfeign.version>
|
<hutool.version>5.8.10</hutool.version>
|
||||||
<hutool.version>5.8.18</hutool.version>
|
|
||||||
<docker.private.repository>172.17.0.1:10888/my_work</docker.private.repository>
|
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -30,6 +28,25 @@
|
|||||||
<artifactId>hutool-core</artifactId>
|
<artifactId>hutool-core</artifactId>
|
||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
<version>3.1.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
<version>${nacos.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
<version>${nacos.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
@@ -46,57 +63,26 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.graalvm.buildtools</groupId>
|
|
||||||
<artifactId>native-maven-plugin</artifactId>
|
|
||||||
<version>0.9.27</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</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>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
package com.bamanker.dailylove;
|
package com.bamanker.dailylove;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author bamanker
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableFeignClients
|
@EnableFeignClients
|
||||||
//开启定时任务
|
//开启定时任务
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
//@ImportAutoConfiguration({FeignAutoConfiguration.class})
|
|
||||||
public class DailyLoveApplication {
|
public class DailyLoveApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ public class PushDailyController {
|
|||||||
|
|
||||||
if (DataUtils.getBirthdays(DailyLoveConfigure.Love_Day) == 1) {
|
if (DataUtils.getBirthdays(DailyLoveConfigure.Love_Day) == 1) {
|
||||||
words = "明天是恋爱周年纪念日!永远爱你~mua";
|
words = "明天是恋爱周年纪念日!永远爱你~mua";
|
||||||
} else if ((DataUtils.getLoveDays(DailyLoveConfigure.Love_Day)) % 100 == 99) {
|
} else if ((DataUtils.getLoveDays(DailyLoveConfigure.Love_Day)) % 100 == 1) {
|
||||||
words = "明天是恋爱百日纪念日!提前庆祝哦~";
|
words = "明天是恋爱百日纪念日!提前庆祝哦~";
|
||||||
} else if (girlBirthdays == 1) {
|
} else if (girlBirthdays == 1) {
|
||||||
words = "明天是lili大宝贝的生日啦";
|
words = "明天是lili大宝贝的生日啦";
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.bamanker.dailylove.controller;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author bamanker
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@GetMapping("/test")
|
|
||||||
public String test(){
|
|
||||||
return "test ok!!!!!!!!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,24 @@ server:
|
|||||||
port: 13145
|
port: 13145
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: prob
|
||||||
application:
|
application:
|
||||||
name: dailyLove
|
name: dailyLove
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
config:
|
||||||
|
server-addr: ${url.nacos} # nacos地址配置中心
|
||||||
|
file-extension: yaml
|
||||||
|
group: Group1
|
||||||
|
|
||||||
|
discovery:
|
||||||
|
#持久化实例 ture为临时实例 false为持久化实例 临时实例发生异常直接剔除, 而持久化实例等待恢复
|
||||||
|
ephemeral: true
|
||||||
|
#注册中心地址
|
||||||
|
server-addr: ${url.nacos}
|
||||||
|
url:
|
||||||
|
nacos: 127.0.0.1:8848
|
||||||
|
|
||||||
DL:
|
DL:
|
||||||
tianxin-key: 72fbbb9e75e338ea6a240e83972f287c
|
tianxin-key: 72fbbb9e75e338ea6a240e83972f287c
|
||||||
@@ -13,140 +13,138 @@ import org.bouncycastle.util.Strings;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import static com.bamanker.dailylove.utils.DataUtils.getBirthdays;
|
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@Slf4j
|
@Slf4j
|
||||||
class DailyLoveApplicationTests {
|
class DailyLoveApplicationTests {
|
||||||
|
|
||||||
// @Resource
|
@Resource
|
||||||
// DataRemoteClient dataRemoteClient;
|
DataRemoteClient dataRemoteClient;
|
||||||
//
|
|
||||||
// String remark = "❤";
|
String remark = "❤";
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// void test4(){
|
void test4(){
|
||||||
// log.info("mark: {}",205%100);
|
log.info("mark: {}",205%100);
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
// @Test
|
@Test
|
||||||
// void test3() {
|
void test3() {
|
||||||
//
|
|
||||||
//
|
|
||||||
// //获取输入的生日
|
//获取输入的生日
|
||||||
// String boyBirthday = DailyLoveConfigure.Boy_Birthday;
|
String boyBirthday = DailyLoveConfigure.Boy_Birthday;
|
||||||
// //获取农历生日
|
//获取农历生日
|
||||||
// ChineseDate chineseBir = new ChineseDate(DateUtil.parseDate(DailyLoveConfigure.Boy_Birthday));
|
ChineseDate chineseBir = new ChineseDate(DateUtil.parseDate(DailyLoveConfigure.Boy_Birthday));
|
||||||
// log.info("生日的农历日期是:{}", chineseBir);
|
log.info("生日的农历日期是:{}", chineseBir);
|
||||||
// //截取日、月
|
//截取日、月
|
||||||
// String[] strings = Strings.split(boyBirthday, '-');
|
String[] strings = Strings.split(boyBirthday, '-');
|
||||||
// int chineseMonth = chineseBir.getMonth();
|
int chineseMonth = chineseBir.getMonth();
|
||||||
// int chineseDay = chineseBir.getDay();
|
int chineseDay = chineseBir.getDay();
|
||||||
// //获取当前日期的年
|
//获取当前日期的年
|
||||||
// Calendar dateToday = Calendar.getInstance();
|
Calendar dateToday = Calendar.getInstance();
|
||||||
// int todayYear = dateToday.get(Calendar.YEAR);
|
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();
|
int gregorianDay = chineseDate.getGregorianDay();
|
||||||
// //计算时间差
|
//计算时间差
|
||||||
// long days = haveThisDay(chineseMonth, chineseDay, dateToday, todayYear, chineseDate, gregorianDay);
|
long days = haveThisDay(chineseMonth, chineseDay, dateToday, todayYear, chineseDate, gregorianDay);
|
||||||
// log.info("days:{}", days);
|
log.info("days:{}", days);
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 需要递归计算日期差
|
* 需要递归计算日期差
|
||||||
// *
|
*
|
||||||
// * @param chineseMonth 农历月
|
* @param chineseMonth 农历月
|
||||||
// * @param chineseDay 农历日
|
* @param chineseDay 农历日
|
||||||
// * @param dateToday 今天的日期类
|
* @param dateToday 今天的日期类
|
||||||
// * @param todayYear 当前的年
|
* @param todayYear 当前的年
|
||||||
// * @param chineseDate 组装的待计算的新日期
|
* @param chineseDate 组装的待计算的新日期
|
||||||
// * @param gregorianDay 判断是否存在农历日期的参数,-1代表今年不存在这个农历日期
|
* @param gregorianDay 判断是否存在农历日期的参数,-1代表今年不存在这个农历日期
|
||||||
// * @return 计算好的天数
|
* @return 计算好的天数
|
||||||
// */
|
*/
|
||||||
// private static long haveThisDay(int chineseMonth, int chineseDay, Calendar dateToday, int todayYear, ChineseDate chineseDate, int gregorianDay) {
|
private static long haveThisDay(int chineseMonth, int chineseDay, Calendar dateToday, int todayYear, ChineseDate chineseDate, int gregorianDay) {
|
||||||
// //判断当前年份是否存在农历日对应的阳历日
|
//判断当前年份是否存在农历日对应的阳历日
|
||||||
// while (gregorianDay == -1) {
|
while (gregorianDay == -1) {
|
||||||
// //不存在,计算明年
|
//不存在,计算明年
|
||||||
// todayYear += 1;
|
todayYear += 1;
|
||||||
// chineseDate = new ChineseDate(todayYear, chineseMonth, chineseDay, false);
|
chineseDate = new ChineseDate(todayYear, chineseMonth, chineseDay, false);
|
||||||
// gregorianDay = chineseDate.getGregorianDay();
|
gregorianDay = chineseDate.getGregorianDay();
|
||||||
// }
|
}
|
||||||
// //存在
|
//存在
|
||||||
// //将农历日期改为阳历日期
|
//将农历日期改为阳历日期
|
||||||
// Calendar gregorianbir = chineseDate.getGregorianCalendar();
|
Calendar gregorianbir = chineseDate.getGregorianCalendar();
|
||||||
// //判断这个日期是否和今年是同一年
|
//判断这个日期是否和今年是同一年
|
||||||
// if (todayYear == dateToday.get(Calendar.YEAR)) {
|
if (todayYear == dateToday.get(Calendar.YEAR)) {
|
||||||
// //是同一年,判断这一天过了没
|
//是同一年,判断这一天过了没
|
||||||
// if (gregorianbir.get(Calendar.DAY_OF_YEAR) < dateToday.get(Calendar.DAY_OF_YEAR)) {
|
if (gregorianbir.get(Calendar.DAY_OF_YEAR) < dateToday.get(Calendar.DAY_OF_YEAR)) {
|
||||||
// //这一天过了,计算明年
|
//这一天过了,计算明年
|
||||||
// todayYear += 1;
|
todayYear += 1;
|
||||||
// chineseDate = new ChineseDate(todayYear, chineseMonth, chineseDay, false);
|
chineseDate = new ChineseDate(todayYear, chineseMonth, chineseDay, false);
|
||||||
// gregorianDay = chineseDate.getGregorianDay();
|
gregorianDay = chineseDate.getGregorianDay();
|
||||||
// //递归计算下一年是否存在对应的阳历日
|
//递归计算下一年是否存在对应的阳历日
|
||||||
// return haveThisDay(chineseMonth, chineseDay, dateToday, todayYear, chineseDate, gregorianDay);
|
return haveThisDay(chineseMonth, chineseDay, dateToday, todayYear, chineseDate, gregorianDay);
|
||||||
// }
|
}
|
||||||
// //没有过,直接计算
|
//没有过,直接计算
|
||||||
// }
|
}
|
||||||
// //不是同一年,直接计算
|
//不是同一年,直接计算
|
||||||
// Date time = dateToday.getTime();
|
Date time = dateToday.getTime();
|
||||||
// log.info("当前的日期是:{}", time);
|
log.info("当前的日期是:{}", time);
|
||||||
// Date time1 = gregorianbir.getTime();
|
Date time1 = gregorianbir.getTime();
|
||||||
// log.info("下一个生日的日期:{}", time1);
|
log.info("下一个生日的日期:{}", time1);
|
||||||
// return DateUtil.between(dateToday.getTime(), gregorianbir.getTime(), DateUnit.DAY);
|
return DateUtil.between(dateToday.getTime(), gregorianbir.getTime(), DateUnit.DAY);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// void test2() {
|
void test2() {
|
||||||
//
|
|
||||||
// TianXinReqParam param1 = new TianXinReqParam();
|
TianXinReqParam param1 = new TianXinReqParam();
|
||||||
// param1.setKey(DailyLoveConfigure.TianXin_Key);
|
param1.setKey(DailyLoveConfigure.TianXin_Key);
|
||||||
// param1.setCity(DailyLoveConfigure.City_ID);
|
param1.setCity(DailyLoveConfigure.City_ID);
|
||||||
// param1.setType("7");
|
param1.setType("7");
|
||||||
// String weatherJson = dataRemoteClient.getWeather(param1);
|
String weatherJson = dataRemoteClient.getWeather(param1);
|
||||||
// log.info("weather:{}", weatherJson);
|
log.info("weather:{}", weatherJson);
|
||||||
// JSONObject resWeather = JSONObject.parseObject(weatherJson);
|
JSONObject resWeather = JSONObject.parseObject(weatherJson);
|
||||||
// JSONObject result = resWeather.getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(2);
|
JSONObject result = resWeather.getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(2);
|
||||||
// log.info("----result----:{}", result);
|
log.info("----result----:{}", result);
|
||||||
// Weather weather = result.toJavaObject(Weather.class);
|
Weather weather = result.toJavaObject(Weather.class);
|
||||||
// log.info("weather:{}", weather);
|
log.info("weather:{}", weather);
|
||||||
// ChineseDate chineseDate = new ChineseDate(DateUtil.parseDate(weather.getDate()));
|
ChineseDate chineseDate = new ChineseDate(DateUtil.parseDate(weather.getDate()));
|
||||||
// System.out.println("--------------55555----------"+weather.getDate());
|
System.out.println("--------------55555----------"+weather.getDate());
|
||||||
// System.out.println("------------------------"+chineseDate);
|
System.out.println("------------------------"+chineseDate);
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// void test1() {
|
void test1() {
|
||||||
// int loveDays = getBirthdays("2023-05-14");
|
int loveDays = getLoveDays("2021-07-16");
|
||||||
// log.info("-------------------------------{}", loveDays);
|
log.info("-------------------------------{}", loveDays);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public static int getLoveDays(String loveday) {
|
public static int getLoveDays(String loveday) {
|
||||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
// int days = 0;
|
int days = 0;
|
||||||
// try {
|
try {
|
||||||
// long time = System.currentTimeMillis() - dateFormat.parse(loveday).getTime();
|
long time = System.currentTimeMillis() - dateFormat.parse(loveday).getTime();
|
||||||
// days = (int) (time / (24 * 60 * 60 * 1000));
|
days = (int) (time / (24 * 60 * 60 * 1000));
|
||||||
//
|
|
||||||
// } catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// }
|
}
|
||||||
// return days;
|
return days;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// void contextLoads() {
|
void contextLoads() {
|
||||||
// TianXinReqParam param1 = new TianXinReqParam();
|
// TianXinReqParam param1 = new TianXinReqParam();
|
||||||
// param1.setKey(DailyLoveConfigure.TianXin_Key);
|
// param1.setKey(DailyLoveConfigure.TianXin_Key);
|
||||||
// param1.setCity(DailyLoveConfigure.City_ID);
|
// param1.setCity(DailyLoveConfigure.City_ID);
|
||||||
@@ -203,6 +201,6 @@ class DailyLoveApplicationTests {
|
|||||||
// log.info("resultVo:{}", resultVo);
|
// log.info("resultVo:{}", resultVo);
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user