Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d74c1cb7
authored
Sep 22, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]时间处理
1 parent
d3e2bff5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
14 deletions
platform-process/src/main/java/cn/com/glsx/process/modules/sop/SopHelper.java
platform-process/src/main/java/cn/com/glsx/process/modules/sop/SopHelper.java
View file @
d74c1cb
...
@@ -47,20 +47,32 @@ public class SopHelper {
...
@@ -47,20 +47,32 @@ public class SopHelper {
DistributedLockUtils
.
unlock
(
key
);
DistributedLockUtils
.
unlock
(
key
);
}
}
public
static
boolean
diffDay
(
Date
now
,
Integer
days
)
{
public
static
boolean
diffDay
(
Date
date
,
Integer
diff
days
)
{
DateFormat
dft
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
DateFormat
dft
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
try
{
String
end
=
dft
.
format
(
new
Date
());
String
star
=
dft
.
format
(
date
);
Date
star
=
dft
.
parse
(
"2020-02-03"
);
//开始时间
String
[]
star1
=
star
.
split
(
"-"
);
Date
endDay
=
dft
.
parse
(
"2025-03-02"
);
//结束时间
String
[]
end1
=
end
.
split
(
"-"
);
Long
starTime
=
star
.
getTime
();
int
days
=
0
;
Long
endTime
=
endDay
.
getTime
();
if
(
Integer
.
parseInt
(
star1
[
0
])
<
Integer
.
parseInt
(
end1
[
0
]))
{
return
(
endTime
-
starTime
)
/
24
/
60
/
60
/
1000
==
days
;
for
(
int
i
=
Integer
.
parseInt
(
star1
[
0
]);
i
<
Integer
.
parseInt
(
end1
[
0
]);
i
++)
{
}
catch
(
ParseException
e
)
{
//计算是否是瑞年
throw
new
RuntimeException
(
e
);
if
(
i
%
4
==
0
&&
i
%
100
!=
0
||
i
%
400
==
0
)
{
days
+=
366
;
}
else
{
days
+=
365
;
}
}
}
}
}
//得到开始那一年已过去的日期
int
starday
=
days
(
star1
[
0
],
star1
[
1
],
star1
[
2
]);
//得到结束那一年已过去的日期
int
endday
=
days
(
end1
[
0
],
end1
[
1
],
end1
[
2
]);
//减去开始那一年已过去的日期,加上结束那一年已过去的日期
days
=
days
-
starday
+
endday
;
return
days
==
diffdays
;
}
/**
/**
...
@@ -90,13 +102,12 @@ public class SopHelper {
...
@@ -90,13 +102,12 @@ public class SopHelper {
String
[]
split
=
nodeKey
.
split
(
"\\|"
);
String
[]
split
=
nodeKey
.
split
(
"\\|"
);
// 拿到过滤出阶段的客户
// 拿到过滤出阶段的客户
List
<
CustomerInfo
>
customerInfoList
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
resultData
.
get
(
split
[
0
])),
CustomerInfo
.
class
);
List
<
CustomerInfo
>
customerInfoList
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
resultData
.
get
(
split
[
0
])),
CustomerInfo
.
class
);
String
day
=
SopHelper
.
getValueFromJsonString
(
nodeParam
,
"day"
);
String
d
iffd
ay
=
SopHelper
.
getValueFromJsonString
(
nodeParam
,
"day"
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
day
))
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
d
iffd
ay
))
{
return
null
;
return
null
;
}
}
if
(
CollectionUtils
.
isNotEmpty
(
customerInfoList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
customerInfoList
))
{
return
customerInfoList
;
return
customerInfoList
.
stream
().
filter
(
index
->
SopHelper
.
diffDay
(
index
.
getSopJourneyStageEnterTime
(),
Integer
.
parseInt
(
diffday
))).
collect
(
Collectors
.
toList
());
/*return customerInfoList.stream().filter(index -> SopHelper.diffDay(index.getSopJourneyStageEnterTime(), Integer.getInteger(day))).collect(Collectors.toList());*/
}
}
return
null
;
return
null
;
}
}
...
@@ -221,4 +232,27 @@ public class SopHelper {
...
@@ -221,4 +232,27 @@ public class SopHelper {
paramsMap
.
add
(
"method"
,
method
);
paramsMap
.
add
(
"method"
,
method
);
paramsMap
.
add
(
"name"
,
"zhouhb"
);
paramsMap
.
add
(
"name"
,
"zhouhb"
);
}
}
public
static
int
days
(
String
year
,
String
month
,
String
day
)
{
int
days
=
0
;
int
nowyear
=
Integer
.
parseInt
(
year
);
int
[]
monthday
=
{
0
,
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
int
[]
monthday1
=
{
0
,
31
,
29
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
boolean
flag
=
true
;
if
(
nowyear
%
4
==
0
&&
nowyear
%
100
!=
0
||
nowyear
%
400
==
0
)
{
}
else
{
flag
=
false
;
}
for
(
int
i
=
0
;
i
<
Integer
.
parseInt
(
month
);
i
++)
{
if
(
flag
)
{
days
+=
monthday1
[
i
];
}
else
{
days
+=
monthday
[
i
];
}
}
days
+=
Integer
.
parseInt
(
day
);
return
days
;
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment