活动签到
This commit is contained in:
parent
196b398b22
commit
04ed78e4d9
|
@ -41,7 +41,7 @@ public class WxActivityController extends BaseController {
|
||||||
@Log(title = "活动报名", businessType = BusinessType.INSERT)
|
@Log(title = "活动报名", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/enter")
|
@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));
|
return toAjax(activityEnterService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,4 +62,15 @@ public class WxActivityController extends BaseController {
|
||||||
public R<ActivityVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
public R<ActivityVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||||
return R.ok(activityService.queryById(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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ public class ActivityEnterServiceImpl implements IActivityEnterService {
|
||||||
throw new ServiceException("你已报名,请勿重复报名");
|
throw new ServiceException("你已报名,请勿重复报名");
|
||||||
}
|
}
|
||||||
ActivityEnter add = MapstructUtils.convert(bo, ActivityEnter.class);
|
ActivityEnter add = MapstructUtils.convert(bo, ActivityEnter.class);
|
||||||
|
add.setStatus(0);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
@ -109,7 +110,15 @@ public class ActivityEnterServiceImpl implements IActivityEnterService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(ActivityEnterBo bo) {
|
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);
|
ActivityEnter update = MapstructUtils.convert(bo, ActivityEnter.class);
|
||||||
|
update.setStatus(1);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
Long deptId = loginUser.getDeptId();
|
Long deptId = loginUser.getDeptId();
|
||||||
String userType = loginUser.getUserType();
|
|
||||||
// if (!UserType.STUDENT.getName().equals(userType)) {
|
|
||||||
// throw new ServiceException("只有学生账户才能测评");
|
|
||||||
// }
|
|
||||||
String deptBatchNo = publishMapper.selectUseBatchNoByDeptId(deptId);
|
String deptBatchNo = publishMapper.selectUseBatchNoByDeptId(deptId);
|
||||||
String userBatchNo = publishMapper.selectUseBatchNoByUserId(userId);
|
String userBatchNo = publishMapper.selectUseBatchNoByUserId(userId);
|
||||||
List<String> batchList = new ArrayList<>();
|
List<String> batchList = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue