Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_screen_data_2.0

master
yinzuomei 5 years ago
parent
commit
6a1f5bab0a
  1. 28
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java
  2. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  3. 8
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java
  4. 30
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
  5. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  6. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  7. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java
  8. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java
  9. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java
  10. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  11. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  12. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java
  13. 69
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java
  14. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  15. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  16. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  17. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  18. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  19. 97
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  20. 9
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

28
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/fact/FactIndexController.java

@ -28,78 +28,78 @@ public class FactIndexController {
private FactIndexService factIndexService;
/**
* @param tokenDTO
* @param formDTO
* @Description 能力指数
* @author sun
*/
@PostMapping("index/ablityindex")
public Result<List<AblityIndexResultDTO>> ablityIndex(@LoginUser TokenDto tokenDTO, @RequestBody AblityIndexFormDTO formDTO) {
public Result<List<AblityIndexResultDTO>> ablityIndex(@RequestBody AblityIndexFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AblityIndexFormDTO.AddUserInternalGroup.class);
return new Result<List<AblityIndexResultDTO>>().ok(factIndexService.ablityIndex(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 按月份查询各项能力分数
* @author sun
*/
@PostMapping("index/scorelist")
public Result<List<ScoreListResultDTO>> scoreList(@LoginUser TokenDto tokenDTO, @RequestBody ScoreListFormDTO formDTO) {
public Result<List<ScoreListResultDTO>> scoreList(@RequestBody ScoreListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ScoreListFormDTO.AddUserInternalGroup.class);
return new Result<List<ScoreListResultDTO>>().ok(factIndexService.scoreList(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 按月份查询各项能力最近12个月得分
* @author sun
*/
@PostMapping("index/monthscorelist")
public Result<List<MonthScoreListResultDTO>> monthScoreList(@LoginUser TokenDto tokenDTO, @RequestBody MonthScoreListFormDTO formDTO) {
public Result<List<MonthScoreListResultDTO>> monthScoreList(@RequestBody MonthScoreListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MonthScoreListFormDTO.AddUserInternalGroup.class);
return new Result<List<MonthScoreListResultDTO>>().ok(factIndexService.monthScoreList(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 按月查询各项指标数据
* @author sun
*/
@PostMapping("index/ablitylist")
public Result<List<AblityListResultDTO>> ablityList(@LoginUser TokenDto tokenDTO, @RequestBody AblityListFormDTO formDTO) {
public Result<List<AblityListResultDTO>> ablityList(@RequestBody AblityListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AblityListFormDTO.AddUserInternalGroup.class);
return new Result<List<AblityListResultDTO>>().ok(factIndexService.ablityList(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 按月查询各项指标最近12个月数据
* @author sun
*/
@PostMapping("index/monthablitylist")
public Result<List<MonthAblityListResultDTO>> monthAblityList(@LoginUser TokenDto tokenDTO, @RequestBody MonthAblityListFormDTO formDTO) {
public Result<List<MonthAblityListResultDTO>> monthAblityList(@RequestBody MonthAblityListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MonthAblityListFormDTO.AddUserInternalGroup.class);
return new Result<List<MonthAblityListResultDTO>>().ok(factIndexService.monthAblityList(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 同级对比各项数据查询
* @author sun
*/
@PostMapping("index/peercomparison")
public Result<List<PeerComparisonResultDTO>> peerComparison(@LoginUser TokenDto tokenDTO, @RequestBody PeerComparisonFormDTO formDTO) {
public Result<List<PeerComparisonResultDTO>> peerComparison(@RequestBody PeerComparisonFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PeerComparisonFormDTO.AddUserInternalGroup.class);
return new Result<List<PeerComparisonResultDTO>>().ok(factIndexService.peerComparison(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 是否根组织
* @author sun
*/
@PostMapping("index/rootagency")
public Result<RootAgencyResultDTO> rootAgency(@LoginUser TokenDto tokenDTO, @RequestBody RootAgencyFormDTO formDTO) {
public Result<RootAgencyResultDTO> rootAgency(@RequestBody RootAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, RootAgencyFormDTO.AddUserInternalGroup.class);
return new Result<RootAgencyResultDTO>().ok(factIndexService.rootAgency(formDTO));
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -103,12 +103,12 @@ public class IndexController {
}
/**
* @param tokenDTO
* @param formDTO
* @Description 组织月度指数得分
* @author sun
*/
@PostMapping("month/indexscore")
public Result<IndexScoreResultDTO> indexScore(@LoginUser TokenDto tokenDTO, @RequestBody IndexScoreFormDTO formDTO) {
public Result<IndexScoreResultDTO> indexScore(@RequestBody IndexScoreFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IndexScoreFormDTO.AddUserInternalGroup.class);
return new Result<IndexScoreResultDTO>().ok(indexService.indexScore(formDTO));
}

8
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenUserController.java

@ -30,23 +30,23 @@ public class ScreenUserController {
private ScreenUserService screenUserService;
/**
* @param tokenDTO
* @param formDTO
* @Description 热心市民积分排行列表
* @author sun
*/
@PostMapping("userpointrank")
public Result<List<UserPointRankListResultDTO>> userPointRank(@LoginUser TokenDto tokenDTO, @RequestBody UserPointRankFormDTO formDTO) {
public Result<List<UserPointRankListResultDTO>> userPointRank(@RequestBody UserPointRankFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UserPointRankFormDTO.AddUserInternalGroup.class);
return new Result<List<UserPointRankListResultDTO>>().ok(screenUserService.userPointRank(formDTO));
}
/**
* @param tokenDTO
* @param formDTO
* @Description 党员指标得分排行
* @author sun
*/
@PostMapping("partindexscroerank")
public Result<List<PartIndexScroeRankResultDTO>> partIndexScroeRank(@LoginUser TokenDto tokenDTO, @RequestBody PartIndexScroeRankFormDTO formDTO) {
public Result<List<PartIndexScroeRankResultDTO>> partIndexScroeRank(@RequestBody PartIndexScroeRankFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PartIndexScroeRankFormDTO.AddUserInternalGroup.class);
return new Result<List<PartIndexScroeRankResultDTO>>().ok(screenUserService.partIndexScroeRank(formDTO));
}

30
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java

@ -19,6 +19,7 @@ import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
/**
* 数据改版api
@ -447,6 +448,9 @@ public class FactIndexServiceImpl implements FactIndexService {
* @author sun
*/
public String getDate(String newDate) {
if (!validDateEffecitive(newDate)) {
throw new RenException(String.format("monthId格式错误,monthId:%s", newDate));
}
String date = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
try {
@ -460,6 +464,32 @@ public class FactIndexServiceImpl implements FactIndexService {
return date;
}
/**
* @param newDate
* @Description 校验日期格式是否正确
* @author sun
*/
public boolean validDateEffecitive(String newDate) {
//yyyy-MM-dd格式
//String DATE_REGEX = "^([1-9]\\d{3}-)(([0]{0,1}[1-9]-)|([1][0-2]-))(([0-3]{0,1}[0-9]))$";
//yyyymm格式
String DATE_REGEX = "^([1-9]\\d{3})(([0]{0,1}[1-9])|([1][0-2]))$";
boolean matches = Pattern.matches(DATE_REGEX, newDate);
if (!matches) {
return matches;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyymm");
//设置日期格式转的严谨性
sdf.setLenient(false);
try {
sdf.parse(newDate);
} catch (ParseException e) {
e.printStackTrace();
return false;
}
return matches;
}
/**
* @param formDTO
* @Description 同级对比各项数据查询

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java

@ -22,6 +22,7 @@ import com.epmet.dto.extract.FactOriginProjectMainDailyDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -169,6 +170,16 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
*/
List<OrgStatisticsResultDTO> getGridResolveProject(@Param("customerId") String customerId, @Param("monthId")String monthId);
/**
* @Description 查询难点赌点的基本信息要排除之前已经结案过的项目
* @param customerId
* @param list
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.09.28 10:19
*/
List<ScreenDifficultyDataEntity> selectDifficultyBaseInfo(@Param("customerId")String customerId,@Param("list")List<String> list);
/**
* 网格解决项目数

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java

@ -94,4 +94,13 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
* @return java.util.List<com.epmet.dto.project.ProjectInfoDTO>
*/
List<ProjectDTO> selectProjectInfo(@Param("customerId") String customerId, @Param("date") String date);
/**
* 获取用户可滞留天数
* @author zhaoqifeng
* @date 2020/9/28 10:16
* @param customerId
* @return java.lang.String
*/
String selectParameterValueByKey(@Param("customerId") String customerId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java

@ -26,6 +26,7 @@ import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
@ -143,7 +144,8 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService
entity.setClosedProjectRatio(BigDecimal.ZERO);
}
//办结效率
entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId()));
entity.setHandleProjectRatio(Optional.ofNullable(efficiencyMap.get(entity.getAgencyId())).orElse(BigDecimal.ZERO));
});
factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY);

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollStreetServiceImpl.java

@ -26,6 +26,7 @@ import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
@ -125,14 +126,16 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService {
BigDecimal element = new BigDecimal(entity.getClosedProjectCount());
//分母,即机关参与过的项目数(去重)
Integer denominator = agencyParticipatedCount.get(entity.getAgencyId());
if (agencyParticipatedCount.get(entity.getAgencyId()) != NumConstant.ZERO) {
if (null != denominator && denominator != NumConstant.ZERO) {
//办结率
entity.setClosedProjectRatio(
element.divide(new BigDecimal(denominator), NumConstant.SIX, RoundingMode.HALF_UP)
);
}else{
entity.setClosedProjectRatio(BigDecimal.ZERO);
}
//办结效率
entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId()));
entity.setHandleProjectRatio(Optional.ofNullable(efficiencyMap.get(entity.getAgencyId())).orElse(BigDecimal.ZERO));
});
factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET);

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java

@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -52,7 +53,7 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService
String monthId = formDTO.getMonthId();
String customerId = formDTO.getCustomerId();
if (StringUtils.isBlank(monthId)) {
monthId = DimIdGenerator.getDateDimId(DateUtils.addDateMonths(new Date(), -1));
monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX);
}
List<String> customerIds = new ArrayList<>();
if (StringUtils.isNotBlank(customerId)) {

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java

@ -23,6 +23,7 @@ import com.epmet.dto.extract.FactOriginProjectMainDailyDTO;
import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity;
import java.util.List;
import java.util.Map;
@ -237,4 +238,14 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getOrgProjectCount(String customerId, String monthId, String level);
/**
* @Description 查询难点赌点基础信息
* @param customerId
* @param list
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.09.28 10:23
*/
List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId , List<String> list);
}

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java

@ -31,6 +31,7 @@ import com.epmet.dto.extract.FactOriginProjectMainDailyDTO;
import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -223,4 +224,17 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
public List<OrgStatisticsResultDTO> getOrgProjectCount(String customerId, String monthId, String level) {
return baseDao.getOrgProjectCount(customerId, monthId, level);
}
/**
* @Description 查询难点赌点基础信息
* @param customerId
* @param list
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity>
* @author wangc
* @date 2020.09.28 10:23
*/
@Override
public List<ScreenDifficultyDataEntity> getDifficultyBaseInfo(String customerId, List<String> list) {
return null;
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
@ -101,6 +102,11 @@ public class GroupExtractServiceImpl implements GroupExtractService {
group.setAgencyId(attr.getAgencyId());
group.setParentId(attr.getParentId());
group.setPids(attr.getPids());
if(StringUtils.isBlank(group.getPids().trim()) || NumConstant.ZERO_STR.equals(group.getPids().trim())){
group.setPids(group.getAgencyId());
}else{
group.setPids(group.getPids().concat(StrConstant.COLON).concat(group.getAgencyId()));
}
}
if(null != group.getCreatedTime()){
DimIdGenerator.DimIdBean dateInfo = DimIdGenerator.getDimIdBean(group.getCreatedTime());
@ -124,6 +130,11 @@ public class GroupExtractServiceImpl implements GroupExtractService {
member.setAgencyId(attr.getAgencyId());
member.setParentId(attr.getParentId());
member.setPids(attr.getPids());
if(StringUtils.isBlank(member.getPids().trim()) || NumConstant.ZERO_STR.equals(member.getPids().trim())){
member.setPids(member.getAgencyId());
}else{
member.setPids(member.getPids().concat(StrConstant.COLON).concat(member.getAgencyId()));
}
}
memberList.add(member);
});

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

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
@ -71,6 +72,8 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
@Autowired
private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao;
private final static String ONE_DAY = "<1";
@Override
public void saveOriginProjectDaily(ExtractOriginFormDTO extractOriginFormDTO) {
String dateString = extractOriginFormDTO.getDateId();
@ -80,7 +83,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()) {
if (CollectionUtils.isEmpty(closedList)) {
List<FactOriginProjectMainDailyEntity> closeProjects =
pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> {
FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity();
@ -92,9 +95,9 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
return entity;
})).collect(Collectors.toList());
if (null != finishOrgList && !finishOrgList.isEmpty()) {
if (CollectionUtils.isEmpty(finishOrgList)) {
closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> {
String[] orgIds = dto.getPIdPath().split(":");
String[] orgIds = dto.getPIdPath().split(StrConstant.COLON);
if (orgIds.length > NumConstant.ONE) {
close.setFinishOrgIds(orgIds[orgIds.length - 1]);
} else {
@ -109,7 +112,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
}
//获取项目信息
List<ProjectDTO> projectList = projectService.getProjectInfo(customerId, dateString);
if (null != projectList && !projectList.isEmpty()) {
if (CollectionUtils.isEmpty(projectList)) {
//提取议题ID
List<String> issueIds = projectList.stream().map(ProjectDTO::getOriginId).collect(Collectors.toList());
//获取议题信息
@ -139,7 +142,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setCreatedTime(project.getCreatedTime());
entity.setUpdatedTime(project.getUpdatedTime());
entity.setPids(project.getOrgIdPath());
String[] pIds = project.getOrgIdPath().split(":");
String[] pIds = project.getOrgIdPath().split(StrConstant.COLON);
if (pIds.length > 1) {
entity.setPid(pIds[pIds.length - 2]);
} else if(pIds.length == 1){
@ -163,7 +166,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setIsParty(NumConstant.ONE_STR);
}));
list.forEach(entity -> finishOrgList.stream().filter(finish -> entity.getId().equals(finish.getProjectId())).forEach(dto -> {
String[] orgIds = dto.getPIdPath().split(":");
String[] orgIds = dto.getPIdPath().split(StrConstant.COLON);
if (orgIds.length > NumConstant.ONE) {
entity.setFinishOrgIds(orgIds[orgIds.length - 1]);
} else {
@ -179,7 +182,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
final List<FactOriginProjectMainDailyEntity> mainList = list;
//节点发起人
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString);
if (null != processList && !processList.isEmpty()) {
if (CollectionUtils.isEmpty(processList)) {
List<FactOriginProjectLogDailyEntity> logList = processList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
@ -204,15 +207,15 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(":")){
if(!process.getPids().contains(StrConstant.COLON)){
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
String[] orgArray = process.getPids().split(":");
if(null != orgArray && orgArray.length > NumConstant.ONE){
String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(":")){
if(path.endsWith(StrConstant.COLON)){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
}
entity.setPids(path);
@ -283,15 +286,15 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(":")){
if(!process.getPids().contains(StrConstant.COLON)){
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
String[] orgArray = process.getPids().split(":");
if(null != orgArray && orgArray.length > NumConstant.ONE){
String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(":")){
if(path.endsWith(StrConstant.COLON)){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
}
entity.setPids(path);
@ -322,7 +325,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
@Override
public void extractProjectPeriodData(ExtractOriginFormDTO param) {
int trace = factOriginProjectOrgPeriodDailyDao.selectIfExisted(param.getCustomerId());
Boolean isFirst = trace <= NumConstant.ZERO ? true : false;
Boolean isFirst = trace <= NumConstant.ZERO;
if (StringUtils.isBlank(param.getDateId())) {
Date yesterday = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
@ -345,23 +348,23 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
}else{
dest.setOrgType("agency");
dest.setPids("");
String[] array = original.getOrgIdPath().split(":");
if(null == array || array.length <= NumConstant.ZERO){
String[] array = original.getOrgIdPath().split(StrConstant.COLON);
if(array.length <= NumConstant.ZERO){
dest.setPid(NumConstant.ZERO_STR);
}
if(array[NumConstant.ZERO] == original.getOrgId() && array.length == NumConstant.ONE){
if(array[NumConstant.ZERO].equals(original.getOrgId()) && array.length == NumConstant.ONE){
dest.setPid(NumConstant.ZERO_STR);
}
if(array.length > NumConstant.ONE && original.getOrgId() == array[array.length - NumConstant.ONE]){
if(array.length > NumConstant.ONE && original.getOrgId().equals(array[array.length - NumConstant.ONE])){
dest.setPid(array[array.length - NumConstant.TWO]);
dest.setPids(original.getOrgIdPath().replace(original.getOrgId(),""));
}
if(StringUtils.isNotBlank(dest.getPids())){
while(dest.getPids().endsWith(":")){
while(dest.getPids().endsWith(StrConstant.COLON)){
dest.setPids(dest.getPids().substring(NumConstant.ZERO,dest.getPids().length() - NumConstant.ONE));
}
while(dest.getPids().startsWith(":")){
dest.setPids(dest.getPids().replaceFirst(":",""));
while(dest.getPids().startsWith(StrConstant.COLON)){
dest.setPids(dest.getPids().replaceFirst(StrConstant.COLON,""));
}
}
dest.setPids(dest.getPids().replaceAll(" ",""));
@ -400,13 +403,29 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
list.add(workDayFormDTO);
Result<List<WorkDayResultDTO>> detentionDays = epmetCommonServiceOpenFeignClient.detentionDays(list);
String days = detentionDays.getData().get(NumConstant.ZERO).getDetentionDays();
if (("<1").equals(days)) {
result = 1;
if (ONE_DAY.equals(days)) {
result = NumConstant.ONE;
} else {
result = Integer.parseInt(days);
}
return result;
}
/**
* 客户配置的可滞留时间没有的话默认5天
* @author zhaoqifeng
* @date 2020/9/28 10:27
* @param customerId
* @return java.lang.Integer
*/
private Integer getDays(String customerId) {
String value = projectService.getParameterValueByKey(customerId);
Integer days = NumConstant.FIVE;
if (StringUtils.isNotBlank(value)) {
days = Integer.valueOf(value);
}
return days;
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java

@ -233,7 +233,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
bigDecimal = bigDecimal.add(new BigDecimal(vote.getVoteCount() / (memberCount * 1.0)));
}
if (votedByIssueCount.intValue() != 0) {
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)));
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)));
}
}
});

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

@ -4,10 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService;
import com.epmet.service.evaluationindex.extract.toscreen.PioneerDataExtractService;
import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractService;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
import com.epmet.service.stats.DimCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -35,6 +32,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
private PioneerDataExtractService pioneerDataExtractService;
@Autowired
private PublicPartExtractService publicPartExtractService;
@Autowired
private OrgRankExtractService orgRankExtractService;
@Autowired
private GovernRankDataExtractService governRankDataExtractService;
/**
* @param extractOriginFormDTO
@ -124,5 +125,13 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
formDTO.setMonthId(monthId);
publicPartExtractService.extractTotalDataMonthly(formDTO);
//治理能力排行
governRankDataExtractService.extractGridData(customerId, monthId);
governRankDataExtractService.extractCommunityData(customerId, monthId);
governRankDataExtractService.extractStreetData(customerId, monthId);
//先进排行
orgRankExtractService.extractGridData(customerId, monthId);
orgRankExtractService.extractCommunityData(customerId, monthId);
orgRankExtractService.extractStreetData(customerId, monthId);
}
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -1,9 +1,11 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService;
import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService;
@ -88,7 +90,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
user.setGridName(gridInfo.getGridName());
user.setOrgId(gridInfo.getAgencyId());
user.setOrgName(gridInfo.getOrgName());
user.setAllParentIds(gridInfo.getPids());
//原始数据Pid使用英文:隔开,大屏数据要求按照英文,隔开
user.setAllParentIds(gridInfo.getPids().replaceAll(StrConstant.COLON,StrConstant.COMMA));
}
Integer point = pointMap.get(user.getUserId());
BigDecimal score = scoreMap.get(user.getUserId());
@ -114,6 +117,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
**/
@Override
public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) {
ScreenDifficultyDataEntity entity = new ScreenDifficultyDataEntity();
}
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java

@ -90,4 +90,13 @@ public interface ProjectService extends BaseService<ProjectEntity> {
* @return java.util.List<com.epmet.dto.project.ProjectInfoDTO>
*/
List<ProjectDTO> getProjectInfo(String customerId, String date);
/**
* 获取用户可滞留天数
* @author zhaoqifeng
* @date 2020/9/28 10:15
* @param customerId
* @return java.lang.String
*/
String getParameterValueByKey(String customerId);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java

@ -77,4 +77,9 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
return baseDao.selectProjectInfo(customerId, date);
}
@Override
public String getParameterValueByKey(String customerId) {
return baseDao.selectParameterValueByKey(customerId);
}
}

97
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -306,4 +306,101 @@
AND f.MONTH_ID = #{monthId}
GROUP BY f.AGENCY_ID
</select>
<!-- 根据客户Id查询 -->
<select id="selectDifficultyBaseInfo" resultType="com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity">
SELECT
project.CUSTOMER_ID,
project.ID AS EVENT_ID,
'grid' AS orgType,
project.GRID_ID AS orgId,
project.AGENCY_ID AS parentId,
project.TOPIC_ID AS eventImgUrl,
gridInfo.allPathName AS eventSource,
project.PROJECT_STATUS AS eventStatusCode,
IF
( project.PROJECT_STATUS = 'pending', '处理中', '已结案' ) AS eventStatusDesc,
relation.reOrg AS eventReOrg,
handleCount.HandledCount AS eventHandledCount,
costTime.costTime AS eventCostTime ,
gridInfo.allParentIds
FROM
fact_origin_project_main_daily project
LEFT JOIN (
SELECT
grid.ID AS dimGridId,
concat(
IF
(
ISNULL( agency.ALL_PARENT_NAME ) || LENGTH( trim( agency.ALL_PARENT_NAME ) ) <![CDATA[<]]> 1,
'',
concat( agency.ALL_PARENT_NAME, '-' )
),
agency.AGENCY_NAME,
'-',
grid.GRID_NAME
) AS allPathName,
REPLACE(concat(
IF
(
ISNULL( agency.PIDS ) || LENGTH( trim( agency.PIDS ) ) <![CDATA[<]]> 1,
'',
concat( agency.PIDS, ':' )
),
agency.ID
),':',',') AS allParentIds
FROM
DIM_GRID grid
LEFT JOIN DIM_AGENCY agency ON grid.AGENCY_ID = agency.ID
AND agency.DEL_FLAG = '0'
AND agency.CUSTOMER_ID = #{customerId}
WHERE
grid.DEL_FLAG = '0'
AND grid.CUSTOMER_ID = #{customerId}
) gridInfo ON project.GRID_ID = gridInfo.dimGridId
LEFT JOIN ( SELECT PROJECT_ID, COUNT( DISTINCT ORG_ID ) AS reOrg FROM fact_origin_project_org_period_daily WHERE DEL_FLAG = '0' AND CUSTOMER_ID = '3ef7e4bb195eb9e622d68b52509aa940' GROUP BY PROJECT_ID ) relation ON project.ID = relation.PROJECT_ID -- 处理次数
LEFT JOIN (
SELECT
PROJECT_ID,
COUNT( ID ) AS handledCount
FROM
fact_origin_project_org_period_daily
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND IS_RESOLVED = 'resolved'
GROUP BY
PROJECT_ID
) handleCount ON project.ID = handleCount.PROJECT_ID
LEFT JOIN (
SELECT
main.ID AS PROJECT_ID,
TIMESTAMPDIFF(
MINUTE,
str_to_date( main.DATE_ID, '%Y%m%d' ),
IF
( main.IS_RESOLVED = 'resolved', time.HANDLED_DATE, NOW( ) )
) AS costTime
FROM
fact_origin_project_main_daily main
LEFT JOIN fact_origin_project_org_period_daily time ON main.ID = time.PROJECT_ID
AND time.DEL_FLAG = '0'
AND time.OPERATION = 'close'
WHERE
main.DEL_FLAG = '0'
AND main.CUSTOMER_ID = #{customerId}
GROUP BY
main.ID
) costTime ON project.ID = costTime.PROJECT_ID
WHERE
project.DEL_FLAG = '0'
AND project.CUSTOMER_ID = #{customerId}
<if test="null != list and list.size() != 0">
<foreach collection="list" item="projectId" open="AND " separator=" AND " >
project.ID <![CDATA[<>]]> #{projectId}
</foreach>
</if>
</select>
</mapper>

9
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

@ -96,5 +96,14 @@
AND DATE_FORMAT(CREATED_TIME, '%Y%m%d') = #{date}
</if>
</select>
<select id="selectParameterValueByKey" resultType="java.lang.String">
select
PARAMETER_VALUE
from
customer_project_parameter
where DEL_FLAG = '0'
and CUSTOMER_ID = #{customerId}
and PARAMETER_KEY ='detention_days'
</select>
</mapper>
Loading…
Cancel
Save