| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.common.FundNotifyMessageBuilder; |
| | | import com.ruoyi.project.domain.dto.ServiceReimbursementDto; |
| | | import com.ruoyi.project.domain.vo.CheckFundVO; |
| | | import com.ruoyi.project.domain.vo.DingTalkReqVo; |
| | |
| | | Collections.sort(list, new Comparator<SpFinancialExpensesReimbursementOut>() { |
| | | @Override |
| | | public int compare(SpFinancialExpensesReimbursementOut o1, SpFinancialExpensesReimbursementOut o2) { |
| | | return o1.getApplyTime().compareTo(o2.getApplyTime()); |
| | | return o2.getApplyTime().compareTo(o1.getApplyTime()); |
| | | } |
| | | }); |
| | | return getCustomDataTable(list, pageNum, pageSize); |
| | |
| | | //陈慕华信息 |
| | | sysUser = sysUserService.selectUserByUserName("047"); |
| | | } |
| | | ConcurrentHashMap map = new ConcurrentHashMap(); |
| | | ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>(); |
| | | map.put("提交人:", loginUser.getUser().getUserName()); |
| | | map.put("提交时间:", new Date()); |
| | | map.put("内容:", serviceReimbursement.getReason()); |
| | | contentList.add(map); |
| | | DingTalkReqVo dingTalkReqVo = new DingTalkReqVo(); |
| | | dingTalkReqVo.setTitle("差旅审批信息"); |
| | | dingTalkReqVo.setNumber(sysUser != null ? sysUser.getPhonenumber() : ""); |
| | | dingTalkReqVo.setContents(contentList); |
| | | dingTalkService.sendNotification(dingTalkReqVo); |
| | | //差旅费上报提交:单据信息 + 提交人/提交时间/内容 |
| | | //钉钉属于旁路通知,任何失败都不得影响"上报"主流程(否则前端会提示失败但数据已更新) |
| | | try { |
| | | List<ConcurrentHashMap<String, Object>> contentList = FundNotifyMessageBuilder.newRows(); |
| | | FundNotifyMessageBuilder.addBillInfo(contentList, "0", serviceReimbursement.getUsername(), |
| | | serviceReimbursement.getAmountrequested(), null, |
| | | FundNotifyMessageBuilder.billNo(serviceReimbursement.getBh(), |
| | | serviceReimbursement.getId())); |
| | | FundNotifyMessageBuilder.addTravelInfo(contentList, serviceReimbursement.getTravelers(), |
| | | serviceReimbursement.getReason()); |
| | | FundNotifyMessageBuilder.addSubmitInfo(contentList, loginUser.getUser().getNickName(), |
| | | new Date(), serviceReimbursement.getReason()); |
| | | DingTalkReqVo dingTalkReqVo = new DingTalkReqVo(); |
| | | dingTalkReqVo.setTitle(FundNotifyMessageBuilder.TITLE); |
| | | dingTalkReqVo.setNumber(sysUser != null ? sysUser.getPhonenumber() : ""); |
| | | dingTalkReqVo.setContents(contentList); |
| | | dingTalkService.sendNotification(dingTalkReqVo); |
| | | } catch (Throwable t) { |
| | | log.error("差旅上报钉钉通知失败,已忽略(不影响上报主流程),id={}", |
| | | serviceReimbursement.getId(), t); |
| | | } |
| | | } |
| | | |
| | | serviceReimbursementService.updateById(serviceReimbursement); |
| | |
| | | System.out.println("目录已存在"); |
| | | } |
| | | |
| | | Writer out = null; |
| | | |
| | | try { |
| | | out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8")); |
| | | |
| | | } catch (FileNotFoundException e1) { |
| | | e1.printStackTrace(); |
| | | if (t == null) { |
| | | throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT); |
| | | } |
| | | try { |
| | | |
| | | // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整 |
| | | try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) { |
| | | t.process(dataMap, out); |
| | | } catch (TemplateException e) { |
| | | e.printStackTrace(); |
| | | } catch (TemplateException | IOException e) { |
| | | log.error("生成模板文档失败, name={}", name, e); |
| | | throw new ServiceException("生成文档失败", HttpStatus.ERROR); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc"); |