Browse Source

Merge remote-tracking branch 'remotes/origin/dev_group_point' into dev_temp

dev_shibei_match
jianjun 4 years ago
parent
commit
fbbf76e2f6
  1. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/AbstractStatsAchievementService.java
  2. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementStatsService.java
  3. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/StatsAchievementService.java
  4. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupAchievementStatsServiceImpl.java
  5. 34
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/StatsAchievementServiceImpl.java
  6. 6
      epmet-module/resi-group/resi-group-server/src/test/com/epmet/modules/group/service/impl/StatsAchievementServiceImplTest.java

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/AbstractStatsAchievementService.java

@ -44,14 +44,16 @@ public abstract class AbstractStatsAchievementService {
/**
* desc: 根据成绩类型 分页获取成就配置 按targetValue 升序
* desc: 根据客户Id清空客户小组成就数据
*
* @param offset
* @param pageSize
* @param customerId
* @return java.util.List<com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity>
* @author LiuJanJun
* @date 2021/4/22 1:36 下午
*/
protected Integer initPre(String customerId) {
return achievementStatsService.deleteByCId(customerId);
}
/**
* desc: 根据成绩类型 分页获取成就配置 按targetValue 升序
*
@ -61,7 +63,7 @@ public abstract class AbstractStatsAchievementService {
* @author LiuJanJun
* @date 2021/4/22 1:36 下午
*/
protected List<ResiGroupAchievementConfigEntity> getAchievemnetConfigPage(int pageNum, int pageSize, String achievementType) {
protected List<ResiGroupAchievementConfigEntity> getAchievementConfigPage(int pageNum, int pageSize, String achievementType) {
return achievementConfigService.selectMoreThanOneByValue(achievementType, (pageNum - NumConstant.ONE) * pageSize, pageSize);
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupAchievementStatsService.java

@ -133,4 +133,14 @@ public interface ResiGroupAchievementStatsService extends BaseService<ResiGroupA
* @date 2021/4/22 3:03 下午
*/
int saveOrUpdate(List<ResiGroupAchievementStatsEntity> haveArrive, boolean updateAll);
/**
* desc: 请描述类的业务用途
*
* @param customerId
* @return int
* @author LiuJanJun
* @date 2021/4/25 11:01 上午
*/
int deleteByCId(String customerId);
}

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/StatsAchievementService.java

@ -26,14 +26,13 @@ package com.epmet.modules.group.service;
public interface StatsAchievementService{
/**
* desc: 计算小组成就 统一入口
* desc: 初始化所有小组的各种成就入口
*
* @param achievementType 成就类型 小组人数话题数转议题数小组内问题解决数
* @return java.lang.Boolean
* @author LiuJanJun
* @date 2021/4/20
*/
Boolean calculateAcm(String achievementType);
Boolean initAllGroupAchievement();
/**
* desc: 根据小组Id计算小组成就 入口

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupAchievementStatsServiceImpl.java

@ -20,10 +20,10 @@ package com.epmet.modules.group.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.modules.group.dao.ResiGroupAchievementStatsDao;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.modules.group.service.ResiGroupAchievementStatsService;
@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -141,4 +142,11 @@ public class ResiGroupAchievementStatsServiceImpl extends BaseServiceImpl<ResiGr
return baseDao.saveOrUpdate(haveArrive, updateAll);
}
@Override
public int deleteByCId(String customerId) {
Map<String,Object> param = new HashMap<>();
param.put("CUSTOMER_ID",customerId);
return baseDao.deleteByMap(param);
}
}

34
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/StatsAchievementServiceImpl.java

@ -5,8 +5,10 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.modules.enums.AchievementTypeEnum;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupAchievementConfigEntity;
import com.epmet.modules.group.entity.ResiGroupAchievementStatsEntity;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.service.AbstractStatsAchievementService;
import com.epmet.modules.group.service.StatsAchievementService;
import com.epmet.modules.member.dao.ResiGroupMemberDao;
@ -38,22 +40,39 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService
private ResiGroupMemberDao resiGroupMemberDao;
@Autowired
private ResiTopicDao resiTopicDao;
@Autowired
private ResiGroupDao resiGroupDao;
/**
* desc: 计算小组成就 统一入口
*
* @param achievementType 成就类型
* @return java.lang.Boolean
* @author LiuJanJun
* @date 2021/4/20
*/
@Override
public Boolean calculateAcm(String achievementType) {
if (StringUtils.isBlank(achievementType)) {
public Boolean initAllGroupAchievement() {
//计算所有类型的 小组人数、话题数、转议题数、小组内问题解决数
}
return null;
QueryWrapper<ResiGroupEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ResiGroupEntity::getDelFlag,'0');
List<ResiGroupEntity> groupEntities = resiGroupDao.selectList(queryWrapper);
groupEntities.forEach(group->{
AchievementTypeEnum[] achievementTypeEnum = AchievementTypeEnum.values();
Integer integer = super.initPre(group.getCustomerId());
log.info("initPre del:{}",integer);
for (AchievementTypeEnum anEnum : achievementTypeEnum) {
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
calculateAcm(group.getCustomerId(),group.getId(),anEnum.getCode());
}
});
return true;
}
/**
@ -108,9 +127,6 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService
default:
log.info("calculateAcm error");
}
if (currentValue == 0) {
return true;
}
log.info("calculateAcm achievementType:{},groupId:{},currentValue:{}", groupId, currentValue, achievementType);
calculateGroupAchievement(customerId, groupId, currentValue, achievementType);
return true;
@ -221,7 +237,7 @@ public class StatsAchievementServiceImpl extends AbstractStatsAchievementService
}
private List<ResiGroupAchievementConfigEntity> getConfigByType(String achievementType, int pageNum, int pageSize) {
List<ResiGroupAchievementConfigEntity> list = super.getAchievemnetConfigPage(pageNum, pageSize, achievementType);
List<ResiGroupAchievementConfigEntity> list = super.getAchievementConfigPage(pageNum, pageSize, achievementType);
if (CollectionUtils.isEmpty(list)) {
log.warn("获取小组成就配置错误,{} 开始进行初始化规则", achievementType);
list = super.initAchievementConfig(achievementType);

6
epmet-module/resi-group/resi-group-server/src/test/com/epmet/modules/group/service/impl/StatsAchievementServiceImplTest.java

@ -13,6 +13,12 @@ public class StatsAchievementServiceImplTest {
@Autowired
private StatsAchievementService statsAchievementService;
@Test
public void initAll() {
Boolean aBoolean = statsAchievementService.initAllGroupAchievement();
System.out.println(aBoolean);
}
@Test
public void calculateAcm() {

Loading…
Cancel
Save