| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import liquibase.pro.packaged.S; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | |
| | | import org.springblade.core.tool.jackson.JsonUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldImporter; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 住户 控制器 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导入用户 |
| | | * 导入住户 |
| | | */ |
| | | @PostMapping("import-household") |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "导入住户", notes = "传入excel") |
| | | public R importUser(MultipartFile file, Integer isCovered) { |
| | | HouseHoldImporter houseHoldImporter = new HouseHoldImporter(householdService, isCovered == 1); |
| | | ExcelUtil.save(file, houseHoldImporter, HouseHoldExcel.class); |
| | | return R.success("操作成功"); |
| | | String data = householdService.importUserHouseHold(ExcelUtil.read(file, ImportHouseholdExcel.class),isCovered==1); |
| | | return R.data(200,data,null); |
| | | } |
| | | |
| | | /** |
| | | * 导出用户 |
| | | * 导出住户 |
| | | */ |
| | | @GetMapping("export-household") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出住户", notes = "传入user") |
| | | public void exportUser(HouseholdVO household, HttpServletResponse response) { |
| | | List<HouseHoldExcel> list = householdService.export(household); |
| | | ExcelUtil.export(response, "住户户数据" + DateUtil.time(), "住户数据表", list, HouseHoldExcel.class); |
| | | List<ImportHouseholdExcel> list = householdService.export(household); |
| | | ExcelUtil.export(response, "住户户数据" + DateUtil.time(), "住户数据表", list, ImportHouseholdExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 模板下載 |
| | | */ |
| | | @GetMapping("/export-template") |
| | | @ApiOperationSupport(order = 15) |
| | | @ApiOperation(value = "模板下載", notes = "传入response") |
| | | public void exportUser(HttpServletResponse response) { |
| | | List<ImportHouseholdExcel> list = new ArrayList<>(); |
| | | ImportHouseholdExcel houseHoldExcel = new ImportHouseholdExcel(); |
| | | // 设置模板数据 |
| | | houseHoldExcel.setHouseCode("Afdsfdasf5421********411214"); |
| | | houseHoldExcel.setName("张三"); |
| | | houseHoldExcel.setGender("1"); |
| | | houseHoldExcel.setPhoneNumber("13112341234"); |
| | | houseHoldExcel.setBirthday("2001-01-01"); |
| | | houseHoldExcel.setIdCard("360*************0001"); |
| | | houseHoldExcel.setOtherContact("13112341234"); |
| | | houseHoldExcel.setRelationship("1"); |
| | | houseHoldExcel.setIsPrimaryContact("1"); |
| | | houseHoldExcel.setResidentialStatus("1"); |
| | | houseHoldExcel.setEthnicity("1"); |
| | | houseHoldExcel.setHukouRegistration("江西上饶****"); |
| | | houseHoldExcel.setCurrentAddress("江西上饶****"); |
| | | houseHoldExcel.setPartyEmber("2"); |
| | | houseHoldExcel.setEducation("21"); |
| | | houseHoldExcel.setOccupation("***"); |
| | | houseHoldExcel.setEmployer("***单位"); |
| | | houseHoldExcel.setCmpyRegAddr("江西上饶****"); |
| | | houseHoldExcel.setWorkStatus("1"); |
| | | houseHoldExcel.setMaritalStatus("1"); |
| | | houseHoldExcel.setReligiousBelief("***"); |
| | | houseHoldExcel.setHealthStatus("1"); |
| | | houseHoldExcel.setGoOutWhere("去***"); |
| | | houseHoldExcel.setGoOutAddr("回老家"); |
| | | houseHoldExcel.setGoOutTime("2024-01-01"); |
| | | houseHoldExcel.setGoOutAddr("江西上饶********"); |
| | | houseHoldExcel.setCardNumber("赣*****"); |
| | | houseHoldExcel.setVolunteerOrg("信州义警"); |
| | | houseHoldExcel.setRemark("*****"); |
| | | houseHoldExcel.setLabelName("普通群众"); |
| | | list.add(houseHoldExcel); |
| | | ExcelUtil.export(response, "住户数据模板", "住户数据表", list, ImportHouseholdExcel.class); |
| | | } |
| | | |
| | | |