Browse Source

Merge remote-tracking branch 'origin/dev_heart' into dev

dev_shibei_match
yinzuomei 5 years ago
parent
commit
0e409f04d9
  1. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  2. 85
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  3. 73
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java

8
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 new Result();
} }
/**
* @return com.epmet.commons.tools.utils.Result
* @param formDTO
* @author yinzuomei
* @description 测试积分发放接口
* @Date 2020/7/31 13:19
**/
@PostMapping("testgrantpoint") @PostMapping("testgrantpoint")
public Result testGrantPoint(@RequestBody TestGrantFormDTO formDTO){ public Result testGrantPoint(@RequestBody TestGrantFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,TestGrantFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO,TestGrantFormDTO.AddUserInternalGroup.class);
workActService.testGrantPoint(formDTO); workActService.testGrantPoint(formDTO);
return new Result(); return new Result();
} }
/** /**
* @return com.epmet.commons.tools.utils.Result * @return com.epmet.commons.tools.utils.Result
* @param formDTO * @param formDTO

85
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) { public void cancelAct(CancelActFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){ if(null==actInfoDTO){
logger.error("act_info is null"); logger.error("act_info is null actId="+formDTO.getActId());
return ; return ;
} }
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
@ -809,7 +809,7 @@ public class WorkActServiceImpl implements WorkActService {
public void finishAct(String actId) { public void finishAct(String actId) {
ActInfoDTO actInfoDTO=actInfoService.get(actId); ActInfoDTO actInfoDTO=actInfoService.get(actId);
if(null==actInfoDTO){ if(null==actInfoDTO){
logger.error("act_info is null"); logger.error("act_info is null actId="+actId);
return; return;
} }
//校验是否可以结束 //校验是否可以结束
@ -826,9 +826,18 @@ public class WorkActServiceImpl implements WorkActService {
//发放积分调用事件 //发放积分调用事件
if(actInfoDTO.getReward()>0){ if(actInfoDTO.getReward()>0){
this.grantActPoints(actInfoDTO); 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) { private void grantActPoints(ActInfoDTO actInfoDTO) {
//查询已经给分的用户 //查询已经给分的用户
QueryWrapper<ActUserRelationEntity> wrapper = new QueryWrapper<>(); QueryWrapper<ActUserRelationEntity> wrapper = new QueryWrapper<>();
@ -837,7 +846,7 @@ public class WorkActServiceImpl implements WorkActService {
.eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE); .eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE);
List<ActUserRelationEntity> actUserRelationEntityList=actUserRelationDao.selectList(wrapper); List<ActUserRelationEntity> actUserRelationEntityList=actUserRelationDao.selectList(wrapper);
if(null==actUserRelationEntityList||actUserRelationEntityList.size()<1){ if(null==actUserRelationEntityList||actUserRelationEntityList.size()<1){
logger.info("不存在给分的记录,无需发送消息时间"); logger.info(String.format("活动%s,不存在给分的记录,无需发送消息时间",actInfoDTO.getId()));
return; return;
} }
//查询当前用户所属组织信息 //查询当前用户所属组织信息
@ -879,7 +888,7 @@ public class WorkActServiceImpl implements WorkActService {
actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result)); actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result));
actGrantPointLogDao.insert(actGrantPointLogEntity); actGrantPointLogDao.insert(actGrantPointLogEntity);
if(!result.success()){ 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("积分发方成功"); logger.info("积分发方成功");
} }
/**
* @return void
* @param actInfoDTO
* @author yinzuomei
* @description //发放爱心时长、参与活动并获得积分的次数
* @Date 2020/7/31 13:15
**/
private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { private void updateHeartUserInfo(ActInfoDTO actInfoDTO) {
List<ActUserRelationDTO> actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR); List<ActUserRelationDTO> actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR);
for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){ for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){
@ -932,23 +948,36 @@ public class WorkActServiceImpl implements WorkActService {
if(null==heartUserInfoDTO){ if(null==heartUserInfoDTO){
continue; continue;
} }
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ if(actInfoDTO.getReward()>0){
heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1);
}
//爱心时长发放(签到的。未签到但是有积分的)
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())){ 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()); 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) { private void saveActStatistical(String actId) {
ActStatisticalDTO actStatisticalDTO=new ActStatisticalDTO(); ActStatisticalDTO actStatisticalDTO=new ActStatisticalDTO();
actStatisticalDTO.setActId(actId); actStatisticalDTO.setActId(actId);
@ -971,6 +1000,13 @@ public class WorkActServiceImpl implements WorkActService {
actStatisticalService.save(actStatisticalDTO); actStatisticalService.save(actStatisticalDTO);
} }
/**
* @return void
* @param actId
* @author yinzuomei
* @description 保存活动结束日志
* @Date 2020/7/31 13:16
**/
private void saveActOperationRec(String actId) { private void saveActOperationRec(String actId) {
ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity();
actOperationRecEntity.setActId(actId); actOperationRecEntity.setActId(actId);
@ -980,6 +1016,13 @@ public class WorkActServiceImpl implements WorkActService {
actOperationRecDao.insert(actOperationRecEntity); actOperationRecDao.insert(actOperationRecEntity);
} }
/**
* @return com.epmet.dto.ActInfoDTO
* @param actInfoDTO
* @author yinzuomei
* @description 校验是否可以结束
* @Date 2020/7/31 13:16
**/
private ActInfoDTO checkActInfoDTO(ActInfoDTO actInfoDTO) { private ActInfoDTO checkActInfoDTO(ActInfoDTO actInfoDTO) {
//只有我发布的活动,我可以就结束 //只有我发布的活动,我可以就结束
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
@ -1012,7 +1055,7 @@ public class WorkActServiceImpl implements WorkActService {
public void summaryAct(SummaryActFormDTO formDTO) { public void summaryAct(SummaryActFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){ if(null==actInfoDTO){
logger.info("act_info is null"); logger.error("act_info is null actId="+formDTO.getActId());
return; return;
} }
if(!actInfoDTO.getActStatus().equals(ActConstant.ACT_STATUS_FINISHED)){ if(!actInfoDTO.getActStatus().equals(ActConstant.ACT_STATUS_FINISHED)){
@ -1127,7 +1170,7 @@ public class WorkActServiceImpl implements WorkActService {
//删除所有的草稿 //删除所有的草稿
this.deleteDraft(); this.deleteDraft();
publishActResultDTO.setActId(rePublishFormDTO.getActId()); publishActResultDTO.setActId(rePublishFormDTO.getActId());
//发送消息通知-暂时不做了 //发送消息通知-暂时不做了,前端默认串的是不通知
/*if(rePublishFormDTO.getNoticePassedPeople()){ /*if(rePublishFormDTO.getNoticePassedPeople()){
this.noticePassedPeople(originalActInfo,newActInfoEntity); this.noticePassedPeople(originalActInfo,newActInfoEntity);
}*/ }*/
@ -1135,14 +1178,4 @@ public class WorkActServiceImpl implements WorkActService {
} }
private void noticePassedPeople(ActInfoDTO originalActInfo, ActInfoEntity newActInfoEntity) {
/* List<ActUserRelationDTO> actUserRelationDTOList=actUserRelationDao.selectAuditingAndPassedList(originalActInfo.getId());
if(null==actUserRelationDTOList||actUserRelationDTOList.size()<1){
logger.info("不存在待审核人员、已经审核用户,无需发送站内信");
return;
}
String originalTitle=originalActInfo.getTitle();
//活动地点、活动预计开始时间、活动预计结束时间、活动积分、签到时间开始、签到结束时间、签到地点*/
}
} }

73
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.ActUserRelationService;
import com.epmet.service.HeartUserInfoService; import com.epmet.service.HeartUserInfoService;
import com.epmet.service.WorkActUserService; import com.epmet.service.WorkActUserService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -102,9 +103,15 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//赋值基本信息 //赋值基本信息
for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){
if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){
auditingDTO.setRealName(userBaseInfoResultDTO.getRealName()); if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){
auditingDTO.setNickName(userBaseInfoResultDTO.getNickname()); auditingDTO.setRealName(userBaseInfoResultDTO.getRealName());
auditingDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); }
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){
auditingDTO.setNickName(userBaseInfoResultDTO.getNickname());
}
if(StringUtils.isNotBlank((userBaseInfoResultDTO.getHeadImgUrl()))){
auditingDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl());
}
break; break;
} }
} }
@ -145,9 +152,15 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//赋值基本信息 //赋值基本信息
for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){
if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){
passedDTO.setRealName(userBaseInfoResultDTO.getRealName()); if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){
passedDTO.setNickName(userBaseInfoResultDTO.getNickname()); passedDTO.setRealName(userBaseInfoResultDTO.getRealName());
passedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); }
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){
passedDTO.setNickName(userBaseInfoResultDTO.getNickname());
}
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getHeadImgUrl())){
passedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl());
}
break; break;
} }
} }
@ -189,9 +202,15 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//赋值基本信息 //赋值基本信息
for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){
if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){
rejectedDTO.setRealName(userBaseInfoResultDTO.getRealName()); if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){
rejectedDTO.setNickName(userBaseInfoResultDTO.getNickname()); rejectedDTO.setRealName(userBaseInfoResultDTO.getRealName());
rejectedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); }
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){
rejectedDTO.setNickName(userBaseInfoResultDTO.getNickname());
}
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getHeadImgUrl())){
rejectedDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl());
}
break; break;
} }
} }
@ -233,9 +252,15 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//赋值基本信息 //赋值基本信息
for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){
if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){
cancelDTO.setRealName(userBaseInfoResultDTO.getRealName()); if(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName())){
cancelDTO.setNickName(userBaseInfoResultDTO.getNickname()); cancelDTO.setRealName(userBaseInfoResultDTO.getRealName());
cancelDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); }
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname())){
cancelDTO.setNickName(userBaseInfoResultDTO.getNickname());
}
if(StringUtils.isNotBlank(userBaseInfoResultDTO.getHeadImgUrl())){
cancelDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl());
}
break; break;
} }
} }
@ -503,9 +528,15 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//基础信息赋值 //基础信息赋值
for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ for(UserBaseInfoResultDTO userBaseInfo:userInfoList){
if(joinedUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ if(joinedUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){
joinedUserResultDTO.setRealName(userBaseInfo.getRealName()); if(StringUtils.isNotBlank(userBaseInfo.getRealName())){
joinedUserResultDTO.setNickName(userBaseInfo.getNickname()); joinedUserResultDTO.setRealName(userBaseInfo.getRealName());
joinedUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); }
if(StringUtils.isNotBlank(userBaseInfo.getNickname())){
joinedUserResultDTO.setNickName(userBaseInfo.getNickname());
}
if(StringUtils.isNotBlank(userBaseInfo.getHeadImgUrl())){
joinedUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl());
}
break; break;
} }
@ -536,9 +567,15 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//基础信息赋值 //基础信息赋值
for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ for(UserBaseInfoResultDTO userBaseInfo:userInfoList){
if(canceledUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ if(canceledUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){
canceledUserResultDTO.setRealName(userBaseInfo.getRealName()); if(StringUtils.isNotBlank(userBaseInfo.getRealName())){
canceledUserResultDTO.setNickName(userBaseInfo.getNickname()); canceledUserResultDTO.setRealName(userBaseInfo.getRealName());
canceledUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); }
if(StringUtils.isNotBlank(userBaseInfo.getNickname())){
canceledUserResultDTO.setNickName(userBaseInfo.getNickname());
}
if(StringUtils.isNotBlank(userBaseInfo.getHeadImgUrl())){
canceledUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl());
}
break; break;
} }

Loading…
Cancel
Save