diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityCountCensusFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityCountCensusFormDTO.java new file mode 100644 index 0000000000..d9e7f7d4e4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommunityCountCensusFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + +/** + * @ClassName AgencyCountCensus$ + * @Description + * @Date 2023/4/6 16:46 + * @Author lichao + **/ +@Data +public class CommunityCountCensusFormDTO implements Serializable { + + + + private static final long serialVersionUID = 4360690752084258055L; + + @NotBlank(message = "组织Id不能为空") + private String agencyId; + + private Date timeStart; + + private Date timeEnd; + + private Integer pageNum; + + private Integer pageSize; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java index 15bf7a402a..623af190db 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java @@ -10,6 +10,19 @@ import java.io.Serializable; */ @Data public class EnterprisePageFormDTO implements Serializable { + + /** + * 组织id或者网格id + * 04.10添加次入参,原型地址:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvzaghxlqxhe + */ + private String orgId; + /** + * 组织:agency + * 网格:grid + * 04.10添加次入参,原型地址:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvzaghxlqxhe + */ + private String orgType; + /** * 场所区域 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java new file mode 100644 index 0000000000..451c5c6790 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseCountPictureFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description 根据小区,楼宇,单元名称校验是否存在 + * @Author wgf + * @Date 2022/8/24 9:03 + */ +@Data +public class HouseCountPictureFormDTO implements Serializable { + private static final long serialVersionUID = 2636608477324780974L; + + private String orgIdPath; + + private String orgId; + + private String orgType; + + private Date timeStart; + + private Date timeEnd; + + private String purpose; + + private Integer rentFlag; + + private Integer pageSize; + + private Integer pageNo; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/EnterpriseCountPlaceTypeFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/EnterpriseCountPlaceTypeFormDTO.java new file mode 100644 index 0000000000..be4e1aac78 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/EnterpriseCountPlaceTypeFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form.yt; + +import lombok.Data; + +/** + * @Description 九小场所分析 + * @Author yzm + * @Date 2023/4/7 16:47 + */ +@Data +public class EnterpriseCountPlaceTypeFormDTO { + private String orgId; + private String orgType; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java index 9f453b4a09..4599d00793 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java @@ -1,5 +1,7 @@ package com.epmet.dto.result; +import lombok.Data; + import java.io.Serializable; /** @@ -8,6 +10,7 @@ import java.io.Serializable; * @Date 2023/4/6 16:46 * @Author lichao **/ +@Data public class AgencyCountCensusResultDTO implements Serializable { private static final long serialVersionUID = 4360690752084258055L; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountCensusResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountCensusResultDTO.java new file mode 100644 index 0000000000..5788007304 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountCensusResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName AgencyCountCensus$ + * @Description + * @Date 2023/4/6 16:46 + * @Author lichao + **/ +@Data +public class CommunityCountCensusResultDTO implements Serializable { + + private static final long serialVersionUID = 4360690752084258055L; + + private String agencyId; + + private String agencyName; + + private Integer count; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListByAgencyIdResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListByAgencyIdResultDTO.java new file mode 100644 index 0000000000..f256fbe316 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityListByAgencyIdResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: + * @Author: lichao + * @Date: 2023/4/7 16:43 + */ +@Data +public class CommunityListByAgencyIdResultDTO implements Serializable { + private static final long serialVersionUID = -1677303397440121269L; + + private String id; + + private String pids; + + private String name; + + private String streeName; + +// private String streeId; + + private String districtName; + +// private String districtId; + + private Date createTime; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseCountPictureListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseCountPictureListResultDTO.java new file mode 100644 index 0000000000..e90cd207a7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseCountPictureListResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description: + * @Author: lichao + * @Date: 2023/4/11 15:05 + */ +@NoArgsConstructor +@Data +public class HouseCountPictureListResultDTO implements Serializable { + + private static final long serialVersionUID = 2063032844842070847L; + + private String type; + + private Integer count; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseCountPictureResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseCountPictureResultDTO.java new file mode 100644 index 0000000000..998776fffb --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseCountPictureResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description: + * @Author: lichao + * @Date: 2023/4/11 15:05 + */ +@NoArgsConstructor +@Data +public class HouseCountPictureResultDTO implements Serializable { + + private static final long serialVersionUID = 2063032844842070847L; + + private Integer total; + + private List list; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HousePictureListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HousePictureListResultDTO.java new file mode 100644 index 0000000000..b511488220 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HousePictureListResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description: + * @Author: lichao + * @Date: 2023/4/11 14:41 + */ +@NoArgsConstructor +@Data +public class HousePictureListResultDTO implements Serializable { + + private static final long serialVersionUID = 2063032844842070847L; + + private String houseId; + + private String districtName; + + private String streetName; + + private String communityName; + + private String gridName; + + private String houseName; + + private String purposeName; + + private String rentFlagName; + + private String orgIdPath; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/EnterpriseCountPlaceTypeDetailDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/EnterpriseCountPlaceTypeDetailDTO.java new file mode 100644 index 0000000000..f92834a43b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/EnterpriseCountPlaceTypeDetailDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result.yt; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +/** + * @Description 九小场所分析 + * @Author yzm + * @Date 2023/4/7 16:48 + */ +@Data +public class EnterpriseCountPlaceTypeDetailDTO { + private String placeType; + private String placeTypeName; + private Integer total; + + + public EnterpriseCountPlaceTypeDetailDTO() { + this.total = NumConstant.ZERO; + } + + +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/EnterpriseCountPlaceTypeResDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/EnterpriseCountPlaceTypeResDTO.java new file mode 100644 index 0000000000..865a2f481a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/EnterpriseCountPlaceTypeResDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result.yt; + +import lombok.Data; + +import java.util.List; + +/** + * @Description 九小场所分析 + * @Author yzm + * @Date 2023/4/7 16:47 + */ +@Data +public class EnterpriseCountPlaceTypeResDTO { + private Integer total; + private List list; +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 2f70dc04ce..e0d4f9f644 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -251,6 +251,17 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId())); } + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 工作端-查询当前人员所属组织及所有下级组织(到区县级) + **/ + @PostMapping("staffinAgencyLevelList") + public Result staffinAgencyLevelList(@LoginUser TokenDto tokenDTO) { + return new Result().ok(customerAgencyService.staffinAgencyLevelList(tokenDTO.getUserId())); + } + /** * @Description 对外接口,根据customerId返回Element UI中Tree结构的agency列表 * @param map @@ -517,12 +528,40 @@ public class CustomerAgencyController { return customerAgencyService.getCurrentUserCommunityInfo(tokenDTO); } - + /** + * @Description: 返回下级数量统计 + * @param agencyId: + * @Return com.epmet.commons.tools.utils.Result> + * @Author: lichao + * @Date: 2023/4/7 14:48 + */ @GetMapping("getAgencyCountList") public Result> getAgencyCountList(@RequestParam String agencyId){ return new Result>().ok(customerAgencyService.getAgencyCountList(agencyId)); } + /** + * @Description: 获取下级组织数量统计 + * @param dto: + * @Return com.epmet.commons.tools.utils.Result> + * @Author: lichao + * @Date: 2023/4/7 15:08 + */ + @PostMapping("getCommunityCountList") + public Result> getCommunityCountList(@RequestBody CommunityCountCensusFormDTO dto){ + return new Result>().ok(customerAgencyService.getCommunityCountList(dto)); + } + /** + * @Description: 根据agencyId获取下级社区列表 + * @param dto: + * @Return com.epmet.commons.tools.utils.Result> + * @Author: lichao + * @Date: 2023/4/7 16:49 + */ + @PostMapping("getCommunityList") + public Result> getCommunityList(@RequestBody CommunityCountCensusFormDTO dto){ + return new Result>().ok(customerAgencyService.getCommunityList(dto)); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java index 7d9afd1a83..ab66b5aa4f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java @@ -22,14 +22,15 @@ import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; -import com.epmet.dto.IcEnterpriseChangeRecordDTO; import com.epmet.dto.form.EnterpriseFormDTO; import com.epmet.dto.form.EnterprisePageFormDTO; import com.epmet.dto.form.EnterprisePatrolFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.yt.EnterpriseCountPlaceTypeFormDTO; import com.epmet.dto.result.EnterpriseDetailDTO; import com.epmet.dto.result.EnterprisePatrolResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.dto.result.yt.EnterpriseCountPlaceTypeResDTO; import com.epmet.excel.EnterpriseExportExcelDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcEnterpriseService; @@ -69,6 +70,7 @@ public class IcEnterpriseController implements ResultDataResolver { private IcEnterpriseService icEnterpriseService; @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + /** * 企事业单位巡查】新增/编辑 * @@ -359,4 +361,17 @@ public class IcEnterpriseController implements ResultDataResolver { icEnterpriseService.qrCodeExport(formDTO,response); } + /** + * 九小场所分析:返回各个场所类型的数量 + * + * @param formDTO + * @return + */ + @PostMapping("count-type") + public Result countType(@RequestBody EnterpriseCountPlaceTypeFormDTO formDTO) { + return new Result().ok(icEnterpriseService.countType(formDTO.getOrgId(), formDTO.getOrgType())); + } + + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java index c2420c0832..7c8bdc939f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java @@ -17,24 +17,47 @@ package com.epmet.controller; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; +import com.epmet.dto.form.HouseCountPictureFormDTO; import com.epmet.dto.form.HouseFormDTO; -import com.epmet.dto.result.HouseAgencyInfoResultDTO; -import com.epmet.dto.result.HouseInfoDTO; -import com.epmet.dto.result.HouseListResultDTO; -import com.epmet.dto.result.HousesNameResultDTO; +import com.epmet.dto.result.*; +import com.epmet.excel.EnterpriseExportExcelDTO; +import com.epmet.excel.HousePictureListExcelDTO; import com.epmet.service.IcHouseService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.VerticalAlignment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Date; import java.util.List; import java.util.Map; @@ -45,6 +68,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2021-10-25 */ +@Slf4j @RestController @RequestMapping("ichouse") public class IcHouseController { @@ -161,4 +185,85 @@ public class IcHouseController { return icHouseService.checkHomeInfo(formDTO); } + /** + * @Description: 房屋画像-用途统计 + * @param dto: + * @Return com.epmet.commons.tools.utils.Result + * @Author: lichao + * @Date: 2023/4/11 15:08 + */ + @PostMapping("getHousePurposeCount") + public Result getHousePurposeCount(@RequestBody HouseCountPictureFormDTO dto){ + return new Result().ok(icHouseService.getHousePurposeCount(dto)); + } + + + /** + * @Description: 房屋画像-状态统计 + * @param dto: + * @Return com.epmet.commons.tools.utils.Result + * @Author: lichao + * @Date: 2023/4/11 15:07 + */ + @PostMapping("getHouseStatusCount") + public Result getHouseStatusCount(@RequestBody HouseCountPictureFormDTO dto){ + return new Result().ok(icHouseService.getHouseStatusCount(dto)); + } + + /** + * @Description: 房屋画像-列表 + * @param dto: + * @Return com.epmet.commons.tools.utils.Result> + * @Author: lichao + * @Date: 2023/4/11 16:20 + */ + @PostMapping("getHousePictureList") + public Result> getHousePictureList(@RequestBody HouseCountPictureFormDTO dto){ + return new Result>().ok(icHouseService.getHousePictureList(dto)); + } + + @PostMapping("export") + public void export(@RequestBody HouseCountPictureFormDTO formDTO, HttpServletResponse response) throws IOException { + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "房屋列表" + DateUtils.format(new Date()) + ".xlsx"; + // 头的策略 + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + // 背景设置为红色 + headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + FreezeAndFilter writeHandler = new FreezeAndFilter(); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), HousePictureListExcelDTO.class) + .registerWriteHandler(horizontalCellStyleStrategy) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .registerWriteHandler(writeHandler).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = icHouseService.getHousePictureList(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), HousePictureListExcelDTO.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("房屋列表导出异常export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java index aab97c99fc..c2967945f7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java @@ -141,11 +141,11 @@ public class StaffLoginLogController { PageData res = staffLoginLogService.getAccountActivityInfo(formDTO); if (!CollectionUtils.isEmpty(res.getList())) { if("1".equals(formDTO.getIsActivity())){ - List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountActivityExcel.class); - ExcelUtils.exportExcelToTarget(response, null, accountActivityExcels, AccountActivityInfo.class); +// List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountActivityExcel.class); + ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountActivityExcel.class); }else { - List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountInactivityExcel.class); - ExcelUtils.exportExcelToTarget(response, null, accountActivityExcels, AccountActivityInfo.class); +// List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountInactivityExcel.class); + ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountInactivityExcel.class); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 7d01383272..5639d33894 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -108,6 +108,8 @@ public interface CustomerAgencyDao extends BaseDao { **/ List selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids); + List selectSubAgencyLevelList(@Param("subAgencyPids") String subAgencyPids); + /** * 查询客户根级组织 * @@ -195,6 +197,8 @@ public interface CustomerAgencyDao extends BaseDao { **/ AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId); +// AgencyResultDTO selectAgencyByLevelStaffId(@Param("staffId") String staffId); + /** * @param customerId * @param pid @@ -430,6 +434,14 @@ public interface CustomerAgencyDao extends BaseDao { */ List getAllCommunity(String customerId); - Integer agencyCount(@Param("pids") String pids,@Param("level") String level); + List agencyCount(@Param("pids") String pids); + + Integer agencyGridCount(@Param("pids") String pids); + + Integer agencyStaffCount(@Param("pids") String pids); + + Integer getCommunityCount(@Param("pids")String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); + + List getCommunityByPidList (@Param("pids")String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcEnterpriseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcEnterpriseDao.java index 40bdde151e..95d7119471 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcEnterpriseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcEnterpriseDao.java @@ -3,6 +3,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.EnterprisePageFormDTO; import com.epmet.dto.result.EnterpriseDetailDTO; +import com.epmet.dto.result.yt.EnterpriseCountPlaceTypeDetailDTO; import com.epmet.entity.IcEnterpriseEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -32,4 +33,14 @@ public interface IcEnterpriseDao extends BaseDao { List selectList(EnterprisePageFormDTO formDTO); List selectForUniqueName(@Param("gridId") String gridId, @Param("placeOrgName") String placeOrgName, @Param("enterpriseId") String enterpriseId); + + /** + * 按场所类型 + * @param orgId + * @param orgType + * @return + */ + List selectCountByPlaceType(@Param("customerId")String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 3e9d28b39f..9f76843368 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import java.util.Set; @@ -218,4 +219,10 @@ public interface IcHouseDao extends BaseDao { * @return */ List selectGroupRentHouseList(GroupRentHouseFormDTO formDTO); + + List getHousePurposeCount(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); + + List getHouseStatusCount(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd); + + List getHousePictureList(@Param("orgId") String orgId,@Param("orgType") String orgType, @Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd,@Param("purpose") String purpose,@Param("rentFlag") Integer rentFlag); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/HousePictureListExcelDTO.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/HousePictureListExcelDTO.java new file mode 100644 index 0000000000..b6cc195a81 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/HousePictureListExcelDTO.java @@ -0,0 +1,50 @@ +package com.epmet.excel; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.util.Date; + +/** + * 企事业单位导出excel + */ +@Data +public class HousePictureListExcelDTO { + + + @ExcelIgnore + private String houseId; + + @ExcelProperty(value = "区县") + @ColumnWidth(25) + private String districtName; + + @ExcelProperty(value = "镇街") + @ColumnWidth(25) + private String streetName; + + @ExcelProperty(value = "社区") + @ColumnWidth(25) + private String communityName; + + @ExcelProperty(value = "网格") + @ColumnWidth(25) + private String gridName; + + @ExcelProperty(value = "房屋名称") + @ColumnWidth(25) + private String houseName; + + @ExcelProperty(value = "房屋用途") + @ColumnWidth(25) + private String purposeName; + + @ExcelProperty(value = "房屋状态") + @ColumnWidth(25) + private String rentFlagName; + @ExcelIgnore + private String orgIdPath; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index d80ec62617..f43de77102 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -215,6 +215,9 @@ public interface CustomerAgencyService extends BaseService **/ StaffInAgencyListResultDTO staffInAgencyList(String staffId); + StaffInAgencyListResultDTO staffinAgencyLevelList(String staffId); + + /** * @Description 运营端-返回element ui - tree 结构agency列表 * @param customerId @@ -362,5 +365,29 @@ public interface CustomerAgencyService extends BaseService * @return */ String getOrgIdPath(String orgId); + + /** + * 返回下级数量 + * @param agencyId + * @return + */ List getAgencyCountList(String agencyId); + + /** + * @Description: 获取下级组织的社区数量 + * @param dto: + * @Return java.util.List + * @Author: lichao + * @Date: 2023/4/7 15:09 + */ + List getCommunityCountList(CommunityCountCensusFormDTO dto); + + /** + * @Description: 根据agencyId获取下级社区列表 + * @param dto: + * @Return java.util.List + * @Author: lichao + * @Date: 2023/4/7 16:49 + */ + PageData getCommunityList(CommunityCountCensusFormDTO dto); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java index e141e008e3..5868cb805b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java @@ -2,19 +2,17 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.IcEnterpriseChangeRecordDTO; import com.epmet.dto.form.EnterpriseFormDTO; import com.epmet.dto.form.EnterprisePageFormDTO; import com.epmet.dto.form.EnterprisePatrolFormDTO; import com.epmet.dto.result.EnterpriseDetailDTO; import com.epmet.dto.result.EnterprisePatrolResultDTO; +import com.epmet.dto.result.yt.EnterpriseCountPlaceTypeResDTO; import com.epmet.entity.IcEnterpriseEntity; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.nio.file.Path; -import java.util.List; import java.util.Map; /** @@ -103,4 +101,12 @@ public interface IcEnterpriseService extends BaseService { */ void qrCodeExport(EnterprisePageFormDTO formDTO, HttpServletResponse response) throws IOException; + /** + * 九小场所分析:返回各个场所类型的数量 + * + * @param orgId + * @param orgType + * @return + */ + EnterpriseCountPlaceTypeResDTO countType(String orgId, String orgType); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java index 0855d78104..72fa7d2674 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java @@ -2,12 +2,14 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; +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.dto.IcHouseDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.DetailByTypeFormDTO; +import com.epmet.dto.form.HouseCountPictureFormDTO; import com.epmet.dto.form.HouseFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.IcHouseEntity; @@ -139,4 +141,9 @@ public interface IcHouseService extends BaseService { Result checkHomeInfo(CheckHouseInfoFormDTO formDTO); + HouseCountPictureResultDTO getHousePurposeCount(HouseCountPictureFormDTO dto); + + HouseCountPictureResultDTO getHouseStatusCount(HouseCountPictureFormDTO dto); + + PageData getHousePictureList(HouseCountPictureFormDTO dto); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 67f97aeb0c..7a651ecc9a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -37,12 +38,14 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.CustomerGridConstant; import com.epmet.dao.*; import com.epmet.dto.*; import com.epmet.dto.form.*; +import com.epmet.dto.region.LogOperationResultDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerDepartmentEntity; @@ -56,6 +59,8 @@ import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; import com.epmet.util.ModuleConstant; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -681,6 +686,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getDepartmentLevelList(String subAgencyPids) { + List subAgencyList = baseDao.selectSubAgencyLevelList(subAgencyPids); + if (subAgencyList.size() > NumConstant.ZERO) { + for (AgencySubResultDTO sub : subAgencyList) { + List subAgency = getDepartmentLevelList(sub.getPids() + ":" + sub.getAgencyId()); + sub.setSubAgencyList(subAgency); + } + } + return subAgencyList; + } + /** * @param staffId * @return @@ -1052,6 +1068,24 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl%s", staffId)); + throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION); + } + resultDTO.setAgencyList(agencyList); + + //2.递归查询所有下级组织信息 + List subAgencyList = getDepartmentLevelList(("".equals(agencyList.getPids()) ? "" : agencyList.getPids() + ":") + agencyList.getAgencyId()); + resultDTO.setSubAgencyList(subAgencyList); + + return resultDTO; + } + /** * @param customerId * @return com.epmet.dto.result.AgencyElementTreeResultDTO @@ -1193,6 +1227,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl + * @Author: lichao + * @Date: 2023/4/7 14:17 + */ @Override public List getAgencyCountList(String agencyId) { @@ -1631,24 +1674,89 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getCommunityCountList(CommunityCountCensusFormDTO dto) { + + List resultDTOS = new ArrayList<>(); + + CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId()); + if (customerAgency!=null){ + String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(CustomerAgencyEntity::getPids,pids); + List agencyEntityList = baseDao.selectList(queryWrapper); + agencyEntityList.forEach( + entity->{ + CommunityCountCensusResultDTO communityCountCensusResultDTO = new CommunityCountCensusResultDTO(); + communityCountCensusResultDTO.setAgencyId(entity.getId()); + communityCountCensusResultDTO.setAgencyName(entity.getOrganizationName()); + String agencyPids = PidUtils.convertPid2OrgIdPath(entity.getId(),entity.getPids()); + communityCountCensusResultDTO.setCount(baseDao.getCommunityCount(agencyPids,dto.getTimeStart(),dto.getTimeEnd())); + resultDTOS.add(communityCountCensusResultDTO); + } + ); + }else { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); + } - } + return resultDTOS; + } - }else{ + @Override + public PageData getCommunityList(CommunityCountCensusFormDTO dto) { + + CustomerAgencyEntity customerAgency = baseDao.selectById(dto.getAgencyId()); + if (customerAgency!=null){ + + String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids()); + + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + List entityList = baseDao.getCommunityByPidList(pids,dto.getTimeStart(),dto.getTimeEnd()); + + entityList.forEach( + entity->{ + String[] pidArray = entity.getPids().split(":"); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().in(CustomerAgencyEntity::getId,pidArray); + List customerAgencyEntities = baseDao.selectList(queryWrapper); + for (CustomerAgencyEntity customerAgencyEntity : customerAgencyEntities) { + if (customerAgencyEntity.getLevel().equals("district")){ + entity.setDistrictName(customerAgencyEntity.getOrganizationName()); + } + if (customerAgencyEntity.getLevel().equals("street")){ + entity.setStreeName(customerAgencyEntity.getOrganizationName()); + } + } + } + ); + + PageInfo pageInfo = new PageInfo<>(entityList); + return new PageData<>(entityList, pageInfo.getTotal(),dto.getPageSize()); + + }else { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); } - return agencyCountCensusResultDTOS; } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java index 7867b1434b..f5da256144 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java @@ -29,10 +29,11 @@ import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.dto.result.yt.EnterpriseCountPlaceTypeDetailDTO; +import com.epmet.dto.result.yt.EnterpriseCountPlaceTypeResDTO; import com.epmet.entity.*; import com.epmet.excel.EnterpriseImportExcelDTO; import com.epmet.excel.handler.IcEnterpriseExcelImportListener; -import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.OssFeignClient; @@ -85,8 +86,6 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl dictList = SpringContextUtils.getBean(CoverageService.class).dictMap(EpmetRequestHolder.getLoginUserCustomerId(), CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode()); + if (CollectionUtils.isEmpty(dictList)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "场所类型字典为空", "场所类型字典为空"); + } + // + List placeTypeCountList = baseDao.selectCountByPlaceType(EpmetRequestHolder.getLoginUserCustomerId(),orgId, orgType); + Map map = CollectionUtils.isEmpty(placeTypeCountList) ? new HashMap<>() : placeTypeCountList.stream().collect(Collectors.toMap(EnterpriseCountPlaceTypeDetailDTO::getPlaceType, o -> o));; + List list = new ArrayList<>(); + int total = 0; + for (IcCoverageCategoryDictListResultDTO placeType : dictList) { + EnterpriseCountPlaceTypeDetailDTO detailDTO = new EnterpriseCountPlaceTypeDetailDTO(); + detailDTO.setPlaceType(placeType.getValue()); + detailDTO.setPlaceTypeName(placeType.getLabel()); + detailDTO.setTotal(NumConstant.ZERO); + if (map.containsKey(placeType.getValue())) { + detailDTO.setTotal(map.get(placeType.getValue()).getTotal()); + } + list.add(detailDTO); + total += detailDTO.getTotal(); + } + EnterpriseCountPlaceTypeResDTO resDTO = new EnterpriseCountPlaceTypeResDTO(); + resDTO.setList(list); + resDTO.setTotal(total); + + return resDTO; + } + + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 93322c7ed6..c29c3b24e0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -9,26 +9,23 @@ import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dao.IcBuildingDao; -import com.epmet.dao.IcBuildingUnitDao; -import com.epmet.dao.IcHouseDao; -import com.epmet.dao.IcNeighborHoodDao; +import com.epmet.dao.*; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.CheckHouseInfoFormDTO; +import com.epmet.dto.form.HouseCountPictureFormDTO; import com.epmet.dto.form.HouseFormDTO; +import com.epmet.dto.region.LogOperationResultDTO; import com.epmet.dto.result.*; -import com.epmet.entity.IcBuildingEntity; -import com.epmet.entity.IcBuildingUnitEntity; -import com.epmet.entity.IcHouseEntity; -import com.epmet.entity.IcNeighborHoodEntity; +import com.epmet.entity.*; import com.epmet.enums.HousePurposeEnums; import com.epmet.enums.HouseRentFlagEnums; import com.epmet.enums.HouseTypeEnums; @@ -36,10 +33,14 @@ import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.redis.IcHouseRedis; +import com.epmet.service.CustomerAgencyService; import com.epmet.service.IcHouseService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.record.PageBreakRecord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -73,6 +74,10 @@ public class IcHouseServiceImpl extends BaseServiceImpl().ok(checkHomeInfoResultInfo); } + + @Override + public HouseCountPictureResultDTO getHousePurposeCount(HouseCountPictureFormDTO dto) { + + HouseCountPictureResultDTO resultDTO = new HouseCountPictureResultDTO(); + + resultDTO.setTotal(0); + + if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ + dto.setOrgType("agency"); + } + resultDTO.setList(baseDao.getHousePurposeCount(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd())); + + resultDTO.getList().forEach( + result->resultDTO.setTotal(resultDTO.getTotal()+result.getCount()) + ); + + return resultDTO; + } + + @Override + public HouseCountPictureResultDTO getHouseStatusCount(HouseCountPictureFormDTO dto) { + + HouseCountPictureResultDTO resultDTO = new HouseCountPictureResultDTO(); + + resultDTO.setTotal(0); + + if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ + dto.setOrgType("agency"); + } + + resultDTO.setList(baseDao.getHouseStatusCount(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd())); + + resultDTO.getList().forEach( + result->resultDTO.setTotal(resultDTO.getTotal()+result.getCount()) + ); + + return resultDTO; + } + + @Override + public PageData getHousePictureList(HouseCountPictureFormDTO dto) { + // 列表/导出查询 + PageHelper.startPage(dto.getPageNo(), dto.getPageSize()); + + if (dto.getOrgType().equals("community") || dto.getOrgType().equals("street") ||dto.getOrgType().equals("district") ||dto.getOrgType().equals("city")){ + dto.setOrgType("agency"); + } + + List list = baseDao.getHousePictureList(dto.getOrgId(),dto.getOrgType(),dto.getTimeStart(),dto.getTimeEnd(),dto.getPurpose(),dto.getRentFlag()); + + list.forEach(entity->{ + String[] agencyIds = entity.getOrgIdPath().split(":"); + LambdaQueryWrapper queryWrapperAgency = new LambdaQueryWrapper().in(CustomerAgencyEntity::getId,agencyIds); + List customerAgencyEntities = customerAgencyDao.selectList(queryWrapperAgency); + customerAgencyEntities.forEach(agency->{ + if (agency.getLevel().equals("district")){ + entity.setDistrictName(agency.getOrganizationName()); + }else if (agency.getLevel().equals("street")){ + entity.setStreetName(agency.getOrganizationName()); + }else if (agency.getLevel().equals("community")){ + entity.setCommunityName(agency.getOrganizationName()); + } + }); + }); + + PageInfo pageInfo = new PageInfo<>(list); + + return new PageData<>(list,pageInfo.getTotal()); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java index 85e498a6c3..a47241caf1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java @@ -186,6 +186,12 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl getAccountActivityInfo(CountActivityFormDTO formDTO) { + if (formDTO.getIsPage()) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List accountActivityInfos = baseDao.selectListActivityInfo(formDTO); + PageInfo pageInfo = new PageInfo<>(accountActivityInfos); + return new PageData<>(accountActivityInfos, pageInfo.getTotal(),formDTO.getPageSize()); + } List accountActivityInfos = baseDao.selectListActivityInfo(formDTO); int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size(); return new PageData<>(accountActivityInfos, total); @@ -207,7 +213,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl + + + + + + + @@ -1163,4 +1204,33 @@ ca.del_flag = '0' AND ca.customer_id = #{customerId} + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml index 2b14cedbbb..52945262d5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml @@ -66,10 +66,30 @@ LEFT JOIN ic_enterprise_patrol_record r ON ( ie.id = r.ENTERPRISE_ID AND r.DEL_FLAG = '0' ) WHERE ie.DEL_FLAG = '0' - AND ( - ie.AGENCY_ID = #{staffAgencyId} - OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' ) - ) + + + AND ie.GRID_ID = #{orgId} + + + + + AND (ie.AGENCY_ID = #{orgId} or ie.AGENCY_PIDS like concat('%',#{orgId},'%')) + + + AND ( + ie.AGENCY_ID = #{staffAgencyId} + OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' ) + ) + + + + + AND ( + ie.AGENCY_ID = #{staffAgencyId} + OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' ) + ) + + AND ie.GRID_ID = #{gridId} @@ -108,4 +128,24 @@ and ie.id != #{enterpriseId} + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 222062704a..b3ae7973eb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -775,5 +775,136 @@ CAST( ih.DOOR_NAME AS SIGNED ), CONVERT ( ih.DOOR_NAME USING gbk ), ih.SORT ASC + + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml index 6ed487ad44..13a1b5da8e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml @@ -49,7 +49,7 @@ and l.LOGIN_TIME <= #{endDate} GROUP BY ca.id - order by count(l.id) desc + order by count(l.id) desc,ca.CREATED_TIME desc @@ -111,7 +111,7 @@ and l.LOGIN_TIME <= #{endDate} group by ca.id - order by count(l.ID) desc + order by count(l.ID) desc,ca.CREATED_TIME desc @@ -176,13 +176,11 @@ customer_agency a LEFT JOIN staff_login_log l ON a.ID = l.AGENCY_ID WHERE - a.PIDS LIKE CONCAT( - '%', - #{orgId}, - '%' - ) - AND a.`LEVEL` = 'community' + a.`LEVEL` = 'community' AND a.DEL_FLAG = '0' + + AND a.PIDS LIKE CONCAT('%',#{orgId},'%') + GROUP BY a.ID ) t; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java new file mode 100644 index 0000000000..d5f763ceb4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/ResiPortrayalCommonFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form.resi; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description 烟台居民画像入参 + * @Author yzm + * @Date 2023/4/11 17:03 + */ +@Data +public class ResiPortrayalCommonFormDTO extends PageFormDTO { + /** + * /gov/org/customeragency/agencygridtree返回的agencyId + */ + private String orgId; + /** + * /gov/org/customeragency/agencygridtree返回level=grid时,orgType:grid;其他情况orgType:agency + */ + private String orgType; + + /** + * 查询居民列表 + * 年龄饼图/学历饼图返回的code + */ + private String code; + /** + * 学历:education + * 年龄:age + */ + private String codeType; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java new file mode 100644 index 0000000000..2cb38e742a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalDetailDTO.java @@ -0,0 +1,121 @@ +package com.epmet.dto.result.resi; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +/** + * @Description 烟台居民画像,居民列表 + * @Author yzm + * @Date 2023/4/12 10:10 + */ +@Data +public class ResiPortrayalDetailDTO { + /** + * 居民id + */ + @ExcelIgnore + private String icResiUserId; + + @ExcelIgnore + private String gridId; + + @ExcelProperty(value = "所属网格") + @ColumnWidth(30) + private String gridName; + + /** + * 所属小区ID + */ + @ExcelIgnore + private String villageId; + @ExcelIgnore + private String villageName; + /** + * 所属楼宇Id + */ + @ExcelIgnore + private String buildId; + @ExcelIgnore + private String buildName; + /** + * 单元id + */ + @ExcelIgnore + private String unitId; + @ExcelIgnore + private String unitName; + + /** + * 所属家庭Id + */ + @ExcelIgnore + private String homeId; + + @ExcelProperty(value = "所属房屋") + @ColumnWidth(30) + private String homeName; + + /** + * 所属家庭号 + * 101 + */ + @ExcelIgnore + private String doorName; + + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + @ColumnWidth(25) + private String name; + /** + * 手机号 + */ + @ExcelProperty(value = "手机号") + @ColumnWidth(25) + private String mobile; + /** + * 性别:1男;2女;0未知 + */ + @ExcelIgnore + private String gender; + /** + * 性别名称 + */ + @ExcelProperty(value = "性别") + @ColumnWidth(10) + private String genderName; + /** + * 身份证 + */ + @ExcelProperty(value = "身份证号") + @ColumnWidth(25) + private String idCard; + + @ExcelProperty(value = "出生日期") + @ColumnWidth(25) + private String birthday; + + /** + * 年龄 + */ + @ExcelProperty(value = "年龄") + @ColumnWidth(10) + private Integer age; + /** + * 学历key + */ + @ExcelIgnore + private String educationCode; + /** + * 学历 + */ + @ExcelProperty(value = "学历") + @ColumnWidth(10) + private String educationName; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResultDTO.java new file mode 100644 index 0000000000..4f0b95072a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/ResiPortrayalResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result.resi; + +import lombok.Data; + +/** + * @Description 烟台居民画像返参 + * @Author yzm + * @Date 2023/4/11 17:04 + */ +@Data +public class ResiPortrayalResultDTO { + /** + * 居民数量 + */ + private Integer totalResi; + /** + * 年龄分布:50岁以下:0;50-59岁:1;60-69岁:2;70-79岁:3;80岁以上:4 + * 学历分布:学历key + */ + private String code; + + /** + * 学历分布:小学及文盲/初中..... + * 年龄分布:50岁以下/50-59岁/60-69岁/70-79岁/80岁以上 + */ + private String codeName; +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 407eb3c26c..68aef04cda 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -59,9 +59,12 @@ import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; +import com.epmet.dto.form.resi.ResiPortrayalCommonFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.PartyMemberAgeExportExcel; import com.epmet.excel.PartyMemberEducationExportExcel; @@ -463,7 +466,6 @@ public class IcResiUserController implements ResultDataResolver { /** * desc: 导出居民信息 * - * @param customerId * @param tokenDto * @param pageFormDTO * @param response @@ -618,7 +620,6 @@ public class IcResiUserController implements ResultDataResolver { * * @param tokenDto * @param pageFormDTO - * @param response * @return void * @author LiuJanJun * @date 2021/11/19 4:24 下午 @@ -1449,7 +1450,6 @@ public class IcResiUserController implements ResultDataResolver { /** * Desc: 居民首次进入小程序,可以根据输入身份证信息查询在数字社区居民信息中的网格,匹配不成功提示 - * @param tokenDto * @param formDTO * @author zxc * @date 2022/8/5 11:17 @@ -1527,4 +1527,95 @@ public class IcResiUserController implements ResultDataResolver { return new Result>().ok(icResiUserService.renHuConditionList(formDTO)); } + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 + * 居民年龄分布饼图 + * + * @param formDTO + * @return + */ + @PostMapping("age-distribute") + public Result> queryAgeDistribute(@LoginUser TokenDto tokenDto,@RequestBody ResiPortrayalCommonFormDTO formDTO) { + return new Result>().ok(icResiUserService.queryAgeDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType())); + } + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 + * 居民学历分布饼图 + * + * @param formDTO + * @return + */ + @PostMapping("education-distribute") + public Result> queryEducationDistribute(@LoginUser TokenDto tokenDto,@RequestBody ResiPortrayalCommonFormDTO formDTO) { + return new Result>().ok(icResiUserService.queryEducationDistribute(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getOrgId(), formDTO.getOrgType())); + } + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 居民画像,居民列表 + * + * @param tokenDto + * @param formDTO + * @return + */ + @MaskResponse(fieldNames = {"mobile", "idCard"},fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) + @PostMapping("portrayal-list") + public Result> queryPortrayalResiList(@LoginUser TokenDto tokenDto, @RequestBody ResiPortrayalCommonFormDTO formDTO) { + return new Result>().ok(icResiUserService.queryPortrayalResiList(tokenDto.getCustomerId(), tokenDto.getUserId(), + formDTO.getPageNo(), formDTO.getPageSize(), + formDTO.getOrgId(), formDTO.getOrgType(), + formDTO.getCodeType(), + formDTO.getCode())); + } + + /** + * 11、导出列表数据 + * + * @param response + * @param formDTO + * @throws Exception + */ + @PostMapping("portrayal-listexport") + public void exportMonitoringEquipment(HttpServletResponse response, + @RequestBody ResiPortrayalCommonFormDTO formDTO) throws Exception { + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "居民画像-居民列表" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), ResiPortrayalDetailDTO.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + // 默认查询本组织及下级 + data = icResiUserService.queryPortrayalResiList(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId(), + formDTO.getPageNo(),formDTO.getPageSize(), + formDTO.getOrgId(),formDTO.getOrgType(), + formDTO.getCodeType(),formDTO.getCode()); + list = data.getList(); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("居民画像-居民列表export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 7ea3b00fbb..f69b949563 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -24,6 +24,8 @@ import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcVolunteerPolyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.entity.IcResiUserEntity; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; @@ -451,4 +453,32 @@ public interface IcResiUserDao extends BaseDao { List getImportUserList(@Param("customerId")String customerId,@Param("agencyId")String agencyId); + /** + * 烟台居民画像:按照学历分组,查询居民数量 + * @param customerId + * @param orgId + * @param orgType:agency/grid + * @return + */ + List queryEducationDistribute(@Param("customerId") String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType); + + List selectAgeAgeDistribute(@Param("customerId") String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType); + + /** + * @param customerId + * @param orgId + * @param orgType + * @param codeType 学历:education 年龄:age + * @param code + * @return 居民画像,居民列表 + */ + List selectPortrayalResiList(@Param("customerId") String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType, + @Param("codeType")String codeType, + @Param("code") String code); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index c29d0cb69d..c43853500a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -28,6 +28,8 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.entity.IcResiUserEntity; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; @@ -542,4 +544,38 @@ public interface IcResiUserService extends BaseService { List renHuConditionList(RHZKStatisticsFormDTO formDTO); + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 + * 居民年龄分布饼图 + * + * @param customerId + * @param staffId + * @param orgId + * @param orgType + * @return + */ + List queryAgeDistribute(String customerId, String staffId, String orgId, String orgType); + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 + * 居民学历分布饼图 + * + * @param orgId + * @param orgType agency/grid + * @return + */ + List queryEducationDistribute(String customerId, String staffId, String orgId, String orgType); + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 居民画像,居民列表 + * + * @return + */ + PageData queryPortrayalResiList(String customerId, String staffId, + Integer pageNo, Integer pageSize, + String orgId, String orgType, + String codeType,String code); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index d8e5ea3c17..22e10b0101 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -62,6 +62,8 @@ import com.epmet.dto.result.*; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; +import com.epmet.dto.result.resi.ResiPortrayalDetailDTO; +import com.epmet.dto.result.resi.ResiPortrayalResultDTO; import com.epmet.entity.*; import com.epmet.enums.RenHuConditionEnum; import com.epmet.excel.EpidemicPreventionExportExcel; @@ -81,6 +83,7 @@ import com.google.common.cache.CacheBuilder; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; @@ -3890,4 +3893,177 @@ public class IcResiUserServiceImpl extends BaseServiceImpl queryAgeDistribute(String customerId,String staffId,String orgId, String orgType) { + if (StringUtils.isBlank(orgId)) { + orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); + orgType = OrgTypeEnum.AGENCY.getCode(); + } + List resultList=getDefaultAgeDistribute(); + List list=baseDao.selectAgeAgeDistribute(customerId,orgId,orgType); + if(CollectionUtils.isEmpty(list)){ + return resultList; + } + Map resultMap = list.stream().collect(Collectors.toMap(ResiPortrayalResultDTO::getCode,ResiPortrayalResultDTO::getTotalResi)); + resultList.forEach(result->{ + if (MapUtils.isNotEmpty(resultMap) && resultMap.containsKey(result.getCode())) { + result.setTotalResi(resultMap.get(result.getCode())); + } + }); + return resultList; + } + + private List getDefaultAgeDistribute() { + List list = new ArrayList<>(); + for (int code = 0; code <= 4; code++) { + ResiPortrayalResultDTO resultDTO = new ResiPortrayalResultDTO(); + resultDTO.setTotalResi(NumConstant.ZERO); + resultDTO.setCode(String.valueOf(code)); + switch (code) { + case 0: + resultDTO.setCodeName("50岁以下"); + break; + case 1: + resultDTO.setCodeName("50-59岁"); + break; + case 2: + resultDTO.setCodeName("60-69岁"); + break; + case 3: + resultDTO.setCodeName("70-79岁"); + break; + case 4: + resultDTO.setCodeName("80岁以上"); + break; + default: + resultDTO.setCodeName(StrConstant.EPMETY_STR); + } + list.add(resultDTO); + } + return list; + } + + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 接口地址:http://yapi.elinkservice.cn/project/356/interface/api/cat_1370 + * 居民学历分布饼图 + * + * @param orgId + * @param orgType agency/grid + * @return + */ + @Override + public List queryEducationDistribute(String customerId, String staffId, String orgId, String orgType) { + if (StringUtils.isBlank(orgId)) { + orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); + orgType = OrgTypeEnum.AGENCY.getCode(); + } + // 获取文化程度字典 + DictListFormDTO dictFormDTO = new DictListFormDTO(); + dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode()); + Result> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); + if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败"); + } + //按照学历分组,查询居民数量 + List totalList = baseDao.queryEducationDistribute(customerId, orgId, orgType); + Map map = totalList.stream().collect(Collectors.toMap(ResiPortrayalResultDTO::getCode,ResiPortrayalResultDTO::getTotalResi)); + List resultDTOList = new ArrayList<>(); + dictResult.getData().forEach(dict -> { + ResiPortrayalResultDTO resultDTO = new ResiPortrayalResultDTO(); + resultDTO.setCode(dict.getValue()); + resultDTO.setCodeName(dict.getLabel()); + resultDTO.setTotalResi(NumConstant.ZERO); + if(MapUtils.isNotEmpty(map)&&map.containsKey(dict.getValue())){ + resultDTO.setTotalResi(map.get(dict.getValue())); + } + resultDTOList.add(resultDTO); + }); + return resultDTOList; + } + + + /** + * 烟台需求:https://modao.cc/app/DUshpXWirii6amoDQsb8OP#screen=slfbvoz5w4z9f98 + * 居民画像,居民列表 + * + * @param customerId + * @param staffId + * @param pageNo + * @param pageSize + * @param orgId + * @param orgType + * @param codeType 学历:education 年龄:age + * @param code:年龄饼图/学历饼图返回的code + * @return + */ + @Override + public PageData queryPortrayalResiList(String customerId, String staffId, + Integer pageNo, Integer pageSize, + String orgId, String orgType, + String codeType, + String code) { + // 获取文化程度字典 + DictListFormDTO dictFormDTO = new DictListFormDTO(); + dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode()); + Result> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); + if (!dictResult.success() || CollectionUtils.isEmpty(dictResult.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "学历字典获取失败", "学历字典获取失败"); + } + Map educationMap = dictResult.getData().stream().collect(Collectors.toMap(DictListResultDTO::getValue, DictListResultDTO::getLabel)); + + if (StringUtils.isBlank(orgId)) { + orgId = CustomerStaffRedis.getStaffInfo(customerId, staffId).getAgencyId(); + orgType = OrgTypeEnum.AGENCY.getCode(); + } + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.selectPortrayalResiList(customerId, orgId, orgType,codeType, code); + if(CollectionUtils.isNotEmpty(list)){ + Set houseIds=list.stream().map(m -> m.getHomeId()).collect(Collectors.toSet()); + //查询房子名称 + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); + List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); + Map houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); + + list.forEach(resi -> { + // 学历名称 + resi.setEducationName(educationMap.get(resi.getEducationCode())); + GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(resi.getGridId()); + if (null != gridInfoCache) { + resi.setGridName(gridInfoCache.getGridNamePath()); + } + if (houseInfoMap.containsKey(resi.getHomeId()) && null != houseInfoMap.get(resi.getHomeId())) { + HouseInfoDTO houseInfoDTO = houseInfoMap.get(resi.getHomeId()); + String buildName = StringUtils.isNotBlank(houseInfoDTO.getBuildingName()) ? houseInfoDTO.getBuildingName() : StrConstant.EPMETY_STR; + resi.setBuildName(buildName); + + String neighBorName = StringUtils.isNotBlank(houseInfoDTO.getNeighborHoodName()) ? houseInfoDTO.getNeighborHoodName() : StrConstant.EPMETY_STR; + resi.setVillageName(neighBorName); + + String unitName = StringUtils.isNotBlank(houseInfoDTO.getUnitName()) ? houseInfoDTO.getUnitName() : StrConstant.EPMETY_STR; + resi.setUnitName(unitName); + + String doorName = StringUtils.isNotBlank(houseInfoDTO.getDoorName()) ? houseInfoDTO.getDoorName() : StrConstant.EPMETY_STR; + resi.setDoorName(doorName); + resi.setHomeName(neighBorName.concat(buildName).concat(unitName).concat(doorName)); + } + }); + } + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(), pageSize); + } + + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 5f1104ddce..229652a45f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -125,7 +125,47 @@ - and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} <= #{subCondition.columnValue[1]} + + + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) <= #{subCondition.columnValue[1]} + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + @@ -180,7 +220,47 @@ - and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} <= #{subCondition.columnValue[1]} + + + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + and ${subCondition.tableName}.${subCondition.columnName} >= #{subCondition.columnValue[0]} + + + + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) <= #{subCondition.columnValue[1]} + + + + + and ic_resi_user.BIRTHDAY is not null + and ic_resi_user.BIRTHDAY !='' + and YEAR(NOW())-SUBSTR(ic_resi_user.BIRTHDAY, 1, 4) >= #{subCondition.columnValue[0]} + + @@ -1515,4 +1595,121 @@ + + + + + + + +