| | |
| | | InputStream inputStream = file.getInputStream(); |
| | | List<StructureItemParameter> lists = new ArrayList<>(); |
| | | AtomicReference<String> sample = new AtomicReference<>(); |
| | | ExcelUtil.readBySax(inputStream, 0, (i, l, list1) -> { |
| | | if (i == 0 && l == 1) { |
| | | ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> { |
| | | if (l == 1) { |
| | | sample.set(list1.get(1) + ""); |
| | | } |
| | | if (i == 0 && l >= 1) { |
| | | if (l >= 1) { |
| | | StructureItemParameter str = new StructureItemParameter(); |
| | | if (list1.get(1) == null) { |
| | | str.setSample(null); |
| | |
| | | str.setTemplateId(null); |
| | | } |
| | | try { |
| | | if (list1.get(22) != null) { |
| | | if (list1.get(22) != null && list1.get(22) != "") { |
| | | str.setInspectionItemClass(list1.get(22) + ""); |
| | | } else { |
| | | str.setInspectionItemClass(null); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | try { |
| | | if (list1.get(23) != null) { |
| | | if (list1.get(23) != null && list1.get(23) != "") { |
| | | str.setInspectionItemClassEn(list1.get(23) + ""); |
| | | } else { |
| | | str.setInspectionItemClassEn(null); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | |
| | | structureItemParameterService.removeNoSample(sample.get()); |
| | | // 如果数据库里面的数据存在那么就执行更新拷贝操作 |
| | | try { |
| | | structureItemParameterService.saveBatch(lists); |
| | | structureItemParameterService.saveOrUpdateBatch(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("服务端报错啦!!!"); |