|
@@ -0,0 +1,109 @@
|
|
|
+package com.citu.module.menduner.system.controller.admin.hunt;
|
|
|
+
|
|
|
+
|
|
|
+import com.citu.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import com.citu.framework.common.pojo.CommonResult;
|
|
|
+import com.citu.framework.common.pojo.PageParam;
|
|
|
+import com.citu.framework.common.pojo.PageResult;
|
|
|
+import com.citu.framework.common.util.object.BeanUtils;
|
|
|
+import com.citu.framework.excel.core.util.ExcelUtils;
|
|
|
+import com.citu.module.menduner.system.controller.base.hunt.*;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.hunt.HuntDO;
|
|
|
+import com.citu.module.menduner.system.service.hunt.HuntService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.annotation.security.PermitAll;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.citu.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 猎寻服务")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/menduner/system/hunt")
|
|
|
+@Validated
|
|
|
+public class HuntController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private HuntService huntService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建猎寻服务")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:create')")
|
|
|
+ public CommonResult<Long> createHunt(@Valid @RequestBody HuntSaveReqVO createReqVO) {
|
|
|
+ return success(huntService.createHunt(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PermitAll
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @Operation(summary = "提交猎寻服务")
|
|
|
+ public CommonResult<Boolean> submit(@Valid @RequestBody HuntSubmitReqVO reqVO) {
|
|
|
+ huntService.submit(reqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/processed")
|
|
|
+ @Operation(summary = "已处理")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:update')")
|
|
|
+ public CommonResult<Boolean> processed(@Valid @RequestBody HuntProcessedReqVO reqVO) {
|
|
|
+ huntService.processed(reqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新猎寻服务")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:update')")
|
|
|
+ public CommonResult<Boolean> updateHunt(@Valid @RequestBody HuntSaveReqVO updateReqVO) {
|
|
|
+ huntService.updateHunt(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除猎寻服务")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:delete')")
|
|
|
+ public CommonResult<Boolean> deleteHunt(@RequestParam("id") Long id) {
|
|
|
+ huntService.deleteHunt(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得猎寻服务")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:query')")
|
|
|
+ public CommonResult<HuntRespVO> getHunt(@RequestParam("id") Long id) {
|
|
|
+ HuntDO hunt = huntService.getHunt(id);
|
|
|
+ return success(BeanUtils.toBean(hunt, HuntRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得猎寻服务分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:query')")
|
|
|
+ public CommonResult<PageResult<HuntRespVO>> getHuntPage(@Valid HuntPageReqVO pageReqVO) {
|
|
|
+ PageResult<HuntDO> pageResult = huntService.getHuntPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, HuntRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出猎寻服务 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:hunt:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportHuntExcel(@Valid HuntPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<HuntDO> list = huntService.getHuntPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "猎寻服务.xls", "数据", HuntRespVO.class,
|
|
|
+ BeanUtils.toBean(list, HuntRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|