| | |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.PageTestObjectDto; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | |
| | | List<StructureItemParameter> lists = new ArrayList<>(); |
| | | AtomicReference<String> sample = new AtomicReference<>(); |
| | | ExcelUtil.readBySax(inputStream, 0, (i, l, list1) -> { |
| | | if(i == 0 && l == 1){ |
| | | sample.set(list1.get(1)+""); |
| | | if (i == 0 && l == 1) { |
| | | sample.set(list1.get(1) + ""); |
| | | } |
| | | if (i == 0 && l >= 1) { |
| | | StructureItemParameter str = new StructureItemParameter(); |
| | |
| | | String brand = (String) list1.get(1); |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("["); |
| | | if (ObjectUtil.isNotEmpty(list1.get(2))){ |
| | | if (ObjectUtil.isNotEmpty(list1.get(2))) { |
| | | String production = (String) list1.get(2); |
| | | if (!production.contains("、")){ |
| | | builder.append(String.format("[\"%s\",\"%s\"]",brand,production)); |
| | | }else{ |
| | | Arrays.stream(production.split("、")).forEach(item->{ |
| | | builder.append(String.format("[\"%s\",\"%s\"],",brand,item)); |
| | | if (!production.contains("、")) { |
| | | builder.append(String.format("[\"%s\",\"%s\"]", brand, production)); |
| | | } else { |
| | | Arrays.stream(production.split("、")).forEach(item -> { |
| | | builder.append(String.format("[\"%s\",\"%s\"],", brand, item)); |
| | | }); |
| | | builder.deleteCharAt(builder.length() - 1); |
| | | } |
| | | }else{ |
| | | } else { |
| | | builder.append("["); |
| | | builder.append(String.format("\"%s\"",brand)); |
| | | builder.append(String.format("\"%s\"", brand)); |
| | | builder.append("]"); |
| | | } |
| | | builder.append("]"); |
| | | str.setSample(builder.toString()); |
| | | } |
| | | str.setInspectionItem(list1.get(4).toString()); |
| | | str.setInspectionItemEn(list1.get(5).toString()); |
| | | if (list1.get(5) != null) { |
| | | str.setInspectionItemEn(list1.get(5).toString()); |
| | | } |
| | | if (list1.get(6) == null) { |
| | | str.setInspectionItemSubclass(null); |
| | | } else { |
| | |
| | | str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString())); |
| | | } |
| | | StructureItemParameter db_str; |
| | | if (StringUtils.isEmpty(str.getInspectionItemSubclass())){ |
| | | if (StringUtils.isEmpty(str.getInspectionItemSubclass())) { |
| | | // 比较两个条件 |
| | | db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | ); |
| | | }else{ |
| | | db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | .eq(StructureItemParameter::getInspectionItemSubclass,str.getInspectionItemSubclass()) |
| | | ); |
| | | try { |
| | | db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | ); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("重复查询:" + str.getInspectionItem()); |
| | | } |
| | | } else { |
| | | try { |
| | | db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | .eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass()) |
| | | ); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(db_str)){ |
| | | if (ObjectUtils.isNotEmpty(db_str)) { |
| | | str.setId(db_str.getId()); |
| | | } |
| | | if (list1.get(8) == null) { |
| | |
| | | } |
| | | str.setInspectionItemType(jy); |
| | | String validateValueType = list1.get(18).toString(); |
| | | if (StringUtils.isNotBlank(validateValueType)){ |
| | | if (StringUtils.isNotBlank(validateValueType)) { |
| | | Enums enums = enumService.getOne(Wrappers.lambdaQuery(Enums.class) |
| | | .eq(Enums::getCategory, "检验值类型") |
| | | .eq(Enums::getLabel, validateValueType)); |