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
21004d02
Commit
21004d02
authored
Mar 05, 2019
by
Jeong Gilmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#32782 - 指示者テーブル関連削除(TaskDirections, TaskDirectionsItems)
parent
4dfce160
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
479 additions
and
100 deletions
+479
-100
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/OperationDataJSON.java
+4
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/RoutineTaskDataJSON.java
+4
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/ABVDataOpenHelper.java
+4
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/OperationDao.java
+4
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskDao.java
+10
-4
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskDirectionsDao.java
+32
-8
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskDirectionsItemsDao.java
+17
-4
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskReportDao.java
+18
-3
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TTaskDirections.java
+4
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TTaskDirectionsItems.java
+4
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TTaskReport.java
+3
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/TaskDto.java
+4
-1
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/TaskReportDto.java
+12
-2
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
+337
-63
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
+22
-7
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/OperationDataJSON.java
View file @
21004d02
...
...
@@ -50,7 +50,10 @@ public class OperationDataJSON extends AcmsCommonJSON {
for
(
int
i
=
0
;
i
<
taskList
.
length
();
i
++)
{
JSONObject
taskJson
=
taskList
.
getJSONObject
(
i
);
TaskDto
dto
=
new
TaskDto
();
dto
.
taskDirectionsDto
=
new
TaskDirectionsDto
();
// 0305 start
// dto.taskDirectionsDto = new TaskDirectionsDto();
dto
.
taskDirectionsDto
=
new
TaskReportDto
();
// 0305 end
dto
.
taskReportDto
=
new
TaskReportDto
();
dto
.
operationId
=
taskJson
.
getLong
(
OperationId
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/RoutineTaskDataJSON.java
View file @
21004d02
...
...
@@ -41,7 +41,10 @@ public class RoutineTaskDataJSON extends OperationDataJSON {
for
(
int
i
=
0
;
i
<
taskList
.
length
();
i
++)
{
JSONObject
taskJson
=
taskList
.
getJSONObject
(
i
);
TaskDto
dto
=
new
TaskDto
();
dto
.
taskDirectionsDto
=
new
TaskDirectionsDto
();
// 0305 start
// dto.taskDirectionsDto = new TaskDirectionsDto();
dto
.
taskDirectionsDto
=
new
TaskReportDto
();
// 0305 end
dto
.
taskReportDto
=
new
TaskReportDto
();
dto
.
operationId
=
taskJson
.
getLong
(
OperationId
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/ABVDataOpenHelper.java
View file @
21004d02
...
...
@@ -91,8 +91,10 @@ public class ABVDataOpenHelper {
iTableScripts
.
add
(
new
TOperation
());
iTableScripts
.
add
(
new
ROperationContent
());
iTableScripts
.
add
(
new
TTask
());
iTableScripts
.
add
(
new
TTaskDirections
());
iTableScripts
.
add
(
new
TTaskDirectionsItems
());
// 0305 start
// iTableScripts.add(new TTaskDirections());
// iTableScripts.add(new TTaskDirectionsItems());
// 0305 end
iTableScripts
.
add
(
new
TTaskReport
());
iTableScripts
.
add
(
new
TTaskReportSend
());
iTableScripts
.
add
(
new
TTaskReportItems
());
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/OperationDao.java
View file @
21004d02
...
...
@@ -204,8 +204,10 @@ public class OperationDao extends AbstractDao {
delete
(
"r_project_content"
,
null
,
null
);
delete
(
"t_project"
,
null
,
null
);
delete
(
"t_task"
,
null
,
null
);
delete
(
"t_task_directions"
,
null
,
null
);
delete
(
"t_task_directions_items"
,
null
,
null
);
// 0305 start
// delete("t_task_directions", null, null);
// delete("t_task_directions_items", null, null);
// 0305 end
delete
(
"t_task_report"
,
null
,
null
);
delete
(
"t_task_report_send"
,
null
,
null
);
delete
(
"t_task_report_items"
,
null
,
null
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskDao.java
View file @
21004d02
...
...
@@ -100,8 +100,12 @@ public class TaskDao extends AbstractDao {
if
(
directionFlg
)
{
delete
(
"t_task"
,
"task_key=?"
,
keyValues
);
delete
(
"t_task_directions"
,
"task_key=?"
,
keyValues
);
delete
(
"t_task_directions_items"
,
"task_key=?"
,
keyValues
);
// 0305 start
// delete("t_task_directions", "task_key=?", keyValues);
// delete("t_task_directions_items", "task_key=?", keyValues);
delete
(
"t_task_report"
,
"task_key=?"
,
keyValues
);
delete
(
"t_task_report_items"
,
"task_key=?"
,
keyValues
);
// 0305 end
}
else
{
delete
(
"t_task_report"
,
"task_key=?"
,
keyValues
);
delete
(
"t_task_report_items"
,
"task_key=?"
,
keyValues
);
...
...
@@ -114,8 +118,10 @@ public class TaskDao extends AbstractDao {
*/
public
void
delete
(
TaskDto
dto
)
{
delete
(
"t_task"
,
"task_key=?"
,
dto
.
getKeyValues
());
delete
(
"t_task_directions"
,
"task_key=?"
,
dto
.
getKeyValues
());
delete
(
"t_task_directions_items"
,
"task_key=?"
,
dto
.
getKeyValues
());
// 0305 start
// delete("t_task_directions", "task_key=?", dto.getKeyValues());
// delete("t_task_directions_items", "task_key=?", dto.getKeyValues());
// 0305 end
delete
(
"t_task_report"
,
"task_key=?"
,
dto
.
getKeyValues
());
delete
(
"t_task_report_items"
,
"task_key=?"
,
dto
.
getKeyValues
());
delete
(
"t_inspect_task_report"
,
"task_key=?"
,
new
String
[]
{
dto
.
taskKey
});
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskDirectionsDao.java
View file @
21004d02
...
...
@@ -11,7 +11,10 @@ import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
public
class
TaskDirectionsDao
extends
AbstractDao
{
private
static
final
String
TAG
=
"TaskDirectionsDao"
;
// 0305 start
// private static final String TAG = "TaskDirectionsDao";
private
static
final
String
TAG
=
"TaskReportDao"
;
// 0305 end
/*package*/
TaskDirectionsDao
()
{
}
...
...
@@ -58,7 +61,10 @@ public class TaskDirectionsDao extends AbstractDao {
public
void
insert
(
TaskDirectionsDto
dto
)
{
insert
(
"insert into t_task_directions "
// 0305 start
// insert("insert into t_task_directions "
// 0305 end
insert
(
"insert into t_task_report "
+
"(task_key, "
+
"json_data, "
+
"attached_file_name, "
...
...
@@ -73,7 +79,10 @@ public class TaskDirectionsDao extends AbstractDao {
public
List
<
TaskDirectionsDto
>
getTaskDirectionsByOperationId
(
Long
operationId
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
" select ttd.* "
);
sb
.
append
(
" from t_task_directions ttd "
);
// 0305 start
// sb.append(" from t_task_directions ttd ");
sb
.
append
(
" from t_task_report ttd "
);
// 0305 end
sb
.
append
(
" inner join "
);
sb
.
append
(
" t_task tt "
);
sb
.
append
(
" ON tt.task_key == ttd.task_key "
);
...
...
@@ -83,15 +92,24 @@ public class TaskDirectionsDao extends AbstractDao {
}
public
TaskDirectionsDto
getTaskDirections
(
String
taskKey
)
{
return
rawQueryGetDto
(
"select * from t_task_directions where task_key=?"
,
new
String
[]{
""
+
taskKey
},
TaskDirectionsDto
.
class
);
// 0305 start
// return rawQueryGetDto("select * from t_task_directions where task_key=?", new String[]{"" + taskKey}, TaskDirectionsDto.class);
return
rawQueryGetDto
(
"select * from t_task_report where task_key=?"
,
new
String
[]{
""
+
taskKey
},
TaskDirectionsDto
.
class
);
// 0305 end
}
public
String
getTaskDirectionsAttachedFileName
(
String
taskKey
)
{
return
rawQueryGetString
(
"select local_attached_file_name from t_task_directions where task_key=?"
,
new
String
[]{
""
+
taskKey
});
// 0305 start
// return rawQueryGetString("select local_attached_file_name from t_task_directions where task_key=?", new String[]{"" + taskKey});
return
rawQueryGetString
(
"select local_attached_file_name from t_task_report where task_key=?"
,
new
String
[]{
""
+
taskKey
});
// 0305 end
}
public
boolean
update
(
TaskDirectionsDto
dto
)
{
long
count
=
update
(
"update t_task_directions "
// 0305 start
// long count = update("update t_task_directions "
// 0305 end
long
count
=
update
(
"update t_task_report "
+
"set "
+
"json_data=?, "
+
"attached_file_name=?, "
...
...
@@ -110,7 +128,10 @@ public class TaskDirectionsDao extends AbstractDao {
public
List
<
TaskDirectionsDto
>
getSendableTaskData
(
Long
operationId
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
" select * "
);
sb
.
append
(
" from t_task_directions ttd "
);
// 0305 start
// sb.append(" from t_task_directions ttd ");
sb
.
append
(
" from t_task_report ttd "
);
// 0305 end
sb
.
append
(
" inner join "
);
sb
.
append
(
" t_task tt "
);
sb
.
append
(
" ON tt.task_key == ttd.task_key "
);
...
...
@@ -122,7 +143,10 @@ public class TaskDirectionsDao extends AbstractDao {
public
List
<
TaskDirectionsDto
>
getSendableTaskData
(
Long
operationId
,
String
taskKey
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
" select * "
);
sb
.
append
(
" from t_task_directions ttd "
);
// 0305 start
// sb.append(" from t_task_directions ttd ");
sb
.
append
(
" from t_task_report ttd "
);
// 0305 end
sb
.
append
(
" inner join "
);
sb
.
append
(
" t_task tt "
);
sb
.
append
(
" ON tt.task_key == ttd.task_key "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskDirectionsItemsDao.java
View file @
21004d02
...
...
@@ -35,17 +35,26 @@ public class TaskDirectionsItemsDao extends AbstractDao {
}
public
void
insertTaskDirectionsItems
(
TaskDirectionsItemsDto
dto
)
{
insert
(
"insert into t_task_directions_items (task_key, item_key, input_value) values (?,?,?)"
,
dto
.
getInsertValues
());
// 0305 start
// insert("insert into t_task_directions_items (task_key, item_key, input_value) values (?,?,?)", dto.getInsertValues());
insert
(
"insert into t_task_report_items (task_key, item_key, input_value) values (?,?,?)"
,
dto
.
getInsertValues
());
// 0305 end
}
public
List
<
TaskDirectionsItemsDto
>
getTaskDirectionsItemByTaskKey
(
String
taskKey
)
{
return
rawQueryGetDtoList
(
"select * from t_task_directions_items where task_key=?"
,
new
String
[]{
""
+
taskKey
},
TaskDirectionsItemsDto
.
class
);
// 0305 start
// return rawQueryGetDtoList("select * from t_task_directions_items where task_key=?", new String[]{"" + taskKey}, TaskDirectionsItemsDto.class);
return
rawQueryGetDtoList
(
"select * from t_task_report_items where task_key=?"
,
new
String
[]{
""
+
taskKey
},
TaskDirectionsItemsDto
.
class
);
// 0305 end
}
public
List
<
TaskDirectionsItemsDto
>
getTaskDirectionsItemByOperationId
(
Long
operationId
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
" select distinct ttdi.* "
);
sb
.
append
(
" from t_task_directions_items ttdi "
);
// 0305 start
// sb.append(" from t_task_directions_items ttdi ");
sb
.
append
(
" from t_task_report_items ttdi "
);
// 0305 end
sb
.
append
(
" inner join "
);
sb
.
append
(
" t_task tt "
);
sb
.
append
(
" ON tt.task_key == ttdi.task_key "
);
...
...
@@ -55,7 +64,10 @@ public class TaskDirectionsItemsDao extends AbstractDao {
}
public
boolean
updateTaskDirectionsItems
(
TaskDirectionsItemsDto
dto
)
{
long
count
=
update
(
"update t_task_directions_items set input_value=? where item_key=? and task_key=? "
,
dto
.
getUpdateValues
());
// 0305 start
// long count = update("update t_task_directions_items set input_value=? where item_key=? and task_key=? ", dto.getUpdateValues());
long
count
=
update
(
"update t_task_report_items set input_value=? where item_key=? and task_key=? "
,
dto
.
getUpdateValues
());
// 0305 end
return
(
count
>
0
);
}
}
\ No newline at end of file
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/TaskReportDao.java
View file @
21004d02
...
...
@@ -53,6 +53,12 @@ public class TaskReportDao extends AbstractDao {
if
(
column
!=
-
1
)
{
dto
.
delFlg
=
toBool
(
cursor
.
getInt
(
column
));
}
// 0305 start
column
=
cursor
.
getColumnIndex
(
"reportor_flag"
);
if
(
column
!=
-
1
)
{
dto
.
reportorFlag
=
toBool
(
cursor
.
getInt
(
column
));
}
// 0305 end
return
dto
;
}
...
...
@@ -64,6 +70,9 @@ public class TaskReportDao extends AbstractDao {
+
"attached_file_name, "
+
"local_attached_file_name, "
+
"attached_file_send_flg, "
// 0301 start
+
"reportor_flag, "
// 0301 end
+
"data_send_flg) "
+
"values "
+
"(?,?,?,?,?,?,?)"
,
...
...
@@ -93,7 +102,10 @@ public class TaskReportDao extends AbstractDao {
+
"attached_file_name=?, "
+
"local_attached_file_name=?, "
+
"attached_file_send_flg=?, "
+
"data_send_flg=? "
+
"data_send_flg=?, "
// 0301 start
+
"reportor_flag=? "
// 0301 end
+
"where task_key=?"
,
dto
.
getUpdateValues
());
return
count
>
0
;
...
...
@@ -121,7 +133,7 @@ public class TaskReportDao extends AbstractDao {
return
rawQueryGetDtoList
(
sb
.
toString
(),
new
String
[]{
""
+
operationId
},
TaskReportDto
.
class
);
}
public
List
<
TaskReportDto
>
getSendableTaskData
(
Long
operationId
,
String
taskKey
)
{
public
List
<
TaskReportDto
>
getSendableTaskData
(
Long
operationId
,
String
taskKey
,
boolean
reportorFlag
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
" select * "
);
sb
.
append
(
" from t_task_report ttr "
);
...
...
@@ -131,7 +143,10 @@ public class TaskReportDao extends AbstractDao {
sb
.
append
(
" WHERE ttr.data_send_flg = 1"
);
sb
.
append
(
" AND tt.project_id = ?"
);
sb
.
append
(
" AND tt.task_key = ?"
);
return
rawQueryGetDtoList
(
sb
.
toString
(),
new
String
[]{
""
+
operationId
,
""
+
taskKey
},
TaskReportDto
.
class
);
// 0305 start
sb
.
append
(
" AND ttr.reportor_flag = ?"
);
return
rawQueryGetDtoList
(
sb
.
toString
(),
new
String
[]{
""
+
operationId
,
""
+
taskKey
,
""
+
reportorFlag
},
TaskReportDto
.
class
);
// 0305 end
}
public
String
getTaskReportAttachedFileName
(
String
taskKey
)
{
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TTaskDirections.java
View file @
21004d02
...
...
@@ -21,7 +21,10 @@ public class TTaskDirections extends SQLiteTableScript {
List
<
String
>
ddl
=
new
ArrayList
<
String
>();
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" CREATE TABLE t_task_directions ( "
);
// 0305 start
// sql.append(" CREATE TABLE t_task_directions ( ");
sql
.
append
(
" CREATE TABLE t_task_report ( "
);
// 0305 end
sql
.
append
(
" task_key TEXT NOT NULL "
);
sql
.
append
(
" , json_data TEXT NOT NULL "
);
sql
.
append
(
" , attached_file_name TEXT "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TTaskDirectionsItems.java
View file @
21004d02
...
...
@@ -21,7 +21,10 @@ public class TTaskDirectionsItems extends SQLiteTableScript {
List
<
String
>
ddl
=
new
ArrayList
<
String
>();
StringBuffer
sql
=
new
StringBuffer
();
sql
.
append
(
" CREATE TABLE t_task_directions_items ( "
);
// 0305 start
// sql.append(" CREATE TABLE t_task_directions_items ( ");
sql
.
append
(
" CREATE TABLE t_task_report_items ( "
);
// 0305 end
sql
.
append
(
" task_key TEXT NOT NULL "
);
sql
.
append
(
" , item_key VARCHAR(64) "
);
sql
.
append
(
" , input_value VARCHAR(64) "
);
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/tables/TTaskReport.java
View file @
21004d02
...
...
@@ -28,6 +28,9 @@ public class TTaskReport extends SQLiteTableScript {
sql
.
append
(
" , local_attached_file_name TEXT "
);
sql
.
append
(
" , attached_file_send_flg BOOLEAN DEFAULT 0 "
);
sql
.
append
(
" , data_send_flg BOOLEAN DEFAULT 0 "
);
// 0305 start
sql
.
append
(
" , reportor_flag BOOLEAN DEFAULT 0 "
);
// 0305 end
sql
.
append
(
" ) "
);
ddl
.
add
(
sql
.
toString
());
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/TaskDto.java
View file @
21004d02
...
...
@@ -16,8 +16,11 @@ public class TaskDto extends AbstractDto {
public
String
taskHotSpotInfo
;
public
boolean
delFlg
;
public
TaskDirectionsDto
taskDirectionsDto
;
// 0305 start
// public TaskDirectionsDto taskDirectionsDto;
public
TaskReportDto
taskDirectionsDto
;
public
TaskReportDto
taskReportDto
;
// 0305 end
public
int
taskReportId
;
public
List
<
RoutineTaskReportDto
>
RoutineTaskReportList
;
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/dto/TaskReportDto.java
View file @
21004d02
...
...
@@ -15,14 +15,24 @@ public class TaskReportDto extends AbstractDto {
public
String
taskHotSpotInfo
;
public
boolean
delFlg
;
// 0301 start
public
boolean
reportorFlag
;
// 0301 end
@Override
public
Object
[]
getInsertValues
()
{
return
new
Object
[]
{
taskKey
,
jsonData
,
attachedFileName
,
localAttachedFileName
,
attachedFileSendFlg
,
dataSendFlg
};
// 0301 start
return
new
Object
[]
{
taskKey
,
jsonData
,
attachedFileName
,
localAttachedFileName
,
attachedFileSendFlg
,
dataSendFlg
,
reportorFlag
};
// return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg };
// 0301 end
}
@Override
public
Object
[]
getUpdateValues
()
{
return
new
Object
[]
{
jsonData
,
attachedFileName
,
localAttachedFileName
,
attachedFileSendFlg
,
dataSendFlg
,
taskKey
};
// 0301 start
return
new
Object
[]
{
jsonData
,
attachedFileName
,
localAttachedFileName
,
attachedFileSendFlg
,
dataSendFlg
,
reportorFlag
,
taskKey
};
// return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
// 0301 end
}
@Override
...
...
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/OperationLogic.java
View file @
21004d02
...
...
@@ -78,8 +78,10 @@ public class OperationLogic extends AbstractLogic {
private
WorkerGroupDao
mWorkerGroupDao
=
AbstractDao
.
getDao
(
WorkerGroupDao
.
class
);
private
TaskDao
mTaskDao
=
AbstractDao
.
getDao
(
TaskDao
.
class
);
private
TaskDirectionsDao
mTaskDirectionsDao
=
AbstractDao
.
getDao
(
TaskDirectionsDao
.
class
);
private
TaskDirectionsItemsDao
mTaskDirectionsItemsDao
=
AbstractDao
.
getDao
(
TaskDirectionsItemsDao
.
class
);
// 0301 start
// private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// private TaskDirectionsItemsDao mTaskDirectionsItemsDao = AbstractDao.getDao(TaskDirectionsItemsDao.class);
// 0301 end
private
TaskReportDao
mTaskReportDao
=
AbstractDao
.
getDao
(
TaskReportDao
.
class
);
private
TaskReportSendDao
mTaskReportSendDao
=
AbstractDao
.
getDao
(
TaskReportSendDao
.
class
);
private
TaskReportItemsDao
mTaskReportItemsDao
=
AbstractDao
.
getDao
(
TaskReportItemsDao
.
class
);
...
...
@@ -226,8 +228,65 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
public
void
insertTaskDirections
(
String
taskKey
,
long
operationId
,
long
contentId
,
JSONObject
taskDirectionsJson
,
String
hotSpotInfo
,
String
localAttachedFileName
,
boolean
attachedChangeFlag
,
boolean
dataSendFlg
)
throws
IOException
{
// 0305 start
// TaskDto taskDto = new TaskDto();
// TaskDirectionsDto taskDirectionsDto = new TaskDirectionsDto();
// JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
// taskDto.taskKey = taskKey;
// taskDto.operationId = operationId;
// taskDto.taskHotSpotInfo = hotSpotInfo;
//
//
// Iterator taskKeys = taskJson.keys();
// while (taskKeys.hasNext()) {
// TaskDirectionsItemsDto taskDirectionsItemsDto = new TaskDirectionsItemsDto();
// String itemKey = (String) taskKeys.next();
// if (itemKey.startsWith("q_1_")) {
// taskDto.taskCode = taskJson.getString(itemKey);
// }
// taskDirectionsItemsDto.taskKey = taskKey;
// taskDirectionsItemsDto.itemKey = itemKey;
// try {
// taskDirectionsItemsDto.inputValue = taskJson.getString(itemKey);
// } catch (JSONException e) {
// // 値がStringではない場合、無視する
// continue;
// }
// mTaskDirectionsItemsDao.insertTaskDirectionsItems(taskDirectionsItemsDto);
// }
// taskDirectionsDto.taskKey = taskKey;
// taskDirectionsDto.jsonData = taskDirectionsJson.toString();
// taskDirectionsDto.dataSendFlg = dataSendFlg;
// taskDirectionsDto.attachedFileSendFlg = attachedChangeFlag;
// if (localAttachedFileName != null) {
// taskDirectionsDto.localAttachedFileName = localAttachedFileName;
// }
//
// if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
// taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
// }
//
// mTaskDirectionsDao.insert(taskDirectionsDto);
// mTaskDao.insert(taskDto);
//
// String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
//
// //添付ファイル変更の場合、以下の処理を行う
// JSONObject attachedListJson = taskDirectionsJson.getJSONObject("attached");
// List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// // コピー元のファイルで、添付ファイルとして使用しないファイル削除
// deleteDifferentialFile(tempDirPath, attachedFileNames);
//
// String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
//
// // 添付ディレクトリの移動
// boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
// if (result) {
// FileUtil.delete(tempDirPath);
// }
TaskDto
taskDto
=
new
TaskDto
();
Task
DirectionsDto
taskDirectionsDto
=
new
TaskDirections
Dto
();
Task
ReportDto
taskReportDto
=
new
TaskReport
Dto
();
JSONObject
taskJson
=
taskDirectionsJson
.
getJSONObject
(
"task"
);
taskDto
.
taskKey
=
taskKey
;
taskDto
.
operationId
=
operationId
;
...
...
@@ -236,34 +295,39 @@ public class OperationLogic extends AbstractLogic {
Iterator
taskKeys
=
taskJson
.
keys
();
while
(
taskKeys
.
hasNext
())
{
Task
DirectionsItemsDto
taskDirectionsItemsDto
=
new
TaskDirections
ItemsDto
();
Task
ReportItemsDto
taskReportItemsDto
=
new
TaskReport
ItemsDto
();
String
itemKey
=
(
String
)
taskKeys
.
next
();
if
(
itemKey
.
startsWith
(
"q_1_"
))
{
taskDto
.
taskCode
=
taskJson
.
getString
(
itemKey
);
}
task
Directions
ItemsDto
.
taskKey
=
taskKey
;
task
Directions
ItemsDto
.
itemKey
=
itemKey
;
task
Report
ItemsDto
.
taskKey
=
taskKey
;
task
Report
ItemsDto
.
itemKey
=
itemKey
;
try
{
task
Directions
ItemsDto
.
inputValue
=
taskJson
.
getString
(
itemKey
);
task
Report
ItemsDto
.
inputValue
=
taskJson
.
getString
(
itemKey
);
}
catch
(
JSONException
e
)
{
// 値がStringではない場合、無視する
continue
;
}
mTask
DirectionsItemsDao
.
insertTaskDirectionsItems
(
taskDirections
ItemsDto
);
mTask
ReportItemsDao
.
insertTaskReportItems
(
taskReport
ItemsDto
);
}
task
Directions
Dto
.
taskKey
=
taskKey
;
task
Directions
Dto
.
jsonData
=
taskDirectionsJson
.
toString
();
task
Directions
Dto
.
dataSendFlg
=
dataSendFlg
;
task
Directions
Dto
.
attachedFileSendFlg
=
attachedChangeFlag
;
task
Report
Dto
.
taskKey
=
taskKey
;
task
Report
Dto
.
jsonData
=
taskDirectionsJson
.
toString
();
task
Report
Dto
.
dataSendFlg
=
dataSendFlg
;
task
Report
Dto
.
attachedFileSendFlg
=
attachedChangeFlag
;
if
(
localAttachedFileName
!=
null
)
{
task
Directions
Dto
.
localAttachedFileName
=
localAttachedFileName
;
task
Report
Dto
.
localAttachedFileName
=
localAttachedFileName
;
}
if
(
taskDirectionsJson
.
has
(
ABookKeys
.
TASK_STATUS
))
{
taskDto
.
taskStatus
=
taskDirectionsJson
.
getInt
(
ABookKeys
.
TASK_STATUS
);
}
mTaskDirectionsDao
.
insert
(
taskDirectionsDto
);
// 0305 start
// 指示の場合
taskReportDto
.
reportorFlag
=
false
;
// 0305 end
mTaskReportDao
.
insert
(
taskReportDto
);
mTaskDao
.
insert
(
taskDto
);
String
tempDirPath
=
ABVEnvironment
.
getInstance
().
getTempTaskDirPath
(
contentId
,
taskKey
);
...
...
@@ -281,6 +345,7 @@ public class OperationLogic extends AbstractLogic {
if
(
result
)
{
FileUtil
.
delete
(
tempDirPath
);
}
// 0305 end
}
/**
...
...
@@ -303,50 +368,115 @@ public class OperationLogic extends AbstractLogic {
Logger
.
w
(
TAG
,
"taskDto is null"
);
return
;
}
TaskDirectionsDto
taskDirectionsDto
=
mTaskDirectionsDao
.
getTaskDirections
(
taskKey
);
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDto.operationId = operationId;
// taskDto.taskHotSpotInfo = hotSpotInfo;
// JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
//
// Iterator taskKeys = taskJson.keys();
// List<TaskDirectionsItemsDto> taskDirectionsItemsDtoList = mTaskDirectionsItemsDao.getTaskDirectionsItemByTaskKey(taskKey);
// for (TaskDirectionsItemsDto taskDirectionsItemsDto : taskDirectionsItemsDtoList) {
// try {
// String newValue = taskJson.getString(taskDirectionsItemsDto.itemKey);
// if (!newValue.equals(taskDirectionsItemsDto.inputValue)) {
// // 値が異なる場合のみ、更新する
// taskDirectionsItemsDto.inputValue = newValue;
// if (taskDirectionsItemsDto.itemKey.startsWith("q_1_")) {
// // 値が異なるため、作業コードの入力値を変更する
// taskDto.taskCode = taskDirectionsItemsDto.inputValue;
// }
// mTaskDirectionsItemsDao.updateTaskDirectionsItems(taskDirectionsItemsDto);
// }
// } catch (JSONException e) {
// // 値がStringではない場合、無視する
// continue;
// }
// }
// taskDirectionsDto.jsonData = taskDirectionsJson.toString();
// taskDirectionsDto.dataSendFlg = dataSendFlg;
//
// // attachedFileSendFlgがtrueの場合は、更新しない
// if (!taskDirectionsDto.attachedFileSendFlg) {
// taskDirectionsDto.attachedFileSendFlg = attachedChangeFlag;
// }
// if (localAttachedFileName != null) {
// taskDirectionsDto.localAttachedFileName = localAttachedFileName;
// }
//
// if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
// taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
// }
//
// mTaskDirectionsDao.update(taskDirectionsDto);
// mTaskDao.update(taskDto);
// String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
// if (taskDirectionsDto.attachedFileSendFlg) {
// //添付ファイル変更の場合、以下の処理を行う
// JSONObject attachedListJson = taskDirectionsJson.getJSONObject("attached");
// List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
//
// // コピー元のファイルで、添付ファイルとして使用しないファイル削除
// deleteDifferentialFile(tempDirPath, attachedFileNames);
// // 同じファイル名が存在すれば、コピー先ファイルを削除
// deleteDifferentialFile(operationDrectionOrReportDirPath, attachedFileNames);
//
// // 添付ディレクトリの移動
// boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
// if(result) {
// FileUtil.delete(tempDirPath);
// }
// }
TaskReportDto
taskReportDto
=
mTaskReportDao
.
getTaskReport
(
taskKey
);
taskDto
.
operationId
=
operationId
;
taskDto
.
taskHotSpotInfo
=
hotSpotInfo
;
JSONObject
taskJson
=
taskDirectionsJson
.
getJSONObject
(
"task"
);
Iterator
taskKeys
=
taskJson
.
keys
();
List
<
Task
DirectionsItemsDto
>
taskDirectionsItemsDtoList
=
mTaskDirectionsItemsDao
.
getTaskDirections
ItemByTaskKey
(
taskKey
);
for
(
Task
DirectionsItemsDto
taskDirectionsItemsDto
:
taskDirections
ItemsDtoList
)
{
List
<
Task
ReportItemsDto
>
taskReportItemsDtoList
=
mTaskReportItemsDao
.
getTaskReport
ItemByTaskKey
(
taskKey
);
for
(
Task
ReportItemsDto
taskReportItemsDto
:
taskReport
ItemsDtoList
)
{
try
{
String
newValue
=
taskJson
.
getString
(
task
Directions
ItemsDto
.
itemKey
);
if
(!
newValue
.
equals
(
task
Directions
ItemsDto
.
inputValue
))
{
String
newValue
=
taskJson
.
getString
(
task
Report
ItemsDto
.
itemKey
);
if
(!
newValue
.
equals
(
task
Report
ItemsDto
.
inputValue
))
{
// 値が異なる場合のみ、更新する
task
Directions
ItemsDto
.
inputValue
=
newValue
;
if
(
task
Directions
ItemsDto
.
itemKey
.
startsWith
(
"q_1_"
))
{
task
Report
ItemsDto
.
inputValue
=
newValue
;
if
(
task
Report
ItemsDto
.
itemKey
.
startsWith
(
"q_1_"
))
{
// 値が異なるため、作業コードの入力値を変更する
taskDto
.
taskCode
=
task
Directions
ItemsDto
.
inputValue
;
taskDto
.
taskCode
=
task
Report
ItemsDto
.
inputValue
;
}
mTask
DirectionsItemsDao
.
updateTaskDirectionsItems
(
taskDirections
ItemsDto
);
mTask
ReportItemsDao
.
updateTaskReportItems
(
taskReport
ItemsDto
);
}
}
catch
(
JSONException
e
)
{
// 値がStringではない場合、無視する
continue
;
}
}
task
Directions
Dto
.
jsonData
=
taskDirectionsJson
.
toString
();
task
Directions
Dto
.
dataSendFlg
=
dataSendFlg
;
task
Report
Dto
.
jsonData
=
taskDirectionsJson
.
toString
();
task
Report
Dto
.
dataSendFlg
=
dataSendFlg
;
// attachedFileSendFlgがtrueの場合は、更新しない
if
(!
task
Directions
Dto
.
attachedFileSendFlg
)
{
task
Directions
Dto
.
attachedFileSendFlg
=
attachedChangeFlag
;
if
(!
task
Report
Dto
.
attachedFileSendFlg
)
{
task
Report
Dto
.
attachedFileSendFlg
=
attachedChangeFlag
;
}
if
(
localAttachedFileName
!=
null
)
{
task
Directions
Dto
.
localAttachedFileName
=
localAttachedFileName
;
task
Report
Dto
.
localAttachedFileName
=
localAttachedFileName
;
}
if
(
taskDirectionsJson
.
has
(
ABookKeys
.
TASK_STATUS
))
{
taskDto
.
taskStatus
=
taskDirectionsJson
.
getInt
(
ABookKeys
.
TASK_STATUS
);
}
mTaskDirectionsDao
.
update
(
taskDirectionsDto
);
// 0305 start
taskReportDto
.
reportorFlag
=
false
;
// 0305 end
mTaskReportDao
.
update
(
taskReportDto
);
mTaskDao
.
update
(
taskDto
);
String
tempDirPath
=
ABVEnvironment
.
getInstance
().
getTempTaskDirPath
(
contentId
,
taskKey
);
String
operationDrectionOrReportDirPath
=
ABVEnvironment
.
getInstance
().
getOperationDirectionOrReportDirPath
(
operationId
,
taskKey
,
true
);
if
(
task
Directions
Dto
.
attachedFileSendFlg
)
{
if
(
task
Report
Dto
.
attachedFileSendFlg
)
{
//添付ファイル変更の場合、以下の処理を行う
JSONObject
attachedListJson
=
taskDirectionsJson
.
getJSONObject
(
"attached"
);
List
<
String
>
attachedFileNames
=
JSONObject
.
getValues
(
attachedListJson
);
...
...
@@ -362,8 +492,11 @@ public class OperationLogic extends AbstractLogic {
FileUtil
.
delete
(
tempDirPath
);
}
}
// 0305 end
}
// TODO
// 削除対象
/**
* 作業指示の削除
*
...
...
@@ -377,15 +510,28 @@ public class OperationLogic extends AbstractLogic {
return
;
}
TaskDirectionsDto
taskDirectionsDto
=
mTaskDirectionsDao
.
getTaskDirections
(
taskKey
);
taskDirectionsDto
.
dataSendFlg
=
true
;
taskDirectionsDto
.
attachedFileSendFlg
=
false
;
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDirectionsDto.dataSendFlg = true;
// taskDirectionsDto.attachedFileSendFlg = false;
// taskDto.delFlg = true;
// mTaskDirectionsDao.update(taskDirectionsDto);
// mTaskDao.update(taskDto);
TaskReportDto
taskReportDto
=
mTaskReportDao
.
getTaskReport
(
taskKey
);
taskReportDto
.
dataSendFlg
=
true
;
taskReportDto
.
attachedFileSendFlg
=
false
;
taskDto
.
delFlg
=
true
;
mTaskDirectionsDao
.
update
(
taskDirectionsDto
);
// 0305 start
taskReportDto
.
reportorFlag
=
false
;
// 0305 end
mTaskReportDao
.
update
(
taskReportDto
);
mTaskDao
.
update
(
taskDto
);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData
(
operationId
,
contentId
,
taskKey
);
// 0305 end
}
/**
...
...
@@ -429,6 +575,11 @@ public class OperationLogic extends AbstractLogic {
taskReportDto
.
dataSendFlg
=
dataSendFlg
;
taskReportDto
.
attachedFileSendFlg
=
attachedChangeFlag
;
// 0305 start
// 報告者の場合
taskReportDto
.
reportorFlag
=
true
;
// 0305 end
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
List
<
TaskReportDto
>
taskReport
=
mTaskReportDao
.
selectByTaskKey
(
taskReportDto
.
taskKey
);
if
(
taskReport
.
size
()
>
0
)
{
...
...
@@ -550,6 +701,10 @@ public class OperationLogic extends AbstractLogic {
taskReportDto
.
attachedFileSendFlg
=
attachedChangeFlag
;
}
// 0305 start
taskReportDto
.
reportorFlag
=
true
;
// 0305 end
mTaskReportDao
.
update
(
taskReportDto
);
mTaskDao
.
update
(
taskDto
);
String
tempDirPath
=
ABVEnvironment
.
getInstance
().
getTempTaskDirPath
(
contentId
,
taskKey
);
...
...
@@ -873,10 +1028,17 @@ public class OperationLogic extends AbstractLogic {
*/
public
void
updateTaskHotspot
(
String
taskKey
,
Map
<
String
,
String
>
param
)
{
TaskDto
taskDto
=
mTaskDao
.
getTaskByTaskKey
(
taskKey
);
TaskDirectionsDto
taskDirectionsDto
=
mTaskDirectionsDao
.
getTaskDirections
(
taskKey
);
taskDirectionsDto
.
dataSendFlg
=
true
;
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDirectionsDto.dataSendFlg = true;
// taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
// mTaskDirectionsDao.update(taskDirectionsDto);
TaskReportDto
taskReportDao
=
mTaskReportDao
.
getTaskReport
(
taskKey
);
taskReportDao
.
dataSendFlg
=
true
;
taskDto
.
taskHotSpotInfo
=
param
.
get
(
ABookKeys
.
HOT_SPOT
);
mTaskDirectionsDao
.
update
(
taskDirectionsDto
);
mTaskReportDao
.
update
(
taskReportDao
);
// 0305 end
mTaskDao
.
update
(
taskDto
);
}
...
...
@@ -889,13 +1051,23 @@ public class OperationLogic extends AbstractLogic {
*/
public
void
updateTaskHotspot
(
String
taskKey
,
float
newX
,
float
newY
)
{
TaskDto
taskDto
=
mTaskDao
.
getTaskByTaskKey
(
taskKey
);
TaskDirectionsDto
taskDirectionsDto
=
mTaskDirectionsDao
.
getTaskDirections
(
taskKey
);
taskDirectionsDto
.
dataSendFlg
=
true
;
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDirectionsDto.dataSendFlg = true;
// JSONObject hotSpot = new JSONObject(taskDto.taskHotSpotInfo);
// hotSpot.put("x", newX);
// hotSpot.put("y", newY);
// taskDto.taskHotSpotInfo = hotSpot.toString();
// mTaskDirectionsDao.update(taskDirectionsDto);
TaskReportDto
taskReportDto
=
mTaskReportDao
.
getTaskReport
(
taskKey
);
taskReportDto
.
dataSendFlg
=
true
;
JSONObject
hotSpot
=
new
JSONObject
(
taskDto
.
taskHotSpotInfo
);
hotSpot
.
put
(
"x"
,
newX
);
hotSpot
.
put
(
"y"
,
newY
);
taskDto
.
taskHotSpotInfo
=
hotSpot
.
toString
();
mTaskDirectionsDao
.
update
(
taskDirectionsDto
);
mTaskReportDao
.
update
(
taskReportDto
);
// 0305 end
mTaskDao
.
update
(
taskDto
);
}
...
...
@@ -926,6 +1098,7 @@ public class OperationLogic extends AbstractLogic {
*/
public
void
createJsonForOperationContent
(
Long
operationId
,
int
reportUpdateType
,
String
contentPath
,
boolean
directionsFlg
,
boolean
routineTaskReportFlg
)
throws
IOException
{
try
{
// 0305 start
createTaskDirectionsJson
(
operationId
,
contentPath
);
createTaskDirectionsSuggestJson
(
operationId
,
contentPath
);
if
(!
directionsFlg
)
{
...
...
@@ -940,6 +1113,8 @@ public class OperationLogic extends AbstractLogic {
createTaskReportSuggestJson
(
operationId
,
contentPath
);
}
// 0305 end
createHopSpotJson
(
operationId
,
contentPath
);
}
catch
(
IOException
e
)
{
Logger
.
e
(
TAG
,
"createJsonForOperationContent error : "
,
e
);
...
...
@@ -1038,6 +1213,8 @@ public class OperationLogic extends AbstractLogic {
FileUtil
.
createFile
(
contentPath
+
"/taskHotspot.json"
,
hotspotJson
.
toString
());
}
// TODO
// 削除対象
/**
* taskDirections.jsonファイル作成
*
...
...
@@ -1046,15 +1223,27 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
private
void
createTaskDirectionsJson
(
Long
operationId
,
String
contentPath
)
throws
IOException
{
List
<
JSONObject
>
taskDirectionsJsonList
=
new
ArrayList
<
JSONObject
>();
JSONObject
taskDirectionsJson
=
new
JSONObject
();
List
<
TaskDirectionsDto
>
taskDirectionsDtoList
=
mTaskDirectionsDao
.
getTaskDirectionsByOperationId
(
operationId
);
for
(
TaskDirectionsDto
dto
:
taskDirectionsDtoList
)
{
taskDirectionsJsonList
.
add
(
new
JSONObject
(
dto
.
jsonData
));
}
taskDirectionsJson
.
put
(
ABookKeys
.
TASK_DIRECTIONS
,
taskDirectionsJsonList
);
Logger
.
d
(
TAG
,
"createTaskDirectionsJson : "
+
taskDirectionsJson
.
toString
());
FileUtil
.
createFile
(
contentPath
+
"/"
+
ABookKeys
.
TASK_DIRECTIONS
+
".json"
,
taskDirectionsJson
.
toString
());
// 0305 start
// List<JSONObject> taskDirectionsJsonList = new ArrayList<JSONObject>();
// JSONObject taskDirectionsJson = new JSONObject();
// List<TaskDirectionsDto> taskDirectionsDtoList = mTaskDirectionsDao.getTaskDirectionsByOperationId(operationId);
// for (TaskDirectionsDto dto : taskDirectionsDtoList) {
// taskDirectionsJsonList.add(new JSONObject(dto.jsonData));
// }
// taskDirectionsJson.put(ABookKeys.TASK_DIRECTIONS, taskDirectionsJsonList);
// Logger.d(TAG, "createTaskDirectionsJson : " + taskDirectionsJson.toString());
// FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_DIRECTIONS + ".json", taskDirectionsJson.toString());
List
<
JSONObject
>
taskReportJsonList
=
new
ArrayList
<
JSONObject
>();
JSONObject
taskReportJson
=
new
JSONObject
();
List
<
TaskReportDto
>
taskReportDtoList
=
mTaskReportDao
.
getTaskReportByOperationId
(
operationId
);
for
(
TaskReportDto
dto
:
taskReportDtoList
)
{
taskReportJsonList
.
add
(
new
JSONObject
(
dto
.
jsonData
));
}
taskReportJson
.
put
(
ABookKeys
.
TASK_DIRECTIONS
,
taskReportJsonList
);
Logger
.
d
(
TAG
,
"createTaskDirectionsJson : "
+
taskReportJson
.
toString
());
FileUtil
.
createFile
(
contentPath
+
"/"
+
ABookKeys
.
TASK_DIRECTIONS
+
".json"
,
taskReportJson
.
toString
());
// 0305 end
}
/**
...
...
@@ -1065,10 +1254,37 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
private
void
createTaskDirectionsSuggestJson
(
Long
operationId
,
String
contentPath
)
throws
IOException
{
// 0305 start
// JSONObject itemJson = new JSONObject();
// JSONObject taskDirectionsSuggestJson = new JSONObject();
// List<TaskDirectionsItemsDto> taskDirectionsItemsDtoList = mTaskDirectionsItemsDao.getTaskDirectionsItemByOperationId(operationId);
// for (TaskDirectionsItemsDto dto : taskDirectionsItemsDtoList) {
// JSONArray jsonArray = new JSONArray();
// if (itemJson.has(dto.itemKey)) {
// boolean result = false;
// jsonArray = itemJson.getJSONArray(dto.itemKey);
// for (int i = 0; i < jsonArray.length(); i++) {
// if (jsonArray.get(i).equals(dto.inputValue)) {
// result = true;
// break;
// }
// }
// if (!result) {
// jsonArray.put(dto.inputValue);
// itemJson.put(dto.itemKey, jsonArray);
// }
// } else {
// jsonArray.put(dto.inputValue);
// itemJson.put(dto.itemKey, jsonArray);
// }
// }
// taskDirectionsSuggestJson.put(ABookKeys.TASK_DIRECTIONS_SUGGEST, itemJson);
// FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_DIRECTIONS_SUGGEST + ".json", taskDirectionsSuggestJson.toString());
JSONObject
itemJson
=
new
JSONObject
();
JSONObject
task
Directions
SuggestJson
=
new
JSONObject
();
List
<
Task
DirectionsItemsDto
>
taskDirectionsItemsDtoList
=
mTaskDirectionsItemsDao
.
getTaskDirections
ItemByOperationId
(
operationId
);
for
(
Task
DirectionsItemsDto
dto
:
taskDirections
ItemsDtoList
)
{
JSONObject
task
Report
SuggestJson
=
new
JSONObject
();
List
<
Task
ReportItemsDto
>
taskReportItemsDtoList
=
mTaskReportItemsDao
.
getTaskReport
ItemByOperationId
(
operationId
);
for
(
Task
ReportItemsDto
dto
:
taskReport
ItemsDtoList
)
{
JSONArray
jsonArray
=
new
JSONArray
();
if
(
itemJson
.
has
(
dto
.
itemKey
))
{
boolean
result
=
false
;
...
...
@@ -1088,10 +1304,13 @@ public class OperationLogic extends AbstractLogic {
itemJson
.
put
(
dto
.
itemKey
,
jsonArray
);
}
}
taskDirectionsSuggestJson
.
put
(
ABookKeys
.
TASK_DIRECTIONS_SUGGEST
,
itemJson
);
FileUtil
.
createFile
(
contentPath
+
"/"
+
ABookKeys
.
TASK_DIRECTIONS_SUGGEST
+
".json"
,
taskDirectionsSuggestJson
.
toString
());
taskReportSuggestJson
.
put
(
ABookKeys
.
TASK_DIRECTIONS_SUGGEST
,
itemJson
);
FileUtil
.
createFile
(
contentPath
+
"/"
+
ABookKeys
.
TASK_DIRECTIONS_SUGGEST
+
".json"
,
taskReportSuggestJson
.
toString
());
// 0305 end
}
public
void
createTaskReportJson
(
Long
operationId
,
String
contentPath
)
throws
IOException
{
List
<
JSONObject
>
taskReportJsonList
=
new
ArrayList
<
JSONObject
>();
JSONObject
taskReportJson
=
new
JSONObject
();
...
...
@@ -1195,7 +1414,10 @@ public class OperationLogic extends AbstractLogic {
// プロジェクト毎に作業の送信フラグがあるかチェックし、存在する場合プロジェクトのデータ同期必要区分をtrueにセット
if
(
ABVDataCache
.
getInstance
().
getMemberInfo
().
operationAuthLevel
==
OperationAuthLevel
.
OPERATION_INSTRUCTOR
)
{
// 作業指示者
if
(
mTaskDirectionsDao
.
isExistSendTaskData
(
operationDto
.
operationId
))
{
// 0305 start
// if (mTaskDirectionsDao.isExistSendTaskData(operationDto.operationId)) {
if
(
mTaskReportDao
.
isExistSendTaskData
(
operationDto
.
operationId
))
{
// 0305 end
mOperationDao
.
updateNeedSyncFlg
(
operationDto
.
operationId
,
true
);
}
}
else
{
...
...
@@ -1313,21 +1535,66 @@ public class OperationLogic extends AbstractLogic {
* @throws Exception
*/
public
void
sendTaskDirectionsData
(
long
operationId
,
String
taskKey
,
Callback
progressCallback
)
throws
ABVException
,
NetworkDisconnectedException
,
IOException
,
ZipException
,
NoSuchAlgorithmException
{
List
<
TaskDirectionsDto
>
taskDirectionsDtoList
=
null
;
// 0305 start
// List<TaskDirectionsDto> taskDirectionsDtoList = null;
// int maxProgress = 0;
// if (taskKey == null) {
// taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId);
// maxProgress = 40;
// } else {
// taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId, taskKey);
// maxProgress = 100;
// }
//
// if (taskDirectionsDtoList != null && taskDirectionsDtoList.size() > 0) {
// //プログレスを40%進行させるための計算
// int progress = maxProgress / taskDirectionsDtoList.size();
//
// for (TaskDirectionsDto dto : taskDirectionsDtoList) {
// File zipFile = null;
// if (dto.attachedFileSendFlg) {
// String fileName = null;
// zipFile = createAttachedFile(operationId, dto.taskKey, true);
// if (zipFile != null) {
// fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
// }
// dto.localAttachedFileName = fileName != null ? SecurityUtil.getMd5Hash(fileName) : null;
// }
//
// AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendTaskData
// (cache.getMemberInfo().sid, String.valueOf(operationId), dto.taskKey, dto.delFlg ? "1" : "0", String.valueOf(0), dto.taskHotSpotInfo, dto.jsonData, zipFile, dto.attachedFileSendFlg, null);
//
// if (zipFile != null) {
// zipFile.delete();
// }
// if (dto.delFlg) {
// // 物理削除
// mTaskDao.deleteTaskData(dto.taskKey, true);
// } else {
// dto.dataSendFlg = false;
// dto.attachedFileSendFlg = false;
// mTaskDirectionsDao.update(dto);
// }
// progressCallback.callback(new Integer(progress));
// }
// }
List
<
TaskReportDto
>
taskReportDtoList
=
null
;
int
maxProgress
=
0
;
if
(
taskKey
==
null
)
{
task
DirectionsDtoList
=
mTaskDirections
Dao
.
getSendableTaskData
(
operationId
);
task
ReportDtoList
=
mTaskReport
Dao
.
getSendableTaskData
(
operationId
);
maxProgress
=
40
;
}
else
{
task
DirectionsDtoList
=
mTaskDirectionsDao
.
getSendableTaskData
(
operationId
,
taskKey
);
task
ReportDtoList
=
mTaskReportDao
.
getSendableTaskData
(
operationId
,
taskKey
,
false
);
maxProgress
=
100
;
}
if
(
task
DirectionsDtoList
!=
null
&&
taskDirections
DtoList
.
size
()
>
0
)
{
if
(
task
ReportDtoList
!=
null
&&
taskReport
DtoList
.
size
()
>
0
)
{
//プログレスを40%進行させるための計算
int
progress
=
maxProgress
/
task
Directions
DtoList
.
size
();
int
progress
=
maxProgress
/
task
Report
DtoList
.
size
();
for
(
Task
DirectionsDto
dto
:
taskDirections
DtoList
)
{
for
(
Task
ReportDto
dto
:
taskReport
DtoList
)
{
File
zipFile
=
null
;
if
(
dto
.
attachedFileSendFlg
)
{
String
fileName
=
null
;
...
...
@@ -1350,11 +1617,15 @@ public class OperationLogic extends AbstractLogic {
}
else
{
dto
.
dataSendFlg
=
false
;
dto
.
attachedFileSendFlg
=
false
;
mTaskDirectionsDao
.
update
(
dto
);
// 0305 start
dto
.
reportorFlag
=
false
;
// 0305 end
mTaskReportDao
.
update
(
dto
);
}
progressCallback
.
callback
(
new
Integer
(
progress
));
}
}
// 0305 end
}
/**
...
...
@@ -1370,7 +1641,7 @@ public class OperationLogic extends AbstractLogic {
taskReportDtoList
=
mTaskReportDao
.
getSendableTaskData
(
operationId
);
maxProgress
=
40
;
}
else
{
taskReportDtoList
=
mTaskReportDao
.
getSendableTaskData
(
operationId
,
taskKey
);
taskReportDtoList
=
mTaskReportDao
.
getSendableTaskData
(
operationId
,
taskKey
,
true
);
maxProgress
=
100
;
}
if
(
taskReportDtoList
!=
null
&&
taskReportDtoList
.
size
()
>
0
)
{
...
...
@@ -1436,6 +1707,9 @@ public class OperationLogic extends AbstractLogic {
taskReportDto
.
dataSendFlg
=
false
;
taskReportDto
.
attachedFileSendFlg
=
false
;
// 0305 start
taskReportDto
.
reportorFlag
=
true
;
// 0305 end
mTaskReportDao
.
update
(
taskReportDto
);
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
View file @
21004d02
...
...
@@ -143,7 +143,9 @@ public class OperationListActivity extends ABVUIActivity {
private
Dialog
mPanoEntryDialog
;
private
OperationContentDao
mOperationContentDao
=
AbstractDao
.
getDao
(
OperationContentDao
.
class
);
private
TaskDirectionsDao
mTaskDirectionsDao
=
AbstractDao
.
getDao
(
TaskDirectionsDao
.
class
);
// 0301 start
// private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// 0301 end
private
TaskReportDao
mTaskReportDao
=
AbstractDao
.
getDao
(
TaskReportDao
.
class
);
private
RoutineTaskReportDao
mRoutineTaskReportDao
=
AbstractDao
.
getDao
(
RoutineTaskReportDao
.
class
);
private
OperationLogic
mOperationLogic
=
AbstractLogic
.
getLogic
(
OperationLogic
.
class
);
...
...
@@ -1033,6 +1035,7 @@ public class OperationListActivity extends ABVUIActivity {
}
lastEditDate
=
json
.
lastEditDate
;
}
else
{
// TODO
OperationDataJSON
json
=
AcmsClient
.
getInstance
(
ABVDataCache
.
getInstance
().
getUrlPath
(),
ABVEnvironment
.
getInstance
().
networkAdapter
).
getOpereationData
(
param
);
//プログレスを40%進行させるための計算
...
...
@@ -1041,13 +1044,17 @@ public class OperationListActivity extends ABVUIActivity {
progress
=
40
/
json
.
taskDtoList
.
size
();
}
JSONObject
taskDirectionJson
;
// 0305 start
// JSONObject taskDirectionJson;
JSONObject
taskReportJson
;
for
(
TaskDto
taskDto
:
json
.
taskDtoList
)
{
String
directionsAttachedFileName
=
taskDto
.
taskDirectionsDto
.
attachedFileName
;
String
reportAttachedFileName
=
taskDto
.
taskReportDto
.
attachedFileName
;
taskDirectionJson
=
new
JSONObject
(
taskDto
.
taskDirectionsDto
.
jsonData
);
taskDirectionJson
.
put
(
ABookKeys
.
TASK_STATUS
,
taskDto
.
taskStatus
);
// 0305 start
taskReportJson
=
new
JSONObject
(
taskDto
.
taskDirectionsDto
.
jsonData
);
taskReportJson
.
put
(
ABookKeys
.
TASK_STATUS
,
taskDto
.
taskStatus
);
// 0305 end
int
localTaskIndex
=
localTaskList
.
indexOf
(
taskDto
);
if
(
localTaskIndex
>=
0
)
{
...
...
@@ -1058,9 +1065,11 @@ public class OperationListActivity extends ABVUIActivity {
return
null
;
}
// 0305 start
// 作業更新
mOperationLogic
.
updateTaskDirections
(
taskDto
.
taskKey
,
taskDto
.
operationId
,
operationContentDto
.
contentId
,
taskDirectionJson
,
taskDto
.
taskHotSpotInfo
,
directionsAttachedFileName
,
false
,
false
);
taskReportJson
,
taskDto
.
taskHotSpotInfo
,
directionsAttachedFileName
,
false
,
false
);
// 0305 end
localTaskList
.
remove
(
taskDto
);
// 報告データが存在すると作業報告を更新する
if
(
taskDto
.
taskReportDto
.
jsonData
!=
null
)
{
...
...
@@ -1074,9 +1083,11 @@ public class OperationListActivity extends ABVUIActivity {
return
null
;
}
// 0301 start
// 作業登録
mOperationLogic
.
insertTaskDirections
(
taskDto
.
taskKey
,
operationContentDto
.
operationId
,
operationContentDto
.
contentId
,
taskDirectionJson
,
taskDto
.
taskHotSpotInfo
,
directionsAttachedFileName
,
false
,
false
);
taskReportJson
,
taskDto
.
taskHotSpotInfo
,
directionsAttachedFileName
,
false
,
false
);
// 0305 end
if
(
taskDto
.
taskReportDto
.
jsonData
!=
null
)
{
mOperationLogic
.
insertTaskReport
(
taskDto
.
taskKey
,
operationContentDto
.
operationId
,
operationContentDto
.
contentId
,
new
JSONObject
(
taskDto
.
taskReportDto
.
jsonData
),
reportAttachedFileName
,
false
,
false
);
...
...
@@ -1084,6 +1095,7 @@ public class OperationListActivity extends ABVUIActivity {
}
progressCallback
.
callback
(
new
Integer
(
progress
));
}
// 0305 end
// サーバーから取得した作業情報がローカルに存在しないので削除する
for
(
TaskDto
taskDto
:
localTaskList
)
{
...
...
@@ -1103,7 +1115,10 @@ public class OperationListActivity extends ABVUIActivity {
// 既存の添付ディレクトリ削除
FileUtil
.
delete
(
ABVEnvironment
.
getInstance
().
getTempTaskDirPath
(
contentId
,
taskKey
));
String
directionsLocalAttachedFileName
=
mTaskDirectionsDao
.
getTaskDirectionsAttachedFileName
(
taskKey
);
// 0305 start
// String directionsLocalAttachedFileName = mTaskDirectionsDao.getTaskDirectionsAttachedFileName(taskKey);
String
directionsLocalAttachedFileName
=
mTaskReportDao
.
getTaskReportAttachedFileName
(
taskKey
);
// 0305 end
String
reportLocalAttachedFileName
=
mTaskReportDao
.
getTaskReportAttachedFileName
(
taskKey
);
int
count
=
0
;
boolean
getDirectionsFileFlg
=
directionsAttachedFileName
!=
null
&&
!
directionsAttachedFileName
.
equals
(
directionsLocalAttachedFileName
);
...
...
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