diff --git a/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobHelpProcessor.java b/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobHelpProcessor.java index 034928ca..8dbee73a 100644 --- a/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobHelpProcessor.java +++ b/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobHelpProcessor.java @@ -41,7 +41,7 @@ public void handle(ProcessContext context) { // list telecom nb-iot devices sb.append(ColorUtils.cyanAnnotation("list: " + bundle.getString("nb.operation.list.desc"))) .append(StringUtils.lineSeparator()); - sb.append(" usage: list pageNo searchValue").append(StringUtils.lineSeparator()); + sb.append(" usage: list searchValue pageNo").append(StringUtils.lineSeparator()); sb.append(StringUtils.lineSeparator()); // get telecom nb-iot device detail info diff --git a/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobListDeviceProcessor.java b/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobListDeviceProcessor.java index 8fb0a73d..99681fa8 100644 --- a/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobListDeviceProcessor.java +++ b/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/mobile/MobListDeviceProcessor.java @@ -20,6 +20,7 @@ import com.github.freva.asciitable.HorizontalAlign; import com.github.freva.asciitable.OverflowBehaviour; import iot.technology.client.toolkit.common.rule.ProcessContext; +import iot.technology.client.toolkit.common.rule.TkAbstractProcessor; import iot.technology.client.toolkit.common.rule.TkProcessor; import iot.technology.client.toolkit.common.utils.ColorUtils; import iot.technology.client.toolkit.nb.service.mobile.MobileDeviceService; @@ -33,9 +34,18 @@ import java.util.List; /** + * usage: + *
+ * 1、list: print first page device list + *
+ * 2、list pageNo: print pageNo device list + *
+ * 3、list searchValue pageNo: print searchValue pageNo device list + *
+ *
* @author mushuwei
*/
-public class MobListDeviceProcessor implements TkProcessor {
+public class MobListDeviceProcessor extends TkAbstractProcessor implements TkProcessor {
private final MobileDeviceService mobileDeviceService = new MobileDeviceService();
@@ -47,15 +57,29 @@ public boolean supports(ProcessContext context) {
@Override
public void handle(ProcessContext context) {
List
- * 2、list 1
+ * 1、list: print first page device list
+ *
+ * 2、list pageNo: print pageNo device list
+ *
+ * 3、list searchValue pageNo: print searchValue pageNo device list
*
- * 3、list searchValue 1
*
* @author mushuwei
*/
diff --git a/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/telecom/domain/action/device/TelQueryDeviceByImeiResponse.java b/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/telecom/domain/action/device/TelQueryDeviceByImeiResponse.java
index 46a7b950..de828e4d 100644
--- a/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/telecom/domain/action/device/TelQueryDeviceByImeiResponse.java
+++ b/toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/telecom/domain/action/device/TelQueryDeviceByImeiResponse.java
@@ -33,23 +33,29 @@ public class TelQueryDeviceByImeiResponse extends BaseTelResponse {
private TelQueryDeviceByImeiBody result;
public void printToConsole() {
- System.out.format("deviceId: " + ColorUtils.blackBold(result.getDeviceId()) + "%n");
- System.out.format("deviceName: " + ColorUtils.blackBold(result.getDeviceName()) + "%n");
- System.out.format("productId: " + ColorUtils.blackBold(String.valueOf(result.getProductId())) + "%n");
- System.out.format("imei: " + ColorUtils.blackBold(result.getImei()) + "%n");
- System.out.format("deviceStatus: " + ColorUtils.blackBold(TelDeviceStatusEnum.type(result.getDeviceStatus())) + "%n");
- System.out.format(
- "imsi: " + (Objects.nonNull(result.getImsi()) ? ColorUtils.blackBold(String.valueOf(result.getImsi())) : "") + "%n");
- System.out.format("firmwareVersion: " +
- (Objects.nonNull(result.getFirmwareVersion()) ? ColorUtils.blackBold(result.getFirmwareVersion()) : "") + "%n");
- System.out.format("autoObserver: " + ColorUtils.blackBold(TelAutoObserverEnum.type(result.getAutoObserver())) + "%n");
- System.out.format("netStatus: " + ColorUtils.blackBold(TelNetStatusEnum.type(result.getNetStatus())) + "%n");
- System.out.format("onlineAt: " +
- (Objects.nonNull(result.getOnlineAt()) ? ColorUtils.blackBold(DateUtils.timestampToFormatterTime(result.getOnlineAt())) :
- "") + "%n");
- System.out.format("offlineAt: " +
- (Objects.nonNull(result.getOfflineAt()) ? ColorUtils.blackBold(DateUtils.timestampToFormatterTime(result.getOfflineAt())) :
- "") + "%n");
+ if (Objects.nonNull(result)) {
+ System.out.format("deviceId: " + ColorUtils.blackBold(result.getDeviceId()) + "%n");
+ System.out.format("deviceName: " + ColorUtils.blackBold(result.getDeviceName()) + "%n");
+ System.out.format("productId: " + ColorUtils.blackBold(String.valueOf(result.getProductId())) + "%n");
+ System.out.format("imei: " + ColorUtils.blackBold(result.getImei()) + "%n");
+ System.out.format("deviceStatus: " + ColorUtils.blackBold(TelDeviceStatusEnum.type(result.getDeviceStatus())) + "%n");
+ System.out.format(
+ "imsi: " + (Objects.nonNull(result.getImsi()) ? ColorUtils.blackBold(String.valueOf(result.getImsi())) : "") + "%n");
+ System.out.format("firmwareVersion: " +
+ (Objects.nonNull(result.getFirmwareVersion()) ? ColorUtils.blackBold(result.getFirmwareVersion()) : "") + "%n");
+ System.out.format("autoObserver: " + ColorUtils.blackBold(TelAutoObserverEnum.type(result.getAutoObserver())) + "%n");
+ System.out.format("netStatus: " + ColorUtils.blackBold(TelNetStatusEnum.type(result.getNetStatus())) + "%n");
+ System.out.format("onlineAt: " +
+ (Objects.nonNull(result.getOnlineAt()) ? ColorUtils.blackBold(DateUtils.timestampToFormatterTime(result.getOnlineAt())) :
+ "") + "%n");
+ System.out.format("offlineAt: " +
+ (Objects.nonNull(result.getOfflineAt()) ? ColorUtils.blackBold(DateUtils.timestampToFormatterTime(result.getOfflineAt())) :
+ "") + "%n");
+ } else {
+ System.out.println("this product does not have this imei!");
+ }
+
+
}
public TelQueryDeviceByImeiBody getResult() {