|
@@ -0,0 +1,95 @@
|
|
|
+package com.yc.ship.module.trade.controller.admin.orderjz;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+
|
|
|
+import javax.validation.constraints.*;
|
|
|
+import javax.validation.*;
|
|
|
+import javax.servlet.http.*;
|
|
|
+import java.util.*;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+import com.yc.ship.framework.common.pojo.PageParam;
|
|
|
+import com.yc.ship.framework.common.pojo.PageResult;
|
|
|
+import com.yc.ship.framework.common.pojo.CommonResult;
|
|
|
+import com.yc.ship.framework.common.util.object.BeanUtils;
|
|
|
+import static com.yc.ship.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+import com.yc.ship.framework.excel.core.util.ExcelUtils;
|
|
|
+
|
|
|
+import com.yc.ship.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import static com.yc.ship.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
+
|
|
|
+import com.yc.ship.module.trade.controller.admin.orderjz.vo.*;
|
|
|
+import com.yc.ship.module.trade.dal.dataobject.orderjz.OrderJzDO;
|
|
|
+import com.yc.ship.module.trade.service.orderjz.OrderJzService;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 订单接站")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/trade/order-jz")
|
|
|
+@Validated
|
|
|
+public class OrderJzController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private OrderJzService orderJzService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建订单接站")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order-jz:create')")
|
|
|
+ public CommonResult<Long> createOrderJz(@Valid @RequestBody OrderJzSaveReqVO createReqVO) {
|
|
|
+ return success(orderJzService.createOrderJz(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新订单接站")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order-jz:update')")
|
|
|
+ public CommonResult<Boolean> updateOrderJz(@Valid @RequestBody OrderJzSaveReqVO updateReqVO) {
|
|
|
+ orderJzService.updateOrderJz(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除订单接站")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order-jz:delete')")
|
|
|
+ public CommonResult<Boolean> deleteOrderJz(@RequestParam("id") Long id) {
|
|
|
+ orderJzService.deleteOrderJz(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得订单接站")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order-jz:query')")
|
|
|
+ public CommonResult<OrderJzRespVO> getOrderJz(@RequestParam("id") Long id) {
|
|
|
+ OrderJzDO orderJz = orderJzService.getOrderJz(id);
|
|
|
+ return success(BeanUtils.toBean(orderJz, OrderJzRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得订单接站分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order-jz:query')")
|
|
|
+ public CommonResult<PageResult<OrderJzRespVO>> getOrderJzPage(@Valid OrderJzPageReqVO pageReqVO) {
|
|
|
+ PageResult<OrderJzDO> pageResult = orderJzService.getOrderJzPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, OrderJzRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出订单接站 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:order-jz:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportOrderJzExcel(@Valid OrderJzPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<OrderJzDO> list = orderJzService.getOrderJzPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "订单接站.xls", "数据", OrderJzRespVO.class,
|
|
|
+ BeanUtils.toBean(list, OrderJzRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|