diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/GetRangeResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/GetRangeResultDTO.java new file mode 100644 index 0000000000..d1ea08f6fe --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/GetRangeResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dataaggre.dto.epmettduck.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/9/18 14:41 + */ +@Data +public class GetRangeResultDTO implements Serializable { + private static final long serialVersionUID = 3208245365454855156L; + /** + * 适用于哪个端 resi:居民端用户;gov:工作端用户 + */ + private String client; + /** + * 发布范围组织列表 + */ + private List orgList; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java index 169fd2eb04..8491176bcc 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java @@ -1,25 +1,21 @@ package com.epmet.dataaggre.controller; -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.epmet.commons.tools.annotation.LoginUser; 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.epmettduck.PrPublishRangeDTO; +import com.epmet.dataaggre.dto.epmettduck.form.ProjectKeyCommonDTO; import com.epmet.dataaggre.dto.epmettduck.form.TDuckDetailFormDTO; import com.epmet.dataaggre.dto.epmettduck.form.TDuckHeaderInfoFormDTO; import com.epmet.dataaggre.dto.epmettduck.form.TDuckListFormDTO; +import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO; +import com.epmet.dataaggre.dto.epmettduck.result.GetRangeResultDTO; +import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO; import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectItemEntity; import com.epmet.dataaggre.service.epmettduck.PrUserProjectItemService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dataaggre.dto.epmettduck.form.ProjectKeyCommonDTO; -import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO; -import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO; import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -105,4 +101,16 @@ public class EpmetTDuckController { return new Result().ok(prUserProjectService.headerInfo(formDTO)); } + /** + * @Description 获取发布范围 + * @Param formDTO + * @Return {@link Result< GetRangeResultDTO>} + * @Author zhaoqifeng + * @Date 2021/9/18 15:18 + */ + @PostMapping("getrange") + public Result getRange(@RequestBody PrPublishRangeDTO formDTO) { + return new Result().ok(prUserProjectService.getRange(formDTO.getProjectKey())); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrPublishRangeService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrPublishRangeService.java index 403587d43d..bef2464a1d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrPublishRangeService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrPublishRangeService.java @@ -92,4 +92,13 @@ public interface PrPublishRangeService extends BaseService * @date 2021-09-15 */ void delete(String[] ids); + + /** + * @Description 发布范围组织列表 + * @Param projectKey + * @Return {@link List< String>} + * @Author zhaoqifeng + * @Date 2021/9/18 15:28 + */ + List getRangeOrgList(String projectKey); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java index b581036ef0..7ba470a900 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java @@ -23,6 +23,7 @@ import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO; import com.epmet.dataaggre.dto.epmettduck.form.TDuckHeaderInfoFormDTO; import com.epmet.dataaggre.dto.epmettduck.form.TDuckListFormDTO; import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO; +import com.epmet.dataaggre.dto.epmettduck.result.GetRangeResultDTO; import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO; import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity; @@ -133,4 +134,13 @@ public interface PrUserProjectService extends BaseService { * @date 2021/9/18 10:35 上午 */ PrUserProjectEntity headerInfo(TDuckHeaderInfoFormDTO formDTO); + + /** + * @Description 获取发布范围 + * @Param projectKey + * @Return {@link GetRangeResultDTO} + * @Author zhaoqifeng + * @Date 2021/9/18 15:18 + */ + GetRangeResultDTO getRange(String projectKey); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrPublishRangeServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrPublishRangeServiceImpl.java index c6bb01a72e..cc7d940a6e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrPublishRangeServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrPublishRangeServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.dataaggre.service.epmettduck.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; @@ -30,13 +31,16 @@ import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO; import com.epmet.dataaggre.entity.epmettduck.PrPublishRangeEntity; import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 项目发布范围表 @@ -101,4 +105,23 @@ public class PrPublishRangeServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2021/9/18 15:28 + */ + @Override + public List getRangeOrgList(String projectKey) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PrPublishRangeEntity::getProjectKey, projectKey); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(PrPublishRangeEntity::getOrgId).collect(Collectors.toList()); + } + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java index 22b4795302..645b2dbd6a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java @@ -19,11 +19,9 @@ package com.epmet.dataaggre.service.epmettduck.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; @@ -37,13 +35,11 @@ import com.epmet.dataaggre.dto.epmettduck.PrUserProjectDTO; import com.epmet.dataaggre.dto.epmettduck.ProjectItemTypeEnum; import com.epmet.dataaggre.dto.epmettduck.form.TDuckHeaderInfoFormDTO; import com.epmet.dataaggre.dto.epmettduck.form.TDuckListFormDTO; -import com.epmet.dataaggre.dto.epmettduck.result.AnalysisReportResDTO; -import com.epmet.dataaggre.dto.epmettduck.result.OptionDTO; -import com.epmet.dataaggre.dto.epmettduck.result.ProjectProfileResultDTO; -import com.epmet.dataaggre.dto.epmettduck.result.TDuckListResultDTO; +import com.epmet.dataaggre.dto.epmettduck.result.*; import com.epmet.dataaggre.dto.epmettduck.struct.*; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectEntity; import com.epmet.dataaggre.entity.epmettduck.PrUserProjectResultEntity; +import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService; import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -54,6 +50,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -72,6 +69,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl page(Map params) { @@ -479,6 +478,25 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PrUserProjectEntity :: getKey, projectKey); + PrUserProjectEntity entity = baseDao.selectOne(wrapper); + result.setClient(entity.getClient()); + result.setOrgList(prPublishRangeService.getRangeOrgList(projectKey)); + return result; + } + private List> sortMap(Map map, boolean asc) { Stream> stream = null;