Browse Source

爱心互助-枚举

master
zhangyongzhangyong 5 years ago
parent
commit
1e6fd9417d
  1. 57
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java
  2. 70
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  3. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java
  4. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  5. 43
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java
  6. 49
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java

57
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java

@ -88,14 +88,30 @@ public interface ActConstant {
*/
String ACT_USER_STATUS_CANCELD="canceld";
/*操作类型已报名/待审核auditing
/**
* (5)act_user_relation表的REWARD_FLAG给积分agree
*/
String ACT_USER_STATUS_AGREE="agree";
/**
* (6)act_user_relation表的REWARD_FLAG不给积分deny
*/
String ACT_USER_STATUS_DENY="deny";
/**
* (7)act_user_relation表的SIGN_IN_FLAG已签到
*/
String ACT_USER_STATUS_SIGNED_IN="signed_in";
/*act_user_log表操作类型
已报名/待审核auditing
审核通过passed
审核不通过refused
取消报名canceld
已签到signedin
发放积分rewarded
发放积分rewarded
拒绝发放积分refuse_reward
重新处理processing
重新处理processing
*/
String ACT_USER_LOG_OPER_AUDITING="auditing";
String ACT_USER_LOG_OPER_PASSED="passed";
@ -111,4 +127,39 @@ public interface ActConstant {
*/
String PASSEDTYPE_AUTO="auto";
String PASSEDTYPE_MANUAL="manual";
/**
* (1)用户活动页面按钮控制我要报名
*/
String CURRENT_STATUS_USER_SIGN_UP = "sign_up";
/**
* (2)用户活动页面按钮控制已报满
*/
String CURRENT_STATUS_USER_ENOUGH = "enough";
/**
* (3)用户活动页面按钮控制截止报名
*/
String CURRENT_STATUS_USER_END_SIGN_UP = "end_sign_up";
/**
* (4)用户活动页面按钮控制已开始
*/
String CURRENT_STATUS_USER_IN_PROGRESS = "in_progress";
/**
* (5)用户活动页面按钮控制已结束
*/
String CURRENT_STATUS_USER_FINISHED = "finished";
/**
* (6)用户活动页面按钮控制已取消
*/
String CURRENT_STATUS_USER_CANCELED = "canceled";
/**
* (7)用户活动页面按钮控制已确认积分
*/
String CURRENT_STATUS_USER_POINTS_CONFIRM = "points_confirm";
}

70
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

@ -20,18 +20,18 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ActConstant;
import com.epmet.dao.ActInfoDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.form.resi.*;
import com.epmet.dto.result.resi.*;
@ -40,8 +40,6 @@ import com.epmet.entity.ActUserRelationEntity;
import com.epmet.redis.ActInfoRedis;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ActUserRelationStatusConstant;
import com.epmet.utils.ActUserStatusConstant;
import com.epmet.utils.CaculateDistance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -228,12 +226,12 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
Date currentTime = new Date();
ActInfoEntity actInfoEntity =baseDao.selectById(actId);
// 活动已取消
if (ActUserStatusConstant.CANCELED.equals(actInfoEntity.getActStatus())) {
return ActUserStatusConstant.CANCELED;
if (ActConstant.CURRENT_STATUS_USER_CANCELED.equals(actInfoEntity.getActStatus())) {
return ActConstant.CURRENT_STATUS_USER_CANCELED;
}
// 活动已经结束
if (ActUserStatusConstant.FINISHED.equals(actInfoEntity.getActStatus())) {
return ActUserStatusConstant.FINISHED;
if (ActConstant.CURRENT_STATUS_USER_FINISHED.equals(actInfoEntity.getActStatus())) {
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
// 查询用户是否报名该活动
@ -267,19 +265,19 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
/*报名结束前*/
if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) || actInfoEntity.getActQuota() > signUpNum) {
// 我要报名(不限名额或者未报满的)
return ActUserStatusConstant.SIGN_UP;
return ActConstant.CURRENT_STATUS_USER_SIGN_UP;
} else {
// 已报满(限制名额且已经报满的)
return ActUserStatusConstant.ENOUGH;
return ActConstant.CURRENT_STATUS_USER_ENOUGH;
}
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/*报名结束,活动未开始:显示:截止报名*/
return ActUserStatusConstant.END_SIGN_UP;
return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP;
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
// 活动打卡时间段内: 显示:已开始
return ActUserStatusConstant.IN_PROGRESS;
return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS;
} else {
return ActUserStatusConstant.FINISHED;
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
}
@ -298,58 +296,58 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
String actUserStatus = actUserRelationEntity.getStatus();
// 已确认过积分,直接返回
if (ActUserRelationStatusConstant.AGREE.equals(actUserRelationEntity.getRewardFlag())
|| ActUserRelationStatusConstant.DENY.equals(actUserRelationEntity.getRewardFlag())) {
return ActUserStatusConstant.POINTS_CONFIRM;
if (ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelationEntity.getRewardFlag())
|| ActConstant.ACT_USER_STATUS_DENY.equals(actUserRelationEntity.getRewardFlag())) {
return ActConstant.CURRENT_STATUS_USER_POINTS_CONFIRM;
}
if (currentTime.after(actInfoEntity.getActEndTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/*活动结束;打卡未截止*/
// (未审核的、审核未通过、取消报名的)- 已结束
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)
|| ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)
|| ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.FINISHED;
if (ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
} else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) {
/* 活动打卡时间段内 */
// (未审核的、审核未通过、取消报名的)- 已开始
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)
|| ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)
|| ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.IN_PROGRESS;
if (ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)
|| ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS;
}
} else if (currentTime.before(actInfoEntity.getSignUpEndTime())) {
/* 报名截至时间前 */
//(未审核、审核通过的)底部显示按钮 取消报名
if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus) || ActUserRelationStatusConstant.PASSED.equals(actUserStatus)) {
return ActUserStatusConstant.CANCELD;
if (ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_PASSED.equals(actUserStatus)) {
return ActConstant.ACT_USER_STATUS_CANCELD;
}
// 活动限制名额,且报名人数已满 已报满
if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) && signUpNum >= actInfoEntity.getActQuota()) {
return ActUserStatusConstant.ENOUGH;
return ActConstant.CURRENT_STATUS_USER_ENOUGH;
}
// (报名审核未通过或者已经取消报名的)可再次报名-我要报名
if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.SIGN_UP;
if (ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_SIGN_UP;
}
} else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) {
/* 报名截止但 活动未开始 */
// 已经取消报名的-报名截止
if (ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) {
return ActUserStatusConstant.END_SIGN_UP;
if (ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP;
}
// 已报名审核不通过 -报名截止
if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)) {
return ActUserStatusConstant.END_SIGN_UP;
if (ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)) {
return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP;
}
// 已报名且审核通过、未审核 -取消报名
if (ActUserRelationStatusConstant.PASSED.equals(actUserStatus) || ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)) {
return ActUserStatusConstant.CANCELD;
if (ActConstant.ACT_USER_STATUS_PASSED.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)) {
return ActConstant.ACT_USER_STATUS_CANCELD;
}
}
return ActUserStatusConstant.FINISHED;
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
@Override

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ActConstant;
import com.epmet.dao.ActSignInPicDao;
import com.epmet.dao.ActSignInRecDao;
import com.epmet.dao.ActUserLogDao;
@ -35,7 +36,6 @@ import com.epmet.entity.ActUserLogEntity;
import com.epmet.redis.ActSignInRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.service.ActSignInRecService;
import com.epmet.utils.ActUserRelationStatusConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -74,14 +74,14 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO();
actUserRelationDTO.setActId(formDTO.getActId());
actUserRelationDTO.setUserId(formDTO.getUserId());
actUserRelationDTO.setSignInFlag(ActUserRelationStatusConstant.SIGNED_IN);
actUserRelationDTO.setSignInFlag(ActConstant.ACT_USER_STATUS_SIGNED_IN);
actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO);
// 存储用户活动关系日志表
ActUserLogEntity actUserLogEntity = new ActUserLogEntity();
actUserLogEntity.setActId(formDTO.getActId());
actUserLogEntity.setUserId(formDTO.getUserId());
actUserLogEntity.setOperationType(ActUserRelationStatusConstant.SIGNED_IN);
actUserLogEntity.setOperationType(ActConstant.ACT_USER_STATUS_SIGNED_IN);
actUserLogDao.insert(actUserLogEntity);
//" 实况id,当sync_live=1时此列有值"

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ActConstant;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dao.VolunteerInfoDao;
@ -46,7 +47,6 @@ import com.epmet.redis.ActUserRelationRedis;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserLogService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ActUserRelationStatusConstant;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -181,14 +181,14 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
userRelationDTO.setActId(formDTO.getActId());
userRelationDTO.setUserId(tokenDto.getUserId());
userRelationDTO.setCancelReason(formDTO.getFailureReason());
userRelationDTO.setStatus(ActUserRelationStatusConstant.CANCELD);
userRelationDTO.setStatus(ActConstant.ACT_USER_STATUS_CANCELD);
baseDao.updateUserRelationByActIdAndUserId(userRelationDTO);
//2、插入用户活动关系日志表
ActUserLogDTO userLogDTO = new ActUserLogDTO();
userLogDTO.setActId(formDTO.getActId());
userLogDTO.setUserId(tokenDto.getUserId());
userLogDTO.setOperationType(ActUserRelationStatusConstant.CANCELD);
userLogDTO.setOperationType(ActConstant.ACT_USER_STATUS_CANCELD);
userLogDTO.setReason(formDTO.getFailureReason());
actUserLogService.save(userLogDTO);
return new Result();
@ -257,14 +257,14 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
ActUserRelationEntity entity = new ActUserRelationEntity();
entity.setActId(formDTO.getActId());
entity.setUserId(formDTO.getUserId());
entity.setStatus(ActUserRelationStatusConstant.AUDITING);
entity.setStatus(ActConstant.ACT_USER_STATUS_AUDITING);
baseDao.insert(entity);
// 5.插入活动日志表
ActUserLogEntity userLogEntity = new ActUserLogEntity();
userLogEntity.setActId(formDTO.getActId());
userLogEntity.setUserId(formDTO.getUserId());
userLogEntity.setOperationType(ActUserRelationStatusConstant.AUDITING);
userLogEntity.setOperationType(ActConstant.ACT_USER_STATUS_AUDITING);
actUserLogService.insert(userLogEntity);
}
}

43
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java

@ -1,43 +0,0 @@
package com.epmet.utils;
/**
* @Description 用户活动关系表当前状态
* @Auther: zhangyong
* @Date: 2020-07-21 17:36
*/
public interface ActUserRelationStatusConstant {
/**
* 已报名/待审核
*/
String AUDITING="auditing";
/**
* 审核通过
*/
String PASSED="passed";
/**
* 审核不通过
*/
String REFUSED = "refused";
/**
* 取消报名
*/
String CANCELD = "canceld";
/**
* 给积分
*/
String AGREE = "agree";
/**
* 不给积分
*/
String DENY = "deny";
/**
* 已签到
*/
String SIGNED_IN = "signed_in";
}

49
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java

@ -1,49 +0,0 @@
package com.epmet.utils;
/**
* 用户当前状态sign_up-我要报名canceld-取消报名enough-已报满end_sign_up-截止报名in_progress-已开始; finished-已结束canceled-已取消points_confirm-已确认积分
* @Auther: zhangyong
* @Date: 2020-07-21 17:36
*/
public interface ActUserStatusConstant {
/**
* 我要报名
*/
String SIGN_UP = "sign_up";
/**
* 取消报名
*/
String CANCELD = "canceld";
/**
* 已报满
*/
String ENOUGH = "enough";
/**
* 截止报名
*/
String END_SIGN_UP = "end_sign_up";
/**
* 已开始
*/
String IN_PROGRESS = "in_progress";
/**
* 已结束
*/
String FINISHED = "finished";
/**
* 已取消
*/
String CANCELED = "canceled";
/**
* 已确认积分
*/
String POINTS_CONFIRM = "points_confirm";
}
Loading…
Cancel
Save