|
|
|
@ -30,6 +30,7 @@ import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.constant.ActStateConstant; |
|
|
|
import com.elink.esua.epdc.constant.ActUserRelationStatusConstant; |
|
|
|
import com.elink.esua.epdc.modules.activity.dao.ActInfoDao; |
|
|
|
import com.elink.esua.epdc.modules.activity.dao.ActUserRelationDao; |
|
|
|
import com.elink.esua.epdc.modules.activity.entity.ActUserRelationEntity; |
|
|
|
@ -140,8 +141,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
updateById(updateEntity); |
|
|
|
//存储活动日志表 epdc_act_user_log
|
|
|
|
ActUserLogDTO actUserLogDTO = new ActUserLogDTO(); |
|
|
|
actUserLogDTO.setUserId(entity.getUserId()); |
|
|
|
actUserLogDTO.setActId(entity.getActId()); |
|
|
|
actUserLogDTO.setActUserRelationId(dto.getId()); |
|
|
|
actUserLogDTO.setOperationType(dto.getStatus()); |
|
|
|
actUserLogDTO.setFailureReason(dto.getFailureReason()); |
|
|
|
actUserLogDTO.setOperationTime(new Date()); |
|
|
|
@ -162,42 +162,44 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
public Result activitySignUp(ActUserRelationDTO actUserRelationDTO) { |
|
|
|
ActInfoDTO actInfoDTO = actInfoDao.queryActSignupNum(actUserRelationDTO.getActId()); |
|
|
|
//判断报名是否已满
|
|
|
|
if (actInfoDTO.getActQuotaCategory() != 0 && actInfoDTO.getActQuota() == actInfoDTO.getSignupNum()){ |
|
|
|
return new Result().error("已报满"); |
|
|
|
if (actInfoDTO.getActQuotaCategory() != 0 && actInfoDTO.getActQuota().equals(actInfoDTO.getSignupNum())) { |
|
|
|
return new Result().error("活动已报满"); |
|
|
|
} |
|
|
|
//查询是否已报名
|
|
|
|
int data = baseDao.isSignUp(actUserRelationDTO.getUserId(),actUserRelationDTO.getActId()); |
|
|
|
if(data == 0){ |
|
|
|
ActUserRelationEntity actUserRelationEntity = baseDao.selectOneByUserIdAndActId(actUserRelationDTO.getUserId(), actUserRelationDTO.getActId()); |
|
|
|
if (null == actUserRelationEntity || (ActUserRelationStatusConstant.CANCEL_SIGN_UP.equals(actUserRelationEntity.getStatus()) |
|
|
|
|| ActUserRelationStatusConstant.NOT_APPROVED.equals(actUserRelationEntity.getStatus()))) { |
|
|
|
//未报名该活动,进行报名
|
|
|
|
//存储活动人员关系表
|
|
|
|
ActUserRelationEntity entity = ConvertUtils.sourceToTarget(actUserRelationDTO, ActUserRelationEntity.class); |
|
|
|
insert(entity); |
|
|
|
if (null != actUserRelationEntity) { |
|
|
|
entity.setId(actUserRelationEntity.getId()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
} else { |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
//存储活动日志表
|
|
|
|
ActUserLogDTO actUserLogDTO = new ActUserLogDTO(); |
|
|
|
actUserLogDTO.setActId(actUserRelationDTO.getActId()); |
|
|
|
actUserLogDTO.setUserId(actUserRelationDTO.getUserId()); |
|
|
|
actUserLogDTO.setOperationType("0");//报名
|
|
|
|
actUserLogDTO.setActUserRelationId(entity.getId()); |
|
|
|
actUserLogDTO.setOperationType(ActUserRelationStatusConstant.SIGN_UP); |
|
|
|
actUserLogDTO.setOperationTime(new Date()); |
|
|
|
actUserLogService.save(actUserLogDTO); |
|
|
|
|
|
|
|
//更新epdc_act_info的已报名名额
|
|
|
|
actInfoDTO.setSignupNum(actInfoDTO.getSignupNum() + 1); |
|
|
|
actInfoService.update(actInfoDTO); |
|
|
|
}else{ |
|
|
|
return new Result().error("已报名"); |
|
|
|
} else { |
|
|
|
return new Result().error("您已报名"); |
|
|
|
} |
|
|
|
|
|
|
|
return new Result().ok("报名成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result activityCancelSignUp(AppActUserCancelsignupDTO appActUserCancelsignupDTO) { |
|
|
|
|
|
|
|
//查询是否已报名
|
|
|
|
List<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(appActUserCancelsignupDTO.getUserId(),appActUserCancelsignupDTO.getActId()); |
|
|
|
if(data != null && data.size() > 0){ |
|
|
|
List<ActUserRelationDTO> data = baseDao.selectOneActUserRelationInfo(appActUserCancelsignupDTO.getUserId(), appActUserCancelsignupDTO.getActId()); |
|
|
|
if (data != null && data.size() > 0) { |
|
|
|
ActUserRelationDTO actUserRelationDTO = data.get(0); |
|
|
|
actUserRelationDTO.setStatus("3");//取消报名
|
|
|
|
actUserRelationDTO.setStatus(ActUserRelationStatusConstant.CANCEL_SIGN_UP);//取消报名
|
|
|
|
actUserRelationDTO.setFailureReason(appActUserCancelsignupDTO.getFailureReason());//取消报名原因
|
|
|
|
//已报名该活动,进行取消报名
|
|
|
|
//更新活动人员关系表
|
|
|
|
@ -205,12 +207,11 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
updateById(entity); |
|
|
|
//存储活动日志表
|
|
|
|
ActUserLogDTO actUserLogDTO = new ActUserLogDTO(); |
|
|
|
actUserLogDTO.setActId(actUserRelationDTO.getActId()); |
|
|
|
actUserLogDTO.setUserId(actUserRelationDTO.getUserId()); |
|
|
|
actUserLogDTO.setOperationType("3");//取消报名
|
|
|
|
actUserLogDTO.setActUserRelationId(actUserRelationDTO.getId()); |
|
|
|
actUserLogDTO.setOperationType(ActUserRelationStatusConstant.CANCEL_SIGN_UP);//取消报名
|
|
|
|
actUserLogDTO.setOperationTime(new Date()); |
|
|
|
actUserLogDTO.setFailureReason(appActUserCancelsignupDTO.getFailureReason()); |
|
|
|
actUserLogService.save(actUserLogDTO); |
|
|
|
|
|
|
|
//更新epdc_act_info的已报名名额
|
|
|
|
ActInfoDTO actInfoDTO = actInfoDao.queryActSignupNum(actUserRelationDTO.getActId()); |
|
|
|
actInfoDTO.setSignupNum(actInfoDTO.getSignupNum() - 1); |
|
|
|
@ -218,7 +219,6 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
}else{ |
|
|
|
return new Result().error("未报名"); |
|
|
|
} |
|
|
|
|
|
|
|
return new Result().ok("取消报名成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@ -299,8 +299,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
updateById(entity); |
|
|
|
// 存储活动日志表
|
|
|
|
ActUserLogDTO actUserLogDTO = new ActUserLogDTO(); |
|
|
|
actUserLogDTO.setActId(actUserRelationDTO.getActId()); |
|
|
|
actUserLogDTO.setUserId(actUserRelationDTO.getUserId()); |
|
|
|
actUserLogDTO.setActUserRelationId(entity.getId()); |
|
|
|
actUserLogDTO.setOperationType(actUserDefaultState);// 默认状态
|
|
|
|
actUserLogDTO.setOperationTime(new Date()); |
|
|
|
actUserLogService.save(actUserLogDTO); |
|
|
|
@ -312,4 +311,4 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD |
|
|
|
return new Result().ok("该活动对已报名的志愿者自动审核成功"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|