【feat】 考虑增加data_log表
This commit is contained in:
parent
080d7b45ca
commit
013301ba34
90
src/main/java/com/celnet/datadump/entity/DataLog.java
Normal file
90
src/main/java/com/celnet/datadump/entity/DataLog.java
Normal file
@ -0,0 +1,90 @@
|
||||
package com.celnet.datadump.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.Value;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Kris
|
||||
* @date 2025/04/10
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("data_log")
|
||||
@ApiModel(value = "操作日志")
|
||||
public class DataLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@TableField("request_data")
|
||||
@ApiModelProperty(value = "请求参数")
|
||||
private String requestData;
|
||||
|
||||
/**
|
||||
* 请求状态
|
||||
*/
|
||||
@TableField("request_status")
|
||||
@ApiModelProperty(value = "请求状态")
|
||||
private String requestStatus;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@TableField("start_time")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@TableField("end_time")
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
@TableField("request_method")
|
||||
@ApiModelProperty(value = "请求方法")
|
||||
private String requestMethod;
|
||||
|
||||
/**
|
||||
* 请求类型
|
||||
*/
|
||||
@TableField("request_type")
|
||||
@ApiModelProperty(value = "请求类型")
|
||||
private String requestType;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
@TableField("error_message")
|
||||
@ApiModelProperty(value = "错误信息")
|
||||
private String errorMessage;
|
||||
|
||||
/**
|
||||
* 是否发送邮件
|
||||
*/
|
||||
@TableField("email_flag")
|
||||
@ApiModelProperty(value = "是否发送邮件")
|
||||
private Boolean emailFlag;
|
||||
}
|
16
src/main/java/com/celnet/datadump/mapper/DataLogMapper.java
Normal file
16
src/main/java/com/celnet/datadump/mapper/DataLogMapper.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.celnet.datadump.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.celnet.datadump.entity.DataLog;
|
||||
import com.celnet.datadump.entity.DataObject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataLogMapper extends BaseMapper<DataLog> {
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.celnet.datadump.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.celnet.datadump.entity.DataLog;
|
||||
|
||||
|
||||
public interface DataLogService extends IService<DataLog> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.celnet.datadump.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.celnet.datadump.entity.DataLog;
|
||||
import com.celnet.datadump.mapper.DataLogMapper;
|
||||
import com.celnet.datadump.service.DataLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class DataLogServiceImpl extends ServiceImpl<DataLogMapper, DataLog> implements DataLogService {
|
||||
|
||||
}
|
123
src/main/java/com/celnet/datadump/util/MD5Util.java
Normal file
123
src/main/java/com/celnet/datadump/util/MD5Util.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.celnet.datadump.util;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import java.security.Key;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.util.Base64;
|
||||
|
||||
public class MD5Util {
|
||||
|
||||
/** 向量(同时拥有向量和密匙才能解密),此向量必须是8byte,多少都报错 */
|
||||
private final byte[] DESIV = new byte[] { 0x22, 0x54, 0x36, 110, 0x40, (byte) 0xac, (byte) 0xad, (byte) 0xdf };
|
||||
/** 自定义密钥,个数不能太短,太短报错,过长,它默认只取前N位(N的具体值,大家另行查找资料) */
|
||||
private final String deSkey = "datax-cloud";
|
||||
/** 加密算法的参数接口 */
|
||||
private AlgorithmParameterSpec iv = null;
|
||||
private Key key = null;
|
||||
private String charset = "UTF-8";
|
||||
|
||||
private static volatile MD5Util instance;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @throws Exception
|
||||
*/
|
||||
private MD5Util() throws Exception {
|
||||
// 设置密钥参数
|
||||
DESKeySpec keySpec = new DESKeySpec(deSkey.getBytes(this.charset));
|
||||
// 设置向量
|
||||
iv = new IvParameterSpec(DESIV);
|
||||
// 获得密钥工厂
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
|
||||
// 得到密钥对象
|
||||
key = keyFactory.generateSecret(keySpec);
|
||||
}
|
||||
|
||||
public static MD5Util getInstance() throws Exception {
|
||||
if(instance == null) {
|
||||
synchronized (MD5Util.class) {
|
||||
if(instance == null) {
|
||||
instance = new MD5Util();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
String value = "1246656415670484994";
|
||||
MD5Util mt = new MD5Util();
|
||||
System.out.println("加密前的字符:" + value);
|
||||
System.out.println("加密后的字符:" + mt.encode(value));
|
||||
System.out.println("解密后的字符:" + mt.decode(mt.encode(value)));
|
||||
System.out.println("字符串的MD5值:"+ getMD5Value(value));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param data
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String encode(String data) throws Exception {
|
||||
// 得到加密对象Cipher
|
||||
Cipher enCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
// 设置工作模式为加密模式,给出密钥和向量
|
||||
enCipher.init(Cipher.ENCRYPT_MODE, key, iv);
|
||||
byte[] pasByte = enCipher.doFinal(data.getBytes(this.charset));
|
||||
return Base64.getEncoder().encodeToString(pasByte);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
* @param data
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String decode(String data) throws Exception {
|
||||
Cipher deCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
deCipher.init(Cipher.DECRYPT_MODE, key, iv);
|
||||
//此处注意doFinal()的参数的位数必须是8的倍数,否则会报错(通过encode加密的字符串读出来都是8的倍数位,但写入文件再读出来,就可能因为读取的方式的问题,导致最后此处的doFinal()的参数的位数不是8的倍数)
|
||||
//此处必须用base64Decoder,若用data。getBytes()则获取的字符串的byte数组的个数极可能不是8的倍数,而且不与上面的BASE64Encoder对应(即使解密不报错也不会得到正确结果)
|
||||
byte[] pasByte = deCipher.doFinal(Base64.getDecoder().decode(data));
|
||||
return new String(pasByte, this.charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取MD5的值,可用于对比校验
|
||||
* @param sourceStr
|
||||
* @return
|
||||
*/
|
||||
private static String getMD5Value(String sourceStr) {
|
||||
String result = "";
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(sourceStr.getBytes());
|
||||
byte b[] = md.digest();
|
||||
int i;
|
||||
StringBuffer buf = new StringBuffer("");
|
||||
for (int offset = 0; offset < b.length; offset++) {
|
||||
i = b[offset];
|
||||
if (i < 0) {
|
||||
i += 256;
|
||||
}
|
||||
if (i < 16) {
|
||||
buf.append("0");
|
||||
}
|
||||
buf.append(Integer.toHexString(i));
|
||||
}
|
||||
result = buf.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
Binary file not shown.
@ -1,57 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/cook?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: celnet@2025.bln
|
||||
# url: jdbc:mysql://183.6.105.131:13306/zhonghe_test?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
# username: root
|
||||
# password: Celnet@2022
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
protocol: smtps
|
||||
username: red_celnet@163.com
|
||||
password: COGERHMHEPUMXJLF
|
||||
send-to: kris.dong@celnet.com.cn
|
||||
|
||||
#sf webservice配置
|
||||
sf:
|
||||
# 附件下载url
|
||||
file-download-url: https://zhonghe.my.salesforce.com
|
||||
file-upload-url: https://yihui-medical.my.sfcrmproducts.cn
|
||||
# #线程数
|
||||
# executor-size: 5
|
||||
# list:
|
||||
# - username: conner.yan@hairobotics.com.puat
|
||||
# password: hairou20228
|
||||
# url: https://test.salesforce.com/services/Soap/u/56.0
|
||||
|
||||
#sf-target:
|
||||
# #线程数
|
||||
# executor-size: 5
|
||||
# list:
|
||||
# - url: https://test.salesforce.com/services/Soap/u/56.0
|
||||
# username: michelle.qian@celnet.com.cn.devcpq
|
||||
# password: celnet2023
|
||||
|
||||
#xxl-job配置
|
||||
xxl-job:
|
||||
address: http://127.0.0.1:8080/xxl-job-admin/
|
||||
appname: ${spring.application.name}
|
||||
port: 8887
|
||||
logPath: /${spring.application.name}/xxl-job/jobhandler
|
||||
|
||||
file:
|
||||
# 存储类别 OSS SERVER
|
||||
type: SERVER
|
||||
# 文件存储路径 当type为SERVER生效 作为服务器文件存储路径 不配置默认 ./file
|
||||
path: file
|
||||
# 阿里oss配置 不用可不配
|
||||
aliyun:
|
||||
oss:
|
||||
accessKey: LTAI5tBEFLSJ6hccuDH7wKkv
|
||||
secretKey: Q3d6MjrWJCmwz1ND54hLnUCwYAWsDa
|
||||
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
||||
bucket: crm-backup-oss
|
@ -1,47 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/cook?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: celnet@2025.bln
|
||||
mail:
|
||||
host: smtp.mxhichina.com
|
||||
port: 465
|
||||
protocol: smtps
|
||||
username: kris.dong@celnet.com.cn
|
||||
password: 20010725.dly
|
||||
send-to: kris.dong@celnet.com.cn
|
||||
|
||||
#sf webservice配置
|
||||
sf:
|
||||
# 附件下载url
|
||||
file-download-url: https://starrapid.my.salesforce.com
|
||||
file-upload-url: https://procision.my.salesforce.com
|
||||
#线程数
|
||||
executor-size: 5
|
||||
list:
|
||||
- url: https://login.salesforce.com/services/Soap/u/41.0
|
||||
username: crm-system@genomics.cn
|
||||
password: 666@sunwei
|
||||
|
||||
#xxl-job配置
|
||||
xxl-job:
|
||||
address: http://127.0.0.1:8080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
port: 8887
|
||||
logPath: /home/celnet/${spring.application.name}/xxl-job/jobhandler
|
||||
|
||||
file:
|
||||
# 存储类别 OSS SERVER
|
||||
type: SERVER
|
||||
# 文件存储路径 当type为SERVER生效 作为服务器文件存储路径 不配置默认 ./file
|
||||
path: file
|
||||
|
||||
# 阿里oss配置 不用可不配
|
||||
aliyun:
|
||||
oss:
|
||||
accessKey: LTAI5tBEFLSJ6hccuDH7wKkv
|
||||
secretKey: Q3d6MjrWJCmwz1ND54hLnUCwYAWsDa
|
||||
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
||||
bucket: crm-backup-oss
|
@ -1,47 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/cook?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: celnet@2025.bln
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
protocol: smtps
|
||||
username: red_celnet@163.com
|
||||
password: COGERHMHEPUMXJLF
|
||||
send-to: kris.dong@celnet.com.cn
|
||||
|
||||
#sf webservice配置
|
||||
sf:
|
||||
# 附件下载url
|
||||
file-download-url: https://starrapid.lightning.force.com/
|
||||
file-upload-url: https://yihui-medical.my.sfcrmproducts.cn
|
||||
#线程数
|
||||
executor-size: 5
|
||||
list:
|
||||
- url: https://login.salesforce.com/services/Soap/u/41.0
|
||||
username: crm-system@genomics.cn
|
||||
password: 666@sunwei
|
||||
|
||||
#xxl-job配置
|
||||
xxl-job:
|
||||
address: http://127.0.0.1:8080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
port: 8887
|
||||
logPath: /home/celnet/${spring.application.name}/xxl-job/jobhandler
|
||||
|
||||
file:
|
||||
# 存储类别 OSS SERVER
|
||||
type: SERVER
|
||||
# 文件存储路径 当type为SERVER生效 作为服务器文件存储路径 不配置默认 ./file
|
||||
path: file
|
||||
|
||||
# 阿里oss配置 不用可不配
|
||||
aliyun:
|
||||
oss:
|
||||
accessKey: LTAI5tBEFLSJ6hccuDH7wKkv
|
||||
secretKey: Q3d6MjrWJCmwz1ND54hLnUCwYAWsDa
|
||||
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
||||
bucket: crm-backup-oss
|
@ -1,22 +0,0 @@
|
||||
server:
|
||||
port: 8888
|
||||
spring:
|
||||
profiles:
|
||||
active: prod
|
||||
application:
|
||||
name: data-dump
|
||||
data-dump:
|
||||
name: 测试
|
||||
# mybatis 配置
|
||||
mybatis-plus:
|
||||
# 扫描mybatis的实现dao接口*.xml文件
|
||||
mapper-locations: classpath:/mapper/*.xml
|
||||
#实体类取别名
|
||||
type-aliases-package: com.celnet.datadump.entity
|
||||
configuration:
|
||||
# 下划线转驼峰配置
|
||||
map-underscore-to-camel-case: true
|
||||
# 控制输出sql log
|
||||
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user