From 0113d7d021c6ee3ae4c150b43268ca9fa0b395f4 Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 14 Jul 2020 11:46:17 +1000 Subject: [PATCH] fix ui bugs --- .../clearing/core/impl/SettleTaskServiceImpl.java | 7 ++++++- src/main/ui/static/analysis/settle_tasks.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleTaskServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleTaskServiceImpl.java index f04e2e38e..63dc949cc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleTaskServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleTaskServiceImpl.java @@ -4,6 +4,7 @@ import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksServic import au.com.royalpay.payment.manage.management.clearing.web.ManualSettleTask; import au.com.royalpay.payment.manage.mappers.system.SysSettlePlanMapper; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; +import au.com.royalpay.payment.tools.livecheck.AppLiveCheck; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONException; @@ -36,15 +37,17 @@ public class SettleTaskServiceImpl implements SettleTasksService { private final String prefix; private final RestTemplate restTemplate; private final String transactionHost; + private final AppLiveCheck appLiveCheck; private static final String SETTLE_TASK_URI = "/dev/manual/settle_tasks"; public SettleTaskServiceImpl(SysSettlePlanMapper planMapper, StringRedisTemplate redisTemplate, MerchantInfoProvider mchInfoProvider, @Value("${app.redis.prefix}") String prefix, - @Value("${platform.services.transaction:http://127.0.0.1:6012}") String transactionHost) { + @Value("${platform.services.transaction:http://127.0.0.1:6012}") String transactionHost, AppLiveCheck appLiveCheck) { this.planMapper = planMapper; this.redisTemplate = redisTemplate; this.mchInfoProvider = mchInfoProvider; this.prefix = prefix; + this.appLiveCheck = appLiveCheck; this.restTemplate = new RestTemplateBuilder() .messageConverters(new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter(StandardCharsets.UTF_8)) @@ -71,6 +74,8 @@ public class SettleTaskServiceImpl implements SettleTasksService { return idleStatus; } JSONObject stdObj = JSON.parseObject(std); + boolean live = appLiveCheck.listLiveApps().contains(stdObj.getString("server_id")); + stdObj.put("processing", live); if (!stdObj.getBooleanValue("processing")) { stdObj.put("interrupted", true); } diff --git a/src/main/ui/static/analysis/settle_tasks.js b/src/main/ui/static/analysis/settle_tasks.js index 5afc610bf..fdbfc872c 100644 --- a/src/main/ui/static/analysis/settle_tasks.js +++ b/src/main/ui/static/analysis/settle_tasks.js @@ -226,7 +226,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { let arr = $scope.plans.filter(p => p.plan_id === $scope.task.plan) chosenPlan = arr.length ? arr[0] : null; $scope.$close({ - plan_id: $scope.task.remark.replace(' ', '') + randomString(6), + task_id: $scope.task.remark.replace(' ', '') + randomString(6), settle_date: $filter('date')($scope.task.settle_date, 'yyyy-MM-dd'), remark: $scope.task.remark, plan: chosenPlan @@ -243,7 +243,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { cleanDays.push(3); } $scope.$close({ - plan_id: $scope.task.remark.replace(' ', '') + randomString(6), + task_id: $scope.task.remark.replace(' ', '') + randomString(6), disabled_clean_days: cleanDays, settle_date: $filter('date')($scope.task.settle_date, 'yyyy-MM-dd'), last_settle_date: $scope.task.last_settle_date != null ? $filter('date')($scope.task.last_settle_date, 'yyyy-MM-dd') : null,