|
|
@ -434,44 +434,6 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> imp |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param deptList |
|
|
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 批量生成网格党员群 |
|
|
|
* @Date 2019/12/19 14:41 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result savePartyGroups(List<CompleteDeptDTO> deptList) { |
|
|
|
if(CollUtil.isEmpty(deptList)){ |
|
|
|
return new Result().error("请选择网格"); |
|
|
|
} |
|
|
|
//在创建党员群的时候,查询当前网格下的党员用户和网格长用户
|
|
|
|
List<Long> gridIdList=new ArrayList<>(); |
|
|
|
for(CompleteDeptDTO completeDeptDTO:deptList){ |
|
|
|
gridIdList.add(completeDeptDTO.getGridId()); |
|
|
|
} |
|
|
|
Result<List<EpdcGridUserResultDTO>> gridUserList=userFeignClient.queryGroupUsers(gridIdList); |
|
|
|
//将集合转为Map,key为网格id
|
|
|
|
Map<Long, List<EpdcGridUserResultDTO>> map=gridUserList.getData().stream().collect(Collectors.groupingBy(EpdcGridUserResultDTO::getGridId)); |
|
|
|
for (CompleteDeptDTO dept : |
|
|
|
deptList) { |
|
|
|
GroupBatchCreateFormDTO groupCreateFormDto = ConvertUtils.sourceToTarget(dept, GroupBatchCreateFormDTO.class); |
|
|
|
groupCreateFormDto.setGroupName(dept.getCommunity().concat(dept.getGrid()).concat(GroupConstant.PARTY_GROUP_NAME_SUFFIX)); |
|
|
|
groupCreateFormDto.setGroupAvatar(GroupConstant.PARTY_GROUP_AVATAR); |
|
|
|
groupCreateFormDto.setGroupIntroduction(dept.getStreet().concat(dept.getCommunity()).concat(dept.getGrid())); |
|
|
|
groupCreateFormDto.setGroupCategory(NumConstant.ZERO_STR); |
|
|
|
groupCreateFormDto.setState(GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue()); |
|
|
|
groupCreateFormDto.setAllDeptIds(dept.getDistrictId() + "," + dept.getStreetId() + "," + dept.getCommunityId() + "," + dept.getGridId()); |
|
|
|
groupCreateFormDto.setAllDeptNames(dept.getDistrict() + "-" + dept.getStreet() + "-" + dept.getCommunity() + "-" + dept.getGrid()); |
|
|
|
groupCreateFormDto.setParentDeptIds(dept.getDistrictId() + "," + dept.getStreetId() + "," + dept.getCommunityId()); |
|
|
|
groupCreateFormDto.setParentDeptNames(dept.getDistrict() + "-" + dept.getStreet() + "-" + dept.getCommunity()); |
|
|
|
List<GroupUserFormDTO> groupUserFormDTOList=ConvertUtils.sourceToTarget(map.get(dept.getGridId()), GroupUserFormDTO.class); |
|
|
|
groupCreateFormDto.setGroupUserFormDTOList(groupUserFormDTOList); |
|
|
|
this.saveGroups(groupCreateFormDto); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result saveGroups(GroupBatchCreateFormDTO formDto) { |
|
|
|