REM:
1. 修改亿阳设备为鹏信设备
This commit is contained in:
HuangXin 2020-10-12 10:28:40 +08:00
parent ed9c273be6
commit 393f77e3a5
18 changed files with 133 additions and 134 deletions

View File

@ -10,12 +10,12 @@ import com.dispose.common.NetflowDirection;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
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.yiyang.dispose.common.YiYangDisposeAbilityRsp; import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
import com.yiyang.dispose.common.YiYangLoginRsp; import com.pengxin.dispose.common.PengXinLoginRsp;
import com.yiyang.dispose.common.YiYangStartTaskItem; import com.pengxin.dispose.common.PengXinStartTaskItem;
import com.yiyang.dispose.common.YiYangStartTaskRsp; import com.pengxin.dispose.common.PengXinStartTaskRsp;
import com.yiyang.dispose.common.YiYangStopTaskRsp; import com.pengxin.dispose.common.PengXinStopTaskRsp;
import com.yiyang.dispose.protocol.YiYangInterface; 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;
@ -28,12 +28,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* The type Yi yang ability. * The type Peng xin ability.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Slf4j @Slf4j
public class YiYangAbilityImpl implements DisposeAbility { public class PengXinAbilityImpl implements DisposeAbility {
/** /**
* The Protect ipv4. * The Protect ipv4.
@ -47,7 +47,7 @@ public class YiYangAbilityImpl implements DisposeAbility {
/** /**
* The Restful interface. * The Restful interface.
*/ */
private final YiYangInterface restfulInterface = new YiYangInterface(); private final PengXinInterface restfulInterface = new PengXinInterface();
/** /**
* The Task req id. * The Task req id.
@ -81,27 +81,27 @@ public class YiYangAbilityImpl implements DisposeAbility {
private String token; private String token;
/** /**
* The Yi yang dispose type. * The Peng xin dispose type.
*/ */
private final Integer[] yiYangDisposeType = new Integer[] {0, 4, 1, 3}; private final Integer[] pengXinDisposeType = new Integer[] {0, 4, 1, 3};
/** /**
* Gets yi yang task type. * Gets peng xin task type.
* *
* @param capType the cap type * @param capType the cap type
* @return the yi yang task type * @return the peng xin task type
*/ */
private int getYiYangTaskType(DisposeCapacityType capType) { private int getPengXinTaskType(DisposeCapacityType capType) {
return yiYangDisposeType[capType.getValue()]; return pengXinDisposeType[capType.getValue()];
} }
/** /**
* Gets yi yang object type. * Gets peng xin object type.
* *
* @param objType the obj type * @param objType the obj type
* @return the yi yang object type * @return the peng xin object type
*/ */
private int getYiYangObjectType(DisposeObjectType objType) { private int getPengXinObjectType(DisposeObjectType objType) {
switch (objType) { switch (objType) {
case URL: case URL:
return 2; return 2;
@ -144,7 +144,7 @@ public class YiYangAbilityImpl implements DisposeAbility {
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long duration) { @Nullable Long duration) {
List<YiYangStartTaskItem> reqItems = new ArrayList<>(); List<PengXinStartTaskItem> reqItems = new ArrayList<>();
String url = urlRootPath + "dispose_device/task/start"; String url = urlRootPath + "dispose_device/task/start";
@ -153,10 +153,10 @@ public class YiYangAbilityImpl implements DisposeAbility {
} }
try { try {
log.info("++++Begging YiYang Start Cleanup Task: {}", ip); log.info("++++Begging PengXin Start Cleanup Task: {}", ip);
if (capType != DisposeCapacityType.BLACKHOOL) { if (capType != DisposeCapacityType.BLACKHOOL) {
log.error("----Error YiYang don't support dispose capacity type: {}", capType); log.error("----Error PengXin don't support dispose capacity type: {}", capType);
return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null); return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null);
} }
@ -165,15 +165,15 @@ public class YiYangAbilityImpl implements DisposeAbility {
duration = -1L; duration = -1L;
} }
reqItems.add(YiYangStartTaskItem.builder() reqItems.add(PengXinStartTaskItem.builder()
.type(getYiYangTaskType(capType)) .type(getPengXinTaskType(capType))
.disposeObject(ip) .disposeObject(ip)
.objectType(getYiYangObjectType(DisposeObjectType.IP)) .objectType(getPengXinObjectType(DisposeObjectType.IP))
.disposeTime(duration) .disposeTime(duration)
.taskReqId(String.valueOf(taskReqId++)) .taskReqId(String.valueOf(taskReqId++))
.build()); .build());
ProtocolRespDTO<YiYangStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems); ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) { if (rspInfo != null && rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) {
@ -183,14 +183,14 @@ public class YiYangAbilityImpl implements DisposeAbility {
} }
if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) { if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) {
log.error("----Error YiYang start clean {} server return error", ip); log.error("----Error PengXin start clean {} server return error", ip);
return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null); return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null);
} }
log.debug("----Finish YiYang Start Cleanup Task: {}", ip); log.debug("----Finish PengXin Start Cleanup Task: {}", ip);
return new MulReturnType<>(ErrorCode.ERR_OK, rspInfo.getMsgContent().getItems().get(0).getTaskId()); return new MulReturnType<>(ErrorCode.ERR_OK, rspInfo.getMsgContent().getItems().get(0).getTaskId());
} catch (Exception ex) { } catch (Exception ex) {
log.error("----Exception YiYang Start Cleanup Task: {}, {}, {}", ip, nfDirection, duration); log.error("----Exception PengXin Start Cleanup Task: {}, {}, {}", ip, nfDirection, duration);
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null); return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
} }
} }
@ -217,10 +217,10 @@ public class YiYangAbilityImpl implements DisposeAbility {
} }
try { try {
log.debug("++++Begging YiYang Stop Cleanup Task: {}", taskId); log.debug("++++Begging PengXin Stop Cleanup Task: {}", taskId);
if (capType != DisposeCapacityType.BLACKHOOL) { if (capType != DisposeCapacityType.BLACKHOOL) {
log.error("----Error YiYang don't support dispose capacity type: {}", capType); log.error("----Error PengXin don't support dispose capacity type: {}", capType);
return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null); return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null);
} }
@ -228,7 +228,7 @@ public class YiYangAbilityImpl implements DisposeAbility {
return new MulReturnType<>(ErrorCode.ERR_PARAMS, null); return new MulReturnType<>(ErrorCode.ERR_PARAMS, null);
} }
ProtocolRespDTO<YiYangStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token, ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
new String[]{taskId}); new String[]{taskId});
// 判断是否token过期 // 判断是否token过期
@ -239,14 +239,14 @@ public class YiYangAbilityImpl implements DisposeAbility {
} }
if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) { if (rspInfo == null || rspInfo.getCode() != ErrorCode.ERR_OK.getHttpCode()) {
log.error("----Error YiYang stop task{} server return error", taskId); log.error("----Error PengXin stop task{} server return error", taskId);
return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null); return new MulReturnType<>(ErrorCode.ERR_HAOHAN_ERROR, null);
} }
log.debug("----Finish YiYang Stop Cleanup Task: {}", taskId); log.debug("----Finish PengXin Stop Cleanup Task: {}", taskId);
return new MulReturnType<>(ErrorCode.ERR_OK, null); return new MulReturnType<>(ErrorCode.ERR_OK, null);
} catch (Exception ex) { } catch (Exception ex) {
log.error("----Exception YiYang Stop Cleanup Task: {}, {}, {}", ip, nfDirection, taskId); log.error("----Exception PengXin Stop Cleanup Task: {}, {}, {}", ip, nfDirection, taskId);
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null); return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
} }
} }
@ -260,7 +260,7 @@ public class YiYangAbilityImpl implements DisposeAbility {
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() { public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
return new MulReturnType<>(ErrorCode.ERR_OK, return new MulReturnType<>(ErrorCode.ERR_OK,
DeviceFirewareInfo.builder() DeviceFirewareInfo.builder()
.vendor("YiYang") .vendor("PengXin")
.model("Unknown") .model("Unknown")
.firmware("Unknown") .firmware("Unknown")
.os("Linux Server") .os("Linux Server")
@ -325,7 +325,7 @@ public class YiYangAbilityImpl implements DisposeAbility {
try { try {
String url = urlRootPath + "dispose_device/information/capacity"; String url = urlRootPath + "dispose_device/information/capacity";
ProtocolRespDTO<YiYangDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token); ProtocolRespDTO<PengXinDisposeAbilityRsp> rspInfo = restfulInterface.getDeviceDisposeAbility(url, token);
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) { if (rspInfo != null && rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) {
@ -410,7 +410,7 @@ public class YiYangAbilityImpl 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<YiYangLoginRsp> logInfo = restfulInterface.login(url, username, password); ProtocolRespDTO<PengXinLoginRsp> 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

@ -16,9 +16,9 @@ public enum DisposeDeviceType implements BaseEnum {
HAOHAN_PLATFORM(1, "浩瀚处置设备"), HAOHAN_PLATFORM(1, "浩瀚处置设备"),
/** /**
* Yiyang platform dispose device type. * The Pengxin platform.
*/ */
YIYANG_PLATFORM(2, "亿阳处置设备"), PENGXIN_PLATFORM(2, "鹏信处置设备"),
/** /**
* The Virtual dispose. * The Virtual dispose.

View File

@ -417,13 +417,13 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
} }
/** /**
* Yi yang device task run. * Peng xin device task run.
* *
* @param ai the ai * @param ai the ai
* @param deviceTask the device task * @param deviceTask the device task
* @param disposeTask the dispose task * @param disposeTask the dispose task
*/ */
private void yiYangDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) { private void pengXinDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
MulReturnType<ErrorCode, String> ret; MulReturnType<ErrorCode, String> ret;
// 重试错误次数过多 // 重试错误次数过多
@ -447,10 +447,10 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 更改处置任务状态为处置中 // 更改处置任务状态为处置中
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTED); deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTED);
// 记录亿阳设备返回的任务ID // 记录鹏信设备返回的任务ID
deviceTaskManager.setTaskExternId(deviceTask.getId(), ret.getSecondParam()); deviceTaskManager.setTaskExternId(deviceTask.getId(), ret.getSecondParam());
log.info("YIYANG_PLATFORM setup task succeed: {}, device taskId {}", deviceTask, ret.getSecondParam()); log.info("PENGXIN_PLATFORM setup task succeed: {}, device taskId {}", deviceTask, ret.getSecondParam());
// 重置错误尝试次数 // 重置错误尝试次数
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0); deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
@ -459,24 +459,24 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_NEW); deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_NEW);
// 记录任务出错重试次数 // 记录任务出错重试次数
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1); deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
log.error("YIYANG_PLATFORM setup task times {} error {}: {}", deviceTask.getErrRetry(), log.error("PENGXIN_PLATFORM setup task times {} error {}: {}", deviceTask.getErrRetry(),
ret.getSecondParam(), deviceTask); ret.getSecondParam(), deviceTask);
} else { } else {
// 任务出错不在重试当做失败任务处理 // 任务出错不在重试当做失败任务处理
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(), deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),
disposeTask.getFlowDirection(), 0L); disposeTask.getFlowDirection(), 0L);
log.error("YIYANG_PLATFORM setup task error {}: {}", ret.getFirstParam(), deviceTask); log.error("PENGXIN_PLATFORM setup task error {}: {}", ret.getFirstParam(), deviceTask);
} }
} }
/** /**
* Yi yang device task stop. * Peng xin device task stop.
* *
* @param ai the ai * @param ai the ai
* @param deviceTask the device task * @param deviceTask the device task
* @param disposeTask the dispose task * @param disposeTask the dispose task
*/ */
private void yiYangDeviceTaskStop(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) { private void pengXinDeviceTaskStop(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
MulReturnType<ErrorCode, Long> ret; MulReturnType<ErrorCode, Long> ret;
// 停止处置任务 // 停止处置任务
@ -484,7 +484,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTask.getExternId()); deviceTask.getExternId());
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
log.info("YIYANG_PLATFORM stop task succeed: {}, device taskId {}", deviceTask, ret.getSecondParam()); log.info("PENGXIN_PLATFORM stop task succeed: {}, device taskId {}", deviceTask, ret.getSecondParam());
// 设置任务状态为结束 // 设置任务状态为结束
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_FINISHED); deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_FINISHED);
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0); deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
@ -492,10 +492,10 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) { } else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
// 记录任务出错重试次数 // 记录任务出错重试次数
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1); deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry() + 1);
log.error("YIYANG_PLATFORM stop task times {} error {}: {}", deviceTask.getErrRetry(), log.error("PENGXIN_PLATFORM stop task times {} error {}: {}", deviceTask.getErrRetry(),
ret.getSecondParam(), deviceTask); ret.getSecondParam(), deviceTask);
} else { } else {
log.error("YIYANG_PLATFORM stop task error {}: {}", ret.getFirstParam(), deviceTask); log.error("PENGXIN_PLATFORM stop task error {}: {}", ret.getFirstParam(), deviceTask);
} }
} }
@ -583,8 +583,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
virtualDeviceTaskRun(ai, v, task); virtualDeviceTaskRun(ai, v, task);
break; break;
case YIYANG_PLATFORM: case PENGXIN_PLATFORM:
yiYangDeviceTaskRun(ai, v, task); pengXinDeviceTaskRun(ai, v, task);
break; break;
default: default:
@ -647,8 +647,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
virtualDeviceTaskStop(ai, v, task); virtualDeviceTaskStop(ai, v, task);
break; break;
case YIYANG_PLATFORM: case PENGXIN_PLATFORM:
yiYangDeviceTaskStop(ai, v, task); pengXinDeviceTaskStop(ai, v, task);
break; break;
default: default:

View File

@ -3,8 +3,8 @@ package com.dispose.service.impl;
import com.dispose.ability.DisposeAbility; import com.dispose.ability.DisposeAbility;
import com.dispose.ability.impl.DpTechAbilityImpl; import com.dispose.ability.impl.DpTechAbilityImpl;
import com.dispose.ability.impl.HaoHanAbilityImpl; import com.dispose.ability.impl.HaoHanAbilityImpl;
import com.dispose.ability.impl.PengXinAbilityImpl;
import com.dispose.ability.impl.VirtualAbilityImpl; import com.dispose.ability.impl.VirtualAbilityImpl;
import com.dispose.ability.impl.YiYangAbilityImpl;
import com.dispose.common.DisposeCapacityType; import com.dispose.common.DisposeCapacityType;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.common.HttpType; import com.dispose.common.HttpType;
@ -112,8 +112,8 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
case HAOHAN_PLATFORM: case HAOHAN_PLATFORM:
db = new HaoHanAbilityImpl(); db = new HaoHanAbilityImpl();
break; break;
case YIYANG_PLATFORM: case PENGXIN_PLATFORM:
db = new YiYangAbilityImpl(); db = new PengXinAbilityImpl();
break; break;
case VIRTUAL_DISPOSE: case VIRTUAL_DISPOSE:
db = new VirtualAbilityImpl(); db = new VirtualAbilityImpl();

View File

@ -164,7 +164,6 @@ public class UserAccountServiceImpl implements UserAccountService {
public MulReturnType<ErrorCode, UserAccount> createUserAccount(String username, String password, String token) { public MulReturnType<ErrorCode, UserAccount> createUserAccount(String username, String password, String token) {
UserAccount user = userAccountManager.getUserByName(username); UserAccount user = userAccountManager.getUserByName(username);
UserAccount optUser = userAccountManager.getUserByName("admin"); UserAccount optUser = userAccountManager.getUserByName("admin");
//userAccountManager.getUserByToken(token);
if (optUser == null) { if (optUser == null) {
return MulReturnType.<ErrorCode, UserAccount>builder() return MulReturnType.<ErrorCode, UserAccount>builder()

View File

@ -1,18 +1,18 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang base resp status. * The type Peng xin base resp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class YiYangBaseResp { public class PengXinBaseResp {
/** /**
* The Status. * The Status.
*/ */

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -6,7 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang dispose ability info. * The type Peng xin dispose ability info.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangDisposeAbilityInfo { public class PengXinDisposeAbilityInfo {
/** /**
* The Type. * The Type.
*/ */
@ -31,7 +31,7 @@ public class YiYangDisposeAbilityInfo {
private Integer IPType; private Integer IPType;
/** /**
* The Protect ip. * The Dispose ip.
*/ */
private String disposeIp; private String disposeIp;
} }

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Yi yang dispose ability rsp. * The type Peng xin dispose ability rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -18,7 +18,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangDisposeAbilityRsp extends YiYangBaseResp { public class PengXinDisposeAbilityRsp extends PengXinBaseResp {
/** /**
* The Device name. * The Device name.
*/ */
@ -27,5 +27,5 @@ public class YiYangDisposeAbilityRsp extends YiYangBaseResp {
/** /**
* The Capacity. * The Capacity.
*/ */
List<YiYangDisposeAbilityInfo> capacity; List<PengXinDisposeAbilityInfo> capacity;
} }

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -6,7 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang login req. * The type Peng xin login req.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class YiYangLoginReq { public class PengXinLoginReq {
/** /**
* The User name. * The User name.
*/ */

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang login rsp. * The type Peng xin login rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangLoginRsp extends YiYangBaseResp { public class PengXinLoginRsp extends PengXinBaseResp {
/** /**
* The User name. * The User name.
*/ */

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -6,7 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang start task items. * The type Peng xin start task item.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class YiYangStartTaskItem { public class PengXinStartTaskItem {
/** /**
* The Task req id. * The Task req id.
*/ */

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Yi yang start task req. * The type Peng xin start task req.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -16,9 +16,9 @@ import java.util.List;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class YiYangStartTaskReq { public class PengXinStartTaskReq {
/** /**
* The Items. * The Items.
*/ */
List<YiYangStartTaskItem> items; List<PengXinStartTaskItem> items;
} }

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Yi yang start task rsp. * The type Peng xin start task rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -16,7 +16,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangStartTaskRsp { public class PengXinStartTaskRsp {
/** /**
* The Device name. * The Device name.
*/ */
@ -25,5 +25,5 @@ public class YiYangStartTaskRsp {
/** /**
* The Items. * The Items.
*/ */
List<YiYangStartedItem> items; List<PengXinStartedItem> items;
} }

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang started item. * The type Peng xin started item.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangStartedItem extends YiYangBaseResp { public class PengXinStartedItem extends PengXinBaseResp {
/** /**
* The Task req id. * The Task req id.
*/ */

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -6,7 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang stop task req. * The type Peng xin stop task req.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class YiYangStopTaskReq { public class PengXinStopTaskReq {
/** /**
* The Task id. * The Task id.
*/ */

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
/** /**
* The type Yi yang stop task rsp. * The type Peng xin stop task rsp.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -16,7 +16,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangStopTaskRsp { public class PengXinStopTaskRsp {
/** /**
* The Device name. * The Device name.
*/ */
@ -24,5 +24,5 @@ public class YiYangStopTaskRsp {
/** /**
* The Items. * The Items.
*/ */
private List<YiYangStoppedItem> items; private List<PengXinStoppedItem> items;
} }

View File

@ -1,4 +1,4 @@
package com.yiyang.dispose.common; package com.pengxin.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* The type Yi yang stopped item. * The type Peng xin stopped item.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class YiYangStoppedItem extends YiYangBaseResp { public class PengXinStoppedItem extends PengXinBaseResp {
/** /**
* The Task id. * The Task id.
*/ */

View File

@ -1,29 +1,29 @@
package com.yiyang.dispose.protocol; package com.pengxin.dispose.protocol;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.pojo.dto.protocol.base.BaseProtocolDTO; import com.dispose.pojo.dto.protocol.base.BaseProtocolDTO;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO; import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.dispose.restful.RestfulInterface; import com.dispose.restful.RestfulInterface;
import com.yiyang.dispose.common.YiYangBaseResp; import com.pengxin.dispose.common.PengXinBaseResp;
import com.yiyang.dispose.common.YiYangDisposeAbilityRsp; import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
import com.yiyang.dispose.common.YiYangLoginReq; import com.pengxin.dispose.common.PengXinLoginReq;
import com.yiyang.dispose.common.YiYangLoginRsp; import com.pengxin.dispose.common.PengXinLoginRsp;
import com.yiyang.dispose.common.YiYangStartTaskItem; import com.pengxin.dispose.common.PengXinStartTaskItem;
import com.yiyang.dispose.common.YiYangStartTaskReq; import com.pengxin.dispose.common.PengXinStartTaskReq;
import com.yiyang.dispose.common.YiYangStartTaskRsp; import com.pengxin.dispose.common.PengXinStartTaskRsp;
import com.yiyang.dispose.common.YiYangStopTaskReq; import com.pengxin.dispose.common.PengXinStopTaskReq;
import com.yiyang.dispose.common.YiYangStopTaskRsp; import com.pengxin.dispose.common.PengXinStopTaskRsp;
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 Yi yang interface. * The type Peng xin interface.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
public class YiYangInterface { public class PengXinInterface {
/** /**
* The Ver. * The Ver.
*/ */
@ -52,11 +52,11 @@ public class YiYangInterface {
* @param password the password * @param password the password
* @return the protocol resp dto * @return the protocol resp dto
*/ */
public ProtocolRespDTO<YiYangLoginRsp> login(String baseUrlPath, String username, String password) { public ProtocolRespDTO<PengXinLoginRsp> login(String baseUrlPath, String username, String password) {
BaseProtocolDTO<YiYangLoginReq> reqInfo = new BaseProtocolDTO<>(); BaseProtocolDTO<PengXinLoginReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(YiYangLoginReq.builder() reqInfo.setMsgContent(PengXinLoginReq.builder()
.userName(username) .userName(username)
.password(password) .password(password)
.build()); .build());
@ -68,7 +68,7 @@ public class YiYangInterface {
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
null, null,
reqInfo, reqInfo,
YiYangLoginRsp.class, PengXinLoginRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
@ -80,10 +80,10 @@ public class YiYangInterface {
* @return the link status * @return the link status
*/ */
public ErrorCode getLinkStatus(String baseUrlPath, String token) { public ErrorCode getLinkStatus(String baseUrlPath, String token) {
ProtocolRespDTO<YiYangBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath, ProtocolRespDTO<PengXinBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath,
token, token,
null, null,
YiYangBaseResp.class, PengXinBaseResp.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) {
@ -104,10 +104,10 @@ public class YiYangInterface {
* @param items the items * @param items the items
* @return the protocol resp dto * @return the protocol resp dto
*/ */
public ProtocolRespDTO<YiYangStartTaskRsp> startDisposeTask(String baseUrlPath, String token, public ProtocolRespDTO<PengXinStartTaskRsp> startDisposeTask(String baseUrlPath, String token,
List<YiYangStartTaskItem> items) { List<PengXinStartTaskItem> items) {
BaseProtocolDTO<YiYangStartTaskReq> reqInfo = new BaseProtocolDTO<>(); BaseProtocolDTO<PengXinStartTaskReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(new YiYangStartTaskReq()); reqInfo.setMsgContent(new PengXinStartTaskReq());
reqInfo.getMsgContent().setItems(items); reqInfo.getMsgContent().setItems(items);
reqInfo.setCryptoType(this.cryptoType); reqInfo.setCryptoType(this.cryptoType);
@ -117,7 +117,7 @@ public class YiYangInterface {
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
reqInfo, reqInfo,
YiYangStartTaskRsp.class, PengXinStartTaskRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
@ -129,10 +129,10 @@ public class YiYangInterface {
* @param taskId the task id * @param taskId the task id
* @return the protocol resp dto * @return the protocol resp dto
*/ */
public ProtocolRespDTO<YiYangStopTaskRsp> stopDisposeTask(String baseUrlPath, String token, String[] taskId) { public ProtocolRespDTO<PengXinStopTaskRsp> stopDisposeTask(String baseUrlPath, String token, String[] taskId) {
BaseProtocolDTO<YiYangStopTaskReq> reqInfo = new BaseProtocolDTO<>(); BaseProtocolDTO<PengXinStopTaskReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(new YiYangStopTaskReq()); reqInfo.setMsgContent(new PengXinStopTaskReq());
reqInfo.getMsgContent().setTaskId(taskId); reqInfo.getMsgContent().setTaskId(taskId);
reqInfo.setCryptoType(this.cryptoType); reqInfo.setCryptoType(this.cryptoType);
@ -142,7 +142,7 @@ public class YiYangInterface {
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
reqInfo, reqInfo,
YiYangStopTaskRsp.class, PengXinStopTaskRsp.class,
RequestMethod.POST); RequestMethod.POST);
} }
@ -153,11 +153,11 @@ public class YiYangInterface {
* @param token the token * @param token the token
* @return the device dispose ability * @return the device dispose ability
*/ */
public ProtocolRespDTO<YiYangDisposeAbilityRsp> getDeviceDisposeAbility(String baseUrlPath, String token) { public ProtocolRespDTO<PengXinDisposeAbilityRsp> getDeviceDisposeAbility(String baseUrlPath, String token) {
return RestfulInterface.baseProRun(baseUrlPath, return RestfulInterface.baseProRun(baseUrlPath,
token, token,
null, null,
YiYangDisposeAbilityRsp.class, PengXinDisposeAbilityRsp.class,
RequestMethod.GET); RequestMethod.GET);
} }
} }