From 57bc53671b82f7f1360aa7d01e01c19cca5fb796 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 3 Aug 2020 15:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9heart=5Fuser=5Finfo,=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E7=BB=93=E6=9D=9F=E5=90=8E=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E5=8F=82=E4=B8=8E=E6=B4=BB=E5=8A=A8=E6=95=B0?= =?UTF-8?q?+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/HeartUserInfoDTO.java | 2 +- .../com/epmet/entity/HeartUserInfoEntity.java | 2 +- .../epmet/service/impl/WorkActServiceImpl.java | 18 ++++++++++++++++-- .../resources/db/migration/epmet_heart.sql | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java index 8ea2b28322..778e30884b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java +++ b/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; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java index c7b90074b1..b4368fe26c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java +++ b/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; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index c228c937a0..a390e9c14e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/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); } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql index 1cc390bad2..7cc204d675 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql +++ b/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 '乐观锁',