Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
ceb8f918
Commit
ceb8f918
authored
Apr 14, 2020
by
东州 翁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改良正则表达式
parent
73e3c637
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
25 deletions
+27
-25
src/main/java/cn/timer/api/config/enuminterface/YgEnumInterface.java
+23
-23
src/main/java/cn/timer/api/controller/yggl/YgglController.java
+0
-1
src/main/java/cn/timer/api/dto/yggl/YgjgDto.java
+4
-1
No files found.
src/main/java/cn/timer/api/config/enuminterface/YgEnumInterface.java
View file @
ceb8f918
...
...
@@ -16,7 +16,6 @@ import java.util.regex.Pattern;
import
cn.timer.api.dto.yggl.YgbintuDto
;
import
lombok.Getter
;
import
net.sf.ehcache.search.expression.Between
;
/**
* @date 2020年3月23日
...
...
@@ -113,31 +112,32 @@ public interface YgEnumInterface {
}
public
static
String
tranTime
(
String
index
)
{
DateFormat
zhenFormat
=
new
SimpleDateFormat
(
ZHEN
.
name
);
String
result
=
zhenFormat
.
format
(
new
Date
());
if
(
index
==
null
||
index
.
length
()
==
0
)
return
result
;
Pattern
pattern
=
Pattern
.
compile
(
"^[0-9]{8}$"
);
if
(
pattern
.
matcher
(
index
).
matches
())
{
result
=
index
.
substring
(
0
,
4
)
+
"-"
+
index
.
substring
(
4
,
6
)
+
"-"
+
index
.
substring
(
6
,
8
);
return
result
;
}
String
s
=
index
.
replaceAll
(
"([1-9]+[0-9]*|0)(\\.[\\d]+)?"
,
""
);
for
(
rzTime
item
:
rzTime
.
values
())
{
if
(
s
.
indexOf
(
item
.
type
)
!=
-
1
)
{
DateFormat
dateFormat
=
new
SimpleDateFormat
(
item
.
name
);
try
{
result
=
new
SimpleDateFormat
(
ZHEN
.
name
).
format
(
dateFormat
.
parse
(
index
));
return
result
;
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
return
result
;
}
}
}
return
result
;
//String str ="2013/11/12";
String
p
=
"年|月|日|号|时|/|//-"
;
String
result
=
index
.
replaceAll
(
p
,
"-"
);
String
p2
=
"-$"
;
String
result2
=
result
.
replaceAll
(
p2
,
""
);
return
result2
;
}
/*
* public static String tranTime(String index) { DateFormat zhenFormat = new
* SimpleDateFormat(ZHEN.name); String result = zhenFormat.format(new Date());
* if (index == null || index.length() == 0) return result; Pattern pattern =
* Pattern.compile("^[0-9]{8}$"); if (pattern.matcher(index).matches()) { result
* = index.substring(0, 4) + "-" + index.substring(4, 6) + "-" +
* index.substring(6, 8); return result; } String s =
* index.replaceAll("([1-9]+[0-9]*|0)(\\.[\\d]+)?", ""); for (rzTime item :
* rzTime.values()) { if (s.indexOf(item.type) != -1) { DateFormat dateFormat =
* new SimpleDateFormat(item.name); try { result = new
* SimpleDateFormat(ZHEN.name).format(dateFormat.parse(index)); return result; }
* catch (ParseException e) { e.printStackTrace(); return result; } } } return
* result; }
*/
public
static
String
tranTime2
(
String
result
)
{
String
isYear
=
"^(?:(?!0000)[0-9]{4} -(?:(?:0[1-9]|1[0-2]) -(?:0[1-9]|1[0-9]|2[0-8]) |(?:0[13-9]|1[0-2]) -(?:29|30) |(?:0[13578]|1[02]) -31 )|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00) -02 -29 )$"
;
Pattern
pattern
=
Pattern
.
compile
(
isYear
);
...
...
src/main/java/cn/timer/api/controller/yggl/YgglController.java
View file @
ceb8f918
...
...
@@ -1513,7 +1513,6 @@ public class YgglController {
Integer
type
=
ygjgDto
.
getType
();
Integer
upId
=
ygjgDto
.
getJgid
();
List
<
YgjgDto
>
maps
=
new
ArrayList
<
YgjgDto
>();
if
(
type
==
1
)
{
// 省份
List
<
YgProDto
>
list
=
new
LambdaQueryChainWrapper
<
YgProDto
>(
ygProDtoMapper
)
.
select
(
YgProDto:
:
getId
,
YgProDto:
:
getProvince
,
YgProDto:
:
getName
).
orderByAsc
(
YgProDto:
:
getProvince
)
...
...
src/main/java/cn/timer/api/dto/yggl/YgjgDto.java
View file @
ceb8f918
...
...
@@ -6,6 +6,8 @@
package
cn
.
timer
.
api
.
dto
.
yggl
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.persistence.Transient
;
...
...
@@ -26,7 +28,7 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
YgjgDto
implements
Serializable
{
public
class
YgjgDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -44,4 +46,5 @@ public class YgjgDto implements Serializable {
@TableField
(
exist
=
false
)
private
String
jgname
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment