From 19fa8e96173773e92c0fde1291e97bcd4cba6c7a Mon Sep 17 00:00:00 2001 From: yixian Date: Mon, 6 Aug 2018 12:01:15 +0800 Subject: [PATCH] custom query --- .../custom/core/impl/CustomServiceImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java index f42f8fe74..b7709c6ad 100644 --- a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java @@ -11,6 +11,8 @@ import au.com.royalpay.payment.tools.utils.PageListUtils; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; @@ -25,6 +27,7 @@ import javax.annotation.Resource; */ @Service public class CustomServiceImpl implements CustomService { + private Logger logger = LoggerFactory.getLogger(getClass()); @Resource private CustomSupport customSupport; @Resource @@ -36,12 +39,17 @@ public class CustomServiceImpl implements CustomService { public JSONObject findOneWithDetail(String report_id) { JSONObject result = customReportsMapper.findOne(report_id); result.put("sub_orders", customReportDetailsMapper.findByReportId(report_id)); + try { + result.put("query_result", customSupport.queryCustomResult(report_id)); + } catch (Exception e) { + logger.error("Query Custom Declare status failure:", e); + } return result; } @Override - public void add(String orderId, String mchCustomId, String custom,String mchCustomName, List subOrders) { - CustomReport customReport = new CustomReport(orderId, mchCustomId, mchCustomName,custom); + public void add(String orderId, String mchCustomId, String custom, String mchCustomName, List subOrders) { + CustomReport customReport = new CustomReport(orderId, mchCustomId, mchCustomName, custom); if (!CollectionUtils.isEmpty(subOrders)) { subOrders.forEach(p -> { customReport.addSubOrder(p.getBigDecimal("order_fee"), p.getBigDecimal("order_fee").subtract(p.getBigDecimal("transport_fee"))); @@ -68,11 +76,11 @@ public class CustomServiceImpl implements CustomService { public JSONObject query(JSONObject param, int page, int limit) { param.put("orderStatus", OrderStatus.SUCCESS.getStatus()); List channels = customSupport.customSupportedChannels(param.getIntValue("client_id")); - param.put("channels",channels); - if(!StringUtils.isEmpty(param.getString("channel"))) { + param.put("channels", channels); + if (!StringUtils.isEmpty(param.getString("channel"))) { channels.clear(); channels.add(param.getString("channel")); - param.put("channels",channels); + param.put("channels", channels); } return PageListUtils.buildPageListResult(customReportsMapper.queryWithTrans(param, new PageBounds(page, limit))); }