use of com.orion.ops.entity.domain.MachineInfoDO in project orion-ops by lijiahangmax.
the class MachineInfoServiceImpl method testPing.
@Override
public Integer testPing(Long id) {
MachineInfoDO machine = machineInfoDAO.selectById(id);
Valid.notNull(machine, MessageConst.INVALID_MACHINE);
boolean ping = IPs.ping(machine.getMachineHost(), Const.MS_S_3);
return ping ? Const.ENABLE : Const.DISABLE;
}
use of com.orion.ops.entity.domain.MachineInfoDO in project orion-ops by lijiahangmax.
the class MachineInfoServiceImpl method machineDetail.
@Override
public MachineInfoVO machineDetail(Long id) {
MachineInfoDO machine = machineInfoDAO.selectById(id);
Valid.notNull(machine, MessageConst.INVALID_MACHINE);
MachineInfoVO vo = Converts.to(machine, MachineInfoVO.class);
Optional.ofNullable(machine.getProxyId()).map(machineProxyDAO::selectById).ifPresent(p -> {
vo.setProxyHost(p.getProxyHost());
vo.setProxyPort(p.getProxyPort());
vo.setProxyType(p.getProxyType());
});
return vo;
}
use of com.orion.ops.entity.domain.MachineInfoDO in project orion-ops by lijiahangmax.
the class FileTailServiceImpl method tailFileDetail.
@Override
public FileTailVO tailFileDetail(Long id) {
FileTailListDO tail = fileTailListDAO.selectById(id);
Valid.notNull(tail, MessageConst.UNKNOWN_DATA);
FileTailVO vo = Converts.to(tail, FileTailVO.class);
// 设置机器信息
MachineInfoDO machine = machineInfoService.selectById(tail.getMachineId());
Valid.notNull(machine, MessageConst.INVALID_MACHINE);
vo.setMachineName(machine.getMachineName());
vo.setMachineHost(machine.getMachineHost());
return vo;
}
use of com.orion.ops.entity.domain.MachineInfoDO in project orion-ops by lijiahangmax.
the class MachineEnvServiceImpl method getFullMachineEnv.
@Override
public MutableLinkedHashMap<String, String> getFullMachineEnv(Long machineId) {
// 查询机器
MachineInfoDO machine = machineInfoDAO.selectById(machineId);
Valid.notNull(machine, MessageConst.INVALID_MACHINE);
MutableLinkedHashMap<String, String> env = Maps.newMutableLinkedMap();
env.put(EnvConst.MACHINE_PREFIX + EnvConst.MACHINE_ID, machine.getId() + Strings.EMPTY);
env.put(EnvConst.MACHINE_PREFIX + EnvConst.MACHINE_NAME, machine.getMachineName());
env.put(EnvConst.MACHINE_PREFIX + EnvConst.MACHINE_TAG, machine.getMachineTag());
env.put(EnvConst.MACHINE_PREFIX + EnvConst.MACHINE_HOST, machine.getMachineHost());
env.put(EnvConst.MACHINE_PREFIX + EnvConst.MACHINE_PORT, machine.getSshPort() + Strings.EMPTY);
env.put(EnvConst.MACHINE_PREFIX + EnvConst.MACHINE_USERNAME, machine.getUsername());
// 查询环境变量
LambdaQueryWrapper<MachineEnvDO> wrapper = new LambdaQueryWrapper<MachineEnvDO>().eq(MachineEnvDO::getMachineId, machineId).orderByAsc(MachineEnvDO::getId);
machineEnvDAO.selectList(wrapper).forEach(e -> env.put(EnvConst.MACHINE_PREFIX + e.getAttrKey(), e.getAttrValue()));
return env;
}
use of com.orion.ops.entity.domain.MachineInfoDO in project orion-ops by lijiahangmax.
the class MachineInfoServiceImpl method updateMachine.
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateMachine(MachineInfoRequest request) {
// 检查proxyId
this.checkProxy(request.getProxyId());
MachineInfoDO entity = new MachineInfoDO();
String password = request.getPassword();
this.copyProperties(request, entity);
if (Strings.isNotBlank(password)) {
entity.setPassword(ValueMix.encrypt(password));
}
// 修改
int effect = machineInfoDAO.updateById(entity);
// 设置日志参数
EventParamsHolder.addParams(entity);
return effect;
}
Aggregations