Browse Source

新增项目分布接口供龙湾调用

dev_shibei_match
yinzuomei 5 years ago
parent
commit
0be9eb0fa4
  1. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  2. 16
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueInfoDTO.java
  3. 19
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java
  4. 25
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectDistributionResultDTO.java
  5. 7
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java
  6. 25
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java
  7. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java
  8. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java
  9. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiTopicDao.java
  10. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java
  11. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java
  12. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java
  13. 39
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  14. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java
  15. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java
  16. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml
  17. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml
  18. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiTopicDao.xml

2
epmet-gateway/src/main/resources/bootstrap.yml

@ -468,7 +468,7 @@ epmet:
- /epmet/ext/**
- /epmetuser/customerstaff/customerlist
- /message/template/**
- /data/aggregator/project/projectdistribution
swaggerUrls:
jwt:

16
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueInfoDTO.java

@ -0,0 +1,16 @@
package com.epmet.dataaggre.dto.govissue.result;
import lombok.Data;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/24 12:12
*/
@Data
public class IssueInfoDTO {
private String issueId;
private String gridId;
private String topicId;
}

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

@ -0,0 +1,19 @@
package com.epmet.dataaggre.dto.govproject.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 项目分布实时只适用于e事通客户入参
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/24 11:04
*/
@Data
public class ProjectDistributionFormDTO implements Serializable {
private String gridId;
@NotBlank(message = "customerId不能为空")
private String customerId;
}

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

@ -0,0 +1,25 @@
package com.epmet.dataaggre.dto.govproject.result;
import lombok.Data;
import java.io.Serializable;
/**
* 项目分布实时只适用于e事通客户返参
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/24 11:05
*/
@Data
public class ProjectDistributionResultDTO implements Serializable {
private String projectId;
private String projectTitle;
private String statusDesc;
private String longitude;
private String latitude;
// @JsonIgnore
private String issueId;
// @JsonIgnore
private String statusCode;
private String gridId;
}

7
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java

@ -17,9 +17,10 @@
package com.epmet.dataaggre.dto.resigroup;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -128,4 +129,8 @@ public class ResiTopicDTO implements Serializable {
*/
private String issueId;
/**
* 话题所属网格id
*/
private String gridId;
}

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

@ -5,14 +5,16 @@ import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectDistributionFormDTO;
import com.epmet.dataaggre.dto.govproject.result.AllProjectResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.service.govproject.GovProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author zxc
@ -39,4 +41,19 @@ public class GovProjectController {
AllProjectResultDTO result = govProjectService.allProjectList(tokenDto, formDTO);
return new Result<AllProjectResultDTO>().ok(result);
}
/**
* @param customerId
* @param formDTO
* @author yinzuomei 项目分布实时只适用于e事通客户返参
* @description 目前在用龙湾大屏调用此接口接口内写死了 按照立项时间降序取前100个项目
* @Date 2021/2/24 13:17
**/
@PostMapping("projectdistribution")
public Result<List<ProjectDistributionResultDTO>> queryProjectDistribution(@RequestHeader("CustomerId") String customerId,
@RequestBody ProjectDistributionFormDTO formDTO){
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
return new Result<List<ProjectDistributionResultDTO>>().ok(govProjectService.queryProjectDistribution(formDTO));
}
}

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

@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govissue.form.ClosedIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.ShiftProjectIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.VotingIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.result.ClosedIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueShiftProjectResultDTO;
import com.epmet.dataaggre.dto.govissue.result.VotingIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.*;
import com.epmet.dataaggre.entity.govissue.IssueEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -75,4 +72,6 @@ public interface IssueDao extends BaseDao<IssueEntity> {
List<ClosedIssueListResultDTO> selectClosedListGov(ClosedIssueListFormDTO fromDTO);
Integer selectIssueCount(@Param("gridIds") List<String> gridIds,@Param("issueType")String issueType);
List<IssueInfoDTO> selectShiftProjectIssueList(@Param("customerId") String customerId, @Param("gridId") String gridId);
}

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

@ -18,18 +18,17 @@
package com.epmet.dataaggre.dao.govproject;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.ProjectDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.entity.govproject.ProjectEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.List;
/**
* 项目表
*
@ -68,4 +67,5 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
**/
List<String> selectDepartmentNameList(ProjectDTO project);
List<ProjectDistributionResultDTO> selectList(@Param("customerId") String customerId,@Param("list")List<String> issueIds);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiTopicDao.java

@ -18,8 +18,12 @@
package com.epmet.dataaggre.dao.resigroup;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.entity.resigroup.ResiTopicEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 话题信息表
@ -30,4 +34,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ResiTopicDao extends BaseDao<ResiTopicEntity> {
List<ResiTopicDTO> selectTopicInfoByIds(@Param("list") List<String> topicIds);
}

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

@ -5,10 +5,7 @@ import com.epmet.dataaggre.dto.govissue.form.AllIssueFormDTO;
import com.epmet.dataaggre.dto.govissue.form.ClosedIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.ShiftProjectIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.VotingIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.result.AllIssueResultDTO;
import com.epmet.dataaggre.dto.govissue.result.ClosedIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.ShiftProjectIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.VotingIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.*;
import java.util.List;
@ -46,4 +43,6 @@ public interface GovIssueService {
* @author sun
**/
List<ClosedIssueListResultDTO> closedIssueList(ClosedIssueListFormDTO fromDTO);
List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId);
}

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

@ -313,4 +313,9 @@ public class GovIssueServiceImpl implements GovIssueService {
return resultList;
}
@Override
public List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId) {
return issueDao.selectShiftProjectIssueList(customerId,gridId);
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java

@ -1,12 +1,11 @@
package com.epmet.dataaggre.service.govproject;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectDistributionFormDTO;
import com.epmet.dataaggre.dto.govproject.result.AllProjectResultDTO;
import java.util.List;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ShiftProjectResultDTO;
import java.util.List;
@ -41,4 +40,5 @@ public interface GovProjectService {
List<ShiftProjectResultDTO> getProjectByIssue(List<String> issueIdList);
List<ProjectDistributionResultDTO> queryProjectDistribution(ProjectDistributionFormDTO formDTO);
}

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

@ -8,17 +8,21 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.ProjectConstant;
import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao;
import com.epmet.dataaggre.dao.govproject.ProjectDao;
import com.epmet.dataaggre.dto.govissue.result.IssueInfoDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
import com.epmet.dataaggre.dto.govproject.ProjectDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectDistributionFormDTO;
import com.epmet.dataaggre.dto.govproject.result.AllProjectResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.dto.govproject.result.ShiftProjectResultDTO;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.service.govissue.GovIssueService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.govproject.GovProjectService;
import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import com.epmet.dto.form.TimestampIntervalFormDTO;
import com.epmet.dto.form.WorkMinuteFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -46,6 +50,10 @@ public class GovProjectServiceImpl implements GovProjectService {
private GovOrgService govOrgService;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private GovIssueService govIssueService;
@Autowired
private ResiGroupService resiGroupService;
/**
* @Description 查询项目信息
@ -103,6 +111,33 @@ public class GovProjectServiceImpl implements GovProjectService {
return resultList;
}
@Override
public List<ProjectDistributionResultDTO> queryProjectDistribution(ProjectDistributionFormDTO formDTO) {
List<ProjectDistributionResultDTO> resultDTOList = new ArrayList<>();
List<IssueInfoDTO> issueInfoDTOList = govIssueService.selectShiftProjectIssueList(formDTO.getCustomerId(), formDTO.getGridId());
if (CollectionUtils.isNotEmpty(issueInfoDTOList)) {
List<String> topicIds = issueInfoDTOList.stream().map(data -> data.getTopicId()).collect(Collectors.toList());
// log.info("话题id集合:" + JSON.toJSONString(topicIds, true));
List<ResiTopicDTO> topicInfoDTOList = resiGroupService.selectTopicInfoByIds(topicIds);
List<String> issueIds = issueInfoDTOList.stream().map(data -> data.getIssueId()).collect(Collectors.toList());
// log.info("议题id集合:" + JSON.toJSONString(issueIds, true));
resultDTOList = projectDao.selectList(formDTO.getCustomerId(),issueIds);
for (ProjectDistributionResultDTO project : resultDTOList) {
for (ResiTopicDTO topicInfoDTO : topicInfoDTOList) {
if (project.getIssueId().equals(topicInfoDTO.getIssueId())) {
//维度
project.setLatitude(topicInfoDTO.getDimension());
//经度
project.setLongitude(topicInfoDTO.getLongitude());
project.setGridId(topicInfoDTO.getGridId());
break;
}
}
}
}
return resultDTOList;
}
/**
* 全部项目

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java

@ -1,8 +1,14 @@
package com.epmet.dataaggre.service.resigroup;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:21
*/
public interface ResiGroupService {
List<ResiTopicDTO> selectTopicInfoByIds(@Param("topicIds") List<String> topicIds);
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java

@ -2,10 +2,15 @@ package com.epmet.dataaggre.service.resigroup.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.resigroup.ResiTopicDao;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:21
@ -14,4 +19,11 @@ import org.springframework.stereotype.Service;
@DataSource(DataSourceConstant.RESI_GROUP)
@Slf4j
public class ResiGroupServiceImpl implements ResiGroupService {
@Autowired
private ResiTopicDao resiTopicDao;
@Override
public List<ResiTopicDTO> selectTopicInfoByIds(List<String> topicIds) {
return resiTopicDao.selectTopicInfoByIds(topicIds);
}
}

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

@ -107,4 +107,21 @@
</foreach>)
</select>
<select id="selectShiftProjectIssueList" parameterType="map" resultType="com.epmet.dataaggre.dto.govissue.result.IssueInfoDTO">
SELECT
i.ID as issueId,
i.GRID_ID as gridId,
i.SOURCE_ID as topicId
FROM
issue i
WHERE
i.DEL_FLAG = '0'
AND i.ISSUE_STATUS = 'shift_project'
and i.SOURCE_TYPE='resi_topic'
AND i.CUSTOMER_ID = #{customerId}
<if test="gridId != null and gridId.trim() != ''">
AND i.GRID_ID = #{gridId}
</if>
order by i.SHIFTED_TIME desc limit 100
</select>
</mapper>

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

@ -124,4 +124,22 @@
AND p.id = #{id}
</select>
<select id="selectList" parameterType="map" resultType="com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO">
SELECT
p.id AS projectId,
p.TITLE AS projectTitle,
( CASE WHEN p.`STATUS` = 'pending' THEN '处理中' WHEN p.`STATUS` = 'closed' THEN '已结案' ELSE '' END ) AS statusDesc,
p.`STATUS` as statusCode,
p.ORIGIN_ID as issueId
FROM
project p
WHERE
p.DEL_FLAG = '0'
and p.CUSTOMER_ID=#{customerId}
and p.ORIGIN_ID in
<foreach item="issueId" collection="list" separator="," open="(" close=")" index="">
#{issueId}
</foreach>
order by CREATED_TIME desc limit 100
</select>
</mapper>

21
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiTopicDao.xml

@ -2,5 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.resigroup.ResiTopicDao">
<select id="selectTopicInfoByIds" parameterType="map" resultType="com.epmet.dataaggre.dto.resigroup.ResiTopicDTO">
SELECT
rt.id ,
rt.ISSUE_ID ,
rt.LONGITUDE,
rt.DIMENSION,
RG.GRID_ID
FROM
resi_topic rt
LEFT JOIN resi_group RG
ON(RT.GROUP_ID=RG.ID)
WHERE rt.DEL_FLAG='0'
AND rt.SHIFT_ISSUE = '1'
and LENGTH(rt.LONGITUDE)>0
AND LENGTH(RT.DIMENSION)>0
and rt.id in
<foreach item="topicId" collection="list" separator="," open="(" close=")" index="">
#{topicId}
</foreach>
</select>
</mapper>
Loading…
Cancel
Save