Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b1048a2f
由
zshaohui
编写于
2023-10-09 14:58:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.接口异常全部重发修改
2.出入库任务统计修改 3.看板数据展示修改
1 个父辈
c16db042
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
89 行增加
和
177 行删除
src/main/java/com/neotel/smfcore/core/hik/rest/InterfaceExceptionController.java
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
src/main/java/com/neotel/smfcore/hikvision/HikvisionKanBanController.java
src/main/java/com/neotel/smfcore/hikvision/service/dao/IHikTaskCountDao.java
src/main/java/com/neotel/smfcore/hikvision/service/dao/impl/HikTaskCountDaoImpl.java
src/main/java/com/neotel/smfcore/hikvision/service/manager/IHikTaskCountManager.java
src/main/java/com/neotel/smfcore/hikvision/service/manager/impl/HikTaskCountManagerImpl.java
src/main/java/com/neotel/smfcore/hikvision/service/po/TaskCount.java
src/main/java/com/neotel/smfcore/hikvision/util/ShiftUtil.java
src/main/java/com/neotel/smfcore/core/hik/rest/InterfaceExceptionController.java
查看文件 @
b1048a2
...
@@ -97,7 +97,7 @@ public class InterfaceExceptionController {
...
@@ -97,7 +97,7 @@ public class InterfaceExceptionController {
}
}
}
}
@ApiOperation
(
"全部重发"
)
@ApiOperation
(
"全部重发"
)
@
Pos
tMapping
(
"/reSendAll"
)
@
Ge
tMapping
(
"/reSendAll"
)
public
ResultBean
reSend
(
InterfaceExCriteria
criteria
)
{
public
ResultBean
reSend
(
InterfaceExCriteria
criteria
)
{
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
List
<
HikApiRequestError
>
requests
=
hikApiRequestErrorDao
.
findByQuery
(
query
);
List
<
HikApiRequestError
>
requests
=
hikApiRequestErrorDao
.
findByQuery
(
query
);
...
...
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
b1048a2
...
@@ -970,120 +970,4 @@ public class LiteOrderCache implements ITaskListener {
...
@@ -970,120 +970,4 @@ public class LiteOrderCache implements ITaskListener {
}
}
return
outPos
;
return
outPos
;
}
}
public
void
updateOrderProgress
(
LiteOrder
order
,
boolean
flag
)
{
try
{
if
(!
flag
)
{
if
(!
order
.
isClosed
())
{
return
;
}
}
else
{
if
(!
order
.
isNew
())
{
return
;
}
}
if
(
StringUtils
.
isNotBlank
(
order
.
getReplenishmentNo
()))
{
return
;
}
OrderProgress
progress
=
dataCache
.
getCache
(
Constants
.
CACHE_OrderProgress
);
if
(
progress
==
null
)
{
progress
=
initProgress
(
order
.
getOrderNo
());
}
else
{
//判断创建时间,是否在当前时间范围内
Date
createDate
=
progress
.
getCreateDate
();
Date
startDate
=
ShiftUtil
.
getShiftAStartDate
();
DateTime
endDate
=
DateUtil
.
offsetDay
(
startDate
,
1
);
//如果当前时间大于等于当天的白班开始日期,再判断工单记录的创建时间是否在今天范围内
if
(
System
.
currentTimeMillis
()
>=
startDate
.
getTime
()){
if
(
createDate
.
getTime
()
>=
startDate
.
getTime
()
&&
createDate
.
getTime
()
<
endDate
.
getTime
())
{
}
else
{
progress
=
initProgress
(
order
.
getOrderNo
());
}
}
}
Date
orderStartDate
=
order
.
getStartDate
();
String
orderStartDateStr
=
DateUtil
.
format
(
orderStartDate
,
"yyyy-MM-dd"
);
log
.
info
(
"工单:"
+
order
.
getOrderNo
()
+
"开工时间为:"
+
orderStartDateStr
+
"状态为:"
+
order
.
getStatus
());
if
(
ShiftUtil
.
isA
(
orderStartDate
))
{
if
(
order
.
isNew
())
{
log
.
info
(
"工单:"
+
order
.
getOrderNo
()
+
"属于白班新建,数量加1"
);
progress
.
setShiftAOrderCount
(
progress
.
getShiftAOrderCount
()
+
1
);
}
else
if
(
order
.
isClosed
())
{
log
.
info
(
"工单:"
+
order
.
getOrderNo
()
+
"属于白班关闭,数量加1"
);
progress
.
setShiftAOrderFinishedCount
(
progress
.
getShiftAOrderFinishedCount
()
+
1
);
}
}
else
if
(
ShiftUtil
.
isB
(
orderStartDate
))
{
if
(
order
.
isNew
())
{
log
.
info
(
"工单:"
+
order
.
getOrderNo
()
+
"属于夜班新建,数量加1"
);
progress
.
setShiftBOrderCount
(
progress
.
getShiftBOrderCount
()
+
1
);
}
else
if
(
order
.
isClosed
())
{
log
.
info
(
"工单:"
+
order
.
getOrderNo
()
+
"属于夜班新建,数量加1"
);
progress
.
setShiftBOrderFinishedCount
(
progress
.
getShiftBOrderFinishedCount
()
+
1
);
}
}
dataCache
.
updateCache
(
Constants
.
CACHE_OrderProgress
,
progress
);
}
catch
(
Exception
e
)
{
log
.
error
(
"更新工单信息报错"
,
e
);
e
.
printStackTrace
();
}
}
private
OrderProgress
initProgress
(
String
orderNo
)
{
OrderProgress
process
=
new
OrderProgress
();
Date
startDate
=
ShiftUtil
.
getShiftAStartDate
();
DateTime
endDate
=
DateUtil
.
offsetDay
(
startDate
,
1
);
Query
query
=
new
Query
(
Criteria
.
where
(
"startDate"
).
gte
(
startDate
).
lt
(
endDate
));
List
<
LiteOrder
>
liteOrderList
=
liteOrderManager
.
findByQuery
(
query
);
//A班工单数量
int
shiftAOrderCount
=
0
;
//B班工单数量
int
shiftBOrderCount
=
0
;
//A班工单完成数量
int
shiftAOrderFinishedCount
=
0
;
//B班工单完成数量
int
shiftBOrderFinishedCount
=
0
;
for
(
LiteOrder
order
:
liteOrderList
)
{
if
(
orderNo
.
equals
(
order
.
getOrderNo
()))
{
continue
;
}
if
(
StringUtils
.
isNotBlank
(
order
.
getReplenishmentNo
())){
continue
;
}
if
(
ShiftUtil
.
isA
(
order
.
getStartDate
()))
{
if
(
order
.
isClosed
())
{
shiftAOrderFinishedCount
=
shiftAOrderFinishedCount
+
1
;
}
shiftAOrderCount
=
shiftAOrderCount
+
1
;
}
else
{
if
(
order
.
isClosed
())
{
shiftBOrderFinishedCount
=
shiftBOrderFinishedCount
+
1
;
}
shiftBOrderCount
=
shiftBOrderCount
+
1
;
}
}
process
.
setShiftAOrderCount
(
shiftAOrderCount
);
process
.
setShiftBOrderCount
(
shiftBOrderCount
);
process
.
setShiftAOrderFinishedCount
(
shiftAOrderFinishedCount
);
process
.
setShiftBOrderFinishedCount
(
shiftBOrderFinishedCount
);
return
process
;
}
}
}
src/main/java/com/neotel/smfcore/hikvision/HikvisionKanBanController.java
查看文件 @
b1048a2
...
@@ -15,6 +15,8 @@ import com.neotel.smfcore.hikvision.service.manager.IHikTaskCountManager;
...
@@ -15,6 +15,8 @@ import com.neotel.smfcore.hikvision.service.manager.IHikTaskCountManager;
import
com.neotel.smfcore.hikvision.service.po.TaskCount
;
import
com.neotel.smfcore.hikvision.service.po.TaskCount
;
import
com.neotel.smfcore.hikvision.util.ShiftUtil
;
import
com.neotel.smfcore.hikvision.util.ShiftUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
import
com.neotel.smfcore.security.service.po.User
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
...
@@ -31,8 +33,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -31,8 +33,6 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Api
(
tags
=
"海康看板"
)
@Api
(
tags
=
"海康看板"
)
@Slf4j
@Slf4j
...
@@ -49,6 +49,9 @@ public class HikvisionKanBanController {
...
@@ -49,6 +49,9 @@ public class HikvisionKanBanController {
@Autowired
@Autowired
private
ILiteOrderManager
liteOrderManager
;
private
ILiteOrderManager
liteOrderManager
;
@Autowired
private
IUserManager
userManager
;
@ApiOperation
(
"获取库容信息"
)
@ApiOperation
(
"获取库容信息"
)
@GetMapping
(
"/getStorageInventoryInfo"
)
@GetMapping
(
"/getStorageInventoryInfo"
)
@AnonymousAccess
@AnonymousAccess
...
@@ -90,9 +93,15 @@ public class HikvisionKanBanController {
...
@@ -90,9 +93,15 @@ public class HikvisionKanBanController {
@AnonymousAccess
@AnonymousAccess
public
ResultBean
<
InOutDetailInfo
>
inOutDetail
(
@RequestParam
(
value
=
"date"
)
String
date
,
@RequestParam
(
value
=
"type"
)
String
type
)
{
public
ResultBean
<
InOutDetailInfo
>
inOutDetail
(
@RequestParam
(
value
=
"date"
)
String
date
,
@RequestParam
(
value
=
"type"
)
String
type
)
{
InOutDetailInfo
info
=
new
InOutDetailInfo
();
InOutDetailInfo
info
=
new
InOutDetailInfo
();
List
<
TaskCount
>
taskCountList
=
hikTaskCountManager
.
findTaskCountByDate
(
DateUtil
.
parse
(
date
,
"yyyy-MM-dd"
),
tru
e
);
List
<
TaskCount
>
taskCountList
=
hikTaskCountManager
.
findTaskCountByDate
Str
(
dat
e
);
if
(
taskCountList
!=
null
&&
!
taskCountList
.
isEmpty
())
{
if
(
taskCountList
!=
null
&&
!
taskCountList
.
isEmpty
())
{
for
(
TaskCount
taskCount
:
taskCountList
)
{
for
(
TaskCount
taskCount
:
taskCountList
)
{
//判断有没有别名,没有就跳过
User
user
=
userManager
.
findByUserName
(
taskCount
.
getName
());
if
(
user
==
null
||
StringUtils
.
isBlank
(
user
.
getOtherName
()))
{
continue
;
}
taskCount
.
setName
(
user
.
getOtherName
());
if
(
ShiftUtil
.
SHIFT_A
.
equals
(
taskCount
.
getShift
()))
{
if
(
ShiftUtil
.
SHIFT_A
.
equals
(
taskCount
.
getShift
()))
{
if
(
"1"
.
equals
(
type
))
{
if
(
"1"
.
equals
(
type
))
{
if
(
taskCount
.
getPutInCount
()
>
0
)
{
if
(
taskCount
.
getPutInCount
()
>
0
)
{
...
@@ -157,18 +166,20 @@ public class HikvisionKanBanController {
...
@@ -157,18 +166,20 @@ public class HikvisionKanBanController {
int
checkOutCount
=
0
;
int
checkOutCount
=
0
;
for
(
TaskCount
taskCount
:
taskCountList
)
{
for
(
TaskCount
taskCount
:
taskCountList
)
{
if
(
i
==
timeList
.
size
()
-
1
)
{
if
(
"1"
.
equals
(
type
)){
if
(
taskCount
.
getCreateDate
().
getTime
()
>
timeList
.
get
(
i
).
getTime
())
{
String
format
=
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
);
putInCount
=
putInCount
+
taskCount
.
getPutInCount
();
if
(
format
.
equals
(
taskCount
.
getDateStr
())){
checkOutCount
=
checkOutCount
+
taskCount
.
getCheckOutCount
();
putInCount
=
taskCount
.
getPutInCount
()
+
putInCount
;
}
checkOutCount
=
taskCount
.
getCheckOutCount
()
+
checkOutCount
;
}
else
{
}
if
(
taskCount
.
getCreateDate
().
getTime
()
>=
timeList
.
get
(
i
).
getTime
()
&&
taskCount
.
getCreateDate
().
getTime
()
<
timeList
.
get
(
i
+
1
).
getTime
())
{
}
else
{
putInCount
=
putInCount
+
taskCount
.
getPutInCount
();
String
format
=
DateUtil
.
format
(
date
,
"yyyy-MM"
);
checkOutCount
=
checkOutCount
+
taskCount
.
getCheckOutCount
();
String
dateStr
=
taskCount
.
getDateStr
();
}
if
(
StringUtils
.
isNotBlank
(
dateStr
)
&&
dateStr
.
startsWith
(
format
)){
}
putInCount
=
taskCount
.
getPutInCount
()
+
putInCount
;
checkOutCount
=
taskCount
.
getCheckOutCount
()
+
checkOutCount
;
}
}
}
}
detail
.
setPutInCount
(
putInCount
);
detail
.
setPutInCount
(
putInCount
);
...
@@ -229,7 +240,7 @@ public class HikvisionKanBanController {
...
@@ -229,7 +240,7 @@ public class HikvisionKanBanController {
//判断是否属于A班数据
//判断是否属于A班数据
Date
orderStartDate
=
order
.
getStartDate
();
Date
orderStartDate
=
order
.
getStartDate
();
boolean
shiftA
=
ShiftUtil
.
isA
(
orderStartDate
);
boolean
shiftA
=
ShiftUtil
.
is
Shift
A
(
orderStartDate
);
if
(
shiftA
)
{
if
(
shiftA
)
{
shiftAOrderCount
=
shiftAOrderCount
+
1
;
shiftAOrderCount
=
shiftAOrderCount
+
1
;
...
...
src/main/java/com/neotel/smfcore/hikvision/service/dao/IHikTaskCountDao.java
查看文件 @
b1048a2
...
@@ -7,7 +7,9 @@ import java.util.Date;
...
@@ -7,7 +7,9 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
public
interface
IHikTaskCountDao
extends
IBaseDao
{
public
interface
IHikTaskCountDao
extends
IBaseDao
{
TaskCount
getByOperatorAndShift
(
String
operator
,
String
shift
,
Date
createDate
);
TaskCount
getByOperatorAndShift
(
String
operator
,
String
shift
,
String
dateStr
);
List
<
TaskCount
>
findTaskCountByDate
(
Date
date
);
List
<
TaskCount
>
findTaskCountByDate
(
Date
date
);
List
<
TaskCount
>
findTaskCountByDateStr
(
String
dateStr
);
}
}
src/main/java/com/neotel/smfcore/hikvision/service/dao/impl/HikTaskCountDaoImpl.java
查看文件 @
b1048a2
...
@@ -18,12 +18,17 @@ public class HikTaskCountDaoImpl extends AbstractBaseDao implements IHikTaskCoun
...
@@ -18,12 +18,17 @@ public class HikTaskCountDaoImpl extends AbstractBaseDao implements IHikTaskCoun
}
}
@Override
@Override
public
TaskCount
getByOperatorAndShift
(
String
operator
,
String
shift
,
Date
createDate
)
{
public
TaskCount
getByOperatorAndShift
(
String
operator
,
String
shift
,
String
dateStr
)
{
return
findOne
(
new
Query
(
Criteria
.
where
(
"name"
).
is
(
operator
).
and
(
"shift"
).
is
(
shift
).
and
(
"
createDate"
).
gte
(
createDate
)));
return
findOne
(
new
Query
(
Criteria
.
where
(
"name"
).
is
(
operator
).
and
(
"shift"
).
is
(
shift
).
and
(
"
dateStr"
).
is
(
dateStr
)));
}
}
@Override
@Override
public
List
<
TaskCount
>
findTaskCountByDate
(
Date
date
)
{
public
List
<
TaskCount
>
findTaskCountByDate
(
Date
date
)
{
return
findByQuery
(
new
Query
(
Criteria
.
where
(
"createDate"
).
gte
(
date
)));
return
findByQuery
(
new
Query
(
Criteria
.
where
(
"createDate"
).
gte
(
date
)));
}
}
@Override
public
List
<
TaskCount
>
findTaskCountByDateStr
(
String
dateStr
)
{
return
findByQuery
(
new
Query
(
Criteria
.
where
(
"dateStr"
).
is
(
dateStr
)));
}
}
}
src/main/java/com/neotel/smfcore/hikvision/service/manager/IHikTaskCountManager.java
查看文件 @
b1048a2
...
@@ -13,4 +13,6 @@ public interface IHikTaskCountManager {
...
@@ -13,4 +13,6 @@ public interface IHikTaskCountManager {
void
updateInOutCount
(
DataLog
task
);
void
updateInOutCount
(
DataLog
task
);
List
<
TaskCount
>
findTaskCountByDate
(
Date
date
,
boolean
hasOtherName
);
List
<
TaskCount
>
findTaskCountByDate
(
Date
date
,
boolean
hasOtherName
);
List
<
TaskCount
>
findTaskCountByDateStr
(
String
dateStr
);
}
}
src/main/java/com/neotel/smfcore/hikvision/service/manager/impl/HikTaskCountManagerImpl.java
查看文件 @
b1048a2
...
@@ -28,36 +28,33 @@ public class HikTaskCountManagerImpl implements IHikTaskCountManager {
...
@@ -28,36 +28,33 @@ public class HikTaskCountManagerImpl implements IHikTaskCountManager {
private
IUserManager
userManager
;
private
IUserManager
userManager
;
@Override
@Override
public
void
updateInOutCount
(
DataLog
task
)
{
public
synchronized
void
updateInOutCount
(
DataLog
task
)
{
if
(
task
.
isFinished
())
{
if
(
task
.
isFinished
())
{
//获取到操作人,班次,和查询时间
//获取到操作人,班次,和查询时间
String
operator
=
task
.
getOperator
();
String
operator
=
task
.
getOperator
();
if
(
StringUtils
.
isBlank
(
operator
))
{
if
(
StringUtils
.
isBlank
(
operator
))
{
operator
=
"other"
;
operator
=
"other"
;
}
}
String
shift
=
""
;
Date
createDate
=
null
;
String
shift
=
""
;
//判断当前时间是否属于A班
//判断当前时间是否属于A班
Date
taskDate
=
task
.
getCreateDate
();
Date
taskDate
=
task
.
getUpdateDate
();
if
(
ShiftUtil
.
isA
(
taskDate
))
{
boolean
shiftA
=
ShiftUtil
.
isShiftA
(
taskDate
);
if
(
shiftA
){
shift
=
ShiftUtil
.
SHIFT_A
;
shift
=
ShiftUtil
.
SHIFT_A
;
createDate
=
ShiftUtil
.
getShiftAStartDate
();
}
else
{
}
else
{
shift
=
ShiftUtil
.
SHIFT_B
;
shift
=
ShiftUtil
.
SHIFT_B
;
if
(
taskDate
.
getTime
()
<
ShiftUtil
.
getShiftAStartDate
().
getTime
())
{
createDate
=
DateUtil
.
offsetDay
(
ShiftUtil
.
getShiftAStartDate
(),
-
1
);
}
else
{
createDate
=
ShiftUtil
.
getShiftAStartDate
();
}
}
}
String
dateStr
=
ShiftUtil
.
getDateStr
(
taskDate
);
//保存数据
//保存数据
TaskCount
taskCount
=
hikTaskCountDao
.
getByOperatorAndShift
(
operator
,
shift
,
createDate
);
TaskCount
taskCount
=
hikTaskCountDao
.
getByOperatorAndShift
(
operator
,
shift
,
dateStr
);
if
(
taskCount
==
null
)
{
if
(
taskCount
==
null
)
{
log
.
info
(
taskDate
+
"操作人:"
+
operator
+
"新建一条记录"
);
log
.
info
(
taskDate
+
"操作人:"
+
operator
+
"新建一条记录"
);
taskCount
=
new
TaskCount
();
taskCount
=
new
TaskCount
();
taskCount
.
setName
(
operator
);
taskCount
.
setName
(
operator
);
taskCount
.
setShift
(
shift
);
taskCount
.
setShift
(
shift
);
taskCount
.
setDateStr
(
dateStr
);
}
}
if
(
task
.
isPutInTask
())
{
if
(
task
.
isPutInTask
())
{
log
.
info
(
"姓名:"
+
operator
+
"班次:"
+
shift
+
",入库数量+1"
);
log
.
info
(
"姓名:"
+
operator
+
"班次:"
+
shift
+
",入库数量+1"
);
...
@@ -90,4 +87,9 @@ public class HikTaskCountManagerImpl implements IHikTaskCountManager {
...
@@ -90,4 +87,9 @@ public class HikTaskCountManagerImpl implements IHikTaskCountManager {
}
}
return
resultList
;
return
resultList
;
}
}
@Override
public
List
<
TaskCount
>
findTaskCountByDateStr
(
String
dateStr
)
{
return
hikTaskCountDao
.
findTaskCountByDateStr
(
dateStr
);
}
}
}
src/main/java/com/neotel/smfcore/hikvision/service/po/TaskCount.java
查看文件 @
b1048a2
...
@@ -16,6 +16,12 @@ public class TaskCount extends BasePo {
...
@@ -16,6 +16,12 @@ public class TaskCount extends BasePo {
*/
*/
private
String
name
;
private
String
name
;
/**
* 当前日期
*/
private
String
dateStr
;
/**
/**
* 入库数量
* 入库数量
*/
*/
...
...
src/main/java/com/neotel/smfcore/hikvision/util/ShiftUtil.java
查看文件 @
b1048a2
...
@@ -29,49 +29,49 @@ public class ShiftUtil {
...
@@ -29,49 +29,49 @@ public class ShiftUtil {
return
DateUtil
.
parse
(
currentDateStr
+
" "
+
SHIFT_A_START
,
"yyyy-MM-dd HH:mm:ss"
);
return
DateUtil
.
parse
(
currentDateStr
+
" "
+
SHIFT_A_START
,
"yyyy-MM-dd HH:mm:ss"
);
}
}
/**
/**
*
获取A班结束时间
*
判断是否属于A班范围内
*
*
* @param date
* @return
* @return
*/
*/
public
static
Date
getShiftAEndDate
()
{
public
static
boolean
isShiftA
(
Date
date
)
{
String
currentDateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
String
dateStr
=
DateUtil
.
format
(
date
,
"HH:mm:ss"
);
return
DateUtil
.
parse
(
currentDateStr
+
" "
+
SHIFT_A_END
,
"yyyy-MM-dd HH:mm:ss"
);
DateTime
endTime
=
DateUtil
.
parse
(
dateStr
,
"HH:mm:ss"
);
DateTime
shiftAStartTime
=
DateUtil
.
parse
(
SHIFT_A_START
,
"HH:mm:ss"
);
DateTime
shiftAEndTime
=
DateUtil
.
parse
(
SHIFT_A_END
,
"HH:mm:ss"
);
return
endTime
.
getTime
()
>=
shiftAStartTime
.
getTime
()
&&
endTime
.
getTime
()
<
shiftAEndTime
.
getTime
();
}
}
/**
/**
* 判断是否属于
A班
* 判断是否属于
0点到8点半
*
*
* @param date
* @param date
* @return
* @return
*/
*/
public
static
boolean
isA
(
Date
date
)
{
public
static
boolean
isNextDay
(
Date
date
)
{
return
date
.
getTime
()
>=
getShiftAStartDate
().
getTime
()
&&
date
.
getTime
()
<
getShiftAEndDate
().
getTime
();
String
dateStr
=
DateUtil
.
format
(
date
,
"HH:mm:ss"
);
}
DateTime
time
=
DateUtil
.
parse
(
dateStr
,
"HH:mm:ss"
);
DateTime
startTime
=
DateUtil
.
parse
(
START
,
"HH:mm:ss"
);
public
static
boolean
isB
(
Date
date
)
{
DateTime
endTime
=
DateUtil
.
parse
(
SHIFT_A_START
,
"HH:mm:ss"
);
Date
startDate
=
getShiftAEndDate
();
return
time
.
getTime
()
>=
startTime
.
getTime
()
&&
time
.
getTime
()
<
endTime
.
getTime
();
DateTime
endDate
=
DateUtil
.
offsetDay
(
getShiftAStartDate
(),
1
);
return
date
.
getTime
()
>=
startDate
.
getTime
()
&&
date
.
getTime
()
<
endDate
.
getTime
();
}
public
static
Date
getShiftASelectDate
()
{
String
currentDateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
return
DateUtil
.
parse
(
currentDateStr
+
" "
+
START
,
"yyyy-MM-dd 00:00:00"
);
}
}
public
static
Date
getShiftBSelectDate
(
Date
paramDate
)
{
String
currentDateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
Date
currentDate
=
DateUtil
.
parse
(
currentDateStr
+
" "
+
START
,
"yyyy-MM-dd 00:00:00"
);
Date
shiftAStartDate
=
getShiftAStartDate
();
String
paramDateStr
=
DateUtil
.
format
(
paramDate
,
"yyyy-MM-dd"
);
DateTime
resultDate
=
DateUtil
.
parse
(
paramDateStr
,
"yyyy-MM-dd"
);
if
(
paramDate
.
getTime
()
>=
currentDate
.
getTime
()
&&
paramDate
.
getTime
()
<
shiftAStartDate
.
getTime
())
{
/**
return
DateUtil
.
offsetDay
(
resultDate
,
-
1
);
* 获取当前日期
*
* @param date
* @return
*/
public
static
String
getDateStr
(
Date
date
)
{
if
(!
isShiftA
(
date
))
{
if
(
isNextDay
(
date
))
{
DateTime
dateTime
=
DateUtil
.
offsetDay
(
date
,
-
1
);
return
DateUtil
.
format
(
dateTime
,
"yyyy-MM-dd"
);
}
}
}
return
resultDate
;
return
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
)
;
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论