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
28dda6be
Commit
28dda6be
authored
Nov 27, 2024
by
NGUYEN LONG CHAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
62460:アプリ自動同期仕様変更
自動同期機能のために30分間のコードチェックを実装。
parent
5b70622b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
9 deletions
+52
-9
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/OperationDao.java
+12
-3
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TOperation.java
+4
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/OperationDto.java
+4
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
+27
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
+5
-3
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/OperationDao.java
View file @
28dda6be
...
...
@@ -131,6 +131,11 @@ public class OperationDao extends AbstractDao {
dto
.
statusCompletedCount
=
cursor
.
getInt
(
column
);
}
column
=
cursor
.
getColumnIndex
(
"operation_last_sync_date"
);
if
(
column
!=
-
1
)
{
dto
.
operationLastSyncDate
=
DateTimeUtil
.
toDate
(
cursor
.
getString
(
column
),
"UTC"
,
DateTimeFormat
.
yyyyMMddHHmmss_hyphen
);
}
return
dto
;
}
...
...
@@ -205,9 +210,10 @@ public class OperationDao extends AbstractDao {
+
"status_not_started_count, "
+
"status_working_count, "
+
"status_completed_count, "
+
"quick_report) "
+
"quick_report, "
+
"operation_last_sync_date) "
+
"values "
+
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
,
+
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
,?
)"
,
dto
.
getInsertValues
());
}
...
...
@@ -232,7 +238,8 @@ public class OperationDao extends AbstractDao {
+
"status_not_started_count=?, "
+
"status_working_count=?, "
+
"status_completed_count=?, "
+
"quick_report=? "
+
"quick_report=?, "
+
"operation_last_sync_date=? "
+
"where operation_id=?"
,
dto
.
getUpdateValues
());
return
count
>
0
;
...
...
@@ -301,6 +308,7 @@ public class OperationDao extends AbstractDao {
sql
.
append
(
" top.status_not_started_count, "
);
sql
.
append
(
" top.status_working_count, "
);
sql
.
append
(
" top.status_completed_count, "
);
sql
.
append
(
" top.operation_last_sync_date, "
);
sql
.
append
(
" CASE "
);
sql
.
append
(
" WHEN report_type = 1 THEN ( "
);
sql
.
append
(
" SELECT strftime('%Y/%m/%d %H:%M', datetime(ttr.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ttr.report_end_date, 'localtime')) "
);
...
...
@@ -466,6 +474,7 @@ public class OperationDao extends AbstractDao {
sql
.
append
(
" top.status_not_started_count, "
);
sql
.
append
(
" top.status_working_count, "
);
sql
.
append
(
" top.status_completed_count, "
);
sql
.
append
(
" top.operation_last_sync_date, "
);
sql
.
append
(
" CASE "
);
sql
.
append
(
" WHEN report_type = 1 THEN ( "
);
sql
.
append
(
" SELECT strftime('%Y/%m/%d %H:%M', datetime(ttr.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ttr.report_end_date, 'localtime')) "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TOperation.java
View file @
28dda6be
...
...
@@ -47,6 +47,7 @@ public class TOperation extends SQLiteTableScript {
sql
.
append
(
" , status_not_started_count INTEGER NOT NULL DEFAULT 0 "
);
sql
.
append
(
" , status_working_count INTEGER NOT NULL DEFAULT 0 "
);
sql
.
append
(
" , status_completed_count INTEGER NOT NULL DEFAULT 0 "
);
sql
.
append
(
" , operation_last_sync_date DATETIME "
);
sql
.
append
(
" , PRIMARY KEY (operation_id) "
);
sql
.
append
(
" ) "
);
ddl
.
add
(
sql
.
toString
());
...
...
@@ -67,6 +68,9 @@ public class TOperation extends SQLiteTableScript {
ddl
.
add
(
" ALTER TABLE t_operation ADD COLUMN status_working_count INTEGER NOT NULL DEFAULT 0 "
);
ddl
.
add
(
" ALTER TABLE t_operation ADD COLUMN status_completed_count INTEGER NOT NULL DEFAULT 0 "
);
}
if
(
oldVersion
<
DatabaseVersions
.
Ver1_0_612
)
{
ddl
.
add
(
" ALTER TABLE t_operation ADD COLUMN operation_last_sync_date DATETIME "
);
}
return
ddl
;
}
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/OperationDto.java
View file @
28dda6be
...
...
@@ -37,6 +37,8 @@ public class OperationDto extends AbstractDto {
public
int
statusWorkingCount
;
//「作業中」数
public
int
statusCompletedCount
;
// 「作業完了」数
public
Date
operationLastSyncDate
;
// 作業担当グループリスト
public
List
<
TaskWorkerGroupDto
>
taskWorkerGroupDtoList
;
// 作業種別に紐づく作業Dto
...
...
@@ -53,12 +55,12 @@ public class OperationDto extends AbstractDto {
@Override
public
Object
[]
getInsertValues
()
{
return
new
Object
[]
{
operationId
,
operationName
,
operationDescriptions
,
operationStartDate
,
operationEndDate
,
operationType
,
reportType
,
lastEditDate
,
contentCreatingFlg
,
editLockFlg
,
needSyncFlg
,
reportCycle
,
enableReportUpdate
,
enableReportHistory
,
enableReportEdit
,
enableAddReport
,
statusNotStartedCount
,
statusWorkingCount
,
statusCompletedCount
,
quickReport
};
return
new
Object
[]
{
operationId
,
operationName
,
operationDescriptions
,
operationStartDate
,
operationEndDate
,
operationType
,
reportType
,
lastEditDate
,
contentCreatingFlg
,
editLockFlg
,
needSyncFlg
,
reportCycle
,
enableReportUpdate
,
enableReportHistory
,
enableReportEdit
,
enableAddReport
,
statusNotStartedCount
,
statusWorkingCount
,
statusCompletedCount
,
quickReport
,
operationLastSyncDate
};
}
@Override
public
Object
[]
getUpdateValues
()
{
return
new
Object
[]
{
operationName
,
operationDescriptions
,
operationStartDate
,
operationEndDate
,
operationType
,
reportType
,
lastEditDate
,
contentCreatingFlg
,
editLockFlg
,
needSyncFlg
,
reportCycle
,
enableReportUpdate
,
enableReportHistory
,
enableReportEdit
,
enableAddReport
,
statusNotStartedCount
,
statusWorkingCount
,
statusCompletedCount
,
quickReport
,
operationId
};
return
new
Object
[]
{
operationName
,
operationDescriptions
,
operationStartDate
,
operationEndDate
,
operationType
,
reportType
,
lastEditDate
,
contentCreatingFlg
,
editLockFlg
,
needSyncFlg
,
reportCycle
,
enableReportUpdate
,
enableReportHistory
,
enableReportEdit
,
enableAddReport
,
statusNotStartedCount
,
statusWorkingCount
,
statusCompletedCount
,
quickReport
,
operation
LastSyncDate
,
operation
Id
};
}
@Override
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
View file @
28dda6be
...
...
@@ -90,6 +90,7 @@ public class OperationLogic extends AbstractLogic {
private
TaskWorkerGroupDao
mTaskWorkerGroupDao
=
AbstractDao
.
getDao
(
TaskWorkerGroupDao
.
class
);
private
static
final
int
FINISHED_STATUS
=
999
;
private
final
static
int
INTERVAL_LAST_EDIT_TIME_MS
=
1800000
;
public
void
initializeOperations
()
throws
AcmsException
,
NetworkDisconnectedException
{
// 作業グループリスト取得
setWorkingGroupList
();
...
...
@@ -117,6 +118,7 @@ public class OperationLogic extends AbstractLogic {
if
(
serverOperationDto
.
operationId
.
equals
(
localProjcetDto
.
operationId
))
{
//update
serverOperationDto
.
needSyncFlg
=
serverOperationDto
.
equalsLastEdit
(
localProjcetDto
)
?
localProjcetDto
.
needSyncFlg
:
true
;
serverOperationDto
.
operationLastSyncDate
=
localProjcetDto
.
operationLastSyncDate
;
List
<
Long
>
localOperationContentIds
=
mOperationContentDao
.
getContentIds
(
serverOperationDto
.
operationId
);
boolean
operationContentFlg
=
false
;
for
(
OperationContentDto
operationContentDto
:
serverOperationDto
.
operationContentDtoList
)
{
...
...
@@ -1573,9 +1575,10 @@ public class OperationLogic extends AbstractLogic {
* @param operationId
* @param lastEditDate
*/
public
void
finishedSyncOperation
(
Long
operationId
,
Date
lastEditDate
)
{
public
void
finishedSyncOperation
(
Long
operationId
,
Date
lastEditDate
,
Date
lastSyncDate
)
{
OperationDto
operationDto
=
mOperationDao
.
getOperationJoinContent
(
operationId
);
operationDto
.
lastEditDate
=
lastEditDate
;
operationDto
.
operationLastSyncDate
=
lastSyncDate
;
operationDto
.
needSyncFlg
=
false
;
mOperationDao
.
update
(
operationDto
);
}
...
...
@@ -1931,4 +1934,27 @@ public class OperationLogic extends AbstractLogic {
}
return
result
;
}
private
Boolean
isEnableTimeForAutoSync
(
Date
lastEditDateTime
)
{
Date
currentDateTime
=
DateTimeUtil
.
getCurrentDate
();
if
(
lastEditDateTime
==
null
)
{
return
true
;
}
else
{
long
diffInMillis
=
currentDateTime
.
getTime
()
-
lastEditDateTime
.
getTime
();
if
(
diffInMillis
>
INTERVAL_LAST_EDIT_TIME_MS
)
{
return
true
;
}
}
return
false
;
}
public
List
<
OperationDto
>
needSyncCheckArray
(
List
<
OperationDto
>
needSyncOperationInfoArray
)
{
List
<
OperationDto
>
needSyncCheckArray
=
new
ArrayList
<>();
for
(
OperationDto
operationDto
:
needSyncOperationInfoArray
)
{
if
(
isEnableTimeForAutoSync
(
operationDto
.
operationLastSyncDate
))
{
needSyncCheckArray
.
add
(
operationDto
);
}
}
return
needSyncCheckArray
;
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
View file @
28dda6be
...
...
@@ -505,8 +505,9 @@ public class OperationListActivity extends OperationActivity {
}
else
{
needSyncOperationList
.
addAll
(
mOperationDao
.
getNeedSyncAllOperation
());
}
if
(
needSyncOperationList
.
size
()
>
0
)
{
categoryBatchSync
(
needSyncOperationList
);
List
<
OperationDto
>
needSyncCheckArray
=
mOperationLogic
.
needSyncCheckArray
(
needSyncOperationList
);
if
(
needSyncCheckArray
.
size
()
>
0
)
{
categoryBatchSync
(
needSyncCheckArray
);
}
else
{
// donot need sync
autoSyncOperationDone
(
true
);
...
...
@@ -966,7 +967,8 @@ public class OperationListActivity extends OperationActivity {
// データの受信時、エラーキャッチのための変数を初期化
isSyncGetTaskFileError
=
false
;
if
(
mOperationLastEditDate
!=
null
)
{
mOperationLogic
.
finishedSyncOperation
(
operationId
,
mOperationLastEditDate
);
Date
operationLastSyncDate
=
DateTimeUtil
.
getCurrentDate
();
mOperationLogic
.
finishedSyncOperation
(
operationId
,
mOperationLastEditDate
,
operationLastSyncDate
);
progressDialogHorizontal
.
setProgress
(
100
);
}
mOperationLastEditDate
=
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