Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
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
abook_android
abook_check
Commits
0474d906
Commit
0474d906
authored
Jan 12, 2023
by
Kazuyuki Hida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ロックのコールバック呼び出しを実装した。
parent
b46fc80c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
287 additions
and
107 deletions
+287
-107
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/UnlockReportJSON.java
+15
-3
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
+128
-4
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
+132
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+8
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookCheckWebViewHelper.java
+0
-95
gradle.properties
+4
-4
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/UnlockReportJSON.java
View file @
0474d906
...
@@ -10,6 +10,7 @@ import jp.agentec.adf.util.DateTimeUtil;
...
@@ -10,6 +10,7 @@ import jp.agentec.adf.util.DateTimeUtil;
public
class
UnlockReportJSON
extends
AcmsCommonJSON
{
public
class
UnlockReportJSON
extends
AcmsCommonJSON
{
private
Date
presentTimeUTC
;
private
Date
presentTimeUTC
;
private
int
reportStatus
;
public
UnlockReportJSON
(
String
jsonString
)
throws
AcmsException
{
public
UnlockReportJSON
(
String
jsonString
)
throws
AcmsException
{
super
(
jsonString
);
super
(
jsonString
);
...
@@ -18,20 +19,31 @@ public class UnlockReportJSON extends AcmsCommonJSON {
...
@@ -18,20 +19,31 @@ public class UnlockReportJSON extends AcmsCommonJSON {
@Override
@Override
protected
void
parse
(
JSONObject
json
)
{
protected
void
parse
(
JSONObject
json
)
{
presentTimeUTC
=
dateOrNull
(
json
,
"presentTimeUTC"
);
presentTimeUTC
=
dateOrNull
(
json
,
"presentTimeUTC"
);
reportStatus
=
intOrDef
(
json
,
""
,
999
);
}
}
int
getHttpStatus
()
{
public
int
getHttpStatus
()
{
return
httpStatus
;
return
httpStatus
;
}
}
Date
getPresentTime
()
{
public
Date
getPresentTime
()
{
return
presentTime
;
return
presentTime
;
}
}
Date
getPresentTimeUTC
()
{
public
Date
getPresentTimeUTC
()
{
return
presentTimeUTC
;
return
presentTimeUTC
;
}
}
public
int
getReportStatus
()
{
return
reportStatus
;
}
private
int
intOrDef
(
JSONObject
json
,
String
key
,
int
def
)
{
if
(
json
.
has
(
key
))
{
return
json
.
getInt
(
key
);
}
else
{
return
def
;
}
}
private
Date
dateOrNull
(
JSONObject
json
,
String
key
)
{
private
Date
dateOrNull
(
JSONObject
json
,
String
key
)
{
if
(
json
.
has
(
key
))
{
if
(
json
.
has
(
key
))
{
return
DateTimeUtil
.
toDate
(
json
.
getString
(
key
),
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
return
DateTimeUtil
.
toDate
(
json
.
getString
(
key
),
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
View file @
0474d906
package
jp
.
agentec
.
abook
.
abv
.
bl
.
logic
;
package
jp
.
agentec
.
abook
.
abv
.
bl
.
logic
;
import
org.json.adf.JSONObject
;
import
java.util.Date
;
import
java.util.Map
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.json.LockReportJSON
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters
;
import
jp.agentec.abook.abv.bl.dto.MemberInfoDto
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
public
class
LockReportLogic
extends
AbstractLogic
{
import
static
java
.
net
.
HttpURLConnection
.
HTTP_OK
;
public
class
LockReportLogic
extends
AbstractLogic
{
public
static
LockReportLogic
newInstance
()
{
public
static
LockReportLogic
newInstance
()
{
return
new
LockReportLogic
();
return
new
LockReportLogic
();
}
}
public
void
lock
(
LockReportParameters
param
)
{
public
LockResult
lock
(
Map
<
String
,
String
>
param
)
{
return
sendLockReport
(
param
.
get
(
"taskKey"
),
longOrNull
(
param
.
get
(
"taskReportId"
)),
dateOrNull
(
param
.
get
(
"reportStartDate"
))
);
}
private
LockResult
sendLockReport
(
String
taskKey
,
Long
taskReportId
,
Date
reportStartDate
)
{
AcmsClient
client
=
AcmsClient
.
getInstance
(
cache
.
getUrlPath
(),
networkAdapter
);
MemberInfoDto
member
=
cache
.
getMemberInfo
();
LockReportParameters
param
=
new
LockReportParameters
(
member
.
sid
,
taskKey
,
taskReportId
,
reportStartDate
,
member
.
loginId
,
member
.
memberName
);
if
(!
networkAdapter
.
isNetworkConnected
())
{
// オフラインだったら、ロック成功扱い
return
LockResult
.
offLine
();
}
try
{
LockReportJSON
reportJSON
=
client
.
sendLockReport
(
param
);
return
LockResult
.
succsess
(
reportJSON
);
}
catch
(
Throwable
e
)
{
return
LockResult
.
failure
(
e
);
}
}
private
Long
longOrNull
(
String
s
)
{
try
{
return
Long
.
valueOf
(
s
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
private
Date
dateOrNull
(
String
s
)
{
try
{
return
DateTimeUtil
.
toDate
(
s
,
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
public
void
unlock
(
UnlockReportParameters
param
)
{
// コールバック用のパラメータ
public
static
class
LockResult
{
int
result
;
String
message
;
String
extParam
;
static
LockResult
succsess
(
LockReportJSON
reportJSON
)
{
// 成功したとき
LockResult
result
=
new
LockResult
();
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
message
=
""
;
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
reportJSON
.
getReportStatus
());
extParam
.
put
(
"reportLockUserId"
,
reportJSON
.
getReportLockUserId
());
extParam
.
put
(
"reportLockUserName"
,
reportJSON
.
getReportLockUserName
());
extParam
.
put
(
"reportLockTime"
,
reportJSON
.
getReportLockTime
());
result
.
extParam
=
extParam
.
toString
();
return
result
;
}
static
LockResult
failure
(
Throwable
e
)
{
// 例外がでたとき
LockResult
result
=
new
LockResult
();
result
.
result
=
1
;
result
.
message
=
e
.
getLocalizedMessage
();
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
"999"
);
extParam
.
put
(
"reportLockUserId"
,
(
String
)
null
);
extParam
.
put
(
"reportLockUserName"
,
(
String
)
null
);
extParam
.
put
(
"reportLockTime"
,
(
String
)
null
);
result
.
extParam
=
extParam
.
toString
();
return
result
;
}
static
LockResult
offLine
()
{
// オフラインは成功扱い
LockResult
result
=
new
LockResult
();
result
.
result
=
0
;
result
.
message
=
""
;
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
"3"
);
// オフラインはstatus 3
extParam
.
put
(
"reportLockUserId"
,
(
String
)
null
);
extParam
.
put
(
"reportLockUserName"
,
(
String
)
null
);
extParam
.
put
(
"reportLockTime"
,
(
String
)
null
);
result
.
extParam
=
extParam
.
toString
();
return
result
;
}
public
int
getResult
()
{
return
result
;
}
public
String
getMessage
()
{
return
message
;
}
public
String
getExtParam
()
{
return
extParam
;
}
}
}
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
0 → 100644
View file @
0474d906
package
jp
.
agentec
.
abook
.
abv
.
bl
.
logic
;
import
org.json.adf.JSONObject
;
import
java.util.Date
;
import
java.util.Map
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.json.UnlockReportJSON
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.nw.NetworkAdapter
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
static
java
.
net
.
HttpURLConnection
.
HTTP_OK
;
public
class
UnlockReportLogic
extends
AbstractLogic
{
public
static
UnlockReportLogic
newInstance
()
{
return
new
UnlockReportLogic
();
}
public
Result
unlock
(
Map
<
String
,
String
>
param
)
{
return
sendUnlockReport
(
param
.
get
(
"taskKey"
),
longOrNull
(
param
.
get
(
"taskReportId"
)),
dateOrNull
(
param
.
get
(
"reportStartDate"
))
);
}
private
Result
sendUnlockReport
(
String
taskKey
,
Long
taskReportId
,
Date
reportStartDate
)
{
NetworkAdapter
adapter
=
ABVEnvironment
.
getInstance
().
networkAdapter
;
AcmsClient
client
=
AcmsClient
.
getInstance
(
cache
.
getUrlPath
(),
adapter
);
UnlockReportParameters
param
=
new
UnlockReportParameters
(
cache
.
getMemberInfo
().
sid
,
taskKey
,
taskReportId
,
reportStartDate
);
if
(!
networkAdapter
.
isNetworkConnected
())
{
// オフラインだったら、ロック成功扱い
return
Result
.
offLine
();
}
try
{
UnlockReportJSON
reportJSON
=
client
.
sendUnlockReport
(
param
);
return
Result
.
succsess
(
reportJSON
);
}
catch
(
Exception
e
)
{
return
Result
.
failure
(
e
);
}
}
private
Long
longOrNull
(
String
s
)
{
try
{
return
Long
.
valueOf
(
s
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
private
Date
dateOrNull
(
String
s
)
{
try
{
return
DateTimeUtil
.
toDate
(
s
,
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
// コールバック用のパラメータ
public
static
class
Result
{
int
result
;
String
message
;
String
extParam
;
static
Result
succsess
(
UnlockReportJSON
reportJSON
)
{
// 成功したとき
Result
result
=
new
Result
();
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
message
=
""
;
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
reportJSON
.
getReportStatus
());
result
.
extParam
=
extParam
.
toString
();
return
result
;
}
static
Result
failure
(
Throwable
e
)
{
// 例外がでたとき
Result
result
=
new
Result
();
result
.
result
=
1
;
result
.
message
=
e
.
getLocalizedMessage
();
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
"999"
);
result
.
extParam
=
extParam
.
toString
();
return
result
;
}
static
Result
offLine
()
{
// オフラインは成功扱い
Result
result
=
new
Result
();
result
.
result
=
0
;
result
.
message
=
""
;
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
"3"
);
// オフラインはstatus 3
result
.
extParam
=
extParam
.
toString
();
return
result
;
}
public
int
getResult
()
{
return
result
;
}
public
String
getMessage
()
{
return
message
;
}
public
String
getExtParam
()
{
return
extParam
;
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
0474d906
...
@@ -50,7 +50,9 @@ import jp.agentec.abook.abv.bl.dto.OperationDto;
...
@@ -50,7 +50,9 @@ import jp.agentec.abook.abv.bl.dto.OperationDto;
import
jp.agentec.abook.abv.bl.dto.OperationTaskDto
;
import
jp.agentec.abook.abv.bl.dto.OperationTaskDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic
;
import
jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic
;
import
jp.agentec.abook.abv.bl.logic.LockReportLogic
;
import
jp.agentec.abook.abv.bl.logic.OperationLogic
;
import
jp.agentec.abook.abv.bl.logic.OperationLogic
;
import
jp.agentec.abook.abv.bl.logic.UnlockReportLogic
;
import
jp.agentec.abook.abv.bl.websocket.MeetingManager
;
import
jp.agentec.abook.abv.bl.websocket.MeetingManager
;
import
jp.agentec.abook.abv.cl.environment.DeviceInfo
;
import
jp.agentec.abook.abv.cl.environment.DeviceInfo
;
import
jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper
;
import
jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper
;
...
@@ -1070,7 +1072,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
...
@@ -1070,7 +1072,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// ビーコンデータを受信して目的のデバイスIDの信号から値を取得する
// ビーコンデータを受信して目的のデバイスIDの信号から値を取得する
// 1:中心温度計 2:置くだけセンサー 3:バーコード
// 1:中心温度計 2:置くだけセンサー 3:バーコード
getDeviceInfo
(
abookCheckParam
);
getDeviceInfo
(
abookCheckParam
);
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_LOCK_REPORT
))
{
LockReportLogic
.
LockResult
r
=
LockReportLogic
.
newInstance
().
lock
(
abookCheckParam
);
afterABookCheckApi
(
mCmd
,
mTaskKey
,
r
.
getResult
(),
r
.
getMessage
(),
r
.
getExtParam
());
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_UNLOCK_REPORT
))
{
UnlockReportLogic
.
Result
r
=
UnlockReportLogic
.
newInstance
().
unlock
(
abookCheckParam
);
afterABookCheckApi
(
mCmd
,
mTaskKey
,
r
.
getResult
(),
r
.
getMessage
(),
r
.
getExtParam
());
}
}
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookCheckWebViewHelper.java
View file @
0474d906
...
@@ -19,9 +19,6 @@ import java.util.Date;
...
@@ -19,9 +19,6 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.Callback
;
import
jp.agentec.abook.abv.bl.common.Callback
;
import
jp.agentec.abook.abv.bl.common.CommonExecutor
;
import
jp.agentec.abook.abv.bl.common.CommonExecutor
;
...
@@ -30,8 +27,6 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
...
@@ -30,8 +27,6 @@ import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import
jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode
;
import
jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.common.nw.NetworkAdapter
;
import
jp.agentec.abook.abv.bl.data.ABVDataCache
;
import
jp.agentec.abook.abv.bl.dto.OperationDto
;
import
jp.agentec.abook.abv.bl.dto.OperationDto
;
import
jp.agentec.abook.abv.bl.dto.OperationTaskDto
;
import
jp.agentec.abook.abv.bl.dto.OperationTaskDto
;
import
jp.agentec.abook.abv.bl.dto.TaskDto
;
import
jp.agentec.abook.abv.bl.dto.TaskDto
;
...
@@ -142,12 +137,6 @@ public class ABookCheckWebViewHelper extends ABookHelper {
...
@@ -142,12 +137,6 @@ public class ABookCheckWebViewHelper extends ABookHelper {
FileUtil
.
delete
(
ABVEnvironment
.
getInstance
().
getTempTaskDirPath
(
contentId
,
taskKey
));
FileUtil
.
delete
(
ABVEnvironment
.
getInstance
().
getTempTaskDirPath
(
contentId
,
taskKey
));
mFinishCallback
.
callback
(
false
);
mFinishCallback
.
callback
(
false
);
break
;
break
;
case
ABookKeys
.
CMD_LOCK_REPORT
:
sendLockReport
(
param
);
break
;
case
ABookKeys
.
CMD_UNLOCK_REPORT
:
sendUnlockReport
(
param
);
break
;
}
}
}
}
...
@@ -559,88 +548,4 @@ public class ABookCheckWebViewHelper extends ABookHelper {
...
@@ -559,88 +548,4 @@ public class ABookCheckWebViewHelper extends ABookHelper {
return
rotationAngle
;
return
rotationAngle
;
}
}
private
void
sendLockReport
(
Map
<
String
,
String
>
param
)
{
sendLockReport
(
param
.
get
(
"sid"
),
param
.
get
(
"taskKey"
),
longOrNull
(
param
.
get
(
"taskReportId"
)),
dateOrNull
(
param
.
get
(
"reportStartDate"
)),
param
.
get
(
"userId"
),
param
.
get
(
"userName"
)
);
}
private
void
sendLockReport
(
String
sid
,
String
taskKey
,
Long
taskReportId
,
Date
reportStartDate
,
String
userId
,
String
userName
)
{
ABVDataCache
cache
=
ABVDataCache
.
getInstance
();
NetworkAdapter
adapter
=
ABVEnvironment
.
getInstance
().
networkAdapter
;
AcmsClient
client
=
AcmsClient
.
getInstance
(
cache
.
getUrlPath
(),
adapter
);
LockReportParameters
param
=
new
LockReportParameters
(
sid
,
taskKey
,
taskReportId
,
reportStartDate
,
userId
,
userName
);
try
{
client
.
sendLockReport
(
param
);
}
catch
(
Exception
e
)
{
// todo
}
}
private
void
sendUnlockReport
(
Map
<
String
,
String
>
param
)
{
sendUnlockReport
(
param
.
get
(
"sid"
),
param
.
get
(
"taskKey"
),
longOrNull
(
param
.
get
(
"taskReportId"
)),
dateOrNull
(
param
.
get
(
"reportStartDate"
))
);
}
private
void
sendUnlockReport
(
String
sid
,
String
taskKey
,
Long
taskReportId
,
Date
reportStartDate
)
{
ABVDataCache
cache
=
ABVDataCache
.
getInstance
();
NetworkAdapter
adapter
=
ABVEnvironment
.
getInstance
().
networkAdapter
;
AcmsClient
client
=
AcmsClient
.
getInstance
(
cache
.
getUrlPath
(),
adapter
);
UnlockReportParameters
param
=
new
UnlockReportParameters
(
sid
,
taskKey
,
taskReportId
,
reportStartDate
);
try
{
client
.
sendUnlockReport
(
param
);
}
catch
(
Exception
e
)
{
// todo
}
}
private
Long
longOrNull
(
String
s
)
{
try
{
return
Long
.
valueOf
(
s
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
private
Date
dateOrNull
(
String
s
)
{
try
{
return
DateTimeUtil
.
toDate
(
s
,
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
}
}
gradle.properties
View file @
0474d906
...
@@ -39,10 +39,10 @@ app_versioncode=1
...
@@ -39,10 +39,10 @@ app_versioncode=1
#cms server
#cms server
#acms_address=https://check.abookcloud.com/acms
#acms_address=https://check.abookcloud.com/acms
#download_server_address=https://check.abookcloud.com/acms
#download_server_address=https://check.abookcloud.com/acms
#
acms_address=https://abook188-1.abook.bz/acms
acms_address
=
https://abook188-1.abook.bz/acms
#
download_server_address=https://abook188-1.abook.bz/acms
download_server_address
=
https://abook188-1.abook.bz/acms
acms_address
=
http://10.0.2.2:8080/acms
#
acms_address=http://10.0.2.2:8080/acms
download_server_address
=
http://10.0.2.2:8080/acms
#
download_server_address=http://10.0.2.2:8080/acms
#syncview server
#syncview server
websocket_server_http_url
=
https://abook188-1.abook.bz/v1
websocket_server_http_url
=
https://abook188-1.abook.bz/v1
...
...
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