parent
389f796970
commit
6fc86145ca
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
@ -15,7 +15,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinDisposeAbilityInfo {
|
||||
public class CmhiDisposeAbilityInfo {
|
||||
/**
|
||||
* The Type.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinDisposeAbilityRsp extends PengXinBaseResp {
|
||||
public class CmhiDisposeAbilityRsp extends CmhiDisposeBaseResp {
|
||||
/**
|
||||
* The Device name.
|
||||
*/
|
||||
|
@ -27,5 +27,5 @@ public class PengXinDisposeAbilityRsp extends PengXinBaseResp {
|
|||
/**
|
||||
* The Capacity.
|
||||
*/
|
||||
List<PengXinDisposeAbilityInfo> capacity;
|
||||
List<CmhiDisposeAbilityInfo> capacity;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PengXinBaseResp {
|
||||
public class CmhiDisposeBaseResp {
|
||||
/**
|
||||
* The Status.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PengXinLoginReq {
|
||||
public class CmhiDisposeLoginReq {
|
||||
/**
|
||||
* The User name.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinLoginRsp extends PengXinBaseResp {
|
||||
public class CmhiDisposeLoginRsp extends CmhiDisposeBaseResp {
|
||||
/**
|
||||
* The User name.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PengXinStartTaskItem {
|
||||
public class CmhiDisposeStartTaskItem {
|
||||
/**
|
||||
* The Task req id.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -16,9 +16,9 @@ import java.util.List;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PengXinStartTaskReq {
|
||||
public class CmhiDisposeStartTaskReq {
|
||||
/**
|
||||
* The Items.
|
||||
*/
|
||||
List<PengXinStartTaskItem> items;
|
||||
List<CmhiDisposeStartTaskItem> items;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinStartTaskRsp {
|
||||
public class CmhiDisposeStartTaskRsp {
|
||||
/**
|
||||
* The Device name.
|
||||
*/
|
||||
|
@ -25,5 +25,5 @@ public class PengXinStartTaskRsp {
|
|||
/**
|
||||
* The Items.
|
||||
*/
|
||||
List<PengXinStartedItem> items;
|
||||
List<CmhiDisposeStartedItem> items;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinStartedItem extends PengXinBaseResp {
|
||||
public class CmhiDisposeStartedItem extends CmhiDisposeBaseResp {
|
||||
/**
|
||||
* The Task req id.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PengXinStopTaskReq {
|
||||
public class CmhiDisposeStopTaskReq {
|
||||
/**
|
||||
* The Task id.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinStopTaskRsp {
|
||||
public class CmhiDisposeStopTaskRsp {
|
||||
/**
|
||||
* The Device name.
|
||||
*/
|
||||
|
@ -24,5 +24,5 @@ public class PengXinStopTaskRsp {
|
|||
/**
|
||||
* The Items.
|
||||
*/
|
||||
private List<PengXinStoppedItem> items;
|
||||
private List<CmhiDisposeStoppedItem> items;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinStoppedItem extends PengXinBaseResp {
|
||||
public class CmhiDisposeStoppedItem extends CmhiDisposeBaseResp {
|
||||
/**
|
||||
* The Task id.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.dispose.common.BaseEnum;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import com.dispose.common.BaseEnum;
|
|||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public enum PengXinTaskStatus implements BaseEnum {
|
||||
public enum CmhiDisposeTaskStatus implements BaseEnum {
|
||||
/**
|
||||
* The Task starting.
|
||||
*/
|
||||
|
@ -69,7 +69,7 @@ public enum PengXinTaskStatus implements BaseEnum {
|
|||
* @param code the code
|
||||
* @param readme the readme
|
||||
*/
|
||||
PengXinTaskStatus(int code, String readme) {
|
||||
CmhiDisposeTaskStatus(int code, String readme) {
|
||||
this.code = code;
|
||||
this.readme = readme;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinTaskStatusItem extends PengXinBaseResp {
|
||||
public class CmhiDisposeTaskStatusItem extends CmhiDisposeBaseResp {
|
||||
/**
|
||||
* The Task id.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.pengxin.dispose.common;
|
||||
package com.cmhi.dispose.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PengXinTaskStatusRsp {
|
||||
public class CmhiDisposeTaskStatusRsp {
|
||||
|
||||
/**
|
||||
* The Device name.
|
||||
|
@ -26,5 +26,5 @@ public class PengXinTaskStatusRsp {
|
|||
/**
|
||||
* The Items.
|
||||
*/
|
||||
private List<PengXinTaskStatusItem> items;
|
||||
private List<CmhiDisposeTaskStatusItem> items;
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
package com.pengxin.dispose.protocol;
|
||||
package com.cmhi.dispose.protocol;
|
||||
|
||||
import com.cmhi.dispose.common.CmhiDisposeAbilityRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeBaseResp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeLoginReq;
|
||||
import com.cmhi.dispose.common.CmhiDisposeLoginRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskItem;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskReq;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStopTaskReq;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStopTaskRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeTaskStatusRsp;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.pojo.dto.protocol.base.BaseProtocolDTO;
|
||||
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
||||
import com.dispose.restful.RestfulInterface;
|
||||
import com.pengxin.dispose.common.PengXinBaseResp;
|
||||
import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
|
||||
import com.pengxin.dispose.common.PengXinLoginReq;
|
||||
import com.pengxin.dispose.common.PengXinLoginRsp;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskReq;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskRsp;
|
||||
import com.pengxin.dispose.common.PengXinStopTaskReq;
|
||||
import com.pengxin.dispose.common.PengXinStopTaskRsp;
|
||||
import com.pengxin.dispose.common.PengXinTaskStatusRsp;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class PengXinInterface {
|
||||
public class CmhiDisposeInterface {
|
||||
/**
|
||||
* The Ver.
|
||||
*/
|
||||
|
@ -53,11 +53,11 @@ public class PengXinInterface {
|
|||
* @param password the password
|
||||
* @return the protocol resp dto
|
||||
*/
|
||||
public ProtocolRespDTO<PengXinLoginRsp> login(String baseUrlPath, String username, String password) {
|
||||
public ProtocolRespDTO<CmhiDisposeLoginRsp> login(String baseUrlPath, String username, String password) {
|
||||
|
||||
BaseProtocolDTO<PengXinLoginReq> reqInfo = new BaseProtocolDTO<>();
|
||||
BaseProtocolDTO<CmhiDisposeLoginReq> reqInfo = new BaseProtocolDTO<>();
|
||||
|
||||
reqInfo.setMsgContent(PengXinLoginReq.builder()
|
||||
reqInfo.setMsgContent(CmhiDisposeLoginReq.builder()
|
||||
.userName(username)
|
||||
.password(password)
|
||||
.build());
|
||||
|
@ -69,7 +69,7 @@ public class PengXinInterface {
|
|||
return RestfulInterface.baseProRun(baseUrlPath,
|
||||
null,
|
||||
reqInfo,
|
||||
PengXinLoginRsp.class,
|
||||
CmhiDisposeLoginRsp.class,
|
||||
RequestMethod.POST);
|
||||
}
|
||||
|
||||
|
@ -81,10 +81,10 @@ public class PengXinInterface {
|
|||
* @return the link status
|
||||
*/
|
||||
public ErrorCode getLinkStatus(String baseUrlPath, String token) {
|
||||
ProtocolRespDTO<PengXinBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath,
|
||||
ProtocolRespDTO<CmhiDisposeBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath,
|
||||
token,
|
||||
null,
|
||||
PengXinBaseResp.class,
|
||||
CmhiDisposeBaseResp.class,
|
||||
RequestMethod.GET);
|
||||
if (rspInfo != null && rspInfo.getMsgContent() != null) {
|
||||
if (rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) {
|
||||
|
@ -109,10 +109,10 @@ public class PengXinInterface {
|
|||
* @param items the items
|
||||
* @return the protocol resp dto
|
||||
*/
|
||||
public ProtocolRespDTO<PengXinStartTaskRsp> startDisposeTask(String baseUrlPath, String token,
|
||||
List<PengXinStartTaskItem> items) {
|
||||
BaseProtocolDTO<PengXinStartTaskReq> reqInfo = new BaseProtocolDTO<>();
|
||||
reqInfo.setMsgContent(new PengXinStartTaskReq());
|
||||
public ProtocolRespDTO<CmhiDisposeStartTaskRsp> startDisposeTask(String baseUrlPath, String token,
|
||||
List<CmhiDisposeStartTaskItem> items) {
|
||||
BaseProtocolDTO<CmhiDisposeStartTaskReq> reqInfo = new BaseProtocolDTO<>();
|
||||
reqInfo.setMsgContent(new CmhiDisposeStartTaskReq());
|
||||
|
||||
reqInfo.getMsgContent().setItems(items);
|
||||
reqInfo.setCryptoType(this.cryptoType);
|
||||
|
@ -122,7 +122,7 @@ public class PengXinInterface {
|
|||
return RestfulInterface.baseProRun(baseUrlPath,
|
||||
token,
|
||||
reqInfo,
|
||||
PengXinStartTaskRsp.class,
|
||||
CmhiDisposeStartTaskRsp.class,
|
||||
RequestMethod.POST);
|
||||
}
|
||||
|
||||
|
@ -134,10 +134,10 @@ public class PengXinInterface {
|
|||
* @param taskId the task id
|
||||
* @return the protocol resp dto
|
||||
*/
|
||||
public ProtocolRespDTO<PengXinStopTaskRsp> stopDisposeTask(String baseUrlPath, String token, String[] taskId) {
|
||||
BaseProtocolDTO<PengXinStopTaskReq> reqInfo = new BaseProtocolDTO<>();
|
||||
public ProtocolRespDTO<CmhiDisposeStopTaskRsp> stopDisposeTask(String baseUrlPath, String token, String[] taskId) {
|
||||
BaseProtocolDTO<CmhiDisposeStopTaskReq> reqInfo = new BaseProtocolDTO<>();
|
||||
|
||||
reqInfo.setMsgContent(new PengXinStopTaskReq());
|
||||
reqInfo.setMsgContent(new CmhiDisposeStopTaskReq());
|
||||
|
||||
reqInfo.getMsgContent().setTaskId(taskId);
|
||||
reqInfo.setCryptoType(this.cryptoType);
|
||||
|
@ -147,7 +147,7 @@ public class PengXinInterface {
|
|||
return RestfulInterface.baseProRun(baseUrlPath,
|
||||
token,
|
||||
reqInfo,
|
||||
PengXinStopTaskRsp.class,
|
||||
CmhiDisposeStopTaskRsp.class,
|
||||
RequestMethod.POST);
|
||||
}
|
||||
|
||||
|
@ -158,11 +158,11 @@ public class PengXinInterface {
|
|||
* @param token the token
|
||||
* @return the device dispose ability
|
||||
*/
|
||||
public ProtocolRespDTO<PengXinDisposeAbilityRsp> getDeviceDisposeAbility(String baseUrlPath, String token) {
|
||||
public ProtocolRespDTO<CmhiDisposeAbilityRsp> getDeviceDisposeAbility(String baseUrlPath, String token) {
|
||||
return RestfulInterface.baseProRun(baseUrlPath,
|
||||
token,
|
||||
null,
|
||||
PengXinDisposeAbilityRsp.class,
|
||||
CmhiDisposeAbilityRsp.class,
|
||||
RequestMethod.GET);
|
||||
}
|
||||
|
||||
|
@ -174,10 +174,10 @@ public class PengXinInterface {
|
|||
* @param taskId the task id
|
||||
* @return the device task status
|
||||
*/
|
||||
public ProtocolRespDTO<PengXinTaskStatusRsp> getDeviceTaskStatus(String baseUrlPath, String token, String[] taskId) {
|
||||
BaseProtocolDTO<PengXinStopTaskReq> reqInfo = new BaseProtocolDTO<>();
|
||||
public ProtocolRespDTO<CmhiDisposeTaskStatusRsp> getDeviceTaskStatus(String baseUrlPath, String token, String[] taskId) {
|
||||
BaseProtocolDTO<CmhiDisposeStopTaskReq> reqInfo = new BaseProtocolDTO<>();
|
||||
|
||||
reqInfo.setMsgContent(new PengXinStopTaskReq());
|
||||
reqInfo.setMsgContent(new CmhiDisposeStopTaskReq());
|
||||
|
||||
reqInfo.getMsgContent().setTaskId(taskId);
|
||||
reqInfo.setCryptoType(this.cryptoType);
|
||||
|
@ -187,7 +187,7 @@ public class PengXinInterface {
|
|||
return RestfulInterface.baseProRun(baseUrlPath,
|
||||
token,
|
||||
reqInfo,
|
||||
PengXinTaskStatusRsp.class,
|
||||
CmhiDisposeTaskStatusRsp.class,
|
||||
RequestMethod.POST);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,12 @@
|
|||
package com.dispose.ability.impl;
|
||||
|
||||
import com.cmhi.dispose.common.CmhiDisposeAbilityRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeLoginRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskItem;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStopTaskRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeTaskStatusRsp;
|
||||
import com.cmhi.dispose.protocol.CmhiDisposeInterface;
|
||||
import com.dispose.ability.DisposeAbility;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.DisposeConfigValue;
|
||||
|
@ -12,13 +19,6 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
|||
import com.dispose.pojo.entity.ServiceInfo;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||
import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
|
||||
import com.pengxin.dispose.common.PengXinLoginRsp;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskRsp;
|
||||
import com.pengxin.dispose.common.PengXinStopTaskRsp;
|
||||
import com.pengxin.dispose.common.PengXinTaskStatusRsp;
|
||||
import com.pengxin.dispose.protocol.PengXinInterface;
|
||||
import inet.ipaddr.IPAddress;
|
||||
import inet.ipaddr.IPAddressString;
|
||||
import lombok.Getter;
|
||||
|
@ -48,7 +48,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
/**
|
||||
* The Restful interface.
|
||||
*/
|
||||
private final PengXinInterface restfulInterface = new PengXinInterface();
|
||||
private final CmhiDisposeInterface restfulInterface = new CmhiDisposeInterface();
|
||||
/**
|
||||
* The Peng xin dispose type.
|
||||
*/
|
||||
|
@ -150,7 +150,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable Integer attackType,
|
||||
@Nullable Long duration) {
|
||||
List<PengXinStartTaskItem> reqItems = new ArrayList<>();
|
||||
List<CmhiDisposeStartTaskItem> reqItems = new ArrayList<>();
|
||||
|
||||
String url = urlRootPath + "dispose_device/task/start";
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
duration = -1L;
|
||||
}
|
||||
|
||||
reqItems.add(PengXinStartTaskItem.builder()
|
||||
reqItems.add(CmhiDisposeStartTaskItem.builder()
|
||||
.type(getPengXinTaskType(capType))
|
||||
.disposeObject(disposeObject)
|
||||
.objectType(getPengXinObjectType(objectType))
|
||||
|
@ -179,7 +179,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
.taskReqId(String.valueOf(taskReqId++))
|
||||
.build());
|
||||
|
||||
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
|
||||
ProtocolRespDTO<CmhiDisposeStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
|
||||
|
||||
// 判断是否token过期
|
||||
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
|
||||
|
@ -244,7 +244,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
return new MulReturnType<>(ErrorCode.ERR_PARAMS, null);
|
||||
}
|
||||
|
||||
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
|
||||
ProtocolRespDTO<CmhiDisposeStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
|
||||
new String[]{taskId});
|
||||
|
||||
// 判断是否token过期
|
||||
|
@ -365,7 +365,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
try {
|
||||
String url = urlRootPath + "dispose_device/information/capacity";
|
||||
|
||||
ProtocolRespDTO<PengXinDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token);
|
||||
ProtocolRespDTO<CmhiDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token);
|
||||
|
||||
// 判断是否token过期
|
||||
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getStatus())) {
|
||||
|
@ -458,7 +458,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
try {
|
||||
String url = urlRootPath + "dispose_device/task/get";
|
||||
|
||||
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
|
||||
ProtocolRespDTO<CmhiDisposeTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
|
||||
new String[]{taskId});
|
||||
|
||||
// 判断是否token过期
|
||||
|
@ -489,7 +489,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
|||
private void upgradeToken() {
|
||||
try {
|
||||
String url = urlRootPath + "dispose_device/auth/login";
|
||||
ProtocolRespDTO<PengXinLoginRsp> logInfo = restfulInterface.login(url, username, password);
|
||||
ProtocolRespDTO<CmhiDisposeLoginRsp> logInfo = restfulInterface.login(url, username, password);
|
||||
|
||||
if (logInfo != null && logInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
|
||||
this.token = logInfo.getMsgContent().getToken();
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
package com.dispose.ability.impl;
|
||||
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskItem;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStartTaskRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeStopTaskRsp;
|
||||
import com.cmhi.dispose.common.CmhiDisposeTaskStatusRsp;
|
||||
import com.cmhi.dispose.protocol.CmhiDisposeInterface;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.DisposeObjectType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
|
@ -8,11 +13,6 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
|||
import com.dispose.pojo.entity.ServiceInfo;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
||||
import com.pengxin.dispose.common.PengXinStartTaskRsp;
|
||||
import com.pengxin.dispose.common.PengXinStopTaskRsp;
|
||||
import com.pengxin.dispose.common.PengXinTaskStatusRsp;
|
||||
import com.pengxin.dispose.protocol.PengXinInterface;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -32,7 +32,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
|||
/**
|
||||
* The Restful interface.
|
||||
*/
|
||||
private final PengXinInterface restfulInterface = new PengXinInterface();
|
||||
private final CmhiDisposeInterface restfulInterface = new CmhiDisposeInterface();
|
||||
/**
|
||||
* The upf dispose type.
|
||||
*/
|
||||
|
@ -125,7 +125,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
|||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable Integer attackType,
|
||||
@Nullable Long duration) {
|
||||
List<PengXinStartTaskItem> reqItems = new ArrayList<>();
|
||||
List<CmhiDisposeStartTaskItem> reqItems = new ArrayList<>();
|
||||
String url = urlRootPath + "dispose_device/task/start";
|
||||
//1.调用upf设备登录接口,生成token值;2.upf不提供登录接口,随机生成token值,保证有token值
|
||||
if (token == null || token.length() == 0) {
|
||||
|
@ -142,7 +142,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
|||
// 适配处置时间参数, -1为不限制处置时间
|
||||
duration = -1L;
|
||||
|
||||
reqItems.add(PengXinStartTaskItem.builder()
|
||||
reqItems.add(CmhiDisposeStartTaskItem.builder()
|
||||
.type(getUpfTaskType(capType))
|
||||
.disposeObject(disposeObject)
|
||||
.objectType(getUpfObjectType(objectType))
|
||||
|
@ -150,7 +150,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
|||
.taskReqId(String.valueOf(taskReqId++))
|
||||
.build());
|
||||
|
||||
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
|
||||
ProtocolRespDTO<CmhiDisposeStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
|
||||
|
||||
// upf设备不判断header认证消息中的token值
|
||||
if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) {
|
||||
|
@ -209,7 +209,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
|||
return new MulReturnType<>(ErrorCode.ERR_PARAMS, null);
|
||||
}
|
||||
|
||||
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
|
||||
ProtocolRespDTO<CmhiDisposeStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
|
||||
new String[]{taskId});
|
||||
|
||||
if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) {
|
||||
|
@ -315,7 +315,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
|||
|
||||
try {
|
||||
String url = urlRootPath + "dispose_device/task/get";
|
||||
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
|
||||
ProtocolRespDTO<CmhiDisposeTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
|
||||
new String[]{taskId});
|
||||
|
||||
if (rspInfo != null && rspInfo.getCode() == ErrorCode.ERR_OK.getHttpCode()) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public enum DisposeDeviceType implements BaseEnum {
|
|||
/**
|
||||
* The Pengxin platform.
|
||||
*/
|
||||
PENGXIN_PLATFORM(2, "鹏信处置设备"),
|
||||
CMHI_PLATFORM(2, "集团一键处置设备"),
|
||||
/**
|
||||
* The Huawei platform.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dispose.service.impl;
|
||||
|
||||
import com.cmhi.dispose.common.CmhiDisposeTaskStatus;
|
||||
import com.dispose.common.DisposeConfigValue;
|
||||
import com.dispose.common.DisposeDeviceType;
|
||||
import com.dispose.common.DisposeObjectType;
|
||||
|
@ -18,7 +19,6 @@ import com.dispose.pojo.po.AbilityInfo;
|
|||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.service.DeviceTaskManagerService;
|
||||
import com.dispose.service.DisposeAbilityRouterService;
|
||||
import com.pengxin.dispose.common.PengXinTaskStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
@ -416,7 +416,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
|
||||
//任务出错,设备任务状态为启动处置任务失败
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
|
||||
(long) PengXinTaskStatus.TASK_STARTED_FAILED.getValue());
|
||||
(long) CmhiDisposeTaskStatus.TASK_STARTED_FAILED.getValue());
|
||||
|
||||
// 记录任务出错重试次数
|
||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
||||
|
@ -583,8 +583,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
virtualDeviceTaskRun(ai, v, task);
|
||||
break;
|
||||
|
||||
case PENGXIN_PLATFORM:
|
||||
restfulDeviceTaskRun(ai, v, task, DisposeDeviceType.PENGXIN_PLATFORM);
|
||||
case CMHI_PLATFORM:
|
||||
restfulDeviceTaskRun(ai, v, task, DisposeDeviceType.CMHI_PLATFORM);
|
||||
break;
|
||||
|
||||
case HUAWEI_PLATFORM:
|
||||
|
@ -668,8 +668,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
virtualDeviceTaskStop(ai, v, task);
|
||||
break;
|
||||
|
||||
case PENGXIN_PLATFORM:
|
||||
restfulDeviceTaskStop(ai, v, task, DisposeDeviceType.PENGXIN_PLATFORM);
|
||||
case CMHI_PLATFORM:
|
||||
restfulDeviceTaskStop(ai, v, task, DisposeDeviceType.CMHI_PLATFORM);
|
||||
break;
|
||||
|
||||
case HUAWEI_PLATFORM:
|
||||
|
|
|
@ -166,7 +166,7 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
|
|||
case HAOHAN_PLATFORM:
|
||||
db = new HaoHanAbilityImpl();
|
||||
break;
|
||||
case PENGXIN_PLATFORM:
|
||||
case CMHI_PLATFORM:
|
||||
db = new PengXinAbilityImpl();
|
||||
break;
|
||||
case HUAWEI_PLATFORM:
|
||||
|
|
Loading…
Reference in New Issue