Browse Source

[feat] 客户报价

客户报价列表页面新增导出客户报价3按钮,新增对应的导出js方法,导出前进行判断,是否审核通过,是否只选择一条,是否币种是RMB
新增 导出客户报价模板3后端接口,新增具体实现类,完成对客户报价模板3导出模板的数据填充
新增 客户报价模板3导出模板
dev
liuxiaoxu 3 months ago
parent
commit
100072517e
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteService.java
  3. 71
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java
  4. BIN
      ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx
  5. 44
      ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html

12
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java

@ -358,4 +358,16 @@ public class SysCustomerQuoteController extends BaseController
}
/**
* 导出客户报价模板3
* */
@RequiresPermissions("system:customerQuote:exportCustomerQuoteThree")
@Log(title = "客户报价信息", businessType = BusinessType.EXPORT)
@GetMapping("/exportCustomerQuoteThree/{supplierCode}")
public void exportCustomerQuoteThree(@PathVariable("supplierCode") String supplierCode, HttpServletResponse response){
sysCustomerQuoteService.exportCustomerQuoteThree(supplierCode,response);
}
}

5
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteService.java

@ -96,4 +96,9 @@ public interface ISysCustomerQuoteService
* 导出客户报价模板2
* */
void exportCustomerQuoteTwo(String supplierCode, HttpServletResponse response);
/**
* 导出客户报价模板3
* */
void exportCustomerQuoteThree(String supplierCode, HttpServletResponse response);
}

71
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java

@ -455,7 +455,73 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService {
* */
@Override
public void exportCustomerQuoteTwo(String supplierCode, HttpServletResponse response) {
String fileName = "客户报价1.xlsx";
String fileName = "客户报价2.xlsx";
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try {
String fileRelativePath = fileDownloadUtils.getFileRelativePath(fileName);
String realFileName = supplierCode +"-" + fileName.substring(0, fileName.indexOf(".")) + ".xlsx";
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8"));
response.setContentType("application/octet-stream");
//to
SysCustomerQuote sysCustomerQuote = sysCustomerQuoteMapper.selectSysCustomerBySupplierCode(supplierCode);
if(sysCustomerQuote==null){
log.warn("客户报价信息不存在:{}", supplierCode);
}
List<SysCustomerQuoteChild> sysCustomerQuoteChildren = sysCustomerQuoteChildMapper.selectSysCustomerQuoteChildByQuoteId(sysCustomerQuote.getSupplierCode());
String customerCode = sysCustomerQuote.getCustomerCode();
SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(customerCode);
List<SysCompanyInformation> companyInformations = companyInformationMapper.selectSysCompanyInformationAllList();
HashMap<String, Object> map = new HashMap<>();
String pricingDate = sysCustomerQuote.getPricingDate();
map.put("supplierCode", sysCustomerQuote.getSupplierCode());
map.put("pricingDate", pricingDate);
map.put("customerContact", sysCustomerVo.getCustomerContact());
map.put("contactNumberTo", sysCustomerVo.getContactNumber());
map.put("customerEmail", sysCustomerVo.getCustomerEmail());
List<ExportCustomerQuoteChildVo> exportCustomerQuoteChildVos = new ArrayList<>();
for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) {
ExportCustomerQuoteChildVo exportCustomerQuoteChildVo = new ExportCustomerQuoteChildVo();
exportCustomerQuoteChildVo.setDescribe(sysCustomerQuoteChild.getDescribe());
exportCustomerQuoteChildVo.setMaterialNum(sysCustomerQuoteChild.getMaterialNum());
//区分币种
setMaterialPrice(exportCustomerQuoteChildVo, sysCustomerVo, sysCustomerQuoteChild);
exportCustomerQuoteChildVos.add(exportCustomerQuoteChildVo);
}
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileRelativePath).build();
WriteSheet sheet = EasyExcel.writerSheet().build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();
workBook.fill(map, sheet);
workBook.fill(exportCustomerQuoteChildVos, fillConfig, sheet);
workBook.finish();
} catch (IOException e) {
throw new RuntimeException("文件处理失败",e);
}
}
/**
* 导出客户报价模板3
* */
@Override
public void exportCustomerQuoteThree(String supplierCode, HttpServletResponse response) {
String fileName = "客户报价3.xlsx";
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try {
@ -491,6 +557,9 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService {
map.put("supplierCode", sysCustomerQuote.getSupplierCode());
map.put("pricingDate", pricingDate);
map.put("contacts", sysCompanyInformation.getContacts());
map.put("contactNumberFrom", sysCompanyInformation.getContactNumber());
map.put("companyEmail", sysCompanyInformation.getCompanyEmail());
map.put("customerContact", sysCustomerVo.getCustomerContact());
map.put("contactNumberTo", sysCustomerVo.getContactNumber());
map.put("customerEmail", sysCustomerVo.getCustomerEmail());

BIN
ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx

Binary file not shown.

44
ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html

@ -77,6 +77,10 @@
<i class="fa fa-download"></i> 导出客户报价2
</a>
<a class="btn btn-warning" onclick="exportCustomerQuoteThree()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteThree">
<i class="fa fa-download"></i> 导出客户报价3
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space:nowrap"></table>
@ -297,6 +301,46 @@
}
}
// 导出客户报价模板3
function exportCustomerQuoteThree(){
const selectRows = $("#bootstrap-table").bootstrapTable('getSelections');
// 定义状态码常量
const AUDIT_STATUS_APPROVED = "1";//审核通过
const DELETE_FLAG = "2"; //作废
if (selectRows.length === 1){
const row = selectRows[0];
// 检查是否已作废
if (row.useStatus === DELETE_FLAG) {
showWarning("该订单已作废");
}else {
// 检查是否已审核
if (row.auditStatus === AUDIT_STATUS_APPROVED) {
if (row.commonCurrency === '2'){
// 使用 $.modal.confirm 显示确认对话框
$.modal.confirm("确定导出这条数据的客户报价吗?", function() {
// 如果用户点击确定,继续导出
var supplierCode = row.supplierCode;
window.location.href = prefix + "/exportCustomerQuoteThree/" + supplierCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}else {
showWarning("请选择报价币种为美元的数据进行导出");
}
} else {
showWarning("请先审核");
}
}
}else {
$.modal.alertWarning("请选择一条数据");
return;
}
}

Loading…
Cancel
Save