Browse Source

修改heart_user_info,活动结束后,修改实际参与活动数+1

master
yinzuomei 5 years ago
parent
commit
57bc53671b
  1. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java
  2. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java
  3. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  4. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java

@ -61,7 +61,7 @@ public class HeartUserInfoDTO implements Serializable {
private Integer kindnessTime;
/**
* 实际参与活动个数签到+1
* 实际参与活动个数
*/
private Integer participationNum;

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java

@ -57,7 +57,7 @@ public class HeartUserInfoEntity extends BaseEpmetEntity {
private Integer kindnessTime;
/**
* 实际参与活动个数签到+1
* 实际参与活动个数
*/
private Integer participationNum;

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -819,7 +819,7 @@ public class WorkActServiceImpl implements WorkActService {
//act_info表改为已完成
actInfoDTO.setActStatus(ActConstant.ACT_STATUS_FINISHED);
actInfoService.update(actInfoDTO);
//发放爱心时长、参与活动并获得积分的次数
//发放爱心时长、参与活动并获得积分的次数、实际参与活动个数
updateHeartUserInfo(actInfoDTO);
//保存结束活动日志
this.saveActOperationRec(actId);
@ -950,8 +950,10 @@ public class WorkActServiceImpl implements WorkActService {
if(null==heartUserInfoDTO){
continue;
}
boolean updateFlag=false;
if(actInfoDTO.getReward()>0){
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){
updateFlag=true;
heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1);
}
}
@ -959,6 +961,7 @@ public class WorkActServiceImpl implements WorkActService {
//爱心时长发放(签到的。未签到但是有积分的)
if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){
//已签到的
updateFlag=true;
heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin());
UserKindnessTimeLogEntity userKindnessTimeLogEntity=new UserKindnessTimeLogEntity();
userKindnessTimeLogEntity.setActId(actInfoDTO.getId());
@ -968,6 +971,7 @@ public class WorkActServiceImpl implements WorkActService {
}else{
//未签到,但是有积分的
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){
updateFlag=true;
heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin());
UserKindnessTimeLogEntity userKindnessTimeLogEntity=new UserKindnessTimeLogEntity();
userKindnessTimeLogEntity.setActId(actInfoDTO.getId());
@ -977,7 +981,17 @@ public class WorkActServiceImpl implements WorkActService {
}
}
}
if(actInfoDTO.getReward()>0||actInfoDTO.getServiceMin()>0){
//审核通过并且已经签到的更新实际参与活动数,+1
if (ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())
&& ActConstant.ACT_USER_STATUS_PASSED.equals(actUserRelation.getStatus())) {
updateFlag = true;
if (null != heartUserInfoDTO.getParticipationNum() && heartUserInfoDTO.getParticipationNum() >= 0) {
heartUserInfoDTO.setParticipationNum(heartUserInfoDTO.getParticipationNum() + 1);
} else if (null == heartUserInfoDTO.getParticipationNum()) {
heartUserInfoDTO.setParticipationNum(NumConstant.ONE);
}
}
if (updateFlag) {
heartUserInfoService.update(heartUserInfoDTO);
}
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql

@ -350,7 +350,7 @@ CREATE TABLE `heart_user_info` (
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`VOLUNTEER_FLAG` tinyint(1) NOT NULL COMMENT '1是志愿者,0不是志愿者(志愿者注册成功后需要来更新值)',
`KINDNESS_TIME` int(11) NOT NULL DEFAULT 0 COMMENT '爱心时长(单位:分钟)(参与并签到了的活动,实际结束-实际开始)签到的。未签到但是有积分的\r\n',
`PARTICIPATION_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '实际参与活动个数(签到+1)',
`PARTICIPATION_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '实际参与活动个数',
`OBTAIN_POINT_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '参与活动并获得积分的次数(结束活动时,如果给用户发放积分则该数值+1)',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',

Loading…
Cancel
Save