|
|
@ -52,16 +52,19 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService |
|
|
|
* @date 2021/4/20 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Boolean initAllGroupAchievement() { |
|
|
|
public Boolean initAllGroupAchievement(String customerId) { |
|
|
|
|
|
|
|
//计算所有类型的 小组人数、话题数、转议题数、小组内问题解决数
|
|
|
|
QueryWrapper<ResiGroupEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.lambda().eq(ResiGroupEntity::getDelFlag,'0'); |
|
|
|
if (StringUtils.isNotBlank(customerId)){ |
|
|
|
queryWrapper.lambda().eq(ResiGroupEntity::getCustomerId,customerId); |
|
|
|
} |
|
|
|
List<ResiGroupEntity> groupEntities = resiGroupDao.selectList(queryWrapper); |
|
|
|
groupEntities.forEach(group->{ |
|
|
|
AchievementTypeEnum[] achievementTypeEnum = AchievementTypeEnum.values(); |
|
|
|
Integer integer = super.initPre(group.getCustomerId()); |
|
|
|
log.info("initPre del:{}",integer); |
|
|
|
//Integer integer = super.initPre(group.getCustomerId());
|
|
|
|
//log.info("initPre del:{}",integer);
|
|
|
|
for (AchievementTypeEnum anEnum : achievementTypeEnum) { |
|
|
|
try { |
|
|
|
Thread.sleep(2); |
|
|
@ -140,14 +143,14 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService |
|
|
|
*/ |
|
|
|
private void calculateGroupAchievement(String customerId, String groupId, int currentValue, String achievementType) { |
|
|
|
//根据成就类型获取小组未实现成就 数据库正常只会有一条
|
|
|
|
ResiGroupAchievementStatsEntity one = super.achievementStatsService.selectLastUnAchieved(customerId, groupId, achievementType); |
|
|
|
ResiGroupAchievementStatsEntity one = super.selectLastUnAchieved(customerId, groupId, achievementType); |
|
|
|
|
|
|
|
List<ResiGroupAchievementStatsEntity> haveArrive = new ArrayList<>(); |
|
|
|
//如果没有实现的成就则说明是初始化
|
|
|
|
if (one == null) { |
|
|
|
initAchievementStat(customerId, groupId, achievementType, currentValue, haveArrive); |
|
|
|
//初始化如果记录存在 只更新修改时间
|
|
|
|
super.achievementStatsService.saveOrUpdate(haveArrive, false); |
|
|
|
super.saveOrUpdate(haveArrive, false); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -167,13 +170,13 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService |
|
|
|
} |
|
|
|
|
|
|
|
if (isBatch) { |
|
|
|
super.achievementStatsService.saveOrUpdate(haveArrive, true); |
|
|
|
super.saveOrUpdate(haveArrive, true); |
|
|
|
} else { |
|
|
|
//未实现 只更新当前值
|
|
|
|
ResiGroupAchievementStatsDTO newStat = new ResiGroupAchievementStatsDTO(); |
|
|
|
newStat.setId(one.getId()); |
|
|
|
newStat.setCurrentValue(currentValue); |
|
|
|
super.achievementStatsService.update(newStat); |
|
|
|
super.update(newStat); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -218,14 +221,16 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService |
|
|
|
statsEntity.setGroupId(groupId); |
|
|
|
statsEntity.setAchievementId(configEntity.getId()); |
|
|
|
statsEntity.setAchievementName(configEntity.getAchievementName()); |
|
|
|
statsEntity.setArriveTime(new Date()); |
|
|
|
|
|
|
|
statsEntity.setAchievementType(achievementType); |
|
|
|
statsEntity.setCurrentValue(currentValue); |
|
|
|
statsEntity.setTargetValue(configEntity.getTargetValue()); |
|
|
|
statsEntity.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
|
|
|
|
haveArrive.add(statsEntity); |
|
|
|
if (currentValue >= configEntity.getTargetValue()) { |
|
|
|
statsEntity.setIsArrive(NumConstant.ONE); |
|
|
|
statsEntity.setArriveTime(new Date()); |
|
|
|
} else { |
|
|
|
//如果没有达到则 放入这一条后 退出
|
|
|
|
statsEntity.setIsArrive(NumConstant.ZERO); |
|
|
|