无关风月
2026-01-12 5335f3c239f5c9cbe39edc9efe8f20bc6d894a3c
用户新增会员到期时间
4个文件已修改
38 ■■■■■ 已修改文件
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/WxPayController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/query/DetectionPaymentReportQuery.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/DetectionPaymentReportVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TSysPayRecordMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/WxPayController.java
@@ -30,6 +30,7 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Objects;
@@ -67,13 +68,22 @@
    public R<Map<String, Object>> orderPay(@RequestParam(value = "inspectionId") String inspectionId,@RequestParam(value = "orderType") Integer orderType) {
        TSysOtherConfig sysOtherConfig = sysOtherConfigService.getById(1);
        if (Objects.isNull(sysOtherConfig.getAiPrice())) {
            return R.fail("系统未配置AI支付价格");
        Long totalPrice = 0L;
        if (orderType==1){
            if (Objects.isNull(sysOtherConfig.getAiPrice())) {
                return R.fail("系统未配置AI单次支付价格");
            }
            totalPrice= sysOtherConfig.getAiPrice().multiply(new BigDecimal(100)).longValue();
        }
        if (orderType==2){
            if (Objects.isNull(sysOtherConfig.getAiMonthPrice())) {
                return R.fail("系统未配置AI包月支付价格");
            }
            totalPrice= sysOtherConfig.getAiMonthPrice().multiply(new BigDecimal(100)).longValue();
        }
        String userId = tokenService.getLoginUserApplet().getUserId();
        TSysAppUser sysAppUser = sysAppUserService.getById(userId);
        // 价格
        Long totalPrice = sysOtherConfig.getAiPrice().multiply(new BigDecimal(100)).longValue();
        // 生成订单号
        String orderNo = CodeGenerateUtils.generateOrderSn();
        // 查询用户信息 用户openid
@@ -122,6 +132,13 @@
                sysPayRecord.setPayState(2);
                sysPayRecord.setPayTime(WxTimeUtils.dateToLocalDateTime(WxTimeUtils.toRfc3339Date(success_time)));
                sysPayRecord.setTransactionId(transaction_id);
                String appUserId = sysPayRecord.getAppUserId();
                TSysAppUser appUser = sysAppUserService.getById(appUserId);
                if (sysPayRecord.getOrderType()==2){
                    LocalDateTime localDateTime = LocalDateTime.now().plusMonths(1L);
                    localDateTime = localDateTime.withHour(23).withMinute(59).withSecond(59);
                    appUser.setVipEndTime(localDateTime);
                }
                sysPayRecordService.updateById(sysPayRecord);
                // 处理检测报告为可见
ruoyi-system/src/main/java/com/ruoyi/system/query/DetectionPaymentReportQuery.java
@@ -11,6 +11,8 @@
    @ApiModelProperty(value = "用户昵称")
    private String nickName;
    @ApiModelProperty(value = "购买类型 1单次 2包月")
    private Integer orderType;
}
ruoyi-system/src/main/java/com/ruoyi/system/vo/DetectionPaymentReportVO.java
@@ -25,7 +25,8 @@
    @Excel(name = "支付时间", width = 20)
    private String payTimeStr;
    @Excel(name = "购买类型", width = 20, replace = {"单次_1", "包月_2"})
    private Integer orderType;
    @Excel(name = "支付金额", width = 20)
    @ApiModelProperty(value = "支付价格")
    private BigDecimal payAmount;
ruoyi-system/src/main/resources/mapper/system/TSysPayRecordMapper.xml
@@ -21,12 +21,15 @@
    <select id="detectionPaymentReport" resultType="com.ruoyi.system.vo.DetectionPaymentReportVO">
        SELECT
        tspr.id, tspr.app_user_id, tspr.inspection_id, tspr.pay_amount, tspr.pay_state, tspr.order_no,
        tspr.transaction_id, tspr.pay_time, tsau.nick_name
        tspr.transaction_id, tspr.pay_time, tsau.nick_name,tspr.order_type
        FROM t_sys_pay_record tspr
        LEFT JOIN t_sys_app_user tsau ON tspr.app_user_id = tsau.id
        <where>
            <if test="query.nickName != null and query.nickName != ''">
                AND tsau.nick_name LIKE CONCAT('%', #{query.nickName}, '%')
            </if>
            <if test="query.orderType != null ">
                and tspr.orderType = #{query.orderType}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tspr.pay_time &gt;= #{query.startTime}
@@ -39,13 +42,16 @@
    <select id="exportDetectionPaymentReport" resultType="com.ruoyi.system.vo.DetectionPaymentReportVO">
        SELECT
        tspr.id, tspr.app_user_id, tspr.inspection_id, tspr.pay_amount, tspr.pay_state, tspr.order_no,
        tspr.transaction_id, tspr.pay_time, tsau.nick_name
        tspr.transaction_id, tspr.pay_time, tsau.nick_name,tspr.order_type
        FROM t_sys_pay_record tspr
        LEFT JOIN t_sys_app_user tsau ON tspr.app_user_id = tsau.id
        <where>
            <if test="query.nickName != null and query.nickName != ''">
                AND tsau.nick_name LIKE CONCAT('%', #{query.nickName}, '%')
            </if>
            <if test="query.orderType != null ">
                and tspr.orderType = #{query.orderType}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tspr.pay_time &gt;= #{query.startTime}
                AND tspr.pay_time &lt;= #{query.endTime}