Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 3 months ago
parent
commit
b3702435cb
  1. 4
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  2. 7
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html
  3. 20
      ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileDownloadUtils.java

4
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java

@ -51,6 +51,7 @@ import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -133,6 +134,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
@Autowired @Autowired
private SysCompanyInformationMapper companyInformationMapper; private SysCompanyInformationMapper companyInformationMapper;
/** /**
* 查询采购订单 * 查询采购订单
* *
@ -711,7 +713,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils(); FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try { try {
String fileAbsolutePath = fileDownloadUtils.getFileAbsolutePath(fileName); String fileAbsolutePath = fileDownloadUtils.getFileRelativePath(fileName);
//处理供应商 //处理供应商
SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode); SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode);

7
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html

@ -328,12 +328,17 @@
} }
const selectedChildRow = selectedChildRows[0]; const selectedChildRow = selectedChildRows[0];
// 使用 $.modal.confirm 显示确认对话框
$.modal.confirm("确定导出这条数据的合同吗?", function() {
// 如果用户点击确定,继续导出
var supplierCode = selectedChildRow.supplierCode; var supplierCode = selectedChildRow.supplierCode;
// 如果一切正常,继续导出 // 如果一切正常,继续导出
var purchaseOrderCode = row.purchaseOrderCode; var purchaseOrderCode = row.purchaseOrderCode;
window.location.href = prefix + "/exportContract/" + purchaseOrderCode + "?supplierCode=" + encodeURIComponent(supplierCode); window.location.href = prefix + "/exportContract/" + purchaseOrderCode + "?supplierCode=" + encodeURIComponent(supplierCode);
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
} }
// 显示警告消息的通用函数 // 显示警告消息的通用函数
function showWarning(message) { function showWarning(message) {

20
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileDownloadUtils.java

@ -4,6 +4,9 @@ import org.springframework.core.io.ClassPathResource;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/** /**
* 文件下载类 * 文件下载类
@ -11,10 +14,25 @@ import java.io.IOException;
public class FileDownloadUtils { public class FileDownloadUtils {
// 获取文件绝对路径 // 获取文件绝对路径
public String getFileAbsolutePath(String fileName) throws IOException { public String getFileAbsolutePath(String fileName) throws IOException {
ClassPathResource resource = new ClassPathResource("attachments/" + fileName); ClassPathResource resource = new ClassPathResource("attachments/" + fileName);
File file = resource.getFile(); File file = resource.getFile();
return file.getAbsolutePath(); return file.getPath();
}
//获取文件的相对路径
public String getFileRelativePath(String fileName) throws IOException {
ClassPathResource resource = new ClassPathResource("attachments/" + fileName);
Path path = Paths.get(resource.getURI());
File file = path.toFile();
return file.getPath();
} }
} }

Loading…
Cancel
Save