Browse Source

治理能力统计

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
29eac44df5
  1. 20
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/FinishOrgDTO.java
  2. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java
  3. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  4. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java
  5. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java
  6. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java
  7. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java
  8. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectLogDailyService.java
  9. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectMainDailyService.java
  10. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java
  11. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java
  12. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectExtractServiceImpl.java
  13. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java
  14. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollCommunityService.java
  15. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollStreetService.java
  16. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java
  17. 96
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java
  18. 93
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java
  19. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java
  20. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java
  21. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java
  22. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java
  23. 33
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml
  24. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  25. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml
  26. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml
  27. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml
  28. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml

20
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;
}

19
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<FactOriginProjectL
* 机关被吹哨次数
* @author zhaoqifeng
* @date 2020/9/18 14:46
* @param customerId
* @param monthId
* @param level
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> selectAgencyTransferCount(@Param("monthId") String monthId, @Param("level")String level);
List<OrgStatisticsResultDTO> selectAgencyTransferCount(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("level")String level);
/**
* @Description 查询未被退回的项目数
@ -77,8 +79,21 @@ public interface FactOriginProjectLogDailyDao extends BaseDao<FactOriginProjectL
* 根据日期删除数据
* @author zhaoqifeng
* @date 2020/9/18 17:32
* @param customerId
* @param date
* @return void
*/
void deleteByDate(@Param("date") String date);
void deleteByDate(@Param("customerId") String customerId, @Param("date") String date);
/**
* 办结项目满意度
* @author zhaoqifeng
* @date 2020/9/20 16:44
* @param customerId
* @param monthId
* @param level
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> selectSatisfaction(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("level")String level);
}

6
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<FactOriginProject
* 项目超期数
* @author zhaoqifeng
* @date 2020/9/18 16:28
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> selectOverdueCount(@Param("monthId") String monthId);
List<OrgStatisticsResultDTO> selectOverdueCount(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* @Description 网格办结项目数
@ -77,8 +78,9 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
* 根据日期删除数据
* @author zhaoqifeng
* @date 2020/9/18 17:32
* @param customerId
* @param date
* @return void
*/
void deleteByDate(@Param("date") String date);
void deleteByDate(@Param("customerId") String customerId, @Param("date") String date);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -55,13 +56,16 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao<FactOriginPr
* 获取项目响应度
* @author zhaoqifeng
* @date 2020/9/18 15:52
* @param customerId
* @param monthId
* @param level
* @param orgType
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
// List<OrgStatisticsResultDTO> selectResponsiveness(@Param("monthId") String monthId, @Param("level")String level,
// @Param("orgType")String orgType);
List<OrgStatisticsResultDTO> selectResponsiveness(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("level")String level,
@Param("orgType")String orgType);
void deleteByProjectId(@Param("list") List<String> list);
/**

11
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<FactIndexGovr
* @date 2020/8/26 1:40 下午
*/
List<Map<String,Object>> 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);
}

5
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<ProjectProcessEntity> {
* @date 2020/9/18 18:01
* @param customerId
* @param date
* @return java.util.List<com.epmet.entity.project.ProjectProcessEntity>
* @return java.util.List<com.epmet.dto.project.FinishOrgDTO>
*/
List<ProjectProcessEntity> selectFinishOrg(@Param("customerId") String customerId, @Param("date") String date);
List<FinishOrgDTO> selectFinishOrg(@Param("customerId") String customerId, @Param("date") String date);
}

10
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<DimAgencyEntity> {
* @date 2020/9/15 6:15 下午
*/
List<AgencyInfoResultDTO> selectAgencyInfo(@Param("agencyIds")List<String> agencyIds);
/**
* 根据级别获取组织信息
* @author zhaoqifeng
* @date 2020/9/20 17:31
* @param customerId
* @param level
* @return java.util.List<com.epmet.dto.stats.DimAgencyDTO>
*/
List<DimAgencyDTO> selectDimAgencyByLevel(@Param("customerId")String customerId, @Param("level")String level);
}

17
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<FactOrigin
* 机关被吹哨次数
* @author zhaoqifeng
* @date 2020/9/18 14:53
* @param customerId
* @param monthId
* @param level
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getAgencyTransferCount(String monthId, String level);
List<OrgStatisticsResultDTO> getAgencyTransferCount(String customerId, String monthId, String level);
/**
* @Description 查询未被退回的项目数
@ -129,10 +130,11 @@ public interface FactOriginProjectLogDailyService extends BaseService<FactOrigin
* 根据日期删除数据
* @author zhaoqifeng
* @date 2020/9/18 17:30
* @param customerId
* @param date
* @return void
*/
void deleteByDate(String date);
void deleteByDate(String customerId, String date);
/**
* @Description 网格项目自治率查询
@ -142,4 +144,15 @@ public interface FactOriginProjectLogDailyService extends BaseService<FactOrigin
* @date 2020/9/18 5:25 下午
*/
List<AutoNoMyResultDTO> selectProjectAutoNoMy(String customerId,String monthId);
/**
* 办结项目满意度
* @author zhaoqifeng
* @date 2020/9/20 16:43
* @param customerId
* @param monthId
* @param level
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getSatisfaction(String customerId, String monthId, String level);
}

6
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<FactOrigi
* 项目超期数
* @author zhaoqifeng
* @date 2020/9/18 16:29
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getOverdueCount(String monthId);
List<OrgStatisticsResultDTO> 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);
}

13
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<FactOr
}
@Override
public List<OrgStatisticsResultDTO> getAgencyTransferCount(String monthId, String level) {
return baseDao.selectAgencyTransferCount(monthId, level);
public List<OrgStatisticsResultDTO> getAgencyTransferCount(String customerId, String monthId, String level) {
return baseDao.selectAgencyTransferCount(customerId, monthId, level);
}
/**
@ -131,8 +131,8 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
}
@Override
public void deleteByDate(String date) {
baseDao.deleteByDate(date);
public void deleteByDate(String customerId, String date) {
baseDao.deleteByDate(customerId, date);
}
/**
@ -147,4 +147,9 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
return baseDao.selectProjectAutoNoMy(customerId, monthId);
}
@Override
public List<OrgStatisticsResultDTO> getSatisfaction(String customerId, String monthId, String level) {
return baseDao.selectSatisfaction(customerId, monthId, level);
}
}

8
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<FactO
}
@Override
public List<OrgStatisticsResultDTO> getOverdueCount(String monthId) {
return baseDao.selectOverdueCount(monthId);
public List<OrgStatisticsResultDTO> getOverdueCount(String customerId, String monthId) {
return baseDao.selectOverdueCount(customerId, monthId);
}
/**
@ -127,8 +127,8 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
}
@Override
public void deleteByDate(String date) {
baseDao.deleteByDate(date);
public void deleteByDate(String customerId, String date) {
baseDao.deleteByDate(customerId, date);
}
}

25
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectExtractServiceImpl.java

@ -11,6 +11,7 @@ import com.epmet.dto.extract.form.ExtractFormDTO;
import com.epmet.dto.form.WorkDayFormDTO;
import com.epmet.dto.issue.IssueDTO;
import com.epmet.dto.party.PartyMemberDTO;
import com.epmet.dto.project.FinishOrgDTO;
import com.epmet.dto.project.ProcessInfoDTO;
import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO;
import com.epmet.dto.result.WorkDayResultDTO;
@ -75,6 +76,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
//获取已关闭项目列表
List<ProjectProcessEntity> closedList = projectProcessService.getClosedProjectList(customerId, dateString);
List<FactOriginProjectMainDailyDTO> pendingList = factOriginProjectMainDailyService.getPendingList(customerId);
List<FinishOrgDTO> finishOrgList= projectProcessService.getFinishOrg(customerId, dateString);
if (null != closedList && !closedList.isEmpty()) {
List<FactOriginProjectMainDailyEntity> 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);
}
}

22
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<FactIndexGovrnAblityOrgMonthlyEntity> {
/**
* 根据客户清空数据
* @author zhaoqifeng
* @date 2020/9/20 20:33
* @param customerId
* @param monthId
* @param type
* @return void
*/
void deleteByCustomer(String customerId, String monthId, String type);
}

16
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);
}

10
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);
}

23
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<FactIndexGovrnAblityOrgMonthlyDao, FactIndexGovrnAblityOrgMonthlyEntity> implements FactIndexGovrnAblityOrgMonthlyService {
@Override
public void deleteByCustomer(String customerId, String monthId, String type) {
baseDao.deleteByCustomer(customerId, monthId, type);
}
}

96
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);
//获取社区列表
List<DimAgencyDTO>agencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.COMMUNITY);
//社区数据初始化
List<FactIndexGovrnAblityOrgMonthlyEntity> 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<OrgStatisticsResultDTO> transferCount = factOriginProjectLogDailyService.getAgencyTransferCount(dimId.getMonthId(), "community");
List<OrgStatisticsResultDTO> 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<OrgStatisticsResultDTO> responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(dimId.getMonthId(), "community",
// "agency");
List<OrgStatisticsResultDTO> 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<OrgStatisticsResultDTO> overdueCount = factOriginProjectMainDailyService.getOverdueCount(dimId.getMonthId());
List<OrgStatisticsResultDTO> 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<OrgStatisticsResultDTO> 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);
//获取社区列表
List<DimAgencyDTO>agencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.COMMUNITY);
//获取社区发文数量
}
}

93
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);
//获取社区列表
List<DimAgencyDTO>agencyList = dimAgencyService.getAgencyByLevel(customerId, OrgTypeConstant.STREET);
//社区数据初始化
List<FactIndexGovrnAblityOrgMonthlyEntity> 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<OrgStatisticsResultDTO> 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<OrgStatisticsResultDTO> 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<OrgStatisticsResultDTO> 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);
}
}

11
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<ProjectProcessEntity>
* @date 2020.09.18 13:38
**/
List<ProjectOrgPeriodResultDTO> getProjectPeriod(Boolean isFirst,String customerId,String date);
/**
* 获取办结组织
* @author zhaoqifeng
* @date 2020/9/20 21:11
* @param customerId
* @param date
* @return java.util.List<com.epmet.dto.project.FinishOrgDTO>
*/
List<FinishOrgDTO> getFinishOrg(String customerId, String date);
}

6
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<ProjectProcessDao
return new ArrayList<>();
}
@Override
public List<FinishOrgDTO> getFinishOrg(String customerId, String date) {
return baseDao.selectFinishOrg(customerId, date);
}
/**
* @Description 跨级分组 eg -> transfer ; response response transfer ; return ; response close.
* @param dest - Map<String,List<ProjectOrgPeriodResultDTO>> 需要填充的数据

11
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> {
DimAgencyEntity getLatestCreatedAgencyDimEntity();
DimAgencyEntity getLatestUpdatedAgencyDimEntity();
/**
* 根据级别获取组织信息
* @author zhaoqifeng
* @date 2020/9/20 17:29
* @param customerId
* @param level
* @return java.util.List<com.epmet.dto.stats.DimAgencyDTO>
*/
List<DimAgencyDTO> getAgencyByLevel(String customerId, String level);
}

5
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<DimAgencyDao, DimAgenc
return baseDao.getLatestUpdatedAgencyDimEntity();
}
@Override
public List<DimAgencyDTO> getAgencyByLevel(String customerId, String level) {
return baseDao.selectDimAgencyByLevel(customerId, level);
}
}

33
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml

@ -5,8 +5,9 @@
<delete id="deleteByDate">
DELETE FROM
fact_origin_project_log_daily
WHERE
CUSTOMER_ID = #{customerId}
<if test='null != date and "" != date'>
WHERE
DATE_ID = #{date}
</if>
</delete>
@ -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')
</select>
<select id="selectSatisfaction" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
AGENCY_ID,
COUNT( ID ) AS "count",
SUM( IFNULL( b.score, 0 ) ) AS "sum"
FROM
( SELECT f.ID, f.AGENCY_ID FROM fact_origin_project_main_daily f
INNER JOIN dim_agency da ON f.FINISH_ORG_IDS LIKE concat('%', da.ID, '%')
AND da.AGENCY_DIM_TYPE = 'all'
AND da.`LEVEL` = #{level}
AND da.CUSTOMER_ID = #{customerId}
WHERE 1=1
AND f.MONTH_ID = #{monthId}) a
LEFT JOIN (
SELECT
PROJECT_ID,
SUM( CASE ACTION_CODE WHEN 'bad' THEN 60 WHEN 'perfect' THEN 100 ELSE 80 END ) AS score
FROM
fact_origin_project_log_daily
WHERE
(ACTION_CODE = 'bad'
OR ACTION_CODE = 'good'
OR ACTION_CODE = 'perfect')
AND CUSTOMER_ID = #{customerId}
GROUP BY
PROJECT_ID
) b ON a.ID = b.PROJECT_ID
GROUP BY AGENCY_ID
</select>
</mapper>

8
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 id="deleteByDate">
DELETE FROM
fact_origin_project_main_daily
WHERE
CUSTOMER_ID = #{customerId}
<if test='null != date and "" != date'>
WHERE
DATE_ID = #{date}
</if>
</delete>

1
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

6
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>
<delete id="deleteByCustomer">
delete from fact_index_govrn_ablity_org_monthly
where CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND DATA_TYPE = #{type}
</delete>
<insert id="batchInsertFactIndexGovrnAblityOrgMonthly" parameterType="map">
insert into fact_index_govrn_ablity_org_monthly

13
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>
<select id="selectFinishOrg" resultType="com.epmet.entity.project.ProjectProcessEntity">
<select id="selectFinishOrg" resultType="com.epmet.dto.project.FinishOrgDTO">
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'
<if test="date != null and date.trim() != ''">
AND pp.CREATED_TIME = #{date}
</if>
) 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
</select>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml

@ -315,5 +315,20 @@
</foreach>
)
</select>
<select id="selectDimAgencyByLevel" resultType="com.epmet.dto.stats.DimAgencyDTO">
SELECT
id AS id,
customer_id AS customerId,
level AS level,
pid AS pid,
pids AS pids
FROM
dim_agency
WHERE
del_flag = '0'
AND AGENCY_DIM_TYPE = 'all'
AND customer_id = #{customerId}
AND LEVEL = #{level}
</select>
</mapper>
Loading…
Cancel
Save