|
@@ -13,7 +13,11 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/oldEquipment")
|
|
@RequestMapping("/oldEquipment")
|
|
public class SyncEquipmentController {
|
|
public class SyncEquipmentController {
|
|
@@ -23,6 +27,41 @@ public class SyncEquipmentController {
|
|
this.equipmentService = equipmentService;
|
|
this.equipmentService = equipmentService;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "判断设备是否未脱机")
|
|
|
|
+ @GetMapping("/isOnline")
|
|
|
|
+ public Boolean isOnline(TEquipment equipment) {
|
|
|
|
+ if (Objects.isNull(equipment)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ String clientId = equipment.getClientId();
|
|
|
|
+ boolean endsWith = clientId.endsWith("xxx"); // 区分大小写
|
|
|
|
+// boolean endsWith = clientId.toLowerCase().endsWith("xxx"); // 不区分大小写
|
|
|
|
+// boolean endsWith = clientId.toUpperCase().endsWith("xxx"); // 不区分大小写
|
|
|
|
+ return !endsWith;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "同步未脱机的设备")
|
|
|
|
+ @GetMapping("/getOnline")
|
|
|
|
+ public ResponseModel<List<TEquipment>> getOnline(String equipmentId) {
|
|
|
|
+ if (equipmentId.isEmpty()) {
|
|
|
|
+ return R.fail("equipmentId不能为空");
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<TEquipment> lqw = Wrappers.lambdaQuery();
|
|
|
|
+ lqw.eq(TEquipment::getId, equipmentId);
|
|
|
|
+ List<TEquipment> equipmentList = equipmentService.list(lqw);
|
|
|
|
+ List<TEquipment> tEquipments = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ for (TEquipment equipment : equipmentList) {
|
|
|
|
+ Boolean online = this.isOnline(equipment);
|
|
|
|
+ if (online) {
|
|
|
|
+ // 可以同步
|
|
|
|
+ tEquipments.add(equipment);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return R.ok(tEquipments);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@ApiOperation(value = "获取某一时间段内的 equipment 设备信息")
|
|
@ApiOperation(value = "获取某一时间段内的 equipment 设备信息")
|
|
@GetMapping("/getEquipmentInTime")
|
|
@GetMapping("/getEquipmentInTime")
|
|
public ResponseModel<List<TEquipment>> getEquipmentInTime(String startTime, String endTime) {
|
|
public ResponseModel<List<TEquipment>> getEquipmentInTime(String startTime, String endTime) {
|