diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java index fe859bfac0..9c6bb27cea 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java @@ -54,11 +54,6 @@ public class ScreenProjectDataDTO implements Serializable { */ private String orgId; - /** - * 来源:议题issue,组织agency - */ - private String origin; - /** * 上级组织Id */ @@ -112,6 +107,16 @@ public class ScreenProjectDataDTO implements Serializable { */ private String projectAddress; + /** + * add 20211014 + * 项目所属编码,如果有多个,以英文顿号隔开 + */ + private String categoryCode; + /** + * add 20211014 + * 来源:议题issue 项目立项:agency 事件:resi_event + */ + private String origin; /** * 所有分类名,用 - 连接 */ @@ -185,4 +190,10 @@ public class ScreenProjectDataDTO implements Serializable { */ private BigDecimal satisfactionScore; + + + /** + * fact_origin_project_main_daily.grid_id对应的网格名称 + */ + private String tempGridName; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java index f0f6422e94..9202158945 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/ScreenProjectDataInfoFormDTO.java @@ -81,6 +81,17 @@ public class ScreenProjectDataInfoFormDTO implements Serializable { */ private String projectAddress; + /** + * add 20211014 + * 项目所属编码,如果有多个,以英文顿号隔开 + */ + private String categoryCode; + /** + * add 20211014 + * 来源:议题issue 项目立项:agency 事件:resi_event + */ + private String origin; + /** * 所有分类名,用 - 连接 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index d6a7ad782a..0e7dc2dac7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -891,7 +891,6 @@ public class DemoController { formDTO.setCustomerId(customerId); formDTO.setDateId(param.getDateId()); screenProjectSettleService.extractScreenData(param); - log.error(String.format("/data/stats/demo/project-test,screen_project_**表抽取完毕,customerId:%s", customerId)); } return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java index 52c9a19ab3..ac4775c311 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectDataEntity.java @@ -109,6 +109,17 @@ public class ScreenProjectDataEntity extends BaseEpmetEntity { */ private String projectAddress; + /** + * add 20211014 + * 项目所属编码,如果有多个,以英文顿号隔开 + */ + private String categoryCode; + /** + * add 20211014 + * 来源:议题issue 项目立项:agency 事件:resi_event + */ + private String origin; + /** * 所有分类名,用 - 连接 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index 4096fcb500..445894bd66 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -182,7 +182,7 @@ public interface IssueService { * @author wangc * @date 2021.03.09 00:23 */ - Map getIntegratedProjectCategory(Map> param,String customerId); + Map> getIntegratedProjectCategory(Map> param,String customerId); /** * 获取议题总数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 593c21b9fa..b86b6daa40 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -17,10 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * @author zhaoqifeng @@ -157,18 +154,23 @@ public class IssueServiceImpl implements IssueService { * @date 2021.03.09 00:23 */ @Override - public Map getIntegratedProjectCategory(Map> param,String customerId) { - Map map = new HashMap<>(); + public Map> getIntegratedProjectCategory(Map> param,String customerId) { + Map> map = new HashMap<>(); param.forEach((projectId,categoryIds) -> { //以下查询只适用于二级分类,如果分类层级变多了要修改此查询 List categories = statsIssueDao.selectCategory(customerId, categoryIds); if(!CollectionUtils.isEmpty(categories)){ - StringBuilder str = new StringBuilder(); + StringBuilder allCategoryName = new StringBuilder(); + StringBuilder categoryCode = new StringBuilder(); categories.forEach(category -> { - str.append(category.getCategoryName()).append(StrConstant.COMMA); + allCategoryName.append(category.getCategoryName()).append(StrConstant.COMMA); + categoryCode.append(category.getCategoryCode()).append(StrConstant.COMMA); //log.info(str.toString()); }); - map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.ONE)); + List list=new ArrayList<>(); + list.add(allCategoryName.substring(NumConstant.ZERO,allCategoryName.length() - NumConstant.ONE)); + list.add(categoryCode.substring(NumConstant.ZERO,categoryCode.length() - NumConstant.ONE)); + map.put(projectId,list); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java index 05dbbed28c..529593abcc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java @@ -81,30 +81,47 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic List info = projectService.getProjectInfo(metaData.stream().map(ScreenProjectDataDTO::getProjectId).collect(Collectors.toList())); if(!CollectionUtils.isEmpty(info)){ metaData = metaData.stream().flatMap(meta -> info.stream().filter(nature -> StringUtils.equals(meta.getProjectId(), - nature.getId())).map(projectInfo -> { - meta.setProjectCreateTime(projectInfo.getCreatedTime()); - meta.setProjectTitle(projectInfo.getTitle()); - meta.setOrigin(projectInfo.getOrigin()); - //直接立项的话 项目内容是项目背景 经纬度添加 - if (ProjectConstant.PROJECT_ORIGIN_AGENCY.equals(projectInfo.getOrigin())){ - meta.setOrgType(OrgTypeConstant.AGENCY); - meta.setOrgId(projectInfo.getAgencyId()); - meta.setProjectContent(projectInfo.getBackGround()); - meta.setLinkUserId(projectInfo.getCreatedBy()); - meta.setLinkName(projectInfo.getCreatedBy()); - if (StringUtils.isNotBlank(projectInfo.getLocateDimension())){ - meta.setLatitude(new BigDecimal(projectInfo.getLocateDimension())); - } - if (StringUtils.isNotBlank(projectInfo.getLocateLongitude())){ - meta.setLongitude(new BigDecimal(projectInfo.getLocateLongitude())); - } - meta.setProjectAddress(projectInfo.getLocateAddress()); - } else { - meta.setLinkUserId(meta.getLinkName()); - } - //项目满意度得分 - meta.setSatisfactionScore(projectService.calProjectSatisfactionScore(param.getCustomerId(),meta.getProjectId())); - return meta; + nature.getId())).map(projectInfo -> { + meta.setProjectCreateTime(projectInfo.getCreatedTime()); + meta.setProjectTitle(projectInfo.getTitle()); + meta.setOrigin(projectInfo.getOrigin()); + if (ProjectConstant.PROJECT_ORIGIN_ISSUE.equals(projectInfo.getOrigin())) { + + //来源于议题的,上面的initNewScreenProjectData,已经赋值orgType=grid, orgId:gridId + meta.setOrgName(meta.getTempGridName()); + //A:如果是来源于议题,linkUserId为话题的发布人id; + meta.setLinkUserId(meta.getLinkName()); + + }else if(ProjectConstant.PROJECT_ORIGIN_EVENT.equals(projectInfo.getOrigin())){ + + meta.setProjectContent(projectInfo.getBackGround()); + meta.setLatitude(new BigDecimal(projectInfo.getLocateDimension())); + meta.setLongitude(new BigDecimal(projectInfo.getLocateLongitude())); + meta.setProjectAddress(projectInfo.getLocateAddress()); + meta.setOrgType(OrgTypeConstant.AGENCY); + meta.setOrgId(projectInfo.getAgencyId()); + //B:如果是来源是居民端报事,此列实际为空; + meta.setLinkUserId(meta.getLinkName()); + + }else if (ProjectConstant.PROJECT_ORIGIN_AGENCY.equals(projectInfo.getOrigin())) { + //直接立项的话 项目内容是项目背景 经纬度添加 + meta.setOrgType(OrgTypeConstant.AGENCY); + meta.setOrgId(projectInfo.getAgencyId()); + //上面的initNewScreenProjectData已经赋值了orgName=组织名称 + meta.setProjectContent(projectInfo.getBackGround()); + meta.setLinkUserId(projectInfo.getCreatedBy()); + meta.setLinkName(projectInfo.getCreatedBy()); + if (StringUtils.isNotBlank(projectInfo.getLocateDimension())) { + meta.setLatitude(new BigDecimal(projectInfo.getLocateDimension())); + } + if (StringUtils.isNotBlank(projectInfo.getLocateLongitude())) { + meta.setLongitude(new BigDecimal(projectInfo.getLocateLongitude())); + } + meta.setProjectAddress(projectInfo.getLocateAddress()); + } + //项目满意度得分 + meta.setSatisfactionScore(projectService.calProjectSatisfactionScore(param.getCustomerId(),meta.getProjectId())); + return meta; })).collect(Collectors.toList()); } //设置项目经纬度和项目内容 @@ -129,13 +146,25 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic } Map> categoryMap = projectService.getProjectCategory(projectIds); if(!CollectionUtils.isEmpty(categoryMap)){ - Map integratedProjectCategoryMap = issueService.getIntegratedProjectCategory(categoryMap, param.getCustomerId()); + Map> integratedProjectCategoryMap = issueService.getIntegratedProjectCategory(categoryMap, param.getCustomerId()); if(!CollectionUtils.isEmpty(integratedProjectCategoryMap)){ metaData.forEach(meta -> { - meta.setAllCategoryName(integratedProjectCategoryMap.get(meta.getProjectId())); + List list1=integratedProjectCategoryMap.get(meta.getProjectId()); + if(!CollectionUtils.isEmpty(list1)){ + meta.setAllCategoryName(list1.get(0)); + meta.setCategoryCode(list1.get(1)); + }else{ + log.warn("1、projectId="+meta.getProjectId()+" category is null"); + } }); orientData.forEach(orient -> { - orient.setAllCategoryName(integratedProjectCategoryMap.get(orient.getProjectId())); + List list2=integratedProjectCategoryMap.get(orient.getProjectId()); + if(!CollectionUtils.isEmpty(list2)){ + orient.setAllCategoryName(list2.get(0)); + orient.setCategoryCode(list2.get(1)); + }else{ + log.warn("2、projectId="+orient.getProjectId()+" category is null"); + } }); } } @@ -168,7 +197,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic } } - + log.error(String.format("/data/stats/demo/project-test,screen_project_**表抽取完毕,customerId:%s", param.getCustomerId())); } /** 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 5558bfaa05..b8560a06a1 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 @@ -578,10 +578,12 @@ data.PIDS as allParentIds, data.TOPIC_ID, IFNULL(log.response, 0) AS responseCount, - #{dataEndTime} as dataEndTime - + #{dataEndTime} as dataEndTime, + data.ORIGIN as origin, + grid.GRID_NAME as tempGridName FROM `fact_origin_project_main_daily` data - LEFT JOIN DIM_AGENCY agency on data.agency_id = agency.id + LEFT JOIN DIM_AGENCY agency on (data.agency_id = agency.id and agency.del_flag='0') + LEFT JOIN DIM_GRID grid on (data.grid_id=grid.id and grid.del_flag='0') LEFT JOIN ( SELECT PROJECT_ID, COUNT(IS_ACTIVE) AS response FROM fact_origin_project_log_daily WHERE (ACTION_CODE = 'close' OR ACTION_CODE = 'response' OR ACTION_CODE = 'transfer' OR ACTION_CODE = 'return') diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index 3ee79011e8..514f743353 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -311,7 +311,8 @@