|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.huimv.common.utils.Result;
|
|
import com.huimv.common.utils.Result;
|
|
import com.huimv.common.utils.ResultCode;
|
|
import com.huimv.common.utils.ResultCode;
|
|
import com.huimv.common.utils.StringUtilsWork;
|
|
import com.huimv.common.utils.StringUtilsWork;
|
|
|
|
+import com.huimv.produce.dhicc.util.GetResponse;
|
|
import com.huimv.produce.entity.BaseTelecomRoom;
|
|
import com.huimv.produce.entity.BaseTelecomRoom;
|
|
import com.huimv.produce.entity.SysTelecom;
|
|
import com.huimv.produce.entity.SysTelecom;
|
|
import com.huimv.produce.entity.SysTelecomEvent;
|
|
import com.huimv.produce.entity.SysTelecomEvent;
|
|
@@ -23,7 +24,6 @@ import java.util.*;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/telecom")
|
|
@RequestMapping("/telecom")
|
|
-@CrossOrigin
|
|
|
|
public class SysTelecomEventController {
|
|
public class SysTelecomEventController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -34,7 +34,6 @@ public class SysTelecomEventController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ISysTelecomEventService sysTelecomEventService;
|
|
private ISysTelecomEventService sysTelecomEventService;
|
|
-
|
|
|
|
//传入机器编码 返回这个机器下的所有事件 带分页
|
|
//传入机器编码 返回这个机器下的所有事件 带分页
|
|
@GetMapping("/listevent")
|
|
@GetMapping("/listevent")
|
|
public Result list(@RequestParam(name = "deviceId", required = false) String deviceId ,
|
|
public Result list(@RequestParam(name = "deviceId", required = false) String deviceId ,
|
|
@@ -45,14 +44,22 @@ public class SysTelecomEventController {
|
|
@RequestParam(name = "farmId") Integer farmId //分页大小
|
|
@RequestParam(name = "farmId") Integer farmId //分页大小
|
|
|
|
|
|
) throws ParseException {
|
|
) throws ParseException {
|
|
|
|
+ //如果传入的开始时间是默认的今天的 就返回最近三天的 --前端说改起来比较麻烦
|
|
|
|
+
|
|
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ Date date = new Date();
|
|
Date startTime = fmt.parse(startTimeString);
|
|
Date startTime = fmt.parse(startTimeString);
|
|
Date endTime = fmt.parse(endTimeString);
|
|
Date endTime = fmt.parse(endTimeString);
|
|
|
|
+
|
|
|
|
+ long timeGap = date.getTime()-startTime.getTime();
|
|
QueryWrapper<SysTelecomEvent> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysTelecomEvent> wrapper = new QueryWrapper<>();
|
|
wrapper.eq("farm_id", farmId);
|
|
wrapper.eq("farm_id", farmId);
|
|
if(StringUtilsWork.isNotBlank(deviceId)){
|
|
if(StringUtilsWork.isNotBlank(deviceId)){
|
|
wrapper.eq("device_id", deviceId);
|
|
wrapper.eq("device_id", deviceId);
|
|
}
|
|
}
|
|
|
|
+ if (timeGap<1000*60*60*24){
|
|
|
|
+ startTime = new Date(endTime.getTime()-1000*60*60*72);
|
|
|
|
+ }
|
|
wrapper.between("event_time", startTime, endTime);
|
|
wrapper.between("event_time", startTime, endTime);
|
|
wrapper.orderByDesc( "id" );
|
|
wrapper.orderByDesc( "id" );
|
|
Page<SysTelecomEvent> page = sysTelecomEventService.page(new Page< >(current, size), wrapper);
|
|
Page<SysTelecomEvent> page = sysTelecomEventService.page(new Page< >(current, size), wrapper);
|