REM:
1. 鹏信设备改名为集团一键处置设备PengXin->Cmhi
This commit is contained in:
HuangXin 2021-10-09 14:59:16 +08:00
parent 389f796970
commit 6fc86145ca
21 changed files with 612 additions and 612 deletions

View File

@ -1,39 +1,39 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin dispose ability info. * The type Peng xin dispose ability info.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinDisposeAbilityInfo { public class CmhiDisposeAbilityInfo {
/** /**
* The Type. * The Type.
*/ */
private Integer type; private Integer type;
/** /**
* The Object type. * The Object type.
*/ */
private Integer objectType; private Integer objectType;
/** /**
* The Ip type. * The Ip type.
*/ */
@JsonProperty("IPType") @JsonProperty("IPType")
private Integer ipType; private Integer ipType;
/** /**
* The Dispose ip. * The Dispose ip.
*/ */
private String disposeIp; private String disposeIp;
} }

View File

@ -1,31 +1,31 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Peng xin dispose ability rsp. * The type Peng xin dispose ability rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinDisposeAbilityRsp extends PengXinBaseResp { public class CmhiDisposeAbilityRsp extends CmhiDisposeBaseResp {
/** /**
* The Device name. * The Device name.
*/ */
private String deviceName; private String deviceName;
/** /**
* The Capacity. * The Capacity.
*/ */
List<PengXinDisposeAbilityInfo> capacity; List<CmhiDisposeAbilityInfo> capacity;
} }

View File

@ -1,24 +1,24 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin base resp. * The type Peng xin base resp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class PengXinBaseResp { public class CmhiDisposeBaseResp {
/** /**
* The Status. * The Status.
*/ */
private Integer status; private Integer status;
/** /**
* The Message. * The Message.
*/ */
private String message; private String message;
} }

View File

@ -1,26 +1,26 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin login req. * The type Peng xin login req.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PengXinLoginReq { public class CmhiDisposeLoginReq {
/** /**
* The User name. * The User name.
*/ */
private String userName; private String userName;
/** /**
* The Password. * The Password.
*/ */
private String password; private String password;
} }

View File

@ -1,38 +1,38 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin login rsp. * The type Peng xin login rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinLoginRsp extends PengXinBaseResp { public class CmhiDisposeLoginRsp extends CmhiDisposeBaseResp {
/** /**
* The User name. * The User name.
*/ */
private String userName; private String userName;
/** /**
* The Token. * The Token.
*/ */
private String token; private String token;
/** /**
* The Log time. * The Log time.
*/ */
private Long logTime; private Long logTime;
/** /**
* The Expire time. * The Expire time.
*/ */
private Long expireTime; private Long expireTime;
} }

View File

@ -1,38 +1,38 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin start task item. * The type Peng xin start task item.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PengXinStartTaskItem { public class CmhiDisposeStartTaskItem {
/** /**
* The Task req id. * The Task req id.
*/ */
private String taskReqId; private String taskReqId;
/** /**
* The Type. * The Type.
*/ */
private Integer type; private Integer type;
/** /**
* The Object type. * The Object type.
*/ */
private Integer objectType; private Integer objectType;
/** /**
* The Dispose object. * The Dispose object.
*/ */
private String disposeObject; private String disposeObject;
/** /**
* The Dispose time. * The Dispose time.
*/ */
private Long disposeTime; private Long disposeTime;
} }

View File

@ -1,24 +1,24 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Peng xin start task req. * The type Peng xin start task req.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PengXinStartTaskReq { public class CmhiDisposeStartTaskReq {
/** /**
* The Items. * The Items.
*/ */
List<PengXinStartTaskItem> items; List<CmhiDisposeStartTaskItem> items;
} }

View File

@ -1,29 +1,29 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Peng xin start task rsp. * The type Peng xin start task rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinStartTaskRsp { public class CmhiDisposeStartTaskRsp {
/** /**
* The Device name. * The Device name.
*/ */
private String deviceName; private String deviceName;
/** /**
* The Items. * The Items.
*/ */
List<PengXinStartedItem> items; List<CmhiDisposeStartedItem> items;
} }

View File

@ -1,34 +1,34 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin started item. * The type Peng xin started item.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinStartedItem extends PengXinBaseResp { public class CmhiDisposeStartedItem extends CmhiDisposeBaseResp {
/** /**
* The Task req id. * The Task req id.
*/ */
private String taskReqId; private String taskReqId;
/** /**
* The Task id. * The Task id.
*/ */
private String taskId; private String taskId;
/** /**
* The Expire time. * The Expire time.
*/ */
private Long expireTime; private Long expireTime;
} }

View File

@ -1,22 +1,22 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin stop task req. * The type Peng xin stop task req.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PengXinStopTaskReq { public class CmhiDisposeStopTaskReq {
/** /**
* The Task id. * The Task id.
*/ */
private String[] taskId; private String[] taskId;
} }

View File

@ -1,28 +1,28 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Peng xin stop task rsp. * The type Peng xin stop task rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinStopTaskRsp { public class CmhiDisposeStopTaskRsp {
/** /**
* The Device name. * The Device name.
*/ */
private String deviceName; private String deviceName;
/** /**
* The Items. * The Items.
*/ */
private List<PengXinStoppedItem> items; private List<CmhiDisposeStoppedItem> items;
} }

View File

@ -1,40 +1,40 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Peng xin stopped item. * The type Peng xin stopped item.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinStoppedItem extends PengXinBaseResp { public class CmhiDisposeStoppedItem extends CmhiDisposeBaseResp {
/** /**
* The Task id. * The Task id.
*/ */
private String taskId; private String taskId;
/** /**
* The Type. * The Type.
*/ */
private Integer type; private Integer type;
/** /**
* The Object type. * The Object type.
*/ */
private Integer objectType; private Integer objectType;
/** /**
* The Dispose object. * The Dispose object.
*/ */
private String disposeObject; private String disposeObject;
/** /**
* The Left time. * The Left time.
*/ */
private Long leftTime; private Long leftTime;
} }

View File

@ -1,4 +1,4 @@
package com.pengxin.dispose.common; package com.cmhi.dispose.common;
import com.dispose.common.BaseEnum; import com.dispose.common.BaseEnum;
@ -7,7 +7,7 @@ import com.dispose.common.BaseEnum;
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
public enum PengXinTaskStatus implements BaseEnum { public enum CmhiDisposeTaskStatus implements BaseEnum {
/** /**
* The Task starting. * The Task starting.
*/ */
@ -69,7 +69,7 @@ public enum PengXinTaskStatus implements BaseEnum {
* @param code the code * @param code the code
* @param readme the readme * @param readme the readme
*/ */
PengXinTaskStatus(int code, String readme) { CmhiDisposeTaskStatus(int code, String readme) {
this.code = code; this.code = code;
this.readme = readme; this.readme = readme;
} }

View File

@ -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.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinTaskStatusItem extends PengXinBaseResp { public class CmhiDisposeTaskStatusItem extends CmhiDisposeBaseResp {
/** /**
* The Task id. * The Task id.
*/ */

View File

@ -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.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -16,7 +16,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class PengXinTaskStatusRsp { public class CmhiDisposeTaskStatusRsp {
/** /**
* The Device name. * The Device name.
@ -26,5 +26,5 @@ public class PengXinTaskStatusRsp {
/** /**
* The Items. * The Items.
*/ */
private List<PengXinTaskStatusItem> items; private List<CmhiDisposeTaskStatusItem> items;
} }

View File

@ -1,193 +1,193 @@
package com.pengxin.dispose.protocol; package com.cmhi.dispose.protocol;
import com.dispose.common.ErrorCode; import com.cmhi.dispose.common.CmhiDisposeAbilityRsp;
import com.dispose.pojo.dto.protocol.base.BaseProtocolDTO; import com.cmhi.dispose.common.CmhiDisposeBaseResp;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; import com.cmhi.dispose.common.CmhiDisposeLoginReq;
import com.dispose.restful.RestfulInterface; import com.cmhi.dispose.common.CmhiDisposeLoginRsp;
import com.pengxin.dispose.common.PengXinBaseResp; import com.cmhi.dispose.common.CmhiDisposeStartTaskItem;
import com.pengxin.dispose.common.PengXinDisposeAbilityRsp; import com.cmhi.dispose.common.CmhiDisposeStartTaskReq;
import com.pengxin.dispose.common.PengXinLoginReq; import com.cmhi.dispose.common.CmhiDisposeStartTaskRsp;
import com.pengxin.dispose.common.PengXinLoginRsp; import com.cmhi.dispose.common.CmhiDisposeStopTaskReq;
import com.pengxin.dispose.common.PengXinStartTaskItem; import com.cmhi.dispose.common.CmhiDisposeStopTaskRsp;
import com.pengxin.dispose.common.PengXinStartTaskReq; import com.cmhi.dispose.common.CmhiDisposeTaskStatusRsp;
import com.pengxin.dispose.common.PengXinStartTaskRsp; import com.dispose.common.ErrorCode;
import com.pengxin.dispose.common.PengXinStopTaskReq; import com.dispose.pojo.dto.protocol.base.BaseProtocolDTO;
import com.pengxin.dispose.common.PengXinStopTaskRsp; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.pengxin.dispose.common.PengXinTaskStatusRsp; import com.dispose.restful.RestfulInterface;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
* The type Peng xin interface. * The type Peng xin interface.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
public class PengXinInterface { public class CmhiDisposeInterface {
/** /**
* The Ver. * The Ver.
*/ */
private int ver; private int ver;
/** /**
* The Crypto type. * The Crypto type.
*/ */
private int cryptoType; private int cryptoType;
/** /**
* Sets params. * Sets params.
* *
* @param ver the ver * @param ver the ver
* @param cryptoType the crypto type * @param cryptoType the crypto type
*/ */
public void setParams(int ver, int cryptoType) { public void setParams(int ver, int cryptoType) {
this.ver = ver; this.ver = ver;
this.cryptoType = cryptoType; this.cryptoType = cryptoType;
} }
/** /**
* Login protocol resp dto. * Login protocol resp dto.
* *
* @param baseUrlPath the base url path * @param baseUrlPath the base url path
* @param username the username * @param username the username
* @param password the password * @param password the password
* @return the protocol resp dto * @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) .userName(username)
.password(password) .password(password)
.build()); .build());
reqInfo.setCryptoType(this.cryptoType); reqInfo.setCryptoType(this.cryptoType);
reqInfo.setVer(this.ver); reqInfo.setVer(this.ver);
reqInfo.setTimeStamp(System.currentTimeMillis()); reqInfo.setTimeStamp(System.currentTimeMillis());
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
null, null,
reqInfo, reqInfo,
PengXinLoginRsp.class, CmhiDisposeLoginRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
/** /**
* Gets link status. * Gets link status.
* *
* @param baseUrlPath the base url path * @param baseUrlPath the base url path
* @param token the token * @param token the token
* @return the link status * @return the link status
*/ */
public ErrorCode getLinkStatus(String baseUrlPath, String token) { public ErrorCode getLinkStatus(String baseUrlPath, String token) {
ProtocolRespDTO<PengXinBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath, ProtocolRespDTO<CmhiDisposeBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath,
token, token,
null, null,
PengXinBaseResp.class, CmhiDisposeBaseResp.class,
RequestMethod.GET); RequestMethod.GET);
if (rspInfo != null && rspInfo.getMsgContent() != null) { if (rspInfo != null && rspInfo.getMsgContent() != null) {
if (rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) { if (rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) {
return ErrorCode.ERR_LOGOUT; return ErrorCode.ERR_LOGOUT;
} else if (rspInfo.getCode() == HttpServletResponse.SC_OK) { } else if (rspInfo.getCode() == HttpServletResponse.SC_OK) {
if(rspInfo.getMsgContent().getStatus() != ErrorCode.ERR_OK.getCode()){ if(rspInfo.getMsgContent().getStatus() != ErrorCode.ERR_OK.getCode()){
return ErrorCode.ERR_LOGOUT; return ErrorCode.ERR_LOGOUT;
} else { } else {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} }
} }
} }
return ErrorCode.ERR_UNKNOWNCMD; return ErrorCode.ERR_UNKNOWNCMD;
} }
/** /**
* Start dispose task protocol resp dto. * Start dispose task protocol resp dto.
* *
* @param baseUrlPath the base url path * @param baseUrlPath the base url path
* @param token the token * @param token the token
* @param items the items * @param items the items
* @return the protocol resp dto * @return the protocol resp dto
*/ */
public ProtocolRespDTO<PengXinStartTaskRsp> startDisposeTask(String baseUrlPath, String token, public ProtocolRespDTO<CmhiDisposeStartTaskRsp> startDisposeTask(String baseUrlPath, String token,
List<PengXinStartTaskItem> items) { List<CmhiDisposeStartTaskItem> items) {
BaseProtocolDTO<PengXinStartTaskReq> reqInfo = new BaseProtocolDTO<>(); BaseProtocolDTO<CmhiDisposeStartTaskReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(new PengXinStartTaskReq()); reqInfo.setMsgContent(new CmhiDisposeStartTaskReq());
reqInfo.getMsgContent().setItems(items); reqInfo.getMsgContent().setItems(items);
reqInfo.setCryptoType(this.cryptoType); reqInfo.setCryptoType(this.cryptoType);
reqInfo.setVer(this.ver); reqInfo.setVer(this.ver);
reqInfo.setTimeStamp(System.currentTimeMillis()); reqInfo.setTimeStamp(System.currentTimeMillis());
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
reqInfo, reqInfo,
PengXinStartTaskRsp.class, CmhiDisposeStartTaskRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
/** /**
* Stop dispose task protocol resp dto. * Stop dispose task protocol resp dto.
* *
* @param baseUrlPath the base url path * @param baseUrlPath the base url path
* @param token the token * @param token the token
* @param taskId the task id * @param taskId the task id
* @return the protocol resp dto * @return the protocol resp dto
*/ */
public ProtocolRespDTO<PengXinStopTaskRsp> stopDisposeTask(String baseUrlPath, String token, String[] taskId) { public ProtocolRespDTO<CmhiDisposeStopTaskRsp> stopDisposeTask(String baseUrlPath, String token, String[] taskId) {
BaseProtocolDTO<PengXinStopTaskReq> reqInfo = new BaseProtocolDTO<>(); BaseProtocolDTO<CmhiDisposeStopTaskReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(new PengXinStopTaskReq()); reqInfo.setMsgContent(new CmhiDisposeStopTaskReq());
reqInfo.getMsgContent().setTaskId(taskId); reqInfo.getMsgContent().setTaskId(taskId);
reqInfo.setCryptoType(this.cryptoType); reqInfo.setCryptoType(this.cryptoType);
reqInfo.setVer(this.ver); reqInfo.setVer(this.ver);
reqInfo.setTimeStamp(System.currentTimeMillis()); reqInfo.setTimeStamp(System.currentTimeMillis());
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
reqInfo, reqInfo,
PengXinStopTaskRsp.class, CmhiDisposeStopTaskRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
/** /**
* Gets device dispose ability. * Gets device dispose ability.
* *
* @param baseUrlPath the base url path * @param baseUrlPath the base url path
* @param token the token * @param token the token
* @return the device dispose ability * @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, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
null, null,
PengXinDisposeAbilityRsp.class, CmhiDisposeAbilityRsp.class,
RequestMethod.GET); RequestMethod.GET);
} }
/** /**
* Gets device task status. * Gets device task status.
* *
* @param baseUrlPath the base url path * @param baseUrlPath the base url path
* @param token the token * @param token the token
* @param taskId the task id * @param taskId the task id
* @return the device task status * @return the device task status
*/ */
public ProtocolRespDTO<PengXinTaskStatusRsp> getDeviceTaskStatus(String baseUrlPath, String token, String[] taskId) { public ProtocolRespDTO<CmhiDisposeTaskStatusRsp> getDeviceTaskStatus(String baseUrlPath, String token, String[] taskId) {
BaseProtocolDTO<PengXinStopTaskReq> reqInfo = new BaseProtocolDTO<>(); BaseProtocolDTO<CmhiDisposeStopTaskReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(new PengXinStopTaskReq()); reqInfo.setMsgContent(new CmhiDisposeStopTaskReq());
reqInfo.getMsgContent().setTaskId(taskId); reqInfo.getMsgContent().setTaskId(taskId);
reqInfo.setCryptoType(this.cryptoType); reqInfo.setCryptoType(this.cryptoType);
reqInfo.setVer(this.ver); reqInfo.setVer(this.ver);
reqInfo.setTimeStamp(System.currentTimeMillis()); reqInfo.setTimeStamp(System.currentTimeMillis());
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
reqInfo, reqInfo,
PengXinTaskStatusRsp.class, CmhiDisposeTaskStatusRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
} }

View File

@ -1,5 +1,12 @@
package com.dispose.ability.impl; 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.ability.DisposeAbility;
import com.dispose.common.DisposeCapacityType; import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue; 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.entity.ServiceInfo;
import com.dispose.pojo.po.MulReturnType; import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo; 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.IPAddress;
import inet.ipaddr.IPAddressString; import inet.ipaddr.IPAddressString;
import lombok.Getter; import lombok.Getter;
@ -48,7 +48,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
/** /**
* The Restful interface. * The Restful interface.
*/ */
private final PengXinInterface restfulInterface = new PengXinInterface(); private final CmhiDisposeInterface restfulInterface = new CmhiDisposeInterface();
/** /**
* The Peng xin dispose type. * The Peng xin dispose type.
*/ */
@ -150,7 +150,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long duration) { @Nullable Long duration) {
List<PengXinStartTaskItem> reqItems = new ArrayList<>(); List<CmhiDisposeStartTaskItem> reqItems = new ArrayList<>();
String url = urlRootPath + "dispose_device/task/start"; String url = urlRootPath + "dispose_device/task/start";
@ -171,7 +171,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
duration = -1L; duration = -1L;
} }
reqItems.add(PengXinStartTaskItem.builder() reqItems.add(CmhiDisposeStartTaskItem.builder()
.type(getPengXinTaskType(capType)) .type(getPengXinTaskType(capType))
.disposeObject(disposeObject) .disposeObject(disposeObject)
.objectType(getPengXinObjectType(objectType)) .objectType(getPengXinObjectType(objectType))
@ -179,7 +179,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
.taskReqId(String.valueOf(taskReqId++)) .taskReqId(String.valueOf(taskReqId++))
.build()); .build());
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems); ProtocolRespDTO<CmhiDisposeStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) { if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -244,8 +244,8 @@ public class PengXinAbilityImpl implements DisposeAbility {
return new MulReturnType<>(ErrorCode.ERR_PARAMS, null); return new MulReturnType<>(ErrorCode.ERR_PARAMS, null);
} }
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token, ProtocolRespDTO<CmhiDisposeStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
new String[]{taskId}); new String[]{taskId});
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) { if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -365,7 +365,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
try { try {
String url = urlRootPath + "dispose_device/information/capacity"; String url = urlRootPath + "dispose_device/information/capacity";
ProtocolRespDTO<PengXinDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token); ProtocolRespDTO<CmhiDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token);
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getStatus())) { if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getStatus())) {
@ -458,8 +458,8 @@ public class PengXinAbilityImpl implements DisposeAbility {
try { try {
String url = urlRootPath + "dispose_device/task/get"; String url = urlRootPath + "dispose_device/task/get";
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token, ProtocolRespDTO<CmhiDisposeTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
new String[]{taskId}); new String[]{taskId});
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) { if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -489,7 +489,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
private void upgradeToken() { private void upgradeToken() {
try { try {
String url = urlRootPath + "dispose_device/auth/login"; 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()) { if (logInfo != null && logInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
this.token = logInfo.getMsgContent().getToken(); this.token = logInfo.getMsgContent().getToken();

View File

@ -1,5 +1,10 @@
package com.dispose.ability.impl; 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.DisposeCapacityType;
import com.dispose.common.DisposeObjectType; import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode; 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.entity.ServiceInfo;
import com.dispose.pojo.po.MulReturnType; import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo; 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.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -32,7 +32,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
/** /**
* The Restful interface. * The Restful interface.
*/ */
private final PengXinInterface restfulInterface = new PengXinInterface(); private final CmhiDisposeInterface restfulInterface = new CmhiDisposeInterface();
/** /**
* The upf dispose type. * The upf dispose type.
*/ */
@ -125,7 +125,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long duration) { @Nullable Long duration) {
List<PengXinStartTaskItem> reqItems = new ArrayList<>(); List<CmhiDisposeStartTaskItem> reqItems = new ArrayList<>();
String url = urlRootPath + "dispose_device/task/start"; String url = urlRootPath + "dispose_device/task/start";
//1.调用upf设备登录接口生成token值2.upf不提供登录接口随机生成token值保证有token值 //1.调用upf设备登录接口生成token值2.upf不提供登录接口随机生成token值保证有token值
if (token == null || token.length() == 0) { if (token == null || token.length() == 0) {
@ -142,7 +142,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
// 适配处置时间参数 -1为不限制处置时间 // 适配处置时间参数 -1为不限制处置时间
duration = -1L; duration = -1L;
reqItems.add(PengXinStartTaskItem.builder() reqItems.add(CmhiDisposeStartTaskItem.builder()
.type(getUpfTaskType(capType)) .type(getUpfTaskType(capType))
.disposeObject(disposeObject) .disposeObject(disposeObject)
.objectType(getUpfObjectType(objectType)) .objectType(getUpfObjectType(objectType))
@ -150,7 +150,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
.taskReqId(String.valueOf(taskReqId++)) .taskReqId(String.valueOf(taskReqId++))
.build()); .build());
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems); ProtocolRespDTO<CmhiDisposeStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
// upf设备不判断header认证消息中的token值 // upf设备不判断header认证消息中的token值
if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) { if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) {
@ -209,8 +209,8 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
return new MulReturnType<>(ErrorCode.ERR_PARAMS, null); return new MulReturnType<>(ErrorCode.ERR_PARAMS, null);
} }
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token, ProtocolRespDTO<CmhiDisposeStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
new String[]{taskId}); new String[]{taskId});
if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) { if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) {
log.error("----Error UPF stop task{} server return error", taskId); log.error("----Error UPF stop task{} server return error", taskId);
@ -315,8 +315,8 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
try { try {
String url = urlRootPath + "dispose_device/task/get"; String url = urlRootPath + "dispose_device/task/get";
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token, ProtocolRespDTO<CmhiDisposeTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
new String[]{taskId}); new String[]{taskId});
if (rspInfo != null && rspInfo.getCode() == ErrorCode.ERR_OK.getHttpCode()) { if (rspInfo != null && rspInfo.getCode() == ErrorCode.ERR_OK.getHttpCode()) {
int errCode = rspInfo.getMsgContent().getItems().get(0).getStatus(); int errCode = rspInfo.getMsgContent().getItems().get(0).getStatus();

View File

@ -17,7 +17,7 @@ public enum DisposeDeviceType implements BaseEnum {
/** /**
* The Pengxin platform. * The Pengxin platform.
*/ */
PENGXIN_PLATFORM(2, "鹏信处置设备"), CMHI_PLATFORM(2, "集团一键处置设备"),
/** /**
* The Huawei platform. * The Huawei platform.
*/ */

View File

@ -1,5 +1,6 @@
package com.dispose.service.impl; package com.dispose.service.impl;
import com.cmhi.dispose.common.CmhiDisposeTaskStatus;
import com.dispose.common.DisposeConfigValue; import com.dispose.common.DisposeConfigValue;
import com.dispose.common.DisposeDeviceType; import com.dispose.common.DisposeDeviceType;
import com.dispose.common.DisposeObjectType; import com.dispose.common.DisposeObjectType;
@ -18,7 +19,6 @@ import com.dispose.pojo.po.AbilityInfo;
import com.dispose.pojo.po.MulReturnType; import com.dispose.pojo.po.MulReturnType;
import com.dispose.service.DeviceTaskManagerService; import com.dispose.service.DeviceTaskManagerService;
import com.dispose.service.DisposeAbilityRouterService; import com.dispose.service.DisposeAbilityRouterService;
import com.pengxin.dispose.common.PengXinTaskStatus;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
@ -416,7 +416,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
//任务出错设备任务状态为启动处置任务失败 //任务出错设备任务状态为启动处置任务失败
deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(), deviceTaskManager.changeDisposeDeviceTaskInfoDevStatus(deviceTask.getId(),
(long) PengXinTaskStatus.TASK_STARTED_FAILED.getValue()); (long) CmhiDisposeTaskStatus.TASK_STARTED_FAILED.getValue());
// 记录任务出错重试次数 // 记录任务出错重试次数
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0); deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
@ -583,8 +583,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
virtualDeviceTaskRun(ai, v, task); virtualDeviceTaskRun(ai, v, task);
break; break;
case PENGXIN_PLATFORM: case CMHI_PLATFORM:
restfulDeviceTaskRun(ai, v, task, DisposeDeviceType.PENGXIN_PLATFORM); restfulDeviceTaskRun(ai, v, task, DisposeDeviceType.CMHI_PLATFORM);
break; break;
case HUAWEI_PLATFORM: case HUAWEI_PLATFORM:
@ -668,8 +668,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
virtualDeviceTaskStop(ai, v, task); virtualDeviceTaskStop(ai, v, task);
break; break;
case PENGXIN_PLATFORM: case CMHI_PLATFORM:
restfulDeviceTaskStop(ai, v, task, DisposeDeviceType.PENGXIN_PLATFORM); restfulDeviceTaskStop(ai, v, task, DisposeDeviceType.CMHI_PLATFORM);
break; break;
case HUAWEI_PLATFORM: case HUAWEI_PLATFORM:

View File

@ -166,7 +166,7 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
case HAOHAN_PLATFORM: case HAOHAN_PLATFORM:
db = new HaoHanAbilityImpl(); db = new HaoHanAbilityImpl();
break; break;
case PENGXIN_PLATFORM: case CMHI_PLATFORM:
db = new PengXinAbilityImpl(); db = new PengXinAbilityImpl();
break; break;
case HUAWEI_PLATFORM: case HUAWEI_PLATFORM: