baolhyhzhg
2024-12-25 d75b2dcea46d51be058196f55632c8ed35a36dff
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractServiceImpl.java
@@ -1362,16 +1362,69 @@
                }
                if (ObjectUtil.isNotEmpty(row.get("开票总金额"))) {
                    // billingTotalAmount(计算)
                    invoice.setBeforeTaxAmount(new BigDecimal(row.get("开票总金额").toString()));
                    invoice.setAfterTaxAmount(new BigDecimal(row.get("开票总金额").toString()));
                }
                if (ObjectUtil.isNotEmpty(row.get("开票日期"))) {
                    // billingTime
                    invoice.setBillingTime(Timestamp.valueOf(row.get("开票日期").toString()));
                    if (checkRequiredColumn(row, "开票日期", rowNum, errorMap)) {
                        // billingTime
                        invoice.setBillingTime(Timestamp.valueOf(row.get("开票日期").toString()));
                    }
                    if (checkRequiredColumn(row, "税前开票金额", rowNum, errorMap)) {
                        // beforeTaxAmount
                        invoice.setBeforeTaxAmount(new BigDecimal(row.get("税前开票金额").toString()));
                        if (ObjectUtil.isNotEmpty(row.get("税率"))) {
                            // taxRate
                            invoice.setTaxRate(new BigDecimal(row.get("税率").toString()).multiply(new BigDecimal(100)).doubleValue());
                            invoice.setTaxAmount(new BigDecimal(row.get("税前开票金额").toString()).multiply(new BigDecimal(row.get("税率").toString())));
                        }
                    }
                    if (checkRequiredColumn(row, "发票类型", rowNum, errorMap) && checkTypeColumn(row, "发票类型", rowNum, errorMap)) {
                        // invoiceType
                        if (row.get("发票类型").toString().equals("增值税普通发票")) {
                            invoice.setInvoiceType(Constant.INVOICE_TYPE_ORDINARY);
                        } else if (row.get("发票类型").toString().equals("增值税专用发票")) {
                            invoice.setInvoiceType(Constant.INVOICE_TYPE_SPECIAL);
                        }
                    }
                    if (ObjectUtil.isNotEmpty(row.get("开票备注"))) {
                        // remarks
                        invoice.setRemarks(row.get("开票备注").toString());
                    }
                }
                if (ObjectUtil.isNotEmpty(row.get("付款总金额"))) {
                    // paymentTotalAmount(计算)
                    payment.setPaymentAmount(new BigDecimal(row.get("付款总金额").toString()));
                    if (checkRequiredColumn(row, "付款时间", rowNum, errorMap)) {
                        // paymentTime(合同付款信息)
                        payment.setPaymentTime(Timestamp.valueOf(row.get("付款时间").toString()));
                    }
                    if (checkRequiredColumn(row, "付款类型", rowNum, errorMap) && checkTypeColumn(row, "付款类型", rowNum, errorMap)) {
                        // fundType
                        if (row.get("付款类型").toString().equals("服务费")) {
                            payment.setFundType(Constant.FUND_SERVICE);
                            if (checkRequiredColumn(row, "服务费开始时间", rowNum, errorMap)) {
                                // fundBelongStart
                                payment.setFundBelongStart(Timestamp.valueOf(row.get("服务费开始时间").toString()));
                            }
                            if (checkRequiredColumn(row, "服务费结束时间", rowNum, errorMap)) {
                                // fundBelongEnd
                                payment.setFundBelongEnd(Timestamp.valueOf(row.get("服务费结束时间").toString()));
                            }
                        } else if (row.get("付款类型").toString().equals("合同费")) {
                            payment.setFundType(Constant.FUND_CONTRACT);
                            if (ObjectUtil.isNotEmpty(row.get("合同费所属"))) {
                                // fundBelong
                                payment.setFundBelong(row.get("合同费所属").toString());
                            }
                        }
                        if (ObjectUtil.isNotEmpty(row.get("付款备注"))) {
                            // remarks
                            payment.setRemarks(row.get("付款备注").toString());
                        }
                    }
                }
//                if (checkRequiredColumn(row, "预收款金额", rowNum, errorMap)) {
//                    // advancePayment(计算)
@@ -1395,10 +1448,6 @@
                            contract.setContractPaymentState(Constant.PAYMENT_ALREADY);
                        }
                    }
                }
                if (ObjectUtil.isNotEmpty(row.get("付款时间"))) {
                    // paymentTime(合同付款信息)
                    payment.setPaymentTime(Timestamp.valueOf(row.get("付款时间").toString()));
                }
//                if (checkRequiredColumn(row, "合同费延期情况", rowNum, errorMap)) {
//                    // contractPostponement
@@ -1465,7 +1514,7 @@
                    }
                    Map<String, Object> supplyMapData = new HashMap<>();
                    if (ObjectUtil.isNotEmpty(invoice.getBeforeTaxAmount())) {
                    if (ObjectUtil.isNotEmpty(invoice.getAfterTaxAmount())) {
                        supplyMapData.put("invoice", invoice);
                    }
                    if (ObjectUtil.isNotEmpty(payment.getPaymentAmount())) {
@@ -1576,6 +1625,26 @@
                errorMap.put(newKey, errorRows);
                return false;
            }
        } else if (key.equals("发票类型")) {
            if (data.get(key).toString().equals("增值税普通发票") || data.get(key).toString().equals("增值税专用发票")) {
                return true;
            } else {
                String newKey = key.concat("输入错误");
                List<Integer> errorRows = errorMap.containsKey(newKey) ? errorMap.get(newKey) : new ArrayList<>();
                errorRows.add(rowNum);
                errorMap.put(newKey, errorRows);
                return false;
            }
        } else if (key.equals("付款类型")) {
            if (data.get(key).toString().equals("服务费") || data.get(key).toString().equals("合同费")) {
                return true;
            } else {
                String newKey = key.concat("输入错误");
                List<Integer> errorRows = errorMap.containsKey(newKey) ? errorMap.get(newKey) : new ArrayList<>();
                errorRows.add(rowNum);
                errorMap.put(newKey, errorRows);
                return false;
            }
        } else {
            String newKey = "校验类型不存在";
            List<Integer> errorRows = errorMap.containsKey(newKey) ? errorMap.get(newKey) : new ArrayList<>();