Commit 417dcc5b by 阳浪

我的积分 阅读文章五次

parent 71851344
...@@ -26,9 +26,10 @@ public class PointDetailVO { ...@@ -26,9 +26,10 @@ public class PointDetailVO {
@ApiModelProperty(value = "积分活动分类") @ApiModelProperty(value = "积分活动分类")
private List<PointVo> pointVoList; private List<PointVo> pointVoList;
public void addPoint(String learnType,String learnName,Integer flag){ public void addPoint(String learnType,String learnName,Integer countNum,Integer flag){
PointVo pointVo = new PointVo(); PointVo pointVo = new PointVo();
pointVo.setFlag(flag); pointVo.setFlag(flag);
pointVo.setCountNum(countNum);
pointVo.setLearnName(learnName); pointVo.setLearnName(learnName);
pointVo.setLearnType(learnType); pointVo.setLearnType(learnType);
if(CollectionUtils.isEmpty(this.pointVoList)){ if(CollectionUtils.isEmpty(this.pointVoList)){
......
...@@ -20,4 +20,6 @@ public class PointVo { ...@@ -20,4 +20,6 @@ public class PointVo {
@ApiModelProperty(value = "学习活动名称") @ApiModelProperty(value = "学习活动名称")
private String learnName; private String learnName;
private Integer countNum;
} }
...@@ -3,6 +3,7 @@ package com.yizhi.application.controller; ...@@ -3,6 +3,7 @@ package com.yizhi.application.controller;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yizhi.application.constant.PointChangeReasonConstant;
import com.yizhi.application.constant.PointEventEnum; import com.yizhi.application.constant.PointEventEnum;
import com.yizhi.application.domain.*; import com.yizhi.application.domain.*;
import com.yizhi.application.orm.id.IdGenerator; import com.yizhi.application.orm.id.IdGenerator;
...@@ -370,6 +371,10 @@ public class PointListenerController { ...@@ -370,6 +371,10 @@ public class PointListenerController {
pointActivity.setState(2); pointActivity.setState(2);
EntityWrapper<PointActivity> entityWrapper = new EntityWrapper<PointActivity>(); EntityWrapper<PointActivity> entityWrapper = new EntityWrapper<PointActivity>();
PointActivity vo = pointActivityService.selectOne(entityWrapper); PointActivity vo = pointActivityService.selectOne(entityWrapper);
Integer count = pointDetailsService.getCountToDay(accountId,siteId,code);
if(Objects.equals(code, PointChangeReasonConstant.POINT_READ.getKey())&&count>=5){
return false;
}
if(vo!=null&& ObjectUtil.isNotEmpty(vo.getCode())&&accountId!=null&&accountId!=0L){ if(vo!=null&& ObjectUtil.isNotEmpty(vo.getCode())&&accountId!=null&&accountId!=0L){
try { try {
PointParamVO pointParamVO = new PointParamVO(); PointParamVO pointParamVO = new PointParamVO();
......
...@@ -99,4 +99,6 @@ public interface PointDetailsMapper extends BaseMapper<PointDetails> { ...@@ -99,4 +99,6 @@ public interface PointDetailsMapper extends BaseMapper<PointDetails> {
Integer selectPointVo(@Param("accountId") Long accountId, @Param("siteId")Long siteId, @Param("type")String type,@Param("toDay")String toDay); Integer selectPointVo(@Param("accountId") Long accountId, @Param("siteId")Long siteId, @Param("type")String type,@Param("toDay")String toDay);
Integer getAmount(@Param("accountId") Long accountId, @Param("siteId")Long siteId); Integer getAmount(@Param("accountId") Long accountId, @Param("siteId")Long siteId);
Integer getCountToDay(@Param("accountId") Long accountId, @Param("siteId")Long siteId, @Param("type")String type,@Param("toDay")String toDay);
} }
...@@ -27,6 +27,8 @@ public interface PointDetailsService extends IService<PointDetails> { ...@@ -27,6 +27,8 @@ public interface PointDetailsService extends IService<PointDetails> {
PointDetailVO getPointDetail(Long accountId, Long siteId); PointDetailVO getPointDetail(Long accountId, Long siteId);
Integer getCountToDay(Long accountId,Long siteId,String type);
Integer queryPiont(Long userId, Long companyId, Long siteId, Long orgId); Integer queryPiont(Long userId, Long companyId, Long siteId, Long orgId);
Page<PointDetailsVO> getManagePointDetails(Integer pageNo, Integer pageSize, Long activityId, Page<PointDetailsVO> getManagePointDetails(Integer pageNo, Integer pageSize, Long activityId,
......
...@@ -446,15 +446,16 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com ...@@ -446,15 +446,16 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com
Arrays.stream(PointChangeReasonConstant.values()).forEach(e->{ Arrays.stream(PointChangeReasonConstant.values()).forEach(e->{
if(pointTypeList.contains(e.getValue())){ if(pointTypeList.contains(e.getValue())){
Integer point = pointDetailsMapper.selectPointVo(accountId,siteId,e.getKey(),toDay); Integer point = pointDetailsMapper.selectPointVo(accountId,siteId,e.getKey(),toDay);
Integer count = pointDetailsMapper.getCountToDay(accountId,siteId,e.getKey(),toDay);
if(Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITCOURSEDONE1.getKey()) if(Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITCOURSEDONE1.getKey())
||Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITEXAMPASSED.getKey()) ||Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITEXAMPASSED.getKey())
||Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITCALENDARDONE.getKey())){ ||Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITCALENDARDONE.getKey())){
}else if(Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITEXAMDONE.getKey()) }else if(Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITEXAMDONE.getKey())
||Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITSIGNDONE.getKey())) { ||Objects.equals(e.getKey(),PointChangeReasonConstant.CREDITSIGNDONE.getKey())) {
pointDetailVO.addPoint(e.getKey(), e.getValue(), 0); pointDetailVO.addPoint(e.getKey(), e.getValue(),count, 0);
}else{ }else{
pointDetailVO.addPoint(e.getKey(), e.getValue(), (point != null && point > 0) ? 1 : 0); pointDetailVO.addPoint(e.getKey(), e.getValue(),count, (point != null && point > 0) ? 1 : 0);
} }
if(point!=null&&point>0){ if(point!=null&&point>0){
pointDetailVO.setPoint(point+pointDetailVO.getPoint()); pointDetailVO.setPoint(point+pointDetailVO.getPoint());
...@@ -471,6 +472,12 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com ...@@ -471,6 +472,12 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com
return pointDetailVO; return pointDetailVO;
} }
@Override
public Integer getCountToDay(Long accountId,Long siteId,String type) {
String toDay = DateUtil.formatDate(new Date());
return pointDetailsMapper.getCountToDay(accountId,siteId,type,toDay);
}
public static void main(String[] args) { public static void main(String[] args) {
DateTime yesterday = DateUtil.yesterday(); DateTime yesterday = DateUtil.yesterday();
DateTime beginOfDay = DateUtil.beginOfDay(yesterday); DateTime beginOfDay = DateUtil.beginOfDay(yesterday);
......
...@@ -254,6 +254,14 @@ ...@@ -254,6 +254,14 @@
point_details point_details
where account_id =#{accountId} and site_id =#{siteId} where account_id =#{accountId} and site_id =#{siteId}
</select> </select>
<select id="getCountToDay" resultType="java.lang.Integer">
select
count(distinct mpp.source_id)
from
mq_point_param mpp
where mpp.account_id =#{accountId} and mpp.site_id =#{siteId} and mpp.event_name =#{type}
and DATE_FORMAT(mpp.create_point_time, '%Y-%m-%d' ) = #{toDay}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment