Browse Source

修复代码提交

master
主管理员 4 days ago
parent
commit
349673dac8
11 changed files with 1549 additions and 1 deletions
  1. +1
    -1
      module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java
  2. +8
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/CreateOrderReq.java
  3. +1120
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/HttpClientUtil.java
  4. +47
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/HttpServletUtils.java
  5. +31
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/PayOrderInfo.java
  6. +23
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/QueryOrderReq.java
  7. +36
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/RefundOrderReq.java
  8. +164
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/Response.java
  9. +86
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/WxPayAutoCertificateConfig.java
  10. +15
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/WxPayConfig.java
  11. +18
    -0
      module-common/src/main/java/org/jeecg/api/wxUtils/WxQrCodeVo.java

+ 1
- 1
module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java View File

@ -16,8 +16,8 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.jeecg.api.bean.FansPageBean;
import org.jeecg.api.bean.HttpClientUtil;
import org.jeecg.api.bean.PageBean;
import org.jeecg.api.bean.WxQrCodeVo;
import org.jeecg.api.service.AppletIndexService;
import org.jeecg.api.wxUtils.WxQrCodeVo;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.config.shiro.ShiroRealm;


+ 8
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/CreateOrderReq.java View File

@ -0,0 +1,8 @@
package org.jeecg.api.wxUtils;
public class CreateOrderReq {
/**
* 微信用户openid前端不用传参
*/
private String wxOpenId;
}

+ 1120
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/HttpClientUtil.java
File diff suppressed because it is too large
View File


+ 47
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/HttpServletUtils.java View File

@ -0,0 +1,47 @@
package org.jeecg.api.wxUtils;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
/**
* <p>
* HttpServletRequest 获取请求体
* </p>
*
* @author songfayuan
* @date 2024/9/30 19:11
*/
public class HttpServletUtils {
/**
* 获取请求体
*
* @param request
* @return
* @throws IOException
*/
public static String getRequestBody(HttpServletRequest request) throws IOException {
ServletInputStream stream = null;
BufferedReader reader = null;
StringBuffer sb = new StringBuffer();
try {
stream = request.getInputStream();
// 获取响应
reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
throw new IOException("读取返回支付接口数据流出现异常!");
} finally {
reader.close();
}
return sb.toString();
}
}

+ 31
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/PayOrderInfo.java View File

@ -0,0 +1,31 @@
package org.jeecg.api.wxUtils;
import lombok.Data;
import java.math.BigDecimal;
/**
* <p>
* 支付订单信息
* </p>
*
* @author songfayuan
* @date 2024/9/30 17:46
*/
@Data
public class PayOrderInfo {
/**
* 订单标题
*/
private String description;
/**
* 商户订单号
* 只能是数字大小写字母_-*且在同一个商户号下唯一
*/
private String outTradeNo;
/**
* 支付金额单位
*/
private BigDecimal amount;
}

+ 23
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/QueryOrderReq.java View File

@ -0,0 +1,23 @@
package org.jeecg.api.wxUtils;
import lombok.Data;
/**
* <p>
* 订单查询请求
* </p>
*
* @author songfayuan
* @date 2024/9/30 19:19
*/
@Data
public class QueryOrderReq {
/**
* 订单号业务侧的订单号
*/
private String transactionId;
/**
* 商户订单号
*/
private String outTradeNo;
}

+ 36
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/RefundOrderReq.java View File

@ -0,0 +1,36 @@
package org.jeecg.api.wxUtils;
import lombok.Data;
import java.math.BigDecimal;
/**
* <p>
* 退款订单请求参数
* </p>
*
* @author songfayuan
* @date 2024/9/30 19:19
*/
@Data
public class RefundOrderReq {
/**
* 订单号业务侧的订单号
*/
private String transactionId;
/**
* 商户订单号
*/
private String outTradeNo;
/**
* 原订单金额 说明原支付交易的订单总金额这里单位为元
*/
private BigDecimal totalAmount;
/**
* 退款金额 说明退款金额这里单位为元不能超过原订单支付金额
*/
private BigDecimal refundAmount;
}

+ 164
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/Response.java View File

@ -0,0 +1,164 @@
package org.jeecg.api.wxUtils;
import lombok.Data;
/**
* 返回参数封装类
*
* @param <T>
* @author songfayuan
*/
@Data
public class Response<T> {
/**
* 状态码
*/
protected int code;
/**
* 提示信息
*/
protected String msg;
/**
* 数据
*/
protected T data;
/**
* 成功时状态码
*/
private static final int SUCCESS_CODE = 200;
/**
* 成功时提示信息
*/
private static final String SUCCESS_MSG = "success";
/**
* 异常错误信息状态码
*/
private static final int ERROR_CODE = 500;
/**
* 异常错误提示信息
*/
private static final String ERROR_MSG = "服务器内部异常,请联系技术人员!";
/**
* 返回成功消息
*
* @param <T>
* @return
*/
public static <T> Response<T> success() {
Response resp = new Response();
resp.code = (SUCCESS_CODE);
resp.msg = (SUCCESS_MSG);
return resp;
}
/**
* 返回成功消息
*
* @param <T>
* @param msg
* @return
*/
public static <T> Response<T> successResponse(String msg) {
Response resp = new Response();
resp.code = SUCCESS_CODE;
resp.msg = msg;
return resp;
}
/**
* 返回错误消息
*
* @param <T>
* @return
*/
public static <T> Response<T> error() {
Response resp = new Response();
resp.code = (ERROR_CODE);
resp.msg = (ERROR_MSG);
return resp;
}
/**
* 返回错误消息
*
* @param <T>
* @param msg
* @return
*/
public static <T> Response<T> errorResponse(String msg) {
Response resp = new Response();
resp.code = ERROR_CODE;
resp.msg = msg;
return resp;
}
/**
* 自定义状态码提示信息
*
* @param <T>
* @param code 状态码
* @param msg 提示信息
* @return
*/
public static <T> Response<T> response(int code, String msg) {
Response resp = new Response();
resp.code = (code);
resp.msg = (msg);
return resp;
}
/**
* 自定义状态码提示信息业务数据
*
* @param <T>
* @param code 状态码
* @param msg 提示信息
* @param data 业务数据
* @return
*/
public static <T> Response<T> response(int code, String msg, T data) {
Response<T> resp = new Response<>();
resp.code = (code);
resp.msg = (msg);
resp.data = data;
return resp;
}
/**
* 返回成功数据
*
* @param <T>
* @param data 业务数据
* @return
*/
public static <T> Response<T> success(T data) {
Response<T> resp = new Response<>();
resp.code = (SUCCESS_CODE);
resp.msg = (SUCCESS_MSG);
resp.data = data;
return resp;
}
/**
* 返回错误消息
*
* @param <T>
* @param data 业务数据
* @return
*/
public static <T> Response<T> error(T data) {
Response<T> resp = new Response<>();
resp.code = (ERROR_CODE);
resp.msg = (ERROR_MSG);
resp.data = data;
return resp;
}
}

+ 86
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/WxPayAutoCertificateConfig.java View File

@ -0,0 +1,86 @@
package org.jeecg.api.wxUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class WxPayAutoCertificateConfig {
// /**
// * 微信小程序的 AppID
// */
// @Value("${wx.miniapp.appid}")
// private String appid;
//
// /**
// * 微信小程序的密钥
// */
// @Value("${wx.miniapp.secret}")
// private String secret;
//
// /**
// * 商户号
// */
// @Value("${wx.miniapp.merchantId}")
// private String merchantId;
//
// /**
// * 商户API私钥路径
// */
// @Value("${wx.miniapp.privateKeyPath}")
// private String privateKeyPath;
//
// /**
// * 商户证书序列号
// */
// @Value("${wx.miniapp.merchantSerialNumber}")
// private String merchantSerialNumber;
//
// /**
// * 商户APIV3密钥
// */
// @Value("${wx.miniapp.apiV3Key}")
// private String apiV3Key;
//
// /**
// * 支付通知地址
// */
// @Value("${wx.miniapp.payNotifyUrl}")
// private String payNotifyUrl;
//
// /**
// * 退款通知地址
// */
// @Value("${wx.miniapp.refundNotifyUrl}")
// private String refundNotifyUrl;
// /**
// * 初始化商户配置
// * @return
// */
// @Bean
// public Config rsaAutoCertificateConfig() {
// // 这里把Config作为配置Bean是为了避免多次创建资源一般项目运行的时候这些东西都确定了
// // 具体的参数改为申请的数据可以通过读配置文件的形式获取
//// Config config = new RSAAutoCertificateConfig.Builder()
//// .merchantId("1659066870")
//// .privateKeyFromPath("E:\\git_java\\api_java\\popularize-admin\\popularize-admin\\popularize-admin\\module-pay\\src\\main\\resources\\apiclient_key.pem")
//// .merchantSerialNumber("7BE56DC695B2B612BD1C6C710A7FBFA1AC46B10F")
//// .apiV3Key("vtribevtribevtribevtribevtribe12")
//// .build();
//
//
//// Config config = new RSAAutoCertificateConfig.Builder()
//// .merchantId(merchantId)
//// .privateKeyFromPath(privateKeyPath)
//// .merchantSerialNumber(merchantSerialNumber)
//// .apiV3Key(apiV3Key)
//// .build();
//// log.info("初始化微信支付商户配置完成...");
// return config;
// }
}

+ 15
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/WxPayConfig.java View File

@ -0,0 +1,15 @@
package org.jeecg.api.wxUtils;
import lombok.Data;
import org.springframework.stereotype.Component;
@Data
@Component
public class WxPayConfig {
}

+ 18
- 0
module-common/src/main/java/org/jeecg/api/wxUtils/WxQrCodeVo.java View File

@ -0,0 +1,18 @@
package org.jeecg.api.wxUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class WxQrCodeVo {
/**图片地址*/
@ApiModelProperty(value = "图片地址")
private String url;
@ApiModelProperty(value = "二维码名称")
private String name;
@ApiModelProperty(value = "二维码背景图")
private String bjImage;
}

Loading…
Cancel
Save