Browse Source

【项目分类分析】分类下项目列表

dev_shibei_match
sunyuchao 4 years ago
parent
commit
5ec25107ae
  1. 6
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridsInfoListResultDTO.java
  2. 45
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ResiEventDTO.java
  3. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/CategoryProjectFormDTO.java
  4. 11
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/CategoryProjectResultDTO.java
  5. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectStatusListResultDTO.java
  6. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java
  7. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java
  8. 31
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java
  9. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java
  10. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java
  11. 75
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  12. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml
  13. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
  14. 76
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml

6
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridsInfoListResultDTO.java

@ -24,8 +24,12 @@ public class GridsInfoListResultDTO implements Serializable {
private String gridId;
/**
* 网格名称
* 组织-网格名称
*/
private String gridName;
/**
* 网格名称
*/
private String name;
}

45
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ResiEventDTO.java

@ -0,0 +1,45 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.dto.govproject;
import lombok.Data;
import java.io.Serializable;
/**
* 居民报事表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-03
*/
@Data
public class ResiEventDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
private String projectId;
private String reportUserId;
}

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/CategoryProjectFormDTO.java

@ -33,6 +33,11 @@ public class CategoryProjectFormDTO implements Serializable {
private Integer pageSize = 20;
//是否分页(是:true 否:false)
private Boolean isPage = true;
//明天的dateId值
private String toDateId;
private String customerId;
private List<String> categoreCodeList;
public interface Category extends CustomerClientShowGroup {
}

11
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/CategoryProjectResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dataaggre.dto.govproject.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -26,7 +27,7 @@ public class CategoryProjectResultDTO implements Serializable {
private String projectId;
//项目编码[目前没这个功能 默认为空]
private String projectCode = "";
//一级分类Id集合
//一级分类Code集合
private List<String> categoryCodes;
//一级分类名称集合
private List<String> categoryNames;
@ -42,10 +43,14 @@ public class CategoryProjectResultDTO implements Serializable {
private String title;
//转项目时间
private String time;
//当前人员是否处理:未处理unhandled,已处理handle
private String isHandle;
//小程序居民端话题或事件创建人【立项项目此值为空】
private String userId;
//分类对应的所有上级,英文逗号隔开【目前分类只有两级,所以这个字段值其实就是一类的id值】
@JsonIgnore
private String categoryPids;
//二级分类code
@JsonIgnore
private String categoryCode;
}
}

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectStatusListResultDTO.java

@ -24,5 +24,7 @@ public class ProjectStatusListResultDTO implements Serializable {
private Integer longitude;
//纬度
private Integer dimension;
//项目标题
private String title;
}

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java

@ -102,8 +102,9 @@ public class GovProjectController {
* @author sun
*/
@PostMapping("categoryprojectlist")
public Result<CategoryProjectResultDTO> categoryProjectList(@RequestBody CategoryProjectFormDTO formDTO) {
public Result<CategoryProjectResultDTO> categoryProjectList(@LoginUser TokenDto tokenDto, @RequestBody CategoryProjectFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, CategoryProjectFormDTO.Category.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<CategoryProjectResultDTO>().ok(govProjectService.categoryProjectList(formDTO));
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java

@ -80,5 +80,5 @@ public interface IssueDao extends BaseDao<IssueEntity> {
* @Description 查询客户下分类信息
* @author sun
**/
List<IssueProjectCategoryDictDTO> getCategoryList(@Param("customerId") String customerId);
List<IssueProjectCategoryDictDTO> getCategoryList(@Param("customerId") String customerId, @Param("level") String level, @Param("isDisable") String isDisable);
}

31
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java

@ -18,14 +18,14 @@
package com.epmet.dataaggre.dao.govproject;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govproject.result.IssueProjectCategory;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.ProjectDTO;
import com.epmet.dataaggre.dto.govproject.ProjectRelatedPersonnelDTO;
import com.epmet.dataaggre.dto.govproject.ResiEventDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.CategoryProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectTotalFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectStatusListResultDTO;
import com.epmet.dataaggre.dto.govproject.result.*;
import com.epmet.dataaggre.entity.govproject.ProjectEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -81,4 +81,27 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
List<ProjectStatusListResultDTO> getProjectStatusList(ProjectTotalFormDTO formDTO);
List<IssueProjectCategory> selectProjectIssueCategory(@Param("issueIds") List<String> issueIds);
/**
* @Description 查询组织截止某一天的某个分类下的项目列表
* @author sun
*/
List<CategoryProjectResultDTO.Project> categoryProjectList(CategoryProjectFormDTO formDTO);
/**
* @Description 查询项目对应的所有分类信息
* @author sun
*/
List<CategoryProjectResultDTO.Project> getCategoryList(@Param("projectIds") List<String> projectIds);
/**
* @Description 查询来源事件的项目居民端创建人信息
* @author sun
*/
List<ResiEventDTO> getEventList(@Param("projectIds") List<String> projectIds);
/**
* @Description 查询来源话题的项目居民端创建人信息
* @author sun
*/
List<ProjectRelatedPersonnelDTO> getTopicUser(@Param("projectIds") List<String> projectIds);
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java

@ -48,8 +48,8 @@ public interface GovIssueService {
List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId,Integer pageNo,Integer pageSize);
/**
* @Description 查询客户下一级分类信息
* @Description 查询客户下分类信息
* @author sun
**/
List<IssueProjectCategoryDictDTO> categoryList(String customerId);
List<IssueProjectCategoryDictDTO> categoryList(String customerId, String level, String isDisable);
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java

@ -329,8 +329,8 @@ public class GovIssueServiceImpl implements GovIssueService {
* @author sun
**/
@Override
public List<IssueProjectCategoryDictDTO> categoryList(String customerId) {
return issueDao.getCategoryList(customerId);
public List<IssueProjectCategoryDictDTO> categoryList(String customerId, String level, String isDisable) {
return issueDao.getCategoryList(customerId, level, isDisable);
}
}

75
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java

@ -15,7 +15,10 @@ import com.epmet.dataaggre.dto.datastats.result.FactAgencyProjectResultDTO;
import com.epmet.dataaggre.dto.govissue.IssueProjectCategoryDictDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueInfoDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO;
import com.epmet.dataaggre.dto.govproject.ProjectDTO;
import com.epmet.dataaggre.dto.govproject.ProjectRelatedPersonnelDTO;
import com.epmet.dataaggre.dto.govproject.ResiEventDTO;
import com.epmet.dataaggre.dto.govproject.form.*;
import com.epmet.dataaggre.dto.govproject.result.*;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
@ -28,6 +31,8 @@ import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import com.epmet.dto.form.TimestampIntervalFormDTO;
import com.epmet.dto.form.WorkMinuteFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -330,7 +335,7 @@ public class GovProjectServiceImpl implements GovProjectService {
@Override
public List<ProjectStatusListResultDTO> projectStatusList(ProjectTotalFormDTO formDTO) {
//所选日期后一天的dateId值
formDTO.setYeDateId(DateUtils.dateOrmonthId(formDTO.getDateId(), "date", 1));
formDTO.setToDateId(DateUtils.dateOrmonthId(formDTO.getDateId(), "date", 1));
//1.查询组织下截止到dateId的某个状态的项目列表
List<ProjectStatusListResultDTO> resultList = projectDao.getProjectStatusList(formDTO);
return resultList;
@ -344,7 +349,7 @@ public class GovProjectServiceImpl implements GovProjectService {
public List<ProjectCategoryTotalResultDTO> projectCategoryList(ProjectCategoryTotalFormDTO formDTO) {
List<ProjectCategoryTotalResultDTO> resultList = new ArrayList<>();
//1.查询客户下一级分类信息
List<IssueProjectCategoryDictDTO> categoryList = govIssueService.categoryList(formDTO.getCustomerId());
List<IssueProjectCategoryDictDTO> categoryList = govIssueService.categoryList(formDTO.getCustomerId(), "1", "enable");
//2.按dateId查询组织下一级分类项目总数
List<ProjectCategoryTotalResultDTO> list = evaluationIndexService.projectCategoryList(formDTO);
@ -372,7 +377,71 @@ public class GovProjectServiceImpl implements GovProjectService {
*/
@Override
public CategoryProjectResultDTO categoryProjectList(CategoryProjectFormDTO formDTO) {
return null;
CategoryProjectResultDTO resultDTO = new CategoryProjectResultDTO();
//所选日期后一天的dateId值
formDTO.setToDateId(DateUtils.dateOrmonthId(formDTO.getDateId(), "date", 1));
//1.查询客户下分类信息
List<IssueProjectCategoryDictDTO> categoryList = govIssueService.categoryList(formDTO.getCustomerId(), null, null);
List<String> categoreCodeList = categoryList.stream().map(ca -> formDTO.getCategoryCode().equals(ca.getParentCategoryCode()) ? ca.getCategoryCode() : "").collect(Collectors.toList());
formDTO.setCategoreCodeList(categoreCodeList);
//2.查询组织及下级截止某一天的某个一级分类下的项目列表
PageInfo<CategoryProjectResultDTO.Project> result =
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> projectDao.categoryProjectList(formDTO));
if (org.springframework.util.CollectionUtils.isEmpty(result.getList())) {
return resultDTO;
}
resultDTO.setTotal((int) result.getTotal());
//3.查询已有项目列表涉及的所有分类信息【一个项目存在多个一级分类下的二级分类】
List<String> projectIds = result.getList().stream().map(CategoryProjectResultDTO.Project::getProjectId).collect(Collectors.toList());
List<CategoryProjectResultDTO.Project> list = projectDao.getCategoryList(projectIds);
//4.查询网格信息【楼院小组类项目、上报事件且上报给网格的项目才存在网格Id】
List<String> gridIds = result.getList().stream().map(CategoryProjectResultDTO.Project::getGridId).collect(Collectors.toList());
gridIds = gridIds.stream().distinct().collect(Collectors.toList());
List<GridsInfoListResultDTO> gridList = govOrgService.gridListByIds(gridIds);
//5.查询来源议题、事件的项目居民端创建人userId
List<ResiEventDTO> eventUser = projectDao.getEventList(projectIds);
List<ProjectRelatedPersonnelDTO> topicUser = projectDao.getTopicUser(projectIds);
//5.封装数据
result.getList().forEach(re -> {
//项目涉及网格信息
gridList.forEach(g -> {
if (StringUtils.isNotBlank(re.getGridId()) && re.getGridId().equals(g.getGridId())) {
re.setGridName(g.getName());
}
});
//项目涉及分类信息【一个项目涉及多个一级分类】
List<String> caId = new ArrayList<>();
List<String> caCode = new ArrayList<>();
list.forEach(ca -> {
if (ca.getProjectId().equals(re.getProjectId())) {
caId.add(ca.getCategoryPids());
caCode.add(ca.getCategoryCode());
}
});
List<String> caName = new ArrayList<>();
categoryList.forEach(ca -> caId.stream().filter(li -> ca.getId().equals(li)).forEach(s -> caName.add(ca.getCategoryName())));
re.setCategoryCodes(caCode);
re.setCategoryNames(caName);
//项目来源话题、事件的创建人信息
eventUser.forEach(ev -> {
if (re.getProjectId().equals(ev.getProjectId())) {
re.setUserId(ev.getReportUserId());
}
});
topicUser.forEach(to -> {
if (re.getProjectId().equals(to.getProjectId())) {
re.setUserId(to.getUserId());
}
});
});
resultDTO.setList(result.getList());
return resultDTO;
}
/**

8
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml

@ -131,8 +131,12 @@
FROM issue_project_category_dict
WHERE del_flag = 0
AND customer_id = #{customerId}
AND category_type = '1'
AND is_disable = 'enable'
<if test="level != null and level.trim() != ''">
AND category_type = #{level}
</if>
<if test="isDisable != null and isDisable.trim() != ''">
AND is_disable = #{isDisable}
</if>
ORDER BY category_code
</select>

3
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml

@ -22,7 +22,8 @@
cg.grid_name,
CONCAT(ca.organization_name,'-',cg.grid_name)
) AS 'gridName',
cg.customer_id AS 'customerId'
cg.customer_id AS 'customerId',
cg.grid_name AS 'name'
FROM
customer_grid cg
INNER JOIN customer_agency ca ON cg.pid = ca.id

76
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml

@ -163,17 +163,87 @@
origin "origin",
`status` "status",
locate_longitude "longitude",
locate_dimension dimension
locate_dimension dimension,
title title
FROM
project
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
AND org_id_path LIKE CONCAT('%', #{agencyId}, '%')
AND `status` = #{status}
AND created_time <![CDATA[<]]> DATE_FORMAT(#{dateId}, '%Y-%m-%d')
AND created_time <![CDATA[<]]> DATE_FORMAT(#{toDateId}, '%Y-%m-%d')
ORDER BY created_time DESC
</select>
<select id="categoryProjectList" resultType="com.epmet.dataaggre.dto.govproject.result.CategoryProjectResultDTO$Project">
SELECT
p.agency_id agencyId,
p.id projectId,
p.origin origin,
pc.grid_id gridId,
p.`status` status,
p.title title,
p.created_time time
FROM
project p
INNER JOIN project_category pc ON p.id = pc.project_id
WHERE
p.del_flag = '0'
AND p.org_id_path LIKE CONCAT('%', #{agencyId}, '%')
AND p.created_time <![CDATA[<]]> DATE_FORMAT(#{toDateId}, '%Y-%m-%d')
<foreach collection="categoreCodeList" item="code" open="AND pc.category_code IN (" separator="," close=")">
#{code}
</foreach>
GROUP BY
pc.project_id
ORDER BY
p.created_time DESC
</select>
<select id="getCategoryList" resultType="com.epmet.dataaggre.dto.govproject.result.CategoryProjectResultDTO$Project">
SELECT
project_id projectId,
category_pids categoryPids, <!-- 目前分类只有两级,所以这个字段值其实就是一类的id值 -->
category_code categoryCode
FROM
project_category
WHERE
del_flag = '0'
<foreach collection="projectIds" item="projectId" open="AND project_id IN (" separator="," close=")">
#{projectId}
</foreach>
GROUP BY
category_pids, project_id
ORDER BY project_id
</select>
<select id="getEventList" resultType="com.epmet.dataaggre.dto.govproject.ResiEventDTO">
SELECT
project_id projectId,
report_user_id reportUserId
FROM
resi_event
WHERE
DEL_FLAG = '0'
<foreach collection="projectIds" item="projectId" open="AND project_id IN (" separator="," close=")">
#{projectId}
</foreach>
</select>
<select id="getTopicUser" resultType="com.epmet.dataaggre.dto.govproject.ProjectRelatedPersonnelDTO">
SELECT
project_id projectId,
user_id userId
FROM
project_related_personnel
WHERE
del_flag = '0'
AND source_type = 'topic'
<foreach collection="projectIds" item="projectId" open="AND project_id IN (" separator="," close=")">
#{projectId}
</foreach>
</select>
<select id="selectProjectIssueCategory" parameterType="map" resultType="com.epmet.dataaggre.dto.govproject.result.IssueProjectCategory">
SELECT
p.ORIGIN_ID AS issueId,

Loading…
Cancel
Save