|
|
@@ -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(); |
|
|
|
} |
|
|
|
} |