From d7462c0c0615cee1acfbc14a52aa12d72940e49d Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期三, 16 八月 2023 14:25:41 +0800
Subject: [PATCH] 单兵端
---
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java | 1
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordMonthParam.java | 11 +
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordDetailsParam.java | 10 +
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java | 5
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java | 14 +
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java | 248 ++++++++++++++++++++++++++++++++--
ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java | 58 +++++++-
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloExParam.java | 12 +
ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloParam.java | 13 +
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java | 1
10 files changed, 343 insertions(+), 30 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 cb0da57..1bf372a 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
@@ -14,7 +14,7 @@
import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpoint;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecord;
-import com.ruoyi.app.patrolplan.domain.param.ArdAppPatrolpointRecordParam;
+import com.ruoyi.app.patrolplan.domain.param.*;
import com.ruoyi.app.patrolplan.service.IArdAppPatrolpointRecordService;
import com.ruoyi.app.patrolplan.service.IArdAppPatrolpointService;
import com.ruoyi.app.patrolplan.service.IArdAppPatroluserService;
@@ -182,7 +182,7 @@
}
/**
- * 绠$悊绔�--鏌ヨ鍗曟潯鏁版嵁
+ * 绠$悊绔�--鏌ヨ鍗曟潯鏁版嵁
*/
@PreAuthorize("@ss.hasPermi('app:appPatrolplan:oneById')")
@PostMapping("/oneById/{id}")
@@ -220,8 +220,8 @@
@PreAuthorize("@ss.hasPermi('app:appPatrolplan:recordMonth')")
@ApiOperation("绠$悊绔�--宸℃鏃ュ巻")
@PostMapping("recordMonth")
- public Results recordMonth(@RequestBody ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException {
- return recordService.recordMonth(ardAppPatrolpointRecordParam);
+ public Results recordMonth(@RequestBody RecordMonthParam recordMonthParam) throws ParseException {
+ return recordService.recordMonth(recordMonthParam);
}
/**
@@ -230,8 +230,8 @@
@PreAuthorize("@ss.hasPermi('app:appPatrolplan:recordDetails')")
@ApiOperation("绠$悊绔�--鐐瑰嚮鏃ュ巻鑾峰彇璇ヨ褰曚笅浜哄憳鎵撳崱璁板綍")
@PostMapping("recordDetails")
- public Results recordDetails(@RequestBody ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException {
- return recordService.recordDetails(ardAppPatrolpointRecordParam);
+ public Results recordDetails(@RequestBody RecordDetailsParam recordDetailsParam) throws ParseException {
+ return recordService.recordDetails(recordDetailsParam);
}
/**
@@ -240,8 +240,8 @@
@PreAuthorize("@ss.hasPermi('app:appPatrolplan:recordSolo')")
@ApiOperation("绠$悊绔�--鍗曚汉璇︽儏")
@PostMapping("recordSolo")
- public Results recordSolo(@RequestBody ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException {
- return recordService.recordSolo(ardAppPatrolpointRecordParam);
+ public Results recordSolo(@RequestBody RecordSoloParam recordSoloParam) throws ParseException {
+ return recordService.recordSolo(recordSoloParam);
}
/**
@@ -264,4 +264,46 @@
List<ArdAppPatrolplan> list = ardAppPatrolplanService.executeList(ardAppPatrolplan);
return Results.succeed(new PageInfo<>(list));
}
+
+ /**
+ * 鍗曞叺绔�--鏌ヨ鍗曟潯鏁版嵁
+ */
+ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:executeOneById')")
+ @PostMapping("/executeOneById/{id}")
+ @ApiOperation("鍗曞叺绔�--鏌ヨ鍗曟潯鏁版嵁")
+ public Results executeOneById(@PathVariable String id)
+ {
+ return ardAppPatrolplanService.executeOneById(id);
+ }
+
+ /**
+ * 鍗曞叺绔�--宸℃鏃ュ巻
+ */
+ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:executeMonth')")
+ @ApiOperation("鍗曞叺绔�--宸℃鏃ュ巻")
+ @PostMapping("executeMonth")
+ public Results executeMonth(@RequestBody RecordMonthParam recordMonthParam) throws ParseException {
+ return recordService.executeMonth(recordMonthParam);
+ }
+
+ /**
+ * 鍗曞叺绔�--鐐瑰嚮鏃ュ巻鑾峰彇璇ヨ褰曚笅浜哄憳鎵撳崱璁板綍
+ */
+ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:executeDetails')")
+ @ApiOperation("鍗曞叺绔�--鐐瑰嚮鏃ュ巻鑾峰彇璇ヤ汉鍛樹笅鎵�鏈夊湴鐐规墦鍗¤褰�")
+ @PostMapping("executeDetails")
+ public Results executeDetails(@RequestBody RecordDetailsParam recordDetailsParam) throws ParseException {
+ return recordService.executeDetails(recordDetailsParam);
+ }
+
+ /**
+ * 鍗曞叺绔�--鍗曚汉璇︽儏
+ */
+ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:executeSolo')")
+ @ApiOperation("鍗曞叺绔�--鍗曚汉璇︽儏")
+ @PostMapping("executeSolo")
+ public Results executeSolo(@RequestBody RecordSoloExParam recordSoloExParam) throws ParseException {
+ return recordService.executeSolo(recordSoloExParam);
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java
index c776aad..856f17e 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/ArdAppPatrolpointRecordParam.java
@@ -13,4 +13,5 @@
private String toDay;
private String userId;
private String userName;
+ private String wellId;
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordDetailsParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordDetailsParam.java
new file mode 100644
index 0000000..d6902cb
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordDetailsParam.java
@@ -0,0 +1,10 @@
+package com.ruoyi.app.patrolplan.domain.param;
+
+import lombok.Data;
+
+@Data
+public class RecordDetailsParam {
+
+ private String planId;
+ private String toDay;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordMonthParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordMonthParam.java
new file mode 100644
index 0000000..909fb17
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordMonthParam.java
@@ -0,0 +1,11 @@
+package com.ruoyi.app.patrolplan.domain.param;
+
+import lombok.Data;
+
+@Data
+public class RecordMonthParam {
+
+ private String begin;
+ private String end;
+ private String planId;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloExParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloExParam.java
new file mode 100644
index 0000000..989e3f8
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloExParam.java
@@ -0,0 +1,12 @@
+package com.ruoyi.app.patrolplan.domain.param;
+
+import lombok.Data;
+
+@Data
+public class RecordSoloExParam {
+
+ private String planId;
+ private String toDay;
+ private String userId;
+ private String wellId;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloParam.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloParam.java
new file mode 100644
index 0000000..e210f0b
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/param/RecordSoloParam.java
@@ -0,0 +1,13 @@
+package com.ruoyi.app.patrolplan.domain.param;
+
+import lombok.Data;
+
+@Data
+public class RecordSoloParam {
+
+ private String planId;
+ private String planName;
+ private String toDay;
+ private String userId;
+ private String userName;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
index d7f0b4a..abdea0f 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
@@ -63,4 +63,5 @@
List<ArdAppPatrolplan> executeList(ArdAppPatrolplan ardAppPatrolplan);
+ Results executeOneById(String id);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java
index d076d30..72bb5e5 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolpointRecordService.java
@@ -5,7 +5,7 @@
import java.util.Map;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecord;
-import com.ruoyi.app.patrolplan.domain.param.ArdAppPatrolpointRecordParam;
+import com.ruoyi.app.patrolplan.domain.param.*;
import com.ruoyi.utils.result.Results;
/**
@@ -66,9 +66,15 @@
Results record(ArdAppPatrolpointRecord ardAppPatrolpointRecord);
- Results recordMonth(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException;
+ Results recordMonth(RecordMonthParam recordMonthParam) throws ParseException;
- Results recordDetails(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException;
+ Results recordDetails(RecordDetailsParam recordDetailsParam) throws ParseException;
- Results recordSolo(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam);
+ Results recordSolo(RecordSoloParam recordSoloParam);
+
+ Results executeMonth(RecordMonthParam recordMonthParam) throws ParseException;
+
+ Results executeDetails(RecordDetailsParam recordDetailsParam) throws ParseException;
+
+ Results executeSolo(RecordSoloExParam recordSoloExParam);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
index 3ab109a..55a739f 100644
--- a/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
@@ -307,4 +307,9 @@
return ardAppPatrolplanMapper.executeList(ardAppPatrolplan);
}
+ @Override
+ public Results executeOneById(String id) {
+ return Results.succeed(ardAppPatrolplanMapper.selectById(id));
+ }
+
}
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 ecd6d16..d4c769c 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
@@ -15,7 +15,7 @@
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolplan;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecordImg;
import com.ruoyi.app.patrolplan.domain.ArdAppPatroluser;
-import com.ruoyi.app.patrolplan.domain.param.ArdAppPatrolpointRecordParam;
+import com.ruoyi.app.patrolplan.domain.param.*;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolplanMapper;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointRecordImgMapper;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatroluserMapper;
@@ -156,11 +156,11 @@
}
@Override
- public Results recordMonth(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException {
+ public Results recordMonth(RecordMonthParam recordMonthParam) throws ParseException {
//鑾峰彇鍓嶇鍙傛暟
- String begin = ardAppPatrolpointRecordParam.getBegin();
- String end = ardAppPatrolpointRecordParam.getEnd();
- String planId = ardAppPatrolpointRecordParam.getPlanId();
+ String begin = recordMonthParam.getBegin();
+ String end = recordMonthParam.getEnd();
+ String planId = recordMonthParam.getPlanId();
//鏌ヨ璁″垝琛�
ArdAppPatrolplan ardAppPatrolplan = patrolplanMapper.selectById(planId);
//鏌ヨ鍑烘湁鏁堟墦鍗℃暟鎹�
@@ -251,12 +251,12 @@
}
@Override
- public Results recordDetails(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException {
+ public Results recordDetails(RecordDetailsParam recordDetailsParam) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
//鑾峰彇鍙傛暟
- String planId = ardAppPatrolpointRecordParam.getPlanId();
- String toDay = ardAppPatrolpointRecordParam.getToDay();
+ String planId = recordDetailsParam.getPlanId();
+ String toDay = recordDetailsParam.getToDay();
//鏌ヨ璁″垝琛�
ArdAppPatrolplan ardAppPatrolplan = patrolplanMapper.selectById(planId);
String cycle = ardAppPatrolplan.getCycle();
@@ -360,18 +360,32 @@
}
@Override
- public Results recordSolo(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) {
- String toDay = ardAppPatrolpointRecordParam.getToDay();
- String planId = ardAppPatrolpointRecordParam.getPlanId();
- String userId = ardAppPatrolpointRecordParam.getUserId();
- String planName = ardAppPatrolpointRecordParam.getPlanName();
- String userName = ardAppPatrolpointRecordParam.getUserName();
+ public Results recordSolo(RecordSoloParam recordSoloParam) {
+ String toDay = recordSoloParam.getToDay();
+ String planId = recordSoloParam.getPlanId();
+ String userId = recordSoloParam.getUserId();
+ String planName = recordSoloParam.getPlanName();
+ String userName = recordSoloParam.getUserName();
QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("plan_id", planId).eq("user_id",userId).like("record_time", toDay);
//褰撳墠璁″垝閫変腑鏃堕棿閲屾鐢ㄦ埛鐨勬墦鍗¤褰�
List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(queryWrapper);
+ //鏌ヨ璇ヨ鍒掔殑鎵�鏈夊叴瓒g偣
+ List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId);
if(list.size()==0){
-
+ for (ArdAlarmpointsWell ardAlarmpointsWell : wellList) {
+ ArdAppPatrolpointRecord ardAppPatrolpointRecord = new ArdAppPatrolpointRecord();
+ ardAppPatrolpointRecord.setAppPatrolpointsId(ardAlarmpointsWell.getId());
+ ardAppPatrolpointRecord.setAppPatrolpointsName(ardAlarmpointsWell.getWellId());
+ ardAppPatrolpointRecord.setPlanId(planId);
+ ardAppPatrolpointRecord.setPlanName(planName);
+ ardAppPatrolpointRecord.setUserId(userId);
+ ardAppPatrolpointRecord.setUserName(userName);
+ ardAppPatrolpointRecord.setLatitude(String.valueOf(ardAlarmpointsWell.getLatitude()));
+ ardAppPatrolpointRecord.setLongitude(String.valueOf(ardAlarmpointsWell.getLongitude().toString()));
+ list.add(ardAppPatrolpointRecord);
+ }
+ return Results.succeed(list);
}
for (ArdAppPatrolpointRecord appPatrolpointRecord : list) {
QueryWrapper<ArdAppPatrolpointRecordImg> queryWrapper1 = new QueryWrapper<>();
@@ -388,12 +402,10 @@
for (ArdAppPatrolpointRecord appPatrolpointRecord : list) {
pointList.add(appPatrolpointRecord.getAppPatrolpointsId());
}
- //鏌ヨ璇ヨ鍒掔殑鎵�鏈夊叴瓒g偣
- List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId);
for (ArdAlarmpointsWell ardAlarmpointsWell : wellList) {
//鎵�鏈夊簲璇ユ墦鍗$殑鍦扮偣ID
String well = ardAlarmpointsWell.getId();
- //濡傛灉鎵撳紑鍦扮偣涓嶅寘鍚簲鎵撳崱鍦扮偣锛岄偅璇村悕杩欏潡鍎挎病鎵撳崱
+ //濡傛灉鎵撳崱鍦扮偣涓嶅寘鍚簲鎵撳崱鍦扮偣锛岄偅璇村悕杩欏潡鍎挎病鎵撳崱
if (!pointList.contains(well)) {
ArdAppPatrolpointRecord ardAppPatrolpointRecord = new ArdAppPatrolpointRecord();
ardAppPatrolpointRecord.setAppPatrolpointsId(well);
@@ -410,4 +422,204 @@
return Results.succeed(list);
}
+ @Override
+ public Results executeMonth(RecordMonthParam RecordMonthParam) throws ParseException {
+ //鑾峰彇鍓嶇鍙傛暟
+ String begin = RecordMonthParam.getBegin();
+ String end = RecordMonthParam.getEnd();
+ String planId = RecordMonthParam.getPlanId();
+ //鏌ヨ璁″垝琛�
+ ArdAppPatrolplan ardAppPatrolplan = patrolplanMapper.selectById(planId);
+ //鏌ヨ鍑烘湁鏁堟墦鍗℃暟鎹�
+ String userId = SecurityUtils.getUserId();
+ QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>();
+ queryWrapper.between("record_time",begin,end).eq("plan_id",planId).eq("user_id",userId);
+ List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(queryWrapper);
+ //鏃堕棿鎷嗗垎
+ String[] parts = end.split("[-\\s:]");
+ 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+"-"+monthZero+"-"+di;
+ //鍖归厤璁″垝鏃堕棿
+ String cycle = ardAppPatrolplan.getCycle();
+ if(cycle.equals("day")){
+ String createTime = ardAppPatrolplan.getCreateTime();
+ int d = ymd.compareTo(createTime);
+ if(d>=0){
+ planBoolean = true;
+ }
+ }else if(cycle.equals("once")){
+ String onceBegin = ardAppPatrolplan.getPatroBeginTime();
+ String onceEnd = ardAppPatrolplan.getPatroEndTime();
+ int bd = ymd.compareTo(onceBegin);
+ int ed = ymd.compareTo(onceEnd);
+ if(bd>=0 && ed<=0){
+ planBoolean = true;
+ }
+ }
+ //鍖归厤鎵撳崱鏃堕棿
+ Boolean or = false;
+ if(planBoolean){
+ for (int j = 0; j < list.size(); j++) {
+ //鎵撳崱鏃堕棿鎷嗗垎
+ String recordTime = list.get(j).getRecordTime();
+ String[] part = recordTime.split("[-\\s:]");
+ int recordYear = Integer.parseInt(part[0]);
+ int recordMonth = Integer.parseInt(part[1]);
+ String recordMonthZero;
+ if(recordMonth<10){
+ recordMonthZero = String.format("%02d", recordMonth);
+ }else {
+ recordMonthZero = String.valueOf(recordMonth);
+ }
+ int recordDay = Integer.parseInt(part[2]);
+ String recordDayZero;
+ if(recordDay<10){
+ recordDayZero = String.format("%02d", recordDay);
+ }else {
+ recordDayZero = String.valueOf(recordDay);
+ }
+ String recordDate = recordYear+"-"+recordMonthZero+"-"+recordDayZero;
+ //濡傛灉鐩哥瓑璇存槑杩欏ぉ鏈夋墦鍗¤褰曡褰�
+ if(ymd.equals(recordDate)){
+ or = true;
+ break;
+ }
+ }
+ }
+ jsonObject.put("toDay",ymd );
+ jsonObject.put("plan",planBoolean);
+ jsonObject.put("record",or);
+ jsonArray.add(jsonObject);
+ }
+ return Results.succeed(jsonArray);
+ }
+
+ @Override
+ public Results executeDetails(RecordDetailsParam recordDetailsParam) throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ String userId = SecurityUtils.getUserId();
+ //鑾峰彇鍙傛暟
+ String planId = recordDetailsParam.getPlanId();
+ String toDay = recordDetailsParam.getToDay();
+ //鏌ヨ璁″垝琛�
+ ArdAppPatrolplan ardAppPatrolplan = patrolplanMapper.selectById(planId);
+ String cycle = ardAppPatrolplan.getCycle();
+ String begin = ardAppPatrolplan.getPatroBeginTime();
+ String end = ardAppPatrolplan.getPatroEndTime();
+ String create = ardAppPatrolplan.getCreateTime();
+ JSONArray jsonArray = new JSONArray();
+ int c = 0;
+ if(cycle.equals("day")){
+ //姣忓ぉ璁″垝鍙栧垱寤烘椂闂�
+ c = toDay.compareTo(create.substring(0,10));
+ }else if(cycle.equals("once")){
+ //鍗曟璁″垝鍙栧紑濮嬫椂闂�
+ c = toDay.compareTo(begin.substring(0,10));
+ }
+ if(cycle.equals("once") && c>0){
+ //鍗曟璁″垝澶т簬寮�濮嬫椂闂�==璺ㄥぉ锛屽湪璁″垝鏃堕棿澶�
+ return Results.succeed("[]");
+ }
+ if(c<0){
+ //姣忔棩璁″垝灏忎簬鍒涘缓鏃堕棿鎴栧崟娆¤鍒掑皬浜庡紑濮嬫椂闂达紝鍦ㄨ鍒掓椂闂村
+ return Results.succeed("[]");
+ }else{
+ //鍦ㄦ瘡鏃ヨ鍒掔殑鏃堕棿鑼冨洿鍐�
+ String date = dateFormat.format(new Date());
+ //姣旇緝閫変腑鐨勬棩鏈熷拰浠婂ぉ鏃ユ湡
+ int d = toDay.compareTo(date);
+ //鏌ヨ璇ヨ鍒掔殑鎵�鏈変汉鍛�
+ List<SysUser> users = sysUserMapper.userByPlanId(planId);
+ //鏌ヨ璇ヨ鍒掔殑鎵�鏈夊叴瓒g偣
+ List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId);
+ //澶т簬0浠h〃鏌ヨ浠ュ悗鐨勮褰�
+ if(d>0){
+ //鏌ヨ璁″垝鍐呯殑姣忔棩鏈潵鏁版嵁
+ for (int i = 0; i < users.size(); i++) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("wellId",wellList.get(i).getId());
+ jsonObject.put("wellName",wellList.get(i).getWellId());
+ jsonObject.put("type",false);
+ jsonArray.add(jsonObject);
+ }
+ return Results.succeed(jsonArray);
+ }else{
+ //鏌ヨ璁″垝鍐呯殑瀹為檯鍘嗗彶鎵撳崱鏁版嵁
+ QueryWrapper<ArdAppPatrolpointRecord> recordQueryWrapper = new QueryWrapper<>();
+ if(d<0){
+ //灏忎簬0鏄巻鍙�
+ recordQueryWrapper.select("app_patrolpoints_id","app_patrolpoints_name").eq("plan_id", planId).eq("user_id",userId).like("record_time", toDay);
+ }else{
+ //绛変簬0閫変腑鐨勬棩鏈熷氨鏄粖澶╋紝闇�瑕佽繘涓�姝ュ垽鏂皬浜庡綋鍓嶆椂鍒嗙鐨勮褰�
+ recordQueryWrapper.select("app_patrolpoints_id","app_patrolpoints_name").eq("plan_id", planId).eq("user_id",userId).le("record_time", dateFormatTime.format(new Date()));
+ }
+ List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(recordQueryWrapper);
+ //寰幆鎵撳崱鍦扮偣
+ for (int i = 0; i < wellList.size(); i++) {
+ String id = wellList.get(i).getId();
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("wellId",wellList.get(i).getId());
+ jsonObject.put("wellName",wellList.get(i).getWellId());
+ if(list.size()>0){
+ for (int j = 0; j < list.size(); j++) {
+ if(id.equals(list.get(j).getAppPatrolpointsId())){
+ jsonObject.put("type",true);
+ break;
+ }
+ if(j==list.size()-1){
+ jsonObject.put("type",false);
+ }
+ }
+ }else {
+ jsonObject.put("type",false);
+ }
+ jsonArray.add(jsonObject);
+ }
+ return Results.succeed(jsonArray);
+ }
+ }
+ }
+
+ @Override
+ public Results executeSolo(RecordSoloExParam recordSoloExParam) {
+ QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("plan_id",recordSoloExParam.getPlanId())
+ .eq("app_patrolpoints_id",recordSoloExParam.getWellId())
+ .eq("user_id",recordSoloExParam.getUserId())
+ .like("record_time",recordSoloExParam.getToDay());
+ List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(queryWrapper);
+ for (ArdAppPatrolpointRecord appPatrolpointRecord : list) {
+ QueryWrapper<ArdAppPatrolpointRecordImg> queryWrapper1 = new QueryWrapper<>();
+ queryWrapper1.eq("app_patrolponit_record_id", appPatrolpointRecord.getId());
+ List<ArdAppPatrolpointRecordImg> list1 = recordImgMapper.selectList(queryWrapper1);
+ List<String> strings = new ArrayList<>();
+ for (ArdAppPatrolpointRecordImg ardAppPatrolpointRecordImg : list1) {
+ strings.add(ardAppPatrolpointRecordImg.getImg());
+ }
+ appPatrolpointRecord.setImg(strings);
+ }
+ return Results.succeed(list);
+ }
+
}
--
Gitblit v1.9.3