| | |
| | | sysUsers = sysUserMapper.selectUserByUserName(user.getUserName()); |
| | | log.info("费用sysUsers返回的值为:{}", sysUsers); |
| | | } |
| | | if (checkFundVO.getFlowconclusion() == 1 && sysUsers != null && sysUsers.getRoles() != null && sysUsers.getRoles().stream().anyMatch(role -> "officedirector".equals(role.getRoleKey()))) { |
| | | serviceFund.setOfficedirector(user.getNickName()); |
| | | // 2026-10-09:推送条件由"当前审核人有 officedirector 角色"改为"本次审批后到达最后一级"。 |
| | | // 原写法在"最后一级审核人没有该角色"时永远不会推送,而"非最后一级的 officedirector"会提前推送。 |
| | | boolean uploadAtLastLevel = checkFundVO.getFlowconclusion() == 1 |
| | | && TotalLevel != null && TotalLevel != 0 && TotalLevel == OriginalFlowLevel + 1; |
| | | if (uploadAtLastLevel) { |
| | | // 仍只在该角色审批时记录办公室主任,保持字段语义不变 |
| | | if (sysUsers != null && sysUsers.getRoles() != null |
| | | && sysUsers.getRoles().stream().anyMatch(role -> "officedirector".equals(role.getRoleKey()))) { |
| | | serviceFund.setOfficedirector(user.getNickName()); |
| | | } |
| | | serviceFund.setUploadStates(1); |
| | | //数据发送 |
| | | Boolean aBoolean1 = null; |
| | |
| | | } |
| | | |
| | | private Boolean doSendData(ServiceFund serviceFund) { |
| | | // fund和funddetail的数据获取 |
| | | addFundSharedInfo(serviceFund.getId()); |
| | | // 2026-10-09:接住 addFundSharedInfo 的失败信号(附件上传失败时它会回滚分享表并返回 false) |
| | | Boolean sharedOk = addFundSharedInfo(serviceFund.getId()); |
| | | if (sharedOk == null || !sharedOk) { |
| | | log.error("费用报销单上传失败:分享表/附件环节失败,审批不生效,fundId={}", serviceFund.getId()); |
| | | return false; |
| | | } |
| | | List<ServiceFundShared> fundShareInfos = serviceFundSharedMapper.getFundShareInfoById(serviceFund.getId()); |
| | | if (CollectionUtils.isEmpty(fundShareInfos)) return false; |
| | | |
| | |
| | | try { |
| | | if (isUploadOaEnabled()) uploadOAFileAndUpdateDb(serviceFunddetailShareds.get(i)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("Exception中入参的ID为:{},异常信息为 : {}", id, e.getMessage()); |
| | | log.error("费用附件上传医院协友系统失败:单据id={}(本次报销单上传整体失败,审批不生效)", id, e); |
| | | if (id != null) { |
| | | Boolean aBoolean = sharedService.delfundsharedInfoById(null, id); |
| | | log.error("fund2分享表里的数据是否删除成功:{}", aBoolean); |
| | | log.error("已回滚分享表数据:{}", aBoolean); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | log.info("filePath的修改:{}", filePath); |
| | | String url = rbDetailFile.getUrl(); |
| | | //file用的是绝对位置 |
| | | String substring = url.substring(url.indexOf("/profile/upload") + "/profile/upload".length()); |
| | | // 2026-10-09:附件地址解析加固,避免 url 异常/文件缺失时抛 NPE 导致看不到失败原因 |
| | | int profileIdx = url == null ? -1 : url.indexOf("/profile/upload"); |
| | | if (profileIdx < 0) { |
| | | throw new ServiceException("附件地址格式不正确(缺少 /profile/upload),无法上传协友:" + url); |
| | | } |
| | | String substring = url.substring(profileIdx + "/profile/upload".length()); |
| | | // String strFile = rbDetailFile.getUrl().replace(filePath, "/profile/upload"); |
| | | System.out.println("fund服务的filePath + substring: " + filePath + substring); |
| | | File filetest = new File(filePath + substring); |
| | | if (!filetest.exists()) { |
| | | throw new ServiceException("附件文件在服务器上不存在,无法上传协友:" + filetest.getAbsolutePath()); |
| | | } |
| | | |
| | | String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl); |
| | | log.info("第三方传回的数据: {}", struploadResult); |