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
f381ab70
Commit
f381ab70
authored
Jan 27, 2023
by
Kazuyuki Hida
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/contract/sato/1.0.300_51565_js_interface' into 'contract/sato/1.0.300_dev'
報告書の排他制御 See merge request
!262
parents
660516f0
01da32ae
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
688 additions
and
12 deletions
+688
-12
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
+19
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/AcmsJSONParser.java
+27
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/LockReportJSON.java
+68
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/OperationDataJSON.java
+2
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/UnlockReportJSON.java
+42
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/parameters/LockReportParameters.java
+53
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/parameters/UnlockReportParameters.java
+38
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/type/AcmsApis.java
+6
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookKeys.java
+2
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
+212
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
+156
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+56
-2
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookCheckWebViewHelper.java
+7
-9
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
View file @
f381ab70
...
...
@@ -20,6 +20,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import
jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.LockReportJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.MasterDataJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON
;
...
...
@@ -32,6 +33,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import
jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.UnlockReportJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters
;
...
...
@@ -47,11 +49,13 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters;
import
jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.UpdateDeviceTokenParameters
;
import
jp.agentec.abook.abv.bl.acms.type.AcmsApis
;
import
jp.agentec.abook.abv.bl.acms.type.LoginStatus
;
...
...
@@ -719,6 +723,18 @@ public class AcmsClient implements AcmsClientResponseListener {
return
json
;
}
public
LockReportJSON
sendLockReport
(
LockReportParameters
param
)
throws
NetworkDisconnectedException
,
AcmsException
{
HttpResponse
response
=
send
(
AcmsApis
.
ApiLockReport
,
param
);
String
json
=
response
.
httpResponseBody
;
return
new
LockReportJSON
(
json
);
}
public
UnlockReportJSON
sendUnlockReport
(
UnlockReportParameters
param
)
throws
NetworkDisconnectedException
,
AcmsException
{
HttpResponse
response
=
send
(
AcmsApis
.
ApiUnlockReport
,
param
);
String
json
=
response
.
httpResponseBody
;
return
new
UnlockReportJSON
(
json
);
}
/**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/
...
...
@@ -922,7 +938,9 @@ public class AcmsClient implements AcmsClientResponseListener {
AcmsApis
.
ApiUrlNewAppStoreLogin
,
AcmsApis
.
ApiUrlAppStoreNewLogin
,
AcmsApis
.
ApiGetPushMessages
,
AcmsApis
.
ApiSendPushMessage
AcmsApis
.
ApiSendPushMessage
,
AcmsApis
.
ApiLockReport
,
AcmsApis
.
ApiUnlockReport
};
public
HttpTaskWorker
(
String
methodName
,
String
apiUrl
,
T
param
)
{
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/AcmsJSONParser.java
View file @
f381ab70
...
...
@@ -6,11 +6,15 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import
jp.agentec.abook.abv.bl.common.exception.JSONValidationException
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.adf.core.CloneableObject
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
jp.agentec.adf.util.StringUtil
;
import
org.json.adf.JSONException
;
import
org.json.adf.JSONObject
;
import
java.util.Date
;
public
abstract
class
AcmsJSONParser
extends
CloneableObject
{
/**
* {@link AcmsJSONParser} クラスのインスタンスを初期化します。
...
...
@@ -129,4 +133,27 @@ public abstract class AcmsJSONParser extends CloneableObject {
}
}
protected
int
getIntOrDef
(
JSONObject
json
,
String
key
,
int
def
)
{
if
(
json
.
has
(
key
))
{
return
json
.
getInt
(
key
);
}
else
{
return
def
;
}
}
protected
String
getStringOrNull
(
JSONObject
json
,
String
key
)
{
if
(
json
.
has
(
key
))
{
return
json
.
getString
(
key
);
}
else
{
return
null
;
}
}
protected
Date
getDateOrNull
(
JSONObject
json
,
String
key
)
{
if
(
json
.
has
(
key
))
{
return
DateTimeUtil
.
toDate
(
json
.
getString
(
key
),
"UTC"
,
DateTimeFormat
.
yyyyMMdd_hyphen
);
}
else
{
return
null
;
}
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/LockReportJSON.java
0 → 100644
View file @
f381ab70
package
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
;
import
org.json.adf.JSONObject
;
import
java.util.Date
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
/**
* checkapi/lockReport/のレスポンスを変換するクラス
*/
public
class
LockReportJSON
extends
AcmsCommonJSON
{
public
static
final
int
BAD_STATE
=
999
;
private
Date
presentTimeUTC
;
private
int
reportStatus
;
private
String
reportLockUserId
;
private
String
reportLockUserName
;
private
Date
reportLockTime
;
public
LockReportJSON
(
String
jsonString
)
throws
AcmsException
{
super
(
jsonString
);
}
@Override
protected
void
parse
(
JSONObject
json
)
{
presentTimeUTC
=
getDateOrNull
(
json
,
"presentTimeUTC"
);
reportStatus
=
getIntOrDef
(
json
,
"reportStatus"
,
BAD_STATE
);
reportLockUserId
=
getStringOrNull
(
json
,
"reportLockUserId"
);
reportLockUserName
=
getStringOrNull
(
json
,
"reportLockUserName"
);
reportLockTime
=
getDateOrNull
(
json
,
"reportLockTime"
);
}
@SuppressWarnings
(
"unused"
)
int
getHttpStatus
()
{
return
httpStatus
;
}
@SuppressWarnings
(
"unused"
)
Date
getPresentTime
()
{
return
presentTime
;
}
@SuppressWarnings
(
"unused"
)
public
Date
getPresentTimeUTC
()
{
return
presentTimeUTC
;
}
@SuppressWarnings
(
"unused"
)
public
int
getReportStatus
()
{
return
reportStatus
;
}
@SuppressWarnings
(
"unused"
)
public
String
getReportLockUserId
()
{
return
reportLockUserId
;
}
@SuppressWarnings
(
"unused"
)
public
String
getReportLockUserName
()
{
return
reportLockUserName
;
}
@SuppressWarnings
(
"unused"
)
public
Date
getReportLockTime
()
{
return
reportLockTime
;
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/OperationDataJSON.java
View file @
f381ab70
...
...
@@ -45,6 +45,8 @@ public class OperationDataJSON extends AcmsCommonJSON {
public
static
final
String
SendBackUserName
=
"sendBackUserName"
;
// 差し戻しユーザ名 差し戻された場合のみ
public
static
final
String
SendBackComment
=
"sendBackComment"
;
// 確認コメント 差し戻された場合のみ
public
static
final
String
ReportStatus
=
"reportStatus"
;
public
List
<
TaskDto
>
taskDtoList
;
public
Date
lastEditDate
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/UnlockReportJSON.java
0 → 100644
View file @
f381ab70
package
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
;
import
org.json.adf.JSONObject
;
import
java.util.Date
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
public
class
UnlockReportJSON
extends
AcmsCommonJSON
{
public
static
final
int
BAD_STATE
=
999
;
private
Date
presentTimeUTC
;
private
int
reportStatus
;
public
UnlockReportJSON
(
String
jsonString
)
throws
AcmsException
{
super
(
jsonString
);
}
@Override
protected
void
parse
(
JSONObject
json
)
{
presentTimeUTC
=
getDateOrNull
(
json
,
"presentTimeUTC"
);
reportStatus
=
getIntOrDef
(
json
,
""
,
BAD_STATE
);
}
@SuppressWarnings
(
"unused"
)
public
int
getHttpStatus
()
{
return
httpStatus
;
}
@SuppressWarnings
(
"unused"
)
public
Date
getPresentTime
()
{
return
presentTime
;
}
@SuppressWarnings
(
"unused"
)
public
Date
getPresentTimeUTC
()
{
return
presentTimeUTC
;
}
@SuppressWarnings
(
"unused"
)
public
int
getReportStatus
()
{
return
reportStatus
;
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/parameters/LockReportParameters.java
0 → 100644
View file @
f381ab70
package
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
parameters
;
import
java.util.Date
;
/**
* checkapi/lockReport/のリクエストに使うパラメータ
*/
public
class
LockReportParameters
extends
AcmsParameters
{
private
String
sid
;
private
String
taskKey
;
private
Long
taskReportId
;
private
Date
reportStartDate
;
private
String
userId
;
private
String
userName
;
public
LockReportParameters
(
String
sid
,
String
taskKey
,
Long
taskReportId
,
Date
reportStartDate
,
String
userId
,
String
userName
)
{
super
(
sid
);
this
.
taskKey
=
taskKey
;
this
.
taskReportId
=
taskReportId
;
this
.
reportStartDate
=
reportStartDate
;
this
.
userId
=
userId
;
this
.
userName
=
userName
;
}
public
String
getTaskKey
()
{
return
taskKey
;
}
public
Long
getTaskReportId
()
{
return
taskReportId
;
}
public
Date
getReportStartDate
()
{
return
reportStartDate
;
}
public
String
getUserId
()
{
return
userId
;
}
public
String
getUserName
()
{
return
userName
;
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/parameters/UnlockReportParameters.java
0 → 100644
View file @
f381ab70
package
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
parameters
;
import
java.util.Date
;
/**
* checkapi/unlockReport/のリクエストに使うパラメータ
*/
public
class
UnlockReportParameters
extends
AcmsParameters
{
private
String
taskKey
;
private
Long
taskReportId
;
private
Date
reportStartDate
;
public
UnlockReportParameters
(
String
sid
,
String
taskKey
,
Long
taskReportId
,
Date
reportStartDate
)
{
super
(
sid
);
this
.
taskKey
=
taskKey
;
this
.
taskReportId
=
taskReportId
;
this
.
reportStartDate
=
reportStartDate
;
}
String
getTaskKey
()
{
return
taskKey
;
}
Long
getTaskReportId
()
{
return
taskReportId
;
}
Date
getReportStartDate
()
{
return
reportStartDate
;
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/type/AcmsApis.java
View file @
f381ab70
...
...
@@ -160,6 +160,11 @@ public class AcmsApis {
public
static
final
String
ApiQuickReportSearch
=
"quickReportSearch"
;
// 簡易帳票リビジョン一覧取得
public
static
final
String
ApiQuickReportRevision
=
"quickReportRevision"
;
// 報告・点検のロック
public
static
final
String
ApiLockReport
=
"lockReport"
;
// 報告・点検のロック解除
public
static
final
String
ApiUnlockReport
=
"unlockReport"
;
// download
/**
* コンテンツのZIPファイルを取得<br>
...
...
@@ -182,6 +187,7 @@ public class AcmsApis {
public
static
final
String
GetTaskFileUrlFormat
=
"%s/%s/checkapi/getTaskFile"
;
/**
* APIのURLを完成します。
* @param host ACMSのFQDNです。
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookKeys.java
View file @
f381ab70
...
...
@@ -34,6 +34,8 @@ public class ABookKeys {
public
static
final
String
CMD_MOVE_PAGE
=
"movePage"
;
public
static
final
String
CMD_SHOW_RELATED_CONTENT
=
"showRelatedContent"
;
public
static
final
String
CMD_PAGE_NUM
=
"pageNum"
;
public
static
final
String
CMD_LOCK_REPORT
=
"lockReport"
;
public
static
final
String
CMD_UNLOCK_REPORT
=
"unlockReport"
;
public
static
final
String
GPS_TYPE
=
"gpsType"
;
public
static
final
String
STATUS_CODE
=
"statusCode"
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
0 → 100644
View file @
f381ab70
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.dto.MemberInfoDto
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
static
java
.
net
.
HttpURLConnection
.
HTTP_OK
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportLockTime
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportLockUserId
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportLockUserName
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportStartDate
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportStatus
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskReportId
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
common
.
constant
.
ABookKeys
.
TASK_KEY
;
public
class
LockReportLogic
extends
AbstractLogic
{
public
static
LockReportLogic
newInstance
()
{
return
new
LockReportLogic
();
}
public
Result
lock
(
Map
<
String
,
String
>
param
)
{
Long
taskReportId
=
longOrNull
(
param
.
get
(
TaskReportId
));
Date
reportStartDate
=
dateOrNull
(
param
.
get
(
ReportStartDate
));
return
sendLockReport
(
param
.
get
(
TASK_KEY
),
taskReportId
,
reportStartDate
);
}
private
Result
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
Result
.
offLine
(
taskReportId
,
reportStartDate
);
}
try
{
LockReportJSON
reportJSON
=
client
.
sendLockReport
(
param
);
return
Result
.
succsess
(
reportJSON
,
taskReportId
,
reportStartDate
);
}
catch
(
Throwable
e
)
{
return
Result
.
failure
(
e
,
taskReportId
,
reportStartDate
);
}
}
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
{
public
static
final
int
BAD_STATUS
=
999
;
int
result
;
String
message
;
ExtParam
extParam
;
static
Result
succsess
(
LockReportJSON
reportJSON
,
Long
taskReportId
,
Date
reportStartDate
)
{
// 成功したとき
Result
result
=
new
Result
();
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
reportJSON
.
getReportStatus
(),
reportJSON
.
getReportLockUserId
(),
reportJSON
.
getReportLockUserName
(),
reportJSON
.
getReportLockTime
(),
taskReportId
,
reportStartDate
);
return
result
;
}
@SuppressWarnings
(
"magic_number"
)
static
Result
failure
(
Throwable
e
,
Long
taskReportId
,
Date
reportStartDate
)
{
// 例外がでたとき
Result
result
=
new
Result
();
result
.
result
=
1
;
result
.
message
=
e
.
getLocalizedMessage
();
result
.
extParam
=
new
ExtParam
(
BAD_STATUS
,
null
,
null
,
null
,
taskReportId
,
reportStartDate
);
return
result
;
}
static
Result
offLine
(
Long
taskReportId
,
Date
reportStartDate
)
{
// オフラインは成功扱い
Result
result
=
new
Result
();
result
.
result
=
0
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
3
,
null
,
null
,
null
,
taskReportId
,
reportStartDate
);
return
result
;
}
public
int
getResult
()
{
return
result
;
}
public
String
getMessage
()
{
return
message
;
}
public
ExtParam
getExtParam
()
{
return
extParam
;
}
}
static
public
class
ExtParam
{
int
reportStatus
;
String
reportLockUserId
;
String
reportLockUserName
;
Date
reportLockTime
;
Long
taskReportId
;
Date
reportStartDate
;
ExtParam
(
int
reportStatus
,
String
reportLockUserId
,
String
reportLockUserName
,
Date
reportLockTime
,
Long
taskReportId
,
Date
reportStartDate
)
{
this
.
reportStatus
=
reportStatus
;
this
.
reportLockUserId
=
reportLockUserId
;
this
.
reportLockUserName
=
reportLockUserName
;
this
.
reportLockTime
=
reportLockTime
;
this
.
taskReportId
=
taskReportId
;
this
.
reportStartDate
=
reportStartDate
;
}
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
,
DateTimeUtil
.
formatDate
(
reportLockTime
,
DateTimeFormat
.
yyyyMMddHHmmssSSS_hyphen
));
if
(
taskReportId
!=
null
&&
taskReportId
!=
0
)
{
extParam
.
put
(
TaskReportId
,
taskReportId
);
}
if
(
reportStartDate
!=
null
)
{
extParam
.
put
(
ReportStartDate
,
DateTimeUtil
.
formatDate
(
reportStartDate
,
DateTimeFormat
.
yyyyMMddHHmmssSSS_hyphen
));
}
return
extParam
.
toString
();
}
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
0 → 100644
View file @
f381ab70
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
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportStartDate
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportStatus
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskKey
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskReportId
;
public
class
UnlockReportLogic
extends
AbstractLogic
{
public
static
UnlockReportLogic
newInstance
()
{
return
new
UnlockReportLogic
();
}
public
Result
unlock
(
Map
<
String
,
String
>
param
)
{
Long
taskReportId
=
longOrNull
(
param
.
get
(
TaskReportId
));
Date
reportStartDate
=
dateOrNull
(
param
.
get
(
ReportStartDate
));
return
sendUnlockReport
(
param
.
get
(
TaskKey
),
taskReportId
,
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
(
taskReportId
,
reportStartDate
);
}
try
{
UnlockReportJSON
reportJSON
=
client
.
sendUnlockReport
(
param
);
return
Result
.
succsess
(
reportJSON
,
taskReportId
,
reportStartDate
);
}
catch
(
Exception
e
)
{
return
Result
.
failure
(
e
,
taskReportId
,
reportStartDate
);
}
}
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
{
public
static
final
int
BAD_STATUS
=
999
;
int
result
;
String
message
;
ExtParam
extParam
;
static
Result
succsess
(
UnlockReportJSON
reportJSON
,
Long
taskReportId
,
Date
reportStartDate
)
{
// 成功したとき
Result
result
=
new
Result
();
result
.
result
=
reportJSON
.
httpStatus
==
HTTP_OK
?
0
:
1
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
reportJSON
.
getReportStatus
(),
taskReportId
,
reportStartDate
);
return
result
;
}
static
Result
failure
(
Throwable
e
,
Long
taskReportId
,
Date
reportStartDate
)
{
// 例外がでたとき
Result
result
=
new
Result
();
result
.
result
=
1
;
result
.
message
=
e
.
getLocalizedMessage
();
result
.
extParam
=
new
ExtParam
(
BAD_STATUS
,
taskReportId
,
reportStartDate
);
return
result
;
}
static
Result
offLine
(
Long
taskReportId
,
Date
reportStartDate
)
{
// オフラインは成功扱い
Result
result
=
new
Result
();
result
.
result
=
0
;
result
.
message
=
""
;
result
.
extParam
=
new
ExtParam
(
3
,
taskReportId
,
reportStartDate
);
return
result
;
}
public
int
getResult
()
{
return
result
;
}
public
String
getMessage
()
{
return
message
;
}
public
ExtParam
getExtParam
()
{
return
extParam
;
}
}
public
static
class
ExtParam
{
int
reportStatus
;
Long
taskReportId
;
Date
reportStartDate
;
ExtParam
(
int
reportStatus
,
Long
taskReportId
,
Date
reportStartDate
)
{
this
.
reportStatus
=
reportStatus
;
this
.
taskReportId
=
taskReportId
;
this
.
reportStartDate
=
reportStartDate
;
}
public
int
getReportStatus
()
{
return
reportStatus
;
}
public
String
json
()
{
JSONObject
extParam
=
new
JSONObject
();
extParam
.
put
(
ReportStatus
,
String
.
valueOf
(
reportStatus
));
if
(
taskReportId
!=
null
&&
taskReportId
!=
0
)
{
extParam
.
put
(
TaskReportId
,
taskReportId
);
}
if
(
reportStartDate
!=
null
)
{
extParam
.
put
(
ReportStartDate
,
DateTimeUtil
.
formatDate
(
reportStartDate
,
DateTimeFormat
.
yyyyMMddHHmmssSSS_hyphen
));
}
return
extParam
.
toString
();
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
f381ab70
...
...
@@ -29,6 +29,7 @@ import org.json.adf.JSONObject;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
...
...
@@ -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.log.Logger
;
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.dto.ContentDto
;
import
jp.agentec.abook.abv.bl.dto.MydataDto
;
...
...
@@ -50,7 +53,9 @@ import jp.agentec.abook.abv.bl.dto.OperationDto;
import
jp.agentec.abook.abv.bl.dto.OperationTaskDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
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.UnlockReportLogic
;
import
jp.agentec.abook.abv.bl.websocket.MeetingManager
;
import
jp.agentec.abook.abv.cl.environment.DeviceInfo
;
import
jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper
;
...
...
@@ -75,10 +80,13 @@ 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.NoPdfViewActivity
;
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.FileUtil
;
import
jp.agentec.adf.util.StringUtil
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
ReportStartDate
;
public
abstract
class
ABVContentViewActivity
extends
ABVAuthenticatedActivity
{
private
static
final
String
TAG
=
"ABVContentViewActivity"
;
...
...
@@ -1070,7 +1078,46 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// ビーコンデータを受信して目的のデバイスIDの信号から値を取得する
// 1:中心温度計 2:置くだけセンサー 3:バーコード
getDeviceInfo
(
abookCheckParam
);
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_LOCK_REPORT
))
{
LockReportLogic
.
Result
r
=
LockReportLogic
.
newInstance
().
lock
(
abookCheckParam
);
// ローカル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
))
{
UnlockReportLogic
.
Result
r
=
UnlockReportLogic
.
newInstance
().
unlock
(
abookCheckParam
);
// ローカル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
()
);
}
}
...
...
@@ -1323,4 +1370,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
//ABVCheckContentViewActivityから処理
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
;
}
}}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookCheckWebViewHelper.java
View file @
f381ab70
...
...
@@ -24,7 +24,6 @@ import jp.agentec.abook.abv.bl.common.Callback;
import
jp.agentec.abook.abv.bl.common.CommonExecutor
;
import
jp.agentec.abook.abv.bl.common.Constant
;
import
jp.agentec.abook.abv.bl.common.constant.ABookKeys
;
import
jp.agentec.abook.abv.bl.common.exception.ABVException
;
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.log.Logger
;
...
...
@@ -37,7 +36,6 @@ import jp.agentec.abook.abv.bl.logic.OperationLogic;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.constant.ErrorCode
;
import
jp.agentec.abook.abv.ui.common.constant.ErrorMessage
;
import
jp.agentec.abook.abv.ui.common.util.PatternStringUtil
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
...
...
@@ -70,15 +68,15 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* parameterによって処理を分ける
*
* @param context ABVContentViewActivity
* @param cmd
* @param cmd
コマンド
* @param taskKey タスクキー
* @param enableReportHistory
* @param param
* @param enableReportHistory
履歴を残すかどうか
* @param param
パラメータ
* @param operationId プロジェクトID
* @param contentPath
* @param reportType
* @param finishCallback
* @param taskReportLevel
* @param contentPath
添付資料のパス
* @param reportType
報告タイプ
* @param finishCallback
最後に呼ぶコールバック
* @param taskReportLevel
作業の報告レベル
*/
public
void
doABookCheckParam
(
ABVContentViewActivity
context
,
String
cmd
,
String
taskKey
,
int
enableReportHistory
,
Map
<
String
,
String
>
param
,
long
operationId
,
String
contentPath
,
long
contentId
,
int
reportType
,
Callback
finishCallback
,
int
taskReportLevel
)
throws
IOException
{
int
taskReportSendId
=
0
;
...
...
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