Search in sources :

Example 1 with MachineTerminalDO

use of com.orion.ops.entity.domain.MachineTerminalDO in project orion-ops by lijiahangmax.

the class MachineTerminalServiceImpl method updateSetting.

@Override
public Integer updateSetting(MachineTerminalRequest request) {
    // 查询配置
    Long id = request.getId();
    MachineTerminalDO beforeConfig = machineTerminalDAO.selectById(id);
    Valid.notNull(beforeConfig, MessageConst.UNKNOWN_DATA);
    // 查询机器信息
    MachineInfoDO machineInfo = machineInfoService.selectById(beforeConfig.getMachineId());
    Valid.notNull(machineInfo, MessageConst.UNKNOWN_DATA);
    // 设置修改信息
    MachineTerminalDO update = new MachineTerminalDO();
    update.setId(id);
    update.setTerminalType(request.getTerminalType());
    update.setFontSize(request.getFontSize());
    update.setFontFamily(request.getFontFamily());
    update.setFontColor(request.getFontColor());
    update.setBackgroundColor(request.getBackgroundColor());
    update.setUpdateTime(new Date());
    update.setEnableWebLink(request.getEnableWebLink());
    update.setEnableWebGL(request.getEnableWebGL());
    // 修改
    int effect = machineTerminalDAO.updateById(update);
    // 设置日志参数
    EventParamsHolder.addParams(request);
    EventParamsHolder.addParam(EventKeys.NAME, machineInfo.getMachineName());
    return effect;
}
Also used : MachineTerminalDO(com.orion.ops.entity.domain.MachineTerminalDO) MachineInfoDO(com.orion.ops.entity.domain.MachineInfoDO) Date(java.util.Date)

Example 2 with MachineTerminalDO

use of com.orion.ops.entity.domain.MachineTerminalDO in project orion-ops by lijiahangmax.

the class MachineTerminalServiceImpl method getMachineConfig.

@Override
public MachineTerminalVO getMachineConfig(Long machineId) {
    MachineTerminalDO config = machineTerminalDAO.selectOne(new LambdaQueryWrapper<MachineTerminalDO>().eq(MachineTerminalDO::getMachineId, machineId));
    if (config == null) {
        // 初始化
        MachineTerminalDO insert = new MachineTerminalDO();
        insert.setMachineId(machineId);
        insert.setTerminalType(TerminalType.XTERM.getType());
        insert.setBackgroundColor(TerminalConst.BACKGROUND_COLOR);
        insert.setFontColor(TerminalConst.FONT_COLOR);
        insert.setFontSize(TerminalConst.FONT_SIZE);
        insert.setFontFamily(TerminalConst.FONT_FAMILY);
        insert.setEnableWebLink(Const.DISABLE);
        insert.setEnableWebGL(Const.DISABLE);
        machineTerminalDAO.insert(insert);
        config = insert;
    }
    return Converts.to(config, MachineTerminalVO.class);
}
Also used : MachineTerminalDO(com.orion.ops.entity.domain.MachineTerminalDO) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Aggregations

MachineTerminalDO (com.orion.ops.entity.domain.MachineTerminalDO)2 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 MachineInfoDO (com.orion.ops.entity.domain.MachineInfoDO)1 Date (java.util.Date)1