Browse Source

feat: 添加当天已巡查接口

master_tdsql
hxh 1 year ago
parent
commit
a8aff82bae
  1. 8
      shuili-system/src/main/java/com/kms/yxgh/df/controller/DfPlanController.java
  2. 14
      shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java
  3. 7
      shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java
  4. 15
      shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java

8
shuili-system/src/main/java/com/kms/yxgh/df/controller/DfPlanController.java

@ -102,4 +102,12 @@ public class DfPlanController {
public Response<List<DfPointDto>> addPoints(@PathVariable("id") String id) { public Response<List<DfPointDto>> addPoints(@PathVariable("id") String id) {
return Response.ok(dfPlanService.getPoints(id)); return Response.ok(dfPlanService.getPoints(id));
} }
//当天已巡查
@ApiOperation("堤防巡视检查计划当天已巡查")
@Log(title = "堤防巡视检查计划当天已巡查", businessType = BusinessType.SEARCH)
@GetMapping("/today/{id}")
public Response<Boolean> today(@PathVariable("id") String id) {
return Response.ok(dfPlanService.today(id));
}
} }

14
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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.List;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -200,5 +203,16 @@ public class DfPlanService extends BaseService<DfPlanMapper, DfPlan> {
return this.getBaseMapper().selectCount(wp) > 0; return this.getBaseMapper().selectCount(wp) > 0;
} }
//获取当天零点时间
private Date getZeroTime() {
return Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant());
}
public Boolean today(String id) {
Wrapper<DfRecord> wp = Wrappers.<DfRecord>lambdaQuery()
.eq(DfRecord::getPlanId, id)
.eq(DfRecord::getCreateTime, getZeroTime());
return dfRecordMapper.selectCount(wp) > 0;
}
} }

7
shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java

@ -96,4 +96,11 @@ public class SzPlanController {
public Response<List<SzPointDto>> addPoints(@PathVariable("id") String id) { public Response<List<SzPointDto>> addPoints(@PathVariable("id") String id) {
return Response.ok(szPlanService.getPoints(id)); return Response.ok(szPlanService.getPoints(id));
} }
//当天已巡查
@ApiOperation("水闸巡视检查计划当天已巡查")
@GetMapping("/today/{id}")
public Response<Boolean> today(@PathVariable("id") String id) {
return Response.ok(szPlanService.today(id));
}
} }

15
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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.List;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -200,4 +203,16 @@ public class SzPlanService extends BaseService<SzPlanMapper, SzPlan> {
.eq(SzPlan::getId, id); .eq(SzPlan::getId, id);
return this.getBaseMapper().selectCount(wp) > 0; return this.getBaseMapper().selectCount(wp) > 0;
} }
//获取当天零点时间
private Date getZeroTime() {
return Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant());
}
public Boolean today(String id) {
Wrapper<SzRecord> wp = Wrappers.<SzRecord>lambdaQuery()
.eq(SzRecord::getPlanId, id)
.eq(SzRecord::getCreateTime, getZeroTime());
return szCheckRecordMapper.selectCount(wp) > 0;
}
} }

Loading…
Cancel
Save