From dd5169107669f03ad9469481f90918827763ab3e Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期四, 10 八月 2023 13:14:19 +0800
Subject: [PATCH] 日期格式
---
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolpointRecord.java | 2 +-
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java | 29 +++++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolpointRecord.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolpointRecord.java
index 427109a..ab30b47 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolpointRecord.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolpointRecord.java
@@ -16,7 +16,7 @@
* @date 2023-08-02
*/
@Data
-public class ArdAppPatrolpointRecord extends BaseEntity
+public class ArdAppPatrolpointRecord
{
private static final long serialVersionUID = 1L;
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
index 9f8639b..c09b1fd 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
@@ -148,13 +148,25 @@
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
int day = Integer.parseInt(parts[2]);
+ String monthZero;
+ if(month<10){
+ monthZero = String.format("%02d", month);
+ }else {
+ monthZero = String.valueOf(month);
+ }
JSONArray jsonArray = new JSONArray();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 1; i <= day; i++) {
+ String di;
+ if(i<10){
+ di = String.format("%02d", i);
+ }else {
+ di = String.valueOf(i);
+ }
JSONObject jsonObject = new JSONObject();
Boolean planBoolean = false;
//寰幆姣忎竴澶�
- String ymd = year+"-"+month+"-"+i;
+ String ymd = year+"-"+monthZero+"-"+di;
Date ymdDate = dateFormat.parse(ymd);
//鍖归厤璁″垝鏃堕棿
String cycle = ardAppPatrolplan.getCycle();
@@ -185,8 +197,20 @@
String[] part = recordTime.split("[-\\s:]");
int recordYear = Integer.parseInt(part[0]);
int recordMonth = Integer.parseInt(part[1]);
+ String recordMonthZero;
+ if(i<10){
+ recordMonthZero = String.format("%02d", recordMonth);
+ }else {
+ recordMonthZero = String.valueOf(recordMonth);
+ }
int recordDay = Integer.parseInt(part[2]);
- String recordDate = recordYear+"-"+recordMonth+"-"+recordDay;
+ String recordDayZero;
+ if(i<10){
+ recordDayZero = String.format("%02d", recordDay);
+ }else {
+ recordDayZero = String.valueOf(recordDay);
+ }
+ String recordDate = recordYear+"-"+recordMonthZero+"-"+recordDayZero;
//濡傛灉鐩哥瓑璇存槑杩欏ぉ鏈夋墦鍗¤褰曡褰�
if(ymd.equals(recordDate)){
or = true;
@@ -201,4 +225,5 @@
}
return Results.succeed(jsonArray);
}
+
}
--
Gitblit v1.9.3