Compare commits
8 Commits
master
...
dev.csh.on
Author | SHA1 | Date |
---|---|---|
|
b33b59222e | |
|
76761de5e8 | |
|
bf60933eac | |
|
3dc7b35e04 | |
|
37c71a5d3e | |
|
2983c635ff | |
|
6233a50911 | |
|
a2d2caac79 |
|
@ -22,6 +22,32 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--json模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.gitee.chemors</groupId>
|
||||
<artifactId>secure-ext-spring-boot-starter</artifactId>
|
||||
<version>1.0.3-RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:qdm
|
||||
* @Package:com.muyu.domain
|
||||
* @Project:cloud-etlw3123123
|
||||
* @name:ActionScope
|
||||
* @Date:2024/8/21 20:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActionScope {
|
||||
/**
|
||||
* 规则作用域
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 规则作用域名称
|
||||
*/
|
||||
@Schema(name = "规则作用域名称", type = "String", defaultValue = "数据字段", description = "规则作用域名称")
|
||||
private String name;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.mos.secure.ext.annotations.DesensitizationProp;
|
||||
import com.mos.secure.ext.enums.SensitiveTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.domain
|
||||
* @ClassName:DesensitizationAdmin
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 21:00
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class DesensitizationAdmin {
|
||||
private Integer uid;
|
||||
@DesensitizationProp(SensitiveTypeEnum.CHINESE_NAME)
|
||||
private String userName;//姓名
|
||||
@DesensitizationProp(SensitiveTypeEnum.MOBILE_PHONE)
|
||||
private String userMobile;//手机号
|
||||
@DesensitizationProp(SensitiveTypeEnum.FIXED_PHONE)
|
||||
private String userTel;//固定电话
|
||||
@DesensitizationProp(SensitiveTypeEnum.ID_CARD)
|
||||
private String userBkId;//银行卡号
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
/**
|
||||
* @Author:qdm
|
||||
* @Package:com.muyu.domain
|
||||
* @Project :cloud-etlw3123123
|
||||
* @name:Rule
|
||||
* @Date:2024/8/21 19:34
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户支付单", description = "客户支付单简略信息")
|
||||
public class Rule {
|
||||
/**
|
||||
* 规则引擎id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 规则引擎名称
|
||||
*/
|
||||
@Schema(name = "规则名称", type = "String", defaultValue = "基础规则", description = "规则名称")
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型
|
||||
*/
|
||||
@Schema(name = "规则类型", type = "Integer", defaultValue = "1", description = "规则类型")
|
||||
private Integer type;
|
||||
/**
|
||||
* 规则作用域
|
||||
*/
|
||||
@Schema(name = "规则作用域", type = "Integer", defaultValue = "1", description = "规则作用域")
|
||||
private Integer actionScope;
|
||||
/**
|
||||
* 规则邮编码
|
||||
*/
|
||||
@Schema(name = "规则邮编码", type = "String", defaultValue = "123456", description = "规则邮编码")
|
||||
private String code;
|
||||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
@Schema(name = "是否激活", type = "Integer", defaultValue = "1", description = "是否激活")
|
||||
private Integer flag;
|
||||
/**
|
||||
* 规则状态
|
||||
*/
|
||||
@Schema(name = "规则状态", type = "Integer", defaultValue = "1", description = "规则状态")
|
||||
private Integer status;
|
||||
}
|
|
@ -26,7 +26,6 @@ public class SourceType extends BaseEntity {
|
|||
@TableField(value = "driver_class")
|
||||
private String driverClass;
|
||||
|
||||
//
|
||||
private String prefix;
|
||||
|
||||
private String suffix;
|
||||
|
|
|
@ -21,6 +21,7 @@ public class TableInfo extends TreeEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:qdm
|
||||
* @Package:com.muyu.domain
|
||||
* @Project:cloud-etlw3123123
|
||||
* @name:Type
|
||||
* @Date:2024/8/21 20:54
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Type {
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@Schema(name = "类型名称", type = "String", defaultValue = "基础类型", description = "类型名称")
|
||||
private String name;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.domain.dto;
|
||||
|
||||
import com.muyu.domain.enumerate.Desensitization;
|
||||
import com.muyu.domain.enumerate.DesensitizationTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.domain
|
||||
* @ClassName:AnnotainDTO
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 16:10
|
||||
*/
|
||||
@Data
|
||||
public class AnnotationDTO implements Serializable {
|
||||
/**
|
||||
* 自定义
|
||||
*/
|
||||
@Desensitization(type = DesensitizationTypeEnum.CUSTOMER,startInclude = 5,endExclude = 10)
|
||||
private String name;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Desensitization(type = DesensitizationTypeEnum.MOBILE_PHONE)
|
||||
private String tel;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Desensitization(type = DesensitizationTypeEnum.EMAIL)
|
||||
private String email;
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
@Desensitization(type = DesensitizationTypeEnum.ID_CARD)
|
||||
private String idCard;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.domain.enumerate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.muyu.domain.serialize.DesensitizationSerialize;
|
||||
import kotlin.annotation.AnnotationRetention;
|
||||
import kotlin.annotation.Retention;
|
||||
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.domain.enumerate
|
||||
* @ClassName:Desensitization
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 14:04
|
||||
*/
|
||||
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@JacksonAnnotationsInside
|
||||
@JsonSerialize(using = DesensitizationSerialize.class)
|
||||
public @interface Desensitization {
|
||||
/**
|
||||
* 脱敏规则
|
||||
* @return
|
||||
*/
|
||||
|
||||
DesensitizationTypeEnum type() default DesensitizationTypeEnum.CUSTOMER;
|
||||
|
||||
/**
|
||||
* 开始
|
||||
*/
|
||||
int startInclude() default 0;
|
||||
|
||||
/**
|
||||
* 结束
|
||||
*/
|
||||
int endExclude() default 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.muyu.domain.enumerate;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.domain
|
||||
* @ClassName:SensitiveType
|
||||
* @Description: 数据脱敏
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 13:59
|
||||
*/
|
||||
|
||||
|
||||
public enum DesensitizationTypeEnum {
|
||||
//自定义
|
||||
CUSTOMER,
|
||||
//用户id
|
||||
USER_ID,
|
||||
//中文名
|
||||
CHINESE_NAME,
|
||||
//身份证号
|
||||
ID_CARD,
|
||||
//座机号
|
||||
FIXED_PHONE,
|
||||
//手机号
|
||||
MOBILE_PHONE,
|
||||
//地址
|
||||
ADDRESS,
|
||||
//电子邮件
|
||||
EMAIL,
|
||||
//密码
|
||||
PASSWORD,
|
||||
//中国大陆车牌,包含普通车辆、新能源车辆
|
||||
CAR_LICENSE,
|
||||
//银行卡
|
||||
BANK_CARD
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.domain.job;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.domain.job
|
||||
* @ClassName:SysJob
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 22:29
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@SuperBuilder
|
||||
public class SysJob extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
private Long jobId;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String jobName;
|
||||
|
||||
/**
|
||||
* 任务分组
|
||||
*/
|
||||
private String jobGroup;
|
||||
|
||||
/**
|
||||
* 目标字符串
|
||||
*/
|
||||
private String characterString;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1暂停)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:qdm
|
||||
* @Package:com.muyu.domain.req
|
||||
* @Project:cloud-etlw3123123
|
||||
* @name:RuleReq
|
||||
* @Date:2024/8/21 21:38
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RuleReq {
|
||||
/**
|
||||
* 名称模糊查询
|
||||
*/
|
||||
@Schema(name = "名称模糊查询", type = "String", defaultValue = "基础规则", description = "名称模糊查询")
|
||||
private String name;
|
||||
/**
|
||||
* 类型精确查询
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 是否激活精确查询
|
||||
*/
|
||||
private Integer flag;
|
||||
/**、
|
||||
* 状态精确查询
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
|
@ -2,24 +2,15 @@ package com.muyu.domain.req;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value ="source",autoResultMap = true) //数据库表相关
|
||||
|
||||
|
||||
|
||||
public class SourceReq extends BaseEntity {
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
|
@ -65,16 +56,6 @@ public class SourceReq extends BaseEntity {
|
|||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitTimes;
|
||||
|
||||
@Excel(name ="连接参数")
|
||||
private String connectionParams;
|
||||
|
||||
@Excel(name ="用户名")
|
||||
private String username;
|
||||
|
||||
@Excel(name ="密码")
|
||||
private String password;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SourceReq{" +
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.muyu.domain.rule;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @PackageName:com.muyu.domain.rule
|
||||
* @ClassName:Rule
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/22 2:09
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "规则")
|
||||
public class Rule {
|
||||
|
||||
/**
|
||||
* 规则ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 规则类型
|
||||
*/
|
||||
private String ruleType;
|
||||
|
||||
|
||||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
private String isActivate;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
private String ruleDesc;
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.muyu.domain.serialize;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.BeanProperty;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
|
||||
import com.muyu.domain.enumerate.DesensitizationTypeEnum;
|
||||
import com.muyu.domain.enumerate.Desensitization;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DesensitizationSerialize extends JsonSerializer<String> implements ContextualSerializer {
|
||||
private DesensitizationTypeEnum type;
|
||||
|
||||
private Integer startInclude;
|
||||
|
||||
private Integer endExclude;
|
||||
@Override
|
||||
public void serialize(String str, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||
switch (type) {
|
||||
//自定义 Java 对象如何序列化成 JSON 格式
|
||||
// 中文姓名脱敏
|
||||
case CHINESE_NAME:
|
||||
jsonGenerator.writeString(DesensitizedUtil.chineseName(String.valueOf(str)));
|
||||
break;
|
||||
// 身份证脱敏
|
||||
case ID_CARD:
|
||||
jsonGenerator.writeString(DesensitizedUtil.idCardNum(String.valueOf(str), 1, 2));
|
||||
break;
|
||||
// 手机号脱敏
|
||||
case MOBILE_PHONE:
|
||||
jsonGenerator.writeString(DesensitizedUtil.mobilePhone(String.valueOf(str)));
|
||||
break;
|
||||
// 地址脱敏
|
||||
case ADDRESS:
|
||||
jsonGenerator.writeString(DesensitizedUtil.address(String.valueOf(str), 8));
|
||||
break;
|
||||
// 邮箱脱敏
|
||||
case EMAIL:
|
||||
jsonGenerator.writeString(DesensitizedUtil.email(String.valueOf(str)));
|
||||
break;
|
||||
// 密码脱敏
|
||||
case PASSWORD:
|
||||
jsonGenerator.writeString(DesensitizedUtil.password(String.valueOf(str)));
|
||||
break;
|
||||
// 银行卡脱敏
|
||||
case BANK_CARD:
|
||||
jsonGenerator.writeString(DesensitizedUtil.bankCard(String.valueOf(str)));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonSerializer<?> createContextual(SerializerProvider serializerProvider, BeanProperty beanProperty) throws JsonMappingException {
|
||||
if (beanProperty != null) {
|
||||
System.out.println("aaa");
|
||||
// 判断数据类型是否为String类型
|
||||
if (Objects.equals(beanProperty.getType().getRawClass(), String.class)) {
|
||||
// 获取定义的注解
|
||||
Desensitization desensitization = beanProperty.getAnnotation(Desensitization.class);
|
||||
// 为null
|
||||
if (desensitization == null) {
|
||||
desensitization = beanProperty.getContextAnnotation(Desensitization.class);
|
||||
}
|
||||
// 不为null
|
||||
if (desensitization != null) {
|
||||
// 创建定义的序列化类的实例并且返回,入参为注解定义的type,开始位置,结束位置。
|
||||
return new DesensitizationSerialize(desensitization.type(), desensitization.startInclude(),
|
||||
desensitization.endExclude());
|
||||
}
|
||||
}
|
||||
|
||||
return serializerProvider.findValueSerializer(beanProperty.getType(), beanProperty);
|
||||
}
|
||||
return serializerProvider.findNullValueSerializer(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,261 @@
|
|||
package com.muyu.domain.util;
|
||||
|
||||
|
||||
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 敏感数据脱敏工具类
|
||||
*/
|
||||
public class Desensitization {
|
||||
/**
|
||||
* 身份证号脱敏
|
||||
*
|
||||
* @param idCard
|
||||
* @return
|
||||
*/
|
||||
public static String idCardDesensitization(String idCard) {
|
||||
if (StringUtils.isNotEmpty(idCard)) {
|
||||
// 身份证号脱敏规则一:保留前六后三
|
||||
if (idCard.length() == 15) {
|
||||
idCard = idCard.replaceAll("(\\w{6})\\w*(\\w{3})", "$1******$2");
|
||||
} else if (idCard.length() == 18) {
|
||||
idCard = idCard.replaceAll("(\\w{6})\\w*(\\w{3})", "$1*********$2");
|
||||
}
|
||||
// 身份证号脱敏规则二:保留前三后四
|
||||
// idCard = idCard.replaceAll("(?<=\\w{3})\\w(?=\\w{4})", "*");
|
||||
}
|
||||
return idCard;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号码脱敏
|
||||
*
|
||||
* @param mobilePhone
|
||||
* @return
|
||||
*/
|
||||
public static String mobilePhoneDesensitization(String mobilePhone) {
|
||||
// 手机号码保留前三后四
|
||||
if (StringUtils.isNotEmpty(mobilePhone)) {
|
||||
mobilePhone = mobilePhone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
|
||||
}
|
||||
return mobilePhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 电子邮箱脱敏
|
||||
*
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
public static String emailDesensitization(String email) {
|
||||
// 电子邮箱隐藏@前面的3个字符
|
||||
if (StringUtils.isEmpty(email)) {
|
||||
return email;
|
||||
}
|
||||
String encrypt = email.replaceAll("(\\w+)\\w{3}@(\\w+)", "$1***@$2");
|
||||
if (email.equalsIgnoreCase(encrypt)) {
|
||||
encrypt = email.replaceAll("(\\w*)\\w{1}@(\\w+)", "$1*@$2");
|
||||
}
|
||||
return encrypt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 银行账号脱敏
|
||||
*
|
||||
* @param acctNo
|
||||
* @return
|
||||
*/
|
||||
public static String acctNoDesensitization(String acctNo) {
|
||||
// 银行账号保留前六后四
|
||||
if (StringUtils.isNotEmpty(acctNo)) {
|
||||
String regex = "(\\w{6})(.*)(\\w{4})";
|
||||
Matcher m = Pattern.compile(regex).matcher(acctNo);
|
||||
if (m.find()) {
|
||||
String rep = m.group(2);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < rep.length(); i++) {
|
||||
sb.append("*");
|
||||
}
|
||||
acctNo = acctNo.replaceAll(rep, sb.toString());
|
||||
}
|
||||
}
|
||||
return acctNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户名称脱敏
|
||||
*
|
||||
* @param custName
|
||||
* @return
|
||||
*/
|
||||
public static String custNameDesensitization(String custName) {
|
||||
|
||||
if (StringUtils.isNotEmpty(custName)) {
|
||||
char[] chars = custName.toCharArray();
|
||||
if (chars.length < 5) {// 表示姓名
|
||||
if (chars.length > 1) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < chars.length - 2; i++) {
|
||||
sb.append("*");
|
||||
}
|
||||
custName = custName.replaceAll(custName.substring(1, chars.length - 1), sb.toString());
|
||||
}
|
||||
} else {
|
||||
int start = 4;
|
||||
String str1 = custName.substring(0, start);
|
||||
String str2 = "";
|
||||
if (chars.length == 5) {
|
||||
str2 = "*";
|
||||
} else if (chars.length == 6) {
|
||||
str2 = "**";
|
||||
} else if (chars.length == 7) {
|
||||
str2 = "***";
|
||||
} else if (chars.length == 8) {
|
||||
str2 = "****";
|
||||
} else if (chars.length == 9) {
|
||||
str2 = "*****";
|
||||
} else {
|
||||
str2 = "******";
|
||||
}
|
||||
// 通过计算得到第三部分需要从第几个字符截取
|
||||
int subIndex = start + str2.length();
|
||||
// 第三部分
|
||||
String str3 = custName.substring(subIndex);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(str1);
|
||||
sb.append(str2);
|
||||
sb.append(str3);
|
||||
custName = sb.toString();
|
||||
}
|
||||
}
|
||||
return custName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 家庭地址脱敏
|
||||
*
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
public static String addressDesensitization(String address) {
|
||||
// 规则说明:从第4位开始隐藏,隐藏8位。
|
||||
if (StringUtils.isNotEmpty(address)) {
|
||||
char[] chars = address.toCharArray();
|
||||
if (chars.length > 11) {// 由于需要从第4位开始,隐藏8位,因此数据长度必须大于11位
|
||||
// 获取第一部分内容
|
||||
String str1 = address.substring(0, 4);
|
||||
// 获取第二部分
|
||||
String str2 = "********";
|
||||
// 获取第三部分
|
||||
String str3 = address.substring(12);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(str1);
|
||||
sb.append(str2);
|
||||
sb.append(str3);
|
||||
address = sb.toString();
|
||||
}
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
//下面代码是从别人博客看到的。
|
||||
|
||||
/**
|
||||
* 定义所有常量
|
||||
*/
|
||||
public static final int ONE = 1;
|
||||
public static final int TWO = 2;
|
||||
|
||||
/**
|
||||
* 姓名脱敏
|
||||
*
|
||||
* @param realName
|
||||
* @return
|
||||
*/
|
||||
public static String desensitizedName(String realName) {
|
||||
if (realName == null) {
|
||||
return null;
|
||||
}
|
||||
if (realName.length() == ONE) {
|
||||
return realName;
|
||||
} else if (realName.length() == TWO) {
|
||||
return realName.substring(0, 1) +"*";
|
||||
} else {
|
||||
Integer length = realName.length();
|
||||
StringBuffer middle = new StringBuffer();
|
||||
for (int i = 0; i < realName.substring(1, length - 1).length(); i++) {
|
||||
middle.append("*");
|
||||
}
|
||||
return realName.substring(0, 1) + middle + realName.substring(length - 1, length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 详细地址脱敏
|
||||
*
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
public static String desensitizedAddress(String address){
|
||||
//江西省宜春市丰城市剑南街道人才教育小区41号丰城住总运营有限公司-->江西省宜春市丰城市剑南街道人才教育小区*************
|
||||
if (StringUtils.isNotEmpty(address)) {
|
||||
int length = address.length();
|
||||
int indes = address.indexOf("区");
|
||||
if (indes == -1) {
|
||||
indes = address.indexOf("市");
|
||||
}
|
||||
address = address.substring(0, indes + 1);
|
||||
StringBuffer middle = new StringBuffer();
|
||||
for (int i = 0; i < length - indes; i++) {
|
||||
middle.append("*");
|
||||
}
|
||||
return address + middle;
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对字符串进行脱敏操作
|
||||
*
|
||||
* @param origin 原始字符串
|
||||
* @param prefixNoMaskLen 左侧需要保留几位明文字段
|
||||
* @param suffixNoMaskLen 右侧需要保留几位明文字段
|
||||
* @param maskStr 用于遮罩的字符串, 如'*'
|
||||
* @return 脱敏后结果
|
||||
*/
|
||||
public static String desValue(String origin, int prefixNoMaskLen, int suffixNoMaskLen, String maskStr) {
|
||||
if (origin == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0, n = origin.length(); i < n; i++) {
|
||||
if (i < prefixNoMaskLen) {
|
||||
sb.append(origin.charAt(i));
|
||||
continue;
|
||||
}
|
||||
if (i > (n - suffixNoMaskLen - 1)) {
|
||||
sb.append(origin.charAt(i));
|
||||
continue;
|
||||
}
|
||||
sb.append(maskStr);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文姓名,只显示最后一个汉字,其他隐藏为星号,比如:**梦
|
||||
*
|
||||
* @param fullName
|
||||
* @return
|
||||
*/
|
||||
public static String chineseName(String fullName) {
|
||||
if (fullName == null) {
|
||||
return null;
|
||||
}
|
||||
return desValue(fullName, 0, 1, "*");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package com.muyu.domain.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class DesensitizationUtil {
|
||||
|
||||
/**
|
||||
* [中文姓名] 只显示第一个汉字,其他隐藏为2个星号<例子:李**>
|
||||
*/
|
||||
public static String chineseName(final String fullName) {
|
||||
if (StringUtils.isBlank(fullName)) {
|
||||
return "";
|
||||
}
|
||||
final String name = StringUtils.left(fullName, 1);
|
||||
return StringUtils.rightPad(name, StringUtils.length(fullName), "*");
|
||||
}
|
||||
|
||||
|
||||
public static String chineseName(final String familyName, final String givenName) {
|
||||
if (StringUtils.isBlank(familyName) || StringUtils.isBlank(givenName)) {
|
||||
return "";
|
||||
}
|
||||
return chineseName(familyName + givenName);
|
||||
}
|
||||
|
||||
/**
|
||||
* [身份证号] 显示最后四位,其他隐藏。共计18位或者15位。<例子:*************5762>
|
||||
*/
|
||||
public static String annotationDTO(final String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return StringUtils.left(id, 3).concat(StringUtils
|
||||
.removeStart(StringUtils.leftPad(StringUtils.right(id, 3), StringUtils.length(id), "*"),
|
||||
"***"));
|
||||
}
|
||||
|
||||
/**
|
||||
* [固定电话] 后四位,其他隐藏<例子:****1234>
|
||||
*/
|
||||
public static String fixedPhone(final String num) {
|
||||
if (StringUtils.isBlank(num)) {
|
||||
return "";
|
||||
}
|
||||
return StringUtils.leftPad(StringUtils.right(num, 4), StringUtils.length(num), "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* [手机号码] 前三位,后四位,其他隐藏<例子:138******1234>
|
||||
*/
|
||||
public static String mobilePhone(final String num) {
|
||||
if (StringUtils.isBlank(num)) {
|
||||
return "";
|
||||
}
|
||||
return StringUtils.left(num, 2).concat(StringUtils
|
||||
.removeStart(StringUtils.leftPad(StringUtils.right(num, 2), StringUtils.length(num), "*"),
|
||||
"***"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* [地址] 只显示到地区,不显示详细地址;我们要对个人信息增强保护<例子:北京市海淀区****>
|
||||
*
|
||||
* @param sensitiveSize 敏感信息长度
|
||||
*/
|
||||
public static String address(final String address, final int sensitiveSize) {
|
||||
if (StringUtils.isBlank(address)) {
|
||||
return "";
|
||||
}
|
||||
final int length = StringUtils.length(address);
|
||||
return StringUtils.rightPad(StringUtils.left(address, length - sensitiveSize), length, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* [电子邮箱] 邮箱前缀仅显示第一个字母,前缀其他隐藏,用星号代替,@及后面的地址显示<例子:g**@163.com>
|
||||
*/
|
||||
public static String email(final String email) {
|
||||
if (StringUtils.isBlank(email)) {
|
||||
return "";
|
||||
}
|
||||
final int index = StringUtils.indexOf(email, "@");
|
||||
if (index <= 1) {
|
||||
return email;
|
||||
} else {
|
||||
return StringUtils.rightPad(StringUtils.left(email, 1), index, "*")
|
||||
.concat(StringUtils.mid(email, index, StringUtils.length(email)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [银行卡号] 前六位,后四位,其他用星号隐藏每位1个星号<例子:6222600**********1234>
|
||||
*/
|
||||
public static String bankCard(final String cardNum) {
|
||||
if (StringUtils.isBlank(cardNum)) {
|
||||
return "";
|
||||
}
|
||||
return StringUtils.left(cardNum, 6).concat(StringUtils.removeStart(
|
||||
StringUtils.leftPad(StringUtils.right(cardNum, 4), StringUtils.length(cardNum), "*"),
|
||||
"******"));
|
||||
}
|
||||
|
||||
/**
|
||||
* [公司开户银行联号] 公司开户银行联行号,显示前两位,其他用星号隐藏,每位1个星号<例子:12********>
|
||||
*/
|
||||
public static String cnapsCode(final String code) {
|
||||
if (StringUtils.isBlank(code)) {
|
||||
return "";
|
||||
}
|
||||
return StringUtils.rightPad(StringUtils.left(code, 2), StringUtils.length(code), "*");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(DesensitizationUtil.chineseName("李王丽"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.cloud.etl.controller;
|
||||
|
||||
import com.muyu.cloud.etl.service.AnnotationDTOService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.controller
|
||||
* @ClassName:SensitiveController
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 15:23
|
||||
*/
|
||||
@RestController
|
||||
public class SensitiveController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AnnotationDTOService annotationDTOService;
|
||||
|
||||
// Desensitization
|
||||
|
||||
}
|
|
@ -5,9 +5,9 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.domain.Source;
|
||||
import com.muyu.domain.req.SourceReq;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -21,10 +21,10 @@ public class SourceController extends BaseController {
|
|||
@Autowired
|
||||
private SourceService sourceService;
|
||||
|
||||
|
||||
//列表
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<Source>> list(@RequestBody SourceReq sourceReq) {
|
||||
@RequiresPermissions("etl:info:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Source>> list(SourceReq sourceReq) {
|
||||
startPage();
|
||||
List<Source> list = sourceService.selectSourceList(sourceReq);
|
||||
return getDataTable(list);
|
||||
|
@ -33,6 +33,7 @@ public class SourceController extends BaseController {
|
|||
/*
|
||||
* 导出
|
||||
*/
|
||||
@RequiresPermissions("etl:info:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SourceReq sourceReq) {
|
||||
List<Source> list= sourceService.selectSourceList(sourceReq);
|
||||
|
@ -40,27 +41,28 @@ public class SourceController extends BaseController {
|
|||
util.exportExcel(response,list,"基础信息");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取基础信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("etl:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id) {
|
||||
Source source= sourceService.getInfo(id);
|
||||
return success(source);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*/
|
||||
@PostMapping("/insert")
|
||||
@RequiresPermissions("etl:info:add")
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Source sourceReq) {
|
||||
|
||||
return toAjax(sourceService.insertBasicConfigInfo(sourceReq));
|
||||
}
|
||||
|
||||
//批量删除
|
||||
@RequiresPermissions("etl:info:deleteIds")
|
||||
@DeleteMapping("{ids}")
|
||||
public Integer delete(@PathVariable("ids") String ids) {
|
||||
return sourceService.deleteByIds(ids);
|
||||
|
@ -69,22 +71,12 @@ public class SourceController extends BaseController {
|
|||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public Result update(@RequestBody Source sourceReq) {
|
||||
|
||||
return toAjax(sourceService.updataSource(sourceReq));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
|
||||
@PostMapping("/connectionTest")
|
||||
public Result connectionTest(@RequestBody Source source) throws ServletException {
|
||||
return toAjax(sourceService.connectionTest(source));
|
||||
}
|
||||
|
||||
// @RequiresPermissions("etl:info:updata")
|
||||
// @PostMapping
|
||||
// public Result update(@RequestBody Source sourceReq) {
|
||||
//
|
||||
// return toAjax(sourceService.updataSource(sourceReq));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.cloud.etl.controller;
|
||||
|
||||
import com.muyu.cloud.etl.service.SysJobService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.domain.job.SysJob;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static io.netty.handler.codec.http.multipart.DiskFileUpload.prefix;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.controller
|
||||
* @ClassName:SysJobController
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 22:37
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/job")
|
||||
public class SysJobController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SysJobService jobService;
|
||||
|
||||
@RequiresPermissions("monitor:job:view")
|
||||
@GetMapping()
|
||||
public String job()
|
||||
{
|
||||
return prefix + "/job";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:list")
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<SysJob>> list(SysJob job)
|
||||
{
|
||||
List<SysJob> list = jobService.selectJobList(job);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
public Result changeStatus(SysJob job)
|
||||
{
|
||||
SysJob newJob = jobService.selectJobById(job.getJobId());
|
||||
newJob.setStatus(job.getStatus());
|
||||
return Result.success(jobService.changeStatus(newJob));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cloud.etl.controller;
|
||||
|
||||
import com.muyu.domain.DesensitizationAdmin;
|
||||
import com.muyu.domain.dto.AnnotationDTO;
|
||||
import com.muyu.domain.enumerate.Desensitization;
|
||||
import com.muyu.domain.util.DesensitizationUtil;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.controller
|
||||
* @ClassName:Text2Controller
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 21:01
|
||||
*/
|
||||
@RestController
|
||||
public class Text2Controller {
|
||||
@Desensitization //意思为当前返回的数据要进行脱敏
|
||||
@RequestMapping("/datase")
|
||||
public AnnotationDTO test(AnnotationDTO annotationDTO){
|
||||
|
||||
String s = DesensitizationUtil.chineseName(annotationDTO.getName());
|
||||
annotationDTO.setName(s);
|
||||
annotationDTO.setEmail(DesensitizationUtil.email(annotationDTO.getEmail()));
|
||||
annotationDTO.setTel(DesensitizationUtil.email(annotationDTO.getTel()));
|
||||
annotationDTO.setIdCard(DesensitizationUtil.email(annotationDTO.getIdCard()));
|
||||
return annotationDTO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.cloud.etl.controller;
|
||||
|
||||
import com.muyu.domain.dto.AnnotationDTO;
|
||||
import com.muyu.domain.enumerate.Desensitization;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.controller
|
||||
* @ClassName:TextController
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 16:32
|
||||
*/
|
||||
@RestController
|
||||
@Desensitization
|
||||
@RequestMapping("/test")
|
||||
public class TextController {
|
||||
|
||||
|
||||
@GetMapping("/test-annotation")
|
||||
public AnnotationDTO testAnnotation(AnnotationDTO annotationDTO) {
|
||||
annotationDTO.setTel("1111111111111");
|
||||
annotationDTO.setEmail("1437200980@qq.com");
|
||||
annotationDTO.setIdCard("1342543654544322754635");
|
||||
return annotationDTO;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.cloud.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.dto.AnnotationDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AnnotationDTOMapper extends BaseMapper<AnnotationDTO>{
|
||||
}
|
|
@ -10,7 +10,4 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface SourceMapper extends BaseMapper<Source> {
|
||||
List<Source> selectSourceList(SourceReq sourceReq);
|
||||
|
||||
Integer updataSource(Source sourceReq);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.cloud.etl.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.job.SysJob;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysJobMapper extends BaseMapper<SysJob> {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.muyu.cloud.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.dto.AnnotationDTO;
|
||||
|
||||
|
||||
public interface AnnotationDTOService extends IService<AnnotationDTO> {
|
||||
}
|
|
@ -15,7 +15,6 @@ public interface SourceService extends IService<Source> {
|
|||
|
||||
Integer deleteByIds(String ids);
|
||||
|
||||
int updataSource(Source sourceReq);
|
||||
// int updataSource(Source sourceReq);
|
||||
|
||||
int connectionTest(Source source);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.cloud.etl.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.SourceType;
|
||||
import com.muyu.domain.job.SysJob;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.service
|
||||
* @ClassName:SysJobService
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 22:42
|
||||
*/
|
||||
public interface SysJobService extends IService<SysJob> {
|
||||
|
||||
/**
|
||||
* 获取quartz调度器的计划任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 调度任务集合
|
||||
*/
|
||||
public List<SysJob> selectJobList(SysJob job);
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
*
|
||||
* @param jobId 调度任务ID
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
public SysJob selectJobById(Long jobId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeStatus(SysJob job);
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.cloud.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.etl.mapper.AnnotationDTOMapper;
|
||||
import com.muyu.cloud.etl.service.AnnotationDTOService;
|
||||
import com.muyu.domain.dto.AnnotationDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.service.impl
|
||||
* @ClassName:SensitiveServiceImpl
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/21 15:24
|
||||
*/
|
||||
@Service
|
||||
public class AnnotationDTOServiceImpl extends ServiceImpl<AnnotationDTOMapper, AnnotationDTO> implements AnnotationDTOService {
|
||||
|
||||
|
||||
}
|
|
@ -9,9 +9,6 @@ import com.muyu.domain.req.SourceReq;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
@ -46,32 +43,11 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
|||
return delete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updataSource(Source sourceReq) {
|
||||
Integer i= sourceMapper.updataSource(sourceReq);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int connectionTest(Source source) {
|
||||
String host = source.getHost();
|
||||
String port = source.getPort();
|
||||
String databaseName = source.getDatabaseName();
|
||||
String databaseType = source.getDatabaseType();
|
||||
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + source.getConnectionParams();
|
||||
String user = source.getUsername();
|
||||
String password = source.getPassword();
|
||||
Connection conn = null;
|
||||
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
// @Override
|
||||
// public int updataSource(Source sourceReq) {
|
||||
// LambdaQueryWrapper<Source> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// int update = sourceMapper.update(lambdaQueryWrapper);
|
||||
// return update;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.cloud.etl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.etl.mapper.SourceTypeMapper;
|
||||
import com.muyu.cloud.etl.mapper.SysJobMapper;
|
||||
import com.muyu.cloud.etl.service.SourceTypeService;
|
||||
import com.muyu.cloud.etl.service.SysJobService;
|
||||
import com.muyu.domain.SourceType;
|
||||
import com.muyu.domain.job.SysJob;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.etl.service.impl
|
||||
* @ClassName:SysJobServiceImpl
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/22 0:35
|
||||
*/
|
||||
@Service
|
||||
public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> implements SysJobService {
|
||||
@Override
|
||||
public List<SysJob> selectJobList(SysJob job) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysJob selectJobById(Long jobId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int changeStatus(SysJob job) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.cloud.rule.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.rule.Rule;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @PackageName:com.muyu.cloud.rule
|
||||
* @ClassName:RuleController
|
||||
* @Description:
|
||||
* @author: ¥陈思豪¥
|
||||
* @date: 2024/8/22 2:10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
public class RuleController {
|
||||
@Autowired
|
||||
private RuleService ruleService;
|
||||
|
||||
/**
|
||||
* 规则列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "查看规则", description = "规则")
|
||||
public Result<List<Rule>> select(@RequestBody Rule rule) {
|
||||
return Result.success(ruleService.select(rule));
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则修改
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/update")
|
||||
public Result update(@RequestBody Rule rule) {
|
||||
return Result.success(ruleService.updateById(rule));
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/delete")
|
||||
public Result delete(@RequestParam Integer id) {
|
||||
return Result.success(ruleService.removeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则添加
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/insert")
|
||||
public Result insert(@RequestBody Rule rule) {
|
||||
return Result.success(ruleService.save(rule));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.cloud.rule.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.rule.Rule;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RuleMapper extends BaseMapper<Rule> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.cloud.rule.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.rule.Rule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RuleService extends IService<Rule> {
|
||||
/**
|
||||
* 列表
|
||||
* @param rule
|
||||
* @return
|
||||
*/
|
||||
List<Rule> select(Rule rule);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.cloud.rule.service.impl
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import com.muyu.cloud.rule.mapper.RuleMapper
|
||||
import com.muyu.cloud.rule.service.RuleService
|
||||
import com.muyu.domain.SourceType
|
||||
import com.muyu.domain.rule.Rule
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
public class RuleServiceImpl extends ServiceImpl<RuleMapper, Rule> implements RuleService {
|
||||
|
||||
@Override
|
||||
public List<Rule> select(Rule rule) {
|
||||
LambdaQueryWrapper<Rule> sourceTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
return this.list(sourceTypeLambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.116.184.54:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: cloud-2112
|
||||
namespace: text
|
||||
# Spring
|
||||
spring:
|
||||
|
||||
|
|
|
@ -21,27 +21,7 @@
|
|||
<sql id="selectSourceList">
|
||||
select id, data_resource_name,username,password, data_sources_system_name, host, port, database_type, database_name, init_link_num, max_link_num, max_wait_time, max_wait_times,connection_params, remark from source
|
||||
</sql>
|
||||
<update id="updataSource">
|
||||
update source
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dataResourceName != null">data_resource_name = #{dataResourceName},</if>
|
||||
<if test="dataSourcesSystemName != null">data_sources_system_name = #{dataSourcesSystemName},</if>
|
||||
<if test="host != null">host = #{host},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="databaseType != null">database_type = #{databaseType},</if>
|
||||
<if test="databaseName != null">database_name = #{databaseName},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="initLinkNum != null">init_link_num = #{initLinkNum},</if>
|
||||
<if test="maxLinkNum != null">max_link_num = #{maxLinkNum},</if>
|
||||
<if test="maxWaitTime != null">max_wait_time = #{maxWaitTime},</if>
|
||||
<if test="maxWaitTimes != null">max_wait_times = #{maxWaitTimes},</if>
|
||||
<if test="connectionParams != null">connection_params = #{connectionParams},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- <select id="selectSourceList" resultType="com.muyu.domain.Source">-->
|
||||
<!-- <select id="selectSourceList" resultType="com.muyu.domain.Source">-->
|
||||
<!-- -->
|
||||
<!-- </select>-->
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue