|
|
@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils; |
|
|
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils; |
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant; |
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
@ -29,23 +30,30 @@ import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
import com.elink.esua.epdc.dto.constant.GroupConstant; |
|
|
import com.elink.esua.epdc.dto.constant.GroupConstant; |
|
|
import com.elink.esua.epdc.dto.enums.GroupStateEnum; |
|
|
import com.elink.esua.epdc.dto.enums.GroupStateEnum; |
|
|
|
|
|
import com.elink.esua.epdc.dto.events.form.GroupFormDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.group.GroupDTO; |
|
|
import com.elink.esua.epdc.dto.project.PropertyProjectDTO; |
|
|
import com.elink.esua.epdc.dto.project.PropertyProjectDTO; |
|
|
import com.elink.esua.epdc.dto.project.form.ProjectDetailFormDTO; |
|
|
import com.elink.esua.epdc.dto.project.form.ProjectDetailFormDTO; |
|
|
import com.elink.esua.epdc.dto.project.form.ProjectListFormDTO; |
|
|
import com.elink.esua.epdc.dto.project.form.ProjectListFormDTO; |
|
|
import com.elink.esua.epdc.dto.project.result.ProjectDetailResultDTO; |
|
|
import com.elink.esua.epdc.dto.project.result.ProjectDetailResultDTO; |
|
|
import com.elink.esua.epdc.dto.project.result.ProjectListResultDTO; |
|
|
import com.elink.esua.epdc.dto.project.result.ProjectListResultDTO; |
|
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|
|
|
|
|
import com.elink.esua.epdc.modules.feign.EventFeignClient; |
|
|
import com.elink.esua.epdc.modules.group.dao.GroupDao; |
|
|
import com.elink.esua.epdc.modules.group.dao.GroupDao; |
|
|
import com.elink.esua.epdc.modules.group.entity.GroupEntity; |
|
|
import com.elink.esua.epdc.modules.group.entity.GroupEntity; |
|
|
|
|
|
import com.elink.esua.epdc.modules.group.service.GroupService; |
|
|
import com.elink.esua.epdc.modules.project.dao.PropertyProjectDao; |
|
|
import com.elink.esua.epdc.modules.project.dao.PropertyProjectDao; |
|
|
import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; |
|
|
import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; |
|
|
import com.elink.esua.epdc.modules.project.service.PropertyProjectService; |
|
|
import com.elink.esua.epdc.modules.project.service.PropertyProjectService; |
|
|
|
|
|
import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; |
|
|
|
|
|
import com.elink.esua.epdc.modules.topic.service.TopicService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
@ -62,6 +70,15 @@ public class PropertyProjectServiceImpl extends BaseServiceImpl<PropertyProjectD |
|
|
@Autowired |
|
|
@Autowired |
|
|
private AdminFeignClient adminFeignClient; |
|
|
private AdminFeignClient adminFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private TopicService topicService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EventFeignClient eventFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private GroupService groupService; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private GroupDao groupDao; |
|
|
private GroupDao groupDao; |
|
|
|
|
|
|
|
|
@ -194,4 +211,97 @@ public class PropertyProjectServiceImpl extends BaseServiceImpl<PropertyProjectD |
|
|
return baseDao.selectDetailByIdV2(dto); |
|
|
return baseDao.selectDetailByIdV2(dto); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void modifyOrganizationInfo(OrganizationModifyDTO dto) { |
|
|
|
|
|
// 查询需要修改组织机构信息邻里党群
|
|
|
|
|
|
List<PropertyProjectDTO> groupList = baseDao.selectListOfOrganizationInfo(dto.getDeptId().toString()); |
|
|
|
|
|
if (null != groupList && groupList.size() > 0) { |
|
|
|
|
|
// 组织机构信息处理
|
|
|
|
|
|
List<PropertyProjectEntity> entities = handleOrganizationInfo(dto, groupList); |
|
|
|
|
|
// 更新邻里党群组织机构信息
|
|
|
|
|
|
updateBatchById(entities); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新网格名称
|
|
|
|
|
|
baseDao.updateGridByDeptId(dto.getNewDeptName(), dto.getDeptId()); |
|
|
|
|
|
// 修改网格党员群名称
|
|
|
|
|
|
if (OrganizationTypeConstant.ORG_TYPE_COMMUNITY_PARTY.equals(dto.getTypeKey()) |
|
|
|
|
|
|| OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(dto.getTypeKey())) { |
|
|
|
|
|
// 查询需要修改名称的党员群
|
|
|
|
|
|
List<GroupDTO> partyGroups = baseDao.selectListOfPartyGroups(dto.getDeptId().toString()); |
|
|
|
|
|
if (null != partyGroups && partyGroups.size() > 0) { |
|
|
|
|
|
List<GroupEntity> partyEntities = createPartyGroupName(partyGroups); |
|
|
|
|
|
// 更新党员群名称
|
|
|
|
|
|
groupService.updateBatchById(partyEntities); |
|
|
|
|
|
// 更新话题表党员群名称
|
|
|
|
|
|
topicService.modifyPartyGroupNameByGroupId(ConvertUtils.sourceToTarget(partyEntities, GroupDTO.class)); |
|
|
|
|
|
// 更新事件表、议题表、项目表党员群名称
|
|
|
|
|
|
eventFeignClient.modifyPartyGroupName(ConvertUtils.sourceToTarget(partyEntities, GroupFormDTO.class)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 组织机构信息处理 |
|
|
|
|
|
* |
|
|
|
|
|
* @return java.util.List<com.elink.esua.epdc.modules.topic.entity.TopicEntity> |
|
|
|
|
|
* @params [dto, topicList] |
|
|
|
|
|
* @author liuchuang |
|
|
|
|
|
* @since 2020/3/7 2:14 |
|
|
|
|
|
*/ |
|
|
|
|
|
private List<PropertyProjectEntity> handleOrganizationInfo(OrganizationModifyDTO dto, List<PropertyProjectDTO> topicList) { |
|
|
|
|
|
List<PropertyProjectEntity> entities = new ArrayList<>(); |
|
|
|
|
|
for (PropertyProjectDTO topic : topicList) { |
|
|
|
|
|
PropertyProjectEntity entity = new PropertyProjectEntity(); |
|
|
|
|
|
if (StringUtils.isNotEmpty(topic.getParentDeptIds()) && StringUtils.isNotEmpty(topic.getParentDeptNames())) { |
|
|
|
|
|
List<String> parentDeptIds = Arrays.asList(topic.getParentDeptIds().split(",")); |
|
|
|
|
|
List<String> parentDeptNames = Arrays.asList(topic.getParentDeptNames().split("-")); |
|
|
|
|
|
int index = parentDeptIds.indexOf(dto.getDeptId().toString()); |
|
|
|
|
|
if (index >= 0 && parentDeptNames.size() > index) { |
|
|
|
|
|
parentDeptNames.set(index, dto.getNewDeptName()); |
|
|
|
|
|
entity.setId(topic.getId()); |
|
|
|
|
|
entity.setParentDeptNames(StringUtils.join(parentDeptNames, "-")); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(topic.getAllDeptIds()) && StringUtils.isNotEmpty(topic.getAllDeptNames())) { |
|
|
|
|
|
List<String> allDeptIds = Arrays.asList(topic.getAllDeptIds().split(",")); |
|
|
|
|
|
List<String> allDeptNames = Arrays.asList(topic.getAllDeptNames().split("-")); |
|
|
|
|
|
int index = allDeptIds.indexOf(dto.getDeptId().toString()); |
|
|
|
|
|
if (index >= 0 && allDeptNames.size() > index) { |
|
|
|
|
|
allDeptNames.set(index, dto.getNewDeptName()); |
|
|
|
|
|
entity.setId(topic.getId()); |
|
|
|
|
|
entity.setAllDeptNames(StringUtils.join(allDeptNames, "-")); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
entities.add(entity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return entities; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 生成新的群名称 |
|
|
|
|
|
* |
|
|
|
|
|
* @return java.util.List<com.elink.esua.epdc.modules.group.entity.GroupEntity> |
|
|
|
|
|
* @params [partyGroups] |
|
|
|
|
|
* @author liuchuang |
|
|
|
|
|
* @since 2020/3/7 12:08 |
|
|
|
|
|
*/ |
|
|
|
|
|
private List<GroupEntity> createPartyGroupName(List<GroupDTO> partyGroups) { |
|
|
|
|
|
List<GroupEntity> groupEntities = new ArrayList<>(); |
|
|
|
|
|
for (GroupDTO group : partyGroups) { |
|
|
|
|
|
String[] allDeptNames = group.getAllDeptNames().split("-"); |
|
|
|
|
|
int len = allDeptNames.length; |
|
|
|
|
|
if (len == 4) { |
|
|
|
|
|
GroupEntity entity = new GroupEntity(); |
|
|
|
|
|
entity.setId(group.getId()); |
|
|
|
|
|
entity.setGroupName(allDeptNames[len - 1] + "群"); |
|
|
|
|
|
groupEntities.add(entity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return groupEntities; |
|
|
|
|
|
} |
|
|
} |
|
|
} |