From e145f248db1bfee531fd095b43abf3725a365e57 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期六, 29 三月 2025 14:30:27 +0800 Subject: [PATCH] 删除无用标准方法列表 --- /dev/null | 81 ------- basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java | 12 - basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java | 6 basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java | 7 basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java | 14 + basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java | 1 basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java | 54 ---- basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml | 3 basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java | 311 --------------------------- basic-server/src/main/resources/mapper/StandardMethodMapper.xml | 35 +++ basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java | 129 +++-------- 11 files changed, 107 insertions(+), 546 deletions(-) diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java index 27d106b..a76b0ea 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java +++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java @@ -50,10 +50,4 @@ return Result.success(standardMethodService.upStandardMethod(standardMethod)); } - @ApiOperation(value = "瀵煎叆鏍囧噯鏄庣粏") - @PostMapping("/importStandardDetails") - public Result<?> importStandardDetails(@RequestPart("file") MultipartFile file) throws IOException { - standardMethodService.inputExcel(file); - return Result.success(); - } } diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java index 45851ec..499d73b 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java +++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; +import com.ruoyi.basic.service.*; import com.ruoyi.common.core.domain.Result; import com.ruoyi.basic.dto.CopyStandardProductListDto; import com.ruoyi.basic.dto.FactoryDto; @@ -10,10 +11,6 @@ import com.ruoyi.basic.pojo.StandardProductList; import com.ruoyi.basic.pojo.StandardProductListSupplierAsk; import com.ruoyi.basic.pojo.StandardTree; -import com.ruoyi.basic.service.StandardMethodListService; -import com.ruoyi.basic.service.StandardProductListService; -import com.ruoyi.basic.service.StandardProductListSupplierAskService; -import com.ruoyi.basic.service.StandardTreeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -33,7 +30,7 @@ private StandardTreeService standardTreeService; - private StandardMethodListService standardMethodListService; + private StandardMethodService standardMethodService; private StandardProductListService standardProductListService; @@ -60,7 +57,7 @@ @ApiOperation(value = "鏍规嵁鏍囧噯鏍戣繘琛屾爣鍑嗘煡璇�") @GetMapping("/selectsStandardMethodByFLSSM") public Result selectsStandardMethodByFLSSM(String tree) { - return Result.success(standardMethodListService.selectsStandardMethodByFLSSM(tree)); + return Result.success(standardMethodService.selectsStandardMethodByFLSSM(tree)); } @ApiOperation(value = "淇敼鏍囧噯搴撲腑鐨勫唴瀹�") @@ -112,7 +109,7 @@ @ApiOperation(value = "鑾峰彇鏍囧噯鏍戜笅鏍囧噯鏂规硶鏋氫妇") @GetMapping("/selectStandardMethodEnum") public Result selectStandardMethodEnum() { - return Result.success(standardMethodListService.selectStandardMethodEnum()); + return Result.success(standardMethodService.selectStandardMethodEnum()); } @ApiOperation(value = "鑾峰彇浜у搧鏋舵瀯") @@ -131,49 +128,6 @@ return Result.success(standardTreeService.upStandardProducts(product)); } - @ApiOperation("浠呰幏鍙栧厜绾ょ殑鍨嬪彿") - @GetMapping("/getStandTreeBySampleType") - public Result<?> getStandTreeBySampleType(String laboratory, String sampleType) { - return Result.success(standardTreeService.getStandTreeBySampleType(laboratory, sampleType)); - } - - @ApiOperation("瀵煎叆鏍囧噯搴�") - @PostMapping("/inExcelOfTree/{isEquipment}") - public Result inExcelOfTree(@RequestParam("file") MultipartFile file, @PathVariable("isEquipment") Boolean isEquipment) { - if (!isEquipment) { - standardTreeService.inExcelOfTree(file); - } else { - standardTreeService.importWorkstationExcel(file); - } - return Result.success(); - } - - @ApiOperation("閲嶇疆鏍囧噯搴撳崟浠�") - @PostMapping("/resetTreeOfPrice") - public Result resetTreeOfPrice(@RequestBody Map<String, Object> map) { - String tree = (String) map.get("tree"); - Integer standardId = (Integer) map.get("standardId"); - standardTreeService.resetTreeOfPrice(tree, standardId); - return Result.success(); - } - - @ApiOperation("閲嶇疆鏍囧噯搴撳伐鏃剁郴鏁�") - @PostMapping("/resetTreeOfHour") - public Result resetTreeOfHour(@RequestBody Map<String, Object> map) { - String tree = (String) map.get("tree"); - Integer standardId = (Integer) map.get("standardId"); - standardTreeService.resetTreeOfHour(tree, standardId); - return Result.success(); - } - - @ApiOperation("閲嶇疆鏍囧噯搴撹姹傛弿杩板拰瑕佹眰鍊�") - @PostMapping("/resetTreeOfAsk") - public Result resetTreeOfAsk(@RequestBody Map<String, Object> map) { - String tree = (String) map.get("tree"); - Integer standardId = (Integer) map.get("standardId"); - standardTreeService.resetTreeOfAsk(tree, standardId); - return Result.success(); - } @ApiOperation("鏍囧噯搴撴嫋鎷�") @PostMapping("/resetTreeDrag") diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java deleted file mode 100644 index 34c8292..0000000 --- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ruoyi.basic.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.ruoyi.basic.pojo.StandardMethodList; -import com.ruoyi.basic.pojo.StandardProductList; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** -* @author Administrator -* @description 閽堝琛ㄣ�恠tandard_method_list(鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�)銆戠殑鏁版嵁搴撴搷浣淢apper -* @createDate 2024-03-04 13:44:04 -* @Entity com.ruoyi.basic.pojo.StandardMethodList -*/ -public interface StandardMethodListMapper extends BaseMapper<StandardMethodList> { - - Map<String, String> selectStandardMethodById(@Param("id") Integer id); - - String selectUserById(@Param("id") Integer id); - - List<StandardMethodList> selectStandardMethodLists(@Param("tree") String tree); - - List<StandardMethodList> selectStandardMethodListsByNull(@Param("tree") String tree); - - List<StandardMethodList> selectStandardMethodLists3(@Param("tree") String tree); - - List<StandardProductList> selectParameterList(@Param("code") String code); - - List<StandardMethodList> selectListEnum(); - - Integer getStandardMethodId(@Param("code") String code); -} - - - - diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java index 420811b..8af3fc9 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java +++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java @@ -3,9 +3,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.basic.pojo.StandardMethodList; import com.ruoyi.framework.mybatis_config.MyBaseMapper; import com.ruoyi.basic.pojo.StandardMethod; import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @author Administrator @@ -19,6 +22,17 @@ StandardMethod selectStandMethodById(@Param("id") Integer id); + + List<StandardMethodList> selectStandardMethodLists(@Param("tree") String tree); + + List<StandardMethodList> selectStandardMethodListsByNull(@Param("tree") String tree); + + List<StandardMethodList> selectStandardMethodLists3(@Param("tree") String tree); + + List<StandardMethodList> selectListEnum(); + + Integer getStandardMethodId(@Param("code") String code); + } diff --git a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java index 8161270..97d6aa1 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java +++ b/basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java @@ -12,7 +12,6 @@ * 鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛� * @TableName standard_method_list */ -@TableName(value ="standard_method_list") @Data public class StandardMethodList implements Serializable { /** diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java deleted file mode 100644 index 2f6a810..0000000 --- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ruoyi.basic.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.ruoyi.basic.pojo.StandardMethodList; - -import java.util.List; -import java.util.Map; - -/** -* @author Administrator -* @description 閽堝琛ㄣ�恠tandard_method_list(鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice -* @createDate 2024-03-04 13:44:04 -*/ -public interface StandardMethodListService extends IService<StandardMethodList> { - - - Map<String, List<?>> selectsStandardMethodByFLSSM(String tree); - - List<StandardMethodList> selectStandardMethodEnum(); - - Integer getStandardMethodId(String code); - -} diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java index d9b3432..b6dbea4 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java @@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.basic.pojo.StandardMethod; +import com.ruoyi.basic.pojo.StandardMethodList; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.util.List; +import java.util.Map; /** * @author Administrator @@ -26,5 +28,8 @@ int upStandardMethod(StandardMethod standardMethod); - void inputExcel(MultipartFile file) throws IOException; + Map<String, List<?>> selectsStandardMethodByFLSSM(String tree); + + List<StandardMethodList> selectStandardMethodEnum(); + } diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java index 0ad0f47..4083e8c 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java @@ -27,18 +27,6 @@ int upStandardProducts(Map<String, Object> product); - List<StandardTree> getStandTreeBySampleType(String laboratory, String sampleType); - - void inExcelOfTree(MultipartFile file); - - void resetTreeOfPrice(String tree, Integer standardId); - - void resetTreeOfHour(String tree, Integer standardId); - - void resetTreeOfAsk(String tree, Integer standardId); - - void importWorkstationExcel(MultipartFile file); - /** * 鏍囧噯鏁版帓搴� * @param list diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java deleted file mode 100644 index d000b4b..0000000 --- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ruoyi.basic.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ruoyi.basic.mapper.StandardMethodListMapper; -import com.ruoyi.basic.mapper.StandardProductListMapper; -import com.ruoyi.basic.pojo.StandardMethodList; -import com.ruoyi.basic.pojo.StandardProductList; -import com.ruoyi.basic.service.StandardMethodListService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** -* @author Administrator -* @description 閽堝琛ㄣ�恠tandard_method_list(鏍囧噯鏍戜笅鐨勬爣鍑嗗垪琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇 -* @createDate 2024-03-04 13:44:04 -*/ -@Service -@AllArgsConstructor -public class StandardMethodListServiceImpl extends ServiceImpl<StandardMethodListMapper, StandardMethodList> - implements StandardMethodListService{ - - private StandardMethodListMapper standardMethodListMapper; - - @Override - public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) { - String[] trees = tree.split(" - "); - Map<String, List<?>> map = new HashMap<>(); - String str = ""; - List<StandardMethodList> standardMethodLists = new ArrayList<>(); - switch (trees.length){ - case 5: - str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\""; - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str)); - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\"")); - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\"")); - break; - case 4: - str += "\"" + trees[2] + "\",\"" + trees[3] + "\""; - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str)); - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\"")); - break; - case 3: - str += "\"" + trees[2] + "\""; - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str)); - break; - default: - map.put("standardMethodList", null); - return map; - } - standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str)); - map.put("standardMethodList", standardMethodLists); - return map; - } - - @Override - public List<StandardMethodList> selectStandardMethodEnum() { - return standardMethodListMapper.selectListEnum(); - } - - @Override - public Integer getStandardMethodId(String code) { - return baseMapper.getStandardMethodId(code); - } -} - - - - diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java index 44566bd..161ea61 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.basic.pojo.StandardMethodList; import com.ruoyi.common.utils.QueryWrappers; import com.ruoyi.basic.mapper.StandardMethodMapper; import com.ruoyi.basic.mapper.StandardProductListMapper; @@ -39,11 +40,11 @@ private StandardMethodMapper standardMethodMapper; - StandardProductListMapper standardProductListMapper; - StandardProductListService standardProductListService; + private StandardProductListMapper standardProductListMapper; + private StandardProductListService standardProductListService; - StructureItemParameterMapper structureItemParameterMapper; - StructureItemParameterService structureItemParameterService; + private StructureItemParameterMapper structureItemParameterMapper; + private StructureItemParameterService structureItemParameterService; @Override public IPage<StandardMethod> selectStandardMethodList(Page page, StandardMethod standardMethod) { @@ -128,26 +129,6 @@ return "鏇挎崲瀹屾瘯!"; } - @Transactional(rollbackFor = Exception.class) - @Override - public void inputExcel(MultipartFile file) throws IOException { - // 瀛樺偍妫�娴嬪璞ist - List<Object> structureTestObjectIdList = new ArrayList<>(); - List<StandardMethod> result = new ArrayList<>(); - ExcelUtil.readBySax(file.getInputStream(), 0, (i, l, list) -> { - // 鍘婚櫎绗竴琛岃〃澶� - if (l == 0) { - return; - } - // 瀛樺偍鍞竴妫�娴嬪璞� - if (!structureTestObjectIdList.contains(list.get(2))) { - structureTestObjectIdList.add(list.get(2)); - } - StandardMethod standardMethod = formatData(list); - result.add(standardMethod); - }); - addStructureTest(structureTestObjectIdList, result); - } // 鏍煎紡鍖栨暟鎹� public StandardMethod formatData(List<Object> list) { @@ -185,74 +166,42 @@ return standardMethod; } - // 鏂板鏁版嵁 - public void addStructureTest(List<Object> structureTestObjectIdList, List<StandardMethod> standardMethodList) { - List<StandardMethod> updateList = new ArrayList<>(); - List<Integer> deleteListId = new ArrayList<>(); - List<StandardMethod> addList = new ArrayList<>(); - if (!structureTestObjectIdList.isEmpty()) { - // 寰幆excel閲岄潰鐨勫垎缁� - structureTestObjectIdList.forEach(j -> { - // 浠xcel涓殑缁勫悕鏌ヨ鏁版嵁搴撲腑鐨勫垎缁� - List<StandardMethod> standardMethods = baseMapper.selectList(Wrappers.<StandardMethod>lambdaQuery() - .like(StandardMethod::getStructureTestObjectId, "\"" + j + "\"")); - // 灏嗙粨鏋滃惊鐜尮閰� - for (int i = 0; i < standardMethods.size(); i++) { - boolean isExistence = false; - for (int i1 = 0; i1 < standardMethodList.size(); i1++) { - // 鏇存柊 - if (standardMethods.get(i).getStructureTestObjectId().equals(standardMethodList.get(i1).getStructureTestObjectId()) - && standardMethods.get(i).getCode().equals(standardMethodList.get(i1).getCode()) - && standardMethods.get(i).getField().equals(standardMethodList.get(i1).getField())) { - // 缁檈xcel鏁版嵁璧嬪�糹d鍋氭洿鏂� - standardMethodList.get(i1).setId(standardMethods.get(i).getId()); - // 鏇存柊 - updateList.add(standardMethodList.get(i1)); - isExistence = true; - break; - } - } - // 鍒犻櫎 - if (!isExistence) { - deleteListId.add(standardMethods.get(i).getId()); - } - } - for (int i = 0; i < standardMethodList.size(); i++) { - if (standardMethodList.get(i).getStructureTestObjectId().contains("\"" + j + "\"")) { - boolean isExistence = false; - for (int i1 = 0; i1 < standardMethods.size(); i1++) { - if (standardMethods.get(i1).getStructureTestObjectId().equals(standardMethodList.get(i).getStructureTestObjectId()) - && standardMethods.get(i1).getCode().equals(standardMethodList.get(i).getCode()) - && standardMethods.get(i1).getField().equals(standardMethodList.get(i).getField())) { - isExistence = true; - break; - } - } - // 鏂板 - if (!isExistence) { - addList.add(standardMethodList.get(i)); - } - } - } - }); + @Override + public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) { + String[] trees = tree.split(" - "); + Map<String, List<?>> map = new HashMap<>(); + String str = ""; + List<StandardMethodList> standardMethodLists = new ArrayList<>(); + switch (trees.length){ + case 5: + str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\""; + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodLists(str)); + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\"")); + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodLists("\"" + trees[2] + "\"")); + break; + case 4: + str += "\"" + trees[2] + "\",\"" + trees[3] + "\""; + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodLists(str)); + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodLists("\"" + trees[2] + "\"")); + break; + case 3: + str += "\"" + trees[2] + "\""; + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodLists3(str)); + break; + default: + map.put("standardMethodList", null); + return map; } - if (!addList.isEmpty()) { - // 鏂板 - baseMapper.insertBatchSomeColumn(addList); - } - - if (!deleteListId.isEmpty()) { - // 鍒犻櫎 - baseMapper.deleteBatchIds(deleteListId); - } - - if (!updateList.isEmpty()) { - // 鏇存柊 - updateList.forEach(i -> { - baseMapper.updateById(i); - }); - } + standardMethodLists.addAll(standardMethodMapper.selectStandardMethodListsByNull(str)); + map.put("standardMethodList", standardMethodLists); + return map; } + + @Override + public List<StandardMethodList> selectStandardMethodEnum() { + return standardMethodMapper.selectListEnum(); + } + } diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java index ad84b75..f6661dc 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java @@ -1,38 +1,32 @@ package com.ruoyi.basic.service.impl; import cn.hutool.core.collection.CollUtil; -import cn.hutool.poi.excel.ExcelUtil; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ruoyi.basic.dto.SampleDto; -import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.basic.dto.FactoryDto; import com.ruoyi.basic.dto.LaboratoryDto; import com.ruoyi.basic.dto.SampleTypeDto; import com.ruoyi.basic.mapper.StandardProductListMapper; import com.ruoyi.basic.mapper.StandardTreeMapper; import com.ruoyi.basic.pojo.StandardProductList; -import com.ruoyi.basic.pojo.StandardTemplate; import com.ruoyi.basic.pojo.StandardTree; import com.ruoyi.basic.pojo.StructureTestObject; -import com.ruoyi.basic.service.*; +import com.ruoyi.basic.service.StandardProductListService; +import com.ruoyi.basic.service.StandardTreeService; +import com.ruoyi.basic.service.StructureTestObjectService; +import com.ruoyi.common.exception.base.BaseException; import lombok.AllArgsConstructor; -import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * @author Administrator @@ -47,13 +41,9 @@ private StandardTreeMapper standardTreeMapper; - private StandardMethodListService standardMethodListService; - private StandardProductListMapper standardProductListMapper; private StandardProductListService standardProductListService; - - private StandardTemplateService standardTemplateService; private StructureTestObjectService structureTestObjectService; @@ -135,271 +125,6 @@ } @Override - public List<StandardTree> getStandTreeBySampleType(String laboratory, String sampleType) { - return standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery() - .eq(StandardTree::getLaboratory, laboratory) - .eq(StandardTree::getSampleType, sampleType) - .select(StandardTree::getModel, StandardTree::getSample)); - } - - /** - * 娌冲彛妫�娴嬩腑蹇冨鍏� - * @param file - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void inExcelOfTree(MultipartFile file) { - InputStream inputStream; - try { - inputStream = file.getInputStream(); - } catch (IOException e) { - throw new RuntimeException(e); - } - List<StandardProductList> lists = new ArrayList<>(); - AtomicReference<String> laboratory = new AtomicReference<>(); - ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> { - StandardProductList str = new StandardProductList(); - if (i == 0 && l == 1) { - laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + "")); - if (laboratory.get() == null) { - throw new BaseException("妫�楠屽璞′笉瀛樺湪锛�" + list.get(1)); - } - } - if (i == 0 && l >= 1) { - Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + ""); - if (standardMethodId == null) { - throw new BaseException("鏍囧噯缂栧彿涓嶅瓨鍦細" + list.get(0)); - } - str.setStandardMethodListId(standardMethodId); - str.setSampleType(list.get(1) + ""); - if (list.get(2) != null) { - String sample = baseMapper.selSample(list.get(2) + ""); - if (sample == null) { - throw new BaseException("鏍峰搧涓嶅瓨鍦細" + list.get(2)); - } - str.setSample(list.get(2) + ""); - } else { - str.setSample(null); - } - if (list.get(3) != null) { - str.setModel(list.get(3) + ""); - Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery() - .eq(StandardTree::getModel, str.getModel()) - .eq(StandardTree::getSampleType, list.get(1) + "")); - if (aLong == 0) { - StandardTree standardTree = new StandardTree(); - standardTree.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�"); - standardTree.setLaboratory(laboratory.get()); - standardTree.setSampleType(str.getSampleType()); - standardTree.setSample(str.getSample()); - standardTree.setModel(str.getModel()); - standardTreeMapper.insert(standardTree); - } - } else { - str.setModel(null); - } - str.setInspectionItem(list.get(4) + ""); - if (list.get(6) == null) { - str.setInspectionItemSubclass(""); - } else { - str.setInspectionItemSubclass(list.get(6).toString()); - } - StandardProductList db_str; - try { - db_str = standardProductListMapper.getOne(str.getStandardMethodListId(), str.getInspectionItem(), str.getSample(), str.getInspectionItemSubclass(), str.getModel(), str.getInspectionItemClass()); - } catch (Exception e) { - throw new BaseException("閲嶅鏌ヨ锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); - } - if (ObjectUtils.isNotEmpty(db_str)) { - str.setId(db_str.getId()); - str.setStructureItemParameterId(db_str.getStructureItemParameterId()); - } - if (list.get(8) != null) { - str.setMethodS(list.get(8) + ""); - } - - if (list.get(11) == null) { - str.setTell(null); - } else { - str.setTell(list.get(11).toString()); - } - - if (list.get(12) == null) { - str.setAsk(null); - } else { - str.setAsk(list.get(12).toString()); - } - - if (list.get(13) == null) { - str.setPrice(null); - } else { - str.setPrice((list.get(13).toString())); - } - - if (list.get(14) == null) { - str.setManHour(null); - } else { - str.setManHour(list.get(14).toString()); - } - - StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(21))); - if (standTempIdByName != null) { - str.setTemplateId(standTempIdByName.getId()); - } else { - throw new BaseException("妯℃澘涓嶅瓨鍦細" + list.get(21)); - } - str.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�"); - str.setLaboratory(laboratory.get()); - str.setState(1); - str.setTree(str.getFactory() + " - " + str.getLaboratory() + " - " + str.getSampleType() + " - " + str.getSample() + " - " + (str.getModel() == null ? "" : str.getModel())); - try { - str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass())); - } catch (Exception e) { - str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\",\"" + str.getSample() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass())); - } - if (str.getStructureItemParameterId() == null) { - throw new BaseException("妫�楠岄」鐩笉瀛樺湪锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); - } - lists.add(str); - } - }); - lists.forEach(a -> { - if (a.getId() != null) { - standardProductListMapper.updateById(a); - } else { - standardProductListMapper.insert(a); - } - }); - } - - @Override - public void importWorkstationExcel(MultipartFile file) { - InputStream inputStream; - try { - inputStream = file.getInputStream(); - } catch (IOException e) { - throw new RuntimeException(e); - } - List<StandardProductList> lists = new ArrayList<>(); - AtomicReference<String> laboratory = new AtomicReference<>(); - ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> { - StandardProductList str = new StandardProductList(); - if (i == 0 && l == 1) { - laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + "")); - if (laboratory.get() == null) { - throw new BaseException("妫�楠屽璞′笉瀛樺湪锛�" + list.get(1)); - } - } - if (i == 0 && l >= 1) { - Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + ""); - if (standardMethodId == null) { - throw new BaseException("鏍囧噯缂栧彿涓嶅瓨鍦細" + list.get(0)); - } - str.setStandardMethodListId(standardMethodId); - str.setSampleType(list.get(1) + ""); - if (list.get(2) != null) { - String sample = baseMapper.selSample(list.get(2) + ""); - if (sample == null) { - throw new BaseException("鏍峰搧涓嶅瓨鍦細" + list.get(2)); - } - str.setSample(list.get(2) + ""); - } else { - str.setSample(null); - } - if (list.get(3) != null) { - str.setModel(list.get(3) + ""); - Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery() - .eq(StandardTree::getModel, str.getModel()) - .eq(StandardTree::getSampleType, list.get(1) + "")); - if (aLong == 0) { - StandardTree standardTree = new StandardTree(); - standardTree.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�"); - standardTree.setLaboratory(laboratory.get()); - standardTree.setSampleType(str.getSampleType()); - standardTree.setSample(str.getSample()); - standardTree.setModel(str.getModel()); - standardTreeMapper.insert(standardTree); - } - } else { - str.setModel(null); - } - str.setInspectionItemClass(list.get(4).toString()); - str.setInspectionItemClassEn(list.get(5).toString()); - // 寮�濮嬪姞2 - str.setInspectionItem(list.get(6) + ""); - if (list.get(8) == null) { - str.setInspectionItemSubclass(""); - } else { - str.setInspectionItemSubclass(list.get(8).toString()); - } - StandardProductList db_str; - try { - db_str = standardProductListMapper.getOne(str.getStandardMethodListId(), str.getInspectionItem(), str.getSample(), str.getInspectionItemSubclass(), str.getModel(), str.getInspectionItemClass()); - } catch (Exception e) { - throw new BaseException("閲嶅鏌ヨ锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); - } - if (ObjectUtils.isNotEmpty(db_str)) { - str.setId(db_str.getId()); - str.setStructureItemParameterId(db_str.getStructureItemParameterId()); - } - if (list.get(10) != null) { - str.setMethodS(list.get(10) + ""); - } - if (list.get(13) == null) { - str.setTell(null); - } else { - str.setTell(list.get(13).toString()); - } - - if (list.get(14) == null) { - str.setAsk(null); - } else { - str.setAsk(list.get(14).toString()); - } - - if (list.get(15) == null) { - str.setPrice(null); - } else { - str.setPrice((list.get(15).toString())); - } - - if (list.get(16) == null) { - str.setManHour(null); - } else { - str.setManHour(list.get(16).toString()); - } - - StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(23))); - if (standTempIdByName != null) { - str.setTemplateId(standTempIdByName.getId()); - } else { - throw new BaseException("妯℃澘涓嶅瓨鍦細" + list.get(23)); - } - str.setFactory("涓ぉ绉戞妧妫�娴嬩腑蹇�"); - str.setLaboratory(laboratory.get()); - str.setState(1); - str.setTree(str.getFactory() + " - " + str.getLaboratory() + " - " + str.getSampleType() + " - " + str.getSample() + " - " + (str.getModel() == null ? "" : str.getModel())); - try { - str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass())); - } catch (Exception e) { - str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\",\"" + str.getSample() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass())); - } - if (str.getStructureItemParameterId() == null) { - throw new BaseException("妫�楠岄」鐩笉瀛樺湪锛�" + str.getInspectionItem() + " " + str.getInspectionItemSubclass()); - } - lists.add(str); - } - }); - lists.forEach(a -> { - if (a.getId() != null) { - standardProductListMapper.updateById(a); - } else { - standardProductListMapper.insert(a); - } - }); - } - - @Override public boolean updateTreeSort(List<FactoryDto> list) { List<StructureTestObject> testObjects = new ArrayList<>(); for (FactoryDto factoryDto : list) { @@ -463,28 +188,6 @@ return standardTreeMapper.update(null, wrapper); } - @Override - public void resetTreeOfPrice(String tree, Integer standardId) { - standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getPrice, null)); - } - - @Override - public void resetTreeOfHour(String tree, Integer standardId) { - standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getManHour, null)); - } - - @Override - public void resetTreeOfAsk(String tree, Integer standardId) { - standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId) - .set(StandardProductList::getAsk, null) - .set(StandardProductList::getTell, null) - .set(StandardProductList::getSection, null) - .set(StandardProductList::getCores, null) - .set(StandardProductList::getConductorMaterial, null) - .set(StandardProductList::getConductorType, null) - .set(StandardProductList::getPrice, null) - .set(StandardProductList::getManHour, null)); - } } diff --git a/basic-server/src/main/resources/mapper/StandardMethodListMapper.xml b/basic-server/src/main/resources/mapper/StandardMethodListMapper.xml deleted file mode 100644 index 32fbb43..0000000 --- a/basic-server/src/main/resources/mapper/StandardMethodListMapper.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper - PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.basic.mapper.StandardMethodListMapper"> - - <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardMethodList"> - <id property="id" column="id" jdbcType="INTEGER"/> - <result property="code" column="code" jdbcType="VARCHAR"/> - <result property="name" column="name" jdbcType="VARCHAR"/> - <result property="remark" column="remark" jdbcType="VARCHAR"/> - <result property="createUser" column="create_user" jdbcType="INTEGER"/> - <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> - <result property="updateUser" column="update_user" jdbcType="INTEGER"/> - <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> - </resultMap> - - <select id="selectStandardMethodById" resultType="java.util.Map"> - select code, name, remark - from standard_method - where id = #{id} - </select> - <select id="selectUserById" resultType="java.lang.String"> - select name - from user - where id = #{id} - </select> - <select id="selectStandardMethodLists" resultType="com.ruoyi.basic.pojo.StandardMethodList"> - select id, code, name, remark - from standard_method - where is_use = 1 - and is_product = 1 - and structure_test_object_id LIKE CONCAT('%[', #{tree}, ']%') - </select> - <select id="selectParameterList" resultType="com.ruoyi.basic.pojo.StandardProductList"> - select inspection_item, - inspection_item_subclass, - laboratory, - unit, - price, - man_hour, - man_hour_group, - inspection_item_type, - inspection_value_type, - checkout_number, - section, - method, - man_day, - bsm, - template_id, - son_laboratory - from structure_item_parameter - where method = #{code} - </select> - <select id="selectStandardMethodLists3" resultType="com.ruoyi.basic.pojo.StandardMethodList"> - select id, code, name, remark - from standard_method - where is_use = 1 - and is_product = 1 - and structure_test_object_id LIKE CONCAT('%', #{tree}, '%') - </select> - <select id="selectListEnum" resultType="com.ruoyi.basic.pojo.StandardMethodList"> - select id,code,name from standard_method - where is_product = 1 - and is_use = 1 - </select> - <select id="selectStandardMethodListsByNull" resultType="com.ruoyi.basic.pojo.StandardMethodList"> - select id, code, name, remark - from standard_method - where is_use = 1 - and is_product = 1 - and ( - structure_test_object_id is null - OR structure_test_object_id = '' - OR structure_test_object_id = '[]' - ) - </select> - <select id="getStandardMethodId" resultType="java.lang.Integer"> - select id from standard_method where code = #{code} - </select> -</mapper> diff --git a/basic-server/src/main/resources/mapper/StandardMethodMapper.xml b/basic-server/src/main/resources/mapper/StandardMethodMapper.xml index 739d2d4..1f50462 100644 --- a/basic-server/src/main/resources/mapper/StandardMethodMapper.xml +++ b/basic-server/src/main/resources/mapper/StandardMethodMapper.xml @@ -64,4 +64,39 @@ left join structure_test_object sto on sm.structure_test_object_id = sto.id where sm.id = #{id} </select> + + <select id="selectStandardMethodLists" resultType="com.ruoyi.basic.pojo.StandardMethodList"> + select id, code, name, remark + from standard_method + where is_use = 1 + and is_product = 1 + and structure_test_object_id LIKE CONCAT('%[', #{tree}, ']%') + </select> + + <select id="selectStandardMethodLists3" resultType="com.ruoyi.basic.pojo.StandardMethodList"> + select id, code, name, remark + from standard_method + where is_use = 1 + and is_product = 1 + and structure_test_object_id LIKE CONCAT('%', #{tree}, '%') + </select> + <select id="selectListEnum" resultType="com.ruoyi.basic.pojo.StandardMethodList"> + select id,code,name from standard_method + where is_product = 1 + and is_use = 1 + </select> + <select id="selectStandardMethodListsByNull" resultType="com.ruoyi.basic.pojo.StandardMethodList"> + select id, code, name, remark + from standard_method + where is_use = 1 + and is_product = 1 + and ( + structure_test_object_id is null + OR structure_test_object_id = '' + OR structure_test_object_id = '[]' + ) + </select> + <select id="getStandardMethodId" resultType="java.lang.Integer"> + select id from standard_method where code = #{code} + </select> </mapper> diff --git a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml index fd67dfc..b0139da 100644 --- a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml +++ b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml @@ -40,7 +40,8 @@ inspection_item_class_en, code, radius_list, - rates + rates, + device_ids from (select *, CASE WHEN INSTR(sample, ',') > 0 THEN -- Gitblit v1.9.3