猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
5.4 KiB

5 months ago
5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. package com.ruoyi.model.controller;
  2. import java.io.IOException;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import com.cyl.h5.pojo.vo.H5OrderVO;
  6. import com.cyl.h5.service.H5OrderService;
  7. import com.cyl.manager.oms.service.OrderService;
  8. import com.ruoyi.applet.service.IApiMallOrderService;
  9. import com.ruoyi.applet.service.IMallOrderService;
  10. import com.ruoyi.common.utils.StringUtils;
  11. import com.ruoyi.model.service.IAppletUsersService;
  12. import org.springframework.security.access.prepost.PreAuthorize;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.GetMapping;
  15. import org.springframework.web.bind.annotation.PostMapping;
  16. import org.springframework.web.bind.annotation.PutMapping;
  17. import org.springframework.web.bind.annotation.DeleteMapping;
  18. import org.springframework.web.bind.annotation.PathVariable;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import com.ruoyi.common.annotation.Log;
  23. import com.ruoyi.common.core.controller.BaseController;
  24. import com.ruoyi.common.core.domain.AjaxResult;
  25. import com.ruoyi.common.enums.BusinessType;
  26. import com.ruoyi.model.domain.AppletOrder;
  27. import com.ruoyi.model.service.IAppletOrderService;
  28. import com.ruoyi.common.utils.poi.ExcelUtil;
  29. import com.ruoyi.common.core.page.TableDataInfo;
  30. /**
  31. * 订单信息Controller
  32. *
  33. * @author ruoyi
  34. * @date 2025-03-28
  35. */
  36. @RestController
  37. @RequestMapping("/model/AppletOrder")
  38. public class AppletOrderController extends BaseController
  39. {
  40. @Autowired
  41. private IAppletOrderService appletOrderService;
  42. @Autowired
  43. private IMallOrderService mallOrderService;
  44. //下单小程序:那边来的订单信息
  45. @Autowired
  46. private H5OrderService h5OrderService;
  47. @Autowired
  48. private OrderService service;
  49. @Autowired
  50. private IAppletUsersService appletUsersService;
  51. @Autowired
  52. private IApiMallOrderService apiMallOrderService;
  53. /**
  54. * 查询订单信息列表
  55. */
  56. @PreAuthorize("@ss.hasPermi('model:AppletOrder:list')")
  57. @GetMapping("/list")
  58. public TableDataInfo list(AppletOrder appletOrder)
  59. {
  60. startPage();
  61. List<AppletOrder> list = appletOrderService.selectAppletOrderList(appletOrder);
  62. return getDataTable(list);
  63. }
  64. /**
  65. * 导出订单信息列表
  66. */
  67. @PreAuthorize("@ss.hasPermi('model:AppletOrder:export')")
  68. @Log(title = "订单信息", businessType = BusinessType.EXPORT)
  69. @PostMapping("/export")
  70. public void export(HttpServletResponse response, AppletOrder appletOrder) throws IOException {
  71. List<AppletOrder> list = appletOrderService.selectAppletOrderList(appletOrder);
  72. ExcelUtil<AppletOrder> util = new ExcelUtil<AppletOrder>(AppletOrder.class);
  73. util.exportExcel(response, list, "订单信息数据");
  74. }
  75. /**
  76. * 获取订单信息详细信息
  77. */
  78. @PreAuthorize("@ss.hasPermi('model:AppletOrder:query')")
  79. @GetMapping(value = "/{id}")
  80. public AjaxResult getInfo(@PathVariable("id") Long id)
  81. {
  82. return success(appletOrderService.selectAppletOrderById(id));
  83. }
  84. /**
  85. * 获取订单信息详细信息
  86. */
  87. @PreAuthorize("@ss.hasPermi('model:AppletOrder:query')")
  88. @GetMapping(value = "/detail/{orderId}")
  89. public AjaxResult getInfoDetail(@PathVariable("orderId") Long orderId)
  90. {
  91. return success(apiMallOrderService.orderDetail(orderId));
  92. }
  93. /**
  94. * 新增订单信息
  95. */
  96. @PreAuthorize("@ss.hasPermi('model:AppletOrder:add')")
  97. @Log(title = "订单信息", businessType = BusinessType.INSERT)
  98. @PostMapping
  99. public AjaxResult add(@RequestBody AppletOrder appletOrder)
  100. {
  101. H5OrderVO h5OrderVO = h5OrderService.orderDetail(appletOrder.getOrderId());
  102. if(h5OrderVO == null){
  103. return AjaxResult.error("订单不存在");
  104. }
  105. if(appletOrder.getType().equals("0")){
  106. //系统派单
  107. AjaxResult ajaxResult = mallOrderService.acceptDispatchAll(h5OrderVO);
  108. return ajaxResult;
  109. }else if(appletOrder.getType().equals("1")){
  110. if(StringUtils.isEmpty(appletOrder.getUserIdJson())){
  111. return AjaxResult.error("userIdJson不能为空");
  112. }
  113. //指定用户派单
  114. // Long appletUserId =Long.getLong(appletOrder.getUserIdJson());
  115. Long appletUserId = Long.valueOf(appletOrder.getUserIdJson());
  116. AjaxResult ajaxResult = mallOrderService.acceptDispatch(appletUserId, h5OrderVO);
  117. return ajaxResult;
  118. }else{
  119. return AjaxResult.error("type状态不能为空");
  120. }
  121. }
  122. /**
  123. * 修改订单信息
  124. */
  125. @PreAuthorize("@ss.hasPermi('model:AppletOrder:edit')")
  126. @Log(title = "订单信息", businessType = BusinessType.UPDATE)
  127. @PutMapping
  128. public AjaxResult edit(@RequestBody AppletOrder appletOrder)
  129. {
  130. return toAjax(appletOrderService.updateAppletOrder(appletOrder));
  131. }
  132. /**
  133. * 删除订单信息
  134. */
  135. @PreAuthorize("@ss.hasPermi('model:AppletOrder:remove')")
  136. @Log(title = "订单信息", businessType = BusinessType.DELETE)
  137. @DeleteMapping("/{ids}")
  138. public AjaxResult remove(@PathVariable Long[] ids)
  139. {
  140. return toAjax(appletOrderService.deleteAppletOrderByIds(ids));
  141. }
  142. }