| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.TContractDTO; |
| | | import com.ruoyi.system.dto.THouseDTO; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.TContractRentType; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.query.THouseQuery; |
| | | import com.ruoyi.system.query.TUserHistoryQuery; |
| | | import com.ruoyi.system.service.TContractRentTypeService; |
| | | import com.ruoyi.system.service.TContractService; |
| | | import com.ruoyi.system.service.THouseService; |
| | | import com.ruoyi.system.vo.HouseVO; |
| | | import com.ruoyi.system.vo.TContractVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class TContractController { |
| | | @Autowired |
| | | private TContractService contractService; |
| | | // @Log(title = "房屋基础信息管理-新增房屋", businessType = BusinessType.INSERT) |
| | | // @ApiOperation(value = "新增房屋") |
| | | // @PostMapping(value = "/addHouse") |
| | | // public AjaxResult<Boolean> addHouse(@Validated @RequestBody THouseDTO dto) { |
| | | // return AjaxResult.success(contractService.save(dto)); |
| | | // } |
| | | // @Log(title = "房屋基础信息管理-编辑房屋", businessType = BusinessType.UPDATE) |
| | | // @ApiOperation(value = "编辑房屋") |
| | | // @PostMapping(value = "/updateHouse") |
| | | // public AjaxResult<Boolean> updateHouse(@Validated @RequestBody THouseDTO dto) { |
| | | // return AjaxResult.success(contractService.updateById(dto)); |
| | | // } |
| | | // @Log(title = "房屋基础信息管理-查询房屋信息", businessType = BusinessType.DELETE) |
| | | // @ApiOperation(value = "查询房屋信息") |
| | | // @GetMapping(value = "/getHouseById") |
| | | // public AjaxResult<THouse> getHouseById(@RequestParam Long id) { |
| | | // return AjaxResult.success(contractService.getById(id)); |
| | | // } |
| | | // @Log(title = "房屋基础信息管理-删除房屋", businessType = BusinessType.DELETE) |
| | | // @ApiOperation(value = "删除房屋") |
| | | // @DeleteMapping(value = "/deleteHouseById") |
| | | // public AjaxResult<Boolean> deleteHouseById(@RequestParam Long id) { |
| | | // return AjaxResult.success(contractService.removeById(id)); |
| | | // } |
| | | // @ApiOperation(value = "获取房屋分页列表") |
| | | // @PostMapping(value = "/houseList") |
| | | // public AjaxResult<PageInfo<THouse>> houseList(@RequestBody THouseQuery query) { |
| | | // return AjaxResult.success(contractService.houseList(query)); |
| | | // } |
| | | // @ApiOperation(value = "历史租户列表") |
| | | // @PostMapping(value = "/userHistoryList") |
| | | // public AjaxResult<PageInfo<HouseVO>> userHistoryList(@RequestBody TUserHistoryQuery query) { |
| | | // return AjaxResult.success(contractService.userHistoryList(query)); |
| | | // } |
| | | @Autowired |
| | | private TContractRentTypeService contractRentTypeService; |
| | | @Log(title = "合同管理-新增合同", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增合同") |
| | | @PostMapping(value = "/addContract") |
| | | public AjaxResult<Boolean> addContract(@Validated @RequestBody TContractDTO dto) { |
| | | contractService.save(dto); |
| | | if (dto.getIsIncreasing()==1){ |
| | | TContractRentType tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(dto.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | contractRentTypeService.save(tContractRentType); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @Log(title = "合同管理-编辑合同", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑合同") |
| | | @PostMapping(value = "/updateContract") |
| | | public AjaxResult<Boolean> updateContract(@Validated @RequestBody TContractDTO dto) { |
| | | contractService.updateById(dto); |
| | | contractRentTypeService.remove(new LambdaQueryWrapper<TContractRentType>() |
| | | .eq(TContractRentType::getContractId,dto.getId())); |
| | | if (dto.getIsIncreasing()==1){ |
| | | TContractRentType tContractRentType = new TContractRentType(); |
| | | tContractRentType.setContractId(dto.getId()); |
| | | tContractRentType.setIncreasingDecreasing(dto.getIncreasingDecreasing()); |
| | | tContractRentType.setIncreasingDecreasingType(dto.getIncreasingDecreasingType()); |
| | | tContractRentType.setNumericalValue(dto.getNumericalValue()); |
| | | tContractRentType.setChangeTime(dto.getChangeTime()); |
| | | contractRentTypeService.save(tContractRentType); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @Log(title = "合同管理-批量删除合同", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除合同") |
| | | @DeleteMapping(value = "/deleteContractByIds") |
| | | public AjaxResult<Boolean> deleteContractByIds3 |
| | | (@RequestParam String ids) { |
| | | if (StringUtils.isNotEmpty(ids)){ |
| | | contractService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询合同信息信息") |
| | | @GetMapping(value = "/getContractById") |
| | | public AjaxResult<TContractVO> getContractById(@RequestParam Long id) { |
| | | return AjaxResult.success(contractService.getById(id)); |
| | | } |
| | | |
| | | } |
| | | |