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