package com.ruoyi.web.controller.system;
|
|
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;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
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
|
@RequestMapping("/system/order")
|
@Api( tags = "后台-订单管理")
|
public class OrderController {
|
@Resource
|
private OrderService orderService;
|
|
/**
|
* 分页
|
*/
|
@PostMapping("/getOrderPage")
|
@ApiOperation(value = "订单分页")
|
@PreAuthorize("@ss.hasPermi('order:manage')")
|
public R<IPage<OrderPageVO>> getOrderPage(@RequestBody OrderPageDTO dto) {
|
return R.ok(orderService.getOrderPage(dto));
|
}
|
/**
|
* 查看详情
|
*/
|
@GetMapping("/detail/{id}")
|
@ApiOperation(value = "查看详情-基础信息")
|
@PreAuthorize("@ss.hasPermi('order:manage')")
|
public R<OrderDetailVO> detail(@PathVariable("id") String id) {
|
return R.ok(orderService.detail(id));
|
}
|
|
/**
|
* 企业工商信息
|
*/
|
@GetMapping("/business/{id}")
|
@ApiOperation(value = "查看详情-企业工商信息")
|
@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));
|
}
|
/**
|
* 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));
|
}
|
/**
|
* 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));
|
}
|
|
/**
|
* 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));
|
}
|
/**
|
* 删除
|
*/
|
@DeleteMapping("/delete/{id}")
|
@ApiOperation(value = "删除")
|
@PreAuthorize("@ss.hasPermi('order:manage')")
|
public R delete(@PathVariable("id") String id) {
|
orderService.delete(id);
|
return R.ok();
|
}
|
|
|
/**
|
* 上、下架
|
*/
|
@PutMapping("/shelves/{id}")
|
@ApiOperation(value = "上、下架")
|
@PreAuthorize("@ss.hasPermi('order:manage')")
|
public R shelves(@PathVariable("id") String id) {
|
orderService.shelves(id);
|
return R.ok();
|
}
|
|
/**
|
* 取消交易
|
*/
|
@PutMapping("/cancel/{id}")
|
@ApiOperation(value = "取消交易")
|
@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);
|
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();
|
}
|
}
|
}
|