Browse Source

发布范围回显

master
zhaoqifeng 4 years ago
parent
commit
85f6011766
  1. 24
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/GetRangeResultDTO.java
  2. 26
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java
  3. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrPublishRangeService.java
  4. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/PrUserProjectService.java
  5. 23
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrPublishRangeServiceImpl.java
  6. 30
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java

24
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<String> orgList;
}

26
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<PrUserProjectEntity>().ok(prUserProjectService.headerInfo(formDTO));
}
/**
* @Description 获取发布范围
* @Param formDTO
* @Return {@link Result< GetRangeResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/18 15:18
*/
@PostMapping("getrange")
public Result<GetRangeResultDTO> getRange(@RequestBody PrPublishRangeDTO formDTO) {
return new Result<GetRangeResultDTO>().ok(prUserProjectService.getRange(formDTO.getProjectKey()));
}
}

9
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<PrPublishRangeEntity>
* @date 2021-09-15
*/
void delete(String[] ids);
/**
* @Description 发布范围组织列表
* @Param projectKey
* @Return {@link List< String>}
* @Author zhaoqifeng
* @Date 2021/9/18 15:28
*/
List<String> getRangeOrgList(String projectKey);
}

10
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<PrUserProjectEntity> {
* @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);
}

23
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<PrPublishRangeDao
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param projectKey
* @Description 发布范围组织列表
* @Param projectKey
* @Return {@link List< String>}
* @Author zhaoqifeng
* @Date 2021/9/18 15:28
*/
@Override
public List<String> getRangeOrgList(String projectKey) {
LambdaQueryWrapper<PrPublishRangeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PrPublishRangeEntity::getProjectKey, projectKey);
List<PrPublishRangeEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(PrPublishRangeEntity::getOrgId).collect(Collectors.toList());
}
}

30
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<PrUserProjectDao,
@Autowired
private PrVistRecordDao visitRecordDao;
@Resource
private PrPublishRangeService prPublishRangeService;
@Override
public PageData<PrUserProjectDTO> page(Map<String, Object> params) {
@ -479,6 +478,25 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
return eq.getEntity();
}
/**
* @param projectKey
* @Description 获取发布范围
* @Param projectKey
* @Return {@link GetRangeResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/18 15:18
*/
@Override
public GetRangeResultDTO getRange(String projectKey) {
GetRangeResultDTO result = new GetRangeResultDTO();
LambdaQueryWrapper<PrUserProjectEntity> 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<Map.Entry<Integer, Integer>> sortMap(Map<Integer, Integer> map, boolean asc) {
Stream<Map.Entry<Integer, Integer>> stream = null;

Loading…
Cancel
Save