Compare commits
2 Commits
30c201a230
...
c26a183209
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c26a183209 | ||
![]() |
4b8dfe978a |
@ -44,23 +44,21 @@ public class MachineEnvController {
|
|||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除机器的环境变量")
|
@Operation(summary = "删除机器的环境变量")
|
||||||
public CommonResult deleteByMachineId(
|
public CommonResult deleteByMachineId(@RequestParam Long machineEvnId) {
|
||||||
@RequestParam Long machineId) {
|
machineEnvService.deleteByMachineId(machineEvnId);
|
||||||
machineEnvService.deleteByMachineId(machineId);
|
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/deleteList")
|
@DeleteMapping("/deleteList")
|
||||||
@Operation(summary = "批量删除机器环境变量")
|
@Operation(summary = "批量删除机器环境变量")
|
||||||
public CommonResult deleteList(@RequestParam List<Long> ids){
|
public CommonResult deleteList(@RequestParam String ids){
|
||||||
machineEnvService.deleteList(ids);
|
machineEnvService.deleteList(ids);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getByMachineId")
|
@GetMapping("/getByMachineId")
|
||||||
@Operation(summary = "获取机器的环境变量")
|
@Operation(summary = "获取机器的环境变量")
|
||||||
public CommonResult getByMachineId(
|
public CommonResult getByMachineId(@RequestParam Long machineId) {
|
||||||
@RequestParam Long machineId) {
|
|
||||||
return success(machineEnvService.getByMachineId(machineId));
|
return success(machineEnvService.getByMachineId(machineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import cd.casic.module.machine.entity.MachineInfo;
|
|||||||
import cd.casic.module.machine.enums.ConnectionStatus;
|
import cd.casic.module.machine.enums.ConnectionStatus;
|
||||||
import cd.casic.module.machine.service.MachineInfoService;
|
import cd.casic.module.machine.service.MachineInfoService;
|
||||||
import cd.casic.module.machine.dto.MachineInfoDto;
|
import cd.casic.module.machine.dto.MachineInfoDto;
|
||||||
import cd.casic.module.machine.pojo.SuccessResponseData;
|
|
||||||
|
|
||||||
import cd.casic.module.machine.utils.PageResult;
|
import cd.casic.module.machine.utils.PageResult;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -33,7 +32,7 @@ public class MachineInfoController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "获取机器信息列表")
|
@Operation(summary = "获取机器信息列表")
|
||||||
public CommonResult<PageResult<MachineInfoDto>> list(@RequestBody MachineInfoDto machineInfoDto) {
|
public CommonResult<PageResult<MachineInfoDto>> list(@RequestBody MachineInfoDto machineInfoDto) {
|
||||||
return success(machineInfoService.listMachineInfo(machineInfoDto));
|
return success(machineInfoService.listMachineInfo(machineInfoDto));
|
||||||
@ -47,26 +46,26 @@ public class MachineInfoController {
|
|||||||
|
|
||||||
@PutMapping("/updateStatus")
|
@PutMapping("/updateStatus")
|
||||||
@Operation(summary = "机器启用/停用")
|
@Operation(summary = "机器启用/停用")
|
||||||
public CommonResult<Boolean> updateStatus(@RequestParam("machineInfoId") Long machineInfoId, @RequestParam("status") String status) {
|
public CommonResult<Boolean> updateStatus(@RequestBody MachineInfoDto machineInfoDto) {
|
||||||
return success(machineInfoService.updateStatus(machineInfoId, status));
|
return success(machineInfoService.updateStatus(machineInfoDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/bindingSecretKey")
|
@PutMapping("/bindingSecretKey")
|
||||||
@Operation(summary = "绑定密钥")
|
@Operation(summary = "绑定密钥")
|
||||||
public CommonResult<Boolean> bindingSecretKey(@RequestParam("machineInfoId") Long machineInfoId, @RequestParam("secretKeyId") Long secretKeyId) {
|
public CommonResult<Boolean> bindingSecretKey(@RequestBody MachineInfoDto machineInfoDto) {
|
||||||
return success(machineInfoService.bindingSecretKey(machineInfoId, secretKeyId));
|
return success(machineInfoService.bindingSecretKey(machineInfoDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "机器信息删除")
|
@Operation(summary = "机器信息删除")
|
||||||
public CommonResult<Boolean> delete(@RequestParam("machineInfoId") Long machineInfoId) {
|
public CommonResult<Boolean> delete(@RequestParam Long machineInfoId) {
|
||||||
machineInfoService.deleteMachineInfo(machineInfoId);
|
machineInfoService.deleteMachineInfo(machineInfoId);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/deleteList")
|
@DeleteMapping("/deleteList")
|
||||||
@Operation(summary = "批量删除机器信息")
|
@Operation(summary = "批量删除机器信息")
|
||||||
public CommonResult<Boolean> deleteList(@RequestParam("machineInfoIds") List<Long> machineInfoIds) {
|
public CommonResult<Boolean> deleteList(@RequestParam String machineInfoIds) {
|
||||||
machineInfoService.deleteList(machineInfoIds);
|
machineInfoService.deleteList(machineInfoIds);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class MachineProxyController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary ="获取代理列表")
|
@Operation(summary ="获取代理列表")
|
||||||
public CommonResult list(MachineProxyDTO machineProxyDTO) {
|
public CommonResult list(MachineProxyDTO machineProxyDTO) {
|
||||||
return success(machineProxyService.list(machineProxyDTO));
|
return success(machineProxyService.list(machineProxyDTO));
|
||||||
@ -52,18 +52,17 @@ public class MachineProxyController {
|
|||||||
return success(machineProxyService.getStatusStatistics());
|
return success(machineProxyService.getStatusStatistics());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/updateConfig")
|
@PutMapping("/update")
|
||||||
@Operation(summary ="更新代理配置")
|
@Operation(summary ="更新代理信息")
|
||||||
public CommonResult updateConfig(@RequestBody MachineProxyDTO machineProxyDTO) {
|
public CommonResult updateConfig(@RequestBody MachineProxyDTO machineProxyDTO) {
|
||||||
machineProxyService.updateConfig(machineProxyDTO);
|
machineProxyService.update(machineProxyDTO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/batch")
|
@DeleteMapping("/batch")
|
||||||
@Operation(summary ="批量删除代理")
|
@Operation(summary ="批量删除代理")
|
||||||
public CommonResult deleteBatch(@RequestParam List<Long> ids) {
|
public CommonResult deleteBatch(@RequestParam String ids) {
|
||||||
machineProxyService.delete(ids);
|
return success(machineProxyService.delete(ids));
|
||||||
return success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestPart;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cd.casic.framework.commons.pojo.CommonResult.success;
|
import static cd.casic.framework.commons.pojo.CommonResult.success;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -38,8 +36,8 @@ public class SecretKeyController {
|
|||||||
|
|
||||||
@PutMapping("/bindingMachine")
|
@PutMapping("/bindingMachine")
|
||||||
@Operation(summary ="绑定机器")
|
@Operation(summary ="绑定机器")
|
||||||
public CommonResult<Boolean> bindingMachine(@RequestParam("secretKeyId") Long secretKeyId, @RequestParam("machineInfoIds") List<Long> machineInfoIds) {
|
public CommonResult<Boolean> bindingMachine(@RequestBody SecretKeyDto secretKeyDto) {
|
||||||
secretKeyService.bindingMachine(secretKeyId, machineInfoIds);
|
secretKeyService.bindingMachine(secretKeyDto);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,17 +50,17 @@ public class SecretKeyController {
|
|||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary ="删除密钥")
|
@Operation(summary ="删除密钥")
|
||||||
public CommonResult<Boolean> delete(@RequestParam("secretKeyId") Long secretKeyId) {
|
public CommonResult<Boolean> delete(@RequestParam Long secretKeyId) {
|
||||||
return success(secretKeyService.deleteSecretKey(secretKeyId));
|
return success(secretKeyService.deleteSecretKey(secretKeyId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/deleteList")
|
@DeleteMapping("/deleteList")
|
||||||
@Operation(summary ="批量删除密钥")
|
@Operation(summary ="批量删除密钥")
|
||||||
public CommonResult<Boolean> deleteList(@RequestParam("secretKeyId") List<Long> secretKeyIds) {
|
public CommonResult<Boolean> deleteList(@RequestParam String secretKeyIds) {
|
||||||
return success(secretKeyService.deleteList(secretKeyIds));
|
return success(secretKeyService.deleteList(secretKeyIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary ="获取密钥信息列表")
|
@Operation(summary ="获取密钥信息列表")
|
||||||
public CommonResult<PageResult<SecretKey>> list(@RequestBody SecretKeyDto secretKeyDto) {
|
public CommonResult<PageResult<SecretKey>> list(@RequestBody SecretKeyDto secretKeyDto) {
|
||||||
return success(secretKeyService.listSecretKey(secretKeyDto));
|
return success(secretKeyService.listSecretKey(secretKeyDto));
|
||||||
|
@ -19,27 +19,10 @@ public class MachineEnvDTO extends PageDto implements Serializable {
|
|||||||
private Long id;
|
private Long id;
|
||||||
private String envKey;
|
private String envKey;
|
||||||
private String envValue;
|
private String envValue;
|
||||||
private Integer sensitive;//(1敏感,0不敏感)
|
|
||||||
private String description;
|
private String description;
|
||||||
private Long machineId;
|
private Long machineId;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
private String sortField;
|
private String sortField;
|
||||||
private String sortDirection;
|
private String sortDirection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取脱敏后的环境变量值
|
|
||||||
*/
|
|
||||||
public String getMaskedValue() {
|
|
||||||
if (sensitive==1 || envValue == null) {
|
|
||||||
return envValue;
|
|
||||||
}
|
|
||||||
int length = envValue.length();
|
|
||||||
if (length <= 4) {
|
|
||||||
return "****";
|
|
||||||
} else {
|
|
||||||
return envValue.substring(0, 2) + "****" + envValue.substring(length - 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class MachineInfoDto extends cd.casic.module.machine.dto.PageDto {
|
public class MachineInfoDto extends PageDto {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
@ -41,4 +41,6 @@ public class MachineInfoDto extends cd.casic.module.machine.dto.PageDto {
|
|||||||
private String authenticationType;
|
private String authenticationType;
|
||||||
|
|
||||||
private String machineInfoType;
|
private String machineInfoType;
|
||||||
|
|
||||||
|
private int isProxy;
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,12 @@ public class MachineProxyDTO extends PageDto implements Serializable {
|
|||||||
private String version;
|
private String version;
|
||||||
private String status;
|
private String status;
|
||||||
private Date lastHeartbeatTime;
|
private Date lastHeartbeatTime;
|
||||||
private String config;
|
|
||||||
private String description;
|
private String description;
|
||||||
private String hostIp;
|
private String hostIp;
|
||||||
private String sshPort;
|
private String sshPort;
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算代理是否在线
|
* 计算代理是否在线
|
||||||
|
@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ -33,4 +34,6 @@ public class SecretKeyDto extends PageDto {
|
|||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
|
|
||||||
|
private List<Long> machineInfoIds;
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,6 @@ public class MachineEnv extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String envValue;
|
private String envValue;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否敏感
|
|
||||||
*/
|
|
||||||
@TableField("`sensitive`")
|
|
||||||
private Integer sensitive;//(1敏感,0不敏感)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述信息
|
* 描述信息
|
||||||
|
@ -63,4 +63,7 @@ public class MachineInfo extends BaseEntity{
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private AuthenticationType authenticationType;
|
private AuthenticationType authenticationType;
|
||||||
|
|
||||||
|
@TableField(value = "is_proxy")
|
||||||
|
private int isProxy;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cd.casic.module.machine.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import cd.casic.module.machine.enums.MachineInfoStatus;
|
import cd.casic.module.machine.enums.MachineInfoStatus;
|
||||||
import cd.casic.module.machine.enums.MachineProxyType;
|
import cd.casic.module.machine.enums.MachineProxyType;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -19,8 +20,10 @@ import java.util.Date;
|
|||||||
public class MachineProxy extends BaseEntity implements Serializable {
|
public class MachineProxy extends BaseEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableField(value = "host_ip")
|
||||||
private String hostIp;
|
private String hostIp;
|
||||||
|
|
||||||
|
@TableField(value = "ssh_port")
|
||||||
private String sshPort;
|
private String sshPort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,11 +32,13 @@ public class MachineProxy extends BaseEntity implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private MachineProxyType proxyType;
|
private MachineProxyType proxyType;
|
||||||
|
|
||||||
|
@TableField(value = "proxy_type_code")
|
||||||
private int proxyTypeCode;
|
private int proxyTypeCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理版本
|
* 代理版本
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "version")
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,22 +47,23 @@ public class MachineProxy extends BaseEntity implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private MachineInfoStatus status;
|
private MachineInfoStatus status;
|
||||||
|
|
||||||
|
@TableField(value = "status_code")
|
||||||
private int statusCode;
|
private int statusCode;
|
||||||
|
|
||||||
|
@TableField(value = "username")
|
||||||
|
private String username;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最后心跳时间
|
* 最后心跳时间
|
||||||
*/
|
*/
|
||||||
private Date lastHeartbeatTime;
|
private Date lastHeartbeatTime;
|
||||||
|
|
||||||
/**
|
@TableField(value = "password")
|
||||||
* 代理配置 (JSON格式)
|
private String password;
|
||||||
*/
|
|
||||||
private String config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述信息
|
* 描述信息
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package cd.casic.module.machine.pojo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class ErrorResponseData extends ResponseData {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异常的具体类名称
|
|
||||||
*/
|
|
||||||
private String exceptionClazz;
|
|
||||||
|
|
||||||
public ErrorResponseData(String message) {
|
|
||||||
super(false, DEFAULT_ERROR_CODE, message, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseData(Integer code, String message) {
|
|
||||||
super(false, code, message, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ErrorResponseData(Integer code, String message, Object object) {
|
|
||||||
super(false, code, message, object);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
package cd.casic.module.machine.pojo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应结果数据
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ResponseData {
|
|
||||||
|
|
||||||
public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功";
|
|
||||||
|
|
||||||
public static final String DEFAULT_ERROR_MESSAGE = "网络异常";
|
|
||||||
|
|
||||||
public static final Integer DEFAULT_SUCCESS_CODE = 200;
|
|
||||||
|
|
||||||
public static final Integer DEFAULT_ERROR_CODE = 500;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求是否成功
|
|
||||||
*/
|
|
||||||
private Boolean success;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应状态码
|
|
||||||
*/
|
|
||||||
private Integer code;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应信息
|
|
||||||
*/
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应对象
|
|
||||||
*/
|
|
||||||
private Object data;
|
|
||||||
|
|
||||||
public ResponseData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResponseData(Boolean success, Integer code, String message, Object data) {
|
|
||||||
this.success = success;
|
|
||||||
this.code = code;
|
|
||||||
this.message = message;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SuccessResponseData success() {
|
|
||||||
return new SuccessResponseData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SuccessResponseData success(Object object) {
|
|
||||||
return new SuccessResponseData(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SuccessResponseData success(Integer code, String message, Object object) {
|
|
||||||
return new SuccessResponseData(code, message, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ErrorResponseData error(String message) {
|
|
||||||
return new ErrorResponseData(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ErrorResponseData error(Integer code, String message) {
|
|
||||||
return new ErrorResponseData(code, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ErrorResponseData error(Integer code, String message, Object object) {
|
|
||||||
return new ErrorResponseData(code, message, object);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cd.casic.module.machine.pojo;
|
|
||||||
|
|
||||||
public class SuccessResponseData extends ResponseData {
|
|
||||||
|
|
||||||
public SuccessResponseData() {
|
|
||||||
super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SuccessResponseData(Object object) {
|
|
||||||
super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SuccessResponseData(Integer code, String message, Object object) {
|
|
||||||
super(true, code, message, object);
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,9 +18,8 @@ public interface MachineEnvService extends IService<MachineEnv> {
|
|||||||
boolean add(MachineEnvDTO machineEnvDTO);
|
boolean add(MachineEnvDTO machineEnvDTO);
|
||||||
/**
|
/**
|
||||||
* 删除机器的环境变量
|
* 删除机器的环境变量
|
||||||
* @param machineId 机器ID
|
|
||||||
*/
|
*/
|
||||||
void deleteByMachineId(Long machineId);
|
void deleteByMachineId(Long machineEvnId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取机器的环境变量
|
* 获取机器的环境变量
|
||||||
@ -34,7 +33,7 @@ public interface MachineEnvService extends IService<MachineEnv> {
|
|||||||
*/
|
*/
|
||||||
PageResult<MachineEnvDTO> listEnv(MachineEnvDTO machineEnvDTO);
|
PageResult<MachineEnvDTO> listEnv(MachineEnvDTO machineEnvDTO);
|
||||||
|
|
||||||
void deleteList(List<Long> ids);
|
void deleteList(String ids);
|
||||||
|
|
||||||
boolean update(MachineEnvDTO machineEnvDTO);
|
boolean update(MachineEnvDTO machineEnvDTO);
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@ public interface MachineInfoService extends IService<MachineInfo> {
|
|||||||
|
|
||||||
boolean updateMachineInfo(MachineInfoDto machineInfoDto);
|
boolean updateMachineInfo(MachineInfoDto machineInfoDto);
|
||||||
|
|
||||||
boolean updateStatus(Long machineInfoId, String status);
|
boolean updateStatus(MachineInfoDto machineInfoDto);
|
||||||
|
|
||||||
boolean bindingSecretKey( Long machineInfoId, Long secretKeyId);
|
boolean bindingSecretKey(MachineInfoDto machineInfoDto);
|
||||||
|
|
||||||
void deleteList(List<Long> machineInfoIds);
|
void deleteList(String machineInfoIds);
|
||||||
|
|
||||||
void deleteMachineInfo(Long machineInfoId);
|
void deleteMachineInfo(Long machineInfoId);
|
||||||
|
|
||||||
|
@ -33,15 +33,14 @@ public interface MachineProxyService extends IService<MachineProxy> {
|
|||||||
/**
|
/**
|
||||||
* 更新代理配置
|
* 更新代理配置
|
||||||
*/
|
*/
|
||||||
void updateConfig(MachineProxyDTO machineProxyDTO);
|
void update(MachineProxyDTO machineProxyDTO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除代理
|
* 批量删除代理
|
||||||
* @param proxyIds 代理ID列表
|
* @param proxyIds 代理ID列表
|
||||||
*/
|
*/
|
||||||
void delete(List<Long> proxyIds);
|
String delete(String proxyIds);
|
||||||
|
|
||||||
PageResult<MachineProxyDTO> list(MachineProxyDTO machineProxyDTO);
|
PageResult<MachineProxyDTO> list(MachineProxyDTO machineProxyDTO);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
public interface SecretKeyService extends IService<SecretKey> {
|
public interface SecretKeyService extends IService<SecretKey> {
|
||||||
boolean addSecretKey(SecretKeyDto secretKeyDto, MultipartFile file);
|
boolean addSecretKey(SecretKeyDto secretKeyDto, MultipartFile file);
|
||||||
|
|
||||||
void bindingMachine(Long secretKeyId, List<Long> machineInfoIds);
|
void bindingMachine(SecretKeyDto secretKeyDto);
|
||||||
|
|
||||||
boolean updateSecretKey(SecretKeyDto secretKeyDto,MultipartFile file);
|
boolean updateSecretKey(SecretKeyDto secretKeyDto,MultipartFile file);
|
||||||
|
|
||||||
@ -23,6 +23,6 @@ public interface SecretKeyService extends IService<SecretKey> {
|
|||||||
|
|
||||||
ResponseEntity<InputStreamResource> downloadSecretKeyFile(Long secretKeyId);
|
ResponseEntity<InputStreamResource> downloadSecretKeyFile(Long secretKeyId);
|
||||||
|
|
||||||
boolean deleteList(List<Long> secretKeyIds);
|
boolean deleteList(String secretKeyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -49,8 +50,8 @@ public class MachineEnvServiceImpl extends ServiceImpl<MachineEnvMapper, Machine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByMachineId(Long machineId) {
|
public void deleteByMachineId(Long machineEvnId) {
|
||||||
this.removeById(machineId);
|
this.removeById(machineEvnId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,11 +88,6 @@ public class MachineEnvServiceImpl extends ServiceImpl<MachineEnvMapper, Machine
|
|||||||
queryWrapper.like(MachineEnv::getMachineId, machineEnvDTO.getMachineId());
|
queryWrapper.like(MachineEnv::getMachineId, machineEnvDTO.getMachineId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否敏感
|
|
||||||
if (!StringUtils.isEmpty(machineEnvDTO.getSensitive())) {
|
|
||||||
queryWrapper.eq(MachineEnv::getSensitive, machineEnvDTO.getSensitive());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建时间范围查询
|
// 创建时间范围查询
|
||||||
if (!StringUtils.isEmpty(machineEnvDTO.getCreateDate())) {
|
if (!StringUtils.isEmpty(machineEnvDTO.getCreateDate())) {
|
||||||
queryWrapper.ge(MachineEnv::getCreateDate, machineEnvDTO.getCreateDate());
|
queryWrapper.ge(MachineEnv::getCreateDate, machineEnvDTO.getCreateDate());
|
||||||
@ -133,8 +129,13 @@ public class MachineEnvServiceImpl extends ServiceImpl<MachineEnvMapper, Machine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteList(List<Long> ids) {
|
public void deleteList(String ids) {
|
||||||
this.machineEnvMapper.deleteBatchIds(ids);
|
List<Long> machineEnvIds = Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(s -> !s.isEmpty())
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.toList();
|
||||||
|
this.machineEnvMapper.deleteBatchIds(machineEnvIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -150,7 +151,6 @@ public class MachineEnvServiceImpl extends ServiceImpl<MachineEnvMapper, Machine
|
|||||||
dto.setId(machineEnv.getId());
|
dto.setId(machineEnv.getId());
|
||||||
dto.setEnvKey(machineEnv.getEnvKey());
|
dto.setEnvKey(machineEnv.getEnvKey());
|
||||||
dto.setEnvValue(machineEnv.getEnvValue());
|
dto.setEnvValue(machineEnv.getEnvValue());
|
||||||
dto.setSensitive(machineEnv.getSensitive());
|
|
||||||
dto.setDescription(machineEnv.getDescription());
|
dto.setDescription(machineEnv.getDescription());
|
||||||
dto.setCreateDate(machineEnv.getCreateDate());
|
dto.setCreateDate(machineEnv.getCreateDate());
|
||||||
dto.setUpdateDate(machineEnv.getUpdateDate());
|
dto.setUpdateDate(machineEnv.getUpdateDate());
|
||||||
|
@ -80,49 +80,56 @@ public class MachineProxyServiceImpl extends ServiceImpl<MachineProxyMapper, Mac
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateConfig(MachineProxyDTO machineProxyDTO) {
|
public void update(MachineProxyDTO machineProxyDTO) {
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (machineProxyDTO == null) {
|
if (machineProxyDTO == null) {
|
||||||
throw new ServiceException(ServiceException.MACHINE_PROXY_DTO_NULL,"MachineProxyDTO对象为空");
|
throw new ServiceException(ServiceException.MACHINE_PROXY_DTO_NULL,"MachineProxyDTO对象为空");
|
||||||
}
|
}
|
||||||
|
MachineProxy machineProxy = new MachineProxy();
|
||||||
// 查询代理
|
BeanUtils.copyProperties(machineProxyDTO, machineProxy);
|
||||||
MachineProxy proxy = getById(machineProxyDTO.getId());
|
if (machineProxyDTO.getProxyType()!= null && !machineProxyDTO.getProxyType().isEmpty()){
|
||||||
|
machineProxy.setProxyTypeCode(EnumUtils.getEnumByMessage(machineProxyDTO.getProxyType(), MachineProxyType.class).getCode());
|
||||||
if (proxy == null) {
|
|
||||||
throw new ServiceException(ServiceException.MACHINE_PROXY_NULL,"代理不存在");
|
|
||||||
}
|
}
|
||||||
// 更新配置
|
if (machineProxyDTO.getStatus()!= null && !machineProxyDTO.getStatus().isEmpty()){
|
||||||
proxy.setConfig(machineProxyDTO.getConfig());
|
machineProxy.setStatusCode(EnumUtils.getEnumByMessage(machineProxyDTO.getStatus(), MachineProxyStatus.class).getCode());
|
||||||
proxy.setUpdateDate(new Date());
|
}
|
||||||
updateById(proxy);
|
this.updateById(machineProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(List<Long> ids) {
|
public String delete(String ids) {
|
||||||
|
List<Long> machineProxyIds = Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(s -> !s.isEmpty())
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.toList();
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (CollectionUtils.isEmpty(ids)) {
|
if (CollectionUtils.isEmpty(machineProxyIds)) {
|
||||||
throw new ServiceException(ServiceException.PARAMETER_ERROR,"参数错误");
|
throw new ServiceException(ServiceException.PARAMETER_ERROR,"参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询在线代理
|
// 查询在线代理
|
||||||
List<MachineProxy> onlineProxies = list(new LambdaQueryWrapper<MachineProxy>()
|
List<MachineProxy> onlineProxies = list(new LambdaQueryWrapper<MachineProxy>()
|
||||||
.in(MachineProxy::getId, ids)
|
.in(MachineProxy::getId, machineProxyIds)
|
||||||
.eq(MachineProxy::getStatusCode, MachineProxyStatus.ONLINE.getCode()));
|
.eq(MachineProxy::getStatusCode, MachineProxyStatus.ONLINE.getCode()));
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(onlineProxies)) {
|
if (!CollectionUtils.isEmpty(onlineProxies)) {
|
||||||
List<Long> onlineIds = onlineProxies.stream()
|
List<Long> onlineIds = onlineProxies.stream()
|
||||||
.map(MachineProxy::getId)
|
.map(MachineProxy::getId)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
throw new IllegalArgumentException("以下代理处于在线状态,无法删除: " + String.join( ",", (CharSequence) onlineIds));
|
|
||||||
|
// 将 [10, 9] 转换为 "10, 9"
|
||||||
|
String idStr = onlineIds.toString().replaceAll("[\\[\\]]", "");
|
||||||
|
return "以下代理处于在线状态,无法删除: " + idStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量逻辑删除
|
// 批量逻辑删除
|
||||||
remove(new LambdaQueryWrapper<MachineProxy>()
|
remove(new LambdaQueryWrapper<MachineProxy>()
|
||||||
.in(MachineProxy::getId, ids));
|
.in(MachineProxy::getId, machineProxyIds));
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -132,7 +139,7 @@ public class MachineProxyServiceImpl extends ServiceImpl<MachineProxyMapper, Mac
|
|||||||
List<MachineProxyDTO> machineProxyDtos = page.getRecords().stream().map(machineProxy -> {
|
List<MachineProxyDTO> machineProxyDtos = page.getRecords().stream().map(machineProxy -> {
|
||||||
MachineProxyDTO dto = new MachineProxyDTO();
|
MachineProxyDTO dto = new MachineProxyDTO();
|
||||||
BeanUtils.copyProperties(machineProxy, dto);
|
BeanUtils.copyProperties(machineProxy, dto);
|
||||||
dto.setProxyType(EnumUtils.getEnumByCode(machineProxy.getStatusCode(), MachineProxyType.class).getMessage());
|
dto.setProxyType(EnumUtils.getEnumByCode(machineProxy.getProxyTypeCode(), MachineProxyType.class).getMessage());
|
||||||
dto.setStatus(EnumUtils.getEnumByCode(machineProxy.getStatusCode(), MachineProxyStatus.class).getMessage());
|
dto.setStatus(EnumUtils.getEnumByCode(machineProxy.getStatusCode(), MachineProxyStatus.class).getMessage());
|
||||||
return dto;
|
return dto;
|
||||||
}).toList();
|
}).toList();
|
||||||
@ -148,21 +155,21 @@ public class MachineProxyServiceImpl extends ServiceImpl<MachineProxyMapper, Mac
|
|||||||
private QueryWrapper<MachineProxy> getMachineProxyQueryWrapper(MachineProxyDTO machineProxyDTO){
|
private QueryWrapper<MachineProxy> getMachineProxyQueryWrapper(MachineProxyDTO machineProxyDTO){
|
||||||
QueryWrapper<MachineProxy> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<MachineProxy> queryWrapper = new QueryWrapper<>();
|
||||||
if (machineProxyDTO.getHostIp() != null && !machineProxyDTO.getHostIp().isEmpty()) {
|
if (machineProxyDTO.getHostIp() != null && !machineProxyDTO.getHostIp().isEmpty()) {
|
||||||
queryWrapper.eq("host_ip", machineProxyDTO.getHostIp());
|
queryWrapper.like("host_ip", machineProxyDTO.getHostIp());
|
||||||
}
|
}
|
||||||
if (machineProxyDTO.getSshPort() != null && !machineProxyDTO.getSshPort().isEmpty()) {
|
if (machineProxyDTO.getSshPort() != null && !machineProxyDTO.getSshPort().isEmpty()) {
|
||||||
queryWrapper.eq("ssh_port", machineProxyDTO.getSshPort());
|
queryWrapper.like("ssh_port", machineProxyDTO.getSshPort());
|
||||||
}
|
}
|
||||||
if (machineProxyDTO.getUsername() != null && !machineProxyDTO.getUsername().isEmpty()) {
|
if (machineProxyDTO.getUsername() != null && !machineProxyDTO.getUsername().isEmpty()) {
|
||||||
queryWrapper.eq("username", machineProxyDTO.getUsername());
|
queryWrapper.like("username", machineProxyDTO.getUsername());
|
||||||
}
|
}
|
||||||
if (machineProxyDTO.getDescription() != null && !machineProxyDTO.getDescription().isEmpty()) {
|
if (machineProxyDTO.getDescription() != null && !machineProxyDTO.getDescription().isEmpty()) {
|
||||||
queryWrapper.eq("description", machineProxyDTO.getDescription());
|
queryWrapper.like("description", machineProxyDTO.getDescription());
|
||||||
}
|
}
|
||||||
if (machineProxyDTO.getStatus() != null && !machineProxyDTO.getStatus().isEmpty()) {
|
if (machineProxyDTO.getStatus() != null && !machineProxyDTO.getStatus().isEmpty()) {
|
||||||
queryWrapper.eq("status_code", EnumUtils.getEnumByMessage(machineProxyDTO.getStatus(),MachineProxyStatus.class).getCode());
|
queryWrapper.like("status_code", EnumUtils.getEnumByMessage(machineProxyDTO.getStatus(),MachineProxyStatus.class).getCode());
|
||||||
}
|
}
|
||||||
return queryWrapper;
|
return queryWrapper.orderByDesc("create_date");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,21 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -121,22 +126,27 @@ public class MachineinfoServiceImpl extends ServiceImpl<MachineInfoMapper, Machi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateStatus(Long machineInfoId, String status) {
|
public boolean updateStatus(MachineInfoDto machineInfoDto) {
|
||||||
UpdateWrapper<MachineInfo> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<MachineInfo> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("id", machineInfoId).set("status_code", EnumUtils.getEnumByMessage(status, MachineInfoStatus.class).getCode());
|
updateWrapper.eq("id", machineInfoDto.getId()).set("status_code", EnumUtils.getEnumByMessage(machineInfoDto.getStatus(), MachineInfoStatus.class).getCode());
|
||||||
return this.update(updateWrapper);
|
return this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean bindingSecretKey(Long machineInfoId, Long secretKeyId) {
|
public boolean bindingSecretKey(MachineInfoDto machineInfoDto) {
|
||||||
UpdateWrapper<MachineInfo> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<MachineInfo> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("id", machineInfoId).set("secret_key_id", secretKeyId).set("authentication_type_code",2);
|
updateWrapper.eq("id", machineInfoDto.getId()).set("secret_key_id", machineInfoDto.getSecretKeyId()).set("authentication_type_code",2);
|
||||||
return this.update(updateWrapper);
|
return this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteList(List<Long> machineInfoIds) {
|
public void deleteList(String machineInfoIds) {
|
||||||
machineInfoMapper.selectBatchIds(machineInfoIds).forEach(machineInfo -> {
|
List<Long> machineInfoIdList = Arrays.stream(machineInfoIds.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(s -> !s.isEmpty())
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
machineInfoMapper.selectBatchIds(machineInfoIdList).forEach(machineInfo -> {
|
||||||
if (machineInfo.getStatusCode() == 1){
|
if (machineInfo.getStatusCode() == 1){
|
||||||
this.removeById(machineInfo.getId());
|
this.removeById(machineInfo.getId());
|
||||||
}
|
}
|
||||||
@ -168,7 +178,7 @@ public class MachineinfoServiceImpl extends ServiceImpl<MachineInfoMapper, Machi
|
|||||||
if (machineInfoDto.getDescription() != null && !machineInfoDto.getDescription().isEmpty()) {
|
if (machineInfoDto.getDescription() != null && !machineInfoDto.getDescription().isEmpty()) {
|
||||||
queryWrapper.like("description", machineInfoDto.getDescription());
|
queryWrapper.like("description", machineInfoDto.getDescription());
|
||||||
}
|
}
|
||||||
return queryWrapper;
|
return queryWrapper.orderByDesc("create_date");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@ -61,9 +62,9 @@ public class SecretKeyServiceImpl extends ServiceImpl<SecretServiceMapper, Secre
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindingMachine(Long secretKeyId, List<Long> machineInfoIds) {
|
public void bindingMachine(SecretKeyDto secretKeyDto) {
|
||||||
List<MachineInfo> machineInfos = machineInfoService.listByIds(machineInfoIds);
|
List<MachineInfo> machineInfos = machineInfoService.listByIds(secretKeyDto.getMachineInfoIds());
|
||||||
machineInfos.forEach(machineInfo -> machineInfo.setSecretKeyId(secretKeyId));
|
machineInfos.forEach(machineInfo -> machineInfo.setSecretKeyId(secretKeyDto.getId()));
|
||||||
machineInfoService.updateBatchById(machineInfos);
|
machineInfoService.updateBatchById(machineInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +98,7 @@ public class SecretKeyServiceImpl extends ServiceImpl<SecretServiceMapper, Secre
|
|||||||
if (secretKeyDto.getDescription() != null && !secretKeyDto.getDescription().isEmpty()){
|
if (secretKeyDto.getDescription() != null && !secretKeyDto.getDescription().isEmpty()){
|
||||||
queryWrapper.like("description", secretKeyDto.getDescription());
|
queryWrapper.like("description", secretKeyDto.getDescription());
|
||||||
}
|
}
|
||||||
|
queryWrapper.orderByDesc("create_date");
|
||||||
Page<SecretKey> page = secretServiceMapper.selectPage(new Page<>(secretKeyDto.getPageIndex(), secretKeyDto.getPageSize()), queryWrapper);
|
Page<SecretKey> page = secretServiceMapper.selectPage(new Page<>(secretKeyDto.getPageIndex(), secretKeyDto.getPageSize()), queryWrapper);
|
||||||
return new PageResult<>(
|
return new PageResult<>(
|
||||||
page.getCurrent(),
|
page.getCurrent(),
|
||||||
@ -114,7 +116,12 @@ public class SecretKeyServiceImpl extends ServiceImpl<SecretServiceMapper, Secre
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteList(List<Long> secretKeyIds) {
|
public boolean deleteList(String ids) {
|
||||||
|
List<Long> secretKeyIds = Arrays.stream(ids.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(s -> !s.isEmpty())
|
||||||
|
.map(Long::parseLong)
|
||||||
|
.toList();
|
||||||
List<SecretKey> secretKeys = this.listByIds(secretKeyIds);
|
List<SecretKey> secretKeys = this.listByIds(secretKeyIds);
|
||||||
// 提交异步任务到线程池
|
// 提交异步任务到线程池
|
||||||
FILE_DELETE_EXECUTOR.execute(() -> {
|
FILE_DELETE_EXECUTOR.execute(() -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user