Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
3fcf565e
提交
3fcf565e
authored
4月 24, 2022
作者:
Administrator
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
style : 调整代码格式
上级
6f940765
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
6 行增加
和
518 行删除
+6
-518
MapController.java
app/src/main/java/com/yiring/app/web/map/MapController.java
+5
-7
User.java
...-auth/src/main/java/com/yiring/auth/domain/user/User.java
+1
-0
Excel.java
...til/src/main/java/com/yiring/common/annotation/Excel.java
+0
-177
Excels.java
...il/src/main/java/com/yiring/common/annotation/Excels.java
+0
-16
Convert.java
...on/util/src/main/java/com/yiring/common/text/Convert.java
+0
-0
DateUtils.java
.../src/main/java/com/yiring/common/util/date/DateUtils.java
+0
-166
FileTypeUtils.java
.../main/java/com/yiring/common/util/file/FileTypeUtils.java
+0
-69
ImageUtils.java
...src/main/java/com/yiring/common/util/file/ImageUtils.java
+0
-67
ExcelHandlerAdapter.java
.../java/com/yiring/common/util/poi/ExcelHandlerAdapter.java
+0
-16
ExcelUtils.java
.../src/main/java/com/yiring/common/util/poi/ExcelUtils.java
+0
-0
ReflectUtils.java
...ain/java/com/yiring/common/util/reflect/ReflectUtils.java
+0
-0
没有找到文件。
app/src/main/java/com/yiring/app/web/map/MapController.java
浏览文件 @
3fcf565e
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
map
;
import
com.yiring.auth.util.ZyUtil
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -31,10 +29,10 @@ public class MapController {
@GetMapping
(
"/mapSelect"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"orgId"
,
required
=
true
,
name
=
"orgId"
)
})
public
Result
<
Serializable
>
fail
(
String
orgId
)
{
Result
<
Serializable
>
result
=
ZyUtil
.
getRequest
(
"/positionApi/api/area/allList/"
,
orgId
,
3000
);
if
(
result
.
getCode
()
!=
200
)
{
Result
.
no
(
Status
.
BAD_REQUEST
,
result
.
getMessage
());
}
return
Result
.
ok
(
result
.
getBody
()
);
//
Result<Serializable> result = ZyUtil.getRequest("/positionApi/api/area/allList/", orgId, 3000);
//
if (result.getCode() != 200) {
//
Result.no(Status.BAD_REQUEST, result.getMessage());
//
}
return
Result
.
ok
();
}
}
basic-auth/src/main/java/com/yiring/auth/domain/user/User.java
浏览文件 @
3fcf565e
...
...
@@ -3,6 +3,7 @@ package com.yiring.auth.domain.user;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.role.Role
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.domain.BasicEntity
;
...
...
basic-common/util/src/main/java/com/yiring/common/annotation/Excel.java
deleted
100644 → 0
浏览文件 @
6f940765
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
com.yiring.common.util.poi.ExcelHandlerAdapter
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.math.BigDecimal
;
/**
* 自定义导出Excel数据注解
*
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
Excel
{
/**
* 导出时在excel中排序
*/
int
sort
()
default
Integer
.
MAX_VALUE
;
/**
* 导出到Excel中的名字.
*/
String
name
()
default
""
;
/**
* 日期格式, 如: yyyy-MM-dd
*/
String
dateFormat
()
default
""
;
/**
* 如果是字典类型,请设置字典的type值 (如: user_sex)
*/
String
dictType
()
default
""
;
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
String
readConverterExp
()
default
""
;
/**
* 分隔符,读取字符串组内容
*/
String
separator
()
default
","
;
/**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/
int
scale
()
default
-
1
;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
int
roundingMode
()
default
BigDecimal
.
ROUND_HALF_EVEN
;
/**
* 导出类型(0数字 1字符串)
*/
ColumnType
cellType
()
default
ColumnType
.
STRING
;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
double
height
()
default
14
;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
double
width
()
default
16
;
/**
* 文字后缀,如% 90 变成90%
*/
String
suffix
()
default
""
;
/**
* 当值为空时,字段的默认值
*/
String
defaultValue
()
default
""
;
/**
* 提示信息
*/
String
prompt
()
default
""
;
/**
* 设置只能选择不能输入的列内容.
*/
String
[]
combo
()
default
{};
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
boolean
isExport
()
default
true
;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
String
targetAttr
()
default
""
;
/**
* 是否自动统计数据,在最后追加一行统计数据总和
*/
boolean
isStatistics
()
default
false
;
/**
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
*/
Align
align
()
default
Align
.
AUTO
;
/**
* 自定义数据处理器
*/
Class
<?>
handler
()
default
ExcelHandlerAdapter
.
class
;
/**
* 自定义数据处理器参数
*/
String
[]
args
()
default
{};
enum
Align
{
AUTO
(
0
),
LEFT
(
1
),
CENTER
(
2
),
RIGHT
(
3
);
private
final
int
value
;
Align
(
int
value
)
{
this
.
value
=
value
;
}
public
int
value
()
{
return
this
.
value
;
}
}
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
Type
type
()
default
Type
.
ALL
;
enum
Type
{
ALL
(
0
),
EXPORT
(
1
),
IMPORT
(
2
);
private
final
int
value
;
Type
(
int
value
)
{
this
.
value
=
value
;
}
int
value
()
{
return
this
.
value
;
}
}
enum
ColumnType
{
NUMERIC
(
0
),
STRING
(
1
),
IMAGE
(
2
);
private
final
int
value
;
ColumnType
(
int
value
)
{
this
.
value
=
value
;
}
int
value
()
{
return
this
.
value
;
}
}
}
basic-common/util/src/main/java/com/yiring/common/annotation/Excels.java
deleted
100644 → 0
浏览文件 @
6f940765
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Excel注解集
*/
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Excels
{
Excel
[]
value
();
}
basic-common/util/src/main/java/com/yiring/common/text/Convert.java
deleted
100644 → 0
浏览文件 @
6f940765
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/date/DateUtils.java
deleted
100644 → 0
浏览文件 @
6f940765
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
date
;
import
java.lang.management.ManagementFactory
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.util.Date
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
/**
* 时间工具类
*/
public
class
DateUtils
extends
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
{
public
static
String
YYYY
=
"yyyy"
;
public
static
String
YYYY_MM
=
"yyyy-MM"
;
public
static
String
YYYY_MM_DD
=
"yyyy-MM-dd"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
private
static
final
String
[]
parsePatterns
=
{
"yyyy-MM-dd"
,
"yyyy-MM-dd HH:mm:ss"
,
"yyyy-MM-dd HH:mm"
,
"yyyy-MM"
,
"yyyy/MM/dd"
,
"yyyy/MM/dd HH:mm:ss"
,
"yyyy/MM/dd HH:mm"
,
"yyyy/MM"
,
"yyyy.MM.dd"
,
"yyyy.MM.dd HH:mm:ss"
,
"yyyy.MM.dd HH:mm"
,
"yyyy.MM"
,
};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public
static
Date
getNowDate
()
{
return
new
Date
();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public
static
String
getDate
()
{
return
dateTimeNow
(
YYYY_MM_DD
);
}
public
static
String
getTime
()
{
return
dateTimeNow
(
YYYY_MM_DD_HH_MM_SS
);
}
public
static
String
dateTimeNow
()
{
return
dateTimeNow
(
YYYYMMDDHHMMSS
);
}
public
static
String
dateTimeNow
(
final
String
format
)
{
return
parseDateToStr
(
format
,
new
Date
());
}
public
static
String
dateTime
(
final
Date
date
)
{
return
parseDateToStr
(
YYYY_MM_DD
,
date
);
}
public
static
String
parseDateToStr
(
final
String
format
,
final
Date
date
)
{
return
new
SimpleDateFormat
(
format
).
format
(
date
);
}
public
static
Date
dateTime
(
final
String
format
,
final
String
ts
)
{
try
{
return
new
SimpleDateFormat
(
format
).
parse
(
ts
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
/**
* 日期路径 即年/月/日 如2018/08/08
*/
public
static
String
datePath
()
{
Date
now
=
new
Date
();
return
DateFormatUtils
.
format
(
now
,
"yyyy/MM/dd"
);
}
/**
* 日期路径 即年/月/日 如20180808
*/
public
static
String
dateTime
()
{
Date
now
=
new
Date
();
return
DateFormatUtils
.
format
(
now
,
"yyyyMMdd"
);
}
/**
* 日期型字符串转化为日期 格式
*/
public
static
Date
parseDate
(
Object
str
)
{
if
(
str
==
null
)
{
return
null
;
}
try
{
return
parseDate
(
str
.
toString
(),
parsePatterns
);
}
catch
(
ParseException
e
)
{
return
null
;
}
}
/**
* 获取服务器启动时间
*/
public
static
Date
getServerStartDate
()
{
long
time
=
ManagementFactory
.
getRuntimeMXBean
().
getStartTime
();
return
new
Date
(
time
);
}
/**
* 计算两个时间差
*/
public
static
String
getDatePoor
(
Date
endDate
,
Date
nowDate
)
{
long
nd
=
1000
*
24
*
60
*
60
;
long
nh
=
1000
*
60
*
60
;
long
nm
=
1000
*
60
;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long
diff
=
endDate
.
getTime
()
-
nowDate
.
getTime
();
// 计算差多少天
long
day
=
diff
/
nd
;
// 计算差多少小时
long
hour
=
diff
%
nd
/
nh
;
// 计算差多少分钟
long
min
=
diff
%
nd
%
nh
/
nm
;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return
day
+
"天"
+
hour
+
"小时"
+
min
+
"分钟"
;
}
/**
* 增加 LocalDateTime ==> Date
*/
public
static
Date
toDate
(
LocalDateTime
temporalAccessor
)
{
ZonedDateTime
zdt
=
temporalAccessor
.
atZone
(
ZoneId
.
systemDefault
());
return
Date
.
from
(
zdt
.
toInstant
());
}
/**
* 增加 LocalDate ==> Date
*/
public
static
Date
toDate
(
LocalDate
temporalAccessor
)
{
LocalDateTime
localDateTime
=
LocalDateTime
.
of
(
temporalAccessor
,
LocalTime
.
of
(
0
,
0
,
0
));
ZonedDateTime
zdt
=
localDateTime
.
atZone
(
ZoneId
.
systemDefault
());
return
Date
.
from
(
zdt
.
toInstant
());
}
}
basic-common/util/src/main/java/com/yiring/common/util/file/FileTypeUtils.java
deleted
100644 → 0
浏览文件 @
6f940765
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
file
;
import
java.io.File
;
import
org.apache.commons.lang3.StringUtils
;
/**
* 文件类型工具类
*/
public
class
FileTypeUtils
{
/**
* 获取文件类型
* <p>
* 例如: ruoyi.txt, 返回: txt
*
* @param file 文件名
* @return 后缀(不含".")
*/
public
static
String
getFileType
(
File
file
)
{
if
(
null
==
file
)
{
return
StringUtils
.
EMPTY
;
}
return
getFileType
(
file
.
getName
());
}
/**
* 获取文件类型
* <p>
* 例如: ruoyi.txt, 返回: txt
*
* @param fileName 文件名
* @return 后缀(不含".")
*/
public
static
String
getFileType
(
String
fileName
)
{
int
separatorIndex
=
fileName
.
lastIndexOf
(
"."
);
if
(
separatorIndex
<
0
)
{
return
""
;
}
return
fileName
.
substring
(
separatorIndex
+
1
).
toLowerCase
();
}
/**
* 获取文件类型
*
* @param photoByte 文件字节码
* @return 后缀(不含".")
*/
public
static
String
getFileExtendName
(
byte
[]
photoByte
)
{
String
strFileExtendName
=
"JPG"
;
if
(
(
photoByte
[
0
]
==
71
)
&&
(
photoByte
[
1
]
==
73
)
&&
(
photoByte
[
2
]
==
70
)
&&
(
photoByte
[
3
]
==
56
)
&&
((
photoByte
[
4
]
==
55
)
||
(
photoByte
[
4
]
==
57
))
&&
(
photoByte
[
5
]
==
97
)
)
{
strFileExtendName
=
"GIF"
;
}
else
if
((
photoByte
[
6
]
==
74
)
&&
(
photoByte
[
7
]
==
70
)
&&
(
photoByte
[
8
]
==
73
)
&&
(
photoByte
[
9
]
==
70
))
{
strFileExtendName
=
"JPG"
;
}
else
if
((
photoByte
[
0
]
==
66
)
&&
(
photoByte
[
1
]
==
77
))
{
strFileExtendName
=
"BMP"
;
}
else
if
((
photoByte
[
1
]
==
80
)
&&
(
photoByte
[
2
]
==
78
)
&&
(
photoByte
[
3
]
==
71
))
{
strFileExtendName
=
"PNG"
;
}
return
strFileExtendName
;
}
}
basic-common/util/src/main/java/com/yiring/common/util/file/ImageUtils.java
deleted
100644 → 0
浏览文件 @
6f940765
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
file
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.Arrays
;
import
org.apache.poi.util.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* 图片处理工具类
*/
public
class
ImageUtils
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ImageUtils
.
class
);
public
static
byte
[]
getImage
(
String
imagePath
)
{
InputStream
is
=
getFile
(
imagePath
);
try
{
return
IOUtils
.
toByteArray
(
is
);
}
catch
(
Exception
e
)
{
log
.
error
(
"图片加载异常 {}"
,
e
);
return
null
;
}
finally
{
IOUtils
.
closeQuietly
(
is
);
}
}
public
static
InputStream
getFile
(
String
imagePath
)
{
try
{
byte
[]
result
=
readFile
(
imagePath
);
result
=
Arrays
.
copyOf
(
result
,
result
.
length
);
return
new
ByteArrayInputStream
(
result
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取图片异常 {}"
,
e
);
}
return
null
;
}
/**
* 读取文件为字节数据
*
* @param url 地址
* @return 字节数据
*/
public
static
byte
[]
readFile
(
String
url
)
{
InputStream
in
=
null
;
try
{
// 网络地址
URL
urlObj
=
new
URL
(
url
);
URLConnection
urlConnection
=
urlObj
.
openConnection
();
urlConnection
.
setConnectTimeout
(
30
*
1000
);
urlConnection
.
setReadTimeout
(
60
*
1000
);
urlConnection
.
setDoInput
(
true
);
in
=
urlConnection
.
getInputStream
();
return
IOUtils
.
toByteArray
(
in
);
}
catch
(
Exception
e
)
{
log
.
error
(
"访问文件异常 {}"
,
e
);
return
null
;
}
finally
{
IOUtils
.
closeQuietly
(
in
);
}
}
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelHandlerAdapter.java
deleted
100644 → 0
浏览文件 @
6f940765
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
poi
;
/**
* Excel数据格式处理适配器
*/
public
interface
ExcelHandlerAdapter
{
/**
* 格式化
*
* @param value 单元格数据值
* @param args excel注解args参数组
* @return 处理后的值
*/
Object
format
(
Object
value
,
String
[]
args
);
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelUtils.java
deleted
100644 → 0
浏览文件 @
6f940765
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/reflect/ReflectUtils.java
deleted
100644 → 0
浏览文件 @
6f940765
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论