sinake
2 天以前 e24ab2fc4d092b4599ef44ddce5ebdbbc0bd8f9a
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceReimbursementServiceImpl.java
@@ -293,12 +293,12 @@
                //如果是本地环境,就不调这个了
                if (isUploadOaEnabled()) uploadOAFileAndUpdateDb(serviceReimbursementdetailShareds.get(i));
            } catch (Exception e) {
                log.error("Exception中reimShare的入参id为:{}", serviceReimbursementShared.getId());
                log.error("差旅附件上传医院协友系统失败:分享id={},明细={}(本次报销单上传整体失败,审批不生效)",
                        serviceReimbursementShared.getId(), serviceReimbursementdetailShareds.get(i), e);
                if (serviceReimbursementShared.getId() != null) {
                    Boolean aBoolean = sharedService.delResharedInfoById(serviceReimbursementShared.getId());
                    log.error("文件上传失败,将分享表数据回滚:{}", aBoolean);
                    log.error("已回滚分享表数据:{}", aBoolean);
                }
                e.getMessage();
                return false;
            }
@@ -543,8 +543,16 @@
                log.info("差旅sysUsers返回的值为:{}", sysUser);
            }
            if (checkFundVO.getFlowconclusion() == 1 && Objects.nonNull(sysUser) && sysUser.getRoles() != null && sysUser.getRoles().stream().anyMatch(role -> "officedirector".equals(role.getRoleKey()))) {
                serviceReimbursement.setOfficedirector(user.getNickName());
            // 2026-10-09:推送条件由"当前审核人有 officedirector 角色"改为"本次审批后到达最后一级"。
            // 原写法在"最后一级审核人没有该角色"时永远不会推送,而"非最后一级的 officedirector"会提前推送。
            boolean uploadAtLastLevel = checkFundVO.getFlowconclusion() == 1
                    && totalLevel != null && totalLevel != 0 && totalLevel == OriginalFlowLevel + 1;
            if (uploadAtLastLevel) {
                // 仍只在该角色审批时记录办公室主任,保持字段语义不变
                if (Objects.nonNull(sysUser) && sysUser.getRoles() != null
                        && sysUser.getRoles().stream().anyMatch(role -> "officedirector".equals(role.getRoleKey()))) {
                    serviceReimbursement.setOfficedirector(user.getNickName());
                }
                serviceReimbursement.setUploadStates(1);
                Boolean aBoolean1 = null;
@@ -648,9 +656,17 @@
    private Boolean doSendData(ServiceReimbursement serviceReimbursement) {
        // fund和funddetail的数据获取
        addSharedData(serviceReimbursement.getId());
        // 2026-10-09:接住 addSharedData 的失败信号(附件上传失败时它会回滚分享表并返回 false)
        Boolean sharedOk = addSharedData(serviceReimbursement.getId());
        if (sharedOk == null || !sharedOk) {
            log.error("差旅报销单上传失败:分享表/附件环节失败,审批不生效,id={}", serviceReimbursement.getId());
            return false;
        }
        List<ServiceReimbursementShared> serviceReimbursementSharedList = sharedService.getRemShareInfoByRemId(serviceReimbursement.getId());
        if (org.springframework.util.CollectionUtils.isEmpty(serviceReimbursementSharedList)) return false;
        if (org.springframework.util.CollectionUtils.isEmpty(serviceReimbursementSharedList)) {
            log.error("差旅报销单上传失败:分享表为空(附件或组装环节异常),审批不生效,id={}", serviceReimbursement.getId());
            return false;
        }
        log.info("serviceReimbursementSharedList的数据量为:{}", serviceReimbursementSharedList.size());
        //detail详情
@@ -956,7 +972,7 @@
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("userName", "opo");
        map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5");
        map.put("loginName", "OPO系统审批");
        map.put("loginName", "OPO系统");
        JSONObject jsonObj = new JSONObject(map);
@@ -974,9 +990,17 @@
                log.info("filePath的修改:{}", filePath);
                String url = rbDetailFile.getUrl();
                //file用的是绝对位置
                String fileName = 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 fileName = url.substring(profileIdx + "/profile/upload".length());
                String strFile = rbDetailFile.getUrl().replace(filePath, "/profile/upload");
                File fileUpload = new File(filePath + fileName);
                if (!fileUpload.exists()) {
                    throw new ServiceException("附件文件在服务器上不存在,无法上传协友:" + fileUpload.getAbsolutePath());
                }
                log.info("请求第三方的入参strFile : {}, strFUrl : {}", strFile, filePath);
                String struploadResult = HttpClientKit.sendPostWithFile(fileUpload, strFUrl);
                log.info("第三方传回的数据: {}", struploadResult);