parent
eac6deb84e
commit
4287429779
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
(xjs专用版) 若依28900行代码
|
||||
数据库文件在本机电脑上
|
||||
|
||||
* 采用前后端分离的模式,微服务版本前端(基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue))。
|
||||
* 后端采用Spring Boot、Spring Cloud & Alibaba。
|
||||
|
|
@ -128,4 +129,4 @@ com.ruoyi
|
|||
|
||||
## 若依微服务交流群
|
||||
|
||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) 点击按钮入群。
|
||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=yqInfq0S) [](https://jq.qq.com/?_wv=1027&k=Oy1mb3p8) [](https://jq.qq.com/?_wv=1027&k=rvxkJtXK) [](https://jq.qq.com/?_wv=1027&k=0Ck3PvTe) [](https://jq.qq.com/?_wv=1027&k=FnHHP4TT) [](https://jq.qq.com/?_wv=1027&k=qdT1Ojpz) 点击按钮入群。
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
//加密
|
||||
export function encryption(data) {
|
||||
return request({
|
||||
url: '/openapi/md5/encryption',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
//解密
|
||||
export function decrypt(data) {
|
||||
return request({
|
||||
url: '/openapi/md5/decrypt',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="hover">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>MD5解密说明</span>
|
||||
</div>
|
||||
<ul style="font-size: 13px;color: #999999">
|
||||
<li>MD5再次申明没有解密的方法,最好的反驳就是:数据源是无穷尽的,而 MD5密文是有限的。</li>
|
||||
<li>本工具是采用先加密存储,然后再反查询,上千 PB 级别毫秒级响应。</li>
|
||||
<li>16位 MD5和32位 MD5区别是取的是8~24位。</li>
|
||||
<li>目前 MD5 数据正在拓展,拓展一个量级会同步到工具中来。</li>
|
||||
</ul>
|
||||
</el-card>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<el-col :span="12">
|
||||
<at-input v-model="SourceValue" placeholder="请输入" size="large" :maxlength="20" append-button>
|
||||
<template slot="append">
|
||||
<i class="icon icon-search" @click="encryption">加密</i>
|
||||
</template>
|
||||
</at-input>
|
||||
</el-col>
|
||||
|
||||
<el-form :inline="true">
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="32位">
|
||||
<at-input v-model="targetValue32"></at-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="16位">
|
||||
<at-input v-model="targetValue16"></at-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<el-col :span="24">
|
||||
<at-input v-model="md5Value" placeholder="请输入" size="large" :maxlength="32" append-button>
|
||||
<template slot="append">
|
||||
<i class="icon icon-search" @click="decrypt">解密</i>
|
||||
</template>
|
||||
</at-input>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {decrypt, encryption} from "@/api/business/tools/md5";
|
||||
|
||||
export default {
|
||||
name: "index",
|
||||
|
||||
data() {
|
||||
return {
|
||||
SourceValue: null,
|
||||
targetValue16: null,
|
||||
targetValue32: null,
|
||||
|
||||
md5Value: '',
|
||||
|
||||
//解密值
|
||||
decryptValue: null,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
encryption() {
|
||||
let data = {
|
||||
str: this.SourceValue
|
||||
}
|
||||
encryption(data).then(res => {
|
||||
this.targetValue16 = res.data.target16
|
||||
this.targetValue32 = res.data.target32
|
||||
this.$modal.notifySuccess("加密成功")
|
||||
})
|
||||
},
|
||||
|
||||
decrypt() {
|
||||
let data = {
|
||||
str: this.md5Value
|
||||
}
|
||||
decrypt(data).then(res => {
|
||||
this.decryptValue = res.msg
|
||||
this.$alert(this.decryptValue, '解密成功啦', {
|
||||
confirmButtonText: '确定',
|
||||
});
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,286 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-descriptions title="什么是正则表达式?">
|
||||
<el-descriptions-item label="描述" contentStyle="color: #999999">
|
||||
在编写处理字符串的程序或网页时,经常有查找符合某些复杂规则的字符串的需要。正则表达式就是用于描述这些规则的工具。换句话说,正则表达式就是记录文本规则的代码。
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<div>
|
||||
<el-col :span="24">常用的正则表达式</el-col>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('[1-9]\\d*.\\d*|0\\.\\d*[1-9]\\d*')">中文字符</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('[^\x00-\xff]')">双字节字符</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('\\s')">空白行</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}')">
|
||||
Email地址
|
||||
</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('^((https|http|ftp|rtsp|mms)?:\\/\\/)[^\\s]+')">网址URL</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('0?(13|14|15|18|17)[0-9]{9}')">手机(国内)</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('[0-9-()()]{7,18}')">电话号码(国内)</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('-([1-9]\\d*.\\d*|0\\.\\d*[1-9]\\d*)')">负浮点数</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('-?[1-9]\\d*')">匹配整数</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('[1-9]\\d*.\\d*|0\\.\\d*[1-9]\\d*')">正浮点数</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('[1-9]([0-9]{4,10})')">腾讯QQ号</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('\\d{6}')">邮政编码</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow
|
||||
@click="print('(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)')">
|
||||
IP地址
|
||||
</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('\\d{17}[\\d|x]|\\d{15}')">身份证号</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('\\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2}')">格式日期</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('[1-9]\\d*')">正整数</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('-[1-9]\\d*')">负整数</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<at-button type="error" hollow @click="print('^<([a-z]+)([^<]+)*(?:>(.*)<\\/\\1>|\\s+\\/>)$')">HTML标签</at-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<el-col :span="24">
|
||||
<el-input
|
||||
v-model="input"
|
||||
>
|
||||
</el-input>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="50" style="margin-top: 20px">
|
||||
<el-col :span="8">
|
||||
<template>
|
||||
<el-table
|
||||
:data="one"
|
||||
style="width: 100%">
|
||||
<el-table-column label="常用元字符" align="center">
|
||||
<el-table-column align="center"
|
||||
prop="code"
|
||||
label="代码"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column align="center"
|
||||
prop="explanation"
|
||||
label="说明"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<template>
|
||||
<el-table
|
||||
:data="two"
|
||||
style="width: 100%">
|
||||
<el-table-column label="常用限定符" align="center">
|
||||
<el-table-column align="center"
|
||||
prop="code"
|
||||
label="代码/语法"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column align="center"
|
||||
prop="explanation"
|
||||
label="说明"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<template>
|
||||
<el-table
|
||||
:data="three"
|
||||
style="width: 100%">
|
||||
<el-table-column label="常用反义词" align="center">
|
||||
<el-table-column align="center"
|
||||
prop="code"
|
||||
label="代码/语法"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column align="center"
|
||||
prop="explanation"
|
||||
label="说明"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Regex",
|
||||
|
||||
data() {
|
||||
return {
|
||||
input: '',
|
||||
|
||||
one: [{
|
||||
code: '.',
|
||||
explanation: '匹配除换行符以外的任意字符',
|
||||
}, {
|
||||
code: '\\w',
|
||||
explanation: '匹配字母或数字或下划线',
|
||||
}, {
|
||||
code: '\\s',
|
||||
explanation: '匹配任意的空白符',
|
||||
}, {
|
||||
code: '\\d',
|
||||
explanation: '匹配数字',
|
||||
},
|
||||
{
|
||||
code: '\\b',
|
||||
explanation: '匹配单词的开始或结束',
|
||||
},
|
||||
{
|
||||
code: '^',
|
||||
explanation: '匹配字符串的开始',
|
||||
},
|
||||
{
|
||||
code: '$',
|
||||
explanation: '匹配字符串的结束',
|
||||
},
|
||||
],
|
||||
|
||||
two :[{
|
||||
code: '*',
|
||||
explanation: '重复零次或更多次',
|
||||
}, {
|
||||
code: '+',
|
||||
explanation: '重复一次或更多次',
|
||||
}, {
|
||||
code: '?',
|
||||
explanation: '重复零次或一次',
|
||||
}, {
|
||||
code: '{n}',
|
||||
explanation: '重复n次',
|
||||
},
|
||||
{
|
||||
code: '{n,}',
|
||||
explanation: '重复n次或更多次',
|
||||
},
|
||||
{
|
||||
code: '{n,m}',
|
||||
explanation: '重复n到m次',
|
||||
},
|
||||
],
|
||||
|
||||
three :[{
|
||||
code: '\\W',
|
||||
explanation: '匹配任意不是字母,数字,下划线,汉字的字符',
|
||||
}, {
|
||||
code: '\\S',
|
||||
explanation: '匹配任意不是空白符的字符',
|
||||
}, {
|
||||
code: '\\D',
|
||||
explanation: '匹配任意非数字的字符',
|
||||
}, {
|
||||
code: '\\B',
|
||||
explanation: '匹配不是单词开头或结束的位置',
|
||||
},
|
||||
{
|
||||
code: '[^x]',
|
||||
explanation: '匹配除了x以外的任意字符',
|
||||
},
|
||||
{
|
||||
code: '[^aeiou]',
|
||||
explanation: '匹配除了aeiou这几个字母以外的任意字符',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
print(data) {
|
||||
this.input = data
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -42,4 +42,14 @@ public class RegexConst {
|
|||
* url正则
|
||||
*/
|
||||
public static final String URL_REGEX= "(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
|
||||
|
||||
/**
|
||||
* 16位md5正则
|
||||
*/
|
||||
public static final String MD5_16_REGEX= "([a-f\\d]{32}|[A-F\\d]{32})";
|
||||
|
||||
/**
|
||||
* 32位md5正则
|
||||
*/
|
||||
public static final String MD5_32_REGEX= "([a-f\\d]{16}|[A-F\\d]{16})";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class ApiLogController extends BaseController {
|
|||
@PostMapping("/export")
|
||||
@ApiOperation("导出日志列表")
|
||||
public void export(HttpServletResponse response, ApiLog apiLog) {
|
||||
startPage();
|
||||
List<ApiLog> list = apiLogService.selectApiLogList(apiLog);
|
||||
ExcelUtil<ApiLog> util = new ExcelUtil<ApiLog>(ApiLog.class);
|
||||
util.exportExcel(response, list, "日志数据");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.xjs.tools;
|
||||
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.security.annotation.RequiresLogin;
|
||||
import com.xjs.exception.BusinessException;
|
||||
import com.xjs.tools.domain.ToolMd5;
|
||||
import com.xjs.tools.service.ToolMd5Service;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.xjs.consts.RegexConst.*;
|
||||
|
||||
/**
|
||||
* md5工具Controller
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("md5")
|
||||
@Api(tags = "业务模块-md5加解密")
|
||||
@Log4j2
|
||||
@Validated
|
||||
public class ToolMd5Controller {
|
||||
|
||||
@Autowired
|
||||
private ToolMd5Service toolMd5Service;
|
||||
|
||||
|
||||
@GetMapping("encryption")
|
||||
@ApiOperation("加密md5")
|
||||
@Log(title = "加密md5")
|
||||
@RequiresLogin
|
||||
public AjaxResult encryption(@NotBlank(message = "参数不能为空") @Size(max = 20, message = "长度不能大于 20 字符") String str) {
|
||||
ToolMd5 md5 = toolMd5Service.encryption(str);
|
||||
return AjaxResult.success(md5);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("decrypt")
|
||||
@ApiOperation("解密md5")
|
||||
@Log(title = "解密md5")
|
||||
@RequiresLogin
|
||||
public AjaxResult decrypt(@NotBlank(message = "参数不能为空") @Size(max = 32, message = "长度不能大于 32 字符") String str) {
|
||||
boolean md516Regex = Pattern.matches(MD5_16_REGEX, str);
|
||||
boolean md532Regex = Pattern.matches(MD5_32_REGEX, str);
|
||||
|
||||
if (!md516Regex && !md532Regex) {
|
||||
throw new BusinessException("请输入正确的md5");
|
||||
}
|
||||
|
||||
String value = toolMd5Service.decrypt(str);
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
throw new BusinessException("解密未成功");
|
||||
}
|
||||
|
||||
return AjaxResult.success(value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.xjs.tools.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* md5工具实体类
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-05-10
|
||||
*/
|
||||
@Data
|
||||
public class ToolMd5 implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 来源字符
|
||||
*/
|
||||
@Excel(name = "来源字符")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 目标字符16位
|
||||
*/
|
||||
@Excel(name = "目标字符16位")
|
||||
private String target16;
|
||||
|
||||
/**
|
||||
* 目标字符32位
|
||||
*/
|
||||
@Excel(name = "目标字符32位")
|
||||
private String target32;
|
||||
|
||||
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.xjs.tools.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xjs.tools.domain.ToolMd5;
|
||||
|
||||
/**
|
||||
* md5工具mapper
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-05-10
|
||||
*/
|
||||
public interface ToolMd5Mapper extends BaseMapper<ToolMd5> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.xjs.tools.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjs.tools.domain.ToolMd5;
|
||||
|
||||
/**
|
||||
* md5工具service接口
|
||||
* @author xiejs
|
||||
* @since 2022-05-10
|
||||
*/
|
||||
public interface ToolMd5Service extends IService<ToolMd5> {
|
||||
|
||||
/**
|
||||
* 加密md5
|
||||
* @param str 来源字符串
|
||||
* @return 16位和32位md5
|
||||
*/
|
||||
ToolMd5 encryption(String str);
|
||||
|
||||
/**
|
||||
* 解密md5
|
||||
* @param str md5
|
||||
* @return 解密的字符串
|
||||
*/
|
||||
String decrypt(String str);
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.xjs.tools.service.impl;
|
||||
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjs.tools.domain.ToolMd5;
|
||||
import com.xjs.tools.mapper.ToolMd5Mapper;
|
||||
import com.xjs.tools.service.ToolMd5Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* md5工具service实现
|
||||
* @author xiejs
|
||||
* @since 2022-05-10
|
||||
*/
|
||||
@Service
|
||||
public class ToolMd5ServiceImpl extends ServiceImpl<ToolMd5Mapper, ToolMd5> implements ToolMd5Service {
|
||||
|
||||
@Override
|
||||
public ToolMd5 encryption(String str) {
|
||||
String md5Hex32 = DigestUtil.md5Hex(str);
|
||||
String md5Hex16 = DigestUtil.md5Hex16(str);
|
||||
|
||||
ToolMd5 toolMd5 = new ToolMd5();
|
||||
toolMd5.setSource(str);
|
||||
toolMd5.setTarget16(md5Hex16);
|
||||
toolMd5.setTarget32(md5Hex32);
|
||||
|
||||
try {
|
||||
LambdaQueryWrapper<ToolMd5> wrapper = new LambdaQueryWrapper<ToolMd5>()
|
||||
.eq(ToolMd5::getTarget16, toolMd5.getTarget16())
|
||||
.eq(ToolMd5::getTarget32, toolMd5.getTarget32());
|
||||
|
||||
ToolMd5 one = super.getOne(wrapper, false);
|
||||
if (Objects.isNull(one)) {
|
||||
super.save(toolMd5);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return toolMd5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decrypt(String str) {
|
||||
str = str.toLowerCase();
|
||||
|
||||
LambdaQueryWrapper<ToolMd5> wrapper = new LambdaQueryWrapper<ToolMd5>()
|
||||
.eq(ToolMd5::getTarget32, str)
|
||||
.or()
|
||||
.eq(ToolMd5::getTarget16, str);
|
||||
|
||||
ToolMd5 one = super.getOne(wrapper, false);
|
||||
|
||||
if (one != null) {
|
||||
return one.getSource();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.xjs.domain.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 待办对象 todo_list
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-05-07
|
||||
*/
|
||||
@Data
|
||||
public class TodoList implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 待办内容
|
||||
*/
|
||||
@Excel(name = "待办内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 颜色 #999999
|
||||
*/
|
||||
@Excel(name = "颜色 #999999")
|
||||
private String color;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Excel(name = "排序")
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
@Excel(name = "截止时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 是否完成 1:完成 2:未完成
|
||||
*/
|
||||
@Excel(name = "是否完成", readConverterExp = " 1=完成,2=未完成")
|
||||
private Integer success;
|
||||
|
||||
/**
|
||||
* 待办类别id
|
||||
*/
|
||||
@Excel(name = "待办类别id")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@Excel(name = "创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue