Browse Source

[feat] 客户报价

客户报价列表页面新增导出客户报价2按钮,新增对应的导出js方法,导出前进行判断,是否审核通过,是否只选择一条,是否币种是RMB
新增 导出客户报价模板2后端接口,新增具体实现类,完成对客户报价模板2导出模板的数据填充
新增 客户报价模板2导出模板
修改 通用ry-ui.js 的分页数据为 10,100,1000
dev
liuxiaoxu 2 months ago
parent
commit
2b157b431b
  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. 67
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java
  4. BIN
      ruoyi-admin/src/main/resources/static/attachments/客户报价2.xlsx
  5. 2
      ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
  6. 49
      ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html

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

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

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

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

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

@ -450,7 +450,74 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService {
}
/**
* 导出客户报价模板2
* */
@Override
public void exportCustomerQuoteTwo(String supplierCode, HttpServletResponse response) {
String fileName = "客户报价1.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();
//from
SysCompanyInformation sysCompanyInformation = companyInformations.get(0);
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);
}
}
//区分不同币种的金额
private void setMaterialPrice(ExportCustomerQuoteChildVo vo, SysCustomerVo sysCustomerVo, SysCustomerQuoteChild child) {
if (RMB.equals(sysCustomerVo.getCommonCurrency())) {
// RMB

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

Binary file not shown.

2
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js

@ -47,7 +47,7 @@ var table = {
paginationLoop: false,
pageSize: 10,
pageNumber: 1,
pageList: [10, 25, 50],
pageList: [10, 100, 1000],
toolbar: "toolbar",
loadingFontSize: 13,
striped: false,

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

@ -73,7 +73,9 @@
<a class="btn btn-warning" onclick="exportCustomerQuoteOne()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteOne">
<i class="fa fa-download"></i> 导出客户报价1
</a>
<a class="btn btn-warning" onclick="exportCustomerQuoteTwo()" shiro:hasPermission="system:customerQuote:exportCustomerQuoteTwo">
<i class="fa fa-download"></i> 导出客户报价2
</a>
</div>
<div class="col-sm-12 select-table table-striped">
@ -122,7 +124,6 @@
restoreUrl: prefix + "/restore/{id}",
detailUrl: prefix + "/detail/{id}",
exportUrl: prefix + "/export",
pageSize: 5,
pageList: [5, 10, 25, 50],
modalName: "客户报价表",
fixedColumns:true,
@ -255,6 +256,50 @@
}
}
// 导出客户报价模板2
function exportCustomerQuoteTwo(){
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 + "/exportCustomerQuoteTwo/" + supplierCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}else {
showWarning("请选择报价币种为美元的数据进行导出");
}
} else {
showWarning("请先审核");
}
}
}else {
$.modal.alertWarning("请选择一条数据");
return;
}
}
// 显示警告消息的通用函数
function showWarning(message) {
$.modal.msgWarning(message);

Loading…
Cancel
Save