|
|
@ -30,6 +30,11 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -123,17 +128,78 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
return userOperListResultDTOS; |
|
|
|
} |
|
|
|
|
|
|
|
public void initPartyMemberBadge(){ |
|
|
|
List<String> userIds = userRoleDao.selectPartyMemberUserIds(); |
|
|
|
if (CollectionUtils.isEmpty(userIds)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds); |
|
|
|
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){ |
|
|
|
log.error("未查询到党员基本信息......"); |
|
|
|
throw new RenException("未查询到党员基本信息......"); |
|
|
|
/** |
|
|
|
* @Description 初始化党员徽章 |
|
|
|
* @Param userId |
|
|
|
* @author zxc |
|
|
|
* @date 2020/11/18 下午3:04 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void initPartyMemberBadge(String userId){ |
|
|
|
List<String> userIds = resiUserBadgeDao.selectUserIds(); |
|
|
|
List<ResiUserBadgeDTO> badges = new ArrayList<>(); |
|
|
|
String partyBadgeId = badgeDao.getPartyBadgeId(null); |
|
|
|
if (StringUtils.isEmpty(userId)) { |
|
|
|
List<PartyMemberUserIdsResultDTO> partyMemberUserIds = userRoleDao.selectPartyMemberUserIds(); |
|
|
|
if (CollectionUtils.isEmpty(partyMemberUserIds)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(userIds)) { |
|
|
|
userIds.stream().forEach(u -> partyMemberUserIds.stream().filter(p -> u.equals(p.getUserId())).forEach(p -> p.setReStatus(true))); |
|
|
|
} |
|
|
|
List<String> reUserIds = partyMemberUserIds.stream().filter(p -> !p.getReStatus()).map(p -> p.getUserId()).collect(Collectors.toList()); |
|
|
|
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(reUserIds); |
|
|
|
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)) { |
|
|
|
log.error("未查询到党员基本信息......"); |
|
|
|
throw new RenException("未查询到党员基本信息......"); |
|
|
|
} |
|
|
|
userBaseInfoResultDTOS.forEach(u -> { |
|
|
|
ResiUserBadgeDTO dto = new ResiUserBadgeDTO(); |
|
|
|
dto.setBadgeId(partyBadgeId); |
|
|
|
dto.setCertificationAutidStatus("approved"); |
|
|
|
dto.setCustomerId(u.getCustomerId()); |
|
|
|
dto.setGridId(u.getRegisteredGridId()); |
|
|
|
dto.setIsOpened(NumConstant.ZERO); |
|
|
|
badges.add(dto); |
|
|
|
}); |
|
|
|
resiUserBadgeDao.insertResiUserBadge(badges); |
|
|
|
}else { |
|
|
|
List<String> oneUserIds = new ArrayList<>(); |
|
|
|
oneUserIds.add(userId); |
|
|
|
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(oneUserIds); |
|
|
|
if (!CollectionUtils.isEmpty(userIds)) { |
|
|
|
AtomicReference<Boolean> status = new AtomicReference<>(true); |
|
|
|
userIds.forEach(u -> { |
|
|
|
if(u.equals(userId)){ |
|
|
|
status.set(false); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (status.get()==false){ |
|
|
|
return; |
|
|
|
}else { |
|
|
|
userBaseInfoResultDTOS.forEach(u -> { |
|
|
|
ResiUserBadgeDTO dto = new ResiUserBadgeDTO(); |
|
|
|
dto.setBadgeId(partyBadgeId); |
|
|
|
dto.setCertificationAutidStatus("approved"); |
|
|
|
dto.setCustomerId(u.getCustomerId()); |
|
|
|
dto.setGridId(u.getRegisteredGridId()); |
|
|
|
dto.setIsOpened(NumConstant.ZERO); |
|
|
|
badges.add(dto); |
|
|
|
}); |
|
|
|
} |
|
|
|
}else { |
|
|
|
userBaseInfoResultDTOS.forEach(u -> { |
|
|
|
ResiUserBadgeDTO dto = new ResiUserBadgeDTO(); |
|
|
|
dto.setBadgeId(partyBadgeId); |
|
|
|
dto.setCertificationAutidStatus("approved"); |
|
|
|
dto.setCustomerId(u.getCustomerId()); |
|
|
|
dto.setGridId(u.getRegisteredGridId()); |
|
|
|
dto.setIsOpened(NumConstant.ZERO); |
|
|
|
badges.add(dto); |
|
|
|
}); |
|
|
|
} |
|
|
|
resiUserBadgeDao.insertResiUserBadge(badges); |
|
|
|
} |
|
|
|
// badgeDao.getPartyBadgeId()
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -155,7 +221,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
UserBadgeCertificateRecordDTO form = ConvertUtils.sourceToTarget(certificationAddFormDTO, UserBadgeCertificateRecordDTO.class); |
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
userIds.add(certificationAddFormDTO.getUserId()); |
|
|
|
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfoFromCache(userIds); |
|
|
|
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds); |
|
|
|
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){ |
|
|
|
throw new RenException("查询用户基本信息集合为空......"); |
|
|
|
} |
|
|
|