bihs 1 month ago
parent
commit
ca08103316

+ 19 - 11
qmjszx-admin/src/main/resources/application.yml

@@ -147,19 +147,27 @@ rsa:
   # 私钥
   privateKey: MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAh2ZN5B1TJgrZrmK89d1gCs6AMwMq7qhvtg+VoLpHX9fGMeEZpIi5xgavM74mEIU2SGAfGZzg86nIWr48V0u40wIDAQABAkBbgNXu7ap9sSN/aJcPCXaYlwmob+GZvBcS0OFr57fImsxTEzWg/OJWxcbHk7Li31AbHjwqQmVtUxk2wQ6GawthAiEAve5+CCaUHV3BIH7LhzU7MsPAr6IIx25t1NkNNg+dn3kCIQC2f7XtdTOVRtPUwO7QhwC0fX/wJu53pR01p55tqmgLqwIgYzUHr8o243/tOMQCG4W6fjGxnAvO+hy8UcluFSbi9kECIQCAK4NOyPA4V6zwD6vpgdcJ69YNiJoUJz8zboxCwtodzwIgNUN6uuiVJuZmBJDm+9AIY7Ury+ajGRZJ7l1FIBbxMPY=
 
-# 微信支付配置 notifyUrl:微信支付异步回调地址
+# 微信支付配置
 wx:
   pay:
-    appId: wxe44c64c20fa20d69
-#    appId: wxf02cdfd83ef8ce4d
-    apiV3Key: #商户私钥key
-    notifyUrl: #支付回调地址
-    merchantId: #商户id
-    appSecret: bbaaa2292da0bcc3336dc2a0f2f8493a
-#    appSecret: 228a6905484fbf9c3e571962c92c7e7e
-    privateKeyPath: #证书认证是生成文件
-    merchantserialNumber: #证书序列号
-
+    # 小程序或公众号的appid(必需)
+    appId: wxf02cdfd83ef8ce4d
+    # 微信支付商户号(必需)
+    mchId: 1730382253
+    # APIv3密钥(必需)
+    apiv3Key: TulAW0rXQj82sx8CEaO0pbUnTXZqWRKP
+    # 小程序密钥
+    appSecret: 228a6905484fbf9c3e571962c92c7e7e
+    # 证书序列号(必需)
+    certSerialNo: 55AFB8526ECF0CECE18137B49703C20B237744A5
+    # 私钥文件路径(必需)
+    privateKeyPath: classpath:cert/apiclient_key.pem
+    # 商户证书文件路径(必需)
+    privateCertPath: classpath:cert/apiclient_cert.pem
+    # 异步通知地址(必需)
+    notifyUrl: http://116.142.80.10:80/api/pay/notify
+    #证书路径
+    certurl: classpath:cert/apiclient_cert.p12
 # 海康获取直播视频流配置
 hik:
   appKey: "28356728"

+ 111 - 0
qmjszx-admin/src/main/resources/templates/order/order.html

@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('订单列表')"/>
+</head>
+<body class="gray-bg">
+<div class="container-div">
+    <div class="row">
+        <div class="col-sm-12 search-collapse">
+            <form id="formId">
+                <div class="select-list">
+                    <ul>
+                        <li>
+                            <label>订单号:</label>
+                            <input type="text" name="orderId"/>
+                        </li>
+                        <li>
+                            <label>用户姓名:</label>
+                            <input type="text" name="realName"/>
+                        </li>
+                        <li>
+                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
+                                    class="fa fa-search"></i>&nbsp;搜索</a>
+                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
+                                    class="fa fa-refresh"></i>&nbsp;重置</a>
+                        </li>
+                    </ul>
+                </div>
+            </form>
+        </div>
+
+        <div class="btn-group-sm" id="toolbar" role="group">
+            <a class="btn btn-warning" onclick="$.table.exportExcel()">
+                <i class="fa fa-download"></i> 导出
+            </a>
+        </div>
+        <div class="col-sm-12 select-table table-striped">
+            <table id="bootstrap-table"></table>
+        </div>
+    </div>
+</div>
+<th:block th:include="include :: footer"/>
+<script th:inline="javascript">
+    var prefix = ctx + "order";
+
+    $(function () {
+        var options = {
+            url: prefix + "/list",
+            createUrl: prefix + "/add",
+            updateUrl: prefix + "/edit/{id}",
+            removeUrl: prefix + "/remove",
+            exportUrl: prefix + "/export",
+            modalName: "订单",
+            columns: [{
+                checkbox: true
+            },
+                {
+                    field: 'id',
+                    title: '订单ID',
+                    visible: false
+                },
+                {
+                    field: 'orderId',
+                    title: '订单号'
+                },
+                {
+                    field: 'realName',
+                    title: '用户姓名'
+                },
+                {
+                    field: 'userPhone',
+                    title: '用户电话'
+                },
+                {
+                    field: 'userAddress',
+                    title: '详细地址'
+                },
+                {
+                    field: 'totalNum',
+                    title: '订单商品总数'
+                },
+                {
+                    field: 'totalPrice',
+                    title: '订单总价'
+                },
+                {
+                    field: 'payPrice',
+                    title: '实际支付金额'
+                },
+                {
+                    field: 'paid',
+                    title: '支付状态'
+                },
+                {
+                    field: 'payTime',
+                    title: '支付时间'
+                },
+                {
+                    field: 'payType',
+                    title: '支付方式'
+                },
+                {
+                    field: 'status',
+                    title: '订单状态'
+                }]
+        };
+        $.table.init(options);
+    });
+</script>
+</body>
+</html>

+ 111 - 0
qmjszx-business/src/main/java/beilv/order/controller/StoreOrderController.java

@@ -0,0 +1,111 @@
+package beilv.order.controller;
+
+import java.util.List;
+
+import beilv.order.domain.StoreOrder;
+import beilv.order.service.IStoreOrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import beilv.common.annotation.Log;
+import beilv.common.enums.BusinessType;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import beilv.common.utils.poi.ExcelUtil;
+import beilv.common.core.page.TableDataInfo;
+
+/**
+ * 订单Controller
+ *
+ * @author ruoyi
+ * @date 2025-11-12
+ */
+@Controller
+@RequestMapping("/order")
+public class StoreOrderController extends BaseController {
+    private String prefix = "/order";
+
+    @Autowired
+    private IStoreOrderService storeOrderService;
+
+    @GetMapping()
+    public String order() {
+        return prefix + "/order";
+    }
+
+    /**
+     * 查询订单列表
+     */
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(StoreOrder storeOrder) {
+        startPage();
+        List<StoreOrder> list = storeOrderService.selectStoreOrderList(storeOrder);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出订单列表
+     */
+    @Log(title = "订单", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(StoreOrder storeOrder) {
+        List<StoreOrder> list = storeOrderService.selectStoreOrderList(storeOrder);
+        ExcelUtil<StoreOrder> util = new ExcelUtil<StoreOrder>(StoreOrder.class);
+        return util.exportExcel(list, "订单数据");
+    }
+
+    /**
+     * 新增订单
+     */
+    @GetMapping("/add")
+    public String add() {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存订单
+     */
+    @Log(title = "订单", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(StoreOrder storeOrder) {
+        return toAjax(storeOrderService.insertStoreOrder(storeOrder));
+    }
+
+    /**
+     * 修改订单
+     */
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") Long id, ModelMap mmap) {
+        StoreOrder storeOrder = storeOrderService.selectStoreOrderById(id);
+        mmap.put("storeOrder", storeOrder);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存订单
+     */
+    @Log(title = "订单", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(StoreOrder storeOrder) {
+        return toAjax(storeOrderService.updateStoreOrder(storeOrder));
+    }
+
+    /**
+     * 删除订单
+     */
+    @Log(title = "订单", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids) {
+        return toAjax(storeOrderService.deleteStoreOrderByIds(ids));
+    }
+}

+ 173 - 0
qmjszx-business/src/main/java/beilv/order/domain/StoreOrder.java

@@ -0,0 +1,173 @@
+package beilv.order.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import beilv.common.annotation.Excel;
+import beilv.common.core.domain.BaseEntity;
+
+/**
+ * 订单对象 store_order
+ *
+ * @author ruoyi
+ * @date 2025-11-12
+ */
+@Data
+public class StoreOrder extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 订单ID
+     */
+    private Long id;
+
+    /**
+     * 订单号
+     */
+    @Excel(name = "订单号")
+    private String orderId;
+
+    /**
+     * 订单类型
+     */
+    @Excel(name = "订单类型")
+    private String orderType;
+
+    /**
+     * 用户id
+     */
+    @Excel(name = "用户id")
+    private Long uid;
+
+    /**
+     * 用户姓名
+     */
+    @Excel(name = "用户姓名")
+    private String realName;
+
+    /**
+     * 用户电话
+     */
+    @Excel(name = "用户电话")
+    private String userPhone;
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    private String userAddress;
+
+    /**
+     * 订单商品总数
+     */
+    @Excel(name = "订单商品总数")
+    private Integer totalNum;
+
+    /**
+     * 订单总价
+     */
+    @Excel(name = "订单总价")
+    private BigDecimal totalPrice;
+
+    /**
+     * 实际支付金额
+     */
+    @Excel(name = "实际支付金额")
+    private BigDecimal payPrice;
+
+    /**
+     * 会员折扣
+     */
+    @Excel(name = "会员折扣")
+    private BigDecimal vipDiscount;
+
+    /**
+     * 会员优惠金额
+     */
+    @Excel(name = "会员优惠金额")
+    private BigDecimal vipDeductionAmount;
+
+    /**
+     * 抵扣金额
+     */
+    @Excel(name = "抵扣金额")
+    private BigDecimal deductionPrice;
+
+    /**
+     * 优惠券id
+     */
+    @Excel(name = "优惠券id")
+    private Integer couponId;
+
+    /**
+     * 优惠券金额
+     */
+    @Excel(name = "优惠券金额")
+    private BigDecimal couponPrice;
+
+    /**
+     * 支付状态
+     */
+    @Excel(name = "支付状态")
+    private Integer paid;
+
+    /**
+     * 支付时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date payTime;
+
+    /**
+     * 支付方式
+     */
+    @Excel(name = "支付方式")
+    private String payType;
+
+    /**
+     * 订单状态(-1 : 取消 ;0:未支付;1:待发货;2:待收货;3:待评价;4:已完成;5:待成团)
+     */
+    @Excel(name = "订单状态", readConverterExp = "-=1,:=,取=消,;=0:未支付;1:待发货;2:待收货;3:待评价;4:已完成;5:待成团")
+    private Integer status;
+
+    /**
+     * 0 未退款 1 申请中 2 已退款
+     */
+    @Excel(name = "0 未退款 1 申请中 2 已退款")
+    private Integer refundStatus;
+
+    /**
+     * 使用积分
+     */
+    @Excel(name = "使用积分")
+    private BigDecimal useIntegral;
+
+    /**
+     * 实际支付积分
+     */
+    @Excel(name = "实际支付积分")
+    private BigDecimal payIntegral;
+
+    /**
+     * 创建者
+     */
+    @Excel(name = "创建者")
+    private String creator;
+
+    /**
+     * 更新者
+     */
+    @Excel(name = "更新者")
+    private String updater;
+
+    /**
+     * 支付id
+     */
+    @Excel(name = "支付id")
+    private String payId;
+
+}

+ 61 - 0
qmjszx-business/src/main/java/beilv/order/mapper/StoreOrderMapper.java

@@ -0,0 +1,61 @@
+package beilv.order.mapper;
+
+import beilv.order.domain.StoreOrder;
+
+import java.util.List;
+
+/**
+ * 订单Mapper接口
+ *
+ * @author ruoyi
+ * @date 2025-11-12
+ */
+public interface StoreOrderMapper {
+    /**
+     * 查询订单
+     *
+     * @param id 订单主键
+     * @return 订单
+     */
+    public StoreOrder selectStoreOrderById(Long id);
+
+    /**
+     * 查询订单列表
+     *
+     * @param storeOrder 订单
+     * @return 订单集合
+     */
+    public List<StoreOrder> selectStoreOrderList(StoreOrder storeOrder);
+
+    /**
+     * 新增订单
+     *
+     * @param storeOrder 订单
+     * @return 结果
+     */
+    public int insertStoreOrder(StoreOrder storeOrder);
+
+    /**
+     * 修改订单
+     *
+     * @param storeOrder 订单
+     * @return 结果
+     */
+    public int updateStoreOrder(StoreOrder storeOrder);
+
+    /**
+     * 删除订单
+     *
+     * @param id 订单主键
+     * @return 结果
+     */
+    public int deleteStoreOrderById(Long id);
+
+    /**
+     * 批量删除订单
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteStoreOrderByIds(String[] ids);
+}

+ 61 - 0
qmjszx-business/src/main/java/beilv/order/service/IStoreOrderService.java

@@ -0,0 +1,61 @@
+package beilv.order.service;
+
+import beilv.order.domain.StoreOrder;
+
+import java.util.List;
+
+/**
+ * 订单Service接口
+ *
+ * @author ruoyi
+ * @date 2025-11-12
+ */
+public interface IStoreOrderService {
+    /**
+     * 查询订单
+     *
+     * @param id 订单主键
+     * @return 订单
+     */
+    public StoreOrder selectStoreOrderById(Long id);
+
+    /**
+     * 查询订单列表
+     *
+     * @param storeOrder 订单
+     * @return 订单集合
+     */
+    public List<StoreOrder> selectStoreOrderList(StoreOrder storeOrder);
+
+    /**
+     * 新增订单
+     *
+     * @param storeOrder 订单
+     * @return 结果
+     */
+    public int insertStoreOrder(StoreOrder storeOrder);
+
+    /**
+     * 修改订单
+     *
+     * @param storeOrder 订单
+     * @return 结果
+     */
+    public int updateStoreOrder(StoreOrder storeOrder);
+
+    /**
+     * 批量删除订单
+     *
+     * @param ids 需要删除的订单主键集合
+     * @return 结果
+     */
+    public int deleteStoreOrderByIds(String ids);
+
+    /**
+     * 删除订单信息
+     *
+     * @param id 订单主键
+     * @return 结果
+     */
+    public int deleteStoreOrderById(Long id);
+}

+ 91 - 0
qmjszx-business/src/main/java/beilv/order/service/impl/StoreOrderServiceImpl.java

@@ -0,0 +1,91 @@
+package beilv.order.service.impl;
+
+import java.util.List;
+
+import beilv.common.utils.DateUtils;
+import beilv.order.domain.StoreOrder;
+import beilv.order.mapper.StoreOrderMapper;
+import beilv.order.service.IStoreOrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import beilv.common.core.text.Convert;
+
+/**
+ * 订单Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2025-11-12
+ */
+@Service
+public class StoreOrderServiceImpl implements IStoreOrderService {
+    @Autowired
+    private StoreOrderMapper storeOrderMapper;
+
+    /**
+     * 查询订单
+     *
+     * @param id 订单主键
+     * @return 订单
+     */
+    @Override
+    public StoreOrder selectStoreOrderById(Long id) {
+        return storeOrderMapper.selectStoreOrderById(id);
+    }
+
+    /**
+     * 查询订单列表
+     *
+     * @param storeOrder 订单
+     * @return 订单
+     */
+    @Override
+    public List<StoreOrder> selectStoreOrderList(StoreOrder storeOrder) {
+        return storeOrderMapper.selectStoreOrderList(storeOrder);
+    }
+
+    /**
+     * 新增订单
+     *
+     * @param storeOrder 订单
+     * @return 结果
+     */
+    @Override
+    public int insertStoreOrder(StoreOrder storeOrder) {
+        storeOrder.setCreateTime(DateUtils.getNowDate());
+        return storeOrderMapper.insertStoreOrder(storeOrder);
+    }
+
+    /**
+     * 修改订单
+     *
+     * @param storeOrder 订单
+     * @return 结果
+     */
+    @Override
+    public int updateStoreOrder(StoreOrder storeOrder) {
+        storeOrder.setUpdateTime(DateUtils.getNowDate());
+        return storeOrderMapper.updateStoreOrder(storeOrder);
+    }
+
+    /**
+     * 批量删除订单
+     *
+     * @param ids 需要删除的订单主键
+     * @return 结果
+     */
+    @Override
+    public int deleteStoreOrderByIds(String ids) {
+        return storeOrderMapper.deleteStoreOrderByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除订单信息
+     *
+     * @param id 订单主键
+     * @return 结果
+     */
+    @Override
+    public int deleteStoreOrderById(Long id) {
+        return storeOrderMapper.deleteStoreOrderById(id);
+    }
+}

+ 190 - 0
qmjszx-business/src/main/resources/mapper/order/StoreOrderMapper.xml

@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="beilv.order.mapper.StoreOrderMapper">
+
+    <resultMap type="StoreOrder" id="StoreOrderResult">
+        <result property="id" column="id"/>
+        <result property="orderId" column="order_id"/>
+        <result property="orderType" column="order_type"/>
+        <result property="uid" column="uid"/>
+        <result property="realName" column="real_name"/>
+        <result property="userPhone" column="user_phone"/>
+        <result property="userAddress" column="user_address"/>
+        <result property="totalNum" column="total_num"/>
+        <result property="totalPrice" column="total_price"/>
+        <result property="payPrice" column="pay_price"/>
+        <result property="vipDiscount" column="vip_discount"/>
+        <result property="vipDeductionAmount" column="vip_deduction_amount"/>
+        <result property="deductionPrice" column="deduction_price"/>
+        <result property="couponId" column="coupon_id"/>
+        <result property="couponPrice" column="coupon_price"/>
+        <result property="paid" column="paid"/>
+        <result property="payTime" column="pay_time"/>
+        <result property="payType" column="pay_type"/>
+        <result property="status" column="status"/>
+        <result property="refundStatus" column="refund_status"/>
+        <result property="useIntegral" column="use_integral"/>
+        <result property="payIntegral" column="pay_integral"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
+    <sql id="selectStoreOrderVo">
+        select id,
+               order_id,
+               uid,
+               real_name,
+               user_phone,
+               user_address,
+               total_num,
+               total_price,
+               pay_price,
+               vip_discount,
+               vip_deduction_amount,
+               deduction_price,
+               coupon_id,
+               coupon_price,
+               paid,
+               pay_time,
+               pay_type,
+               order_type,
+               status,
+               refund_status,
+               use_integral,
+               pay_integral,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from store_order
+    </sql>
+
+    <select id="selectStoreOrderList" parameterType="StoreOrder" resultMap="StoreOrderResult">
+        <include refid="selectStoreOrderVo"/>
+        <where>
+            <if test="orderId != null  and orderId != ''">and order_id = #{orderId}</if>
+            <if test="realName != null  and realName != ''">and real_name like concat('%', #{realName}, '%')</if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectStoreOrderById" parameterType="Long" resultMap="StoreOrderResult">
+        <include refid="selectStoreOrderVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertStoreOrder" parameterType="StoreOrder">
+        insert into store_order
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="orderId != null and orderId != ''">order_id,</if>
+            <if test="uid != null">uid,</if>
+            <if test="realName != null and realName != ''">real_name,</if>
+            <if test="userPhone != null and userPhone != ''">user_phone,</if>
+            <if test="userAddress != null and userAddress != ''">user_address,</if>
+            <if test="totalNum != null">total_num,</if>
+            <if test="totalPrice != null">total_price,</if>
+            <if test="payPrice != null">pay_price,</if>
+            <if test="vipDiscount != null">vip_discount,</if>
+            <if test="vipDeductionAmount != null">vip_deduction_amount,</if>
+            <if test="deductionPrice != null">deduction_price,</if>
+            <if test="couponId != null">coupon_id,</if>
+            <if test="couponPrice != null">coupon_price,</if>
+            <if test="paid != null">paid,</if>
+            <if test="payTime != null">pay_time,</if>
+            <if test="payType != null and payType != ''">pay_type,</if>
+            <if test="orderType != null and orderType != ''">order_type,</if>
+            <if test="status != null">status,</if>
+            <if test="refundStatus != null">refund_status,</if>
+            <if test="useIntegral != null">use_integral,</if>
+            <if test="payIntegral != null">pay_integral,</if>
+            <if test="createBy != null and createBy != ''">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null and updateBy != ''">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null and remark != ''">remark,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="orderId != null and orderId != ''">#{orderId},</if>
+            <if test="uid != null">#{uid},</if>
+            <if test="realName != null and realName != ''">#{realName},</if>
+            <if test="userPhone != null and userPhone != ''">#{userPhone},</if>
+            <if test="userAddress != null and userAddress != ''">#{userAddress},</if>
+            <if test="totalNum != null">#{totalNum},</if>
+            <if test="totalPrice != null">#{totalPrice},</if>
+            <if test="payPrice != null">#{payPrice},</if>
+            <if test="vipDiscount != null">#{vipDiscount},</if>
+            <if test="vipDeductionAmount != null">#{vipDeductionAmount},</if>
+            <if test="deductionPrice != null">#{deductionPrice},</if>
+            <if test="couponId != null">#{couponId},</if>
+            <if test="couponPrice != null">#{couponPrice},</if>
+            <if test="paid != null">#{paid},</if>
+            <if test="payTime != null">#{payTime},</if>
+            <if test="payType != null and payType != ''">#{payType},</if>
+            <if test="orderType != null and orderType != ''">#{orderType},</if>
+            <if test="status != null">#{status},</if>
+            <if test="refundStatus != null">#{refundStatus},</if>
+            <if test="useIntegral != null">#{useIntegral},</if>
+            <if test="payIntegral != null">#{payIntegral},</if>
+            <if test="createBy != null and createBy != ''">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null and remark != ''">#{remark},</if>
+        </trim>
+    </insert>
+
+    <update id="updateStoreOrder" parameterType="StoreOrder">
+        update store_order
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
+            <if test="uid != null">uid = #{uid},</if>
+            <if test="realName != null and realName != ''">real_name = #{realName},</if>
+            <if test="userPhone != null and userPhone != ''">user_phone = #{userPhone},</if>
+            <if test="userAddress != null and userAddress != ''">user_address = #{userAddress},</if>
+            <if test="totalNum != null">total_num = #{totalNum},</if>
+            <if test="totalPrice != null">total_price = #{totalPrice},</if>
+            <if test="payPrice != null">pay_price = #{payPrice},</if>
+            <if test="vipDiscount != null">vip_discount = #{vipDiscount},</if>
+            <if test="vipDeductionAmount != null">vip_deduction_amount = #{vipDeductionAmount},</if>
+            <if test="deductionPrice != null">deduction_price = #{deductionPrice},</if>
+            <if test="couponId != null">coupon_id = #{couponId},</if>
+            <if test="couponPrice != null">coupon_price = #{couponPrice},</if>
+            <if test="paid != null">paid = #{paid},</if>
+            <if test="payTime != null">pay_time = #{payTime},</if>
+            <if test="payType != null and payType != ''">pay_type = #{payType},</if>
+            <if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="refundStatus != null">refund_status = #{refundStatus},</if>
+            <if test="useIntegral != null">use_integral = #{useIntegral},</if>
+            <if test="payIntegral != null">pay_integral = #{payIntegral},</if>
+            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null and remark != ''">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteStoreOrderById" parameterType="Long">
+        delete
+        from store_order
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteStoreOrderByIds" parameterType="Long">
+        delete from store_order where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 13 - 6
qmjszx-pay/pom.xml

@@ -71,16 +71,23 @@
             <artifactId>qmjszx-system</artifactId>
         </dependency>
 
-        <!-- 微信支付-->
+        <!-- 微信支付 -->
         <dependency>
             <groupId>com.github.wechatpay-apiv3</groupId>
-            <artifactId>wechatpay-java</artifactId>
-            <version>0.2.15</version>
+            <artifactId>wechatpay-apache-httpclient</artifactId>
+            <version>0.4.4</version>
         </dependency>
+        
+        <!-- Jackson Databind -->
         <dependency>
-            <groupId>com.squareup.okio</groupId>
-            <artifactId>okio</artifactId>
-            <version>3.3.0</version>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+        
+        <!-- Apache Http Client -->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
         </dependency>
     </dependencies>
 

+ 0 - 76
qmjszx-pay/src/main/java/beilv/pay/config/WxPayConfig.java

@@ -1,76 +0,0 @@
-package beilv.pay.config;
-
-
-import com.wechat.pay.java.core.RSAAutoCertificateConfig;
-import com.wechat.pay.java.core.util.IOUtil;
-import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
-import com.wechat.pay.java.service.refund.RefundService;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.io.ClassPathResource;
-
-import java.io.IOException;
-
-@Data
-@Slf4j
-@Configuration
-@ConfigurationProperties(prefix = "wx.pay")
-public class WxPayConfig {
-
-    private String appId;
-
-    private String apiV3Key;
-
-    private String notifyUrl;
-
-    private String merchantId;
-
-    private String privateKeyPath;
-
-    private String merchantSerialNumber;
-
-    // RSA配置
-    private RSAAutoCertificateConfig RSAConfig;
-
-    // JSAPI支付
-    private JsapiServiceExtension jsapiServiceExtension;
-
-    // 退款
-    private RefundService refundService;
-
-    /**
-     * 初始化配置
-     */
-    @Bean
-    public void initWxPayConfig() throws IOException {
-//        this.RSAConfig = buildRSAAutoCertificateConfig();
-//        this.jsapiServiceExtension = buildJsapiServiceExtension(RSAConfig);
-//        this.refundService = buildRefundService(RSAConfig);
-    }
-
-    // 构建并使用自动更新平台证书的RSA配置,一个商户号只能初始化一个配置,否则会因为重复的下载任务报错
-//    private RSAAutoCertificateConfig buildRSAAutoCertificateConfig() throws IOException {
-//        // 将 resource 目录下的文件转为 InputStream,然后利用 IOUtil.toString(inputStream) 转化为密钥
-//        String privateKey = IOUtil.toString(new ClassPathResource(privateKeyPath).getInputStream());
-//        return new RSAAutoCertificateConfig.Builder()
-//                .merchantId(merchantId)
-//                .privateKey(privateKey)
-//                .merchantSerialNumber(merchantSerialNumber)
-//                .apiV3Key(apiV3Key)
-//                .build();
-//    }
-
-    // 构建JSAPI
-//    private JsapiServiceExtension buildJsapiServiceExtension(RSAAutoCertificateConfig config) {
-//        return new JsapiServiceExtension.Builder().config(config).build();
-//    }
-
-    // 构建退款
-//    private RefundService buildRefundService(RSAAutoCertificateConfig config) {
-//        return new RefundService.Builder().config(config).build();
-//    }
-
-}

+ 0 - 65
qmjszx-pay/src/main/java/beilv/pay/controller/WxUserPayController.java

@@ -1,65 +0,0 @@
-//package beilv.pay.controller;
-//
-//import beilv.common.core.domain.AjaxResult;
-//import beilv.pay.service.WxUserPayService;
-//import cn.hutool.core.util.IdUtil;
-//import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
-//import com.wechat.pay.java.service.payments.model.Transaction;
-//import com.wechat.pay.java.service.refund.model.Refund;
-//import com.wechat.pay.java.service.refund.model.RefundNotification;
-//import org.springframework.transaction.annotation.Transactional;
-//import org.springframework.web.bind.annotation.*;
-//
-//import javax.annotation.Resource;
-//import javax.servlet.http.HttpServletRequest;
-//
-//@RestController
-//@RequestMapping
-//public class WxUserPayController {
-//    @Resource
-//    private WxUserPayService wxUserPayService;
-//
-//    /**
-//     * JSAPI 下单
-//     */
-//    @GetMapping("/create/IndentPayment")
-//    public AjaxResult creationIndentPayment(String openId) {
-//        PrepayWithRequestPaymentResponse paymentResponse = wxUserPayService.creationIndentPayment(IdUtil.simpleUUID(), openId, 0.01);
-//        return AjaxResult.success(paymentResponse);
-//    }
-//
-//    /**
-//     * JSAPI 下单回调
-//     */
-//    @PostMapping("/end/IndentPayment")
-//    @Transactional(rollbackFor = Exception.class)
-//    public synchronized AjaxResult endIndentPayment(HttpServletRequest request) {
-//        // 获取下单信息
-//        Transaction transaction = wxUserPayService.getTransaction(request);
-//        // 修改订单状态
-//        boolean result = wxUserPayService.indentPaymentBlack(transaction);
-////        ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "修改订单失败");
-//        return AjaxResult.success(result);
-//    }
-//
-//    /**
-//     * 退款
-//     */
-//    @GetMapping("/refund/IndentPayment")
-//    public AjaxResult refundIndentPayment(@RequestParam String orderId, @RequestParam Double amount) {
-//        Refund refund = wxUserPayService.refundIndentPayment(orderId, amount);
-//        return AjaxResult.success(refund);
-//    }
-//
-//    /**
-//     * 退款回调
-//     */
-//    @PostMapping("/refund/black")
-//    public AjaxResult endRefundIndent(HttpServletRequest request) {
-//        // 获取退款信息
-//        RefundNotification refundNotification = wxUserPayService.getRefundNotification(request);
-//        // 修改订单状态
-//        boolean result = wxUserPayService.refundIndentBlack(refundNotification);
-//        return AjaxResult.success(result);
-//    }
-//}

+ 0 - 30
qmjszx-pay/src/main/java/beilv/pay/service/WxUserPayService.java

@@ -1,30 +0,0 @@
-//package beilv.pay.service;
-//
-//import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
-//import com.wechat.pay.java.service.payments.model.Transaction;
-//import com.wechat.pay.java.service.refund.model.Refund;
-//import com.wechat.pay.java.service.refund.model.RefundNotification;
-//
-//import javax.servlet.http.HttpServletRequest;
-//
-//public interface WxUserPayService {
-//
-//
-//    // 微信支付
-//    PrepayWithRequestPaymentResponse creationIndentPayment(String indentId, String myOpenId, Double amount);
-//
-//    // 获取支付回调信息
-//    Transaction getTransaction(HttpServletRequest request);
-//
-//    // 支付回调
-//    boolean indentPaymentBlack(Transaction transaction);
-//
-//    // 退款申请
-//    Refund refundIndentPayment(String refundId, Double amount);
-//
-//    // 获取退款回调信息
-//    RefundNotification getRefundNotification(HttpServletRequest request);
-//
-//    // 退款回调
-//    boolean refundIndentBlack(RefundNotification refundNotification);
-//}

+ 0 - 165
qmjszx-pay/src/main/java/beilv/pay/service/impl/WxUserPayServiceImpl.java

@@ -1,165 +0,0 @@
-//package beilv.pay.service.impl;
-//
-//import beilv.pay.config.WxPayConfig;
-//import beilv.pay.service.WxUserPayService;
-//import com.wechat.pay.java.core.notification.NotificationParser;
-//import com.wechat.pay.java.core.notification.RequestParam;
-//import com.wechat.pay.java.service.payments.jsapi.model.Amount;
-//import com.wechat.pay.java.service.payments.jsapi.model.Payer;
-//import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
-//import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
-//import com.wechat.pay.java.service.payments.model.Transaction;
-//import com.wechat.pay.java.service.refund.model.AmountReq;
-//import com.wechat.pay.java.service.refund.model.CreateRequest;
-//import com.wechat.pay.java.service.refund.model.Refund;
-//import com.wechat.pay.java.service.refund.model.RefundNotification;
-//import lombok.SneakyThrows;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.stereotype.Service;
-//
-//import javax.annotation.Resource;
-//import javax.servlet.http.HttpServletRequest;
-//import java.io.BufferedReader;
-//import java.math.BigDecimal;
-//
-//@Service
-//@Slf4j
-//public class WxUserPayServiceImpl implements WxUserPayService {
-//
-//    @Resource
-//    private WxPayConfig wxPayConfig;
-////    @Resource
-////    private UserOrderMapper userOrderMapper;
-//    /**
-//     * 请求参数
-//     */
-//    public static RequestParam requestParam = null;
-//
-//    @Override
-//    public PrepayWithRequestPaymentResponse creationIndentPayment(String orderId, String myOpenId, Double amount) {
-//        PrepayRequest request = new PrepayRequest();
-//        // 金额
-//        Amount WxAmount = new Amount();
-//        WxAmount.setTotal(new BigDecimal(String.valueOf(amount)).movePointRight(2).intValue());
-//        WxAmount.setCurrency("CNY");
-//        request.setAmount(WxAmount);
-//        // 公众号appId
-//        request.setAppid(wxPayConfig.getAppId());
-//        // 商户号
-//        request.setMchid(wxPayConfig.getMerchantId());
-//        // 支付者信息
-//        Payer payer = new Payer();
-//        payer.setOpenid(myOpenId);
-//        request.setPayer(payer);
-//        // 描述
-//        request.setDescription("代办服务");
-//        // 微信回调地址
-//        request.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/end/IndentPayment");
-//        //系统内部订单号
-//        request.setOutTradeNo(orderId);
-//        //返回数据,前端调起支付
-//        return wxPayConfig.getJsapiServiceExtension().prepayWithRequestPayment(request);
-//    }
-//
-//    // 获取支付回调信息
-//    @Override
-//    public Transaction getTransaction(HttpServletRequest request) {
-//        NotificationParser notificationParser = getNotificationParser(request);
-//        return notificationParser.parse(requestParam, Transaction.class);
-//    }
-//
-//    // 支付回调
-//    @Override
-//    public boolean indentPaymentBlack(Transaction transaction) {
-//        System.out.println("---------------------------修改订单状态信息(下单)-------------------------------");
-//        // 获取订单号
-//        String orderId = transaction.getOutTradeNo();
-////        UserOrder userOrder = userOrderMapper.selectById(orderId);
-////        if (userOrder == null) {
-////            log.error("订单不存在");
-////            throw new BusinessException(40004,"订单不存在:" + transaction.getOutTradeNo());
-////        }
-////        log.info("下单成功");
-////        LambdaUpdateWrapper<UserOrder> updateWrapper = new LambdaUpdateWrapper<>();
-////        updateWrapper.set(UserOrder::getIsTrue,"已支付").eq(UserOrder::getOrderId,orderId);
-////        userOrderMapper.update(null,updateWrapper);
-//        System.out.println("---------------------------修改订单状态信息完毕-------------------------------");
-//        System.out.println("---------------------------添加微信支付记录完毕-------------------------------");
-//        return true;
-//    }
-//
-//    @Override
-//    public Refund refundIndentPayment(String refundId, Double amount) {
-//        // 退款请求
-//        CreateRequest createRequest = new CreateRequest();
-//        // 商户订单号
-//        createRequest.setOutTradeNo(refundId);
-//        // 商户退款单号
-//        createRequest.setOutRefundNo(refundId);
-//        // 退款结果回调
-//        createRequest.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/refund/black");
-//        // 退款金额
-//        AmountReq amountReq = new AmountReq();
-//        long refundAmount = new BigDecimal(String.valueOf(amount)).movePointRight(2).intValue();
-//        amountReq.setRefund(refundAmount);
-//        amountReq.setTotal(refundAmount);
-//        amountReq.setCurrency("CNY");
-//        createRequest.setAmount(amountReq);
-//        // 申请退款
-//        System.out.println("退款请求:" + createRequest);
-//        Refund refund = wxPayConfig.getRefundService().create(createRequest);
-//        System.out.println("退款申请结果:" + refund);
-//        return refund;
-//    }
-//
-//    // 获取退款回调信息
-//    @Override
-//    public RefundNotification getRefundNotification(HttpServletRequest request) {
-//        NotificationParser notificationParser = getNotificationParser(request);
-//        return notificationParser.parse(requestParam, RefundNotification.class);
-//    }
-//
-//    // 退款回调
-//    @Override
-//    public boolean refundIndentBlack(RefundNotification refundNotification) {
-//        System.out.println("---------------------------修改订单状态信息(退款)-------------------------------");
-//        // 获取订单号
-//        String indentIdByString = refundNotification.getOutTradeNo();
-//        System.out.println("---------------------------修改订单状态信息完毕-------------------------------");
-//        return true;
-//    }
-//
-//    /**
-//     * 根据微信官方发送的请求获取信息
-//     */
-//    @SneakyThrows
-//    public NotificationParser getNotificationParser(HttpServletRequest request) {
-//        System.out.println("---------------------------获取信息-------------------------------");
-//        // 获取RSA配置
-//        NotificationParser notificationParser = new NotificationParser(wxPayConfig.getRSAConfig());
-//        // 构建请求
-//        StringBuilder bodyBuilder = new StringBuilder();
-//        BufferedReader reader = request.getReader();
-//        String line;
-//        while ((line = reader.readLine()) != null) {
-//            bodyBuilder.append(line);
-//        }
-//        String body = bodyBuilder.toString();
-//        String timestamp = request.getHeader("Wechatpay-Timestamp");
-//        String nonce = request.getHeader("Wechatpay-Nonce");
-//        String signature = request.getHeader("Wechatpay-Signature");
-//        String singType = request.getHeader("Wechatpay-Signature-Type");
-//        String wechatPayCertificateSerialNumber = request.getHeader("Wechatpay-Serial");
-//        requestParam = new RequestParam.Builder()
-//                .serialNumber(wechatPayCertificateSerialNumber)
-//                .nonce(nonce)
-//                .signature(signature)
-//                .timestamp(timestamp)
-//                .signType(singType)
-//                .body(body)
-//                .build();
-//        System.out.println(requestParam.toString());
-//        System.out.println("---------------------------信息获取完毕-------------------------------");
-//        return notificationParser;
-//    }
-//}