Merge branch '于相涌/Lark' into test

test
bob 2 years ago
commit 5156018e01

@ -215,6 +215,11 @@
<artifactId>ruoyi-flowable</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-flyingbook</artifactId>
<version>3.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
@ -274,6 +279,7 @@
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
<module>ruoyi-flowable</module>
<module>ruoyi-flyingbook</module>
</modules>
<packaging>pom</packaging>

@ -78,20 +78,14 @@
<artifactId>ruoyi-flowable</artifactId>
</dependency>
<dependency>
<groupId>com.larksuite.oapi</groupId>
<artifactId>oapi-sdk</artifactId>
<version>2.0.13</version>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-flyingbook</artifactId>
</dependency>
<!--飞书-->
<dependency>
<groupId>com.larksuite.oapi</groupId>
<artifactId>oapi-sdk</artifactId>
<version>2.0.13</version>
</dependency>
</dependencies>

@ -1,8 +1,10 @@
package com.ruoyi;
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
/**
*
@ -17,4 +19,5 @@ public class RuoYiApplication
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
}
}

@ -0,0 +1,14 @@
package com.ruoyi.common.constant;
/**
* @author yuxiangyong
* @create 2023-03-12 19:30
*/
public class CompanyNameConstants {
/**
*
*/
public static final String COMPANY_NAME = "COMPANY_NAME";
}

@ -0,0 +1,18 @@
package com.ruoyi.common.constant;
/**
* @author yuxiangyong
* @create 2023-03-12 19:30
*/
public class RedisConstants {
public static void main(String[] args) {
System.out.println("Multidimensional tabular feedback".replaceAll(" ","").toUpperCase());
}
/**
* key
*/
public static final String MULTIDIMENSIONALTABULARFEEDBACK = "MULTIDIMENSIONALTABULARFEEDBACK";
}

@ -0,0 +1,32 @@
package com.ruoyi.common.enums;
/**
*
*
* @author ruoyi
*/
public enum EventOperateStatus {
/**
*
*/
PENDING("PENDING", "未处理"),
SUCCESS("SUCCESS", "成功"),
FAIL("FAIL", "失败");
private final String code;
private final String info;
EventOperateStatus(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,32 @@
package com.ruoyi.common.enums;
/**
*
*
* @author ruoyi
*/
public enum EventOperateType {
/**
*
*/
CALL_BACK("CALL_BACK", "反馈"),
CREATE("CREATE", "创建"),
UPDATE("UPDATE", "更新"),
DELETE("DELETE", "删除");
private final String code;
private final String info;
EventOperateType(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,31 @@
package com.ruoyi.common.enums;
/**
*
*
* @author ruoyi
*/
public enum FlagStatus {
/**
*
*/
OK(0L, "正常"),
DELETED(1L, "删除");
private final Long code;
private final String info;
FlagStatus(Long code, String info) {
this.code = code;
this.info = info;
}
public Long getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,61 @@
package com.ruoyi.common.utils;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
/**
* @author yuxiangyong
* @create 2023-03-12 20:48
*/
@Slf4j
public class DecryptUtil {
public static void main(String[] args) throws Exception {
System.out.println(decrypt("P37w+VZImNgPEO1RBhJ6RtKl7n6zymIbEG1pReEzghk=")); //hello world
}
private static byte[] keyBs;
public DecryptUtil(String key) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
// won't happen
}
keyBs = digest.digest(key.getBytes(StandardCharsets.UTF_8));
}
public static String decrypt(String base64) {
try {
DecryptUtil d = new DecryptUtil("ND2ANZB8F7NplUqcrmKD530lDRFssNWJ");
byte[] decode = Base64.getDecoder().decode(base64);
Cipher cipher = Cipher.getInstance("AES/CBC/NOPADDING");
byte[] iv = new byte[16];
System.arraycopy(decode, 0, iv, 0, 16);
byte[] data = new byte[decode.length - 16];
System.arraycopy(decode, 16, data, 0, data.length);
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keyBs, "AES"), new IvParameterSpec(iv));
byte[] r = cipher.doFinal(data);
if (r.length > 0) {
int p = r.length - 1;
for (; p >= 0 && r[p] <= 16; p--) {
}
if (p != r.length - 1) {
byte[] rr = new byte[p + 1];
System.arraycopy(r, 0, rr, 0, p + 1);
r = rr;
}
}
return new String(r, StandardCharsets.UTF_8);
}catch (Exception e){
log.error("DecryptUtil error",e);
}
return null;
}
}

@ -1,33 +0,0 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

Binary file not shown.

@ -1,18 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

@ -3,14 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.4.0</version>
</parent>
<groupId>com.flyingbook</groupId>
<version>3.4.1-SNAPSHOT</version>
<artifactId>ruoyi-flyingbook</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ruoyi-flyingbook</name>
<description>Demo project for Spring Boot</description>
<properties>
@ -39,7 +37,15 @@
<artifactId>oapi-sdk</artifactId>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
<dependency>
<artifactId>oapi-sdk-servlet-ext</artifactId>
<groupId>com.larksuite.oapi</groupId>
@ -55,21 +61,5 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -1,65 +0,0 @@
package com.flyingbook.controller;
import org.springframework.web.bind.annotation.RestController;
import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.event.EventDispatcher;
import com.lark.oapi.service.contact.v3.ContactService;
import com.lark.oapi.service.contact.v3.model.P2UserCreatedV3;
import com.lark.oapi.service.im.v1.ImService;
import com.lark.oapi.service.im.v1.model.P1MessageReadV1;
import com.lark.oapi.service.im.v1.model.P2MessageReadV1;
import com.lark.oapi.service.im.v1.model.P2MessageReceiveV1;
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@RestController
public class EventController {
//1. 注册消息处理器
private final EventDispatcher EVENT_DISPATCHER = EventDispatcher.newBuilder("verificationToken",
"encryptKey")
.onP2MessageReceiveV1(new ImService.P2MessageReceiveV1Handler() {
@Override
public void handle(P2MessageReceiveV1 event) {
System.out.println(Jsons.DEFAULT.toJson(event));
System.out.println(event.getRequestId());
}
}).onP2UserCreatedV3(new ContactService.P2UserCreatedV3Handler() {
@Override
public void handle(P2UserCreatedV3 event) {
System.out.println(Jsons.DEFAULT.toJson(event));
System.out.println(event.getRequestId());
}
})
.onP2MessageReadV1(new ImService.P2MessageReadV1Handler() {
@Override
public void handle(P2MessageReadV1 event) {
System.out.println(Jsons.DEFAULT.toJson(event));
System.out.println(event.getRequestId());
}
}).onP1MessageReadV1(new ImService.P1MessageReadV1Handler() {
@Override
public void handle(P1MessageReadV1 event) {
System.out.println(Jsons.DEFAULT.toJson(event));
System.out.println(event.getRequestId());
}
})
.build();
//2. 注入 ServletAdapter 实例
@Autowired
private ServletAdapter servletAdapter;
//3. 创建路由处理器
@RequestMapping("/webhook/event")
public void event(HttpServletRequest request, HttpServletResponse response)
throws Throwable {
//3.1 回调扩展包提供的事件回调处理器
servletAdapter.handleEvent(request, response, EVENT_DISPATCHER);
}
}

@ -0,0 +1,98 @@
package com.ruoyi.flyingbook.LarkHelper;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author yuxiangyong
* @create 2023-03-12 18:10
*/
@Slf4j
@Component
public class LarkTokenHelper {
private static OkHttpClient client = new OkHttpClient().newBuilder()
.callTimeout(10, TimeUnit.SECONDS)
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(10, TimeUnit.SECONDS)
.build();
public String getToken(String appId, String srcret) {
Response execute = null;
Map<String, String> map = new HashMap<>();
map.put("app_id", appId);
map.put("app_secret", srcret);
Request request = new Request.Builder()
.method("POST", RequestBody.create(JSONObject.toJSONString(map), MediaType.get("application/json")))
.url("https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal")
.build();
try {
execute = client.newCall(request).execute();
if (ObjectUtil.isNotNull(execute) && execute.isSuccessful()) {
return execute.body().string();
}
} catch (IOException e) {
log.error("http post 请求失败--{}", e);
}
return null;
}
/**
* @param url
* @param token
* @return
*/
public String getLark(String url,Map<String, String> body, String token) {
Response execute = null;
Request request = new Request.Builder()
.url(url)
.addHeader("Authorization",String.format("Bearer %s",token))
.build();
try {
execute = client.newCall(request).execute();
log.info(JSONObject.toJSONString(execute.body().string()));
if (ObjectUtil.isNotNull(execute) && execute.isSuccessful()) {
return execute.body().string();
}
} catch (IOException e) {
log.error("http get 请求失败--{}", e);
}
return null;
}
public String postLark(String url,Map<Object, Object> body, String token) {
Response execute = null;
Request request = new Request.Builder()
.method("POST", RequestBody
.create(JSONObject.toJSONString(body), MediaType.get("application/json")))
.url(url)
// .addHeader("Authorization",String.format("Bearer %s",token))
.build();
try {
execute = client.newCall(request).execute();
if (ObjectUtil.isNotNull(execute) && execute.isSuccessful()) {
return execute.body().string();
}
} catch (IOException e) {
log.error("http post 请求失败--{}", e);
}
return null;
}
public static void main(String[] args) {
LarkTokenHelper helper = new LarkTokenHelper();
String token = helper.getToken( "cli_a482a8572cbc9013", "lZNXbCLlOslWbwBIVc4qvgxOdnfA8Mos");
System.out.println(token);
JSONObject jsonObject = JSONObject.parseObject(token);
helper.getLark("https://open.feishu.cn/open-apis/approval/v4/instances/81D31358-93AF-92D6-7425-01A5D67C4E71",null,jsonObject.getString("tenant_access_token"));
}
}

@ -1,4 +1,4 @@
package com.flyingbook;
package com.ruoyi.flyingbook;
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
import org.springframework.boot.SpringApplication;

@ -1,4 +1,4 @@
package com.flyingbook.config;
package com.ruoyi.flyingbook.config;
import com.lark.oapi.Client;

@ -1,4 +1,4 @@
package com.flyingbook.config;
package com.ruoyi.flyingbook.config;
import com.lark.oapi.Client;
import com.lark.oapi.core.enums.AppType;
import com.lark.oapi.core.response.RawResponse;

@ -0,0 +1,100 @@
package com.ruoyi.flyingbook.consumer;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import com.ruoyi.common.constant.RedisConstants;
import com.ruoyi.common.enums.EventOperateStatus;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.LarkRequest;
import com.ruoyi.flyingbook.mapper.EventMapper;
import com.ruoyi.flyingbook.service.IEventService;
import com.ruoyi.flyingbook.strategy.operate.MultidimensionalTableOperate;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author yuxiangyong
* @create 2023-03-12 23:04
*/
@Slf4j
@Component
public class LarkApplicationRunner implements ApplicationRunner {
/**
* 线
*/
private static final Integer CORE_POOL_SIZE = 1;
/**
* 线
*/
private static final Integer MAX_POOL_SIZE = 1;
/**
*
*/
private static final Integer KEEP_ALIVE_TIME = 30;
/**
*
*/
private static final Integer QUEUE_SIZE = 20;
/**
* 线
*/
private static final Integer WAIT_TIME = 5000;
@Autowired
private EventMapper eventMapper;
@Autowired
private MultidimensionalTableOperate multidimensionalTableOperate;
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(QUEUE_SIZE), new ThreadPoolExecutor.AbortPolicy());
@Override
public void run(ApplicationArguments args) throws Exception {
//这里用线程池,后续如果出现量大的情况下可以调整
threadPool.execute(() -> {
while (true) {
List<String> statusList = Arrays.asList(EventOperateStatus.PENDING.getCode(),EventOperateStatus.FAIL.getCode());
List<Event> eventList = eventMapper.queryListOperate(statusList);
if (CollectionUtils.isEmpty(eventList)) {
try {
// 没有订单,休息一下
Thread.sleep(WAIT_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
try {
for (Event event : eventList) {
LarkRequest request = new LarkRequest();
request.setEvent(event);
multidimensionalTableOperate.execute(request);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
}

@ -0,0 +1,46 @@
package com.ruoyi.flyingbook.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.flyingbook.domain.LarkRequest;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.DecryptUtil;
import com.ruoyi.flyingbook.strategy.callback.ApprovalCallback;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@RestController
public class EventController extends BaseController {
@Autowired
private ApprovalCallback approvalCallback;
//3. 创建路由处理器
@PostMapping("/approval")
public String event(@RequestBody JSONObject jsonObject) {
String result = "";
if (jsonObject == null) {
log.error("没有值");
return result;
}
log.info("/event/test1/approval request:{} encrypt:{}", jsonObject.toJSONString(), result);
if (jsonObject.containsKey("encrypt")) {
result = DecryptUtil.decrypt(jsonObject.getString("encrypt"));
log.info("/event/test1/approval request:{} encrypt:{}", jsonObject.toJSONString(), result);
}
if (jsonObject.containsKey("challenge")) {
result = jsonObject.getString("challenge");
log.info("/event/test1/approval request:{} challenge:{}", jsonObject.toJSONString(), result);
}
LarkRequest larkRequest = new LarkRequest();
larkRequest.setMessage(result);
approvalCallback.execute(larkRequest);
return result;
}
}

@ -1,4 +1,8 @@
package com.flyingbook.controller;
package com.ruoyi.flyingbook.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.DecryptUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.event.EventDispatcher;
@ -23,7 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
@Slf4j
@RestController
public class EventControllers {
@ -167,11 +173,13 @@ public class EventControllers {
private ServletAdapter servletAdapter;
//3. 创建路由处理器
@RequestMapping("/webhook/events")
@PostMapping("/approval2")
public void event(HttpServletRequest request, HttpServletResponse response)
throws Throwable {
//3.1 回调扩展包提供的事件回调处理器
servletAdapter.handleEvent(request, response, EVENT_DISPATCHER);
Map<String, String[]> parameterMap = request.getParameterMap();
log.info("/event/test2/approval request:{}", JSONObject.toJSONString(parameterMap));
}

@ -0,0 +1,88 @@
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* event
*
* @author ruoyi
* @date 2023-03-12
*/
public class Event extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
private Integer numbers;
private String eventCode;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String message;
/** pendingsuccessfaild */
@Excel(name = "pendingsuccessfaild")
private String flag;
public Integer getNumbers() {
return numbers;
}
public void setNumbers(Integer numbers) {
this.numbers = numbers;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMessage(String message)
{
this.message = message;
}
public String getMessage()
{
return message;
}
public void setFlag(String flag)
{
this.flag = flag;
}
public String getFlag()
{
return flag;
}
public String getEventCode() {
return eventCode;
}
public void setEventCode(String eventCode) {
this.eventCode = eventCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("message", getMessage())
.append("numbers", getMessage())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("flag", getFlag())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,154 @@
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* event_log
*
* @author ruoyi
* @date 2023-03-12
*/
public class EventLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** id */
@Excel(name = "id")
private String tableId;
/** id */
@Excel(name = "id")
private String recordId;
/** id */
@Excel(name = "id")
private Long eventId;
/** $column.columnComment */
@Excel(name = "id")
private String operateType;
/** $column.columnComment */
@Excel(name = "id")
private String operateStatus;
/** $column.columnComment */
@Excel(name = "id")
private String errorCode;
/** $column.columnComment */
@Excel(name = "id")
private String errorMessage;
/** 01 */
@Excel(name = "01")
private Long flag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTableId(String tableId)
{
this.tableId = tableId;
}
public String getTableId()
{
return tableId;
}
public void setRecordId(String recordId)
{
this.recordId = recordId;
}
public String getRecordId()
{
return recordId;
}
public void setEventId(Long eventId)
{
this.eventId = eventId;
}
public Long getEventId()
{
return eventId;
}
public void setOperateType(String operateType)
{
this.operateType = operateType;
}
public String getOperateType()
{
return operateType;
}
public void setOperateStatus(String operateStatus)
{
this.operateStatus = operateStatus;
}
public String getOperateStatus()
{
return operateStatus;
}
public void setErrorCode(String errorCode)
{
this.errorCode = errorCode;
}
public String getErrorCode()
{
return errorCode;
}
public void setErrorMessage(String errorMessage)
{
this.errorMessage = errorMessage;
}
public String getErrorMessage()
{
return errorMessage;
}
public void setFlag(Long flag)
{
this.flag = flag;
}
public Long getFlag()
{
return flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tableId", getTableId())
.append("recordId", getRecordId())
.append("eventId", getEventId())
.append("operateType", getOperateType())
.append("operateStatus", getOperateStatus())
.append("errorCode", getErrorCode())
.append("errorMessage", getErrorMessage())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("flag", getFlag())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,112 @@
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* lark_company_relation
*
* @author ruoyi
* @date 2023-03-12
*/
public class LarkCompanyRelation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** id */
@Excel(name = "id")
private Long companyId;
/** $column.columnComment */
@Excel(name = "id")
private String companyName;
/** appId */
@Excel(name = "appId")
private String appId;
/** +appId */
@Excel(name = "+appId")
private String secret;
/** 01 */
@Excel(name = "01")
private Long flag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCompanyId(Long companyId)
{
this.companyId = companyId;
}
public Long getCompanyId()
{
return companyId;
}
public void setCompanyName(String companyName)
{
this.companyName = companyName;
}
public String getCompanyName()
{
return companyName;
}
public void setAppId(String appId)
{
this.appId = appId;
}
public String getAppId()
{
return appId;
}
public void setSecret(String secret)
{
this.secret = secret;
}
public String getSecret()
{
return secret;
}
public void setFlag(Long flag)
{
this.flag = flag;
}
public Long getFlag()
{
return flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("companyId", getCompanyId())
.append("companyName", getCompanyName())
.append("appId", getAppId())
.append("secret", getSecret())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("flag", getFlag())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,30 @@
package com.ruoyi.flyingbook.domain;
import lombok.Data;
/**
* @author yuxiangyong
* @create 2023-03-12 16:00
*/
@Data
public class LarkRequest {
/**
*
*/
private String token;
private String appId;
private String url;
private String errorMessage;
/**
* ApprovalCallback
*/
private Long eventId;
private String message;
/**
* MultidimensionalTableOperate
*/
private Event event;
}

@ -0,0 +1,112 @@
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* lark_table_relation
*
* @author ruoyi
* @date 2023-03-12
*/
public class LarkTableRelation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** id */
@Excel(name = "id")
private Long larkCompanyRelationId;
/** $column.columnComment */
@Excel(name = "id")
private String fromTableId;
/** $column.columnComment */
@Excel(name = "id")
private String toTableId;
/** url */
@Excel(name = "url")
private Long url;
/** 01 */
@Excel(name = "01")
private Long flag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setLarkCompanyRelationId(Long larkCompanyRelationId)
{
this.larkCompanyRelationId = larkCompanyRelationId;
}
public Long getLarkCompanyRelationId()
{
return larkCompanyRelationId;
}
public void setFromTableId(String fromTableId)
{
this.fromTableId = fromTableId;
}
public String getFromTableId()
{
return fromTableId;
}
public void setToTableId(String toTableId)
{
this.toTableId = toTableId;
}
public String getToTableId()
{
return toTableId;
}
public void setUrl(Long url)
{
this.url = url;
}
public Long getUrl()
{
return url;
}
public void setFlag(Long flag)
{
this.flag = flag;
}
public Long getFlag()
{
return flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("larkCompanyRelationId", getLarkCompanyRelationId())
.append("fromTableId", getFromTableId())
.append("toTableId", getToTableId())
.append("url", getUrl())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("flag", getFlag())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,63 @@
package com.ruoyi.flyingbook.mapper;
import com.ruoyi.flyingbook.domain.EventLog;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-03-12
*/
public interface EventLogMapper
{
/**
*
*
* @param id ID
* @return
*/
public EventLog selectEventLogById(Long id);
/**
*
*
* @param eventLog
* @return
*/
public List<EventLog> selectEventLogList(EventLog eventLog);
/**
*
*
* @param eventLog
* @return
*/
public int insertEventLog(EventLog eventLog);
/**
*
*
* @param eventLog
* @return
*/
public int updateEventLog(EventLog eventLog);
/**
*
*
* @param id ID
* @return
*/
public int deleteEventLogById(Long id);
/**
*
*
* @param ids ID
* @return
*/
public int deleteEventLogByIds(Long[] ids);
}

@ -0,0 +1,69 @@
package com.ruoyi.flyingbook.mapper;
import com.ruoyi.flyingbook.domain.Event;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-03-12
*/
public interface EventMapper
{
/**
*
*
* @param id ID
* @return
*/
public Event selectEventById(Long id);
/**
*
*
* @param event
* @return
*/
public List<Event> selectEventList(Event event);
/**
*
*
* @param event
* @return
*/
public int insertEvent(Event event);
/**
*
*
* @param event
* @return
*/
public int updateEvent(Event event);
/**
*
*
* @param id ID
* @return
*/
public int deleteEventById(Long id);
/**
*
*
* @param ids ID
* @return
*/
public int deleteEventByIds(Long[] ids);
/**
*
*/
public List<Event> queryListOperate(@Param("statusList") List<String> statusList);
}

@ -0,0 +1,63 @@
package com.ruoyi.flyingbook.mapper;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-03-12
*/
public interface LarkCompanyRelationMapper
{
/**
*
*
* @param id ID
* @return
*/
public LarkCompanyRelation selectLarkCompanyRelationById(Long id);
/**
*
*
* @param larkCompanyRelation
* @return
*/
public List<LarkCompanyRelation> selectLarkCompanyRelationList(LarkCompanyRelation larkCompanyRelation);
/**
*
*
* @param larkCompanyRelation
* @return
*/
public int insertLarkCompanyRelation(LarkCompanyRelation larkCompanyRelation);
/**
*
*
* @param larkCompanyRelation
* @return
*/
public int updateLarkCompanyRelation(LarkCompanyRelation larkCompanyRelation);
/**
*
*
* @param id ID
* @return
*/
public int deleteLarkCompanyRelationById(Long id);
/**
*
*
* @param ids ID
* @return
*/
public int deleteLarkCompanyRelationByIds(Long[] ids);
}

@ -0,0 +1,63 @@
package com.ruoyi.flyingbook.mapper;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-03-12
*/
public interface LarkTableRelationMapper
{
/**
*
*
* @param id ID
* @return
*/
public LarkTableRelation selectLarkTableRelationById(Long id);
/**
*
*
* @param larkTableRelation
* @return
*/
public List<LarkTableRelation> selectLarkTableRelationList(LarkTableRelation larkTableRelation);
/**
*
*
* @param larkTableRelation
* @return
*/
public int insertLarkTableRelation(LarkTableRelation larkTableRelation);
/**
*
*
* @param larkTableRelation
* @return
*/
public int updateLarkTableRelation(LarkTableRelation larkTableRelation);
/**
*
*
* @param id ID
* @return
*/
public int deleteLarkTableRelationById(Long id);
/**
*
*
* @param ids ID
* @return
*/
public int deleteLarkTableRelationByIds(Long[] ids);
}

@ -0,0 +1,63 @@
package com.ruoyi.flyingbook.service;
import com.ruoyi.flyingbook.domain.EventLog;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
public interface IEventLogService
{
/**
*
*
* @param id ID
* @return
*/
public EventLog selectEventLogById(Long id);
/**
*
*
* @param eventLog
* @return
*/
public List<EventLog> selectEventLogList(EventLog eventLog);
/**
*
*
* @param eventLog
* @return
*/
public int insertEventLog(EventLog eventLog);
/**
*
*
* @param eventLog
* @return
*/
public int updateEventLog(EventLog eventLog);
/**
*
*
* @param ids ID
* @return
*/
public int deleteEventLogByIds(Long[] ids);
/**
*
*
* @param id ID
* @return
*/
public int deleteEventLogById(Long id);
}

@ -0,0 +1,63 @@
package com.ruoyi.flyingbook.service;
import com.ruoyi.flyingbook.domain.Event;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
public interface IEventService
{
/**
*
*
* @param id ID
* @return
*/
public Event selectEventById(Long id);
/**
*
*
* @param event
* @return
*/
public List<Event> selectEventList(Event event);
/**
*
*
* @param event
* @return
*/
public int insertEvent(Event event);
/**
*
*
* @param event
* @return
*/
public int updateEvent(Event event);
/**
*
*
* @param ids ID
* @return
*/
public int deleteEventByIds(Long[] ids);
/**
*
*
* @param id ID
* @return
*/
public int deleteEventById(Long id);
}

@ -0,0 +1,65 @@
package com.ruoyi.flyingbook.service;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
public interface ILarkCompanyRelationService
{
/**
*
*
* @param id ID
* @return
*/
public LarkCompanyRelation selectLarkCompanyRelationById(Long id);
/**
*
*
* @param larkCompanyRelation
* @return
*/
public List<LarkCompanyRelation> selectLarkCompanyRelationList(LarkCompanyRelation larkCompanyRelation);
/**
*
*
* @param larkCompanyRelation
* @return
*/
public int insertLarkCompanyRelation(LarkCompanyRelation larkCompanyRelation);
/**
*
*
* @param larkCompanyRelation
* @return
*/
public int updateLarkCompanyRelation(LarkCompanyRelation larkCompanyRelation);
/**
*
*
* @param ids ID
* @return
*/
public int deleteLarkCompanyRelationByIds(Long[] ids);
/**
*
*
* @param id ID
* @return
*/
public int deleteLarkCompanyRelationById(Long id);
public LarkCompanyRelation getByCompanyName(String companyName);
}

@ -0,0 +1,63 @@
package com.ruoyi.flyingbook.service;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
public interface ILarkTableRelationService
{
/**
*
*
* @param id ID
* @return
*/
public LarkTableRelation selectLarkTableRelationById(Long id);
/**
*
*
* @param larkTableRelation
* @return
*/
public List<LarkTableRelation> selectLarkTableRelationList(LarkTableRelation larkTableRelation);
/**
*
*
* @param larkTableRelation
* @return
*/
public int insertLarkTableRelation(LarkTableRelation larkTableRelation);
/**
*
*
* @param larkTableRelation
* @return
*/
public int updateLarkTableRelation(LarkTableRelation larkTableRelation);
/**
*
*
* @param ids ID
* @return
*/
public int deleteLarkTableRelationByIds(Long[] ids);
/**
*
*
* @param id ID
* @return
*/
public int deleteLarkTableRelationById(Long id);
}

@ -0,0 +1,97 @@
package com.ruoyi.flyingbook.service.impl;
import java.util.List;
import com.ruoyi.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.mapper.EventLogMapper;
import com.ruoyi.flyingbook.service.IEventLogService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
@Service
public class EventLogServiceImpl implements IEventLogService
{
@Autowired
private EventLogMapper eventLogMapper;
/**
*
*
* @param id ID
* @return
*/
@Override
public EventLog selectEventLogById(Long id)
{
return eventLogMapper.selectEventLogById(id);
}
/**
*
*
* @param eventLog
* @return
*/
@Override
public List<EventLog> selectEventLogList(EventLog eventLog)
{
return eventLogMapper.selectEventLogList(eventLog);
}
/**
*
*
* @param eventLog
* @return
*/
@Override
public int insertEventLog(EventLog eventLog)
{
eventLog.setCreateTime(DateUtils.getNowDate());
return eventLogMapper.insertEventLog(eventLog);
}
/**
*
*
* @param eventLog
* @return
*/
@Override
public int updateEventLog(EventLog eventLog)
{
eventLog.setUpdateTime(DateUtils.getNowDate());
return eventLogMapper.updateEventLog(eventLog);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteEventLogByIds(Long[] ids)
{
return eventLogMapper.deleteEventLogByIds(ids);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public int deleteEventLogById(Long id)
{
return eventLogMapper.deleteEventLogById(id);
}
}

@ -0,0 +1,98 @@
package com.ruoyi.flyingbook.service.impl;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.mapper.EventMapper;
import com.ruoyi.flyingbook.service.IEventService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
@Service
public class EventServiceImpl implements IEventService
{
@Autowired
private EventMapper eventMapper;
/**
*
*
* @param id ID
* @return
*/
@Override
public Event selectEventById(Long id)
{
return eventMapper.selectEventById(id);
}
/**
*
*
* @param event
* @return
*/
@Override
public List<Event> selectEventList(Event event)
{
return eventMapper.selectEventList(event);
}
/**
*
*
* @param event
* @return
*/
@Override
public int insertEvent(Event event)
{
event.setCreateTime(DateUtils.getNowDate());
return eventMapper.insertEvent(event);
}
/**
*
*
* @param event
* @return
*/
@Override
public int updateEvent(Event event)
{
event.setUpdateTime(DateUtils.getNowDate());
return eventMapper.updateEvent(event);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteEventByIds(Long[] ids)
{
return eventMapper.deleteEventByIds(ids);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public int deleteEventById(Long id)
{
return eventMapper.deleteEventById(id);
}
}

@ -0,0 +1,116 @@
package com.ruoyi.flyingbook.service.impl;
import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import com.ruoyi.flyingbook.mapper.LarkCompanyRelationMapper;
import com.ruoyi.flyingbook.service.ILarkCompanyRelationService;
import com.ruoyi.common.utils.DateUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
@Service
public class LarkCompanyRelationServiceImpl implements ILarkCompanyRelationService
{
@Autowired
private LarkCompanyRelationMapper larkCompanyRelationMapper;
/**
*
*
* @param id ID
* @return
*/
@Override
public LarkCompanyRelation selectLarkCompanyRelationById(Long id)
{
return larkCompanyRelationMapper.selectLarkCompanyRelationById(id);
}
/**
*
*
* @param larkCompanyRelation
* @return
*/
@Override
public List<LarkCompanyRelation> selectLarkCompanyRelationList(LarkCompanyRelation larkCompanyRelation)
{
return larkCompanyRelationMapper.selectLarkCompanyRelationList(larkCompanyRelation);
}
/**
*
*
* @param larkCompanyRelation
* @return
*/
@Override
public int insertLarkCompanyRelation(LarkCompanyRelation larkCompanyRelation)
{
larkCompanyRelation.setCreateTime(DateUtils.getNowDate());
return larkCompanyRelationMapper.insertLarkCompanyRelation(larkCompanyRelation);
}
/**
*
*
* @param larkCompanyRelation
* @return
*/
@Override
public int updateLarkCompanyRelation(LarkCompanyRelation larkCompanyRelation)
{
larkCompanyRelation.setUpdateTime(DateUtils.getNowDate());
return larkCompanyRelationMapper.updateLarkCompanyRelation(larkCompanyRelation);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteLarkCompanyRelationByIds(Long[] ids)
{
return larkCompanyRelationMapper.deleteLarkCompanyRelationByIds(ids);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public int deleteLarkCompanyRelationById(Long id)
{
return larkCompanyRelationMapper.deleteLarkCompanyRelationById(id);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public LarkCompanyRelation getByCompanyName(String companyName)
{
if (StringUtils.isEmpty(companyName)){
return null;
}
LarkCompanyRelation relation = new LarkCompanyRelation();
List<LarkCompanyRelation> larkCompanyRelations = larkCompanyRelationMapper.selectLarkCompanyRelationList(relation);
return CollectionUtils.isEmpty(larkCompanyRelations) ? null : larkCompanyRelations.get(0);
}
}

@ -0,0 +1,97 @@
package com.ruoyi.flyingbook.service.impl;
import java.util.List;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import com.ruoyi.flyingbook.mapper.LarkTableRelationMapper;
import com.ruoyi.flyingbook.service.ILarkTableRelationService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service
*
* @author ruoyi
* @date 2023-03-12
*/
@Service
public class LarkTableRelationServiceImpl implements ILarkTableRelationService
{
@Autowired
private LarkTableRelationMapper larkTableRelationMapper;
/**
*
*
* @param id ID
* @return
*/
@Override
public LarkTableRelation selectLarkTableRelationById(Long id)
{
return larkTableRelationMapper.selectLarkTableRelationById(id);
}
/**
*
*
* @param larkTableRelation
* @return
*/
@Override
public List<LarkTableRelation> selectLarkTableRelationList(LarkTableRelation larkTableRelation)
{
return larkTableRelationMapper.selectLarkTableRelationList(larkTableRelation);
}
/**
*
*
* @param larkTableRelation
* @return
*/
@Override
public int insertLarkTableRelation(LarkTableRelation larkTableRelation)
{
larkTableRelation.setCreateTime(DateUtils.getNowDate());
return larkTableRelationMapper.insertLarkTableRelation(larkTableRelation);
}
/**
*
*
* @param larkTableRelation
* @return
*/
@Override
public int updateLarkTableRelation(LarkTableRelation larkTableRelation)
{
larkTableRelation.setUpdateTime(DateUtils.getNowDate());
return larkTableRelationMapper.updateLarkTableRelation(larkTableRelation);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteLarkTableRelationByIds(Long[] ids)
{
return larkTableRelationMapper.deleteLarkTableRelationByIds(ids);
}
/**
*
*
* @param id ID
* @return
*/
@Override
public int deleteLarkTableRelationById(Long id)
{
return larkTableRelationMapper.deleteLarkTableRelationById(id);
}
}

@ -0,0 +1,66 @@
package com.ruoyi.flyingbook.strategy;
import com.ruoyi.flyingbook.domain.LarkRequest;
import lombok.extern.slf4j.Slf4j;
/**
* @author yuxiangyong
* @create 2023-03-12 15:58
*/
@Slf4j
public abstract class LarkOperateAbstract{
public String execute(LarkRequest request){
try {
//参数校验逻辑
if (!check(request)){
//构建返回对象
return buildResult(request);
}
//对入参进行预处理,例如解密
preOperate(request);
//真正的业务处理逻辑
businessProcessing(request);
//业务处理完成后的系列操作,例如日志
endHandle(request);
}catch (Exception e){
log.error("{} execute error: {}",getName(),e);
}
//构建返回对象并返回
return buildResult(request);
}
/**
*
*
*/
protected Boolean check(LarkRequest request){
return Boolean.TRUE;
}
/**
*
*/
protected abstract void preOperate(LarkRequest request);
/**
*
* @param request
*/
protected abstract void businessProcessing(LarkRequest request);
/**
*
*/
protected void endHandle(LarkRequest request){
}
/**
*
*/
protected abstract String buildResult(LarkRequest request);
protected abstract String getName();
}

@ -0,0 +1,94 @@
package com.ruoyi.flyingbook.strategy.callback;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.service.IEventLogService;
import com.ruoyi.flyingbook.service.IEventService;
import com.ruoyi.flyingbook.domain.LarkRequest;
import com.ruoyi.common.constant.RedisConstants;
import com.ruoyi.common.enums.EventOperateStatus;
import com.ruoyi.common.enums.EventOperateType;
import com.ruoyi.common.enums.FlagStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @author yuxiangyong
* @create 2023-03-12 15:58
*/
@Slf4j
@Service
public class ApprovalCallback extends CallbackAbstract {
@Autowired
private IEventService eventService;
@Autowired
private IEventLogService eventLogService;
@Autowired
private RedisTemplate redisTemplate;
@Override
protected Boolean check(LarkRequest request) {
String message = "";
return Boolean.TRUE;
}
@Override
protected void preOperate(LarkRequest request) {
}
@Override
protected void businessProcessing(LarkRequest request) {
String message = request.getMessage();
Event event = this.buildDto(message);
int i = eventService.insertEvent(event);
request.setEventId(event.getId());
}
@Override
protected void endHandle(LarkRequest request) {
if (request.getEventId() == null){
return;
}
redisTemplate.opsForList().rightPush(RedisConstants.MULTIDIMENSIONALTABULARFEEDBACK,request.getEventId());
EventLog eventLog = new EventLog();
eventLog.setCreateBy("Syetem");
eventLog.setCreateTime(new Date());
eventLog.setFlag(FlagStatus.OK.getCode());
eventLog.setOperateStatus(EventOperateStatus.PENDING.getCode());
eventLog.setOperateType(EventOperateType.CALL_BACK.getCode());
eventLog.setEventId(request.getEventId());
eventLogService.insertEventLog(eventLog);
Object o = redisTemplate.opsForList().leftPop(RedisConstants.MULTIDIMENSIONALTABULARFEEDBACK);
System.out.println(String.valueOf(o));
}
@Override
protected String buildResult(LarkRequest request) {
return "";
}
@Override
protected String getName() {
return this.getClass().getSimpleName();
}
private Event buildDto(String message){
Event event = new Event();
event.setFlag(EventOperateStatus.PENDING.getCode());
event.setMessage(message);
event.setEventCode("test");
event.setCreateBy("System");
event.setCreateTime(new Date());
return event;
}
}

@ -0,0 +1,14 @@
package com.ruoyi.flyingbook.strategy.callback;
import com.ruoyi.flyingbook.strategy.LarkOperateAbstract;
import lombok.extern.slf4j.Slf4j;
/**
* @author yuxiangyong
* @create 2023-03-12 15:58
*/
@Slf4j
public abstract class CallbackAbstract extends LarkOperateAbstract {
}

@ -0,0 +1,33 @@
package com.ruoyi.flyingbook.strategy.operate;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.flyingbook.domain.LarkRequest;
import com.ruoyi.flyingbook.strategy.LarkOperateAbstract;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;
/**
* @author yuxiangyong
* @create 2023-03-13 20:45
*/
public abstract class LarkAbstract extends LarkOperateAbstract {
/**
* URL
*/
protected abstract String getUrl(LarkRequest request);
/**
* body
*/
protected abstract Map<Object,Object> getBody(String message);
/**
*
*/
protected abstract JSONObject send(String url,Map<Object,Object> body,String token);
}

@ -0,0 +1,92 @@
package com.ruoyi.flyingbook.strategy.operate;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.CompanyNameConstants;
import com.ruoyi.flyingbook.LarkHelper.LarkTokenHelper;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import com.ruoyi.flyingbook.domain.LarkRequest;
import com.ruoyi.flyingbook.service.IEventService;
import com.ruoyi.flyingbook.service.ILarkCompanyRelationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
*
* @author yuxiangyong
* @create 2023-03-13 20:47
*/
@Component("MultidimensionalTableOperate")
public class MultidimensionalTableOperate extends LarkAbstract {
@Autowired
protected LarkTokenHelper larkTokenHelper;
@Autowired
protected ILarkCompanyRelationService larkCompanyRelationService;
@Autowired
protected IEventService iEventService;
private String getDetailUrl = "https://open.feishu.cn/open-apis/approval/v4/instances/:instance_id";
@Override
protected void preOperate(LarkRequest request) {
Event event = request.getEvent();
if (event == null) {
return;
}
LarkCompanyRelation relation = larkCompanyRelationService.getByCompanyName(CompanyNameConstants.COMPANY_NAME);
if (relation == null) {
return;
}
String token = larkTokenHelper.getToken(relation.getAppId(), relation.getSecret());
if (StringUtils.isBlank(token)) {
return;
}
request.setToken(token);
if (StringUtils.isNotBlank(event.getMessage())) {
return;
}
getDetailUrl.replace(":instance_id", "aaa");
String message = larkTokenHelper.postLark(getDetailUrl, null, token);
event.setMessage(message);
}
@Override
protected void businessProcessing(LarkRequest request) {
if (StringUtils.isBlank(request.getToken()) || request.getEvent() == null || StringUtils.isBlank(request.getEvent().getMessage())) {
return;
}
send(getUrl(request), getBody(request.getMessage()), request.getToken());
}
@Override
protected String getUrl(LarkRequest request) {
return null;
}
@Override
protected Map<Object, Object> getBody(String message) {
return null;
}
@Override
protected JSONObject send(String url, Map<Object, Object> body, String token) {
larkTokenHelper.postLark(url,body,token);
return null;
}
@Override
protected String buildResult(LarkRequest request) {
return null;
}
@Override
protected String getName() {
return this.getClass().getSimpleName();
}
}

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.flyingbook.mapper.EventLogMapper">
<resultMap type="EventLog" id="EventLogResult">
<result property="id" column="id"/>
<result property="tableId" column="table_id"/>
<result property="recordId" column="record_id"/>
<result property="eventId" column="event_id"/>
<result property="operateType" column="operate_type"/>
<result property="operateStatus" column="operate_status"/>
<result property="errorCode" column="error_code"/>
<result property="errorMessage" column="error_message"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="flag" column="flag"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectEventLogVo">
select id,
table_id,
record_id,
event_id,
operate_type,
operate_status,
error_code,
error_message,
create_by,
create_time,
update_by,
update_time,
flag,
remark
from event_log
</sql>
<select id="selectEventLogList" parameterType="EventLog" resultMap="EventLogResult">
<include refid="selectEventLogVo"/>
<where>
<if test="tableId != null and tableId != ''">and table_id = #{tableId}</if>
<if test="recordId != null and recordId != ''">and record_id = #{recordId}</if>
<if test="eventId != null">and event_id = #{eventId}</if>
<if test="operateType != null and operateType != ''">and operate_type = #{operateType}</if>
<if test="operateStatus != null and operateStatus != ''">and operate_status = #{operateStatus}</if>
<if test="errorCode != null and errorCode != ''">and error_code = #{errorCode}</if>
<if test="errorMessage != null and errorMessage != ''">and error_message = #{errorMessage}</if>
<if test="flag != null ">and flag = #{flag}</if>
</where>
</select>
<select id="selectEventLogById" parameterType="Long" resultMap="EventLogResult">
<include refid="selectEventLogVo"/>
where id = #{id}
</select>
<insert id="insertEventLog" parameterType="EventLog" useGeneratedKeys="true" keyProperty="id">
insert into event_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableId != null">table_id,</if>
<if test="recordId != null">record_id,</if>
<if test="eventId != null">event_id,</if>
<if test="operateType != null">operate_type,</if>
<if test="operateStatus != null">operate_status,</if>
<if test="errorCode != null">error_code,</if>
<if test="errorMessage != null">error_message,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="flag != null">flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tableId != null">#{tableId},</if>
<if test="recordId != null">#{recordId},</if>
<if test="eventId != null">#{eventId},</if>
<if test="operateType != null">#{operateType},</if>
<if test="operateStatus != null">#{operateStatus},</if>
<if test="errorCode != null">#{errorCode},</if>
<if test="errorMessage != null">#{errorMessage},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="flag != null">#{flag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateEventLog" parameterType="EventLog">
update event_log
<trim prefix="SET" suffixOverrides=",">
<if test="tableId != null">table_id = #{tableId},</if>
<if test="recordId != null">record_id = #{recordId},</if>
<if test="eventId != null">event_id = #{eventId},</if>
<if test="operateType != null">operate_type = #{operateType},</if>
<if test="operateStatus != null">operate_status = #{operateStatus},</if>
<if test="errorCode != null">error_code = #{errorCode},</if>
<if test="errorMessage != null">error_message = #{errorMessage},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEventLogById" parameterType="Long">
delete
from event_log
where id = #{id}
</delete>
<delete id="deleteEventLogByIds" parameterType="String">
delete from event_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.flyingbook.mapper.EventMapper">
<resultMap type="Event" id="EventResult">
<result property="id" column="id"/>
<result property="event_code" column="eventCode"/>
<result property="message" column="message"/>
<result property="numbers" column="numbers"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="flag" column="flag"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectEventVo">
select id,
event_code,
message,
numbers,
create_by,
create_time,
update_by,
update_time,
flag,
remark
from event
</sql>
<select id="selectEventList" parameterType="Event" resultMap="EventResult">
<include refid="selectEventVo"/>
<where>
<if test="message != null and message != ''">and message = #{message}</if>
<if test="flag != null and flag != ''">and flag = #{flag}</if>
</where>
</select>
<select id="selectEventById" parameterType="Long" resultMap="EventResult">
<include refid="selectEventVo"/>
where id = #{id}
</select>
<insert id="insertEvent" parameterType="Event" useGeneratedKeys="true" keyProperty="id">
insert into event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="eventCode != null">event_code,</if>
<if test="message != null">message,</if>
<if test="numbers != null">numbers,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="flag != null and flag != ''">flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="eventCode != null">#{event_code},</if>
<if test="message != null">#{message},</if>
<if test="numbers != null">#{numbers},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="flag != null and flag != ''">#{flag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateEvent" parameterType="Event">
update event
<trim prefix="SET" suffixOverrides=",">
<if test="eventCode != null and eventCode != ''">message = #{event_code},</if>
<if test="message != null and message != ''">message = #{message},</if>
<if test="numbers != null">message = #{numbers},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="flag != null and flag != ''">flag = #{flag},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEventById" parameterType="Long">
delete
from event
where id = #{id}
</delete>
<delete id="deleteEventByIds" parameterType="String">
delete from event where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="queryListOperate" resultMap="EventResult">
<include refid="selectEventVo"/>
where 3 > numbers
and flag in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</select>
</mapper>

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.flyingbook.mapper.LarkCompanyRelationMapper">
<resultMap type="LarkCompanyRelation" id="LarkCompanyRelationResult">
<result property="id" column="id"/>
<result property="companyId" column="company_id"/>
<result property="companyName" column="company_name"/>
<result property="appId" column="app_id"/>
<result property="secret" column="secret"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="flag" column="flag"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectLarkCompanyRelationVo">
select id,
company_id,
company_name,
app_id,
secret,
create_by,
create_time,
update_by,
update_time,
flag,
remark
from lark_company_relation
</sql>
<select id="selectLarkCompanyRelationList" parameterType="LarkCompanyRelation"
resultMap="LarkCompanyRelationResult">
<include refid="selectLarkCompanyRelationVo"/>
<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="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="secret != null and secret != ''">and secret = #{secret}</if>
<if test="flag != null ">and flag = #{flag}</if>
</where>
</select>
<select id="selectLarkCompanyRelationById" parameterType="Long" resultMap="LarkCompanyRelationResult">
<include refid="selectLarkCompanyRelationVo"/>
where id = #{id}
</select>
<insert id="insertLarkCompanyRelation" parameterType="LarkCompanyRelation" useGeneratedKeys="true" keyProperty="id">
insert into lark_company_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyId != null">company_id,</if>
<if test="companyName != null">company_name,</if>
<if test="appId != null and appId != ''">app_id,</if>
<if test="secret != null and secret != ''">secret,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="flag != null">flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyId != null">#{companyId},</if>
<if test="companyName != null">#{companyName},</if>
<if test="appId != null and appId != ''">#{appId},</if>
<if test="secret != null and secret != ''">#{secret},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="flag != null">#{flag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateLarkCompanyRelation" parameterType="LarkCompanyRelation">
update lark_company_relation
<trim prefix="SET" suffixOverrides=",">
<if test="companyId != null">company_id = #{companyId},</if>
<if test="companyName != null">company_name = #{companyName},</if>
<if test="appId != null and appId != ''">app_id = #{appId},</if>
<if test="secret != null and secret != ''">secret = #{secret},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLarkCompanyRelationById" parameterType="Long">
delete
from lark_company_relation
where id = #{id}
</delete>
<delete id="deleteLarkCompanyRelationByIds" parameterType="String">
delete from lark_company_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.flyingbook.mapper.LarkTableRelationMapper">
<resultMap type="LarkTableRelation" id="LarkTableRelationResult">
<result property="id" column="id"/>
<result property="larkCompanyRelationId" column="lark_company_relation_id"/>
<result property="fromTableId" column="from_table_id"/>
<result property="toTableId" column="to_table_id"/>
<result property="url" column="url"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="flag" column="flag"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectLarkTableRelationVo">
select id,
lark_company_relation_id,
from_table_id,
to_table_id,
url,
create_by,
create_time,
update_by,
update_time,
flag,
remark
from lark_table_relation
</sql>
<select id="selectLarkTableRelationList" parameterType="LarkTableRelation" resultMap="LarkTableRelationResult">
<include refid="selectLarkTableRelationVo"/>
<where>
<if test="larkCompanyRelationId != null ">and lark_company_relation_id = #{larkCompanyRelationId}</if>
<if test="fromTableId != null and fromTableId != ''">and from_table_id = #{fromTableId}</if>
<if test="toTableId != null and toTableId != ''">and to_table_id = #{toTableId}</if>
<if test="url != null ">and url = #{url}</if>
<if test="flag != null ">and flag = #{flag}</if>
</where>
</select>
<select id="selectLarkTableRelationById" parameterType="Long" resultMap="LarkTableRelationResult">
<include refid="selectLarkTableRelationVo"/>
where id = #{id}
</select>
<insert id="insertLarkTableRelation" parameterType="LarkTableRelation" useGeneratedKeys="true" keyProperty="id">
insert into lark_table_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="larkCompanyRelationId != null">lark_company_relation_id,</if>
<if test="fromTableId != null">from_table_id,</if>
<if test="toTableId != null">to_table_id,</if>
<if test="url != null">url,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="flag != null">flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="larkCompanyRelationId != null">#{larkCompanyRelationId},</if>
<if test="fromTableId != null">#{fromTableId},</if>
<if test="toTableId != null">#{toTableId},</if>
<if test="url != null">#{url},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="flag != null">#{flag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateLarkTableRelation" parameterType="LarkTableRelation">
update lark_table_relation
<trim prefix="SET" suffixOverrides=",">
<if test="larkCompanyRelationId != null">lark_company_relation_id = #{larkCompanyRelationId},</if>
<if test="fromTableId != null">from_table_id = #{fromTableId},</if>
<if test="toTableId != null">to_table_id = #{toTableId},</if>
<if test="url != null">url = #{url},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLarkTableRelationById" parameterType="Long">
delete
from lark_table_relation
where id = #{id}
</delete>
<delete id="deleteLarkTableRelationByIds" parameterType="String">
delete from lark_table_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/captchaImage").anonymous()
.antMatchers("/login", "/captchaImage", "/approval", "/approval2").anonymous()
.antMatchers(
HttpMethod.GET,
"/*.html",

@ -0,0 +1,11 @@
package com.ruoyi.system.domain;
import com.ruoyi.common.base.LarkRequest;
/**
* @author yuxiangyong
* @create 2023-03-12 16:00
*/
public class LarkCallbackRequest extends LarkRequest {
}

@ -0,0 +1,71 @@
-- 飞书-公司关联表
CREATE TABLE `lark_company_relation`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '唯一主键',
`company_id` bigint DEFAULT NULL COMMENT '公司id',
`company_name` varchar(255) DEFAULT NULL COMMENT '公司名称',
`app_id` varchar(255) NOT NULL COMMENT '飞书的appId',
`secret` varchar(255) NOT NULL COMMENT '公司+appId对应的唯一密钥',
`create_by` varchar(255) NOT NULL,
`create_time` datetime NOT NULL,
`update_by` varchar(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`flag` tinyint NOT NULL DEFAULT '0' COMMENT '删除标记0未删除、1已删除',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- AppId-table关联表
CREATE TABLE `lark_table_relation`
(
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一主键',
`lark_company_relation_id` BIGINT DEFAULT NULL COMMENT '公司与飞书关联表id',
`from_table_id` VARCHAR(255) DEFAULT NULL COMMENT '来源表',
`to_table_id` VARCHAR(255) DEFAULT NULL COMMENT '对应更新表',
`url` BIGINT DEFAULT NULL COMMENT 'url地址',
`create_by` VARCHAR(255) NOT NULL,
`create_time` datetime NOT NULL,
`update_by` VARCHAR(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`flag` TINYINT NOT NULL DEFAULT '0' COMMENT '删除标记0未删除、1已删除',
`remark` VARCHAR(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE = INNODB;
-- 事务操作日志
CREATE TABLE `event_log`
(
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一主键',
`table_id` VARCHAR(255) DEFAULT NULL COMMENT '多维表格id',
`record_id` VARCHAR(255) DEFAULT NULL COMMENT '实际行id',
`event_id` BIGINT DEFAULT NULL COMMENT '实际事务id',
`operate_type` VARCHAR(255) DEFAULT NULL COMMENT '操作类型',
`operate_status` VARCHAR(255) DEFAULT NULL COMMENT '操作编码',
`error_code` VARCHAR(255) DEFAULT NULL COMMENT '错误编码',
`error_message` VARCHAR(255) DEFAULT NULL COMMENT '错误信息',
`create_by` VARCHAR(255) NOT NULL,
`create_time` datetime NOT NULL,
`update_by` VARCHAR(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`flag` TINYINT NOT NULL DEFAULT '0' COMMENT '删除标记0未删除、1已删除',
`remark` VARCHAR(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE = INNODB;
-- 事务详情
CREATE TABLE `event`
(
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一主键',
`message` text DEFAULT NULL COMMENT '回调信息',
`create_by` VARCHAR(255) NOT NULL,
`create_time` datetime NOT NULL,
`update_by` VARCHAR(255) DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`flag` VARCHAR(20) NOT NULL COMMENT '状态标记pending处理中、success成功、faild失败',
`remark` VARCHAR(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE = INNODB;
Loading…
Cancel
Save