| | |
| | | ContractInvoicePaymentQueryCriteria invoicePaymentQueryCriteria = new ContractInvoicePaymentQueryCriteria(); |
| | | invoicePaymentQueryCriteria.setPaymentId(payment.getPaymentId()); |
| | | List<ContractInvoicePayment> invoicePaymentList = contractInvoicePaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,invoicePaymentQueryCriteria,criteriaBuilder)); |
| | | for (ContractInvoicePayment invoicePayment : invoicePaymentList) { |
| | | ContractInvoice invoice = contractInvoiceRepository.getById(invoicePayment.getInvoiceId()); |
| | | invoiceList.add(invoice); |
| | | if (invoicePaymentList.size() > 0) { |
| | | for (ContractInvoicePayment invoicePayment : invoicePaymentList) { |
| | | ContractInvoice invoice = contractInvoiceRepository.getById(invoicePayment.getInvoiceId()); |
| | | invoiceList.add(invoice); |
| | | } |
| | | } else { |
| | | invoiceList.add(new ContractInvoice()); |
| | | } |
| | | } else { |
| | | invoiceList.add(new ContractInvoice()); |
| | |
| | | } |
| | | |
| | | // 判断合同类型 |
| | | if (Constant.CONTRACT_DEVELOP_SERVICE.equals(resources.getContractSecondType())) { |
| | | if (Constant.CONTRACT_TECHNOLOGY.equals(resources.getContractType()) && Constant.CONTRACT_DEVELOP_SERVICE.equals(resources.getContractSecondType())) { |
| | | // 不处理 |
| | | } else if (Constant.CONTRACT_SERVICE.equals(resources.getContractSecondType())) { |
| | | } else if (Constant.CONTRACT_TECHNOLOGY.equals(resources.getContractType()) && Constant.CONTRACT_SERVICE.equals(resources.getContractSecondType())) { |
| | | // 合同费金额 |
| | | resources.setContractAmount(null); |
| | | // 预计付款日期 |
| | |
| | | BigDecimal contractAmount = contractPaymentRepository.findByContractIdAndFundType(contract.getContractId(), Constant.FUND_CONTRACT); |
| | | contractAmount = contractAmount == null ? new BigDecimal(0) : contractAmount; |
| | | // 判断合同款项付款金额 |
| | | if(Constant.CONTRACT_SERVICE.equals(contract.getContractSecondType())) { |
| | | if(Constant.CONTRACT_TECHNOLOGY.equals(contract.getContractType()) && Constant.CONTRACT_SERVICE.equals(contract.getContractSecondType())) { |
| | | // 付款状态 |
| | | contract.setContractPaymentState(null); |
| | | } else if(contractAmount.compareTo(new BigDecimal(0)) == 0) { |
| | |
| | | BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundType(contract.getContractId(), Constant.FUND_SERVICE); |
| | | serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount; |
| | | // 判断服务款项付款金额 |
| | | if(Constant.CONTRACT_DEVELOP.equals(contract.getContractSecondType())) { |
| | | if(Constant.CONTRACT_TECHNOLOGY.equals(contract.getContractType()) && Constant.CONTRACT_DEVELOP.equals(contract.getContractSecondType())) { |
| | | // 付款状态 |
| | | contract.setServicePaymentState(null); |
| | | } else if(serviceAmount.compareTo(new BigDecimal(0)) == 0) { |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal contractTotalMoney(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询合同款总金额 |
| | | BigDecimal contractTotalMoney = contractRepository.contractTotalMoney( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode(), criteria.getCompanys() |
| | | ); |
| | | return contractTotalMoney; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Integer contractDelayTotalAmount(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 合同款延期数 |
| | | Integer contractDelayTotalAmount = 0; |
| | | // 搜索数据处理 |
| | |
| | | // 查询有合同款的合同数据 |
| | | List<Contract> contractList = contractRepository.findContractAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode(), criteria.getCompanys() |
| | | ); |
| | | // 循环有合同款的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal contractDelayTotalMoney(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 合同款延期金额 |
| | | BigDecimal contractDelayTotalMoney = new BigDecimal("0.00"); |
| | | // 搜索数据处理 |
| | |
| | | // 查询有合同款的合同数据 |
| | | List<Contract> contractList = contractRepository.findContractAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode(), criteria.getCompanys() |
| | | ); |
| | | // 循环有合同款的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal advancePaymentTotalMoney(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 预收款总金额 |
| | | BigDecimal advancePaymentTotalMoney = new BigDecimal("0.00"); |
| | | // 查询所有合同信息 |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal serviceTotalMoney(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 搜索数据处理 |
| | | String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null; |
| | | String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null; |
| | | // 查询运维服务总金额 |
| | | BigDecimal serviceTotalMoney = contractRepository.serviceTotalMoney( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode(), criteria.getCompanys() |
| | | ); |
| | | return serviceTotalMoney; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Integer serviceDelayTotalAmount(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 运维服务延期数 |
| | | Integer serviceDelayTotalAmount = 0; |
| | | // 搜索数据处理 |
| | |
| | | // 查询有运维服务的合同数据 |
| | | List<Contract> contractList = contractRepository.findServiceAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode(), criteria.getCompanys() |
| | | ); |
| | | // 循环有运维服务的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal serviceDelayTotalMoney(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 运维服务延期金额 |
| | | BigDecimal serviceDelayTotalMoney = new BigDecimal("0.00"); |
| | | // 搜索数据处理 |
| | |
| | | // 查询有运维服务的合同数据 |
| | | List<Contract> contractList = contractRepository.findServiceAmountNotNull( |
| | | criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(), |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode() |
| | | criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode(), criteria.getCompanys() |
| | | ); |
| | | // 循环有运维服务的合同数据 |
| | | for(int i = 0; i < contractList.size(); i ++) { |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal receivePaymentTotalMoney(ContractQueryCriteria criteria){ |
| | | criteria.setCompanys(SecurityUtils.getCompanyIds()); |
| | | // 应收款总金额 |
| | | BigDecimal receivePaymentTotalMoney = new BigDecimal("0.00"); |
| | | // 查询所有合同信息 |
| | |
| | | throw new BadRequestException("上传失败"); |
| | | } |
| | | |
| | | ExcelReader reader = ExcelUtil.getReader(FileUtil.toFile(file)); |
| | | File uploadFile = FileUtil.toFile(file); |
| | | ExcelReader reader = ExcelUtil.getReader(uploadFile); |
| | | List<Map<String,Object>> readAll = reader.readAll(); |
| | | if (ObjectUtil.isNull(readAll)) { |
| | | throw new BadRequestException("Excel解析失败"); |
| | |
| | | // if (checkRequiredColumn(row, "应收款金额", rowNum, errorMap)) { |
| | | // // receivePayment(计算) |
| | | // } |
| | | if (ObjectUtil.isNotEmpty(row.get("合同类型(二级)")) && !row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_SERVICE)) { |
| | | if (checkRequiredColumn(row, "合同费金额", rowNum, errorMap)) { |
| | | contract.setContractAmount(new BigDecimal(row.get("合同费金额").toString())); |
| | | if (ObjectUtil.isNotEmpty(row.get("合同类型")) && ObjectUtil.isNotEmpty(row.get("合同类型(二级)"))) { |
| | | // 合同费 |
| | | if (!(row.get("合同类型").toString().equals(Constant.CONTRACT_TECHNOLOGY) && row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_SERVICE))) { |
| | | if (checkRequiredColumn(row, "合同费金额", rowNum, errorMap)) { |
| | | contract.setContractAmount(new BigDecimal(row.get("合同费金额").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "合同费预计付款日期", rowNum, errorMap)) { |
| | | contract.setContractPaymentDate(Timestamp.valueOf(row.get("合同费预计付款日期").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "合同费付款状态", rowNum, errorMap) && checkTypeColumn(row, "合同费付款状态", rowNum, errorMap)) { |
| | | if (row.get("合同费付款状态").toString().equals("未付款")) { |
| | | contract.setContractPaymentState(Constant.PAYMENT_NOT); |
| | | } else if (row.get("合同费付款状态").toString().equals("部分付款")) { |
| | | contract.setContractPaymentState(Constant.PAYMENT_PART); |
| | | } else if (row.get("合同费付款状态").toString().equals("已付款")) { |
| | | contract.setContractPaymentState(Constant.PAYMENT_ALREADY); |
| | | } |
| | | } |
| | | } |
| | | if (checkRequiredColumn(row, "合同费预计付款日期", rowNum, errorMap)) { |
| | | contract.setContractPaymentDate(Timestamp.valueOf(row.get("合同费预计付款日期").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "合同费付款状态", rowNum, errorMap) && checkTypeColumn(row, "合同费付款状态", rowNum, errorMap)) { |
| | | if (row.get("合同费付款状态").toString().equals("未付款")) { |
| | | contract.setContractPaymentState(Constant.PAYMENT_NOT); |
| | | } else if (row.get("合同费付款状态").toString().equals("部分付款")) { |
| | | contract.setContractPaymentState(Constant.PAYMENT_PART); |
| | | } else if (row.get("合同费付款状态").toString().equals("已付款")) { |
| | | contract.setContractPaymentState(Constant.PAYMENT_ALREADY); |
| | | // 服务费 |
| | | if (row.get("合同类型").toString().equals(Constant.CONTRACT_TECHNOLOGY) && (row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_SERVICE) || row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_DEVELOP_SERVICE))) { |
| | | if (row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_DEVELOP_SERVICE) && checkRequiredColumn(row, "服务开始日期", rowNum, errorMap)) { |
| | | contract.setServiceStartsDate(Timestamp.valueOf(row.get("服务开始日期").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "服务费金额", rowNum, errorMap)) { |
| | | contract.setServiceAmount(new BigDecimal(row.get("服务费金额").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "服务费预计付款日期", rowNum, errorMap)) { |
| | | contract.setServicePaymentDate(Timestamp.valueOf(row.get("服务费预计付款日期").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "服务费付款状态", rowNum, errorMap) && checkTypeColumn(row, "服务费付款状态", rowNum, errorMap)) { |
| | | if (row.get("服务费付款状态").toString().equals("未付款")) { |
| | | contract.setServicePaymentState(Constant.PAYMENT_NOT); |
| | | } else if (row.get("服务费付款状态").toString().equals("部分付款")) { |
| | | contract.setServicePaymentState(Constant.PAYMENT_PART); |
| | | } else if (row.get("服务费付款状态").toString().equals("已付款")) { |
| | | contract.setServicePaymentState(Constant.PAYMENT_ALREADY); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // if (checkRequiredColumn(row, "合同费延期情况", rowNum, errorMap)) { |
| | | // // contractPostponement |
| | | // } |
| | | if (ObjectUtil.isNotEmpty(row.get("合同类型(二级)")) && (row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_SERVICE) || row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_DEVELOP_SERVICE))) { |
| | | if (row.get("合同类型(二级)").toString().equals(Constant.CONTRACT_DEVELOP_SERVICE) && checkRequiredColumn(row, "服务开始日期", rowNum, errorMap)) { |
| | | contract.setServiceStartsDate(Timestamp.valueOf(row.get("服务开始日期").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "服务费金额", rowNum, errorMap)) { |
| | | contract.setServiceAmount(new BigDecimal(row.get("服务费金额").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "服务费预计付款日期", rowNum, errorMap)) { |
| | | contract.setServicePaymentDate(Timestamp.valueOf(row.get("服务费预计付款日期").toString())); |
| | | } |
| | | if (checkRequiredColumn(row, "服务费付款状态", rowNum, errorMap) && checkTypeColumn(row, "服务费付款状态", rowNum, errorMap)) { |
| | | if (row.get("服务费付款状态").toString().equals("未付款")) { |
| | | contract.setServicePaymentState(Constant.PAYMENT_NOT); |
| | | } else if (row.get("服务费付款状态").toString().equals("部分付款")) { |
| | | contract.setServicePaymentState(Constant.PAYMENT_PART); |
| | | } else if (row.get("服务费付款状态").toString().equals("已付款")) { |
| | | contract.setServicePaymentState(Constant.PAYMENT_ALREADY); |
| | | } |
| | | } |
| | | } |
| | | // if (checkRequiredColumn(row, "服务费延期情况", rowNum, errorMap)) { |
| | | // // servicePostponement |
| | | // } |
| | |
| | | } catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new BadRequestException("数据保存失败"); |
| | | } finally { |
| | | reader.close(); |
| | | if (uploadFile.exists()) { |
| | | uploadFile.deleteOnExit(); |
| | | } |
| | | } |
| | | |
| | | return finalMap; |