From 3a709d693bec87de92b4b91abba535d14392810b Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 27 三月 2025 16:10:25 +0800
Subject: [PATCH] 获取项目列表接口
---
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java
index 2e03d8f..e60cbae 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanCtrl.java
@@ -60,6 +60,7 @@
return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
+ Long projectId = planAndSchedule.getProjectId();
Long operatorId = planAndSchedule.getOperatorId();
Byte startupMode = planAndSchedule.getStartupMode();
Date planStartTime = planAndSchedule.getPlanStartTime();;
@@ -68,6 +69,20 @@
Integer duration = 0;
for(IrrigateSchedule schedule : planAndSchedule.getSchedules()){
duration = duration + schedule.getDuration();
+ }
+
+ if(startupMode == 2){
+ if(planStartTime == null) {
+ return BaseResponseUtils.buildErrorMsg("鑷姩鍚姩妯″紡蹇呴』鎸囧畾璁″垝鍚姩鏃堕棿");
+ }
+
+ LocalDateTime startTime = planStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime();
+ LocalDateTime currentTime = LocalDateTime.now();
+ currentTime = currentTime.plusHours(8);
+
+ if(!startTime.isAfter(currentTime)) {
+ return BaseResponseUtils.buildErrorMsg("鍚姩鏃堕棿涓嶈兘鍦�8灏忔椂涔嬪唴");
+ }
}
//if(startupMode == 1){
@@ -80,6 +95,7 @@
//planStopTime = Date.from(stopTime.atZone(ZoneId.systemDefault()).toInstant());
IrIrrigatePlan plan = new IrIrrigatePlan();
+ plan.setProjectId(projectId);
plan.setPlanName(planAndSchedule.getPlanName());
plan.setStartupMode(startupMode);
plan.setPlanStartTime(planStartTime);
@@ -208,7 +224,9 @@
planStartTime = new Date();
}
LocalDateTime startTime = planStartTime.toInstant().atZone(ZoneId.systemDefault()) .toLocalDateTime();
- startTime = startTime.plusMinutes(5);
+ if(startupMode == 1){
+ startTime = startTime.plusMinutes(5);
+ }
planStartTime = Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant());
LocalDateTime stopTime = startTime.plusMinutes(duration);
planStopTime = Date.from(stopTime.atZone(ZoneId.systemDefault()).toInstant());
--
Gitblit v1.8.0