删除所有 as any.
This commit is contained in:
@@ -53,6 +53,8 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
HostKeyDO record = HostKeyConvert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.checkHostKeyPresent(record);
|
||||
// 加密
|
||||
this.encryptKey(record);
|
||||
String password = record.getPassword();
|
||||
if (!Strings.isBlank(password)) {
|
||||
record.setPassword(CryptoUtils.encryptAsString(password));
|
||||
@@ -78,6 +80,8 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
HostKeyDO updateRecord = HostKeyConvert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.checkHostKeyPresent(updateRecord);
|
||||
// 加密
|
||||
this.encryptKey(updateRecord);
|
||||
// 设置密码
|
||||
String newPassword = PasswordModifier.getEncryptNewPassword(request);
|
||||
updateRecord.setPassword(newPassword);
|
||||
@@ -97,6 +101,8 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
// 查询
|
||||
HostKeyDO record = hostKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 解密秘钥
|
||||
this.decryptKey(record);
|
||||
// 转换
|
||||
return HostKeyConvert.MAPPER.to(record);
|
||||
}
|
||||
@@ -105,6 +111,9 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
public HostKeyDO getHostKey(Long id) {
|
||||
HostKeyDO record = hostKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 解密秘钥
|
||||
this.decryptKey(record);
|
||||
// 解密密码
|
||||
String password = record.getPassword();
|
||||
if (!Strings.isBlank(password)) {
|
||||
record.setPassword(CryptoUtils.decryptAsString(password));
|
||||
@@ -206,4 +215,36 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
vo.setPrivateKey(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密 公钥 私钥
|
||||
*
|
||||
* @param record record
|
||||
*/
|
||||
private void encryptKey(HostKeyDO record) {
|
||||
String publicKey = record.getPublicKey();
|
||||
if (!Strings.isBlank(publicKey)) {
|
||||
record.setPublicKey(CryptoUtils.encryptAsString(publicKey));
|
||||
}
|
||||
String privateKey = record.getPrivateKey();
|
||||
if (!Strings.isBlank(privateKey)) {
|
||||
record.setPrivateKey(CryptoUtils.encryptAsString(privateKey));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密 公钥 私钥
|
||||
*
|
||||
* @param record record
|
||||
*/
|
||||
private void decryptKey(HostKeyDO record) {
|
||||
String publicKey = record.getPublicKey();
|
||||
if (!Strings.isBlank(publicKey)) {
|
||||
record.setPublicKey(CryptoUtils.decryptAsString(publicKey));
|
||||
}
|
||||
String privateKey = record.getPrivateKey();
|
||||
if (!Strings.isBlank(privateKey)) {
|
||||
record.setPrivateKey(CryptoUtils.decryptAsString(privateKey));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface HostCreateRequest {
|
||||
* 主机更新请求
|
||||
*/
|
||||
export interface HostUpdateRequest extends HostCreateRequest {
|
||||
id: number;
|
||||
id: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +54,7 @@ export interface HostQueryResponse {
|
||||
*/
|
||||
export interface HostConfigRequest {
|
||||
id?: number;
|
||||
hostId?: number;
|
||||
version?: number;
|
||||
status?: number;
|
||||
config?: string;
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface UserCreateRequest {
|
||||
* 用户更新请求
|
||||
*/
|
||||
export interface UserUpdateRequest extends UserCreateRequest {
|
||||
id: number;
|
||||
id: number | undefined;
|
||||
roleIdList?: Array<number>;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
!tagList.value.some((tag) => tag.fullPath === route.fullPath)
|
||||
) {
|
||||
// 固定并且没有此 tab 则添加
|
||||
tabBarStore.addTab(routerToTag(route), route.meta?.ignoreCache as unknown as any);
|
||||
tabBarStore.addTab(routerToTag(route), route.meta?.ignoreCache as unknown as boolean);
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
return props.modelValue;
|
||||
},
|
||||
async set(e) {
|
||||
await checkCreateTag(e as any);
|
||||
await checkCreateTag(e as Array<any>);
|
||||
emits('update:modelValue', e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { FavoriteType, addFavorite, cancelFavorite } from '@/api/meta/favorite';
|
||||
|
||||
export default function useFavorite(type: FavoriteType) {
|
||||
const toggle = async (record: any, id: number, cancelField = 'favorite') => {
|
||||
const request = { relId: id, type } as any;
|
||||
const request = { relId: id, type };
|
||||
const loading = Message.loading(record[cancelField] ? '取消中' : '收藏中');
|
||||
try {
|
||||
if (record[cancelField]) {
|
||||
|
||||
@@ -111,7 +111,7 @@ export function permission10toString(permission: number) {
|
||||
const ps = (permission + '');
|
||||
let res = '';
|
||||
for (let i = 0; i < ps.length; i++) {
|
||||
const per = ps.charAt(i) as any;
|
||||
const per = ps.charAt(i) as unknown as number;
|
||||
if ((per & 4) === 0) {
|
||||
res += '-';
|
||||
} else {
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import formRules from '../types/form.rules';
|
||||
import { createHost, updateHost } from '@/api/asset/host';
|
||||
import { createHost, updateHost, HostUpdateRequest } from '@/api/asset/host';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import TagMultiSelector from '@/components/tag/tag-multi-selector.vue';
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
const title = ref<string>();
|
||||
const isAddHandle = ref<boolean>(true);
|
||||
|
||||
const defaultForm = () => {
|
||||
const defaultForm = (): HostUpdateRequest & Record<string, any> => {
|
||||
return {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
@@ -77,7 +77,7 @@
|
||||
};
|
||||
|
||||
const formRef = ref<any>();
|
||||
const formModel = reactive<Record<string, any>>(defaultForm());
|
||||
const formModel = reactive<HostUpdateRequest & Record<string, any>>(defaultForm());
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
@@ -118,12 +118,12 @@
|
||||
}
|
||||
if (isAddHandle.value) {
|
||||
// 新增
|
||||
await createHost(formModel as any);
|
||||
await createHost(formModel);
|
||||
Message.success('创建成功');
|
||||
emits('added');
|
||||
} else {
|
||||
// 修改
|
||||
await updateHost(formModel as any);
|
||||
await updateHost(formModel);
|
||||
Message.success('修改成功');
|
||||
emits('updated');
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import formRules from '../types/form.rules';
|
||||
import { createRole, updateRole } from '@/api/user/role';
|
||||
import { createRole, updateRole, RoleUpdateRequest, } from '@/api/user/role';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
@@ -53,7 +53,7 @@
|
||||
const title = ref<string>();
|
||||
const isAddHandle = ref<boolean>(true);
|
||||
|
||||
const defaultForm = () => {
|
||||
const defaultForm = (): RoleUpdateRequest & Record<string, any> => {
|
||||
return {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
@@ -62,7 +62,7 @@
|
||||
};
|
||||
|
||||
const formRef = ref<any>();
|
||||
const formModel = reactive<Record<string, any>>(defaultForm());
|
||||
const formModel = reactive<RoleUpdateRequest & Record<string, any>>(defaultForm());
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
@@ -102,12 +102,12 @@
|
||||
}
|
||||
if (isAddHandle.value) {
|
||||
// 新增
|
||||
await createRole(formModel as any);
|
||||
await createRole(formModel);
|
||||
Message.success('创建成功');
|
||||
emits('added');
|
||||
} else {
|
||||
// 修改
|
||||
await updateRole(formModel as any);
|
||||
await updateRole(formModel);
|
||||
Message.success('修改成功');
|
||||
emits('updated');
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import formRules from '../types/form.rules';
|
||||
import { createUser, updateUser } from '@/api/user/user';
|
||||
import { createUser, updateUser, UserUpdateRequest } from '@/api/user/user';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { md5 } from '@/utils';
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
const title = ref<string>();
|
||||
const isAddHandle = ref<boolean>(true);
|
||||
|
||||
const defaultForm = () => {
|
||||
const defaultForm = (): UserUpdateRequest & Record<string, any> => {
|
||||
return {
|
||||
id: undefined,
|
||||
username: undefined,
|
||||
@@ -80,7 +80,7 @@
|
||||
};
|
||||
|
||||
const formRef = ref<any>();
|
||||
const formModel = reactive<Record<string, any>>(defaultForm());
|
||||
const formModel = reactive<UserUpdateRequest & Record<string, any>>(defaultForm());
|
||||
|
||||
const emits = defineEmits(['added', 'updated']);
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
emits('added');
|
||||
} else {
|
||||
// 修改
|
||||
await updateUser(formModel as any);
|
||||
await updateUser(formModel);
|
||||
Message.success('修改成功');
|
||||
emits('updated');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user