swh代码
parent
5facd548b4
commit
cf5a4fa927
|
@ -24,7 +24,7 @@ public class MyBasicApplication
|
|||
SpringApplication.run(MyBasicApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 我的模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | _ _ \\ 娄逼 \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package com.ruoyi.mybasic.controller;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.mybasic.service.MessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -22,8 +23,9 @@ public class MessageController {
|
|||
* 银行卡api
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public void upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
public R upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
messageService.upload(file);
|
||||
return R.ok("上传成功");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,54 +100,6 @@ public class PurseControllerTwo {
|
|||
purseServiceTwo.PayBank(aliPay , httpResponse);
|
||||
}
|
||||
|
||||
// // 1. 创建Client,通用SDK提供的Client,负责调用支付宝的API
|
||||
// AlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, aliPayConfig.getAppId(),
|
||||
// aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);
|
||||
//
|
||||
// // 2. 创建 Request并设置Request参数
|
||||
// AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); // 发送请求的 Request类
|
||||
// request.setNotifyUrl(aliPayConfig.getNotifyUrl());
|
||||
// request.setReturnUrl(aliPayConfig.getReturnUrl());
|
||||
// JSONObject bizContent = new JSONObject();
|
||||
// bizContent.set("out_trade_no", aliPay.getTraceNo()); // 我们自己生成的订单编号
|
||||
// bizContent.set("total_amount", aliPay.getTotalAmount()); // 订单的总金额
|
||||
// bizContent.set("subject", aliPay.getSubject()); // 支付的名称
|
||||
// bizContent.set("product_code", "FAST_INSTANT_TRADE_PAY"); // 固定配置
|
||||
// request.setBizContent(bizContent.toString());
|
||||
//
|
||||
//
|
||||
// UserMoneyLogs userMoneyLogs = new UserMoneyLogs();
|
||||
//
|
||||
// //获取前台传入的一个参数 充值金额
|
||||
// double totalAmount = aliPay.getTotalAmount();
|
||||
// double totalAmountOne = (totalAmount * 100);// 1/100
|
||||
//
|
||||
// userMoneyLogs.setUserId(Math.toIntExact(SecurityUtils.getUserId()));
|
||||
// userMoneyLogs.setAmountIncome((int) totalAmountOne);
|
||||
// userMoneyLogs.setMoneyTypeName("支付宝充值");
|
||||
// userMoneyLogs.setStatus(2);
|
||||
// //调用修改钱包接口
|
||||
// purseServiceTwo.purseBalanceChange(userMoneyLogs);
|
||||
//
|
||||
// //充值记录表
|
||||
// RechargeLog rechargeLog = new RechargeLog();
|
||||
// rechargeLog.setUserId(SecurityUtils.getUserId());
|
||||
// rechargeLog.setRechargeType("支付宝");
|
||||
// rechargeLog.setRechargeAmount(totalAmount);
|
||||
// purseServiceTwo.insertRechargeLog(rechargeLog);
|
||||
//
|
||||
// // 执行请求,拿到响应的结果,返回给浏览器
|
||||
// String form = "";
|
||||
// try {
|
||||
// form = alipayClient.pageExecute(request).getBody(); // 调用SDK生成表单
|
||||
// } catch (AlipayApiException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// httpResponse.setContentType("text/html;charset=" + CHARSET);
|
||||
// httpResponse.getWriter().write(form);// 直接将完整的表单html输出到页面
|
||||
// httpResponse.getWriter().flush();
|
||||
// httpResponse.getWriter().close();
|
||||
|
||||
|
||||
/**
|
||||
* 创建支付宝回调
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.mybasic.service.Impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.mybasic.common.domain.BankConfig;
|
||||
|
@ -35,7 +36,11 @@ public class MessageServiceImpl implements MessageService {
|
|||
* @param file
|
||||
*/
|
||||
@Override
|
||||
public void upload(MultipartFile file) {
|
||||
bankScan.BankScan(file);
|
||||
public R upload(MultipartFile file) {
|
||||
String s = bankScan.BankScan(file);
|
||||
if (s == null ){
|
||||
throw new ServiceException("上传重复");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.mybasic.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.mybasic.common.domain.BankConfig;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -13,5 +14,5 @@ import java.util.List;
|
|||
public interface MessageService {
|
||||
|
||||
//银行扫描加添加数据库
|
||||
void upload(MultipartFile file);
|
||||
R upload(MultipartFile file);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.core.exception.ServiceException;
|
|||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.mybasic.common.domain.BankConfig;
|
||||
import com.ruoyi.mybasic.mapper.MessageMapper;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -24,6 +25,7 @@ import java.util.Map;
|
|||
* 银行扫描工具类
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class BankScan {
|
||||
|
||||
/** @noinspection SpringJavaInjectionPointsAutowiringInspection*/
|
||||
|
@ -34,7 +36,6 @@ public class BankScan {
|
|||
private UploadUtil uploadUtil;
|
||||
|
||||
public String BankScan(MultipartFile file){
|
||||
OutputStream outputStream = null;
|
||||
//上传文件方法
|
||||
if (null == file){
|
||||
throw new ServiceException("银行卡照片为空");
|
||||
|
@ -67,11 +68,12 @@ public class BankScan {
|
|||
*/
|
||||
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||
System.out.println("response:"+response.toString());
|
||||
|
||||
String string = EntityUtils.toString(response.getEntity());
|
||||
JSONObject jsonObject = JSONObject.parseObject(string);
|
||||
//
|
||||
// String string = EntityUtils.toString(response.getEntity());
|
||||
// System.out.println(string);
|
||||
// JSONObject jsonObject = JSONObject.parseObject(string);
|
||||
//获取response的body
|
||||
// JSONObject jsonObject = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
|
||||
JSONObject jsonObject = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
|
||||
System.out.println("jsonObject数据为:" + jsonObject);
|
||||
|
||||
bodys.clear();//用于清空bodys路径数据
|
||||
|
|
Loading…
Reference in New Issue