Skip to content

Commit

Permalink
🎨 improve telecom del and show subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
sanshengshui committed Nov 17, 2023
1 parent 1090721 commit 521956d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ public boolean supports(ProcessContext context) {
@Override
public void handle(ProcessContext context) {
TelProcessContext telProcessContext = (TelProcessContext) context;
String imeiListString = context.getData().substring(context.getData().indexOf(" ") + 1);
String[] arr = context.getData().split(" ");
if (arr.length < 2) {
StringBuilder sb = new StringBuilder();
sb.append(ColorUtils.redError("imei is required")).append(StringUtils.lineSeparator);
sb.append(ColorUtils.blackBold("detail usage please enter: help del"));
System.out.println(sb);
return;
}
String imeiListString = arr[2];
if (StringUtils.isNotBlank(imeiListString)) {
List<String> imeiList = List.of(imeiListString.split(","));
TelDelDeviceByImeiResponse response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import iot.technology.client.toolkit.common.rule.ProcessContext;
import iot.technology.client.toolkit.common.rule.TkProcessor;
import iot.technology.client.toolkit.common.utils.ColorUtils;
import iot.technology.client.toolkit.common.utils.StringUtils;
import iot.technology.client.toolkit.nb.service.processor.TelProcessContext;
import iot.technology.client.toolkit.nb.service.telecom.TelecomDeviceService;
Expand All @@ -38,7 +39,15 @@ public boolean supports(ProcessContext context) {

@Override
public void handle(ProcessContext context) {
String imei = context.getData().substring(context.getData().indexOf(" ") + 1);
String[] arr = context.getData().split(" ");
if (arr.length < 2) {
StringBuilder sb = new StringBuilder();
sb.append(ColorUtils.redError("imei is required")).append(StringUtils.lineSeparator);
sb.append(ColorUtils.blackBold("detail usage please enter: help show"));
System.out.println(sb);
return;
}
String imei = arr[2];
TelProcessContext telProcessContext = (TelProcessContext) context;
if (StringUtils.isNotBlank(imei)) {
TelQueryDeviceByImeiResponse response =
Expand Down

0 comments on commit 521956d

Please sign in to comment.