REM:
1. 添加标准JavaDoc注释内容
This commit is contained in:
huangxin 2020-04-21 15:28:38 +08:00
parent 4c06518a86
commit 5e26f421c1
61 changed files with 1222 additions and 56 deletions

View File

@ -7,7 +7,17 @@ import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.wss4j.common.ext.WSPasswordCallback; import org.apache.wss4j.common.ext.WSPasswordCallback;
/**
* The type Soap password callback handler.
*/
public class SoapPasswordCallbackHandler implements CallbackHandler { public class SoapPasswordCallbackHandler implements CallbackHandler {
/**
* Handle.
*
* @param callbacks the callbacks
* @throws IOException the io exception
* @throws UnsupportedCallbackException the unsupported callback exception
*/
@Override @Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

View File

@ -10,10 +10,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan; import tk.mybatis.spring.annotation.MapperScan;
/** /**
* 系统启动入口 * The type Phoenix boot application.
*
* @author phoenix
* @date 2020年2月4日
*/ */
@SpringBootApplication @SpringBootApplication
@EnableAsync @EnableAsync
@ -24,6 +21,11 @@ import tk.mybatis.spring.annotation.MapperScan;
@Slf4j @Slf4j
public class PhoenixBootApplication { public class PhoenixBootApplication {
/**
* The entry point of application.
*
* @param args the input arguments
*/
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(PhoenixBootApplication.class, args); SpringApplication.run(PhoenixBootApplication.class, args);
log.info("\n----------------------------------------------------------\n\t" log.info("\n----------------------------------------------------------\n\t"

View File

@ -1,58 +1,91 @@
package com.dispose.common; package com.dispose.common;
/**
* The type Const value.
*/
public class ConstValue { public class ConstValue {
public class GlobalConfigure { /**
* The type Global configure.
*/
public static class GlobalConfigure {
/**
* The constant TOKEN_TIMEOUT_MS.
*/
public static final int TOKEN_TIMEOUT_MS = 30 * 60 * 1000; public static final int TOKEN_TIMEOUT_MS = 30 * 60 * 1000;
/**
* The constant ALLOW_PWD_ERR_TIMES.
*/
public static final int ALLOW_PWD_ERR_TIMES = 5; public static final int ALLOW_PWD_ERR_TIMES = 5;
/**
* The constant IS_SKIP_TIMEOUT_CHECK.
*/
public static final boolean IS_SKIP_TIMEOUT_CHECK = true; public static final boolean IS_SKIP_TIMEOUT_CHECK = true;
/**
* The constant IS_VERIFY_TOKEN.
*/
public static final boolean IS_VERIFY_TOKEN = false; public static final boolean IS_VERIFY_TOKEN = false;
/**
* The constant TOKEN_EXPIRED_TIME_MS.
*/
public static final long TOKEN_EXPIRED_TIME_MS = 1000 * 60 * 60; public static final long TOKEN_EXPIRED_TIME_MS = 1000 * 60 * 60;
} }
public class SOAPWrapperConst { /**
* The type Soap wrapper const.
*/
public static class SOAPWrapperConst {
/**
* The constant NAMESPACE_URI.
*/
public static final String NAMESPACE_URI = "http://%s/UMC/service/AbnormalFlowCleaningService"; public static final String NAMESPACE_URI = "http://%s/UMC/service/AbnormalFlowCleaningService";
//public static final String SERVICE_ADDRESS = "http://10.88.77.15/UMC/service/AbnormalFlowCleaningService?wsdl"; /**
* The constant USER_NAME.
*/
//public static final String SERVICE_ADDRESS = "http://10.88.77.15/UMC/service/AbnormalFlowCleaningService?wsdl";
public static final String USER_NAME = "admin"; public static final String USER_NAME = "admin";
/**
* The constant PASSWORD.
*/
public static final String PASSWORD = "UMCAdministrator"; public static final String PASSWORD = "UMCAdministrator";
} }
public class Protocol { /**
* The type Protocol.
*/
public static class Protocol {
/**
* The constant RESP_CMD_BASE.
*/
public static final int RESP_CMD_BASE = 10000; public static final int RESP_CMD_BASE = 10000;
/**
* The constant VERSION.
*/
public static final int VERSION = 2; public static final int VERSION = 2;
/**
* The constant CRYPTO_NONE.
*/
public static final int CRYPTO_NONE = 0; public static final int CRYPTO_NONE = 0;
/**
* The constant CRYPTO_BASE64.
*/
public static final int CRYPTO_BASE64 = 1; public static final int CRYPTO_BASE64 = 1;
/**
* The constant CRYPTO_AES256.
*/
public static final int CRYPTO_AES256 = 2; public static final int CRYPTO_AES256 = 2;
} }
public class ProtocolCmdId { /**
public static final int AUTH_LOGIN = 10; * The enum Dispose device type.
public static final int AUTH_LOGOUT = 11; */
public static final int ADD_DISPOSE_POINT = 100;
public static final int MOD_DISPOSE_POINT = 101;
public static final int DEL_DISPOSE_POINT = 102;
public static final int GET_DISPOSE_POINT_VERSION = 200;
public static final int GET_DISPOSE_POINT_DEV_INFO = 201;
public static final int GET_DISPOSE_POINT_LINK_STATUS = 202;
public static final int GET_DISPOSE_POINT_CATACITY = 203;
public static final int GET_DISPOSE_POINT_PROTECT_IP = 204;
public static final int GET_DISPOSE_POINT_LIST = 209;
public static final int GET_DISPOSE_POINT_DETAILS = 210;
public static final int START_DISPOSE_CMD = 400;
public static final int STOP_DISPOSE_CMD_BY_TASKID = 401;
public static final int STOP_DISPOSE_CMD_BY_IP = 402;
public static final int STOP_DISPOSE_CMD_BY_POINT = 403;
public static final int STOP_DISPOSE_CMD_ALL = 404;
public static final int GET_DISPOSE_TASK_LIST = 405;
public static final int GET_DISPOSE_TASK_DETAIL = 406;
}
public enum DisposeDeviceType { public enum DisposeDeviceType {
/**
* Dptech umc dispose device type.
*/
DPTECH_UMC(0, "迪普UMC管理平台"), DPTECH_UMC(0, "迪普UMC管理平台"),
/**
* Haohan platform dispose device type.
*/
HAOHAN_PLATFORM(1, "浩瀚处置设备"); HAOHAN_PLATFORM(1, "浩瀚处置设备");
private final int code; private final int code;
@ -63,24 +96,58 @@ public class ConstValue {
this.readme = readme; this.readme = readme;
} }
/**
* Gets code.
*
* @return the code
*/
public int getCode() { public int getCode() {
return this.code; return this.code;
} }
/**
* Gets readme.
*
* @return the readme
*/
public String getReadme() { public String getReadme() {
return this.readme; return this.readme;
} }
} }
/**
* The type User account status.
*/
public class UserAccountStatus { public class UserAccountStatus {
/**
* The constant NORMAL.
*/
public static final int NORMAL = 0; public static final int NORMAL = 0;
/**
* The constant LOCKED.
*/
public static final int LOCKED = 1; public static final int LOCKED = 1;
} }
/**
* The enum Device capacity.
*/
public enum DeviceCapacity { public enum DeviceCapacity {
/**
* Cleanup device capacity.
*/
CLEANUP(0, "清洗能力"), CLEANUP(0, "清洗能力"),
/**
* Hidepend device capacity.
*/
HIDEPEND(1, "高防能力"), HIDEPEND(1, "高防能力"),
/**
* Blackhool device capacity.
*/
BLACKHOOL(2, "黑洞能力"), BLACKHOOL(2, "黑洞能力"),
/**
* Detecive device capacity.
*/
DETECIVE(3, "检测能力"); DETECIVE(3, "检测能力");
private final int code; private final int code;
@ -91,18 +158,44 @@ public class ConstValue {
this.readme = readme; this.readme = readme;
} }
/**
* Gets code.
*
* @return the code
*/
public int getCode() { public int getCode() {
return this.code; return this.code;
} }
/**
* Gets readme.
*
* @return the readme
*/
public String getReadme() { public String getReadme() {
return this.readme; return this.readme;
} }
} }
/**
* The enum Ip addr type.
*/
public enum IPAddrType { public enum IPAddrType {
IPV4_TYPE, IPV6_TYPE; /**
* Ipv 4 type ip addr type.
*/
IPV4_TYPE,
/**
* Ipv 6 type ip addr type.
*/
IPV6_TYPE;
/**
* Gets ip addr type.
*
* @param ipAddr the ip addr
* @return the ip addr type
*/
public static IPAddrType getIpAddrType(String ipAddr) { public static IPAddrType getIpAddrType(String ipAddr) {
if (ipAddr.contains(":")) { if (ipAddr.contains(":")) {
return IPV6_TYPE; return IPV6_TYPE;

View File

@ -1,33 +1,108 @@
package com.dispose.common; package com.dispose.common;
/** /**
* 错误码常量定义 * The enum Error code.
*/ */
public enum ErrorCode { public enum ErrorCode {
/**
* Err ok error code.
*/
ERR_OK(0, "成功"), ERR_OK(0, "成功"),
/**
* Err password error code.
*/
ERR_PASSWORD(1, "密码错误"), ERR_PASSWORD(1, "密码错误"),
/**
* Err usernotfound error code.
*/
ERR_USERNOTFOUND(2, "用户不存在"), ERR_USERNOTFOUND(2, "用户不存在"),
/**
* Err passwordmore error code.
*/
ERR_PASSWORDMORE(3, "连续密码错误达上限,再次输入错误将锁定用户"), ERR_PASSWORDMORE(3, "连续密码错误达上限,再次输入错误将锁定用户"),
/**
* Err userlock error code.
*/
ERR_USERLOCK(4, "密码错误达上限,用户被锁定"), ERR_USERLOCK(4, "密码错误达上限,用户被锁定"),
/**
* Err account error code.
*/
ERR_ACCOUNT(5, "用户账户异常"), ERR_ACCOUNT(5, "用户账户异常"),
/**
* Err userexist error code.
*/
ERR_USEREXIST(6, "该用户已经存在"), ERR_USEREXIST(6, "该用户已经存在"),
/**
* Err passwordsimple error code.
*/
ERR_PASSWORDSIMPLE(7, "用户密码强度不符合要求"), ERR_PASSWORDSIMPLE(7, "用户密码强度不符合要求"),
/**
* Err inputformat error code.
*/
ERR_INPUTFORMAT(8, "输入信息格式有误"), ERR_INPUTFORMAT(8, "输入信息格式有误"),
/**
* Err inputmiss error code.
*/
ERR_INPUTMISS(9, "缺少必要输入信息"), ERR_INPUTMISS(9, "缺少必要输入信息"),
/**
* Err permission error code.
*/
ERR_PERMISSION(10, "操作员权限不足"), ERR_PERMISSION(10, "操作员权限不足"),
/**
* Err reqtimeout error code.
*/
ERR_REQTIMEOUT(11, "请求超时"), ERR_REQTIMEOUT(11, "请求超时"),
/**
* Err params error code.
*/
ERR_PARAMS(12, "参数错误"), ERR_PARAMS(12, "参数错误"),
/**
* Err systemexception error code.
*/
ERR_SYSTEMEXCEPTION(13, "系统异常"), ERR_SYSTEMEXCEPTION(13, "系统异常"),
/**
* Err unknowncmd error code.
*/
ERR_UNKNOWNCMD(14, "未知命令"), ERR_UNKNOWNCMD(14, "未知命令"),
/**
* Err logout error code.
*/
ERR_LOGOUT(15, "用户未登录"), ERR_LOGOUT(15, "用户未登录"),
/**
* Err tokentimeout error code.
*/
ERR_TOKENTIMEOUT(16, "Token超时"), ERR_TOKENTIMEOUT(16, "Token超时"),
/**
* Err tokennotfound error code.
*/
ERR_TOKENNOTFOUND(17, "非法Token"), ERR_TOKENNOTFOUND(17, "非法Token"),
/**
* Err missauthhead error code.
*/
ERR_MISSAUTHHEAD(18, "Http 请求缺少认证头部"), ERR_MISSAUTHHEAD(18, "Http 请求缺少认证头部"),
/**
* Err nosuchdevice error code.
*/
ERR_NOSUCHDEVICE(19, "没有这个设备"), ERR_NOSUCHDEVICE(19, "没有这个设备"),
/**
* Err deviceexists error code.
*/
ERR_DEVICEEXISTS(20, "设备已经存在"), ERR_DEVICEEXISTS(20, "设备已经存在"),
/**
* Err paramexception error code.
*/
ERR_PARAMEXCEPTION(21, "参数异常"), ERR_PARAMEXCEPTION(21, "参数异常"),
/**
* Err version error code.
*/
ERR_VERSION(23, "协议版本不兼容,请升级系统"), ERR_VERSION(23, "协议版本不兼容,请升级系统"),
/**
* Err nosuchtype error code.
*/
ERR_NOSUCHTYPE(24, "没有这个类型的处置设备"), ERR_NOSUCHTYPE(24, "没有这个类型的处置设备"),
/**
* Err removemore error code.
*/
ERR_REMOVEMORE(25, "禁止同时删除多个设备"), ERR_REMOVEMORE(25, "禁止同时删除多个设备"),
; ;
@ -39,10 +114,20 @@ public enum ErrorCode {
this.errMsg = msg; this.errMsg = msg;
} }
/**
* Gets code.
*
* @return the code
*/
public int getCode() { public int getCode() {
return errno; return errno;
} }
/**
* Gets http code.
*
* @return the http code
*/
public int getHttpCode() { public int getHttpCode() {
if (this.errno == 0) { if (this.errno == 0) {
return 200; return 200;
@ -51,6 +136,11 @@ public enum ErrorCode {
} }
} }
/**
* Gets msg.
*
* @return the msg
*/
public String getMsg() { public String getMsg() {
return errMsg; return errMsg;
} }

View File

@ -1,13 +1,18 @@
package com.dispose.common; package com.dispose.common;
/** /**
* @author: chiwei * The type Global var.
* @date: 2020年4月7日 下午4:36:39
*/ */
public class GlobalVar { public class GlobalVar {
/**
* The constant MAX_THREAT_INFO_VERSION.
*/
public static volatile int MAX_THREAT_INFO_VERSION = -1; public static volatile int MAX_THREAT_INFO_VERSION = -1;
/**
* The constant THREAT_INFO_TYPE.
*/
public static volatile String THREAT_INFO_TYPE = "1"; public static volatile String THREAT_INFO_TYPE = "1";
} }

View File

@ -5,6 +5,9 @@ import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* The type Dispose configure.
*/
@Getter @Getter
@Setter @Setter
@Component @Component

View File

@ -5,8 +5,16 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.filter.CharacterEncodingFilter;
/**
* The type Encoding filter config.
*/
@Configuration @Configuration
public class EncodingFilterConfig { public class EncodingFilterConfig {
/**
* Filter registration bean filter registration bean.
*
* @return the filter registration bean
*/
@Bean @Bean
public FilterRegistrationBean filterRegistrationBean() { public FilterRegistrationBean filterRegistrationBean() {
FilterRegistrationBean registrationBean = new FilterRegistrationBean(); FilterRegistrationBean registrationBean = new FilterRegistrationBean();

View File

@ -6,6 +6,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* The type Setup init.
*/
@Component @Component
@Slf4j @Slf4j
public class SetupInit implements CommandLineRunner { public class SetupInit implements CommandLineRunner {
@ -13,6 +16,11 @@ public class SetupInit implements CommandLineRunner {
private DisposeNodeManager disposeNodeManager; private DisposeNodeManager disposeNodeManager;
/**
* Run.
*
* @param args the args
*/
@Override @Override
public void run(String... args) { public void run(String... args) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

View File

@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
/**
* The type Auth controller.
*/
@Controller @Controller
@RequestMapping(value = "/auth") @RequestMapping(value = "/auth")
@Slf4j @Slf4j
@ -38,6 +41,14 @@ public class AuthController {
@Resource @Resource
private UserAccountService userAccountService; private UserAccountService userAccountService;
/**
* User login protocol resp dto.
*
* @param mr the mr
* @return the protocol resp dto
* @throws JsonProcessingException the json processing exception
* @throws NoSuchAlgorithmException the no such algorithm exception
*/
@PostMapping("/login") @PostMapping("/login")
@ResponseBody @ResponseBody
@ApiOperation("登录") @ApiOperation("登录")
@ -69,6 +80,14 @@ public class AuthController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
} }
/**
* User logout protocol resp dto.
*
* @param mr the mr
* @param headers the headers
* @return the protocol resp dto
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/logout") @PostMapping("/logout")
@ResponseBody @ResponseBody
@ApiOperation("注销") @ApiOperation("注销")

View File

@ -34,6 +34,9 @@ import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
/**
* The type Dispose node info controller.
*/
@Controller @Controller
@RequestMapping(value = "/information") @RequestMapping(value = "/information")
@Slf4j @Slf4j
@ -49,6 +52,14 @@ public class DisposeNodeInfoController {
//@Resource //@Resource
//private DisposeDeviceMapper disposeDeviceMapper; //private DisposeDeviceMapper disposeDeviceMapper;
/**
* Gets link status.
*
* @param mr the mr
* @param headers the headers
* @return the link status
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/linkstatus") @PostMapping("/linkstatus")
@ResponseBody @ResponseBody
@ApiOperation("链接状态") @ApiOperation("链接状态")
@ -101,6 +112,14 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
} }
/**
* Gets version.
*
* @param mr the mr
* @param headers the headers
* @return the version
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/version") @PostMapping("/version")
@ResponseBody @ResponseBody
@ApiOperation("处置设备版本") @ApiOperation("处置设备版本")
@ -156,6 +175,14 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
} }
/**
* Gets device info.
*
* @param mr the mr
* @param headers the headers
* @return the device info
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/deviceinfo") @PostMapping("/deviceinfo")
@ResponseBody @ResponseBody
@ApiOperation("处置设备信息") @ApiOperation("处置设备信息")
@ -223,6 +250,14 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
} }
/**
* Gets capacity.
*
* @param mr the mr
* @param headers the headers
* @return the capacity
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/capacity") @PostMapping("/capacity")
@ResponseBody @ResponseBody
@ApiOperation("处置设备处置能力") @ApiOperation("处置设备处置能力")
@ -278,6 +313,14 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspMessage, ConstValue.Protocol.CRYPTO_NONE); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspMessage, ConstValue.Protocol.CRYPTO_NONE);
} }
/**
* Gets protected ip.
*
* @param mr the mr
* @param headers the headers
* @return the protected ip
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/protected_ip") @PostMapping("/protected_ip")
@ResponseBody @ResponseBody
@ApiOperation("处置设备防护IP") @ApiOperation("处置设备防护IP")
@ -333,6 +376,14 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspMessage, ConstValue.Protocol.CRYPTO_NONE); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspMessage, ConstValue.Protocol.CRYPTO_NONE);
} }
/**
* Gets dispose node list.
*
* @param mr the mr
* @param headers the headers
* @return the dispose node list
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/node_list") @PostMapping("/node_list")
@ResponseBody @ResponseBody
@ApiOperation("处置设备列表") @ApiOperation("处置设备列表")
@ -394,6 +445,14 @@ public class DisposeNodeInfoController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
} }
/**
* Gets dispose node details.
*
* @param mr the mr
* @param headers the headers
* @return the dispose node details
* @throws JsonProcessingException the json processing exception
*/
@PostMapping("/node_details") @PostMapping("/node_details")
@ResponseBody @ResponseBody
@ApiOperation("处置节点详细信息") @ApiOperation("处置节点详细信息")

View File

@ -30,6 +30,9 @@ import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
/**
* The type Dispose node manager controller.
*/
@Controller @Controller
@RequestMapping(value = "/manager") @RequestMapping(value = "/manager")
@Slf4j @Slf4j
@ -42,6 +45,14 @@ public class DisposeNodeManagerController {
@Resource @Resource
private UserAccountCacheManager userAccountCacheManager; private UserAccountCacheManager userAccountCacheManager;
/**
* Add dispose node protocol resp dto.
*
* @param mr the mr
* @param headers the headers
* @return the protocol resp dto
* @throws JsonProcessingException the json processing exception
*/
@PutMapping("/device") @PutMapping("/device")
@ResponseBody @ResponseBody
@ApiOperation("添加处置能力节点") @ApiOperation("添加处置能力节点")
@ -95,6 +106,14 @@ public class DisposeNodeManagerController {
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo); return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
} }
/**
* Remove dispose node protocol resp dto.
*
* @param mr the mr
* @param headers the headers
* @return the protocol resp dto
* @throws JsonProcessingException the json processing exception
*/
@DeleteMapping("/device") @DeleteMapping("/device")
@ResponseBody @ResponseBody
@ApiOperation("删除处置能力节点") @ApiOperation("删除处置能力节点")

View File

@ -3,8 +3,19 @@ package com.dispose.dispose;
import com.dispose.common.ConstValue; import com.dispose.common.ConstValue;
import com.dispose.dispose.impl.DPTechImpl; import com.dispose.dispose.impl.DPTechImpl;
/**
* The type Device router.
*/
public class DeviceRouter { public class DeviceRouter {
/**
* Device router factory dispose entry manager.
*
* @param devType the dev type
* @param ipAddr the ip addr
* @param ipType the ip type
* @return the dispose entry manager
*/
public static DisposeEntryManager deviceRouterFactory(int devType, String ipAddr, ConstValue.IPAddrType ipType) { public static DisposeEntryManager deviceRouterFactory(int devType, String ipAddr, ConstValue.IPAddrType ipType) {
if (devType == ConstValue.DisposeDeviceType.DPTECH_UMC.getCode()) { if (devType == ConstValue.DisposeDeviceType.DPTECH_UMC.getCode()) {
return new DPTechImpl(ipAddr); return new DPTechImpl(ipAddr);
@ -13,6 +24,13 @@ public class DeviceRouter {
return null; return null;
} }
/**
* Device router factory dispose entry manager.
*
* @param devType the dev type
* @param ipAddr the ip addr
* @return the dispose entry manager
*/
public static DisposeEntryManager deviceRouterFactory(int devType, String ipAddr) { public static DisposeEntryManager deviceRouterFactory(int devType, String ipAddr) {
return deviceRouterFactory(devType, ipAddr, ConstValue.IPAddrType.IPV4_TYPE); return deviceRouterFactory(devType, ipAddr, ConstValue.IPAddrType.IPV4_TYPE);
} }

View File

@ -5,23 +5,74 @@ import com.dispose.dispose.po.DeviceInfo;
import com.dispose.pojo.po.DisposeDeviceCapacity; import com.dispose.pojo.po.DisposeDeviceCapacity;
import java.util.List; import java.util.List;
/**
* The interface Dispose entry manager.
*/
public interface DisposeEntryManager { public interface DisposeEntryManager {
/**
* Run dispose int.
*
* @param ip the ip
* @return the int
*/
int runDispose(String ip); int runDispose(String ip);
/**
* Gets all detection object.
*
* @param <T> the type parameter
* @return the all detection object
*/
<T> T getAllDetectionObject(); <T> T getAllDetectionObject();
/**
* Gets all protection object.
*
* @param <T> the type parameter
* @return the all protection object
*/
<T> T getAllProtectionObject(); <T> T getAllProtectionObject();
/**
* Gets device capacity.
*
* @return the device capacity
*/
List<DisposeDeviceCapacity> getDeviceCapacity(); List<DisposeDeviceCapacity> getDeviceCapacity();
/**
* Gets detection devices.
*
* @return the detection devices
*/
String getDetectionDevices(); String getDetectionDevices();
/**
* Gets protect devices.
*
* @return the protect devices
*/
String getProtectDevices(); String getProtectDevices();
/**
* Gets device link status.
*
* @return the device link status
*/
boolean getDeviceLinkStatus(); boolean getDeviceLinkStatus();
/**
* Gets version.
*
* @return the version
*/
String getVersion(); String getVersion();
/**
* Gets device info.
*
* @return the device info
*/
DeviceInfo getDeviceInfo(); DeviceInfo getDeviceInfo();
//public NtcRequestResultInfo stopAbnormalTask(String abnormalIp, int attackType, int direction); //public NtcRequestResultInfo stopAbnormalTask(String abnormalIp, int attackType, int direction);

View File

@ -20,12 +20,25 @@ import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.wss4j.dom.WSConstants; import org.apache.wss4j.dom.WSConstants;
import org.apache.wss4j.dom.handler.WSHandlerConstants; import org.apache.wss4j.dom.handler.WSHandlerConstants;
/**
* The type Dp tech.
*/
public class DPTechImpl implements DisposeEntryManager { public class DPTechImpl implements DisposeEntryManager {
/**
* Gets version.
*
* @return the version
*/
@Override @Override
public String getVersion() { public String getVersion() {
return "Not Support"; return "Not Support";
} }
/**
* Gets device info.
*
* @return the device info
*/
@Override @Override
public DeviceInfo getDeviceInfo() { public DeviceInfo getDeviceInfo() {
return DeviceInfo.builder() return DeviceInfo.builder()
@ -41,6 +54,11 @@ public class DPTechImpl implements DisposeEntryManager {
.build(); .build();
} }
/**
* Gets device capacity.
*
* @return the device capacity
*/
@Override @Override
public List<DisposeDeviceCapacity> getDeviceCapacity() { public List<DisposeDeviceCapacity> getDeviceCapacity() {
List<DisposeDeviceCapacity> capList = new ArrayList<>(); List<DisposeDeviceCapacity> capList = new ArrayList<>();
@ -83,6 +101,11 @@ public class DPTechImpl implements DisposeEntryManager {
return capList; return capList;
} }
/**
* Gets device link status.
*
* @return the device link status
*/
@Override @Override
public boolean getDeviceLinkStatus() { public boolean getDeviceLinkStatus() {
List<ArrayOfProtectionObjectDataForService> objs = getAllProtectionObject(); List<ArrayOfProtectionObjectDataForService> objs = getAllProtectionObject();
@ -90,23 +113,47 @@ public class DPTechImpl implements DisposeEntryManager {
return objs != null; return objs != null;
} }
/**
* Run dispose int.
*
* @param ip the ip
* @return the int
*/
@Override @Override
public int runDispose(String ip) { public int runDispose(String ip) {
return 0; return 0;
} }
/**
* Gets all detection object.
*
* @param <T> the type parameter
* @return the all detection object
*/
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T getAllDetectionObject() { public <T> T getAllDetectionObject() {
return (T) cleanTypePort.getAllDetectionObjectFromUMC().getDetectionObjectDataForService(); return (T) cleanTypePort.getAllDetectionObjectFromUMC().getDetectionObjectDataForService();
} }
/**
* Gets all protection object.
*
* @param <T> the type parameter
* @return the all protection object
*/
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T getAllProtectionObject() { public <T> T getAllProtectionObject() {
return (T) cleanTypePort.getAllProtectionObjectFromUMC().getProtectionObjectDataForService(); return (T) cleanTypePort.getAllProtectionObjectFromUMC().getProtectionObjectDataForService();
} }
/**
* Gets detection object device json.
*
* @return the detection object device json
* @throws JsonProcessingException the json processing exception
*/
public String getDetectionObjectDeviceJson() throws JsonProcessingException { public String getDetectionObjectDeviceJson() throws JsonProcessingException {
ArrayOfDetectionObjectDataForService typePort = cleanTypePort.getAllDetectionObjectFromUMC(); ArrayOfDetectionObjectDataForService typePort = cleanTypePort.getAllDetectionObjectFromUMC();
@ -114,18 +161,36 @@ public class DPTechImpl implements DisposeEntryManager {
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(typePort); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(typePort);
} }
/**
* Gets protect devices.
*
* @return the protect devices
*/
@Override @Override
public String getProtectDevices() { public String getProtectDevices() {
return cleanTypePort.getAllProtectDevices(); return cleanTypePort.getAllProtectDevices();
} }
/**
* Gets detection devices.
*
* @return the detection devices
*/
@Override @Override
public String getDetectionDevices() { public String getDetectionDevices() {
return cleanTypePort.getAllDetectDevices(); return cleanTypePort.getAllDetectDevices();
} }
/**
* The Clean type port.
*/
AbnormalFlowCleaningServicePortType cleanTypePort; AbnormalFlowCleaningServicePortType cleanTypePort;
/**
* Instantiates a new Dp tech.
*
* @param ipAddr the ip addr
*/
public DPTechImpl(String ipAddr) { public DPTechImpl(String ipAddr) {
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean(); JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
jaxWsProxyFactoryBean.setServiceClass(AbnormalFlowCleaningServicePortType.class); jaxWsProxyFactoryBean.setServiceClass(AbnormalFlowCleaningServicePortType.class);
@ -144,6 +209,12 @@ public class DPTechImpl implements DisposeEntryManager {
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create(); this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
} }
/**
* Instantiates a new Dp tech.
*
* @param ipAddr the ip addr
* @param type the type
*/
public DPTechImpl(String ipAddr, ConstValue.IPAddrType type) { public DPTechImpl(String ipAddr, ConstValue.IPAddrType type) {
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean(); JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
jaxWsProxyFactoryBean.setServiceClass(AbnormalFlowCleaningServicePortType.class); jaxWsProxyFactoryBean.setServiceClass(AbnormalFlowCleaningServicePortType.class);

View File

@ -4,6 +4,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Device info.
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@ -18,6 +21,19 @@ public class DeviceInfo {
private int freeMemory; private int freeMemory;
private int cpuUsed; private int cpuUsed;
/**
* Instantiates a new Device info.
*
* @param vendor the vendor
* @param model the model
* @param firmware the firmware
* @param os the os
* @param kernel the kernel
* @param arch the arch
* @param memory the memory
* @param freeMemory the free memory
* @param cpuUsed the cpu used
*/
public DeviceInfo(String vendor, public DeviceInfo(String vendor,
String model, String model,
String firmware, String firmware,

View File

@ -11,16 +11,19 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
/** /**
* 全局异常处理 * The type Global exception handler.
*
* @author phoenix
* @date 2020年2月5日
*/ */
@ControllerAdvice @ControllerAdvice
@Slf4j @Slf4j
public class GlobalExceptionHandler { public class GlobalExceptionHandler {
/**
* Handle exception protocol resp dto.
*
* @param request the request
* @param e the e
* @return the protocol resp dto
*/
@ExceptionHandler(Throwable.class) @ExceptionHandler(Throwable.class)
@ResponseBody @ResponseBody
public ProtocolRespDTO handleException(HttpServletRequest request, Throwable e) { public ProtocolRespDTO handleException(HttpServletRequest request, Throwable e) {
@ -37,6 +40,13 @@ public class GlobalExceptionHandler {
return resp; return resp;
} }
/**
* Param exception protocol resp dto.
*
* @param request the request
* @param e the e
* @return the protocol resp dto
*/
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
@ResponseBody @ResponseBody
public ProtocolRespDTO paramException(HttpServletRequest request, Exception e) { public ProtocolRespDTO paramException(HttpServletRequest request, Exception e) {

View File

@ -6,6 +6,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* The type Git information.
*/
@Getter @Getter
@Setter @Setter
@Component @Component

View File

@ -4,22 +4,80 @@ import com.dispose.common.ErrorCode;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
/**
* The interface User account cache manager.
*/
public interface UserAccountCacheManager { public interface UserAccountCacheManager {
/**
* Gets user token.
*
* @param username the username
* @return the user token
* @throws NoSuchAlgorithmException the no such algorithm exception
*/
String getUserToken(String username) throws NoSuchAlgorithmException; String getUserToken(String username) throws NoSuchAlgorithmException;
/**
* Gets usr pwd err times.
*
* @param username the username
* @return the usr pwd err times
*/
int getUsrPwdErrTimes(String username); int getUsrPwdErrTimes(String username);
/**
* Sets user pwd err times.
*
* @param username the username
* @param errTimes the err times
*/
void setUserPwdErrTimes(String username, Integer errTimes); void setUserPwdErrTimes(String username, Integer errTimes);
/**
* Clean user token.
*
* @param username the username
*/
void cleanUserToken(String username); void cleanUserToken(String username);
/**
* Verify user login error code.
*
* @param username the username
* @param token the token
* @return the error code
*/
ErrorCode verifyUserLogin(String username, String token); ErrorCode verifyUserLogin(String username, String token);
/**
* Verify token error code.
*
* @param token the token
* @return the error code
*/
ErrorCode verifyToken(String token); ErrorCode verifyToken(String token);
/**
* Gets username by token.
*
* @param token the token
* @return the username by token
*/
String getUsernameByToken(String token); String getUsernameByToken(String token);
/**
* Verify permission error code.
*
* @param token the token
* @return the error code
*/
ErrorCode verifyPermission(String token); ErrorCode verifyPermission(String token);
/**
* Gets cache user.
*
* @return the cache user
* @throws JsonProcessingException the json processing exception
*/
String getCacheUser() throws JsonProcessingException; String getCacheUser() throws JsonProcessingException;
} }

View File

@ -18,6 +18,9 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* The type User account cache manager.
*/
@Component @Component
@Slf4j @Slf4j
public class UserAccountCacheManagerImpl implements UserAccountCacheManager { public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
@ -29,6 +32,12 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
private final ConcurrentHashMap<String, UserAccountCache> userAccountCache = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, UserAccountCache> userAccountCache = new ConcurrentHashMap<>();
/**
* Verify permission error code.
*
* @param token the token
* @return the error code
*/
@Override @Override
public ErrorCode verifyPermission(String token) { public ErrorCode verifyPermission(String token) {
if (disposeConfigure.getCheckAdminPermission().equals("false")) { if (disposeConfigure.getCheckAdminPermission().equals("false")) {
@ -46,6 +55,12 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
return ErrorCode.ERR_PERMISSION; return ErrorCode.ERR_PERMISSION;
} }
/**
* Gets username by token.
*
* @param token the token
* @return the username by token
*/
@Override @Override
public String getUsernameByToken(String token) { public String getUsernameByToken(String token) {
if (userAccountCache.containsKey(token)) { if (userAccountCache.containsKey(token)) {
@ -55,6 +70,12 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
return null; return null;
} }
/**
* Verify token error code.
*
* @param token the token
* @return the error code
*/
@Override @Override
public ErrorCode verifyToken(String token) { public ErrorCode verifyToken(String token) {
//userAccountMap //userAccountMap
@ -73,6 +94,13 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
} }
} }
/**
* Verify user login error code.
*
* @param username the username
* @param token the token
* @return the error code
*/
@Override @Override
public ErrorCode verifyUserLogin(String username, String token) { public ErrorCode verifyUserLogin(String username, String token) {
Optional<UserAccountCache> findRet = userAccountCache.values().stream() Optional<UserAccountCache> findRet = userAccountCache.values().stream()
@ -101,11 +129,22 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} }
/**
* Gets cache user.
*
* @return the cache user
* @throws JsonProcessingException the json processing exception
*/
@Override @Override
public String getCacheUser() throws JsonProcessingException { public String getCacheUser() throws JsonProcessingException {
return objectMapper.writeValueAsString(userAccountCache); return objectMapper.writeValueAsString(userAccountCache);
} }
/**
* Clean user token.
*
* @param username the username
*/
@Override @Override
public void cleanUserToken(String username) { public void cleanUserToken(String username) {
Optional<UserAccountCache> findRet = userAccountCache.values().stream() Optional<UserAccountCache> findRet = userAccountCache.values().stream()
@ -118,6 +157,12 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
} }
} }
/**
* Gets usr pwd err times.
*
* @param username the username
* @return the usr pwd err times
*/
@Override @Override
public int getUsrPwdErrTimes(String username) { public int getUsrPwdErrTimes(String username) {
Optional<UserAccountCache> findRet = userAccountCache.values().stream() Optional<UserAccountCache> findRet = userAccountCache.values().stream()
@ -140,6 +185,12 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
} }
} }
/**
* Sets user pwd err times.
*
* @param username the username
* @param errTimes the err times
*/
@Override @Override
public void setUserPwdErrTimes(String username, Integer errTimes) { public void setUserPwdErrTimes(String username, Integer errTimes) {
Optional<UserAccountCache> findRet = userAccountCache.values().stream() Optional<UserAccountCache> findRet = userAccountCache.values().stream()
@ -152,6 +203,13 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
} }
} }
/**
* Gets user token.
*
* @param username the username
* @return the user token
* @throws NoSuchAlgorithmException the no such algorithm exception
*/
@Override @Override
public String getUserToken(String username) throws NoSuchAlgorithmException { public String getUserToken(String username) throws NoSuchAlgorithmException {

View File

@ -5,19 +5,61 @@ import tk.mybatis.mapper.common.IdsMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper; import tk.mybatis.mapper.common.MySqlMapper;
/**
* The interface Dispose device mapper.
*/
public interface DisposeDeviceMapper extends Mapper<DisposeDevice>, public interface DisposeDeviceMapper extends Mapper<DisposeDevice>,
IdsMapper<DisposeDevice>, MySqlMapper<DisposeDevice> { IdsMapper<DisposeDevice>, MySqlMapper<DisposeDevice> {
/**
* Add new dispose device.
*
* @param dev the dev
*/
void addNewDisposeDevice(DisposeDevice dev); void addNewDisposeDevice(DisposeDevice dev);
/**
* Is device exists by ip int.
*
* @param ipAddr the ip addr
* @return the int
*/
int isDeviceExistsByIp(String ipAddr); int isDeviceExistsByIp(String ipAddr);
/**
* Is device exists by id int.
*
* @param id the id
* @return the int
*/
int isDeviceExistsById(Long id); int isDeviceExistsById(Long id);
/**
* Gets device by ip.
*
* @param ipAddr the ip addr
* @return the device by ip
*/
DisposeDevice getDeviceByIp(String ipAddr); DisposeDevice getDeviceByIp(String ipAddr);
/**
* Gets device by id.
*
* @param id the id
* @return the device by id
*/
DisposeDevice getDeviceById(Long id); DisposeDevice getDeviceById(Long id);
/**
* Del dispose device by ip.
*
* @param ipAddr the ip addr
*/
void delDisposeDeviceByIp(String ipAddr); void delDisposeDeviceByIp(String ipAddr);
/**
* Del dispose device by ip.
*
* @param id the id
*/
void delDisposeDeviceByIp(Long id); void delDisposeDeviceByIp(Long id);
} }

View File

@ -3,12 +3,36 @@ package com.dispose.mapper;
import com.dispose.pojo.entity.UserAccount; import com.dispose.pojo.entity.UserAccount;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/**
* The interface User account mapper.
*/
public interface UserAccountMapper { public interface UserAccountMapper {
/**
* Gets user by name.
*
* @param username the username
* @return the user by name
*/
UserAccount getUserByName(String username); UserAccount getUserByName(String username);
/**
* Lock user account.
*
* @param username the username
*/
void lockUserAccount(@Param("username") String username); void lockUserAccount(@Param("username") String username);
/**
* Unlock user account.
*
* @param username the username
*/
void unlockUserAccount(@Param("username") String username); void unlockUserAccount(@Param("username") String username);
/**
* Refresh login time.
*
* @param username the username
*/
void refreshLoginTime(@Param("username") String username); void refreshLoginTime(@Param("username") String username);
} }

View File

@ -9,6 +9,9 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Protocol dto.
*/
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ -35,6 +38,11 @@ public abstract class ProtocolDTO {
example = "{}") example = "{}")
private String msgContent; private String msgContent;
/**
* Is request timeout boolean.
*
* @return the boolean
*/
@JsonIgnore @JsonIgnore
public Boolean isRequestTimeout() { public Boolean isRequestTimeout() {

View File

@ -11,6 +11,9 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
/**
* The type Protocol req dto.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@ -20,16 +23,35 @@ public class ProtocolReqDTO extends ProtocolDTO {
private static String token; private static String token;
/**
* Gets request object.
*
* @param <T> the type parameter
* @param objType the obj type
* @return the request object
* @throws JsonProcessingException the json processing exception
*/
public <T> T getRequestObject(Class<T> objType) throws JsonProcessingException { public <T> T getRequestObject(Class<T> objType) throws JsonProcessingException {
return objMapper.readValue(this.getMsgContent(), objType); return objMapper.readValue(this.getMsgContent(), objType);
} }
/**
* Gets auth token.
*
* @return the auth token
*/
@JsonIgnore @JsonIgnore
public String getAuthToken() { public String getAuthToken() {
return ProtocolReqDTO.token; return ProtocolReqDTO.token;
} }
/**
* Verify request error code.
*
* @param headers the headers
* @return the error code
*/
public ErrorCode verifyRequest(HttpHeaders headers) { public ErrorCode verifyRequest(HttpHeaders headers) {
if (headers == null) { if (headers == null) {
@ -55,6 +77,11 @@ public class ProtocolReqDTO extends ProtocolDTO {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} }
/**
* Verify request error code.
*
* @return the error code
*/
public ErrorCode verifyRequest() { public ErrorCode verifyRequest() {
if (this.getVer() < ConstValue.Protocol.VERSION) { if (this.getVer() < ConstValue.Protocol.VERSION) {

View File

@ -13,6 +13,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Protocol resp dto.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@Builder @Builder
@ -31,6 +34,13 @@ public class ProtocolRespDTO extends ProtocolDTO {
return objectMapper.writeValueAsString(obj); return objectMapper.writeValueAsString(obj);
} }
/**
* Result protocol resp dto.
*
* @param err the err
* @return the protocol resp dto
* @throws JsonProcessingException the json processing exception
*/
public static ProtocolRespDTO result(ErrorCode err) throws JsonProcessingException { public static ProtocolRespDTO result(ErrorCode err) throws JsonProcessingException {
ProtocolRespDTO resp = new ProtocolRespDTO(); ProtocolRespDTO resp = new ProtocolRespDTO();
@ -43,14 +53,37 @@ public class ProtocolRespDTO extends ProtocolDTO {
return resp; return resp;
} }
/**
* Result protocol resp dto.
*
* @param err the err
* @param respMsg the resp msg
* @return the protocol resp dto
*/
public static ProtocolRespDTO result(ErrorCode err, String respMsg) { public static ProtocolRespDTO result(ErrorCode err, String respMsg) {
return result(err, respMsg, ConstValue.Protocol.CRYPTO_NONE); return result(err, respMsg, ConstValue.Protocol.CRYPTO_NONE);
} }
/**
* Result protocol resp dto.
*
* @param err the err
* @param obj the obj
* @return the protocol resp dto
* @throws JsonProcessingException the json processing exception
*/
public static ProtocolRespDTO result(ErrorCode err, Object obj) throws JsonProcessingException { public static ProtocolRespDTO result(ErrorCode err, Object obj) throws JsonProcessingException {
return result(err, getObjectJson(obj), ConstValue.Protocol.CRYPTO_NONE); return result(err, getObjectJson(obj), ConstValue.Protocol.CRYPTO_NONE);
} }
/**
* Result protocol resp dto.
*
* @param err the err
* @param respMsg the resp msg
* @param crypto the crypto
* @return the protocol resp dto
*/
public static ProtocolRespDTO result(ErrorCode err, String respMsg, Integer crypto) { public static ProtocolRespDTO result(ErrorCode err, String respMsg, Integer crypto) {
ProtocolRespDTO resp = new ProtocolRespDTO(); ProtocolRespDTO resp = new ProtocolRespDTO();

View File

@ -17,6 +17,9 @@ import lombok.ToString;
import tk.mybatis.mapper.annotation.NameStyle; import tk.mybatis.mapper.annotation.NameStyle;
import tk.mybatis.mapper.code.Style; import tk.mybatis.mapper.code.Style;
/**
* The type Dispose device.
*/
@Getter @Getter
@Setter @Setter
@ToString @ToString

View File

@ -13,6 +13,9 @@ import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.annotation.NameStyle; import tk.mybatis.mapper.annotation.NameStyle;
import tk.mybatis.mapper.code.Style; import tk.mybatis.mapper.code.Style;
/**
* The type User account.
*/
@Getter @Getter
@Setter @Setter
@ToString @ToString

View File

@ -7,6 +7,9 @@ import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
/**
* The type Dispose device capacity.
*/
@Getter @Getter
@Setter @Setter
@ToString @ToString

View File

@ -3,12 +3,24 @@ package com.dispose.pojo.po;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
/**
* The type M return type.
*
* @param <A> the type parameter
* @param <B> the type parameter
*/
@Getter @Getter
@Builder @Builder
public class MReturnType<A, B> { public class MReturnType<A, B> {
private final A firstParam; private final A firstParam;
private final B secondParam; private final B secondParam;
/**
* Instantiates a new M return type.
*
* @param a the a
* @param b the b
*/
public MReturnType(A a, B b) { public MReturnType(A a, B b) {
this.firstParam = a; this.firstParam = a;
this.secondParam = b; this.secondParam = b;

View File

@ -7,6 +7,9 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/**
* The type New node info.
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor

View File

@ -4,6 +4,9 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Return status.
*/
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ -11,6 +14,11 @@ public class ReturnStatus {
private int status; private int status;
private String message; private String message;
/**
* To string string.
*
* @return the string
*/
@Override @Override
public String toString() { public String toString() {
return "{\"status\":" + status + ", \"message\":\"" + message + "\"}"; return "{\"status\":" + status + ", \"message\":\"" + message + "\"}";

View File

@ -3,6 +3,9 @@ package com.dispose.pojo.po;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
/**
* The type User account cache.
*/
@Data @Data
@Builder @Builder
public class UserAccountCache { public class UserAccountCache {

View File

@ -7,6 +7,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Login req.
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor

View File

@ -9,6 +9,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Login rsp.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@Builder @Builder

View File

@ -8,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Logout rsp.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@Builder @Builder

View File

@ -7,14 +7,28 @@ import lombok.Builder;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
/**
* The type Dispose capacity.
*/
@Setter @Setter
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class DisposeCapacity { public class DisposeCapacity {
/**
* The interface Base view.
*/
public interface BaseView {} public interface BaseView {}
/**
* The interface Capacity view.
*/
public interface CapacityView extends BaseView {} public interface CapacityView extends BaseView {}
/**
* The interface Depend ip view.
*/
public interface DependIpView extends BaseView {} public interface DependIpView extends BaseView {}
@JsonView(BaseView.class) @JsonView(BaseView.class)

View File

@ -5,6 +5,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Id array req.
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor

View File

@ -8,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Id return status.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -8,6 +8,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Add node req.
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor

View File

@ -8,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Add node ret data.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -8,13 +8,22 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
/**
* The type Add node rsp.
*/
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class AddNodeRsp { public class AddNodeRsp {
/**
* The Result.
*/
List<AddNodeRetData> result; List<AddNodeRetData> result;
/**
* Instantiates a new Add node rsp.
*/
public AddNodeRsp() { public AddNodeRsp() {
this.result = new ArrayList<>(); this.result = new ArrayList<>();
} }

View File

@ -12,14 +12,25 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Device capacity data.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@JsonPropertyOrder({"id", "capacity", "status", "message"}) @JsonPropertyOrder({"id", "capacity", "status", "message"})
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class DeviceCapacityData extends IDReturnStatus { public class DeviceCapacityData extends IDReturnStatus {
/**
* The Capacity.
*/
List<DisposeCapacity> capacity; List<DisposeCapacity> capacity;
/**
* Instantiates a new Device capacity data.
*
* @param cpList the cp list
*/
public DeviceCapacityData(List<DisposeDeviceCapacity> cpList) { public DeviceCapacityData(List<DisposeDeviceCapacity> cpList) {
this.capacity = new ArrayList<>(); this.capacity = new ArrayList<>();

View File

@ -6,6 +6,9 @@ import java.util.List;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Device capacity rsp.
*/
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@JsonPropertyOrder({"id", "capacity", "status", "message"}) @JsonPropertyOrder({"id", "capacity", "status", "message"})

View File

@ -8,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Device info data.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@ -18,6 +21,21 @@ public class DeviceInfoData extends DeviceInfo {
private int status; private int status;
private String message; private String message;
/**
* Instantiates a new Device info data.
*
* @param id the id
* @param vendor the vendor
* @param model the model
* @param firmware the firmware
* @param os the os
* @param kernel the kernel
* @param arch the arch
* @param memory the memory
* @param freeMemory the free memory
* @param cpuUsed the cpu used
* @param err the err
*/
public DeviceInfoData(String id, public DeviceInfoData(String id,
String vendor, String vendor,
String model, String model,
@ -35,6 +53,12 @@ public class DeviceInfoData extends DeviceInfo {
this.message = err.getMsg(); this.message = err.getMsg();
} }
/**
* Instantiates a new Device info data.
*
* @param id the id
* @param err the err
*/
public DeviceInfoData(String id, public DeviceInfoData(String id,
ErrorCode err) { ErrorCode err) {
this.id = id; this.id = id;

View File

@ -3,7 +3,13 @@ package com.dispose.pojo.vo.information;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
/**
* The type Device info rsp.
*/
@Data @Data
public class DeviceInfoRsp { public class DeviceInfoRsp {
/**
* The Items.
*/
List<DeviceInfoData> items; List<DeviceInfoData> items;
} }

View File

@ -10,6 +10,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Dispose node data.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@Builder @Builder
@ -27,6 +30,19 @@ public class DisposeNodeData extends DeviceCapacityData {
private String version; private String version;
private String readme; private String readme;
/**
* Instantiates a new Dispose node data.
*
* @param type the type
* @param name the name
* @param ip the ip
* @param areaCode the area code
* @param manufacturer the manufacturer
* @param model the model
* @param version the version
* @param readme the readme
* @param capacity the capacity
*/
public DisposeNodeData(int type, String name, String ip, Integer areaCode, public DisposeNodeData(int type, String name, String ip, Integer areaCode,
String manufacturer, String model, String version, String manufacturer, String model, String version,
String readme, String readme,

View File

@ -4,6 +4,9 @@ import java.util.List;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Dispose node list rsp.
*/
@Data @Data
@NoArgsConstructor @NoArgsConstructor
public class DisposeNodeListRsp { public class DisposeNodeListRsp {

View File

@ -8,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Link status rsp.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@Builder @Builder

View File

@ -8,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**
* The type Version rsp.
*/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@Builder @Builder

View File

@ -5,18 +5,59 @@ import com.dispose.pojo.entity.DisposeDevice;
import com.dispose.pojo.po.MReturnType; import com.dispose.pojo.po.MReturnType;
import java.util.List; import java.util.List;
/**
* The interface Dispose node manager.
*/
public interface DisposeNodeManager { public interface DisposeNodeManager {
/**
* Add new dispose device m return type.
*
* @param dev the dev
* @return the m return type
*/
MReturnType<ErrorCode, String> addNewDisposeDevice(DisposeDevice dev); MReturnType<ErrorCode, String> addNewDisposeDevice(DisposeDevice dev);
/**
* Del dispose device by ip error code.
*
* @param ipAddr the ip addr
* @return the error code
*/
ErrorCode delDisposeDeviceByIp(String ipAddr); ErrorCode delDisposeDeviceByIp(String ipAddr);
/**
* Del dispose device by id error code.
*
* @param id the id
* @return the error code
*/
ErrorCode delDisposeDeviceById(Long id); ErrorCode delDisposeDeviceById(Long id);
/**
* Gets all dispose device.
*
* @return the all dispose device
*/
List<DisposeDevice> getAllDisposeDevice(); List<DisposeDevice> getAllDisposeDevice();
/**
* Gets dispose device by ip.
*
* @param ipAddr the ip addr
* @return the dispose device by ip
*/
DisposeDevice getDisposeDeviceByIp(String ipAddr); DisposeDevice getDisposeDeviceByIp(String ipAddr);
/**
* Gets dispose device by id.
*
* @param id the id
* @return the dispose device by id
*/
DisposeDevice getDisposeDeviceById(Long id); DisposeDevice getDisposeDeviceById(Long id);
/**
* Load dispose node from db.
*/
void loadDisposeNodeFromDB(); void loadDisposeNodeFromDB();
} }

View File

@ -5,12 +5,42 @@ import com.dispose.pojo.entity.UserAccount;
import com.dispose.pojo.po.MReturnType; import com.dispose.pojo.po.MReturnType;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
/**
* The interface User account service.
*/
public interface UserAccountService { public interface UserAccountService {
/**
* Login service m return type.
*
* @param username the username
* @param password the password
* @return the m return type
* @throws NoSuchAlgorithmException the no such algorithm exception
*/
MReturnType<ErrorCode, String> loginService(String username, String password) throws NoSuchAlgorithmException; MReturnType<ErrorCode, String> loginService(String username, String password) throws NoSuchAlgorithmException;
/**
* Logout service error code.
*
* @param username the username
* @param token the token
* @return the error code
*/
ErrorCode logoutService(String username, String token); ErrorCode logoutService(String username, String token);
/**
* Auth token check error code.
*
* @param token the token
* @return the error code
*/
ErrorCode authTokenCheck(String token); ErrorCode authTokenCheck(String token);
/**
* Gets user by token.
*
* @param token the token
* @return the user by token
*/
UserAccount getUserByToken(String token); UserAccount getUserByToken(String token);
} }

View File

@ -16,6 +16,9 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/**
* The type Dispose node manager.
*/
@Service @Service
public class DisposeNodeManagerImpl implements DisposeNodeManager { public class DisposeNodeManagerImpl implements DisposeNodeManager {
@Resource @Resource
@ -26,6 +29,9 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
private final ConcurrentHashMap<String, DisposeDevice> disposeDevMap = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, DisposeDevice> disposeDevMap = new ConcurrentHashMap<>();
/**
* Load dispose node from db.
*/
@Override @Override
public void loadDisposeNodeFromDB() { public void loadDisposeNodeFromDB() {
List<DisposeDevice> devList = disposeDeviceMapper.selectAll(); List<DisposeDevice> devList = disposeDeviceMapper.selectAll();
@ -49,6 +55,12 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
}); });
} }
/**
* Del dispose device by id error code.
*
* @param id the id
* @return the error code
*/
@Override @Override
public ErrorCode delDisposeDeviceById(Long id) { public ErrorCode delDisposeDeviceById(Long id) {
DisposeEntryManager dp; DisposeEntryManager dp;
@ -61,6 +73,12 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
return delDisposeDeviceByIp(dev.getIpAddr()); return delDisposeDeviceByIp(dev.getIpAddr());
} }
/**
* Del dispose device by ip error code.
*
* @param ipAddr the ip addr
* @return the error code
*/
@Override @Override
public ErrorCode delDisposeDeviceByIp(String ipAddr) { public ErrorCode delDisposeDeviceByIp(String ipAddr) {
DisposeEntryManager dp; DisposeEntryManager dp;
@ -88,6 +106,12 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} }
/**
* Add new dispose device m return type.
*
* @param dev the dev
* @return the m return type
*/
@Override @Override
public MReturnType<ErrorCode, String> addNewDisposeDevice(DisposeDevice dev) { public MReturnType<ErrorCode, String> addNewDisposeDevice(DisposeDevice dev) {
DisposeEntryManager dp; DisposeEntryManager dp;
@ -125,16 +149,33 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
return new MReturnType<>(ErrorCode.ERR_OK, dev.getIpAddr()); return new MReturnType<>(ErrorCode.ERR_OK, dev.getIpAddr());
} }
/**
* Gets all dispose device.
*
* @return the all dispose device
*/
@Override @Override
public List<DisposeDevice> getAllDisposeDevice() { public List<DisposeDevice> getAllDisposeDevice() {
return new ArrayList<>(disposeDevMap.values()); return new ArrayList<>(disposeDevMap.values());
} }
/**
* Gets dispose device by ip.
*
* @param ipAddr the ip addr
* @return the dispose device by ip
*/
@Override @Override
public DisposeDevice getDisposeDeviceByIp(String ipAddr) { public DisposeDevice getDisposeDeviceByIp(String ipAddr) {
return disposeDevMap.get(ipAddr); return disposeDevMap.get(ipAddr);
} }
/**
* Gets dispose device by id.
*
* @param id the id
* @return the dispose device by id
*/
@Override @Override
public DisposeDevice getDisposeDeviceById(Long id) { public DisposeDevice getDisposeDeviceById(Long id) {
Optional<DisposeDevice> findRet = disposeDevMap.values().stream() Optional<DisposeDevice> findRet = disposeDevMap.values().stream()

View File

@ -12,6 +12,9 @@ import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/**
* The type User account service.
*/
@Service @Service
@Slf4j @Slf4j
public class UserAccountServiceImpl implements UserAccountService { public class UserAccountServiceImpl implements UserAccountService {
@ -22,6 +25,12 @@ public class UserAccountServiceImpl implements UserAccountService {
@Resource @Resource
private UserAccountMapper userAccountMapper; private UserAccountMapper userAccountMapper;
/**
* Auth token check error code.
*
* @param token the token
* @return the error code
*/
@Override @Override
public ErrorCode authTokenCheck(String token) { public ErrorCode authTokenCheck(String token) {
@ -32,6 +41,14 @@ public class UserAccountServiceImpl implements UserAccountService {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} }
/**
* Login service m return type.
*
* @param username the username
* @param password the password
* @return the m return type
* @throws NoSuchAlgorithmException the no such algorithm exception
*/
@Override @Override
public MReturnType<ErrorCode, String> loginService(String username, String password) throws NoSuchAlgorithmException { public MReturnType<ErrorCode, String> loginService(String username, String password) throws NoSuchAlgorithmException {
userAccountMapper.refreshLoginTime(username); userAccountMapper.refreshLoginTime(username);
@ -80,6 +97,13 @@ public class UserAccountServiceImpl implements UserAccountService {
.build(); .build();
} }
/**
* Logout service error code.
*
* @param username the username
* @param token the token
* @return the error code
*/
@Override @Override
public ErrorCode logoutService(String username, String token) { public ErrorCode logoutService(String username, String token) {
UserAccount loginUser = userAccountMapper.getUserByName(username); UserAccount loginUser = userAccountMapper.getUserByName(username);
@ -97,6 +121,12 @@ public class UserAccountServiceImpl implements UserAccountService {
return err; return err;
} }
/**
* Gets user by token.
*
* @param token the token
* @return the user by token
*/
@Override @Override
public UserAccount getUserByToken(String token) { public UserAccount getUserByToken(String token) {

View File

@ -12,6 +12,9 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* The type Device manager task.
*/
@Component @Component
@Slf4j @Slf4j
public class DeviceManagerTask { public class DeviceManagerTask {
@ -19,7 +22,7 @@ public class DeviceManagerTask {
private DisposeNodeManager disposeNodeManager; private DisposeNodeManager disposeNodeManager;
/** /**
* Corn 小时 日期 月份 星期 每10秒执行 * Thread pool task.
*/ */
@Async("bizExecutor") @Async("bizExecutor")
@Scheduled(cron = "0/30 * * * * ?") @Scheduled(cron = "0/30 * * * * ?")

View File

@ -1,20 +1,20 @@
#Generated by Git-Commit-Id-Plugin #Generated by Git-Commit-Id-Plugin
#Mon Apr 20 15:47:47 CST 2020 #Tue Apr 21 15:12:20 CST 2020
git.branch=v2_dev git.branch=master
git.build.host=DESKTOP-GJUT8MA git.build.host=DESKTOP-GJUT8MA
git.build.time=2020-04-20T15\:47\:47+0800 git.build.time=2020-04-21T15\:12\:20+0800
git.build.user.email=huangxin@\u0096cmhi.chinamobile.com git.build.user.email=huangxin@\u0096cmhi.chinamobile.com
git.build.user.name=HuangXin git.build.user.name=HuangXin
git.build.version=1.0.0 git.build.version=1.0.0
git.closest.tag.commit.count= git.closest.tag.commit.count=
git.closest.tag.name= git.closest.tag.name=
git.commit.id=edff379c6495dcfd4488cab48dd1d30167f3e06a git.commit.id=4c06518a8623bb94f3da53fa27e43cd5c60625e0
git.commit.id.abbrev=edff379 git.commit.id.abbrev=4c06518
git.commit.id.describe=edff379-dirty git.commit.id.describe=4c06518-dirty
git.commit.id.describe-short=edff379-dirty git.commit.id.describe-short=4c06518-dirty
git.commit.message.full=OCT\nREM\:\n1. \u589E\u52A0\u542F\u52A8\u65F6\u81EA\u52A8\u52A0\u8F7D\u6240\u6709\u5904\u7F6E\u8BBE\u5907\u529F\u80FD\n2. \u589E\u52A0\u8C03\u8BD5\u76F8\u5173\u914D\u7F6E\u9879\u5F00\u5173\u529F\u80FD\n3. \u589E\u52A0\u5904\u7F6E\u8282\u70B9\u4FE1\u606F\u83B7\u53D6\u63A5\u53E3\n4. \u589E\u52A0\u8282\u70B9\u7BA1\u7406\u6743\u9650\u9A8C\u8BC1\u529F\u80FD\n5. \u589E\u52A0\u8282\u70B9\u4FE1\u606F\u81EA\u52A8\u66F4\u65B0\u529F\u80FD\n6. \u589E\u52A0\u5BF9\u5E94\u63A5\u53E3\uFF0C\u529F\u80FD\u5355\u5143\u6D4B\u8BD5\u7528\u4F8B git.commit.message.full=OCT\nREM\:\n1. \u6DFB\u52A0idea\u5DE5\u7A0B\u914D\u7F6E\u6587\u4EF6\u8FC7\u6EE4\u89C4\u5219
git.commit.message.short=OCT REM\: 1. \u589E\u52A0\u542F\u52A8\u65F6\u81EA\u52A8\u52A0\u8F7D\u6240\u6709\u5904\u7F6E\u8BBE\u5907\u529F\u80FD 2. \u589E\u52A0\u8C03\u8BD5\u76F8\u5173\u914D\u7F6E\u9879\u5F00\u5173\u529F\u80FD 3. \u589E\u52A0\u5904\u7F6E\u8282\u70B9\u4FE1\u606F\u83B7\u53D6\u63A5\u53E3 4. \u589E\u52A0\u8282\u70B9\u7BA1\u7406\u6743\u9650\u9A8C\u8BC1\u529F\u80FD 5. \u589E\u52A0\u8282\u70B9\u4FE1\u606F\u81EA\u52A8\u66F4\u65B0\u529F\u80FD 6. \u589E\u52A0\u5BF9\u5E94\u63A5\u53E3\uFF0C\u529F\u80FD\u5355\u5143\u6D4B\u8BD5\u7528\u4F8B git.commit.message.short=OCT REM\: 1. \u6DFB\u52A0idea\u5DE5\u7A0B\u914D\u7F6E\u6587\u4EF6\u8FC7\u6EE4\u89C4\u5219
git.commit.time=2020-04-17T20\:38\:41+0800 git.commit.time=2020-04-21T15\:06\:48+0800
git.commit.user.email=huangxin@cmhi.chinamobile.com git.commit.user.email=huangxin@cmhi.chinamobile.com
git.commit.user.name=huangxin git.commit.user.name=huangxin
git.dirty=true git.dirty=true
@ -22,4 +22,4 @@ git.local.branch.ahead=0
git.local.branch.behind=0 git.local.branch.behind=0
git.remote.origin.url=git@git.komect.net\:DDOSAQ/phoenix_ddos_handle.git git.remote.origin.url=git@git.komect.net\:DDOSAQ/phoenix_ddos_handle.git
git.tags= git.tags=
git.total.commit.count=43 git.total.commit.count=47

View File

@ -10,6 +10,9 @@ import com.dispose.mapper.UserAccountMapperTest;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
/**
* The type All dispose platform test.
*/
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({ @Suite.SuiteClasses({
DPTechInterfaceTestCase.class, DPTechInterfaceTestCase.class,

View File

@ -23,6 +23,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* The type Auth controller test.
*/
@AutoConfigureMockMvc @AutoConfigureMockMvc
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ -37,6 +40,11 @@ public class AuthControllerTest {
static private String logToken = ""; static private String logToken = "";
/**
* Login 1.
*
* @throws Exception the exception
*/
@Test @Test
public void login1() throws Exception { public void login1() throws Exception {
LoginReq logReq = LoginReq.builder() LoginReq logReq = LoginReq.builder()
@ -67,6 +75,11 @@ public class AuthControllerTest {
log.info("Login Token:" + logToken); log.info("Login Token:" + logToken);
} }
/**
* Logout 2.
*
* @throws Exception the exception
*/
@Test @Test
public void logout2() throws Exception { public void logout2() throws Exception {
LoginReq logReq = LoginReq.builder() LoginReq logReq = LoginReq.builder()

View File

@ -24,6 +24,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* The type Device node info controller test.
*/
@AutoConfigureMockMvc @AutoConfigureMockMvc
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ -51,6 +54,11 @@ public class DeviceNodeInfoControllerTest {
return -1L; return -1L;
} }
/**
* T 1 get version.
*
* @throws Exception the exception
*/
@Test @Test
public void t1_getVersion() throws Exception { public void t1_getVersion() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()
@ -77,6 +85,11 @@ public class DeviceNodeInfoControllerTest {
.getContentAsString(); .getContentAsString();
} }
/**
* T 2 get device info.
*
* @throws Exception the exception
*/
@Test @Test
public void t2_getDeviceInfo() throws Exception { public void t2_getDeviceInfo() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()
@ -103,6 +116,11 @@ public class DeviceNodeInfoControllerTest {
.getContentAsString(); .getContentAsString();
} }
/**
* T 3 get device capacity.
*
* @throws Exception the exception
*/
@Test @Test
public void t3_getDeviceCapacity() throws Exception { public void t3_getDeviceCapacity() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()
@ -129,6 +147,11 @@ public class DeviceNodeInfoControllerTest {
.getContentAsString(); .getContentAsString();
} }
/**
* T 3 get device protected ip.
*
* @throws Exception the exception
*/
@Test @Test
public void t3_getDeviceProtectedIp() throws Exception { public void t3_getDeviceProtectedIp() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()
@ -155,6 +178,11 @@ public class DeviceNodeInfoControllerTest {
.getContentAsString(); .getContentAsString();
} }
/**
* T 3 get dispose node list.
*
* @throws Exception the exception
*/
@Test @Test
public void t3_getDisposeNodeList() throws Exception { public void t3_getDisposeNodeList() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()
@ -181,6 +209,11 @@ public class DeviceNodeInfoControllerTest {
.getContentAsString(); .getContentAsString();
} }
/**
* T 3 get dispose node details.
*
* @throws Exception the exception
*/
@Test @Test
public void t3_getDisposeNodeDetails() throws Exception { public void t3_getDisposeNodeDetails() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()

View File

@ -25,6 +25,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* The type Device node manager controller test.
*/
@AutoConfigureMockMvc @AutoConfigureMockMvc
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ -37,6 +40,11 @@ public class DeviceNodeManagerControllerTest {
@Resource @Resource
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
/**
* T 1 add device.
*
* @throws Exception the exception
*/
@Test @Test
public void t1_addDevice() throws Exception { public void t1_addDevice() throws Exception {
AddNodeReq addReq = AddNodeReq.builder() AddNodeReq addReq = AddNodeReq.builder()
@ -85,6 +93,11 @@ public class DeviceNodeManagerControllerTest {
.getContentAsString(); .getContentAsString();
} }
/**
* T 2 del device.
*
* @throws Exception the exception
*/
@Test @Test
public void t2_delDevice() throws Exception { public void t2_delDevice() throws Exception {
IDArrayReq reqData = IDArrayReq.builder() IDArrayReq reqData = IDArrayReq.builder()

View File

@ -18,6 +18,9 @@ import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
/**
* The type Dp tech interface test case.
*/
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
@ -25,6 +28,9 @@ public class DPTechInterfaceTestCase {
@Resource @Resource
private ObjectMapper objMapper; private ObjectMapper objMapper;
/**
* Get all detection object from umc.
*/
@Test @Test
public void getAllDetectionObjectFromUMC(){ public void getAllDetectionObjectFromUMC(){
@ -40,6 +46,9 @@ public class DPTechInterfaceTestCase {
} }
} }
/**
* Get all protect devices.
*/
@Test @Test
public void getAllProtectDevices(){ public void getAllProtectDevices(){
@ -55,6 +64,9 @@ public class DPTechInterfaceTestCase {
} }
} }
/**
* Get all protect objects.
*/
@Test @Test
public void getAllProtectObjects(){ public void getAllProtectObjects(){
@ -70,6 +82,9 @@ public class DPTechInterfaceTestCase {
} }
} }
/**
* Get link status.
*/
@Test @Test
public void getLinkStatus(){ public void getLinkStatus(){
@ -79,6 +94,11 @@ public class DPTechInterfaceTestCase {
Assert.assertTrue(dp.getDeviceLinkStatus()); Assert.assertTrue(dp.getDeviceLinkStatus());
} }
/**
* Gets device capacity.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void getDeviceCapacity() throws JsonProcessingException { public void getDeviceCapacity() throws JsonProcessingException {

View File

@ -19,6 +19,9 @@ import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* The type Dispose device mapper test.
*/
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
@ -33,6 +36,11 @@ public class DisposeDeviceMapperTest {
@Resource @Resource
private DisposeNodeManager disposeNodeManager; private DisposeNodeManager disposeNodeManager;
/**
* T 1 add new dispose device.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t1_addNewDisposeDevice() throws JsonProcessingException { public void t1_addNewDisposeDevice() throws JsonProcessingException {
Long devId = -1L; Long devId = -1L;
@ -59,6 +67,11 @@ public class DisposeDeviceMapperTest {
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dp)); log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dp));
} }
/**
* T 2 is device exists by ip.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t2_isDeviceExistsByIp() throws JsonProcessingException { public void t2_isDeviceExistsByIp() throws JsonProcessingException {
List<DisposeDevice> dp = disposeDeviceMapper.selectAll(); List<DisposeDevice> dp = disposeDeviceMapper.selectAll();
@ -69,6 +82,11 @@ public class DisposeDeviceMapperTest {
}); });
} }
/**
* T 3 is device exists by id.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t3_isDeviceExistsById() throws JsonProcessingException { public void t3_isDeviceExistsById() throws JsonProcessingException {
List<DisposeDevice> dp = disposeDeviceMapper.selectAll(); List<DisposeDevice> dp = disposeDeviceMapper.selectAll();
@ -79,6 +97,11 @@ public class DisposeDeviceMapperTest {
}); });
} }
/**
* T 4 get device exists by ip.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t4_getDeviceExistsByIp() throws JsonProcessingException { public void t4_getDeviceExistsByIp() throws JsonProcessingException {
List<DisposeDevice> dp = disposeDeviceMapper.selectAll(); List<DisposeDevice> dp = disposeDeviceMapper.selectAll();
@ -91,6 +114,11 @@ public class DisposeDeviceMapperTest {
}); });
} }
/**
* T 5 get device exists by id.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t5_getDeviceExistsById() throws JsonProcessingException { public void t5_getDeviceExistsById() throws JsonProcessingException {
List<DisposeDevice> dp = disposeDeviceMapper.selectAll(); List<DisposeDevice> dp = disposeDeviceMapper.selectAll();
@ -103,6 +131,11 @@ public class DisposeDeviceMapperTest {
}); });
} }
/**
* T 100 del dispose device by ip.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t100_delDisposeDeviceByIp() throws JsonProcessingException { public void t100_delDisposeDeviceByIp() throws JsonProcessingException {
String ipAddr = "10.88.77.15"; String ipAddr = "10.88.77.15";

View File

@ -16,6 +16,9 @@ import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
/**
* The type User account mapper test.
*/
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
@ -27,6 +30,11 @@ public class UserAccountMapperTest {
@Resource @Resource
private UserAccountMapper userAccountMapper; private UserAccountMapper userAccountMapper;
/**
* T 1 get user by name.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t1_getUserByName() throws JsonProcessingException { public void t1_getUserByName() throws JsonProcessingException {
UserAccount user = userAccountMapper.getUserByName("admin"); UserAccount user = userAccountMapper.getUserByName("admin");
@ -36,6 +44,11 @@ public class UserAccountMapperTest {
Assert.assertNotNull(user); Assert.assertNotNull(user);
} }
/**
* T 2 lock user.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t2_lockUser() throws JsonProcessingException { public void t2_lockUser() throws JsonProcessingException {
userAccountMapper.lockUserAccount("admin"); userAccountMapper.lockUserAccount("admin");
@ -46,6 +59,11 @@ public class UserAccountMapperTest {
} }
/**
* T 3 refresh login time.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t3_refreshLoginTime() throws JsonProcessingException { public void t3_refreshLoginTime() throws JsonProcessingException {
userAccountMapper.refreshLoginTime("admin"); userAccountMapper.refreshLoginTime("admin");
@ -55,6 +73,11 @@ public class UserAccountMapperTest {
log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(user)); log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(user));
} }
/**
* T 4 unlock user.
*
* @throws JsonProcessingException the json processing exception
*/
@Test @Test
public void t4_unlockUser() throws JsonProcessingException { public void t4_unlockUser() throws JsonProcessingException {
userAccountMapper.unlockUserAccount("admin"); userAccountMapper.unlockUserAccount("admin");