无关风月
2025-02-20 04d2f146d27f9e4dbfb52d71b3092db764629167
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
@@ -14,10 +14,7 @@
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.WebUtils;
import com.ruoyi.system.dto.SetContractDto;
import com.ruoyi.system.dto.TContractDTO;
import com.ruoyi.system.dto.THouseDTO;
import com.ruoyi.system.dto.TerminateContractDTO;
import com.ruoyi.system.dto.*;
import com.ruoyi.system.export.ContractExport;
import com.ruoyi.system.export.OpticalInspectionExport;
import com.ruoyi.system.model.*;
@@ -74,6 +71,7 @@
    private TBillService billService;
    @Autowired
    private TCheckAcceptRecordService checkAcceptRecordService;
    @ApiOperation(value = "测试生成账单")
    @PostMapping(value = "/testBill")
    public R testBill(String id) {
@@ -88,7 +86,7 @@
            TBill rentBill = new TBill();
            rentBill.setContractId(contract.getId());
            rentBill.setContractNumber(contract.getContractNumber());
            rentBill.setPayableFeesTime(firstPayTime);
            rentBill.setPayableFeesTime(firstPayTime.toLocalDate());
            rentBill.setPayFeesStatus("1");
            rentBill.setBillType("1");
            rentBill.setStartTime(contract.getStartPayTime());
@@ -168,7 +166,7 @@
            depositBill.setPayableFeesMoney(contract.getDeposit());
            depositBill.setOutstandingMoney(depositBill.getPayableFeesMoney());
            depositBill.setPayableFeesTime(firstPayTime);
            depositBill.setPayableFeesTime(firstPayTime.toLocalDate());
            depositBill.setPayFeesStatus("1");
            depositBill.setBillType("2");
        contractService.updateById(contract);
@@ -228,8 +226,7 @@
    @PreAuthorize("@ss.hasPermi('system:contract:delete')")
    @DeleteMapping(value = "/deleteContractByIds")
    public R<Boolean> deleteContractByIds
            (@RequestParam String ids) {
    public R<Boolean> deleteContractByIds(@RequestParam String ids) {
        if (StringUtils.isNotEmpty(ids)){
            contractService.removeBatchByIds(Arrays.asList(ids.split(",")));
        }
@@ -308,6 +305,7 @@
    @PreAuthorize("@ss.hasPermi('system:contract:terminate')")
    public R terminateContract(@RequestBody TerminateContractDTO dto) {
        contractService.terminateContract(dto);
        // 生成房屋验收记录 待验收
        return R.ok();
    }
    @ApiOperation(value = "根据合同id查看验收记录")
@@ -336,8 +334,10 @@
            templateParam.put("endTime", DateUtils.localDateTimeToStringYear(contract.getEndTime()));
            templateParam.put("monthRent", "¥¥"+contract.getMonthRent()+"元");
            templateParam.put("monthRentString", "人民币"+NumberToChineseUtils.numberToChinese(contract.getMonthRent().setScale(2, BigDecimal.ROUND_DOWN).doubleValue()));
            templateParam.put("totalYear", "¥¥"+contract.getTotalYear()+"元");
            templateParam.put("totalYearString", "人民币"+NumberToChineseUtils.numberToChinese(contract.getTotalYear().setScale(2, BigDecimal.ROUND_DOWN).doubleValue()));
            String totalYear = Objects.nonNull(contract.getTotalYear())?contract.getTotalYear().toString():"";
            templateParam.put("totalYear", "¥¥"+totalYear+"元");
            String totalYearString = StringUtils.isNotEmpty(totalYear)?NumberToChineseUtils.numberToChinese(contract.getTotalYear().setScale(2, BigDecimal.ROUND_DOWN).doubleValue()):"";
            templateParam.put("totalYearString", "人民币"+totalYearString);
            templateParam.put("payType", contract.getPayType().equals("1")?"月":contract.getPayType().equals("2")?"季":"年");
            templateParam.put("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,BigDecimal.ROUND_DOWN)+"元");
            templateParam.put("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,BigDecimal.ROUND_DOWN)).doubleValue()));
@@ -348,7 +348,7 @@
            templateParam.put("partyOnePhone", contract.getPartyOnePhone());
            templateParam.put("partyTwoPerson", contract.getPartyTwoPerson());
            templateParam.put("partyTwoPhone", contract.getPartyTwoPhone());
            String url = wordUtil.generatePdf("/templates", "1_yzj_租赁合同.xml", templateParam, "租赁合同", "E:\\");
            String url = wordUtil.generatePdf("/template", "1_yzj_租赁合同.xml", templateParam, "租赁合同", "E:\\");
            res.add(url);
        }
@@ -372,12 +372,13 @@
            contractExport.setContractName(contract.getContractName());
            contractExport.setPartyOneName(contract.getPartyOneName());
            contractExport.setPartyTwoName(contract.getPartyTwoName());
            contractExport.setCreate_time(contract.getCreateTime());
            contractExport.setStartTime(contract.getStartTime());
            contractExport.setEndTime(contract.getEndTime());
            contractExport.setCreateTime(DateUtils.localDateTimeToStringYear(contract.getCreateTime()));
            contractExport.setStartTime(DateUtils.localDateTimeToStringYear(contract.getStartTime()));
            contractExport.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime()));
            contractExport.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,contract.getPayType()));
            contractExport.setDeposit(contract.getDeposit()+"");
            contractExport.setStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS,contract.getStatus()));
            contractExports.add(contractExport);
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ContractExport.class, contractExports);
        HttpServletResponse response = WebUtils.response();
@@ -394,7 +395,6 @@
            workbook.write(outputStream);
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("合同列表信息导出失败");
        } finally {
            try {
                outputStream.close();