8 changed files with 238 additions and 7 deletions
-
67cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BusinessAlipayController.java
-
19cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/BusinessWxpayController.java
-
20cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/balipay/CereBusinessAlipayDao.java
-
19cereshop-admin/src/main/java/com/shop/cereshop/admin/service/balipay/CereBusinessAlipayService.java
-
40cereshop-admin/src/main/java/com/shop/cereshop/admin/service/balipay/impl/CereBusinessAlipayServiceImpl.java
-
18cereshop-admin/src/main/resources/mybatis/mapper/ballipay/CereBusinessAlipayDAO.xml
-
50cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/balipay/CereBusinessAlipay.java
-
12doc/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.service.balipay.CereBusinessAlipayService; |
||||
|
import com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay; |
||||
|
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.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("balipay") |
||||
|
/** |
||||
|
* 注解方式生成日志对象,指定topic生成对象类名 |
||||
|
*/ |
||||
|
@Slf4j(topic = "BusinessAlipayController") |
||||
|
@Api(value = "商家支付宝配置模块", tags = "商家支付宝配置模块") |
||||
|
public class BusinessAlipayController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CereBusinessAlipayService businessAlipayService; |
||||
|
|
||||
|
@PostMapping(value = "save") |
||||
|
@NoRepeatSubmit |
||||
|
@ApiOperation(value = "新建商家支付宝配置信息") |
||||
|
@NoRepeatWebLog |
||||
|
public Result save(@RequestBody CereBusinessAlipay alipay, HttpServletRequest request) throws CoBusinessException { |
||||
|
//获取当前登录账户 |
||||
|
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
||||
|
businessAlipayService.save(alipay); |
||||
|
return new Result(user.getUsername(),"新建商家支付宝配置信息", GsonUtil.objectToGson(alipay)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping(value = "update") |
||||
|
@NoRepeatSubmit |
||||
|
@ApiOperation(value = "修改商家支付宝配置信息") |
||||
|
@NoRepeatWebLog |
||||
|
public Result update(@RequestBody CereBusinessAlipay alipay, HttpServletRequest request) throws CoBusinessException{ |
||||
|
//获取当前登录账户 |
||||
|
CerePlatformUser user = (CerePlatformUser) request.getAttribute("user"); |
||||
|
businessAlipayService.update(alipay); |
||||
|
return new Result(user.getUsername(),"修改商家支付宝配置信息", GsonUtil.objectToGson(alipay)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping(value = "getBusinessAlipay/{businessId}") |
||||
|
@ApiOperation(value = "根据商家id获取支付宝配置信息") |
||||
|
@NoRepeatWebLog |
||||
|
public Result<CereBusinessAlipay> getHnaPayInfo(@PathVariable Long businessId) throws CoBusinessException{ |
||||
|
CereBusinessAlipay alipay = businessAlipayService.getByBusinessId(businessId); |
||||
|
return new Result(alipay, ""); |
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.shop.cereshop.admin.dao.balipay; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 描述: |
||||
|
* |
||||
|
* @author stevenhu |
||||
|
* @version 2025/02/20 11:49 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CereBusinessAlipayDao extends BaseMapper<CereBusinessAlipay> { |
||||
|
|
||||
|
CereBusinessAlipay getByBusinessId(@Param("businessId") Long businessId); |
||||
|
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.shop.cereshop.admin.service.balipay; |
||||
|
|
||||
|
import com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay; |
||||
|
import com.shop.cereshop.commons.exception.CoBusinessException; |
||||
|
|
||||
|
/** |
||||
|
* 描述: |
||||
|
* |
||||
|
* @author stevenhu |
||||
|
* @version 2025/02/20 14:19 |
||||
|
*/ |
||||
|
public interface CereBusinessAlipayService { |
||||
|
|
||||
|
void save(CereBusinessAlipay record) throws CoBusinessException; |
||||
|
|
||||
|
void update(CereBusinessAlipay businessAlipay) throws CoBusinessException; |
||||
|
|
||||
|
CereBusinessAlipay getByBusinessId(Long businessId) throws CoBusinessException; |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.shop.cereshop.admin.service.balipay.impl; |
||||
|
|
||||
|
import com.shop.cereshop.admin.dao.balipay.CereBusinessAlipayDao; |
||||
|
import com.shop.cereshop.admin.service.balipay.CereBusinessAlipayService; |
||||
|
import com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay; |
||||
|
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 CereBusinessAlipayServiceImpl implements CereBusinessAlipayService { |
||||
|
|
||||
|
@Autowired |
||||
|
private CereBusinessAlipayDao cereBusinessAlipayDao; |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
||||
|
public void save(CereBusinessAlipay record) throws CoBusinessException { |
||||
|
cereBusinessAlipayDao.insert(record); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void update(CereBusinessAlipay businessAlipay) throws CoBusinessException { |
||||
|
cereBusinessAlipayDao.updateById(businessAlipay); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CereBusinessAlipay getByBusinessId(Long businessId) throws CoBusinessException { |
||||
|
return cereBusinessAlipayDao.getByBusinessId(businessId); |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
<?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.balipay.CereBusinessAlipayDao"> |
||||
|
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay"> |
||||
|
<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="private_key" jdbcType="VARCHAR" property="privateKey" /> |
||||
|
<result column="decry_key" jdbcType="VARCHAR" property="decryKey" /> |
||||
|
<result column="public_key" jdbcType="VARCHAR" property="publicKey" /> |
||||
|
<result column="gateway_url" jdbcType="VARCHAR" property="gatewayUrl" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="getByBusinessId" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.balipay.CereBusinessAlipay"> |
||||
|
SELECT * FROM cere_business_alipay where business_id = #{businessId} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,50 @@ |
|||||
|
package com.shop.cereshop.commons.domain.balipay; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 描述: |
||||
|
* |
||||
|
* @author stevenhu |
||||
|
* @version 2025/02/20 11:12 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CereBusinessAlipay implements Serializable { |
||||
|
/** |
||||
|
* 主键Id |
||||
|
*/ |
||||
|
private Long id; |
||||
|
|
||||
|
/** |
||||
|
* 商家id |
||||
|
*/ |
||||
|
private Long businessId; |
||||
|
|
||||
|
/** |
||||
|
* 应用appid |
||||
|
*/ |
||||
|
private String appId; |
||||
|
|
||||
|
/** |
||||
|
* 应用私钥 |
||||
|
*/ |
||||
|
private String privateKey; |
||||
|
|
||||
|
/** |
||||
|
* 接口内容解密key |
||||
|
*/ |
||||
|
private String decryKey; |
||||
|
|
||||
|
/** |
||||
|
* 支付宝公钥 |
||||
|
*/ |
||||
|
private String publicKey; |
||||
|
|
||||
|
/** |
||||
|
* 请求网关地址 |
||||
|
*/ |
||||
|
private String gatewayUrl; |
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue