| | |
| | | List<String> equipmentIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(mdcDeviceCalendarQueryVo.getParentId()) && StringUtils.isEmpty(mdcDeviceCalendarQueryVo.getEquipmentId())) { |
| | | if ("2".equals(mdcDeviceCalendarQueryVo.getTypeTree())) { |
| | | //部门层级 |
| | | // 部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcDeviceCalendarQueryVo.getParentId()); |
| | | } else { |
| | | //产线层级 |
| | | // 产线层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcDeviceCalendarQueryVo.getParentId()); |
| | | } |
| | | } else if (StringUtils.isNotEmpty(mdcDeviceCalendarQueryVo.getEquipmentId())) { |
| | | //单台设备信息 |
| | | // 单台设备信息 |
| | | mdcDeviceCalendarQueryVo.setEquipmentIdList(Collections.singletonList(mdcDeviceCalendarQueryVo.getEquipmentId())); |
| | | } else { |
| | | //查询用户拥有的所有设备信息 |
| | | // 查询用户拥有的所有设备信息 |
| | | if ("2".equals(mdcDeviceCalendarQueryVo.getTypeTree())) { |
| | | //部门层级 |
| | | equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); |
| | |
| | | } |
| | | if (mdcDeviceCalendarQueryVo.getEquipmentIdList() == null || mdcDeviceCalendarQueryVo.getEquipmentIdList().isEmpty()) { |
| | | mdcDeviceCalendarQueryVo.setEquipmentIdList(equipmentIds); |
| | | } |
| | | |
| | | if (mdcDeviceCalendarQueryVo.getEquipmentIdList() == null || mdcDeviceCalendarQueryVo.getEquipmentIdList().isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | return this.baseMapper.pageList(pageData, mdcDeviceCalendarQueryVo); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询班制数据 |
| | | * |
| | | * @param equipmentid |
| | | * @param stringDates |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcDeviceCalendarVo> listByEquipmentAndDate(String equipmentid, List<String> stringDates) { |
| | | List<MdcDeviceCalendarVo> result = new ArrayList<>(); |
| | | try { |
| | | //查询默认班制 |
| | | List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); |
| | | |
| | | for (String stringDate : stringDates) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentid, stringDate); |
| | | if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { |
| | | result.addAll(mdcDeviceCalendarVos); |
| | | } else { |
| | | acquiesceShift.forEach(mdcDeviceCalendarVo -> { |
| | | mdcDeviceCalendarVo.setEquipmentId(equipmentid); |
| | | mdcDeviceCalendarVo.setEffectiveDate(stringDate); |
| | | }); |
| | | // 设置默认班制 |
| | | result.addAll(acquiesceShift); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取一段时间范围内符合星期几的日期集合 |
| | | * |
| | | * @param startDate 开始时间 |