diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/HnaPayController.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/HnaPayController.java index 4e50565..dc6d149 100644 --- a/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/HnaPayController.java +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/HnaPayController.java @@ -4,17 +4,17 @@ import com.shop.cereshop.admin.annotation.NoRepeatSubmit; import com.shop.cereshop.admin.annotation.NoRepeatWebLog; import com.shop.cereshop.admin.param.business.BusinessHnapayCreateParam; import com.shop.cereshop.admin.pay.hnapay.HnaPayService; +import com.shop.cereshop.admin.service.bhnapay.CereBusinessHnapayService; import com.shop.cereshop.admin.service.business.CerePlatformBusinessService; +import com.shop.cereshop.commons.constant.CoReturnFormat; +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; import com.shop.cereshop.commons.exception.CoBusinessException; import com.shop.cereshop.commons.result.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @@ -38,6 +38,9 @@ public class HnaPayController { private HnaPayService hnaPayService; @Autowired + private CereBusinessHnapayService businessHnapayService; + + @Autowired private CerePlatformBusinessService businessService; @@ -59,11 +62,13 @@ public class HnaPayController { shareParId = String.valueOf(result.get("userId")); String bindCardAgrNo = String.valueOf(result.get("bindCardAgrNo")); businessService.updateBusinessHnaPay(param.getBusinessId(),shareParId,bindCardAgrNo); + //创建商家新账通配置信息 + businessHnapayService.createBusinessHnaPay(param,shareParId,bindCardAgrNo); }else { String errorMsg = String.valueOf(result.get("errorMsg")); throw new CoBusinessException(errorMsg); } - return new Result(shareParId); + return new Result(shareParId, ""); } @PostMapping("uploadCertInfo") @@ -76,11 +81,12 @@ public class HnaPayController { String resultCode = String.valueOf(result.get("resultCode")); if (resultCode.equals("0000")){ businessService.updateBusinessHnapayState(Long.parseLong(businessId),1); + businessHnapayService.updateHnaPayState(Long.parseLong(businessId),1); }else { String errorMsg = String.valueOf(result.get("errorMsg")); throw new CoBusinessException(errorMsg); } - return new Result(base64); + return new Result(base64, ""); } private String getBase64(MultipartFile file) { @@ -100,4 +106,14 @@ public class HnaPayController { return base64; } + + + @GetMapping(value = "getHnapay/{businessId}") + @ApiOperation(value = "根据商家id获取新账通配置信息") + @NoRepeatWebLog + public Result getHnaPayInfo(@PathVariable Long businessId) throws CoBusinessException{ + //校验商家名称是否存在 + CereBusinessHnapay hnapay = businessHnapayService.getByBusinessId(businessId); + return new Result(hnapay, ""); + } } diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/bhnapay/CereBusinessHnapayDao.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/bhnapay/CereBusinessHnapayDao.java new file mode 100644 index 0000000..0433943 --- /dev/null +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/bhnapay/CereBusinessHnapayDao.java @@ -0,0 +1,22 @@ +package com.shop.cereshop.admin.dao.bhnapay; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 11:49 + */ +@Mapper +public interface CereBusinessHnapayDao extends BaseMapper { + + CereBusinessHnapay getByBusinessId(@Param("businessId") Long businessId); + + void updateHnaPayState(@Param("businessId") Long businessId, @Param("status") Integer status); + +} diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bhnapay/CereBusinessHnapayService.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bhnapay/CereBusinessHnapayService.java new file mode 100644 index 0000000..da93509 --- /dev/null +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bhnapay/CereBusinessHnapayService.java @@ -0,0 +1,24 @@ +package com.shop.cereshop.admin.service.bhnapay; + +import com.shop.cereshop.admin.param.business.BusinessHnapayCreateParam; +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; +import com.shop.cereshop.commons.exception.CoBusinessException; + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 14:19 + */ +public interface CereBusinessHnapayService { + + void save(CereBusinessHnapay record) throws CoBusinessException; + + void update(CereBusinessHnapay businessHnapay) throws CoBusinessException; + + CereBusinessHnapay getByBusinessId(Long businessId) throws CoBusinessException; + + void createBusinessHnaPay(BusinessHnapayCreateParam param, String xsPayId, String bindCardAgrNo) throws CoBusinessException; + + void updateHnaPayState(Long businessId, Integer status); +} diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bhnapay/impl/CereBusinessHnapayServiceImpl.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bhnapay/impl/CereBusinessHnapayServiceImpl.java new file mode 100644 index 0000000..e154d11 --- /dev/null +++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bhnapay/impl/CereBusinessHnapayServiceImpl.java @@ -0,0 +1,64 @@ +package com.shop.cereshop.admin.service.bhnapay.impl; + +import com.shop.cereshop.admin.dao.bhnapay.CereBusinessHnapayDao; +import com.shop.cereshop.admin.param.business.BusinessHnapayCreateParam; +import com.shop.cereshop.admin.service.bhnapay.CereBusinessHnapayService; +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; +import com.shop.cereshop.commons.exception.CoBusinessException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 14:21 + */ +@Service +public class CereBusinessHnapayServiceImpl implements CereBusinessHnapayService { + + @Autowired + private CereBusinessHnapayDao cereBusinessHnapayDao; + + @Override + @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) + public void save(CereBusinessHnapay record) throws CoBusinessException { + cereBusinessHnapayDao.insert(record); + } + + @Override + public void update(CereBusinessHnapay businessHnapay) throws CoBusinessException { + cereBusinessHnapayDao.updateById(businessHnapay); + } + + @Override + public CereBusinessHnapay getByBusinessId(Long businessId) throws CoBusinessException { + return cereBusinessHnapayDao.getByBusinessId(businessId); + } + + @Override + public void createBusinessHnaPay(BusinessHnapayCreateParam param, String xsPayId, String bindCardAgrNo) throws CoBusinessException { + CereBusinessHnapay hnapay = new CereBusinessHnapay(); + hnapay.setBusinessId(param.getBusinessId()); + hnapay.setXsPayId(xsPayId); + hnapay.setBindCardAgrNo(bindCardAgrNo); + hnapay.setName(param.getName()); + hnapay.setEnterpriseCode(param.getEnterpriseCode()); + hnapay.setValidDate(param.getValidDate()); + hnapay.setBankCard(param.getBankCard()); + hnapay.setBankCode(param.getBankCode()); + hnapay.setBankProvince(param.getBankProvince()); + hnapay.setBankCity(param.getBankCity()); + hnapay.setBankBranch(param.getBankBranch()); + hnapay.setContactPhone(param.getContactPhone()); + cereBusinessHnapayDao.insert(hnapay); + } + + @Override + public void updateHnaPayState(Long businessId, Integer status) { + cereBusinessHnapayDao.updateHnaPayState(businessId, status); + } +} diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/bhnapay/CereBusinessHnapayDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/bhnapay/CereBusinessHnapayDAO.xml new file mode 100644 index 0000000..139c903 --- /dev/null +++ b/cereshop-admin/src/main/resources/mybatis/mapper/bhnapay/CereBusinessHnapayDAO.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + update cere_business_hnapay set status=#{status} where business_id = #{businessId} + + diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HnaPayController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HnaPayController.java index aeecaad..d56e6e9 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HnaPayController.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HnaPayController.java @@ -5,6 +5,7 @@ import com.google.gson.Gson; import com.shop.cereshop.business.pay.hnapay.HnaPayService; import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo; import com.shop.cereshop.business.service.after.CereOrderAfterService; +import com.shop.cereshop.business.service.bhnapay.CereBusinessHnapayService; import com.shop.cereshop.business.service.business.CerePlatformBusinessService; import com.shop.cereshop.commons.constant.IntegerEnum; import com.shop.cereshop.commons.utils.SpringUtil; @@ -32,6 +33,9 @@ public class HnaPayController { @Autowired private CerePlatformBusinessService businessService; + @Autowired + private CereBusinessHnapayService businessHnapayService; + /** * 退款通知回调 * @throws Exception @@ -97,7 +101,9 @@ public class HnaPayController { if (auditResult.equals("1")){ //审核通过 businessService.updateBusinessHnapayState(Long.valueOf(businessId), 2); + businessHnapayService.updateHnaPayState(Long.valueOf(businessId), 2); }else { + businessService.updateBusinessHnapayState(Long.valueOf(businessId), 3); //不通过原因 String rejectReason = content.getString("rejectReason"); //不通过证件类型列表, @@ -107,6 +113,7 @@ public class HnaPayController { //4:营业执照; //7:开户许可证; String certTypeList = content.getString("certTypeList"); + businessHnapayService.updateHnaPayApproval(Long.valueOf(businessId), rejectReason, certTypeList); } } } catch (Exception e) { diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/bhnapay/CereBusinessHnapayDao.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/bhnapay/CereBusinessHnapayDao.java new file mode 100644 index 0000000..0f42686 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/bhnapay/CereBusinessHnapayDao.java @@ -0,0 +1,24 @@ +package com.shop.cereshop.business.dao.bhnapay; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 11:49 + */ +@Mapper +public interface CereBusinessHnapayDao extends BaseMapper { + + CereBusinessHnapay getByBusinessId(@Param("businessId") Long businessId); + + void updateHnaPayState(@Param("businessId") Long businessId, @Param("status") Integer status); + + void updateHnaPayApproval(@Param("businessId") Long businessId, @Param("rejectReason") String rejectReason, @Param("certTypeList") String certTypeList); + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/bhnapay/CereBusinessHnapayService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/bhnapay/CereBusinessHnapayService.java new file mode 100644 index 0000000..7750edb --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/bhnapay/CereBusinessHnapayService.java @@ -0,0 +1,23 @@ +package com.shop.cereshop.business.service.bhnapay; + +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; +import com.shop.cereshop.commons.exception.CoBusinessException; + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 14:19 + */ +public interface CereBusinessHnapayService { + + void save(CereBusinessHnapay record) throws CoBusinessException; + + void update(CereBusinessHnapay businessHnapay) throws CoBusinessException; + + CereBusinessHnapay getByBusinessId(Long businessId) throws CoBusinessException; + + void updateHnaPayState(Long businessId, Integer status); + + void updateHnaPayApproval(Long businessId, String rejectReason, String certTypeList); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/bhnapay/impl/CereBusinessHnapayServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/bhnapay/impl/CereBusinessHnapayServiceImpl.java new file mode 100644 index 0000000..fe7c7b9 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/bhnapay/impl/CereBusinessHnapayServiceImpl.java @@ -0,0 +1,50 @@ +package com.shop.cereshop.business.service.bhnapay.impl; + +import com.shop.cereshop.business.dao.bhnapay.CereBusinessHnapayDao; +import com.shop.cereshop.business.service.bhnapay.CereBusinessHnapayService; +import com.shop.cereshop.commons.domain.bhnapay.CereBusinessHnapay; +import com.shop.cereshop.commons.exception.CoBusinessException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 14:21 + */ +@Service +public class CereBusinessHnapayServiceImpl implements CereBusinessHnapayService { + + @Autowired + private CereBusinessHnapayDao cereBusinessHnapayDao; + + @Override + @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) + public void save(CereBusinessHnapay record) throws CoBusinessException { + cereBusinessHnapayDao.insert(record); + } + + @Override + public void update(CereBusinessHnapay businessHnapay) throws CoBusinessException { + cereBusinessHnapayDao.updateById(businessHnapay); + } + + @Override + public CereBusinessHnapay getByBusinessId(Long businessId) throws CoBusinessException { + return cereBusinessHnapayDao.getByBusinessId(businessId); + } + + @Override + public void updateHnaPayState(Long businessId, Integer status) { + cereBusinessHnapayDao.updateHnaPayState(businessId, status); + } + + @Override + public void updateHnaPayApproval(Long businessId, String rejectReason, String certTypeList) { + cereBusinessHnapayDao.updateHnaPayApproval(businessId, rejectReason, certTypeList); + } +} diff --git a/cereshop-business/src/main/resources/mybatis/mapper/bhnapay/CereBusinessHnapayDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/bhnapay/CereBusinessHnapayDAO.xml new file mode 100644 index 0000000..2186d47 --- /dev/null +++ b/cereshop-business/src/main/resources/mybatis/mapper/bhnapay/CereBusinessHnapayDAO.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + update cere_business_hnapay set status=#{status} where business_id = #{businessId} + + + + update cere_business_hnapay set reject_reason=#{rejectReason}, cert_type_list=#{certTypeList}, status=3 where business_id = #{businessId} + + diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/bhnapay/CereBusinessHnapay.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/bhnapay/CereBusinessHnapay.java new file mode 100644 index 0000000..13cda15 --- /dev/null +++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/bhnapay/CereBusinessHnapay.java @@ -0,0 +1,94 @@ +package com.shop.cereshop.commons.domain.bhnapay; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述: + * + * @author stevenhu + * @version 2025/02/20 11:12 + */ +@Data +public class CereBusinessHnapay implements Serializable { + /** + * 主键Id + */ + private Long id; + + /** + * 商家id + */ + private Long businessId; + + /** + * 新生支付新账通商户Id/分账方id + */ + private String xsPayId; + + /** + * 新生支付绑卡协议号 + */ + private String bindCardAgrNo; + + /** + * 企业名称 + */ + private String name; + + /** + * 统一社会信用代码 + */ + private String enterpriseCode; + + /** + * 营业执照有效期 + */ + private String validDate; + + /** + * 银行卡号 + */ + private String bankCard; + + /** + * 银行简码 + */ + private String bankCode; + + /** + * 开户行所属省份 + */ + private String bankProvince; + + /** + * 开户行所属城市 + */ + private String bankCity; + + /** + * 开户支行 + */ + private String bankBranch; + + /** + * 联系电话 + */ + private String contactPhone; + + /** + * 0-待上传 1-审核中 2-审核通过 3-审核拒绝 + */ + private Integer status; + + /** + * 不通过原因 + */ + private String rejectReason; + + /** + * 列出审批不通过证件类型 + */ + private String certTypeList; +} diff --git a/doc/3.0/update.sql b/doc/3.0/update.sql index eed1ac0..366691a 100644 --- a/doc/3.0/update.sql +++ b/doc/3.0/update.sql @@ -304,6 +304,28 @@ ALTER TABLE `cere_platform_membership` ALTER TABLE `cere_platform_member_level` ADD COLUMN `business_id` bigint(20) DEFAULT 0 COMMENT '商家Id'; +DROP TABLE IF EXISTS `cere_business_hnapay`; +CREATE TABLE `cere_business_hnapay` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `business_id` bigint(20) NULL DEFAULT 0 COMMENT '商家Id', + `xs_pay_id` varchar(255) NULL DEFAULT NULL COMMENT '新生支付新账通商户Id/分账方id', + `bind_card_agr_no` varchar(30) NULL DEFAULT NULL COMMENT '新生支付绑卡协议号', + `name` varchar(256) NOT NULL DEFAULT '' COMMENT '企业名称', + `enterprise_code` varchar(20) NOT NULL DEFAULT '' COMMENT '统一社会信用代码', + `valid_date` varchar(30) NULL DEFAULT '' COMMENT '营业执照有效期', + `bank_card` varchar(30) NULL DEFAULT '' COMMENT '银行卡号', + `bank_code` varchar(30) NULL DEFAULT '' COMMENT '银行简码', + `bank_province` varchar(30) NULL DEFAULT '' COMMENT '开户行所属省份', + `bank_city` varchar(30) NULL DEFAULT '' COMMENT '开户行所属城市', + `bank_branch` varchar(30) NULL DEFAULT '' COMMENT '开户支行', + `contact_phone` varchar(16) NULL DEFAULT '' COMMENT '联系电话', + `status` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '0-待上传 1-审核中 2-审核通过 3-审核拒绝', + `reject_reason` varchar(100) NULL DEFAULT '' COMMENT '不通过原因', + `cert_type_list` varchar(20) NULL DEFAULT '' COMMENT '列出审批不通过证件类型', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商家新账通配置信息' ROW_FORMAT = DYNAMIC; + +DROP TABLE IF EXISTS `cere_business_wxpay`; CREATE TABLE `cere_business_wxpay` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `business_id` bigint(20) NULL DEFAULT 0 COMMENT '商家Id',