Commit 0586c611 by Kazuyuki Hida

StartDateに逆のタイムゾーンオフセットをかけた。また、必要のない制約を外した。

parent 645e49d5
......@@ -3,8 +3,10 @@ package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -223,7 +225,6 @@ public class TaskReportDao extends AbstractDao {
* @param reportLockUserId
* @param reportLockUserName
* @param reportLockTime
* @param loginId
* @return
*/
public void updateReportLock(
......@@ -233,8 +234,7 @@ public class TaskReportDao extends AbstractDao {
int reportStatus,
String reportLockUserId,
String reportLockUserName,
Date reportLockTime,
String loginId
Date reportLockTime
) {
StringBuilder sql = new StringBuilder();
List<Object> args = new ArrayList<Object>();
......@@ -250,24 +250,22 @@ public class TaskReportDao extends AbstractDao {
} else {
sql.append(" WHERE task_key=? ");
}
if (loginId != null) {
sql.append(" AND report_lock_user_id=? "); //自分以外のロックを変更しないため
}
args.add(reportStatus);
args.add(reportLockUserId);
args.add(reportLockUserName);
args.add(reportLockTime);
if (reportStartDate != null) {
args.add(taskReportId);
args.add(DateTimeUtil.toStringInTimeZone(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC"));
int offset = TimeZone.getDefault().getOffset(reportStartDate.getTime());
Date date = new Date(reportStartDate.getTime() - offset);
String dateStr = DateTimeUtil.toStringInTimeZone(date, DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
args.add(dateStr);
} else {
args.add(taskKey);
}
if (loginId != null) {
args.add(loginId);
}
update(sql.toString(), args.toArray());
long count = update(sql.toString(), args.toArray());
Logger.i(TAG, "updated " + count + "record(s) by LOCK/UNLOCK");
}
/**
......
......@@ -80,8 +80,7 @@ public class LockReportLogic extends AbstractLogic {
reportStatus,
member.loginId,
member.memberName,
new Date(),
null
new Date()
);
}
......
......@@ -26,10 +26,9 @@ public class UnlockReportLogic extends AbstractLogic {
}
public Result unlock(String taskKey, Long taskReportId, Date reportStartDate) {
String loginId = cache.getMemberInfo().loginId;
Result r = sendUnlockReport(taskKey, taskReportId, reportStartDate);
if (r.result == 0) {
updateLocalDB(taskKey, taskReportId, reportStartDate, r.extParam.getReportStatus(), loginId);
updateLocalDB(taskKey, taskReportId, reportStartDate, r.extParam.getReportStatus());
}
return r;
}
......@@ -65,8 +64,7 @@ public class UnlockReportLogic extends AbstractLogic {
String taskKey,
Long taskReportId,
Date reportStartDate,
int reportStatus,
String loginId
int reportStatus
) {
// ローカルDBに反映
TaskReportDao dao = AbstractDao.getDao(TaskReportDao.class);
......@@ -77,8 +75,7 @@ public class UnlockReportLogic extends AbstractLogic {
reportStatus,
null,
null,
null,
loginId
null
);
}
......
......@@ -337,6 +337,13 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
// AndroidOSが5以下のPANO_SERVER処理のため、置き換える必要がある。
url = "/" + url;
if (url.contains(ABookKeys.ABOOK_CHECK_API)) {
String cmd = uri.getQueryParameter("cmd");
if (cmd.contains("lockReport")) {
String sd = uri.getQueryParameter("reportStartDate");
Logger.d(TAG, "mCmd:" + cmd + ",reportStartDate: "+ sd+", CheckApiUrl: " + url);
} else {
Logger.d(TAG, "mCmd:" + cmd + ", CheckApiUrl: " + url);
}
commonShouldOverrideUrlLoading(uri, null);
}
if (fromDashboard && (url.contains(ABookKeys.CMD_CANCEL_TASK_REPORT))) {
......
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