| | |
| | | //获取检验下单数据 |
| | | @Override |
| | | public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | // TODO 针对人员做权限处理 目前先对检验人员做数据处理 如果是检验人员只能查询到检验项目是自己或者订单分派人是自己的订单,不是检验人员的暂时全查 |
| | | boolean checkUserFlag = isCheckUser(SecurityUtils.getUserId().intValue()); |
| | | String laboratory = null; |
| | | // 判断是否是全部 |
| | | String isOrderAll = null; |
| | |
| | | SampleOrderDto otherParam = new SampleOrderDto(); |
| | | otherParam.setLaboratory(laboratory); |
| | | otherParam.setIsOrderAll(isOrderAll); |
| | | otherParam.setCheckUserFlag(checkUserFlag); |
| | | otherParam.setCheckUserId(SecurityUtils.getUserId()); |
| | | IPage<SampleOrderDto> sampleOrderDtoIPage = insOrderMapper.selectInsOrderPage(page, QueryWrappers.queryWrappers(sampleOrderDto), otherParam); |
| | | // 拼接检验人根据检验项来 |
| | | if(CollectionUtils.isEmpty(sampleOrderDtoIPage.getRecords())){ |
| | | return sampleOrderDtoIPage; |
| | | } |
| | | List<Integer> orderIds = new ArrayList<>(); |
| | | for (SampleOrderDto record : sampleOrderDtoIPage.getRecords()) { |
| | | orderIds.add(record.getId()); |
| | | } |
| | | List<CheckUserDto> checkUserDtoList = insProductMapper.selectCheckUserNameByOrderIds(orderIds); |
| | | for (SampleOrderDto record : sampleOrderDtoIPage.getRecords()) { |
| | | Integer orderId = record.getId(); |
| | | for (CheckUserDto checkUserDto : checkUserDtoList) { |
| | | if(orderId.equals(checkUserDto.getOrderId())) { |
| | | record.setTestingName(checkUserDto.getCheckUserNames()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return sampleOrderDtoIPage; |
| | | } |
| | | |
| | |
| | | auxiliaryOutputWorkingHours.setCheck(userId);//检测人 |
| | | auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//单价 |
| | | auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//样品id |
| | | auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//检验项id |
| | | auxiliaryOutputWorkingHours.setInsProductId(Math.toIntExact(insProduct.getId()));//检验项id |
| | | |
| | | return auxiliaryOutputWorkingHours; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 初次分配检验人,各个检验项默认订单的检验人 |
| | | List<Integer> insProductIds = insProductList.stream().map(insproduct -> { |
| | | return insproduct.getId(); |
| | | return Math.toIntExact(insproduct.getId()); |
| | | }).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(insProductIds)){ |
| | | insProductMapper.batchUpdateInsProductCheckUserId(insProductIds, userId); |
| | |
| | | ip2.addAll(insProducts); |
| | | } |
| | | for (InsProduct product : ip2) { |
| | | product.setStandardMethodListId(a.getInsulating().getStandardMethodListId()); |
| | | product.setStandardMethodListId(Long.valueOf(a.getInsulating().getStandardMethodListId())); |
| | | } |
| | | addInsProductMethod(a.getId(), ip2); |
| | | } |
| | |
| | | ip2.addAll(insProducts); |
| | | } |
| | | for (InsProduct product : ip2) { |
| | | product.setStandardMethodListId(a.getAuxiliaryWireCore().getStandardMethodListId()); |
| | | product.setStandardMethodListId(Long.valueOf(a.getAuxiliaryWireCore().getStandardMethodListId())); |
| | | } |
| | | addInsProductMethod(a.getId(), ip2); |
| | | } |
| | |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("导出失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断是否为检验人员 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | public boolean isCheckUser(Integer userId) { |
| | | List<User> userList = userMapper.selectQualityUserList(); |
| | | for (User user : userList) { |
| | | if(userId.equals(user.getId())){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |