活动签到

This commit is contained in:
cjw 2024-10-12 14:01:51 +08:00
parent 196b398b22
commit 04ed78e4d9
3 changed files with 22 additions and 5 deletions

View File

@ -41,7 +41,7 @@ public class WxActivityController extends BaseController {
@Log(title = "活动报名", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/enter")
public R<Void> addReservation(@Validated(AddGroup.class) @RequestBody ActivityEnterBo bo) {
public R<Void> addEnter(@Validated(AddGroup.class) @RequestBody ActivityEnterBo bo) {
return toAjax(activityEnterService.insertByBo(bo));
}
@ -62,4 +62,15 @@ public class WxActivityController extends BaseController {
public R<ActivityVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
return R.ok(activityService.queryById(id));
}
/**
* 活动签到
*/
@Log(title = "活动签到", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/sign")
public R<Void> addSign(@Validated(AddGroup.class) @RequestBody ActivityEnterBo bo) {
return toAjax(activityEnterService.updateByBo(bo));
}
}

View File

@ -92,6 +92,7 @@ public class ActivityEnterServiceImpl implements IActivityEnterService {
throw new ServiceException("你已报名,请勿重复报名");
}
ActivityEnter add = MapstructUtils.convert(bo, ActivityEnter.class);
add.setStatus(0);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
@ -109,7 +110,15 @@ public class ActivityEnterServiceImpl implements IActivityEnterService {
*/
@Override
public Boolean updateByBo(ActivityEnterBo bo) {
Long userId = LoginHelper.getUserId();
boolean exists = baseMapper.exists(new LambdaQueryWrapper<ActivityEnter>()
.eq(ActivityEnter::getActivityId, bo.getActivityId())
.eq(ActivityEnter::getCreateBy, userId));
if (!exists) {
throw new ServiceException("签到失败,请先报名活动");
}
ActivityEnter update = MapstructUtils.convert(bo, ActivityEnter.class);
update.setStatus(1);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}

View File

@ -70,10 +70,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
LoginUser loginUser = getLoginUser();
Long userId = loginUser.getUserId();
Long deptId = loginUser.getDeptId();
String userType = loginUser.getUserType();
// if (!UserType.STUDENT.getName().equals(userType)) {
// throw new ServiceException("只有学生账户才能测评");
// }
String deptBatchNo = publishMapper.selectUseBatchNoByDeptId(deptId);
String userBatchNo = publishMapper.selectUseBatchNoByUserId(userId);
List<String> batchList = new ArrayList<>();