25 changed files with 638 additions and 32 deletions
-
67cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BusinessWxpayController.java
-
103cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/HnaPayController.java
-
4cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/business/CerePlatformBusinessDAO.java
-
20cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/bwxpay/CereBusinessWxpayDao.java
-
87cereshop-admin/src/main/java/com/shop/cereshop/admin/param/business/BusinessHnapayCreateParam.java
-
15cereshop-admin/src/main/java/com/shop/cereshop/admin/pay/hnapay/HnaPayService.java
-
26cereshop-admin/src/main/java/com/shop/cereshop/admin/pay/hnapay/impl/HnaPayServiceImpl.java
-
4cereshop-admin/src/main/java/com/shop/cereshop/admin/service/business/CerePlatformBusinessService.java
-
10cereshop-admin/src/main/java/com/shop/cereshop/admin/service/business/impl/CerePlatformBusinessServiceImpl.java
-
20cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bwxpay/CereBusinessWxpayService.java
-
40cereshop-admin/src/main/java/com/shop/cereshop/admin/service/bwxpay/impl/CereBusinessWxpayServiceImpl.java
-
11cereshop-admin/src/main/resources/mybatis/mapper/business/CerePlatformBusinessDAO.xml
-
19cereshop-admin/src/main/resources/mybatis/mapper/bwxpay/CereBusinessWxpayDAO.xml
-
21cereshop-app/src/main/java/com/shop/cereshop/app/dao/bwxpay/CereBusinessWxpayDao.java
-
21cereshop-app/src/main/java/com/shop/cereshop/app/service/bwxpay/CereBusinessWxpayService.java
-
42cereshop-app/src/main/java/com/shop/cereshop/app/service/bwxpay/impl/CereBusinessWxpayServiceImpl.java
-
54cereshop-business/src/main/java/com/shop/cereshop/business/controller/HnaPayController.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/dao/business/CerePlatformBusinessDAO.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/service/business/CerePlatformBusinessService.java
-
4cereshop-business/src/main/java/com/shop/cereshop/business/service/business/impl/CerePlatformBusinessServiceImpl.java
-
4cereshop-business/src/main/resources/mybatis/mapper/business/CerePlatformBusinessDAO.xml
-
5cereshop-commons/src/main/java/com/shop/cereshop/commons/config/HnaPayConfig.java
-
17cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/business/CerePlatformBusiness.java
-
55cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/bwxpay/CereBusinessWxpay.java
-
17doc/3.0/update.sql
@ -0,0 +1,67 @@ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
/** |
|||
* 描述:商家微信配置模块 |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/20 14:38 |
|||
*/ |
|||
|
|||
import com.shop.cereshop.admin.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.admin.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.admin.param.business.BusinessUpdateParam; |
|||
import com.shop.cereshop.admin.service.bwxpay.CereBusinessWxpayService; |
|||
import com.shop.cereshop.commons.constant.CoReturnFormat; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
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 javax.servlet.http.HttpServletRequest; |
|||
|
|||
@RestController |
|||
@RequestMapping("bwxpay") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "BusinessWxpayController") |
|||
@Api(value = "商家微信配置模块", tags = "商家微信配置模块") |
|||
public class BusinessWxpayController { |
|||
|
|||
@Autowired |
|||
private CereBusinessWxpayService businessWxpayService; |
|||
|
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新建商家微信配置信息") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody CereBusinessWxpay wxpay, HttpServletRequest request) throws CoBusinessException { |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
businessWxpayService.save(wxpay); |
|||
return new Result(user.getUsername(),"新建商家微信配置信息", GsonUtil.objectToGson(wxpay)); |
|||
} |
|||
|
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改商家") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody CereBusinessWxpay wxpay, HttpServletRequest request) throws CoBusinessException{ |
|||
//校验商家名称是否存在 |
|||
//获取当前登录账户 |
|||
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
|||
businessWxpayService.update(wxpay); |
|||
return new Result(user.getUsername(),"修改商家", GsonUtil.objectToGson(wxpay)); |
|||
} |
|||
} |
@ -0,0 +1,103 @@ |
|||
package com.shop.cereshop.admin.controller; |
|||
|
|||
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.business.CerePlatformBusinessService; |
|||
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.multipart.MultipartFile; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.Base64; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 描述:新生支付新账通回调处理 |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/14 9:24 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("hnaPay") |
|||
@Slf4j(topic = "hnaPayController") |
|||
@Api(value = "新账通模块", tags = "新账通模块") |
|||
public class HnaPayController { |
|||
|
|||
@Autowired |
|||
private HnaPayService hnaPayService; |
|||
|
|||
@Autowired |
|||
private CerePlatformBusinessService businessService; |
|||
|
|||
|
|||
/** |
|||
* 新账通企业开户 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "create") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新账通企业开户") |
|||
@NoRepeatWebLog |
|||
public Result<String> create(@RequestBody BusinessHnapayCreateParam param) throws CoBusinessException { |
|||
//新生支付新账通企业开户 |
|||
Map<String,Object> result = hnaPayService.createEntAccount(param); |
|||
String resultCode = String.valueOf(result.get("resultCode")); |
|||
String shareParId = ""; |
|||
if (resultCode.equals("0000")){ |
|||
shareParId = String.valueOf(result.get("userId")); |
|||
String bindCardAgrNo = String.valueOf(result.get("bindCardAgrNo")); |
|||
businessService.updateBusinessHnaPay(param.getBusinessId(),shareParId,bindCardAgrNo); |
|||
}else { |
|||
String errorMsg = String.valueOf(result.get("errorMsg")); |
|||
throw new CoBusinessException(errorMsg); |
|||
} |
|||
return new Result(shareParId); |
|||
} |
|||
|
|||
@PostMapping("uploadCertInfo") |
|||
@NoRepeatSubmit |
|||
@ApiOperation("企业开户资料上送") |
|||
@NoRepeatWebLog |
|||
public Result<String> uploadCertInfo(MultipartFile file, String businessId, String shareParId, String type) throws CoBusinessException { |
|||
String base64 = getBase64(file); |
|||
Map<String,Object> result = hnaPayService.uploadEntFile(shareParId, type,base64); |
|||
String resultCode = String.valueOf(result.get("resultCode")); |
|||
if (resultCode.equals("0000")){ |
|||
businessService.updateBusinessHnapayState(Long.parseLong(businessId),1); |
|||
}else { |
|||
String errorMsg = String.valueOf(result.get("errorMsg")); |
|||
throw new CoBusinessException(errorMsg); |
|||
} |
|||
return new Result(base64); |
|||
} |
|||
|
|||
private String getBase64(MultipartFile file) { |
|||
InputStream in = null; |
|||
byte[] data = null; |
|||
String base64 = ""; |
|||
try { |
|||
in = file.getInputStream(); |
|||
data = new byte[in.available()]; |
|||
in.read(data); |
|||
in.close(); |
|||
base64 = Base64.getEncoder().encodeToString(data); |
|||
base64 = base64.replace("\n", "").replace("\r", ""); |
|||
}catch (IOException e) { |
|||
return null; |
|||
} |
|||
|
|||
return base64; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.shop.cereshop.admin.dao.bwxpay; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
|
|||
/** |
|||
* 描述: |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/20 11:49 |
|||
*/ |
|||
@Mapper |
|||
public interface CereBusinessWxpayDao extends BaseMapper<CereBusinessWxpay> { |
|||
|
|||
CereBusinessWxpay getByBusinessId(@Param("businessId") Long businessId); |
|||
|
|||
} |
@ -0,0 +1,87 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.admin.param.business; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 新账通企业开户 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "BusinessHnapayCreateParam", description = "新账通企业开户") |
|||
public class BusinessHnapayCreateParam { |
|||
|
|||
private Long businessId; |
|||
|
|||
/** |
|||
* 企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "企业名称") |
|||
@NotBlank(message = "企业名称不能为空") |
|||
private String name; |
|||
|
|||
/** |
|||
* 营业执照号 |
|||
*/ |
|||
@ApiModelProperty(value = "营业执照号") |
|||
@NotBlank(message = "营业执照号") |
|||
private String enterpriseCode; |
|||
|
|||
/** |
|||
* 执照效期 |
|||
*/ |
|||
@ApiModelProperty(value = "执照效期") |
|||
@NotBlank(message = "执照效期") |
|||
private String validDate; |
|||
|
|||
/** |
|||
* 银行卡号 |
|||
*/ |
|||
@ApiModelProperty(value = "银行卡号") |
|||
@NotBlank(message = "银行卡号") |
|||
private String bankCard; |
|||
|
|||
/** |
|||
* 银行简码 |
|||
*/ |
|||
@ApiModelProperty(value = "银行简码") |
|||
@NotBlank(message = "银行简码") |
|||
private String bankCode; |
|||
|
|||
/** |
|||
* 开户省份 |
|||
*/ |
|||
@ApiModelProperty(value = "开户省份") |
|||
@NotBlank(message = "开户省份") |
|||
private String bankProvince; |
|||
|
|||
/** |
|||
* 开户城市 |
|||
*/ |
|||
@ApiModelProperty(value = "开户城市") |
|||
@NotBlank(message = "开户城市") |
|||
private String bankCity; |
|||
|
|||
|
|||
/** |
|||
* 开户城市 |
|||
*/ |
|||
@ApiModelProperty(value = "开户支行") |
|||
@NotBlank(message = "开户支行") |
|||
private String bankBranch; |
|||
|
|||
/** |
|||
* 负责人电话 |
|||
*/ |
|||
@ApiModelProperty(value = "负责人电话") |
|||
@NotBlank(message = "负责人电话") |
|||
private String contactPhone; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.shop.cereshop.admin.service.bwxpay; |
|||
|
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerBank; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
|
|||
/** |
|||
* 描述: |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/20 14:19 |
|||
*/ |
|||
public interface CereBusinessWxpayService { |
|||
|
|||
void save(CereBusinessWxpay record) throws CoBusinessException; |
|||
|
|||
void update(CereBusinessWxpay businessWxpay) throws CoBusinessException; |
|||
|
|||
CereBusinessWxpay getByBusinessId(Long businessId) throws CoBusinessException; |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.shop.cereshop.admin.service.bwxpay.impl; |
|||
|
|||
import com.shop.cereshop.admin.dao.bwxpay.CereBusinessWxpayDao; |
|||
import com.shop.cereshop.admin.service.bwxpay.CereBusinessWxpayService; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
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 CereBusinessWxpayServiceImpl implements CereBusinessWxpayService { |
|||
|
|||
@Autowired |
|||
private CereBusinessWxpayDao cereBusinessWxpayDao; |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public void save(CereBusinessWxpay record) throws CoBusinessException { |
|||
cereBusinessWxpayDao.insert(record); |
|||
} |
|||
|
|||
@Override |
|||
public void update(CereBusinessWxpay businessWxpay) throws CoBusinessException { |
|||
cereBusinessWxpayDao.updateById(businessWxpay); |
|||
} |
|||
|
|||
@Override |
|||
public CereBusinessWxpay getByBusinessId(Long businessId) throws CoBusinessException { |
|||
return cereBusinessWxpayDao.getByBusinessId(businessId); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
<?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.shop.cereshop.admin.dao.bwxpay.CereBusinessWxpayDao"> |
|||
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay"> |
|||
<id column="id" jdbcType="BIGINT" property="id"/> |
|||
<result column="business_id" jdbcType="BIGINT" property="businessId" /> |
|||
<result column="app_id" jdbcType="VARCHAR" property="appId" /> |
|||
<result column="app_app_id" jdbcType="VARCHAR" property="appAppId" /> |
|||
<result column="mch_id" jdbcType="VARCHAR" property="mchId" /> |
|||
<result column="cert_url" jdbcType="VARCHAR" property="certUrl" /> |
|||
<result column="mch_key" jdbcType="VARCHAR" property="mchKey" /> |
|||
<result column="secret" jdbcType="VARCHAR" property="secret" /> |
|||
</resultMap> |
|||
|
|||
<select id="getByBusinessId" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay"> |
|||
SELECT * FROM cere_business_wxpay where business_id = #{businessId} |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,21 @@ |
|||
package com.shop.cereshop.app.dao.bwxpay; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
|
|||
/** |
|||
* 描述: |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/20 11:49 |
|||
*/ |
|||
@Mapper |
|||
public interface CereBusinessWxpayDao extends BaseMapper<CereBusinessWxpay> { |
|||
int insertSelective(CereBusinessWxpay record); |
|||
|
|||
CereBusinessWxpay getByBusinessId(@Param("businessId") Long businessId); |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.shop.cereshop.app.service.bwxpay; |
|||
|
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerBank; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
|
|||
/** |
|||
* 描述: |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/20 14:19 |
|||
*/ |
|||
public interface CereBusinessWxpayService { |
|||
|
|||
void save(CereBusinessWxpay record) throws CoBusinessException; |
|||
|
|||
void update(CereBusinessWxpay businessWxpay) throws CoBusinessException; |
|||
|
|||
CereBuyerBank getByBusinessId(Long businessId) throws CoBusinessException; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.shop.cereshop.app.service.bwxpay.impl; |
|||
|
|||
import com.shop.cereshop.app.dao.bwxpay.CereBusinessWxpayDao; |
|||
import com.shop.cereshop.app.service.bwxpay.CereBusinessWxpayService; |
|||
import com.shop.cereshop.commons.domain.buyer.CereBuyerBank; |
|||
import com.shop.cereshop.commons.domain.bwxpay.CereBusinessWxpay; |
|||
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 CereBusinessWxpayServiceImpl implements CereBusinessWxpayService { |
|||
|
|||
@Autowired |
|||
private CereBusinessWxpayDao cereBusinessWxpayDao; |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public void save(CereBusinessWxpay record) throws CoBusinessException { |
|||
cereBusinessWxpayDao.insert(record); |
|||
} |
|||
|
|||
@Override |
|||
public void update(CereBusinessWxpay businessWxpay) throws CoBusinessException { |
|||
cereBusinessWxpayDao.updateById(businessWxpay); |
|||
} |
|||
|
|||
@Override |
|||
public CereBuyerBank getByBusinessId(Long businessId) throws CoBusinessException { |
|||
cereBusinessWxpayDao.getByBusinessId(businessId); |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
package com.shop.cereshop.commons.domain.bwxpay; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 描述: |
|||
* |
|||
* @author stevenhu |
|||
* @version 2025/02/20 11:12 |
|||
*/ |
|||
@Data |
|||
public class CereBusinessWxpay implements Serializable { |
|||
/** |
|||
* 主键Id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 商家id |
|||
*/ |
|||
private Long businessId; |
|||
|
|||
/** |
|||
* 支付小程序appid |
|||
*/ |
|||
private String appId; |
|||
|
|||
/** |
|||
* 支付APP端的appid |
|||
*/ |
|||
private String AppAppId; |
|||
|
|||
/** |
|||
* 商户号 |
|||
*/ |
|||
private String mchId; |
|||
|
|||
/** |
|||
* 证书路径 |
|||
*/ |
|||
private String certUrl; |
|||
|
|||
/** |
|||
* 商户秘钥 |
|||
*/ |
|||
private String mchKey; |
|||
|
|||
/** |
|||
* 私钥 |
|||
*/ |
|||
private String secret; |
|||
|
|||
} |
Reference in new issue
xxxxxxxxxx