Browse Source

签到时间判断,空指针问题处理

dev_shibei_match
zhangyongzhangyong 5 years ago
parent
commit
f6942827d7
  1. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

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

@ -23,6 +23,7 @@ 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;
@ -399,14 +400,19 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
Date currentTime = new Date();
// 查询 活动信息
ActInfoEntity entity = baseDao.selectById(formDTO.getActId());
if (currentTime.before(entity.getSignInStartTime())){
// 签到时间还未到~
resultDTO.setTip(EpmetErrorCode.SIGN_IN_TIME_NO.getMsg());
resultDTO.setFlag(EpmetErrorCode.SIGN_IN_TIME_NO.getCode());
} else if (currentTime.after(entity.getSignInEndTime())){
// 签到时间已结束~
resultDTO.setTip(EpmetErrorCode.SIGN_IN_TIME_END.getMsg());
resultDTO.setFlag(EpmetErrorCode.SIGN_IN_TIME_END.getCode());
if (null != entity){
if (currentTime.before(entity.getSignInStartTime())){
// 签到时间还未到~
resultDTO.setTip(EpmetErrorCode.SIGN_IN_TIME_NO.getMsg());
resultDTO.setFlag(EpmetErrorCode.SIGN_IN_TIME_NO.getCode());
} else if (currentTime.after(entity.getSignInEndTime())){
// 签到时间已结束~
resultDTO.setTip(EpmetErrorCode.SIGN_IN_TIME_END.getMsg());
resultDTO.setFlag(EpmetErrorCode.SIGN_IN_TIME_END.getCode());
}
} else {
logger.error("签到失败,未查到匹配的活动信息,传参活动ID:" + formDTO.getActId());
throw new RenException("签到失败,未查到匹配的活动信息");
}
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}

Loading…
Cancel
Save