no message

This commit is contained in:
2025-09-08 03:04:04 +08:00
commit d814831822
105 changed files with 10519 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package com.sczx.pay.mapper;
import com.sczx.pay.entity.CompanyAlipayConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface CompanyAlipayConfigMapper {
/**
* 根据公司ID获取支付宝支付配置
* @param companyId 公司ID
* @return 微信支付配置信息
*/
@Select("SELECT id, ali_receiving_account AS mchId, ali_key AS apikey FROM zc_company WHERE id = #{companyId}")
CompanyAlipayConfig getConfigByCompanyId(@Param("companyId") Long companyId);
@Select("SELECT id,ali_receiving_account AS mchId, ali_key AS apikey FROM zc_company WHERE ali_receiving_account = #{mchId} limit 1")
CompanyAlipayConfig getCompanyIdByMchId(@Param("mchId") String mchId);
}

View File

@ -0,0 +1,22 @@
package com.sczx.pay.mapper;
import com.sczx.pay.entity.CompanyWechatConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface CompanyWechatConfigMapper {
/**
* 根据公司ID获取微信支付配置
* @param companyId 公司ID
* @return 微信支付配置信息
*/
@Select("SELECT id, wechat_receiving_account AS mchId, wechat_key AS apikey FROM zc_company WHERE id = #{companyId}")
CompanyWechatConfig getWechatConfigByCompanyId(@Param("companyId") Long companyId);
@Select("SELECT id,wechat_receiving_account AS mchId, wechat_key AS apikey FROM zc_company WHERE wechat_receiving_account = #{mchId} limit 1")
CompanyWechatConfig getCompanyIdByMchId(@Param("mchId") String mchId);
}

View File

@ -0,0 +1,73 @@
package com.sczx.pay.mapper;
import com.sczx.pay.entity.OrderMain;
import com.sczx.pay.entity.OrderSub;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
@Mapper
public interface OrderPayMapper {
/**
* 根据商户订单号更新支付状态
*/
@Update("UPDATE zc_order_main SET pay_type = #{payType}, pay_status = #{payStatus}, " +
"payment_no = #{transactionId}" +
"WHERE order_no = #{outTradeNo}")
int updatePaymentStatus(@Param("outTradeNo") String outTradeNo,
@Param("payType") String payType,
@Param("payStatus") String payStatus,
@Param("transactionId") String transactionId);
@Update("update zc_order_main as om,zc_order_sub as os set os.transaction_id = #{transactionId},os.pay_status = #{payStatus}," +
"os.payment_method = #{payType}" +
" where om.order_id = os.order_id and os.payment_id = #{outTradeNo}")
int updateSubOrderPaymentStatus(@Param("outTradeNo") String outTradeNo,
@Param("payType") String payType,
@Param("payStatus") String payStatus,
@Param("transactionId") String transactionId);
@Update("UPDATE zc_order_main SET order_status = #{orderStatus}" +
"WHERE order_no = #{outTradeNo}")
int updateOrderStatus(@Param("outTradeNo") String outTradeNo,
@Param("orderStatus") String orderStatus);
@Update("UPDATE zc_order_main SET order_status = #{orderStatus} , end_rent_time = #{returnTime}, overdue_days = #{overdueDays}, order_amount = #{orderAmount}" +
"WHERE order_no = #{outTradeNo}")
int updateOrderStatusAndEndRentTime(@Param("outTradeNo") String outTradeNo,@Param("returnTime") LocalDateTime returnTime,@Param("overdueDays") Integer overdueDays,@Param("orderAmount") BigDecimal orderAmount,
@Param("orderStatus") String orderStatus);
@Update("update zc_order_main as om,zc_order_sub as os set os.transaction_id = #{paymentId},os.pay_status = #{payStatus}" +
" where om.order_id = os.order_id and om.order_no = #{outTradeNo} and suborder_type = 'DEPOSIT'")
int updateRefundOrderStatus(@Param("outTradeNo") String outTradeNo,
@Param("orderStatus") String orderStatus,
@Param("transactionId") String transactionId);
@Select("select order_id,order_no,order_status,overdue_days, order_amount from zc_order_main " +
"where order_id in (select order_id from zc_order_sub " +
"where payment_id = #{paymentId} and del_flag = '0')")
OrderMain getOrderStatusByOrderNo(@Param("paymentId") String paymentId);
@Update("update zc_order_main as om,zc_order_sub as os set os.transaction_id = #{refundId},os.pay_status = #{payStatus}, os.amount = #{refundFee},os.update_time = #{updateTime}" +
" where om.order_id = os.order_id and os.payment_id = #{outTradeNo} and os.suborder_type = 'FD_DEPOSIT'" )
int updateSubOrderRefundStatus(@Param("outTradeNo") String outTradeNo,
@Param("payStatus") String payStatus,
@Param("refundFee") BigDecimal refundFee,
@Param("updateTime") Date updateTime,
@Param("refundId") String refundId);
@Select("select suborder_id from zc_order_sub where payment_id = #{paymentId} and suborder_type = 'RENTBATTEY' limit 1")
Long getSubOrderIdByTradeNo(@Param("paymentId") String paymentId);
@Select("select * from zc_order_sub where payment_id = #{paymentId} order by suborder_id desc limit 1")
OrderSub getSubOrderByTradeNo(@Param("paymentId") String paymentId);
}

View File

@ -0,0 +1,28 @@
package com.sczx.pay.mapper;
import com.sczx.pay.entity.PaymentNotifyRecord;
import org.apache.ibatis.annotations.*;
@Mapper
public interface PaymentNotifyRecordMapper {
/**
* 插入支付通知记录
*/
@Insert("INSERT INTO payment_notify_record (company_id, out_trade_no, out_refund_no, notify_data, notify_type, " +
"trade_status, refund_status, pay_channel, process_status, process_result) " +
"VALUES (#{companyId}, #{outTradeNo}, #{outRefundNo}, #{notifyData}, #{notifyType}, " +
"#{tradeStatus}, #{refundStatus}, #{payChannel}, #{processStatus}, #{processResult})")
@Options(useGeneratedKeys = true, keyProperty = "id")
int insertPaymentNotifyRecord(PaymentNotifyRecord paymentNotifyRecord);
/**
* 更新支付通知记录处理状态
*/
@Update("UPDATE payment_notify_record SET process_status = #{processStatus}, process_result = #{processResult}, " +
"update_time = #{updateTime} WHERE id = #{id}")
int updateProcessStatus(@Param("id") Long id,
@Param("processStatus") Integer processStatus,
@Param("processResult") String processResult,
@Param("updateTime") java.util.Date updateTime);
}

View File

@ -0,0 +1,62 @@
package com.sczx.pay.mapper;
import com.sczx.pay.entity.PaymentRecord;
import org.apache.ibatis.annotations.*;
import java.util.Date;
@Mapper
public interface PaymentRecordMapper {
/**
* 插入支付记录
*/
@Insert("INSERT INTO zc_payment_record (company_id, out_trade_no, transaction_id, total_fee, body, openid, " +
"trade_state, trade_state_desc, create_time, update_time, pay_time, attach, pay_channel, buyer_id) " +
"VALUES (#{companyId}, #{outTradeNo}, #{transactionId}, #{totalFee}, #{body}, #{openid}, " +
"#{tradeState}, #{tradeStateDesc}, #{createTime}, #{updateTime}, #{payTime}, #{attach}, #{payChannel}, #{buyerId})")
@Options(useGeneratedKeys = true, keyProperty = "id")
int insertPaymentRecord(PaymentRecord paymentRecord);
/**
* 根据商户订单号查询支付记录
*/
@Select("SELECT * FROM zc_payment_record WHERE out_trade_no = #{outTradeNo} LIMIT 1")
PaymentRecord getPaymentRecordByOutTradeNo(@Param("outTradeNo") String outTradeNo);
/**
* 根据商户订单号更新支付状态
*/
@Update("UPDATE zc_payment_record SET trade_state = #{tradeState}, trade_state_desc = #{tradeStateDesc}, " +
"transaction_id = #{transactionId}, pay_time = #{payTime}, update_time = #{updateTime} " +
"WHERE out_trade_no = #{outTradeNo}")
int updatePaymentStatus(@Param("outTradeNo") String outTradeNo,
@Param("tradeState") String tradeState,
@Param("tradeStateDesc") String tradeStateDesc,
@Param("transactionId") String transactionId,
@Param("payTime") Date payTime,
@Param("updateTime") Date updateTime);
/**
* 根据商户订单号更新为支付成功状态(微信支付)
*/
@Update("UPDATE zc_payment_record SET trade_state = 'SUCCESS', trade_state_desc = '支付成功', " +
"transaction_id = #{transactionId}, pay_time = #{payTime}, update_time = #{updateTime} " +
"WHERE out_trade_no = #{outTradeNo}")
int updateToSuccess(@Param("outTradeNo") String outTradeNo,
@Param("transactionId") String transactionId,
@Param("payTime") Date payTime,
@Param("updateTime") Date updateTime);
/**
* 根据商户订单号更新为支付成功状态(支付宝)
*/
@Update("UPDATE zc_payment_record SET trade_state = 'SUCCESS', trade_state_desc = '支付成功', " +
"transaction_id = #{transactionId}, buyer_id = #{buyerId}, pay_time = #{payTime}, update_time = #{updateTime} " +
"WHERE out_trade_no = #{outTradeNo}")
int updateToSuccessForAlipay(@Param("outTradeNo") String outTradeNo,
@Param("transactionId") String transactionId,
@Param("buyerId") String buyerId,
@Param("payTime") Date payTime,
@Param("updateTime") Date updateTime);
}

View File

@ -0,0 +1,39 @@
package com.sczx.pay.mapper;
import com.sczx.pay.entity.RefundRecord;
import org.apache.ibatis.annotations.*;
import java.util.Date;
@Mapper
public interface RefundRecordMapper {
/**
* 插入退款记录
*/
@Insert("INSERT INTO zc_refund_record (company_id, out_trade_no, out_refund_no, refund_id, total_fee, refund_fee, " +
"refund_status, refund_status_desc, refund_desc, create_time, update_time, refund_time, pay_channel) " +
"VALUES (#{companyId}, #{outTradeNo}, #{outRefundNo}, #{refundId}, #{totalFee}, #{refundFee}, " +
"#{refundStatus}, #{refundStatusDesc}, #{refundDesc}, #{createTime}, #{updateTime}, #{refundTime}, #{payChannel})")
@Options(useGeneratedKeys = true, keyProperty = "id")
int insertRefundRecord(RefundRecord refundRecord);
/**
* 根据商户退款单号查询退款记录
*/
@Select("SELECT * FROM zc_refund_record WHERE out_refund_no = #{outRefundNo} LIMIT 1")
RefundRecord getRefundRecordByOutRefundNo(@Param("outRefundNo") String outRefundNo);
/**
* 根据商户退款单号更新退款状态
*/
@Update("UPDATE zc_refund_record SET refund_status = #{refundStatus}, refund_status_desc = #{refundStatusDesc}, " +
"refund_id = #{refundId}, refund_time = #{refundTime}, update_time = #{updateTime} " +
"WHERE out_refund_no = #{outRefundNo}")
int updateRefundStatus(@Param("outRefundNo") String outRefundNo,
@Param("refundStatus") String refundStatus,
@Param("refundStatusDesc") String refundStatusDesc,
@Param("refundId") String refundId,
@Param("refundTime") Date refundTime,
@Param("updateTime") Date updateTime);
}

View File

@ -0,0 +1,30 @@
package com.sczx.pay.mapper;
import com.sczx.pay.alipay.po.RentRuleItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 车型租赁规则项数据访问层
*/
@Mapper
public interface RentRuleItemMapper {
RentRuleItem selectByAliId(@Param("aliItemId") String aliItemId);
RentRuleItem selectByFourId(@Param("batteryRuleId") Long batteryRuleId, @Param("carRuleId") Long carRuleId, @Param("carModelId") Long carModelId,@Param("brandId") Long brandId);
RentRuleItem selectItemByFourIds(@Param("batteryRuleId") Long batteryRuleId, @Param("carRuleId") Long carRuleId, @Param("carModelId") Long carModelId,@Param("brandId") Long brandId);
RentRuleItem selectItemByOutItemId(@Param("outItemId") String outItemId);
int insertByFourId(RentRuleItem zcRentRuleItem);
int updateItemIdByOutItemId(RentRuleItem rentRuleItem);
int updateByOutItemId(@Param("outItemId") String outItemId, @Param("aliItemId") String aliItemId);
}