| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | |
| | | import org.jeecg.modules.system.mapper.MdcEquipmentDepartMapper; |
| | | import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; |
| | | import org.jeecg.modules.system.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @Date: 2023-03-22 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class MdcEquipmentServiceImpl extends ServiceImpl<MdcEquipmentMapper, MdcEquipment> implements IMdcEquipmentService { |
| | | |
| | |
| | | |
| | | @Value("${fileNCPath}") |
| | | private String fileNCPath; |
| | | |
| | | @Autowired |
| | | private IEquipmentService equipmentService; |
| | | |
| | | |
| | | @Override |
| | |
| | | return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addNewEquipmentFromEam(MdcEquipment mdcEquipment, String productionId) { |
| | | //默认系统类型 |
| | | mdcEquipment.setSystemValue("3"); |
| | | //判断MDC是否已添加此设备 |
| | | MdcEquipment entity = this.getBaseMapper().selectOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcEquipment.getEquipmentId())); |
| | | if (entity != null) { |
| | | //MDC已经存在此设备 |
| | | log.warn("MDC已经存在此设备, equipmentId={}", mdcEquipment.getEquipmentId()); |
| | | return; |
| | | } |
| | | Equipment equipment = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, mdcEquipment.getEquipmentId())); |
| | | if(equipment == null) { |
| | | //采集未配置 |
| | | log.warn("采集未配置, equipmentId={}", mdcEquipment.getEquipmentId()); |
| | | return; |
| | | } |
| | | //设置值 |
| | | mdcEquipment.setEquipmentIp(equipment.getEquipmentip()); |
| | | mdcEquipment.setEquipmentModel(equipment.getEquipmentmodel()); |
| | | mdcEquipment.setDataPort(equipment.getDataport()); |
| | | mdcEquipment.setDriveType(equipment.getDrivetype()); |
| | | mdcEquipment.setControlSystem(equipment.getControlsystem()); |
| | | mdcEquipment.setSaveTableName(equipment.getSavetablename()); |
| | | |
| | | this.saveMdcEquipment(mdcEquipment, null, productionId); |
| | | } |
| | | |
| | | } |