sinake
4 天以前 ee089a8ac4a9d99ef0a0491bbf1d80a2d4fbc393
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
@@ -559,27 +559,25 @@
                    FlowLevel = 0;
                }
            }
            SysUser sysUser = sysUserService.selectUserByUserName(serviceFund.getUserno());
            //审批未通过:单据信息 + 审批人/审批时间/意见(意见 = "审批未通过。" + 驳回意见)
            List<ConcurrentHashMap<String, Object>> contentList = FundNotifyMessageBuilder.newRows();
            FundNotifyMessageBuilder.addBillInfo(contentList, serviceFund.getApplytype(),
                    serviceFund.getUsername(), serviceFund.getPretaxcost(), serviceFund.getDonorname(),
                    FundNotifyMessageBuilder.billNo(serviceFund.getBh(), serviceFund.getId()));
            FundNotifyMessageBuilder.addAuditResult(contentList, loginUser.getUser().getNickName(), new Date(),
                    FundNotifyMessageBuilder.opinion(FundNotifyMessageBuilder.CONCLUSION_REJECT,
                            checkFundVO.getFlowcontent()));
            try {
                DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
                dingTalkReqVo.setTitle(FundNotifyMessageBuilder.TITLE);
                dingTalkReqVo.setNumber(sysUser.getPhonenumber());
                dingTalkReqVo.setContents(contentList);
                dingTalkService.sendNotification(dingTalkReqVo);
            } catch (Exception e) {
                log.error("费用---审批未通过钉钉通知失败,fundId={}", serviceFund.getId(), e);
            }
        }
        SysUser sysUser = sysUserService.selectUserByUserName(serviceFund.getUserno());
        //审批未通过:单据信息 + 审批人/审批时间/意见(意见 = "审批未通过。" + 驳回意见)
        List<ConcurrentHashMap<String, Object>> contentList = FundNotifyMessageBuilder.newRows();
        FundNotifyMessageBuilder.addBillInfo(contentList, serviceFund.getApplytype(),
                serviceFund.getUsername(), serviceFund.getPretaxcost(), serviceFund.getDonorname(),
                FundNotifyMessageBuilder.billNo(serviceFund.getBh(), serviceFund.getId()));
        FundNotifyMessageBuilder.addAuditResult(contentList, loginUser.getUser().getNickName(), new Date(),
                FundNotifyMessageBuilder.opinion(checkFundVO.getFlowconclusion()+"",
                        checkFundVO.getFlowcontent()));
        try {
            DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
            dingTalkReqVo.setTitle(FundNotifyMessageBuilder.TITLE);
            dingTalkReqVo.setNumber(sysUser.getPhonenumber());
            dingTalkReqVo.setContents(contentList);
            dingTalkService.sendNotification(dingTalkReqVo);
        } catch (Exception e) {
            log.error("费用---审批未通过钉钉通知失败,fundId={}", serviceFund.getId(), e);
        }
        serviceFund.setRecordstatus(RecordStatus);
        serviceFund.setFlowlevel(FlowLevel.longValue());
        //  serviceFund.setBackflowlevel(serviceFund.getFlowlevel());
@@ -1585,6 +1583,28 @@
            // 保存详情数据
            for (ServiceFunddetailVO serviceFunddetailVO : serviceFunddetails) {
                // 2026-10-15:附件文件名规范二次校验(与前端 fileNameCheck 同口径;只校验本次变更的附件,历史附件放行)
                java.util.Set<String> existingNames = new java.util.HashSet<>();
                if (serviceFunddetailVO.getId() != null) {
                    ServiceFunddetail oldDetail = serviceFunddetailMapper.selectById(serviceFunddetailVO.getId());
                    if (oldDetail != null) {
                        existingNames.addAll(com.ruoyi.project.common.AttachmentNameValidator
                                .collectNames(oldDetail.getInvoicefiles()));
                        existingNames.addAll(com.ruoyi.project.common.AttachmentNameValidator
                                .collectNames(oldDetail.getAnnexfiles()));
                    }
                }
                String invoiceJson = CollectionUtils.isEmpty(serviceFunddetailVO.getInvoicefilesList())
                        ? serviceFunddetailVO.getInvoicefiles()
                        : JSON.toJSONString(serviceFunddetailVO.getInvoicefilesList());
                String annexJson = CollectionUtils.isEmpty(serviceFunddetailVO.getAnnexfilesList())
                        ? serviceFunddetailVO.getAnnexfiles()
                        : JSON.toJSONString(serviceFunddetailVO.getAnnexfilesList());
                String nameError = com.ruoyi.project.common.AttachmentNameValidator
                        .checkJsonListForUpdate(existingNames, invoiceJson, annexJson);
                if (nameError != null) {
                    throw new BaseException("附件文件名不符合要求,无法保存:" + nameError);
                }
                //去掉身份证的首尾空格
                if (StringUtils.isNotEmpty(serviceFunddetailVO.getIdcardno())) {
                    serviceFunddetailVO.setIdcardno(serviceFunddetailVO.getIdcardno().trim());
@@ -1685,10 +1705,23 @@
            //通过受益人名称,将税前、税后的值相加
            Map<String, Double> sumAmount = serviceFunddetails.stream().collect(Collectors.groupingBy(ServiceFunddetail::getBeneficiaryname, Collectors.summingDouble(ServiceFunddetail::getAmount)));
            Map<String, Double> sumTaxdAmount = serviceFunddetails.stream().collect(Collectors.groupingBy(ServiceFunddetail::getBeneficiaryname, Collectors.summingDouble(ServiceFunddetail::getTaxedamount)));
            // 新增口径:增值税、城建税、劳务税前、劳务个税按受益人合计
            Map<String, Double> sumVat = serviceFunddetails.stream().collect(Collectors.groupingBy(ServiceFunddetail::getBeneficiaryname,
                    Collectors.summingDouble(d -> d.getVatAmount() == null ? 0.0 : d.getVatAmount())));
            Map<String, Double> sumCityTax = serviceFunddetails.stream().collect(Collectors.groupingBy(ServiceFunddetail::getBeneficiaryname,
                    Collectors.summingDouble(d -> d.getCityTaxAmount() == null ? 0.0 : d.getCityTaxAmount())));
            Map<String, Double> sumLaborPretax = serviceFunddetails.stream().collect(Collectors.groupingBy(ServiceFunddetail::getBeneficiaryname,
                    Collectors.summingDouble(d -> d.getLaborPretaxAmount() == null ? 0.0 : d.getLaborPretaxAmount())));
            Map<String, Double> sumTax = serviceFunddetails.stream().collect(Collectors.groupingBy(ServiceFunddetail::getBeneficiaryname,
                    Collectors.summingDouble(d -> d.getTaxamount() == null ? 0.0 : d.getTaxamount())));
            for (String key : sumAmount.keySet()) {
                ServiceFunddetailExcel serviceFunddetailExcel = new ServiceFunddetailExcel();
                serviceFunddetailExcel.setAmount(sumAmount.getOrDefault(key, 0.0));
                serviceFunddetailExcel.setVatAmount(sumVat.getOrDefault(key, 0.0));
                serviceFunddetailExcel.setCityTaxAmount(sumCityTax.getOrDefault(key, 0.0));
                serviceFunddetailExcel.setLaborPretaxAmount(sumLaborPretax.getOrDefault(key, 0.0));
                serviceFunddetailExcel.setTaxamount(sumTax.getOrDefault(key, 0.0));
                serviceFunddetailExcel.setTaxedamount(sumTaxdAmount.getOrDefault(key, 0.0));
                for (ServiceFunddetail serviceFunddetail2 : serviceFunddetails) {
                    if (serviceFunddetail2.getBeneficiaryname().equals(key)) {