| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | @Resource |
| | | private IMdcShiftSubService mdcShiftSubService; |
| | | |
| | | @Resource |
| | | private IMdcVacationManagementService mdcVacationManagementService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 计算实际班产天数 |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeActualWorkDayCount(String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | List<String> validDateList = this.baseMapper.computeActualWorkDayCount(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 equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeShiftTimeCount(String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | Integer shiftCount = this.baseMapper.computeShiftTimeCount(equipmentId, validDate); |
| | | return new BigDecimal(shiftCount).multiply(new BigDecimal("8")).multiply(new BigDecimal("60")); |
| | | } |
| | | |
| | | /** |
| | | * 自动生成设备工作日历 |
| | | */ |
| | | @Override |
| | |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | List<MdcDeviceCalendar> list = super.list(new LambdaQueryWrapper<MdcDeviceCalendar>().eq(MdcDeviceCalendar::getEquipmentId, mdcEquipment.getEquipmentId()).eq(MdcDeviceCalendar::getEffectiveDate, localDate.replaceAll("-", ""))); |
| | | if (list == null || list.isEmpty()) { |
| | | List<MdcVacationManagement> vacationManagementList = mdcVacationManagementService.list(new LambdaQueryWrapper<MdcVacationManagement>().eq(MdcVacationManagement::getEquipmentId, mdcEquipment.getEquipmentId()).eq(MdcVacationManagement::getVacationDate, localDate)); |
| | | if (vacationManagementList == null || vacationManagementList.isEmpty()) { |
| | | String effectiveDate = localDate.replaceAll("-", ""); |
| | | for (MdcDeviceCalendarVo mdcDeviceCalendarVo : acquiesceShift) { |
| | | MdcDeviceCalendar mdcDeviceCalendar = new MdcDeviceCalendar(); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!result.isEmpty()) { |
| | | super.saveBatch(result); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcDeviceCalendar getFirstData(String equipmentId) { |
| | | return this.baseMapper.getFirstData(equipmentId); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcDeviceCalendarVo> listByEquipmentIdAndDate(String equipmentId, String date) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentId, date); |
| | | if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { |
| | | for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) { |
| | | List<MdcEquipmentOvertime> list = mdcEquipmentOvertimeService.list(new LambdaQueryWrapper<MdcEquipmentOvertime>().eq(MdcEquipmentOvertime::getEquipmentId, mdcDeviceCalendarVo.getEquipmentId()).eq(MdcEquipmentOvertime::getTheDate, mdcDeviceCalendarVo.getEndDate())); |
| | | if (list != null && !list.isEmpty()) { |
| | | mdcDeviceCalendarVo.setOvertimeStartTime(list.get(0).getStartTime()); |
| | | mdcDeviceCalendarVo.setOvertimeEndTime(list.get(0).getEndTime()); |
| | | } |
| | | } |
| | | } |
| | | return mdcDeviceCalendarVos; |
| | | } |
| | | |
| | | } |