From 031d1c5a7c680bfcf2b9a4a98e9d0ae0c613ff51 Mon Sep 17 00:00:00 2001
From: zhuo <2089219845@qq.com>
Date: 星期六, 15 三月 2025 11:42:24 +0800
Subject: [PATCH] 新增无需密码获取用户登录信息
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
index 742af90..46c30d9 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -22,6 +22,7 @@
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.constant.MenuJumpPathConstants;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.entity.InformationNotification;
import com.ruoyi.common.core.domain.entity.User;
@@ -36,8 +37,10 @@
import com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper;
import com.ruoyi.system.mapper.UserMapper;
import com.ruoyi.system.service.InformationNotificationService;
+import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -65,6 +68,7 @@
* @createDate 2024-03-17 22:10:02
*/
@Service
+@Slf4j
public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport>
implements InsReportService {
@Resource
@@ -81,8 +85,7 @@
private String wordUrl;
@Value("${file.path}")
private String imgUrl;
- @Value("${file.licenseUrl}")
- private String licenseUrl;
+
@Resource
private InsOrderMapper insOrderMapper;
@Resource
@@ -185,7 +188,7 @@
info.setSenderId(submitUserId); //鍙戦�佷汉
info.setConsigneeId(userId); //鏀朵欢浜�
info.setViewStatus(false);
- info.setJumpPath("b1-report-preparation");
+ info.setJumpPath(MenuJumpPathConstants.REPORT_PREPARATION);
informationNotificationService.addInformationNotification(info);
//绯荤粺鐢熸垚鎶ュ憡鍦板潃
String url = insReport.getUrl();
@@ -306,7 +309,7 @@
info.setSenderId(checkUserId); //鍙戦�佷汉
info.setConsigneeId(userId); //鏀朵欢浜�
info.setViewStatus(false);
- info.setJumpPath("b1-report-preparation");
+ info.setJumpPath(MenuJumpPathConstants.REPORT_PREPARATION);
informationNotificationService.addInformationNotification(info);
//绯荤粺鐢熸垚鎶ュ憡鍦板潃
String url = insReport.getUrl();
@@ -535,12 +538,16 @@
}
// 鍘嬬缉涓存椂鏂囦欢澶�
zipFilePath = wordUrl + "/zip/output.zip";
+ // 鍒ゆ柇zip璺緞鏄惁瀛樺湪
+ File zipDir = new File(wordUrl + "/zip");
+ if(!zipDir.isDirectory()){
+ zipDir.mkdirs();
+ }
zipDirectory(tempFolderPath, zipFilePath);
// 娓呯悊涓存椂鏂囦欢澶�
deleteDirectory(tempFolder);
- System.out.println("ZIP鏂囦欢鍒涘缓瀹屾垚锛�");
} catch (IOException e) {
e.printStackTrace();
}
@@ -675,13 +682,11 @@
FileOutputStream os = null;
try {
//鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
-// InputStream is = this.getClass().getResourceAsStream("/lib/license.xml");
-// InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("license.xml");
- InputStream is = Files.newInputStream(new File(licenseUrl).toPath());
+ InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
License license = new License();
license.setLicense(is);
if (!license.getIsLicensed()) {
- System.out.println("License楠岃瘉涓嶉�氳繃...");
+ log.info("License楠岃瘉涓嶉�氳繃...");
return null;
}
//鐢熸垚涓�涓┖鐨凱DF鏂囦欢
@@ -1116,11 +1121,11 @@
FileOutputStream os = null;
try {
//鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃
- InputStream is = Files.newInputStream(new File(licenseUrl).toPath());
+ InputStream is = new ClassPathResource("/lib/license.xml").getInputStream();
License license = new License();
license.setLicense(is);
if (!license.getIsLicensed()) {
- System.out.println("License楠岃瘉涓嶉�氳繃...");
+ log.info("License楠岃瘉涓嶉�氳繃...");
return null;
}
//鐢熸垚涓�涓┖鐨凱DF鏂囦欢
@@ -1131,7 +1136,6 @@
//瑕佽浆鎹㈢殑word鏂囦欢
com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
doc.save(os, SaveFormat.PDF);
- String name = file.getName();
return file.getName();
} catch (Exception e) {
e.printStackTrace();
--
Gitblit v1.9.3