Browse Source

添加支付插件,obs

lianghanqiang 4 years ago
parent
commit
ff9c5c3e41
49 changed files with 760 additions and 757 deletions
  1. 6 0
      pom.xml
  2. 22 0
      src/main/java/org/springblade/common/OrderType.java
  3. 12 0
      src/main/java/org/springblade/common/config/SwaggerConfiguration.java
  4. 29 0
      src/main/java/org/springblade/common/enums/PaymentScene.java
  5. 21 0
      src/main/java/org/springblade/common/enums/PaymentType.java
  6. 1 5
      src/main/java/org/springblade/common/enums/ResCode.java
  7. 1 1
      src/main/java/org/springblade/gateway/app_gateway/controller/AgentController.java
  8. 2 2
      src/main/java/org/springblade/ldt/feedback/entity/Feedback.java
  9. 1 2
      src/main/java/org/springblade/ldt/mall/entity/Mall.java
  10. 2 3
      src/main/java/org/springblade/ldt/shop/entity/Shop.java
  11. 1 1
      src/main/java/org/springblade/ldt/shop/mapper/ShopMapper.xml
  12. 0 128
      src/main/java/org/springblade/ldt/user/controller/UserController.java
  13. 0 34
      src/main/java/org/springblade/ldt/user/dto/UserDTO.java
  14. 0 98
      src/main/java/org/springblade/ldt/user/entity/User.java
  15. 0 42
      src/main/java/org/springblade/ldt/user/mapper/UserMapper.java
  16. 0 25
      src/main/java/org/springblade/ldt/user/mapper/UserMapper.xml
  17. 0 41
      src/main/java/org/springblade/ldt/user/service/IUserService.java
  18. 0 41
      src/main/java/org/springblade/ldt/user/service/impl/UserServiceImpl.java
  19. 0 36
      src/main/java/org/springblade/ldt/user/vo/UserVO.java
  20. 0 49
      src/main/java/org/springblade/ldt/user/wrapper/UserWrapper.java
  21. 29 0
      src/main/java/org/springblade/modules/resource/builder/oss/ObsBuilder.java
  22. 3 0
      src/main/java/org/springblade/modules/resource/builder/oss/OssBuilder.java
  23. 23 0
      src/main/java/org/springblade/modules/resource/enums/BizOssEnum.java
  24. 82 0
      src/main/java/org/springblade/payment/controller/PaymentController.java
  25. 27 0
      src/main/java/org/springblade/payment/entity/PayParam.java
  26. 47 0
      src/main/java/org/springblade/payment/entity/SuccessParams.java
  27. 21 0
      src/main/java/org/springblade/payment/event/AgentChargeEvent.java
  28. 21 0
      src/main/java/org/springblade/payment/event/MallChargeEvent.java
  29. 21 0
      src/main/java/org/springblade/payment/event/UserPayEvent.java
  30. 27 0
      src/main/java/org/springblade/payment/listener/AgentChargeListener.java
  31. 25 0
      src/main/java/org/springblade/payment/listener/MallChargeListener.java
  32. 25 0
      src/main/java/org/springblade/payment/listener/UserPayListener.java
  33. 54 0
      src/main/java/org/springblade/payment/plugin/Payment.java
  34. 26 0
      src/main/java/org/springblade/payment/plugin/PaymentBuilder.java
  35. 113 0
      src/main/java/org/springblade/payment/plugin/YeePayPlugin.java
  36. 13 0
      src/main/java/org/springblade/payment/service/IPaymentService.java
  37. 43 0
      src/main/java/org/springblade/payment/service/impl/PaymentService.java
  38. 0 16
      src/main/java/org/springblade/yeePay/event/BatchTransferEvent.java
  39. 0 16
      src/main/java/org/springblade/yeePay/event/GatewayEvent.java
  40. 0 15
      src/main/java/org/springblade/yeePay/event/PayNotifyEvent.java
  41. 0 16
      src/main/java/org/springblade/yeePay/event/TransferEvent.java
  42. 0 27
      src/main/java/org/springblade/yeePay/listener/BatchTransferNotifyListener.java
  43. 0 28
      src/main/java/org/springblade/yeePay/listener/GatewayNotifyListener.java
  44. 0 44
      src/main/java/org/springblade/yeePay/listener/PayNotifyListener.java
  45. 0 27
      src/main/java/org/springblade/yeePay/listener/TransferNotifyListener.java
  46. 0 60
      src/main/java/org/springblade/yeePay/service/YeePayService.java
  47. 3 0
      src/main/resources/application-dev.yml
  48. 40 0
      src/main/resources/payConfig.properties
  49. 19 0
      src/main/resources/wxConfig.properties

+ 6 - 0
pom.xml

@@ -206,6 +206,12 @@
             <artifactId>hutool-all</artifactId>
             <version>5.7.9</version>
         </dependency>
+        <!--  易宝支付SDK   -->
+        <dependency>
+            <groupId>com.yeepay.yop.sdk</groupId>
+            <artifactId>yop-java-sdk</artifactId>
+            <version>4.1.4-jdk7</version>
+        </dependency>
 
         <!-- obs sdk -->
         <dependency>

+ 22 - 0
src/main/java/org/springblade/common/OrderType.java

@@ -0,0 +1,22 @@
+package org.springblade.common;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author: lianghanqiang
+ * @description: 订单类型
+ * @since: 7/29/21 -- 1:56 PM
+ */
+@AllArgsConstructor
+@Getter
+public enum OrderType {
+
+	/* 用户付款 */
+	USER_PAY("USER_PAY"),
+	AGENT_CHARGE("AGENT_CHARGE"),
+	MALL_CHARGE("MALL_CHARGE");
+
+	String name;
+
+}

+ 12 - 0
src/main/java/org/springblade/common/config/SwaggerConfiguration.java

@@ -68,6 +68,18 @@ public class SwaggerConfiguration {
 			Arrays.asList(AppConstant.BASE_PACKAGES + ".modules.system", AppConstant.BASE_PACKAGES + ".modules.resource"));
 	}
 
+	@Bean
+	public Docket ldtDocket() {
+		return docket("联兑通",
+			Arrays.asList(AppConstant.BASE_PACKAGES + ".modules.ldt"));
+	}
+
+	@Bean
+	public Docket payDocket() {
+		return docket("支付模块",
+			Arrays.asList(AppConstant.BASE_PACKAGES + ".modules.pay"));
+	}
+
 	@Bean
 	public Docket flowDocket() {
 		return docket("工作流模块", Collections.singletonList(AppConstant.BASE_PACKAGES + ".flow"));

+ 29 - 0
src/main/java/org/springblade/common/enums/PaymentScene.java

@@ -0,0 +1,29 @@
+package org.springblade.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author: lianghanqiang
+ * @description: 支付场景
+ * @since: 7/29/21 -- 1:56 PM
+ */
+@AllArgsConstructor
+@Getter
+public enum PaymentScene {
+
+	/* 扫码支付 */
+	SCAN_CODE("scanCode"),
+
+
+	/* 对公转账 */
+	TRANSFER("transfer"),
+
+	/* 收款码支付 */
+	PAY_CODE("payCode"),
+
+	/* 小程序支付 */
+	MINI_PROGRAM("mini_program");
+	String name;
+
+}

+ 21 - 0
src/main/java/org/springblade/common/enums/PaymentType.java

@@ -0,0 +1,21 @@
+package org.springblade.common.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author: lianghanqiang
+ * @description:
+ * @since: 7/29/21 -- 2:47 PM
+ */
+@AllArgsConstructor
+@Getter
+public enum PaymentType {
+	/**
+	 *	易宝支付
+	 **/
+	YEE_PAY("yeePay");
+
+
+	String name;
+}

+ 1 - 5
src/main/java/org/springblade/common/enums/ResCode.java

@@ -13,10 +13,6 @@ import org.springblade.core.tool.api.IResultCode;
 @AllArgsConstructor
 public enum ResCode implements IResultCode {
 
-
-
-
-
 	/*  支付模块  */
 	PAY_FAIL(511,"支付异常"),
 	PAY_TYPE_ERROR(512,"支付方式错误"),
@@ -37,7 +33,7 @@ public enum ResCode implements IResultCode {
 
 
 
-	Integer code;
+	int code;
 	String message;
 
 }

+ 1 - 1
src/main/java/org/springblade/gateway/app_gateway/controller/AgentController.java

@@ -2,8 +2,8 @@ package org.springblade.gateway.app_gateway.controller;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springblade.app_gateway.entity.vo.AgenterInfoVO;
 import org.springblade.core.tool.api.R;
+import org.springblade.gateway.app_gateway.entity.vo.AgenterInfoVO;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;

+ 2 - 2
src/main/java/org/springblade/ldt/feedback/entity/Feedback.java

@@ -57,9 +57,9 @@ public class Feedback implements Serializable {
 		@ApiModelProperty(value = "反馈内容")
 		private String content;
 	/**
-	* 图片,多个用,"隔开
+	* 图片,多个用,隔开
 	*/
-		@ApiModelProperty(value = "图片,多个用,"隔开")
+		@ApiModelProperty(value = "图片,多个用,隔开")
 		private String pics;
 	/**
 	* 联系方式

+ 1 - 2
src/main/java/org/springblade/ldt/mall/entity/Mall.java

@@ -17,7 +17,6 @@
 package org.springblade.ldt.mall.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.sql.Blob;
 import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -106,7 +105,7 @@ public class Mall implements Serializable {
 	* 是否启用会员中心
 	*/
 		@ApiModelProperty(value = "是否启用会员中心")
-		private Blob useMember;
+		private Integer useMember;
 
 
 }

+ 2 - 3
src/main/java/org/springblade/ldt/shop/entity/Shop.java

@@ -18,7 +18,6 @@ package org.springblade.ldt.shop.entity;
 
 import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.sql.Blob;
 import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -132,7 +131,7 @@ public class Shop implements Serializable {
 	* 是否启用会员中心
 	*/
 		@ApiModelProperty(value = "是否启用会员中心")
-		private Blob useMember;
+		private Integer useMember;
 	/**
 	* 邮箱
 	*/
@@ -172,7 +171,7 @@ public class Shop implements Serializable {
 	* 审核意见
 	*/
 		@ApiModelProperty(value = "审核意见")
-		private String audit-comment;
+		private String auditComment;
 	/**
 	* 账单应收
 	*/

+ 1 - 1
src/main/java/org/springblade/ldt/shop/mapper/ShopMapper.xml

@@ -30,7 +30,7 @@
         <result column="shop_audit_id" property="shopAuditId"/>
         <result column="slogan" property="slogan"/>
         <result column="audit_status" property="auditStatus"/>
-        <result column="audit-comment" property="audit-comment"/>
+        <result column="audit_comment" property="auditComment"/>
         <result column="charge" property="charge"/>
     </resultMap>
 

+ 0 - 128
src/main/java/org/springblade/ldt/user/controller/UserController.java

@@ -1,128 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.controller;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
-import org.springblade.core.mp.support.Condition;
-import org.springblade.core.mp.support.Query;
-import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.Func;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.ldt.user.entity.User;
-import org.springblade.ldt.user.vo.UserVO;
-import org.springblade.ldt.user.wrapper.UserWrapper;
-import org.springblade.ldt.user.service.IUserService;
-import org.springblade.core.boot.ctrl.BladeController;
-
-/**
- *  控制器
- *
- * @author BladeX
- * @since 2021-08-24
- */
-@RestController
-@AllArgsConstructor
-@RequestMapping("ldt_user/user")
-@Api(value = "", tags = "接口")
-public class UserController extends BladeController {
-
-	private final IUserService userService;
-
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入user")
-	public R<UserVO> detail(User user) {
-		User detail = userService.getOne(Condition.getQueryWrapper(user));
-		return R.data(UserWrapper.build().entityVO(detail));
-	}
-
-	/**
-	 * 分页 
-	 */
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页", notes = "传入user")
-	public R<IPage<UserVO>> list(User user, Query query) {
-		IPage<User> pages = userService.page(Condition.getPage(query), Condition.getQueryWrapper(user));
-		return R.data(UserWrapper.build().pageVO(pages));
-	}
-
-
-	/**
-	 * 自定义分页 
-	 */
-	@GetMapping("/page")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入user")
-	public R<IPage<UserVO>> page(UserVO user, Query query) {
-		IPage<UserVO> pages = userService.selectUserPage(Condition.getPage(query), user);
-		return R.data(pages);
-	}
-
-	/**
-	 * 新增 
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入user")
-	public R save(@Valid @RequestBody User user) {
-		return R.status(userService.save(user));
-	}
-
-	/**
-	 * 修改 
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入user")
-	public R update(@Valid @RequestBody User user) {
-		return R.status(userService.updateById(user));
-	}
-
-	/**
-	 * 新增或修改 
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入user")
-	public R submit(@Valid @RequestBody User user) {
-		return R.status(userService.saveOrUpdate(user));
-	}
-
-	
-	/**
-	 * 删除 
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 8)
-	@ApiOperation(value = "删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(userService.removeByIds(Func.toLongList(ids)));
-	}
-
-	
-}

+ 0 - 34
src/main/java/org/springblade/ldt/user/dto/UserDTO.java

@@ -1,34 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.dto;
-
-import org.springblade.ldt.user.entity.User;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 数据传输对象实体类
- *
- * @author BladeX
- * @since 2021-08-24
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class UserDTO extends User {
-	private static final long serialVersionUID = 1L;
-
-}

+ 0 - 98
src/main/java/org/springblade/ldt/user/entity/User.java

@@ -1,98 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.time.LocalDate;
-import java.sql.Blob;
-import java.io.Serializable;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * 实体类
- *
- * @author BladeX
- * @since 2021-08-24
- */
-@Data
-@TableName("ldt_user")
-@ApiModel(value = "User对象", description = "User对象")
-public class User implements Serializable {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	* 用户id
-	*/
-		@ApiModelProperty(value = "用户id")
-		private Long id;
-	/**
-	* 渠道积分
-	*/
-		@ApiModelProperty(value = "渠道积分")
-		private Double channelPoint;
-	/**
-	* 账户余额
-	*/
-		@ApiModelProperty(value = "账户余额")
-		private Double balance;
-	/**
-	* 手机号码
-	*/
-		@ApiModelProperty(value = "手机号码")
-		private String phone;
-	/**
-	* 用户openID
-	*/
-		@ApiModelProperty(value = "用户openID")
-		private String openid;
-	/**
-	* 用户头像
-	*/
-		@ApiModelProperty(value = "用户头像")
-		private String avatar;
-	/**
-	* 用户昵称
-	*/
-		@ApiModelProperty(value = "用户昵称")
-		private String nickName;
-	/**
-	* 男、女
-	*/
-		@ApiModelProperty(value = "男、女")
-		private String sex;
-	/**
-	* 出生日期
-	*/
-		@ApiModelProperty(value = "出生日期")
-		private LocalDate birth;
-	/**
-	* 总价值额度
-	*/
-		@ApiModelProperty(value = "总价值额度")
-		private Double totalValue;
-	/**
-	* 是否是代理
-	*/
-		@ApiModelProperty(value = "是否是代理")
-		private Blob agent;
-
-
-}

+ 0 - 42
src/main/java/org/springblade/ldt/user/mapper/UserMapper.java

@@ -1,42 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.mapper;
-
-import org.springblade.ldt.user.entity.User;
-import org.springblade.ldt.user.vo.UserVO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import java.util.List;
-
-/**
- *  Mapper 接口
- *
- * @author BladeX
- * @since 2021-08-24
- */
-public interface UserMapper extends BaseMapper<User> {
-
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param user
-	 * @return
-	 */
-	List<UserVO> selectUserPage(IPage page, UserVO user);
-
-}

+ 0 - 25
src/main/java/org/springblade/ldt/user/mapper/UserMapper.xml

@@ -1,25 +0,0 @@
-<?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="org.springblade.ldt.user.mapper.UserMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="userResultMap" type="org.springblade.ldt.user.entity.User">
-        <id column="id" property="id"/>
-        <result column="channel_point" property="channelPoint"/>
-        <result column="balance" property="balance"/>
-        <result column="phone" property="phone"/>
-        <result column="openid" property="openid"/>
-        <result column="avatar" property="avatar"/>
-        <result column="nick_name" property="nickName"/>
-        <result column="sex" property="sex"/>
-        <result column="birth" property="birth"/>
-        <result column="total_value" property="totalValue"/>
-        <result column="agent" property="agent"/>
-    </resultMap>
-
-
-    <select id="selectUserPage" resultMap="userResultMap">
-        select * from ldt_user where is_deleted = 0
-    </select>
-
-</mapper>

+ 0 - 41
src/main/java/org/springblade/ldt/user/service/IUserService.java

@@ -1,41 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.service;
-
-import org.springblade.ldt.user.entity.User;
-import org.springblade.ldt.user.vo.UserVO;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-/**
- *  服务类
- *
- * @author BladeX
- * @since 2021-08-24
- */
-public interface IUserService extends IService<User> {
-
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param user
-	 * @return
-	 */
-	IPage<UserVO> selectUserPage(IPage<UserVO> page, UserVO user);
-
-}

+ 0 - 41
src/main/java/org/springblade/ldt/user/service/impl/UserServiceImpl.java

@@ -1,41 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.service.impl;
-
-import org.springblade.ldt.user.entity.User;
-import org.springblade.ldt.user.vo.UserVO;
-import org.springblade.ldt.user.mapper.UserMapper;
-import org.springblade.ldt.user.service.IUserService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-/**
- *  服务实现类
- *
- * @author BladeX
- * @since 2021-08-24
- */
-@Service
-public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
-
-	@Override
-	public IPage<UserVO> selectUserPage(IPage<UserVO> page, UserVO user) {
-		return page.setRecords(baseMapper.selectUserPage(page, user));
-	}
-
-}

+ 0 - 36
src/main/java/org/springblade/ldt/user/vo/UserVO.java

@@ -1,36 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.vo;
-
-import org.springblade.ldt.user.entity.User;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import io.swagger.annotations.ApiModel;
-
-/**
- * 视图实体类
- *
- * @author BladeX
- * @since 2021-08-24
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "UserVO对象", description = "UserVO对象")
-public class UserVO extends User {
-	private static final long serialVersionUID = 1L;
-
-}

+ 0 - 49
src/main/java/org/springblade/ldt/user/wrapper/UserWrapper.java

@@ -1,49 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.ldt.user.wrapper;
-
-import org.springblade.core.mp.support.BaseEntityWrapper;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.ldt.user.entity.User;
-import org.springblade.ldt.user.vo.UserVO;
-import java.util.Objects;
-
-/**
- * 包装类,返回视图层所需的字段
- *
- * @author BladeX
- * @since 2021-08-24
- */
-public class UserWrapper extends BaseEntityWrapper<User, UserVO>  {
-
-	public static UserWrapper build() {
-		return new UserWrapper();
- 	}
-
-	@Override
-	public UserVO entityVO(User user) {
-		UserVO userVO = Objects.requireNonNull(BeanUtil.copy(user, UserVO.class));
-
-		//User createUser = UserCache.getUser(user.getCreateUser());
-		//User updateUser = UserCache.getUser(user.getUpdateUser());
-		//userVO.setCreateUserName(createUser.getName());
-		//userVO.setUpdateUserName(updateUser.getName());
-
-		return userVO;
-	}
-
-}

+ 29 - 0
src/main/java/org/springblade/modules/resource/builder/oss/ObsBuilder.java

@@ -0,0 +1,29 @@
+package org.springblade.modules.resource.builder.oss;
+
+import com.obs.services.ObsClient;
+import lombok.SneakyThrows;
+import org.springblade.core.oss.OssTemplate;
+import org.springblade.core.oss.props.OssProperties;
+import org.springblade.core.oss.rule.OssRule;
+import org.springblade.modules.resource.entity.Oss;
+import org.springblade.modules.resource.template.ObsTemplate;
+
+/**
+ * @author: lianghanqiang
+ * @description:
+ * @since: 7/27/21 -- 3:01 PM
+ */
+public class ObsBuilder {
+	@SneakyThrows
+	public static OssTemplate template(Oss oss, OssRule ossRule) {
+		// 创建配置类
+		OssProperties ossProperties = new OssProperties();
+		ossProperties.setEndpoint(oss.getEndpoint());
+		ossProperties.setAccessKey(oss.getAccessKey());
+		ossProperties.setSecretKey(oss.getSecretKey());
+		ossProperties.setBucketName(oss.getBucketName());
+
+		ObsClient obsClient = new ObsClient(ossProperties.getAccessKey(), ossProperties.getSecretKey(), ossProperties.getEndpoint());
+		return new ObsTemplate(obsClient,ossProperties,ossRule);
+	}
+}

+ 3 - 0
src/main/java/org/springblade/modules/resource/builder/oss/OssBuilder.java

@@ -32,6 +32,7 @@ import org.springblade.core.tool.utils.StringPool;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.core.tool.utils.WebUtil;
 import org.springblade.modules.resource.entity.Oss;
+import org.springblade.modules.resource.enums.BizOssEnum;
 import org.springblade.modules.resource.service.IOssService;
 
 import java.util.Map;
@@ -107,6 +108,8 @@ public class OssBuilder {
 						template = AliOssBuilder.template(oss, ossRule);
 					} else if (oss.getCategory() == OssEnum.TENCENT.getCategory()) {
 						template = TencentOssBuilder.template(oss, ossRule);
+					} else if(oss.getCategory() == BizOssEnum.HWYUN.getCategory()){
+						template = ObsBuilder.template(oss,ossRule);
 					}
 					templatePool.put(tenantId, template);
 					ossPool.put(tenantId, oss);

+ 23 - 0
src/main/java/org/springblade/modules/resource/enums/BizOssEnum.java

@@ -0,0 +1,23 @@
+package org.springblade.modules.resource.enums;
+
+
+import lombok.Getter;
+
+/**
+ * @author: lianghanqiang
+ * @description:
+ * @since: 7/27/21 -- 3:22 PM
+ */
+@Getter
+public enum BizOssEnum {
+
+	HWYUN("huaweiyun",5);
+
+	String name;
+	 int category;
+
+	  BizOssEnum(String name, Integer category){
+	 	this.name = name;
+	 	this.category = category;
+	 }
+}

+ 82 - 0
src/main/java/org/springblade/payment/controller/PaymentController.java

@@ -0,0 +1,82 @@
+package org.springblade.payment.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springblade.common.enums.PaymentScene;
+import org.springblade.common.enums.PaymentType;
+import org.springblade.common.enums.ResCode;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.tool.api.R;
+import org.springblade.payment.entity.PayParam;
+import org.springblade.payment.plugin.Payment;
+import org.springblade.payment.plugin.PaymentBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Optional;
+
+/**
+ * @author: lianghanqiang
+ * @description:  支付模块控制器
+ * @since: 7/29/21 -- 1:55 PM
+ */
+@Api(tags = "支付模块")
+@RestController
+@RequestMapping("/payment")
+public class PaymentController {
+
+	@Autowired
+	PaymentBuilder paymentBuilder;
+
+	@ApiOperation("订单支付")
+	@GetMapping("/payOrder/{paymentType}/{paymentScene}")
+	public R payOrder(
+		@PathVariable String paymentType,
+		@PathVariable String paymentScene,
+		@Validated PayParam payParam
+	){
+		//获取支付插件
+		Payment payment =  pluginBuild(paymentType);
+		//解析支付场景
+		PaymentScene scene = Optional.ofNullable(PaymentScene.valueOf(paymentScene))
+				.orElseThrow(()-> new ServiceException(ResCode.PAY_SCENE_ERROR));
+		switch (scene){
+			case PAY_CODE:
+				return payment.payCode(payParam);
+			case SCAN_CODE:
+				return payment.nativePay(payParam);
+			case TRANSFER:
+				return payment.transfer(payParam);
+			case MINI_PROGRAM:
+				return payment.miniProgram(payParam);
+			default:
+		}
+		return null;
+	}
+
+	@GetMapping("support")
+	@ApiOperation("获取支付类型列表")
+	public R<PaymentType[]> getSupportList(){
+		return R.data(PaymentType.values());
+	}
+
+
+	@ApiOperation(value = "支付回调")
+	@RequestMapping(value = "/callback/{paymentType}", method = {RequestMethod.GET, RequestMethod.POST})
+	public R callback(HttpServletRequest request, @PathVariable String paymentType) {
+		System.out.println("我是回调:");
+		//获取支付插件
+		Payment payment = pluginBuild(paymentType);
+		payment.callback(request);
+		return R.success("操作成功");
+	}
+
+
+	private Payment pluginBuild(String paymentType){
+		return paymentBuilder.fetchPaymentPlugin(
+			Optional.ofNullable(PaymentType.valueOf(paymentType))
+				.orElseThrow(()-> new ServiceException(ResCode.PAY_TYPE_ERROR))
+		);
+	}
+}

+ 27 - 0
src/main/java/org/springblade/payment/entity/PayParam.java

@@ -0,0 +1,27 @@
+package org.springblade.payment.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author: lianghanqiang
+ * @description:  支付参数
+ * @since: 7/29/21 -- 2:12 PM
+ */
+@Data
+@Builder
+@ToString
+@AllArgsConstructor
+@NoArgsConstructor
+public class PayParam {
+
+	@NotNull
+	@ApiModelProperty(value = "交易类型")
+	private String orderType;
+
+	@NotNull
+	@ApiModelProperty(value = "订单号")
+	private String orderId;
+}

+ 47 - 0
src/main/java/org/springblade/payment/entity/SuccessParams.java

@@ -0,0 +1,47 @@
+package org.springblade.payment.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author: lianghanqiang
+ * @description: 支付成功参数
+ * @since: 8/5/21 -- 2:38 PM
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SuccessParams {
+
+	public static final String PAY_STATUS_SUCCESS = "success";
+	public static final String PAY_STATUS_FAIL = "fail";
+
+	/**
+	 * 订单id
+	 */
+	private String billId;
+	/**
+	 * 平台id
+	 */
+	private String platformId;
+	/**
+	 * orderId
+	 */
+	private String orderId;
+	/**
+	 * 支付状态
+	 */
+	private String status;
+	/**
+	 * 订单类型
+	 */
+	private String orderType;
+
+	/**
+	 * payChannel支付渠道
+	 */
+	private String payChannel;
+}

+ 21 - 0
src/main/java/org/springblade/payment/event/AgentChargeEvent.java

@@ -0,0 +1,21 @@
+package org.springblade.payment.event;
+
+import lombok.Getter;
+import org.springblade.payment.entity.SuccessParams;
+import org.springframework.context.ApplicationEvent;
+
+/**
+ * @author: lianghanqiang
+ * @description: 代理充值回调事件
+ * @since: 8/5/21 -- 2:58 PM
+ */
+@Getter
+public class AgentChargeEvent extends ApplicationEvent {
+
+	private SuccessParams successParams;
+
+	public AgentChargeEvent(SuccessParams successParams) {
+		super(successParams);
+		this.successParams =successParams;
+	}
+}

+ 21 - 0
src/main/java/org/springblade/payment/event/MallChargeEvent.java

@@ -0,0 +1,21 @@
+package org.springblade.payment.event;
+
+import lombok.Getter;
+import org.springblade.payment.entity.SuccessParams;
+import org.springframework.context.ApplicationEvent;
+
+/**
+ * @author: lianghanqiang
+ * @description: 商场充值回调事件
+ * @since: 8/5/21 -- 2:58 PM
+ */
+@Getter
+public class MallChargeEvent extends ApplicationEvent {
+
+	private SuccessParams successParams;
+
+	public MallChargeEvent(SuccessParams successParams) {
+		super(successParams);
+		this.successParams =successParams;
+	}
+}

+ 21 - 0
src/main/java/org/springblade/payment/event/UserPayEvent.java

@@ -0,0 +1,21 @@
+package org.springblade.payment.event;
+
+import lombok.Getter;
+import org.springblade.payment.entity.SuccessParams;
+import org.springframework.context.ApplicationEvent;
+
+/**
+ * @author: lianghanqiang
+ * @description: 用户充值回调事件
+ * @since: 8/5/21 -- 2:58 PM
+ */
+@Getter
+public class UserPayEvent extends ApplicationEvent {
+
+	private SuccessParams successParams;
+
+	public UserPayEvent(SuccessParams successParams) {
+		super(successParams);
+		this.successParams =successParams;
+	}
+}

+ 27 - 0
src/main/java/org/springblade/payment/listener/AgentChargeListener.java

@@ -0,0 +1,27 @@
+package org.springblade.payment.listener;
+
+import org.springblade.payment.entity.SuccessParams;
+import org.springblade.payment.event.AgentChargeEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * @author: lianghanqiang
+ * @description: 代理付款回调
+ * @since: 8/5/21 -- 3:01 PM
+ */
+@Component
+public class AgentChargeListener {
+	
+
+	private final static String SUCCESS_STATUS = "success";
+
+
+	@EventListener
+	@Async
+	public void PaySuccess(AgentChargeEvent agentChargeEvent){
+		SuccessParams successParams = agentChargeEvent.getSuccessParams();
+	}
+}

+ 25 - 0
src/main/java/org/springblade/payment/listener/MallChargeListener.java

@@ -0,0 +1,25 @@
+package org.springblade.payment.listener;
+
+import org.springblade.payment.entity.SuccessParams;
+import org.springblade.payment.event.MallChargeEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author: lianghanqiang
+ * @description: 代理付款回调
+ * @since: 8/5/21 -- 3:01 PM
+ */
+@Component
+public class MallChargeListener {
+
+
+	@EventListener
+	@Async
+	@Transactional
+	public void PaySuccess(MallChargeEvent mallChargeEvent){
+		SuccessParams successParams = mallChargeEvent.getSuccessParams();
+	}
+}

+ 25 - 0
src/main/java/org/springblade/payment/listener/UserPayListener.java

@@ -0,0 +1,25 @@
+package org.springblade.payment.listener;
+
+
+import org.springblade.payment.entity.SuccessParams;
+import org.springblade.payment.event.UserPayEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author: lianghanqiang
+ * @description: 用户付款回调
+ * @since: 8/5/21 -- 3:01 PM
+ */
+@Component
+public class UserPayListener {
+
+	@EventListener
+	@Async
+	@Transactional
+	public void PaySuccess(UserPayEvent userPayEvent){
+		SuccessParams successParams = userPayEvent.getSuccessParams();
+	}
+}

+ 54 - 0
src/main/java/org/springblade/payment/plugin/Payment.java

@@ -0,0 +1,54 @@
+package org.springblade.payment.plugin;
+
+
+import org.springblade.core.tool.api.R;
+import org.springblade.payment.entity.PayParam;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author: lianghanqiang
+ * @description: 支付插件抽象层
+ * @since: 7/29/21 -- 2:08 PM
+ */
+public interface Payment {
+
+	String CALLBACK_DOMAIN = "https://ldt.guosen-fumao.cn/api";
+
+	String CALLBACK_PREFIX = "/payment/callback/";
+	/**
+	 * 	扫码支付
+	 * */
+	R nativePay(PayParam payParam);
+
+	/**
+	 * 	收款码支付
+	 * */
+	R payCode(PayParam payParam);
+
+	/**
+	 * 	对公户打款
+	 * */
+	R transfer(PayParam payParam);
+
+	/**
+	 * 	支付回调
+	 * */
+	void callback(HttpServletRequest request);
+
+	/**
+	 * 	获取回调地址
+	 * */
+	default String callbackUrl(String paymentType){
+		return CALLBACK_DOMAIN + CALLBACK_PREFIX + paymentType;
+	}
+
+	/**
+	 * 	获取订单详情
+	 * */
+//	default BillRecord getOrderDetail(PayParam payParam, IBillRecordService billRecordService){
+//		return billRecordService.getById(payParam.getOrderId());
+//	}
+
+	R miniProgram(PayParam payParam);
+}

+ 26 - 0
src/main/java/org/springblade/payment/plugin/PaymentBuilder.java

@@ -0,0 +1,26 @@
+package org.springblade.payment.plugin;
+
+import lombok.AllArgsConstructor;
+import org.springblade.common.enums.PaymentType;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author: lianghanqiang
+ * @description:  支付插件构造工厂
+ * @since: 7/29/21 -- 2:54 PM
+ */
+@Component
+@AllArgsConstructor
+public class PaymentBuilder {
+
+	YeePayPlugin yeePayPlugin;
+
+	public Payment fetchPaymentPlugin(PaymentType paymentType){
+		switch (paymentType){
+			case YEE_PAY:
+				return yeePayPlugin;
+			default:
+		}
+		return null;
+	}
+}

+ 113 - 0
src/main/java/org/springblade/payment/plugin/YeePayPlugin.java

@@ -0,0 +1,113 @@
+package org.springblade.payment.plugin;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.api.R;
+import org.springblade.payment.entity.PayParam;
+import org.springblade.yeePay.entity.InitOrderDto;
+import org.springblade.yeePay.service.YeePayService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author: lianghanqiang
+ * @description: 易宝支付插件
+ * @since: 7/29/21 -- 2:56 PM
+ */
+@Component
+@Slf4j
+public class YeePayPlugin implements Payment {
+
+	@Autowired
+	YeePayService yeePayService;
+
+	@Override
+	public R nativePay(PayParam payParam) {
+		return yeePayService.createCode(null);
+	}
+	@Override
+	public R payCode(PayParam payParam) {
+		return R.data("我还没有实现,你等等");
+	}
+
+	@Override
+	public R transfer(PayParam payParam) {
+		return yeePayService.payByGateWay(null);
+	}
+
+	@Override
+	public void callback(HttpServletRequest request) {
+//
+//		log.info("易宝网关支付回调: map"+ JSON.toJSONString(request.getParameterMap()));
+//
+//		JSONObject jsonObject = yeePayService.deCodeNotifyData(request.getParameterMap().get("cipherText")[0]);
+//		log.info("易宝网关支付解密回调密文:"+jsonObject.toJSONString());
+//
+//		SuccessParams successParams = PaymentCache.getSuccessParams(jsonObject.getString("orderId"));
+//
+//		Assert.notNull(successParams,"订单回调参数数据获取失败!");
+//
+//		successParams.setPlatformId(jsonObject.getString("uniqueOrderNo"));
+//		successParams.setPayChannel(jsonObject.getString("channel"));
+//		successParams.setStatus(
+//			"SUCCESS".equals(jsonObject.getString("status")) ?
+//			SuccessParams.PAY_STATUS_SUCCESS:
+//			SuccessParams.PAY_STATUS_FAIL);
+//		//处理付款后业务流程
+//		paymentService.success(successParams);
+	}
+
+	@Override
+	public R miniProgram(PayParam payParam) {
+		//查询订单状态
+//		BillRecord bill = getOrderDetail(payParam,billRecordService);
+//		Assert.notNull(bill,"订单查询失败,无此订单信息!");
+//
+//		//封装回调参数
+//		SuccessParams successParams = SuccessParams
+//			.builder()
+//			.billId(Convert.toStr(bill.getId()))
+//			.orderType(OrderType.valueOf(bill.getType()).name())
+//			.build();
+//		PaymentCache.putSuccessParams(Convert.toStr(bill.getId()),successParams);
+
+		return yeePayService.initOrder(
+			InitOrderDto.builder()
+				.payWay("MINI_PROGRAM")
+				.channel("WECHAT")
+				.scene("OFFLINE")
+//				.goodsName(bill.getBillsTitle())
+//				.orderId(Convert.toStr(bill.getId()))
+//				.orderAmount(Double.valueOf(bill.getPayAmount()))
+//				.appId(bill.getAppId())
+//				.userId(bill.getOpenId())
+//				.userIp("127.0.0.1")
+//				.notifyUrl(callbackUrl(PaymentType.YEE_PAY.name()))
+				.build()
+		);
+	}
+
+	public static void main(String[] args) {
+		String s = "{\n" +
+			"    \"channelOrderId\":\"4200001123202108069046794860\",\n" +
+			"    \"orderId\":\"1423594166159466497\",\n" +
+			"    \"bankOrderId\":\"5955072001210806\",\n" +
+			"    \"paySuccessDate\":\"2021-08-06 18:38:19\",\n" +
+			"    \"channel\":\"WECHAT\",\n" +
+			"    \"payWay\":\"USER_SCAN\",\n" +
+			"    \"uniqueOrderNo\":\"1013202108060000002490940644\",\n" +
+			"    \"orderAmount\":\"0.10\",\n" +
+			"    \"payAmount\":\"0.10\",\n" +
+			"    \"payerInfo\":\"{\\\"bankCardNo\\\":\\\"\\\",\\\"bankId\\\":\\\"CFT\\\",\\\"cardType\\\":\\\"CFT\\\",\\\"mobilePhoneNo\\\":\\\"\\\",\\\"userID\\\":\\\"o19581JoLz7p2SjLLoQ6jBBLN7Ws\\\"}\",\n" +
+			"    \"realPayAmount\":\"0.10\",\n" +
+			"    \"parentMerchantNo\":\"10086062555\",\n" +
+			"    \"merchantNo\":\"10086062555\",\n" +
+			"    \"status\":\"SUCCESS\"\n" +
+			"}";
+		JSONObject jsonObject = JSON.parseObject(s);
+		System.out.println(jsonObject.getString("uniqueOrderNo"));
+
+	}
+}

+ 13 - 0
src/main/java/org/springblade/payment/service/IPaymentService.java

@@ -0,0 +1,13 @@
+package org.springblade.payment.service;
+
+
+import org.springblade.payment.entity.SuccessParams;
+
+/**
+ * @author: lianghanqiang
+ * @description:	支付业务逻辑处理
+ * @since: 8/5/21 -- 2:33 PM
+ */
+public interface IPaymentService {
+	void success(SuccessParams build);
+}

+ 43 - 0
src/main/java/org/springblade/payment/service/impl/PaymentService.java

@@ -0,0 +1,43 @@
+package org.springblade.payment.service.impl;
+
+import org.springblade.common.OrderType;
+import org.springblade.payment.entity.SuccessParams;
+import org.springblade.payment.event.AgentChargeEvent;
+import org.springblade.payment.event.MallChargeEvent;
+import org.springblade.payment.event.UserPayEvent;
+import org.springblade.payment.service.IPaymentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author: lianghanqiang
+ * @description:
+ * @since: 8/5/21 -- 2:34 PM
+ */
+@Service
+public class PaymentService implements IPaymentService {
+
+	@Autowired
+	private ApplicationEventPublisher eventPublisher;
+
+	@Override
+	public void success(SuccessParams successParams) {
+		switch (OrderType.valueOf(successParams.getOrderType())){
+			case USER_PAY:
+				eventPublisher.publishEvent(new UserPayEvent(successParams));
+				return;
+			case AGENT_CHARGE:
+				eventPublisher.publishEvent(new AgentChargeEvent(successParams));
+				return;
+			case MALL_CHARGE:
+				eventPublisher.publishEvent(new MallChargeEvent(successParams));
+				return;
+			default: return;
+
+		}
+	}
+
+
+
+}

+ 0 - 16
src/main/java/org/springblade/yeePay/event/BatchTransferEvent.java

@@ -1,16 +0,0 @@
-package org.springblade.yeePay.event;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Getter;
-import org.springframework.context.ApplicationEvent;
-
-@Getter
-public class BatchTransferEvent extends ApplicationEvent {
-
- 	private JSONObject decryptData;
-
-	public BatchTransferEvent(JSONObject decryptData) {
-		super(decryptData);
-		this.decryptData = decryptData;
-	}
-}

+ 0 - 16
src/main/java/org/springblade/yeePay/event/GatewayEvent.java

@@ -1,16 +0,0 @@
-package org.springblade.yeePay.event;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Getter;
-import org.springframework.context.ApplicationEvent;
-
-@Getter
-public class GatewayEvent extends ApplicationEvent {
-
-	private JSONObject decryptData;
-
-	public GatewayEvent(JSONObject decryptData) {
-		super(decryptData);
-		this.decryptData = decryptData;
-	}
-}

+ 0 - 15
src/main/java/org/springblade/yeePay/event/PayNotifyEvent.java

@@ -1,15 +0,0 @@
-package org.springblade.yeePay.event;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Getter;
-import org.springframework.context.ApplicationEvent;
-
-@Getter
-public class PayNotifyEvent extends ApplicationEvent {
-	private JSONObject decryptData;
-
-	public PayNotifyEvent( JSONObject decryptData) {
-		super(decryptData);
-		this.decryptData = decryptData;
-	}
-}

+ 0 - 16
src/main/java/org/springblade/yeePay/event/TransferEvent.java

@@ -1,16 +0,0 @@
-package org.springblade.yeePay.event;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Getter;
-import org.springframework.context.ApplicationEvent;
-
-@Getter
-public class TransferEvent extends ApplicationEvent {
-
- 	private JSONObject decryptData;
-
-	public TransferEvent(JSONObject decryptData) {
-		super(decryptData);
-		this.decryptData = decryptData;
-	}
-}

+ 0 - 27
src/main/java/org/springblade/yeePay/listener/BatchTransferNotifyListener.java

@@ -1,27 +0,0 @@
-package org.springblade.yeePay.listener;
-
-import com.alibaba.fastjson.JSONObject;
-import org.springblade.yeePay.event.BatchTransferEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-
-@Component
-public class BatchTransferNotifyListener {
-
-
-	/**
-	 * 	转账回调业务逻辑处理
-	 * @param  event 回调事件
-	 * */
-	@EventListener
-	@Async
-	@Transactional
-	public void notifyBusiness(BatchTransferEvent event){
-		JSONObject decryptData = event.getDecryptData(); //获取回调信息,解密后的数据
-
-	}
-
-}

+ 0 - 28
src/main/java/org/springblade/yeePay/listener/GatewayNotifyListener.java

@@ -1,28 +0,0 @@
-package org.springblade.yeePay.listener;
-
-import com.alibaba.fastjson.JSONObject;
-import org.springblade.yeePay.event.GatewayEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-
-@Component
-public class GatewayNotifyListener {
-
-	/**
-	 * 	网关充值回调业务逻辑处理
-	 * @param  gatewayEvent 回调事件
-	 * */
-	@EventListener
-	@Async
-	@Transactional
-	public void notifyBusiness(GatewayEvent gatewayEvent){
-		JSONObject decryptData = gatewayEvent.getDecryptData(); //获取回调信息,解密后的数据
-
-	}
-
-
-
-}

+ 0 - 44
src/main/java/org/springblade/yeePay/listener/PayNotifyListener.java

@@ -1,44 +0,0 @@
-package org.springblade.yeePay.listener;
-
-import com.alibaba.fastjson.JSONObject;
-import org.springblade.yeePay.event.PayNotifyEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-@Component
-public class PayNotifyListener {
-
-
-	/**
-	 * 	支付回调业务逻辑处理
-	 * @param  payNotifyEvent 回调解密数据
-	 * */
-	@EventListener
-	@Async
-	public void onApplicationEvent(PayNotifyEvent payNotifyEvent) {
-		System.out.println("==================================================================");
-		JSONObject decryptData = payNotifyEvent.getDecryptData();
-		//返回数据
-//		{
-//			"channelOrderId":"4200001122202107026714708759",
-//			"orderId":"1625223889567",
-//			"bankOrderId":"5908531301210702",
-//			"paySuccessDate":"2021-07-02 19:04:55",
-//			"channel":"WECHAT",
-//			"payWay":"WECHAT_OFFIACCOUNT",
-//			"uniqueOrderNo":"1013202107020000002383974179",
-//			"orderAmount":"0.01",
-//			"payAmount":"0.01",
-//			"payerInfo":"{\"bankCardNo\":\"\",\"bankId\":\"CFT\",\"cardType\":\"CFT\",\"mobilePhoneNo\":\"\",\"userID\":\"o19581K7Nz5lUwsqaT10yTqOe1MI\"}",
-//			"realPayAmount":"0.01",
-//			"parentMerchantNo":"10086062555",
-//			"merchantNo":"10086062555",
-//			"status":"SUCCESS"
-//		}
-
-
-	}
-
-
-}

+ 0 - 27
src/main/java/org/springblade/yeePay/listener/TransferNotifyListener.java

@@ -1,27 +0,0 @@
-package org.springblade.yeePay.listener;
-
-import com.alibaba.fastjson.JSONObject;
-import org.springblade.yeePay.event.TransferEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-@Component
-public class TransferNotifyListener {
-
-	/**
-	 * 	转账回调业务逻辑处理
-	 * @param  transferEvent 回调事件
-	 * */
-	@EventListener
-	@Async
-	public void notifyBusiness(TransferEvent transferEvent){
-		//获取回调信息,解密后的数据
-		JSONObject decryptData = transferEvent.getDecryptData();
-
-
-	}
-
-
-
-}

+ 0 - 60
src/main/java/org/springblade/yeePay/service/YeePayService.java

@@ -18,14 +18,9 @@ import org.springblade.core.tool.api.R;
 import org.springblade.wx.config.WXConfiger;
 import org.springblade.yeePay.common.YeePayConst;
 import org.springblade.yeePay.entity.*;
-import org.springblade.yeePay.event.BatchTransferEvent;
-import org.springblade.yeePay.event.GatewayEvent;
-import org.springblade.yeePay.event.PayNotifyEvent;
-import org.springblade.yeePay.event.TransferEvent;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.stereotype.Service;
-
 import java.security.NoSuchProviderException;
 import java.security.PrivateKey;
 import java.security.cert.CertificateException;
@@ -221,22 +216,6 @@ public class YeePayService {
 		request.addParameter("merchantNo",yeePayConst.getMerchantNo());
 	}
 
-	public void orderNotify(Map<String, Object> params) {
-		JSONObject decryptData = deCodeNotifyData(params);
-		PayNotifyEvent payNotifyEvent = new PayNotifyEvent(decryptData);
-		eventPublisher.publishEvent(payNotifyEvent);
-	}
-
-
-	public void transferNotify(Map<String, Object> params) {
-		log.info("======================== 转账原始数据 =======================");
-		log.info(JSON.toJSONString(params));
-		JSONObject decryptData = deCodeNotifyData(params);
-		log.info("======================== 转账回调解密数据 =======================");
-		log.info(decryptData.toJSONString());
-		TransferEvent transferEvent = new TransferEvent(decryptData);
-		eventPublisher.publishEvent(transferEvent);
-	}
 
 
 	/**
@@ -314,18 +293,6 @@ public class YeePayService {
 		X509Certificate x509Certificate = Sm2CertUtils.getX509Certificate(FileUtils.getResourceAsStream("config/certs/4421256739.cer"));
 		System.out.println(x509Certificate);
 	}
-	/**
-	 * 网关充值回调
-	 * */
-	public void gatewayNotify(Map<String, Object> params) {
-		log.info("======================== 网关充值原始数据 =======================");
-		log.info(JSON.toJSONString(params));
-		JSONObject decryptData = deCodeNotifyData(params);
-		log.info("======================== 网关充值回调解密数据 =======================");
-		log.info(decryptData.toJSONString());
-		GatewayEvent gatewayEvent = new GatewayEvent(decryptData);
-		eventPublisher.publishEvent(gatewayEvent);
-	}
 
 	private	 String sign(List<KeyAndValue> params){
 		StringBuilder stringBuilder = new StringBuilder();
@@ -340,15 +307,6 @@ public class YeePayService {
 		return sign;
 	}
 
-	public void batchTransferNotify(Map<String, Object> params) {
-		log.info("======================== (批量) 转账原始数据 =======================");
-		log.info(JSON.toJSONString(params));
-		JSONObject decryptData = deCodeNotifyData(params);
-		log.info("======================== (批量) 转账回调解密数据 =======================");
-		log.info(decryptData.toJSONString());
-		BatchTransferEvent event = new BatchTransferEvent(decryptData);
-		eventPublisher.publishEvent(event);
-	}
 
 	/**
 	 * 	扫码支付
@@ -362,22 +320,4 @@ public class YeePayService {
 		return execute(request);
 	}
 
-
-//	@Test
-//	public void testSign(){
-//		String priKey = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgHDZ4N8nM1+6wIgJAO6DgytLX000z7w2gbxKReNqO5rmgCgYIKoEcz1UBgi2hRANCAATe2AJOwtbivaFi4/JbV/a3mWku+MicHwGaxA0x1yNvu9ocHOPvVw+kQyd4Ubo5ECaGajs9k3lMUEQZs5c7siHz";
-//		String plainText = "a=123";
-//		PrivateKey privateKey = Sm2Utils.string2PrivateKey(priKey);
-//		String signature = Sm2Utils.sign(plainText, (BCECPrivateKey) privateKey)+"$"+ DigestAlgEnum.SM3.getValue();
-//		System.out.println(signature);
-//	}
-//	@Test
-//	public void testVerify(){
-//		String pubKey = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEEJ8l/z6oUWAQ3cNritO5uRjcmgXl28SD8GgOJMU4+rQkhbE5IdsdrSeDslc2yU4UplLL7vHaNnVr0kZpfbc4sA==";
-//		String signature = "YOUmkuvtQtcKItql9-IRn4YrITtHZNbjpTbEnxUJLTPKemZ-iIl6kWOfbZEswozdSRtpMkCjryRcuKMrDCGQWg$SM3";
-//		String plainText = "merchantNo=10040049388&token=A9111AC520820FE23643FC932A19F0CB8219909B06922FEFECAE1F8601AFE540&timestamp=1625651888&directPayType=&cardType=&userNo=AutoUserNo75773472&userType=PHONE";
-//		PublicKey publicKey = Sm2Utils.string2PublicKey(pubKey);
-//		boolean verify = Sm2Utils.verifySign(plainText,signature.split("$")[0], (BCECPublicKey) publicKey);
-//		Assert.assertTrue(verify);
-//	}
 }

+ 3 - 0
src/main/resources/application-dev.yml

@@ -36,6 +36,9 @@ social:
 
 #blade配置
 blade:
+  secure:
+    skip-url:
+      /**
   #分布式锁配置
   lock:
     ##是否启用分布式锁

+ 40 - 0
src/main/resources/payConfig.properties

@@ -0,0 +1,40 @@
+pay.serviceType = wxpub_pay
+pay.mchId = 200111010000
+pay.interfaceVersion = V3.1
+pay.inputCharset = UTF-8
+pay.signType = RSA-S
+pay.notifyUrl = test
+pay.secondMerchantId =
+pay.publicKey = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJOWwS6NLWdyWFVO+/wZdRQEhutP+ZT39UK7Hq21RmBrJeGmnxOOHVdL3Fc7D+vfYS4VIJDNoLbJPfid9zZmDGf2yCRQxw6Ixkr/4LVwQGhtrhFeuh1g3CFtg5Cd7yQn07tBuLN6vFH5+UzOJqetcrFM3JXFcDY6rZ6Lybkug0rwIDAQAB
+pay.payUrl = https://api.dinpay.com/gateway/api/pay
+pay.secret = MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMk5bBLo0tZ3JYVU77/Bl1FASG60/5lPf1QrserbVGYGsl4aafE44dV0vcVzsP699hLhUgkM2gtsk9+J33NmYMZ/bIJFDHDojGSv/gtXBAaG2uEV66HWDcIW2DkJ3vJCfTu0G4s3q8Ufn5TM4mp61ysUzclcVwNjqtnovJuS6DSvAgMBAAECgYAWOG4TxHwLzMpq5881yKXyBfw5pWkYP+wamlyiR6gRQCoQNDCAv7xIewS9uiHQb5+txA3wC+hEHLBTngD72FFVR+j+c67256W7F0fTYBxHu3Ip5RKMwmYXZbv4R1izySZ5VmnuJJu/RAChTmLynGK1JyWxdtmxJ/obUL48JlQc4QJBAO8i7+cLia5vDjsh25o8fnQFWy+dujOXpyM6zctl5jo4Q+Oy92ou2LwUi0+GKENh6hQJ3zy4kpGDk7SIJ3+k1FECQQDXahFDq7POqXZmCpvppUKJ1ctCXdQ3Wtbc/4KLTitX4vclXej/wgxXGGE3T7N4vyqCqcl9Wpf0vVrVB6yMFzj/AkEA1NA/tVr0PTMB9CfOefVKB9BYdQimE5HroROM320gtUErUbEMNAfaw454592ZaVXy7cBXVX9gmHUC9s+Qbyzt8QJBAKYO3Ro2jdj9aAlHmmNmA0IwLo2NuV+mxkX9LkxnSSBqFa2XlFs84rhtUdwKs8acT5AEhQ/+O2/uXMwmK0yfRk8CQA2y5vDglr+VwMTLbggH3oDjv/xgnNLyAr5hiikFWAQ8jH9uuPoM00O910xDAysjoZx8q9uhf4lp0o927WLfqdo=
+
+
+#yee-pay.parentMerchantNo = 10086066206
+#yee-pay.merchantNo = 10086066206
+
+yee-pay.parentMerchantNo = 10086062555
+yee-pay.merchantNo = 10086062555
+yee-pay.sm4Key = U1FjWERFSFl5M1NlczYzaQ==
+yee-pay.weChatConfigAddUrl = /rest/v2.0/aggpay/wechat-config/add
+yee-pay.weChatConfigQueryUrl = /rest/v2.0/aggpay/wechat-config/query
+yee-pay.prePayUrl = /rest/v1.0/aggpay/pre-pay
+yee-pay.transferOrderUrl = /rest/v1.0/account/pay/order
+yee-pay.queryTransferOrderUrl = /rest/v1.0/account/pay/query
+yee-pay.payNotify = https://music.nanyue6688.com/ldt/api/yeePay/notify
+yee-pay.transferNotify = https://music.nanyue6688.com/ldt/api/yeePay/transfer/notify
+yee-pay.batchTransferNotify = https://music.nanyue6688.com/ldt/api/yeePay/batchTransfer/notify
+yee-pay.gatewayNotify = https://music.nanyue6688.com/ldt/api/yeePay/gateway/notify
+yee-pay.queryBalanceUrl = /rest/v1.0/account/accountinfos/query
+yee-pay.payGateWayUrl = /rest/v1.0/trade/order
+yee-pay.batchTransferUrl = /rest/v1.0/account/pay/batch-order
+yee-pay.appKey = app_10086062555
+yee-pay.privateKey = MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQg0R6BbZZeK++i8MFM72GQMQ8vZKpPg3YWHR1mSDEulrWgCgYIKoEcz1UBgi2hRANCAATmrDkcCyGrN4NlQQdAeAEHh6UbJGH19u2P+1n65FYJpDVsAXlEwoNZrBbwlu9TVH8JAbuTDaTAA/5rVfuEqOkq
+#生成聚合订单码
+yee-pay.createCodeUrl = /rest/v1.0/cashier/pay-link/order
+#聚合码支付回调
+yee-pay.codePayNotify = https://music.nanyue66889.com/ldt/api/yeePay/gateway/notify
+#付款码支付(获取到授权信息后进行收款)
+yee-pay.chargeUrl = /rest/v1.0/aggpay/pay
+#扫码支付支付回调
+yee-pay.chargeNotify = https://music.nanyue66889.com/ldt/notify

+ 19 - 0
src/main/resources/wxConfig.properties

@@ -0,0 +1,19 @@
+#爱效科技
+#wx.appId = wx7e7a38f071b360e9
+#wx.appSecret = 4e862f91b48ac85a91380fa0991c9fda
+
+#guoxin
+#wx.appId = wx6dacff40877a1b1a
+#wx.appSecret = eac73798c4c509e43dc7cb475de82f4d
+
+#南粤药业
+#wx.appId = wx322e246549d7620d
+#wx.appSecret = 118059d75bc8c1a08162fc8a8cf5ac04
+
+# 音乐之声
+#wx.appId = wxf3f84c916a741cac
+#wx.appSecret = 8377629994436f17210500a11bbce6cc
+
+#联兑通客户端
+wx.appId = wx9ad53e8c83ae1a51
+wx.appSecret = fe94990e1f90f65df8bb47e530697906