Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
bob | 8598f1de17 | 2 years ago |
bob | 6a2c22c7a3 | 2 years ago |
bob | b8f305e0b7 | 2 years ago |
bob | 8e63d6fc69 | 2 years ago |
bob | ae3a54062e | 2 years ago |
bob | 29fe333fa6 | 2 years ago |
bob | e16475d629 | 2 years ago |
bob | 32bedd1bfd | 2 years ago |
@ -0,0 +1,45 @@
|
||||
### 备份
|
||||
|
||||
以下命令用于将容器内的 mysql 的特定数据库备份到 sql 文件:
|
||||
|
||||
```sh
|
||||
# 进入 mysql 容器(宿主机执行)
|
||||
docker exec -it mysql bash
|
||||
|
||||
# 执行备份, 此命令演示中仅备份 iot 数据库(容器内执行)
|
||||
mysqldump -u root -p -h 127.0.0.1 oa_system > /tmp/oa_system.sql
|
||||
mysqldump -u root -p -h 127.0.0.1 crm_single > /tmp/crm_single.sql
|
||||
mysqldump -u root -p -h 127.0.0.1 hrm_single > /tmp/hrm_single.sql
|
||||
mysqldump -u root -p -h 127.0.0.1 nacos > /tmp/nacos.sql
|
||||
mysqldump -u root -p -h 127.0.0.1 teamwork > /tmp/teamwork.sql
|
||||
|
||||
# 将备份文件复制到宿主机(宿主机执行)
|
||||
docker cp mysql:/tmp/oa_system.sql ./oa_system.sql
|
||||
|
||||
# 打包备份文件,压缩存储对于文本文件可以节省大量空间(宿主机执行)
|
||||
tar -zcvf oa_system.sql.tzr.gz oa_system.sql
|
||||
```
|
||||
|
||||
### 恢复
|
||||
|
||||
以下命名将备份的 sql 文件恢复到容器内的 mysql 数据库中:
|
||||
|
||||
```sh
|
||||
# 解压备份文件, 解压后生成 iot.sql(宿主机执行)
|
||||
tar -zxvf oa_system.sql.tar.gz
|
||||
|
||||
# 将备份文件复制到容器内(宿主机执行)
|
||||
docker cp oa_system.sql mysql:/tmp/iot.sql
|
||||
|
||||
# 进入 mysql 容器(宿主机执行)
|
||||
docker exec -it mysql bash
|
||||
|
||||
# 执行恢复(容器内执行)
|
||||
mysql -u root -p oa_system < oa_system.sql
|
||||
```
|
||||
|
||||
**全新的数据库在恢复之前需要先创建该数据库,然后再进行恢复:**
|
||||
|
||||
```sql
|
||||
create database iot default character set utf8mb4 collate utf8mb4_unicode_ci;
|
||||
```
|
@ -1,14 +0,0 @@
|
||||
package com.ruoyi.common.constant;
|
||||
|
||||
/**
|
||||
* @author yuxiangyong
|
||||
* @create 2023-03-12 19:30
|
||||
*/
|
||||
public class CompanyNameConstants {
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
public static final String COMPANY_NAME = "COMPANY_NAME";
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
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("multiple tabular feedback".replaceAll(" ","").toUpperCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* 多维表格回调时间缓存key
|
||||
*/
|
||||
public static final String MULTIDIMENSIONALTABULARFEEDBACK = "MULTIDIMENSIONALTABULARFEEDBACK";
|
||||
|
||||
|
||||
/**
|
||||
* 多维表格更新记录
|
||||
*/
|
||||
public static final String MULTIPLE_TABLE_RECORD = "MULTIPLE_TABLE_RECORD";
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum AppType {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
APPROVAL("APPROVAL", "多维表格");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
AppType(String code, String info) {
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum CallBackTypeEnum {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
TABLE_ROW_CHANGE("drive.file.bitable_record_changed_v1", "多维表格行记录变更"),
|
||||
APPROVAL_TASK("approval_task", "审批事件回调");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
CallBackTypeEnum(String code, String info) {
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public static CallBackTypeEnum getByCode(String code){
|
||||
for (CallBackTypeEnum value : CallBackTypeEnum.values()) {
|
||||
if (value.getCode().equals(code)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum EventOperateStatus {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
PENDING("PENDING", "未处理"),
|
||||
SUCCESS("SUCCESS", "处理完成");
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum TableDetailRelationTypeEnum {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
ROW("ROW", "行"),
|
||||
COL("COL", "列");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
TableDetailRelationTypeEnum(String code, String info) {
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
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.
@ -0,0 +1,18 @@
|
||||
# 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
|
@ -1,4 +1,4 @@
|
||||
package com.ruoyi.flyingbook;
|
||||
package com.flyingbook;
|
||||
|
||||
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
|
||||
import org.springframework.boot.SpringApplication;
|
@ -1,4 +1,4 @@
|
||||
package com.ruoyi.flyingbook.config;
|
||||
package com.flyingbook.config;
|
||||
|
||||
|
||||
import com.lark.oapi.Client;
|
@ -1,4 +1,4 @@
|
||||
package com.ruoyi.flyingbook.config;
|
||||
package com.flyingbook.config;
|
||||
import com.lark.oapi.Client;
|
||||
import com.lark.oapi.core.enums.AppType;
|
||||
import com.lark.oapi.core.response.RawResponse;
|
@ -0,0 +1,65 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1,138 +0,0 @@
|
||||
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();
|
||||
|
||||
private JSONObject execute(Request request) {
|
||||
Response execute = null;
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
execute = client.newCall(request).execute();
|
||||
if (execute == null || execute.body() == null){
|
||||
throw new RuntimeException("飞书返回结果为空");
|
||||
}
|
||||
jsonObject = JSONObject.parseObject(execute.body().string());
|
||||
} catch (IOException e) {
|
||||
String errorMessage = String.format("飞书接口调用失败:{}",e.getMessage());
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
|
||||
if ("0".equals(jsonObject.getString("code"))){
|
||||
return jsonObject;
|
||||
}else {
|
||||
String errorMessage = String.format("%s##%s", jsonObject.getString("code"), jsonObject.getString("msg"));
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public String getToken(String appId, String srcret,String tokenType) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("app_id", appId);
|
||||
map.put("app_secret", srcret);
|
||||
Request.Builder builder = new Request.Builder();
|
||||
builder.url("https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal");
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json"),JSONObject.toJSONString(map));
|
||||
|
||||
builder.post(requestBody);
|
||||
return execute(builder.build()).getString(tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject 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();
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
execute = client.newCall(request).execute();
|
||||
if (execute == null || execute.body() == null){
|
||||
throw new RuntimeException("飞书返回结果为空");
|
||||
}
|
||||
jsonObject = JSONObject.parseObject(execute.body().string());
|
||||
} catch (IOException e) {
|
||||
String errorMessage = String.format("飞书接口调用失败:{}",e.getMessage());
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
String code = jsonObject.getString("code");
|
||||
if ("0".equals(code) || "1254043".equals(code)){
|
||||
return jsonObject;
|
||||
}else {
|
||||
String errorMessage = String.format("%s##%s", code, jsonObject.getString("msg"));
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject postLark(String url,Map<Object, Map<Object, Object>> body, String token) {
|
||||
Request request = new Request.Builder()
|
||||
.method("POST", RequestBody
|
||||
.create(MediaType.get("application/json"),JSONObject.toJSONString(body)))
|
||||
.url(url)
|
||||
.addHeader("Authorization",String.format("Bearer %s",token))
|
||||
.build();
|
||||
return execute(request);
|
||||
}
|
||||
|
||||
public JSONObject putLark(String url,Map<Object, Map<Object, Object>> body, String token) {
|
||||
Request request = new Request.Builder()
|
||||
.put(RequestBody
|
||||
.create( MediaType.get("application/json"),JSONObject.toJSONString(body)))
|
||||
.url(url)
|
||||
.addHeader("Authorization",String.format("Bearer %s",token))
|
||||
.build();
|
||||
return execute(request);
|
||||
}
|
||||
|
||||
public JSONObject deleteLark(String url,Map<Object, Map<Object, Object>> body, String token) {
|
||||
Request.Builder builder = new Request.Builder()
|
||||
.url(url)
|
||||
.addHeader("Authorization", String.format("Bearer %s", token));
|
||||
if (body == null || body.isEmpty()){
|
||||
builder.delete();
|
||||
}else {
|
||||
builder.delete(RequestBody
|
||||
.create(MediaType.get("application/json"),JSONObject.toJSONString(body)));
|
||||
}
|
||||
return execute(builder.build());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LarkTokenHelper helper = new LarkTokenHelper();
|
||||
String token = helper.getToken( "cli_a482a8572cbc9013", "lZNXbCLlOslWbwBIVc4qvgxOdnfA8Mos","tenant_access_token");
|
||||
System.out.println(token);
|
||||
JSONObject jsonObject = JSONObject.parseObject(token);
|
||||
Map<Object,Object> map = new HashMap<>();
|
||||
JSONObject b = new JSONObject();
|
||||
map.put("fields",b);
|
||||
b.put("多行文本","345");
|
||||
// helper.putLark("https://open.feishu.cn/open-apis/bitable/v1/apps/Gyu1b8VAFaYiEysfEUjcCKomnVc/tables/tbloMVR0ACW2uO33/records/rece1nuKGU",map,jsonObject.getString("tenant_access_token"));
|
||||
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
package com.ruoyi.flyingbook.consumer;
|
||||
|
||||
import cn.hutool.core.thread.ThreadFactoryBuilder;
|
||||
import com.ruoyi.common.constant.RedisConstants;
|
||||
import com.ruoyi.common.enums.AppType;
|
||||
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 = 10000;
|
||||
|
||||
@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<Event> eventList = eventMapper.queryEventList(EventOperateStatus.PENDING.getCode(), AppType.APPROVAL.getCode());
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
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.MultidimensionalTableCallback;
|
||||
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 MultidimensionalTableCallback multidimensionalTableCallback;
|
||||
|
||||
//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);
|
||||
multidimensionalTableCallback.execute(larkRequest);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.ruoyi.flyingbook.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 event
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
@Data
|
||||
public class Event extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
private String appId;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.AppType
|
||||
*/
|
||||
private String type;
|
||||
private String appToken;
|
||||
private String tableId;
|
||||
private String recordId;
|
||||
private Long numbers;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.EventOperateStatus
|
||||
*/
|
||||
private String operateStatus;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.FlagStatus
|
||||
*/
|
||||
private Long flag;
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package com.ruoyi.flyingbook.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 event_log
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
@Data
|
||||
public class EventLog extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public EventLog() {
|
||||
}
|
||||
|
||||
public EventLog(Long eventId, String operateType, String operateInfo) {
|
||||
this.eventId = eventId;
|
||||
this.operateType = operateType;
|
||||
this.operateInfo = operateInfo;
|
||||
this.setCreateTime(new Date());
|
||||
this.setCreateBy("System");
|
||||
}
|
||||
|
||||
public EventLog(Long eventId, String operateType, String operateInfo, String errorCode, String errorMessage) {
|
||||
this.eventId = eventId;
|
||||
this.operateType = operateType;
|
||||
this.operateInfo = operateInfo;
|
||||
this.errorCode = errorCode;
|
||||
this.errorMessage = errorMessage;
|
||||
this.setCreateTime(new Date());
|
||||
this.setCreateBy("System");
|
||||
}
|
||||
|
||||
private Long id;
|
||||
private Long eventId;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.EventOperateType
|
||||
*/
|
||||
private String operateType;
|
||||
private String operateInfo;
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.ruoyi.flyingbook.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
@Data
|
||||
public class LarkCompanyRelation extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
private Long companyId;
|
||||
private String companyName;
|
||||
private String appId;
|
||||
private String secret;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.AppType
|
||||
*/
|
||||
private String appType;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.FlagStatus
|
||||
*/
|
||||
private Long flag;
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.ruoyi.flyingbook.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 lark_table_relation
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
@Data
|
||||
public class LarkTableRelation extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
private Long larkCompanyRelationId;
|
||||
private String fromAppToken;
|
||||
private String fromTableId;
|
||||
private String toAppToken;
|
||||
private String toTableId;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.FlagStatus
|
||||
*/
|
||||
private Long flag;
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.ruoyi.flyingbook.domain;
|
||||
|
||||
import com.ruoyi.common.enums.FlagStatus;
|
||||
import lombok.Data;
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 lark_table_row_relation
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
@Data
|
||||
public class LarkTableRowRelation extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public LarkTableRowRelation() {
|
||||
}
|
||||
|
||||
public LarkTableRowRelation(Long tableRelationId, String fromId, String toId, String type, String subType) {
|
||||
this.tableRelationId = tableRelationId;
|
||||
this.fromId = fromId;
|
||||
this.toId = toId;
|
||||
this.type = type;
|
||||
this.subType = subType;
|
||||
this.setCreateTime(new Date());
|
||||
this.setCreateBy("System");
|
||||
this.flag = FlagStatus.OK.getCode();
|
||||
}
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
private Long tableRelationId;
|
||||
private String fromId;
|
||||
private String toId;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.TableDetailRelationTypeEnum
|
||||
*/
|
||||
private String type;
|
||||
private String subType;
|
||||
/**
|
||||
* @see com.ruoyi.common.enums.FlagStatus
|
||||
*/
|
||||
private Long flag;
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.ruoyi.flyingbook.factory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.enums.CallBackTypeEnum;
|
||||
import com.ruoyi.flyingbook.domain.LarkRequest;
|
||||
import com.ruoyi.flyingbook.strategy.callback.MultidimensionalTableCallback;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author yuxiangyong
|
||||
* @create 2023-03-16 20:54
|
||||
*/
|
||||
@Component
|
||||
public class LarkFactory {
|
||||
|
||||
@Autowired
|
||||
private MultidimensionalTableCallback approvalCallback;
|
||||
|
||||
public void execute(LarkRequest larkRequest) {
|
||||
String message = larkRequest.getMessage();
|
||||
if (StringUtils.isBlank(message)) {
|
||||
return;
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
String eventType = jsonObject.getJSONObject("header").getString("event_type");
|
||||
CallBackTypeEnum callBackTypeEnum = CallBackTypeEnum.getByCode(eventType);
|
||||
if (callBackTypeEnum == null) {
|
||||
return;
|
||||
}
|
||||
switch (callBackTypeEnum) {
|
||||
case TABLE_ROW_CHANGE:
|
||||
approvalCallback.execute(larkRequest);
|
||||
break;
|
||||
case APPROVAL_TASK:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
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> queryEventList(@Param("status") String status,@Param("type") String type);
|
||||
|
||||
public int updateStatus(@Param("id") Long id,@Param("status") String status,@Param("numbers") Long numbers);
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.ruoyi.flyingbook.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.flyingbook.domain.LarkTableRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
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);
|
||||
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package com.ruoyi.flyingbook.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.flyingbook.domain.LarkTableRowRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
public interface LarkTableRowRelationMapper
|
||||
{
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】ID
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public LarkTableRowRelation selectLarkTableRowRelationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<LarkTableRowRelation> selectLarkTableRowRelationList(LarkTableRowRelation larkTableRowRelation);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertLarkTableRowRelation(LarkTableRowRelation larkTableRowRelation);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateLarkTableRowRelation(LarkTableRowRelation larkTableRowRelation);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLarkTableRowRelationById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLarkTableRowRelationByIds(Long[] ids);
|
||||
|
||||
public List<LarkTableRowRelation> queryListByTableRelationIdList(@Param("tableRelationIdList") List<Long> tableRelationIdList);
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
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);
|
||||
|
||||
public int updateStatus(Long id,String status,Long numbsers);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
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 getByAppIdAndType(String appId,String appType);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
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);
|
||||
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.ruoyi.flyingbook.service;
|
||||
|
||||
|
||||
import com.ruoyi.flyingbook.domain.LarkTableRowRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
public interface ILarkTableRowRelationService
|
||||
{
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】ID
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public LarkTableRowRelation selectLarkTableRowRelationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<LarkTableRowRelation> selectLarkTableRowRelationList(LarkTableRowRelation larkTableRowRelation);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertLarkTableRowRelation(LarkTableRowRelation larkTableRowRelation);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateLarkTableRowRelation(LarkTableRowRelation larkTableRowRelation);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLarkTableRowRelationByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLarkTableRowRelationById(Long id);
|
||||
|
||||
public List<LarkTableRowRelation> queryListByTableRelationIdList(List<Long> tableRelationIdList);
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStatus(Long id, String status,Long numbsers) {
|
||||
return eventMapper.updateStatus(id,status,numbsers);
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
package com.ruoyi.flyingbook.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.enums.FlagStatus;
|
||||
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 getByAppIdAndType(String appId,String appType)
|
||||
{
|
||||
if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(appType)){
|
||||
return null;
|
||||
}
|
||||
LarkCompanyRelation relation = new LarkCompanyRelation();
|
||||
relation.setAppId(appId);
|
||||
relation.setAppType(appType);
|
||||
relation.setFlag(FlagStatus.OK.getCode());
|
||||
List<LarkCompanyRelation> larkCompanyRelations = larkCompanyRelationMapper.selectLarkCompanyRelationList(relation);
|
||||
return CollectionUtils.isEmpty(larkCompanyRelations) ? null : larkCompanyRelations.get(0);
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package com.ruoyi.flyingbook.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
package com.ruoyi.flyingbook.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.flyingbook.domain.LarkTableRowRelation;
|
||||
import com.ruoyi.flyingbook.mapper.LarkTableRowRelationMapper;
|
||||
import com.ruoyi.flyingbook.service.ILarkTableRowRelationService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-15
|
||||
*/
|
||||
@Service
|
||||
public class LarkTableRowRelationServiceImpl implements ILarkTableRowRelationService
|
||||
{
|
||||
@Autowired
|
||||
private LarkTableRowRelationMapper larkTableRowRelationMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】ID
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public LarkTableRowRelation selectLarkTableRowRelationById(Long id)
|
||||
{
|
||||
return larkTableRowRelationMapper.selectLarkTableRowRelationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<LarkTableRowRelation> selectLarkTableRowRelationList(LarkTableRowRelation larkTableRowRelation)
|
||||
{
|
||||
return larkTableRowRelationMapper.selectLarkTableRowRelationList(larkTableRowRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertLarkTableRowRelation(LarkTableRowRelation larkTableRowRelation)
|
||||
{
|
||||
larkTableRowRelation.setCreateTime(DateUtils.getNowDate());
|
||||
return larkTableRowRelationMapper.insertLarkTableRowRelation(larkTableRowRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param larkTableRowRelation 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateLarkTableRowRelation(LarkTableRowRelation larkTableRowRelation)
|
||||
{
|
||||
larkTableRowRelation.setUpdateTime(DateUtils.getNowDate());
|
||||
return larkTableRowRelationMapper.updateLarkTableRowRelation(larkTableRowRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteLarkTableRowRelationByIds(Long[] ids)
|
||||
{
|
||||
return larkTableRowRelationMapper.deleteLarkTableRowRelationByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteLarkTableRowRelationById(Long id)
|
||||
{
|
||||
return larkTableRowRelationMapper.deleteLarkTableRowRelationById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LarkTableRowRelation> queryListByTableRelationIdList(List<Long> tableRelationIdList) {
|
||||
if (CollectionUtils.isEmpty(tableRelationIdList)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return larkTableRowRelationMapper.queryListByTableRelationIdList(tableRelationIdList);
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
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 {
|
||||
|
||||
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
package com.ruoyi.flyingbook.strategy.callback;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.enums.AppType;
|
||||
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.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuxiangyong
|
||||
* @create 2023-03-12 15:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MultidimensionalTableCallback extends CallbackAbstract {
|
||||
|
||||
@Autowired
|
||||
private IEventService eventService;
|
||||
@Autowired
|
||||
private IEventLogService eventLogService;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
protected Boolean check(LarkRequest request) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preOperate(LarkRequest request) {
|
||||
if (StringUtils.isBlank(request.getMessage())) {
|
||||
return;
|
||||
}
|
||||
String message = request.getMessage();
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
JSONObject event = jsonObject.getJSONObject("event");
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
request.setFromAppToken(event.getString("file_token"));
|
||||
request.setFromTableId(event.getString("table_id"));
|
||||
JSONArray actionList = event.getJSONArray("action_list");
|
||||
if (CollectionUtils.isEmpty(actionList)) {
|
||||
return;
|
||||
}
|
||||
JSONObject action = actionList.getJSONObject(0);
|
||||
//如果不存在说明是行变更以外的事件,跳过
|
||||
String recordId = action.getString("record_id");
|
||||
if (StringUtils.isBlank(recordId)) {
|
||||
return;
|
||||
}
|
||||
request.setFromRecordId(recordId);
|
||||
|
||||
JSONObject header = jsonObject.getJSONObject("header");
|
||||
if (header == null) {
|
||||
return;
|
||||
}
|
||||
String appId = header.getString("app_id");
|
||||
request.setAppId(appId);
|
||||
request.setEventType(header.getString("event_type"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void businessProcessing(LarkRequest request) {
|
||||
String cacheKey = String.format("%s_%s_%s_%s", RedisConstants.MULTIPLE_TABLE_RECORD, request.getFromAppToken(),request.getFromTableId(), request.getFromRecordId());
|
||||
String eventStr = (String)redisTemplate.opsForValue().get(cacheKey);
|
||||
Event event = null;
|
||||
if (StringUtils.isBlank(eventStr)){
|
||||
event = queryEvent(request.getFromAppToken(),request.getFromTableId(), request.getFromRecordId());
|
||||
}else {
|
||||
event = JSONObject.parseObject(eventStr,Event.class);
|
||||
}
|
||||
//如果已经存在处理中的就不需要操作数据库了
|
||||
if (event != null && EventOperateStatus.PENDING.getCode().equals(event.getOperateStatus())){
|
||||
return;
|
||||
}
|
||||
event = this.buildDto(request,event);
|
||||
if (event.getId() == null){
|
||||
eventService.insertEvent(event);
|
||||
redisTemplate.opsForValue().set(cacheKey,JSONObject.toJSONString(event));
|
||||
}else {
|
||||
eventService.updateStatus(event.getId(),EventOperateStatus.PENDING.getCode(),0L);
|
||||
}
|
||||
request.setEventId(event.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endHandle(LarkRequest request) {
|
||||
if (request.getEventId() == null){
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getErrorMessage())){
|
||||
|
||||
}
|
||||
EventLog eventLog = StringUtils.isBlank(request.getErrorMessage()) ?
|
||||
new EventLog(request.getEventId(),EventOperateType.CALL_BACK.getCode(),request.getMessage())
|
||||
: new EventLog(request.getEventId(),EventOperateType.CALL_BACK.getCode(),request.getMessage(),request.getErrorCode(),request.getErrorMessage());
|
||||
eventLogService.insertEventLog(eventLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildResult(LarkRequest request) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
private Event queryEvent(String appToken,String tableId,String recordId){
|
||||
|
||||
Event event = new Event();
|
||||
event.setAppToken(appToken);
|
||||
event.setTableId(tableId);
|
||||
event.setRecordId(recordId);
|
||||
List<Event> events = eventService.selectEventList(event);
|
||||
if (CollectionUtils.isNotEmpty(events)){
|
||||
return events.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Event buildDto(LarkRequest request,Event event){
|
||||
event = event == null ? new Event() :event;
|
||||
event.setFlag(FlagStatus.OK.getCode());
|
||||
event.setAppToken(request.getFromAppToken());
|
||||
event.setTableId(request.getFromTableId());
|
||||
event.setRecordId(request.getFromRecordId());
|
||||
event.setNumbers(0L);
|
||||
event.setOperateStatus(EventOperateStatus.PENDING.getCode());
|
||||
event.setCreateBy("System");
|
||||
event.setCreateTime(new Date());
|
||||
event.setUpdateTime(new Date());
|
||||
event.setUpdateBy("System");
|
||||
event.setAppId(request.getAppId());
|
||||
event.setType(AppType.APPROVAL.getCode());
|
||||
return event;
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
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, Map<Object, Object>> getBody(LarkRequest request);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,261 +0,0 @@
|
||||
package com.ruoyi.flyingbook.strategy.operate;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.constant.CompanyNameConstants;
|
||||
import com.ruoyi.common.constant.RedisConstants;
|
||||
import com.ruoyi.common.enums.*;
|
||||
import com.ruoyi.flyingbook.LarkHelper.LarkTokenHelper;
|
||||
import com.ruoyi.flyingbook.domain.*;
|
||||
import com.ruoyi.flyingbook.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 多维表格操作类
|
||||
*
|
||||
* @author yuxiangyong
|
||||
* @create 2023-03-13 20:47
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("MultidimensionalTableOperate")
|
||||
public class MultidimensionalTableOperate extends LarkAbstract {
|
||||
|
||||
@Autowired
|
||||
protected LarkTokenHelper larkTokenHelper;
|
||||
@Autowired
|
||||
protected ILarkCompanyRelationService larkCompanyRelationService;
|
||||
@Autowired
|
||||
protected IEventService iEventService;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
protected ILarkTableRelationService iLarkTableRelationService;
|
||||
@Autowired
|
||||
protected ILarkTableRowRelationService iLarkTableRowRelationService;
|
||||
@Autowired
|
||||
private IEventService eventService;
|
||||
@Autowired
|
||||
private IEventLogService eventLogService;
|
||||
/**
|
||||
* 获取明细行
|
||||
*/
|
||||
private static final String DETAIL = "DETAIL";
|
||||
private String getDetail = "https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id";
|
||||
//新增明细行
|
||||
private static final String CREATE_OPERATE = "CREATE_OPERATE";
|
||||
private String addLine = "https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records";
|
||||
//修改明细行
|
||||
private static final String UPDATE_OPERATE = "UPDATE_OPERATE";
|
||||
private String updateLine = "https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id";
|
||||
//删除明细行
|
||||
private static final String DELETE_OPERATE = "DELETE_OPERATE";
|
||||
private String deleteLine = "https://open.feishu.cn/open-apis/bitable/v1/apps/:app_token/tables/:table_id/records/:record_id";
|
||||
|
||||
|
||||
private void fillTableRelation(LarkRequest request) {
|
||||
LarkTableRelation tableRelation = new LarkTableRelation();
|
||||
tableRelation.setLarkCompanyRelationId(request.getCompanyRelationId());
|
||||
tableRelation.setFromTableId(request.getEvent().getTableId());
|
||||
tableRelation.setFlag(FlagStatus.OK.getCode());
|
||||
List<LarkTableRelation> larkTableRelations = iLarkTableRelationService.selectLarkTableRelationList(tableRelation);
|
||||
if (CollectionUtils.isEmpty(larkTableRelations)) {
|
||||
String errorMessage = String.format("tableId:{}表关系未配置", request.getEvent().getTableId());
|
||||
log.error("iLarkTableRelationService.selectLarkTableRelationList:{}", errorMessage);
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
//主表与副表的列对应关系
|
||||
List<Long> tableRelationIdList = new ArrayList<>();
|
||||
Map<String, Long> tableRelationMap = new HashMap<>();
|
||||
for (LarkTableRelation larkTableRelation : larkTableRelations) {
|
||||
String to = String.format("%s_%s", larkTableRelation.getToAppToken(), larkTableRelation.getToTableId());
|
||||
tableRelationMap.put(to, larkTableRelation.getId());
|
||||
tableRelationIdList.add(larkTableRelation.getId());
|
||||
}
|
||||
request.setTableRelationMap(tableRelationMap);
|
||||
//主表与副表的行对应关系
|
||||
List<LarkTableRowRelation> larkTableRowRelations = iLarkTableRowRelationService.queryListByTableRelationIdList(tableRelationIdList);
|
||||
Map<Long, Map<String, String>> tableRowRelationMap = new HashMap<>();
|
||||
Map<Long, Map<String, String>> tableColRelationMap = new HashMap<>();
|
||||
for (LarkTableRowRelation larkTableRowRelation : larkTableRowRelations) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(larkTableRowRelation.getFromId(), larkTableRowRelation.getToId());
|
||||
if (TableDetailRelationTypeEnum.ROW.getCode().equals(larkTableRowRelation.getType())) {
|
||||
tableRowRelationMap.put(larkTableRowRelation.getTableRelationId(), map);
|
||||
} else if (TableDetailRelationTypeEnum.COL.getCode().equals(larkTableRowRelation.getType())) {
|
||||
tableColRelationMap.put(larkTableRowRelation.getTableRelationId(), map);
|
||||
}
|
||||
}
|
||||
if (tableColRelationMap.isEmpty()) {
|
||||
String errorMessage = String.format("tableId:{} 列关系未配置", request.getEvent().getTableId());
|
||||
log.error("iLarkTableRowRelationService.queryListByTableRelationIdList:{}", errorMessage);
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
request.setTableRowRelationMap(tableRowRelationMap);
|
||||
request.setTableColRelationMap(tableColRelationMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preOperate(LarkRequest request) {
|
||||
Event event = request.getEvent();
|
||||
if (event == null) {
|
||||
throw new RuntimeException("当前事件为空");
|
||||
}
|
||||
LarkCompanyRelation relation = larkCompanyRelationService.getByAppIdAndType(request.getEvent().getAppId(), AppType.APPROVAL.getCode());
|
||||
if (relation == null) {
|
||||
String errorMessage = String.format("获取app值为空 appId:{} appType:{}", request.getEvent().getAppId(), AppType.APPROVAL.getCode());
|
||||
log.error("larkCompanyRelationService.getByCompanyName:{}", errorMessage);
|
||||
throw new RuntimeException(errorMessage);
|
||||
}
|
||||
//用于后续追加row时候做关联关系
|
||||
request.setCompanyRelationId(relation.getId());
|
||||
//关联关系表填充
|
||||
this.fillTableRelation(request);
|
||||
String token = larkTokenHelper.getToken(relation.getAppId(), relation.getSecret(), "tenant_access_token");
|
||||
request.setToken(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void businessProcessing(LarkRequest request) {
|
||||
request.setOperateType(DETAIL);
|
||||
JSONObject message = larkTokenHelper.getLark(getUrl(request), null, request.getToken());
|
||||
request.setRecord(message);
|
||||
for (Map.Entry<String, Long> entry : request.getTableRelationMap().entrySet()) {
|
||||
String[] arr = entry.getKey().split("_");
|
||||
request.setToAppToken(arr[0]);
|
||||
request.setToTableId(arr[1]);
|
||||
request.setTableRelationId(entry.getValue());
|
||||
Map<Object, Map<Object, Object>> body = getBody(request);
|
||||
String url = getUrl(request);
|
||||
if (StringUtils.isBlank(url)) {
|
||||
return;
|
||||
}
|
||||
send(request.getOperateType(), url, body, request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUrl(LarkRequest request) {
|
||||
Event event = request.getEvent();
|
||||
Map<String, String> rowRelation = request.getTableRowRelationMap().get(request.getTableRelationId());
|
||||
String cacheKey = String.format("%s_%s_%s_%s", RedisConstants.MULTIPLE_TABLE_RECORD, event.getAppToken(), event.getTableId(), event.getRecordId());
|
||||
redisTemplate.delete(cacheKey);
|
||||
if (UPDATE_OPERATE.equals(request.getOperateType())) {
|
||||
if (rowRelation.containsKey(event.getRecordId())) {
|
||||
return updateLine.replace(":app_token", request.getToAppToken()).replace(":table_id", request.getToTableId()).replace(":record_id", rowRelation.get(event.getRecordId()));
|
||||
}
|
||||
} else if (CREATE_OPERATE.equals(request.getOperateType())) {
|
||||
return addLine.replace(":app_token", request.getToAppToken()).replace(":table_id", request.getToTableId());
|
||||
} else if (DELETE_OPERATE.equals(request.getOperateType())) {
|
||||
if (rowRelation.containsKey(event.getRecordId())) {
|
||||
return deleteLine.replace(":app_token", request.getToAppToken()).replace(":table_id", request.getToTableId()).replace(":record_id", rowRelation.get(event.getRecordId()));
|
||||
}
|
||||
} else if (DETAIL.equals(request.getOperateType())) {
|
||||
return getDetail.replace(":app_token", event.getAppToken()).replace(":table_id", event.getTableId()).replace(":record_id", event.getRecordId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<Object, Map<Object, Object>> getBody(LarkRequest request) {
|
||||
Map<Object, Map<Object, Object>> result = new HashMap<>();
|
||||
JSONObject record = request.getRecord();
|
||||
String responseCode = record.getString("code");
|
||||
Map<String, String> rowMap = request.getTableRowRelationMap().getOrDefault(request.getTableRelationId(), new HashMap<>());
|
||||
if ("1254043".equals(responseCode)) {
|
||||
request.setOperateType(DELETE_OPERATE);
|
||||
} else if ("0".equals(responseCode)) {
|
||||
result = parseMap(request);
|
||||
if (rowMap.containsKey(request.getEvent().getRecordId())) {
|
||||
request.setOperateType(UPDATE_OPERATE);
|
||||
} else {
|
||||
request.setOperateType(CREATE_OPERATE);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<Object, Map<Object, Object>> parseMap(LarkRequest request) {
|
||||
Map<Object, Object> result = new HashMap<>();
|
||||
JSONObject record = request.getRecord();
|
||||
Map<String, String> colRelation = request.getTableColRelationMap().getOrDefault(request.getTableRelationId(), new HashMap<>());
|
||||
String fields = record.getJSONObject("data").getJSONObject("record").getString("fields");
|
||||
Map<Object, Object> midMap = JSONObject.parseObject(fields, Map.class);
|
||||
for (Map.Entry<Object, Object> entry : midMap.entrySet()) {
|
||||
String key = String.valueOf(entry.getKey());
|
||||
if (!colRelation.containsKey(key)) {
|
||||
continue;
|
||||
}
|
||||
result.put(colRelation.get(key), entry.getValue());
|
||||
}
|
||||
Map<Object, Map<Object, Object>> map = new HashMap<>();
|
||||
map.put("fields", result);
|
||||
return map;
|
||||
}
|
||||
|
||||
protected void send(String type, String url, Map<Object, Map<Object, Object>> body, LarkRequest request) {
|
||||
request.setOperateInfo(String.valueOf(body));
|
||||
String token = request.getToken();
|
||||
if (CREATE_OPERATE.equals(type)) {
|
||||
JSONObject result = larkTokenHelper.postLark(url, body, token);
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
if (data != null) {
|
||||
JSONObject record = data.getJSONObject("record");
|
||||
if (record != null && StringUtils.isNotBlank(record.getString("record_id"))) {
|
||||
String recordId = record.getString("record_id");
|
||||
LarkTableRowRelation rowRelation = new LarkTableRowRelation(request.getCompanyRelationId(), request.getEvent().getRecordId(), recordId, TableDetailRelationTypeEnum.ROW.getCode(), TableDetailRelationTypeEnum.ROW.getCode());
|
||||
iLarkTableRowRelationService.insertLarkTableRowRelation(rowRelation);
|
||||
}
|
||||
}
|
||||
request.setEventOperateType(EventOperateType.CREATE);
|
||||
} else if (UPDATE_OPERATE.equals(type)) {
|
||||
request.setEventOperateType(EventOperateType.UPDATE);
|
||||
larkTokenHelper.putLark(url, body, token);
|
||||
} else if (DELETE_OPERATE.equals(type)) {
|
||||
request.setEventOperateType(EventOperateType.DELETE);
|
||||
larkTokenHelper.deleteLark(url, body, token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endHandle(LarkRequest request) {
|
||||
Event event = request.getEvent();
|
||||
EventLog eventLog = null;
|
||||
if (StringUtils.isBlank(request.getErrorMessage())) {
|
||||
eventService.updateStatus(event.getId(), EventOperateStatus.SUCCESS.getCode(), event.getNumbers());
|
||||
eventLog = new EventLog(event.getId(), request.getEventOperateType().getCode(), request.getMessage());
|
||||
} else {
|
||||
eventService.updateStatus(event.getId(), EventOperateStatus.PENDING.getCode(), event.getNumbers() + 1);
|
||||
if (request.getEventOperateType() != null) {
|
||||
new EventLog(event.getId(), request.getEventOperateType().getCode(), request.getMessage(), request.getErrorCode(), request.getErrorMessage());
|
||||
}
|
||||
}
|
||||
if (eventLog != null) {
|
||||
eventLog.setOperateInfo(request.getOperateType());
|
||||
eventLogService.insertEventLog(eventLog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildResult(LarkRequest request) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
<?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="com.ruoyi.flyingbook.domain.EventLog" id="EventLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="eventId" column="event_id" />
|
||||
<result property="operateType" column="operate_type" />
|
||||
<result property="operateInfo" column="operate_info" />
|
||||
<result property="errorCode" column="error_code" />
|
||||
<result property="errorMessage" column="error_message" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEventLogVo">
|
||||
select id, event_id, operate_type, operate_info, error_code, error_message, remark, create_by, create_time, update_by, update_time from event_log
|
||||
</sql>
|
||||
|
||||
<select id="selectEventLogList" parameterType="com.ruoyi.flyingbook.domain.EventLog" resultMap="EventLogResult">
|
||||
<include refid="selectEventLogVo"/>
|
||||
<where>
|
||||
<if test="eventId != null "> and event_id = #{eventId}</if>
|
||||
<if test="operateType != null and operateType != ''"> and operate_type = #{operateType}</if>
|
||||
<if test="operateInfo != null and operateInfo != ''"> and operate_info = #{operateInfo}</if>
|
||||
<if test="errorCode != null and errorCode != ''"> and error_code = #{errorCode}</if>
|
||||
<if test="errorMessage != null and errorMessage != ''"> and error_message = #{errorMessage}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEventLogById" parameterType="Long" resultMap="EventLogResult">
|
||||
<include refid="selectEventLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEventLog" parameterType="com.ruoyi.flyingbook.domain.EventLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into event_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="eventId != null">event_id,</if>
|
||||
<if test="operateType != null">operate_type,</if>
|
||||
<if test="operateInfo != null">operate_info,</if>
|
||||
<if test="errorCode != null">error_code,</if>
|
||||
<if test="errorMessage != null">error_message,</if>
|
||||
<if test="remark != null">remark,</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>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="eventId != null">#{eventId},</if>
|
||||
<if test="operateType != null">#{operateType},</if>
|
||||
<if test="operateInfo != null">#{operateInfo},</if>
|
||||
<if test="errorCode != null">#{errorCode},</if>
|
||||
<if test="errorMessage != null">#{errorMessage},</if>
|
||||
<if test="remark != null">#{remark},</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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEventLog" parameterType="com.ruoyi.flyingbook.domain.EventLog">
|
||||
update event_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="eventId != null">event_id = #{eventId},</if>
|
||||
<if test="operateType != null">operate_type = #{operateType},</if>
|
||||
<if test="operateInfo != null">operate_info = #{operateInfo},</if>
|
||||
<if test="errorCode != null">error_code = #{errorCode},</if>
|
||||
<if test="errorMessage != null">error_message = #{errorMessage},</if>
|
||||
<if test="remark != null">remark = #{remark},</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>
|
||||
</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>
|
@ -1,139 +0,0 @@
|
||||
<?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="com.ruoyi.flyingbook.domain.Event" id="EventResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="appId" column="app_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="appToken" column="app_token"/>
|
||||
<result property="tableId" column="table_id"/>
|
||||
<result property="recordId" column="record_id"/>
|
||||
<result property="numbers" column="numbers"/>
|
||||
<result property="operateStatus" column="operate_status"/>
|
||||
<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,
|
||||
app_id,
|
||||
`type`,
|
||||
app_token,
|
||||
table_id,
|
||||
record_id,
|
||||
numbers,
|
||||
operate_status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
flag,
|
||||
remark
|
||||
from event
|
||||
</sql>
|
||||
|
||||
<select id="selectEventList" parameterType="com.ruoyi.flyingbook.domain.Event" resultMap="EventResult">
|
||||
<include refid="selectEventVo"/>
|
||||
<where>
|
||||
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
|
||||
<if test="type != null and type != ''">and `type` = #{type}</if>
|
||||
<if test="appToken != null and appToken != ''">and app_token = #{appToken}</if>
|
||||
<if test="tableId != null and tableId != ''">and table_id = #{tableId}</if>
|
||||
<if test="recordId != null and recordId != ''">and record_id = #{recordId}</if>
|
||||
<if test="numbers != null ">and numbers = #{numbers}</if>
|
||||
<if test="operateStatus != null and operateStatus != ''">and operate_status = #{operateStatus}</if>
|
||||
<if test="flag != null ">and flag = #{flag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEventById" parameterType="Long" resultMap="EventResult">
|
||||
<include refid="selectEventVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEvent" parameterType="com.ruoyi.flyingbook.domain.Event" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into event
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="type != null">`type`,</if>
|
||||
<if test="appToken != null">app_token,</if>
|
||||
<if test="tableId != null">table_id,</if>
|
||||
<if test="recordId != null">record_id,</if>
|
||||
<if test="numbers != null">numbers,</if>
|
||||
<if test="operateStatus != null">operate_status,</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="appId != null">#{appId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="appToken != null">#{appToken},</if>
|
||||
<if test="tableId != null">#{tableId},</if>
|
||||
<if test="recordId != null">#{recordId},</if>
|
||||
<if test="numbers != null">#{numbers},</if>
|
||||
<if test="operateStatus != null">#{operateStatus},</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="updateEvent" parameterType="com.ruoyi.flyingbook.domain.Event">
|
||||
update event
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="type != null">`type` = #{type},</if>
|
||||
<if test="appToken != null">app_token = #{appToken},</if>
|
||||
<if test="tableId != null">table_id = #{tableId},</if>
|
||||
<if test="recordId != null">record_id = #{recordId},</if>
|
||||
<if test="numbers != null">numbers = #{numbers},</if>
|
||||
<if test="operateStatus != null">operate_status = #{operateStatus},</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="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="queryEventList" parameterType="com.ruoyi.flyingbook.domain.Event" resultMap="EventResult">
|
||||
<include refid="selectEventVo"/>
|
||||
where operate_status = #{status} and `type` = #{type} and 3 > numbers
|
||||
</select>
|
||||
|
||||
<update id="updateStatus" parameterType="com.ruoyi.flyingbook.domain.Event">
|
||||
update event
|
||||
set operate_status = #{status},
|
||||
numbers = #{numbers}
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
@ -1,101 +0,0 @@
|
||||
<?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="com.ruoyi.flyingbook.domain.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="appType" column="app_type" />
|
||||
<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, app_type, create_by, create_time, update_by, update_time, flag, remark from lark_company_relation
|
||||
</sql>
|
||||
|
||||
<select id="selectLarkCompanyRelationList" parameterType="com.ruoyi.flyingbook.domain.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="appType != null and appType != ''"> and app_type = #{appType}</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="com.ruoyi.flyingbook.domain.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="appType != null">app_type,</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="appType != null">#{appType},</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="com.ruoyi.flyingbook.domain.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="appType != null">app_type = #{appType},</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>
|
@ -1,101 +0,0 @@
|
||||
<?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="com.ruoyi.flyingbook.domain.LarkTableRelation" id="LarkTableRelationResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="larkCompanyRelationId" column="lark_company_relation_id" />
|
||||
<result property="fromAppToken" column="from_app_token" />
|
||||
<result property="fromTableId" column="from_table_id" />
|
||||
<result property="toAppToken" column="to_app_token" />
|
||||
<result property="toTableId" column="to_table_id" />
|
||||
<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_app_token, from_table_id, to_app_token, to_table_id, create_by, create_time, update_by, update_time, flag, remark from lark_table_relation
|
||||
</sql>
|
||||
|
||||
<select id="selectLarkTableRelationList" parameterType="com.ruoyi.flyingbook.domain.LarkTableRelation" resultMap="LarkTableRelationResult">
|
||||
<include refid="selectLarkTableRelationVo"/>
|
||||
<where>
|
||||
<if test="larkCompanyRelationId != null "> and lark_company_relation_id = #{larkCompanyRelationId}</if>
|
||||
<if test="fromAppToken != null and fromAppToken != ''"> and from_app_token = #{fromAppToken}</if>
|
||||
<if test="fromTableId != null and fromTableId != ''"> and from_table_id = #{fromTableId}</if>
|
||||
<if test="toAppToken != null and toAppToken != ''"> and to_app_token = #{toAppToken}</if>
|
||||
<if test="toTableId != null and toTableId != ''"> and to_table_id = #{toTableId}</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="com.ruoyi.flyingbook.domain.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="fromAppToken != null">from_app_token,</if>
|
||||
<if test="fromTableId != null">from_table_id,</if>
|
||||
<if test="toAppToken != null">to_app_token,</if>
|
||||
<if test="toTableId != null">to_table_id,</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="fromAppToken != null">#{fromAppToken},</if>
|
||||
<if test="fromTableId != null">#{fromTableId},</if>
|
||||
<if test="toAppToken != null">#{toAppToken},</if>
|
||||
<if test="toTableId != null">#{toTableId},</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="com.ruoyi.flyingbook.domain.LarkTableRelation">
|
||||
update lark_table_relation
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="larkCompanyRelationId != null">lark_company_relation_id = #{larkCompanyRelationId},</if>
|
||||
<if test="fromAppToken != null">from_app_token = #{fromAppToken},</if>
|
||||
<if test="fromTableId != null">from_table_id = #{fromTableId},</if>
|
||||
<if test="toAppToken != null">to_app_token = #{toAppToken},</if>
|
||||
<if test="toTableId != null">to_table_id = #{toTableId},</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>
|
@ -1,125 +0,0 @@
|
||||
<?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.LarkTableRowRelationMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.flyingbook.domain.LarkTableRowRelation" id="LarkTableRowRelationResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="tableRelationId" column="table_relation_id"/>
|
||||
<result property="fromId" column="from_id"/>
|
||||
<result property="toId" column="to_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="subType" column="sub_type"/>
|
||||
<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="selectLarkTableRowRelationVo">
|
||||
select id,
|
||||
table_relation_id,
|
||||
from_id,
|
||||
to_id,
|
||||
type,
|
||||
sub_type,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
flag,
|
||||
remark
|
||||
from lark_table_row_relation
|
||||
</sql>
|
||||
|
||||
<select id="selectLarkTableRowRelationList" parameterType="com.ruoyi.flyingbook.domain.LarkTableRowRelation"
|
||||
resultMap="LarkTableRowRelationResult">
|
||||
<include refid="selectLarkTableRowRelationVo"/>
|
||||
<where>
|
||||
<if test="tableRelationId != null ">and table_relation_id = #{tableRelationId}</if>
|
||||
<if test="fromId != null and fromId != ''">and from_id = #{fromId}</if>
|
||||
<if test="toId != null and toId != ''">and to_id = #{toId}</if>
|
||||
<if test="type != null and type != ''">and type = #{type}</if>
|
||||
<if test="subType != null and subType != ''">and sub_type = #{subType}</if>
|
||||
<if test="flag != null ">and flag = #{flag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectLarkTableRowRelationById" parameterType="Long" resultMap="LarkTableRowRelationResult">
|
||||
<include refid="selectLarkTableRowRelationVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertLarkTableRowRelation" parameterType="com.ruoyi.flyingbook.domain.LarkTableRowRelation"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into lark_table_row_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tableRelationId != null">table_relation_id,</if>
|
||||
<if test="fromId != null">from_id,</if>
|
||||
<if test="toId != null">to_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="subType != null">sub_type,</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="tableRelationId != null">#{tableRelationId},</if>
|
||||
<if test="fromId != null">#{fromId},</if>
|
||||
<if test="toId != null">#{toId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="subType != null">#{subType},</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="updateLarkTableRowRelation" parameterType="com.ruoyi.flyingbook.domain.LarkTableRowRelation">
|
||||
update lark_table_row_relation
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="tableRelationId != null">table_relation_id = #{tableRelationId},</if>
|
||||
<if test="fromId != null">from_id = #{fromId},</if>
|
||||
<if test="toId != null">to_id = #{toId},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="subType != null">sub_type = #{subType},</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="deleteLarkTableRowRelationById" parameterType="Long">
|
||||
delete
|
||||
from lark_table_row_relation
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteLarkTableRowRelationByIds" parameterType="String">
|
||||
delete from lark_table_row_relation where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryListByTableRelationIdList" parameterType="Long" resultMap="LarkTableRowRelationResult">
|
||||
<include refid="selectLarkTableRowRelationVo"/>
|
||||
where table_relation_id in
|
||||
<foreach collection="tableRelationIdList" item="tableRelationId" separator="," open="(" close=")">
|
||||
#{tableRelationId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in new issue