liujie
2025-07-23 e0916aa2e78266fb12da41d75bf7aab701bbf3d0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/OrderController.java
@@ -2,8 +2,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.wx.RefundCallbackResult;
import com.ruoyi.system.pojo.dto.AppUserPageDTO;
import com.ruoyi.system.pojo.dto.OrderPageDTO;
import com.ruoyi.system.pojo.vo.*;
import com.ruoyi.system.service.OrderService;
@@ -14,9 +12,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@Slf4j
@RestController
@@ -31,7 +27,7 @@
     */
    @PostMapping("/getOrderPage")
    @ApiOperation(value = "订单分页")
    @PreAuthorize("@ss.hasPermi('order:manage')")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<IPage<OrderPageVO>> getOrderPage(@RequestBody OrderPageDTO dto) {
        return R.ok(orderService.getOrderPage(dto));
    }
@@ -40,7 +36,7 @@
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "查看详情-基础信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<OrderDetailVO> detail(@PathVariable("id") String id) {
        return R.ok(orderService.detail(id));
    }
@@ -50,55 +46,55 @@
     */
    @GetMapping("/business/{id}")
    @ApiOperation(value = "查看详情-企业工商信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<BusinessVO> business(@PathVariable("id") String id) {
        return R.ok(orderService.business(id));
    }
    /**
     * todo redis 企业异常信息
     *  企业异常信息
     */
    @GetMapping("/error/{id}")
    @ApiOperation(value = "查看详情-企业异常信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<ErrorVO> error(@PathVariable("id") String id) {
        return R.ok(orderService.error(id));
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R error(@PathVariable("id") String id) {
        return orderService.error(id);
    }
    /**
     * todo redis 企业变更信息
     *  企业变更信息
     */
    @GetMapping("/change/{id}")
    @ApiOperation(value = "查看详情-企业变更信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<ChangeVO> change(@PathVariable("id") String id) {
        return R.ok(orderService.change(id));
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R change(@PathVariable("id") String id) {
        return orderService.change(id);
    }
    /**
     * todo redis 企业纳税信息
     *  企业纳税信息
     */
    @GetMapping("/tax/{id}")
    @ApiOperation(value = "查看详情-企业纳税信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<TaxVO> tax(@PathVariable("id") String id) {
        return R.ok(orderService.tax(id));
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R tax(@PathVariable("id") String id) {
        return orderService.tax(id);
    }
    /**
     * todo redis 企业发票信息
     * 企业发票信息
     */
    @GetMapping("/invoice/{id}")
    @ApiOperation(value = "查看详情-企业纳税信息")
    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R<InvoiceVO> invoice(@PathVariable("id") String id) {
        return R.ok(orderService.invoice(id));
    @ApiOperation(value = "查看详情-企业发票信息")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R invoice(@PathVariable("id") String id) {
        return orderService.invoice(id);
    }
    /**
     *  删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除")
    @PreAuthorize("@ss.hasPermi('order:manage')")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R delete(@PathVariable("id") String id) {
        orderService.delete(id);
        return R.ok();
@@ -110,7 +106,7 @@
     */
    @PutMapping("/shelves/{id}")
    @ApiOperation(value = "上、下架")
    @PreAuthorize("@ss.hasPermi('order:manage')")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R shelves(@PathVariable("id") String id) {
        orderService.shelves(id);
        return R.ok();
@@ -121,34 +117,27 @@
     */
    @PutMapping("/cancel/{id}")
    @ApiOperation(value = "取消交易")
    @PreAuthorize("@ss.hasPermi('order:manage')")
//    @PreAuthorize("@ss.hasPermi('order:manage')")
    public R cancel(@PathVariable("id") String id) {
        orderService.cancel(id);
        return R.ok();
    }
    /**
     * 订单取消支付回退
     *
     * @param refundCallbackResult
     * @param response
     * 平台取消订单支付回退
     * @return
     */
    @ResponseBody
    @GetMapping("/refundPayMoneyCallback")
    public void refundPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response) {
        R callback = orderService.refundPayMoneyCallback(refundCallbackResult);
    @PostMapping("/refundPayMoneyCallback")
    public String refundPayMoneyCallback(@RequestBody(required = false) String xmlData) {
        System.out.println("平台取消订单:" + xmlData);
        R callback = orderService.refundPayMoneyCallback(xmlData);
        if (callback.getCode() == 200) {
            response.setStatus(200);
            PrintWriter out = null;
            try {
                out = response.getWriter();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            out.println("success");
            out.flush();
            out.close();
            return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
        }else {
            System.err.println("支付回退错误:"+callback.getMsg());
            return "<xml><return_code><![CDATA[FAIL]]></return_code></xml>";
        }
    }
}