|
@@ -190,12 +190,13 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
price = ObjectUtils.isNotEmpty(product.getCnyDisplayPrice())? product.getCnyDisplayPrice().toString() : product.getCnyPrice().toString();
|
|
|
renewPrice = product.getCnyPrice();
|
|
|
}
|
|
|
- contentMap.put("@payPrice@", price);
|
|
|
- contentMap.put("@renewPrice@", renewPrice.toString());
|
|
|
+ contentMap.put("@payPrice@", orderManualDTO.getCurrency().equals("USD")?"$"+price:"¥"+price);
|
|
|
+ contentMap.put("@renewPrice@", orderManualDTO.getCurrency().equals("USD")?"$"+renewPrice.toString():"¥"+renewPrice.toString());
|
|
|
+
|
|
|
bo.setSendTitleContent(titleMap);
|
|
|
//设置内容
|
|
|
bo.setSendContent(contentMap);
|
|
|
- String file = sendInvoice(userVO.getEmail(),formattedDate,orderManualDTO.getTradeNo(),orderManualDTO.getInvoiceNo(),renewPrice,orderManualDTO.getPrice());
|
|
|
+ String file = sendInvoice(userVO.getEmail(),formattedDate,orderManualDTO.getTradeNo(),orderManualDTO.getInvoiceNo(),renewPrice,orderManualDTO.getPrice(),orderManualDTO.getCurrency());
|
|
|
bo.setFileUrl(file);
|
|
|
bo.setFileName("invoice.pdf");
|
|
|
emailApi.sendEmail(bo);
|
|
@@ -224,11 +225,11 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
price = ObjectUtils.isNotEmpty(product.getCnyDisplayPrice())? product.getCnyDisplayPrice().toString() : product.getCnyPrice().toString();
|
|
|
renewPrice = product.getCnyPrice();
|
|
|
}
|
|
|
- contentMap.put("@payPrice@", price);
|
|
|
+ contentMap.put("@payPrice@", orderManualDTO.getCurrency().equals("USD")?"$"+price:"¥"+price);
|
|
|
bo.setSendTitleContent(titleMap);
|
|
|
//设置内容
|
|
|
bo.setSendContent(contentMap);
|
|
|
- String file = sendInvoice(userVO.getEmail(),formattedDate,orderManualDTO.getTradeNo(),orderManualDTO.getInvoiceNo(),renewPrice,orderManualDTO.getPrice());
|
|
|
+ String file = sendInvoice(userVO.getEmail(),formattedDate,orderManualDTO.getTradeNo(),orderManualDTO.getInvoiceNo(),renewPrice,orderManualDTO.getPrice(),orderManualDTO.getCurrency());
|
|
|
bo.setFileUrl(file);
|
|
|
bo.setFileName("invoice.pdf");
|
|
|
emailApi.sendEmail(bo);
|
|
@@ -236,7 +237,7 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
}
|
|
|
|
|
|
//生成发票
|
|
|
- private String sendInvoice(String email, String purchasedDate,String tradeNo,String invoiceNumber,BigDecimal unitPrice,BigDecimal amount) {
|
|
|
+ private String sendInvoice(String email, String purchasedDate,String tradeNo,String invoiceNumber,BigDecimal unitPrice,BigDecimal amount,String currency) {
|
|
|
String invoiceHtml = null;
|
|
|
try {
|
|
|
invoiceHtml = new String(StreamUtils.copyToByteArray(this.getClass().getClassLoader().getResourceAsStream("templates/invoice_member.html")), StandardCharsets.UTF_8);
|
|
@@ -259,6 +260,9 @@ public class GooglePayServiceImpl implements GooglePayService {
|
|
|
log.info("发票html内容填充map:{}", map);
|
|
|
// 生成替换内容后的发票
|
|
|
String htmlStr = TemplatesUtil.replaceStringUsingFreeMarker(invoiceHtml, map);
|
|
|
+ if (!currency.equals("USD")) {
|
|
|
+ htmlStr = htmlStr.replace("USD", "CNY");
|
|
|
+ }
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
// 封装表单数据
|