| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.ExportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.HouseTenantExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldImporter; |
| | | import org.springblade.modules.house.excel.ImportTenantHouseholdExcel; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.AddHouseholdVO; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.house.wrapper.HouseholdWrapper; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | return R.status(householdService.saveOrUpdateHousehold(household)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量自定义新增或修改 |
| | | * |
| | | * @param addHouseholdVO |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdateHouseholdBatch") |
| | | @ApiLog("批量自定义新增或修改") |
| | | @ApiOperation(value = "批量自定义新增或修改", notes = "传入household") |
| | | public R saveOrUpdateHouseholdBatch(@Valid @RequestBody AddHouseholdVO addHouseholdVO) { |
| | | bladeLogger.info("住户信息新增或修改", JsonUtil.toJson(addHouseholdVO)); |
| | | List<HouseholdVO> householdVOList = addHouseholdVO.getHouseholdVOList(); |
| | | boolean result = householdService.saveOrUpdateHouseholdBatch(householdVOList); |
| | | return R.status(result); |
| | | } |
| | | |
| | | /** |
| | | * 住户 删除 |
| | | */ |
| | |
| | | @PostMapping("import-household") |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "导入住户", notes = "传入excel") |
| | | public R importUser(MultipartFile file, Integer isCovered) { |
| | | public R importUser(MultipartFile file, Integer isCovered, @RequestParam(value = "isTenant", required = false) String isTenant) { |
| | | bladeLogger.info("住户信息导入", JsonUtil.toJson(isCovered)); |
| | | String data = householdService.importUserHouseHold(ExcelUtil.read(file, ImportHouseholdExcel.class),isCovered==1); |
| | | return R.data(200,data,null); |
| | | String data = householdService.importUserHouseHold(ExcelUtil.read(file, ImportHouseholdExcel.class), isCovered == 1, isTenant); |
| | | return R.data(200, data, data); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "导出住户", notes = "传入user") |
| | | public void exportUser(HouseholdVO household, HttpServletResponse response) { |
| | | List<ExportHouseholdExcel> list = householdService.export(household); |
| | | ExcelUtil.export(response, "住户户数据" + DateUtil.time(), "住户数据表", list, ExportHouseholdExcel.class); |
| | | ExcelUtil.export(response, "租户户数据" + DateUtil.time(), "住户数据表", list, ExportHouseholdExcel.class); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/export-template") |
| | | @ApiOperationSupport(order = 15) |
| | | @ApiOperation(value = "模板下載", notes = "传入response") |
| | | public void exportUser(HttpServletResponse response) { |
| | | public void exportUser(HttpServletResponse response, @RequestParam(value = "isTenant", required = false) String isTenant) { |
| | | List<ImportHouseholdExcel> list = new ArrayList<>(); |
| | | ImportHouseholdExcel houseHoldExcel = new ImportHouseholdExcel(); |
| | | // 设置模板数据 |
| | |
| | | houseHoldExcel.setBirthday("2001-01-01"); |
| | | houseHoldExcel.setIdCard("360*************0001"); |
| | | houseHoldExcel.setOtherContact("13112341234"); |
| | | houseHoldExcel.setRelationship("1"); |
| | | if (StringUtils.isBlank(isTenant)) { |
| | | houseHoldExcel.setRelationship("1"); |
| | | } else { |
| | | houseHoldExcel.setRelationship("18"); |
| | | } |
| | | houseHoldExcel.setIsPrimaryContact("1"); |
| | | houseHoldExcel.setResidentialStatus("1"); |
| | | houseHoldExcel.setEthnicity("1"); |
| | |
| | | |
| | | |
| | | /** |
| | | * 导出住户 |
| | | */ |
| | | @GetMapping("export-tenant-household") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出住户", notes = "传入user") |
| | | public void exporttenantUser(HouseholdVO household, HttpServletResponse response) { |
| | | List<HouseTenantExcel> list = householdService.exportTenant(household); |
| | | ExcelUtil.export(response, "住户户数据" + DateUtil.time(), "住户数据表", list, HouseTenantExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 模板下載 |
| | | */ |
| | | @GetMapping("/export-tenant-template") |
| | | @ApiOperationSupport(order = 15) |
| | | @ApiOperation(value = "模板下載", notes = "传入response") |
| | | public void exportTenantUser(HttpServletResponse response, @RequestParam(value = "isTenant", required = false) String isTenant) { |
| | | List<ImportTenantHouseholdExcel> list = new ArrayList<>(); |
| | | ImportTenantHouseholdExcel houseHoldExcel = new ImportTenantHouseholdExcel(); |
| | | // 设置模板数据 |
| | | houseHoldExcel.setHouseCode("Afdsfdasf5421********411214"); |
| | | houseHoldExcel.setName("张三"); |
| | | houseHoldExcel.setGender("1"); |
| | | houseHoldExcel.setPhoneNumber("13112341234"); |
| | | houseHoldExcel.setBirthday("2001-01-01"); |
| | | houseHoldExcel.setIdCard("360*************0001"); |
| | | if (StringUtils.isBlank(isTenant)) { |
| | | houseHoldExcel.setRelationship("1"); |
| | | } else { |
| | | houseHoldExcel.setRelationship("18"); |
| | | } |
| | | houseHoldExcel.setEthnicity("1"); |
| | | houseHoldExcel.setHukouRegistration("江西上饶****"); |
| | | list.add(houseHoldExcel); |
| | | ExcelUtil.export(response, "租户数据模板", "租户数据表", list, ImportTenantHouseholdExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 住户对应物业,网格,公安负责人查询 |
| | | * |
| | | * @param household |