diff --git a/pom.xml b/pom.xml index d6b478d52..da2c73de3 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.2.35 + 2.3.0 UTF-8 1.8.0 @@ -33,30 +33,14 @@ au.com.royalpay.payment alipay-core - - au.com.royalpay.payment - hf-core - au.com.royalpay.payment rppaymentsvc - - au.com.royalpay.payment - jd-core - au.com.royalpay.payment rpay-core - - au.com.royalpay.payment - yeepay-core - - - au.com.royalpay.payment - bestpay-core - com.github.stuxuhai jpinyin diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java index 21049cd1f..748c33efa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java @@ -16,5 +16,4 @@ public interface PlatformClearService { void generateAliPaySettleLogs(); - void doVerifyHFSettleLog(JSONObject param); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java index 402707f30..9878e525f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java @@ -35,14 +35,9 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { }*/ List listChannel = new ArrayList<>(); listChannel.add(putParam(params,"Wechat")); - listChannel.add(putParam(params,"Bestpay")); listChannel.add(putParam(params,"Alipay")); listChannel.add(putParam(params,"AlipayOnline")); - listChannel.add(putParam(params,"jd")); - listChannel.add(putParam(params,"hf")); listChannel.add(putParam(params,"Rpay")); - listChannel.add(putParam(params,"Yeepay")); - listChannel.add(putParam(params,"LakalaPay")); listChannel.add(putParam(params,"rpaypmt_card")); listChannel.add(putParam(params,"rpaypmt_dd")); return listChannel; @@ -55,7 +50,7 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { } List list = new ArrayList<>(); Map analysisMap = new TreeMap<>(); - String[] channels = {"Wechat","Bestpay","Alipay","jd","AlipayOnline","hf", "Rpay","Yeepay","LakalaPay","rpaypmt_card","rpaypmt_dd"}; + String[] channels = {"Wechat","Alipay","AlipayOnline","Rpay","rpaypmt_card","rpaypmt_dd"}; for (String channel:channels){ analysisChannelCustomers(params, analysisMap, channel); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java index f17ae2af1..e34eee4b6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java @@ -92,12 +92,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService { JSONObject result = new JSONObject(); List channels = new ArrayList<>(); if (params.get("channel") == null) { - channels.add("Bestpay"); - channels.add("Yeepay"); channels.add("Rpay"); - channels.add("hf"); - channels.add("jd"); - channels.add("LakalaPay"); channels.add("rpaypmt_card"); channels.add("rpaypmt_dd"); params.put("channels", channels); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index 98c6fb3b3..b250fbc5d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -566,32 +566,6 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT } } } - -/* @Override - public JSONObject getPlatformAmount(JSONObject params) { - JSONObject resp = new JSONObject(); - - params.put("channel","Bestpay"); - resp.put("bestPayAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("bestPay_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","Wechat"); - resp.put("wechatAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("wechat_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","Alipay"); - resp.put("alipayAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("alipay_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","jd"); - resp.put("jdAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("jd_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","AlipayOnline"); - resp.put("aliOnlineAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("aliOnline_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - return resp; - }*/ @Override public JSONObject getPlatformAmount(JSONObject params) { String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id")+params.getString("begin")).get(); @@ -614,7 +588,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT } } private JSONObject getTodayChannelCount(JSONObject params){ - String[] channels = new String[]{"Bestpay", "Wechat", "Alipay", "jd", "AlipayOnline", "hf", "Rpay", "Yeepay", "LakalaPay", "rpaypmt_card", "rpaypmt_dd"}; + String[] channels = new String[]{"Wechat", "Alipay", "AlipayOnline", "Rpay", "rpaypmt_card", "rpaypmt_dd"}; JSONObject resp = new JSONObject(); for(String channel:channels) { params.put("channel", channel); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java index d2fce07ea..35cff711f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java @@ -293,16 +293,6 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService { } - List hfSettle = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "hf"); - if (hfSettle != null && hfSettle.size() > 0) { - for (JSONObject logs : hfSettle) { - dayInfo.put("hfSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); - dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants"))); - } - } else { - dayInfo.put("platformGetSettleFee", BigDecimal.ZERO); - } - List alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay"); for (JSONObject logs : alipaySettleLogs) { dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java index fc60a39c4..f2e233884 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java @@ -11,10 +11,8 @@ import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; -import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.utils.PageListUtils; - import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; @@ -23,12 +21,11 @@ import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; import java.util.List; -import javax.annotation.Resource; - /** * Created by yishuqian on 20/02/2017. */ @@ -63,7 +60,6 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi client.put("transaction_time", DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyy-MM-dd")); } JSONObject res = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Wechat"); - JSONObject best_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Bestpay"); JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay"); JSONObject rate_value = new JSONObject(); if (res != null) { @@ -72,9 +68,6 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi client.put("clean_days", res.getIntValue("clean_days")); } } - if (best_pay != null) { - rate_value.put("best_rate_value", best_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); - } if (ali_pay != null) { rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java index 0401e4125..9cc9877a3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java @@ -12,40 +12,23 @@ import au.com.royalpay.payment.manage.mappers.log.PlatformSettlementMapper; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; - import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; - -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestMethod; +import javax.annotation.Resource; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import cn.yixblog.platform.http.HttpRequestGenerator; +import java.util.*; @Service public class PlatformClearAnalysisServiceImpl implements PlatformClearService { @@ -104,7 +87,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { doVerifyAlipayOnlineSettleLog(sdfClear.parse(end_date)); } catch (Exception e) { logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝Online到账失败:", e); - throw new ChannelNetworkException("校验失败:",e); + throw new ChannelNetworkException("校验失败:", e); } } if (StringUtils.equals("Wechat", channel)) { @@ -276,9 +259,9 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { JSONObject alipaySettleLog = new JSONObject(); JSONArray payments = aliSettleLog.getJSONArray("payments"); - BigDecimal credit = new BigDecimal(0.00); - BigDecimal creditFee = new BigDecimal(0.00); - BigDecimal creditSettle = new BigDecimal(0.00); + BigDecimal credit = BigDecimal.ZERO; + BigDecimal creditFee = BigDecimal.ZERO; + BigDecimal creditSettle = BigDecimal.ZERO; if (payments != null) { for (int i = 0; i < payments.size(); i++) { JSONObject json = payments.getJSONObject(i); @@ -297,21 +280,19 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { JSONArray refunds = aliSettleLog.getJSONArray("refunds"); logger.info("alipay的refunds清算总信息" + refunds.toJSONString()); - BigDecimal debit = new BigDecimal(0.00); - BigDecimal debitFee = new BigDecimal(0.00); - BigDecimal debitSettle = new BigDecimal(0.00); - if (refunds != null) { - for (int i = 0; i < refunds.size(); i++) { - JSONObject json = refunds.getJSONObject(i); - BigDecimal transactionAmount = json.getBigDecimal("transaction_amount"); - BigDecimal chargeFee = json.getBigDecimal("charge_fee"); - debit = debit.add(transactionAmount); - debitFee = debitFee.add(chargeFee); - if (json.containsKey("settle_amount")) { - debitSettle = debitSettle.add(json.getBigDecimal("settle_amount")); - } else { - debitSettle = debitSettle.add(transactionAmount.subtract(chargeFee)); - } + BigDecimal debit = BigDecimal.ZERO; + BigDecimal debitFee = BigDecimal.ZERO; + BigDecimal debitSettle = BigDecimal.ZERO; + for (int i = 0; i < refunds.size(); i++) { + JSONObject json = refunds.getJSONObject(i); + BigDecimal transactionAmount = json.getBigDecimal("transaction_amount"); + BigDecimal chargeFee = json.getBigDecimal("charge_fee"); + debit = debit.add(transactionAmount); + debitFee = debitFee.add(chargeFee); + if (json.containsKey("settle_amount")) { + debitSettle = debitSettle.add(json.getBigDecimal("settle_amount")); + } else { + debitSettle = debitSettle.add(transactionAmount.subtract(chargeFee)); } } alipaySettleLog.put("debit", debit); @@ -370,7 +351,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { sysLogs.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount"))); if (StringUtils.equals("Alipay", channel)) { - sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, new BigDecimal(0.006))); + sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, BigDecimal.valueOf(0.006))); } else if (StringUtils.equals("AlipayOnline", channel)) { sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, alipay_online_rate)); } else { @@ -385,121 +366,4 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { } return null; } - - @Override - public void doVerifyHFSettleLog(JSONObject param) { - - String end = param.getString("end"); - String start = param.getString("start"); - JSONObject hfSettle = handleHFSettleFile(param.getString("fileId")); - if (hfSettle == null) { - return; - } - JSONObject record = new JSONObject(); - record.put("settle_date", end); - record.put("start_date", start); - record.put("end_date", end); - record.put("channel", "hf"); - record.put("last_update_date", new Date()); - JSONObject syscleardata = getHFSystemClearingAmount(start, end); - if (syscleardata != null && syscleardata.size() > 0) { - record.put("sys_pay_fee", syscleardata.getBigDecimal("sys_pay_fee")); - record.put("sys_refund_fee", syscleardata.getBigDecimal("sys_refund_fee")); - record.put("sys_net_fee", syscleardata.getBigDecimal("sys_net_fee")); - record.put("sys_surcharge", syscleardata.getBigDecimal("sys_surcharge")); - record.put("sys_settlement_fee", syscleardata.getBigDecimal("sys_settle_fee")); - } - record.put("pay_fee", BigDecimal.ZERO); - record.put("refund_fee", BigDecimal.ZERO); - record.put("net_fee", hfSettle.getBigDecimal("orderAmount")); - record.put("settlement_fee", hfSettle.getBigDecimal("clearingAmount")); - record.put("surcharge", hfSettle.getBigDecimal("surcharge")); - record.put("unsettle_fee", BigDecimal.ZERO); - - List check = null; - try { - check = platformSettlementMapper.findBySettleDate(DateUtils.parseDate(end, "yyyy-MM-dd"), "hf"); - } catch (ParseException e) { - e.printStackTrace(); - } - if (CollectionUtils.isNotEmpty(check)) { - record.put("log_id", check.get(0).getString("log_id")); - platformSettlementMapper.update(record); - } else { - platformSettlementMapper.save(record); - } - logger.info("汇付清算记录查询完成"); - - } - - private JSONObject handleHFSettleFile(String fileId) { - try { - HttpRequestGenerator gen = new HttpRequestGenerator(attachmentClient.getFileUrl(fileId), RequestMethod.GET); - HSSFWorkbook workbook = new HSSFWorkbook(gen.execute().getResponseContentStream()); - HSSFSheet sheet = workbook.getSheetAt(0); - Iterator rowIterator = sheet.rowIterator(); - Row row = null; - Cell cell = null; - // 跳过第一行 - rowIterator.next(); - JSONObject result = new JSONObject(); - BigDecimal orderAmount = BigDecimal.ZERO; - BigDecimal surcharge = BigDecimal.ZERO; - BigDecimal clearingAmount = BigDecimal.ZERO; - while (rowIterator.hasNext()) { - row = rowIterator.next(); - - cell = row.getCell(0); - if (cell != null) { - continue; - } - cell = row.getCell(15); - cell.setCellType(HSSFCell.CELL_TYPE_STRING); - if (cell != null) { - String orderAmountStr = cell.getStringCellValue().trim(); - if (StringUtils.isNotEmpty(orderAmountStr)) { - result.put("orderAmount", new BigDecimal(orderAmountStr)); - } - } - cell = row.getCell(16); - cell.setCellType(HSSFCell.CELL_TYPE_STRING); - if (cell != null) { - String surchargeStr = cell.getStringCellValue().trim(); - if (StringUtils.isNotEmpty(surchargeStr)) { - result.put("surcharge", new BigDecimal(surchargeStr)); - } - } - cell = row.getCell(17); - cell.setCellType(HSSFCell.CELL_TYPE_STRING); - if (cell != null) { - String clearingAmounStr = cell.getStringCellValue().trim(); - if (StringUtils.isNotEmpty(clearingAmounStr)) { - result.put("clearingAmount", new BigDecimal(clearingAmounStr)); - } - } - } - return result; - } catch (Exception e) { - logger.debug("处理汇付清算文件出错", e); - } - return null; - } - - private JSONObject getHFSystemClearingAmount(String start, String end) { - JSONObject result = new JSONObject(); - try { - JSONObject creditLogs = platformSettlementMapper.calculateSysSettleLog(start, end, "hf", "Credit", new BigDecimal(0.008)); - result.put("sys_pay_fee", creditLogs.getBigDecimal("aud_amount")); - JSONObject debitLogs = platformSettlementMapper.calculateSysSettleLog(start, end, "hf", "Debit", new BigDecimal(0.008)); - result.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start, end, "hf", new BigDecimal(0.008))); - result.put("sys_refund_fee", debitLogs.getBigDecimal("aud_amount")); - result.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount"))); - result.put("sys_settle_fee", result.getBigDecimal("sys_net_fee").subtract(result.getBigDecimal("sys_surcharge"))); - return result; - } catch (Exception ignore) { - ignore.printStackTrace(); - } - return null; - } - } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java index f23f900fd..4f15d1183 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java @@ -17,7 +17,7 @@ import java.util.List; @Service public class PlatformRevenueImpl implements PlatformRevenueService { private org.slf4j.Logger logger = LoggerFactory.getLogger(getClass()); - String[] channelArr = { "Wechat", "Alipay", "Bestpay" }; + String[] channelArr = { "Wechat", "Alipay" }; @Resource private ClearingLogMapper clearingLogMapper; diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java index 7310285a3..32eada5e7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java @@ -4,19 +4,11 @@ import au.com.royalpay.payment.manage.analysis.core.PlatformClearService; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; - import com.alibaba.fastjson.JSONObject; - -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.text.ParseException; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.text.ParseException; @RestController @RequestMapping(value = "/platform/analysis") @@ -49,8 +41,4 @@ public class PlatformClearAController { platformClearService.generateSettleLogs(); } - @ManagerMapping(value = "/generate/hf/settle", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.DEVELOPER}) - public void generatehfSettleLogs(@RequestBody JSONObject param) { - platformClearService.doVerifyHFSettleLog(param); - } } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 69ef8d993..1f5ac643d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -1665,7 +1665,6 @@ public class RetailAppServiceImp implements RetailAppService { channels[0] = getChannel(clientId, now, "Wechat"); channels[1] = getChannel(clientId, now, "Alipay"); - channels[2] = getChannel(clientId, now, "Bestpay"); res.put("channels", channels); return res; @@ -1782,7 +1781,6 @@ public class RetailAppServiceImp implements RetailAppService { List newActs = new ArrayList<>(); for (JSONObject act : JSON.parseArray(acts.toJSONString(), JSONObject.class)) { if (act.getString("page_desc") != null && !act.getString("page_desc").equals("0")) { - logger.info("app get banner{}-{}", device.getIntValue("client_id"), act.toJSONString()); if (StringUtils.equalsIgnoreCase(act.getString("page_keywords"), "RYCBSM")) { if (geekShowActVersion(device.getString("version"))) { newActs.add(act); @@ -2789,22 +2787,6 @@ public class RetailAppServiceImp implements RetailAppService { throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); } - try { - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); - } - } catch (Exception ignored) { - JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days")); - client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, RoundingMode.DOWN)); - client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, RoundingMode.DOWN)); - } - JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); if (bankAccount == null || bankAccount.size() <= 0) { throw new BadRequestException("The Partner's Account is not config!"); @@ -3099,14 +3081,6 @@ public class RetailAppServiceImp implements RetailAppService { if (alipay.containsKey("channel")) { channels.add(alipay); } - JSONObject bestpay = getChannel(clientId, now, "Bestpay"); - if (bestpay.containsKey("channel")) { - channels.add(bestpay); - } - JSONObject jd = getChannel(clientId, now, "jd"); - if (jd.containsKey("channel")) { - channels.add(jd); - } JSONObject alipayOnline = getChannel(clientId, now, "AlipayOnline"); if (alipayOnline.containsKey("channel")) { channels.add(alipayOnline); @@ -3121,7 +3095,7 @@ public class RetailAppServiceImp implements RetailAppService { } res.put("channels", channels); if (res.containsKey("rate_value")) { - BigDecimal minRate = res.getBigDecimal("rate_value").add(new BigDecimal(0.01)).setScale(2, RoundingMode.DOWN); + BigDecimal minRate = res.getBigDecimal("rate_value").add(BigDecimal.valueOf(0.01)).setScale(2, RoundingMode.DOWN); res.put("customer_rage_title", (minRate.toPlainString() + "~" + res.getString("max_customer_surcharge_rate"))); } return res; diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java index 9bff7968f..bbc612edf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java @@ -18,11 +18,11 @@ import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper; +import org.apache.commons.codec.binary.Base64; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.parser.Feature; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.net.util.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index 5696a9815..9d5ac067f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -338,8 +338,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("cbbank_rate",rate.getString("CB_Bankpay")); - apply.put("bestpay_rate",rate.getString("Bestpay")); - apply.put("jd_rate",rate.getString("JDpay")); JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); apply.put("bank", bankInfo.getString("bank")); @@ -506,8 +504,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("cbbank_rate",rate.getString("CB_Bankpay")); - apply.put("bestpay_rate",rate.getString("Bestpay")); - apply.put("jd_rate",rate.getString("JDpay")); JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); apply.put("bank", bankInfo.getString("bank")); @@ -759,8 +755,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { configNewClientRate(sysRate, clientId, "Wechat", "Wechat"); configNewClientRate(sysRate, clientId, "Alipay", "Alipay"); configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline"); - configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay"); - configNewClientRate(sysRate, clientId, "jd", "JDpay"); configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay"); Runnable task2 = () -> { try { diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java index e665acdd6..abf996ad2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java @@ -42,9 +42,7 @@ public class ContentController { model.addAttribute("wechat_rate", contractInfo.getString("wechat_rate")); model.addAttribute("cbbank_rate", contractInfo.getString("cbbank_rate")); model.addAttribute("alipay_online_rate", contractInfo.getString("alipay_online_rate")); - model.addAttribute("bestpay_rate", contractInfo.getString("bestpay_rate")); model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate")); - model.addAttribute("jd_rate", contractInfo.getString("jd_rate")); return "contract_for_compliance"; } diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java b/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java deleted file mode 100644 index 512641468..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java +++ /dev/null @@ -1,61 +0,0 @@ -package au.com.royalpay.payment.manage.apps.events.listeners; - -import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent; -import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService; -import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper; -import au.com.royalpay.payment.manage.merchants.core.ClientManager; -import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -/** - * Created by wangning on 17/01/2018. - */ -@Service -public class AfterPaymentFinishListener implements ApplicationListener { - @Resource - private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper; - @Resource - private CustomerPaymentInfoService customerPaymentInfoService; - @Resource - private ClientManager clientManager; - - @Override - public void onApplicationEvent(AfterPaymentFinishEvent event) { - JSONObject order = event.getFinishedEvent().getOrder(); - if(!"hf".equals(order.getString("channel"))&&!"Yeepay".equals(order.getString("channel"))){ - return; - } - switch (order.getString("channel")){ - case "hf": - if(StringUtils.isEmpty(order.getString("ext_params"))){ - return; - } - JSONObject extParam = JSONObject.parseObject(order.getString("ext_params")); - JSONObject orderInfo = sysCustomerPaymentInfoMapper.selectPaymentInfo(order.getString("customer_id")); - if (orderInfo != null) { - orderInfo.put("idcard_name", extParam.getString("payer_name")); - orderInfo.put("idcard_no", extParam.getString("payer_identity_card")); - orderInfo.put("bankcard", extParam.getString("card_number")); - orderInfo.put("bank", extParam.getString("bankId")); - sysCustomerPaymentInfoMapper.update(orderInfo); - }else { - JSONObject lastOrderInfo = new JSONObject(); - lastOrderInfo.put("wechat_openid", order.getString("customer_id")); - lastOrderInfo.put("idcard_name", extParam.getString("payer_name")); - lastOrderInfo.put("idcard_no", extParam.getString("payer_identity_card")); - lastOrderInfo.put("bankcard", extParam.getString("card_number")); - lastOrderInfo.put("bank", extParam.getString("bankId")); - customerPaymentInfoService.save(lastOrderInfo); - } - clientManager.sendHfEmailNotice(order); - return; - case "Yeepay": - clientManager.sendGatewayEmailNotice(order); - return; - } - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java index a138e9149..f7e073ea1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java @@ -81,7 +81,7 @@ public class BDPrizeServiceImpl implements BDPrizeService { private static BigDecimal percent = new BigDecimal(100); - private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline","hf", "Rpay","Yeepay","LakalaPay", "rpaypmt_card", "rpaypmt_dd"}; + private static String[] channels = new String[]{"Wechat", "Alipay","AlipayOnline", "Rpay","rpaypmt_card", "rpaypmt_dd"}; private static Logger logger = LoggerFactory.getLogger(BDPrizeServiceImpl.class); @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java index 353c549cf..67bd2d78b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java @@ -62,10 +62,6 @@ public class AgentCommissionAnalysis { orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); break; - case "jd": - orgCharge = grossAmount.multiply(org.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); - orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); - break; case "alipayonline": orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); @@ -143,4 +139,4 @@ public class AgentCommissionAnalysis { } return list; } -} \ No newline at end of file +} diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java index ff589afc3..4660e1331 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java @@ -222,9 +222,6 @@ public class CityPartnerCommissionAnalysis { case "wechat": thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; - case "jd": - thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); - break; case "alipayonline": thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java index fbf574f9d..113a74bd7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java @@ -226,9 +226,6 @@ public class CityPartnerSeniorCommissionAnalysis { case "wechat": thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; - case "jd": - thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); - break; case "alipayonline": thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java index 50abd1285..9a0c1f9f2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java @@ -284,8 +284,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { HashMap channelMap = new HashMap<>(); channelMap.put("Alipay", "Alipay"); channelMap.put("Wechat", "Wechat"); - channelMap.put("Bestpay", "Bestpay"); - channelMap.put("jd", "jd"); channelMap.put("AlipayOnline", "AlipayOnline"); Set orgIds = new HashSet<>(); List transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month); @@ -430,20 +428,19 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal transaction_fee = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { - channel = "cb_bankpay"; - if (orgInfo.get("cb_bankpay_rate_value") == null) { - throw new ServerErrorException(orgInfo.getString("name") + "组织下" + "cbbankpay" + "成本手续费未设置"); - } - } else { - if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) { - throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); - } + if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) { + throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); } for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")).subtract(params.getBigDecimal("transaction_fee")); + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge") + .subtract(params.getBigDecimal("surcharge_cashback")) + .subtract(params.getBigDecimal("transaction_fee")); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); total = total.add(tmpClearingAmount); @@ -482,14 +479,16 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal transaction_fee = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); - - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { - channel = "cb_bankpay"; - } for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")).subtract(params.getBigDecimal("transaction_fee")); + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge") + .subtract(params.getBigDecimal("surcharge_cashback")) + .subtract(params.getBigDecimal("transaction_fee")); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); BigDecimal parent_surage = tmpClearingAmount.multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP); @@ -542,10 +541,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); String rateChannel = oneChannel.getKey(); - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { - channel = "cb_bankpay"; - rateChannel = "CB_BankPay"; - } JSONObject clientRate = null; try { clientRate = merchantInfoProvider.clientCurrentRate(clientId, oneChannel.getValue().get(0).getDate("transaction_time"), @@ -557,6 +552,10 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); //增加货币判断 + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } int i = currencyScale(params.getString("clearing_currency")); if (total.compareTo(BigDecimal.ZERO) == 0) { datefrom = params.getDate("transaction_time"); @@ -587,7 +586,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("client_id", clientId); if (clientRate != null) { json.put("client_rate", clientRate.getBigDecimal("rate_value")); - }else { + } else { json.put("client_rate", oneChannel.getValue().get(0).getBigDecimal("surcharge_rate").multiply(CommonConsts.HUNDRED)); } json.put("gross_amount", total); @@ -636,9 +635,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { case "Wechat": thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); break; - case "jd": - thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("jdChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); - break; case "AlipayOnline": thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); break; @@ -707,8 +703,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { HashMap channelMap = new HashMap<>(); channelMap.put("Alipay", "Alipay"); channelMap.put("Wechat", "Wechat"); - channelMap.put("Bestpay", "Bestpay"); - channelMap.put("jd", "jd"); channelMap.put("AlipayOnline", "AlipayOnline"); List transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month, org.getIntValue("parent_org_id")); Map results = new HashMap<>(); @@ -1229,7 +1223,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("net_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("net_charge").toPlainString()); if (log.getBigDecimal("org_charge").compareTo(BigDecimal.ZERO) == 1) { row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("org_charge").toPlainString()); - }else { + } else { row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(BigDecimal.ZERO.toPlainString()); } row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("share_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("share_charge").toPlainString()); diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfClearAmountService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/HfClearAmountService.java deleted file mode 100644 index 9b6721aca..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfClearAmountService.java +++ /dev/null @@ -1,9 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core; - -import com.alibaba.fastjson.JSONObject; - -public interface HfClearAmountService { - - JSONObject hfjsonobject(String dateto,String datefrom); - -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfUpdateService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/HfUpdateService.java deleted file mode 100644 index fb7611487..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfUpdateService.java +++ /dev/null @@ -1,11 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core; - -import com.alibaba.fastjson.JSONObject; - -public interface HfUpdateService { - - String updateStatus(); - - String rpayUpdate(); - -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java index e44bfe975..709a61302 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java @@ -14,8 +14,8 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import com.alibaba.fastjson.JSONObject; -import com.yeepay.shade.org.apache.commons.lang3.StringUtils; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfClearAmountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfClearAmountServiceImpl.java deleted file mode 100644 index 62b05768d..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfClearAmountServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core.impl; - -import au.com.royalpay.payment.manage.dev.core.HfClearAmountService; -import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; -import au.com.royalpay.payment.tools.env.PlatformEnvironment; -import au.com.royalpay.payment.tools.exceptions.ServerErrorException; -import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.time.DateUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.text.ParseException; -import java.util.List; - -@Service -public class HfClearAmountServiceImpl implements HfClearAmountService { - @Resource - private TransactionMapper transactionMapper; - - @Override - public JSONObject hfjsonobject(String dateto, String datefrom) { - JSONObject params = new JSONObject(); - try { - params.put("datefrom", DateUtils.addMinutes(DateUtils.parseDate(datefrom, "yyyy-MM-dd"), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes())); - params.put("dateto", DateUtils.addMinutes(DateUtils.parseDate(dateto, "yyyy-MM-dd"), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes())); - } catch (ParseException e) { - throw new ServerErrorException("时间转换异常"); - } - List hfClearAmountResult = transactionMapper.getHfClearAmount(params); - JSONObject result = new JSONObject(); - result.put("payment_amount", BigDecimal.ZERO); - result.put("refund_amount", BigDecimal.ZERO); - result.put("gross_amount", BigDecimal.ZERO); - result.put("charge_amount", BigDecimal.ZERO); - result.put("clear_amount", BigDecimal.ZERO); - result.put("payment_surcharge", BigDecimal.ZERO); - result.put("refund_surcharge", BigDecimal.ZERO); - if (hfClearAmountResult.isEmpty()) { - return result; - } - hfClearAmountResult.forEach(dbResult -> { - if ("Credit".equals(dbResult.getString("transaction_type"))) { - result.put("payment_amount", dbResult.getBigDecimal("clear_amount")); - result.put("payment_surcharge", dbResult.getBigDecimal("charge_amount")); - } - if ("Debit".equals(dbResult.getString("transaction_type"))) { - result.put("refund_amount", dbResult.getBigDecimal("clear_amount")); - result.put("refund_surcharge", dbResult.getBigDecimal("charge_amount")); - } - }); - result.put("gross_amount", result.getBigDecimal("payment_amount").subtract(result.getBigDecimal("refund_amount"))); - result.put("charge_amount", result.getBigDecimal("payment_surcharge").subtract(result.getBigDecimal("refund_surcharge"))); - result.put("clear_amount", result.getBigDecimal("gross_amount").subtract(result.getBigDecimal("charge_amount"))); - return result; - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java deleted file mode 100644 index 89f113f31..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core.impl; - -import au.com.royalpay.payment.channels.rpay.runtime.RpayApi; -import au.com.royalpay.payment.manage.dev.core.HfUpdateService; -import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientMapper; -import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; -import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; -import au.com.royalpay.payment.tools.env.PlatformEnvironment; - -import com.alibaba.fastjson.JSONObject; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import java.util.List; - -import javax.annotation.Resource; - -@Service -public class HfUpdateImpl implements HfUpdateService { - @Resource - private ClientMapper clientMapper; - @Resource - private MpWechatApiProvider mpWechatApiProvider; - @Resource - private ClientConfigMapper clientConfigMapper; - @Resource - private RpayApi rpayApi; - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Override - public String updateStatus() { - List clientIds = clientMapper.findByhfPayUrlNotNull(); - clientIds.forEach(dbResult -> { - String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + dbResult.getString("client_moniker") + "/jump/pc"); - MpWechatApi api = mpWechatApiProvider.getNewPaymentApi(); - String url = api.registerShortUrl(longUrl); - dbResult.put("hf_pay_url", url); - JSONObject config = new JSONObject(); - config.put("client_id",dbResult.getString("client_id")); - config.put("hf_pay_url", url); - clientConfigMapper.update(config); - clientMapper.update(dbResult); - - }); - return "ok"; - } - - @Override - public String rpayUpdate() { - List clientIds = clientMapper.findByrpayNotNull(); - StringBuffer sb = new StringBuffer(); - clientIds.forEach(dbResult -> { - try { -// rpayApi.modifySurchargeConfig(dbResult); - } catch (Exception e) { - sb.append("【" + dbResult.getString("client_moniker") + "】、"); - } - }); - logger.info("test for update rpay clearing date,fail + " + sb.toString()); - return "ok"; - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestAPPController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestAPPController.java deleted file mode 100644 index 81af6af53..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestAPPController.java +++ /dev/null @@ -1,70 +0,0 @@ -package au.com.royalpay.payment.manage.dev.web; - - -import au.com.royalpay.payment.manage.analysis.core.DashboardService; - -import com.alibaba.fastjson.JSONObject; - -import org.joda.time.DateTime; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - -@RestController -@RequestMapping(value = "/dev/pine") -public class TestAPPController { - @Resource - private DashboardService dashboardService; - - @GetMapping("/trade_log") - public List getTradeLogs(HttpServletResponse response) { - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Allow-Credentials", "true"); - response.addHeader("Access-Control-Allow-Headers", "Authorization,Origin, X-Requested-With, Content-Type, Accept"); - response.addHeader("Access-Control-Allow-Methods", "*"); - List logs = new ArrayList<>(); - for (int i = 0; i < 5; i++) { - JSONObject json = new JSONObject(); - json.put("channel", "Alipay"); - json.put("order_id", "PINE-r67783ej392u38ry982"); - json.put("status", "1"); - json.put("amount","9.99"); - logs.add(json); - } - for (int i = 0; i < 5; i++) { - JSONObject json = new JSONObject(); - json.put("channel", "Wechat"); - json.put("order_id", "PINE-r67783ej392u38ry982"); - json.put("status", "2"); - json.put("amount","9.99"); - logs.add(json); - } - for (int i = 0; i < 5; i++) { - JSONObject json = new JSONObject(); - json.put("channel", "Bestpay"); - json.put("order_id", "PINE-r67783ej392u38ry982"); - json.put("status", "3"); - json.put("amount","9.99"); - logs.add(json); - } - return logs; - } - - - @RequestMapping(value = "/customer",method = RequestMethod.GET) - public void generateCustomersAndOrdersStatistics(){ - DateTime dt17 = new DateTime(2018,5,17,11,11); - DateTime dt18 = new DateTime(2018,5,18,11,11); - DateTime dt19 = new DateTime(2018,5,19,11,11); - dashboardService.generateCustomersAndOrdersStatistics(dt17.toDate()); - dashboardService.generateCustomersAndOrdersStatistics(dt18.toDate()); - dashboardService.generateCustomersAndOrdersStatistics(dt19.toDate()); - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 973d2b870..e8f61f5c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -2,11 +2,8 @@ package au.com.royalpay.payment.manage.dev.web; import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment; import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient; -import au.com.royalpay.payment.channels.bestpay.runtime.BestPayClient; -import au.com.royalpay.payment.channels.jd.runtime.JDClient; import au.com.royalpay.payment.channels.rpay.runtime.RpayClient; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; -import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.OrderNotExistsException; @@ -19,8 +16,6 @@ import au.com.royalpay.payment.manage.dev.bean.AliExcel; import au.com.royalpay.payment.manage.dev.bean.Message; import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage; import au.com.royalpay.payment.manage.dev.core.AliforexcelService; -import au.com.royalpay.payment.manage.dev.core.HfClearAmountService; -import au.com.royalpay.payment.manage.dev.core.HfUpdateService; import au.com.royalpay.payment.manage.dev.core.WechatMessageService; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.RefundMapper; @@ -37,7 +32,6 @@ import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.env.PlatformEnvironment; -import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.http.HttpUtils; @@ -112,14 +106,8 @@ public class TestController { @Resource private AlipayClient alipayClient; @Resource - private BestPayClient bestPayClient; - @Resource - private JDClient jdClient; - @Resource private RpayClient rpayClient; @Resource - private YeePayClient yeepayClient; - @Resource private TradeLogService tradeLogService; @Resource private RetailAppService retailAppService; @@ -128,14 +116,8 @@ public class TestController { @Resource private AliforexcelService aliforexcelService; @Resource - private HfClearAmountService hfClearAmountService; - @Resource - private HfUpdateService hfUpdateService; - @Resource private ClientManager clientManager; @Resource - private SysConfigManager sysConfigManager; - @Resource private MpWechatApiProvider mpWechatApiProvider; @Resource private SysClientLegalPersonMapper sysClientLegalPersonMapper; @@ -234,17 +216,6 @@ public class TestController { if (alipayRate != null) { client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } - - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); if (alipayOnlineRate != null) { client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); @@ -334,16 +305,6 @@ public class TestController { xmlStr = XmlFormatUtils.formatXml(elem); res.put("xml", xmlStr); break; - case "Bestpay": - JSONObject status = bestPayClient.queryOrderStatus(order.getString("order_id"), order.getDate("create_time")); - String json = JSON.toJSONString(status, SerializerFeature.PrettyFormat); - res.put("xml", json); - break; - case "jd": - elem = jdClient.queryTransaction(orderId, orderId, JDClient.TRADE_TYPE_PAY); - xmlStr = XmlFormatUtils.formatXml(elem); - res.put("xml", xmlStr); - break; case "AlipayOnline": elem = alipayClient.checkOnlineOrderStatusByOrderId(orderId, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid()); xmlStr = XmlFormatUtils.formatXml(elem); @@ -354,9 +315,6 @@ public class TestController { String rpayjson = JSON.toJSONString(orderInfo, SerializerFeature.PrettyFormat); res.put("xml", rpayjson); break; - case "Yeepay": - res.put("xml", yeepayClient.queryOrderStd(orderId).toString()); - break; default: throw new BadRequestException("Not Support channel:" + channel); } @@ -386,24 +344,11 @@ public class TestController { String xmlStr = XmlFormatUtils.formatXml(elem); res.put("xml", xmlStr); break; - case "Bestpay": - JSONObject status = bestPayClient.queryRefundStatus(order.getString("order_id"), refundId, refundOrder.getDate("create_time")); - String json = JSON.toJSONString(status, SerializerFeature.PrettyFormat); - res.put("xml", json); - break; - case "jd": - elem = jdClient.queryTransaction(refundId, order.getString("order_id"), JDClient.TRADE_TYPE_REFUND); - xmlStr = XmlFormatUtils.formatXml(elem); - res.put("xml", xmlStr); - break; case "AlipayOnline": elem = alipayClient.onlineRefund(refundOrder, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid(), type == TradeType.GATEWAY_H5); xmlStr = XmlFormatUtils.formatXml(elem); res.put("xml", xmlStr); break; - case "Yeepay": - res.put("xml", yeepayClient.queryRefundStd(refundOrder.getString("out_refund_id")).toString()); - break; default: throw new BadRequestException("Not Support channel:" + channel); } @@ -444,33 +389,11 @@ public class TestController { wechatMessageService.sendMessageByOpenId(sendWechatMessage); } -/* @ManagerMapping(value = "/orgusertest", method = RequestMethod.POST, role = {ManagerRole.ADMIN,ManagerRole.DEVELOPER}) - public JSONObject orgusertest(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid ClientTestRegisterInfo registery, - Errors errors) { - HttpUtils.handleValidErrors(errors); - return newpartnerService.registerClient(null, registery, manager); - }*/ @ManagerMapping(value = "/aliforexcel", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) public void aliforexcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse, AliExcel query) throws Exception { aliforexcelService.listClients(httpResponse, manager, query); } - - @ManagerMapping(value = "/hfClearAmount", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) - public JSONObject hfUpdate(@RequestParam String datefrom, @RequestParam String dateto) { - return hfClearAmountService.hfjsonobject(dateto, datefrom); - } - - @ManagerMapping(value = "/hfUpdate", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) - public String hfClearAmount() { - return hfUpdateService.updateStatus(); - } - - @ManagerMapping(value = "/rpayUpdate", method = RequestMethod.PUT, role = ManagerRole.DEVELOPER) - public String rpayUpdateClearing() { - return hfUpdateService.rpayUpdate(); - } - @ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) public void resetPartnerPassword() { clientManager.updateAllPartnerPassword("PINE"); diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java index 12c48ee1c..6919c7ecc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java @@ -128,8 +128,6 @@ public class ClientRegisterInfo { rate.put("wechat_rate_value", settleConfig.getWechatRate()); rate.put("alipay_rate_value", settleConfig.getAlipayRate()); rate.put("alipayonline_rate_value", settleConfig.getAlipayOnlineRate()); - rate.put("bestpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Bestpay")); - rate.put("jd_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"JDpay")); rate.put("Rpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Rpay")); rate.put("cb_bankpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"CB_Bankpay")); rate.put("transaction_fee", settleConfig.getTransactionFee()); diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java index 74663013d..33f96db30 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java @@ -42,7 +42,7 @@ public class ClientSettleConfig { @JSONField(name = "alipay_online_rate") private String alipayOnlineRate; @JSONField(name = "transaction_fee") - private String transactionFee; + private String transactionFee ="0.00"; @JSONField(name = "active_time") private String activeTime; @JSONField(name = "expire_time") diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java index 99bfb4489..6286ac685 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java @@ -31,7 +31,7 @@ public class ArrivalNoticeController { @RequestParam("date") String date) throws ParseException { JSONArray reports = new JSONArray(); - Date dt = DateUtils.parseDate(date, new String[]{"yyyyMMdd"}); + Date dt = DateUtils.parseDate(date, "yyyyMMdd"); JSONObject reportItem = validationLogMapper.findByDate(dt); if (reportItem != null) { JSONObject result = JSON.parseObject(reportItem.getString("result")); @@ -50,11 +50,6 @@ public class ArrivalNoticeController { } channelItem.put("analysis", analysis); } - if (channel.equals("Bestpay") && result.containsKey("bestpay_valid_analysis")) { - List analysis = new ArrayList<>(); - analysis.add(result.getJSONObject("bestpay_valid_analysis")); - reports.getJSONObject(i).put("analysis", analysis); - } } } map.put("reports", reports); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java index 00226b22c..994dd765f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java @@ -25,7 +25,7 @@ public class ClientRateConfig { @JSONField(name = "transaction_fee") @NotNull(message = "error.payment.valid.param_missing") - private Double transactionFee; + private Double transactionFee = 0.00; @JSONField(name = "active_time") @NotNull(message = "error.payment.valid.param_missing") diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 88c64ed46..291435655 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -69,9 +69,6 @@ public interface ClientManager { @Transactional void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo); - @Transactional - void updateClientYeepayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject yeepaySubMerchantInfo); - @Transactional void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo); @@ -434,8 +431,6 @@ public interface ClientManager { List listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker); - List listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker); - String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager); void registerAlipayGms(String clientMoniker, JSONObject manager); @@ -492,12 +487,6 @@ public interface ClientManager { void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - - void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - - void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - void updateAllPartnerPassword(String clientMoniker); void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 36d061139..9172a14c7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -13,9 +13,6 @@ import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo; -import au.com.royalpay.payment.channels.yeepay.config.YeePayConfig; -import au.com.royalpay.payment.channels.yeepay.mappers.YeePayClientConfigMapper; -import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.core.PaymentChannelApi; import au.com.royalpay.payment.core.beans.EmptyMerchantApplication; import au.com.royalpay.payment.core.beans.MerchantApplicationResult; @@ -93,7 +90,6 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; -import com.yeepay.yop.sdk.service.kj.model.SubmerchantRegisterResult; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; @@ -228,15 +224,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private RpayApi rpayApi; - @Resource - private YeePayClient yeePayClient; - - @Resource - private YeePayConfig yeePayConfig; - - @Resource - private YeePayClientConfigMapper yeePayClientConfigMapper; - @Resource private ManagerMapper managerMapper; @Resource @@ -452,14 +439,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (upayInfo != null) { client.putAll(upayInfo); } - client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) == null ? false : true); + client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) != null); client.put("show_all_permission", true); int role = manager != null ? manager.getIntValue("role") : 0; if (manager != null) { if (ManagerRole.OPERATOR.hasRole(role)) { List log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"), new PageBounds(Order.formString("create_time.desc"))); - client.put("sub_merchant_id_log", log.size() > 0 ? true : false); + client.put("sub_merchant_id_log", log.size() > 0); } if (ManagerRole.BD_USER.hasRole(role)) { int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); @@ -520,15 +507,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("audit_card_logs", audit_card_logs); } - //HF支付链接二维码 - if (client.getString("hf_pay_url") != null) { - String hfQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + client.getString("client_moniker") + "/jump/app"); - client.put("hfQrcodeUrl", QRCodeUtils.qrcodeImageCode(hfQrcodeUrl, 250, true)); - } - if (client.getString("yeepay_pay_url") != null) { - String yeepayQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/yeepay/partners/" + client.getString("client_moniker") + "/jump/app"); - client.put("yeepayQrcodeUrl", QRCodeUtils.qrcodeImageCode(yeepayQrcodeUrl, 250, true)); - } if (client.getString("cb_bankpay_url") != null) { String cbBankPayQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/sys/partners/" + client.getString("client_moniker") + "/cb_bankpay/link"); client.put("cbBankPayQrcodeUrl", QRCodeUtils.qrcodeImageCode(cbBankPayQrcodeUrl, 250, true)); @@ -574,6 +552,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List children = clientMapper.listChildClients(client.getIntValue("client_id")); client.put("has_children", !children.isEmpty()); } + assert client != null; client.putAll(clientConfigService.find(clientId)); return client; } @@ -1080,7 +1059,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); JSONObject update = new JSONObject(); int clientId = client.getIntValue("client_id"); - String originSubMerchantId = client.getString("rpay_enterprise_id"); update.put("client_id", clientId); String subMerchantId = rpaySubMerchantInfo.getString("rpay_enterprise_id"); update.put("rpay_enterprise_id", subMerchantId); @@ -1093,25 +1071,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(clientId); } - @Transactional - @Override - public void updateClientYeepayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject yeepaySubMerchantInfo) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - if (client.getString("yeepay_sub_merchant_id").equals(yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"))) { - throw new BadRequestException("The sub merchant Id is in use"); - } - JSONObject yeepayConfigValid = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id")); - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"), 0); - JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id")); - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"), 1); - client.put("yeepay_sub_merchant_id", yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id")); - clientMapper.update(client); - } - @Override public void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -1665,9 +1624,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); - upayProfileInfo.put(permissionKey, allow); - sysClientUpayProfileMapper.update(upayProfileInfo); + if (upayProfileInfo != null) { + upayProfileInfo.put(permissionKey, allow); + sysClientUpayProfileMapper.update(upayProfileInfo); + } } @Override @@ -1678,12 +1640,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new NotFoundException("Client Not Exists"); } - if (channel.equals("hf") && !allow && client.getBoolean("enable_hf_email_notice")) { - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_hf_email_notice", allow)); - } - if (channel.equals("yeepay") && !allow && client.getBoolean("enable_yeepay_email_notice")) { - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_yeepay_email_notice", allow)); - } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel " @@ -2089,25 +2045,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkAddRate(config, "Wechat", "wechat_rate_value", org, "min_wechat_rate"); checkAddRate(config, "Alipay", "alipay_rate_value", org, "min_alipay_rate"); checkAddRate(config, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); - checkAddRate(config, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate"); - checkAddRate(config, "jd", "jd_rate_value", org, "min_jd_rate"); -// checkAddRate(config, "hf", "hf_rate_value", org, "min_hf_rate"); checkAddRate(config, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); -// checkAddRate(config, "Yeepay", "yeepay_rate_value", org, "min_yeepay_rate"); checkAddRate(config, "CB_BankPay", "min_cb_bankpay_value", org, "min_cb_bankpay_rate"); configNewClientRate(config, clientId, "Wechat", "wechat_rate_value", org, "min_wechat_rate"); configNewClientRate(config, clientId, "Alipay", "alipay_rate_value", org, "min_alipay_rate"); configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); - configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate"); - configNewClientRate(config, clientId, "jd", "jd_rate_value", org, "min_jd_rate"); -// configNewClientRate(config, clientId, "hf", "hf_rate_value", org, "min_hf_rate"); configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); -// configNewClientRate(config, clientId, "Yeepay", "yeepay_rate_value", org, "min_yeepay_rate"); configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate"); - //todo 暂不更新Rpay+ 费率信息 - //rpayApi.modifySurchargeConfig(client); - } private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) { @@ -2150,8 +2095,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkModifyRate(org, configJson, "Wechat", "min_wechat_rate"); checkModifyRate(org, configJson, "Alipay", "min_alipay_rate"); checkModifyRate(org, configJson, "AlipayOnline", "min_alipayonline_rate"); - checkModifyRate(org, configJson, "jd", "min_jd_rate"); - checkModifyRate(org, configJson, "Bestpay", "min_bestpay_rate"); configJson.put("client_rate_id", rateId); configJson.put("manager_id", manager.getString("manager_id")); configJson.put("manager_name", manager.getString("username")); @@ -2162,9 +2105,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid configJson.put("ext_rates", extParams.toJSONString()); } clientRateMapper.updateConfig(configJson); -// if ("Rpay".equals(configJson.getString("rate_name"))) { -// rpayApi.modifySurchargeConfig(client); -// } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getRateName())) { return; } @@ -2174,7 +2114,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) { clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays)); } - // clientMapper.updateCleanDays(clientId, config.getCleanDays()); } private void checkModifyRate(JSONObject org, JSONObject configJson, String rateName, String rateValueKey) { @@ -2451,23 +2390,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } catch (Exception ignored) { throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); } - - try { - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - } catch (Exception ignored) { - JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days")); - client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, BigDecimal.ROUND_DOWN)); - client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); if (bankAccount == null || bankAccount.size() <= 0) { throw new BadRequestException("The Partner's Account is not config!"); @@ -3103,27 +3025,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")"); } - // List clientRate = clientRateMapper.latestConfig(client.getIntValue("client_id"), null); - // if (CollectionUtils.isEmpty(clientRate)) { - // throw new BadRequestException("The Partner's Rate is not config!"); - // } - // clientRate.forEach((p) -> { - // String rate_name = p.getString("rate_name"); - // if ("Wechat".equals(rate_name)) { - // client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // client.put("clean", "T+" + p.getString("clean_days")); - // client.put("clean_days", p.getString("clean_days")); - // } else if ("Alipay".equals(rate_name)) { - // client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } else if ("Bestpay".equals(rate_name)) { - // client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } else if ("jd".equals(rate_name)) { - // client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } else if ("AlipayOnline".equals(rate_name)) { - // client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } - // }); - JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); if (weChatRate == null) { throw new BadRequestException("The Partner's Rate is not config!"); @@ -3137,17 +3038,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (alipayRate != null) { client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } - - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); if (alipayOnlineRate != null) { client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); @@ -3252,11 +3142,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("clean_days", p.getString("clean_days")); } else if ("Alipay".equals(rate_name)) { client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } else if ("Bestpay".equals(rate_name)) { - client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } else if ("jd".equals(rate_name)) { - client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } else if ("AlipayOnline".equals(rate_name)) { + }else if ("AlipayOnline".equals(rate_name)) { client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } }); @@ -3332,16 +3218,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); if (alipayOnlineRate != null) { client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); @@ -4240,22 +4116,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); } - try { - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - } catch (Exception ignored) { - JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days")); - client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, BigDecimal.ROUND_DOWN)); - client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); if (bankAccount == null || bankAccount.size() <= 0) { throw new BadRequestException("The Partner's Account is not config!"); @@ -5885,20 +5745,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return null; } - @Override - public List listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - List applices = yeePayClientConfigMapper.findAllMerchantConfig(client.getInteger("client_id")); - if (!applices.isEmpty()) { - return applices; - } - return null; - } - @Override @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) { @@ -6159,116 +6005,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - - @Override - @Transactional - public void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - List yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id")); - if (yeepayClientConfigs != null) { - for (JSONObject yeepayClientConfig : yeepayClientConfigs) { - if (yeepayClientConfig.getIntValue("is_valid") == 1) { - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0); - } - } - } - merchantInfo.put("create_time", new Date()); - merchantInfo.put("operator", manager.getString("display_name")); - merchantInfo.put("client_id", client.getIntValue("client_id")); - merchantInfo.put("client_id", merchantInfo.getString("client_id")); -// merchantInfo.put("vouchers",merchantInfo.getJSONObject("vouchers").toJSONString()); - List directorsAll = new ArrayList<>(); - List executivesAll = new ArrayList<>(); - directorsAll.add(merchantInfo.getJSONObject("directors")); - executivesAll.add(merchantInfo.getJSONObject("executives")); - JSONObject extInfo = new JSONObject(); - extInfo.put("directors", directorsAll); - extInfo.put("executives", executivesAll); - merchantInfo.put("extinfo", extInfo.toJSONString()); - yeePayClientConfigMapper.saveMerchantConfig(merchantInfo); - JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id")); - yeepayConfig.put("company_website", merchantInfo.getString("company_website")); - yeepayConfig.put("abn", merchantInfo.getString("abn")); - yeepayConfig.put("company_name", merchantInfo.getString("company_name")); - yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone")); - yeepayConfig.put("contact_email", merchantInfo.getString("contact_email")); - yeepayConfig.put("contact_person", merchantInfo.getString("contact_person")); - SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig); - if (result.getStatus().equals("FAILED")) { - throw new BadRequestException(result.getErrorMsg()); - } - yeepayConfig.put("sub_merchant_id", result.getSubMerchantId()); - yeePayClientConfigMapper.updateSubMerchantId(yeepayConfig.getString("yeepay_config_id"), result.getMerchantId(), result.getSubMerchantId()); - client.put("yeepay_sub_merchant_id", result.getSubMerchantId()); - clientMapper.update(client); - } - - @Override - public void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - JSONObject config = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("sub_merchant_id")); - if (config != null) { - throw new BadRequestException("You had add the sub merchant id"); - } - List yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id")); - if (yeepayClientConfigs != null) { - for (JSONObject yeepayClientConfig : yeepayClientConfigs) { - if (yeepayClientConfig.getIntValue("is_valid") == 1) { - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0); - } - } - } - merchantInfo.put("client_id", client.getIntValue("client_id")); - merchantInfo.put("merchant_id", yeePayConfig.getAppKey().split("_")[1]); - merchantInfo.put("create_time", new Date()); - merchantInfo.put("is_valid", 1); - merchantInfo.put("operator", manager.getString("display_name")); - yeePayClientConfigMapper.saveMerchantConfig(merchantInfo); - client.put("yeepay_sub_merchant_id", merchantInfo.getString("sub_merchant_id")); - clientMapper.update(client); - } - - @Override - public void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("subMerchantId")); - List directorsAll = new ArrayList<>(); - List executivesAll = new ArrayList<>(); - directorsAll.add(merchantInfo.getJSONObject("directors")); - executivesAll.add(merchantInfo.getJSONObject("executives")); - JSONObject extInfo = new JSONObject(); - extInfo.put("directors", directorsAll); - extInfo.put("executives", executivesAll); - yeepayConfig.put("extinfo", extInfo.toJSONString()); - yeepayConfig.put("industry", merchantInfo.getString("industry")); - yeepayConfig.put("business_content", merchantInfo.getString("business_content")); - yeepayConfig.put("business_licence", merchantInfo.getString("business_licence")); - yeePayClientConfigMapper.update(yeepayConfig); - yeepayConfig.put("company_website", merchantInfo.getString("company_website")); - yeepayConfig.put("abn", merchantInfo.getString("abn")); - yeepayConfig.put("company_name", merchantInfo.getString("company_name")); - yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone")); - yeepayConfig.put("contact_email", merchantInfo.getString("contact_email")); - yeepayConfig.put("contact_person", merchantInfo.getString("contact_person")); - yeepayConfig.put("mode", "UPDATE"); - SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig); - if (result.getStatus().equals("FAILED")) { - throw new BadRequestException(result.getErrorMsg()); - } - } - @Override public List listMerchantIds(String clientMoniker, JSONObject manager) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -6609,7 +6345,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid ctx.setVariable("order_id", order.getString("order_id")); ctx.setVariable("amount", order.getString("total_amount")); ctx.setVariable("currency", order.getString("currency")); - ctx.setVariable("channel", getOrderChannel(order.getString("channel"))); + ctx.setVariable("channel", order.getString("channel")); String create_time = ""; if (client.getString("timezone") != null) { create_time = DateFormatUtils.format(order.getDate("create_time"), @@ -6632,16 +6368,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }).start(); } - private String getOrderChannel(String channel) { - switch (channel) { - case "hf": - return "汇付"; - case "Yeepay": - return "易宝支付"; - } - return ""; - } - @Override public void updateAllPartnerPassword(String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -7392,6 +7118,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("rpaypmt_card rate Not configured"); } JSONObject cardRate = clientRate.getJSONObject("ext_rates"); + //增加transaction_fee为null异常 + if (!cardRate.containsKey("transaction_fee") || StringUtils.isEmpty(cardRate.getString("transaction_fee"))) { + cardRate.put("transaction_fee", BigDecimal.ZERO); + } JSONObject bankAccountInfo = clientBankAccountMapper.clientBankAccounts(clientId).get(0); JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 958ddd64b..59fae1acf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -209,11 +209,6 @@ public class PartnerManageController { clientManager.updateClientRpayPaymentConfig(manager, clientMoniker, rpaySubMerchantInfo); } - @ManagerMapping(value = "/{clientMoniker}/yeepay_payment_config", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) - public void updatePartnerYeepayPaymentConfig(@PathVariable String clientMoniker, @RequestBody JSONObject yeepaySubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.updateClientYeepayPaymentConfig(manager, clientMoniker, yeepaySubMerchantInfo); - } - @ManagerMapping(value = "/{clientMoniker}/ali_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void updateAliSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject aliSubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo); @@ -810,12 +805,6 @@ public class PartnerManageController { public List listRpaySubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.listRpaySubMerchantIdApplys(manager, clientMoniker); } - - @ManagerMapping(value = "/{clientMoniker}/list_yeepay_sub_applices", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public List listYeepaySubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientManager.listYeepaySubMerchantIdApplys(manager, clientMoniker); - } - @ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager); @@ -900,16 +889,6 @@ public class PartnerManageController { clientManager.subRpayMerchantApplication(clientMoniker, merchantInfo, manager); } - @ManagerMapping(value = "/{clientMoniker}/registYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void subYeepayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.subYeepayMerchantApplication(clientMoniker, merchantInfo, manager); - } - - @ManagerMapping(value = "/{clientMoniker}/updateYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void reSubYeepayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.reSubYeepayMerchantApplication(clientMoniker, merchantInfo, manager); - } - @GetMapping("/compliance") @RequireManager(role = {ManagerRole.OPERATOR}) public JSONObject lisPartnersByCompliance(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) { @@ -932,10 +911,6 @@ public class PartnerManageController { return clientManager.cbBankPayLink(clientMoniker); } - @ManagerMapping(value = "/{clientMoniker}/addYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void subYeepayMerchantAdd(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.subYeepayMerchantAdd(clientMoniker, merchantInfo, manager); - } @GetMapping("/{clientMoniker}/cb_bankpay/link/pc") public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException { diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index 2f273da61..50c1ababd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -18,10 +18,10 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.net.util.Base64; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java index 1377d2723..2b315e57f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java @@ -26,7 +26,6 @@ public class OrgInfo { private String remark; private Double alipay_rate_value; private Double wechat_rate_value; - private Double bestpay_rate_value; private Double alipayonline_rate_value; private Double cb_bankpay_rate_value; private Double rpaypmt_card_rate_value; @@ -182,14 +181,6 @@ public class OrgInfo { this.wechat_rate_value = wechat_rate_value; } - public Double getBestpay_rate_value() { - return bestpay_rate_value; - } - - public void setBestpay_rate_value(Double bestpay_rate_value) { - this.bestpay_rate_value = bestpay_rate_value; - } - public Double getAlipayonline_rate_value() { return alipayonline_rate_value; } diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java index 6cd187b79..42a2cf925 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java @@ -339,7 +339,7 @@ public class OrgManagerImpl implements OrgManager { JSONArray rate1 = new JSONArray(); JSONArray rate2 = new JSONArray(); if(orgObject.getString("commission_type").equals(json.getString("commission_type"))){ - String[] rates = new String[]{"alipay_rate_value","wechat_rate_value","bestpay_rate_value","alipayonline_rate_value","jd_rate_value","cb_bankpay_rate_value"}; + String[] rates = new String[]{"alipay_rate_value","wechat_rate_value","alipayonline_rate_value","cb_bankpay_rate_value"}; for (String rateName: rates ){ if(StringUtils.isEmpty(orgObject.getString(rateName))){ rate1.add(rateName); diff --git a/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java b/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java index 263d0ba74..adfb62384 100644 --- a/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java +++ b/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java @@ -23,8 +23,6 @@ import java.util.Map; */ @Component public class PartnerPermissionScanner implements BeanPostProcessor, PermissionPartnerReader { - private Logger logger = LoggerFactory.getLogger(getClass()); - private Map permissionNodes = new HashMap<>(); @Override @@ -55,7 +53,6 @@ public class PartnerPermissionScanner implements BeanPostProcessor, PermissionPa PermissionNode node = new PermissionNode(controller.getSimpleName(), method.getName()); getRequestInfo(node, clazzRequestMapping, methodMapping); node.setPartnerPermissions(clazzPermission, methodPermission); - logger.debug("register permission:" + node.getFuncName() + ":" + node.getRequestId()); if (permissionNodes.containsKey(node.getFuncId())) { throw new RuntimeException("Duplicated permission function ID:" + controller.getName() + "." + method.getName()); } diff --git a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java index f67f48b4c..eaa04b71a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java +++ b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java @@ -3,8 +3,6 @@ package au.com.royalpay.payment.manage.pos.datasource; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.core.Ordered; import org.springframework.stereotype.Component; @@ -17,18 +15,14 @@ import org.springframework.stereotype.Component; @Component public class ReadOnlyConnectionInterceptor implements Ordered { - public static final Logger logger = LoggerFactory.getLogger(ReadOnlyConnectionInterceptor.class); - @Around("@annotation(readOnlyConnection)") - public Object proceed(ProceedingJoinPoint proceedingJoinPoint,ReadOnlyConnection readOnlyConnection) throws Throwable { + public Object proceed(ProceedingJoinPoint proceedingJoinPoint, ReadOnlyConnection readOnlyConnection) throws Throwable { try { - logger.info("set database connection to read only"); DbContextHolder.setDbType(DbContextHolder.DbType.SLAVE); Object result = proceedingJoinPoint.proceed(); return result; - }finally { + } finally { DbContextHolder.clearDbType(); - logger.info("restore database connection"); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java b/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java index 1c3ad966f..f271b174c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java +++ b/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java @@ -53,13 +53,6 @@ public class PromotionRootController { @GetMapping("/clients/{clientMoniker}/aggregate") public void clientPromotionRoot(@PathVariable String clientMoniker, @RequestHeader("User-Agent") String userAgent, HttpServletResponse response) { String url = null; - /*if (userAgent.toLowerCase().contains("micromessenger") ) { - url ="/promotions/clients/"+clientMoniker+"/alipay"; - } - if (userAgent.toLowerCase().contains("bestpay") ) { - url ="/promotions/clients/"+clientMoniker+"/alipay"; - - }*/ if (userAgent.toLowerCase().contains("alipayclient") ) { url ="/promotions/clients/"+clientMoniker+"/alipay"; diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java index f7655bfd9..3fda9e882 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -254,9 +254,6 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { attention.put("is_valid", 1); attention.put("enjoin_wechat", params.getBoolean("enjoin_wechat")== null ? true : params.getBoolean("enjoin_wechat")); attention.put("enjoin_alipay", params.getBoolean("enjoin_alipay")== null ? true : params.getBoolean("enjoin_alipay")); - attention.put("enjoin_bestpay", params.getBoolean("enjoin_bestpay")== null ? true : params.getBoolean("enjoin_bestpay")); - attention.put("enjoin_jd", params.getBoolean("enjoin_jd")== null ? true : params.getBoolean("enjoin_jd")); - attention.put("enjoin_hf", params.getBoolean("enjoin_hf")== null ? true : params.getBoolean("enjoin_hf")); attention.put("creation_date", params.getDate("creation_date")==null ? new Date() : params.getDate("creation_date")); attention.put("creation_by", manager.getString("manager_id")); attention.put("remark", params.getString("remark")); @@ -346,9 +343,6 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { } attentionMerchant.put("enjoin_wechat", attention.getBoolean("enjoin_wechat")); attentionMerchant.put("enjoin_alipay", attention.getBoolean("enjoin_alipay")); - attentionMerchant.put("enjoin_bestpay", attention.getBoolean("enjoin_bestpay")); - attentionMerchant.put("enjoin_jd", attention.getBoolean("enjoin_jd")); - attentionMerchant.put("enjoin_hf", attention.getBoolean("enjoin_hf")); attentionMerchant.put("last_update_date", new Date()); attentionMerchant.put("last_update_by", manager.getString("manager_id")); riskAttentionMerchantsAMapper.update(attentionMerchant); diff --git a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java index 3e3694e77..cf6447bbe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java @@ -1,11 +1,9 @@ package au.com.royalpay.payment.manage.support.attachment.web; -import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import com.alibaba.fastjson.JSONObject; -import com.yeepay.yop.sdk.service.kj.model.FileUploadResult; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -22,8 +20,6 @@ import java.io.IOException; public class AttachmentController { @Resource private AttachmentClient attachmentClient; - @Resource - private YeePayClient yeePayClient; @PostMapping("/files") @RequirePartner @@ -32,13 +28,6 @@ public class AttachmentController { return attachmentClient.uploadFile(file,false); } - @PostMapping("/yeepayFiles") - @RequirePartner - @RequireManager - public FileUploadResult uploadYeepayImage(@RequestParam MultipartFile file) throws IOException { - return yeePayClient.uploadFile(file.getOriginalFilename(),"VOUCHER",file.getInputStream()); - } - @PostMapping("/riskFiles") public JSONObject uploadRiskImage(@RequestParam MultipartFile file) throws IOException { return attachmentClient.uploadFile(file,false); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 8982082ab..6183230d5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -26,7 +26,6 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; -import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; @@ -175,14 +174,6 @@ public class TradeLogServiceImpl implements TradeLogService { if (timezone != null) { TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time"); } - if (account != null) { - PartnerRole role = PartnerRole.getRole(account.getIntValue("role")); - if (role == PartnerRole.MANAGER || role == PartnerRole.ADMIN) { - for (JSONObject log : logs) { - log.put("audition", !refundAuditionMapper.listAuditingRefundsOfOrder(log.getString("order_id")).isEmpty()); - } - } - } JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject analysis = orderMapper.analysisOrders(params); result.put("analysis", analysis); @@ -212,14 +203,6 @@ public class TradeLogServiceImpl implements TradeLogService { if (timezone != null) { TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time"); } - if (account != null) { - PartnerRole role = PartnerRole.getRole(account.getIntValue("role")); - if (role == PartnerRole.MANAGER || role == PartnerRole.ADMIN) { - for (JSONObject log : logs) { - log.put("audition", !refundAuditionMapper.listAuditingRefundsOfOrder(log.getString("order_id")).isEmpty()); - } - } - } JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject analysis = orderMapper.analysisOrders(params); result.put("analysis", analysis); @@ -691,16 +674,6 @@ public class TradeLogServiceImpl implements TradeLogService { .filter(log -> "Alipay".equals(log.getString("channel"))) .map(log -> getSymbol(log).multiply(log.getBigDecimal("channel_surcharge"))) .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); - analysis.put("jd_fee", logs.parallelStream() - .filter(log -> log.getBigDecimal("settle_amount") != null) - .filter(log -> "jd".equals(log.getString("channel"))) - .map(log -> getSymbol(log).multiply(log.getBigDecimal("channel_surcharge"))) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); - analysis.put("bestpay_fee", logs.parallelStream() - .filter(log -> log.getBigDecimal("settle_amount") != null) - .filter(log -> "Bestpay".equals(log.getString("channel"))) - .map(log -> getSymbol(log).multiply(log.getBigDecimal("channel_surcharge"))) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); analysis.put("alipay_online_fee", logs.parallelStream() .filter(log -> log.getBigDecimal("settle_amount") != null) .filter(log -> "AlipayOnline".equals(log.getString("channel"))) @@ -710,6 +683,9 @@ public class TradeLogServiceImpl implements TradeLogService { } private BigDecimal getSymbol(JSONObject log) { + if (!log.containsKey("transaction_fee") || StringUtils.isEmpty(log.getString("transaction_fee"))) { + log.put("transaction_fee", BigDecimal.ZERO); + } return "Credit".equals(log.getString("transaction_type")) || "Settlement".equals(log.getString("channel")) ? BigDecimal.ONE : BigDecimal.valueOf(-1); } @@ -741,8 +717,6 @@ public class TradeLogServiceImpl implements TradeLogService { parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO)); parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO)); parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO)); - parmerters.put("bestpay_fee", takeDecimalOrDefault(analysis, "bestpay_fee", BigDecimal.ZERO)); - parmerters.put("jd_fee", takeDecimalOrDefault(analysis, "jd_fee", BigDecimal.ZERO)); parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO)); parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO)); parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO)); @@ -816,8 +790,6 @@ public class TradeLogServiceImpl implements TradeLogService { parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO)); parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO)); parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO)); - parmerters.put("bestpay_fee", takeDecimalOrDefault(analysis, "bestpay_fee", BigDecimal.ZERO)); - parmerters.put("jd_fee", takeDecimalOrDefault(analysis, "jd_fee", BigDecimal.ZERO)); parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO)); parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO)); parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO)); @@ -838,6 +810,10 @@ public class TradeLogServiceImpl implements TradeLogService { BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO; BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO; BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); + //增加transaction_fee为null异常 + if (!item.containsKey("transaction_fee") || StringUtils.isEmpty(item.getString("transaction_fee"))) { + item.put("transaction_fee", BigDecimal.ZERO); + } BigDecimal transactionFee = item.getBigDecimal("transaction_fee"); BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax); @@ -1368,52 +1344,6 @@ public class TradeLogServiceImpl implements TradeLogService { return res; } - public static JSONObject bestpayInfo() { - JSONObject res = new JSONObject(); - res.put("bw", "China Telecom BestPay Co.,Ltd"); - res.put("bx", "BestPay"); - res.put("by", ""); - res.put("bz", "BestPay"); - res.put("ca", "Tianhe District/Guangzhou"); - res.put("cb", "GUANGDONG PROVINCE"); - res.put("cc", "510000"); - res.put("cd", "CHINA"); - res.put("ce", "10F, Central Tower, No. 5 Xiancun Road, Zhu Jiang New Town"); - res.put("cf", "Tianhe District/Guangzhou"); - res.put("cg", "GUANGDONG PROVINCE"); - res.put("ch", "51000"); - res.put("ci", "CHINA"); - res.put("cj", "8617701910171"); - res.put("ck", "cenjianhu@bestpay.com.cn"); - res.put("cl", "Payment Services"); - res.put("cm", ""); - res.put("cn", "Company"); - return res; - } - - public static JSONObject jdpayInfo() { - JSONObject res = new JSONObject(); - res.put("bw", "Chinabank Payment Technology Co. Ltd."); - res.put("bx", "Jing Dong Pay"); - res.put("by", ""); - res.put("bz", "JDPay"); - res.put("ca", "Da Xing District, Beijing"); - res.put("cb", "Beijing"); - res.put("cc", "100111"); - res.put("cd", "CHINA"); - res.put("ce", "Block A, No.18 Kechang 11 Street, BDA, China."); - res.put("cf", "Da Xing District, Beijing"); - res.put("cg", "Beijing"); - res.put("ch", "100111"); - res.put("ci", "CHINA"); - res.put("cj", "861089186958"); - res.put("ck", "luoqi1@jd.com"); - res.put("cl", "Payment Services"); - res.put("cm", ""); - res.put("cn", "Company"); - return res; - } - @Override public void exportTransLog(TradeLogQuery query, JSONObject manager, HttpServletResponse httpResponse) { // List ausTracData = austracDataMapper.getAustracData(query.toParams(null)); @@ -1424,7 +1354,7 @@ public class TradeLogServiceImpl implements TradeLogService { // }else { // ausTracData = austracDataMapper.getAustracDataNew(query.toParams(null)); // } - if (!ausTracData.isEmpty() && ausTracData.size() > 0) { + if (!ausTracData.isEmpty()) { for (JSONObject data : ausTracData) { if (data.getIntValue("client_id") == 0) { data.putAll(tunnel()); @@ -1435,12 +1365,6 @@ public class TradeLogServiceImpl implements TradeLogService { if (StringUtils.isNotBlank(data.getString("channel")) && "AlipayOnline".equals(data.getString("channel"))) { data.putAll(alipayInfo()); } - if (StringUtils.isNotBlank(data.getString("channel")) && "Bestpay".equals(data.getString("channel"))) { - data.putAll(bestpayInfo()); - } - if (StringUtils.isNotBlank(data.getString("channel")) && "jd".equals(data.getString("channel"))) { - data.putAll(jdpayInfo()); - } } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index e2228c0e9..9a7735294 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -109,24 +109,26 @@ 0 AND r.t < o.customer_payment_amount - THEN 6 - WHEN r.t >= o.customer_payment_amount - THEN 7 - END - WHERE o.order_id = #{order_id} + + UPDATE pmt_orders o + LEFT JOIN ( + SELECT + order_id, + IFNULL(SUM(amount), 0) t + FROM pmt_refunds + WHERE status IN (2, 4, 5) AND order_id = #{order_id} + GROUP BY order_id) r ON r.order_id = o.order_id + SET o.refund_amount = ifnull(r.t, 0), + o.status = CASE + WHEN IFNULL(r.t, 0) = 0 + THEN o.status + WHEN r.t > 0 AND r.t < o.customer_payment_amount + THEN 6 + WHEN r.t >= o.customer_payment_amount + THEN 7 + END + WHERE o.order_id = #{order_id} + ]]> @@ -136,9 +138,11 @@ @@ -205,7 +209,7 @@ AND - oo.source = #{source} + oo.source = #{source} ) o @@ -487,6 +491,8 @@ and o.customer_id = #{customer_id} LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit' + and t.create_time >= #{from} + and t.create_time < #{to} @@ -513,7 +519,7 @@ and o.client_order_id = #{search_text} - and binary dev_id=#{dev_id} + and binary dev_id=#{dev_id} and o.gateway in #{gateway} @@ -523,7 +529,6 @@ and o.create_time >= #{from} and o.create_time < #{to} - and date(o.create_time)=date(#{date}) and o.status=#{std} @@ -592,9 +597,11 @@ count(DISTINCT l.client_id) clients, ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.display_amount,0)),0) display_amount, - ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.incremental_surcharge,0)),0) + ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and + l.currency!='CNY',l.incremental_surcharge,0)),0) incremental_surcharge, - ifnull(sum(if(l.transaction_type='Debit' and l.refund_id is not null and l.currency!='CNY',l.incremental_surcharge,0)),0) + ifnull(sum(if(l.transaction_type='Debit' and l.refund_id is not null and + l.currency!='CNY',l.incremental_surcharge,0)),0) refund_incremental_surcharge, ifnull(sum(if(l.currency!='CNY',l.incremental_surcharge,0)),0) all_incremental_surcharge, @@ -625,6 +632,8 @@ INNER JOIN pmt_transactions t on t.order_id=o.order_id and (t.transaction_type='Credit' or t.refund_id is not null) + and t.create_time >= #{from} + and t.create_time < #{to} @@ -669,7 +678,6 @@ and p.org_id=#{org_id} and o.create_time >= #{from} and o.create_time < #{to} - and date(o.create_time)=date(#{date}) and binary o.dev_id=#{dev_id} AND t.incremental_surcharge >0 @@ -752,14 +760,16 @@ = 5 AND o.customer_payment_amount > 0 + + SELECT + o.order_id, + o.channel + FROM pmt_orders o + WHERE o.order_id NOT IN ( + SELECT DISTINCT order_id + FROM pmt_transactions + WHERE transaction_type = 'Credit') AND o.status >= 5 AND o.customer_payment_amount > 0 + ]]> @@ -929,7 +939,7 @@ t.exchange_rate, t.clearing_status, t.settle_amount, - t.clearing_status = 2 pre_auth, + t.clearing_status = 2 pre_auth, IF( t.remark like '%RYCBSM%',TRUE,FALSE) as geek_apply_deduction from pmt_orders o left join pmt_transactions t on t.order_id=o.order_id and t.channel!='Settlement' @@ -1053,23 +1063,25 @@ -
%
- -
-
- No more than 5.0% -
-
- No less than 0.6% -
-
- Required Field -
-
- - - -
- -
-
- -
%
-
-
-
- No more than 5.0% -
-
- No less than 0.6% -
-
- Required Field -
-
- -
-
- -
diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index ad5e3c2b7..59c8f5422 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -56,14 +56,6 @@

-
- -
-

- {{paymentInfo.yeepay_sub_merchant_id||'初始化'}} -

-
-
@@ -597,16 +589,6 @@ switch-change="toggleRequireRemark()">
-
- -
- -
-
diff --git a/src/main/ui/static/payment/product/templates/partner_product.html b/src/main/ui/static/payment/product/templates/partner_product.html index ba9f8ffb2..c1e9c654c 100644 --- a/src/main/ui/static/payment/product/templates/partner_product.html +++ b/src/main/ui/static/payment/product/templates/partner_product.html @@ -14,10 +14,6 @@ class="channel-icon-mid"> - -
  • @@ -42,4 +38,4 @@ - \ No newline at end of file + diff --git a/src/main/ui/static/payment/tradelog/templates/balance_report.html b/src/main/ui/static/payment/tradelog/templates/balance_report.html index c54962cbe..2b284e8f3 100644 --- a/src/main/ui/static/payment/tradelog/templates/balance_report.html +++ b/src/main/ui/static/payment/tradelog/templates/balance_report.html @@ -154,18 +154,8 @@ ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}" ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline | - BestPay | - JD Pay | - HF Pay | RPay + | - Yeepay | - LakalaPay | Card Payment | AlipayOnline | - BestPay | - JD Pay | - HF Pay | RPay + | - Yeepay | - LakalaPay | Card Payment | - - - - - -
  • -
  • - - - -
  • -
  • - - - -
  • -
  • - - - -
  • -
  • - - - -
  • -
  • - - - -
  • diff --git a/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html index b715730be..49fa74723 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html @@ -208,18 +208,8 @@ ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}" ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline | - BestPay | - JD Pay | - HF Pay | RPay+ | - Yeepay | - LakalaPay | Card Payment | - - {{trade.order_id}} @@ -170,4 +168,4 @@ - \ No newline at end of file + diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index 8d84298cd..bdf27ebc7 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -284,8 +284,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; }]); app.controller('newRiskCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog) { - $scope.attentions = {"enjoin_wechat": true,"enjoin_alipay": true,"enjoin_bestpay": true, - "enjoin_jd": true,"enjoin_hf": true} + $scope.attentions = {"enjoin_wechat": true,"enjoin_alipay": true} $scope.save = function (attentions) { var params = angular.copy(attentions); $http.post('/sys/risk/attention/'+ attentions.client_moniker, params).then(function () { @@ -374,4 +373,4 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }); return app; -}); \ No newline at end of file +}); diff --git a/src/main/ui/static/risk/templates/attention_merchants.html b/src/main/ui/static/risk/templates/attention_merchants.html index 6d98cbd24..99370c5f6 100644 --- a/src/main/ui/static/risk/templates/attention_merchants.html +++ b/src/main/ui/static/risk/templates/attention_merchants.html @@ -73,9 +73,6 @@ Wechat Alipay - Bestpay - JD - HF - \ No newline at end of file + diff --git a/src/main/ui/static/risk/templates/risk_add.html b/src/main/ui/static/risk/templates/risk_add.html index 0911e621e..3d83790ce 100644 --- a/src/main/ui/static/risk/templates/risk_add.html +++ b/src/main/ui/static/risk/templates/risk_add.html @@ -36,15 +36,6 @@ - - -

    @@ -58,4 +49,4 @@
    - \ No newline at end of file + diff --git a/src/main/ui/static/risk/templates/risk_merchant_edit.html b/src/main/ui/static/risk/templates/risk_merchant_edit.html index 49b7d7a06..106b4f2d3 100644 --- a/src/main/ui/static/risk/templates/risk_merchant_edit.html +++ b/src/main/ui/static/risk/templates/risk_merchant_edit.html @@ -28,15 +28,6 @@ - - -

    @@ -50,4 +41,4 @@
    - \ No newline at end of file + diff --git a/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java b/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java index 52585cd63..8d01280c3 100644 --- a/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java @@ -1,7 +1,7 @@ package au.com.royalpay.payment.manage.process.aes; import au.com.royalpay.payment.tools.codec.AESCrypt; -import org.apache.commons.net.util.Base64; +import org.apache.commons.codec.binary.Base64; import org.junit.Test; import java.nio.charset.StandardCharsets; diff --git a/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java b/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java index 12160b5d6..1e6f60251 100644 --- a/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java @@ -6,8 +6,8 @@ import au.com.royalpay.payment.tools.codec.AESCrypt; import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils; import com.alibaba.fastjson.JSONObject; import com.github.stuxuhai.jpinyin.PinyinException; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.net.util.Base64; import org.junit.Test; import javax.crypto.BadPaddingException; diff --git a/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java b/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java index e10e6aac4..7a44b32aa 100644 --- a/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java @@ -1,11 +1,10 @@ package au.com.royalpay.payment.manage.valid; import au.com.royalpay.payment.manage.support.serverless.qcloud.support.ServerLessFunctionInvokeRequest; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.net.util.Base64; import org.junit.Test; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.http.ResponseEntity;