From 15734fb99bbc3615f80a13316c5a9648477e4b8e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 31 Jul 2020 13:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=85=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/WorkActController.java | 8 ++ .../service/impl/WorkActServiceImpl.java | 85 +++++++++++++------ .../service/impl/WorkActUserServiceImpl.java | 73 ++++++++++++---- 3 files changed, 122 insertions(+), 44 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index 175e54bdaf..fb0a64e4dc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -190,12 +190,20 @@ public class WorkActController { return new Result(); } + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 测试积分发放接口 + * @Date 2020/7/31 13:19 + **/ @PostMapping("testgrantpoint") public Result testGrantPoint(@RequestBody TestGrantFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO,TestGrantFormDTO.AddUserInternalGroup.class); workActService.testGrantPoint(formDTO); return new Result(); } + /** * @return com.epmet.commons.tools.utils.Result * @param formDTO 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 bbc8c3a9c4..4f65a123c3 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 @@ -621,7 +621,7 @@ public class WorkActServiceImpl implements WorkActService { public void cancelAct(CancelActFormDTO formDTO) { ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); if(null==actInfoDTO){ - logger.error("act_info is null"); + logger.error("act_info is null actId="+formDTO.getActId()); return ; } if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ @@ -809,7 +809,7 @@ public class WorkActServiceImpl implements WorkActService { public void finishAct(String actId) { ActInfoDTO actInfoDTO=actInfoService.get(actId); if(null==actInfoDTO){ - logger.error("act_info is null"); + logger.error("act_info is null actId="+actId); return; } //校验是否可以结束 @@ -826,9 +826,18 @@ public class WorkActServiceImpl implements WorkActService { //发放积分调用事件 if(actInfoDTO.getReward()>0){ this.grantActPoints(actInfoDTO); + }else{ + logger.info("活动积分为"+actInfoDTO.getReward()+"无需发放积分"); } } + /** + * @return void + * @param actInfoDTO + * @author yinzuomei + * @description 活动发放积分 + * @Date 2020/7/31 13:12 + **/ private void grantActPoints(ActInfoDTO actInfoDTO) { //查询已经给分的用户 QueryWrapper wrapper = new QueryWrapper<>(); @@ -837,7 +846,7 @@ public class WorkActServiceImpl implements WorkActService { .eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE); List actUserRelationEntityList=actUserRelationDao.selectList(wrapper); if(null==actUserRelationEntityList||actUserRelationEntityList.size()<1){ - logger.info("不存在给分的记录,无需发送消息时间"); + logger.info(String.format("活动%s,不存在给分的记录,无需发送消息时间",actInfoDTO.getId())); return; } //查询当前用户所属组织信息 @@ -879,7 +888,7 @@ public class WorkActServiceImpl implements WorkActService { actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result)); actGrantPointLogDao.insert(actGrantPointLogEntity); if(!result.success()){ - logger.error("活动积分发放失败"); + logger.error("活动积分发放失败,act_grant_point_log.id="+actGrantPointLogEntity.getId()); } } @@ -925,6 +934,13 @@ public class WorkActServiceImpl implements WorkActService { logger.info("积分发方成功"); } + /** + * @return void + * @param actInfoDTO + * @author yinzuomei + * @description //发放爱心时长、参与活动并获得积分的次数 + * @Date 2020/7/31 13:15 + **/ private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { List actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR); for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){ @@ -932,23 +948,36 @@ public class WorkActServiceImpl implements WorkActService { if(null==heartUserInfoDTO){ continue; } - if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ - heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1); - } - //爱心时长发放(签到的。未签到但是有积分的) - if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){ - //已签到的 - heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); - }else{ - //未签到,但是有积分的 + if(actInfoDTO.getReward()>0){ if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ + heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1); + } + } + if(actInfoDTO.getServiceMin()>0){ + //爱心时长发放(签到的。未签到但是有积分的) + if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){ + //已签到的 heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + }else{ + //未签到,但是有积分的 + if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ + heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + } } } - heartUserInfoService.update(heartUserInfoDTO); + if(actInfoDTO.getReward()>0||actInfoDTO.getServiceMin()>0){ + heartUserInfoService.update(heartUserInfoDTO); + } } } + /** + * @return void + * @param actId + * @author yinzuomei + * @description 活动结束后生成统计表 + * @Date 2020/7/31 13:15 + **/ private void saveActStatistical(String actId) { ActStatisticalDTO actStatisticalDTO=new ActStatisticalDTO(); actStatisticalDTO.setActId(actId); @@ -971,6 +1000,13 @@ public class WorkActServiceImpl implements WorkActService { actStatisticalService.save(actStatisticalDTO); } + /** + * @return void + * @param actId + * @author yinzuomei + * @description 保存活动结束日志 + * @Date 2020/7/31 13:16 + **/ private void saveActOperationRec(String actId) { ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); actOperationRecEntity.setActId(actId); @@ -980,6 +1016,13 @@ public class WorkActServiceImpl implements WorkActService { actOperationRecDao.insert(actOperationRecEntity); } + /** + * @return com.epmet.dto.ActInfoDTO + * @param actInfoDTO + * @author yinzuomei + * @description 校验是否可以结束 + * @Date 2020/7/31 13:16 + **/ private ActInfoDTO checkActInfoDTO(ActInfoDTO actInfoDTO) { //只有我发布的活动,我可以就结束 if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ @@ -1012,7 +1055,7 @@ public class WorkActServiceImpl implements WorkActService { public void summaryAct(SummaryActFormDTO formDTO) { ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); if(null==actInfoDTO){ - logger.info("act_info is null"); + logger.error("act_info is null actId="+formDTO.getActId()); return; } if(!actInfoDTO.getActStatus().equals(ActConstant.ACT_STATUS_FINISHED)){ @@ -1127,7 +1170,7 @@ public class WorkActServiceImpl implements WorkActService { //删除所有的草稿 this.deleteDraft(); publishActResultDTO.setActId(rePublishFormDTO.getActId()); - //发送消息通知-暂时不做了 + //发送消息通知-暂时不做了,前端默认串的是不通知 /*if(rePublishFormDTO.getNoticePassedPeople()){ this.noticePassedPeople(originalActInfo,newActInfoEntity); }*/ @@ -1135,14 +1178,4 @@ public class WorkActServiceImpl implements WorkActService { } - private void noticePassedPeople(ActInfoDTO originalActInfo, ActInfoEntity newActInfoEntity) { - /* List actUserRelationDTOList=actUserRelationDao.selectAuditingAndPassedList(originalActInfo.getId()); - if(null==actUserRelationDTOList||actUserRelationDTOList.size()<1){ - logger.info("不存在待审核人员、已经审核用户,无需发送站内信"); - return; - } - String originalTitle=originalActInfo.getTitle(); - - //活动地点、活动预计开始时间、活动预计结束时间、活动积分、签到时间开始、签到结束时间、签到地点*/ - } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index f59170c609..61d4466c38 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -34,6 +34,7 @@ import com.epmet.service.ActInfoService; import com.epmet.service.ActUserRelationService; import com.epmet.service.HeartUserInfoService; import com.epmet.service.WorkActUserService; +import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -102,9 +103,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { //赋值基本信息 for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ - auditingDTO.setRealName(userBaseInfoResultDTO.getRealName()); - auditingDTO.setNickName(userBaseInfoResultDTO.getNickname()); - auditingDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){ + auditingDTO.setRealName(userBaseInfoResultDTO.getRealName()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){ + auditingDTO.setNickName(userBaseInfoResultDTO.getNickname()); + } + if(StringUtils.isNotBlank((userBaseInfoResultDTO.getHeadImgUrl()))){ + auditingDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + } break; } } @@ -145,9 +152,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { //赋值基本信息 for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ - passedDTO.setRealName(userBaseInfoResultDTO.getRealName()); - passedDTO.setNickName(userBaseInfoResultDTO.getNickname()); - passedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){ + passedDTO.setRealName(userBaseInfoResultDTO.getRealName()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){ + passedDTO.setNickName(userBaseInfoResultDTO.getNickname()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getHeadImgUrl())){ + passedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + } break; } } @@ -189,9 +202,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { //赋值基本信息 for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ - rejectedDTO.setRealName(userBaseInfoResultDTO.getRealName()); - rejectedDTO.setNickName(userBaseInfoResultDTO.getNickname()); - rejectedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){ + rejectedDTO.setRealName(userBaseInfoResultDTO.getRealName()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){ + rejectedDTO.setNickName(userBaseInfoResultDTO.getNickname()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getHeadImgUrl())){ + rejectedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + } break; } } @@ -233,9 +252,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { //赋值基本信息 for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ - cancelDTO.setRealName(userBaseInfoResultDTO.getRealName()); - cancelDTO.setNickName(userBaseInfoResultDTO.getNickname()); - cancelDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){ + cancelDTO.setRealName(userBaseInfoResultDTO.getRealName()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){ + cancelDTO.setNickName(userBaseInfoResultDTO.getNickname()); + } + if(StringUtils.isNotBlank(userBaseInfoResultDTO.getHeadImgUrl())){ + cancelDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + } break; } } @@ -503,9 +528,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { //基础信息赋值 for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ if(joinedUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ - joinedUserResultDTO.setRealName(userBaseInfo.getRealName()); - joinedUserResultDTO.setNickName(userBaseInfo.getNickname()); - joinedUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + if(StringUtils.isNotBlank(userBaseInfo.getRealName())){ + joinedUserResultDTO.setRealName(userBaseInfo.getRealName()); + } + if(StringUtils.isNotBlank(userBaseInfo.getNickname())){ + joinedUserResultDTO.setNickName(userBaseInfo.getNickname()); + } + if(StringUtils.isNotBlank(userBaseInfo.getHeadImgUrl())){ + joinedUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + } break; } @@ -536,9 +567,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { //基础信息赋值 for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ if(canceledUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ - canceledUserResultDTO.setRealName(userBaseInfo.getRealName()); - canceledUserResultDTO.setNickName(userBaseInfo.getNickname()); - canceledUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + if(StringUtils.isNotBlank(userBaseInfo.getRealName())){ + canceledUserResultDTO.setRealName(userBaseInfo.getRealName()); + } + if(StringUtils.isNotBlank(userBaseInfo.getNickname())){ + canceledUserResultDTO.setNickName(userBaseInfo.getNickname()); + } + if(StringUtils.isNotBlank(userBaseInfo.getHeadImgUrl())){ + canceledUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + } break; }