修复所有Bug

This commit is contained in:
wen 2022-01-03 23:00:05 +08:00
parent 45a69c2296
commit 080fee8bc7
2 changed files with 46 additions and 48 deletions

View File

@ -1,7 +1,5 @@
package com.xhpc.invoice.service.impl;
import cn.hutool.extra.mail.MailUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.core.utils.DateUtils;
@ -23,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -129,20 +126,20 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//发送电子发票pdf到接收者邮箱
XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId());
String receiveEmail = xhpcInvoice.getReceiveEmail();
//从阿里云上下载下来电子发票
String fileUrl = requestData.getEletricInvoiceUrl();
File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf");
HttpUtil.downloadFile(fileUrl, electricInvoiceFile);
try {
MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile);
} catch (Exception e) {
System.out.println(e.getMessage());
return Boolean.FALSE;
} finally {
if (electricInvoiceFile.exists()) {
electricInvoiceFile.delete();
}
}
// //从阿里云上下载下来电子发票
// String fileUrl = requestData.getEletricInvoiceUrl();
// File electricInvoiceFile = new File(environment.getProperty("file.serverStoreDisposableFileLocation") + "ElectricInvoice.pdf");
// HttpUtil.downloadFile(fileUrl, electricInvoiceFile);
// try {
// MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile);
// } catch (Exception e) {
// System.out.println(e.getMessage());
// return Boolean.FALSE;
// } finally {
// if (electricInvoiceFile.exists()) {
// electricInvoiceFile.delete();
// }
// }
//更新发票数据,并设置用户未阅读状态
Long successFlag = xhpcInvoiceMapper.invoiceToUser(requestData);
if (successFlag == 0) {
@ -561,7 +558,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
writer.addHeaderAlias("titleContent", "抬头内容");
writer.addHeaderAlias("dutyNumber", "税号");
writer.addHeaderAlias("invoiceContent", "发票内容");
writer.addHeaderAlias("invoiceOrderElectricTotalMoney", "电量金额");
writer.addHeaderAlias("invoiceMoney", "发票总金额");
writer.addHeaderAlias("invoiceOrderServiceTotalMoney", "总服务费金额");
writer.addHeaderAlias("firmAddress", "地址");
writer.addHeaderAlias("firmPhone", "电话号码");

View File

@ -197,41 +197,41 @@
AND creator_type = #{creatorType}
</select>
<select id="selectExcelInvoiceById" resultType="com.xhpc.invoice.domain.ExcelInvoiceRow">
SELECT case i.invoice_type when 0 then '普票' when 1 then '专票' end as invoiceType,
i.receive_email as receiveEmail,
case i.title_type when 0 THEN '企业' ELSE '个人/非企业' END as titleType,
i.title_content as titleContent,
i.duty_number as dutyNumber,
i.invoice_content as invoiceContent,
i.invoice_money as invoiceOrderElectricTotalMoney,
i.invoice_order_service_total_money as invoiceOrderServiceTotalMoney,
i.firm_address as firmAddress,
i.firm_phone as firmPhone,
i.firm_bank as firmBank,
i.firm_bank_account as firmBankAccount,
case i.is_show_date when 0 then '开票者要求展示交易日期' ELSE '开票者不要求展示交易日期' END as isShowDate,
i.user_notes as userNotes,
SELECT case i.invoice_type when 0 then '普票' when 1 then '专票' end as invoiceType,
i.receive_email as receiveEmail,
case i.title_type when 0 THEN '企业' ELSE '个人/非企业' END as titleType,
i.title_content as titleContent,
i.duty_number as dutyNumber,
i.invoice_content as invoiceContent,
i.invoice_money as invoiceMoney,
i.invoice_order_service_total_money as invoiceOrderServiceTotalMoney,
i.firm_address as firmAddress,
i.firm_phone as firmPhone,
i.firm_bank as firmBank,
i.firm_bank_account as firmBankAccount,
case i.is_show_date when 0 then '开票者要求展示交易日期' ELSE '开票者不要求展示交易日期' END as isShowDate,
i.user_notes as userNotes,
case i.creator_type
when 0 then 'C端用户'
when 1 then '流量方'
when 2 then '社区用户'
when 3
then '企业用户' END as creatorType,
i.creator as creator,
i.create_time as iCreateTime,
case i.status when 0 then '未开票' when 1 then '已开票' when 2 then '开票失败' END as status,
i.invoicing_time as invoicingTime,
then '企业用户' END as creatorType,
i.creator as creator,
i.create_time as iCreateTime,
case i.status when 0 then '未开票' when 1 then '已开票' when 2 then '开票失败' END as status,
i.invoicing_time as invoicingTime,
i.drawer,
i.finance_notes as financeNotes,
i.electric_invoice_url as electricInvoiceUrl,
case i.is_read when 1 then '已阅读' when 0 then '未阅读' else '该发票还未处理' END as isRead,
h.hisotry_serial_number as historySerialNumber,
h.power_price_total as powerPriceTotal,
h.service_price_total as servicePriceTotal,
h.promotion_discount as promotionDiscount,
history_act_price as historyActPrice,
h.create_time as hCreateTime,
h.charging_mode as chargingMode
i.finance_notes as financeNotes,
i.electric_invoice_url as electricInvoiceUrl,
case i.is_read when 1 then '已阅读' when 0 then '未阅读' else '该发票还未处理' END as isRead,
h.history_serial_number as historySerialNumber,
h.power_price_total as powerPriceTotal,
h.service_price_total as servicePriceTotal,
h.promotion_discount as promotionDiscount,
history_act_price as historyActPrice,
h.create_time as hCreateTime,
h.charging_mode as chargingMode
FROM xhpc_invoice AS i
INNER JOIN xhpc_invoice_map_history_order AS h ON i.invoice_id = h.invoice_id
WHERE i.invoice_id = #{invoiceId}
@ -724,7 +724,8 @@
invoicing_time = #{invoicingTime},
electric_invoice_url = #{eletricInvoiceUrl},
`status` = #{status},
drawer = #{drawer} is_read = 0
drawer = #{drawer},
is_read = 0
WHERE invoice_id = #{invoiceId}
</update>
<update id="updateByInvoiceId">