设备报警和报警数据根据设备进行租户id赋值
This commit is contained in:
parent
cfbec64bab
commit
d2defd6fd0
@ -88,4 +88,8 @@ public class AlarmDataDO extends BaseDO {
|
||||
* 报警类型
|
||||
*/
|
||||
private Integer alarmType;
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
||||
|
@ -89,4 +89,8 @@ public class AlarmRulesDO extends BaseDO {
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
@ -61,5 +61,8 @@ public class EquipAlarmDataDO extends BaseDO {
|
||||
* 机床分析状态(0:正常,1:磨损中,2:磨损严重)
|
||||
*/
|
||||
private Integer equipAnalyseStatus;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenantId;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDTO;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
|
||||
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -41,10 +43,18 @@ public class AlarmDataServiceImpl implements AlarmDataService {
|
||||
@Resource
|
||||
private EquipAlarmDataService equipAlarmDataService;
|
||||
|
||||
@Resource
|
||||
private EquipInfoService equipInfoService;
|
||||
|
||||
@Override
|
||||
public Long createAlarmData(AlarmDataSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AlarmDataDO alarmData = BeanUtils.toBean(createReqVO, AlarmDataDO.class);
|
||||
if(Objects.nonNull(alarmData.getEquipId())){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(alarmData.getEquipId());
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
tenantIdOptional.ifPresent(alarmData::setTenantId);
|
||||
}
|
||||
alarmDataMapper.insert(alarmData);
|
||||
// 返回
|
||||
return alarmData.getAlarmDataId();
|
||||
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO;
|
||||
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -17,6 +19,8 @@ import com.inspur.framework.common.util.object.BeanUtils;
|
||||
import com.inspur.module.system.dal.mysql.alarm.AlarmRulesMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.inspur.module.system.enums.ErrorCodeConstants.*;
|
||||
@ -36,11 +40,19 @@ public class AlarmRulesServiceImpl implements AlarmRulesService {
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private EquipInfoService equipInfoService;
|
||||
|
||||
@Override
|
||||
public String createAlarmRules(AlarmRulesSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AlarmRulesDO alarmRules = BeanUtils.toBean(createReqVO, AlarmRulesDO.class);
|
||||
alarmRules.setStatus(0);//默认开启
|
||||
if(Objects.nonNull(alarmRules.getEquipId())){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(alarmRules.getEquipId());
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
tenantIdOptional.ifPresent(alarmRules::setTenantId);
|
||||
}
|
||||
alarmRulesMapper.insert(alarmRules);
|
||||
stringRedisTemplate.delete(createReqVO.getEquipId());
|
||||
// 返回
|
||||
|
@ -8,8 +8,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
|
||||
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
|
||||
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper;
|
||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -45,10 +47,18 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService {
|
||||
@Resource
|
||||
private MaintenanceOrderMapper maintenanceOrderMapper;
|
||||
|
||||
@Resource
|
||||
private EquipInfoService equipInfoService;
|
||||
|
||||
@Override
|
||||
public String createEquipAlarmData(EquipAlarmDataSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
EquipAlarmDataDO equipAlarmData = BeanUtils.toBean(createReqVO, EquipAlarmDataDO.class);
|
||||
if(Objects.nonNull(equipAlarmData.getEquipId())){
|
||||
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(equipAlarmData.getEquipId());
|
||||
Optional<Long> tenantIdOptional = Optional.ofNullable(equipInfo.getTenantId());
|
||||
tenantIdOptional.ifPresent(equipAlarmData::setTenantId);
|
||||
}
|
||||
equipAlarmDataMapper.insert(equipAlarmData);
|
||||
// 返回
|
||||
return equipAlarmData.getEquipAlarmId();
|
||||
|
Loading…
Reference in New Issue
Block a user