Commit d415ca5e by Jeong Gilmo

#32782_指示者テーブル関連削除

parent b365f57a
...@@ -29,13 +29,15 @@ public class OperationDataJSON extends AcmsCommonJSON { ...@@ -29,13 +29,15 @@ public class OperationDataJSON extends AcmsCommonJSON {
public static final String TaskStatus = "taskStatus"; public static final String TaskStatus = "taskStatus";
public static final String TaskHotspotInfo = "taskHotspotInfo"; public static final String TaskHotspotInfo = "taskHotspotInfo";
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete TaskDirections // TODO change&delete TaskDirections
public static final String TaskDirectionsInfo = "taskReportInfo"; // public static final String TaskDirectionsInfo = "taskReportInfo";
public static final String TaskDirectionsInfo = "taskDirectionsInfo";
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
public static final String TaskReportInfo = "taskReportInfo"; public static final String TaskReportInfo = "taskReportInfo";
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete TaskDirections // TODO change&Delete TaskDirections
public static final String TaskDirectionsKey = "taskReportKey"; // public static final String TaskDirectionsKey = "taskReportKey";
public static final String TaskDirectionsKey = "taskDirectionsKey";
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
public static final String TaskReportKey = "taskReportKey"; public static final String TaskReportKey = "taskReportKey";
public static final String Task = "task"; public static final String Task = "task";
...@@ -57,7 +59,9 @@ public class OperationDataJSON extends AcmsCommonJSON { ...@@ -57,7 +59,9 @@ public class OperationDataJSON extends AcmsCommonJSON {
JSONObject taskJson = taskList.getJSONObject(i); JSONObject taskJson = taskList.getJSONObject(i);
TaskDto dto = new TaskDto(); TaskDto dto = new TaskDto();
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
dto.taskDirectionsDto = new TaskReportDto(); // TODO change
// dto.taskDirectionsDto = new TaskReportDto();
dto.taskDirectionsDto = new TaskDirectionsDto();
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
dto.taskReportDto = new TaskReportDto(); dto.taskReportDto = new TaskReportDto();
......
...@@ -42,7 +42,9 @@ public class RoutineTaskDataJSON extends OperationDataJSON { ...@@ -42,7 +42,9 @@ public class RoutineTaskDataJSON extends OperationDataJSON {
JSONObject taskJson = taskList.getJSONObject(i); JSONObject taskJson = taskList.getJSONObject(i);
TaskDto dto = new TaskDto(); TaskDto dto = new TaskDto();
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
dto.taskDirectionsDto = new TaskReportDto(); // TODO change
// dto.taskDirectionsDto = new TaskReportDto();
dto.taskDirectionsDto = new TaskDirectionsDto();
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
dto.taskReportDto = new TaskReportDto(); dto.taskReportDto = new TaskReportDto();
......
...@@ -51,9 +51,11 @@ public class ABookKeys { ...@@ -51,9 +51,11 @@ public class ABookKeys {
public static final String DIRECTION_FLG = "directionFlg"; public static final String DIRECTION_FLG = "directionFlg";
public static final String ATTACHED_CHANGE_FLAG = "attachedChangeFlag"; public static final String ATTACHED_CHANGE_FLAG = "attachedChangeFlag";
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO TASK_DIRECTIONS 削除が必要 // TODO change TASK_DIRECTIONS 削除が必要
public static final String TASK_DIRECTIONS = "taskReport"; // public static final String TASK_DIRECTIONS = "taskReport";
public static final String TASK_DIRECTIONS_SUGGEST = "taskReportSuggest"; // public static final String TASK_DIRECTIONS_SUGGEST = "taskReportSuggest";
public static final String TASK_DIRECTIONS = "taskDirections";
public static final String TASK_DIRECTIONS_SUGGEST = "taskDirectionsSuggest";
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
public static final String TASK_HOTSPOT = "taskHotspot"; public static final String TASK_HOTSPOT = "taskHotspot";
public static final String TASK_REPORT = "taskReport"; public static final String TASK_REPORT = "taskReport";
......
...@@ -92,8 +92,9 @@ public class ABVDataOpenHelper { ...@@ -92,8 +92,9 @@ public class ABVDataOpenHelper {
iTableScripts.add(new ROperationContent()); iTableScripts.add(new ROperationContent());
iTableScripts.add(new TTask()); iTableScripts.add(new TTask());
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// iTableScripts.add(new TTaskDirections()); // TODO delete
// iTableScripts.add(new TTaskDirectionsItems()); iTableScripts.add(new TTaskDirections());
iTableScripts.add(new TTaskDirectionsItems());
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
iTableScripts.add(new TTaskReport()); iTableScripts.add(new TTaskReport());
iTableScripts.add(new TTaskReportSend()); iTableScripts.add(new TTaskReportSend());
......
...@@ -436,7 +436,7 @@ public class ContentDao extends AbstractDao { ...@@ -436,7 +436,7 @@ public class ContentDao extends AbstractDao {
if (physicalDelete) { if (physicalDelete) {
delete("r_content_category", "content_id=?", keyValues); delete("r_content_category", "content_id=?", keyValues);
delete("r_content_group", "content_id=?", keyValues); delete("r_content_group", "content_id=?", keyValues);
delete("r_project_content", "content_id=?", keyValues); delete("r_operation_content", "content_id=?", keyValues);
delete("t_content", "content_id=?", keyValues); delete("t_content", "content_id=?", keyValues);
} else { } else {
// 削除したコンテンツは自動ダウンロード禁止フラグをtrueにする // 削除したコンテンツは自動ダウンロード禁止フラグをtrueにする
...@@ -637,21 +637,21 @@ public class ContentDao extends AbstractDao { ...@@ -637,21 +637,21 @@ public class ContentDao extends AbstractDao {
sql.append(" tc.status, "); sql.append(" tc.status, ");
sql.append(" tc.last_delivery_date "); sql.append(" tc.last_delivery_date ");
sql.append(" FROM t_content AS tc "); sql.append(" FROM t_content AS tc ");
sql.append(" INNER JOIN r_project_content AS rpc "); sql.append(" INNER JOIN r_operation_content AS rpc ");
sql.append(" ON tc.content_id = rpc.content_id "); sql.append(" ON tc.content_id = rpc.content_id ");
sql.append(" INNER JOIN r_content_category AS rcc "); sql.append(" INNER JOIN r_content_category AS rcc ");
sql.append(" ON rpc.content_id = rcc.content_id "); sql.append(" ON rpc.content_id = rcc.content_id ");
sql.append(" INNER JOIN m_category AS mc "); sql.append(" INNER JOIN m_category AS mc ");
sql.append(" ON rcc.category_relation_id = mc.category_relation_id "); sql.append(" ON rcc.category_relation_id = mc.category_relation_id ");
sql.append(" WHERE rpc.project_id = ? "); sql.append(" WHERE rpc.operation_id = ? ");
sql.append(" AND rpc.project_content_flg = 0"); sql.append(" AND rpc.operation_content_flg = 0");
sql.append(" ORDER BY mc.category_id, tc.content_id DESC "); sql.append(" ORDER BY mc.category_id, tc.content_id DESC ");
return rawQueryGetDtoList(sql.toString(), new String[]{"" + operationId}, ContentDto.class); return rawQueryGetDtoList(sql.toString(), new String[]{"" + operationId}, ContentDto.class);
} }
public boolean isOperationRelatedContent(long contentId, long operationId) { public boolean isOperationRelatedContent(long contentId, long operationId) {
return rawQueryGetInt("select count(tc.content_id) from t_content as tc inner join r_project_content as rpc on tc.content_id = rpc.content_id where rpc.project_id = ? and rpc.project_content_flg = 0 and tc.content_id = ?", new String[]{"" + operationId, "" + contentId}) > 0; return rawQueryGetInt("select count(tc.content_id) from t_content as tc inner join r_operation_content as rpc on tc.content_id = rpc.content_id where rpc.operation_id = ? and rpc.operation_content_flg = 0 and tc.content_id = ?", new String[]{"" + operationId, "" + contentId}) > 0;
} }
public List<ContentDto> getCommonContent() { public List<ContentDto> getCommonContent() {
......
...@@ -72,7 +72,7 @@ public class MemberInfoDao extends AbstractDao { ...@@ -72,7 +72,7 @@ public class MemberInfoDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.lastUpdateInfor = cursor.getString(column); dto.lastUpdateInfor = cursor.getString(column);
} }
column = cursor.getColumnIndex("project_auth_level"); column = cursor.getColumnIndex("operation_auth_level");
if (column != -1) { if (column != -1) {
dto.operationAuthLevel = cursor.getInt(column); dto.operationAuthLevel = cursor.getInt(column);
} }
...@@ -108,11 +108,11 @@ public class MemberInfoDao extends AbstractDao { ...@@ -108,11 +108,11 @@ public class MemberInfoDao extends AbstractDao {
} }
public void insertMemberInfo(MemberInfoDto dto) { public void insertMemberInfo(MemberInfoDto dto) {
insert("insert into m_member_info (login_id, password, member_name, sid, login_status, invalid_password_count, last_login_date, last_change_password_date, last_cms_access_date, user_id, last_update_infor, project_auth_level, worker_code) values (?,?,?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues()); insert("insert into m_member_info (login_id, password, member_name, sid, login_status, invalid_password_count, last_login_date, last_change_password_date, last_cms_access_date, user_id, last_update_infor, operation_auth_level, worker_code) values (?,?,?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
} }
public boolean updateMemberInfo(MemberInfoDto dto) { public boolean updateMemberInfo(MemberInfoDto dto) {
long count = update("update m_member_info set password=?, member_name=?, sid=?, login_status=?, invalid_password_count=?, last_login_date=?, last_change_password_date=?, last_cms_access_date=?, last_update_infor = ?, project_auth_level = ?, worker_code = ? where login_id=?", dto.getUpdateValues()); long count = update("update m_member_info set password=?, member_name=?, sid=?, login_status=?, invalid_password_count=?, last_login_date=?, last_change_password_date=?, last_cms_access_date=?, last_update_infor = ?, operation_auth_level = ?, worker_code = ? where login_id=?", dto.getUpdateValues());
return count > 0; return count > 0;
} }
......
...@@ -23,7 +23,7 @@ public class OperationContentDao extends AbstractDao { ...@@ -23,7 +23,7 @@ public class OperationContentDao extends AbstractDao {
public OperationContentDto convert(Cursor cursor) { public OperationContentDto convert(Cursor cursor) {
OperationContentDto dto = new OperationContentDto(); OperationContentDto dto = new OperationContentDto();
int colnum = cursor.getColumnIndex("project_id"); int colnum = cursor.getColumnIndex("operation_id");
if (colnum != -1) { if (colnum != -1) {
dto.operationId = cursor.getLong(colnum); dto.operationId = cursor.getLong(colnum);
} }
...@@ -31,7 +31,7 @@ public class OperationContentDao extends AbstractDao { ...@@ -31,7 +31,7 @@ public class OperationContentDao extends AbstractDao {
if (colnum != -1) { if (colnum != -1) {
dto.contentId = cursor.getLong(colnum); dto.contentId = cursor.getLong(colnum);
} }
colnum = cursor.getColumnIndex("project_content_flg"); colnum = cursor.getColumnIndex("operation_content_flg");
if (colnum != -1) { if (colnum != -1) {
dto.operationContentFlg = toBool(cursor.getInt(colnum)); dto.operationContentFlg = toBool(cursor.getInt(colnum));
} }
...@@ -39,19 +39,19 @@ public class OperationContentDao extends AbstractDao { ...@@ -39,19 +39,19 @@ public class OperationContentDao extends AbstractDao {
return dto; return dto;
} }
public List<OperationContentDto> getOperationContent(Long operationId) { public List<OperationContentDto> getOperationContent(Long operationId) {
return rawQueryGetDtoList("select * from r_project_content where project_id=?", new String[]{""+ operationId}, OperationContentDto.class); return rawQueryGetDtoList("select * from r_operation_content where operation_id=?", new String[]{""+ operationId}, OperationContentDto.class);
} }
public OperationContentDto getOperationMainContent(Long operationId) { public OperationContentDto getOperationMainContent(Long operationId) {
return rawQueryGetDto("select * from r_project_content where project_content_flg = 1 AND project_id=?", new String[]{""+ operationId}, OperationContentDto.class); return rawQueryGetDto("select * from r_operation_content where operation_content_flg = 1 AND operation_id=?", new String[]{""+ operationId}, OperationContentDto.class);
} }
public List<ContentDto> getOperationRelatedContent(Long operationId) { public List<ContentDto> getOperationRelatedContent(Long operationId) {
return rawQueryGetDtoList("select * from r_project_content where project_content_flg = 0 AND project_id=?", new String[]{""+ operationId}, ContentDto.class); return rawQueryGetDtoList("select * from r_operation_content where operation_content_flg = 0 AND operation_id=?", new String[]{""+ operationId}, ContentDto.class);
} }
public OperationContentDto getOperationContentForContentId(Long contentId) { public OperationContentDto getOperationContentForContentId(Long contentId) {
return rawQueryGetDto("select * from r_project_content where project_content_flg = 1 AND content_id=?", new String[]{""+ contentId}, OperationContentDto.class); return rawQueryGetDto("select * from r_operation_content where operation_content_flg = 1 AND content_id=?", new String[]{""+ contentId}, OperationContentDto.class);
} }
public boolean isExistMainOperationContent(Long operationId) { public boolean isExistMainOperationContent(Long operationId) {
...@@ -59,24 +59,24 @@ public class OperationContentDao extends AbstractDao { ...@@ -59,24 +59,24 @@ public class OperationContentDao extends AbstractDao {
} }
public List<Long> getContentIds(Long operationId) { public List<Long> getContentIds(Long operationId) {
return rawQueryGetLongList("select content_id from r_project_content where project_id=?", new String[]{""+ operationId}); return rawQueryGetLongList("select content_id from r_operation_content where operation_id=?", new String[]{""+ operationId});
} }
public boolean insertOperationContent(OperationContentDto dto) { public boolean insertOperationContent(OperationContentDto dto) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO r_project_content "); sql.append(" INSERT OR IGNORE INTO r_operation_content ");
sql.append(" SELECT " + dto.operationId); sql.append(" SELECT " + dto.operationId);
sql.append(" , " + dto.contentId); sql.append(" , " + dto.contentId);
sql.append(" , " + (dto.operationContentFlg ? 1 : 0)); sql.append(" , " + (dto.operationContentFlg ? 1 : 0));
sql.append(" FROM t_content AS tc "); sql.append(" FROM t_content AS tc ");
sql.append(" LEFT OUTER JOIN r_project_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON rpc.project_id = ? "); sql.append(" ON rpc.operation_id = ? ");
sql.append(" AND rpc.project_content_flg = " + (dto.operationContentFlg ? 1 : 0)); sql.append(" AND rpc.operation_content_flg = " + (dto.operationContentFlg ? 1 : 0));
sql.append(" AND tc.content_id <> rpc.content_id "); sql.append(" AND tc.content_id <> rpc.content_id ");
sql.append(" WHERE tc.content_id = ? "); sql.append(" WHERE tc.content_id = ? ");
sql.append(" GROUP BY rpc.project_id "); sql.append(" GROUP BY rpc.operation_id ");
SQLiteStatement stmt = null; SQLiteStatement stmt = null;
...@@ -101,6 +101,6 @@ public class OperationContentDao extends AbstractDao { ...@@ -101,6 +101,6 @@ public class OperationContentDao extends AbstractDao {
* @param contentId * @param contentId
*/ */
public void deleteOperationContent(Long operationId, Long contentId) { public void deleteOperationContent(Long operationId, Long contentId) {
delete("r_project_content", "project_id=? and content_id=?", new String[] { ""+operationId, "" + contentId }); delete("r_operation_content", "operation_id=? and content_id=?", new String[] { ""+operationId, "" + contentId });
} }
} }
...@@ -22,28 +22,28 @@ public class OperationDao extends AbstractDao { ...@@ -22,28 +22,28 @@ public class OperationDao extends AbstractDao {
protected OperationDto convert(Cursor cursor) { protected OperationDto convert(Cursor cursor) {
OperationDto dto = new OperationDto(); OperationDto dto = new OperationDto();
int column = cursor.getColumnIndex("project_id"); int column = cursor.getColumnIndex("operation_id");
if (column != -1) { if (column != -1) {
dto.operationId = cursor.getLong(column); dto.operationId = cursor.getLong(column);
} }
column = cursor.getColumnIndex("project_name"); column = cursor.getColumnIndex("operation_name");
if (column != -1) { if (column != -1) {
dto.operationName = cursor.getString(column); dto.operationName = cursor.getString(column);
} }
column = cursor.getColumnIndex("project_descriptions"); column = cursor.getColumnIndex("operation_descriptions");
if (column != -1) { if (column != -1) {
dto.operationDescriptions = cursor.getString(column); dto.operationDescriptions = cursor.getString(column);
} }
column = cursor.getColumnIndex("project_start_date"); column = cursor.getColumnIndex("operation_start_date");
if (column != -1) { if (column != -1) {
dto.operationStartDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMdd_hyphen); dto.operationStartDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} }
column = cursor.getColumnIndex("project_end_date"); column = cursor.getColumnIndex("operation_end_date");
if (column != -1) { if (column != -1) {
dto.operationEndDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMdd_hyphen); dto.operationEndDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} }
column = cursor.getColumnIndex("project_type"); column = cursor.getColumnIndex("operation_type");
if (column != -1) { if (column != -1) {
dto.operationType = cursor.getInt(column); dto.operationType = cursor.getInt(column);
} }
...@@ -74,7 +74,7 @@ public class OperationDao extends AbstractDao { ...@@ -74,7 +74,7 @@ public class OperationDao extends AbstractDao {
dto.reportUpdateType = cursor.getInt(column); dto.reportUpdateType = cursor.getInt(column);
} }
column = cursor.getColumnIndex("project_report_type"); column = cursor.getColumnIndex("operation_report_type");
if (column != -1) { if (column != -1) {
dto.operationReportType = cursor.getInt(column); dto.operationReportType = cursor.getInt(column);
} }
...@@ -103,11 +103,11 @@ public class OperationDao extends AbstractDao { ...@@ -103,11 +103,11 @@ public class OperationDao extends AbstractDao {
} }
public List<OperationDto> getAllOperation() { public List<OperationDto> getAllOperation() {
return rawQueryGetDtoList("select tp.*, rpc.content_id from t_project AS tp left outer join r_project_content AS rpc on tp.project_id = rpc.project_id", null, OperationDto.class); return rawQueryGetDtoList("select tp.*, rpc.content_id from t_project AS tp left outer join r_operation_content AS rpc on tp.operation_id = rpc.operation_id", null, OperationDto.class);
} }
public List<OperationDto> getLatestOperations() { public List<OperationDto> getLatestOperations() {
return rawQueryGetDtoList("select * from t_project where project_start_date <= ? order by project_start_date DESC " , new String[]{DateTimeUtil.toStringInTimeZone(DateTimeUtil.getCurrentDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT")}, OperationDto.class); return rawQueryGetDtoList("select * from t_project where operation_start_date <= ? order by operation_start_date DESC " , new String[]{DateTimeUtil.toStringInTimeZone(DateTimeUtil.getCurrentDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT")}, OperationDto.class);
} }
public OperationDto getOperation(long operationId) { public OperationDto getOperation(long operationId) {
...@@ -115,7 +115,7 @@ public class OperationDao extends AbstractDao { ...@@ -115,7 +115,7 @@ public class OperationDao extends AbstractDao {
String[] args = new String[] { "" + operationId }; String[] args = new String[] { "" + operationId };
sql.append(" SELECT * "); sql.append(" SELECT * ");
sql.append(" FROM t_project "); sql.append(" FROM t_project ");
sql.append(" WHERE project_id = ?"); sql.append(" WHERE operation_id = ?");
return rawQueryGetDto(sql.toString(), args, OperationDto.class); return rawQueryGetDto(sql.toString(), args, OperationDto.class);
} }
...@@ -124,10 +124,10 @@ public class OperationDao extends AbstractDao { ...@@ -124,10 +124,10 @@ public class OperationDao extends AbstractDao {
String[] args = new String[] { "" + operationId }; String[] args = new String[] { "" + operationId };
sql.append(" SELECT * "); sql.append(" SELECT * ");
sql.append(" FROM t_project AS tp "); sql.append(" FROM t_project AS tp ");
sql.append(" LEFT OUTER JOIN r_project_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.project_id = rpc.project_id "); sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.project_content_flg = 1 "); sql.append(" AND rpc.operation_content_flg = 1 ");
sql.append(" WHERE tp.project_id = ?"); sql.append(" WHERE tp.operation_id = ?");
return rawQueryGetDto(sql.toString(), args, OperationDto.class); return rawQueryGetDto(sql.toString(), args, OperationDto.class);
} }
...@@ -136,10 +136,10 @@ public class OperationDao extends AbstractDao { ...@@ -136,10 +136,10 @@ public class OperationDao extends AbstractDao {
String[] args = new String[] { "" + contentId }; String[] args = new String[] { "" + contentId };
sql.append(" SELECT * "); sql.append(" SELECT * ");
sql.append(" FROM t_project AS tp "); sql.append(" FROM t_project AS tp ");
sql.append(" LEFT OUTER JOIN r_project_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.project_id = rpc.project_id "); sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.project_content_flg = 1 "); sql.append(" AND rpc.operation_content_flg = 1 ");
sql.append(" WHERE tp.project_id = ?"); sql.append(" WHERE tp.operation_id = ?");
return rawQueryGetDto(sql.toString(), args, OperationDto.class); return rawQueryGetDto(sql.toString(), args, OperationDto.class);
} }
...@@ -154,18 +154,18 @@ public class OperationDao extends AbstractDao { ...@@ -154,18 +154,18 @@ public class OperationDao extends AbstractDao {
public void insert(OperationDto dto) { public void insert(OperationDto dto) {
insert("insert into t_project " insert("insert into t_project "
+ "(project_id, " + "(operation_id, "
+ "project_name, " + "operation_name, "
+ "project_descriptions, " + "operation_descriptions, "
+ "project_start_date, " + "operation_start_date, "
+ "project_end_date, " + "operation_end_date, "
+ "project_type, " + "operation_type, "
+ "last_edit_date, " + "last_edit_date, "
+ "content_creating_flg, " + "content_creating_flg, "
+ "edit_lock_flg, " + "edit_lock_flg, "
+ "need_sync_flg, " + "need_sync_flg, "
+ "report_update_type, " + "report_update_type, "
+ "project_report_type, " + "operation_report_type, "
+ "report_cycle, " + "report_cycle, "
+ "enable_report_update) " + "enable_report_update) "
+ "values " + "values "
...@@ -176,37 +176,38 @@ public class OperationDao extends AbstractDao { ...@@ -176,37 +176,38 @@ public class OperationDao extends AbstractDao {
public boolean update(OperationDto dto) { public boolean update(OperationDto dto) {
long count = update("update t_project " long count = update("update t_project "
+ "set " + "set "
+ "project_name=?, " + "operation_name=?, "
+ "project_descriptions=?, " + "operation_descriptions=?, "
+ "project_start_date=?, " + "operation_start_date=?, "
+ "project_end_date=?, " + "operation_end_date=?, "
+ "project_type=?, " + "operation_type=?, "
+ "last_edit_date=?, " + "last_edit_date=?, "
+ "content_creating_flg=?, " + "content_creating_flg=?, "
+ "edit_lock_flg=?, " + "edit_lock_flg=?, "
+ "need_sync_flg=?, " + "need_sync_flg=?, "
+ "report_update_type=?, " + "report_update_type=?, "
+ "project_report_type=?, " + "operation_report_type=?, "
+ "report_cycle=?, " + "report_cycle=?, "
+ "enable_report_update=? " + "enable_report_update=? "
+ "where project_id=?", + "where operation_id=?",
dto.getUpdateValues()); dto.getUpdateValues());
return count > 0; return count > 0;
} }
public void delete(OperationDto dto) { public void delete(OperationDto dto) {
delete("r_project_content", "project_id=?", dto.getKeyValues()); delete("r_operation_content", "operation_id=?", dto.getKeyValues());
delete("t_project", "project_id=?", dto.getKeyValues()); delete("t_project", "operation_id=?", dto.getKeyValues());
} }
public void deleteAll() { public void deleteAll() {
delete("t_push_message", null, null); delete("t_push_message", null, null);
delete("r_project_content", null, null); delete("r_operation_content", null, null);
delete("t_project", null, null); delete("t_project", null, null);
delete("t_task", null, null); delete("t_task", null, null);
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// delete("t_task_directions", null, null); // TODO delete
// delete("t_task_directions_items", null, null); delete("t_task_directions", null, null);
delete("t_task_directions_items", null, null);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
delete("t_task_report", null, null); delete("t_task_report", null, null);
delete("t_task_report_send", null, null); delete("t_task_report_send", null, null);
...@@ -225,22 +226,22 @@ public class OperationDao extends AbstractDao { ...@@ -225,22 +226,22 @@ public class OperationDao extends AbstractDao {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT tp.project_id, "); sql.append(" SELECT tp.operation_id, ");
sql.append(" tp.project_name, "); sql.append(" tp.operation_name, ");
sql.append(" tp.project_type, "); sql.append(" tp.operation_type, ");
sql.append(" tp.project_descriptions, "); sql.append(" tp.operation_descriptions, ");
sql.append(" tp.project_start_date, "); sql.append(" tp.operation_start_date, ");
sql.append(" tp.project_end_date, "); sql.append(" tp.operation_end_date, ");
sql.append(" tp.last_edit_date, "); sql.append(" tp.last_edit_date, ");
sql.append(" tp.edit_lock_flg, "); sql.append(" tp.edit_lock_flg, ");
sql.append(" tp.need_sync_flg, "); sql.append(" tp.need_sync_flg, ");
sql.append(" tp.content_creating_flg, "); sql.append(" tp.content_creating_flg, ");
sql.append(" tp.report_update_type, "); sql.append(" tp.report_update_type, ");
sql.append(" tp.project_report_type, "); sql.append(" tp.operation_report_type, ");
sql.append(" tp.report_cycle, "); sql.append(" tp.report_cycle, ");
sql.append(" tp.enable_report_update, "); sql.append(" tp.enable_report_update, ");
sql.append(" CASE "); sql.append(" CASE ");
sql.append(" WHEN project_report_type = 1 THEN ( "); sql.append(" WHEN operation_report_type = 1 THEN ( ");
sql.append(" SELECT strftime('%Y/%m/%d %H:%M', datetime(ti.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ti.report_end_date, 'localtime')) "); sql.append(" SELECT strftime('%Y/%m/%d %H:%M', datetime(ti.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ti.report_end_date, 'localtime')) ");
sql.append(" FROM t_task tt "); sql.append(" FROM t_task tt ");
sql.append(" INNER JOIN t_inspect_task_report ti "); sql.append(" INNER JOIN t_inspect_task_report ti ");
...@@ -248,42 +249,42 @@ public class OperationDao extends AbstractDao { ...@@ -248,42 +249,42 @@ public class OperationDao extends AbstractDao {
sql.append(" AND tt.del_flg = 0 "); sql.append(" AND tt.del_flg = 0 ");
//sql.append(" AND datetime(ti.report_start_date) <= datetime('" + curDate + "') "); //sql.append(" AND datetime(ti.report_start_date) <= datetime('" + curDate + "') ");
sql.append(" AND datetime(ti.report_end_date) >= datetime('" + curDate + "') "); sql.append(" AND datetime(ti.report_end_date) >= datetime('" + curDate + "') ");
sql.append(" WHERE tt.project_id = tp.project_id "); sql.append(" WHERE tt.operation_id = tp.operation_id ");
sql.append(" ORDER BY ti.report_start_date ASC LIMIT 1 ) "); sql.append(" ORDER BY ti.report_start_date ASC LIMIT 1 ) ");
sql.append(" ELSE '' "); sql.append(" ELSE '' ");
sql.append(" END AS report_period, "); sql.append(" END AS report_period, ");
sql.append(" CASE "); sql.append(" CASE ");
sql.append(" WHEN project_report_type = 1 THEN ( "); sql.append(" WHEN operation_report_type = 1 THEN ( ");
sql.append(" SELECT count(*) "); sql.append(" SELECT count(*) ");
sql.append(" FROM t_inspect_task_report "); sql.append(" FROM t_inspect_task_report ");
sql.append(" WHERE task_key = (SELECT task_key FROM t_task WHERE project_id = tp.project_id LIMIT 1) ) "); sql.append(" WHERE task_key = (SELECT task_key FROM t_task WHERE operation_id = tp.operation_id LIMIT 1) ) ");
sql.append(" ELSE 0 "); sql.append(" ELSE 0 ");
sql.append(" END AS report_count, "); sql.append(" END AS report_count, ");
sql.append(" rpc.content_id "); sql.append(" rpc.content_id ");
sql.append(" FROM t_project AS tp "); sql.append(" FROM t_project AS tp ");
sql.append(" LEFT OUTER JOIN r_project_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.project_id = rpc.project_id "); sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.project_content_flg = 1 "); sql.append(" AND rpc.operation_content_flg = 1 ");
sql.append(" WHERE tp.project_id IS NOT NULL "); sql.append(" WHERE tp.operation_id IS NOT NULL ");
if (!StringUtil.isNullOrEmpty(searchOperationName)) { if (!StringUtil.isNullOrEmpty(searchOperationName)) {
sql.append(" AND tp.project_name GLOB " + "'*" + searchOperationName + "*'"); sql.append(" AND tp.operation_name GLOB " + "'*" + searchOperationName + "*'");
} }
if (!StringUtil.isNullOrEmpty(searchStartDateStr)) { if (!StringUtil.isNullOrEmpty(searchStartDateStr)) {
Date startDate = DateTimeUtil.toDate(searchStartDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen); Date startDate = DateTimeUtil.toDate(searchStartDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
sql.append(" AND tp.project_end_date >= '" + DateTimeUtil.toString(startDate, DateTimeFormat.yyyyMMdd_hyphen) + "'"); sql.append(" AND tp.operation_end_date >= '" + DateTimeUtil.toString(startDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
} }
if (!StringUtil.isNullOrEmpty(searchEndDateStr)) { if (!StringUtil.isNullOrEmpty(searchEndDateStr)) {
Date endDate = DateTimeUtil.toDate(searchEndDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen); Date endDate = DateTimeUtil.toDate(searchEndDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
sql.append(" AND tp.project_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'"); sql.append(" AND tp.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
} }
if (operationReportType > -1) { if (operationReportType > -1) {
sql.append(" AND tp.project_report_type = " + operationReportType); sql.append(" AND tp.operation_report_type = " + operationReportType);
} }
sql.append(" ORDER BY tp.project_report_type DESC, tp.project_start_date DESC, tp.project_id DESC"); sql.append(" ORDER BY tp.operation_report_type DESC, tp.operation_start_date DESC, tp.operation_id DESC");
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
......
...@@ -24,7 +24,7 @@ public class PushMessageDao extends AbstractDao { ...@@ -24,7 +24,7 @@ public class PushMessageDao extends AbstractDao {
dto.pushMessageId = cursor.getLong(column); dto.pushMessageId = cursor.getLong(column);
} }
column = cursor.getColumnIndex("project_id"); column = cursor.getColumnIndex("operation_id");
if (column != -1) { if (column != -1) {
dto.operationId = cursor.getLong(column); dto.operationId = cursor.getLong(column);
} }
...@@ -46,7 +46,7 @@ public class PushMessageDao extends AbstractDao { ...@@ -46,7 +46,7 @@ public class PushMessageDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.readingFlg = toBool(cursor.getInt(column)); dto.readingFlg = toBool(cursor.getInt(column));
} }
column = cursor.getColumnIndex("project_name"); column = cursor.getColumnIndex("operation_name");
if (column != -1) { if (column != -1) {
dto.operationName = cursor.getString(column); dto.operationName = cursor.getString(column);
} }
...@@ -55,7 +55,7 @@ public class PushMessageDao extends AbstractDao { ...@@ -55,7 +55,7 @@ public class PushMessageDao extends AbstractDao {
public void insert(PushMessageDto dto) { public void insert(PushMessageDto dto) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO t_push_message "); sql.append(" INSERT OR IGNORE INTO t_push_message ");
sql.append(" (push_message_id, project_id, push_send_login_id, push_send_date, push_message, reading_flg) "); sql.append(" (push_message_id, operation_id, push_send_login_id, push_send_date, push_message, reading_flg) ");
sql.append(" VALUES (?,?,?,?,?,?) "); sql.append(" VALUES (?,?,?,?,?,?) ");
try { try {
beginTransaction(); beginTransaction();
...@@ -89,15 +89,15 @@ public class PushMessageDao extends AbstractDao { ...@@ -89,15 +89,15 @@ public class PushMessageDao extends AbstractDao {
} }
public void delete(long operationId) { public void delete(long operationId) {
String[] args = new String[] { "" + operationId }; String[] args = new String[] { "" + operationId };
delete("t_push_message", "project_id=?", args); delete("t_push_message", "operation_id=?", args);
} }
public List<PushMessageDto> selectAll() { public List<PushMessageDto> selectAll() {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.project_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.project_name "); sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.operation_name ");
sql.append(" FROM t_push_message AS tpm "); sql.append(" FROM t_push_message AS tpm ");
sql.append(" INNER JOIN t_project AS tp "); sql.append(" INNER JOIN t_project AS tp ");
sql.append(" ON tpm.project_id = tp.project_id "); sql.append(" ON tpm.operation_id = tp.operation_id ");
sql.append(" ORDER BY tpm.push_message_id DESC "); sql.append(" ORDER BY tpm.push_message_id DESC ");
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), null, PushMessageDto.class); return rawQueryGetDtoList(sql.toString(), null, PushMessageDto.class);
...@@ -106,10 +106,10 @@ public class PushMessageDao extends AbstractDao { ...@@ -106,10 +106,10 @@ public class PushMessageDao extends AbstractDao {
public PushMessageDto select(long pushMessageId) { public PushMessageDto select(long pushMessageId) {
String[] args = new String[] { "" + pushMessageId }; String[] args = new String[] { "" + pushMessageId };
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.project_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.project_name "); sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.operation_name ");
sql.append(" FROM t_push_message AS tpm "); sql.append(" FROM t_push_message AS tpm ");
sql.append(" INNER JOIN t_project AS tp "); sql.append(" INNER JOIN t_project AS tp ");
sql.append(" ON tpm.project_id = tp.project_id "); sql.append(" ON tpm.operation_id = tp.operation_id ");
sql.append(" WHERE tpm.push_message_id = ? "); sql.append(" WHERE tpm.push_message_id = ? ");
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDto(sql.toString(), args, PushMessageDto.class); return rawQueryGetDto(sql.toString(), args, PushMessageDto.class);
......
...@@ -136,7 +136,7 @@ public class RoutineTaskReportDao extends AbstractDao { ...@@ -136,7 +136,7 @@ public class RoutineTaskReportDao extends AbstractDao {
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key"); sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tt.project_id = ? ORDER BY tr.report_start_date DESC LIMIT 1"); sb.append(" WHERE tt.operation_id = ? ORDER BY tr.report_start_date DESC LIMIT 1");
List<RoutineTaskReportDto> dtoList = rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class); List<RoutineTaskReportDto> dtoList = rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class);
if (dtoList != null && dtoList.size() > 0) { if (dtoList != null && dtoList.size() > 0) {
...@@ -164,7 +164,7 @@ public class RoutineTaskReportDao extends AbstractDao { ...@@ -164,7 +164,7 @@ public class RoutineTaskReportDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == tr.task_key "); sb.append(" ON tt.task_key == tr.task_key ");
sb.append(" WHERE tt.del_flg = 0"); sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
sb.append(" ORDER BY task_report_id ASC, report_start_date ASC"); sb.append(" ORDER BY task_report_id ASC, report_start_date ASC");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, RoutineTaskReportDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, RoutineTaskReportDto.class);
} }
...@@ -177,7 +177,7 @@ public class RoutineTaskReportDao extends AbstractDao { ...@@ -177,7 +177,7 @@ public class RoutineTaskReportDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key"); sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tr.data_send_flag = 1"); sb.append(" WHERE tr.data_send_flag = 1");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class);
} }
...@@ -189,7 +189,7 @@ public class RoutineTaskReportDao extends AbstractDao { ...@@ -189,7 +189,7 @@ public class RoutineTaskReportDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key"); sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tr.data_send_flag = 1"); sb.append(" WHERE tr.data_send_flag = 1");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?"); sb.append(" AND tt.task_key = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId, "" + taskKey }, RoutineTaskReportDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId, "" + taskKey }, RoutineTaskReportDto.class);
} }
...@@ -205,7 +205,7 @@ public class RoutineTaskReportDao extends AbstractDao { ...@@ -205,7 +205,7 @@ public class RoutineTaskReportDao extends AbstractDao {
sb.append(" from t_inspect_task_report tr "); sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join t_task tt ON tt.task_key == tr.task_key "); sb.append(" inner join t_task tt ON tt.task_key == tr.task_key ");
sb.append(" WHERE tt.del_flg = 0 "); sb.append(" WHERE tt.del_flg = 0 ");
sb.append(" AND tt.project_id = ? "); sb.append(" AND tt.operation_id = ? ");
sb.append(" AND datetime(report_end_date) >= datetime(?, 'utc') "); sb.append(" AND datetime(report_end_date) >= datetime(?, 'utc') ");
return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, currDate }) > 0; return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, currDate }) > 0;
} }
......
...@@ -28,7 +28,7 @@ public class TaskDao extends AbstractDao { ...@@ -28,7 +28,7 @@ public class TaskDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.taskId = cursor.getLong(column); dto.taskId = cursor.getLong(column);
} }
column = cursor.getColumnIndex("project_id"); column = cursor.getColumnIndex("operation_id");
if (column != -1) { if (column != -1) {
dto.operationId = cursor.getLong(column); dto.operationId = cursor.getLong(column);
} }
...@@ -52,11 +52,11 @@ public class TaskDao extends AbstractDao { ...@@ -52,11 +52,11 @@ public class TaskDao extends AbstractDao {
} }
public List<TaskDto> selectTaskByOperationId(Long operationId) { public List<TaskDto> selectTaskByOperationId(Long operationId) {
return rawQueryGetDtoList("select * from t_task where project_id = ? and del_flg = 0 ", new String[]{"" + operationId}, TaskDto.class); return rawQueryGetDtoList("select * from t_task where operation_id = ? and del_flg = 0 ", new String[]{"" + operationId}, TaskDto.class);
} }
public List<TaskDto> selectAllTaskByOperationId(Long operationId) { public List<TaskDto> selectAllTaskByOperationId(Long operationId) {
return rawQueryGetDtoList("select * from t_task where project_id = ? ", new String[]{"" + operationId}, TaskDto.class); return rawQueryGetDtoList("select * from t_task where operation_id = ? ", new String[]{"" + operationId}, TaskDto.class);
} }
public TaskDto getTaskByTaskKey(String taskKey) { public TaskDto getTaskByTaskKey(String taskKey) {
...@@ -67,7 +67,7 @@ public class TaskDao extends AbstractDao { ...@@ -67,7 +67,7 @@ public class TaskDao extends AbstractDao {
insert("insert into t_task " insert("insert into t_task "
+ "(task_key, " + "(task_key, "
+ "task_id, " + "task_id, "
+ "project_id, " + "operation_id, "
+ "task_code, " + "task_code, "
+ "task_status, " + "task_status, "
+ "task_hotspot_info) " + "task_hotspot_info) "
...@@ -80,7 +80,7 @@ public class TaskDao extends AbstractDao { ...@@ -80,7 +80,7 @@ public class TaskDao extends AbstractDao {
long count = update("update t_task " long count = update("update t_task "
+ "set " + "set "
+ "task_id=?, " + "task_id=?, "
+ "project_id=?, " + "operation_id=?, "
+ "task_code=?, " + "task_code=?, "
+ "task_status=?, " + "task_status=?, "
+ "task_hotspot_info=?, " + "task_hotspot_info=?, "
...@@ -100,7 +100,11 @@ public class TaskDao extends AbstractDao { ...@@ -100,7 +100,11 @@ public class TaskDao extends AbstractDao {
if (directionFlg) { if (directionFlg) {
delete("t_task", "task_key=?", keyValues); delete("t_task", "task_key=?", keyValues);
// #32782 指示者テーブル関連削除 // #32782 指示者テーブル関連削除 start
// TODO delete
delete("t_task_directions", "task_key=?", keyValues);
delete("t_task_directions_items", "task_key=?", keyValues);
// #32782 指示者テーブル関連削除 end
delete("t_task_report", "task_key=?", keyValues); delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues); delete("t_task_report_items", "task_key=?", keyValues);
} else { } else {
...@@ -115,7 +119,11 @@ public class TaskDao extends AbstractDao { ...@@ -115,7 +119,11 @@ public class TaskDao extends AbstractDao {
*/ */
public void delete(TaskDto dto) { public void delete(TaskDto dto) {
delete("t_task", "task_key=?", dto.getKeyValues()); delete("t_task", "task_key=?", dto.getKeyValues());
// #32782 指示者テーブル関連削除 // #32782 指示者テーブル関連削除 start
// TODO delete
delete("t_task_directions", "task_key=?", dto.getKeyValues());
delete("t_task_directions_items", "task_key=?", dto.getKeyValues());
// #32782 指示者テーブル関連削除 end
delete("t_task_report", "task_key=?", dto.getKeyValues()); delete("t_task_report", "task_key=?", dto.getKeyValues());
delete("t_task_report_items", "task_key=?", dto.getKeyValues()); delete("t_task_report_items", "task_key=?", dto.getKeyValues());
delete("t_inspect_task_report", "task_key=?", new String[] { dto.taskKey }); delete("t_inspect_task_report", "task_key=?", new String[] { dto.taskKey });
......
...@@ -11,10 +11,7 @@ import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto; ...@@ -11,10 +11,7 @@ import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
public class TaskDirectionsDao extends AbstractDao { public class TaskDirectionsDao extends AbstractDao {
// 0305 start private static final String TAG = "TaskDirectionsDao";
// private static final String TAG = "TaskDirectionsDao";
private static final String TAG = "TaskReportDao";
// 0305 end
/*package*/ TaskDirectionsDao() { /*package*/ TaskDirectionsDao() {
} }
...@@ -61,10 +58,7 @@ public class TaskDirectionsDao extends AbstractDao { ...@@ -61,10 +58,7 @@ public class TaskDirectionsDao extends AbstractDao {
public void insert(TaskDirectionsDto dto) { public void insert(TaskDirectionsDto dto) {
// 0305 start insert("insert into t_task_directions "
// insert("insert into t_task_directions "
// 0305 end
insert("insert into t_task_report "
+ "(task_key, " + "(task_key, "
+ "json_data, " + "json_data, "
+ "attached_file_name, " + "attached_file_name, "
...@@ -79,37 +73,25 @@ public class TaskDirectionsDao extends AbstractDao { ...@@ -79,37 +73,25 @@ public class TaskDirectionsDao extends AbstractDao {
public List<TaskDirectionsDto> getTaskDirectionsByOperationId(Long operationId) { public List<TaskDirectionsDto> getTaskDirectionsByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select ttd.* "); sb.append(" select ttd.* ");
// 0305 start sb.append(" from t_task_directions ttd ");
// sb.append(" from t_task_directions ttd ");
sb.append(" from t_task_report ttd ");
// 0305 end
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key "); sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE tt.del_flg = 0"); sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class);
} }
public TaskDirectionsDto getTaskDirections(String taskKey) { public TaskDirectionsDto getTaskDirections(String taskKey) {
// 0305 start return rawQueryGetDto("select * from t_task_directions where task_key=?", new String[]{"" + taskKey}, TaskDirectionsDto.class);
// 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) { public String getTaskDirectionsAttachedFileName(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_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) { public boolean update(TaskDirectionsDto dto) {
// 0305 start long count = update("update t_task_directions "
// long count = update("update t_task_directions "
// 0305 end
long count = update("update t_task_report "
+ "set " + "set "
+ "json_data=?, " + "json_data=?, "
+ "attached_file_name=?, " + "attached_file_name=?, "
...@@ -128,30 +110,24 @@ public class TaskDirectionsDao extends AbstractDao { ...@@ -128,30 +110,24 @@ public class TaskDirectionsDao extends AbstractDao {
public List<TaskDirectionsDto> getSendableTaskData(Long operationId) { public List<TaskDirectionsDto> getSendableTaskData(Long operationId) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select * "); sb.append(" select * ");
// 0305 start sb.append(" from t_task_directions ttd ");
// sb.append(" from t_task_directions ttd ");
sb.append(" from t_task_report ttd ");
// 0305 end
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key "); sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE ttd.data_send_flg = 1"); sb.append(" WHERE ttd.data_send_flg = 1");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class);
} }
public List<TaskDirectionsDto> getSendableTaskData(Long operationId, String taskKey) { public List<TaskDirectionsDto> getSendableTaskData(Long operationId, String taskKey) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select * "); sb.append(" select * ");
// 0305 start sb.append(" from t_task_directions ttd ");
// sb.append(" from t_task_directions ttd ");
sb.append(" from t_task_report ttd ");
// 0305 end
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key "); sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE ttd.data_send_flg = 1"); sb.append(" WHERE ttd.data_send_flg = 1");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?"); sb.append(" AND tt.task_key = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskDirectionsDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskDirectionsDto.class);
} }
......
...@@ -35,39 +35,27 @@ public class TaskDirectionsItemsDao extends AbstractDao { ...@@ -35,39 +35,27 @@ public class TaskDirectionsItemsDao extends AbstractDao {
} }
public void insertTaskDirectionsItems(TaskDirectionsItemsDto dto) { public void insertTaskDirectionsItems(TaskDirectionsItemsDto dto) {
// 0305 start insert("insert into t_task_directions_items (task_key, item_key, input_value) values (?,?,?)", dto.getInsertValues());
// 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) { public List<TaskDirectionsItemsDto> getTaskDirectionsItemByTaskKey(String taskKey) {
// 0305 start return rawQueryGetDtoList("select * from t_task_directions_items where task_key=?", new String[]{"" + taskKey}, TaskDirectionsItemsDto.class);
// 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) { public List<TaskDirectionsItemsDto> getTaskDirectionsItemByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select distinct ttdi.* "); sb.append(" select distinct ttdi.* ");
// 0305 start sb.append(" from t_task_directions_items ttdi ");
// sb.append(" from t_task_directions_items ttdi ");
sb.append(" from t_task_report_items ttdi ");
// 0305 end
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttdi.task_key "); sb.append(" ON tt.task_key == ttdi.task_key ");
sb.append(" WHERE tt.del_flg = 0"); sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsItemsDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsItemsDto.class);
} }
public boolean updateTaskDirectionsItems(TaskDirectionsItemsDto dto) { public boolean updateTaskDirectionsItems(TaskDirectionsItemsDto dto) {
// 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_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); return (count > 0);
} }
} }
\ No newline at end of file
...@@ -54,10 +54,11 @@ public class TaskReportDao extends AbstractDao { ...@@ -54,10 +54,11 @@ public class TaskReportDao extends AbstractDao {
dto.delFlg = toBool(cursor.getInt(column)); dto.delFlg = toBool(cursor.getInt(column));
} }
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
column = cursor.getColumnIndex("reportor_flag"); // TODO append
if (column != -1) { // column = cursor.getColumnIndex("reportor_flag");
dto.reporterFlag = toBool(cursor.getInt(column)); // if (column != -1) {
} // dto.reporterFlag = toBool(cursor.getInt(column));
// }
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
return dto; return dto;
} }
...@@ -70,12 +71,14 @@ public class TaskReportDao extends AbstractDao { ...@@ -70,12 +71,14 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_name, " + "attached_file_name, "
+ "local_attached_file_name, " + "local_attached_file_name, "
+ "attached_file_send_flg, " + "attached_file_send_flg, "
+ "data_send_flg, " + "data_send_flg) "
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
+ "reporter_flag) " // TODO append
// #32782 指示者テーブル関連削除 end // + "reporter_flag) "
+ "values " + "values "
+ "(?,?,?,?,?,?,?)", // + "(?,?,?,?,?,?,?)",
+ "(?,?,?,?,?,?)",
// #32782 指示者テーブル関連削除 end
dto.getInsertValues()); dto.getInsertValues());
} }
...@@ -87,7 +90,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -87,7 +90,7 @@ public class TaskReportDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttr.task_key "); sb.append(" ON tt.task_key == ttr.task_key ");
sb.append(" WHERE tt.del_flg = 0"); sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
} }
...@@ -104,7 +107,8 @@ public class TaskReportDao extends AbstractDao { ...@@ -104,7 +107,8 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_send_flg=?, " + "attached_file_send_flg=?, "
+ "data_send_flg=?, " + "data_send_flg=?, "
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
+ "reporter_flag=? " // TODO append
// + "reporter_flag=? "
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
+ "where task_key=?", + "where task_key=?",
dto.getUpdateValues()); dto.getUpdateValues());
...@@ -129,11 +133,15 @@ public class TaskReportDao extends AbstractDao { ...@@ -129,11 +133,15 @@ public class TaskReportDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttr.task_key "); sb.append(" ON tt.task_key == ttr.task_key ");
sb.append(" WHERE ttr.data_send_flg = 1"); sb.append(" WHERE ttr.data_send_flg = 1");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
} }
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, boolean reporterFlag) { // #32782 指示者テーブル関連削除 start
// TODO append
// public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, boolean reporterFlag) {
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey) {
// #32782 指示者テーブル関連削除 end
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select * "); sb.append(" select * ");
sb.append(" from t_task_report ttr "); sb.append(" from t_task_report ttr ");
...@@ -141,11 +149,13 @@ public class TaskReportDao extends AbstractDao { ...@@ -141,11 +149,13 @@ public class TaskReportDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttr.task_key "); sb.append(" ON tt.task_key == ttr.task_key ");
sb.append(" WHERE ttr.data_send_flg = 1"); sb.append(" WHERE ttr.data_send_flg = 1");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?"); sb.append(" AND tt.task_key = ?");
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
sb.append(" AND ttr.repertor_flag = ?"); // TODO append
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + reporterFlag}, TaskReportDto.class); // sb.append(" AND ttr.repertor_flag = ?");
// return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + reporterFlag}, TaskReportDto.class);
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskReportDto.class);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
......
...@@ -50,7 +50,7 @@ public class TaskReportItemsDao extends AbstractDao { ...@@ -50,7 +50,7 @@ public class TaskReportItemsDao extends AbstractDao {
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttri.task_key "); sb.append(" ON tt.task_key == ttri.task_key ");
sb.append(" WHERE tt.del_flg = 0"); sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportItemsDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportItemsDto.class);
} }
......
...@@ -144,7 +144,7 @@ public class TaskReportSendDao extends AbstractDao { ...@@ -144,7 +144,7 @@ public class TaskReportSendDao extends AbstractDao {
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttrs.task_key "); sb.append(" ON tt.task_key == ttrs.task_key ");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
if (taskKey != null) { if (taskKey != null) {
sb.append(" AND ttrs.task_key = ?"); sb.append(" AND ttrs.task_key = ?");
return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, "" + taskKey }); return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, "" + taskKey });
...@@ -159,7 +159,7 @@ public class TaskReportSendDao extends AbstractDao { ...@@ -159,7 +159,7 @@ public class TaskReportSendDao extends AbstractDao {
sb.append(" inner join "); sb.append(" inner join ");
sb.append(" t_task tt "); sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttrs.task_key "); sb.append(" ON tt.task_key == ttrs.task_key ");
sb.append(" AND tt.project_id = ?"); sb.append(" AND tt.operation_id = ?");
if (!StringUtil.isNullOrEmpty(taskKey) && taskReportId > 0 && !StringUtil.isNullOrEmpty(reportStartDate)) { if (!StringUtil.isNullOrEmpty(taskKey) && taskReportId > 0 && !StringUtil.isNullOrEmpty(reportStartDate)) {
sb.append(" AND ttrs.task_key = ? and task_report_id = ? and report_start_date = ?"); sb.append(" AND ttrs.task_key = ? and task_report_id = ? and report_start_date = ?");
return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, taskKey, "" + taskReportId, reportStartDate }); return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, taskKey, "" + taskReportId, reportStartDate });
......
...@@ -32,7 +32,7 @@ public class MMemberInfo extends SQLiteTableScript { ...@@ -32,7 +32,7 @@ public class MMemberInfo extends SQLiteTableScript {
sql.append(" , password_expiry_date DATETIME "); sql.append(" , password_expiry_date DATETIME ");
sql.append(" , user_id INTEGER"); sql.append(" , user_id INTEGER");
sql.append(" , last_update_infor VARCHAR(64)"); sql.append(" , last_update_infor VARCHAR(64)");
sql.append(" , project_auth_level INTEGER"); sql.append(" , operation_auth_level INTEGER");
sql.append(" , worker_code TEXT"); sql.append(" , worker_code TEXT");
sql.append(" , PRIMARY KEY (login_id) "); sql.append(" , PRIMARY KEY (login_id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -20,12 +20,12 @@ public class ROperationContent extends SQLiteTableScript { ...@@ -20,12 +20,12 @@ public class ROperationContent extends SQLiteTableScript {
List<String> ddl = new ArrayList<String>(); List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE r_project_content ( "); sql.append(" CREATE TABLE r_operation_content ( ");
sql.append(" project_id BIGINT NOT NULL "); sql.append(" operation_id BIGINT NOT NULL ");
sql.append(" , content_id BIGINT NOT NULL "); sql.append(" , content_id BIGINT NOT NULL ");
sql.append(" , project_content_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , operation_content_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (project_id, content_id) "); sql.append(" , PRIMARY KEY (operation_id, content_id) ");
sql.append(" , FOREIGN KEY (project_id) REFERENCES t_project (project_id) "); sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_project (operation_id) ");
sql.append(" , FOREIGN KEY (content_id) REFERENCES t_content (content_id)"); sql.append(" , FOREIGN KEY (content_id) REFERENCES t_content (content_id)");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -66,7 +66,7 @@ public class TContent extends SQLiteTableScript { ...@@ -66,7 +66,7 @@ public class TContent extends SQLiteTableScript {
sql.append(" , log_sended_flg BOOLEAN default 0"); // since ABook+1.6.3 (from t_content_download_queue) sql.append(" , log_sended_flg BOOLEAN default 0"); // since ABook+1.6.3 (from t_content_download_queue)
sql.append(" , status VARCHAR(2) "); // since ABook+1.6.3 (from t_content_download_queue) sql.append(" , status VARCHAR(2) "); // since ABook+1.6.3 (from t_content_download_queue)
sql.append(" , unauthorized_content_flg BOOLEAN default 0"); //since ABook See 1.7.2 sql.append(" , unauthorized_content_flg BOOLEAN default 0"); //since ABook See 1.7.2
sql.append(" , project_content_flg BOOLEAN default 0"); //since ABook Check 1.9.3 sql.append(" , operation_content_flg BOOLEAN default 0"); //since ABook Check 1.9.3
sql.append(" , common_content_flg BOOLEAN default 0"); //since ABook Check 1.9.4 sql.append(" , common_content_flg BOOLEAN default 0"); //since ABook Check 1.9.4
sql.append(" , PRIMARY KEY (content_id) "); sql.append(" , PRIMARY KEY (content_id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -22,21 +22,21 @@ public class TOperation extends SQLiteTableScript { ...@@ -22,21 +22,21 @@ public class TOperation extends SQLiteTableScript {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_project ( "); sql.append(" CREATE TABLE t_project ( ");
sql.append(" project_id BIGINT NOT NULL "); sql.append(" operation_id BIGINT NOT NULL ");
sql.append(" , project_name VARCHAR(128) "); sql.append(" , operation_name VARCHAR(128) ");
sql.append(" , project_type INTEGER NOT NULL "); sql.append(" , operation_type INTEGER NOT NULL ");
sql.append(" , project_descriptions TEXT "); sql.append(" , operation_descriptions TEXT ");
sql.append(" , project_start_date DATE NOT NULL "); sql.append(" , operation_start_date DATE NOT NULL ");
sql.append(" , project_end_date DATE NOT NULL "); sql.append(" , operation_end_date DATE NOT NULL ");
sql.append(" , last_edit_date DATE NOT NULL "); sql.append(" , last_edit_date DATE NOT NULL ");
sql.append(" , content_creating_flg INTEGER NOT NULL "); sql.append(" , content_creating_flg INTEGER NOT NULL ");
sql.append(" , edit_lock_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , edit_lock_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , report_update_type INTEGER NOT NULL DEFAULT 0 "); sql.append(" , report_update_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , project_report_type INTEGER NOT NULL DEFAULT 0 "); sql.append(" , operation_report_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , report_cycle INTEGER NOT NULL DEFAULT 0 "); sql.append(" , report_cycle INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_update INTEGER NOT NULL DEFAULT 0 "); sql.append(" , enable_report_update INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (project_id) "); sql.append(" , PRIMARY KEY (operation_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -21,13 +21,13 @@ public class TPushMessage extends SQLiteTableScript { ...@@ -21,13 +21,13 @@ public class TPushMessage extends SQLiteTableScript {
sql.append(" CREATE TABLE t_push_message ( "); sql.append(" CREATE TABLE t_push_message ( ");
sql.append(" push_message_id BIGINT NOT NULL "); sql.append(" push_message_id BIGINT NOT NULL ");
sql.append(" , project_id BIGINT NOT NULL "); sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , push_send_login_id VARCHAR(128) "); sql.append(" , push_send_login_id VARCHAR(128) ");
sql.append(" , push_send_date DATE NOT NULL "); sql.append(" , push_send_date DATE NOT NULL ");
sql.append(" , push_message TEXT "); sql.append(" , push_message TEXT ");
sql.append(" , reading_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , reading_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (push_message_id) "); sql.append(" , PRIMARY KEY (push_message_id) ");
sql.append(" , FOREIGN KEY (project_id) REFERENCES t_project (project_id) "); sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_project (operation_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -24,7 +24,7 @@ public class TTask extends SQLiteTableScript { ...@@ -24,7 +24,7 @@ public class TTask extends SQLiteTableScript {
sql.append(" CREATE TABLE t_task ( "); sql.append(" CREATE TABLE t_task ( ");
sql.append(" task_key TEXT NOT NULL "); sql.append(" task_key TEXT NOT NULL ");
sql.append(" , task_id BIGINT "); sql.append(" , task_id BIGINT ");
sql.append(" , project_id BIGINT NOT NULL "); sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , task_code VARCHAR(64) "); sql.append(" , task_code VARCHAR(64) ");
sql.append(" , task_status INTEGER "); sql.append(" , task_status INTEGER ");
sql.append(" , task_hotspot_info TEXT "); sql.append(" , task_hotspot_info TEXT ");
......
...@@ -21,10 +21,7 @@ public class TTaskDirections extends SQLiteTableScript { ...@@ -21,10 +21,7 @@ public class TTaskDirections extends SQLiteTableScript {
List<String> ddl = new ArrayList<String>(); List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
// 0305 start sql.append(" CREATE TABLE t_task_directions ( ");
// 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(" task_key TEXT NOT NULL ");
sql.append(" , json_data TEXT NOT NULL "); sql.append(" , json_data TEXT NOT NULL ");
sql.append(" , attached_file_name TEXT "); sql.append(" , attached_file_name TEXT ");
......
...@@ -21,10 +21,7 @@ public class TTaskDirectionsItems extends SQLiteTableScript { ...@@ -21,10 +21,7 @@ public class TTaskDirectionsItems extends SQLiteTableScript {
List<String> ddl = new ArrayList<String>(); List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
// 0305 start sql.append(" CREATE TABLE t_task_directions_items ( ");
// 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(" task_key TEXT NOT NULL ");
sql.append(" , item_key VARCHAR(64) "); sql.append(" , item_key VARCHAR(64) ");
sql.append(" , input_value VARCHAR(64) "); sql.append(" , input_value VARCHAR(64) ");
......
...@@ -29,7 +29,8 @@ public class TTaskReport extends SQLiteTableScript { ...@@ -29,7 +29,8 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 "); sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 "); sql.append(" , data_send_flg BOOLEAN DEFAULT 0 ");
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
sql.append(" , reporter_flag BOOLEAN DEFAULT 0 "); // TODO append
// sql.append(" , reporter_flag BOOLEAN DEFAULT 0 ");
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -18,7 +18,8 @@ public class TaskDto extends AbstractDto { ...@@ -18,7 +18,8 @@ public class TaskDto extends AbstractDto {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO TaskDirectionDto から TaskReportDto に変更、taskDirectionsDto 名を変更必要 // TODO TaskDirectionDto から TaskReportDto に変更、taskDirectionsDto 名を変更必要
public TaskReportDto taskDirectionsDto; // public TaskReportDto taskDirectionsDto;
public TaskDirectionsDto taskDirectionsDto;
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
public TaskReportDto taskReportDto; public TaskReportDto taskReportDto;
......
...@@ -22,14 +22,18 @@ public class TaskReportDto extends AbstractDto { ...@@ -22,14 +22,18 @@ public class TaskReportDto extends AbstractDto {
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag }; // TODO change
// return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag };
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg};
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
@Override @Override
public Object[] getUpdateValues() { public Object[] getUpdateValues() {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag, taskKey }; // TODO change
// return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag, taskKey };
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
......
...@@ -79,8 +79,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -79,8 +79,9 @@ public class OperationLogic extends AbstractLogic {
private WorkerGroupDao mWorkerGroupDao = AbstractDao.getDao(WorkerGroupDao.class); private WorkerGroupDao mWorkerGroupDao = AbstractDao.getDao(WorkerGroupDao.class);
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class); private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class); // TODO delete
// private TaskDirectionsItemsDao mTaskDirectionsItemsDao = AbstractDao.getDao(TaskDirectionsItemsDao.class); private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
private TaskDirectionsItemsDao mTaskDirectionsItemsDao = AbstractDao.getDao(TaskDirectionsItemsDao.class);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class); private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class); private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class);
...@@ -230,7 +231,62 @@ public class OperationLogic extends AbstractLogic { ...@@ -230,7 +231,62 @@ public class OperationLogic extends AbstractLogic {
public void insertTaskDirections( String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void insertTaskDirections( String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete method // TODO Delete
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);
}
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -250,6 +306,71 @@ public class OperationLogic extends AbstractLogic { ...@@ -250,6 +306,71 @@ public class OperationLogic extends AbstractLogic {
public void updateTaskDirections(String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void updateTaskDirections(String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete method // TODO Delete method
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
// ignore
Logger.w(TAG, "taskDto is null");
return;
}
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);
}
}
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -265,6 +386,21 @@ public class OperationLogic extends AbstractLogic { ...@@ -265,6 +386,21 @@ public class OperationLogic extends AbstractLogic {
public void deleteTaskDirections(long operationId, long contentId, String taskKey) { public void deleteTaskDirections(long operationId, long contentId, String taskKey) {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete method // TODO Delete method
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
return;
}
TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
taskDirectionsDto.dataSendFlg = true;
taskDirectionsDto.attachedFileSendFlg = false;
taskDto.delFlg = true;
mTaskDirectionsDao.update(taskDirectionsDto);
mTaskDao.update(taskDto);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData(operationId, contentId, taskKey);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -281,6 +417,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -281,6 +417,9 @@ public class OperationLogic extends AbstractLogic {
* @param hotSpotInfo * @param hotSpotInfo
* @throws IOException * @throws IOException
*/ */
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException { public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel; int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
...@@ -373,6 +512,63 @@ public class OperationLogic extends AbstractLogic { ...@@ -373,6 +512,63 @@ public class OperationLogic extends AbstractLogic {
FileUtil.delete(tempDirPath); FileUtil.delete(tempDirPath);
} }
} }
*/
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
//TODO error
return;
}
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_2_")) {
taskDto.taskStatus = taskJson.getInt(itemKey);
}
taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey;
try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskReportJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey);
if (taskReport.size() > 0) {
mTaskReportDao.update(taskReportDto);
} else {
mTaskReportDao.insert(taskReportDto);
}
mTaskDao.update(taskDto);
//添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false);
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if(result) {
FileUtil.delete(tempDirPath);
}
}
// #32782 指示者テーブル関連削除 end
/** /**
* 定期点検データ新規 * 定期点検データ新規
...@@ -437,6 +633,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -437,6 +633,9 @@ public class OperationLogic extends AbstractLogic {
* @param hotSpotInfo * @param hotSpotInfo
* @throws IOException * @throws IOException
*/ */
// #32782 指示者テーブル関連削除 satrt
// TODO change
/*
public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException { public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey); TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
// 指示者か報告者か判断 // 指示者か報告者か判断
...@@ -525,6 +724,62 @@ public class OperationLogic extends AbstractLogic { ...@@ -525,6 +724,62 @@ public class OperationLogic extends AbstractLogic {
} }
} }
} }
*/
public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
if (taskReportDto == null) {
Logger.w(TAG, "taskReportDto is null");
insertTaskReport(taskKey, operationId, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg);
return;
}
JSONObject taskJson = taskReport.getJSONObject("task");
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
if (taskReportItemsDto.itemKey.startsWith("q_2_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskStatus = Integer.parseInt(taskReportItemsDto.inputValue);
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
taskReportDto.jsonData = taskReport.toString();
taskReportDto.dataSendFlg = dataSendFlg;
// attachedFileSendFlgがtrueの場合は、更新しない
if (!taskReportDto.attachedFileSendFlg) {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
}
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false);
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReport.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);
}
}
}
// #32782 指示者テーブル関連削除 end
/** /**
* 定期点検データ更新 * 定期点検データ更新
...@@ -700,6 +955,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -700,6 +955,9 @@ public class OperationLogic extends AbstractLogic {
* @param contentId * @param contentId
* @param taskKey * @param taskKey
*/ */
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void deleteTaskReport(long operationId, long contentId, String taskKey) { public void deleteTaskReport(long operationId, long contentId, String taskKey) {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
...@@ -735,6 +993,27 @@ public class OperationLogic extends AbstractLogic { ...@@ -735,6 +993,27 @@ public class OperationLogic extends AbstractLogic {
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
*/
public void deleteTaskReport(long operationId, long contentId, String taskKey) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
if(taskReportDto != null) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = "";
mTaskReportDao.update(taskReportDto);
}
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto != null) {
taskDto.taskStatus = 0;
mTaskDao.update(taskDto);
}
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
}
// #32782 指示者テーブル関連削除 end
/** /**
* 定期点検用、作業削除 * 定期点検用、作業削除
...@@ -842,6 +1121,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -842,6 +1121,9 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey * @param taskKey
* @param param * @param param
*/ */
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void updateTaskHotspot(String taskKey, Map<String, String> param) { public void updateTaskHotspot(String taskKey, Map<String, String> param) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
...@@ -852,6 +1134,17 @@ public class OperationLogic extends AbstractLogic { ...@@ -852,6 +1134,17 @@ public class OperationLogic extends AbstractLogic {
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
} }
*/
public void updateTaskHotspot(String taskKey, Map<String, String> param) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
taskDirectionsDto.dataSendFlg = true;
taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
mTaskDirectionsDao.update(taskDirectionsDto);
mTaskDao.update(taskDto);
}
// #32782 指示者テーブル関連削除 end
/** /**
* ホットスポットの位置更新 * ホットスポットの位置更新
...@@ -860,6 +1153,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -860,6 +1153,9 @@ public class OperationLogic extends AbstractLogic {
* @param newX * @param newX
* @param newY * @param newY
*/ */
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void updateTaskHotspot(String taskKey, float newX, float newY) { public void updateTaskHotspot(String taskKey, float newX, float newY) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
...@@ -873,6 +1169,19 @@ public class OperationLogic extends AbstractLogic { ...@@ -873,6 +1169,19 @@ public class OperationLogic extends AbstractLogic {
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
} }
*/
public void updateTaskHotspot(String taskKey, float newX, float newY) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
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);
mTaskDao.update(taskDto);
}
// #32782 指示者テーブル関連削除 end
/** /**
* 作業指示、作業報告用のjsonファイル * 作業指示、作業報告用のjsonファイル
...@@ -899,6 +1208,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -899,6 +1208,9 @@ public class OperationLogic extends AbstractLogic {
* @param routineTaskReportFlg * @param routineTaskReportFlg
* @throws IOException * @throws IOException
*/ */
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg, boolean routineTaskReportFlg) throws IOException { public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg, boolean routineTaskReportFlg) throws IOException {
try { try {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
...@@ -917,6 +1229,29 @@ public class OperationLogic extends AbstractLogic { ...@@ -917,6 +1229,29 @@ public class OperationLogic extends AbstractLogic {
throw e; throw e;
} }
} }
*/
public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg, boolean routineTaskReportFlg) throws IOException {
try {
createTaskDirectionsJson(operationId, contentPath);
createTaskDirectionsSuggestJson(operationId, contentPath);
if (!directionsFlg) {
//if (reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD ) {
// createTaskReportJson(operationId, contentPath);
//}
if (routineTaskReportFlg) {
createRoutineTaskReportJson(operationId, contentPath);
} else {
createTaskReportJson(operationId, contentPath);
}
createTaskReportSuggestJson(operationId, contentPath);
}
createHopSpotJson(operationId, contentPath);
} catch (IOException e) {
Logger.e(TAG, "createJsonForOperationContent error : ", e);
throw e;
}
}
public void createJsonForRoutineTaskReport(int reportCycle, int enableReportUpdate, int taskReportId, String contentPath) throws IOException { public void createJsonForRoutineTaskReport(int reportCycle, int enableReportUpdate, int taskReportId, String contentPath) throws IOException {
JSONObject routineTaskJson = new JSONObject(); JSONObject routineTaskJson = new JSONObject();
...@@ -1021,6 +1356,15 @@ public class OperationLogic extends AbstractLogic { ...@@ -1021,6 +1356,15 @@ public class OperationLogic extends AbstractLogic {
private void createTaskDirectionsJson(Long operationId, String contentPath) throws IOException { private void createTaskDirectionsJson(Long operationId, String contentPath) throws IOException {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete method // TODO Delete method
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());
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -1034,6 +1378,31 @@ public class OperationLogic extends AbstractLogic { ...@@ -1034,6 +1378,31 @@ public class OperationLogic extends AbstractLogic {
private void createTaskDirectionsSuggestJson(Long operationId, String contentPath) throws IOException { private void createTaskDirectionsSuggestJson(Long operationId, String contentPath) throws IOException {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete mothod // TODO Delete mothod
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());
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -1143,7 +1512,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -1143,7 +1512,9 @@ public class OperationLogic extends AbstractLogic {
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// 作業指示者 // 作業指示者
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
if (mTaskReportDao.isExistSendTaskData(operationDto.operationId)) { // TODO change
// if (mTaskReportDao.isExistSendTaskData(operationDto.operationId)) {
if (mTaskDirectionsDao.isExistSendTaskData(operationDto.operationId)) {
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
mOperationDao.updateNeedSyncFlg(operationDto.operationId, true); mOperationDao.updateNeedSyncFlg(operationDto.operationId, true);
} }
...@@ -1264,6 +1635,8 @@ public class OperationLogic extends AbstractLogic { ...@@ -1264,6 +1635,8 @@ public class OperationLogic extends AbstractLogic {
// TODO sendTaskDirectionsData 名を変更必要 // TODO sendTaskDirectionsData 名を変更必要
public void sendTaskDirectionsData(long operationId, String taskKey, Callback progressCallback) throws ABVException, NetworkDisconnectedException, IOException, ZipException, NoSuchAlgorithmException { public void sendTaskDirectionsData(long operationId, String taskKey, Callback progressCallback) throws ABVException, NetworkDisconnectedException, IOException, ZipException, NoSuchAlgorithmException {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO change
/*
List<TaskReportDto> taskReportDtoList = null; List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0; int maxProgress = 0;
if (taskKey == null) { if (taskKey == null) {
...@@ -1309,6 +1682,49 @@ public class OperationLogic extends AbstractLogic { ...@@ -1309,6 +1682,49 @@ public class OperationLogic extends AbstractLogic {
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
} }
} }
*/
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));
}
}
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -1319,6 +1735,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -1319,6 +1735,9 @@ public class OperationLogic extends AbstractLogic {
* @throws Exception * @throws Exception
*/ */
public void sendTaskReportSendData(long operationId, String taskKey, Callback progressCallback) throws Exception { public void sendTaskReportSendData(long operationId, String taskKey, Callback progressCallback) throws Exception {
// #32782 指示者テーブル関連削除 start
// TODO change
/*
List<TaskReportDto> taskReportDtoList = null; List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0; int maxProgress = 0;
if (taskKey == null) { if (taskKey == null) {
...@@ -1434,6 +1853,84 @@ public class OperationLogic extends AbstractLogic { ...@@ -1434,6 +1853,84 @@ public class OperationLogic extends AbstractLogic {
} }
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
*/
List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0;
if (taskKey == null) {
taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId);
maxProgress = 40;
} else {
taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId, taskKey);
maxProgress = 100;
}
if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
OperationDto operationDto = mOperationDao.getOperation(operationId);
int allSendCount = mTaskReportSendDao.getSendableTaskReportSendDataCount(operationId, taskKey);
int progress = maxProgress / allSendCount;
for (TaskReportDto taskReportDto : taskReportDtoList) {
List<TaskReportSendDto> taskReportSendDtoList = mTaskReportSendDao.getSendableTaskReportSendData(taskReportDto.taskKey);
int lastTaskReportSendId = mTaskReportSendDao.getLastTaskReportSendId(taskReportDto.taskKey);
for (TaskReportSendDto taskReportSendDto : taskReportSendDtoList) {
// 履歴なし:元のattachedFileSendFlg
// 履歴追加:古い履歴はtrue
// 履歴更新:true、ファイルに変更が無くてもzipファイル作成
if (taskReportSendDto.taskReportSendId < lastTaskReportSendId || operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
taskReportDto.attachedFileSendFlg = true;
}
File zipFile = null;
if (taskReportDto.attachedFileSendFlg) {
String fileName = null;
zipFile = createAttachedFileForSend(operationId, taskReportDto.taskKey, taskReportSendDto.taskReportSendId, false, 0, "");
if (zipFile != null) {
fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
}
taskReportDto.localAttachedFileName = fileName != null ? SecurityUtil.getMd5Hash(fileName) : null;
}
try {
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendTaskData(
cache.getMemberInfo().sid,
String.valueOf(operationId),
taskReportDto.taskKey,
taskReportDto.delFlg ? "1" : "0", String.valueOf(1),
taskReportDto.taskHotSpotInfo,
taskReportSendDto.jsonData,
zipFile,
taskReportDto.attachedFileSendFlg,
taskReportSendDto.saveDate
);
progressCallback.callback(new Integer(progress));
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
} catch (Exception ex) {
throw ex;
} finally {
if (zipFile != null) {
zipFile.delete();
}
}
}
if (taskReportDto.delFlg) {
// 物理削除
mTaskDao.deleteTaskData(taskReportDto.taskKey, false);
} else {
if (operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
taskReportDto.jsonData = "";
}
taskReportDto.dataSendFlg = false;
taskReportDto.attachedFileSendFlg = false;
mTaskReportDao.update(taskReportDto);
}
}
}
// #32782 指示者テーブル関連削除 end
} }
/** /**
......
...@@ -144,7 +144,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -144,7 +144,8 @@ public class OperationListActivity extends ABVUIActivity {
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class); private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class); // TODO delete
private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class); private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private RoutineTaskReportDao mRoutineTaskReportDao = AbstractDao.getDao(RoutineTaskReportDao.class); private RoutineTaskReportDao mRoutineTaskReportDao = AbstractDao.getDao(RoutineTaskReportDao.class);
...@@ -1045,15 +1046,18 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1045,15 +1046,18 @@ public class OperationListActivity extends ABVUIActivity {
} }
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO change
/*
// JSONObject taskDirectionJson;
JSONObject taskReportJson; JSONObject taskReportJson;
for (TaskDto taskDto : json.taskDtoList) { for (TaskDto taskDto : json.taskDtoList) {
String directionsAttachedFileName = taskDto.taskDirectionsDto.attachedFileName; String directionsAttachedFileName = taskDto.taskDirectionsDto.attachedFileName;
String reportAttachedFileName = taskDto.taskReportDto.attachedFileName; String reportAttachedFileName = taskDto.taskReportDto.attachedFileName;
// #32782 指示者テーブル関連削除 start // 0305 start
taskReportJson = new JSONObject(taskDto.taskDirectionsDto.jsonData); taskReportJson = new JSONObject(taskDto.taskDirectionsDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus); taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
// #32782 指示者テーブル関連削除 end // 0305 end
int localTaskIndex = localTaskList.indexOf(taskDto); int localTaskIndex = localTaskList.indexOf(taskDto);
if (localTaskIndex >= 0) { if (localTaskIndex >= 0) {
...@@ -1094,6 +1098,50 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1094,6 +1098,50 @@ public class OperationListActivity extends ABVUIActivity {
} }
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
} }
*/
JSONObject taskDirectionJson;
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);
int localTaskIndex = localTaskList.indexOf(taskDto);
if (localTaskIndex >= 0) {
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName);
if (isSyncGetTaskFileError) {
return null;
}
// 作業更新
mOperationLogic.updateTaskDirections(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskDirectionJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
localTaskList.remove(taskDto);
// 報告データが存在すると作業報告を更新する
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false);
}
} else {
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName);
if (isSyncGetTaskFileError) {
return null;
}
// 作業登録
mOperationLogic.insertTaskDirections(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskDirectionJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false);
}
}
progressCallback.callback(new Integer(progress));
}
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
// サーバーから取得した作業情報がローカルに存在しないので削除する // サーバーから取得した作業情報がローカルに存在しないので削除する
...@@ -1115,7 +1163,9 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1115,7 +1163,9 @@ public class OperationListActivity extends ABVUIActivity {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
String directionsLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey); // TODO change
String directionsLocalAttachedFileName = mTaskDirectionsDao.getTaskDirectionsAttachedFileName(taskKey);
// String directionsLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey); String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey);
int count = 0; int count = 0;
......
...@@ -67,8 +67,14 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -67,8 +67,14 @@ public class ABookCheckWebViewHelper extends ABookHelper {
int taskReportSendId = 0; int taskReportSendId = 0;
mFinishCallback = finishCallback; mFinishCallback = finishCallback;
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel; // #32782 指示者テーブル関連削除 start
// TODO append
// int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
// #32782 指示者テーブル関連削除 end
// #32782 指示者テーブル関連削除 start
// TODO change
/*
switch (cmd) { switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS: case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
...@@ -158,6 +164,86 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -158,6 +164,86 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mFinishCallback.callback(false); mFinishCallback.callback(false);
break; break;
} }
*/
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
mOperationLogic.deleteTaskDirections(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_MOVE_HOT_SPOT:
mOperationLogic.updateTaskHotspot(taskKey, param);
mOperationLogic.createHopSpotJson(operationId, contentPath);
break;
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, true, routineTaskReportFlg);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
break;
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
break;
case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0;
String reportStartDate = "";
boolean sendTaskReportDataFlg = false;
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if (routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey);
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if (taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
}
if (sendTaskReportDataFlg) {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId);
} else if (reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
} else {
mFinishCallback.callback(false);
}
break;
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
case ABookKeys.CMD_CANCEL_TASK_REPORT:
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
mFinishCallback.callback(false);
break;
}
// #32782 指示者テーブル関連削除 end
} }
/** /**
...@@ -170,6 +256,9 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -170,6 +256,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
private void sendTaskDirectionsData(final ABVContentViewActivity context, final long operationId, final String taskKey) { private void sendTaskDirectionsData(final ABVContentViewActivity context, final long operationId, final String taskKey) {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete mothod // TODO Delete mothod
Logger.d(TAG, "[sendTaskDirectionsData] operationId=%s, taskKey=%s", operationId, taskKey);
//作業指示送信時には「reportUpdateType」値が必要ではないので、「-1」に設定
sendTaskData(context, operationId, taskKey, -1, true);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -180,10 +269,19 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -180,10 +269,19 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param taskKey タスクキー * @param taskKey タスクキー
* @param reportUpdateType 作業履歴タイプ * @param reportUpdateType 作業履歴タイプ
*/ */
// #32782 指示者テーブル関連削除 start
// TODO change
/*
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirection) { private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirection) {
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey); Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, reportUpdateType, isDirection); sendTaskData(context, operationId, taskKey, reportUpdateType, isDirection);
} }
*/
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType) {
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, reportUpdateType, false);
}
// #32782 指示者テーブル関連削除 end
/** /**
* 作業報告・指示データ送信処理(共通) * 作業報告・指示データ送信処理(共通)
...@@ -222,7 +320,9 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -222,7 +320,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
try { try {
if (isDirections) { if (isDirections) {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback); // TODO change
// mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
mOperationLogic.sendTaskDirectionsData(operationId, taskKey, progressCallback);
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
mOperationLogic.updateSyncOperation(operationId, true); mOperationLogic.updateSyncOperation(operationId, true);
} else { } else {
...@@ -345,9 +445,23 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -345,9 +445,23 @@ public class ABookCheckWebViewHelper extends ABookHelper {
private void insertOrUpdateTaskDirections(String taskKey, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg) throws IOException { private void insertOrUpdateTaskDirections(String taskKey, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg) throws IOException {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO Delete method // TODO Delete method
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskDirections = param.get(ABookKeys.TASK_DIRECTIONS);
JSONObject taskDirectionsJson = new JSONObject(taskDirections);
String taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) {
mOperationLogic.insertTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
} else {
mOperationLogic.updateTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
}
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
// #32782 指示者テーブル関連削除 start
// TODO change
/*
private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException { private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException {
int taskReportSendId = 0; int taskReportSendId = 0;
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
...@@ -432,6 +546,67 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -432,6 +546,67 @@ public class ABookCheckWebViewHelper extends ABookHelper {
} }
} }
} }
*/
private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException {
int taskReportSendId = 0;
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskReport = param.get(ABookKeys.TASK_REPORT);
JSONObject taskReportJson = new JSONObject(taskReport);
int taskReportId = 0;
String reportStartDate = "";
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
//reportStartDate = DateTimeUtil.toString(DateTimeUtil.toDate(reportStartDate, "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmss_hyphen);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
routineTaskTaskReportDto.jsonData = taskReport;
mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true);
} else {
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
}
}
if (routineTaskReportFlg) {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskReportFlg) {
mOperationLogic.initialRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createRoutineTaskReportJson(operationId, contentPath);
} else {
mOperationLogic.initialTaskReport(operationId, contentId, taskKey);
mOperationLogic.createTaskReportJson(operationId, contentPath);
}
}
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, routineTaskReportFlg, taskReportId, reportStartDate);
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
}
}
// #32782 指示者テーブル関連削除 end
// xwalkで動画ファイルにアクセスするため、../files/..の以下のパスのディレクトりを../cache/..以下のパスに変更 // xwalkで動画ファイルにアクセスするため、../files/..の以下のパスのディレクトりを../cache/..以下のパスに変更
public void allCopyTaskAttachedMovieFileToCache(long operationId, long contentId, OperationDto operationDto) { public void allCopyTaskAttachedMovieFileToCache(long operationId, long contentId, OperationDto operationDto) {
......
...@@ -100,7 +100,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity { ...@@ -100,7 +100,7 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
webView = (WebView) findViewById(R.id.webView2); webView = (WebView) findViewById(R.id.webView2);
webView.setVisibility(View.VISIBLE); webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
//webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可) webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
// webView.setWebViewClient(new WebViewClient()); // webView.setWebViewClient(new WebViewClient());
// //ブラウザの描画領域を対象としたイベントをフック // //ブラウザの描画領域を対象としたイベントをフック
WebSettings settings = webView.getSettings(); WebSettings settings = webView.getSettings();
......
...@@ -19,6 +19,7 @@ import android.widget.RelativeLayout; ...@@ -19,6 +19,7 @@ import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import org.xwalk.core.XWalkNavigationHistory; import org.xwalk.core.XWalkNavigationHistory;
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkResourceClient; import org.xwalk.core.XWalkResourceClient;
import org.xwalk.core.XWalkSettings; import org.xwalk.core.XWalkSettings;
import org.xwalk.core.XWalkUIClient; import org.xwalk.core.XWalkUIClient;
...@@ -118,7 +119,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity { ...@@ -118,7 +119,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
settings.setDomStorageEnabled(true); // WebStorage有効化 settings.setDomStorageEnabled(true); // WebStorage有効化
settings.setCacheMode(XWalkSettings.LOAD_NO_CACHE); settings.setCacheMode(XWalkSettings.LOAD_NO_CACHE);
//XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); //デバッグモード(chromeからinspect可) XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); //デバッグモード(chromeからinspect可)
final RelativeLayout fl = (RelativeLayout) findViewById(R.id.frameTopbar); final RelativeLayout fl = (RelativeLayout) findViewById(R.id.frameTopbar);
......
...@@ -90,7 +90,7 @@ public class OperationTaskLayout extends RelativeLayout { ...@@ -90,7 +90,7 @@ public class OperationTaskLayout extends RelativeLayout {
mWebView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す mWebView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
// mWebView.setWebViewClient(new WebViewClient()); // mWebView.setWebViewClient(new WebViewClient());
//mWebView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可) mWebView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
mWebView.addJavascriptInterface(jsInf, "android"); mWebView.addJavascriptInterface(jsInf, "android");
// //ブラウザの描画領域を対象としたイベントをフック // //ブラウザの描画領域を対象としたイベントをフック
WebSettings settings = mWebView.getSettings(); WebSettings settings = mWebView.getSettings();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment