package fun.haolo.bigLandlord.core.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.*;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.*;
import com.alipay.api.response.*;
import fun.haolo.bigLandlord.core.dto.AliPayDTO;
import fun.haolo.bigLandlord.core.param.AliPayParam;
import fun.haolo.bigLandlord.core.service.AliPayService;
import fun.haolo.bigLandlord.db.entity.Deposit;
import fun.haolo.bigLandlord.db.entity.House;
import fun.haolo.bigLandlord.db.entity.Order;
import fun.haolo.bigLandlord.db.exception.UnauthorizedException;
import fun.haolo.bigLandlord.db.service.*;
import fun.haolo.bigLandlord.db.utils.DepositStatusConstant;
import fun.haolo.bigLandlord.db.utils.HouseStatusConstant;
import fun.haolo.bigLandlord.db.utils.OrderStatusConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
/**
* @author haolo
* @since 2022-10-26 16:31
*/
@Service
public class AliPayServiceImpl implements AliPayService {
// todo 加锁
@Autowired
private IDepositService depositService;
@Autowired
private IOrderService orderService;
@Autowired
private IUserService userService;
@Autowired
private IHouseService houseService;
@Autowired
private IRunningTallyService runningTallyService;
@Value("${aliyun.pay.app_id}")
private String appId;
@Value("${aliyun.pay.merchant_private_key}")
private String privateKey;
@Value("${aliyun.pay.alipay_public_key}")
private String publicKey;
@Value("${aliyun.pay.sellerId}")
private String sellerId;
@Value("${aliyun.pay.notify_url}")
private String notifyUrl;
// @Value("${aliyun.pay.return_url}")
// private String returnUrl;
@Value("${aliyun.pay.sign_type}")
private String signType;
@Value("${aliyun.pay.charset}")
private String charset;
@Value("${aliyun.pay.time_out}")
private String timeOut;
@Value("${aliyun.pay.gatewayUrl}")
private String serverUrl;
private static final Log log = LogFactory.get();
@Override
public AlipayTradeWapPayResponse alipayTradeWapPay(AliPayDTO param) throws AlipayApiException {
AlipayConfig alipayConfig = initAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
//商户订单号
model.setOutTradeNo(param.getOut_trade_no());
//订单总金额
model.setTotalAmount(param.getTotal_amount());
//订单标题
model.setSubject(param.getSubject());
//商家和支付宝签约的产品码
model.setProductCode("QUICK_WAP_WAY");
//卖家支付宝用户ID
model.setSellerId(sellerId);
model.setQuitUrl(param.getQuit_url());
request.setBizModel(model);
//异步通知
request.setNotifyUrl(notifyUrl);
AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "GET");
// System.out.println(response.getBody());
if (!response.isSuccess()) {
throw new RuntimeException("支付接口调用失败,原因:" + response.getSubCode() + ":" + response.getSubMsg());
}
return response;
}
@Override
public AlipayTradePagePayResponse alipayTradePagePay(AliPayDTO param) throws AlipayApiException {
AlipayConfig alipayConfig = initAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
AlipayTradePagePayModel model = new AlipayTradePagePayModel();
//商户订单号
model.setOutTradeNo(param.getOut_trade_no());
//订单总金额
model.setTotalAmount(param.getTotal_amount());
//订单标题
model.setSubject(param.getSubject());
//商家和支付宝签约的产品码
model.setProductCode("FAST_INSTANT_TRADE_PAY");
//卖家支付宝用户ID
request.setBizModel(model);
//异步通知
request.setNotifyUrl(notifyUrl);
AlipayTradePagePayResponse response = alipayClient.pageExecute(request, "GET");
if (!response.isSuccess()) {
throw new RuntimeException("支付接口调用失败,原因:" + response.getSubCode() + ":" + response.getSubMsg());
}
return response;
}
@Override
public AlipayTradeQueryResponse alipayTradeQuery(String trade_no) throws AlipayApiException {
AlipayConfig alipayConfig = initAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
model.setTradeNo(trade_no);
request.setBizModel(model);
AlipayTradeQueryResponse response = alipayClient.execute(request);
System.out.println(response.getBody());
if (response.isSuccess()) {
return response;
} else {
throw new RuntimeException("交易查询接口调用失败,原因:" + response.getSubCode() + ":" + response.getSubMsg());
}
}
@Override
public AlipayTradeCloseResponse alipayTradeClose(String trade_no) throws AlipayApiException {
AlipayConfig alipayConfig = initAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
AlipayTradeCloseModel model = new AlipayTradeCloseModel();
model.setTradeNo(trade_no);
request.setBizModel(model);
AlipayTradeCloseResponse response = alipayClient.execute(request);
System.out.println(response.getBody());
if (response.isSuccess()) {
return response;
} else {
throw new RuntimeException("交易关闭接口调用失败,原因:" + response.getSubCode() + ":" + response.getSubMsg());
}
}
@Override
public AlipayTradeRefundResponse alipayTradeRefund(String refund_amount, String trade_no) throws AlipayApiException {
AlipayConfig alipayConfig = initAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
AlipayTradeRefundModel model = new AlipayTradeRefundModel();
model.setRefundAmount(refund_amount);
model.setTradeNo(trade_no);
model.setOutRequestNo(String.valueOf(System.currentTimeMillis()));
request.setBizModel(model);
AlipayTradeRefundResponse response = alipayClient.execute(request);
System.out.println(response.getBody());
if (response.isSuccess()) {
return response;
} else {
throw new RuntimeException("退款接口调用失败,原因:" + response.getSubCode() + ":" + response.getSubMsg());
}
}
@Override
@Transactional
public void depositRefund(String username, String depositSn, String refund_amount) throws AlipayApiException {
Long userID = userService.getUserIdByUsername(username);
Deposit deposit = depositService.getBySn(depo
没有合适的资源?快使用搜索试试~ 我知道了~
基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)
共146个文件
java:117个
xml:16个
yaml:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 22 浏览量
2024-10-24
10:34:33
上传
评论
收藏 890KB ZIP 举报
温馨提示
基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计),该项目是个人毕设项目,答辩评审分达到98分,代码都经过调试测试,确保可以运行!欢迎下载使用,可用于小白学习、进阶。该资源主要针对计算机、通信、人工智能、自动化等相关专业的学生、老师或从业者下载使用,亦可作为期末课程设计、课程大作业、毕业设计等。项目整体具有较高的学习借鉴价值!基础能力强的可以在此基础上修改调整,以实现不同的功能。 基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计)基于springboot + vue的房屋租赁管
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot + vue的房屋租赁管理系统源码+数据库+文档说明(毕业设计) (146个子文件)
mvnw.cmd 7KB
手册.1.docx 515KB
.gitignore 388B
maven-wrapper.jar 57KB
AliPayServiceImpl.java 17KB
LandOrderService.java 10KB
HouseServiceImpl.java 9KB
OrderController.java 7KB
DepositController.java 7KB
HouseController.java 6KB
DepositServiceImpl.java 6KB
UserServiceImpl.java 6KB
TenantServiceImpl.java 6KB
RunningTallyServiceImpl.java 5KB
LoginServiceImpl.java 5KB
TenantController.java 5KB
AliPayController.java 5KB
Order.java 5KB
House.java 4KB
SecurityConfig.java 4KB
Deposit.java 4KB
RunningTally.java 4KB
User.java 4KB
AliPayService.java 3KB
Finance.java 3KB
JwtAuthenticationTokenFilter.java 3KB
OrderDTO.java 3KB
OrderAdditional.java 3KB
LoginController.java 3KB
Tenant.java 3KB
NotifyServiceImpl.java 3KB
OrderServiceImpl.java 3KB
RunningTallyController.java 3KB
UserRoleRelationServiceImpl.java 3KB
Role.java 3KB
ResponseResult.java 3KB
JwtTokenUtil.java 3KB
DepositDTO.java 3KB
FinanceServiceImpl.java 2KB
IDepositService.java 2KB
UserRoleRelation.java 2KB
SNUtil.java 2KB
HouseDTO.java 2KB
RedisUtil.java 2KB
PaymentService.java 2KB
IRunningTallyService.java 2KB
Generator.java 2KB
UserController.java 2KB
SecurityUserDetails.java 2KB
HouseParam.java 2KB
RunningTallyDTO.java 2KB
UserRoleRelationController.java 2KB
UserDTO.java 2KB
IHouseService.java 2KB
Knife4jConfiguration.java 2KB
FastJsonRedisSerializer.java 2KB
NotifyController.java 2KB
TimeTaskServiceImpl.java 1KB
OrderAdditionalVO.java 1KB
UserParam.java 1KB
AliPayDTO.java 1KB
UserInfoVO.java 1KB
OrderAdditionalServiceImpl.java 1KB
redisConfig.java 1KB
OrderAdditionalParam.java 1KB
FinanceController.java 1KB
TenantDTO.java 1KB
ExceptionHandler.java 1KB
RestAuthenticationEntryPoint.java 1KB
RestfulAccessDeniedHandler.java 1KB
FinanceVO.java 1KB
ITenantService.java 1KB
PaymentController.java 1021B
RoleServiceImpl.java 1021B
UserParam.java 1003B
PaymentVO.java 995B
IUserService.java 971B
TenantParam.java 915B
CorsConfig.java 891B
TenantOptionsVO.java 861B
RoleRelationVO.java 837B
MyMetaObjectHandler.java 824B
MyBatisPlusConfig.java 804B
LoginService.java 780B
IFinanceService.java 754B
TenantVO.java 749B
TimeTaskHandler.java 736B
DepositVO.java 705B
IOrderService.java 675B
SurrenderDTO.java 665B
BigLandlordApplication.java 650B
ResultCode.java 604B
IUserRoleRelationService.java 594B
ResetPassWordParam.java 579B
RunningTallyVO.java 556B
NotifyService.java 539B
OrderStatusConstant.java 529B
HouseVO.java 521B
OrderVO.java 521B
UserVO.java 516B
共 146 条
- 1
- 2
资源评论
yava_free
- 粉丝: 3644
- 资源: 1458
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功