|
@ -1,5 +1,9 @@ |
|
|
package com.ruoyi.system.service.impl; |
|
|
package com.ruoyi.system.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
|
|
import com.alibaba.excel.write.metadata.fill.FillConfig; |
|
|
import com.github.pagehelper.Page; |
|
|
import com.github.pagehelper.Page; |
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
@ -9,17 +13,20 @@ import com.ruoyi.common.service.ICommonService; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
|
|
import com.ruoyi.common.utils.file.FileDownloadUtils; |
|
|
import com.ruoyi.erp.domain.ErpMaterial; |
|
|
import com.ruoyi.erp.domain.ErpMaterial; |
|
|
import com.ruoyi.process.general.service.IProcessService; |
|
|
import com.ruoyi.process.general.service.IProcessService; |
|
|
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; |
|
|
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; |
|
|
import com.ruoyi.system.domain.*; |
|
|
import com.ruoyi.system.domain.*; |
|
|
import com.ruoyi.system.mapper.SysCustomerQuoteChildMapper; |
|
|
import com.ruoyi.system.domain.Vo.ExportCustomerQuoteChildVo; |
|
|
import com.ruoyi.system.mapper.SysCustomerQuoteMapper; |
|
|
import com.ruoyi.system.domain.Vo.ExportSalesOrderChildVo; |
|
|
import com.ruoyi.system.mapper.SysUserMapper; |
|
|
import com.ruoyi.system.domain.Vo.ExportSalesOrderVo; |
|
|
|
|
|
import com.ruoyi.system.mapper.*; |
|
|
import com.ruoyi.system.service.ISysAttachFileService; |
|
|
import com.ruoyi.system.service.ISysAttachFileService; |
|
|
import com.ruoyi.system.service.ISysAttachService; |
|
|
import com.ruoyi.system.service.ISysAttachService; |
|
|
import com.ruoyi.system.service.ISysCustomerQuoteService; |
|
|
import com.ruoyi.system.service.ISysCustomerQuoteService; |
|
|
import com.ruoyi.system.service.ISysRoleService; |
|
|
import com.ruoyi.system.service.ISysRoleService; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.activiti.engine.TaskService; |
|
|
import org.activiti.engine.TaskService; |
|
|
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; |
|
|
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; |
|
|
import org.activiti.engine.runtime.ProcessInstance; |
|
|
import org.activiti.engine.runtime.ProcessInstance; |
|
@ -30,8 +37,13 @@ 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; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
@Autowired |
|
|
@Autowired |
|
@ -43,6 +55,9 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private SysUserMapper userMapper; |
|
|
private SysUserMapper userMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SysCompanyInformationMapper companyInformationMapper; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private TaskService taskService; |
|
|
private TaskService taskService; |
|
|
|
|
|
|
|
@ -54,6 +69,14 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ISysRoleService roleService; |
|
|
private ISysRoleService roleService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SysCustomerMapper sysCustomerMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static String RMB = "1"; //RMB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SysCustomerQuoteVo selectSysCustomerQuoteById(Long id) { |
|
|
public SysCustomerQuoteVo selectSysCustomerQuoteById(Long id) { |
|
|
SysCustomerQuoteVo sysCustomerQuoteVo = sysCustomerQuoteMapper.selectSysCustomerQuoteById(id); |
|
|
SysCustomerQuoteVo sysCustomerQuoteVo = sysCustomerQuoteMapper.selectSysCustomerQuoteById(id); |
|
@ -352,4 +375,305 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
variables.put("authority",1); |
|
|
variables.put("authority",1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 导出客户报价模板1 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportCustomerQuoteOne(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("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()); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 导出客户报价模板2 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportCustomerQuoteTwo(String supplierCode, HttpServletResponse response) { |
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 { |
|
|
|
|
|
|
|
|
|
|
|
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("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()); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 导出客户报价模板4 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportCustomerQuoteFour(String supplierCode, HttpServletResponse response) { |
|
|
|
|
|
String fileName = "客户报价4.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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
BigDecimal noTax = child.getMaterialNoRmb() != null ? child.getMaterialNoRmb() : BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal tax = child.getMaterialRmb() != null ? child.getMaterialRmb() : BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal allNoTax = child.getMaterialNoRmbSum() != null ? child.getMaterialNoRmbSum() : BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal allTax = child.getMaterialRmbSum() != null ? child.getMaterialRmbSum() : BigDecimal.ZERO; |
|
|
|
|
|
vo.setMaterialNoTaxMoney(noTax); |
|
|
|
|
|
vo.setMaterialTaxMoney(tax); |
|
|
|
|
|
vo.setMaterialAllNoTaxSum(allNoTax); |
|
|
|
|
|
vo.setMaterialAllTaxSum(allTax); |
|
|
|
|
|
} else { |
|
|
|
|
|
// USD
|
|
|
|
|
|
BigDecimal noTax = child.getMaterialNoUsd() != null ? child.getMaterialNoUsd() : BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal tax = child.getUsdTax() != null ? child.getUsdTax() : BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal allNoTax = child.getMaterialNoUsdSum() != null ? child.getMaterialNoUsdSum() : BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal allTax = child.getMaterialUsdSum() != null ? child.getMaterialUsdSum() : BigDecimal.ZERO; |
|
|
|
|
|
|
|
|
|
|
|
vo.setMaterialNoTaxMoney(noTax); |
|
|
|
|
|
vo.setMaterialTaxMoney(tax); |
|
|
|
|
|
vo.setMaterialAllNoTaxSum(allNoTax); |
|
|
|
|
|
vo.setMaterialAllTaxSum(allTax); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|