Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
o2oa
提交
5a41e138
o2oa
项目概览
此号慢热型
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5a41e138
编写于
11月 23, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix/wrapCopy
上级
3ac04111
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
116 addition
and
5 deletion
+116
-5
o2server/x_base_core_project/src/main/java/com/x/base/core/project/bean/WrapCopier.java
...rc/main/java/com/x/base/core/project/bean/WrapCopier.java
+17
-3
o2server/x_base_core_project/src/main/java/com/x/base/core/project/utils/time/BaseWorkTime.java
...java/com/x/base/core/project/utils/time/BaseWorkTime.java
+11
-2
o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionInDefinedHoliday.java
...semble/control/jaxrs/worktime/ActionInDefinedHoliday.java
+26
-0
o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionInDefinedWorkDay.java
...semble/control/jaxrs/worktime/ActionInDefinedWorkDay.java
+26
-0
o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/WorkTimeAction.java
...neral/assemble/control/jaxrs/worktime/WorkTimeAction.java
+36
-0
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/bean/WrapCopier.java
浏览文件 @
5a41e138
package
com.x.base.core.project.bean
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
org.apache.commons.beanutils.PropertyUtilsBean
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.reflect.FieldUtils
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.tools.ListTools
;
public
class
WrapCopier
<
T
,
W
>
{
...
...
@@ -46,9 +50,19 @@ public class WrapCopier<T, W> {
}
copyFields
.
stream
().
forEach
(
f
->
{
try
{
Object
o
=
propertyUtilsBean
.
getProperty
(
orig
,
f
);
if
(
null
!=
o
||
(!
ignoreNull
))
{
propertyUtilsBean
.
setProperty
(
dest
,
f
,
o
);
if
(
StringUtils
.
equals
(
f
,
JpaObject
.
IDCOLUMN
))
{
Field
field
=
FieldUtils
.
getField
(
orig
.
getClass
(),
f
,
true
);
if
(
null
!=
field
)
{
Object
o
=
FieldUtils
.
readField
(
field
,
orig
,
true
);
if
(
null
!=
o
||
(!
ignoreNull
))
{
propertyUtilsBean
.
setProperty
(
dest
,
f
,
o
);
}
}
}
else
{
Object
o
=
propertyUtilsBean
.
getProperty
(
orig
,
f
);
if
(
null
!=
o
||
(!
ignoreNull
))
{
propertyUtilsBean
.
setProperty
(
dest
,
f
,
o
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/utils/time/BaseWorkTime.java
浏览文件 @
5a41e138
...
...
@@ -2,6 +2,7 @@ package com.x.base.core.project.utils.time;
import
java.text.ParseException
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -196,7 +197,11 @@ public class BaseWorkTime {
return
false
;
}
private
boolean
inDefinedHoliday
(
Calendar
c
)
{
public
boolean
inDefinedHoliday
(
Date
d
)
{
return
this
.
inDefinedHoliday
(
DateUtils
.
toCalendar
(
d
));
}
public
boolean
inDefinedHoliday
(
Calendar
c
)
{
if
(
ArrayUtils
.
isNotEmpty
(
this
.
definedHolidays
))
{
if
(
ArrayUtils
.
indexOf
(
this
.
definedHolidays
,
DateFormatUtils
.
format
(
c
,
DATEPARTFORMATPATTERN
[
0
]))
>
ArrayUtils
.
INDEX_NOT_FOUND
)
{
...
...
@@ -206,7 +211,11 @@ public class BaseWorkTime {
return
false
;
}
private
boolean
inDefinedWorkday
(
Calendar
c
)
{
public
boolean
inDefinedWorkday
(
Date
d
)
{
return
this
.
inDefinedWorkday
(
DateUtils
.
toCalendar
(
d
));
}
public
boolean
inDefinedWorkday
(
Calendar
c
)
{
if
(
ArrayUtils
.
isNotEmpty
(
this
.
definedWorkdays
))
{
if
(
ArrayUtils
.
indexOf
(
this
.
definedWorkdays
,
DateFormatUtils
.
format
(
c
,
DATEPARTFORMATPATTERN
[
0
]))
>
ArrayUtils
.
INDEX_NOT_FOUND
)
{
...
...
o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionInDefinedHoliday.java
0 → 100644
浏览文件 @
5a41e138
package
com.x.general.assemble.control.jaxrs.worktime
;
import
java.util.Date
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.tools.DateTools
;
public
class
ActionInDefinedHoliday
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
date
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Date
value
=
DateTools
.
parse
(
date
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
Config
.
workTime
().
inDefinedHoliday
(
value
));
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/ActionInDefinedWorkDay.java
0 → 100644
浏览文件 @
5a41e138
package
com.x.general.assemble.control.jaxrs.worktime
;
import
java.util.Date
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.tools.DateTools
;
public
class
ActionInDefinedWorkDay
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
date
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Date
value
=
DateTools
.
parse
(
date
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
Config
.
workTime
().
inDefinedWorkday
(
value
));
result
.
setData
(
wo
);
return
result
;
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
o2server/x_general_assemble_control/src/main/java/com/x/general/assemble/control/jaxrs/worktime/WorkTimeAction.java
浏览文件 @
5a41e138
...
...
@@ -156,4 +156,40 @@ public class WorkTimeAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"返回指定时间是否定义为节假日."
,
action
=
ActionInDefinedHoliday
.
class
)
@GET
@Path
(
"indefinedholiday/{date}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
inDefinedHoliday
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"指定日期"
)
@PathParam
(
"date"
)
String
date
)
{
ActionResult
<
ActionInDefinedHoliday
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionInDefinedHoliday
().
execute
(
effectivePerson
,
date
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"返回指定时间是否定义为工作日."
,
action
=
ActionInDefinedWorkDay
.
class
)
@GET
@Path
(
"indefinedworkday/{date}"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
inDefinedWorkDay
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"指定日期"
)
@PathParam
(
"date"
)
String
date
)
{
ActionResult
<
ActionInDefinedWorkDay
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionInDefinedWorkDay
().
execute
(
effectivePerson
,
date
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录