From a5b1bad21ba279ade3954852a5e281e9086042f0 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 26 十一月 2024 15:22:52 +0800
Subject: [PATCH] 前端联调修改2.0

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java |  126 +++++++++++++----------------------------
 1 files changed, 41 insertions(+), 85 deletions(-)

diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
index 8701757..add542c 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
@@ -81,22 +81,13 @@
     @Resource
     InsProductResultMapper insProductResultMapper;
     @Resource
-    private WarehouseHistoryMapper warehouseHistoryMapper;
-    @Resource
     private InsProductMapper insProductMapper;
-    @Resource
-    private InsProductService insProductService;
     @Resource
     private InsProductUserMapper insProductUserMapper;
     @Resource
     private GiveCode giveCode;
     @Resource
-    private InsSampleUserMapper insSampleUserMapper;
-    @Resource
-    private InsOrderStateMapper insOrderStateMapper;
-    @Resource
     UserMapper userMapper;
-
     @Resource
     InformationNotificationService informationNotificationService;
     @Resource
@@ -141,34 +132,6 @@
         });
         map.put("body", sampleOrderDtoIPage);
         return map;
-    }
-
-    //鍒嗛厤绔欑偣
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public int upInsOrder(Integer orderId, Integer sampleId, String appointed, Integer userId, String sonLaboratory) {
-        InsOrder insOrder = new InsOrder();
-        insOrder.setId(orderId);
-        //insOrder.setAppointed(LocalDate.parse(appointed));
-        insOrder.setSendTime(LocalDateTime.now());
-        insOrderMapper.updateById(insOrder);
-        //淇敼鎴愬彧缁欏綋鍓嶉�夋嫨鐨勮瘯楠屽涓嬪彂鍗曞瓙
-        InsOrderState insOrderState = new InsOrderState();
-        insOrderState.setInsOrderId(orderId);
-        insOrderState.setLaboratory(sonLaboratory);
-        insOrderState.setInsState(0);
-        insOrderState.setNum(1);//鍒濆鏄涓�娆�
-        insOrderStateMapper.insert(insOrderState);
-        //杩欓噷鏄湪缁欏垎閰嶇殑鎸囧畾鐨勪汉鍜岃瘯楠屽涓嬪彂妫�楠屼汉
-        if (userId != null) {
-            InsSampleUser insSampleUser = new InsSampleUser();
-            insSampleUser.setState(0);
-            insSampleUser.setUserId(userId);
-            insSampleUser.setInsSampleId(orderId);
-            insSampleUser.setSonLaboratory(sonLaboratory);
-            insSampleUserMapper.insert(insSampleUser);
-        }
-        return 1;
     }
 
     @Override
@@ -257,7 +220,7 @@
         if (insOrder.getOrderType().equals("C")) {
             insOrder.setState(1);
             upInsOrderOfState(insOrder);
-        }else if (insOrder.getOrderType().equals("A")){
+        } else if (insOrder.getOrderType().equals("A")) {
             //甯歌澶栭儴鍗曢渶娑堟伅鎻愰啋妫�楠屼腑蹇冧富浠诲拰鐮斿彂閮ㄧ粡鐞�
             //todo 浼佷笟寰俊鎺ㄩ��
             users1.addAll(users2);
@@ -267,7 +230,7 @@
             map.put("msgtype", "text");//娑堟伅绫诲瀷 text:鏂囨湰
             map.put("agentid", 1000517);//搴旂敤id
             HashMap<String, Object> hashMap = new HashMap<>();
-            hashMap.put("content", "鎮ㄦ湁涓�鏉℃楠岃鍗曢渶瑕佸鏍�,璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傚閮ㄨ鍗曞彿鏄細"+insOrder.getOutEntrustCode()+",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
+            hashMap.put("content", "鎮ㄦ湁涓�鏉℃楠岃鍗曢渶瑕佸鏍�,璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傚閮ㄨ鍗曞彿鏄細" + insOrder.getOutEntrustCode() + ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
             map.put("text", hashMap);//娑堟伅鍐呭
             map.put("safe", 0);//鏄惁淇濆瘑娑堟伅.0鍚�
             map.put("enable_id_trans", 0);//鏄惁寮�鍚痠d杞瘧.0鍚�
@@ -280,15 +243,15 @@
                 info.setCreateUser(userMapper.selectById(userId).getName());
                 info.setMessageType("2");
                 info.setTheme("瀹℃牳閫氱煡");
-                info.setContent("鎮ㄦ湁涓�鏉℃楠岃鍗曞緟瀹℃牳娑堟伅,璁㈠崟鐨勫閮ㄧ紪鍙锋槸:"+insOrder.getOutEntrustCode());
+                info.setContent("鎮ㄦ湁涓�鏉℃楠岃鍗曞緟瀹℃牳娑堟伅,璁㈠崟鐨勫閮ㄧ紪鍙锋槸:" + insOrder.getOutEntrustCode());
                 info.setSenderId(userId);
                 info.setViewStatus(false);
-                info.setJumpPath("b1-inspect-order");
+                info.setJumpPath("b1-inspection-order");
                 info.setConsigneeId(user.getId());
                 notificationArrayList.add(info);
             }
             informationNotificationService.saveBatch(notificationArrayList);
-        }else if (insOrder.getOrderType().equals("B")){
+        } else if (insOrder.getOrderType().equals("B")) {
             //闈炲父瑙勫閮ㄥ崟闇�娑堟伅鎻愰啋妫�楠屼腑蹇冧富浠�,鐮斿彂閮ㄧ粡鐞嗗拰鎶�鏈礋璐d汉
             //todo 浼佷笟寰俊鎺ㄩ��
             users1.addAll(users2);
@@ -299,7 +262,7 @@
             map.put("msgtype", "text");//娑堟伅绫诲瀷 text:鏂囨湰
             map.put("agentid", 1000517);//搴旂敤id
             HashMap<String, Object> hashMap = new HashMap<>();
-            hashMap.put("content", "鎮ㄦ湁涓�鏉℃楠岃鍗曢渶瑕佸鏍�,璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傚閮ㄨ鍗曞彿鏄細"+insOrder.getOutEntrustCode()+",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
+            hashMap.put("content", "鎮ㄦ湁涓�鏉℃楠岃鍗曢渶瑕佸鏍�,璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傚閮ㄨ鍗曞彿鏄細" + insOrder.getOutEntrustCode() + ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
             map.put("text", hashMap);//娑堟伅鍐呭
             map.put("safe", 0);//鏄惁淇濆瘑娑堟伅.0鍚�
             map.put("enable_id_trans", 0);//鏄惁寮�鍚痠d杞瘧.0鍚�
@@ -312,10 +275,10 @@
                 info.setCreateUser(userMapper.selectById(userId).getName());
                 info.setMessageType("2");
                 info.setTheme("瀹℃牳閫氱煡");
-                info.setContent("鎮ㄦ湁涓�鏉℃楠岃鍗曞緟瀹℃牳娑堟伅,璁㈠崟鐨勫閮ㄧ紪鍙锋槸:"+insOrder.getOutEntrustCode());
+                info.setContent("鎮ㄦ湁涓�鏉℃楠岃鍗曞緟瀹℃牳娑堟伅,璁㈠崟鐨勫閮ㄧ紪鍙锋槸:" + insOrder.getOutEntrustCode());
                 info.setSenderId(userId);
                 info.setViewStatus(false);
-                info.setJumpPath("b1-inspect-order");
+                info.setJumpPath("b1-inspection-order");
                 info.setConsigneeId(user.getId());
                 notificationArrayList.add(info);
             }
@@ -346,7 +309,7 @@
                     if (!realpath.exists()) {
                         realpath.mkdirs();
                     }
-                    pathName = UUID.randomUUID() + "_" + file.getOriginalFilename();
+                    pathName = UUID.randomUUID() + "_" + file.getOriginalFilename().replace("#", "&");
                     urlString = realpath + "/" + pathName;
                     file.transferTo(new File(urlString));
                     insOrderFile.setFileUrl(pathName);
@@ -365,7 +328,7 @@
             map.put("msgtype", "text");//娑堟伅绫诲瀷 text:鏂囨湰
             map.put("agentid", 1000517);//搴旂敤id
             HashMap<String, Object> hashMap = new HashMap<>();
-            hashMap.put("content", "鎮ㄦ湁涓�鏉¤鍗曢渶瑕佸畬鎴�,璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傚閮ㄨ鍗曞彿鏄細"+insOrder.getOutEntrustCode()+",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
+            hashMap.put("content", "鎮ㄦ湁涓�鏉¤鍗曢渶瑕佸畬鎴�,璇峰墠寰�LIMS绯荤粺鏌ョ湅銆傚閮ㄨ鍗曞彿鏄細" + insOrder.getOutEntrustCode() + ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�<a href=\"https://ztwxlims.ztt.cn:7443/enter\">涓ぉ閫氫俊LIMS绯荤粺 </a>");
             map.put("text", hashMap);//娑堟伅鍐呭
             map.put("safe", 0);//鏄惁淇濆瘑娑堟伅.0鍚�
             map.put("enable_id_trans", 0);//鏄惁寮�鍚痠d杞瘧.0鍚�
@@ -377,11 +340,11 @@
             info.setCreateUser(insProductMapper.selectUserById(userId).get("name"));
             info.setMessageType("1");
             info.setTheme("鏍锋満鍛橀�氱煡");
-            info.setContent("鎮ㄦ湁涓�鏉℃楠岃鍗曠殑鏍锋満寰呭畬鎴愭秷鎭�,澶栭儴璁㈠崟鍙锋槸锛�"+insOrder.getOutEntrustCode()+",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�");
+            info.setContent("鎮ㄦ湁涓�鏉℃楠岃鍗曠殑鏍锋満寰呭畬鎴愭秷鎭�,澶栭儴璁㈠崟鍙锋槸锛�" + insOrder.getOutEntrustCode() + ",璇峰墠寰�LIMS绯荤粺鏌ョ湅銆�");
             info.setSenderId(userId);
             info.setConsigneeId(insOrder.getIssueUser());
             info.setViewStatus(false);
-            info.setJumpPath("b1-inspect-order");
+            info.setJumpPath("b1-inspection-order");
             informationNotificationService.addInformationNotification(info);
         }
         return insOrder.getId();
@@ -479,49 +442,42 @@
     }
 
     @Override
-    public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) {
+    public Map<String, Object> getInsOrderAndSample(Integer sampleId, String laboratory) {
+        InsSample insSample = insSampleMapper.selectById(sampleId);
         Map<String, Object> map = new HashMap<>();
-        InsOrder insOrder = insOrderMapper.selectById2(id);
-        List<SampleProductDto> insSamples = insSampleMapper.selectList1(insOrder.getId());
-        List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory);
+        InsOrder insOrder = insOrderMapper.selectById2(insSample.getInsOrderId());
+        SampleProductDto sampleProductDto = insSampleMapper.getInsOrderAndSample(sampleId, laboratory);
         //鍐嶆璇曢獙浼氬嚭鐜颁负绌虹殑鎯呭喌
-        if (list.size() != insSamples.size()) {
-            List<Integer> ids = list.stream().map(sampleProductDto -> sampleProductDto.getId()).distinct().collect(Collectors.toList());
-            List<SampleProductDto> samples = insSamples.stream().filter(insSample ->
-                    !ids.contains(insSample.getId())
-            ).collect(Collectors.toList());
-            for (SampleProductDto insSample : samples) {
-                List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
-                        .eq(InsProduct::getInsSampleId, insSample.getId())
-                        .eq(InsProduct::getState, 1)
-                        .eq(InsProduct::getSonLaboratory, laboratory));
-                for (InsProduct insProduct : insProducts) {
-                    List<InsProductResult2> insProductResult2List = insProductResult2Mapper.selectList(Wrappers.<InsProductResult2>lambdaQuery()
-                            .eq(InsProductResult2::getInsProductId, insProduct.getId()).isNull(InsProductResult2::getNum));
-                    insProduct.setInsProductResult2(insProductResult2List);
-                    InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery()
-                            .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum));
-                    insProduct.setInsProductResult(insProductResult);
-                }
-                insSample.setInsProduct(insProducts);
-                list.add(insSample);
+        if (ObjectUtils.isEmpty(sampleProductDto)) {
+            List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
+                    .eq(InsProduct::getInsSampleId, insSample.getId())
+                    .eq(InsProduct::getState, 1)
+                    .eq(InsProduct::getSonLaboratory, laboratory));
+            for (InsProduct insProduct : insProducts) {
+                List<InsProductResult2> insProductResult2List = insProductResult2Mapper.selectList(Wrappers.<InsProductResult2>lambdaQuery()
+                        .eq(InsProductResult2::getInsProductId, insProduct.getId()).isNull(InsProductResult2::getNum));
+                insProduct.setInsProductResult2(insProductResult2List);
+                InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery()
+                        .eq(InsProductResult::getInsProductId, insProduct.getId()).isNull(InsProductResult::getNum));
+                insProduct.setInsProductResult(insProductResult);
             }
-
+            SampleProductDto dto = new SampleProductDto();
+            dto.setInsProduct(insProducts);
+            BeanUtils.copyProperties(insSample,dto);
+            sampleProductDto=dto;
         }
-        for (SampleProductDto sampleProductDto : list) {
-            List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList());
-            List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery()
-                    .in(InsProductUser::getInsProductId, ids));
-            if (CollectionUtils.isNotEmpty(insProductUsers)) {
-                List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList());
-                String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(","));
-                sampleProductDto.setCheckName(collect);
-            }
+        List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList());
+        List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery()
+                .in(InsProductUser::getInsProductId, ids));
+        if (CollectionUtils.isNotEmpty(insProductUsers)) {
+            List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList());
+            String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(","));
+            sampleProductDto.setCheckName(collect);
         }
         map.put("insOrder", insOrder);
-        map.put("sampleProduct", list);
+        map.put("sampleProduct", sampleProductDto);
         //鏌ヨ鎵�鏈夎褰曟ā鐗堝幓閲�
-        List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory);
+        List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(insSample.getInsOrderId(), laboratory);
         map.put("reportModel", list2);
         return map;
     }

--
Gitblit v1.9.3