Commit 2324d341 by Kim Jinsung

#39910 連続作業機能

全削除機能実装
parent dbe02eef
......@@ -42,6 +42,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.AddMemberGroupParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AppStoreNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.CheckSendLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParameters;
......@@ -762,6 +763,17 @@ public class AcmsClient implements AcmsClientResponseListener {
return new ApertureMasterDataJSON(response.httpResponseBody);
}
/**
* 工程情報を全部削除する。(全削除ボタンタップ時)
* @param params (Sid, operationId, processKey情報)
* @return 結果Json
* @throws ABVException
* @throws NetworkDisconnectedException
*/
public void sendDeleteProcess(DeleteProcessParameters params) throws ABVException, NetworkDisconnectedException {
HttpResponse response = send(AcmsApis.ApiDeleteProcess, params);
validateHttpResponse(response, AcmsApis.ApiGetPushMessages);
}
/**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/
......
package jp.agentec.abook.abv.bl.acms.client.parameters;
public class DeleteProcessParameters extends AcmsParameters {
private long operationId;
private String processKey;
public DeleteProcessParameters(String sid, long operationId, String processKey) {
super(sid);
this.operationId = operationId;
this.processKey = processKey;
}
public long getOperationId() { return this.operationId; }
public String getProcessKey() { return this.processKey; }
}
......@@ -160,9 +160,13 @@ public class AcmsApis {
public static final String ApiQuickReportSearch = "quickReportSearch";
// 簡易帳票リビジョン一覧取得
public static final String ApiQuickReportRevision = "quickReportRevision";
// 連続作業の承認情報取得
public static final String ApiGetProcessData = "getProcessData";
// 連続作業の全工程の全削除の送信
public static final String ApiDeleteProcess = "deleteProcess";
// チャット
public static final String ChatApiUrlFormat = "%s/%s/chatapi/%s/";
public static final String ApiGetChatPushData = "push";
......@@ -211,7 +215,7 @@ public class AcmsApis {
methodName.equals(ApiGetTaskFile) || methodName.equals(ApiSceneEntry) || methodName.equals(ApiTaskContentEntry) ||
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData) ||
methodName.equals(ApiOperationGroupMaster) || methodName.equals(ApiGetApertureMasterData) || methodName.equals(ApiQuickReportSearch) || methodName.equals(ApiQuickReportRevision)
|| methodName.equals(ApiGetProcessData)) {
|| methodName.equals(ApiGetProcessData) || methodName.equals(ApiDeleteProcess)) {
apiValue = Constant.ApiValue.checkapi;
} else if (methodName.equals(ApiGetChatPushData)) { // pushActionはchatapiを指定
apiValue = Constant.ApiValue.chatapi;
......
......@@ -91,7 +91,7 @@ public class AbstractDao {
protected long delete(String table, String whereClause, String[] whereArgs) {
SQLiteDatabase db = dbConn.getDatabase();
if (Logger.isVerboseEnabled()) {
Logger.v(TAG, "table=%s where=%s [%s]", table, whereClause, join(whereArgs));
Logger.v(TAG, "delete table=%s where=%s [%s]", table, whereClause, join(whereArgs));
}
return db.delete(table, whereClause, whereArgs);
}
......
......@@ -80,6 +80,10 @@ public class TaskDao extends AbstractDao {
return rawQueryGetDtoList("select * from t_task where operation_id = ? and del_flg = 0 ", new String[]{"" + operationId}, TaskDto.class);
}
public List<TaskDto> selectTaskByOperationId(Long operationId, boolean deleteFlg) {
return rawQueryGetDtoList("select * from t_task where operation_id = ? and del_flg = ? ", new String[]{"" + operationId, "" + (deleteFlg ? 1 : 0)}, TaskDto.class);
}
public List<TaskDto> selectTaskGroupByProcessKeyByOperationId(Long operationId) {
return rawQueryGetDtoList("select *, min(phase_no) as min_phase_no from t_task where operation_id = ? and del_flg = 0 group by process_key order by rowid asc", new String[]{"" + operationId}, TaskDto.class);
}
......@@ -116,8 +120,8 @@ public class TaskDao extends AbstractDao {
+ "task_name, "
+ "phase_no, "
+ "phase_status, "
+ "process_status, "
+ "process_key) "
+ "process_key, "
+ "process_status) "
+ "values "
+ "(?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
......@@ -165,7 +169,18 @@ public class TaskDao extends AbstractDao {
delete("t_task_report_send", "task_key=?", keyValues);
delete("t_task_report_approval", "task_key=?", keyValues);
}
/**
* 作業削除(連続作業用)
* @param taskKey
*/
public void deleteTaskData(String taskKey, String processKey) {
String[] keyValues = new String[]{""+ taskKey};
delete("t_task", "task_key=?", keyValues);
delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues);
delete("t_task_report_send", "task_key=?", keyValues);
delete("t_task_report_approval", "process_key=?", new String[]{processKey});
}
/**
* 作業削除
* @param dto
......
......@@ -98,4 +98,12 @@ public class TaskReportApprovalDao extends AbstractDao {
dto.getUpdateValues());
return count > 0;
}
/**
* テーブル物理削除
* @param processKey 工程キー
*/
public void delete(String processKey) {
delete("t_task_report_approval", "process_key=?", new String[] { processKey });
}
}
......@@ -79,4 +79,12 @@ public class TaskReportItemsDao extends AbstractDao {
long count = update("update t_task_report_items set input_value=? where task_report_level=? and item_key=? and task_key=? ", dto.getUpdateValues());
return (count > 0);
}
/**
* テーブル物理削除
* @param taskKey タスクキー
*/
public void delete(String taskKey) {
delete("t_task_report_items", "task_key=?", new String[] { taskKey });
}
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ public class TaskDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] { taskKey, taskId, operationId, taskCode, taskStatus, taskHotSpotInfo, taskName, phaseNo, phaseStatus, processStatus, processKey};
return new Object[] { taskKey, taskId, operationId, taskCode, taskStatus, taskHotSpotInfo, taskName, phaseNo, phaseStatus, processKey, processStatus};
}
@Override
......
......@@ -25,10 +25,12 @@ import jp.agentec.abook.abv.bl.acms.client.json.ProcessDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.DeleteProcessParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.type.OperationSortingType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
......@@ -484,6 +486,41 @@ public class OperationLogic extends AbstractLogic {
}
}
/**
* 「全削除」ボタンで、すべての工程情報を削除する。
* @param operationId 作業ID
* @param contentId コンテンツID
* @param contentPath コンテンツファイルパス
* @param processKey 工程ID
* @throws IOException
*/
public void deleteProcessAllReport(long operationId, long contentId, String processKey, String contentPath) throws IOException {
//作業送信フラグ更新
mOperationDao.updateNeedSyncFlg(operationId, true);
//作業タスク削除フラグ更新
List<TaskDto> taskDtoList = mTaskDao.getTaskByProcessKey(processKey);
for (TaskDto taskDto : taskDtoList) {
taskDto.delFlg = true;
taskDto.taskStatus = 0;
mTaskDao.update(taskDto);
//作業報告更新
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskDto.taskKey, Constant.TaskReportLevel.ReportType);
taskReportDto.dataSendFlg = false;
taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = "";
mTaskReportDao.update(taskReportDto);
//承認情報削除
mTaskReportApprovalDao.delete(processKey);
//報告(Suggest)情報削除
mTaskReportItemsDao.delete(taskDto.taskKey);
//作業ファイル削除
deleteTaskFileData(operationId, contentId, taskDto.taskKey, Constant.TaskReportLevel.ReportType);
}
createJsonForOperationContent(operationId, contentPath, false);
}
/**
* 定期点検データ新規
......@@ -966,7 +1003,7 @@ public class OperationLogic extends AbstractLogic {
* @param contentPath 保存パス
* @throws IOException
*/
private void createPhaseStatusJson(Long operationId, String contentPath) throws IOException {
public void createPhaseStatusJson(Long operationId, String contentPath) throws IOException {
List<TaskDto> taskDtoProcessKeyList = mTaskDao.selectTaskGroupByProcessKeyByOperationId(operationId);
List<JSONObject> processInfoList = new ArrayList<JSONObject>();
for (TaskDto taskDtoProcessKey : taskDtoProcessKeyList) {
......@@ -1014,7 +1051,7 @@ public class OperationLogic extends AbstractLogic {
* @param contentPath
* @throws IOException
*/
public void createProcessInfoJson(Long operationId, String contentPath) throws IOException {
private void createProcessInfoJson(Long operationId, String contentPath) throws IOException {
List<JSONObject> taskJsonList = new ArrayList<JSONObject>();
JSONObject processInfoJson = new JSONObject();
List<TaskDto> taskDtoList = mTaskDao.selectTaskGroupByProcessKeyByOperationId(operationId);
......@@ -1504,7 +1541,13 @@ public class OperationLogic extends AbstractLogic {
if (taskReportDto.delFlg) {
// 物理削除
mTaskDao.deleteTaskData(taskReportDto.taskKey);
if (operationDto.reportType == Constant.ReportType.ReportContinuous) { //連続作業
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskReportDto.taskKey);
mTaskDao.deleteTaskData(taskReportDto.taskKey, taskDto.processKey);
} else {
mTaskDao.deleteTaskData(taskReportDto.taskKey);
}
} else {
taskReportDto.dataSendFlg = false;
taskReportDto.attachedFileSendFlg = false;
......@@ -1901,12 +1944,12 @@ public class OperationLogic extends AbstractLogic {
//Taskデータ更新(phaseStatus, processStatus)
mTaskDao.updateStatus(taskDto.processKey, phaseTaskDto.phaseNo, taskDto.processStatus, phaseTaskDto.phaseStatus);
for (TaskReportApprovalDto taskReportApprovalDto : phaseTaskDto.taskReportApprovalDtoList) {
taskReportApprovalDto.processKey = taskDto.processKey;
taskReportApprovalDto.phaseNo = phaseTaskDto.phaseNo;
//TaskReportApprovalデータ追加・更新
if (mTaskReportApprovalDao.selectTaskReportApprovalByProcessKey(taskDto.processKey, phaseTaskDto.phaseNo, taskReportApprovalDto.approvalNo) != null) {
mTaskReportApprovalDao.update(taskReportApprovalDto);
} else {
taskReportApprovalDto.processKey = taskDto.processKey;
taskReportApprovalDto.phaseNo = phaseTaskDto.phaseNo;
mTaskReportApprovalDao.insert(taskReportApprovalDto);
}
}
......@@ -1915,4 +1958,43 @@ public class OperationLogic extends AbstractLogic {
}
}
/**
* 工程情報を全部削除する。(全削除ボタンタップ時)
* @param operationId 作業ID
* @param processKey 工程キー
* @throws Exception 例外
* @throws ABVException 例外
*/
public void sendDeleteProcess(final long operationId, final String processKey) throws Exception, ABVException {
DeleteProcessParameters parameters = new DeleteProcessParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId, processKey);
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendDeleteProcess(parameters);
}
/**
* 同期処理で、削除された工程情報を
* @param operationId
* @throws Exception
* @throws AcmsException
*/
public boolean deleteProcess(long operationId) throws Exception {
List<TaskDto> taskDtoList = mTaskDao.selectTaskByOperationId(operationId, true);
List<String> sendedProcessKeyList = new ArrayList<String>();
boolean isSuccess = true;
try {
for (TaskDto taskDto : taskDtoList) {
if (sendedProcessKeyList.contains(taskDto.processKey)) {
continue;
}
sendDeleteProcess(taskDto.operationId, taskDto.processKey);
sendedProcessKeyList.add(taskDto.processKey);
}
} catch (AcmsException ex) {
isSuccess = false;
Logger.e(TAG, "deleteProcess ex = ", ex);
} catch (Exception e) {
isSuccess = false;
Logger.e(TAG, "deleteProcess e = ", e);
}
return isSuccess;
}
}
......@@ -1477,4 +1477,8 @@
<string name="msg_error_chat_room_name_too_long">ルーム名は文字列20字以内に入力してください。</string>
<string name="msg_error_chat_name_has_invalid_character">特殊文字 ;/?:@&amp;=+$,-_.!~*\'()#\\\"` はルーム名に含めることができません。</string>
<string name="msg_error_chat_room_sc_forbidden">認証に失敗しました。再度ログインが必要です。</string>
<!-- 連続作業 -->
<string name="msg_error_all_process_delete">全削除の送信に失敗しました。</string>
</resources>
......@@ -1483,4 +1483,5 @@
<string name="msg_error_chat_room_name_too_long">방 제목은 20자 이내로 입력해 주세요.</string>
<string name="msg_error_chat_name_has_invalid_character">특수문자 ;/?:@&amp;=+$,-_.!~*\'()#\\\"` 는 방 제목에 포함될 수 없습니다.</string>
<string name="msg_error_chat_room_sc_forbidden">사용자 정보를 확인할 수 없습니다. 다시 로그인하시기 바랍니다.</string>
<string name="msg_error_all_process_delete">모두 삭제 송신에 실패하였습니다.</string>
</resources>
\ No newline at end of file
......@@ -1480,4 +1480,5 @@
<string name="msg_error_chat_room_name_too_long">Please enter room name less than 20 characters.</string>
<string name="msg_error_chat_name_has_invalid_character">The character ;/?:@&amp;=+$,-_.!~*\'()#\\\"` cannot be included in the roomname.</string>
<string name="msg_error_chat_room_sc_forbidden">Failed to authenticate. Please login again.</string>
<string name="msg_error_all_process_delete">Failed to send all deletes.</string>
</resources>
......@@ -913,7 +913,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT, ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT, ABookKeys.CMD_CHANGE_TASK_REPORT)) {
ABookKeys.CMD_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT, ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT, ABookKeys.CMD_CHANGE_TASK_REPORT, ABookKeys.CMD_DELETE_PROCESS)) {
try {
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT)) {
......@@ -922,6 +922,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
R.string.file_initialization,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
//連続作業の全削除ボタンタップ時のインジケーター表示
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_DELETE_PROCESS)) {
showProgressPopup(PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_common_processing,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
if (isOperationPdf && operationTaskDto != null && StringUtil.equalsAny(mCmd,
ABookKeys.CMD_INSERT_TASK_REPORT,
......@@ -962,9 +968,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public Object callback(Object ret) {
final boolean isError = (boolean)ret;
closeProgressPopup();
// 報告・報告(回答)の切り替えボタンタップ
if (mCmd.equals(ABookKeys.CMD_CHANGE_TASK_REPORT)) {
// 報告・報告(回答)の切り替えボタンタップ、連続作業の全削除ボタンタップ
if (mCmd.equals(ABookKeys.CMD_CHANGE_TASK_REPORT) || mCmd.equals(ABookKeys.CMD_DELETE_PROCESS)) {
afterABookCheckApi(mCmd, mTaskKey, 0, "", null, isOperationPdf());
if (mCmd.equals(ABookKeys.CMD_DELETE_PROCESS)) {
if (isError) {
showSimpleAlertDialog(R.string.error,R.string.msg_error_all_process_delete);
}
}
return null;
}
......
......@@ -869,6 +869,15 @@ public class OperationListActivity extends ABVUIActivity {
// 報告送信
mOperationLogic.sendTaskReportSendData(operationId, progressCallback);
//工程全削除の送信(連続作業)
if (reportType == ReportType.ReportContinuous) {
if (!mOperationLogic.deleteProcess(operationId)) { //工程全削除送信失敗時
return PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_error_all_process_delete,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
}
progressDialogHorizontal.setProgress(60);
// 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, errorMsg);
......@@ -878,7 +887,6 @@ public class OperationListActivity extends ABVUIActivity {
mOperationLogic.getProcessData(operationId);
}
// mOperationLastEditDateがnullの場合、エラーと見做す
if (mOperationLastEditDate != null && reportType == ReportType.RoutineTask) {
if (buttonEventFlag) {
......
......@@ -104,7 +104,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel, processKey, phaseNo);
sendTaskData(context, operationId, taskKey, taskReportLevel, reportType);
sendTaskData(context, operationId, taskKey, taskReportLevel, reportType, contentPath);
break;
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, true);
......@@ -137,9 +137,13 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true, false);
}
sendTaskData(context, operationId, taskKey, taskReportLevel, reportType);
sendTaskData(context, operationId, taskKey, taskReportLevel, reportType, contentPath);
break;
case ABookKeys.CMD_DELETE_PROCESS: //工程情報「全削除」
mOperationLogic.deleteProcessAllReport(operationId, contentId, processKey, contentPath);
sendDeleteProcess(context, operationId, processKey);
break;
case ABookKeys.CMD_MOVE_HOT_SPOT:
mOperationLogic.updateTaskHotspot(taskKey, param);
mOperationLogic.createHopSpotJson(operationId, contentPath);
......@@ -153,12 +157,49 @@ public class ABookCheckWebViewHelper extends ABookHelper {
}
/**
* 工程情報を全部削除する。(全削除ボタンタップ時)
* @param context ABVContentViewActivity
* @param operationId 作業ID
* @param processKey 工程キー
*/
private void sendDeleteProcess(final ABVContentViewActivity context, final long operationId, final String processKey) {
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
mFinishCallback.callback(false);
return;
}
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
try {
mOperationLogic.sendDeleteProcess(operationId, processKey);
} catch (AcmsException ex) {
Logger.e(TAG, "sendDeleteProcess ex = %s", ex.getLocalizedMessage());
} catch (Exception e) {
Logger.e(TAG, "sendDeleteProcess e = %s", e.getLocalizedMessage());
} finally {
//全削除ボタンタップ時にはエラーメッセージ表示しない。
mFinishCallback.callback(false);
}
}
});
}
/**
* 作業報告・指示データ送信処理(共通)
* @param context ABVContentViewActivity
* @param operationId プロジェクトID
* @param taskKey タスクキー
*/
private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int taskReportLevel, final int reportType) {
/**
* 作業報告・指示データ送信処理(共通)
* @param context 報告画面コンテキスト
* @param operationId 作業ID
* @param taskKey タスクキー
* @param taskReportLevel 報告レベル
* @param reportType 報告タイプ
* @param contentPath コンテンツファイルパス
*/
private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int taskReportLevel, final int reportType, final String contentPath) {
// needSyncFlgをtrueに設定
mOperationLogic.updateSyncOperation(operationId, true);
......@@ -197,6 +238,8 @@ public class ABookCheckWebViewHelper extends ABookHelper {
if (reportType == Constant.ReportType.ReportContinuous) {
//連続作業のみ承認データ取得
mOperationLogic.getProcessData(operationId);
//承認情報Jsonファイル更新
mOperationLogic.createPhaseStatusJson(operationId, contentPath);
}
} catch (AcmsException ex) {
//noinspection EnumSwitchStatementWhichMissesCases
......
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