diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStatisticsFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStatisticsFormDTO.java index f6f81f36d7..559a08d9f9 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStatisticsFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStatisticsFormDTO.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * @Description @@ -13,10 +14,12 @@ import java.io.Serializable; @Data public class OrgStatisticsFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = -1043502365053945317L; + private String customerId; private String agencyId; private String orgId; private String orgType; private String type; private String startDate; private String endDate; + private List agencyList; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/MemberProjectInfoResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/MemberProjectInfoResultDTO.java index 4b4ac940a3..e0c941e8e3 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/MemberProjectInfoResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/MemberProjectInfoResultDTO.java @@ -17,7 +17,8 @@ public class MemberProjectInfoResultDTO implements Serializable { private static final long serialVersionUID = -4880909768378661921L; private String staffId; private String staffName; + private String orgId; private String orgName; - private String projectCount; - private String closedCount; + private Integer projectCount = 0; + private Integer closedCount = 0; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 2e5f0bff93..e1538f0168 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -3,6 +3,7 @@ package com.epmet.dataaggre.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.aop.NoRepeatSubmit; @@ -18,7 +19,9 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; 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.dataaggre.beans.GridMemberDataAnalysisExcelExportBean; import com.epmet.dataaggre.dto.epmetuser.result.StaffSelectResDTO; @@ -27,6 +30,8 @@ import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.form.*; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums; +import com.epmet.dataaggre.excel.MemberProjectInfoExcel; +import com.epmet.dataaggre.excel.OrgProjectDetailExcel; import com.epmet.dataaggre.service.AggreGridService; import com.epmet.dataaggre.service.govorg.GovOrgService; import lombok.extern.slf4j.Slf4j; @@ -39,11 +44,13 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.FileInputStream; import java.io.IOException; +import java.io.PrintWriter; import java.net.URLEncoder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; /** @@ -440,14 +447,110 @@ public class GovOrgController { return new Result().ok(govOrgService.queryBuildingInfo(buildingId)); } + /** + * 组织项目统计 + * @Param tokenDto + * @Param formDTO + * @Return {@link Result< PageData< OrgProjectDetailResultDTO>>} + * @Author zhaoqifeng + * @Date 2022/7/28 10:34 + */ @PostMapping("orgProjectDetailList") public Result> orgProjectDetailList(@LoginUser TokenDto tokenDto, @RequestBody OrgStatisticsFormDTO formDTO) { return new Result>().ok(govOrgService.orgProjectDetailList(tokenDto, formDTO)); } + /** + * 网格员项目统计 + * @Param tokenDto + * @Param formDTO + * @Return {@link Result< PageData< MemberProjectInfoResultDTO>>} + * @Author zhaoqifeng + * @Date 2022/7/28 10:34 + */ @PostMapping("memberProjectInfoList") public Result> memberProjectInfoList(@LoginUser TokenDto tokenDto, @RequestBody OrgStatisticsFormDTO formDTO) { return new Result>().ok(govOrgService.memberProjectInfoList(tokenDto, formDTO)); } + @NoRepeatSubmit + @PostMapping("orgProjectDetailList/export") + public void orgProjectExport(@LoginUser TokenDto tokenDto, @RequestBody OrgStatisticsFormDTO formDTO, HttpServletResponse response) throws Exception { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setIsPage(false); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + + ExcelWriter excelWriter = null; + AtomicInteger i = new AtomicInteger(1); + try { + String fileName = "组织项目统计.xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), OrgProjectDetailExcel.class).build(); + PageData page = null; + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + do { + page = govOrgService.orgProjectDetailList(tokenDto, formDTO); + List list = ConvertUtils.sourceToTarget(page.getList(), OrgProjectDetailExcel.class); + list.forEach(item -> { + item.setIndex(i.getAndIncrement()); + }); + excelWriter.write(list, writeSheet); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + } while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(page.getList()) && page.getList().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(); + } + } + } + + @NoRepeatSubmit + @PostMapping("memberProjectInfoList/export") + public void memberProjectExport(@LoginUser TokenDto tokenDto, @RequestBody OrgStatisticsFormDTO formDTO, HttpServletResponse response) throws Exception { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setIsPage(false); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + + ExcelWriter excelWriter = null; + AtomicInteger i = new AtomicInteger(1); + try { + String fileName = "网格员项目统计.xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), MemberProjectInfoExcel.class).build(); + PageData page = null; + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + do { + page = govOrgService.memberProjectInfoList(tokenDto, formDTO); + List list = ConvertUtils.sourceToTarget(page.getList(), MemberProjectInfoExcel.class); + list.forEach(item -> { + item.setIndex(i.getAndIncrement()); + }); + excelWriter.write(list, writeSheet); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + } while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(page.getList()) && page.getList().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/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java index 2c910a3057..d32ddf47ed 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java @@ -28,6 +28,7 @@ import com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO; import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; import com.epmet.dataaggre.dto.govorg.form.OrgStatisticsFormDTO; import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO; +import com.epmet.dataaggre.dto.govorg.result.MemberProjectInfoResultDTO; import com.epmet.dataaggre.dto.govorg.result.OrgCountDTO; import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; @@ -379,4 +380,6 @@ public interface DataStatsDao { List getMemberCount(@Param("agencyId")String agencyId, @Param("dateId") String dateId); + List getMemberList(@Param("gridId") String gridId, @Param("dateId") String dateId); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java index 1540c564d6..6f49f5a6d0 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dataaggre.dto.epmetuser.result.RoleListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; +import com.epmet.dataaggre.dto.govorg.result.MemberProjectInfoResultDTO; import com.epmet.dataaggre.dto.govorg.result.OrgCountDTO; import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; @@ -76,5 +77,5 @@ public interface StaffRoleDao extends BaseDao { List selectStaffByRole(@Param("customerId") String customerId, @Param("roleId") String roleId, @Param("userId") String userId); List getMemberCount(@Param("customerId") String customerId); - + List getMemberList(@Param("customerId") String customerId, @Param("orgIds") List orgIds); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java index 3057cfbb25..05354d0b8b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java @@ -128,4 +128,6 @@ public interface ProjectDao extends BaseDao { List getGridProjectCount(OrgStatisticsFormDTO formDTO); List getGridClosedProjectCount(OrgStatisticsFormDTO formDTO); + List getMemberProjectCount(OrgStatisticsFormDTO formDTO); + List getMemberClosedProjectCount(OrgStatisticsFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/MemberProjectInfoExcel.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/MemberProjectInfoExcel.java new file mode 100644 index 0000000000..58a5d8014e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/MemberProjectInfoExcel.java @@ -0,0 +1,40 @@ +package com.epmet.dataaggre.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.HeadStyle; +import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import lombok.Data; + +/** + * 数字平台党员信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-17 + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class MemberProjectInfoExcel { + + @ColumnWidth(10) + @ExcelProperty(value = "序号",order = 1) + private Integer index; + + @ColumnWidth(30) + @ExcelProperty(value = "网格员",order = 2) + private String name; + + @ColumnWidth(40) + @ExcelProperty(value = "所属组织",order = 3) + private String idCard; + + @ColumnWidth(20) + @ExcelProperty(value = "上报数量",order = 4) + private String mobile; + + @ColumnWidth(20) + @ExcelProperty(value = "办结数",order = 5) + private String rdsj; + + +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/OrgProjectDetailExcel.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/OrgProjectDetailExcel.java new file mode 100644 index 0000000000..e7c5ba3d91 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/OrgProjectDetailExcel.java @@ -0,0 +1,47 @@ +package com.epmet.dataaggre.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.HeadStyle; +import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import lombok.Data; + +/** + * 数字平台党员信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-17 + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class OrgProjectDetailExcel { + + @ColumnWidth(10) + @ExcelProperty(value = "序号",order = 1) + private Integer index; + + @ColumnWidth(40) + @ExcelProperty(value = "所属组织",order = 2) + private String orgName; + + @ColumnWidth(20) + @ExcelProperty(value = "网格员数",order = 3) + private String memberCount; + + @ColumnWidth(20) + @ExcelProperty(value = "上报数量",order = 4) + private String projectCount; + + @ColumnWidth(20) + @ExcelProperty(value = "办结数",order = 5) + private String closedCount; + + @ColumnWidth(20) + @ExcelProperty(value = "人均上报",order = 6) + private String projectAve; + + @ColumnWidth(20) + @ExcelProperty(value = "人均办结",order = 7) + private String closedAve; + +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java index db0827a62a..7ce06a88e5 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.service.datastats; +import com.epmet.commons.tools.page.PageData; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; @@ -10,6 +11,7 @@ import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; import com.epmet.dataaggre.dto.govorg.form.OrgStatisticsFormDTO; import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.dto.govorg.result.MemberProjectInfoResultDTO; import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; @@ -302,4 +304,6 @@ public interface DataStatsService { Map getAgencyProjectTotal(OrgStatisticsFormDTO formDTO); Map getMemberMap(String agencyId); + + PageData getMemberList(OrgStatisticsFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index b89ce1b0c3..bf56d8cdb8 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -8,6 +8,7 @@ import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; + import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; @@ -31,6 +32,7 @@ import com.epmet.dataaggre.dto.govorg.form.OrgStatisticsFormDTO; import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; + import com.epmet.dataaggre.dto.govorg.result.MemberProjectInfoResultDTO; import com.epmet.dataaggre.dto.govorg.result.OrgCountDTO; import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; @@ -44,6 +46,7 @@ import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.opercrm.CustomerRelation; 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; @@ -2297,4 +2300,14 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve } return list.stream().collect(Collectors.toMap(OrgCountDTO::getOrgId, OrgCountDTO::getCount, (o1, o2) -> o1)); } + + @Override + public PageData getMemberList(OrgStatisticsFormDTO formDTO) { + //当前日期前一天 + String dateId = DateUtils.format(DateUtils.addDateDays(new Date(), NumConstant.ONE_NEG), DateUtils.DATE_PATTERN_YYYYMMDD); + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = dataStatsDao.getMemberList(formDTO.getOrgId(), dateId); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 014135e533..894e1fea1c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -1,12 +1,15 @@ package com.epmet.dataaggre.service.epmetuser; +import com.epmet.commons.tools.page.PageData; import com.epmet.dataaggre.dto.epmetuser.form.*; import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; +import com.epmet.dataaggre.dto.govorg.form.OrgStatisticsFormDTO; import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; +import com.epmet.dataaggre.dto.govorg.result.MemberProjectInfoResultDTO; import com.epmet.dataaggre.dto.govproject.result.ProjectAnalysisResultDTO; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import com.epmet.dto.IcResiUserDTO; @@ -217,4 +220,14 @@ public interface EpmetUserService { * @Date 2022/7/27 14:58 */ Map getMemberCount(String customerId); + + /** + * 获取组织下网格员列表 + * + * @Param agencyId + * @Return {@link PageData< MemberProjectInfoResultDTO>} + * @Author zhaoqifeng + * @Date 2022/7/27 17:32 + */ + PageData getMemberList(OrgStatisticsFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 79cb151439..4e31dd4a5d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.form.IdAndNameDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.OrgTypeEnum; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; @@ -25,6 +26,7 @@ import com.epmet.dataaggre.dto.govorg.CustomerDepartmentDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; +import com.epmet.dataaggre.dto.govorg.form.OrgStatisticsFormDTO; import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.govproject.result.ProjectAnalysisResultDTO; @@ -43,6 +45,7 @@ import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.result.StaffRoleResultDTO; 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.collections4.MapUtils; @@ -872,4 +875,21 @@ public class EpmetUserServiceImpl implements EpmetUserService { } return list.stream().collect(Collectors.toMap(OrgCountDTO::getOrgId, OrgCountDTO::getCount, (o1, o2) -> o1)); } + + /** + * 获取组织下网格员列表 + * + * @param formDTO + * @Param agencyId + * @Return {@link PageData < MemberProjectInfoResultDTO>} + * @Author zhaoqifeng + * @Date 2022/7/27 17:32 + */ + @Override + public PageData getMemberList(OrgStatisticsFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = staffRoleDao.getMemberList(formDTO.getCustomerId(), formDTO.getAgencyList()); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index fb237d158e..aeffe22264 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -1256,6 +1256,51 @@ public class GovOrgServiceImpl implements GovOrgService { */ @Override public PageData memberProjectInfoList(TokenDto tokenDto, OrgStatisticsFormDTO formDTO) { - return null; + formDTO.setCustomerId(tokenDto.getCustomerId()); + PageData result; + if (StringUtils.isBlank(formDTO.getAgencyId())) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取用户信息失败", "获取用户信息失败"); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType(OrgConstant.AGENCY); + } + if (OrgConstant.AGENCY.contains(formDTO.getOrgType())) { + //获取当前组织的所有下级组织ID(包含本级) + List agencyIds = customerAgencyDao.getSubAgencyList(formDTO.getOrgId()); + formDTO.setAgencyList(agencyIds); + //获取组织下的网格员 + result = epmetUserService.getMemberList(formDTO); + } else { + //获取网格下的网格员 + result = dataStatsService.getMemberList(formDTO); + } + if (CollectionUtils.isNotEmpty(result.getList())) { + //统计项目数 + Map projectMap = govProjectService.getMemberProjectMap(formDTO); + //统计关闭项目数 + Map closedMap = govProjectService.getMemberClosedProjectMap(formDTO); + result.getList().forEach(item -> { + if (projectMap.containsKey(item.getStaffId())) { + item.setProjectCount(projectMap.get(item.getStaffId())); + } + if (projectMap.containsKey(item.getStaffId())) { + item.setClosedCount(closedMap.get(item.getStaffId())); + } + if (OrgConstant.AGENCY.contains(formDTO.getOrgType())) { + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(item.getOrgId()); + if (null != agencyInfo) { + item.setOrgName(agencyInfo.getOrganizationName()); + } + } else { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getOrgId()); + if (null != gridInfo) { + item.setOrgName(gridInfo.getGridName()); + } + } + }); + } + return result; } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java index e7123f51ca..31beec2422 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java @@ -121,6 +121,36 @@ public interface GovProjectService { */ List searchIcEventEntities(String customerId, String staffOrgIds, String search, Boolean isDifficultPoint, Boolean isPage, Integer pageNo, Integer pageSize); + /** + * 网格上报项目数 + * @Param formDTO + * @Return {@link Map< String, Integer>} + * @Author zhaoqifeng + * @Date 2022/7/28 9:29 + */ Map getGridProjectMap(OrgStatisticsFormDTO formDTO); + /** + * 网格关闭项目数 + * @Param formDTO + * @Return {@link Map< String, Integer>} + * @Author zhaoqifeng + * @Date 2022/7/28 9:29 + */ Map getGridClosedProjectMap(OrgStatisticsFormDTO formDTO); + /** + * 工作人员上报项目数 + * @Param formDTO + * @Return {@link Map< String, Integer>} + * @Author zhaoqifeng + * @Date 2022/7/28 9:28 + */ + Map getMemberProjectMap(OrgStatisticsFormDTO formDTO); + /** + * 工作人员关闭项目数 + * @Param formDTO + * @Return {@link Map< String, Integer>} + * @Author zhaoqifeng + * @Date 2022/7/28 9:29 + */ + Map getMemberClosedProjectMap(OrgStatisticsFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java index f491b2f3b2..72e51a6a54 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java @@ -685,6 +685,42 @@ public class GovProjectServiceImpl implements GovProjectService { return list.stream().collect(Collectors.toMap(OrgCountDTO::getOrgId, OrgCountDTO::getCount, (o1, o2) -> o1)); } + /** + * 工作人员上报项目数 + * + * @param formDTO + * @Param formDTO + * @Return {@link Map< String, Integer>} + * @Author zhaoqifeng + * @Date 2022/7/28 9:28 + */ + @Override + public Map getMemberProjectMap(OrgStatisticsFormDTO formDTO) { + List list = projectDao.getMemberProjectCount(formDTO); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(OrgCountDTO::getOrgId, OrgCountDTO::getCount, (o1, o2) -> o1)); + } + + /** + * 工作人员关闭项目数 + * + * @param formDTO + * @Param formDTO + * @Return {@link Map< String, Integer>} + * @Author zhaoqifeng + * @Date 2022/7/28 9:29 + */ + @Override + public Map getMemberClosedProjectMap(OrgStatisticsFormDTO formDTO) { + List list = projectDao.getMemberProjectCount(formDTO); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(OrgCountDTO::getOrgId, OrgCountDTO::getCount, (o1, o2) -> o1)); + } + /** * 构造事件查询 * @param customerId diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml index b35342302d..a473f03daf 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml @@ -1242,5 +1242,17 @@ GROUP BY GRID_ID + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml index 2a5232fd8c..9c5999aeb3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml @@ -112,4 +112,25 @@ GROUP BY ORG_ID + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml index a5ed36af1a..e56a84c754 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml @@ -458,5 +458,48 @@ GROUP BY GRID_ID + +