springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
@@ -180,7 +180,7 @@ } for (int i = 18; i < headSize; i++) { if (oneData.get(i) != null && oneData.get(i).equals("是")) { vo.getUserTagStr().add(headData.get(i)); vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("("))); } } voList.add(vo); springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -2171,4 +2171,12 @@ */ @PostMapping("common/data/special/page") R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO); /** * 删除特殊群体人员 * @param id 特殊群体id * @return 删除结果 */ @PostMapping("common/data/special/delete") R deleteSpecialInputUser(@RequestParam(value = "id") Long id); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java
@@ -345,59 +345,129 @@ return userService.deleteSpecialInputUser(id); } @ApiOperation(value = "特殊群体 导出特殊群体Excel") // @ApiOperation(value = "特殊群体 导出特殊群体Excel") // @PostMapping("/special/export") // public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) { // exportSpecialUserDTO.setCommunityId(this.getCommunityId()); // String url = excelUrl; // String uuid = UUID.randomUUID().toString().replace("-", ""); // String name = uuid + ".xlsx"; // String ftpUrl = "/mnt/data/web/excel/"; //// 用户搜索了就下载搜索的用户否则下载所有用户 // R r = userService.specialUserExport(exportSpecialUserDTO); // if (R.isOk(r)) { // List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), EexcelUserDTO.class); // try { // SFTPUtil sftp = new SFTPUtil(userName, password, host, port); // sftp.login(); // boolean existDir = sftp.isExistDir(ftpUrl + name); // if (!existDir) { // String property = System.getProperty("user.dir"); // String fileName = property + File.separator + name; // // 这里 需要指定写用哪个class去写 // ExcelWriter excelWriter = null; // InputStream inputStream = null; // try { // excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); // WriteSheet writeSheet = EasyExcel.writerSheet("模板").build(); // excelWriter.write(eexcelUserDTOS, writeSheet); // excelWriter.finish(); // File file = new File(fileName); // inputStream = new FileInputStream(file); // sftp.uploadMore(ftpUrl, name, inputStream); // sftp.logout(); // inputStream.close(); // String absolutePath = file.getAbsolutePath(); // boolean delete = file.delete(); // log.info("删除excel【{}】结果【{}】", absolutePath, delete); // } finally { // // 千万别忘记finish 会帮忙关闭流 // if (inputStream != null) { // inputStream.close(); // } // if (excelWriter != null) { // excelWriter.finish(); // } // } // } // return R.ok(url + name); // } catch (Exception e) { // e.printStackTrace(); // log.error("文件传输失败【{}】", e.getMessage()); // return R.fail(); // } // } // return R.fail("未查询到用户"); // } @ApiOperation(value = "特殊群体-数据导出") @PostMapping("/special/export") public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) { exportSpecialUserDTO.setCommunityId(this.getCommunityId()); String url = excelUrl; String uuid = UUID.randomUUID().toString().replace("-", ""); String name = uuid + ".xlsx"; public R dataExportSpecilPopulation() { //获取登陆用户 LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); //获取登陆用户绑定社区id Long communityId = loginUserInfo.getCommunityId(); //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址 String ftpUrl = "/mnt/data/web/excel/"; // 用户搜索了就下载搜索的用户否则下载所有用户 R r = userService.specialUserExport(exportSpecialUserDTO); if (R.isOk(r)) { List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), EexcelUserDTO.class); try { SFTPUtil sftp = new SFTPUtil(userName, password, host, port); sftp.login(); boolean existDir = sftp.isExistDir(ftpUrl + name); if (!existDir) { String property = System.getProperty("user.dir"); String fileName = property + File.separator + name; // 这里 需要指定写用哪个class去写 ExcelWriter excelWriter = null; InputStream inputStream = null; try { excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); WriteSheet writeSheet = EasyExcel.writerSheet("模板").build(); excelWriter.write(eexcelUserDTOS, writeSheet); excelWriter.finish(); File file = new File(fileName); inputStream = new FileInputStream(file); sftp.uploadMore(ftpUrl, name, inputStream); sftp.logout(); inputStream.close(); String absolutePath = file.getAbsolutePath(); boolean delete = file.delete(); log.info("删除excel【{}】结果【{}】", absolutePath, delete); } finally { // 千万别忘记finish 会帮忙关闭流 if (inputStream != null) { inputStream.close(); } if (excelWriter != null) { excelWriter.finish(); String name = "特殊群体导出数据.xlsx"; try { SFTPUtil sftp = new SFTPUtil(userName, password, host, port); sftp.login(); boolean existDir = sftp.isExistDir(ftpUrl + name); if (!existDir) { String property = System.getProperty("user.dir"); String fileName = property + File.separator + name; // 这里 需要指定写用哪个class去写 ExcelWriter excelWriter = null; InputStream inputStream = null; try { List<ComMngPopulationVO> populList = JSON.parseArray(JSON.toJSONString(communityService.getPopulationListByCommunityId(communityId).getData()),ComMngPopulationVO.class); List<ComMngPopulationExcelVo> populationExcelVoList = new ArrayList<>(); if(populList != null && populList.size() > 0){ for (ComMngPopulationVO popul:populList){ if(popul.getLabel() == null){ continue; } ComMngPopulationExcelVo populationExcelVo = new ComMngPopulationExcelVo(); BeanUtils.copyProperties(popul,populationExcelVo); //设置性别 populationExcelVo.setSex(PopulSexEnum.getCnDescByName(popul.getSex())); //设置政治面貌 populationExcelVo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(popul.getPoliticalOutlook())); //设置是否租住 populationExcelVo.setIsRent(PopulIsOkEnum.getCnDescByName(popul.getIsRent())); populationExcelVoList.add(populationExcelVo); } } excelWriter = EasyExcel.write(fileName, ComMngPopulationExcelVo.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build(); WriteSheet writeSheet = EasyExcel.writerSheet("特殊群体导出数据").build(); excelWriter.write(populationExcelVoList, writeSheet); excelWriter.finish(); File file = new File(fileName); inputStream = new FileInputStream(file); sftp.uploadMore(ftpUrl, name, inputStream); sftp.logout(); inputStream.close(); String absolutePath = file.getAbsolutePath(); boolean delete = file.delete(); log.info("删除excel【{}】结果【{}】", absolutePath, delete); } finally { // 千万别忘记finish 会帮忙关闭流 if (inputStream != null) { inputStream.close(); } if (excelWriter != null) { excelWriter.finish(); } } return R.ok(url + name); } catch (Exception e) { e.printStackTrace(); log.error("文件传输失败【{}】", e.getMessage()); return R.fail(); } return R.ok(excelUrl + name); } catch (Exception e) { e.printStackTrace(); log.error("文件传输失败【{}】", e.getMessage()); return R.fail(); } return R.fail("未查询到用户"); } @ApiOperation(value = "特殊群体/分页查询标签列表", response = ComMngTagVO.class) springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/HouseApi.java
@@ -1,12 +1,15 @@ package com.panzhihua.community_backstage.api; import com.alibaba.fastjson.JSONObject; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.ComOpsHouseDTO; import com.panzhihua.common.model.dtos.community.PageComOpsHouseDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComOpsHouseVO; import com.panzhihua.common.model.vos.user.SysUserNoticeVO; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.validated.AddGroup; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Date; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -30,6 +34,9 @@ public class HouseApi extends BaseController { @Resource private CommunityService communityService; @Resource private UserService userService; @ApiOperation(value = "房屋租售-新增") @PostMapping("house") @@ -56,7 +63,24 @@ if (ObjectUtils.isEmpty(id)) { return R.fail("房屋租售id主键不能为空"); } return communityService.putOpsHouse(comOpsHouseVO); R r = communityService.putOpsHouse(comOpsHouseVO); if(R.isOk(r) && 1==comOpsHouseVO.getStatus()) { //审核通过添加提示信息 SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO(); sysUserNoticeVO.setUserId(comOpsHouseVO.getUserId()); sysUserNoticeVO.setType(3); sysUserNoticeVO.setTitle("房源审核通过"); sysUserNoticeVO.setBusinessType(1); sysUserNoticeVO.setBusinessTitle("您提交的" + comOpsHouseVO.getTitle() +"房屋出租审核已经审核通过"); sysUserNoticeVO.setBusinessId(comOpsHouseVO.getId()); sysUserNoticeVO.setStatus(0); sysUserNoticeVO.setBusinessStatus(2); R r2 = userService.addNotice(sysUserNoticeVO); if (R.isOk(r2)) { log.info("新增房屋出租通过审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); } } return r; } @ApiOperation(value = "房屋租售-删除") springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java
@@ -361,4 +361,14 @@ public R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO) { return comMngPopulationService.specialInputUser(pageInputUserDTO); } /** * 删除特殊群体人员 * @param id 特殊群体id * @return 删除结果 */ @PostMapping("/special/delete") public R deleteSpecialInputUser(@RequestParam(value = "id") Long id){ return comMngPopulationService.deleteSpecialInputUser(id); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
@@ -73,7 +73,7 @@ "AND #{comActMicroWishVO.createEnd}" + " </if> " + "<if test='comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>" + "AND w.status in (3,6) \n" + "AND w.status in (3, 5, 6) \n" + " </if> " + "<if test='comActMicroWishVO.userId != null and comActMicroWishVO.userId != 0'>" + "AND w.sponsor_id =#{comActMicroWishVO.userId} \n" + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -172,7 +172,7 @@ @Select("<script> " + "select cmp.id,cmv.`alley` as areaName,cmp.`name`,cmp.phone,cmp.label as tags,cmp.create_at from com_mng_population as cmp " + "left join com_mng_village as cmv on cmv.village_id = cmp.village_id where cmp.act_id = #{pageInputUserDTO.communityId} " + "left join com_mng_village as cmv on cmv.village_id = cmp.village_id where cmp.act_id = #{pageInputUserDTO.communityId} and cmp.label is not null " + "<if test='pageInputUserDTO.name != null and pageInputUserDTO.name != ""'>" + " AND cmp.`name` LIKE concat(#{pageInputUserDTO.name},'%') " + " </if> " + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -114,4 +114,11 @@ * @return 特殊群体列表 */ R specialInputUser(PageInputUserDTO pageInputUserDTO); /** * 删除特殊群体人员 * @param id 特殊群体id * @return 删除结果 */ R deleteSpecialInputUser(Long id); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java
@@ -59,7 +59,8 @@ if (!ObjectUtils.isEmpty(records)) { records.forEach(comActMicroWishVO1 -> { Long id = comActMicroWishVO1.getId(); ComActMicroWishUserDO comActMicroWishUserDO = comActMicroWishUserDAO.selectOne(new QueryWrapper<ComActMicroWishUserDO>().lambda().eq(ComActMicroWishUserDO::getMicroWishId, id).eq(ComActMicroWishUserDO::getUserId, userId)); ComActMicroWishUserDO comActMicroWishUserDO = comActMicroWishUserDAO.selectOne(new QueryWrapper<ComActMicroWishUserDO>().lambda().eq(ComActMicroWishUserDO::getMicroWishId, id) .eq(ComActMicroWishUserDO::getUserId, userId)); if (ObjectUtils.isEmpty(comActMicroWishUserDO)) { comActMicroWishVO1.setHaveGiveThumbsUp(0); } else { springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -234,9 +234,6 @@ comMngPopulationDO.setActId(comActDO.getCommunityId()); comMngPopulationDO.setStreetId(comActDO.getStreetId()); comMngPopulationDO.setLabel(Joiner.on(",").join(userTag)); if(!userTag.isEmpty()){ //特殊群体插入 } comMngPopulationDO.setVillageName(comMngVillageDO.getGroupAt()); populationDOList.add(comMngPopulationDO); index++; @@ -436,4 +433,24 @@ ,pageInputUserDTO.getPageSize()), pageInputUserDTO); return R.ok(iPage); } /** * 删除特殊群体人员 * @param id 特殊群体id * @return 删除结果 */ @Override public R deleteSpecialInputUser(Long id){ //查询特殊群体人员 ComMngPopulationDO populationDO = this.baseMapper.selectById(id); if(populationDO == null){ return R.fail("未查询到该记录"); } populationDO.setLabel(null); if(this.baseMapper.updateById(populationDO) > 0){ return R.ok(); }else{ return R.fail(); } } }