密钥恢复
This commit is contained in:
@@ -5,14 +5,17 @@ import com.sunyard.chsm.enums.KeyStatus;
|
||||
import com.sunyard.chsm.model.Option;
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.chsm.service.KeyInfoService;
|
||||
import com.sunyard.ssp.common.exception.SspwebException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -62,10 +65,26 @@ public class KeyInfoController {
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public R<Void> save(@Valid @RequestBody KeyInfoDTO.Update update) {
|
||||
keyInfoService.update(update);
|
||||
keyInfoService.update(update);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复密钥(文件上传)
|
||||
*
|
||||
* @param file 密钥备份文件
|
||||
* @return id
|
||||
*/
|
||||
@PostMapping("/recovery")
|
||||
public R<String> recoveryKey(MultipartFile file) {
|
||||
try {
|
||||
String s = keyInfoService.recoveryKey(file.getBytes());
|
||||
return R.ok(s);
|
||||
} catch (IOException e) {
|
||||
throw new SspwebException("获取文件内容异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用密钥
|
||||
*
|
||||
@@ -102,18 +121,6 @@ public class KeyInfoController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复密钥
|
||||
*
|
||||
* @param param 密钥id
|
||||
* @return id
|
||||
*/
|
||||
@PostMapping("/recovery")
|
||||
public R<Void> recoveryKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
||||
keyInfoService.recoveryKey(param.getIds());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁密钥
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user