初始化飞书小程序枚举信息

飞书小程序
YXY 1 year ago
parent fd96525ce0
commit fdfada1c7a

@ -0,0 +1,30 @@
package com.ruoyi.common.core.domain;
import lombok.Data;
/**
* @author yuxiangyong
* @create 2023-08-16 16:58
*/
@Data
public class RequestVo {
/**
*
*/
private Integer currentPage = 1;
/**
*
*/
private Integer pageSize = 20;
/**
*
*/
private Integer offset;
public Integer getOffset() {
return (currentPage - 1) * pageSize;
}
}

@ -0,0 +1,91 @@
package com.ruoyi.flyingbook.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.flyingbook.domain.LarkActive;
import com.ruoyi.flyingbook.domain.edi.ResponseVo;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveRequest;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveVo;
import com.ruoyi.flyingbook.service.ILarkActiveService;
import com.ruoyi.flyingbook.service.ILarkUserActiveInviteRelatoinService;
import com.ruoyi.flyingbook.service.ILarkUserActiveRelatoinService;
import lombok.extern.slf4j.Slf4j;
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.RestController;
@Slf4j
@RestController
public class LarkActiveController extends BaseController {
@Autowired
private ILarkActiveService larkActiveService;
@Autowired
private ILarkUserActiveRelatoinService larkUserActiveRelatoinService;
@Autowired
private ILarkUserActiveInviteRelatoinService larkUserActiveInviteRelatoinService;
/**
*
*/
@PostMapping("/queryActive")
public ResponseVo<LarkActive> queryActive(@RequestBody LarkActiveRequest request) {
return larkActiveService.queryPage(request);
}
/**
* id todo yxy
*/
@PostMapping("/getAcitveById")
public ResponseVo<LarkActiveVo> getAcitveById(@RequestBody LarkActiveRequest request) {
LarkActive larkActive = larkActiveService.selectLarkActiveById(request.getLarkActiveId());
return new ResponseVo(larkActive);
}
/**
* todo yxy
*/
@PostMapping("/uploadActiveFile")
public ResponseVo<LarkActiveVo> uploadActiveFile(@RequestBody LarkActiveRequest request) {
LarkActive larkActive = larkActiveService.selectLarkActiveById(request.getLarkActiveId());
return new ResponseVo(larkActive);
}
/**
* todo yxy
*/
@PostMapping("/queryWaitReview")
public ResponseVo<String> queryWaitReview() {
return new ResponseVo();
}
/**
* todo yxy
*/
@PostMapping("/queryCompleteActiveList")
public ResponseVo<String> queryCompleteActiveList() {
return new ResponseVo();
}
/**
* todo yxy
*/
@PostMapping("/queryMyCompleteActiveList")
public ResponseVo<String> queryMyCompleteActiveList() {
return new ResponseVo();
}
/**
* top 10 todo yxy
*/
@PostMapping("/queryInviteTopTen")
public ResponseVo<String> queryInviteTopTen() {
return new ResponseVo();
}
}

@ -0,0 +1,67 @@
package com.ruoyi.flyingbook.domain.edi;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author yuxiangyong
* @create 2023-05-07 21:47
*/
@Data
@NoArgsConstructor
public class ResponseVo<T> {
private Boolean successFlag;
private T data;
private Integer page;
private Integer pageSize;
private Integer totalPage;
private List<T> dataList;
private String errorMessage;
private List<String> errorMessageList;
public ResponseVo(Integer page,Integer pageSize) {
this.page = page;
this.pageSize = pageSize;
}
public ResponseVo(Integer page,Integer pageSize,List<T> data,Integer totalPage) {
this.page = page;
this.pageSize = pageSize;
this.successFlag = Boolean.TRUE;
this.dataList = dataList;
this.totalPage = totalPage;
}
public ResponseVo(T data) {
this.successFlag = Boolean.TRUE;
this.data = data;
}
public ResponseVo(List<T> dataList) {
this.successFlag = Boolean.TRUE;
this.dataList = dataList;
}
public ResponseVo(Boolean successFlag, String errorMessage) {
this.successFlag = successFlag;
this.errorMessage = errorMessage;
}
public ResponseVo(Boolean successFlag, String... errorMsg) {
this.successFlag = successFlag;
this.errorMessageList = new ArrayList<>();
for (String s : errorMsg) {
this.errorMessageList.add(s);
}
}
}

@ -0,0 +1,23 @@
package com.ruoyi.flyingbook.domain.larkactive;
import com.ruoyi.common.core.domain.RequestVo;
import lombok.Data;
/**
* @author yuxiangyong
* @create 2023-08-16 16:58
*/
@Data
public class LarkActiveRequest extends RequestVo {
private String companyName;
private Long larkActiveId;
private String userName;
/**
* @see com.ruoyi.common.enums.FlagStatus
*/
private Long flag;
}

@ -0,0 +1,20 @@
package com.ruoyi.flyingbook.domain.larkactive;
import com.ruoyi.flyingbook.domain.LarkActive;
import lombok.Data;
/**
* lark_active
*
* @author ruoyi
* @date 2023-08-16
*/
@Data
public class LarkActiveVo extends LarkActive {
/**
*
*/
private Boolean complete;
}

@ -1,6 +1,7 @@
package com.ruoyi.flyingbook.mapper; package com.ruoyi.flyingbook.mapper;
import com.ruoyi.flyingbook.domain.LarkActive; import com.ruoyi.flyingbook.domain.LarkActive;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveRequest;
import java.util.List; import java.util.List;
@ -26,7 +27,8 @@ public interface LarkActiveMapper {
* @return * @return
*/ */
public List<LarkActive> selectLarkActiveList(LarkActive larkActive); public List<LarkActive> selectLarkActiveList(LarkActive larkActive);
public Integer count(LarkActive larkActive);
public List<LarkActive> queryPage(LarkActiveRequest request);
/** /**
* *
* *

@ -2,6 +2,9 @@ package com.ruoyi.flyingbook.service;
import com.ruoyi.flyingbook.domain.LarkActive; import com.ruoyi.flyingbook.domain.LarkActive;
import com.ruoyi.flyingbook.domain.edi.ResponseVo;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveRequest;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveVo;
import java.util.List; import java.util.List;
@ -19,6 +22,7 @@ public interface ILarkActiveService {
* @return * @return
*/ */
public LarkActive selectLarkActiveById(Long id); public LarkActive selectLarkActiveById(Long id);
public LarkActiveVo getActiveInfo(LarkActiveRequest request);
/** /**
* *
@ -27,6 +31,7 @@ public interface ILarkActiveService {
* @return * @return
*/ */
public List<LarkActive> selectLarkActiveList(LarkActive larkActive); public List<LarkActive> selectLarkActiveList(LarkActive larkActive);
ResponseVo<LarkActive> queryPage(LarkActiveRequest request);
/** /**
* *

@ -1,9 +1,18 @@
package com.ruoyi.flyingbook.service.impl; package com.ruoyi.flyingbook.service.impl;
import com.ruoyi.common.enums.FlagStatus;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.flyingbook.domain.LarkActive; import com.ruoyi.flyingbook.domain.LarkActive;
import com.ruoyi.flyingbook.domain.LarkUserActiveRelatoin;
import com.ruoyi.flyingbook.domain.edi.ResponseVo;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveRequest;
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveVo;
import com.ruoyi.flyingbook.mapper.LarkActiveMapper; import com.ruoyi.flyingbook.mapper.LarkActiveMapper;
import com.ruoyi.flyingbook.mapper.LarkUserActiveRelatoinMapper;
import com.ruoyi.flyingbook.service.ILarkActiveService; import com.ruoyi.flyingbook.service.ILarkActiveService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -19,6 +28,8 @@ import java.util.List;
public class LarkActiveServiceImpl implements ILarkActiveService { public class LarkActiveServiceImpl implements ILarkActiveService {
@Autowired @Autowired
private LarkActiveMapper larkActiveMapper; private LarkActiveMapper larkActiveMapper;
@Autowired
private LarkUserActiveRelatoinMapper larkUserActiveRelatoinMapper;
/** /**
* *
@ -31,6 +42,28 @@ public class LarkActiveServiceImpl implements ILarkActiveService {
return larkActiveMapper.selectLarkActiveById(id); return larkActiveMapper.selectLarkActiveById(id);
} }
@Override
public LarkActiveVo getActiveInfo(LarkActiveRequest request) {
LarkActiveVo result = new LarkActiveVo();
if (request == null || request.getLarkActiveId() == null){
return result;
}
LarkActive larkActive = larkActiveMapper.selectLarkActiveById(request.getLarkActiveId());
if (larkActive != null){
BeanUtils.copyProperties(larkActive,result);
}
if (StringUtils.isNotBlank(request.getUserName())){
LarkUserActiveRelatoin relatoin = new LarkUserActiveRelatoin();
relatoin.setFlag(FlagStatus.OK.getCode());
relatoin.setActiveId(request.getLarkActiveId());
relatoin.setUserName(request.getUserName());
List<LarkUserActiveRelatoin> larkUserActiveRelatoins = larkUserActiveRelatoinMapper.selectLarkUserActiveRelatoinList(relatoin);
result.setComplete(CollectionUtils.isNotEmpty(larkUserActiveRelatoins));
}
return result;
}
/** /**
* *
* *
@ -42,6 +75,22 @@ public class LarkActiveServiceImpl implements ILarkActiveService {
return larkActiveMapper.selectLarkActiveList(larkActive); return larkActiveMapper.selectLarkActiveList(larkActive);
} }
@Override
public ResponseVo<LarkActive> queryPage(LarkActiveRequest request) {
if (request == null || StringUtils.isBlank(request.getCompanyName())){
return new ResponseVo(request.getCurrentPage(),request.getPageSize());
}
request.setFlag(FlagStatus.OK.getCode());
LarkActive larkActive = new LarkActive();
BeanUtils.copyProperties(request,larkActive);
Integer count = larkActiveMapper.count(larkActive);
if (count > 0){
List<LarkActive> larkActives = larkActiveMapper.queryPage(request);
return new ResponseVo(request.getCurrentPage(),request.getPageSize(),larkActives,count);
}
return new ResponseVo(request.getCurrentPage(),request.getPageSize(),null,count);
}
/** /**
* *
* *

@ -41,6 +41,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="count" parameterType="com.ruoyi.flyingbook.domain.LarkActive" resultMap="LarkActiveResult">
select count(id) from lark_active
<where>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="activeName != null and activeName != ''"> and active_name like concat('%', #{activeName}, '%')</if>
<if test="activeDesc != null and activeDesc != ''"> and active_desc = #{activeDesc}</if>
<if test="activeContent != null and activeContent != ''"> and active_content = #{activeContent}</if>
<if test="activeImageUrl != null and activeImageUrl != ''"> and active_image_url = #{activeImageUrl}</if>
<if test="activeType != null and activeType != ''"> and active_type = #{activeType}</if>
<if test="activeScore != null and activeScore != ''"> and active_score = #{activeScore}</if>
<if test="flag != null "> and flag = #{flag}</if>
</where>
</select>
<select id="queryPage" parameterType="com.ruoyi.flyingbook.domain.larkactive.LarkActiveRequest" resultMap="LarkActiveResult">
<include refid="selectLarkActiveVo"/>
<where>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="activeName != null and activeName != ''"> and active_name like concat('%', #{activeName}, '%')</if>
<if test="activeDesc != null and activeDesc != ''"> and active_desc = #{activeDesc}</if>
<if test="activeContent != null and activeContent != ''"> and active_content = #{activeContent}</if>
<if test="activeImageUrl != null and activeImageUrl != ''"> and active_image_url = #{activeImageUrl}</if>
<if test="activeType != null and activeType != ''"> and active_type = #{activeType}</if>
<if test="activeScore != null and activeScore != ''"> and active_score = #{activeScore}</if>
<if test="flag != null "> and flag = #{flag}</if>
</where>
limit #{offset},{pageSize}
</select>
<select id="selectLarkActiveById" parameterType="Long" resultMap="LarkActiveResult"> <select id="selectLarkActiveById" parameterType="Long" resultMap="LarkActiveResult">
<include refid="selectLarkActiveVo"/> <include refid="selectLarkActiveVo"/>
where id = #{id} where id = #{id}

Loading…
Cancel
Save