| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.EquipmentMaintenancePlan; |
| | | import org.jeecg.modules.eam.entity.MaintenanceStandard; |
| | | import org.jeecg.modules.eam.entity.MaintenanceStandardDetail; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentMapper; |
| | | import org.jeecg.modules.eam.mapper.EquipmentMaintenancePlanDetailMapper; |
| | | import org.jeecg.modules.eam.mapper.EquipmentMaintenancePlanMapper; |
| | | import org.jeecg.modules.eam.service.IEquipmentMaintenancePlanService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import java.io.Serializable; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: 保养计划 |
| | |
| | | private EquipmentMaintenancePlanMapper equipmentMaintenancePlanMapper; |
| | | @Autowired |
| | | private EquipmentMaintenancePlanDetailMapper equipmentMaintenancePlanDetailMapper; |
| | | @Autowired |
| | | private EamEquipmentMapper equipmentMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return baseMapper.getCycle(mainId,type); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String,Object> getStandards(List<String> equipmentIds, String maintenanceType) { |
| | | String msg = ""; |
| | | Map<String,Object> map = new HashMap<>(2); |
| | | List<MaintenanceStandard> maintenanceStandards = new ArrayList<>(); |
| | | for(String equipmentId:equipmentIds){ |
| | | Equipment equipment = equipmentMapper.selectById(equipmentId); |
| | | List<MaintenanceStandard> list = baseMapper.getStandards(equipmentId,maintenanceType); |
| | | if(list.size()==0){ |
| | | msg = msg+"统一编码为"+equipment.getNum()+"的设备不存在生效保养标注;"; |
| | | }else if(list.size()>1){ |
| | | msg = msg+"统一编码为"+equipment.getNum()+"的设备存在多条生效保养标注;"; |
| | | }else { |
| | | if(equipment.getIsLineEquip().equals("yes")&&maintenanceType.equals("3")){ |
| | | String lineId = equipment.getLineId(); |
| | | if(StringUtils.isNotBlank(lineId)){ |
| | | List<MaintenanceStandard> lineStandard = baseMapper.getStandards(lineId,maintenanceType); |
| | | if(lineStandard.size()==0){ |
| | | msg = msg+"统一编码为"+equipment.getNum()+"的设备不存在生效保养标注;"; |
| | | }else if(list.size()>1){ |
| | | msg = msg+"统一编码为"+equipment.getNum()+"的设备存在多条生效保养标注;"; |
| | | }else{ |
| | | maintenanceStandards.add(lineStandard.get(0)); |
| | | } |
| | | }else { |
| | | msg = msg+"统一编码为"+equipment.getNum()+"的设备不存在生效保养标注;"; |
| | | } |
| | | }else{ |
| | | maintenanceStandards.add(list.get(0)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | map.put("records",maintenanceStandards); |
| | | map.put("message",msg); |
| | | return map ; |
| | | } |
| | | |
| | | |
| | | } |