| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.poi.excel.ExcelUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.PageTestObjectDto; |
| | | import com.yuanchu.mom.pojo.Product; |
| | | import com.yuanchu.mom.pojo.StructureItemParameter; |
| | | import com.yuanchu.mom.pojo.StructureTestObject; |
| | | import com.yuanchu.mom.service.CapacityScopeService; |
| | | import com.yuanchu.mom.service.ProductService; |
| | | import com.yuanchu.mom.excel.StructureTestObjectData; |
| | | import com.yuanchu.mom.excel.StructureTestObjectListener; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | /** |
| | | * 检验项目参数(StructureItemParameter)表控制层 |
| | |
| | | private CapacityScopeService capacityScopeService; |
| | | |
| | | private ProductService productService; |
| | | |
| | | private StructureItemParameterService structureItemParameterService; |
| | | |
| | | private StandardTemplateService standardTemplateService; |
| | | |
| | | @ValueClassify("能力范围") |
| | | @ApiOperation(value = "能力范围-获取项目检验参数列表") |
| | | @ApiOperation(value = "获取项目检验参数列表") |
| | | @PostMapping("/selectItemParameterList") |
| | | public Result selectItemParameterList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | StructureItemParameter itemParameter = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), StructureItemParameter.class); |
| | | return Result.success(capacityScopeService.selectItemParameterList(page, itemParameter)); |
| | | } |
| | | |
| | | @ValueClassify("能力范围") |
| | | @ApiOperation(value = "能力范围-添加项目检验参数") |
| | | @ApiOperation(value = "添加项目检验参数") |
| | | @PostMapping("/addItemParameter") |
| | | public Result addItemParameter(@RequestBody StructureItemParameter itemParameter) { |
| | | return Result.success(capacityScopeService.addItemParameter(itemParameter)); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-删除项目检验参数") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "删除项目检验参数") |
| | | @PostMapping("/delItemParameter") |
| | | public Result<?> delItemParameter(Integer id) { |
| | | return Result.success(capacityScopeService.delItemParameter(id)); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-修改项目检验参数") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "修改项目检验参数") |
| | | @PostMapping("/upItemParameter") |
| | | public Result<?> upItemParameter(@RequestBody StructureItemParameter itemParameter) { |
| | | return Result.success(capacityScopeService.upItemParameter(itemParameter)); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-获取检验对象") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "获取检验对象") |
| | | @PostMapping("/selectTestObjectList") |
| | | public Result selectTestObjectList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | PageTestObjectDto pageTestObjectDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), PageTestObjectDto.class); |
| | | return Result.success(capacityScopeService.selectTestObjectList(page, pageTestObjectDto)); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-添加检验对象") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "添加检验对象") |
| | | @PostMapping("/addTestObject") |
| | | public Result addTestObject(@RequestBody StructureTestObject testObject) { |
| | | return Result.success(capacityScopeService.addTestObject(testObject)); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-删除检验对象") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "删除检验对象") |
| | | @PostMapping("/delTestObject") |
| | | public Result<?> delTestObject(Integer id) { |
| | | return Result.success(capacityScopeService.delTestObject(id)); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-修改检验对象") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "修改检验对象") |
| | | @PostMapping("/upTestObject") |
| | | public Result upTestObject(@RequestBody StructureTestObject testObject) { |
| | | return Result.success(capacityScopeService.upTestObject(testObject)); |
| | | } |
| | | |
| | | @ApiOperation(value = "能力范围-获取检验对象枚举") |
| | | @GetMapping("/selectTestObjectByName") |
| | | @ValueAuth |
| | | @ApiOperation(value = "获取检验对象枚举") |
| | | @GetMapping("/selectTestObjectByName") |
| | | public Result selectTestObjectByName() { |
| | | return Result.success(capacityScopeService.selectTestObjectByName()); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | @ApiOperation(value = "能力范围-设备里面选择检验项目(树形结构)") |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "设备里面选择检验项目(树形结构)") |
| | | @PostMapping("/getInsProduction") |
| | | public Result getInsProduction(){ |
| | | public Result getInsProduction() { |
| | | return Result.success(capacityScopeService.getInsProduction()); |
| | | } |
| | | @ValueClassify(value="能力范围") |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "维护检验对象的产品") |
| | | @PostMapping("/selectProductListByObjectId") |
| | | public Result selectProductListByObjectId(@RequestBody Map<String, Object> data) throws Exception { |
| | |
| | | return Result.success(productService.selectProductListByObjectId(page, product)); |
| | | } |
| | | |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "添加产品") |
| | | @PostMapping("/addProduct") |
| | | @ValueAuth |
| | | public Result addProduct(@RequestBody Product product) { |
| | | return Result.success(productService.addProduct(product)); |
| | | } |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "修改产品") |
| | | @PostMapping("/upProduct") |
| | | @ValueAuth |
| | | public Result upProduct(@RequestBody Product product) { |
| | | return Result.success(productService.upProduct(product)); |
| | | } |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "删除产品") |
| | | @PostMapping("/delProduct") |
| | | @ValueAuth |
| | | public Result delProduct(Integer id) { |
| | | return Result.success(productService.delProduct(id)); |
| | | } |
| | |
| | | return Result.success(capacityScopeService.getItemTree()); |
| | | } |
| | | |
| | | } |
| | | @Autowired |
| | | private EnumService enumService; |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "导入检验项目") |
| | | @PostMapping("/importData") |
| | | @Transactional |
| | | public Result importData(@RequestParam("file") MultipartFile file) throws Exception { |
| | | InputStream inputStream = file.getInputStream(); |
| | | List<StructureItemParameter> lists = new ArrayList<>(); |
| | | AtomicReference<String> sample = new AtomicReference<>(); |
| | | ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> { |
| | | if (l == 1) { |
| | | sample.set(list1.get(1) + ""); |
| | | } |
| | | if (l >= 1) { |
| | | StructureItemParameter str = new StructureItemParameter(); |
| | | if (list1.get(1) == null) { |
| | | str.setSample(null); |
| | | } else { |
| | | String brand = (String) list1.get(1); |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("["); |
| | | 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)); |
| | | }); |
| | | builder.deleteCharAt(builder.length() - 1); |
| | | } |
| | | } else { |
| | | builder.append("["); |
| | | builder.append(String.format("\"%s\"", brand)); |
| | | builder.append("]"); |
| | | } |
| | | builder.append("]"); |
| | | str.setSample(builder.toString()); |
| | | } |
| | | str.setInspectionItem(list1.get(4).toString()); |
| | | if (list1.get(5) != null) { |
| | | str.setInspectionItemEn(list1.get(5).toString()); |
| | | } |
| | | if (list1.get(6) == null) { |
| | | str.setInspectionItemSubclass(null); |
| | | } else { |
| | | str.setInspectionItemSubclass(list1.get(6).toString()); |
| | | } |
| | | if (list1.get(7) == null) { |
| | | str.setInspectionItemSubclassEn(null); |
| | | } else { |
| | | str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString())); |
| | | } |
| | | StructureItemParameter db_str; |
| | | if (StringUtils.isEmpty(str.getInspectionItemSubclass())) { |
| | | // 比较两个条件 |
| | | try { |
| | | db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | .last("limit 1") |
| | | ); |
| | | } 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()) |
| | | .last("limit 1") |
| | | ); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(db_str)) { |
| | | str.setId(db_str.getId()); |
| | | } |
| | | if (list1.get(8) == null) { |
| | | str.setMethod(null); |
| | | } else { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | String input = list1.get(8).toString(); |
| | | buffer.append("["); |
| | | String[] values = input.split("、"); |
| | | for (String value : values) { |
| | | buffer.append("\"").append(value.trim()).append("\","); |
| | | } |
| | | buffer.deleteCharAt(buffer.length() - 1); |
| | | buffer.append("]"); |
| | | str.setMethod(buffer.toString()); |
| | | } |
| | | |
| | | if (list1.get(9) == null) { |
| | | str.setSonLaboratory(null); |
| | | } else { |
| | | str.setSonLaboratory(list1.get(9).toString()); |
| | | } |
| | | if (list1.get(10) == null) { |
| | | str.setUnit(null); |
| | | } else { |
| | | str.setUnit(list1.get(10).toString()); |
| | | } |
| | | |
| | | if (list1.get(11) == null) { |
| | | str.setAskTell(null); |
| | | } else { |
| | | str.setAskTell(list1.get(11).toString()); |
| | | } |
| | | |
| | | if (list1.get(12) == null) { |
| | | str.setAsk(null); |
| | | } else { |
| | | str.setAsk(list1.get(12).toString()); |
| | | } |
| | | |
| | | if (list1.get(13) == null) { |
| | | str.setPrice(null); |
| | | } else { |
| | | str.setPrice(list1.get(13) + ""); |
| | | } |
| | | |
| | | if (list1.get(14) == null) { |
| | | str.setManHour(null); |
| | | } else { |
| | | str.setManHour(Double.valueOf(list1.get(14).toString())); |
| | | } |
| | | |
| | | if (list1.get(15) == null) { |
| | | str.setManHourGroup(null); |
| | | } else { |
| | | str.setManHourGroup(list1.get(15).toString()); |
| | | } |
| | | |
| | | if (list1.get(16) == null) { |
| | | str.setManDay(null); |
| | | } else { |
| | | str.setManDay(Integer.valueOf(list1.get(16).toString())); |
| | | } |
| | | String jy; |
| | | if (list1.get(17).toString().equals("非采集类型")) { |
| | | jy = "0"; |
| | | } else { |
| | | jy = "1"; |
| | | } |
| | | str.setInspectionItemType(jy); |
| | | String validateValueType = list1.get(18).toString(); |
| | | if (StringUtils.isNotBlank(validateValueType)) { |
| | | Enums enums = enumService.getOne(Wrappers.lambdaQuery(Enums.class) |
| | | .eq(Enums::getCategory, "检验值类型") |
| | | .eq(Enums::getLabel, validateValueType)); |
| | | str.setInspectionValueType(enums.getValue()); |
| | | } |
| | | int bsm; |
| | | if (list1.get(19).toString().equals("否")) { |
| | | bsm = 0; |
| | | } else { |
| | | bsm = 1; |
| | | } |
| | | str.setBsm(bsm + ""); |
| | | if (list1.get(20) != null) { |
| | | str.setDic(list1.get(20) + ""); |
| | | } else { |
| | | str.setDic(null); |
| | | } |
| | | StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21))); |
| | | if (standTempIdByName != null) { |
| | | str.setTemplateId(standTempIdByName.getId()); |
| | | } else { |
| | | str.setTemplateId(null); |
| | | } |
| | | try { |
| | | 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 && list1.get(23) != "") { |
| | | str.setInspectionItemClassEn(list1.get(23) + ""); |
| | | } else { |
| | | str.setInspectionItemClassEn(null); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | try { |
| | | if (list1.get(24) != null) { |
| | | str.setLaboratory(list1.get(24) + ""); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | lists.add(str); |
| | | } |
| | | }); |
| | | // structureItemParameterService.removeNoSample(sample.get()); |
| | | // 如果数据库里面的数据存在那么就执行更新拷贝操作 |
| | | try { |
| | | structureItemParameterService.saveOrUpdateBatch(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("服务端报错啦!!!"); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "装备导入检验项目") |
| | | @PostMapping("/importEquipData") |
| | | @Transactional |
| | | public Result importEquipData(@RequestParam("file") MultipartFile file) throws Exception { |
| | | InputStream inputStream = file.getInputStream(); |
| | | List<StructureItemParameter> lists = new ArrayList<>(); |
| | | AtomicReference<String> sample = new AtomicReference<>(); |
| | | ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> { |
| | | if (l == 1) { |
| | | sample.set(list1.get(1) + ""); |
| | | } |
| | | if (l >= 1) { |
| | | StructureItemParameter str = new StructureItemParameter(); |
| | | if (list1.get(1) == null) { |
| | | str.setSample(null); |
| | | } else { |
| | | String brand = (String) list1.get(1); |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("["); |
| | | 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)); |
| | | }); |
| | | builder.deleteCharAt(builder.length() - 1); |
| | | } |
| | | } else { |
| | | builder.append("["); |
| | | builder.append(String.format("\"%s\"", brand)); |
| | | builder.append("]"); |
| | | } |
| | | builder.append("]"); |
| | | str.setSample(builder.toString()); |
| | | } |
| | | str.setInspectionItem(list1.get(4).toString()); |
| | | if (list1.get(5) != null) { |
| | | str.setInspectionItemEn(list1.get(5).toString()); |
| | | } |
| | | if (list1.get(6) == null) { |
| | | str.setInspectionItemSubclass(null); |
| | | } else { |
| | | str.setInspectionItemSubclass(list1.get(6).toString()); |
| | | } |
| | | if (list1.get(7) == null) { |
| | | str.setInspectionItemSubclassEn(null); |
| | | } else { |
| | | str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString())); |
| | | } |
| | | StructureItemParameter db_str; |
| | | if (StringUtils.isEmpty(str.getInspectionItemSubclass())) { |
| | | // 比较两个条件 |
| | | try { |
| | | db_str = structureItemParameterService.getOne(Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | .last("limit 1") |
| | | ); |
| | | } 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()) |
| | | .last("limit 1") |
| | | ); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(db_str)) { |
| | | str.setId(db_str.getId()); |
| | | } |
| | | if (list1.get(8) == null) { |
| | | str.setMethod(null); |
| | | } else { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | String input = list1.get(8).toString(); |
| | | buffer.append("["); |
| | | String[] values = input.split(";"); |
| | | for (String value : values) { |
| | | buffer.append("\"").append(value.trim()).append("\","); |
| | | } |
| | | buffer.deleteCharAt(buffer.length() - 1); |
| | | buffer.append("]"); |
| | | str.setMethod(buffer.toString()); |
| | | } |
| | | |
| | | if (list1.get(9) == null) { |
| | | str.setSonLaboratory(null); |
| | | } else { |
| | | str.setSonLaboratory(list1.get(9).toString()); |
| | | } |
| | | if (list1.get(10) == null) { |
| | | str.setUnit(null); |
| | | } else { |
| | | str.setUnit(list1.get(10).toString()); |
| | | } |
| | | |
| | | if (list1.get(11) == null) { |
| | | str.setAskTell(null); |
| | | } else { |
| | | str.setAskTell(list1.get(11).toString()); |
| | | } |
| | | |
| | | if (list1.get(12) == null) { |
| | | str.setAsk(null); |
| | | } else { |
| | | str.setAsk(list1.get(12).toString()); |
| | | } |
| | | |
| | | if (list1.get(13) == null) { |
| | | str.setPrice(null); |
| | | } else { |
| | | str.setPrice(list1.get(13) + ""); |
| | | } |
| | | |
| | | if (list1.get(14) == null) { |
| | | str.setManHour(null); |
| | | } else { |
| | | str.setManHour(Double.valueOf(list1.get(14).toString())); |
| | | } |
| | | |
| | | if (list1.get(15) == null) { |
| | | str.setManHourGroup(null); |
| | | } else { |
| | | str.setManHourGroup(list1.get(15).toString()); |
| | | } |
| | | |
| | | if (list1.get(16) == null) { |
| | | str.setManDay(null); |
| | | } else { |
| | | str.setManDay(Integer.valueOf(list1.get(16).toString())); |
| | | } |
| | | String jy; |
| | | if (list1.get(17).toString().equals("非采集类型")) { |
| | | jy = "0"; |
| | | } else { |
| | | jy = "1"; |
| | | } |
| | | str.setInspectionItemType(jy); |
| | | String validateValueType = list1.get(18).toString(); |
| | | if (StringUtils.isNotBlank(validateValueType)) { |
| | | Enums enums = enumService.getOne(Wrappers.lambdaQuery(Enums.class) |
| | | .eq(Enums::getCategory, "检验值类型") |
| | | .eq(Enums::getLabel, validateValueType)); |
| | | str.setInspectionValueType(enums.getValue()); |
| | | } |
| | | int bsm; |
| | | if (list1.get(19).toString().equals("否")) { |
| | | bsm = 0; |
| | | } else { |
| | | bsm = 1; |
| | | } |
| | | str.setBsm(bsm + ""); |
| | | if (list1.get(20) != null) { |
| | | str.setDic(list1.get(20) + ""); |
| | | } else { |
| | | str.setDic(null); |
| | | } |
| | | StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21))); |
| | | if (standTempIdByName != null) { |
| | | str.setTemplateId(standTempIdByName.getId()); |
| | | } else { |
| | | str.setTemplateId(null); |
| | | } |
| | | try { |
| | | 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 && list1.get(23) != "") { |
| | | str.setInspectionItemClassEn(list1.get(23) + ""); |
| | | } else { |
| | | str.setInspectionItemClassEn(null); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | try { |
| | | if (list1.get(24) != null) { |
| | | str.setLaboratory(list1.get(24) + ""); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | lists.add(str); |
| | | } |
| | | }); |
| | | structureItemParameterService.removeNoSample(sample.get()); |
| | | // 如果数据库里面的数据存在那么就执行更新拷贝操作 |
| | | try { |
| | | structureItemParameterService.saveOrUpdateBatch(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("服务端报错啦!!!"); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueClassify(value = "能力范围") |
| | | @ApiOperation(value = "导入检验对象") |
| | | @PostMapping("/importExcel") |
| | | public Result importExcel(@RequestParam("file") MultipartFile file) { |
| | | try { |
| | | EasyExcel.read(file.getInputStream(), StructureTestObjectData.class, new StructureTestObjectListener(productService)).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | } |