浏览代码

update 去除无用配置

周箭河 5 年之前
父节点
当前提交
4e9fe0b362

+ 0 - 55
mec-biz/src/main/java/com/ym/mec/biz/service/PayService.java

@@ -9,56 +9,6 @@ import java.util.Map;
  */
 
 public interface PayService {
-
-
-    /**
-     * 返回订单提交数据
-     *
-     * @param amount       金额
-     * @param orderNo      订单编号
-     * @param notifyUrl    异步通知地址
-     * @param returnUrl    支付返回地址
-     * @param orderSubject 订单标题
-     * @param orderBody    订单内容
-     * @return
-     * @throws Exception
-     */
-    Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId) throws Exception;
-
-
-    /**
-     *
-     * @param amount BigDecimal 支付金额
-     * @param orderNo String 订单号
-     * @param notifyUrl String 异步通知地址
-     * @param returnUrl string 支付返回地址
-     * @param orderSubject String 订单标题
-     * @param orderBody String 订单内容
-     * @param userId int 用户id
-     * @param fee 各种费用
-     * @param organId 机构id
-     * @return
-     * @throws Exception
-     */
-    Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId,Map<String,BigDecimal> fee,Integer organId) throws Exception;
-
-    /**
-     *
-     * @param amount BigDecimal 支付金额
-     * @param orderNo String 订单号
-     * @param notifyUrl String 异步通知地址
-     * @param returnUrl string 支付返回地址
-     * @param orderSubject String 订单标题
-     * @param orderBody String 订单内容
-     * @param userId int 用户id
-     * @param fee Map 各种费用
-     * @param organId int 机构id
-     * @return
-     * @throws Exception
-     */
-    Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId,Map<String,BigDecimal> fee,Integer organId,String receiver) throws Exception;
-
-
     /**
      *
      * @param amount 支付金额
@@ -73,9 +23,4 @@ public interface PayService {
      * @throws Exception
      */
     Map<String, Object> getPayMap(BigDecimal amount,BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody,Integer organId,String receiver) throws Exception;
-
-
-
-    Map query(String orderNo) throws Exception;
-
 }

+ 0 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -189,9 +189,6 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
 
     String PRACTICE_FREE_APPLY_EXPIRE_DATE = "practice_free_apply_expire_date";
 
-    //零星支付收到深圳大雅的分部
-    public static final String SZ_DA_YA_ORGAN_IDS = "sz_da_ya_organ_ids";
-
     /**
      * @return com.ym.mec.biz.dal.entity.SysConfig
      * @params paramName

+ 0 - 336
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -33,216 +33,15 @@ import java.util.stream.Collectors;
  */
 @Service
 public class PayServiceImpl implements PayService {
-
-    @Autowired
-    private UnionPayFeignService unionPayFeignService;
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
-    private SysAccountService sysAccountService;
-    @Autowired
-    private MusicGroupDao musicGroupDao;
-    @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
     private SysPaymentConfigService sysPaymentConfigService;
     @Autowired
-    private RedisTemplate<String, String> redisTemplate;
-    @Autowired
     private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
 
-
-    public static void main(String[] args) {
-        String baseApiUrl = "http://dev.dayaedu.com";
-
-        try {
-            Map<String, Object> payMap = new PayServiceImpl().getPayMap(
-                    BigDecimal.TEN,
-                    BigDecimal.ONE,
-                    "5435253245",
-                    baseApiUrl + "/api-student/studentOrder/notify",
-                    baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=5435253245",
-                    "对外课程组购买",
-                    "测试购买",
-                    1,
-                    null
-            );
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 返回订单提交数据
-     *
-     * @param amount       金额
-     * @param orderNo      订单编号
-     * @param notifyUrl    异步通知地址
-     * @param returnUrl    支付返回地址
-     * @param orderSubject 订单标题
-     * @param orderBody    订单内容
-     * @return
-     * @throws Exception
-     */
-    @Override
-    public Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId) throws Exception {
-
-        String company = "daya";
-
-        //支付通道决策
-        Map<String, Object> unionPay = new HashMap<>();
-        SysAccount routingAccount = getRoutingAccount(company, amount);
-        PaymentChannelTypeEnum paymentChannelType = PaymentChannelTypeEnum.COM;
-        if (routingAccount.getType().equals("PER")) {
-            paymentChannelType = PaymentChannelTypeEnum.PER;
-        }
-        Map<String, Object> payMap = null;
-        String type = null;
-        if (routingAccount.getChannel().equals("YQPAY")) {
-            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), routingAccount.getRoutingMerNo());
-            type = "YQPAY";
-        } else {
-            payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), null);
-            type = "ADAPAY";
-        }
-
-        unionPay.put("orderNo", orderNo);
-        unionPay.put("type", type);
-        unionPay.put("paymentChannelType", paymentChannelType);
-        unionPay.put("payMap", payMap);
-        return unionPay;
-    }
-
-    @Override
-    public Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId, Map<String, BigDecimal> fee, Integer organId) throws Exception {
-        String company = "daya";
-        //直接收到深圳的分部
-        String sDaYaOrganIds = sysConfigDao.findConfigValue(SysConfigService.SZ_DA_YA_ORGAN_IDS);
-        if (StringUtils.isNotBlank(sDaYaOrganIds)) {
-            List<String> sDaYaOrganIdList = Arrays.asList(sDaYaOrganIds.split(","));
-            if (sDaYaOrganIdList.contains(organId.toString())) {
-                company = "sdaya";
-            }
-        }
-        //支付通道决策
-        Map<String, Object> unionPay = new HashMap<>();
-        Map<String, BigDecimal> routingFee = getRoutingFee(company, amount, fee, organId);
-        List<SysAccount> accounts = getRoutingAccount(routingFee, company, organId);
-        SysAccount routingAccount = accounts.get(0);
-
-        Map<String, Object> payMap = null;
-        String type = null;
-        List<Map<String, Object>> tempRoutingList = new ArrayList<>();
-        for (SysAccount account : accounts) {
-            Map<String, Object> routingList = new HashMap<>();
-            if (account.getChannel().equals("YQPAY")) {
-                routingList.put("routingMerNo", account.getRoutingMerNo());//分佣账户
-                routingList.put("routingFee", account.getRoutingFee().subtract((account.getRoutingFee().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP))); //分佣金额
-            } else {
-                routingList.put("member_id", account.getMerNo());//分佣账户
-                routingList.put("amount", amount);//分佣金额
-                routingList.put("fee_flag", "Y"); //承担手续费
-            }
-            tempRoutingList.add(routingList);
-        }
-
-        String routingMerNos;
-        if (routingAccount.getChannel().equals("YQPAY")) {
-            if (accounts.size() == 1 && routingAccount.getMerNo().equals(routingAccount.getRoutingMerNo())) {
-                tempRoutingList = null;
-            }
-            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), tempRoutingList);
-            type = "YQPAY";
-            routingMerNos = accounts.stream().map(sysAccount -> sysAccount.getRoutingMerNo()).collect(Collectors.joining(","));
-        } else {
-            if (accounts.size() == 1 && routingAccount.getRoutingOrganId().equals(organId)) {
-                tempRoutingList = null;
-            }
-            payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), tempRoutingList);
-            type = "ADAPAY";
-            routingMerNos = accounts.stream().map(SysAccount::getMerNo).collect(Collectors.joining(","));
-        }
-
-
-        unionPay.put("orderNo", orderNo);
-        unionPay.put("type", type);
-        unionPay.put("payMap", payMap);
-        unionPay.put("routingFee", routingFee);
-        unionPay.put("routingMerNos", routingMerNos);
-        unionPay.put("routingOrganId", accounts.get(0).getRoutingOrganId());
-        return unionPay;
-    }
-
-    @Override
-    public Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer userId, Map<String, BigDecimal> fee, Integer organId, String receiver) throws Exception {
-        String company = "daya";
-        //指定收款方
-        Set<String> companies = new HashSet<>();
-        companies.add("sdaya");
-        companies.add("tq");
-        if (companies.contains(receiver)) {
-            company = receiver;
-            receiver = null;
-        } else {
-            receiver = null;
-        }
-
-        //直接收到深圳的分部
-        String sDaYaOrganIds = sysConfigDao.findConfigValue(SysConfigService.SZ_DA_YA_ORGAN_IDS);
-        if (StringUtils.isNotBlank(sDaYaOrganIds)) {
-            List<String> sDaYaOrganIdList = Arrays.asList(sDaYaOrganIds.split(","));
-            if (sDaYaOrganIdList.contains(organId.toString())) {
-                company = "sdaya";
-            }
-        }
-
-        //支付通道决策
-        Map<String, Object> unionPay = new HashMap<>();
-        Map<String, BigDecimal> routingFee = getRoutingFee(company, amount, fee, organId, receiver);
-        List<SysAccount> accounts = getRoutingAccount(routingFee, company, organId);
-        SysAccount routingAccount = accounts.get(0);
-
-        Map<String, Object> payMap = null;
-        String type = null;
-        List<Map<String, Object>> tempRoutingList = new ArrayList<>();
-        for (SysAccount account : accounts) {
-            Map<String, Object> routingList = new HashMap<>();
-            if (account.getChannel().equals("YQPAY")) {
-                routingList.put("routingMerNo", account.getRoutingMerNo());//分佣账户
-                routingList.put("routingFee", account.getRoutingFee().subtract((account.getRoutingFee().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP))); //分佣金额
-            } else {
-                routingList.put("member_id", account.getMerNo());//分佣账户
-                routingList.put("amount", account.getRoutingFee());//分佣金额
-                routingList.put("fee_flag", "Y"); //承担手续费
-            }
-            tempRoutingList.add(routingList);
-        }
-
-        String routingMerNos;
-        if (routingAccount.getChannel().equals("YQPAY")) {
-            if (accounts.size() == 1 && routingAccount.getMerNo().equals(routingAccount.getRoutingMerNo())) {
-                tempRoutingList = null;
-            }
-            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), tempRoutingList);
-            type = "YQPAY";
-            routingMerNos = accounts.stream().map(SysAccount::getRoutingMerNo).collect(Collectors.joining(","));
-        } else {
-            if (accounts.size() == 1 && routingAccount.getRoutingOrganId().equals(organId)) {
-                tempRoutingList = null;
-            }
-            payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo(), tempRoutingList);
-            type = "ADAPAY";
-            routingMerNos = accounts.stream().map(SysAccount::getMerNo).collect(Collectors.joining(","));
-        }
-        unionPay.put("orderNo", orderNo);
-        unionPay.put("type", type);
-        unionPay.put("payMap", payMap);
-        unionPay.put("routingFee", routingFee);
-        unionPay.put("routingMerNos", routingMerNos);
-        unionPay.put("routingOrganId", accounts.get(0).getRoutingOrganId());
-        return unionPay;
-    }
-
     @Override
     public Map<String, Object> getPayMap(BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer organId, String receiver) throws Exception {
         String usePaymentConfig = sysConfigDao.findConfigValue("use_payment_config");
@@ -564,139 +363,4 @@ public class PayServiceImpl implements PayService {
         return unionPay;
     }
 
-    @Override
-    public Map<String, Object> query(String orderNo) throws Exception {
-        return new UnionPay(unionPayFeignService).query(orderNo);
-    }
-
-    /**
-     * 获取收款账户
-     *
-     * @param company
-     * @param money
-     * @return
-     */
-    private SysAccount getRoutingAccount(String company, BigDecimal money) {
-        SysAccount routingAccount = null;
-        int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
-        //前几笔收入私户
-        int nums = Integer.parseInt(sysConfigDao.findConfigValue("per_account_nums"));
-
-        String type = null;
-        String channel = null;
-        int rem = (payOrderNums + 1) % 10;
-        if (rem > 0 && rem <= nums) { //私人账户
-            channel = sysConfigDao.findConfigValue("per_account_channel");
-            type = "PER";
-        } else {
-            channel = sysConfigDao.findConfigValue("com_account_channel");
-            type = "COM";
-        }
-        if (company.equals("yaming")) {
-            type = "PER";
-        }
-        SysAccount account = sysAccountService.getOneAccount(company, channel, type, null);
-
-        return account;
-    }
-
-    /**
-     * 获取收款账户
-     *
-     * @param routingFee
-     * @param company
-     * @return
-     */
-    private List<SysAccount> getRoutingAccount(Map<String, BigDecimal> routingFee, String company, Integer organId) {
-        String type = "";
-        if (routingFee.get("COM").compareTo(BigDecimal.ZERO) > 0 && routingFee.get("PER").compareTo(BigDecimal.ZERO) > 0) {
-            type = "COM,PER";
-        } else if (routingFee.get("COM").compareTo(BigDecimal.ZERO) > 0 && routingFee.get("PER").compareTo(BigDecimal.ZERO) == 0) {
-            type = "COM";
-        } else if (routingFee.get("COM").compareTo(BigDecimal.ZERO) == 0 && routingFee.get("PER").compareTo(BigDecimal.ZERO) > 0) {
-            type = "PER";
-        }
-        List<SysAccount> accounts = new ArrayList<>();
-        if (sysConfigDao.findConfigValue("payment_channel").equals("ADAPAY")) {
-            BigDecimal amount = routingFee.get("COM").add(routingFee.get("PER"));
-            routingFee.put("COM", amount);
-            routingFee.put("PER", BigDecimal.ZERO);
-            accounts = sysAccountService.getAdaAccount(organId, "ADAPAY", amount);
-        } else {
-            accounts = sysAccountService.getAccount(company, "YQPAY", type, null);
-        }
-
-        for (SysAccount account : accounts) {
-            if (account.getType().equals("COM")) {
-                account.setRoutingFee(routingFee.get("COM"));
-            } else {
-                account.setRoutingFee(routingFee.get("PER"));
-            }
-        }
-        return accounts;
-    }
-
-    /**
-     * 获取分佣金额
-     *
-     * @param fee
-     * @param organId
-     * @return
-     */
-    private Map<String, BigDecimal> getRoutingFee(String company, BigDecimal amount, Map<String, BigDecimal> fee, Integer organId) {
-        Map<String, BigDecimal> routingFee = new HashMap<>(2);
-        routingFee.put("COM", BigDecimal.ZERO);
-        routingFee.put("PER", BigDecimal.ZERO);
-        if (company.equals("yaming")) {
-            routingFee.put("PER", amount);
-            return routingFee;
-        }
-
-
-        int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
-        //前几笔收入私户
-        int nums = Integer.parseInt(sysConfigDao.findConfigValue("per_account_nums"));
-
-        String type = null;
-        int rem = (payOrderNums + 1) % 10;
-        if (rem > 0 && rem <= nums) { //私人账户
-            type = "PER";
-        } else {
-            type = "COM";
-        }
-        routingFee.put(type, amount);
-        return routingFee;
-    }
-
-
-    private Map<String, BigDecimal> getRoutingFee(String company, BigDecimal amount, Map<String, BigDecimal> fee, Integer organId, String receiver) {
-        Map<String, BigDecimal> routingFee = new HashMap<>(2);
-        routingFee.put("COM", BigDecimal.ZERO);
-        routingFee.put("PER", BigDecimal.ZERO);
-        if (company.equals("yaming")) {
-            routingFee.put("PER", amount);
-            return routingFee;
-        }
-
-        if (receiver != null) {
-            routingFee.put(receiver, amount);
-            return routingFee;
-        }
-
-        int payOrderNums = studentPaymentOrderService.findPayOrderNum(); //获取支付中和成功的订单数
-        //前几笔收入私户
-        int nums = Integer.parseInt(sysConfigDao.findConfigValue("per_account_nums"));
-
-        String type = null;
-        int rem = (payOrderNums + 1) % 10;
-        if (rem > 0 && rem <= nums) { //私人账户
-            type = "PER";
-        } else {
-            type = "COM";
-        }
-        routingFee.put(type, amount);
-
-        return routingFee;
-    }
-
 }