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
fb28ee85
Commit
fb28ee85
authored
Jun 29, 2019
by
Jeong Gilmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#33721 絞り検索のAPIとの連携
- 絞り検索のマスタデータを受信処理の修正
parent
09d4ce4c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
132 additions
and
78 deletions
+132
-78
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
+1
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/ApertureMasterDataJSON.java
+7
-17
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/parameters/GetApertureMasterDataParameters.java
+1
-10
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/ABVEnvironment.java
+15
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/ABVDataCache.java
+17
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/download/ContentRefresher.java
+14
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/ApertureMasterDataLogic.java
+63
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
+3
-18
ABVJE_UI_Android/src/jp/agentec/abook/abv/launcher/android/ABVApplication.java
+1
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
+10
-27
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/AcmsClient.java
View file @
fb28ee85
...
...
@@ -975,7 +975,6 @@ public class AcmsClient implements AcmsClientResponseListener {
*/
public
ApertureMasterDataJSON
getApertureMasterData
(
GetApertureMasterDataParameters
param
)
throws
NetworkDisconnectedException
,
AcmsException
{
HttpResponse
response
=
send
(
AcmsApis
.
ApiGetApertureMasterData
,
param
);
ApertureMasterDataJSON
json
=
new
ApertureMasterDataJSON
(
response
.
httpResponseBody
);
return
json
;
return
new
ApertureMasterDataJSON
(
response
.
httpResponseBody
);
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/ApertureMasterDataJSON.java
View file @
fb28ee85
package
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
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.abook.abv.bl.dto.WorkerGroupDto
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
org.json.adf.JSONArray
;
import
org.json.adf.JSONObject
;
...
...
@@ -22,10 +13,10 @@ import org.json.adf.JSONObject;
* @version 1.0.0
*/
public
class
ApertureMasterDataJSON
extends
AcmsCommonJSON
{
p
ublic
static
final
String
operationLastEditDate
=
"operation
LastEditDate"
;
p
ublic
static
final
String
ApertureData
=
"apertureData"
;
public
Date
lastEditDate
;
public
JSONObject
aperture
Json
;
p
rivate
static
final
String
apertureLastEditDate
=
"aperture
LastEditDate"
;
p
rivate
static
final
String
ApertureData
=
"apertureData"
;
public
String
lastEditDate
;
public
JSONObject
aperture
Data
;
public
ApertureMasterDataJSON
(
String
jsonString
)
throws
AcmsException
{
super
(
jsonString
);
...
...
@@ -34,16 +25,15 @@ public class ApertureMasterDataJSON extends AcmsCommonJSON {
@Override
protected
void
parse
(
JSONObject
json
)
throws
JSONValidationException
{
// 絞り検索の日付を取得
if
(
json
.
has
(
operation
LastEditDate
))
{
lastEditDate
=
DateTimeUtil
.
toDate
(
json
.
getString
(
operationLastEditDate
),
"UTC"
,
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
);
if
(
json
.
has
(
aperture
LastEditDate
))
{
lastEditDate
=
json
.
getString
(
apertureLastEditDate
);
}
// 絞り検索のデータを取得
if
(
json
.
has
(
ApertureData
))
{
JSONArray
apertureList
=
json
.
getJSONArray
(
ApertureData
);
for
(
int
i
=
0
;
i
<
apertureList
.
length
();
i
++)
{
apertureJson
=
apertureList
.
getJSONObject
(
i
);
json
.
getJSONArray
(
ApertureData
);
Logger
.
e
(
apertureJson
.
toString
());
apertureData
=
apertureList
.
getJSONObject
(
i
);
}
}
}
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/parameters/GetApertureMasterDataParameters.java
View file @
fb28ee85
...
...
@@ -6,15 +6,7 @@ package jp.agentec.abook.abv.bl.acms.client.parameters;
public
class
GetApertureMasterDataParameters
extends
AcmsParameters
{
private
long
operationId
;
public
GetApertureMasterDataParameters
(
String
sid
,
long
operationId
)
{
public
GetApertureMasterDataParameters
(
String
sid
)
{
super
(
sid
);
this
.
operationId
=
operationId
;
}
public
long
getOperationId
()
{
return
operationId
;
}
}
\ No newline at end of file
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/ABVEnvironment.java
View file @
fb28ee85
...
...
@@ -177,7 +177,14 @@ public class ABVEnvironment {
public
static
final
boolean
DebugContentDownload
=
false
;
public
boolean
enableToastMessage
=
true
;
// 絞り検索マスタ参照パス
public
static
final
String
OperationMasterDataDirFormat
=
"%s/ABook/operation/master"
;
// 絞り検索マスタファイル名
public
static
final
String
ApertureMasterDataFileName
=
"apertureMaster.json"
;
private
ABVEnvironment
()
{
}
...
...
@@ -766,4 +773,11 @@ public class ABVEnvironment {
return
reportDate
;
}
}
// MasterDataに対したJSONファイルの位置
// 経路:root/files/operation/master
public
String
getMasterFilePath
()
{
return
String
.
format
(
OperationMasterDataDirFormat
,
rootDirectory
);
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/ABVDataCache.java
View file @
fb28ee85
...
...
@@ -41,7 +41,7 @@ public class ABVDataCache {
private
static
final
int
SEVER_ALERT_INTERVAL
=
30
;
//システム日付チェック前後期間(分)
// Serverから取得したapertureMasterDataのfetchDateを一時的に保存するための変数
p
ublic
String
tempApertureMasterDataFetchDate
=
null
;
p
rivate
String
tempApertureMasterDataFetchDate
=
null
;
/**
* 未指定ジャンルのID
...
...
@@ -373,4 +373,20 @@ public class ABVDataCache {
}
return
null
;
}
/**
* tempApertureMasterDataFetchDateを更新する
* @param date
*/
public
void
setTempApertureMasterDataFetchDate
(
String
date
){
this
.
tempApertureMasterDataFetchDate
=
date
;
}
/**
* tempApertureMasterDataFetchDateをreturn
* @return tempApertureMasterDataFetchDate
*/
public
String
getTempApertureMasterDataFetchDate
(){
return
tempApertureMasterDataFetchDate
;
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/download/ContentRefresher.java
View file @
fb28ee85
...
...
@@ -23,6 +23,7 @@ import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import
jp.agentec.abook.abv.bl.dto.ContentDto
;
import
jp.agentec.abook.abv.bl.dto.EnqueteDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.ApertureMasterDataLogic
;
import
jp.agentec.abook.abv.bl.logic.CategoryLogic
;
import
jp.agentec.abook.abv.bl.logic.ContentLogic
;
import
jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic
;
...
...
@@ -62,7 +63,12 @@ public class ContentRefresher {
private
boolean
initializingRefreshing
=
false
;
private
static
final
int
refreshSleepInterval
=
500
;
private
static
final
int
maxRefreshWorker
=
2
;
// masterDataを取得するため登録
private
ApertureMasterDataLogic
apertureMasterDataLogic
=
AbstractLogic
.
getLogic
(
ApertureMasterDataLogic
.
class
);
public
static
ContentRefresher
getInstance
()
{
if
(
instance
==
null
)
{
synchronized
(
ContentRefresher
.
class
)
{
...
...
@@ -156,6 +162,13 @@ public class ContentRefresher {
contractLogic
.
initializeContractServiceOption
();
// サービスオプション関連処理
groupLogic
.
initializeGroups
();
// グループ設定(グループ変更の場合、FetchDateをクリアする)
categoryLogic
.
initializeCategories
();
// カテゴリ設定
// 絞り検索マスタデータの最新更新された時のFetchDateを一時に保存する。
Logger
.
d
(
TAG
,
"before fetchDate : "
+
ABVDataCache
.
getInstance
().
getTempApertureMasterDataFetchDate
());
// CMSでメンテナンスされる絞り検索マスタデータをアプリから取得できるようにJSONファイルを生成する。
apertureMasterDataLogic
.
initializeApertureMasterData
(
ABVDataCache
.
getInstance
().
getTempApertureMasterDataFetchDate
());
Logger
.
d
(
TAG
,
"after fetchDate : "
+
ABVDataCache
.
getInstance
().
getTempApertureMasterDataFetchDate
());
if
(
interrupt
)
{
// この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別))
Logger
.
d
(
TAG
,
"stop refresh worker before content update."
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/ApertureMasterDataLogic.java
0 → 100644
View file @
fb28ee85
package
jp
.
agentec
.
abook
.
abv
.
bl
.
logic
;
import
org.json.adf.JSONObject
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.adf.util.DateTimeFormat
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
jp.agentec.adf.util.FileUtil
;
public
class
ApertureMasterDataLogic
extends
AbstractLogic
{
private
static
final
java
.
lang
.
String
TAG
=
"RefineMasterDataLogic"
;
/**
* グループ情報をサーバから受信し、ローカルに保存します。既存のデータは上書きされます。また、サーバにないグループがローカルにある場合、そのグループは削除されます。
* 絞り検索マスタデータ情報をサーバから受信し、ローカルにJSONで保存する。
* 日付を比べてサーバーからローカルのデータより最新のデータを受信した場合、受信した情報を保存する。
* ローカルの日付はない場合、受信した情報を保存する。
* @param lastFetchDateString
*/
public
void
initializeApertureMasterData
(
String
lastFetchDateString
)
{
try
{
GetApertureMasterDataParameters
param
=
new
GetApertureMasterDataParameters
(
cache
.
getMemberInfo
().
sid
);
//サーバーから絞り検索マスタデータを取得
ApertureMasterDataJSON
masterDataJson
=
AcmsClient
.
getInstance
(
cache
.
getUrlPath
(),
networkAdapter
).
getApertureMasterData
(
param
);
//サーバーデータの日付
String
lastEditDateString
=
masterDataJson
.
lastEditDate
;
if
(
lastFetchDateString
!=
null
)
{
Date
lastFetchDate
=
DateTimeUtil
.
toDate
(
lastFetchDateString
,
"UTC"
,
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
);
Date
lastEditDate
=
DateTimeUtil
.
toDate
(
lastEditDateString
,
"UTC"
,
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
);
if
(
lastFetchDate
==
null
||
lastEditDate
.
after
(
lastFetchDate
))
{
createApertureMasterDataJson
(
masterDataJson
.
apertureData
);
cache
.
setTempApertureMasterDataFetchDate
(
lastEditDateString
);
}
}
else
{
createApertureMasterDataJson
(
masterDataJson
.
apertureData
);
cache
.
setTempApertureMasterDataFetchDate
(
lastEditDateString
);
}
Logger
.
i
(
masterDataJson
.
toString
());
}
catch
(
Exception
e
)
{
Logger
.
e
(
TAG
,
"apertureMasterDataSend error : "
,
e
);
}
}
/**
* apertureMaster.jsonファイル作成
* @param json
* @throws IOException
*/
private
void
createApertureMasterDataJson
(
JSONObject
json
)
throws
IOException
{
// マスタデータの保存されるパス
String
masterDataJsonPath
=
ABVEnvironment
.
getInstance
().
getMasterFilePath
()
+
File
.
separator
+
ABVEnvironment
.
getInstance
().
ApertureMasterDataFileName
;
FileUtil
.
createFile
(
masterDataJsonPath
,
json
.
toString
());
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
View file @
fb28ee85
...
...
@@ -798,6 +798,9 @@ public class OperationLogic extends AbstractLogic {
jsonObject
.
put
(
"attachedPath"
,
"../../../../files/ABook/operation/"
+
operationId
);
jsonObject
.
put
(
"attachedMoviePath"
,
ABVEnvironment
.
getInstance
().
getAttachedMoviesFilePath
(
contentId
));
// 絞り検索マスタデータのパス
jsonObject
.
put
(
"masterPath"
,
ABVEnvironment
.
getInstance
().
getMasterFilePath
()
+
File
.
separator
+
ABVEnvironment
.
getInstance
().
ApertureMasterDataFileName
);
FileUtil
.
createFile
(
contentPath
+
"/content.json"
,
jsonObject
.
toString
());
}
...
...
@@ -1597,22 +1600,4 @@ public class OperationLogic extends AbstractLogic {
mTaskDao
.
insert
(
taskDto
);
}
}
/**
* 絞り検索のjsonファイル
* apertureMaster.jsonを作成
*
* @param json
* @param contentPath
* @throws IOException
*/
public
void
createJsonForApertureData
(
JSONObject
json
,
String
contentPath
)
throws
IOException
{
try
{
FileUtil
.
createFile
(
contentPath
+
"/apertureMaster.json"
,
json
.
toString
());
}
catch
(
IOException
e
)
{
Logger
.
e
(
TAG
,
"createJsonForapertureMaster error : "
,
e
);
throw
e
;
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/launcher/android/ABVApplication.java
View file @
fb28ee85
...
...
@@ -54,7 +54,7 @@ public class ABVApplication extends MultiDexApplication {
FileUtil
.
delete
(
ABVEnvironment
.
getInstance
().
getCacheTempAttachedImageDirPath
());
// 絞り検索のfetchDateをローカルに保存された値を取得して設定する
ABVDataCache
.
getInstance
().
tempApertureMasterDataFetchDate
=
PreferenceUtil
.
getUserPref
(
this
,
AppDefType
.
UserPrefKey
.
APERTURE_MASTER_DATA_FETCH_DATE
,
null
);
ABVDataCache
.
getInstance
().
setTempApertureMasterDataFetchDate
(
PreferenceUtil
.
getUserPref
(
this
,
AppDefType
.
UserPrefKey
.
APERTURE_MASTER_DATA_FETCH_DATE
,
null
)
);
}
@Override
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
View file @
fb28ee85
...
...
@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.home.activity;
import
android.app.DatePickerDialog
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.res.Configuration
;
...
...
@@ -12,7 +11,6 @@ import android.graphics.BitmapFactory;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.provider.MediaStore
;
import
android.speech.tts.TextToSpeech
;
import
android.util.SparseBooleanArray
;
import
android.view.KeyEvent
;
import
android.view.View
;
...
...
@@ -89,9 +87,9 @@ import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import
jp.agentec.abook.abv.bl.dto.TaskDto
;
import
jp.agentec.abook.abv.bl.dto.TaskReportDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.ApertureMasterDataLogic
;
import
jp.agentec.abook.abv.bl.logic.OperationLogic
;
import
jp.agentec.abook.abv.bl.logic.PushMessageLogic
;
import
jp.agentec.abook.abv.cl.util.AndroidStringUtil
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
...
...
@@ -188,7 +186,9 @@ public class OperationListActivity extends ABVUIActivity {
private
ArrayList
<
Integer
>
mAllOperationReportTypes
;
// 絞り検索マスタデータ
private
Date
mApertureLastEditDate
;
// private Date mApertureLastEditDate;
// 絞り検索マスタLogic
private
ApertureMasterDataLogic
mApertureMasterDataLogic
=
AbstractLogic
.
getLogic
(
ApertureMasterDataLogic
.
class
);
// ビューの作成
private
class
ReloadHandler
implements
Runnable
{
...
...
@@ -397,6 +397,8 @@ public class OperationListActivity extends ABVUIActivity {
getABVUIDataCache
().
saveLastUpdateTime
();
// リソースパターンを取得し、ローカルに保存する。
setResourcePattern
();
// 絞り検索マスタデータ最新更新する時fetchDateをローカルに保存する。
setApertureMasterDataFetchDate
();
refreshOperationList
();
}
}
...
...
@@ -638,7 +640,7 @@ public class OperationListActivity extends ABVUIActivity {
mOperationLogic
.
createJsonForOperationContent
(
operationDto
.
operationId
,
contentPath
,
operationDto
.
reportType
==
ReportType
.
RoutineTask
);
// 絞り検索マスタデータを受信、JSONファイルを生成
mAperture
LastEditDate
=
receptionApertureMasterData
(
operationDto
.
operationId
,
contentPath
);
mAperture
MasterDataLogic
.
initializeApertureMasterData
(
ABVDataCache
.
getInstance
().
getTempApertureMasterDataFetchDate
()
);
// サーバ作業後、対応必要
StringBuffer
path
=
new
StringBuffer
();
...
...
@@ -1922,28 +1924,9 @@ public class OperationListActivity extends ABVUIActivity {
}
/**
* 絞り検索マスタデータの受信
* @param operationId
* @return
* @throws NetworkDisconnectedException
* @throws ABVException
* @throws IOException
* @throws InterruptedException
* @throws NoSuchAlgorithmException
* @throws ZipException
* 絞り検索の日付を設定
*/
public
Date
receptionApertureMasterData
(
long
operationId
,
String
contentPath
)
throws
NetworkDisconnectedException
,
ABVException
,
IOException
{
// 絞り検索のためparamを設定
GetApertureMasterDataParameters
param
=
new
GetApertureMasterDataParameters
(
ABVDataCache
.
getInstance
().
getMemberInfo
().
sid
,
operationId
);
// 絞り検索した日付の保存
Date
lastEditDate
;
// JSONデータのparsing
ApertureMasterDataJSON
json
=
AcmsClient
.
getInstance
(
ABVDataCache
.
getInstance
().
getUrlPath
(),
ABVEnvironment
.
getInstance
().
networkAdapter
).
getApertureMasterData
(
param
);
// JSONファイルを生成
mOperationLogic
.
createJsonForApertureData
(
json
.
apertureJson
,
contentPath
);
// 絞り検索した日付を取得
lastEditDate
=
json
.
lastEditDate
;
return
lastEditDate
;
private
void
setApertureMasterDataFetchDate
()
{
putUserPref
(
AppDefType
.
UserPrefKey
.
APERTURE_MASTER_DATA_FETCH_DATE
,
ABVDataCache
.
getInstance
().
getTempApertureMasterDataFetchDate
());
}
}
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