custom query

master
yixian 6 years ago
parent e11a5b4d92
commit b41a08e45a

@ -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<JSONObject> subOrders) {
CustomReport customReport = new CustomReport(orderId, mchCustomId, mchCustomName,custom);
public void add(String orderId, String mchCustomId, String custom, String mchCustomName, List<JSONObject> 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<String> 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)));
}

Loading…
Cancel
Save