| | |
| | | import com.qianwen.smartman.modules.cps.dto.KeyNameDTO; |
| | | import com.qianwen.smartman.modules.cps.dto.ShiftDetailDTO; |
| | | import com.qianwen.smartman.modules.cps.dto.ShiftRestTimeDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.ProductionCalendarDay; |
| | | import com.qianwen.smartman.modules.cps.entity.ShiftDetail; |
| | | import com.qianwen.smartman.modules.cps.entity.ShiftModel; |
| | | import com.qianwen.smartman.modules.cps.entity.ShiftRestTime; |
| | | import com.qianwen.smartman.modules.cps.mapper.ShiftModelMapper; |
| | | import com.qianwen.smartman.modules.cps.service.ICalendarDayService; |
| | | import com.qianwen.smartman.modules.cps.service.IShiftDetailService; |
| | |
| | | @Autowired |
| | | private ShiftModelMapper shiftModelMapper; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -2031150610: |
| | | if (implMethodName.equals("getModelId")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 771206363: |
| | | if (implMethodName.equals("getTenantId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCalendarDay") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getModelId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCalendarDay") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getModelId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ShiftRestTime") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getModelId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ShiftDetail") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getModelId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCalendarDay") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getModelId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ShiftModel") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getTenantId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ShiftModel") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IShiftModelService |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public ShiftModel saveShift(ShiftSaveVO shiftSaveVO) { |
| | |
| | | @Override // org.springblade.modules.cps.service.IShiftModelService |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public ShiftModel update(ShiftUpdateVO shiftUpdateVO) { |
| | | if (this.calendarDayService.count((Wrapper) new QueryWrapper().lambda().eq((v0) -> { |
| | | return v0.getModelId(); |
| | | }, shiftUpdateVO.getId())) > 0) { |
| | | long count = this.calendarDayService.count(new QueryWrapper<ProductionCalendarDay>().lambda().eq(ProductionCalendarDay::getModelId, shiftUpdateVO.getId())); |
| | | if (count > 0) { |
| | | throw new ServiceException(MessageUtils.message("calendar.time.shift.model.used", new Object[0])); |
| | | } |
| | | ShiftSaveVO shiftSaveVO = new ShiftSaveVO(); |
| | |
| | | List<ShiftDetail> shiftDetailList = this.shiftModelMapper.getShiftIndexNameByTenantId(tenantId); |
| | | List<KeyNameDTO> list = new ArrayList<>(); |
| | | if (Func.isNotEmpty(shiftDetailList)) { |
| | | Map<Integer, String> map = (Map) shiftDetailList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Integer, String> map = shiftDetailList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getShiftIndex(); |
| | | }, Collectors.mapping(shiftDetail -> { |
| | | return shiftDetail.getIndexName(); |
| | | }, Collectors.joining("/")))); |
| | | map.forEach(key, value -> { |
| | | map.forEach((key, value) -> { |
| | | if (value.contains("null")) { |
| | | value = (String) Arrays.stream(value.split("/")).filter(item -> { |
| | | return !item.equals("null"); |
| | |
| | | public List<Integer> getShiftIndex(Long modelId) { |
| | | ShiftVO shiftDetailR = getShiftDetail(modelId); |
| | | List<ShiftDetailVO> shiftDetailVOList = shiftDetailR.getShiftDetailVOList(); |
| | | return (List) shiftDetailVOList.stream().map((v0) -> { |
| | | return shiftDetailVOList.stream().map((v0) -> { |
| | | return v0.getShiftIndex(); |
| | | }).distinct().collect(Collectors.toList()); |
| | | } |
| | |
| | | @Override // org.springblade.modules.cps.service.IShiftModelService |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public void deleteShift(String id) { |
| | | if (this.calendarDayService.count((Wrapper) new QueryWrapper().lambda().eq((v0) -> { |
| | | return v0.getModelId(); |
| | | }, Long.valueOf(id))) > 0) { |
| | | long count = this.calendarDayService.count(new QueryWrapper<ProductionCalendarDay>().lambda().eq(ProductionCalendarDay::getModelId, Long.valueOf(id))); |
| | | |
| | | if (count > 0) { |
| | | throw new ServiceException(MessageUtils.message("calendar.shift.model.cannot.be.deleted", new Object[0])); |
| | | } |
| | | this.baseMapper.deleteById(Long.valueOf(id)); |
| | |
| | | } |
| | | |
| | | private void deleteShiftAndRest(Long modelId) { |
| | | this.shiftRestTimeService.remove(new QueryWrapper<ShiftRestTime>().lambda().eq(ShiftRestTime::getModelId, modelId)); |
| | | this.shiftDetailService.remove(new QueryWrapper<ShiftDetail>().lambda().eq(ShiftDetail::getModelId, modelId)); |
| | | /* |
| | | this.shiftRestTimeService.remove((Wrapper) new QueryWrapper().lambda().eq((v0) -> { |
| | | return v0.getModelId(); |
| | | }, modelId)); |
| | | this.shiftDetailService.remove((Wrapper) new QueryWrapper().lambda().eq((v0) -> { |
| | | return v0.getModelId(); |
| | | }, modelId)); |
| | | }, modelId));*/ |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IShiftModelService |
| | | public ShiftVO getShiftDetail(Long modelId) { |
| | | ShiftVO shiftDetail = this.shiftModelMapper.getShiftDetail(modelId); |
| | | if (this.calendarDayService.count((Wrapper) new QueryWrapper().lambda().eq((v0) -> { |
| | | return v0.getModelId(); |
| | | }, modelId)) > 0) { |
| | | long count = this.calendarDayService.count(new QueryWrapper<ProductionCalendarDay>().lambda().eq(ProductionCalendarDay::getModelId, modelId)); |
| | | if (count > 0) { |
| | | shiftDetail.setIsUsed(ProductionTimeConstant.IS_USED); |
| | | } |
| | | List<ShiftDetailVO> vos = shiftDetail.getShiftDetailVOList(); |
| | |
| | | |
| | | @Override // org.springblade.modules.cps.service.IShiftModelService |
| | | public Map<Long, ShiftVO> getShiftDetail(List<Long> modelIds) { |
| | | return modelIds.stream().map(id -> this.baseMapper.getShiftDetail(id)).collect(Collectors.toMap(ShiftVO::getId, v -> v)); |
| | | /* |
| | | return (Map) modelIds.stream().map(id -> { |
| | | return this.baseMapper.getShiftDetail(id); |
| | | }).collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | }));*/ |
| | | } |
| | | |
| | | private void verifyShiftRestTime(ShiftDetailDTO shiftDetailDTO) { |
| | |
| | | throw new ServiceException(MessageUtils.message("calendar.shift.rest.time.end.time.must.be.after.start.time", new Object[0])); |
| | | } |
| | | }); |
| | | List<Integer> restStartTimeList = (List) shiftRestTimeDTOList.stream().map((v0) -> { |
| | | List<Integer> restStartTimeList = shiftRestTimeDTOList.stream().map((v0) -> { |
| | | return v0.getRestStartTime(); |
| | | }).sorted().collect(Collectors.toList()); |
| | | List<Integer> restEndTimeList = (List) shiftRestTimeDTOList.stream().map((v0) -> { |
| | | List<Integer> restEndTimeList = shiftRestTimeDTOList.stream().map((v0) -> { |
| | | return v0.getRestEndTime(); |
| | | }).sorted().collect(Collectors.toList()); |
| | | if (ProductionTimeUtils.isOverlap(restStartTimeList, restEndTimeList)) { |
| | |
| | | if (shiftDetailDTOList.size() > ProductionTimeConstant.SHIFT_UPPER.intValue()) { |
| | | throw new ServiceException(MessageUtils.message("calendar.no.more.than.4.shifts.per.day", new Object[0])); |
| | | } |
| | | List<Integer> shiftStartTimeList = (List) shiftDetailDTOList.stream().map((v0) -> { |
| | | List<Integer> shiftStartTimeList = shiftDetailDTOList.stream().map((v0) -> { |
| | | return v0.getShiftStartTime(); |
| | | }).sorted().collect(Collectors.toList()); |
| | | List<Integer> shiftEndTimeList = (List) shiftDetailDTOList.stream().map((v0) -> { |
| | | List<Integer> shiftEndTimeList = shiftDetailDTOList.stream().map((v0) -> { |
| | | return v0.getShiftEndTime(); |
| | | }).sorted().collect(Collectors.toList()); |
| | | if (ProductionTimeUtils.isOverlap(shiftStartTimeList, shiftEndTimeList)) { |
| | |
| | | } |
| | | |
| | | public void checkCode(ShiftSaveVO shiftSaveVO, String tenantId) { |
| | | Wrapper queryWrapper = new QueryWrapper(); |
| | | |
| | | QueryWrapper<ShiftModel> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(ShiftModel::getCode, shiftSaveVO.getCode()).eq(ShiftModel::getTenantId, tenantId); |
| | | /* |
| | | ((LambdaQueryWrapper) queryWrapper.lambda().eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, shiftSaveVO.getCode())).eq((v0) -> { |
| | | return v0.getTenantId(); |
| | | }, tenantId); |
| | | }, tenantId);*/ |
| | | Optional.ofNullable(this.baseMapper.selectOne(queryWrapper)).ifPresent(po -> { |
| | | if (!po.getId().equals(shiftSaveVO.getId())) { |
| | | throw new ServiceException(MessageUtils.message("calendar.code.has.be.repeated", new Object[0])); |