Browse Source

Merge remote-tracking branch 'origin/dev_voice' into dev_voice

master
yinzuomei 5 years ago
parent
commit
f7f6d23865
  1. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java
  2. 12
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java
  3. 44
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptList.java
  4. 44
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java
  5. 53
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublishAgencyListResultDTO.java
  6. 24
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  7. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java
  8. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  9. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  10. 126
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  11. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml
  12. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  13. 35
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/OffLineArticleFormDTO.java
  14. 25
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
  15. 36
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  16. 12
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java
  17. 18
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  18. 121
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  19. 11
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml
  20. 14
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java
  21. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java
  22. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  23. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  24. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  25. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  26. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java

@ -2,8 +2,10 @@ package com.epmet.dto.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.feign.fallback.GovOrgSelfFeignClientFallBack;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
@ -25,4 +27,21 @@ public interface GovOrgSelfFeignClient {
@PostMapping(value = "gov/org/customeragency/getagencygridlist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<ArticleGridResultDTO> getAgencyGridList(@PathVariable("staffId") String staffId);
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位接口调用
**/
@PostMapping(value = "gov/org/customeragency/getpublishagencylist/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<PublishAgencyListResultDTO> getPublishAgencyList(@PathVariable("staffId") String staffId);
/**
* @param staffId
* @return
* @Author sun
* @Description 根据工作人员Id查询对应的组织信息
**/
@PostMapping(value = "gov/org/customeragency/getagencybystaffId/{staffId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<CustomerAgencyDTO> getAgencyByStaffId(@PathVariable("staffId") String staffId);
}

12
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java

@ -3,8 +3,10 @@ package com.epmet.dto.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.feign.GovOrgSelfFeignClient;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import org.springframework.stereotype.Component;
/**
@ -18,4 +20,14 @@ public class GovOrgSelfFeignClientFallBack implements GovOrgSelfFeignClient {
public Result<ArticleGridResultDTO> getAgencyGridList(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyGridList", staffId);
}
@Override
public Result<PublishAgencyListResultDTO> getPublishAgencyList(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getPublishAgencyList", staffId);
}
@Override
public Result<CustomerAgencyDTO> getAgencyByStaffId(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaffId", staffId);
}
}

44
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptList.java

@ -0,0 +1,44 @@
/**
* 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 AgencyDeptList implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门Id
*/
private String departmentId = "";
/**
* 机关-部门名称
*/
private String agencyDeptName = "";
}

44
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java

@ -0,0 +1,44 @@
/**
* 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 AgencyGridList implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格Id
*/
private String gridId = "";
/**
* 机关-网格名称
*/
private String agencyGridName = "";
}

53
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublishAgencyListResultDTO.java

@ -0,0 +1,53 @@
/**
* 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;
import java.util.List;
/**
* 党建声音-可选发布单位-接口返参
*
* @author sun
*/
@Data
public class PublishAgencyListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
private String agencyId = "";
/**
* 机关组织名称
*/
private String agencyName = "";
/**
* 机关下部门列表信息
*/
private List<AgencyDeptList> agencyDeptList;
/**
* 机关下网格列表信息
*/
private List<AgencyGridList> agencyGridList;
}

24
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -169,9 +169,31 @@ public class CustomerAgencyController {
* @Author sun
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
@PostMapping("getagencygridlist/{agencyId}")
@PostMapping("getagencygridlist/{staffId}")
public Result<ArticleGridResultDTO> getAgencyGridList(@PathVariable("staffId") String staffId) {
return new Result<ArticleGridResultDTO>().ok(customerAgencyService.getAgencyGridList(staffId));
}
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
@PostMapping("getpublishagencylist/{staffId}")
public Result<PublishAgencyListResultDTO> getPublishAgencyList(@PathVariable("staffId") String staffId) {
return new Result<PublishAgencyListResultDTO>().ok(customerAgencyService.getPublishAgencyList(staffId));
}
/**
* @param staffId
* @return
* @Author sun
* @Description 根据工作人员Id查询对应的组织信息
**/
@PostMapping("getagencybystaffId/{staffId}")
public Result<CustomerAgencyDTO> getAgencyByStaffId(@PathVariable("staffId") String staffId) {
return new Result<CustomerAgencyDTO>().ok(customerAgencyService.getAgencyByStaffId(staffId));
}
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerIdDTO;
import com.epmet.dto.result.AgencyDeptList;
import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.SubListResultDTO;
import com.epmet.entity.CustomerDepartmentEntity;
@ -75,4 +76,12 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
* @Description 批量查询部门信息
**/
List<CustomerDepartmentDTO> selectDeptListByIds(@Param("deptIdList") List<String> deptIdList);
/**
* @param agencyId
* @return
* @Author sun
* @Description 查询机关下部门列表信息
**/
List<AgencyDeptList> selectAgencyDeptMsgList(@Param("agencyId") String agencyId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -192,4 +192,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Description 查询组织下网格列表
**/
List<AgencyGridListResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @param agencyId
* @return
* @Author sun
* @Description 查询机关下网格列表信息
**/
List<AgencyGridList> selectAgencyGridMsgList(@Param("agencyId") String agencyId);
}

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -164,4 +164,20 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围
**/
ArticleGridResultDTO getAgencyGridList(String staffId);
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位
**/
PublishAgencyListResultDTO getPublishAgencyList(String staffId);
/**
* @param staffId
* @return
* @Author sun
* @Description 根据工作人员Id查询对应的组织信息
**/
CustomerAgencyDTO getAgencyByStaffId(String staffId);
}

126
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -640,52 +640,55 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
@Override
public ArticleGridResultDTO getAgencyGridList(String staffId) {
ArticleGridResultDTO returnDTO = new ArticleGridResultDTO();
//1:根据staffId查询跟工作人员对应的客户Id
//1:根据staffId查询该工作人员对应的机关Id、客户Id
CustomerStaffAgencyDTO staffAgencyDTO = new CustomerStaffAgencyDTO();
staffAgencyDTO.setUserId(staffId);
staffAgencyDTO = customerStaffAgencyDao.selectByStaffId(staffAgencyDTO);
if (null == staffAgencyDTO.getId()) {
throw new RenException(CustomerAgencyConstant.SELECT_AGENCY_STAFF_EXCEPTION);
}
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//2:调用epmet-user服务,根据客户Id、staffId获取该人员在该客户下的角色列表
CustomerStaffRoleListFormDTO formDTO = new CustomerStaffRoleListFormDTO();
formDTO.setCustomerId(staffAgencyDTO.getCustomerId());
formDTO.setStaffId(staffId);
Result<List<CustomerStaffRoleListResultDTO>> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO);
if(null==listResult.getData()||listResult.getData().size()<NumConstant.ONE){
if (null == listResult.getData() || listResult.getData().size() < NumConstant.ONE) {
return returnDTO;
}
List<CustomerStaffRoleListResultDTO> RoleList = listResult.getData();
//3:判断用户是否具有机关党建负责人或网格指导员角色
boolean party = false;//机关党建负责人角色
boolean gridParty = false;//网格指导员角色
for(CustomerStaffRoleListResultDTO role : RoleList){
if(CustomerAgencyConstant.PARTY_PRINCIPALS.equals(role.getRoleKey())){
//机关党建负责人角色
boolean party = false;
//网格指导员角色
boolean gridParty = false;
for (CustomerStaffRoleListResultDTO role : RoleList) {
if (CustomerAgencyConstant.PARTY_PRINCIPALS.equals(role.getRoleKey())) {
party = true;
}
if(CustomerAgencyConstant.GRID_PARTY_DIRECTOR.equals(role.getRoleKey())){
if (CustomerAgencyConstant.GRID_PARTY_DIRECTOR.equals(role.getRoleKey())) {
gridParty = true;
}
}
if(!party&&!gridParty){
if (!party && !gridParty) {
return returnDTO;
}
//4:根据不同角色查询不同数据
if(party){
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
if (party) {
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关信息
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//当前机关下网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
returnDTO.setGridList(gridList);
//递归查询当前组织的下级组织以及每个下级组织对应的网格列表
List<ArticleGridResultDTO> subAgencyGridList = getGridList(agencyEntity.getPids() + ":" + agencyEntity.getId());
returnDTO.setSubAgencyGridList(subAgencyGridList);
}else if(gridParty){
} else if (gridParty) {
//4.2:查询人员在当前机关下参与的网格列表
//查询当前组织下的网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
@ -722,5 +725,102 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return subAgencyList;
}
/**
* @param staffId
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位
**/
@Override
public PublishAgencyListResultDTO getPublishAgencyList(String staffId) {
PublishAgencyListResultDTO returnDTO = new PublishAgencyListResultDTO();
//1:根据staffId查询该工作人员对应的机关Id、客户Id
CustomerStaffAgencyDTO staffAgencyDTO = new CustomerStaffAgencyDTO();
staffAgencyDTO.setUserId(staffId);
staffAgencyDTO = customerStaffAgencyDao.selectByStaffId(staffAgencyDTO);
if (null == staffAgencyDTO.getId()) {
throw new RenException(CustomerAgencyConstant.SELECT_AGENCY_STAFF_EXCEPTION);
}
//2:调用epmet-user服务,根据客户Id、staffId获取该人员在该客户下的角色列表
CustomerStaffRoleListFormDTO formDTO = new CustomerStaffRoleListFormDTO();
formDTO.setCustomerId(staffAgencyDTO.getCustomerId());
formDTO.setStaffId(staffId);
Result<List<CustomerStaffRoleListResultDTO>> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO);
if (null == listResult.getData() || listResult.getData().size() < NumConstant.ONE) {
return returnDTO;
}
List<CustomerStaffRoleListResultDTO> RoleList = listResult.getData();
//3:判断用户是否具有机关党建负责人或网格指导员角色
//机关党建负责人角色
boolean party = false;
//网格指导员角色
boolean gridParty = false;
for (CustomerStaffRoleListResultDTO role : RoleList) {
if (CustomerAgencyConstant.PARTY_PRINCIPALS.equals(role.getRoleKey())) {
party = true;
}
if (CustomerAgencyConstant.GRID_PARTY_DIRECTOR.equals(role.getRoleKey())) {
gridParty = true;
}
}
if (!party && !gridParty) {
return returnDTO;
}
//4:根据不同角色查询不同数据
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
if (party) {
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关信息
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//当前机关下部门列表信息
List<AgencyDeptList> agencyDeptList = customerDepartmentDao.selectAgencyDeptMsgList(agencyEntity.getId());
returnDTO.setAgencyDeptList(agencyDeptList);
//当前机关下网格列表
List<AgencyGridList> agencyGridList = customerGridDao.selectAgencyGridMsgList(agencyEntity.getId());
returnDTO.setAgencyGridList(agencyGridList);
} else if (gridParty) {
//4.2:查询人员在当前机关下参与的网格列表
//查询当前组织下的网格列表
List<AgencyGridListResultDTO> gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId());
//查询该工作人员在该客户下参与的网格列表
CustomerStaffGridDTO staffGridDTO = new CustomerStaffGridDTO();
staffGridDTO.setCustomerId(staffAgencyDTO.getCustomerId());
staffGridDTO.setUserId(staffId);
List<CustomerStaffGridDTO> gridDTOList = customerStaffGridDao.selectStaffGridList(staffGridDTO);
//遍历取出该人员在该组织下参与的网格列表
List<AgencyGridList> resultList = gridList.stream().flatMap(agencyGrid -> gridDTOList.stream().filter(staffGrid ->
agencyGrid.getGridId().equals(staffGrid.getGridId())).map(grid -> {
AgencyGridList resultDTO = new AgencyGridList();
resultDTO.setGridId(agencyGrid.getGridId());
resultDTO.setAgencyGridName(agencyEntity.getOrganizationName() + "-" + agencyGrid.getGridName());
return resultDTO;
})).collect(Collectors.toList());
returnDTO.setAgencyGridList(resultList);
}
return returnDTO;
}
/**
* @param staffId
* @return
* @Author sun
* @Description 根据工作人员Id查询对应的组织信息
**/
@Override
public CustomerAgencyDTO getAgencyByStaffId(String staffId) {
//调用现有方法查询工作人员对应组织信息
CustomerStaffAgencyDTO staffAgencyDTO = new CustomerStaffAgencyDTO();
staffAgencyDTO.setUserId(staffId);
staffAgencyDTO = customerStaffAgencyDao.selectByStaffId(staffAgencyDTO);
CustomerAgencyEntity entity = baseDao.selectById(staffAgencyDTO.getAgencyId());
CustomerAgencyDTO dto = ConvertUtils.sourceToTarget(entity, CustomerAgencyDTO.class);
return dto;
}
}

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml

@ -54,4 +54,21 @@
id = #{departmentId}
</foreach>
</select>
<select id="selectAgencyDeptMsgList" resultType="com.epmet.dto.result.AgencyDeptList">
SELECT
cd.id AS "departmentId",
CONCAT(
ca.organization_name,
"-",
cd.department_name
) "agencyDeptName"
FROM
customer_department cd
INNER JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
cd.del_flag = '0'
AND ca.del_flag = '0'
AND cd.agency_id = #{agencyId}
</select>
</mapper>

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -329,4 +329,21 @@
WHERE del_flag = '0'
AND pid = #{agencyId}
</select>
<select id="selectAgencyGridMsgList" resultType="com.epmet.dto.result.AgencyGridList">
SELECT
cg.id AS "gridId",
CONCAT(
ca.organization_name,
"-",
cg.grid_name
) "agencyGridName"
FROM
customer_grid cg
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = #{agencyId}
</select>
</mapper>

35
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/OffLineArticleFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
/**
* @Description 党建声音-政府端-下线文章-接口入参
* @Author sun
*/
@Data
public class OffLineArticleFormDTO implements Serializable {
private static final long serialVersionUID = 4859779755214502427L;
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
@NotBlank(message = "文章Id不能为空", groups = { AddUserInternalGroup.class })
private String articleId;
@Size(min = 1, message = "项目人员关联Id不能为空", groups = {AddUserInternalGroup.class})
private List<String> gridIdList;
private String customerId;
private String staffId;
}

25
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java

@ -14,4 +14,29 @@ package com.epmet.constant;
* @since 1.0.0
*/
public interface ArticleConstant {
/**
* 发布状态-已发布
*/
String PUBLISHED = "published";
/**
* 发布状态-已下线
*/
String OFFLINE = "offline";
/**
* 文章发布范围内已全部下线不能再调用此接口
*/
String RANGE_DATA_EXCEPTION = "发布范围内无可下线文章";
/**
* 调用epmet-user服务查询工作人员基本信息失败
*/
String SELECT_STAFF_EXCEPTION = "获取用户基本信息失败";
/**
* 调用gov-org服务查询工作人员组织信息失败
*/
String SELECT_AGRNCY_EXCEPTION = "获取用户组织信息失败";
/**
* 下线文章(用于拼接操作表字段值)
*/
String OFF_LINE_ARTICLE = "下线文章";
}

36
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -30,11 +30,13 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ArticleDTO;
import com.epmet.dto.form.ArticleOperationFormDTO;
import com.epmet.dto.form.DraftContentFromDTO;
import com.epmet.dto.form.DraftDetailFormDTO;
import com.epmet.dto.form.GovArticleDetailFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.ArticleOperationResultDTO;
import com.epmet.dto.result.GovArticleDetailResultDTO;
import com.epmet.dto.result.LatestListResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.excel.ArticleExcel;
import com.epmet.service.ArticleOperateRecordService;
import com.epmet.service.ArticleService;
@ -188,4 +190,30 @@ public class ArticleController {
DraftAttrResultDTO draftAttrResultDTO=draftService.getDraftAttr(formDTO);
return new Result<DraftAttrResultDTO>().ok(draftAttrResultDTO);
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
@PostMapping("publishagencylist")
public Result<PublishAgencyListResultDTO> publishAgencyList(@LoginUser TokenDto tokenDTO) {
return new Result<PublishAgencyListResultDTO>().ok(articleService.publishAgencyList(tokenDTO));
}
/**
* @param tokenDTO formDTO
* @return
* @Author sun
* @Description 党建声音-政府端-下线文章
**/
@PostMapping("offlinearticle")
public Result offLineArticle(@LoginUser TokenDto tokenDTO, @RequestBody OffLineArticleFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
formDTO.setStaffId(tokenDTO.getUserId());
ValidatorUtils.validateEntity(formDTO, OffLineArticleFormDTO.AddUserInternalGroup.class);
articleService.offLineArticle(formDTO);
return new Result();
}
}

12
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java

@ -18,9 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ArticlePublishRangeDTO;
import com.epmet.entity.ArticlePublishRangeEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 文章发布范围表
*
@ -29,5 +32,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ArticlePublishRangeDao extends BaseDao<ArticlePublishRangeEntity> {
/**
* @param rangeEntity
* @return
* @Author sun
* @Description 根据文章Id查询发布范围数据
**/
List<ArticlePublishRangeEntity> selectByArticleId(ArticlePublishRangeEntity rangeEntity);
}

18
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -22,8 +22,10 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.ArticleDTO;
import com.epmet.dto.form.DraftContentFromDTO;
import com.epmet.dto.form.OffLineArticleFormDTO;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.GovArticleDetailResultDTO;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.entity.ArticleEntity;
import java.util.List;
@ -123,4 +125,20 @@ public interface ArticleService extends BaseService<ArticleEntity> {
* @date 2020-06-03
*/
GovArticleDetailResultDTO queryGovArticleDetail(String articleId);
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 党建声音-政府端-下线文章
**/
void offLineArticle(OffLineArticleFormDTO formDTO);
}

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

@ -31,19 +31,26 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constant.ArticleConstant;
import com.epmet.dao.ArticleDao;
import com.epmet.dao.ArticlePublishRangeDao;
import com.epmet.dao.DraftContentDao;
import com.epmet.dao.DraftDao;
import com.epmet.dto.ArticleDTO;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.feign.GovOrgSelfFeignClient;
import com.epmet.dto.form.DraftContentFromDTO;
import com.epmet.dto.form.OffLineArticleFormDTO;
import com.epmet.dto.result.ArticleGridResultDTO;
import com.epmet.dto.result.GovArticleContentDTO;
import com.epmet.dto.result.GovArticleDetailResultDTO;
import com.epmet.entity.ArticleEntity;
import com.epmet.entity.DraftContentEntity;
import com.epmet.entity.DraftEntity;
import com.epmet.dto.result.PublishAgencyListResultDTO;
import com.epmet.entity.*;
import com.epmet.feign.EpmetUserSelfFeignClient;
import com.epmet.redis.ArticleRedis;
import com.epmet.service.ArticleOperateRecordService;
import com.epmet.service.ArticlePublishRangeService;
import com.epmet.service.ArticleService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@ -54,6 +61,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* 文章表
@ -72,6 +80,14 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private DraftDao draftDao;
@Autowired
private DraftContentDao draftContentDao;
@Autowired
private ArticlePublishRangeService articlePublishRangeService;
@Autowired
private ArticlePublishRangeDao articlePublishRangeDao;
@Autowired
private EpmetUserSelfFeignClient epmetUserSelfFeignClient;
@Autowired
private ArticleOperateRecordService articleOperateRecordService;
@Override
public PageData<ArticleDTO> page(Map<String, Object> params) {
@ -137,6 +153,18 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return result.getData();
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
@Override
public PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO) {
Result<PublishAgencyListResultDTO> result = govOrgSelfFeignClient.getPublishAgencyList(tokenDTO.getUserId());
return result.getData();
}
@Override
@Transactional(rollbackFor = Exception.class)
public String saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) {
@ -230,4 +258,91 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return newContentList;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 党建声音-政府端-下线文章
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void offLineArticle(OffLineArticleFormDTO formDTO) {
//1:根据文章Id查询全部(已发布、已下线)发布范围数据
ArticlePublishRangeEntity rangeEntity = new ArticlePublishRangeEntity();
rangeEntity.setArticleId(formDTO.getArticleId());
List<ArticlePublishRangeEntity> rangeEntityList = articlePublishRangeDao.selectByArticleId(rangeEntity);
if (null == rangeEntityList || rangeEntityList.size() < NumConstant.ONE) {
throw new RenException(ArticleConstant.RANGE_DATA_EXCEPTION);
}
//2:批量更新发布范围数据,将前台勾选的文章网格列表数据置为下线状态
Date date = new Date();
//还未下线的发布范围列表
List<ArticlePublishRangeEntity> publishedList = new ArrayList<>();
//将要下线的发布范围列表
List<ArticlePublishRangeEntity> offLineList = new ArrayList<>();
rangeEntityList.forEach(entity -> {
if (entity.getPublishStatus().equals(ArticleConstant.PUBLISHED)) {
//是否下线(true:是)
AtomicBoolean isOffLine = new AtomicBoolean(false);
formDTO.getGridIdList().forEach(gridId -> {
if (entity.getGridId().equals(gridId)) {
isOffLine.set(true);
entity.setOffLineTime(date);
entity.setPublishStatus(ArticleConstant.OFFLINE);
offLineList.add(entity);
}
});
if (!isOffLine.get()) {
publishedList.add(entity);
}
}
});
//2.1:批量更新发布范围表数据
articlePublishRangeService.updateBatchById(offLineList);
//3:根据是否全部下线更新文章主表数据
ArticleEntity entity = new ArticleEntity();
entity.setId(formDTO.getArticleId());
StringBuffer publishRangeDesc = new StringBuffer();
if (null == publishedList || publishedList.size() < NumConstant.ONE) {
entity.setStatusFlag(ArticleConstant.OFFLINE);
entity.setOffLineTime(date);
rangeEntityList.forEach(range -> {
publishRangeDesc.append(publishRangeDesc.length() > NumConstant.ZERO ? "、" : "");
publishRangeDesc.append(range.getAgencyGridName());
});
} else {
publishedList.forEach(pub -> {
publishRangeDesc.append(publishRangeDesc.length() > NumConstant.ZERO ? "、" : "");
publishRangeDesc.append(pub.getAgencyGridName());
});
}
entity.setPublishRangeDesc(publishRangeDesc.toString());
baseDao.updateById(entity);
//4:文章操作记录表新增数据
//4.1:调用epmet-user服务,查询工作人员信息
Result<CustomerStaffDTO> resultStaff = epmetUserSelfFeignClient.getCustomerStaff(formDTO.getStaffId());
if (null == resultStaff.getData()) {
throw new RenException(ArticleConstant.SELECT_STAFF_EXCEPTION);
}
CustomerStaffDTO staffDTO = resultStaff.getData();
//4.2:调用gov-org服务,查询当前人员所属组织机构信息
Result<CustomerAgencyDTO> resultAgency = govOrgSelfFeignClient.getAgencyByStaffId(formDTO.getStaffId());
if (null == resultAgency.getData()) {
throw new RenException(ArticleConstant.SELECT_AGRNCY_EXCEPTION);
}
CustomerAgencyDTO agencyDTO = resultAgency.getData();
//4.3:新增操作表数据
ArticleOperateRecordEntity recordEntity = new ArticleOperateRecordEntity();
recordEntity.setCustomerId(formDTO.getCustomerId());
recordEntity.setArticleId(formDTO.getArticleId());
recordEntity.setOpUser(agencyDTO.getOrganizationName() + "-" + staffDTO.getRealName());
recordEntity.setContent(recordEntity.getOpUser() + ArticleConstant.OFF_LINE_ARTICLE);
recordEntity.setOpType(ArticleConstant.OFFLINE);
recordEntity.setOpTime(date);
articleOperateRecordService.insert(recordEntity);
}
}

11
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml

@ -3,5 +3,14 @@
<mapper namespace="com.epmet.dao.ArticlePublishRangeDao">
<select id="selectByArticleId" resultType="com.epmet.entity.ArticlePublishRangeEntity">
SELECT
*
FROM
article_publish_range
WHERE
del_flag = '0'
AND article_id = #{articleId}
ORDER BY created_time ASC
</select>
</mapper>

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

@ -2,11 +2,14 @@ package com.epmet.feign;
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.result.CustomerStaffRoleListResultDTO;
import com.epmet.feign.fallback.EpmetUserSelfFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@ -24,6 +27,15 @@ public interface EpmetUserSelfFeignClient {
* @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表
**/
@PostMapping("/epmetuser/staffrole/getcustomerstaffrolelist")
Result<List<CustomerStaffRoleListResultDTO>> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO);
Result<List<CustomerStaffRoleListResultDTO>> getCustomerStaffRoleList(@RequestBody CustomerStaffRoleListFormDTO formDTO);
/**
* @param staffId
* @return
* @Author sun
* @Description 根据staffId查询工作人员基本信息
**/
@PostMapping("/epmetuser/customerstaff/getcustomerstaff/{staffId}")
Result<CustomerStaffDTO> getCustomerStaff(@PathVariable("staffId") String staffId);
}

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

@ -3,6 +3,7 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
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.result.CustomerStaffRoleListResultDTO;
import com.epmet.feign.EpmetUserSelfFeignClient;
@ -21,4 +22,9 @@ public class EpmetUserSelfFeignClientFallBack implements EpmetUserSelfFeignClien
public Result<List<CustomerStaffRoleListResultDTO>> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffRoleList", formDTO);
}
@Override
public Result<CustomerStaffDTO> getCustomerStaff(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaff", staffId);
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -273,4 +273,15 @@ public class CustomerStaffController {
return new Result<CustomerStaffListResultDTO>().ok(customerStaffService.getCustomerStaffList(staffIdList));
}
/**
* @param staffId
* @return
* @Author sun
* @Description 根据staffId查询工作人员基本信息
**/
@PostMapping(value = "getcustomerstaff/{staffId}")
public Result<CustomerStaffDTO> getCustomerStaff(@PathVariable("staffId") String staffId){
return new Result<CustomerStaffDTO>().ok(customerStaffService.getCustomerStaff(staffId));
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -132,4 +132,12 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Description 根据staffId集合查询工作人员基础信息
**/
List<StaffListResultDTO> selectStaffByIds(@Param("staffIdList") List<String> staffIdList);
/**
* @param staffId
* @return
* @Author sun
* @Description 根据staffId查询工作人员基本信息
**/
CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId);
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -225,4 +225,11 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
**/
CustomerStaffListResultDTO getCustomerStaffList(List<String> staffIdList);
/**
* @param staffId
* @return
* @Author sun
* @Description 根据staffId查询工作人员基本信息
**/
CustomerStaffDTO getCustomerStaff(String staffId);
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -424,4 +424,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return list;
}
/**
* @param staffId
* @return
* @Author sun
* @Description 根据staffId查询工作人员基本信息
**/
@Override
public CustomerStaffDTO getCustomerStaff(String staffId) {
return baseDao.selectByStaffId(staffId);
}
}

10
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -193,4 +193,14 @@
user_id = #{userId}
</foreach>
</select>
<select id="selectByStaffId" resultType="com.epmet.dto.CustomerStaffDTO">
SELECT
*
FROM
customer_staff
WHERE
del_flag = '0'
AND user_id = #{staffId}
</select>
</mapper>
Loading…
Cancel
Save