From 47ff9c863e736ff06c39ba44ddfd736c8329a9b7 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期三, 12 三月 2025 19:34:26 +0800 Subject: [PATCH] 完成检验下单接口联调及自测 --- basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 150 insertions(+), 0 deletions(-) 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 new file mode 100644 index 0000000..7a4f831 --- /dev/null +++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java @@ -0,0 +1,150 @@ +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; + + private StandardProductListMapper standardProductListMapper; + + @Override + public int addStandardMethodList(Integer standardId, String tree) { + String[] trees = tree.split(" - "); + Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId); + StandardMethodList list = new StandardMethodList(); + list.setCode(map.get("code")); + list.setName(map.get("name")); + list.setRemark(map.get("remark")); + list.setFactory(trees[0]); + try { + list.setLaboratory(trees[1]); + }catch (Exception e){} + try { + list.setSampleType(trees[2]); + }catch (Exception e){} + try { + list.setSample(trees[3]); + }catch (Exception e){} + try { + list.setModel(trees[4]); + }catch (Exception e){} + standardMethodListMapper.insert(list); + List<StandardProductList> standardProductLists = standardMethodListMapper.selectParameterList(list.getCode()); + for (StandardProductList standardProductList : standardProductLists) { + standardProductList.setStandardMethodListId(list.getId()); + standardProductList.setFactory(trees[0]); + try { + standardProductList.setLaboratory(trees[1]); + }catch (Exception e){} + try { + standardProductList.setSampleType(trees[2]); + }catch (Exception e){} + try { + standardProductList.setSample(trees[3]); + }catch (Exception e){} + try { + standardProductList.setModel(trees[4]); + }catch (Exception e){} + standardProductListMapper.insert(standardProductList); + } + return 1; + } + + @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 Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree) { + String[] trees = tree.split(" - "); + List<StandardMethodList> standardMethodLists = null; + switch (trees.length){ + case 5: + standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],trees[4]); + break; + case 4: + standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],null); + break; + case 3: + standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],null,null); + break; + case 2: + standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],null,null,null); + break; + case 1: + standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],null,null,null,null); + break; + } + Map<String, List<?>> map = new HashMap<>(); + map.put("standardMethodList", standardMethodLists); + return map; + } + + @Override + public int delStandardMethodByFLSSM(Integer id) { + standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id)); + return standardMethodListMapper.deleteById(id); + } + @Override + public List<StandardMethodList> selectStandardMethodEnum() { + return standardMethodListMapper.selectListEnum(); + } + + @Override + public Integer getStandardMethodId(String code) { + return baseMapper.getStandardMethodId(code); + } +} + + + + -- Gitblit v1.9.3