| | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.ruoyi.account.api.dto.UploadPdfDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | return AjaxResult.success(orderInvoiceService.pageList(query)); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement/accept_hear_case"}, logical = Logical.OR) |
| | | @PostMapping("/uploadPdf") |
| | | @ApiOperation(value = "上传发票", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<String> uploadPdf(@RequestBody UploadPdfDTO dto){ |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(dto.getId()); |
| | | orderInvoice.setInvoiceUrl(dto.getInvoiceUrl()); |
| | | orderInvoice.setStatus(3); |
| | | orderInvoiceService.updateById(orderInvoice); |
| | | |
| | | public static void main(String[] args) { |
| | | // 发送邮箱 |
| | | // 收件人电子邮箱,TODO 换成自己的收件箱 |
| | | String to = orderInvoice.getMailbox(); |
| | | String to = "443237572@qq.com"; |
| | | // 发件人电子邮箱,TODO 换成自己的发件箱 |
| | | String from = "13281306557@163.com"; |
| | | // 指定发送邮件的主机为 |
| | | String host = "smtp.163.com"; |
| | | // 获取系统属性 |
| | | Properties properties = new Properties(); |
| | | // 设置邮件服务器 |
| | | properties.setProperty("mail.smtp.host", host); |
| | | // 邮件发送协议 |
| | | properties.setProperty("mail.transport.protocol", "smtp"); |
| | | //是否启用调试模式(启用调试模式可打印客户端与服务器交互过程时一问一答的响应消息) |
| | | properties.setProperty("mail.debug","true"); |
| | | properties.setProperty("mail.smtp.auth", "true"); |
| | | properties.put("mail.smtp.host", "smtp.163.com"); |
| | | properties.put("mail.smtp.socketFactory.port", "465"); |
| | | properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); |
| | | properties.put("mail.smtp.auth", "true"); |
| | | properties.put("mail.smtp.port", "465"); |
| | | properties.put("mail.smtp.ssl.enable", "true"); // 明确开启SSL |
| | | // 获取默认session对象 |
| | | Session session = Session.getDefaultInstance(properties,new Authenticator(){ |
| | | @Override |
| | |
| | | |
| | | // 组装附件 |
| | | MimeBodyPart filePart = new MimeBodyPart(); |
| | | String imageUrl = dto.getInvoiceUrl(); |
| | | String imageUrl = "https://mxcd.zhinenganguan.com/file/2025-02-14/_1@2x.png"; |
| | | try { |
| | | // 下载数据 |
| | | URL url = new URL(imageUrl); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement/accept_hear_case"}, logical = Logical.OR) |
| | | @PostMapping("/uploadPdf") |
| | | @ApiOperation(value = "上传发票", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<String> uploadPdf(@RequestBody UploadPdfDTO dto){ |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(dto.getId()); |
| | | orderInvoice.setInvoiceUrl(dto.getInvoiceUrl()); |
| | | orderInvoice.setStatus(3); |
| | | orderInvoiceService.updateById(orderInvoice); |
| | | dto.setMailBox(orderInvoice.getMailbox()); |
| | | appUserClient.uploadPdf(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |