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
a4f62104
Commit
a4f62104
authored
Jan 13, 2023
by
Kazuyuki Hida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ロックの結果をローカルのDBに反映するようにした。
parent
0474d906
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
59 deletions
+139
-59
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
+67
-38
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
+23
-17
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+49
-4
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
View file @
a4f62104
...
@@ -20,7 +20,7 @@ public class LockReportLogic extends AbstractLogic {
...
@@ -20,7 +20,7 @@ public class LockReportLogic extends AbstractLogic {
return
new
LockReportLogic
();
return
new
LockReportLogic
();
}
}
public
Lock
Result
lock
(
Map
<
String
,
String
>
param
)
{
public
Result
lock
(
Map
<
String
,
String
>
param
)
{
return
sendLockReport
(
return
sendLockReport
(
param
.
get
(
"taskKey"
),
param
.
get
(
"taskKey"
),
longOrNull
(
param
.
get
(
"taskReportId"
)),
longOrNull
(
param
.
get
(
"taskReportId"
)),
...
@@ -28,7 +28,7 @@ public class LockReportLogic extends AbstractLogic {
...
@@ -28,7 +28,7 @@ public class LockReportLogic extends AbstractLogic {
);
);
}
}
private
Lock
Result
sendLockReport
(
private
Result
sendLockReport
(
String
taskKey
,
String
taskKey
,
Long
taskReportId
,
Long
taskReportId
,
Date
reportStartDate
Date
reportStartDate
...
@@ -46,14 +46,14 @@ public class LockReportLogic extends AbstractLogic {
...
@@ -46,14 +46,14 @@ public class LockReportLogic extends AbstractLogic {
if
(!
networkAdapter
.
isNetworkConnected
())
{
if
(!
networkAdapter
.
isNetworkConnected
())
{
// オフラインだったら、ロック成功扱い
// オフラインだったら、ロック成功扱い
return
Lock
Result
.
offLine
();
return
Result
.
offLine
();
}
}
try
{
try
{
LockReportJSON
reportJSON
=
client
.
sendLockReport
(
param
);
LockReportJSON
reportJSON
=
client
.
sendLockReport
(
param
);
return
Lock
Result
.
succsess
(
reportJSON
);
return
Result
.
succsess
(
reportJSON
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
return
Lock
Result
.
failure
(
e
);
return
Result
.
failure
(
e
);
}
}
}
}
...
@@ -76,56 +76,40 @@ public class LockReportLogic extends AbstractLogic {
...
@@ -76,56 +76,40 @@ public class LockReportLogic extends AbstractLogic {
}
}
// コールバック用のパラメータ
// コールバック用のパラメータ
public
static
class
Lock
Result
{
public
static
class
Result
{
int
result
;
int
result
;
String
message
;
String
message
;
String
extParam
;
ExtParam
extParam
;
static
Lock
Result
succsess
(
LockReportJSON
reportJSON
)
{
static
Result
succsess
(
LockReportJSON
reportJSON
)
{
// 成功したとき
// 成功したとき
LockResult
result
=
new
Lock
Result
();
Result
result
=
new
Result
();
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
message
=
""
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
JSONObject
extParam
=
new
JSONObject
();
reportJSON
.
getReportStatus
(),
extParam
.
put
(
"reportStatus"
,
reportJSON
.
getReportStatus
());
reportJSON
.
getReportLockUserId
(),
extParam
.
put
(
"reportLockUserId"
,
reportJSON
.
getReportLockUserId
());
reportJSON
.
getReportLockUserName
(),
extParam
.
put
(
"reportLockUserName"
,
reportJSON
.
getReportLockUserName
());
reportJSON
.
getReportLockTime
()
extParam
.
put
(
"reportLockTime"
,
reportJSON
.
getReportLockTime
());
);
result
.
extParam
=
extParam
.
toString
();
return
result
;
return
result
;
}
}
static
Lock
Result
failure
(
Throwable
e
)
{
static
Result
failure
(
Throwable
e
)
{
// 例外がでたとき
// 例外がでたとき
LockResult
result
=
new
Lock
Result
();
Result
result
=
new
Result
();
result
.
result
=
1
;
result
.
result
=
1
;
result
.
message
=
e
.
getLocalizedMessage
();
result
.
message
=
e
.
getLocalizedMessage
();
result
.
extParam
=
new
ExtParam
(
999
,
null
,
null
,
null
);
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
;
return
result
;
}
}
static
Lock
Result
offLine
()
{
static
Result
offLine
()
{
// オフラインは成功扱い
// オフラインは成功扱い
LockResult
result
=
new
Lock
Result
();
Result
result
=
new
Result
();
result
.
result
=
0
;
result
.
result
=
0
;
result
.
message
=
""
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
3
,
null
,
null
,
null
);
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
;
return
result
;
}
}
...
@@ -137,8 +121,53 @@ public class LockReportLogic extends AbstractLogic {
...
@@ -137,8 +121,53 @@ public class LockReportLogic extends AbstractLogic {
return
message
;
return
message
;
}
}
public
String
getExtParam
()
{
public
ExtParam
getExtParam
()
{
return
extParam
;
return
extParam
;
}
}
}
}
static
public
class
ExtParam
{
int
reportStatus
;
String
reportLockUserId
;
String
reportLockUserName
;
Date
reportLockTime
;
ExtParam
(
int
reportStatus
,
String
reportLockUserId
,
String
reportLockUserName
,
Date
reportLockTime
)
{
this
.
reportStatus
=
reportStatus
;
this
.
reportLockUserId
=
reportLockUserId
;
this
.
reportLockUserName
=
reportLockUserName
;
this
.
reportLockTime
=
reportLockTime
;
}
public
int
getReportStatus
()
{
return
reportStatus
;
}
public
String
getReportLockUserId
()
{
return
reportLockUserId
;
}
public
String
getReportLockUserName
()
{
return
reportLockUserName
;
}
public
Date
getReportLockTime
()
{
return
reportLockTime
;
}
public
String
json
()
{
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
String
.
valueOf
(
reportStatus
));
extParam
.
put
(
"reportLockUserId"
,
reportLockUserId
);
extParam
.
put
(
"reportLockUserName"
,
reportLockUserName
);
extParam
.
put
(
"reportLockTime"
,
reportLockTime
);
return
extParam
.
toString
();
}
}
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
View file @
a4f62104
...
@@ -76,18 +76,14 @@ public class UnlockReportLogic extends AbstractLogic {
...
@@ -76,18 +76,14 @@ public class UnlockReportLogic extends AbstractLogic {
public
static
class
Result
{
public
static
class
Result
{
int
result
;
int
result
;
String
message
;
String
message
;
String
extParam
;
ExtParam
extParam
;
static
Result
succsess
(
UnlockReportJSON
reportJSON
)
{
static
Result
succsess
(
UnlockReportJSON
reportJSON
)
{
// 成功したとき
// 成功したとき
Result
result
=
new
Result
();
Result
result
=
new
Result
();
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
message
=
""
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
reportJSON
.
getReportStatus
());
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
reportJSON
.
getReportStatus
());
result
.
extParam
=
extParam
.
toString
();
return
result
;
return
result
;
}
}
...
@@ -96,11 +92,7 @@ public class UnlockReportLogic extends AbstractLogic {
...
@@ -96,11 +92,7 @@ public class UnlockReportLogic extends AbstractLogic {
Result
result
=
new
Result
();
Result
result
=
new
Result
();
result
.
result
=
1
;
result
.
result
=
1
;
result
.
message
=
e
.
getLocalizedMessage
();
result
.
message
=
e
.
getLocalizedMessage
();
result
.
extParam
=
new
ExtParam
(
999
);
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
"999"
);
result
.
extParam
=
extParam
.
toString
();
return
result
;
return
result
;
}
}
...
@@ -109,11 +101,7 @@ public class UnlockReportLogic extends AbstractLogic {
...
@@ -109,11 +101,7 @@ public class UnlockReportLogic extends AbstractLogic {
Result
result
=
new
Result
();
Result
result
=
new
Result
();
result
.
result
=
0
;
result
.
result
=
0
;
result
.
message
=
""
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
3
);
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
"3"
);
// オフラインはstatus 3
result
.
extParam
=
extParam
.
toString
();
return
result
;
return
result
;
}
}
...
@@ -125,8 +113,26 @@ public class UnlockReportLogic extends AbstractLogic {
...
@@ -125,8 +113,26 @@ public class UnlockReportLogic extends AbstractLogic {
return
message
;
return
message
;
}
}
public
String
getExtParam
()
{
public
ExtParam
getExtParam
()
{
return
extParam
;
return
extParam
;
}
}
}
}
public
static
class
ExtParam
{
int
reportStatus
;
ExtParam
(
int
reportStatus
)
{
this
.
reportStatus
=
reportStatus
;
}
public
int
getReportStatus
()
{
return
reportStatus
;
}
public
String
json
()
{
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
"reportStatus"
,
String
.
valueOf
(
reportStatus
));
return
extParam
.
toString
();
}
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
a4f62104
...
@@ -29,6 +29,7 @@ import org.json.adf.JSONObject;
...
@@ -29,6 +29,7 @@ import org.json.adf.JSONObject;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
...
@@ -43,6 +44,8 @@ import jp.agentec.abook.abv.bl.common.Constant;
...
@@ -43,6 +44,8 @@ import jp.agentec.abook.abv.bl.common.Constant;
import
jp.agentec.abook.abv.bl.common.constant.ABookKeys
;
import
jp.agentec.abook.abv.bl.common.constant.ABookKeys
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.data.ABVDataCache
;
import
jp.agentec.abook.abv.bl.data.ABVDataCache
;
import
jp.agentec.abook.abv.bl.data.dao.AbstractDao
;
import
jp.agentec.abook.abv.bl.data.dao.TaskReportDao
;
import
jp.agentec.abook.abv.bl.download.ContentFileExtractor
;
import
jp.agentec.abook.abv.bl.download.ContentFileExtractor
;
import
jp.agentec.abook.abv.bl.dto.ContentDto
;
import
jp.agentec.abook.abv.bl.dto.ContentDto
;
import
jp.agentec.abook.abv.bl.dto.MydataDto
;
import
jp.agentec.abook.abv.bl.dto.MydataDto
;
...
@@ -77,6 +80,7 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
...
@@ -77,6 +80,7 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import
jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity
;
import
jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity
;
import
jp.agentec.abook.abv.ui.viewer.activity.NoPdfViewActivity
;
import
jp.agentec.abook.abv.ui.viewer.activity.NoPdfViewActivity
;
import
jp.agentec.abook.abv.ui.viewer.foxitPdf.FoxitPdfCore
;
import
jp.agentec.abook.abv.ui.viewer.foxitPdf.FoxitPdfCore
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
jp.agentec.adf.util.FileUtil
;
import
jp.agentec.adf.util.FileUtil
;
import
jp.agentec.adf.util.StringUtil
;
import
jp.agentec.adf.util.StringUtil
;
...
@@ -1073,11 +1077,45 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
...
@@ -1073,11 +1077,45 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 1:中心温度計 2:置くだけセンサー 3:バーコード
// 1:中心温度計 2:置くだけセンサー 3:バーコード
getDeviceInfo
(
abookCheckParam
);
getDeviceInfo
(
abookCheckParam
);
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_LOCK_REPORT
))
{
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_LOCK_REPORT
))
{
LockReportLogic
.
LockResult
r
=
LockReportLogic
.
newInstance
().
lock
(
abookCheckParam
);
LockReportLogic
.
Result
r
=
LockReportLogic
.
newInstance
().
lock
(
abookCheckParam
);
afterABookCheckApi
(
mCmd
,
mTaskKey
,
r
.
getResult
(),
r
.
getMessage
(),
r
.
getExtParam
());
// ローカルDBに反映
TaskReportDao
dao
=
AbstractDao
.
getDao
(
TaskReportDao
.
class
);
dao
.
updateReportLock
(
mTaskKey
,
dateOrNull
(
abookCheckParam
.
get
(
"reportStartDate"
)),
r
.
getExtParam
().
getReportStatus
(),
r
.
getExtParam
().
getReportLockUserId
(),
r
.
getExtParam
().
getReportLockUserName
(),
r
.
getExtParam
().
getReportLockTime
()
);
// JSコールバック
afterABookCheckApi
(
mCmd
,
mTaskKey
,
r
.
getResult
(),
r
.
getMessage
(),
r
.
getExtParam
().
json
()
);
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_UNLOCK_REPORT
))
{
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_UNLOCK_REPORT
))
{
UnlockReportLogic
.
Result
r
=
UnlockReportLogic
.
newInstance
().
unlock
(
abookCheckParam
);
UnlockReportLogic
.
Result
r
=
UnlockReportLogic
.
newInstance
().
unlock
(
abookCheckParam
);
afterABookCheckApi
(
mCmd
,
mTaskKey
,
r
.
getResult
(),
r
.
getMessage
(),
r
.
getExtParam
());
// ローカルDBに反映
TaskReportDao
dao
=
AbstractDao
.
getDao
(
TaskReportDao
.
class
);
dao
.
updateReportLock
(
mTaskKey
,
dateOrNull
(
abookCheckParam
.
get
(
"reportStartDate"
)),
r
.
getExtParam
().
getReportStatus
(),
null
,
null
,
null
);
// JSコールバック
afterABookCheckApi
(
mCmd
,
mTaskKey
,
r
.
getResult
(),
r
.
getMessage
(),
r
.
getExtParam
().
json
()
);
}
}
}
}
...
@@ -1330,4 +1368,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
...
@@ -1330,4 +1368,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
//ABVCheckContentViewActivityから処理
//ABVCheckContentViewActivityから処理
protected
void
getDeviceInfo
(
Map
<
String
,
String
>
abookCheckParam
)
{}
protected
void
getDeviceInfo
(
Map
<
String
,
String
>
abookCheckParam
)
{}
}
private
Date
dateOrNull
(
String
s
)
{
try
{
return
DateTimeUtil
.
toDate
(
s
,
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
}
catch
(
Exception
e
)
{
return
null
;
}
}}
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