diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/BizParameter.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/BizParameter.java index f8e8c79b..a624965e 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/BizParameter.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/BizParameter.java @@ -33,4 +33,10 @@ public class BizParameter extends JSONObject { this.put(paramName, paramValue); } + + public void addParamNoNull(String paramName, Object paramValue) { + if (paramValue != null) { + this.put(paramName, paramValue); + } + } } diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/params/AddOrderParam.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/params/AddOrderParam.java deleted file mode 100644 index dac8ce06..00000000 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/params/AddOrderParam.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.ruoyi.common.pay.yst.domain.params; - -/** - * 消费申请 参数 - * @author wjh - * 2024/8/1 - */ -public class AddOrderParam { - -} diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/params/PersonRealNameAndBindCardApplyParam.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/params/PersonRealNameAndBindCardApplyParam.java new file mode 100644 index 00000000..7de7552d --- /dev/null +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/domain/params/PersonRealNameAndBindCardApplyParam.java @@ -0,0 +1,69 @@ +package com.ruoyi.common.pay.yst.domain.params; + +import com.ruoyi.common.pay.yst.enums.YstCertType; +import lombok.Builder; +import lombok.Data; + +/** + * 个人会员实名及绑卡(申请)参数 + * @author wjh + * 2024/8/3 + */ +@Data +@Builder +public class PersonRealNameAndBindCardApplyParam { + + /** + * 会员编号 + */ + private String signNum; + + /** + * 会员角色 + */ + private String memberRole; + + /** + * 证件类型 + */ + private String certType; + + /** + * 证件号码 + */ + private String certNum; + + /** + * 姓名 + */ + private String name; + + /** + * 银行预留手机号 + */ + private String phone; + + /** + * 银行卡号 + */ + private String acctNum; + + /** + * 绑卡方式 + */ + private String bindType; + + /** + * 针对信用卡 + * 有效期(月年) + * 格式为月年;如0321,2位月2位年 + */ + private String validDate; + + /** + * 针对信用卡 + * cvv2 + */ + private String cvv2; + + } diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/enums/YstBindType.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/enums/YstBindType.java new file mode 100644 index 00000000..151b4317 --- /dev/null +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/enums/YstBindType.java @@ -0,0 +1,21 @@ +package com.ruoyi.common.pay.yst.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author wjh + * 2024/8/3 + */ +@Getter +@AllArgsConstructor +public enum YstBindType { + + TLT("通联通协议支付签约", "6"), + SYB("收银宝快捷支付签约", "7"), + BANK_CARD4("银行卡四要素验证", "8"); + + private final String name; + private final String type; + +} diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/YstAccountService.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/YstAccountService.java index 881b5aff..25a59396 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/YstAccountService.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/YstAccountService.java @@ -1,5 +1,7 @@ package com.ruoyi.common.pay.yst.service; +import com.ruoyi.common.pay.yst.domain.params.PersonRealNameAndBindCardApplyParam; + /** * 云商通账户接口 * @author wjh @@ -10,6 +12,6 @@ public interface YstAccountService { /** * 个人会员实名及绑卡(申请) */ - void personRealNameAndBindCardApply(); + void personRealNameAndBindCardApply(PersonRealNameAndBindCardApplyParam param); } diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstAccountServiceImpl.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstAccountServiceImpl.java index 275942d1..a2f2cd92 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstAccountServiceImpl.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstAccountServiceImpl.java @@ -1,6 +1,17 @@ package com.ruoyi.common.pay.yst.service.impl; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.pay.yst.config.YstConfig; +import com.ruoyi.common.pay.yst.constants.YstApi; +import com.ruoyi.common.pay.yst.constants.YstTransCode; +import com.ruoyi.common.pay.yst.domain.BizParameter; +import com.ruoyi.common.pay.yst.domain.params.PersonRealNameAndBindCardApplyParam; import com.ruoyi.common.pay.yst.service.YstAccountService; +import com.ruoyi.common.pay.yst.util.SM4Utils; +import com.ruoyi.common.pay.yst.util.YstClient; +import com.ruoyi.common.utils.SnowFlakeUtil; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -9,11 +20,42 @@ import org.springframework.stereotype.Service; */ @Service public class YstAccountServiceImpl implements YstAccountService { + + @Autowired + private YstClient client; + + @Autowired + private YstConfig config; + /** * 个人会员实名及绑卡(申请) */ @Override - public void personRealNameAndBindCardApply() { + public void personRealNameAndBindCardApply(PersonRealNameAndBindCardApplyParam param) { + try { + + // 组装参数 + BizParameter bizParameter = new BizParameter(); + // 发送请求 + bizParameter.addParam("reqTraceNum", String.valueOf(SnowFlakeUtil.newId())); + bizParameter.addParam("signNum", param.getSignNum()); + bizParameter.addParam("memberRole", param.getMemberRole()); + bizParameter.addParam("cerType", param.getCertType()); + + bizParameter.addParam("cerNum", SM4Utils.encryptEcb(config.getSecretKey(),param.getCertNum())); + bizParameter.addParam("name",param.getName()); + bizParameter.addParam("acctNum", SM4Utils.encryptEcb(config.getSecretKey(),param.getAcctNum())); + + bizParameter.addParam("phone",param.getPhone()); + bizParameter.addParam("bindType",param.getBindType());//6-通联通协议支付,7-收银宝快捷,8-银行卡四要素 + + bizParameter.addParam("validDate",param.getValidDate()); + bizParameter.addParam("cvv2",param.getCvv2()); + bizParameter.addParam("bizOrderCode",String.valueOf(System.currentTimeMillis())); + client.sendRequest(YstApi.TM, YstTransCode.INDIVIDUAL_MEMBER_REAL_NAME_AND_BIND_CARD_APPLY, bizParameter, String.class); + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } } } diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstPayServiceImpl.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstPayServiceImpl.java index 0d9b939a..21bcc817 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstPayServiceImpl.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/pay/yst/service/impl/YstPayServiceImpl.java @@ -6,7 +6,6 @@ import com.ruoyi.common.pay.yst.constants.YstTransCode; import com.ruoyi.common.pay.yst.domain.BizParameter; import com.ruoyi.common.pay.yst.domain.YstResponse; import com.ruoyi.common.pay.yst.domain.bizRes.comsumptionApply.ConsumptionApplyRes; -import com.ruoyi.common.pay.yst.domain.params.AddOrderParam; import com.ruoyi.common.pay.yst.service.YstPayService; import com.ruoyi.common.pay.yst.util.SM4Utils; import com.ruoyi.common.pay.yst.util.YstClient; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml index afc9743f..a7e1d487 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml @@ -64,6 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item} + + and ss.user_id in + + #{item} + +