拉卡拉 入网电子合同申请 相关业务逻辑
This commit is contained in:
parent
b377244cb4
commit
40beddaaa5
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
|
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||||
|
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||||
|
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||||
|
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.suisung.mall.common.modules.lakala;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("lkl_ledger_ec")
|
||||||
|
@ApiModel(value = "拉卡拉商家入网电子合同申请表", description = "拉卡拉商家入网电子合同申请表")
|
||||||
|
public class LklLedgerEc implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
|
private Long id;
|
||||||
|
private Long mch_id;
|
||||||
|
private String mch_mobile;
|
||||||
|
private String req_params;
|
||||||
|
private String resp_body;
|
||||||
|
private String resp_notify_body;
|
||||||
|
private String ec_no;
|
||||||
|
private String ec_name;
|
||||||
|
private String ec_status;
|
||||||
|
private Long ec_apply_id;
|
||||||
|
private String result_url;
|
||||||
|
private Integer status;
|
||||||
|
private Date created_at;
|
||||||
|
private Date updated_at;
|
||||||
|
}
|
||||||
@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package com.suisung.mall.common.modules.lakala;
|
package com.suisung.mall.common.modules.lakala;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -25,6 +28,8 @@ import java.util.Date;
|
|||||||
public class LklLedgerMember implements Serializable {
|
public class LklLedgerMember implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
private String order_no;
|
private String order_no;
|
||||||
private String org_code;
|
private String org_code;
|
||||||
|
|||||||
@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package com.suisung.mall.common.modules.lakala;
|
package com.suisung.mall.common.modules.lakala;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -25,6 +28,8 @@ import java.util.Date;
|
|||||||
public class LklLedgerMerReceiverBind implements Serializable {
|
public class LklLedgerMerReceiverBind implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
private String order_no;
|
private String order_no;
|
||||||
private String org_code;
|
private String org_code;
|
||||||
|
|||||||
@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package com.suisung.mall.common.modules.lakala;
|
package com.suisung.mall.common.modules.lakala;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -25,6 +28,8 @@ import java.util.Date;
|
|||||||
public class LklLedgerReceiver implements Serializable {
|
public class LklLedgerReceiver implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
private String order_no;
|
private String order_no;
|
||||||
private String org_id;
|
private String org_id;
|
||||||
|
|||||||
@ -43,14 +43,19 @@ public class LakalaController extends BaseControllerImpl {
|
|||||||
return lakalaPayService.getBankCardBin(paramsJSON.getStr("bankCardNo"));
|
return lakalaPayService.getBankCardBin(paramsJSON.getStr("bankCardNo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "商户入网电子合同申请回调通知", notes = "商户入网电子合同申请回调通知")
|
||||||
|
@RequestMapping(value = "/ec/applyNotify", method = RequestMethod.POST)
|
||||||
|
public JSONObject ecApplyNotify(HttpServletRequest request) {
|
||||||
|
return lakalaPayService.applyLedgerMerNotify(request);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "商户分账业务开通申请", notes = "商户分账业务开通申请")
|
@ApiOperation(value = "商户分账业务开通申请", notes = "商户分账业务开通申请")
|
||||||
@RequestMapping(value = "/ledger/applyLedgerMer", method = RequestMethod.POST)
|
@RequestMapping(value = "/ledger/applyLedgerMer", method = RequestMethod.POST)
|
||||||
public CommonResult ledgerApplyLedgerMer(@RequestBody JSONObject paramsJSON) {
|
public CommonResult ledgerApplyLedgerMer(@RequestBody JSONObject paramsJSON) {
|
||||||
return lakalaPayService.applyLedgerMer(paramsJSON);
|
return lakalaPayService.applyLedgerMer(paramsJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "商户分账业务开通申请异步回调通知", notes = "商户分账业务开通申请异步回调通知")
|
||||||
@ApiOperation(value = "商户分账业务开通申请异步回调回调", notes = "商户分账业务开通申请异步回调回调")
|
|
||||||
@RequestMapping(value = "/ledger/applyLedgerMerNotify", method = RequestMethod.POST)
|
@RequestMapping(value = "/ledger/applyLedgerMerNotify", method = RequestMethod.POST)
|
||||||
public JSONObject ledgerApplyLedgerMerNotify(HttpServletRequest request) {
|
public JSONObject ledgerApplyLedgerMerNotify(HttpServletRequest request) {
|
||||||
return lakalaPayService.applyLedgerMerNotify(request);
|
return lakalaPayService.applyLedgerMerNotify(request);
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
|
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||||
|
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||||
|
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||||
|
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.suisung.mall.shop.lakala.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.suisung.mall.common.modules.lakala.LklLedgerEc;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface LklLedgerEcMapper extends BaseMapper<LklLedgerEc> {
|
||||||
|
}
|
||||||
@ -90,6 +90,14 @@ public interface LakalaApiService {
|
|||||||
*/
|
*/
|
||||||
JSONObject uploadFile(String orderNo, String attType, String attExtName, String attContext);
|
JSONObject uploadFile(String orderNo, String attType, String attExtName, String attContext);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商家申请入网电子合同
|
||||||
|
*
|
||||||
|
* @param mchMobile
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Pair<Boolean, String> applyLedgerMerEc(String mchMobile);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户分账业务开通申请
|
* 商户分账业务开通申请
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
|
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||||
|
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||||
|
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||||
|
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.suisung.mall.shop.lakala.service;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.suisung.mall.common.modules.lakala.LklLedgerEc;
|
||||||
|
import com.suisung.mall.core.web.service.IBaseService;
|
||||||
|
|
||||||
|
public interface LklLedgerEcService extends IBaseService<LklLedgerEc> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据商家Id新增或更新记录
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean saveOrUpdateByMchId(LklLedgerEc record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据applyId更新记录
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateByApplyId(LklLedgerEc record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据接applyId查询记录
|
||||||
|
*
|
||||||
|
* @param applyId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
LklLedgerEc getByApplyId(Long applyId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过mchId商家Id记录信息构建申请入网电子合同的请求参数
|
||||||
|
*
|
||||||
|
* @param mchMobile
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONObject buildApplyLedgerEcReqParams(String mchMobile);
|
||||||
|
|
||||||
|
}
|
||||||
@ -52,6 +52,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -449,6 +450,106 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商家申请入网电子合同
|
||||||
|
*
|
||||||
|
* @param mchMobile
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Pair<Boolean, String> applyLedgerMerEc(String mchMobile) {
|
||||||
|
log.debug("商家开始申请入网电子合同");
|
||||||
|
if (StrUtil.isBlank(mchMobile)) {
|
||||||
|
return Pair.of(false, I18nUtil._("缺少商家必要参数!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商家信息
|
||||||
|
ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByCondition(mchMobile, "");
|
||||||
|
if (shopMchEntry == null) {
|
||||||
|
return Pair.of(false, I18nUtil._("无法查找商家相关信息!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是企业类型商家
|
||||||
|
Boolean isQy = CommonConstant.MCH_ENTITY_TYPE_QY.equals(shopMchEntry.getEntity_type());
|
||||||
|
|
||||||
|
JSONObject reqData = new JSONObject();
|
||||||
|
reqData.put("order_no", StringUtils.genLklOrderNo(8));
|
||||||
|
reqData.put("org_id", orgCode);
|
||||||
|
reqData.put("ec_type_code", "EC007");
|
||||||
|
reqData.put("cert_type", "RESIDENT_ID");
|
||||||
|
|
||||||
|
String larName = isQy ? shopMchEntry.getLegal_person_name() : shopMchEntry.getContact_name();
|
||||||
|
String larIdCard = isQy ? shopMchEntry.getLegal_person_id_number() : shopMchEntry.getIndividual_id_number();
|
||||||
|
reqData.put("cert_name", larName);
|
||||||
|
reqData.put("cert_no", larIdCard);
|
||||||
|
reqData.put("mobile", shopMchEntry.getLogin_mobile());
|
||||||
|
|
||||||
|
if (isQy) {
|
||||||
|
reqData.put("business_license_no", shopMchEntry.getBiz_license_number());
|
||||||
|
reqData.put("business_license_name", shopMchEntry.getBiz_license_company());
|
||||||
|
}
|
||||||
|
reqData.put("openning_bank_code", shopMchEntry.getOpenning_bank_code());
|
||||||
|
reqData.put("openning_bank_name", shopMchEntry.getBank_name());
|
||||||
|
reqData.put("acct_type_code", shopMchEntry.getAccount_type());//57 对公、 58 对私
|
||||||
|
reqData.put("acct_no", shopMchEntry.getAccount_number());
|
||||||
|
reqData.put("acct_name", shopMchEntry.getAccount_holder_name());
|
||||||
|
|
||||||
|
String domain = projectDomain;
|
||||||
|
if (isProd()) {
|
||||||
|
domain += "/api";
|
||||||
|
}
|
||||||
|
// 给拉卡拉通知的回调地址
|
||||||
|
String retUrl = domain + "/mobile/shop/lakala/ec/applyNotify";
|
||||||
|
reqData.put("ret_url", retUrl);
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now(); // 获取当前日期
|
||||||
|
String signDate = today.getYear() + "-" + today.getMonthValue() + "-" + today.getDayOfMonth();
|
||||||
|
|
||||||
|
JSONObject ecParams = new JSONObject();
|
||||||
|
ecParams.put("A1", isQy ? shopMchEntry.getBiz_license_company() : shopMchEntry.getAccount_holder_name());
|
||||||
|
ecParams.put("A30", "0.6"); // 测试环境微信费率0.6
|
||||||
|
ecParams.put("A96", "D1");
|
||||||
|
ecParams.put("A97", "开通");
|
||||||
|
ecParams.put("A100", "不开通");
|
||||||
|
ecParams.put("A101", "中国境内");
|
||||||
|
ecParams.put("A104", today.getYear());
|
||||||
|
ecParams.put("A105", today.getMonthValue());
|
||||||
|
ecParams.put("A106", today.getDayOfMonth());
|
||||||
|
ecParams.put("A107", today.getYear());
|
||||||
|
ecParams.put("A108", today.getMonthValue());
|
||||||
|
ecParams.put("A109", today.getDayOfMonth());
|
||||||
|
ecParams.put("B1", today.getYear());
|
||||||
|
ecParams.put("B2", today.getMonthValue());
|
||||||
|
ecParams.put("B8", isQy ? shopMchEntry.getBiz_license_company() : shopMchEntry.getAccount_holder_name());
|
||||||
|
ecParams.put("B9", shopMchEntry.getSales_info());
|
||||||
|
ecParams.put("B10", isQy ? shopMchEntry.getBiz_license_company() : shopMchEntry.getAccount_holder_name());
|
||||||
|
ecParams.put("B14", isQy ? shopMchEntry.getBiz_license_number() : "");
|
||||||
|
ecParams.put("B19", shopMchEntry.getOpenning_bank_code());
|
||||||
|
ecParams.put("B20", shopMchEntry.getAccount_number());
|
||||||
|
ecParams.put("B31", shopMchEntry.getStore_name());
|
||||||
|
ecParams.put("B32", shopMchEntry.getContact_name());
|
||||||
|
ecParams.put("B33", shopMchEntry.getStore_address());
|
||||||
|
ecParams.put("B34", shopMchEntry.getLogin_mobile());
|
||||||
|
ecParams.put("D1", shopMchEntry.getBank_name());
|
||||||
|
ecParams.put("D2", signDate);
|
||||||
|
ecParams.put("D4", "桂平发发网络有限公司");
|
||||||
|
ecParams.put("D7", signDate);
|
||||||
|
ecParams.put("D9", signDate);
|
||||||
|
ecParams.put("D11", signDate);
|
||||||
|
ecParams.put("D12", signDate);
|
||||||
|
ecParams.put("E1", "桂平发发网络有限公司");
|
||||||
|
ecParams.put("E2", "平台商户入驻合同协议");
|
||||||
|
ecParams.put("E3", "0");
|
||||||
|
ecParams.put("E4", "70");
|
||||||
|
ecParams.put("E5", "桂平发发网络有限公司");
|
||||||
|
ecParams.put("E7", signDate);
|
||||||
|
ecParams.put("E8", shopMchEntry.getAccount_holder_name());
|
||||||
|
|
||||||
|
reqData.put("ec_content_parameters", ecParams);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户分账业务开通申请
|
* 商户分账业务开通申请
|
||||||
|
|||||||
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
|
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||||
|
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||||
|
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||||
|
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.suisung.mall.shop.lakala.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.suisung.mall.common.modules.lakala.LklLedgerEc;
|
||||||
|
import com.suisung.mall.common.modules.store.ShopMchEntry;
|
||||||
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
|
import com.suisung.mall.shop.esign.service.EsignPlatformInfoService;
|
||||||
|
import com.suisung.mall.shop.lakala.mapper.LklLedgerEcMapper;
|
||||||
|
import com.suisung.mall.shop.lakala.service.LakalaApiService;
|
||||||
|
import com.suisung.mall.shop.lakala.service.LklLedgerEcService;
|
||||||
|
import com.suisung.mall.shop.store.service.ShopMchEntryService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class LklLedgerEcServiceImpl extends BaseServiceImpl<LklLedgerEcMapper, LklLedgerEc> implements LklLedgerEcService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EsignPlatformInfoService esignPlatformInfoService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private LakalaApiService lakalaApiService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ShopMchEntryService shopMchEntryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据商家Id新增或更新记录
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean saveOrUpdateByMchId(LklLedgerEc record) {
|
||||||
|
if (record == null || (ObjectUtil.isEmpty(record.getMch_id()) && StrUtil.isBlank(record.getMch_mobile()))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<LklLedgerEc> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (ObjectUtil.isEmpty(record.getMch_id())) {
|
||||||
|
queryWrapper.eq("mch_id", record.getMch_id());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(record.getMch_mobile())) {
|
||||||
|
queryWrapper.eq("mch_mobile", record.getMch_mobile());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<LklLedgerEc> existsRecordList = list(queryWrapper);
|
||||||
|
if (CollectionUtil.isNotEmpty(existsRecordList)
|
||||||
|
&& existsRecordList.get(0) != null
|
||||||
|
&& existsRecordList.get(0).getId() > 0) {
|
||||||
|
// 更新记录
|
||||||
|
record.setId(existsRecordList.get(0).getId());
|
||||||
|
return updateById(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
return add(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据applyId更新记录
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByApplyId(LklLedgerEc record) {
|
||||||
|
if (record == null || ObjectUtil.isEmpty(record.getEc_apply_id())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<LklLedgerEc> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("ec_apply_id", record.getEc_apply_id());
|
||||||
|
|
||||||
|
LklLedgerEc existsRecord = getOne(queryWrapper);
|
||||||
|
if (existsRecord == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新记录
|
||||||
|
record.setId(existsRecord.getId());
|
||||||
|
return updateById(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据接applyId查询记录
|
||||||
|
*
|
||||||
|
* @param applyId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LklLedgerEc getByApplyId(Long applyId) {
|
||||||
|
if (ObjectUtil.isEmpty(applyId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<LklLedgerEc> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("ec_apply_id", applyId);
|
||||||
|
|
||||||
|
return getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过mchId商家Id记录信息构建申请入网电子合同的请求参数
|
||||||
|
*
|
||||||
|
* @param mchMobile
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JSONObject buildApplyLedgerEcReqParams(String mchMobile) {
|
||||||
|
if (StrUtil.isBlank(mchMobile)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByCondition(mchMobile, "");
|
||||||
|
if (shopMchEntry == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
jsonObject.put("mch_id", shopMchEntry.getId());
|
||||||
|
|
||||||
|
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.suisung.mall.shop.lakala.mapper.LklLedgerEcMapper">
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
*
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user