settle task query

master
yixian 4 years ago
parent 606ee82d3c
commit 158138c2a0

@ -0,0 +1,11 @@
package au.com.royalpay.payment.manage.management.clearing.core;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
public interface SettleTasksService {
List<JSONObject> listLiveTasks();
JSONObject currentProcessingStatus();
}

@ -278,7 +278,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
data.put("clients", cleanDaysDetails.size()); data.put("clients", cleanDaysDetails.size());
data.put("reports", cleanDaysDetails.size() < 20 ? cleanDaysDetails : cleanDaysDetails.subList(0, 20)); data.put("reports", cleanDaysDetails.size() < 20 ? cleanDaysDetails : cleanDaysDetails.subList(0, 20));
return data; return data;
}).collect(HashMap::new, (map, data) -> map.put("T+" + data.getIntValue("clean_days"), data), Map::putAll); }).collect(HashMap::new, (map, data) -> map.put(data.getString("clean_days"), data), Map::putAll);
log.put("clean_days", cleanDaysStatistics); log.put("clean_days", cleanDaysStatistics);
if (StringUtils.isNotEmpty(log.getString("plan_detail"))) { if (StringUtils.isNotEmpty(log.getString("plan_detail"))) {

@ -0,0 +1,51 @@
package au.com.royalpay.payment.manage.management.clearing.core.impl;
import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksService;
import au.com.royalpay.payment.manage.mappers.system.SysSettlePlanMapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SettleTaskServiceImpl implements SettleTasksService {
private SysSettlePlanMapper planMapper;
private StringRedisTemplate redisTemplate;
private String prefix;
public SettleTaskServiceImpl(SysSettlePlanMapper planMapper, StringRedisTemplate redisTemplate,
@Value("${app.redis.prefix}") String prefix) {
this.planMapper = planMapper;
this.redisTemplate = redisTemplate;
this.prefix = prefix;
}
@Override
public List<JSONObject> listLiveTasks() {
return planMapper.listPlans();
}
private String statusKey() {
return prefix + ":settlement_progress";
}
@Override
public JSONObject currentProcessingStatus() {
String std = redisTemplate.boundValueOps(statusKey()).get();
if (StringUtils.isEmpty(std)) {
JSONObject idleStatus = new JSONObject();
idleStatus.put("processing", false);
idleStatus.put("interrupted", false);
return idleStatus;
}
JSONObject stdObj = JSON.parseObject(std);
if (!stdObj.getBooleanValue("processing")) {
stdObj.put("interrupted", true);
}
return stdObj;
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.management.clearing.web;
import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@ManagerMapping(value = "/sys/settle_tasks", role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.DEVELOPER})
public class SettleTasksController {
private SettleTasksService svc;
public SettleTasksController(SettleTasksService svc) {
this.svc = svc;
}
@GetMapping
public List<JSONObject> listTasks() {
return svc.listLiveTasks();
}
@GetMapping("/current_progress")
public JSONObject getProcessingStatus() {
return svc.currentProcessingStatus();
}
}

@ -0,0 +1,20 @@
package au.com.royalpay.payment.manage.mappers.system;
import com.alibaba.fastjson.JSONObject;
import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect;
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
import java.util.List;
@AutoMapper(tablename = "sys_settlement_plan", pkName = "plan_id")
public interface SysSettlePlanMapper {
@AdvanceSelect(excludeColumns = "whitelist_clients")
List<JSONObject> listPlans();
@AutoSql(SqlType.SELECT)
JSONObject findPlanDetail(String planId);
}
Loading…
Cancel
Save