From 99698ab94184436c6b3c6f20d4562ef1fac8e7de Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期六, 19 八月 2023 15:59:40 +0800
Subject: [PATCH] 巡检通知
---
ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java | 3 +
ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml | 9 ++++
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSonParam.java | 11 +++++
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java | 60 ++++++++++++++++++++++++------
ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java | 9 ++++
5 files changed, 80 insertions(+), 12 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
index 018a03b..9f1d241 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
@@ -316,4 +316,13 @@
return recordService.recordBefore(recordBeforeParam);
}
+ /**
+ * 鍗曞叺绔�--寰幆
+ */
+ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:son')")
+ @ApiOperation("鍗曞叺绔�--寰幆")
+ @GetMapping("son")
+ public Results son(){
+ return recordService.son();
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSonParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSonParam.java
new file mode 100644
index 0000000..bfa3c60
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSonParam.java
@@ -0,0 +1,11 @@
+package com.ruoyi.app.patrolplan.domain.param;
+
+import lombok.Data;
+
+@Data
+public class RecordSonParam {
+
+ private String userId;
+ private String time;
+ private String beforeTime;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
index 63a8997..fb69ee4 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
@@ -6,6 +6,7 @@
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolplan;
import com.ruoyi.app.patrolplan.domain.param.RecordMonthExParam;
import com.ruoyi.app.patrolplan.domain.param.RecordMonthParam;
+import com.ruoyi.app.patrolplan.domain.param.RecordSonParam;
/**
* app宸℃璁″垝Mapper鎺ュ彛
@@ -61,4 +62,6 @@
List<ArdAppPatrolplan> dayPlan(RecordMonthExParam recordMonthExParam);
+ List<ArdAppPatrolplan> planUser(RecordSonParam recordSonParam);
+
}
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 ce84672..d5589a2 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
@@ -2,6 +2,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -144,15 +145,23 @@
//鍖归厤鎵撳崱鏃堕棿
Boolean or = false;
if(planBoolean){
- //鏌ヨ璇ヨ鍒掔殑鎵�鏈夊叴瓒g偣
- List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId);
- //鏌ヨ璇ヨ鍒掔殑鎵�鏈夋墽琛屼汉
- List<SysUser> userList = sysUserMapper.userByPlanId(planId);
- //婊″嫟澶氬皯鏉℃墦鍗¤褰�
- int maxNum = wellList.size()*userList.size();
- //瀵规瘮搴旀墦鍗¤褰曠浉绛夊垯true
- if(list.size()==maxNum){
- or = true;
+ for (int j = 0; j < list.size(); j++) {
+ //鑾峰彇鎵撳崱鏃堕棿
+ String toDayRecord = list.get(j).getRecordTime();
+ String dr = toDayRecord.substring(0,10);
+ //濡傛灉鎵撳紑鏃ユ湡鍜岃繖澶╃浉鍚�
+ if(ymd.equals(dr)){
+ //鏌ヨ璇ヨ鍒掔殑鎵�鏈夊叴瓒g偣
+ List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId);
+ //鏌ヨ璇ヨ鍒掔殑鎵�鏈夋墽琛屼汉
+ List<SysUser> userList = sysUserMapper.userByPlanId(planId);
+ //婊″嫟澶氬皯鏉℃墦鍗¤褰�
+ int maxNum = wellList.size()*userList.size();
+ //瀵规瘮搴旀墦鍗¤褰曠浉绛夊垯true
+ if(list.size()==maxNum){
+ or = true;
+ }
+ }
}
// for (int j = 0; j < list.size(); j++) {
// //鎵撳崱鏃堕棿鎷嗗垎
@@ -469,7 +478,7 @@
@Override
public Results executeDetailsOld(RecordDetailsParam recordDetailsParam) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
- SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String userId = SecurityUtils.getUserId();
//鑾峰彇鍙傛暟
String planId = recordDetailsParam.getPlanId();
@@ -779,7 +788,34 @@
@Override
public Results son() {
-
- return null;
+ SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ //鑾峰彇鐢ㄦ埛鎵ц浜�
+ String userId = SecurityUtils.getUserId();
+ // 鍑忓皯 10 绉�
+ LocalDateTime now = LocalDateTime.now(); // 鑾峰彇褰撳墠鏃ユ湡鏃堕棿
+ LocalDateTime earlier = now.minusSeconds(10); // 鍑忓皯30绉�
+ System.out.println("褰撳墠鏃ユ湡鏃堕棿锛�" + now);
+ System.out.println("鍑忓皯10绉掑悗鐨勬棩鏈熸椂闂达細" + earlier);
+ RecordSonParam recordSonParam = new RecordSonParam();
+ recordSonParam.setUserId(userId);
+ recordSonParam.setTime(dateFormatTime.format(now));
+ recordSonParam.setBeforeTime(dateFormatTime.format(earlier));
+ //鏍规嵁濮撳悕ID涓烘墽琛屼汉鑾峰彇鎵�鏈夊搴旂殑璁″垝鍚嶇О
+ List<ArdAppPatrolplan> list = patrolplanMapper.planUser(recordSonParam);
+ JSONArray jsonArray = new JSONArray();
+ JSONObject jsonObject = new JSONObject();
+ if(list.size()>0){
+ jsonObject.put("plan",true);
+ jsonObject.put("user",list.get(0).getNickName());
+ jsonObject.put("name",list.get(0).getPlanName());
+// list.get(0).setSon("宸查�氱煡");
+// patrolplanMapper.updateById(list.get(0));
+ }else {
+ jsonObject.put("plan",false);
+ jsonObject.put("user",null);
+ jsonObject.put("name",null);
+ }
+ jsonArray.add(jsonObject);
+ return Results.succeed(jsonArray);
}
}
diff --git a/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml
index 6298d2d..89360c8 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppPatrolplanMapper.xml
@@ -156,4 +156,13 @@
LEFT JOIN ard_app_patroluser users on users.patrolplan_id = plan."id"
where users.app_user_id = #{userId} and cycle = 'day' and create_time < #{end} and del_name is null and del_time is null ;
</select>
+
+ <select id="planUser" parameterType="String" resultMap="ArdAppPatrolplanResult">
+ select s.nick_name nickName, plan.plan_name from ard_app_patrolplan plan
+ LEFT JOIN ard_app_patroluser users on users.patrolplan_id = plan."id"
+ left join sys_user s on users.app_user_id = s.user_id
+ where users.app_user_id = #{userId} and son is null
+ and plan.create_time >= #{beforeTime} and plan.create_time <= #{time}
+ and del_name is null and del_time is null order by plan.create_time desc;
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3