|
|
@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
@ -33,7 +34,7 @@ import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcBuildingDao; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.HouseInfoDTO; |
|
|
|
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|
|
|
import com.epmet.dto.result.IcHouseListResultDTO; |
|
|
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
|
import com.epmet.excel.IcHouseExcel; |
|
|
@ -85,33 +86,25 @@ public class HouseController implements ResultDataResolver { |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("houselist") |
|
|
|
public Result houseList(@RequestBody ListIcNeighborHoodFormDTO formDTO){ |
|
|
|
public Result<PageData<IcHouseListResultDTO>> houseList(@RequestBody IcHouseListFormDTO formDTO) { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
|
|
|
|
IcNeighborHoodResultDTO icNeighborHoodResultDTO = houseService.listNeighborhood(null, formDTO.getBuildingId(), formDTO.getOwnerName(), |
|
|
|
formDTO.getOwnerPhone(), null, |
|
|
|
null, |
|
|
|
formDTO.getPageNo(), formDTO.getPageSize(),formDTO.getId(),formDTO.getLevel(),formDTO.getRentFlag()); |
|
|
|
return new Result().ok(icNeighborHoodResultDTO); |
|
|
|
return new Result().ok(houseService.getHouseList(formDTO)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
*@Description 社区查询-搜索房屋 |
|
|
|
*@Author wangxianzhang |
|
|
|
*@Date 2022/1/14 11:00 上午 |
|
|
|
*@Param |
|
|
|
*@return |
|
|
|
*/ |
|
|
|
* @return |
|
|
|
* @Description 社区查询-搜索房屋 |
|
|
|
* @Author wangxianzhang |
|
|
|
* @Date 2022/1/14 11:00 上午 |
|
|
|
* @Param |
|
|
|
*/ |
|
|
|
@PostMapping("search") |
|
|
|
public Result<IcNeighborHoodResultDTO> searchHouse(@RequestBody ListIcNeighborHoodFormDTO formDTO, @LoginUser TokenDto loginUser) { |
|
|
|
public Result<PageData<IcHouseListResultDTO>> searchHouse(@RequestBody IcHouseListFormDTO formDTO, @LoginUser TokenDto loginUser) { |
|
|
|
String keyword = formDTO.getKeyword(); |
|
|
|
if (StringUtils.isBlank(keyword)) { |
|
|
|
IcNeighborHoodResultDTO r = new IcNeighborHoodResultDTO(); |
|
|
|
r.setTotal(0); |
|
|
|
r.setList(new ArrayList<>()); |
|
|
|
return new Result<IcNeighborHoodResultDTO>().ok(r); |
|
|
|
return new Result<PageData<IcHouseListResultDTO>>().ok(new PageData<>(new ArrayList<>(), NumConstant.ZERO)); |
|
|
|
} |
|
|
|
|
|
|
|
keyword = keyword.trim(); |
|
|
@ -135,50 +128,52 @@ public class HouseController implements ResultDataResolver { |
|
|
|
EpmetErrorCode.SERVER_ERROR.getCode(), |
|
|
|
"【社区查询-查询房屋】查询当前staff所在组织信息失败", |
|
|
|
null); |
|
|
|
|
|
|
|
IcNeighborHoodResultDTO icNeighborHoodResultDTO = houseService.listNeighborhood(loginUserDetail.getAgencyId(),null, null, null, |
|
|
|
neighborhoodName, buildingName, formDTO.getPageNo(), formDTO.getPageSize(),null,null,null); |
|
|
|
|
|
|
|
return new Result<IcNeighborHoodResultDTO>().ok(icNeighborHoodResultDTO); |
|
|
|
formDTO.setAgencyId(loginUserDetail.getAgencyId()); |
|
|
|
formDTO.setBuildingName(buildingName); |
|
|
|
formDTO.setNeighborHoodName(neighborhoodName); |
|
|
|
return new Result<PageData<IcHouseListResultDTO>>().ok(houseService.getHouseList(formDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
@PostMapping("houseadd") |
|
|
|
public Result houseAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){ |
|
|
|
public Result houseAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseAddFormDTO formDTO) { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDTO, IcHouseFormDTO.AddShowGroup.class); |
|
|
|
ValidatorUtils.validateEntity(formDTO, IcHouseAddFormDTO.AddShowGroup.class); |
|
|
|
String customerId = tokenDTO.getCustomerId(); |
|
|
|
// String customerId = "123123";
|
|
|
|
|
|
|
|
houseService.addHouse(customerId,formDTO); |
|
|
|
houseService.addHouse(customerId, formDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@NoRepeatSubmit |
|
|
|
@PostMapping("houseupdate") |
|
|
|
public Result houseUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){ |
|
|
|
public Result houseUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseAddFormDTO formDTO) { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDTO, IcHouseFormDTO.UpdateShowGroup.class); |
|
|
|
ValidatorUtils.validateEntity(formDTO, IcHouseAddFormDTO.UpdateShowGroup.class); |
|
|
|
String customerId = tokenDTO.getCustomerId(); |
|
|
|
// String customerId = "123123";
|
|
|
|
houseService.updateHouse(customerId,formDTO); |
|
|
|
houseService.updateHouse(customerId, formDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* lzh |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return 单独删除房屋内部调用/gov/org/house/delete |
|
|
|
*/ |
|
|
|
@PostMapping("housedel") |
|
|
|
public Result houseDel(@RequestBody IcHouseFormDTO formDTO){ |
|
|
|
public Result houseDel(@RequestBody IcHouseAddFormDTO formDTO) { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class); |
|
|
|
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodAddFormDTO.DeleteGroup.class); |
|
|
|
houseService.delHouse(formDTO.getHouseId()); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出模板 |
|
|
|
* |
|
|
|
* @param response |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
@ -186,26 +181,29 @@ public class HouseController implements ResultDataResolver { |
|
|
|
public void exportTemplate(HttpServletResponse response) throws Exception { |
|
|
|
// ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class);
|
|
|
|
TemplateExportParams templatePath = new TemplateExportParams("excel/house_template.xlsx"); |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("maplist",new ArrayList<IcHouseExcel>()); |
|
|
|
ExcelPoiUtils.exportExcel(templatePath ,map,"房屋信息录入表",response); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("maplist", new ArrayList<IcHouseExcel>()); |
|
|
|
ExcelPoiUtils.exportExcel(templatePath, map, "房屋信息录入表", response); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @param response |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@RequestMapping("exporthouseinfo") |
|
|
|
public void exporthouseinfo(@RequestBody ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
public void exporthouseinfo(@RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
houseService.exportBuildinginfo(formDTO,response); |
|
|
|
houseService.exportBuildinginfo(formDTO, response); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导入数据 |
|
|
|
* |
|
|
|
* @param file |
|
|
|
* @return |
|
|
|
* @throws IOException |
|
|
@ -222,34 +220,34 @@ public class HouseController implements ResultDataResolver { |
|
|
|
|
|
|
|
//存放错误数据行号
|
|
|
|
List<Integer> numList = new ArrayList<>(); |
|
|
|
if(!CollectionUtils.isEmpty(failList)){ |
|
|
|
for ( IcHouseExcel entity : failList) { |
|
|
|
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
|
|
|
|
if (!CollectionUtils.isEmpty(failList)) { |
|
|
|
for (IcHouseExcel entity : failList) { |
|
|
|
log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());//打印失败的行 和失败的信息
|
|
|
|
numList.add(entity.getRowNum()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<IcHouseExcel> result =importResult.getList(); |
|
|
|
List<IcHouseExcel> result = importResult.getList(); |
|
|
|
|
|
|
|
List<Integer> resultList = houseService.importExcel(customerId,result,tokenDTO.getUserId(),numList); |
|
|
|
String str = String.format("共%s条,成功导入%s条。",numList.size()+result.size(),numList.size()+result.size()-resultList.size()); |
|
|
|
if(resultList.size()> NumConstant.ZERO){ |
|
|
|
List<Integer> resultList = houseService.importExcel(customerId, result, tokenDTO.getUserId(), numList); |
|
|
|
String str = String.format("共%s条,成功导入%s条。", numList.size() + result.size(), numList.size() + result.size() - resultList.size()); |
|
|
|
if (resultList.size() > NumConstant.ZERO) { |
|
|
|
Collections.sort(resultList); |
|
|
|
String subList = resultList.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
log.warn(str + "第" + subList + "行未成功!"); |
|
|
|
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str+"第"+subList+"行未成功!"); |
|
|
|
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), str + "第" + subList + "行未成功!"); |
|
|
|
} |
|
|
|
return new Result().ok(str); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping( "queryListHouseInfo") |
|
|
|
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds, @RequestParam("customerId") String customerId){ |
|
|
|
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds,customerId)); |
|
|
|
@PostMapping("queryListHouseInfo") |
|
|
|
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds, @RequestParam("customerId") String customerId) { |
|
|
|
return new Result<List<HouseInfoDTO>>().ok(houseService.queryListHouseInfo(houseIds, customerId)); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("houseimport") |
|
|
|
public Result houseImport(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file, |
|
|
|
@RequestParam("orgId")String orgId, |
|
|
|
@RequestParam("orgType")String orgType,HttpServletRequest multipartRequest){ |
|
|
|
@RequestParam("orgId") String orgId, |
|
|
|
@RequestParam("orgType") String orgType, HttpServletRequest multipartRequest) { |
|
|
|
ImportInfoFormDTO formDTO = new ImportInfoFormDTO(); |
|
|
|
formDTO.setCustomerId(tokenDTO.getCustomerId()); |
|
|
|
formDTO.setOrgType(orgType); |
|
|
@ -260,32 +258,33 @@ public class HouseController implements ResultDataResolver { |
|
|
|
importFormDTO.setOperatorId(formDTO.getUserId()); |
|
|
|
importFormDTO.setOriginFileName(file.getOriginalFilename()); |
|
|
|
Result<ImportTaskCommonResultDTO> importTask = epmetCommonServiceOpenFeignClient.createImportTask(importFormDTO); |
|
|
|
if (!importTask.success()){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入"); |
|
|
|
if (!importTask.success()) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", "存在进行中的导入"); |
|
|
|
} |
|
|
|
InputStream inputStream = null; |
|
|
|
try { |
|
|
|
inputStream = file.getInputStream(); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); |
|
|
|
input.setOperatorId(formDTO.getUserId()); |
|
|
|
input.setTaskId(importTask.getData().getTaskId()); |
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
log.error("读取文件失败",e); |
|
|
|
log.error("读取文件失败", e); |
|
|
|
} |
|
|
|
houseService.dispose(inputStream,formDTO,importTask); |
|
|
|
houseService.dispose(inputStream, formDTO, importTask); |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc 小区管理中批量删除 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/3/1 4:57 下午 |
|
|
|
*/ |
|
|
|
@PostMapping("delete") |
|
|
|
public Result allDelete(@RequestBody NeighborHoodManageDelFormDTO formDTO){ |
|
|
|
public Result allDelete(@RequestBody NeighborHoodManageDelFormDTO formDTO) { |
|
|
|
ValidatorUtils.validateEntity(formDTO, NeighborHoodManageDelFormDTO.NeighborHoodManageDelForm.class); |
|
|
|
houseService.allDelete(formDTO); |
|
|
|
return new Result(); |
|
|
@ -293,14 +292,15 @@ public class HouseController implements ResultDataResolver { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取房屋信息 |
|
|
|
* |
|
|
|
* @param houseId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("gethouseinfo/{houseId}") |
|
|
|
public Result<HouseInfoDTO> getHouseInfo(@LoginUser TokenDto tokenDto,@PathVariable("houseId") String houseId){ |
|
|
|
if(StringUtils.isBlank(houseId)){ |
|
|
|
public Result<HouseInfoDTO> getHouseInfo(@LoginUser TokenDto tokenDto, @PathVariable("houseId") String houseId) { |
|
|
|
if (StringUtils.isBlank(houseId)) { |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
return new Result<HouseInfoDTO>().ok(houseService.getHouseInfoDTO(tokenDto.getCustomerId(),houseId)); |
|
|
|
return new Result<HouseInfoDTO>().ok(houseService.getHouseInfoDTO(tokenDto.getCustomerId(), houseId)); |
|
|
|
} |
|
|
|
} |
|
|
|