|
|
|
@ -117,7 +117,10 @@ public class ActivityService{ |
|
|
|
|
* @return 返回报名结果 |
|
|
|
|
*/ |
|
|
|
|
@Transactional |
|
|
|
|
public JSONResponse<DefaultRes,Void> apply(UpdateActivityForm activityForm) throws RuntimeException{ |
|
|
|
|
public JSONResponse<DefaultRes,Integer> apply(UpdateActivityForm activityForm) throws RuntimeException{ |
|
|
|
|
//记录用户完成活动返回的时间币
|
|
|
|
|
Integer timeScore = null; |
|
|
|
|
|
|
|
|
|
// 保存到活动历史记录
|
|
|
|
|
ActivityHistoryEntity activityEntity=new ActivityHistoryEntity(); |
|
|
|
|
activityEntity.setActivityId(activityForm.getActivityId()); |
|
|
|
@ -126,11 +129,13 @@ public class ActivityService{ |
|
|
|
|
activityEntity.setActivityStatus(activityForm.getActivityStatus().name()); |
|
|
|
|
//完成活动结算时间币
|
|
|
|
|
if(ActivityStatus.complete==activityForm.getActivityStatus()){ |
|
|
|
|
int timeScore=activityHistoryMapper.getTimeScore(activityForm.getActivityId(),activityForm.getUserId()); |
|
|
|
|
timeScore=activityHistoryMapper.getTimeScore(activityForm.getActivityId(),activityForm.getUserId()); |
|
|
|
|
logger.info("奖励时间币:"+timeScore); |
|
|
|
|
activityEntity.setTimeScore(timeScore); |
|
|
|
|
UserEntity userEntity=userMapper.findOne(activityEntity.getUserId()); |
|
|
|
|
userEntity.setTimeScore(userEntity.getTimeScore()+timeScore); |
|
|
|
|
timeScore+=userEntity.getTimeScore(); |
|
|
|
|
userEntity.setTimeScore(timeScore); |
|
|
|
|
|
|
|
|
|
if(!userMapper.update(userEntity)){ |
|
|
|
|
throw new RuntimeException("结算时间币失败"); |
|
|
|
|
} |
|
|
|
@ -153,7 +158,7 @@ public class ActivityService{ |
|
|
|
|
if(!leaveWordMapper.insert(leaveWordEntity)){ |
|
|
|
|
throw new RuntimeException("保存留言信息失败"); |
|
|
|
|
} |
|
|
|
|
return new JSONResponse<>(DefaultRes.ok,Result.OK); |
|
|
|
|
return new JSONResponse<DefaultRes,Integer>(DefaultRes.ok,Result.OK).setBody(timeScore); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|