From f0afb2b17f2f6e13925ffe1b6fd8c8ae724aec0e Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期四, 13 三月 2025 10:46:24 +0800
Subject: [PATCH] 分支合并冲突解决

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java |   97 ++++++++----------------------------------------
 1 files changed, 17 insertions(+), 80 deletions(-)

diff --git a/cnas-require/src/main/java/com/ruoyi/require/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
similarity index 88%
rename from cnas-require/src/main/java/com/ruoyi/require/service/impl/InsReportServiceImpl.java
rename to inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
index f6aea28..e7a5ed2 100644
--- a/cnas-require/src/main/java/com/ruoyi/require/service/impl/InsReportServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -1,10 +1,8 @@
-package com.ruoyi.require.service.impl;
+package com.ruoyi.inspect.service.impl;
 
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONArray;
-import com.aspose.words.Document;
-import com.aspose.words.License;
-import com.aspose.words.SaveFormat;
+import com.aspose.words.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -33,9 +31,9 @@
 import com.ruoyi.inspect.pojo.InsOrder;
 import com.ruoyi.inspect.pojo.InsOrderState;
 import com.ruoyi.inspect.pojo.InsReport;
+import com.ruoyi.inspect.service.InsReportService;
 import com.ruoyi.process.mapper.ProcessReportMapper;
 import com.ruoyi.process.pojo.ProcessReport;
-import com.ruoyi.require.service.InsReportService;
 import com.ruoyi.system.mapper.UserMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -64,6 +62,7 @@
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
@@ -80,6 +79,7 @@
 @Slf4j
 public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport>
         implements InsReportService {
+
 
     @Resource
     private UserMapper userMapper;
@@ -118,7 +118,6 @@
 
     @Override
     public IPage<ReportPageDto> pageInsReport(Page page, ReportPageDto reportPageDto) {
-        Map<String, Object> map = new HashMap<>();
         User user = userMapper.selectById(SecurityUtils.getUserId());//褰撳墠鐧诲綍鐨勪汉
         //鑾峰彇褰撳墠浜烘墍灞炲疄楠屽id
         String departLimsId = user.getDepartLimsId();
@@ -136,8 +135,10 @@
             wrapper.gt(reportPageDto.getCreateTimeRange().size()>1,"create_time",reportPageDto.getCreateTimeRange().get(0))
                     .lt(reportPageDto.getCreateTimeRange().size()>1,"create_time",reportPageDto.getCreateTimeRange().get(1));
         }
-        return insReportMapper.pageInsReport(page, wrapper ,laboratory);
+        IPage<ReportPageDto> iPage = insReportMapper.pageInsReport(page, wrapper, laboratory);
+        return iPage;
     }
+
 
     @Override
     public int inReport(String url, Integer id) {
@@ -168,7 +169,7 @@
         String url = "";
         // 0 涓嬭浇docx 1 涓嬭浇pdf
         if(type == 0) {
-          url  = Strings.isNotEmpty(insReport.getUrlS()) ? insReport.getUrlS() : insReport.getUrl();
+            url  = Strings.isNotEmpty(insReport.getUrlS()) ? insReport.getUrlS() : insReport.getUrl();
         }else {
             url = insReport.getTempUrlPdf();
         }
@@ -210,11 +211,11 @@
         insReport.setId(id);
         insReport.setState(1);
         insReport.setWriteTime(LocalDateTime.now());//鎻愪氦鏃堕棿
-        insReport.setWriteUserId(SecurityUtils.getUserId().intValue());//鎻愪氦浜�
+        insReport.setWriteUserId(Integer.getInteger(SecurityUtils.getUserId().toString()));//鎻愪氦浜�
         //鑾峰彇鎻愪氦浜虹殑绛惧悕鍦板潃
         String signatureUrl;
         try {
-            signatureUrl = userMapper.selectById(SecurityUtils.getUserId().intValue()).getSignatureUrl();
+            signatureUrl = userMapper.selectById(Integer.getInteger(SecurityUtils.getUserId().toString())).getSignatureUrl();
         } catch (Exception e) {
             throw new ErrorException("鎵句笉鍒扮紪鍒朵汉鐨勭鍚�");
         }
@@ -239,7 +240,7 @@
         if (ObjectUtils.isNotEmpty(examineTell)) {
             insReport.setExamineTell(examineTell);
         }
-        insReport.setExamineUserId(SecurityUtils.getUserId().intValue());//瀹℃牳浜�
+        insReport.setExamineUserId(Integer.getInteger(SecurityUtils.getUserId().toString()));//瀹℃牳浜�
         insReport.setExamineTime(LocalDateTime.now());//瀹℃牳鏃堕棿
         if (isExamine == 0) {
             //濡傛灉瀹℃牳涓嶉�氳繃
@@ -275,7 +276,7 @@
         if (ObjectUtils.isNotEmpty(ratifyTell)) {
             insReport.setRatifyTell(ratifyTell);
         }
-        insReport.setRatifyUserId(SecurityUtils.getUserId().intValue());//鎵瑰噯浜�
+        insReport.setRatifyUserId(Integer.getInteger(SecurityUtils.getUserId().toString()));//鎵瑰噯浜�
         insReport.setRatifyTime(LocalDateTime.now());//鎵瑰噯鏃堕棿
         if (isRatify == 0) {
             //濡傛灉鎵瑰噯涓嶉�氳繃
@@ -415,70 +416,6 @@
             }
             inReport("/word/" + pathName, insReport.getId());
         }
-//        File tempFile = null;
-//        File unzipDir = null;
-//        try {
-//            tempFile = File.createTempFile(wordUrl, ".zip");
-//            file.transferTo(tempFile);
-//
-//            unzipDir = new File("uploaded_files");
-//            if (!unzipDir.exists()) {
-//                unzipDir.mkdir();
-//            }
-//            unzip(tempFile, unzipDir);
-//            // 澶勭悊瑙e帇鍚庣殑鏂囦欢
-//            File[] files = unzipDir.listFiles();
-//            if (files != null) {
-//                for (File f : files) {
-//                    // 鏍规嵁鏂囦欢鍚嶆煡璇d
-//                    String name = f.getName();
-//                    String code = f.getName().replace(".docx", "").replace("JCZX", "JCZX/");
-//                    if(f.getName().lastIndexOf("_") != -1) {
-//                        code = code.substring(f.getName().lastIndexOf("_") + 1);
-//                    }
-//                    //InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery().eq(InsReport::getCode, f.getName().replace(".docx", "").replace("JCZX", "JCZX/")));
-//                    InsReport insReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery().eq(InsReport::getCode, code));
-//                    if (ObjectUtils.isEmpty(insReport)) {
-//                        throw new ErrorException("娌℃湁鎵惧埌 " + f.getName() + " 杩欎釜鏂囦欢瀵瑰簲鐨勬姤鍛婃暟鎹�");
-//                    }
-//                    // 濡傛灉UrlS鏈夊�� 鍏堝皢璇ユ枃浠跺垹闄�
-//                    if(Strings.isNotEmpty(insReport.getUrlS())) {
-//                        String url = wordUrl + File.separator + insReport.getUrlS().replace("/word/", "");
-//                        File file1 = new File(url);
-//                        if(file1.exists()) {
-//                            file1.delete();
-//                        }
-//                    }
-//                    String urlString;
-//                    String pathName;
-//                    try {
-//                        String path = wordUrl;
-//                        File realpath = new File(path);
-//                        if (!realpath.exists()) {
-//                            realpath.mkdirs();
-//                        }
-//                        pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + insReport.getCode().replace("/", "") + ".docx";
-//                        urlString = realpath + "/" + pathName;
-//                        // 澶嶅埗鏂囦欢鍒版寚瀹氳矾寰�
-//                        Files.copy(f.toPath(), new File(urlString).toPath(), StandardCopyOption.REPLACE_EXISTING);
-//                        inReport("/word/" + pathName, insReport.getId());
-//                    }
-//                    catch (IOException e) {
-//                        throw new ErrorException("鏂囦欢涓婁紶澶辫触");
-//                    }
-//                }
-//            }
-//        } catch (IOException e) {
-//            throw new ErrorException("鏂囦欢澶勭悊澶辫触");
-//        } finally {
-//            if (tempFile != null && tempFile.exists()) {
-//                tempFile.delete();
-//            }
-//            // 閫掑綊鍒犻櫎瑙e帇鐩綍鍙婂叾涓殑鏂囦欢
-//            if (unzipDir.exists()) {
-//                deleteDirectory(unzipDir); // 鍒犻櫎鏃х殑涓存椂鏂囦欢澶�
-//            }
-//        }
         return 0;
     }
 
@@ -506,7 +443,7 @@
         List<Map<String, Object>> list = new ArrayList<>();
         Integer insOrderId = insReportMapper.selectById(id).getInsOrderId();
         insOrderStateMapper.selectList(new LambdaQueryWrapper<InsOrderState>()
-                .eq(InsOrderState::getInsOrderId,insOrderId))
+                        .eq(InsOrderState::getInsOrderId,insOrderId))
                 .forEach(insOrderState -> {
                     Map<String, Object> map = new HashMap<>();
                     map.put("label",insOrderState.getLaboratory());
@@ -547,7 +484,7 @@
     @Transactional(rollbackFor = Exception.class)
     public void batchApprovalReport(List<Integer> ids) {
         redisTemplate.setKeySerializer(new StringRedisSerializer());
-        Integer userId = SecurityUtils.getUserId().intValue();
+        Integer userId = Integer.parseInt(SecurityUtils.getUserId().toString());
         String key = SYNC_REPORT_KEY_PREFIX+userId;
         //鎵ц鍓嶅垹闄や箣鍓嶇殑keys
         deleteRedisKeys(key);
@@ -676,7 +613,7 @@
 
     @Override
     public Map<String, Object> getBatchApprovalProgress() {
-        Integer userId = SecurityUtils.getUserId().intValue();
+        Integer userId = Integer.parseInt(SecurityUtils.getUserId().toString());
         String key = SYNC_REPORT_KEY_PREFIX + userId;
         Map<String, Object> map = new HashMap<>();
         map.put("hasProgress",false);
@@ -790,7 +727,7 @@
             file = new File(pdfPath);
             os = new FileOutputStream(file);
             //瑕佽浆鎹㈢殑word鏂囦欢
-            Document doc = new Document(wordPath);
+            com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
             doc.save(os, SaveFormat.PDF);
             String name = file.getName();
             return file.getName();

--
Gitblit v1.9.3