Browse Source

志愿者活动-报名

tags/V1.8.0^2
wanghaoran 1 year ago
parent
commit
5687315c92
4 changed files with 46 additions and 15 deletions
  1. +1
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java
  2. +2
    -3
      tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java
  3. +0
    -11
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java
  4. +43
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java

+ 1
- 1
tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamActivityApplyController.java View File

@@ -31,6 +31,6 @@ public class WestreamActivityApplyController {
*/
@PostMapping("/submit")
public JsonResult submit(@RequestBody WestreamActivityApply westreamActivityApply){
return IWestreamActivityApplyService.submit(westreamActivityApply);
return westreamActivityApplyService.submit(westreamActivityApply);
}
}

+ 2
- 3
tuoheng-api/src/main/java/com/tuoheng/api/service/IWestreamActivityApplyService.java View File

@@ -5,7 +5,6 @@ import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

public interface IWestreamActivityApplyService extends IBaseService<WestreamActivityApply> {
static JsonResult submit(WestreamActivityApply westreamActivityApply) {
return null;
}

JsonResult submit(WestreamActivityApply westreamActivityApply);
}

+ 0
- 11
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyImpl.java View File

@@ -1,11 +0,0 @@
package com.tuoheng.api.service.impl;

import com.tuoheng.api.entity.domain.WestreamActivityApply;
import com.tuoheng.api.mapper.WestreamActivityApplyMapper;
import com.tuoheng.api.service.IWestreamActivityApplyService;
import com.tuoheng.common.common.BaseServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class WestreamActivityApplyImpl extends BaseServiceImpl<WestreamActivityApplyMapper, WestreamActivityApply> implements IWestreamActivityApplyService {
}

+ 43
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamActivityApplyServiceImpl.java View File

@@ -0,0 +1,43 @@
package com.tuoheng.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.api.entity.domain.WestreamActivityApply;
import com.tuoheng.api.mapper.WestreamActivityApplyMapper;
import com.tuoheng.api.service.IWestreamActivityApplyService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WestreamActivityApplyServiceImpl extends BaseServiceImpl<WestreamActivityApplyMapper, WestreamActivityApply> implements IWestreamActivityApplyService {

@Autowired
private WestreamActivityApplyMapper westreamActivityApplyMapper;

@Override
public JsonResult submit(WestreamActivityApply entity) {
if (null == entity.getTenantId() || StringUtils.isEmpty(entity.getOpenid())) {
return JsonResult.error("参数为空!");
}
if (null == entity.getActivityId()) {
return JsonResult.error("活动ID为空!");
}

//校验重复报名
Integer count = westreamActivityApplyMapper.selectCount(new LambdaQueryWrapper<WestreamActivityApply>()
.eq(WestreamActivityApply::getActivityId, entity.getActivityId())
.eq(WestreamActivityApply::getTenantId, entity.getTenantId())
.eq(WestreamActivityApply::getOpenid, entity.getOpenid())
.in(WestreamActivityApply::getStatus, 1,2)
.eq(WestreamActivityApply::getMark, 1));

if(count > 0){
return JsonResult.error("您已参加该活动!");
}
super.add(entity);

return JsonResult.success();
}
}

Loading…
Cancel
Save