diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java index 32fc48a..1238883 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java @@ -44,6 +44,8 @@ public class LaKaLaLedgerService { private BsMerService merService; @Resource private BsMerAttachService merAttachService; + @Resource + private BsMerPlatformNoService merPlatformNoService; /** * 商户分账业务开通申请 @@ -57,8 +59,8 @@ public class LaKaLaLedgerService { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 商户 - MerBasisModel merDetail = merService.getMerDetail(merLedger.getMerId()); - if (merDetail == null) { + BsMer mer = merService.getMer(merLedger.getMerId()); + if (mer == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } @@ -71,9 +73,9 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", mer.getOrgNo()); map.put("merCupNo", merLedger.getCupNo()); - map.put("contactMobile", merDetail.getRegPhone()); + map.put("contactMobile", mer.getRegPhone()); map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); map.put("splitEntrustFileName", merLedger.getSplitEntrustFileName()); // 转换成bas64 @@ -118,11 +120,10 @@ public class LaKaLaLedgerService { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 商户 - MerBasisModel merDetail = merService.getMerDetail(merLedger.getMerId()); - if (merDetail == null) { + BsMer mer = merService.getMer(merLedger.getMerId()); + if (mer == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } - Map commonParam = new HashMap<>(); commonParam.put("reqTime", DateUtil.format(new Date(), "yyyyMMddHHmmss")); commonParam.put("version", "1.0.0"); @@ -132,10 +133,10 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", mer.getOrgNo()); map.put("receiverNo", merLedger.getReceiverNo()); map.put("merCupNo", merLedger.getCupNo()); - map.put("contactMobile", merDetail.getRegPhone()); + map.put("contactMobile", mer.getRegPhone()); map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); map.put("splitEntrustFileName", merLedger.getSplitEntrustFileName()); // 转换成bas64 @@ -183,8 +184,8 @@ public class LaKaLaLedgerService { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 商户 - MerBasisModel merDetail = merService.getMerDetail(merLedger.getId()); - if (merDetail == null) { + BsMer mer = merService.getMer(merLedger.getId()); + if (mer == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } @@ -197,9 +198,9 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", mer.getOrgNo()); map.put("merCupNo", merLedger.getCupNo()); - map.put("contactMobile", merDetail.getRegPhone()); + map.put("contactMobile", mer.getRegPhone()); map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); map.put("splitEntrustFileName", merLedger.getSplitEntrustFileName()); // map.put("splitEntrustFilePath", saasCommon.fileUpload(new File(CommonSysConst.getSysConfig().getFile_url() +"/"+ merLedger.getSplitEntrustFilePath()), "SPLIT_ENTRUST_FILE", "0").getString("url")); @@ -244,6 +245,15 @@ public class LaKaLaLedgerService { * @return */ public JSONObject queryLedgerMer(String merCupNo) { + BsMerPlatformNo merPlatform = merPlatformNoService.getPlatformNoByCupNo(merCupNo); + if (merPlatform == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户号"); + } + // 商户 + BsMer mer = merService.getMer(merPlatform.getMerId()); + if (mer == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); + } Map commonParam = new HashMap<>(); commonParam.put("reqTime", DateUtil.format(new Date(), "yyyyMMddHHmmss")); commonParam.put("version", "1.0.0"); @@ -253,7 +263,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", mer.getOrgNo()); map.put("merCupNo", merCupNo); commonParam.put("reqData", map); @@ -290,7 +300,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", merDetail.getOrgNo()); map.put("receiverName", merDetail.getMerName()); map.put("contactMobile", merDetail.getRegPhone()); map.put("acctTypeCode", merDetail.getMerSettleAcct().getSettleType().equals(MerSettleType.status1.getNumber())?57:58);// 57:对公 58:对私 @@ -355,7 +365,7 @@ public class LaKaLaLedgerService { } /** - * 创建分账接收方 + * 修改分账接收方 */ public void updateLedgerReceiver(Long merId) { // 商户 @@ -371,7 +381,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", merDetail.getOrgNo()); map.put("receiverNo", "1"); map.put("receiverName", merDetail.getMerName()); map.put("contactMobile", merDetail.getRegPhone()); @@ -432,6 +442,11 @@ public class LaKaLaLedgerService { if (merLedgerReceiver == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到分账关系"); } + // 商户 + BsMer mer = merService.getMer(merLedgerReceiver.getMerId()); + if (mer == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); + } Map commonParam = new HashMap<>(); commonParam.put("reqTime", DateUtil.format(new Date(), "yyyyMMddHHmmss")); commonParam.put("version", "1.0.0"); @@ -440,7 +455,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", mer.getOrgNo()); map.put("merCupNo", merLedgerReceiver.getCupNo()); map.put("receiverNo", merLedgerReceiver.getReceiverNo()); @@ -488,6 +503,11 @@ public class LaKaLaLedgerService { if (merLedgerReceiver == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到分账关系"); } + // 商户 + BsMer mer = merService.getMer(merLedgerReceiver.getMerId()); + if (mer == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); + } Map commonParam = new HashMap<>(); commonParam.put("reqTime", DateUtil.format(new Date(), "yyyyMMddHHmmss")); commonParam.put("version", "1.0.0"); @@ -496,7 +516,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); + map.put("orgCode", mer.getOrgNo()); map.put("merCupNo", merLedgerReceiver.getCupNo()); map.put("receiverNo", merLedgerReceiver.getReceiverNo()); String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + merLedgerReceiver.getRelieveEntrustFilePath()); diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java index 7cf0c99..3460df5 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java @@ -34,6 +34,8 @@ public class LaKaLaTradeSeparateService { private BsTradeOrderProfitSharingService tradeOrderProfitSharingService; @Resource private BsTradeOrderProfitSharingReceiverService tradeOrderProfitSharingReceiverService; + @Resource + private BsMerService merService; /** * 创建分账 @@ -51,7 +53,8 @@ public class LaKaLaTradeSeparateService { } // 查询交易详情 BsTradeOrder tradeOrder = tradeOrderService.getOrderByTradeNoId(tradeOrderProfitSharing.getTradeOrderId()); - + // 商户 + BsMer mer = merService.getMer(tradeOrder.getMerId()); // 分账接收方 List profitSharingReceiverList = tradeOrderProfitSharingReceiverService.getReceiverListByProfitSharingId(tradeOrderProfitSharing.getId()); @@ -65,7 +68,7 @@ public class LaKaLaTradeSeparateService { map.put("log_date", DateUtil.date2String(tradeOrder.getPayTime(), "yyyyMMdd")); map.put("out_separate_no", tradeOrderProfitSharing.getProfitSharingOrderNo()); map.put("total_amt", tradeOrderProfitSharing.getProfitSharingAmoun().multiply(new BigDecimal("100")).longValue()); - map.put("lkl_org_no", "1"); + map.put("lkl_org_no", mer.getOrgNo()); map.put("cal_type", "0"); List> recvDatasMapList = new ArrayList<>(); diff --git a/service/src/main/java/com/hfkj/service/BsMerPlatformNoService.java b/service/src/main/java/com/hfkj/service/BsMerPlatformNoService.java index 8239bf3..af3fd1f 100644 --- a/service/src/main/java/com/hfkj/service/BsMerPlatformNoService.java +++ b/service/src/main/java/com/hfkj/service/BsMerPlatformNoService.java @@ -26,6 +26,8 @@ public interface BsMerPlatformNoService { */ BsMerPlatformNo getPlatformNo(Long merId, PlatformTypeEnum type); + BsMerPlatformNo getPlatformNoByCupNo(String merCupNo); + /** * 查询商户号 * @param param diff --git a/service/src/main/java/com/hfkj/service/impl/BsMerPlatformNoServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsMerPlatformNoServiceImpl.java index c8d6190..bc703a2 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsMerPlatformNoServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsMerPlatformNoServiceImpl.java @@ -43,6 +43,17 @@ public class BsMerPlatformNoServiceImpl implements BsMerPlatformNoService { return null; } + @Override + public BsMerPlatformNo getPlatformNoByCupNo(String merCupNo) { + BsMerPlatformNoExample example = new BsMerPlatformNoExample(); + example.createCriteria().andCupNoEqualTo(merCupNo).andStatusEqualTo(1); + List list = merPlatformNoMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public List getMerPlatformNoList(Map param) { BsMerPlatformNoExample example = new BsMerPlatformNoExample();