| | |
| | | List<TContract> list = contractService.lambdaQuery().in(TContract::getId, dto.getIds()).list(); |
| | | List<String> res = new ArrayList<>(); |
| | | for (TContract contract : list) { |
| | | String url = generateContract(contract); |
| | | String url = generateContract(contract,new TContractDTO()); |
| | | res.add(url); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | private String generateContract(TContract contract) { |
| | | private String generateContract(TContract contract,TContractDTO dto) { |
| | | String templateFileName = "1_yzj_租赁合同_个人.docx"; |
| | | String contractId = contract.getId(); |
| | | TBill firstBill = null; |
| | |
| | | fill(templateParam, "email", tenant.getEmail()); |
| | | |
| | | // 企业、政府机构、国有企业 |
| | | if (Objects.nonNull(tenant.getTenantType()) |
| | | && (tenant.getTenantType().equals("2") |
| | | || tenant.getTenantType().equals("5") |
| | | || tenant.getTenantType().equals("7"))) { |
| | | if (Objects.nonNull(tenant.getTenantAttributes()) |
| | | && (tenant.getTenantAttributes().equals("2") |
| | | || tenant.getTenantAttributes().equals("5") |
| | | || tenant.getTenantAttributes().equals("7"))) { |
| | | fill(templateParam, "creditCode", tenant.getCreditCode()); |
| | | fill(templateParam, "legalPerson", tenant.getLegalPerson()); |
| | | templateFileName = "1_yzj_租赁合同_企业.docx"; |
| | |
| | | : contract.getPayType().equals("2") ? "季" |
| | | : "年"; |
| | | fill(templateParam, "payType", payType); |
| | | BigDecimal extracted = extracted(contract); |
| | | // 首期租金处理 |
| | | if (firstBill != null) { |
| | | double firstRent = (contract.getPayType().equals("1") |
| | | ? contract.getMonthRent() |
| | | : contract.getPayType().equals("2") |
| | | ? contract.getMonthRent().multiply(new BigDecimal("3")) |
| | | : contract.getMonthRent().multiply(new BigDecimal("12"))) |
| | | .setScale(2, RoundingMode.DOWN).doubleValue(); |
| | | fill(templateParam, "firstRent", "¥" + extracted + "元"); |
| | | // 其他财务字段 |
| | | fill(templateParam, "firstRentString", "人民币" + NumberToChineseUtils.numberToChinese(extracted.doubleValue())); |
| | | } else { |
| | | // fill(templateParam, "firstRent", ""); |
| | | } |
| | | |
| | | fill(templateParam, "firstRent", |
| | | "¥"+(contract.getPayType().equals("1") |
| | | ? contract.getMonthRent() |
| | | :contract.getPayType().equals("2") |
| | | ?contract.getMonthRent().multiply(new BigDecimal("3")) |
| | | :contract.getMonthRent().multiply(new BigDecimal("12")) |
| | | .setScale(2, RoundingMode.DOWN)).doubleValue()+"元"); |
| | | BigDecimal extracted = extracted(contract,dto); |
| | | System.out.println("金额========================="+extracted); |
| | | fill(templateParam, "firstRent", "¥" + extracted + "元"); |
| | | // 其他财务字段 |
| | | fill(templateParam, "firstRentString", "人民币" + NumberToChineseUtils.numberToChinese(extracted.doubleValue())); |
| | | |
| | | |
| | | fill(templateParam, "firstRentString", |
| | | "人民币"+NumberToChineseUtils.numberToChinese( |
| | | (contract.getPayType().equals("1") |
| | | ? contract.getMonthRent() |
| | | :contract.getPayType().equals("2") |
| | | ?contract.getMonthRent().multiply(new BigDecimal("3")) |
| | | :contract.getMonthRent().multiply(new BigDecimal("12")) |
| | | .setScale(2, RoundingMode.DOWN)).doubleValue())); |
| | | // fill(templateParam, "firstRent", |
| | | // "¥"+(contract.getPayType().equals("1") |
| | | // ? contract.getMonthRent() |
| | | // :contract.getPayType().equals("2") |
| | | // ?contract.getMonthRent().multiply(new BigDecimal("3")) |
| | | // :contract.getMonthRent().multiply(new BigDecimal("12")) |
| | | // .setScale(2, RoundingMode.DOWN)).doubleValue()+"元"); |
| | | // |
| | | // |
| | | // fill(templateParam, "firstRentString", |
| | | // "人民币"+NumberToChineseUtils.numberToChinese( |
| | | // (contract.getPayType().equals("1") |
| | | // ? contract.getMonthRent() |
| | | // :contract.getPayType().equals("2") |
| | | // ?contract.getMonthRent().multiply(new BigDecimal("3")) |
| | | // :contract.getMonthRent().multiply(new BigDecimal("12")) |
| | | // .setScale(2, RoundingMode.DOWN)).doubleValue())); |
| | | |
| | | |
| | | |
| | |
| | | "/usr/local/project/file/"); |
| | | } |
| | | |
| | | private BigDecimal extracted(TContract contract) { |
| | | List<TContractRentType> contractRentTypes = contractRentTypeService.list(); |
| | | TContractRentType tContractRentType = contractRentTypes.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null); |
| | | private BigDecimal extracted(TContract contract,TContractDTO dto) { |
| | | TContractRentType tContractRentType = null; |
| | | if (contract.getIsIncreasing()){ |
| | | tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(contract.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | tContractRentType.setCycleTime(dto.getCycleTime()); |
| | | } |
| | | // 生成第一笔账单 |
| | | // 第一次应缴费日期 |
| | | |
| | |
| | | { |
| | | TContract contract = new TContract(); |
| | | BeanUtil.copyProperties(dto,contract); |
| | | return R.ok(generateContract(contract)); |
| | | return R.ok(generateContract(contract,dto)); |
| | | } |
| | | |
| | | /** |