diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java new file mode 100644 index 0000000000..bfaea6a0fd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.org.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 返回每个网格、每个组织下,工作人员的userId + * + * @author yinzuomei@elink-cn.com + * @date 2021/6/3 9:49 + */ +@Data +public class OrgStaffDTO implements Serializable { + + /** + * 组织id或者网格id + */ + private String orgId; + /** + * agency or grid + */ + private String orgType; + /** + * 当前组织或者当前网格下的: + */ + private List staffIds; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index b47d3cc8ef..794b1b707d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -109,6 +109,8 @@ public class DemoController { private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService; @Autowired private FactOriginProjectCategoryDailyService originProjectCategoryDailyService; + @Autowired + private ScreenCentralZoneDataAbsorptionService screenCentralZoneDataAbsorptionService; @GetMapping("testAlarm") public void testAlarm() { @@ -870,4 +872,9 @@ public class DemoController { return new Result().ok(ndddYhjfService.difficultyDataExtract(param)); } + @PostMapping("centralZoneDataHub") + public Result Test(@RequestBody ScreenCentralZoneDataFormDTO param){ + screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index 05a85d3d7c..210882908f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -3,6 +3,7 @@ package com.epmet.dao.org; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.org.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -33,4 +34,12 @@ public interface StatsCustomerAgencyDao extends BaseDao { List selectCustomerAreaCodeById(@Param("customerIds") List customerIds); CustomerAgencyEntity getRootAgencyInfo(String customerId); + + /** + * 获取每个组织、每个网格下工作人员userId集合 + * + * @param customerId + * @return com.epmet.dto.org.result.OrgStaffResultDTO + */ + List selectOrgStaffIds(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index 411452caeb..e48dc81ab3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -141,5 +141,13 @@ public interface UserDao { * @date 2021.03.08 17:16 */ List selectScreenProjectData(@Param("list") List list); + + /** + * 根据工作员用户id, 返回这些人当中多少个网格员 + * + * @param staffIds + * @return int + */ + int selectGridManagerTotal(@Param("customerId")String customerId,@Param("staffIds")List staffIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java index c41ef72cc3..4843a44a24 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java @@ -95,4 +95,8 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity { */ private Integer projectTotal; + /** + * 06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + */ + private Integer gridMemberTotal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java index b3aa943ada..92516e516b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -1,6 +1,7 @@ package com.epmet.service.org; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.org.CustomerAgencyEntity; import java.util.Date; @@ -20,4 +21,12 @@ public interface CustomerAgencyService { List selectCustomerAreaCodeById(List customerIds); CustomerAgencyEntity getRootAgencyInfo(String customerId); + + /** + * 获取每个组织、每个网格下工作人员userId集合 + * + * @param customerId + * @return com.epmet.dto.org.result.OrgStaffResultDTO + */ + List queryOrgStaffIds(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index 8a8fae83b8..5bcfd88550 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -4,6 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.StatsCustomerAgencyDao; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.org.CustomerAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -50,4 +51,16 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { public CustomerAgencyEntity getRootAgencyInfo(String customerId) { return customerAgencyDao.getRootAgencyInfo(customerId); } + + /** + * 获取每个组织、每个网格下工作人员userId集合 + * + * @param customerId + * @return com.epmet.dto.org.result.OrgStaffResultDTO + */ + @Override + public List queryOrgStaffIds(String customerId) { + List resultList=customerAgencyDao.selectOrgStaffIds(customerId); + return resultList; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index feceadf83d..d096430868 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -4,14 +4,16 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; -import com.epmet.dao.stats.*; +import com.epmet.dao.stats.FactAgencyProjectDailyDao; +import com.epmet.dao.stats.FactGroupGridDailyDao; +import com.epmet.dao.stats.FactIssueGridDailyDao; import com.epmet.dao.stats.topic.FactTopicTotalGridDailyDao; - - - import com.epmet.dao.stats.user.FactRegUserGridDailyDao; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; +import com.epmet.service.org.CustomerAgencyService; import com.epmet.service.stats.ScreenCentralZoneDataExtractService; +import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,7 +45,10 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon private FactIssueGridDailyDao factIssueGridDailyDao; @Autowired private FactAgencyProjectDailyDao factAgencyProjectDailyDao; - + @Autowired + private CustomerAgencyService customerAgencyService; + @Autowired + private UserService userService; private final String ORG_LEVEL_AGENCY = "agency"; private final String ORG_LEVEL_GRID = "grid"; @@ -155,6 +160,10 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon Map projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal)); projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal))); + //For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + List orgStaffDTOList=customerAgencyService.queryOrgStaffIds(customerId); + Map gridManagerMap=userService.queryOrgGridManager(customerId,orgStaffDTOList); + result.forEach(o -> { String orgId = o.getOrgId(); Integer count = groupMap.get(orgId); @@ -169,10 +178,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon count = projectMap.get(orgId); o.setProjectTotal(null == count ? NumConstant.ZERO : count); o.setDataEndTime(dimId); - }); - - + //For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 + if(gridManagerMap.containsKey(orgId)){ + o.setGridMemberTotal(gridManagerMap.get(orgId)); + }else{ + o.setGridMemberTotal(NumConstant.ZERO); + } + }); return result; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 36229bfbb2..b7cab26df1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -2,6 +2,7 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; @@ -84,4 +85,13 @@ public interface UserService { * @date 2021.03.08 17:16 */ List fillScreenProjectData(List list); + + /** + * 返回每个组织或者每个网格下的网格员数量 + * + * @param customerId + * @param orgStaffDTOList + * @return com.epmet.dto.user.OrgGridManagerTotalDTO + */ + Map queryOrgGridManager(String customerId,List orgStaffDTOList); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index b5594541a6..fc40a2e5fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -8,6 +8,7 @@ import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; +import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; @@ -755,4 +756,22 @@ public class UserServiceImpl implements UserService { return collection; } + /** + * 返回每个组织或者每个网格下的网格员数量 + * + * @param customerId + * @param orgStaffDTOList + * @return com.epmet.dto.user.OrgGridManagerTotalDTO + */ + @Override + public Map queryOrgGridManager(String customerId,List orgStaffDTOList) { + Map resultMap=new HashMap<>(); + for (OrgStaffDTO orgStaffDTO : orgStaffDTOList) { + if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(orgStaffDTO.getStaffIds())){ + resultMap.put(orgStaffDTO.getOrgId(),userDao.selectGridManagerTotal(customerId,orgStaffDTO.getStaffIds())); + } + } + return resultMap; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml index 4e228f3fed..8b205de7ad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml @@ -75,6 +75,7 @@ TOPIC_TOTAL, ISSUE_TOTAL, PROJECT_TOTAL, + GRID_MEMBER_TOTAL, DEL_FLAG, REVISION, CREATED_BY, @@ -97,6 +98,7 @@ #{item.topicTotal}, #{item.issueTotal}, #{item.projectTotal}, + #{item.gridMemberTotal}, 0, 0, 'CRAWLER_ROBOT', diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index d5ead92c47..5dc44f074c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -125,4 +125,36 @@ and ca.pid='0' and ca.CUSTOMER_ID=#{customerId} + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index f30740e0ee..51db8980fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -532,4 +532,29 @@ user_id = #{project.linkName} + + +