From fb97f83e39a0995fb70326c492a0bcd37af5e300 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 12 十一月 2025 17:45:57 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mobile_community
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOldsterWarningController.java | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOldsterWarningController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOldsterWarningController.java
index 016f999..17cc140 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOldsterWarningController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOldsterWarningController.java
@@ -34,6 +34,8 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
+import java.time.LocalDate;
+import java.time.Period;
import java.util.List;
import java.util.Objects;
@@ -80,7 +82,6 @@
TOldster oldster = oldsterService.getById(oldsterWarning.getOldsterId());
if(Objects.nonNull(oldster)){
oldsterWarningVO.setOldsterName(oldster.getOldsterName());
- oldsterWarningVO.setOldsterAge(oldster.getOldsterAge());
oldsterWarningVO.setOldsterSex(oldster.getOldsterSex());
oldsterWarningVO.setContactPhone(oldster.getContactPhone());
oldsterWarningVO.setGuardianName(oldster.getGuardianName());
@@ -90,14 +91,32 @@
oldsterWarningVO.setIdCard(oldster.getIdCard());
oldsterWarningVO.setBirthDate(oldster.getBirthDate());
oldsterWarningVO.setOldsterType(oldster.getOldsterType());
+ LocalDate birthDate = oldster.getBirthDate();
+ LocalDate currentDate = LocalDate.now();
+ // 使用Period类计算两个日期之间的年数差异
+ Period period = Period.between(birthDate, currentDate);
+ int years = period.getYears();
+ // 如果当前日期小于出生日期的下一个生日,则需要减去一年(因为我们还没有过生日)
+ if (currentDate.isBefore(birthDate.plusYears(years).plusMonths(1).minusDays(1))) {
+ years--;
+ }
+ oldsterWarningVO.setOldsterAge(years);
}
return R.ok(oldsterWarningVO);
}
-
+ /**
+ * 删除老人预警信息
+ */
+ @Log(title = "老人预警信息-删除", businessType = BusinessType.DELETE)
+ @ApiOperation(value = "老人预警信息-删除")
+ @DeleteMapping(value = "/deleteById")
+ public R<Boolean> deleteById(@RequestParam String id) {
+ return R.ok(oldsterWarningService.removeById(id));
+ }
@Log(title = "老人预警管理-老人预警记录导出", businessType = BusinessType.EXPORT)
@ApiOperation(value = "老人预警记录导出")
@PostMapping("/exportOldsterWarning")
- public void exportOldsterWarning(@RequestBody TCourseOrderQuery query){
+ public void exportOldsterWarning(@RequestBody OldsterListQuery query){
List<TOldsterWarningExport> oldsterWarningExports = oldsterWarningService.exportOldsterWarning(query);
for (TOldsterWarningExport oldsterWarningExport : oldsterWarningExports) {
if(Objects.nonNull(oldsterWarningExport.getWarningTime())){
--
Gitblit v1.7.1