瀏覽代碼

Merge branch 'develop' into release

tags/V1.8.0^2
wanghaoran 1 年之前
父節點
當前提交
fba7f4799a
共有 1 個檔案被更改,包括 54 行新增49 行删除
  1. +54
    -49
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java

+ 54
- 49
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamVideoServiceImpl.java 查看文件

@@ -103,6 +103,7 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl<WestreamVideoMappe
.eq(WestreamVideoUser::getVideoId, query.getVideoId())
.eq(WestreamVideoUser::getMark, 1));


if(ObjectUtil.isNull(westreamVideoUser)){
log.info("全民护河学习视频用户表insert,入参:"+ JSON.toJSONString(query));
WestreamVideoUser westreamVideoUserAdd = new WestreamVideoUser();
@@ -114,59 +115,63 @@ public class WestreamVideoServiceImpl extends BaseServiceImpl<WestreamVideoMappe
westreamVideoUser.setVideoProgress(query.getVideoProgress());
westreamVideoUser.setStatus(query.getStatus());
westreamVideoUserMapper.updateById(westreamVideoUser);
//视频学习完成,开始计算积分
if(2 == query.getStatus().intValue()){
log.info("视频学习完成,开始计算积分【" + query.getTenantId() +"】"+ query.getOpenid());
//查询学习视频 积分设置
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>()
.eq(ThDict::getTenantId, query.getTenantId())
.eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE)
.eq(ThDict::getMark, 1));
if(ObjectUtils.isNotNull(thDict)){
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>()
.eq(ThDictData::getDictId, thDict.getId())
.eq(ThDictData::getName, DictConstants.VIDEO));
if(ObjectUtils.isNotNull(thDictData)){
if(StringUtils.isNotEmpty(thDictData.getValue())){
log.info("视频学习积分规则查询完成");
//查询用户昵称
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getTenantId, query.getTenantId())
.eq(WestreamUser::getOpenid, query.getOpenid())
.eq(WestreamUser::getMark, 1));
log.info("查询用户昵称完成,tenantId:" + query.getTenantId());
log.info("查询用户昵称完成,openid:" + query.getOpenid());


//积分明细表入库
UserPointsDetail userPointsDetail = new UserPointsDetail();
BeanUtils.copyProperties(query,userPointsDetail);
userPointsDetail.setNickname(westreamUser.getNickname());
userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue()));
userPointsDetail.setPointsTime(new Date());
userPointsDetail.setChangeName("观看学习视频");
userPointsDetail.setType(1);
userPointsDetail.setCreateTime(new Date());
userPointsDetailMapper.insert(userPointsDetail);
log.info("积分明细表入库完成");

//用户积分更新
westreamUser.setMallPoints(westreamUser.getMallPoints() + userPointsDetail.getPointsChange());
westreamUserMapper.updateById(westreamUser);
log.info("用户积分更新完成");

//TODO 对接商城
}
}
}
}

}

//视频学习完成,开始计算积分
if(2 == query.getStatus().intValue()){
addPoints(query);
}

return JsonResult.success();
}

private String addPoints(WestreamVideoQuery query) {
log.info("视频学习完成,开始计算积分【" + query.getTenantId() +"】"+ query.getOpenid());
//查询学习视频 积分设置
ThDict thDict = thDictMapper.selectOne(new LambdaQueryWrapper<ThDict>()
.eq(ThDict::getTenantId, query.getTenantId())
.eq(ThDict::getCode, DictConstants.POINTS_RULE_CODE)
.eq(ThDict::getMark, 1));
if(ObjectUtils.isNotNull(thDict)){
ThDictData thDictData = thDictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>()
.eq(ThDictData::getDictId, thDict.getId())
.eq(ThDictData::getName, DictConstants.VIDEO));
if(ObjectUtils.isNotNull(thDictData)){
if(StringUtils.isNotEmpty(thDictData.getValue())){
log.info("视频学习积分规则查询完成");
//查询用户昵称
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getTenantId, query.getTenantId())
.eq(WestreamUser::getOpenid, query.getOpenid())
.eq(WestreamUser::getMark, 1));
log.info("查询用户昵称完成,tenantId:" + query.getTenantId());
log.info("查询用户昵称完成,openid:" + query.getOpenid());


//积分明细表入库
UserPointsDetail userPointsDetail = new UserPointsDetail();
BeanUtils.copyProperties(query,userPointsDetail);
userPointsDetail.setNickname(westreamUser.getNickname());
userPointsDetail.setPointsChange(Integer.parseInt(thDictData.getValue()));
userPointsDetail.setPointsTime(new Date());
userPointsDetail.setChangeName("观看学习视频");
userPointsDetail.setType(1);
userPointsDetail.setCreateTime(new Date());
userPointsDetailMapper.insert(userPointsDetail);
log.info("积分明细表入库完成");

//用户积分更新
westreamUser.setMallPoints(westreamUser.getMallPoints() + userPointsDetail.getPointsChange());
westreamUserMapper.updateById(westreamUser);
log.info("用户积分更新完成");

//TODO 对接商城

return thDictData.getValue();
}
}

return JsonResult.success();
}
return "0";
}

@Override

Loading…
取消
儲存