Commit 4309bdca by Lee Jaebin

#32825 作業一覧画面改善(Android)

parent 42f9b507
...@@ -33,15 +33,24 @@ public class OperationDataJSON extends AcmsCommonJSON { ...@@ -33,15 +33,24 @@ public class OperationDataJSON extends AcmsCommonJSON {
// public static final String TaskDirectionsInfo = "taskReportInfo"; // public static final String TaskDirectionsInfo = "taskReportInfo";
public static final String TaskDirectionsInfo = "taskDirectionsInfo"; public static final String TaskDirectionsInfo = "taskDirectionsInfo";
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
public static final String TaskReportInfo = "taskReportInfo";
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO change&Delete TaskDirections // TODO change&Delete TaskDirections
// public static final String TaskDirectionsKey = "taskReportKey"; // public static final String TaskDirectionsKey = "taskReportKey";
public static final String TaskDirectionsKey = "taskDirectionsKey"; public static final String TaskDirectionsKey = "taskDirectionsKey";
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
public static final String TaskReportKey = "taskReportKey";
public static final String Task = "task"; public static final String Task = "task";
// 1.0.1で追加
public static final String TaskReportId = "taskReportId"; // 作業報告書ID ※定期点検のみ
public static final String TaskReportList = "taskReportList"; // 作業報告詳細リスト
public static final String TaskReportLevel = "taskReportLevel"; // 作業報告階層
public static final String EnableReport = "enableReport"; // 報告可能区分
public static final String TaskReportInfoId = "taskReportInfoId"; // 作業報告書情報ID ※定期点検のみ
public static final String ReportStartDate = "reportStartDate"; // 点検開始日時   ※定期点検のみ
public static final String ReportEndDate = "reportEndDate"; // 点検終了日時   ※定期点検のみ
public static final String TaskReportKey = "taskReportKey"; // 作業報告キー
public static final String TaskReportInfo = "taskReportInfo"; // 作業報告データ
public List<TaskDto> taskDtoList; public List<TaskDto> taskDtoList;
public Date lastEditDate; public Date lastEditDate;
...@@ -72,23 +81,51 @@ public class OperationDataJSON extends AcmsCommonJSON { ...@@ -72,23 +81,51 @@ public class OperationDataJSON extends AcmsCommonJSON {
dto.taskStatus = taskJson.getInt(TaskStatus); dto.taskStatus = taskJson.getInt(TaskStatus);
dto.taskHotSpotInfo = taskJson.getJSONObject(TaskHotspotInfo).toString(); dto.taskHotSpotInfo = taskJson.getJSONObject(TaskHotspotInfo).toString();
if(taskJson.has(TaskDirectionsInfo)) {
dto.taskDirectionsDto.jsonData = taskJson.getJSONObject(TaskDirectionsInfo).toString();
}
if(taskJson.has(TaskDirectionsKey)) {
dto.taskDirectionsDto.attachedFileName = taskJson.getString(TaskDirectionsKey);
}
if (taskJson.has(TaskReportInfo)) {
Object object = taskJson.get(TaskReportInfo); // if(taskJson.has(TaskDirectionsInfo)) {
if (object instanceof String) { // dto.taskDirectionsDto.jsonData = taskJson.getJSONObject(TaskDirectionsInfo).toString();
dto.taskReportDto.jsonData = null; // }
} else { // if(taskJson.has(TaskDirectionsKey)) {
dto.taskReportDto.jsonData = taskJson.getJSONObject(TaskReportInfo).toString(); // dto.taskDirectionsDto.attachedFileName = taskJson.getString(TaskDirectionsKey);
// }
//
// if (taskJson.has(TaskReportInfo)) {
// Object object = taskJson.get(TaskReportInfo);
// if (object instanceof String) {
// dto.taskReportDto.jsonData = null;
// } else {
// dto.taskReportDto.jsonData = taskJson.getJSONObject(TaskReportInfo).toString();
// }
// }
// if (taskJson.has(TaskReportKey)) {
// dto.taskReportDto.attachedFileName = taskJson.getString(TaskReportKey);
// }
// 作業報告詳細リスト
JSONArray taskReportList = taskJson.getJSONArray(TaskReportList);
for (int j = 0; j < taskReportList.length(); j++) {
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskReportJson = taskReportList.getJSONObject(j);
taskReportDto.taskReportLevel = taskReportJson.getInt(TaskReportLevel);
taskReportDto.enableReport = taskReportJson.getInt(EnableReport);
taskReportDto.taskReportInfoId = taskReportJson.getLong(TaskReportInfoId);
taskReportDto.reportStartDate = DateTimeUtil.toDate(taskReportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
taskReportDto.reportEndDate = DateTimeUtil.toDate(taskReportJson.getString(ReportEndDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
if (taskReportJson.has(TaskReportKey)) {
taskReportDto.attachedFileName = taskReportJson.getString(TaskReportKey);
} }
} if (taskReportJson.has(TaskReportInfo)) {
if (taskJson.has(TaskReportKey)) { Object object = taskJson.get(TaskReportInfo);
dto.taskReportDto.attachedFileName = taskJson.getString(TaskReportKey); if (object instanceof String) {
dto.taskReportDto.jsonData = null;
} else {
dto.taskReportDto.jsonData = taskJson.getJSONObject(TaskReportInfo).toString();
}
}
dto.taskReportDtoList.add(taskReportDto);
} }
taskDtoList.add(dto); taskDtoList.add(dto);
} }
......
...@@ -11,6 +11,7 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException; ...@@ -11,6 +11,7 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.OperationContentDto; import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto; import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.WorkingGroupDto;
import jp.agentec.adf.util.DateTimeFormat; import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
...@@ -24,30 +25,40 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -24,30 +25,40 @@ public class OperationListJSON extends AcmsCommonJSON {
// サーバ作業後、対応必要「project」→「operation」 // サーバ作業後、対応必要「project」→「operation」
public static final String OperationList = "projectList"; public static final String OperationList = "projectList";
public static final String OperationId = "projectId"; public static final String OperationId = "projectId";
public static final String OperationType = "projectType";
public static final String OperationName = "projectName"; public static final String OperationName = "projectName";
public static final String OperationDescriptions = "projectDescriptions"; public static final String OperationDescriptions = "projectDescriptions";
public static final String OperationStartDate = "projectStartDate"; public static final String OperationStartDate = "projectStartDate";
public static final String OperationEndDate = "projectEndDate"; public static final String OperationEndDate = "projectEndDate";
public static final String OperationType = "projectType";
public static final String ReportUpdateType = "reportUpdateType";
public static final String OperationLastEditDate = "projectLastEditDate";
public static final String OperationStatus = "projectStatus"; public static final String OperationStatus = "projectStatus";
public static final String DecisionStatus = "decisionStatus"; public static final String OperationLastEditDate = "projectLastEditDate";
public static final String DecisionType = "decisionType";
public static final String ContentId = "contentId"; public static final String ContentId = "contentId";
public static final String RelatedContentList = "relatedContentList"; public static final String RelatedContentList = "relatedContentList";
public static final String PushMessageList = "pushMessageList"; public static final String PushMessageList = "pushMessageList";
public static final String PushMessageId = "pushMessageId"; public static final String PushMessageId = "pushMessageId";
public static final String PushSendLoginId = "pushSendLoginId"; public static final String PushSendLoginId = "pushSendLoginId";
public static final String PushSendDate = "pushSendDate"; public static final String PushSendDate = "pushSendDate";
public static final String PushMessage = "pushMessage"; public static final String PushMessage = "pushMessage";
//定期点検用 // TODO 削除予定
public static final String OperationReportType = "projectReportType"; public static final String OperationReportType = "projectReportType";
public static final String ReportUpdateType = "reportUpdateType";
//定期点検用
public static final String ReportCycle = "reportCycle"; public static final String ReportCycle = "reportCycle";
public static final String EnableReportUpdate = "enableReportUpdate"; public static final String EnableReportUpdate = "enableReportUpdate";
public static final String EnableReportHistory = "enableReportHistory";
// 作業担当グループリスト
public static final String WorkingGroupList = "workingGroupList";
public static final String ReportLevel = "reportLevel"; // 報告階層
public static final String GroupList = "groupList"; // グループリスト
public static final String GroupId = "groupId"; // グループID
public static final String ReportType = "reportType";
public List<OperationDto> operationList; public List<OperationDto> operationList;
public OperationListJSON(String jsonString) throws AcmsException { public OperationListJSON(String jsonString) throws AcmsException {
...@@ -64,13 +75,19 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -64,13 +75,19 @@ public class OperationListJSON extends AcmsCommonJSON {
JSONObject operationJson = operations.getJSONObject(i); JSONObject operationJson = operations.getJSONObject(i);
OperationDto dto = new OperationDto(); OperationDto dto = new OperationDto();
dto.operationContentDtoList = new ArrayList<OperationContentDto>(); dto.operationContentDtoList = new ArrayList<OperationContentDto>();
dto.workingGroupDtoList = new ArrayList<WorkingGroupDto>();
dto.operationId = operationJson.getLong(OperationId); dto.operationId = operationJson.getLong(OperationId);
dto.operationType = operationJson.getInt(OperationType);
dto.operationName = operationJson.getString(OperationName); dto.operationName = operationJson.getString(OperationName);
dto.operationDescriptions = operationJson.getString(OperationDescriptions); dto.operationDescriptions = operationJson.getString(OperationDescriptions);
dto.operationStartDate = DateTimeUtil.toDate(operationJson.getString(OperationStartDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen); dto.operationStartDate = DateTimeUtil.toDate(operationJson.getString(OperationStartDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
dto.operationEndDate = DateTimeUtil.toDate(operationJson.getString(OperationEndDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen); dto.operationEndDate = DateTimeUtil.toDate(operationJson.getString(OperationEndDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
dto.operationType = operationJson.getInt(OperationType);
dto.reportUpdateType = operationJson.has(ReportUpdateType) ? operationJson.getInt(ReportUpdateType) : 0; dto.reportUpdateType = operationJson.has(ReportUpdateType) ? operationJson.getInt(ReportUpdateType) : 0;
// 1.0.1で追加
dto.operationStatus = operationJson.getInt(OperationStatus); // 作業状況
dto.reportType = operationJson.getInt(ReportType); // 作業報告タイプ
dto.enableReportHistory = operationJson.getInt(EnableReportHistory); // 報告履歴管理
if (operationJson.has(OperationLastEditDate)) { if (operationJson.has(OperationLastEditDate)) {
dto.lastEditDate = DateTimeUtil.toDate(operationJson.getString(OperationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen); dto.lastEditDate = DateTimeUtil.toDate(operationJson.getString(OperationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
} }
...@@ -124,6 +141,26 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -124,6 +141,26 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.pushMessageList.add(pushMessageDto); dto.pushMessageList.add(pushMessageDto);
} }
} }
JSONArray workingGroupJsonArray = operationJson.getJSONArray(WorkingGroupList);
if (operationJson.has(WorkingGroupList)) {
for (int k = 0; k < workingGroupJsonArray.length(); k++) {
if (workingGroupJsonArray.getJSONObject(k).length() == 0) {
// リストの情報が空の場合、以下の処理を行わないようにする
break;
}
// 作業担当グループリストセット
WorkingGroupDto workingGroupDto = new WorkingGroupDto();
workingGroupDto.reportLevel = workingGroupJsonArray.getJSONObject(k).getInt(ReportLevel);
workingGroupDto.groupList = new ArrayList<Integer>();
JSONArray workingGroupListArray = workingGroupJsonArray.getJSONObject(k).getJSONArray(GroupList);
for (int j = 0; j < workingGroupListArray.length(); j++) {
workingGroupDto.groupList.add(workingGroupListArray.getJSONObject(j).getInt(GroupId));
}
dto.workingGroupDtoList.add(workingGroupDto);
}
}
operationList.add(dto); operationList.add(dto);
} }
} }
......
...@@ -95,10 +95,9 @@ public class Constant { ...@@ -95,10 +95,9 @@ public class Constant {
} }
public interface OperationReportType { public interface OperationReportType {
// TODO 変数名は仮実装、変更必要 int REPORT_TYPE = 0;
int DEFAULT = 0;
int ROUTINE_TASK = 1; int ROUTINE_TASK = 1;
int REPORT_TYPE = 2; int REPORT_RESPONSE_TYPE = 2;
} }
public interface PushMessageSendType { public interface PushMessageSendType {
...@@ -140,4 +139,9 @@ public class Constant { ...@@ -140,4 +139,9 @@ public class Constant {
int Camera = 2; int Camera = 2;
int Audio =3; int Audio =3;
} }
public interface TaskReportLevel {
int ReportType = 0; // 報告タイプ
int ReportResponseType = 1; // 報告(回答)タイプ
}
} }
...@@ -19,6 +19,7 @@ import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup; ...@@ -19,6 +19,7 @@ import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.ROperationContent; import jp.agentec.abook.abv.bl.data.tables.ROperationContent;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory; import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup; import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.RTaskWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript; import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TContent; import jp.agentec.abook.abv.bl.data.tables.TContent;
import jp.agentec.abook.abv.bl.data.tables.TContentBookmark; import jp.agentec.abook.abv.bl.data.tables.TContentBookmark;
...@@ -89,6 +90,7 @@ public class ABVDataOpenHelper { ...@@ -89,6 +90,7 @@ public class ABVDataOpenHelper {
iTableScripts.add(new MWorkerGroup()); iTableScripts.add(new MWorkerGroup());
iTableScripts.add(new TOperation()); iTableScripts.add(new TOperation());
iTableScripts.add(new RTaskWorkerGroup());
iTableScripts.add(new ROperationContent()); iTableScripts.add(new ROperationContent());
iTableScripts.add(new TTask()); iTableScripts.add(new TTask());
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
......
...@@ -75,11 +75,6 @@ public class OperationDao extends AbstractDao { ...@@ -75,11 +75,6 @@ public class OperationDao extends AbstractDao {
dto.reportUpdateType = cursor.getInt(column); dto.reportUpdateType = cursor.getInt(column);
} }
column = cursor.getColumnIndex("operation_report_type");
if (column != -1) {
dto.operationReportType = cursor.getInt(column);
}
column = cursor.getColumnIndex("report_cycle"); column = cursor.getColumnIndex("report_cycle");
if (column != -1) { if (column != -1) {
dto.reportCycle = cursor.getInt(column); dto.reportCycle = cursor.getInt(column);
...@@ -104,18 +99,18 @@ public class OperationDao extends AbstractDao { ...@@ -104,18 +99,18 @@ 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_operation_content AS rpc on tp.operation_id = rpc.operation_id", null, OperationDto.class); return rawQueryGetDtoList("select tp.*, rpc.content_id from t_operation 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 operation_start_date <= ? order by operation_start_date DESC " , new String[]{DateTimeUtil.toStringInTimeZone(DateTimeUtil.getCurrentDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT")}, OperationDto.class); return rawQueryGetDtoList("select * from t_operation 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) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
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_operation ");
sql.append(" WHERE operation_id = ?"); sql.append(" WHERE operation_id = ?");
return rawQueryGetDto(sql.toString(), args, OperationDto.class); return rawQueryGetDto(sql.toString(), args, OperationDto.class);
} }
...@@ -124,7 +119,7 @@ public class OperationDao extends AbstractDao { ...@@ -124,7 +119,7 @@ public class OperationDao extends AbstractDao {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
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_operation AS tp ");
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.operation_id = rpc.operation_id "); sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 "); sql.append(" AND rpc.operation_content_flg = 1 ");
...@@ -136,7 +131,7 @@ public class OperationDao extends AbstractDao { ...@@ -136,7 +131,7 @@ public class OperationDao extends AbstractDao {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
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_operation AS tp ");
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.operation_id = rpc.operation_id "); sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 "); sql.append(" AND rpc.operation_content_flg = 1 ");
...@@ -154,7 +149,7 @@ public class OperationDao extends AbstractDao { ...@@ -154,7 +149,7 @@ public class OperationDao extends AbstractDao {
} }
public void insert(OperationDto dto) { public void insert(OperationDto dto) {
insert("insert into t_project " insert("insert into t_operation "
+ "(operation_id, " + "(operation_id, "
+ "operation_name, " + "operation_name, "
+ "operation_descriptions, " + "operation_descriptions, "
...@@ -166,7 +161,6 @@ public class OperationDao extends AbstractDao { ...@@ -166,7 +161,6 @@ public class OperationDao extends AbstractDao {
+ "edit_lock_flg, " + "edit_lock_flg, "
+ "need_sync_flg, " + "need_sync_flg, "
+ "report_update_type, " + "report_update_type, "
+ "operation_report_type, "
+ "report_cycle, " + "report_cycle, "
+ "enable_report_update) " + "enable_report_update) "
+ "values " + "values "
...@@ -175,7 +169,7 @@ public class OperationDao extends AbstractDao { ...@@ -175,7 +169,7 @@ 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_operation "
+ "set " + "set "
+ "operation_name=?, " + "operation_name=?, "
+ "operation_descriptions=?, " + "operation_descriptions=?, "
...@@ -187,7 +181,6 @@ public class OperationDao extends AbstractDao { ...@@ -187,7 +181,6 @@ public class OperationDao extends AbstractDao {
+ "edit_lock_flg=?, " + "edit_lock_flg=?, "
+ "need_sync_flg=?, " + "need_sync_flg=?, "
+ "report_update_type=?, " + "report_update_type=?, "
+ "operation_report_type=?, "
+ "report_cycle=?, " + "report_cycle=?, "
+ "enable_report_update=? " + "enable_report_update=? "
+ "where operation_id=?", + "where operation_id=?",
...@@ -197,13 +190,13 @@ public class OperationDao extends AbstractDao { ...@@ -197,13 +190,13 @@ public class OperationDao extends AbstractDao {
public void delete(OperationDto dto) { public void delete(OperationDto dto) {
delete("r_operation_content", "operation_id=?", dto.getKeyValues()); delete("r_operation_content", "operation_id=?", dto.getKeyValues());
delete("t_project", "operation_id=?", dto.getKeyValues()); delete("t_operation", "operation_id=?", dto.getKeyValues());
} }
public void deleteAll() { public void deleteAll() {
delete("t_push_message", null, null); delete("t_push_message", null, null);
delete("r_operation_content", null, null); delete("r_operation_content", null, null);
delete("t_project", null, null); delete("t_operation", null, null);
delete("t_task", null, null); delete("t_task", null, null);
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO delete // TODO delete
...@@ -227,22 +220,22 @@ public class OperationDao extends AbstractDao { ...@@ -227,22 +220,22 @@ public class OperationDao extends AbstractDao {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" SELECT tp.operation_id, "); sql.append(" SELECT top.operation_id, ");
sql.append(" tp.operation_name, "); sql.append(" top.operation_name, ");
sql.append(" tp.operation_type, "); sql.append(" top.operation_type, ");
sql.append(" tp.operation_descriptions, "); sql.append(" top.operation_descriptions, ");
sql.append(" tp.operation_start_date, "); sql.append(" top.operation_start_date, ");
sql.append(" tp.operation_end_date, "); sql.append(" top.operation_end_date, ");
sql.append(" tp.last_edit_date, "); sql.append(" top.last_edit_date, ");
sql.append(" tp.edit_lock_flg, "); sql.append(" top.edit_lock_flg, ");
sql.append(" tp.need_sync_flg, "); sql.append(" top.need_sync_flg, ");
sql.append(" tp.content_creating_flg, "); sql.append(" top.content_creating_flg, ");
sql.append(" tp.report_update_type, "); sql.append(" top.report_update_type, ");
sql.append(" tp.operation_report_type, "); sql.append(" top.report_type, ");
sql.append(" tp.report_cycle, "); sql.append(" top.report_cycle, ");
sql.append(" tp.enable_report_update, "); sql.append(" top.enable_report_update, ");
sql.append(" CASE "); sql.append(" CASE ");
sql.append(" WHEN operation_report_type = 1 THEN ( "); sql.append(" WHEN 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 ");
...@@ -250,42 +243,42 @@ public class OperationDao extends AbstractDao { ...@@ -250,42 +243,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.operation_id = tp.operation_id "); sql.append(" WHERE tt.operation_id = top.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 operation_report_type = 1 THEN ( "); sql.append(" WHEN 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 operation_id = tp.operation_id LIMIT 1) ) "); sql.append(" WHERE task_key = (SELECT task_key FROM t_task WHERE operation_id = top.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_operation AS top ");
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc "); sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.operation_id = rpc.operation_id "); sql.append(" ON top.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 "); sql.append(" AND rpc.operation_content_flg = 1 ");
sql.append(" WHERE tp.operation_id IS NOT NULL "); sql.append(" WHERE top.operation_id IS NOT NULL ");
if (!StringUtil.isNullOrEmpty(searchOperationName)) { if (!StringUtil.isNullOrEmpty(searchOperationName)) {
sql.append(" AND tp.operation_name GLOB " + "'*" + searchOperationName + "*'"); sql.append(" AND top.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.operation_end_date >= '" + DateTimeUtil.toString(startDate, DateTimeFormat.yyyyMMdd_hyphen) + "'"); sql.append(" AND top.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.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'"); sql.append(" AND top.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
} }
if (operationReportTypeStr != null) { if (operationReportTypeStr != null) {
sql.append(" AND tp.operation_report_type in ("+ operationReportTypeStr +")"); sql.append(" AND top.operation_report_type in ("+ operationReportTypeStr +")");
} }
sql.append(" ORDER BY tp.operation_report_type DESC, tp.operation_start_date DESC, tp.operation_id DESC"); sql.append(" ORDER BY top.operation_report_type DESC, top.operation_start_date DESC, top.operation_id DESC");
Logger.v(TAG, "sql=%s", sql); Logger.v(TAG, "sql=%s", sql);
......
...@@ -94,10 +94,10 @@ public class PushMessageDao extends AbstractDao { ...@@ -94,10 +94,10 @@ public class PushMessageDao extends AbstractDao {
public List<PushMessageDto> selectAll() { public List<PushMessageDto> selectAll() {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
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(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.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_operation AS top ");
sql.append(" ON tpm.operation_id = tp.operation_id "); sql.append(" ON tpm.operation_id = top.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.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.operation_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, top.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_operation AS top ");
sql.append(" ON tpm.operation_id = tp.operation_id "); sql.append(" ON tpm.operation_id = top.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);
......
package jp.agentec.abook.abv.bl.data.dao; package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
import java.util.List; import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor; import jp.agentec.abook.abv.bl.common.db.Cursor;
...@@ -174,4 +175,16 @@ public class TaskReportDao extends AbstractDao { ...@@ -174,4 +175,16 @@ public class TaskReportDao extends AbstractDao {
public void deleteAll() { public void deleteAll() {
delete("t_task_report", null, null); delete("t_task_report", null, null);
} }
/**
*
* @param taskKey
* @param taskReportLevel
* @param taskReportId
* @param reportStartDate
* @return
*/
public boolean isExistTaskReport(String taskKey, Integer taskReportLevel, String taskReportId, String reportStartDate) {
return rawQueryGetInt("select COUNT(*) from t_task_report where task_key=? AND task_report_level=? AND task_report_id=? AND report_start_date=?", new String[]{"" + taskKey, "" + taskReportLevel, "" + taskReportId, "" + reportStartDate }) > 0;
}
} }
...@@ -23,7 +23,7 @@ public class LContentPageReadingLog extends SQLiteTableScript { ...@@ -23,7 +23,7 @@ public class LContentPageReadingLog extends SQLiteTableScript {
sql.append(" , reading_log_id INTEGER NOT NULL "); sql.append(" , reading_log_id INTEGER NOT NULL ");
sql.append(" , content_id BIGINT NOT NULL "); sql.append(" , content_id BIGINT NOT NULL ");
sql.append(" , page_num INTEGER NOT NULL "); sql.append(" , page_num INTEGER NOT NULL ");
sql.append(" , status CHAR(1) NOT NULL DEFAULT '1' "); sql.append(" , status CHAR(1) NOT NULL REPORT_TYPE '1' ");
sql.append(" , start_date DATETIME NOT NULL "); sql.append(" , start_date DATETIME NOT NULL ");
sql.append(" , resume_date DATETIME "); sql.append(" , resume_date DATETIME ");
sql.append(" , end_date DATETIME "); sql.append(" , end_date DATETIME ");
......
...@@ -21,7 +21,7 @@ public class LContentReadingLog extends SQLiteTableScript { ...@@ -21,7 +21,7 @@ public class LContentReadingLog extends SQLiteTableScript {
sql.append(" CREATE TABLE l_content_reading_log ( "); sql.append(" CREATE TABLE l_content_reading_log ( ");
sql.append(" reading_log_id INTEGER NOT NULL "); sql.append(" reading_log_id INTEGER NOT NULL ");
sql.append(" , content_id BIGINT NOT NULL "); sql.append(" , content_id BIGINT NOT NULL ");
sql.append(" , status CHAR(1) NOT NULL DEFAULT '1' "); sql.append(" , status CHAR(1) NOT NULL REPORT_TYPE '1' ");
sql.append(" , start_date DATETIME NOT NULL "); sql.append(" , start_date DATETIME NOT NULL ");
sql.append(" , resume_date DATETIME "); sql.append(" , resume_date DATETIME ");
sql.append(" , end_date DATETIME "); sql.append(" , end_date DATETIME ");
......
...@@ -33,7 +33,7 @@ public class MGroup extends SQLiteTableScript { ...@@ -33,7 +33,7 @@ public class MGroup extends SQLiteTableScript {
sql.append(" , group_level INTEGER NOT NULL "); sql.append(" , group_level INTEGER NOT NULL ");
sql.append(" , group_name VARCHAR(64) NOT NULL "); sql.append(" , group_name VARCHAR(64) NOT NULL ");
sql.append(" , group_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0 sql.append(" , group_path TEXT NOT NULL "); // path enumaerationパターンを適用する。since DatabaseVersions.Ver1_5_0
sql.append(" , user_group_flg BOOLEAN NOT NULL DEFAULT 0 "); // since DatabaseVersions.Plus_1_1_0 sql.append(" , user_group_flg BOOLEAN NOT NULL REPORT_TYPE 0 "); // since DatabaseVersions.Plus_1_1_0
sql.append(" , PRIMARY KEY (group_relation_id) "); sql.append(" , PRIMARY KEY (group_relation_id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -25,7 +25,7 @@ public class MMemberInfo extends SQLiteTableScript { ...@@ -25,7 +25,7 @@ public class MMemberInfo extends SQLiteTableScript {
sql.append(" , sid VARCHAR(64) "); sql.append(" , sid VARCHAR(64) ");
//sql.append(" , contract_id INTEGER "); // 1.5.0から削除 //sql.append(" , contract_id INTEGER "); // 1.5.0から削除
sql.append(" , login_status INTEGER "); sql.append(" , login_status INTEGER ");
sql.append(" , invalid_password_count SMALLINT DEFAULT 0 "); sql.append(" , invalid_password_count SMALLINT REPORT_TYPE 0 ");
sql.append(" , last_login_date DATETIME "); sql.append(" , last_login_date DATETIME ");
sql.append(" , last_change_password_date DATETIME "); sql.append(" , last_change_password_date DATETIME ");
sql.append(" , last_cms_access_date DATETIME "); sql.append(" , last_cms_access_date DATETIME ");
......
...@@ -20,7 +20,7 @@ public class MPasswordLockInfo extends SQLiteTableScript { ...@@ -20,7 +20,7 @@ public class MPasswordLockInfo extends SQLiteTableScript {
// since 1.5.0 // since 1.5.0
sql.append(" CREATE TABLE m_password_lock_info ( "); sql.append(" CREATE TABLE m_password_lock_info ( ");
sql.append(" id INTEGER NOT NULL "); sql.append(" id INTEGER NOT NULL ");
sql.append(" , invalid_password_count SMALLINT DEFAULT 0 "); sql.append(" , invalid_password_count SMALLINT REPORT_TYPE 0 ");
sql.append(" , password_lock_date DATETIME "); sql.append(" , password_lock_date DATETIME ");
sql.append(" , PRIMARY KEY (id) "); sql.append(" , PRIMARY KEY (id) ");
sql.append(" ) "); sql.append(" ) ");
......
...@@ -23,9 +23,9 @@ public class ROperationContent extends SQLiteTableScript { ...@@ -23,9 +23,9 @@ public class ROperationContent extends SQLiteTableScript {
sql.append(" CREATE TABLE r_operation_content ( "); sql.append(" CREATE TABLE r_operation_content ( ");
sql.append(" operation_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(" , operation_content_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , operation_content_flg BOOLEAN NOT NULL REPORT_TYPE 0 ");
sql.append(" , PRIMARY KEY (operation_id, content_id) "); sql.append(" , PRIMARY KEY (operation_id, content_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_project (operation_id) "); sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (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(" ) ");
......
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
/**
* Created by leej on 2019/03/18.
*/
public class RTaskWorkerGroup extends SQLiteTableScript {
public RTaskWorkerGroup() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_task_worker_group ( ");
sql.append(" task_report_level INTEGER default 0 ");
sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , group_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (task_report_level, operation_id, group_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
sql.append(" , FOREIGN KEY (group_id) REFERENCES m_worker_group (group_id)");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
\ No newline at end of file
...@@ -24,8 +24,8 @@ public class TContentMemo extends SQLiteTableScript { ...@@ -24,8 +24,8 @@ public class TContentMemo extends SQLiteTableScript {
sql.append(" , axis_x SMALLINT NOT NULL "); sql.append(" , axis_x SMALLINT NOT NULL ");
sql.append(" , axis_y SMALLINT NOT NULL "); sql.append(" , axis_y SMALLINT NOT NULL ");
sql.append(" , memo TEXT NOT NULL "); sql.append(" , memo TEXT NOT NULL ");
sql.append(" , copy_flg BOOLEAN DEFAULT false "); // since 1.5.2.01 sql.append(" , copy_flg BOOLEAN REPORT_TYPE false "); // since 1.5.2.01
sql.append(" , del_flg BOOLEAN DEFAULT false "); // since 1.5.2.01 sql.append(" , del_flg BOOLEAN REPORT_TYPE false "); // since 1.5.2.01
sql.append(" , insert_date DATETIME NOT NULL "); sql.append(" , insert_date DATETIME NOT NULL ");
sql.append(" , update_date DATETIME NOT NULL "); // since ABook Plus 1.2(1.2以前のアプリはUNIQUE INDEXのみ作成) sql.append(" , update_date DATETIME NOT NULL "); // since ABook Plus 1.2(1.2以前のアプリはUNIQUE INDEXのみ作成)
sql.append(" , PRIMARY KEY (memo_id) "); sql.append(" , PRIMARY KEY (memo_id) ");
......
...@@ -21,7 +21,7 @@ public class TOperation extends SQLiteTableScript { ...@@ -21,7 +21,7 @@ public class TOperation 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 t_project ( "); sql.append(" CREATE TABLE t_operation ( ");
sql.append(" operation_id BIGINT NOT NULL "); sql.append(" operation_id BIGINT NOT NULL ");
sql.append(" , operation_name VARCHAR(128) "); sql.append(" , operation_name VARCHAR(128) ");
sql.append(" , operation_type INTEGER NOT NULL "); sql.append(" , operation_type INTEGER NOT NULL ");
...@@ -30,12 +30,14 @@ public class TOperation extends SQLiteTableScript { ...@@ -30,12 +30,14 @@ public class TOperation extends SQLiteTableScript {
sql.append(" , operation_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 REPORT_TYPE 0 ");
sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , need_sync_flg BOOLEAN NOT NULL REPORT_TYPE 0 ");
sql.append(" , report_update_type INTEGER NOT NULL DEFAULT 0 "); sql.append(" , report_update_type INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , operation_report_type INTEGER NOT NULL DEFAULT 0 "); sql.append(" , report_type INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , report_cycle INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_update INTEGER NOT NULL DEFAULT 0 "); sql.append(" , report_cycle INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , enable_report_update INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , enable_report_history SMALLINT NOT NULL REPORT_TYPE 0 ");
sql.append(" , PRIMARY KEY (operation_id) "); sql.append(" , PRIMARY KEY (operation_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
...@@ -52,13 +54,13 @@ public class TOperation extends SQLiteTableScript { ...@@ -52,13 +54,13 @@ public class TOperation extends SQLiteTableScript {
// } // }
// //
// if (oldVersion < DatabaseVersions.Plus_1_9_3_5) { // カラムの追加 // if (oldVersion < DatabaseVersions.Plus_1_9_3_5) { // カラムの追加
// ddl.add(" ALTER TABLE t_project ADD COLUMN report_update_type INTEGER NOT NULL DEFAULT 0 "); // ddl.add(" ALTER TABLE t_operation ADD COLUMN report_update_type INTEGER NOT NULL REPORT_TYPE 0 ");
// } // }
// //
// if (oldVersion < DatabaseVersions.Plus_1_9_4) { // カラムの追加 // if (oldVersion < DatabaseVersions.Plus_1_9_4) { // カラムの追加
// ddl.add(" ALTER TABLE t_project ADD COLUMN project_report_type INTEGER NOT NULL DEFAULT 0 "); // ddl.add(" ALTER TABLE t_operation ADD COLUMN project_report_type INTEGER NOT NULL REPORT_TYPE 0 ");
// ddl.add(" ALTER TABLE t_project ADD COLUMN report_cycle INTEGER NOT NULL DEFAULT 0 "); // ddl.add(" ALTER TABLE t_operation ADD COLUMN report_cycle INTEGER NOT NULL REPORT_TYPE 0 ");
// ddl.add(" ALTER TABLE t_project ADD COLUMN enable_report_update INTEGER NOT NULL DEFAULT 0 "); // ddl.add(" ALTER TABLE t_operation ADD COLUMN enable_report_update INTEGER NOT NULL REPORT_TYPE 0 ");
// } // }
// return ddl; // return ddl;
return null; return null;
......
...@@ -25,9 +25,9 @@ public class TPushMessage extends SQLiteTableScript { ...@@ -25,9 +25,9 @@ public class TPushMessage extends SQLiteTableScript {
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 REPORT_TYPE 0 ");
sql.append(" , PRIMARY KEY (push_message_id) "); sql.append(" , PRIMARY KEY (push_message_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_project (operation_id) "); sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -23,16 +23,16 @@ public class TRoutineTaskReport extends SQLiteTableScript { ...@@ -23,16 +23,16 @@ public class TRoutineTaskReport extends SQLiteTableScript {
sql.append(" CREATE TABLE IF NOT EXISTS t_inspect_task_report ( "); sql.append(" CREATE TABLE IF NOT EXISTS t_inspect_task_report ( ");
sql.append(" task_key TEXT NOT NULL "); sql.append(" task_key TEXT NOT NULL ");
sql.append(" , task_report_id INTEGER NOT NULL DEFAULT 0 "); sql.append(" , task_report_id INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , task_report_info_id INTEGER NOT NULL DEFAULT 0 "); sql.append(" , task_report_info_id INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , report_start_date DATETIME NOT NULL "); sql.append(" , report_start_date DATETIME NOT NULL ");
sql.append(" , report_end_date DATETIME "); sql.append(" , report_end_date DATETIME ");
sql.append(" , attached_file_name TEXT "); sql.append(" , attached_file_name TEXT ");
sql.append(" , local_attached_file_name TEXT "); sql.append(" , local_attached_file_name TEXT ");
sql.append(" , json_data TEXT "); sql.append(" , json_data TEXT ");
sql.append(" , data_send_flag BOOLEAN DEFAULT 0 "); sql.append(" , data_send_flag BOOLEAN REPORT_TYPE 0 ");
sql.append(" , attached_file_send_flag BOOLEAN DEFAULT 0 "); sql.append(" , attached_file_send_flag BOOLEAN REPORT_TYPE 0 ");
sql.append(" , reported_flag BOOLEAN DEFAULT 0 "); sql.append(" , reported_flag BOOLEAN REPORT_TYPE 0 ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -28,7 +28,7 @@ public class TTask extends SQLiteTableScript { ...@@ -28,7 +28,7 @@ public class TTask extends SQLiteTableScript {
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 ");
sql.append(" , del_flg BOOLEAN DEFAULT 0 "); sql.append(" , del_flg BOOLEAN REPORT_TYPE 0 ");
sql.append(" , PRIMARY KEY (task_key) "); sql.append(" , PRIMARY KEY (task_key) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -26,8 +26,8 @@ public class TTaskDirections extends SQLiteTableScript { ...@@ -26,8 +26,8 @@ public class TTaskDirections extends SQLiteTableScript {
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 ");
sql.append(" , local_attached_file_name TEXT "); sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 "); sql.append(" , attached_file_send_flg BOOLEAN REPORT_TYPE 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 "); sql.append(" , data_send_flg BOOLEAN REPORT_TYPE 0 ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -26,12 +26,19 @@ public class TTaskReport extends SQLiteTableScript { ...@@ -26,12 +26,19 @@ public class TTaskReport extends SQLiteTableScript {
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 ");
sql.append(" , local_attached_file_name TEXT "); sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 "); sql.append(" , attached_file_send_flg BOOLEAN REPORT_TYPE 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 "); sql.append(" , data_send_flg BOOLEAN REPORT_TYPE 0 ");
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO append // TODO append
// sql.append(" , reporter_flag BOOLEAN DEFAULT 0 "); // sql.append(" , reporter_flag BOOLEAN REPORT_TYPE 0 ");
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
sql.append(" , report_start_date DATETIME ");
sql.append(" , report_end_date DATETIME ");
sql.append(" , task_report_id INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , task_report_info_id INTEGER NOT NULL REPORT_TYPE 0 ");
sql.append(" , enable_report SMALLINT NOT NULL REPORT_TYPE 0 ");
sql.append(" , task_report_level SMALLINT NOT NULL REPORT_TYPE 0 ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -31,11 +31,11 @@ public class TTaskReportSend extends SQLiteTableScript { ...@@ -31,11 +31,11 @@ public class TTaskReportSend extends SQLiteTableScript {
sql.append(" CREATE TABLE t_task_report_send ( "); sql.append(" CREATE TABLE t_task_report_send ( ");
sql.append(" task_report_send_id INTEGER NOT NULL "); sql.append(" task_report_send_id INTEGER NOT NULL ");
sql.append(" , task_key TEXT NOT NULL "); sql.append(" , task_key TEXT NOT NULL ");
sql.append(" , task_report_id INTEGER DEFAULT 0 "); sql.append(" , task_report_id INTEGER REPORT_TYPE 0 ");
sql.append(" , report_start_date DATETIME "); sql.append(" , report_start_date DATETIME ");
sql.append(" , json_data TEXT NOT NULL "); sql.append(" , json_data TEXT NOT NULL ");
sql.append(" , save_date DATE NOT NULL "); sql.append(" , save_date DATE NOT NULL ");
sql.append(" , delete_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , delete_flg BOOLEAN NOT NULL REPORT_TYPE 0 ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -29,6 +29,13 @@ public class OperationDto extends AbstractDto { ...@@ -29,6 +29,13 @@ public class OperationDto extends AbstractDto {
public int enableReportUpdate; //0:不可 1:可 public int enableReportUpdate; //0:不可 1:可
public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00 public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00
public int reportCount; //定期点検、作業数 public int reportCount; //定期点検、作業数
public int operationStatus; // 作業状況 0: 準備中, 1: 作業中, 2: 完了
public int reportType; // 0:報告 1:定期点検 2:報告(回答)
public int enableReportHistory; // 0: 不可, 1: 可
// 作業担当グループリスト
public List<WorkingGroupDto> workingGroupDtoList;
public boolean equalsLastEdit(OperationDto dto) { public boolean equalsLastEdit(OperationDto dto) {
if (dto != null) { if (dto != null) {
......
...@@ -14,6 +14,7 @@ public class TaskDto extends AbstractDto { ...@@ -14,6 +14,7 @@ public class TaskDto extends AbstractDto {
public String taskCode; public String taskCode;
public Integer taskStatus; public Integer taskStatus;
public String taskHotSpotInfo; public String taskHotSpotInfo;
public List<TaskReportDto> taskReportDtoList;
public boolean delFlg; public boolean delFlg;
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
......
package jp.agentec.abook.abv.bl.dto; package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
/** /**
* Created by leej on 2018/09/10. * Created by leej on 2018/09/10.
*/ */
...@@ -8,13 +10,21 @@ public class TaskReportDto extends AbstractDto { ...@@ -8,13 +10,21 @@ public class TaskReportDto extends AbstractDto {
public String taskKey; public String taskKey;
public String jsonData; public String jsonData;
public String attachedFileName;
public String localAttachedFileName; public String localAttachedFileName;
public boolean attachedFileSendFlg; public boolean attachedFileSendFlg;
public boolean dataSendFlg; public boolean dataSendFlg;
public String taskHotSpotInfo; public String taskHotSpotInfo;
public boolean delFlg; public boolean delFlg;
//  作業報告詳細リスト
public int taskReportLevel;
public int enableReport;
public long taskReportInfoId;
public String attachedFileName;
public Date reportStartDate;
public Date reportEndDate;
public String taskReportInfo;
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
public boolean reporterFlag; public boolean reporterFlag;
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
......
package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/**
* Created by leej on 2019/03/18.
*/
public class WorkingGroupDto {
public int reportLevel;
public List<Integer> groupList;
}
...@@ -419,100 +419,212 @@ public class OperationLogic extends AbstractLogic { ...@@ -419,100 +419,212 @@ public class OperationLogic extends AbstractLogic {
*/ */
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
// TODO change // TODO change
/* public void insertTaskReport(String taskKey, int taskReportLevel, 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 { if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = new TaskDto();
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel; TaskReportDto taskReportDto = new TaskReportDto();
if (taskDto == null) { JSONObject taskJson = taskReportJson.getJSONObject("task");
taskDto = new TaskDto(); taskDto.taskKey = taskKey;
// 指示者と報告者判断する taskDto.operationId = operationId;
String taskHotSpotInfo = null; taskDto.taskHotSpotInfo = hotSpotInfo;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskDto.taskKey = taskKey;
taskDto.operationId = operationId;
taskDto.taskHotSpotInfo = hotSpotInfo;
} else {
//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();
// 指示者の場合 Iterator taskKeys = taskJson.keys();
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_1_")) { if (itemKey.startsWith("q_1_")) {
taskDto.taskStatus = taskJson.getInt(itemKey); taskDto.taskCode = taskJson.getString(itemKey);
} }
} else { taskReportItemsDto.taskKey = taskKey;
if (itemKey.startsWith("q_2_")) { taskReportItemsDto.itemKey = itemKey;
taskDto.taskStatus = taskJson.getInt(itemKey); try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
} }
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
} }
taskReportItemsDto.taskKey = taskKey; taskReportDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey; taskReportDto.jsonData = taskReportJson.toString();
try { taskReportDto.dataSendFlg = dataSendFlg;
taskReportItemsDto.inputValue = taskJson.getString(itemKey); taskReportDto.attachedFileSendFlg = attachedChangeFlag;
} catch (JSONException e) { if (localAttachedFileName != null) {
// 値がStringではない場合、無視する taskReportDto.localAttachedFileName = localAttachedFileName;
continue;
} }
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskReportJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// #32782 指示者テーブル関連削除 start if (taskReportJson.has(ABookKeys.TASK_STATUS)) {
// 報告者の場合 taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
taskReportDto.reporterFlag = true; }
// #32782 指示者テーブル関連削除 end
if (localAttachedFileName != null) { mTaskReportDao.insert(taskReportDto);
taskReportDto.localAttachedFileName = localAttachedFileName; mTaskDao.insert(taskDto);
}
if (taskReportJson.has(ABookKeys.TASK_STATUS)) { String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
}
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey);
if (taskReport.size() > 0) {
mTaskReportDao.update(taskReportDto);
} else {
mTaskReportDao.insert(taskReportDto);
}
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { // 添付ディレクトリの移動
mTaskDao.insert(taskDto); boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
} else { } else {
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); mTaskDao.update(taskDto);
}
//添付ファイル変更の場合、以下の処理を行う //添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey); String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false); String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false);
JSONObject attachedListJson = taskReportJson.getJSONObject("attached"); JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson); List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除 // コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames); deleteDifferentialFile(tempDirPath, attachedFileNames);
// 添付ディレクトリの移動 // 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true); boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if(result) { if(result) {
FileUtil.delete(tempDirPath); FileUtil.delete(tempDirPath);
}
} }
// TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
// if (taskDto == null) {
// taskDto = new TaskDto();
// // 指示者と報告者判断する
// String taskHotSpotInfo = null;
// if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// taskDto.taskKey = taskKey;
// taskDto.operationId = operationId;
// taskDto.taskHotSpotInfo = hotSpotInfo;
// } else {
// //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 (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// if (itemKey.startsWith("q_1_")) {
// taskDto.taskStatus = taskJson.getInt(itemKey);
// }
// } else {
// 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;
//
// // #32782 指示者テーブル関連削除 start
// // 報告者の場合
// taskReportDto.reporterFlag = true;
// // #32782 指示者テーブル関連削除 end
//
// if (localAttachedFileName != null) {
// taskReportDto.localAttachedFileName = localAttachedFileName;
// }
//
// if (taskReportJson.has(ABookKeys.TASK_STATUS)) {
// taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
// }
//
//
// // 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
// List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey);
// if (taskReport.size() > 0) {
// mTaskReportDao.update(taskReportDto);
// } else {
// mTaskReportDao.insert(taskReportDto);
// }
//
// if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// mTaskDao.insert(taskDto);
// } else {
// 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);
// }
} }
*/
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) { if (taskDto == null) {
...@@ -1507,29 +1619,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -1507,29 +1619,9 @@ public class OperationLogic extends AbstractLogic {
List<OperationDto> operationDtoList; List<OperationDto> operationDtoList;
operationDtoList = mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, operationReportTypeStr); operationDtoList = mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, operationReportTypeStr);
for (OperationDto operationDto : operationDtoList) { for (OperationDto operationDto : operationDtoList) {
if(ABVDataCache.getInstance().getMemberInfo() != null) { // 作業送信フラグが存在する場合、needSyncFlgをtrueにセット
// プロジェクト毎に作業の送信フラグがあるかチェックし、存在する場合プロジェクトのデータ同期必要区分をtrueにセット if (mTaskReportDao.isExistSendTaskData(operationDto.operationId)) {
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { mOperationDao.updateNeedSyncFlg(operationDto.operationId, true);
// 作業指示者
// #32782 指示者テーブル関連削除 start
// TODO change
// if (mTaskReportDao.isExistSendTaskData(operationDto.operationId)) {
if (mTaskDirectionsDao.isExistSendTaskData(operationDto.operationId)) {
// #32782 指示者テーブル関連削除 end
mOperationDao.updateNeedSyncFlg(operationDto.operationId, true);
}
} else {
boolean needSyncFlg = false;
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
needSyncFlg = mRoutineTaskReportDao.isExistSendRoutineTaskData(operationDto.operationId);
} else {
needSyncFlg = mTaskReportDao.isExistSendTaskData(operationDto.operationId);
}
// 作業者
if (needSyncFlg) {
mOperationDao.updateNeedSyncFlg(operationDto.operationId, true);
}
}
} }
} }
return operationDtoList; return operationDtoList;
...@@ -1538,16 +1630,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -1538,16 +1630,12 @@ public class OperationLogic extends AbstractLogic {
/** /**
* プロジェクト関連資料または共通資料一覧取得 * プロジェクト関連資料または共通資料一覧取得
* *
* @param operationId
* @return * @return
*/ */
public List<CategoryContentDto> getOperationRelatedContent(Long operationId) { public List<CategoryContentDto> getOperationRelatedContent() {
List<ContentDto> contentDtoList; List<ContentDto> contentDtoList;
if (operationId == null || operationId == 0) { contentDtoList = mContentDao.getCommonContent();
contentDtoList = mContentDao.getCommonContent();
} else {
contentDtoList = mContentDao.getOperationRelatedContent(operationId);
}
List<CategoryContentDto> categoryContentDtoArray = new ArrayList<CategoryContentDto>(); List<CategoryContentDto> categoryContentDtoArray = new ArrayList<CategoryContentDto>();
List<ContentDto> saveContentDtoArray = new ArrayList<ContentDto>(); List<ContentDto> saveContentDtoArray = new ArrayList<ContentDto>();
...@@ -1634,24 +1722,21 @@ public class OperationLogic extends AbstractLogic { ...@@ -1634,24 +1722,21 @@ 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 List<TaskDirectionsDto> taskDirectionsDtoList = null;
// TODO change
/*
List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0; int maxProgress = 0;
if (taskKey == null) { if (taskKey == null) {
taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId); taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId);
maxProgress = 40; maxProgress = 40;
} else { } else {
taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId, taskKey, false); taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId, taskKey);
maxProgress = 100; maxProgress = 100;
} }
if (taskReportDtoList != null && taskReportDtoList.size() > 0) { if (taskDirectionsDtoList != null && taskDirectionsDtoList.size() > 0) {
//プログレスを40%進行させるための計算 //プログレスを40%進行させるための計算
int progress = maxProgress / taskReportDtoList.size(); int progress = maxProgress / taskDirectionsDtoList.size();
for (TaskReportDto dto : taskReportDtoList) { for (TaskDirectionsDto dto : taskDirectionsDtoList) {
File zipFile = null; File zipFile = null;
if (dto.attachedFileSendFlg) { if (dto.attachedFileSendFlg) {
String fileName = null; String fileName = null;
...@@ -1674,25 +1759,32 @@ public class OperationLogic extends AbstractLogic { ...@@ -1674,25 +1759,32 @@ public class OperationLogic extends AbstractLogic {
} else { } else {
dto.dataSendFlg = false; dto.dataSendFlg = false;
dto.attachedFileSendFlg = false; dto.attachedFileSendFlg = false;
// #32782 指示者テーブル関連削除 start mTaskDirectionsDao.update(dto);
dto.reporterFlag = false;
// #32782 指示者テーブル関連削除 end
mTaskReportDao.update(dto);
} }
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
} }
} }
*/ // #32782 指示者テーブル関連削除 end
List<TaskDirectionsDto> taskDirectionsDtoList = null; }
/**
* 作業報告履歴データ送信
* @param operationId
* @param taskKey
* @throws Exception
*/
public void sendTaskReportSendData(long operationId, String taskKey, Callback progressCallback) throws Exception {
List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0; int maxProgress = 0;
if (taskKey == null) { if (taskKey == null) {
taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId); taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId);
maxProgress = 40; maxProgress = 40;
} else { } else {
taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId, taskKey); taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId, taskKey);
maxProgress = 100; maxProgress = 100;
} }
if (taskDirectionsDtoList != null && taskDirectionsDtoList.size() > 0) { if (taskDirectionsDtoList != null && taskDirectionsDtoList.size() > 0) {
//プログレスを40%進行させるための計算 //プログレスを40%進行させるための計算
int progress = maxProgress / taskDirectionsDtoList.size(); int progress = maxProgress / taskDirectionsDtoList.size();
...@@ -1725,144 +1817,11 @@ public class OperationLogic extends AbstractLogic { ...@@ -1725,144 +1817,11 @@ public class OperationLogic extends AbstractLogic {
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
} }
} }
// #32782 指示者テーブル関連削除 end
}
/**
* 作業報告履歴データ送信
* @param operationId
* @param taskKey
* @throws Exception
*/
public void sendTaskReportSendData(long operationId, String taskKey, Callback progressCallback) throws Exception {
// #32782 指示者テーブル関連削除 start
// TODO change
/*
List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0;
if (taskKey == null) {
taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId);
maxProgress = 40;
} else {
taskReportDtoList = mTaskReportDao.getSendableTaskData(operationId, taskKey, true);
maxProgress = 100;
}
if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
// #32782 指示者テーブル関連削除 start
// 指示者の場合
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
//プログレスを40%進行させるための計算
int progress = maxProgress / taskReportDtoList.size();
for (TaskReportDto dto : taskReportDtoList) {
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;
mTaskReportDao.update(dto);
}
progressCallback.callback(new Integer(progress));
}
} else {
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;
// #32782 指示者テーブル関連削除 start
taskReportDto.reporterFlag = true;
// #32782 指示者テーブル関連削除 end
mTaskReportDao.update(taskReportDto);
}
}
}
// #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) { if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
OperationDto operationDto = mOperationDao.getOperation(operationId); OperationDto operationDto = mOperationDao.getOperation(operationId);
...@@ -1930,7 +1889,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -1930,7 +1889,6 @@ public class OperationLogic extends AbstractLogic {
} }
} }
} }
// #32782 指示者テーブル関連削除 end
} }
/** /**
......
package jp.agentec.abook.abv.launcher.android; package jp.agentec.abook.abv.launcher.android;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Stack;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.OperationReportType; import jp.agentec.abook.abv.bl.common.Constant.OperationReportType;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
...@@ -141,9 +139,9 @@ public class ABVUIDataCache { ...@@ -141,9 +139,9 @@ public class ABVUIDataCache {
mOperationReportTypes = operationReportTypes; mOperationReportTypes = operationReportTypes;
} else { } else {
mOperationReportTypes = new ArrayList<Integer>(); mOperationReportTypes = new ArrayList<Integer>();
mOperationReportTypes.add(OperationReportType.DEFAULT);
mOperationReportTypes.add(OperationReportType.ROUTINE_TASK);
mOperationReportTypes.add(OperationReportType.REPORT_TYPE); mOperationReportTypes.add(OperationReportType.REPORT_TYPE);
mOperationReportTypes.add(OperationReportType.ROUTINE_TASK);
mOperationReportTypes.add(OperationReportType.REPORT_RESPONSE_TYPE);
} }
return mOperationReportTypes; return mOperationReportTypes;
......
...@@ -728,6 +728,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -728,6 +728,8 @@ public class OperationListActivity extends ABVUIActivity {
mOperationLogic.sendTaskReportSendData(operationId, null, progressCallback); mOperationLogic.sendTaskReportSendData(operationId, null, progressCallback);
} }
} }
mOperationLogic.
progressDialogHorizontal.setProgress(60); progressDialogHorizontal.setProgress(60);
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, buttonEventFlag); mOperationLastEditDate = receptionTaskData(operationId, progressCallback, buttonEventFlag);
...@@ -1032,6 +1034,33 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1032,6 +1034,33 @@ public class OperationListActivity extends ABVUIActivity {
lastEditDate = json.lastEditDate; lastEditDate = json.lastEditDate;
} }
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
// プログレスを40%進行させるための計算
int progress = 0;
if (json.taskDtoList.size() != 0) {
progress = 40 / json.taskDtoList.size();
}
for (TaskDto serverTaskDto : json.taskDtoList) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
mTaskDao.update(serverTaskDto);
localTaskList.remove(serverTaskDto);
} else {
mTaskDao.insert(serverTaskDto);
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey);
mTaskDao.delete(taskDto);
}
String reportAttachedFileName = serverTaskDto.taskReportDto.attachedFileName;
}
progressCallback.callback(new Integer(40)); progressCallback.callback(new Integer(40));
return lastEditDate; return lastEditDate;
...@@ -1688,6 +1717,12 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1688,6 +1717,12 @@ public class OperationListActivity extends ABVUIActivity {
return false; return false;
} }
/**
* 定期点検の報告存在チェック
* @param listDto
* @param rDto
* @return
*/
private boolean isExistsRoutineTaskReportInList(List<RoutineTaskReportDto> listDto, RoutineTaskReportDto rDto) { private boolean isExistsRoutineTaskReportInList(List<RoutineTaskReportDto> listDto, RoutineTaskReportDto rDto) {
for(RoutineTaskReportDto lDto:listDto) { for(RoutineTaskReportDto lDto:listDto) {
if (lDto.taskKey.equals(rDto.taskKey) && if (lDto.taskKey.equals(rDto.taskKey) &&
...@@ -1897,9 +1932,9 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1897,9 +1932,9 @@ public class OperationListActivity extends ABVUIActivity {
private ArrayList<Integer> getOperationReportTypeList(boolean isAll) { private ArrayList<Integer> getOperationReportTypeList(boolean isAll) {
ArrayList<Integer> operationReportTypes = new ArrayList<>(); ArrayList<Integer> operationReportTypes = new ArrayList<>();
if (isAll) { if (isAll) {
operationReportTypes.add(OperationReportType.DEFAULT);
operationReportTypes.add(OperationReportType.ROUTINE_TASK);
operationReportTypes.add(OperationReportType.REPORT_TYPE); operationReportTypes.add(OperationReportType.REPORT_TYPE);
operationReportTypes.add(OperationReportType.ROUTINE_TASK);
operationReportTypes.add(OperationReportType.REPORT_RESPONSE_TYPE);
} else { } else {
operationReportTypes = getABVUIDataCache().getOperationReportTypes(); operationReportTypes = getABVUIDataCache().getOperationReportTypes();
} }
......
...@@ -191,7 +191,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity { ...@@ -191,7 +191,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
public void showOperationRelatedContentList() { public void showOperationRelatedContentList() {
mOperationContentList = mOperationLogic.getOperationRelatedContent(operationId); mOperationContentList = mOperationLogic.getOperationRelatedContent();
Logger.i(TAG, "count of content=" + mOperationContentList.size()); Logger.i(TAG, "count of content=" + mOperationContentList.size());
// Gridビュー // Gridビュー
......
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