diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/controller/DfPlanController.java b/shuili-system/src/main/java/com/kms/yxgh/df/controller/DfPlanController.java index 6dbe06a8..ef1c0f01 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/controller/DfPlanController.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/controller/DfPlanController.java @@ -102,4 +102,12 @@ public class DfPlanController { public Response> addPoints(@PathVariable("id") String id) { return Response.ok(dfPlanService.getPoints(id)); } + + //当天已巡查 + @ApiOperation("堤防巡视检查计划当天已巡查") + @Log(title = "堤防巡视检查计划当天已巡查", businessType = BusinessType.SEARCH) + @GetMapping("/today/{id}") + public Response today(@PathVariable("id") String id) { + return Response.ok(dfPlanService.today(id)); + } } diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java b/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java index e4fa75f6..f18886cc 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java @@ -28,6 +28,9 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Date; import java.util.List; import java.util.function.Consumer; @@ -200,5 +203,16 @@ public class DfPlanService extends BaseService { return this.getBaseMapper().selectCount(wp) > 0; } + //获取当天零点时间 + private Date getZeroTime() { + return Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()); + } + + public Boolean today(String id) { + Wrapper wp = Wrappers.lambdaQuery() + .eq(DfRecord::getPlanId, id) + .eq(DfRecord::getCreateTime, getZeroTime()); + return dfRecordMapper.selectCount(wp) > 0; + } } diff --git a/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java b/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java index 7ac6a55f..9279c010 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java +++ b/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java @@ -96,4 +96,11 @@ public class SzPlanController { public Response> addPoints(@PathVariable("id") String id) { return Response.ok(szPlanService.getPoints(id)); } + + //当天已巡查 + @ApiOperation("水闸巡视检查计划当天已巡查") + @GetMapping("/today/{id}") + public Response today(@PathVariable("id") String id) { + return Response.ok(szPlanService.today(id)); + } } diff --git a/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java b/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java index 17fd41b7..11c7bb83 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java +++ b/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java @@ -28,6 +28,9 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Date; import java.util.List; import java.util.function.Consumer; @@ -200,4 +203,16 @@ public class SzPlanService extends BaseService { .eq(SzPlan::getId, id); return this.getBaseMapper().selectCount(wp) > 0; } + + //获取当天零点时间 + private Date getZeroTime() { + return Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()); + } + + public Boolean today(String id) { + Wrapper wp = Wrappers.lambdaQuery() + .eq(SzRecord::getPlanId, id) + .eq(SzRecord::getCreateTime, getZeroTime()); + return szCheckRecordMapper.selectCount(wp) > 0; + } }