|
@ -48,6 +48,7 @@ import javax.annotation.Resource; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
import static java.util.stream.Collectors.toList; |
|
|
import static java.util.stream.Collectors.toList; |
|
|
|
|
|
|
|
@ -156,6 +157,7 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity> |
|
|
public void delete(String[] ids) { |
|
|
public void delete(String[] ids) { |
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
|
|
groupDao.deleteGroupByProjectIds(Arrays.asList(ids)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -165,30 +167,37 @@ public class PoliceServiceImpl extends BaseServiceImpl<PoliceDao, PoliceEntity> |
|
|
for (PoliceDTO dto : ids) { |
|
|
for (PoliceDTO dto : ids) { |
|
|
// 社区ID下有多少个网格信息
|
|
|
// 社区ID下有多少个网格信息
|
|
|
List<DeptLevelAndLeaderDTO> deptList = adminFeignClient.listChildDeptLevelById(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, dto.getDeptId()).getData(); |
|
|
List<DeptLevelAndLeaderDTO> deptList = adminFeignClient.listChildDeptLevelById(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY, dto.getDeptId()).getData(); |
|
|
|
|
|
List<Long> deptIdList = deptList.stream().map(DeptLevelAndLeaderDTO::getDeptId).collect(toList()); |
|
|
// 现有的群的网格信息
|
|
|
// 现有的群的网格信息
|
|
|
List<DeptLevelAndLeaderDTO> existedDeptList = groupDao.selectListOfGroupByDeptId(dto.getDeptId() + ""); |
|
|
List<DeptLevelAndLeaderDTO> existedDeptList = groupDao.selectListOfGroupByDeptId(dto.getDeptId() + ""); |
|
|
|
|
|
List<Long> existedDeptIdList = existedDeptList.stream().map(DeptLevelAndLeaderDTO::getDeptId).collect(toList()); |
|
|
// 求差集,即为还没有创建过群的网格ID
|
|
|
// 求差集,即为还没有创建过群的网格ID
|
|
|
List<DeptLevelAndLeaderDTO> reduce = deptList.stream().filter(item -> !existedDeptList.contains(item)).collect(toList()); |
|
|
List<Long> reduce = deptIdList.stream().filter(item -> !existedDeptIdList.contains(item)).collect(toList()); |
|
|
|
|
|
|
|
|
// 补建群
|
|
|
// 补建群
|
|
|
reduce.forEach(dept -> { |
|
|
reduce.forEach(deptId -> { |
|
|
ParentAndAllDeptDTO parentAndAllDeptDTOChild = getParentAndAllDeptDTO(dept.getDeptId() + ""); |
|
|
// 通过deptID反向找出该网格信息
|
|
|
GroupEntity groupEntity = new GroupEntity(); |
|
|
Optional<DeptLevelAndLeaderDTO> deptOptional = deptList.stream().filter(item -> item.getDeptId().equals(deptId)).findFirst(); |
|
|
DeptEntityUtils.loadDeptInfo( |
|
|
if (deptOptional.isPresent()) { |
|
|
ConvertUtils.sourceToTarget(parentAndAllDeptDTOChild, DeptEntityUtils.DeptDto.class), |
|
|
// 存在
|
|
|
groupEntity |
|
|
DeptLevelAndLeaderDTO dept = deptOptional.get(); |
|
|
); |
|
|
ParentAndAllDeptDTO parentAndAllDeptDTOChild = getParentAndAllDeptDTO(dept.getDeptId() + ""); |
|
|
groupEntity.setReferenceBusinessId(dto.getId()); |
|
|
GroupEntity groupEntity = new GroupEntity(); |
|
|
groupEntity.setState(GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue()); |
|
|
DeptEntityUtils.loadDeptInfo( |
|
|
groupEntity.setGroupAvatar(GroupConstant.PROPERTY_GROUP_AVATAR); |
|
|
ConvertUtils.sourceToTarget(parentAndAllDeptDTOChild, DeptEntityUtils.DeptDto.class), |
|
|
groupEntity.setGroupName(dto.getDeptName() + "警民群"); |
|
|
groupEntity |
|
|
groupEntity.setGroupCategory(GroupConstant.POLICE_GROUP_CATEGORY); |
|
|
); |
|
|
groupEntity.setGrid(dept.getDeptName()); |
|
|
groupEntity.setReferenceBusinessId(dto.getId()); |
|
|
groupEntity.setGridId(dept.getDeptId()); |
|
|
groupEntity.setState(GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue()); |
|
|
groupDao.insert(groupEntity); |
|
|
groupEntity.setGroupAvatar(GroupConstant.PROPERTY_GROUP_AVATAR); |
|
|
|
|
|
groupEntity.setGroupName(dept.getDeptName() + "警民群"); |
|
|
|
|
|
groupEntity.setGroupCategory(GroupConstant.POLICE_GROUP_CATEGORY); |
|
|
|
|
|
groupEntity.setGrid(dept.getDeptName()); |
|
|
|
|
|
groupEntity.setGridId(dept.getDeptId()); |
|
|
|
|
|
groupDao.insert(groupEntity); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|