Commit 76257e86 authored by zhangsen's avatar zhangsen

bug修改

parent 7fa26d14
...@@ -139,16 +139,17 @@ public class AnalyseController extends BaseController { ...@@ -139,16 +139,17 @@ public class AnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据") @ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据")
@GetMapping(value = "/getInfluxdbDataByConditon") @GetMapping(value = "/getInfluxdbDataByConditon")
public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){ if (StringUtils.isEmpty(startTime)) {
Date currentDayStartTime = null; Date sevenAgoDayStartTime = null;
try { try {
currentDayStartTime = DateUtils.minDateOfMonth(new Date()); sevenAgoDayStartTime = DateUtils.dateAddDays(new Date(), -7);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
Date currentDayEndTime = DateUtils.getCurrentMonthEndTime(new Date()); startTime = DateUtils.convertDateToString(sevenAgoDayStartTime, DateUtils.DATE_TIME_PATTERN);
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); }
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); if (StringUtils.isEmpty(endTime)) {
endTime = DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN);
} }
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ; return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
} }
...@@ -180,16 +181,17 @@ public class AnalyseController extends BaseController { ...@@ -180,16 +181,17 @@ public class AnalyseController extends BaseController {
} }
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){ if (StringUtils.isEmpty(startTime)) {
Date currentDayStartTime = null; Date sevenAgoDayStartTime = null;
try { try {
currentDayStartTime = DateUtils.minDateOfMonth(new Date()); sevenAgoDayStartTime = DateUtils.dateAddDays(new Date(), -7);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
Date currentDayEndTime = DateUtils.getCurrentMonthEndTime(new Date()); startTime = DateUtils.convertDateToString(sevenAgoDayStartTime, DateUtils.DATE_TIME_PATTERN);
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); }
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); if (StringUtils.isEmpty(endTime)) {
endTime = DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN);
} }
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ; return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment