REM:
1. 入参如果为数组,其中有字符串则表示获取所有能力节点,同时去重
This commit is contained in:
chenlinghy 2020-05-28 16:40:44 +08:00
parent 367f80979d
commit acda65d8a5
3 changed files with 41 additions and 17 deletions

View File

@ -398,13 +398,6 @@ public class DisposeTaskController {
return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
}
// for (String deviceId : reqInfo.getId()
// ) {
// if (deviceId.length() == 0) {
// return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
// }
// }
List<DisposeDevice> valuableData = disposeNodeManager.getAllDisposeDevice()
.stream()
.filter(v -> reqInfo.getId().length == 0

View File

@ -3,15 +3,22 @@ package com.dispose.pojo.vo.common;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* The type Id array req.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@Data
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ -19,4 +26,32 @@ import lombok.NoArgsConstructor;
public class IDArrayReq {
private String[] id;
private String[] taskId;
public void setId(String[] id) {
List<String> idList = Arrays.asList(id);
if(idList.contains("")) {
this.id = new String[]{""};
} else {
Map<String, Long> ret = idList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
System.out.println(ret);
List<String> keyList = new ArrayList<>(ret.keySet());
this.id = keyList.toArray(new String[0]);
}
}
public void setTaskId(String[] taskId) {
List<String> idList = Arrays.asList(taskId);
if(idList.contains("")) {
this.taskId = new String[]{""};
} else {
Map<String, Long> ret = idList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
System.out.println(ret);
List<String> keyList = new ArrayList<>(ret.keySet());
this.taskId = keyList.toArray(new String[0]);
}
}
}

View File

@ -1,21 +1,17 @@
package com.dispose.pojo.vo.task;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.dispose.pojo.vo.common.IDArrayReq;
import lombok.*;
/**
* The type Get task req.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class GetTaskReq {
private String[] id;
public class GetTaskReq extends IDArrayReq {
private Integer type;
}