diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java index 1388593063..84e77dc8da 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/GovOrgSelfFeignClient.java +++ b/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 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 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 getAgencyByStaffId(@PathVariable("staffId") String staffId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java index d1210a4f23..c75f6e9257 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/feign/fallback/GovOrgSelfFeignClientFallBack.java +++ b/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 getAgencyGridList(String staffId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyGridList", staffId); } + + @Override + public Result getPublishAgencyList(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getPublishAgencyList", staffId); + } + + @Override + public Result getAgencyByStaffId(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaffId", staffId); + } } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptList.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptList.java new file mode 100644 index 0000000000..c678c1a723 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 = ""; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java new file mode 100644 index 0000000000..ad2c907fd5 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 = ""; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublishAgencyListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublishAgencyListResultDTO.java new file mode 100644 index 0000000000..baa54e8f73 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + /** + * 机关下网格列表信息 + */ + private List agencyGridList; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 5c6d37a701..a5d236f972 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/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 getAgencyGridList(@PathVariable("staffId") String staffId) { return new Result().ok(customerAgencyService.getAgencyGridList(staffId)); } + /** + * @param staffId + * @return + * @Author sun + * @Description 党建声音-政府端-可选发布范围接口调用-根据人员角色查询对应的不同发布范围 + **/ + @PostMapping("getpublishagencylist/{staffId}") + public Result getPublishAgencyList(@PathVariable("staffId") String staffId) { + return new Result().ok(customerAgencyService.getPublishAgencyList(staffId)); + } + + /** + * @param staffId + * @return + * @Author sun + * @Description 根据工作人员Id查询对应的组织信息 + **/ + @PostMapping("getagencybystaffId/{staffId}") + public Result getAgencyByStaffId(@PathVariable("staffId") String staffId) { + return new Result().ok(customerAgencyService.getAgencyByStaffId(staffId)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index 13cb1da0ea..2debda4fce 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/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 * @Description 批量查询部门信息 **/ List selectDeptListByIds(@Param("deptIdList") List deptIdList); + + /** + * @param agencyId + * @return + * @Author sun + * @Description 查询机关下部门列表信息 + **/ + List selectAgencyDeptMsgList(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 2f2fd75797..86303b5b28 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -192,4 +192,12 @@ public interface CustomerGridDao extends BaseDao { * @Description 查询组织下网格列表 **/ List selectAgencyGridList(@Param("agencyId") String agencyId); + + /** + * @param agencyId + * @return + * @Author sun + * @Description 查询机关下网格列表信息 + **/ + List selectAgencyGridMsgList(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index bbd40017b2..f7aeb9367e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -164,4 +164,20 @@ public interface CustomerAgencyService extends BaseService * @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); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 45f234258d..7172d74c7d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/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> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO); - if(null==listResult.getData()||listResult.getData().size() 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 gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId()); returnDTO.setGridList(gridList); //递归查询当前组织的下级组织以及每个下级组织对应的网格列表 List subAgencyGridList = getGridList(agencyEntity.getPids() + ":" + agencyEntity.getId()); returnDTO.setSubAgencyGridList(subAgencyGridList); - }else if(gridParty){ + } else if (gridParty) { //4.2:查询人员在当前机关下参与的网格列表 //查询当前组织下的网格列表 List gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId()); @@ -722,5 +725,102 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl> listResult = epmetUserSelfFeignClient.getCustomerStaffRoleList(formDTO); + if (null == listResult.getData() || listResult.getData().size() < NumConstant.ONE) { + return returnDTO; + } + List 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 = customerDepartmentDao.selectAgencyDeptMsgList(agencyEntity.getId()); + returnDTO.setAgencyDeptList(agencyDeptList); + //当前机关下网格列表 + List agencyGridList = customerGridDao.selectAgencyGridMsgList(agencyEntity.getId()); + returnDTO.setAgencyGridList(agencyGridList); + } else if (gridParty) { + //4.2:查询人员在当前机关下参与的网格列表 + //查询当前组织下的网格列表 + List gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId()); + //查询该工作人员在该客户下参与的网格列表 + CustomerStaffGridDTO staffGridDTO = new CustomerStaffGridDTO(); + staffGridDTO.setCustomerId(staffAgencyDTO.getCustomerId()); + staffGridDTO.setUserId(staffId); + List gridDTOList = customerStaffGridDao.selectStaffGridList(staffGridDTO); + //遍历取出该人员在该组织下参与的网格列表 + List 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; + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index 47273d910c..a31747facc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -54,4 +54,21 @@ id = #{departmentId} + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index cbced7f6d6..11744f7f5a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -329,4 +329,21 @@ WHERE del_flag = '0' AND pid = #{agencyId} + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/OffLineArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/OffLineArticleFormDTO.java new file mode 100644 index 0000000000..54ac353f06 --- /dev/null +++ b/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 gridIdList; + + private String customerId; + + private String staffId; +} + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java index 308585c78b..4142598634 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java +++ b/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 = "下线文章"; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 83c11a43be..881c065acd 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/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().ok(draftAttrResultDTO); } + /** + * @param tokenDTO + * @return + * @Author sun + * @Description 党建声音-政府端-可选发布单位 + **/ + @PostMapping("publishagencylist") + public Result publishAgencyList(@LoginUser TokenDto tokenDTO) { + return new Result().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(); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java index d42919cd95..9b3ef332aa 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java +++ b/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 { - + + /** + * @param rangeEntity + * @return + * @Author sun + * @Description 根据文章Id查询发布范围数据 + **/ + List selectByArticleId(ArticlePublishRangeEntity rangeEntity); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index fa4482b97d..795ad80e6a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/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 { * @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); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index ae8f83582d..49edce1a78 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/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 page(Map params) { @@ -137,6 +153,18 @@ public class ArticleServiceImpl extends BaseServiceImpl 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 rangeEntityList = articlePublishRangeDao.selectByArticleId(rangeEntity); + if (null == rangeEntityList || rangeEntityList.size() < NumConstant.ONE) { + throw new RenException(ArticleConstant.RANGE_DATA_EXCEPTION); + } + + //2:批量更新发布范围数据,将前台勾选的文章网格列表数据置为下线状态 + Date date = new Date(); + //还未下线的发布范围列表 + List publishedList = new ArrayList<>(); + //将要下线的发布范围列表 + List 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 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 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); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml index 595df8b5ea..ee2fa6bf60 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml @@ -3,5 +3,14 @@ - + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java index 1a944da826..d025f8e360 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserSelfFeignClient.java +++ b/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> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO); + Result> getCustomerStaffRoleList(@RequestBody CustomerStaffRoleListFormDTO formDTO); + + /** + * @param staffId + * @return + * @Author sun + * @Description 根据staffId查询工作人员基本信息 + **/ + @PostMapping("/epmetuser/customerstaff/getcustomerstaff/{staffId}") + Result getCustomerStaff(@PathVariable("staffId") String staffId); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java index 4f14d7eac4..76b00a6be0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserSelfFeignClientFallBack.java +++ b/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> getCustomerStaffRoleList(CustomerStaffRoleListFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffRoleList", formDTO); } + + @Override + public Result getCustomerStaff(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaff", staffId); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index f77e5deb4d..ca315b6c68 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -273,4 +273,15 @@ public class CustomerStaffController { return new Result().ok(customerStaffService.getCustomerStaffList(staffIdList)); } + /** + * @param staffId + * @return + * @Author sun + * @Description 根据staffId查询工作人员基本信息 + **/ + @PostMapping(value = "getcustomerstaff/{staffId}") + public Result getCustomerStaff(@PathVariable("staffId") String staffId){ + return new Result().ok(customerStaffService.getCustomerStaff(staffId)); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index c5dbec183f..4922683935 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -132,4 +132,12 @@ public interface CustomerStaffDao extends BaseDao { * @Description 根据staffId集合查询工作人员基础信息 **/ List selectStaffByIds(@Param("staffIdList") List staffIdList); + + /** + * @param staffId + * @return + * @Author sun + * @Description 根据staffId查询工作人员基本信息 + **/ + CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 4f4908cf32..c166c3093f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -225,4 +225,11 @@ public interface CustomerStaffService extends BaseService { **/ CustomerStaffListResultDTO getCustomerStaffList(List staffIdList); + /** + * @param staffId + * @return + * @Author sun + * @Description 根据staffId查询工作人员基本信息 + **/ + CustomerStaffDTO getCustomerStaff(String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index ba47befa3f..be1796082c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -424,4 +424,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl + + \ No newline at end of file