查询我的邀请列表
continuous-integration/drone/push Build is passing Details

飞书小程序
YXY 1 year ago
parent 8bf5f6f38e
commit 6a014a19d0

@ -10,15 +10,17 @@ public enum LarkActiveInviteStageEnum {
/** /**
* *
*/ */
INVITE("INVITE", "邀请"), INVITE("INVITE", "邀请","primary"),
ACTIVE("ACTIVE", "参加活动"); ACTIVE("ACTIVE", "参加活动","success");
private final String code; private final String code;
private final String info; private final String info;
private final String type;
LarkActiveInviteStageEnum(String code, String info) { LarkActiveInviteStageEnum(String code, String info, String type) {
this.code = code; this.code = code;
this.info = info; this.info = info;
this.type = type;
} }
public String getCode() { public String getCode() {
@ -28,4 +30,17 @@ public enum LarkActiveInviteStageEnum {
public String getInfo() { public String getInfo() {
return info; return info;
} }
public String getType() {
return type;
}
public static LarkActiveInviteStageEnum getByCode(String code){
for (LarkActiveInviteStageEnum value : LarkActiveInviteStageEnum.values()) {
if (value.getCode().equals(code)){
return value;
}
}
return null;
}
} }

@ -1,5 +1,6 @@
package com.ruoyi.flyingbook.controller; package com.ruoyi.flyingbook.controller;
import com.lark.oapi.service.authen.v1.model.CreateAccessTokenRespBody;
import com.ruoyi.flyingbook.CosHelper.CosHelper; import com.ruoyi.flyingbook.CosHelper.CosHelper;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.FlagStatus; import com.ruoyi.common.enums.FlagStatus;
@ -50,9 +51,10 @@ public class LarkActiveController extends BaseController {
* *
*/ */
@PostMapping("/getSession") @PostMapping("/getSession")
public ResponseVo<LarkSessionDetailResponse> getSession(@RequestBody LarkSessionRequest request) { public ResponseVo<CreateAccessTokenRespBody> getSession(@RequestBody LarkSessionRequest request) {
LarkSessionResponse larkSessionResponse = larkUserHelper.tokenLoginValidate(new LarkUserRequest(APP_ID, APP_SECRET, null, request.getCode())); LarkSessionResponse larkSessionResponse = larkUserHelper.tokenLoginValidate(new LarkUserRequest(APP_ID, APP_SECRET, null, request.getCode()));
return new ResponseVo<>(larkSessionResponse.getData()); CreateAccessTokenRespBody userToken = larkUserHelper.getUserToken(new LarkUserRequest(APP_ID, APP_SECRET, larkSessionResponse.getData().getOpen_id()));
return new ResponseVo<>(userToken);
} }
/** /**
@ -102,6 +104,15 @@ public class LarkActiveController extends BaseController {
return new ResponseVo(larkActives); return new ResponseVo(larkActives);
} }
/**
*
*/
@PostMapping("/queryInviteUserList")
public ResponseVo<LarkInviteVo> queryInviteUserList(@RequestBody LarkUserActiveInviteRelatoin request) {
List<LarkInviteVo> larkInviteVos = larkUserActiveInviteRelatoinService.queryMyInviteList(request);
return new ResponseVo(larkInviteVos);
}
/** /**
* top 10 * top 10

@ -0,0 +1,18 @@
package com.ruoyi.flyingbook.domain.larkactive;
import lombok.Data;
/**
* lark_active
*
* @author ruoyi
* @date 2023-08-16
*/
@Data
public class LarkInviteVo {
private String url;
private String text;
private String type;
private String badge = "0";
}

@ -1,6 +1,7 @@
package com.ruoyi.flyingbook.service; package com.ruoyi.flyingbook.service;
import com.ruoyi.flyingbook.domain.LarkUserActiveInviteRelatoin; import com.ruoyi.flyingbook.domain.LarkUserActiveInviteRelatoin;
import com.ruoyi.flyingbook.domain.larkactive.LarkInviteVo;
import java.util.List; import java.util.List;
@ -29,6 +30,9 @@ public interface ILarkUserActiveInviteRelatoinService {
public List<LarkUserActiveInviteRelatoin> queryTopTen(LarkUserActiveInviteRelatoin larkUserActiveInviteRelatoin); public List<LarkUserActiveInviteRelatoin> queryTopTen(LarkUserActiveInviteRelatoin larkUserActiveInviteRelatoin);
public List<LarkInviteVo> queryMyInviteList(LarkUserActiveInviteRelatoin larkUserActiveInviteRelatoin);
/** /**
* *
* *

@ -4,12 +4,14 @@ import com.ruoyi.common.enums.FlagStatus;
import com.ruoyi.common.enums.LarkActiveInviteStageEnum; import com.ruoyi.common.enums.LarkActiveInviteStageEnum;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.flyingbook.domain.LarkUserActiveInviteRelatoin; import com.ruoyi.flyingbook.domain.LarkUserActiveInviteRelatoin;
import com.ruoyi.flyingbook.domain.larkactive.LarkInviteVo;
import com.ruoyi.flyingbook.mapper.LarkUserActiveInviteRelatoinMapper; import com.ruoyi.flyingbook.mapper.LarkUserActiveInviteRelatoinMapper;
import com.ruoyi.flyingbook.service.ILarkUserActiveInviteRelatoinService; import com.ruoyi.flyingbook.service.ILarkUserActiveInviteRelatoinService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* Service * Service
@ -51,6 +53,22 @@ public class LarkUserActiveInviteRelatoinServiceImpl implements ILarkUserActiveI
return larkUserActiveInviteRelatoinMapper.queryTopTen(larkUserActiveInviteRelatoin); return larkUserActiveInviteRelatoinMapper.queryTopTen(larkUserActiveInviteRelatoin);
} }
@Override
public List<LarkInviteVo> queryMyInviteList(LarkUserActiveInviteRelatoin larkUserActiveInviteRelatoin) {
larkUserActiveInviteRelatoin.setFlag(FlagStatus.OK.getCode());
List<LarkUserActiveInviteRelatoin> larkUserActiveInviteRelatoins = larkUserActiveInviteRelatoinMapper.selectLarkUserActiveInviteRelatoinList(larkUserActiveInviteRelatoin);
List<LarkInviteVo> result = larkUserActiveInviteRelatoins.stream().map(r -> {
LarkInviteVo larkInviteVo = new LarkInviteVo();
larkInviteVo.setUrl(r.getInviteUserName());
larkInviteVo.setUrl(r.getInviteUserName());
LarkActiveInviteStageEnum inviteStageEnum = LarkActiveInviteStageEnum.getByCode(r.getInviteStage());
larkInviteVo.setType(inviteStageEnum != null ? inviteStageEnum.getType() : "primary");
return larkInviteVo;
}).collect(Collectors.toList());
return result;
}
/** /**
* *
* *

Loading…
Cancel
Save