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
13462e3f
Commit
13462e3f
authored
Jun 15, 2022
by
onuma
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'features/1.4.300_47941' into features/1.4.300
parents
e5faafe3
e488e53a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
2 deletions
+173
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/ABVEnvironment.java
+2
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookKeys.java
+3
-0
ABVJE_BL/src/jp/agentec/adf/util/FileUtil.java
+26
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+142
-2
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/ABVEnvironment.java
View file @
13462e3f
...
...
@@ -155,6 +155,8 @@ public class ABVEnvironment {
public
static
final
String
OperationTaskKeyRoutineTaskReportDirFormat
=
OperationTaskKeyDirFormat
+
"/%d/%s/%s"
;
// #32926 作業報告画面改善 end
public
static
final
String
ContinuousTaskReportJsonDirFormat
=
ContentCacheDirectoryFormat
+
"/processList/phaseList/phase_%d"
;
// アルコールチェッカー(userDataKey)を保存する場所
public
static
final
String
userDataDir
=
"/userData/"
;
/**
* コンテンツのファイルを暗号化するときに、暗号化するサイズをバイト単位で指定します。
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/constant/ABookKeys.java
View file @
13462e3f
...
...
@@ -74,6 +74,8 @@ public class ABookKeys {
public
static
final
String
CMD_PAGE_NUM
=
"pageNum"
;
public
static
final
String
CMD_GET_GROUP_TREE_INFO
=
"getGroupTreeInfo"
;
public
static
final
String
CMD_CLOSE_TASK_LIST
=
"closeTaskList"
;
public
static
final
String
CMD_LOAD_USER_DATA
=
"loadUserData"
;
public
static
final
String
CMD_SAVE_USER_DATA
=
"saveUserData"
;
public
static
final
String
GPS_TYPE
=
"gpsType"
;
public
static
final
String
STATUS_CODE
=
"statusCode"
;
...
...
@@ -86,6 +88,7 @@ public class ABookKeys {
public
static
final
String
ATTACHED_CHANGE_FLAG
=
"attachedChangeFlag"
;
public
static
final
String
ROUTINE_TASK_FLAG
=
"routineTaskFlag"
;
public
static
final
String
UPDATE_HOTSPOT_ONLY_FLAG
=
"updateHotSpotOnlyFlag"
;
public
static
final
String
USER_DATA
=
"userData"
;
//Webviewから呼び出すApiキー
public
static
final
class
CMD_KEY
{
...
...
ABVJE_BL/src/jp/agentec/adf/util/FileUtil.java
View file @
13462e3f
...
...
@@ -1065,4 +1065,30 @@ public class FileUtil {
fileOutputStream
.
close
();
inputStream
.
close
();
}
/**
* ディレクトリ配下のファイルとディレクトリの一覧を作成して返します。
* @param path ディレクトリ
* @return ファイルとディレクトリの一覧
*/
public
static
File
[]
listFiles
(
String
path
)
{
File
dir
=
new
File
(
path
);
File
[]
list
=
dir
.
listFiles
();
return
list
;
}
/**
* 指定した絶対パスの一番下のフォルダ名を返します
* @param dir ディレクトリ
* @return 一番下のディレクトリ名
*/
public
static
String
getLastChildDirectoryName
(
File
dir
)
{
try
{
String
lastDir
=
dir
.
getPath
().
substring
(
dir
.
getPath
().
lastIndexOf
(
"/"
)
+
1
);
return
lastDir
;
}
catch
(
IndexOutOfBoundsException
e
)
{
}
return
null
;
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
13462e3f
...
...
@@ -25,9 +25,15 @@ import android.widget.Toast;
import
org.json.adf.JSONObject
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
...
...
@@ -916,18 +922,24 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// showHelpViewDialog(helpViewType);
// }
/**
* WebView発生を受け取るメソッド
* @param uri 情報がkey, valueの形式で格納されている
* @param operationTaskDto HotSpotの情報などが入っている。報告タイプによっては、使わないケースもある
*/
public
void
commonShouldOverrideUrlLoading
(
Uri
uri
,
OperationTaskDto
operationTaskDto
)
{
Logger
.
d
(
TAG
,
"Uri : %s"
,
uri
);
//parent method
Map
<
String
,
String
>
abookCheckParam
=
new
HashMap
<
String
,
String
>();
for
(
String
key
:
uri
.
getQueryParameterNames
())
{
abookCheckParam
.
put
(
key
,
uri
.
getQueryParameter
(
key
));
Logger
.
d
(
TAG
,
"key = %s, value = %s"
,
key
,
uri
.
getQueryParameter
(
key
));
}
mCmd
=
abookCheckParam
.
get
(
ABookKeys
.
CMD
);
if
(
abookCheckParam
.
containsKey
(
ABookKeys
.
TASK_KEY
))
{
mTaskKey
=
abookCheckParam
.
get
(
ABookKeys
.
TASK_KEY
);
}
int
taskReportLevel
=
0
;
// 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
if
(
abookCheckParam
.
containsKey
(
ABookKeys
.
TASK_REPORT_LEVEL
))
{
taskReportLevel
=
Integer
.
parseInt
(
abookCheckParam
.
get
(
ABookKeys
.
TASK_REPORT_LEVEL
));
// 作業報告レベル
...
...
@@ -1190,9 +1202,137 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
putUserPref
(
AppDefType
.
UserPrefKey
.
SYNC_TARGET_OPERATION_ID
,
mOperationId
);
finishActivity
();
// 開いてる画面を閉じる
}
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_LOAD_USER_DATA
))
{
// 前回の入力内容を読み込む
Logger
.
i
(
TAG
,
"load taskKey = "
+
abookCheckParam
.
get
(
ABookKeys
.
TASK_KEY
));
loadUserDataKey
(
abookCheckParam
.
get
(
ABookKeys
.
TASK_KEY
));
}
else
if
(
mCmd
.
equals
(
ABookKeys
.
CMD_SAVE_USER_DATA
))
{
// 入力内容を保存する
Logger
.
i
(
TAG
,
"save taskKey = "
+
abookCheckParam
.
get
(
ABookKeys
.
TASK_KEY
));
Logger
.
i
(
TAG
,
"save userData = "
+
abookCheckParam
.
get
(
ABookKeys
.
USER_DATA
));
saveUserDataKey
(
abookCheckParam
.
get
(
ABookKeys
.
TASK_KEY
),
abookCheckParam
.
get
(
ABookKeys
.
USER_DATA
));
}
}
/**
* アルコールチェッカー、userDataのルートディレクトリを返す
* 通常 cache/userData/
* @return ルートディレクトリ
*/
private
String
getUserDataDirRoot
()
{
Logger
.
d
(
TAG
,
"userDataDirRoot = %s"
,
ABVEnvironment
.
getInstance
().
cacheDirectory
+
ABVEnvironment
.
getInstance
().
userDataDir
);
return
ABVEnvironment
.
getInstance
().
cacheDirectory
+
ABVEnvironment
.
getInstance
().
userDataDir
;
}
/**
* JSから送られてきたキーデータを保存する
* @param userKeyFileName 保存するユーザーキーファイル名
* @param userData 保存するデータ
*/
private
void
saveUserDataKey
(
String
userKeyFileName
,
String
userData
)
{
if
(
StringUtil
.
isNullOrEmpty
(
userKeyFileName
))
{
Logger
.
d
(
TAG
,
"userKeyFileName is null or empty."
);
// 読み込むためのキーがない
afterABookCheckApi
(
ABookKeys
.
CMD_SAVE_USER_DATA
,
userKeyFileName
,
1
,
""
,
""
);
return
;
}
// フォルダ作成(すでに存在するなら作成はされない)
String
userDataFolderRoot
=
getUserDataDirRoot
();
FileUtil
.
createNewDirectory
(
userDataFolderRoot
+
ABVDataCache
.
getInstance
().
getMemberInfo
().
loginId
);
File
[]
userDirs
=
FileUtil
.
listFiles
(
userDataFolderRoot
);
for
(
File
dir
:
userDirs
)
{
try
{
Logger
.
d
(
TAG
,
"getAbsolutePath = %s"
,
dir
.
getAbsolutePath
());
// 一番下のフォルダ名 = ユーザーID
String
userId
=
FileUtil
.
getLastChildDirectoryName
(
dir
);
Logger
.
d
(
TAG
,
"userId = %s"
,
userId
);
if
(!
ABVDataCache
.
getInstance
().
getMemberInfo
().
loginId
.
equals
(
userId
))
{
// ログインしているユーザー以外のものは削除
FileUtil
.
delete
(
dir
);
continue
;
}
BufferedWriter
bw
=
null
;
if
(
userData
!=
null
)
{
try
{
FileOutputStream
fo
=
new
FileOutputStream
(
userDataFolderRoot
+
"/"
+
userId
+
"/"
+
userKeyFileName
);
OutputStreamWriter
osw
=
new
OutputStreamWriter
(
fo
,
StandardCharsets
.
UTF_8
);
bw
=
new
BufferedWriter
(
osw
);
bw
.
write
(
userData
);
bw
.
close
();
}
catch
(
IOException
e
)
{
Logger
.
e
(
TAG
,
""
+
e
);
}
finally
{
try
{
if
(
bw
!=
null
)
{
bw
.
close
();
}
}
catch
(
IOException
e
)
{
Logger
.
e
(
TAG
,
""
+
e
);
}
}
afterABookCheckApi
(
ABookKeys
.
CMD_SAVE_USER_DATA
,
userKeyFileName
,
0
,
""
,
""
);
}
}
catch
(
IndexOutOfBoundsException
iobex
)
{
Logger
.
e
(
TAG
,
""
+
iobex
);
}
}
}
/**
* キーデータファイルを読み込んで、JSにわたす
* @param userKeyFileName ファイル名
*/
private
void
loadUserDataKey
(
String
userKeyFileName
)
{
if
(
StringUtil
.
isNullOrEmpty
(
userKeyFileName
))
{
Logger
.
d
(
TAG
,
"userKeyFileName is null or Empty"
);
// ファイル名が指定されていない
afterABookCheckApi
(
ABookKeys
.
CMD_LOAD_USER_DATA
,
userKeyFileName
,
1
,
""
,
""
);
return
;
}
String
keyFilePath
=
getUserDataDirRoot
()
+
"/"
+
ABVDataCache
.
getInstance
().
getMemberInfo
().
loginId
+
"/"
+
userKeyFileName
;
Logger
.
d
(
TAG
,
"keyFilePath = "
+
keyFilePath
);
FileInputStream
fi
=
null
;
InputStreamReader
isr
=
null
;
try
{
StringBuffer
sb
=
new
StringBuffer
();
fi
=
new
FileInputStream
(
keyFilePath
);
isr
=
new
InputStreamReader
(
fi
,
StandardCharsets
.
UTF_8
);
int
data
;
while
((
data
=
isr
.
read
())
!=
-
1
)
{
sb
.
append
((
char
)
data
);
}
isr
.
close
();
Logger
.
d
(
TAG
,
"result = "
+
sb
.
toString
());
afterABookCheckApi
(
ABookKeys
.
CMD_LOAD_USER_DATA
,
userKeyFileName
,
0
,
""
,
sb
.
toString
());
return
;
}
catch
(
FileNotFoundException
fex
)
{
Logger
.
e
(
TAG
,
""
+
fex
);
}
catch
(
IOException
e
)
{
Logger
.
e
(
TAG
,
""
+
e
);
}
finally
{
try
{
if
(
isr
!=
null
)
{
isr
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
// 何かしらのExceptionが発生した
afterABookCheckApi
(
ABookKeys
.
CMD_LOAD_USER_DATA
,
userKeyFileName
,
1
,
""
,
""
);
}
public
void
commonAttachedDataUrl
(
String
taskKey
,
String
data
)
{
boolean
isError
=
false
;
...
...
@@ -1245,7 +1385,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
public
void
afterABookCheckApi
(
final
String
cmd
,
final
String
taskKey
,
final
int
result
,
final
String
message
,
final
String
extParam
,
final
boolean
isParent
)
{
Logger
.
v
(
TAG
,
"run javaScript for ABookCheck : cmd=%s, taskKey=%s, result=%s, message=%s"
,
cmd
,
taskKey
,
result
,
message
);
Logger
.
d
(
TAG
,
"run javaScript for ABookCheck : cmd=%s, taskKey=%s, result=%s, message=%s"
,
cmd
,
taskKey
,
result
,
message
);
final
String
finalParent
=
isParent
?
"window.parent."
:
""
;
runOnUiThread
(
new
Runnable
()
{
@Override
...
...
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