| | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.TContractDTO; |
| | |
| | | private THouseService houseService; |
| | | @ApiOperation(value = "获取合同分页列表") |
| | | @PostMapping(value = "/contractList") |
| | | public AjaxResult<PageInfo<TContract>> contractList(@RequestBody TContractQuery query) { |
| | | return AjaxResult.success(contractService.contractList(query)); |
| | | public R<PageInfo<TContract>> contractList(@RequestBody TContractQuery query) { |
| | | return R.ok(contractService.contractList(query)); |
| | | } |
| | | @Log(title = "合同管理-新增合同", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增合同") |
| | | @PostMapping(value = "/addContract") |
| | | public AjaxResult<Boolean> addContract(@Validated @RequestBody TContractDTO dto) { |
| | | public R<Boolean> addContract(@Validated @RequestBody TContractDTO dto) { |
| | | contractService.save(dto); |
| | | if (dto.getIsIncreasing()==1){ |
| | | TContractRentType tContractRentType = new TContractRentType(); |
| | |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | contractRentTypeService.save(tContractRentType); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "合同管理-编辑合同", businessType = BusinessType.UPDATE) |
| | | @Log(title = "合同管理-编辑合同", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑合同") |
| | | @PostMapping(value = "/updateContract") |
| | | public AjaxResult<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) { |
| | | public R<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) { |
| | | contractService.updateById(dto); |
| | | contractRentTypeService.remove(new LambdaQueryWrapper<TContractRentType>() |
| | | .eq(TContractRentType::getContractId,dto.getId())); |
| | |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | contractRentTypeService.save(tContractRentType); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "合同管理-批量删除合同", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除合同") |
| | | @DeleteMapping(value = "/deleteContractByIds") |
| | | public AjaxResult<Boolean> deleteContractByIds3 |
| | | public R<Boolean> deleteContractByIds3 |
| | | (@RequestParam String ids) { |
| | | if (StringUtils.isNotEmpty(ids)){ |
| | | contractService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询合同信息信息") |
| | | @GetMapping(value = "/getContractById") |
| | | public AjaxResult<TContractVO> getContractById(@RequestParam Long id) { |
| | | public R<TContractVO> getContractById(@RequestParam String id) { |
| | | TContractVO res = new TContractVO(); |
| | | TContract contract = contractService.getById(id); |
| | | BeanUtils.copyProperties(contract,res); |
| | |
| | | house.setTenantType(oldContract.getPayType()); |
| | | } |
| | | res.setHouse(house); |
| | | return AjaxResult.success(); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | } |