1111
This commit is contained in:
parent
f53e5b5d65
commit
579c81e553
@ -187,12 +187,19 @@ public class CaseExchangeService {
|
||||
}
|
||||
|
||||
// 新增病例交流统计
|
||||
if (!handleStatsCaseExchange()){
|
||||
StatsCaseExchangeModel statsCaseExchangeData = new StatsCaseExchangeModel();
|
||||
statsCaseExchangeData.setExchangeNum(1);
|
||||
res = statsCaseExchangeDao.insert(statsCaseExchangeData);
|
||||
if (res <= 0){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 新增病例交流统计-用户
|
||||
if (!handleStatsCaseExchangeUser(userId,"exchange_num")){
|
||||
StatsCaseExchangeUserModel statsCaseExchangeUserData = new StatsCaseExchangeUserModel();
|
||||
statsCaseExchangeUserData.setUserId(Long.valueOf(userId));
|
||||
statsCaseExchangeUserData.setExchangeNum(1);
|
||||
res = statsCaseExchangeUserDao.insert(statsCaseExchangeUserData);
|
||||
if (res <= 0){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
@ -513,6 +520,52 @@ public class CaseExchangeService {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增病例交流统计
|
||||
* @param userId 用户id
|
||||
* @param type 类型:1:阅读量 2:收藏量 3:评论数 4:数量
|
||||
*/
|
||||
@Transactional
|
||||
public boolean IncClinicalVideoStats(String userId,Integer type){
|
||||
try {
|
||||
LambdaQueryWrapper<StatsCaseExchangeUserModel> mapQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mapQueryWrapper.eq(StatsCaseExchangeUserModel::getUserId, userId);
|
||||
StatsCaseExchangeUserModel statsCaseExchangeUser = statsCaseExchangeUserDao.selectOne(mapQueryWrapper);
|
||||
if (statsCaseExchangeUser == null){
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 阅读量
|
||||
if (type == 1){
|
||||
statsCaseExchangeDao.inc(1L,"exchange_read_num",1);
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getStatsId(),"exchange_read_num",1);
|
||||
}
|
||||
|
||||
// 收藏量
|
||||
if (type == 2){
|
||||
statsCaseExchangeDao.inc(1L,"exchange_collect_num",1);
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getStatsId(),"exchange_collect_num",1);
|
||||
}
|
||||
|
||||
// 评论数
|
||||
if (type == 3){
|
||||
statsCaseExchangeDao.inc(1L,"exchange_collect_num",1);
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getStatsId(),"exchange_collect_num",1);
|
||||
}
|
||||
|
||||
// 文章数量-只加个人的
|
||||
if (type == 3){
|
||||
statsCaseExchangeUserDao.inc(statsCaseExchangeUser.getStatsId(),"exchange_num",1);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增投票-病例交流
|
||||
* @param exchangeId 病例交流id
|
||||
|
||||
@ -42,6 +42,9 @@ public class UserCaseReadService {
|
||||
@Resource
|
||||
private CaseClinicalVideoService caseClinicalVideoService;
|
||||
|
||||
@Resource
|
||||
private CaseExchangeService caseExchangeService;
|
||||
|
||||
/**
|
||||
* 浏览记录-新增
|
||||
* @return bool
|
||||
@ -90,7 +93,7 @@ public class UserCaseReadService {
|
||||
|
||||
// 病例交流
|
||||
if (request.getType() == 3){
|
||||
caseExchangeDao.inc(Long.valueOf(request.getId()),"read_num",1);
|
||||
caseExchangeService.IncClinicalVideoStats(userId,1);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user