| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.ProcessCategoryEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | |
| | | @PreAuthorize("@ss.hasPermi('contract:list:add')") |
| | | public R<Boolean> addContract(@Validated @RequestBody TContractDTO dto) { |
| | | LocalDateTime changeTime = dto.getChangeTime(); |
| | | long count = contractService.count(new LambdaQueryWrapper<TContract>().eq(TContract::getContractNumber, dto.getContractNumber())); |
| | | long count = contractService.count(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getContractNumber, dto.getContractNumber())); |
| | | if (count!=0){ |
| | | return R.fail("合同编号不可重复"); |
| | | } |
| | | dto.setChangeRent(dto.getMonthRent()); |
| | | dto.setChangeTime(null); |
| | | //查询房产信息,获取所属营业部 |
| | | THouse house = houseService.getById(dto.getHouseId()); |
| | | if (Objects.isNull(house)) { |
| | | throw new ServiceException("房产信息不存在"); |
| | | } |
| | | dto.setBusinessDeptId(house.getBusinessDeptId()); |
| | | contractService.save(dto); |
| | | if (dto.getStatus().equals("2")){ |
| | | //发起合同新增审批 |
| | |
| | | new ImmutableMap.Builder<String, Long>(). |
| | | put("id", flwTask.getId()) |
| | | .build(); |
| | | QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); |
| | | QuartzManager.addJob( |
| | | StateProcessJob.class, |
| | | (StateProcessJob.name+flwTask.getId()).toUpperCase(), |
| | | TimeJobType.AUTO_AUDIT, |
| | | new Date(new Date().getTime()+48*60*60*1000L), |
| | | maps |
| | | ); |
| | | } |
| | | } |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('contract:list:edit')") |
| | | public R<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) { |
| | | dto.setChangeTime(null); |
| | | //查询房产信息,获取所属营业部 |
| | | THouse house = houseService.getById(dto.getHouseId()); |
| | | if (Objects.isNull(house)) { |
| | | throw new ServiceException("房产信息不存在"); |
| | | } |
| | | dto.setBusinessDeptId(house.getBusinessDeptId()); |
| | | contractService.updateById(dto); |
| | | contractRentTypeService.remove(new LambdaQueryWrapper<TContractRentType>() |
| | | .eq(TContractRentType::getContractId,dto.getId())); |
| | |
| | | new ImmutableMap.Builder<String, Long>(). |
| | | put("id", flwTask.getId()) |
| | | .build(); |
| | | QuartzManager.addJob(StateProcessJob.class, (StateProcessJob.name+flwTask.getId()).toUpperCase(), TimeJobType.AUTO_AUDIT,new Date(new Date().getTime()+48*60*60*1000L), maps); |
| | | QuartzManager.addJob( |
| | | StateProcessJob.class, |
| | | (StateProcessJob.name + flwTask.getId()).toUpperCase(), |
| | | TimeJobType.AUTO_AUDIT, |
| | | new Date(new Date().getTime() + 48 * 60 * 60 * 1000L), |
| | | maps |
| | | ); |
| | | } |
| | | } |
| | | } |
| | |
| | | TContractVO res = new TContractVO(); |
| | | TContract contract = contractService.getById(id); |
| | | BeanUtils.copyProperties(contract,res); |
| | | TContractRentType contractRentType = contractRentTypeService.lambdaQuery().eq(TContractRentType::getContractId, id).one(); |
| | | TContractRentType contractRentType = contractRentTypeService.lambdaQuery() |
| | | .eq(TContractRentType::getContractId, id) |
| | | .one(); |
| | | if (contractRentType!=null){ |
| | | BeanUtils.copyProperties(contractRentType,res); |
| | | } |
| | |
| | | for (TBill tBill : list) { |
| | | payMoney = payMoney.add(tBill.getOutstandingMoney()).add(tBill.getPayableFeesPenalty()); |
| | | } |
| | | TCheckAcceptRecord tCheckAcceptRecord = checkAcceptRecordService.lambdaQuery().eq(TCheckAcceptRecord::getContractId, id).one(); |
| | | res.setCheckResult(Objects.nonNull(tCheckAcceptRecord)&&Objects.nonNull(tCheckAcceptRecord.getCheckResult())?tCheckAcceptRecord.getCheckResult():null); |
| | | TCheckAcceptRecord tCheckAcceptRecord = checkAcceptRecordService.lambdaQuery() |
| | | .eq(TCheckAcceptRecord::getContractId, id) |
| | | .one(); |
| | | res.setCheckResult( |
| | | Objects.nonNull(tCheckAcceptRecord) |
| | | &&Objects.nonNull(tCheckAcceptRecord.getCheckResult()) |
| | | ?tCheckAcceptRecord.getCheckResult() |
| | | :null |
| | | ); |
| | | res.setPayMoney(payMoney); |
| | | |
| | | return R.ok(res); |
| | |
| | | // 将所有未缴费账单设置未已失效 |
| | | List<TBill> tBills = billService.list(new LambdaQueryWrapper<TBill>() |
| | | .ne(TBill::getPayFeesStatus, 3) |
| | | .ne(TBill::getBillType,4) |
| | | .eq(TBill::getContractId, contract.getId())); |
| | | for (TBill tBill : tBills) { |
| | | tBill.setPayFeesStatus("5"); |
| | |
| | | @PreAuthorize("@ss.hasPermi('contract:list:export')") |
| | | @Log(title = "导出", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void exportOpticalInspection(@RequestBody TContractQuery query) |
| | | { |
| | | public void exportOpticalInspection(@RequestBody TContractQuery query) throws UnsupportedEncodingException { |
| | | List<ContractExport> contractExports = new ArrayList<>(); |
| | | List<TContract> exportList = contractService.contractExportList(query); |
| | | |
| | | for (TContract contract : exportList) { |
| | | ContractExport contractExport = new ContractExport(); |
| | | contractExport.setContractNumber(contract.getContractNumber()); |
| | |
| | | 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())); |
| | | contractExport.setDeposit(contract.getDeposit() + ""); |
| | | contractExports.add(contractExport); |
| | | contractExport.setPayType( |
| | | DictUtils.getDictLabel( |
| | | DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType()) |
| | | ); |
| | | contractExport.setStatus( |
| | | DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_STATUS, contract.getStatus())); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ContractExport.class, contractExports); |
| | | |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("合同列表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | response.setHeader("Content-Disposition", |
| | | "attachment;filename=" + URLEncoder.encode("合同列表.xls", "utf-8")); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | |
| | | try (Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ContractExport.class, contractExports); |
| | | ServletOutputStream outputStream = response.getOutputStream()) { |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |