Commit 3224b543 by Yujin Seo

Merge branch 'feature/contract/sato/1.0.300_110_non_lock' into 'contract/sato/1.0.300'

一時保存時した報告のロック処理を修正

See merge request !278
parents dd279d72 c203b456
...@@ -495,7 +495,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -495,7 +495,7 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[]{ taskKey, "" + taskReportId, reportStartDate }); return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[]{ taskKey, "" + taskReportId, reportStartDate });
} }
public boolean isLocalSaved(String taskKey, int taskReportId, String reportStartDate) { public boolean isLocalSaved(String taskKey, long taskReportId, String reportStartDate) {
int count; int count;
StringBuilder sql = new StringBuilder(); StringBuilder sql = new StringBuilder();
sql.append("SELECT count(*) FROM t_task_report"); sql.append("SELECT count(*) FROM t_task_report");
......
...@@ -47,6 +47,8 @@ import jp.agentec.abook.abv.bl.common.Constant; ...@@ -47,6 +47,8 @@ import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache; import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor; import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.MydataDto; import jp.agentec.abook.abv.bl.dto.MydataDto;
...@@ -1105,17 +1107,28 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1105,17 +1107,28 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} else if (mCmd.equals(ABookKeys.CMD_LOCK_REPORT)) { } else if (mCmd.equals(ABookKeys.CMD_LOCK_REPORT)) {
String taskKey = abookCheckParam.get(TaskKey); String taskKey = abookCheckParam.get(TaskKey);
Date startDate = dateOrNull(abookCheckParam.get("reportStartDate")); Date startDate = dateOrNull(abookCheckParam.get("reportStartDate"));
// ロック TaskReportDao dao = AbstractDao.getDao(TaskReportDao.class);
LockReportLogic.Result r = LockReportLogic.newInstance().lock(taskKey, taskReportId, startDate); if (dao.isLocalSaved(mTaskKey, taskReportId, DateTimeUtil.toString(startDate, DateTimeFormat.yyyyMMddHHmmss_hyphen))) {
// JSコールバック // ローカルにしかない場合はロックしない
afterABookCheckApi(mCmd, mTaskKey, r.getResult(), r.getMessage(), r.getExtParam().json()); afterABookCheckApi(mCmd, mTaskKey, 0, "", "{'reportStatus':0}");
} else {
// ロック
LockReportLogic.Result r = LockReportLogic.newInstance().lock(taskKey, taskReportId, startDate);
// JSコールバック
afterABookCheckApi(mCmd, mTaskKey, r.getResult(), r.getMessage(), r.getExtParam().json());
}
} else if (mCmd.equals(ABookKeys.CMD_UNLOCK_REPORT)) { } else if (mCmd.equals(ABookKeys.CMD_UNLOCK_REPORT)) {
String taskKey = abookCheckParam.get(TaskKey); String taskKey = abookCheckParam.get(TaskKey);
Date startDate = dateOrNull(abookCheckParam.get("reportStartDate")); Date startDate = dateOrNull(abookCheckParam.get("reportStartDate"));
// アンロック // アンロック
UnlockReportLogic.Result r = UnlockReportLogic.newInstance().unlock(taskKey, taskReportId, startDate); UnlockReportLogic.Result r = UnlockReportLogic.newInstance().unlock(taskKey, taskReportId, startDate);
// JSコールバック // JSコールバック
afterABookCheckApi(mCmd, mTaskKey, r.getResult(), r.getMessage(), r.getExtParam().json()); if (r.getMessage().length() > 0) {
// アンロックの失敗は無視
afterABookCheckApi(mCmd, mTaskKey, 0, "", "{'reportStatus':0}");
} else {
afterABookCheckApi(mCmd, mTaskKey, r.getResult(), r.getMessage(), r.getExtParam().json());
}
} }
} }
......
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