Browse Source

[feat] 销售管理

文件下载工具类,新增获取文件的相对路径接口
采购订单供应商合同导出,新增导出前提示框
dev
liuxiaoxu 1 month ago
parent
commit
a203a2e003
  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.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -133,6 +134,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
@Autowired
private SysCompanyInformationMapper companyInformationMapper;
/**
* 查询采购订单
*
@ -711,7 +713,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try {
String fileAbsolutePath = fileDownloadUtils.getFileAbsolutePath(fileName);
String fileAbsolutePath = fileDownloadUtils.getFileRelativePath(fileName);
//处理供应商
SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode);

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

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