|  |  | @ -77,9 +77,9 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService | 
			
		
	
		
			
				
					|  |  |  |             case TOPIC: | 
			
		
	
		
			
				
					|  |  |  |                 //查询话题数
 | 
			
		
	
		
			
				
					|  |  |  |                 QueryWrapper<ResiTopicEntity> queryWrapper = new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper.lambda().eq(ResiTopicEntity::getCustomerId,customerId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getGroupId,groupId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getDelFlag,NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper.lambda().eq(ResiTopicEntity::getCustomerId, customerId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getGroupId, groupId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getDelFlag, NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                 currentValue = resiTopicDao.selectCount(queryWrapper); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             case MEMBER: | 
			
		
	
	
		
			
				
					|  |  | @ -88,49 +88,50 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService | 
			
		
	
		
			
				
					|  |  |  |             case TOISSUE: | 
			
		
	
		
			
				
					|  |  |  |                 //查询已经转议题的话题数
 | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper = new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper.lambda().eq(ResiTopicEntity::getCustomerId,customerId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getGroupId,groupId) | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper.lambda().eq(ResiTopicEntity::getCustomerId, customerId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getGroupId, groupId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getShiftIssue, NumConstant.ONE) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getDelFlag,NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getDelFlag, NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                 currentValue = resiTopicDao.selectCount(queryWrapper); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             case RESOVLE_TOPIC: | 
			
		
	
		
			
				
					|  |  |  |                 //查询已经关闭且为已解决的话题数
 | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper = new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper.lambda().eq(ResiTopicEntity::getCustomerId,customerId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getGroupId,groupId) | 
			
		
	
		
			
				
					|  |  |  |                 queryWrapper.lambda().eq(ResiTopicEntity::getCustomerId, customerId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getGroupId, groupId) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getStatus, TopicConstant.CLOSED) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getClosedStatus, TopicConstant.RESOLVED) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getShiftIssue, NumConstant.ONE) | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getDelFlag,NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                         .eq(ResiTopicEntity::getDelFlag, NumConstant.ZERO); | 
			
		
	
		
			
				
					|  |  |  |                 currentValue = resiTopicDao.selectCount(queryWrapper); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             default: | 
			
		
	
		
			
				
					|  |  |  |                 log.info("calculateAcm error"); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         if(currentValue == 0){ | 
			
		
	
		
			
				
					|  |  |  |         if (currentValue == 0) { | 
			
		
	
		
			
				
					|  |  |  |             return true; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         log.info("calculateAcm achievementType:{},groupId:{},currentValue:{}",groupId,currentValue,achievementType); | 
			
		
	
		
			
				
					|  |  |  |         log.info("calculateAcm achievementType:{},groupId:{},currentValue:{}", groupId, currentValue, achievementType); | 
			
		
	
		
			
				
					|  |  |  |         calculateGroupAchievement(customerId, groupId, currentValue, achievementType); | 
			
		
	
		
			
				
					|  |  |  |         return true; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * desc: 计算小组的人数等级 | 
			
		
	
		
			
				
					|  |  |  |      * desc: 计算小组成就 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param customerId | 
			
		
	
		
			
				
					|  |  |  |      * @param groupId | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void calculateGroupAchievement(String customerId, String groupId, int currentValue, String achievementType) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         //根据成就类型获取小组未实现成就 数据库正常只会有一条
 | 
			
		
	
		
			
				
					|  |  |  |         ResiGroupAchievementStatsEntity one = super.achievementStatsService.selectLastUnAchieved(customerId, groupId, achievementType); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         List<ResiGroupAchievementStatsEntity> haveArrive = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         //如果没有实现的额成就则说明是初始化
 | 
			
		
	
		
			
				
					|  |  |  |         //如果没有实现的成就则说明是初始化
 | 
			
		
	
		
			
				
					|  |  |  |         if (one == null) { | 
			
		
	
		
			
				
					|  |  |  |             initAchievementStat(customerId, groupId, achievementType, currentValue, haveArrive); | 
			
		
	
		
			
				
					|  |  |  |             super.achievementStatsService.saveOrUpdate(haveArrive,false); | 
			
		
	
		
			
				
					|  |  |  |             //初始化如果记录存在 只更新修改时间
 | 
			
		
	
		
			
				
					|  |  |  |             super.achievementStatsService.saveOrUpdate(haveArrive, false); | 
			
		
	
		
			
				
					|  |  |  |             return; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -144,13 +145,13 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService | 
			
		
	
		
			
				
					|  |  |  |             int pageNum = NumConstant.ONE; | 
			
		
	
		
			
				
					|  |  |  |             int pageSize = NumConstant.TEN; | 
			
		
	
		
			
				
					|  |  |  |             do { | 
			
		
	
		
			
				
					|  |  |  |                 List<ResiGroupAchievementConfigEntity> list = getConfigByType(achievementType,pageNum++,pageSize); | 
			
		
	
		
			
				
					|  |  |  |                 List<ResiGroupAchievementConfigEntity> list = getConfigByType(achievementType, pageNum++, pageSize); | 
			
		
	
		
			
				
					|  |  |  |                 isContinue = buildArriveList(customerId, groupId, achievementType, currentValue, one.getTargetValue(), haveArrive, list); | 
			
		
	
		
			
				
					|  |  |  |             }while (isContinue); | 
			
		
	
		
			
				
					|  |  |  |             } while (isContinue); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if (isBatch) { | 
			
		
	
		
			
				
					|  |  |  |             super.achievementStatsService.saveOrUpdate(haveArrive,true); | 
			
		
	
		
			
				
					|  |  |  |             super.achievementStatsService.saveOrUpdate(haveArrive, true); | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             //未实现 只更新当前值
 | 
			
		
	
		
			
				
					|  |  |  |             ResiGroupAchievementStatsDTO newStat = new ResiGroupAchievementStatsDTO(); | 
			
		
	
	
		
			
				
					|  |  | @ -160,20 +161,27 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * desc: 初始化成就 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @return void | 
			
		
	
		
			
				
					|  |  |  |      * @author LiuJanJun | 
			
		
	
		
			
				
					|  |  |  |      * @date 2021/4/23 6:20 下午 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     private void initAchievementStat(String customerId, String groupId, String achievementType, int currentValue, List<ResiGroupAchievementStatsEntity> haveArrive) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         boolean isContinue; | 
			
		
	
		
			
				
					|  |  |  |         int pageNum = NumConstant.ONE; | 
			
		
	
		
			
				
					|  |  |  |         int pageSize = NumConstant.TEN; | 
			
		
	
		
			
				
					|  |  |  |         do { //没有任何数据说明是初始化
 | 
			
		
	
		
			
				
					|  |  |  |             List<ResiGroupAchievementConfigEntity> list = getConfigByType(achievementType,pageNum++,pageSize); | 
			
		
	
		
			
				
					|  |  |  |             List<ResiGroupAchievementConfigEntity> list = getConfigByType(achievementType, pageNum++, pageSize); | 
			
		
	
		
			
				
					|  |  |  |             //查询和初始化都失败啦
 | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |                 log.error("calculateMember get config fail"); | 
			
		
	
		
			
				
					|  |  |  |                 throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             isContinue = buildArriveList(customerId, groupId, achievementType, currentValue, null, haveArrive, list); | 
			
		
	
		
			
				
					|  |  |  |         }while (isContinue); | 
			
		
	
		
			
				
					|  |  |  |         } while (isContinue); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isEmpty(haveArrive)) { | 
			
		
	
		
			
				
					|  |  |  |             throw new RenException("小组达成成就失败"); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  | @ -184,7 +192,7 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService | 
			
		
	
		
			
				
					|  |  |  |         for (ResiGroupAchievementConfigEntity configEntity : list) { | 
			
		
	
		
			
				
					|  |  |  |             if (targetValue != null) { | 
			
		
	
		
			
				
					|  |  |  |                 //筛选出已经完成的成就
 | 
			
		
	
		
			
				
					|  |  |  |                 if (configEntity.getTargetValue()<targetValue){ | 
			
		
	
		
			
				
					|  |  |  |                 if (configEntity.getTargetValue() < targetValue) { | 
			
		
	
		
			
				
					|  |  |  |                     continue; | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
	
		
			
				
					|  |  | @ -211,7 +219,7 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService | 
			
		
	
		
			
				
					|  |  |  |         return isContinue; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private List<ResiGroupAchievementConfigEntity> getConfigByType(String achievementType,int pageNum,int pageSize) { | 
			
		
	
		
			
				
					|  |  |  |     private List<ResiGroupAchievementConfigEntity> getConfigByType(String achievementType, int pageNum, int pageSize) { | 
			
		
	
		
			
				
					|  |  |  |         List<ResiGroupAchievementConfigEntity> list = super.getAchievemnetConfigPage(pageNum, pageSize, achievementType); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |             log.warn("获取小组成就配置错误,{}  开始进行初始化规则", achievementType); | 
			
		
	
	
		
			
				
					|  |  | 
 |