From 01d1bdf0076da23faaab48a6d6606ebc03aae625 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 15 Oct 2021 10:22:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?/project/uploadprojectinfo,3=E4=B8=AA?= =?UTF-8?q?=E8=A1=97=E9=81=93=E4=B8=8A=E4=BC=A0=E5=85=A5=E5=8F=82=E6=96=B0?= =?UTF-8?q?=E5=A2=9EcategoryCode=EF=BC=8C=E5=80=BC=E4=B8=BA=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=9C=A8=E5=85=B6=E5=AE=A2=E6=88=B7=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/screen/form/ScreenProjectDataInfoFormDTO.java | 11 +++++++++++ .../screen/ScreenProjectDataEntity.java | 11 +++++++++++ 2 files changed, 22 insertions(+) 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/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; + /** * 所有分类名,用 - 连接 */ From e3fb8b5ae78cc2156f2066d18d76040a283bf928 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 15 Oct 2021 13:11:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ScreenProjectSettleService.extractScreenDat?= =?UTF-8?q?a=E6=96=B0=E5=A2=9Eorigin,categoryCode.=E9=A1=BA=E4=BE=BF?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E4=B8=8BorgName=E3=80=82=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E4=BA=8E=E8=AE=AE=E9=A2=98=E7=9A=84=E5=AD=98=E5=82=A8=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E5=90=8D=EF=BC=8C=E6=9D=A5=E6=BA=90=E4=BA=8E=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=92=8C=E7=AB=8B=E9=A1=B9=E7=9A=84=E9=83=BD=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E7=9A=84=E6=98=AFproject.agencyId=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E7=BB=84=E7=BB=87=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/screen/ScreenProjectDataDTO.java | 21 +++-- .../com/epmet/controller/DemoController.java | 1 - .../com/epmet/service/Issue/IssueService.java | 2 +- .../service/Issue/impl/IssueServiceImpl.java | 20 +++-- .../impl/ScreenProjectSettleServiceImpl.java | 85 +++++++++++++------ .../extract/FactOriginProjectMainDailyDao.xml | 8 +- .../resources/mapper/issue/StatsIssueDao.xml | 3 +- 7 files changed, 92 insertions(+), 48 deletions(-) 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-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 771145678f..ef25523ef2 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 @@ -876,7 +876,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/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 @@