| | |
| | | */ |
| | | package org.springblade.modules.house.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.log.logger.BladeLogger; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.jackson.JsonUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.excel.HouseAndHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseAndHoldImporter; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | import org.springblade.modules.house.excel.HouseImporter; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import org.springblade.modules.house.wrapper.HouseWrapper; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 房屋 控制器 |
| | |
| | | public class HouseController extends BladeController { |
| | | |
| | | private final IHouseService houseService; |
| | | private final BladeLogger bladeLogger; |
| | | |
| | | /** |
| | | * 房屋 详情 |
| | |
| | | HouseEntity detail = houseService.getOne(Condition.getQueryWrapper(house)); |
| | | return R.data(HouseWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 房屋自定义详情查询 |
| | | * @param house |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseDetail") |
| | | @ApiLog("房屋自定义详情查询") |
| | | @ApiOperation(value = "房屋自定义详情查询", notes = "传入house") |
| | | public R<HouseVO> getHouseDetail(HouseVO house) { |
| | | bladeLogger.info("房屋自定义详情查询", JsonUtil.toJson(house)); |
| | | HouseVO detail = houseService.getHouseDetail(house); |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 房屋 分页 |
| | | */ |
| | |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入house") |
| | | @ApiLog("房屋 自定义分页") |
| | | @ApiOperation(value = "自定义分页", notes = "传入house") |
| | | public R<IPage<HouseVO>> page(HouseVO house, Query query) { |
| | | bladeLogger.info("房屋 自定义分页", JsonUtil.toJson(house)); |
| | | IPage<HouseVO> pages = houseService.selectHousePage(Condition.getPage(query), house); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 房屋标签统计 |
| | | */ |
| | | @GetMapping("/labelStatistics") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiLog("房屋标签统计") |
| | | @ApiOperation(value = "房屋标签统计") |
| | | public R labelStatistics(HouseVO house) { |
| | | bladeLogger.info("房屋标签统计", JsonUtil.toJson(house)); |
| | | List<Map<String, Object>> pages = houseService.labelStatistics( house); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 房屋标签区域统计 |
| | | */ |
| | | @GetMapping("/labelCommunityStatistics") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiLog("房屋标签区域统计") |
| | | @ApiOperation(value = "房屋标签区域统计") |
| | | public R labelCommunityStatistics(HouseVO house) { |
| | | bladeLogger.info("房屋标签区域统计", JsonUtil.toJson(house)); |
| | | List<Map<String, Object>> pages = houseService.labelCommunityStatistics( house); |
| | | return R.data(pages); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 房屋自定义新增或修改 |
| | | * @param house |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdateHouse") |
| | | @ApiOperation(value = "新增或修改", notes = "传入house") |
| | | @ApiLog("房屋 自定义分页") |
| | | public R saveOrUpdateHouse(@RequestBody HouseEntity house) { |
| | | return R.status(houseService.saveOrUpdateHouse(house)); |
| | | } |
| | | |
| | | /** |
| | | * 房屋 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | @ApiLog("房屋 自定义分页") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | bladeLogger.info("房屋 删除", JsonUtil.toJson(ids)); |
| | | return R.status(houseService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出房屋 |
| | | */ |
| | | @GetMapping("export-house") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出房屋", notes = "传入user") |
| | | public void exportHouse(HouseVO household, HttpServletResponse response) { |
| | | List<HouseExcel> list = houseService.export(household); |
| | | ExcelUtil.export(response, "房屋数据" + DateUtil.time(), "房屋数据表", list, HouseExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 导入房屋 |
| | | */ |
| | | @PostMapping("import-house") |
| | | public R importHouse(MultipartFile file, Integer isCovered) { |
| | | HouseImporter houseImporter = new HouseImporter(houseService, isCovered == 1); |
| | | ExcelUtil.save(file, houseImporter, HouseExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 查询房屋树 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseTree") |
| | | public R getHouseTree(HouseParam houseParam) { |
| | | return R.data(houseService.getHouseTree(houseParam)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入房屋及住户/租户人员数据 |
| | | */ |
| | | @PostMapping("import-houseAndHold") |
| | | public R importHouseAndHold(MultipartFile file, Integer isCovered) { |
| | | HouseAndHoldImporter houseImporter = new HouseAndHoldImporter(houseService, isCovered == 1); |
| | | ExcelUtil.save(file, houseImporter, HouseAndHoldExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getHouseStatistics") |
| | | public R getHouseStatistics(@RequestParam("code") String code, |
| | | @RequestParam("roleType") String roleType, |
| | | @RequestParam(value = "aoiCode", required = false) String aoiCode, |
| | | @RequestParam(value = "buildingCode", required = false) String buildingCode, |
| | | @RequestParam(value = "unitCode", required = false) String unitCode) { |
| | | Map<String, Object> result = houseService.getHouseStatistics(code, roleType, aoiCode, buildingCode, unitCode); |
| | | return R.data(result); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区id查询小区的栋 |
| | | * |
| | | * @param districtCode |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseBuilding") |
| | | @ApiOperation(value = "通过小区id查询小区的栋", notes = "传入小区id") |
| | | public R<List<String>> getHouseBuilding(@RequestParam("districtCode") String districtCode) { |
| | | List<String> detail = houseService.getHouseBuilding(districtCode); |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区id查询小区的单元 |
| | | * |
| | | * @param districtCode |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseUnit") |
| | | @ApiOperation(value = "通过小区id查询小区的单元", notes = "传入小区id") |
| | | public R<List<String>> getHouseUnit(@RequestParam("districtCode") String districtCode, @RequestParam("building") String building) { |
| | | List<String> detail = houseService.getHouseUnit(districtCode, building); |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 房屋网格处理 |
| | | * @return |
| | | */ |
| | | @GetMapping("/houseGridHandle") |
| | | @ApiOperation(value = "房屋网格处理") |
| | | public R houseGridHandle() { |
| | | return R.data(houseService.houseGridHandle()); |
| | | } |
| | | |
| | | /** |
| | | * 房屋警格处理 |
| | | * @return |
| | | */ |
| | | @GetMapping("/houseJwGridHandle") |
| | | @ApiOperation(value = "房屋警格处理") |
| | | public R houseJwGridHandle() { |
| | | return R.data(houseService.houseJwGridHandle()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 房屋画像统计-按房屋标签统计 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHouseLabelStatistic") |
| | | @ApiOperation(value = "房屋画像统计") |
| | | public R getHouseLabelStatistic(HouseVO house) { |
| | | return R.data(houseService.getHouseLabelStatistic(house)); |
| | | } |
| | | |
| | | /** |
| | | * 房屋标签初始化处置-根据有租客的,初始成出租,有业主没租客的初始化成自主,业主都没的就是闲置 |
| | | * @return |
| | | */ |
| | | @GetMapping("/initHouseLabelBind") |
| | | @ApiOperation(value = "房屋标签初始化处置") |
| | | public R initHouseLabelBind(HouseVO house) { |
| | | return R.status(houseService.initHouseLabelBind(house)); |
| | | } |
| | | |
| | | } |