diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java new file mode 100644 index 0000000000..ab5c9ef2ce --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.project; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/20 21:08 + */ +@Data +public class FinishOrgDTO implements Serializable { + + private static final long serialVersionUID = -5684606755705833962L; + private String projectId; + private String orgIdPath; + private String pIdPath; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java index 293163e1d9..759a56e82c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java @@ -40,11 +40,13 @@ public interface FactOriginProjectLogDailyDao extends BaseDao */ - List selectAgencyTransferCount(@Param("monthId") String monthId, @Param("level")String level); + List selectAgencyTransferCount(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level")String level); /** * @Description 查询未被退回的项目数 @@ -77,8 +79,21 @@ public interface FactOriginProjectLogDailyDao extends BaseDao + */ + List selectSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level")String level); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index a8fef6685c..58e683ebbf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -58,10 +58,11 @@ public interface FactOriginProjectMainDailyDao extends BaseDao */ - List selectOverdueCount(@Param("monthId") String monthId); + List selectOverdueCount(@Param("customerId") String customerId, @Param("monthId") String monthId); /** * @Description 网格办结项目数 @@ -77,8 +78,9 @@ public interface FactOriginProjectMainDailyDao extends BaseDao */ -// List selectResponsiveness(@Param("monthId") String monthId, @Param("level")String level, -// @Param("orgType")String orgType); + List selectResponsiveness(@Param("customerId") String customerId, @Param("monthId") String monthId, + @Param("level")String level, + @Param("orgType")String orgType); + void deleteByProjectId(@Param("list") List list); /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java index ef770f48b5..c3c85c1ffd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java @@ -66,4 +66,15 @@ public interface FactIndexGovrnAblityOrgMonthlyDao extends BaseDao> selectCommunityGovernAbility(@Param("customerId")String customerId, @Param("monthId")String monthId,@Param("level")String level); + + /** + * 根据组织类型删除数据 + * @author zhaoqifeng + * @date 2020/9/20 20:52 + * @param customerId + * @param monthId + * @param type + * @return java.lang.Integer + */ + Integer deleteByCustomer(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("type") String type); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java index 1c71121c1d..72beea8ca3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.project.FinishOrgDTO; import com.epmet.dto.project.ProcessInfoDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; import com.epmet.dto.project.result.ProjectOrgRelationWhenResponseResultDTO; @@ -109,7 +110,7 @@ public interface ProjectProcessDao extends BaseDao { * @date 2020/9/18 18:01 * @param customerId * @param date - * @return java.util.List + * @return java.util.List */ - List selectFinishOrg(@Param("customerId") String customerId, @Param("date") String date); + List selectFinishOrg(@Param("customerId") String customerId, @Param("date") String date); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java index 7e20babbeb..487bc79f97 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java @@ -135,4 +135,14 @@ public interface DimAgencyDao extends BaseDao { * @date 2020/9/15 6:15 下午 */ List selectAgencyInfo(@Param("agencyIds")List agencyIds); + + /** + * 根据级别获取组织信息 + * @author zhaoqifeng + * @date 2020/9/20 17:31 + * @param customerId + * @param level + * @return java.util.List + */ + List selectDimAgencyByLevel(@Param("customerId")String customerId, @Param("level")String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java index ba3b6f5239..72f840ba81 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java @@ -101,11 +101,12 @@ public interface FactOriginProjectLogDailyService extends BaseService */ - List getAgencyTransferCount(String monthId, String level); + List getAgencyTransferCount(String customerId, String monthId, String level); /** * @Description 查询未被退回的项目数 @@ -129,10 +130,11 @@ public interface FactOriginProjectLogDailyService extends BaseService selectProjectAutoNoMy(String customerId,String monthId); + + /** + * 办结项目满意度 + * @author zhaoqifeng + * @date 2020/9/20 16:43 + * @param customerId + * @param monthId + * @param level + * @return java.util.List + */ + List getSatisfaction(String customerId, String monthId, String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java index 338418717b..2b8e9f629a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java @@ -127,17 +127,19 @@ public interface FactOriginProjectMainDailyService extends BaseService */ - List getOverdueCount(String monthId); + List getOverdueCount(String customerId, String monthId); /** * 根据日期删除数据 * @author zhaoqifeng * @date 2020/9/18 17:30 + * @param customerId * @param date * @return void */ - void deleteByDate(String date); + void deleteByDate(String customerId, String date); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java index e23ab2e626..a62fdd38e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java @@ -102,8 +102,8 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl getAgencyTransferCount(String monthId, String level) { - return baseDao.selectAgencyTransferCount(monthId, level); + public List getAgencyTransferCount(String customerId, String monthId, String level) { + return baseDao.selectAgencyTransferCount(customerId, monthId, level); } /** @@ -131,8 +131,8 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl getSatisfaction(String customerId, String monthId, String level) { + return baseDao.selectSatisfaction(customerId, monthId, level); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java index 1358c2fdc4..3e42dfd1fb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java @@ -109,8 +109,8 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl getOverdueCount(String monthId) { - return baseDao.selectOverdueCount(monthId); + public List getOverdueCount(String customerId, String monthId) { + return baseDao.selectOverdueCount(customerId, monthId); } /** @@ -127,8 +127,8 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl closedList = projectProcessService.getClosedProjectList(customerId, dateString); List pendingList = factOriginProjectMainDailyService.getPendingList(customerId); + List finishOrgList= projectProcessService.getFinishOrg(customerId, dateString); if (null != closedList && !closedList.isEmpty()) { List closeProjects = pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { @@ -85,6 +87,17 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { entity.setUpdatedTime(process.getUpdatedTime()); return entity; })).collect(Collectors.toList()); + + if (null != finishOrgList && !finishOrgList.isEmpty()) { + closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { + String[] orgIds = dto.getPIdPath().split(":"); + if (orgIds.length > NumConstant.ONE) { + close.setFinishOrgIds(orgIds[orgIds.length - 1]); + } else { + close.setFinishOrgIds(orgIds[0]); + } + })); + } //更新状态 if (!closeProjects.isEmpty()) { factOriginProjectMainDailyService.updateBatchById(closeProjects); @@ -141,9 +154,17 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { list.forEach(entity -> partyMemberList.stream().filter(partyMemberDTO -> partyMemberDTO.getGridId().equals(entity.getGridId()) && partyMemberDTO.getUserId().equals(entity.getTopicCreatorId())).forEach(partyMember -> { entity.setIsParty(NumConstant.ONE_STR); })); + list.forEach(entity -> finishOrgList.stream().filter(finish -> entity.getId().equals(finish.getProjectId())).forEach(dto -> { + String[] orgIds = dto.getPIdPath().split(":"); + if (orgIds.length > NumConstant.ONE) { + entity.setFinishOrgIds(orgIds[orgIds.length - 1]); + } else { + entity.setFinishOrgIds(orgIds[0]); + } + })); //插入数据 if (!list.isEmpty()) { - factOriginProjectMainDailyService.deleteByDate(dateString); + factOriginProjectMainDailyService.deleteByDate(customerId, dateString); factOriginProjectMainDailyService.insertBatch(list); } } @@ -222,7 +243,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { }).collect(Collectors.toList())); if (!logList.isEmpty()) { - factOriginProjectLogDailyService.deleteByDate(dateString); + factOriginProjectLogDailyService.deleteByDate(customerId, dateString); factOriginProjectLogDailyService.insertBatch(logList); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java new file mode 100644 index 0000000000..c2e3b3a179 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java @@ -0,0 +1,22 @@ +package com.epmet.service.evaluationindex.indexcoll; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/20 20:29 + */ +public interface FactIndexGovrnAblityOrgMonthlyService extends BaseService { + /** + * 根据客户清空数据 + * @author zhaoqifeng + * @date 2020/9/20 20:33 + * @param customerId + * @param monthId + * @param type + * @return void + */ + void deleteByCustomer(String customerId, String monthId, String type); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java index 26e46a623f..40fd419333 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java @@ -12,8 +12,20 @@ public interface IndexCollCommunityService { * * @author zhaoqifeng * @date 2020/9/18 13:52 - * @param + * @param customerId + * @param dateId * @return void */ - void saveCommunityAbility(); + void saveCommunityAbility(String customerId, String dateId); + + /** + * 社区党建能力统计 + * + * @author zhaoqifeng + * @date 2020/9/18 13:52 + * @param customerId + * @param dateId + * @return void + */ + void saveCommunityPartyAbility(String customerId, String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollStreetService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollStreetService.java index 2266a52369..a38bff296d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollStreetService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollStreetService.java @@ -7,4 +7,14 @@ package com.epmet.service.evaluationindex.indexcoll; * @date 2020/9/18 10:35 */ public interface IndexCollStreetService { + /** + * 街道治理能力统计 + * + * @author zhaoqifeng + * @date 2020/9/18 13:52 + * @param customerId + * @param dateId + * @return void + */ + void saveStreetAbility(String customerId, String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java new file mode 100644 index 0000000000..a1665b836c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java @@ -0,0 +1,23 @@ +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; +import org.springframework.stereotype.Service; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/20 20:29 + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class FactIndexGovrnAblityOrgMonthlyServiceImpl extends BaseServiceImpl implements FactIndexGovrnAblityOrgMonthlyService { + @Override + public void deleteByCustomer(String customerId, String monthId, String type) { + baseDao.deleteByCustomer(customerId, monthId, type); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java index 4fcf0bcaff..73e99caaa0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java @@ -1,21 +1,30 @@ package com.epmet.service.evaluationindex.indexcoll.impl; 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.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollCommunityService; +import com.epmet.service.stats.DimAgencyService; import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * @author zhaoqifeng @@ -27,7 +36,9 @@ import java.util.List; @DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexCollCommunityServiceImpl implements IndexCollCommunityService { @Autowired - private FactIndexGovrnAblityOrgMonthlyDao factIndexGovrnAblityOrgMonthlyDao; + private DimAgencyService dimAgencyService; + @Autowired + private FactIndexGovrnAblityOrgMonthlyService factIndexGovrnAblityOrgMonthlyService; @Autowired private FactOriginProjectLogDailyService factOriginProjectLogDailyService; @Autowired @@ -36,19 +47,90 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService private FactOriginProjectMainDailyService factOriginProjectMainDailyService; @Override - public void saveCommunityAbility() { + public void saveCommunityAbility(String customerId, String dateId) { //当前日期前一天 - Date date = DateUtils.getBeforeDay(new Date()); + Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); //获取日期相关维度 DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + //获取社区列表 + ListagencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.COMMUNITY); + //社区数据初始化 + List list = agencyList.stream().map(agency ->{ + FactIndexGovrnAblityOrgMonthlyEntity entity = new FactIndexGovrnAblityOrgMonthlyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setParentId(agency.getPid()); + entity.setYearId(dimId.getYearId()); + entity.setQuarterId(dimId.getQuarterId()); + entity.setMonthId(dimId.getMonthId()); + entity.setDataType(OrgTypeConstant.COMMUNITY); + entity.setTransferedCount(NumConstant.ZERO); + entity.setClosedProjectCount(NumConstant.ZERO); + entity.setRespProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setOverdueProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setClosedProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setSatisfactionRatio(new BigDecimal(NumConstant.ZERO)); + entity.setHandleProjectRatio(new BigDecimal(NumConstant.ZERO)); + return entity; + }).collect(Collectors.toList()); + //被吹哨次数统计 - List transferCount = factOriginProjectLogDailyService.getAgencyTransferCount(dimId.getMonthId(), "community"); + List transferCount = factOriginProjectLogDailyService.getAgencyTransferCount(customerId, dimId.getMonthId(), + OrgTypeConstant.COMMUNITY); + if (null != transferCount && !transferCount.isEmpty()) { + list.forEach(entity -> transferCount.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(count -> { + entity.setTransferedCount(count.getCount()); + })); + } + //社区项目响应度 -// List responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(dimId.getMonthId(), "community", -// "agency"); + List responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(customerId, dimId.getMonthId(), + OrgTypeConstant.COMMUNITY, OrgTypeConstant.AGENCY); + if (null != responsiveness && !responsiveness.isEmpty()) { + list.forEach(entity -> responsiveness.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(response -> { + if (response.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(response.getCount()); + BigDecimal sum = new BigDecimal(response.getSum()); + entity.setRespProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + //社区超期项目率 - List overdueCount = factOriginProjectMainDailyService.getOverdueCount(dimId.getMonthId()); + List overdueCount = factOriginProjectMainDailyService.getOverdueCount(customerId, dimId.getMonthId()); + if (null != overdueCount && !overdueCount.isEmpty()) { + list.forEach(entity -> overdueCount.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(overdue -> { + if (overdue.getSum() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(overdue.getCount()); + BigDecimal sum = new BigDecimal(overdue.getSum()); + entity.setOverdueProjectRatio(count.divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + //社区办结项目满意度 + List satisfaction = factOriginProjectLogDailyService.getSatisfaction(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); + if (null != satisfaction && !satisfaction.isEmpty()) { + list.forEach(entity -> satisfaction.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(sa -> { + if (sa.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(sa.getCount()); + BigDecimal sum = new BigDecimal(sa.getSum()); + entity.setOverdueProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); + factIndexGovrnAblityOrgMonthlyService.insertBatch(list); + } + @Override + public void saveCommunityPartyAbility(String customerId, String dateId) { + //当前日期前一天 + Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + //获取日期相关维度 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + //获取社区列表 + ListagencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.COMMUNITY); + //获取社区发文数量 } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java index 09ceaf6188..8f32d7507a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java @@ -1,11 +1,30 @@ package com.epmet.service.evaluationindex.indexcoll.impl; 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.constant.OrgTypeConstant; +import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.stats.DimAgencyDTO; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; +import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; +import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollStreetService; +import com.epmet.service.stats.DimAgencyService; +import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + /** * @author zhaoqifeng * @dscription @@ -15,4 +34,78 @@ import org.springframework.stereotype.Service; @Slf4j @DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexCollStreetServiceImpl implements IndexCollStreetService { + @Autowired + private DimAgencyService dimAgencyService; + @Autowired + private FactIndexGovrnAblityOrgMonthlyService factIndexGovrnAblityOrgMonthlyService; + @Autowired + private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + @Autowired + private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; + @Autowired + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Override + public void saveStreetAbility(String customerId, String dateId) { + //当前日期前一天 + Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + //获取日期相关维度 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + //获取社区列表 + ListagencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.STREET); + //社区数据初始化 + List list = agencyList.stream().map(agency ->{ + FactIndexGovrnAblityOrgMonthlyEntity entity = new FactIndexGovrnAblityOrgMonthlyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(agency.getId()); + entity.setParentId(agency.getPid()); + entity.setYearId(dimId.getYearId()); + entity.setQuarterId(dimId.getQuarterId()); + entity.setMonthId(dimId.getMonthId()); + entity.setDataType(OrgTypeConstant.STREET); + entity.setTransferedCount(NumConstant.ZERO); + entity.setClosedProjectCount(NumConstant.ZERO); + entity.setRespProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setOverdueProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setClosedProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setSatisfactionRatio(new BigDecimal(NumConstant.ZERO)); + entity.setHandleProjectRatio(new BigDecimal(NumConstant.ZERO)); + return entity; + }).collect(Collectors.toList()); + + //被吹哨次数统计 + List transferCount = factOriginProjectLogDailyService.getAgencyTransferCount(customerId, dimId.getMonthId(), + OrgTypeConstant.STREET); + if (null != transferCount && !transferCount.isEmpty()) { + list.forEach(entity -> transferCount.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(count -> { + entity.setTransferedCount(count.getCount()); + })); + } + + //社区项目响应度 + List responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(customerId, dimId.getMonthId(), + OrgTypeConstant.STREET, OrgTypeConstant.AGENCY); + if (null != responsiveness && !responsiveness.isEmpty()) { + list.forEach(entity -> responsiveness.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(response -> { + if (response.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(response.getCount()); + BigDecimal sum = new BigDecimal(response.getSum()); + entity.setRespProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + + //社区办结项目满意度 + List satisfaction = factOriginProjectLogDailyService.getSatisfaction(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); + if (null != satisfaction && !satisfaction.isEmpty()) { + list.forEach(entity -> satisfaction.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(sa -> { + if (sa.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(sa.getCount()); + BigDecimal sum = new BigDecimal(sa.getSum()); + entity.setOverdueProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); + factIndexGovrnAblityOrgMonthlyService.insertBatch(list); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java index 42def9affd..b6b0f70269 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java @@ -18,6 +18,7 @@ package com.epmet.service.project; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.project.FinishOrgDTO; import com.epmet.dto.project.ProcessInfoDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; import com.epmet.entity.project.ProjectEntity; @@ -90,4 +91,14 @@ public interface ProjectProcessService extends BaseService * @date 2020.09.18 13:38 **/ List getProjectPeriod(Boolean isFirst,String customerId,String date); + + /** + * 获取办结组织 + * @author zhaoqifeng + * @date 2020/9/20 21:11 + * @param customerId + * @param date + * @return java.util.List + */ + List getFinishOrg(String customerId, String date); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java index fdf84a48e5..6d4f47d76c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.project.ProjectProcessDao; import com.epmet.dto.form.CommonStaffIdFormDTO; +import com.epmet.dto.project.FinishOrgDTO; import com.epmet.dto.project.ProcessInfoDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; import com.epmet.dto.project.result.ProjectOrgRelationWhenResponseResultDTO; @@ -117,6 +118,11 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl(); } + @Override + public List getFinishOrg(String customerId, String date) { + return baseDao.selectFinishOrg(customerId, date); + } + /** * @Description 跨级分组 eg -> transfer ; response response transfer ; return ; response close. * @param dest - Map> 需要填充的数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index aad2cae314..e22b42c609 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java @@ -25,6 +25,7 @@ import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.stats.DimAgencyEntity; +import javax.xml.soap.SAAJResult; import java.util.Date; import java.util.List; import java.util.Map; @@ -176,4 +177,14 @@ public interface DimAgencyService extends BaseService { DimAgencyEntity getLatestCreatedAgencyDimEntity(); DimAgencyEntity getLatestUpdatedAgencyDimEntity(); + + /** + * 根据级别获取组织信息 + * @author zhaoqifeng + * @date 2020/9/20 17:29 + * @param customerId + * @param level + * @return java.util.List + */ + List getAgencyByLevel(String customerId, String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index ee4c56db29..f0f530fa4f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -276,4 +276,9 @@ public class DimAgencyServiceImpl extends BaseServiceImpl getAgencyByLevel(String customerId, String level) { + return baseDao.selectDimAgencyByLevel(customerId, level); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index cfb6ff85b7..6047bc9726 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -5,8 +5,9 @@ DELETE FROM fact_origin_project_log_daily + WHERE + CUSTOMER_ID = #{customerId} - WHERE DATE_ID = #{date} @@ -24,6 +25,7 @@ fopld.IS_ACTIVE = 0 AND fopld.ACTION_CODE = 'transfer' AND fopld.MONTH_ID = #{monthId} + AND fopld.CUSTOMER_ID = #{customerId} GROUP BY fopld.CUSTOMER_ID, fopld.AGENCY_ID @@ -84,5 +86,34 @@ OR l.ACTION_CODE = 'unresolved' OR l.ACTION_CODE = 'created') + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index 81472beb65..7dee1c7ccf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -61,8 +61,9 @@ INNER JOIN dim_agency da ON f.AGENCY_ID = da.ID AND da.`LEVEL` = 'community' WHERE - f.IS_OVERDUE = 0 + f.PROJECT_STATUS = 'closed' AND f.MONTH_ID = #{monthId} + AND f.CUSTOMER_ID = #{customerId} GROUP BY f.CUSTOMER_ID, f.AGENCY_ID @@ -78,7 +79,9 @@ AND da.`LEVEL` = 'community' WHERE f.IS_OVERDUE = 1 + AND f.PROJECT_STATUS = 'closed' AND f.MONTH_ID = #{monthId} + AND f.CUSTOMER_ID = #{customerId} GROUP BY f.CUSTOMER_ID, f.AGENCY_ID @@ -102,8 +105,9 @@ DELETE FROM fact_origin_project_main_daily + WHERE + CUSTOMER_ID = #{customerId} - WHERE DATE_ID = #{date} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index a642ff1f56..20f45783a4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -58,6 +58,7 @@ f.ORG_TYPE = #{orgType} AND DATE_FORMAT(INFORMED_DATE, '%Y%m') = #{monthId} AND PERIOD_TILL_REPLY_FIRSTLY != 0 + AND f.CUSTOMER_ID = #{customerId} GROUP BY f.CUSTOMER_ID, f.ORG_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml index eb9a582759..4644c01b11 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml @@ -33,6 +33,12 @@ AND MONTH_ID = #{monthId} limit 1000; + + delete from fact_index_govrn_ablity_org_monthly + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + AND DATA_TYPE = #{type} + insert into fact_index_govrn_ablity_org_monthly diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml index be19516363..48bf09f1c2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml @@ -144,11 +144,11 @@ ) ORDER BY process.STAFF_ID , process.CREATED_TIME ASC - SELECT a.PROJECT_ID, a.ORG_ID_PATH, - b.ORG_ID_PATH + b.ORG_ID_PATH AS pIdPath FROM ( SELECT @@ -161,12 +161,19 @@ AND pp.PROJECT_ID = ps.PROJECT_ID AND ps.IS_HANDLE = 'handle' AND pp.CREATED_TIME = ps.UPDATED_TIME + AND ps.CUSTOMER_ID = #{customerId} WHERE pp.OPERATION = 'close' + + AND pp.CREATED_TIME = #{date} + + ) a LEFT JOIN ( SELECT PROJECT_ID, ORG_ID_PATH, MIN( LENGTH( ORG_ID_PATH )) - FROM project_staff GROUP BY PROJECT_ID + FROM project_staff + WHERE CUSTOMER_ID = #{customerId} + GROUP BY PROJECT_ID ) b ON a.PROJECT_ID = b.PROJECT_ID \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index 357265ee82..58dbc205d9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -315,5 +315,20 @@ ) + \ No newline at end of file