Browse Source

政府端党建声音列表

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
e46d3fc414
  1. 5
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java
  2. 30
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  3. 48
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleResultDTO.java
  4. 34
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java
  5. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java

5
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java

@ -23,6 +23,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* 文章表
@ -75,7 +76,7 @@ public interface ArticleDao extends BaseDao<ArticleEntity> {
* @return java.util.List<com.epmet.dto.result.PublishedListResultDTO>
*/
@DataFilter(tableAliases = {"a", "apr"}, gridIdArgName = "gridList")
List<PublishedListResultDTO> selectArticleListForGrid(@Param("customerId") String customerId, @Param("gridList") List<String> gridList);
List<PublishedListResultDTO> selectArticleListForGrid(@Param("customerId") String customerId, Set<String> gridList);
/**
* 已下线文章列表
@ -85,6 +86,6 @@ public interface ArticleDao extends BaseDao<ArticleEntity> {
* @return java.util.List<com.epmet.dto.result.OfflineListResultDTO>
*/
@DataFilter(tableAliases = "a", gridIdArgName = "gridList")
List<OfflineListResultDTO> selectOfflineList(@Param("gridList") List<String> gridList);
List<OfflineListResultDTO> selectOfflineList(Set<String> gridList);
}

30
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -43,9 +43,7 @@ import com.epmet.dto.feign.GovOrgSelfFeignClient;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserSelfFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.redis.ArticleRedis;
import com.epmet.service.ArticleOperateRecordService;
import com.epmet.service.ArticlePublishRangeService;
@ -92,10 +90,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private DraftCoverDao draftCoverDao;
@Autowired
private DraftPublishRangeDao draftPublishRangeDao;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
private static final String AGENCY = "agency";
private static final String GRID = "grid";
@ -526,11 +520,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
public PageData publishedArticleList(TokenDto tokenDto, PublishedListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
List<PublishedListResultDTO> resultList;
Result<CustomerAgencyDTO> customerAgencyResult = govOrgFeignClient.getAgencyByStaff(tokenDto.getUserId());
if (!customerAgencyResult.success()) {
throw new RenException(customerAgencyResult.getCode(), customerAgencyResult.getMsg());
}
List<CustomerStaffRoleResultDTO> roles = epmetUserFeignClient.getStaffRoles(tokenDto.getUserId()).getData();
List<CustomerStaffRoleResultDTO> roles = epmetUserSelfFeignClient.getStaffRoles(tokenDto.getUserId()).getData();
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO();
loginUserDetailsFormDTO.setApp(tokenDto.getApp());
loginUserDetailsFormDTO.setClient(tokenDto.getClient());
loginUserDetailsFormDTO.setUserId(tokenDto.getUserId());
LoginUserDetailsResultDTO userInfo = epmetUserSelfFeignClient.getLoginUserDetails(loginUserDetailsFormDTO).getData();
String staffLevel = "";
for (CustomerStaffRoleResultDTO role : roles) {
//党建负责人
@ -548,9 +543,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
if (AGENCY.equals(staffLevel)) {
resultList = baseDao.selectArticleListForAgency(tokenDto.getCustomerId());
} else {
//TODO
List<String> gridList = new ArrayList<>();
resultList = baseDao.selectArticleListForGrid(tokenDto.getCustomerId(), gridList);
resultList = baseDao.selectArticleListForGrid(tokenDto.getCustomerId(), userInfo.getGridIdList());
}
PageInfo<PublishedListResultDTO> pageInfo = new PageInfo<>(resultList);
return new PageData<>(resultList, pageInfo.getTotal());
@ -559,8 +552,13 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
public PageData offlineList(TokenDto tokenDto, OfflineListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
List<String> gridList = new ArrayList<>();
List<OfflineListResultDTO> resultList = baseDao.selectOfflineList(gridList);
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO();
loginUserDetailsFormDTO.setApp(tokenDto.getApp());
loginUserDetailsFormDTO.setClient(tokenDto.getClient());
loginUserDetailsFormDTO.setUserId(tokenDto.getUserId());
LoginUserDetailsResultDTO userInfo = epmetUserSelfFeignClient.getLoginUserDetails(loginUserDetailsFormDTO).getData();
List<OfflineListResultDTO> resultList = baseDao.selectOfflineList(userInfo.getGridIdList());
PageInfo<OfflineListResultDTO> pageInfo = new PageInfo<>(resultList);
return new PageData<>(resultList, pageInfo.getTotal());
}

48
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CustomerStaffRoleResultDTO.java

@ -0,0 +1,48 @@
/**
* 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.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 工作人员角色
*
* @author sun
*/
@Data
public class CustomerStaffRoleResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 工作人员Id
*/
private String staffId = "";
/**
* 人员角色Key
*/
private String roleKey = "";
/**
* 人员角色名称
*/
private String roleName = "";
}

34
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java

@ -4,7 +4,12 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.form.TagCustomerFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.TagCustomerResultDTO;
import com.epmet.feign.fallback.EpmetUserSelfFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
@ -14,8 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @dscription epmet-user服务
* @author sun
* @dscription epmet-user服务
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserSelfFeignClientFallBack.class)
public interface EpmetUserSelfFeignClient {
@ -38,4 +43,31 @@ public interface EpmetUserSelfFeignClient {
@PostMapping("/epmetuser/customerstaff/getcustomerstaff/{staffId}")
Result<CustomerStaffDTO> getCustomerStaff(@PathVariable("staffId") String staffId);
/**
* 从缓存中查询已登录用户的基本信息以及角色等相关信息
*
* @return
*/
@PostMapping("/epmetuser/user/loginuserdetails")
Result<LoginUserDetailsResultDTO> getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto);
/**
* @param formDTO
* @Description 根据userId获取customerId
* @author zxc
*/
@PostMapping("/epmetuser/user/getcustomeridbyuserid")
Result<TagCustomerResultDTO> getCustomerIdByUserId(@RequestBody TagCustomerFormDTO formDTO);
/**
* 根据staffId查询人员拥有的所有角色信息
*
* @param staffId
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.CustomerStaffRoleResultDTO>>
* @author zhaoqifeng
* @date 2020/6/2 16:11
*/
@PostMapping("/epmetuser/staffrole/staffroles/{staffId}")
Result<List<CustomerStaffRoleResultDTO>> getStaffRoles(@PathVariable String staffId);
}

20
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java

@ -5,7 +5,12 @@ import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.CustomerStaffRoleListFormDTO;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.form.TagCustomerFormDTO;
import com.epmet.dto.result.CustomerStaffRoleListResultDTO;
import com.epmet.dto.result.CustomerStaffRoleResultDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.TagCustomerResultDTO;
import com.epmet.feign.EpmetUserSelfFeignClient;
import org.springframework.stereotype.Component;
@ -27,4 +32,19 @@ public class EpmetUserSelfFeignClientFallBack implements EpmetUserSelfFeignClien
public Result<CustomerStaffDTO> getCustomerStaff(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaff", staffId);
}
@Override
public Result<LoginUserDetailsResultDTO> getLoginUserDetails(LoginUserDetailsFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLoginUserDetails", dto);
}
@Override
public Result<TagCustomerResultDTO> getCustomerIdByUserId(TagCustomerFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerIdByUserId", formDTO);
}
@Override
public Result<List<CustomerStaffRoleResultDTO>> getStaffRoles(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffRoles", staffId);
}
}

Loading…
Cancel
Save