Przeglądaj źródła

查询用户可否申请 接口

tags/V1.8.0^2
wanghaoran 1 rok temu
rodzic
commit
22846e0887
4 zmienionych plików z 71 dodań i 5 usunięć
  1. +15
    -5
      tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java
  2. +23
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamTiktokQuery.java
  3. +3
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java
  4. +30
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java

+ 15
- 5
tuoheng-api/src/main/java/com/tuoheng/api/controller/WestreamTiktokController.java Wyświetl plik

@@ -1,13 +1,12 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.domain.ThWestreamTiktok;
import com.tuoheng.api.entity.request.OnlineNumQuery;
import com.tuoheng.api.entity.request.WestreamTiktokQuery;
import com.tuoheng.api.service.ThWestreamTiktokService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

/**
* 关注抖音业务 前端控制器
@@ -16,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
* @Date 2023/6/6 9:46
*/
@RestController
@RequestMapping("/tiktok")
@RequestMapping("/westreamTiktok")
public class WestreamTiktokController {

@Autowired
@@ -33,4 +32,15 @@ public class WestreamTiktokController {
return thWestreamTiktokService.add(entity);
}

/**
* 查询用户可否申请
*
* @param
* @return
*/
@GetMapping("/getIsApply")
public JsonResult getIsApply(WestreamTiktokQuery query) {
return thWestreamTiktokService.getIsApply(query);
}

}

+ 23
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/WestreamTiktokQuery.java Wyświetl plik

@@ -0,0 +1,23 @@
package com.tuoheng.api.entity.request;

import lombok.Data;

/**
* 全民护河抖音关注审核表查询
*
* @author WangHaoran
* @since 2023-06-06
*/
@Data
public class WestreamTiktokQuery {

/**
* 用户openid
*/
private String openid;

/**
* 租户ID
*/
private Integer tenantId;
}

+ 3
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/ThWestreamTiktokService.java Wyświetl plik

@@ -2,6 +2,7 @@ package com.tuoheng.api.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tuoheng.api.entity.domain.ThWestreamTiktok;
import com.tuoheng.api.entity.request.WestreamTiktokQuery;
import com.tuoheng.common.utils.JsonResult;

/**
@@ -12,4 +13,6 @@ import com.tuoheng.common.utils.JsonResult;
public interface ThWestreamTiktokService extends IService<ThWestreamTiktok> {

JsonResult add(ThWestreamTiktok entity);

JsonResult getIsApply(WestreamTiktokQuery query);
}

+ 30
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/ThWestreamTiktokServiceImpl.java Wyświetl plik

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

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tuoheng.api.entity.domain.Identity;
import com.tuoheng.api.entity.domain.ThWestreamTiktok;
import com.tuoheng.api.entity.domain.WestreamUser;
import com.tuoheng.api.entity.request.WestreamTiktokQuery;
import com.tuoheng.api.mapper.IdentityMapper;
import com.tuoheng.api.mapper.ThWestreamTiktokMapper;
import com.tuoheng.api.mapper.WestreamUserMapper;
@@ -48,6 +50,15 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl<ThWestreamTiktokMap
if (StringUtils.isNull(entity.getTenantId())) {
return JsonResult.error("tenantId不能为空!");
}
//查询是否已经申请
Integer count = westreamTiktokMapper.selectCount(new LambdaQueryWrapper<ThWestreamTiktok>()
.eq(ThWestreamTiktok::getOpenid, entity.getOpenid())
.eq(ThWestreamTiktok::getTenantId, entity.getTenantId())
.in(ThWestreamTiktok::getStatus, 1, 2)
.eq(ThWestreamTiktok::getMark, 1));
if(count > 0){
return JsonResult.error("您已参与了该活动!");
}
//查询当前用户
WestreamUser westreamUser = westreamUserMapper.selectOne(Wrappers.<WestreamUser>lambdaQuery()
.eq(WestreamUser::getOpenid, entity.getOpenid())
@@ -75,6 +86,25 @@ public class ThWestreamTiktokServiceImpl extends ServiceImpl<ThWestreamTiktokMap
return JsonResult.error("新增抖音审核任务失败");
}
}

@Override
public JsonResult getIsApply(WestreamTiktokQuery query) {

//查询是否已经申请
Integer count = westreamTiktokMapper.selectCount(new LambdaQueryWrapper<ThWestreamTiktok>()
.eq(ThWestreamTiktok::getOpenid, query.getOpenid())
.eq(ThWestreamTiktok::getTenantId, query.getTenantId())
.in(ThWestreamTiktok::getStatus, 1, 2)
.eq(ThWestreamTiktok::getMark, 1));
if(count > 0){
//0代表已经申请,无法再申请
return JsonResult.success(0);
}else {
//1代表可以申请
return JsonResult.success(1);
}

}
}



Ładowanie…
Anuluj
Zapisz