Forráskód Böngészése

alter date violate

Lloyd 3 év óta
szülő
commit
86c1d7e30b

+ 12 - 0
src/main/java/com/gct/aoid/controller/AoidSinglegtYieldController.java

@@ -12,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
12 12
 import org.springframework.web.bind.annotation.*;
13 13
 
14 14
 import java.text.ParseException;
15
+import java.time.LocalDate;
16
+import java.time.LocalDateTime;
17
+import java.time.format.DateTimeFormatter;
15 18
 import java.util.List;
16 19
 import java.util.Map;
17 20
 
@@ -57,6 +60,15 @@ public class AoidSinglegtYieldController {
57 60
     @ApiOperation(value = "根据井号和日期时间段查询量液的基本信息--分页" ,notes = "根据井号和日期时间段查询量液的基本信息--分页")
58 61
     @PostMapping("/getAoidSinglegtYieldInfoByPages")
59 62
     public Result getAoidSinglegtYieldInfoByWellIdAndPorDatePeriodAndPages(@RequestBody AoidYeildVo aoidYeildVo) throws ParseException {
63
+        String datePattern = "\\d{4}-\\d{1,2}-\\d{1,2}";
64
+        if(aoidYeildVo.getStartDate()==null){
65
+            LocalDate now = LocalDate.now();
66
+            aoidYeildVo.setStartDate(now.format(DateTimeFormatter.ISO_DATE));
67
+            aoidYeildVo.setEndDate(now.plusDays(1).format(DateTimeFormatter.ISO_DATE));
68
+        }
69
+        if (aoidYeildVo.getStartDate()==null||aoidYeildVo.getEndDate()==null ||!aoidYeildVo.getStartDate().matches(datePattern) || !aoidYeildVo.getEndDate().matches(datePattern))
70
+            return Result.error("日期格式有误");
71
+
60 72
         Page<Map<String,Object>> mapPage =  aoidSinglegtYieldService.getAoidSinglegtYieldInfoByWellIdAndPorDatePeriodAndPages(
61 73
                 aoidYeildVo.getWellId(),
62 74
                 aoidYeildVo.getStartDate(),

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -9,7 +9,7 @@ spring:
9 9
         file-extension: yaml #指定yaml格式配置
10 10
         group: DEV_GROUP
11 11
         namespace: b452cf4e-33df-404f-8828-7d654edad9cc
12
-        refresh-enabled: true
12
+        refresh-enabled: false
13 13
   application:
14 14
     name: production-calculation
15 15