| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设备工作日历表 |
| | |
| | | List<MdcDeviceCalendarVo> result = new ArrayList<>(); |
| | | try { |
| | | //查询默认班制 |
| | | List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); |
| | | // 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); |
| | | } |
| | | // else { |
| | | // acquiesceShift.forEach(mdcDeviceCalendarVo -> { |
| | | // mdcDeviceCalendarVo.setEquipmentId(equipmentId); |
| | | // mdcDeviceCalendarVo.setEffectiveDate(stringDate); |
| | | // }); |
| | | // // 设置默认班制 |
| | | // result.addAll(acquiesceShift); |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 计算实际班产天数 |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeActualWorkDayCount(String shiftSubId, String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | List<String> validDateList = this.baseMapper.computeActualWorkDayCount(shiftSubId, equipmentId, validDate); |
| | | return new BigDecimal(validDateList.size()); |
| | | } |
| | | |
| | | /** |
| | | * 查询班次分类 |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> findShiftSort(String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | return this.baseMapper.findShiftSort(equipmentId, validDate); |
| | | } |
| | | |
| | | /** |
| | | * 计算班次时间 |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeShiftTimeCount(String shiftSubId, String equipmentId, String validDate) { |
| | | Integer shiftCount = this.baseMapper.computeShiftTimeCount(shiftSubId, equipmentId, validDate); |
| | | return new BigDecimal(shiftCount).multiply(new BigDecimal("8")).multiply(new BigDecimal("60")); |
| | | } |
| | | |
| | | } |