|
@@ -1,29 +1,37 @@
|
|
|
package com.persagy.apm.energy.report.monthly.outline.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.persagy.apm.common.response.ApmResponseUpsertVO;
|
|
|
+import com.persagy.apm.common.response.CommonResult;
|
|
|
+import com.persagy.apm.common.response.PageList;
|
|
|
+import com.persagy.apm.common.utils.ResultHelper;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.model.ConvertReportOutlineTool;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.model.ReportOutline;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.model.dto.AddReportOutlineDTO;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.model.dto.PageQueryReportOutlineDTO;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.model.dto.QueryReportOutlineDTO;
|
|
|
+import com.persagy.apm.energy.report.monthly.outline.model.vo.ResponseReportOutlineListItemVO;
|
|
|
import com.persagy.apm.energy.report.monthly.outline.service.IReportOutlineService;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
-import com.persagy.apm.energy.report.monthly.outline.model.*;
|
|
|
-import com.persagy.apm.energy.report.monthly.outline.model.vo.*;
|
|
|
-import com.persagy.apm.energy.report.monthly.outline.model.dto.*;
|
|
|
-import com.persagy.apm.common.response.*;
|
|
|
-import com.persagy.apm.common.utils.ResultHelper;
|
|
|
+import org.assertj.core.util.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * 报告表控制层
|
|
|
+ * 报告概要控制层
|
|
|
*
|
|
|
* @author lixing
|
|
|
- * @version V1.0 2021-05-17 10:47:26
|
|
|
+ * @version V1.0 2021-05-17 11:09:37
|
|
|
*/
|
|
|
-@Api(tags = "报告表")
|
|
|
+@Api(tags = "报告概要")
|
|
|
@Validated
|
|
|
@RestController
|
|
|
@RequestMapping("reportOutlines")
|
|
@@ -31,7 +39,7 @@ public class ReportOutlineController {
|
|
|
@Autowired
|
|
|
private IReportOutlineService reportOutlineService;
|
|
|
|
|
|
- @ApiOperation(value = "创建报告表")
|
|
|
+ @ApiOperation(value = "创建报告概要")
|
|
|
@PostMapping("/create")
|
|
|
public CommonResult<ApmResponseUpsertVO> createReportOutline(
|
|
|
@Valid @RequestBody AddReportOutlineDTO addReportOutlineDTO) {
|
|
@@ -39,56 +47,70 @@ public class ReportOutlineController {
|
|
|
return ResultHelper.single(new ApmResponseUpsertVO(id));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "报告表详情")
|
|
|
- @PostMapping("/get")
|
|
|
- public CommonResult<ResponseReportOutlineItemVO> queryReportOutlineDetail(
|
|
|
- @Valid @RequestBody QueryReportOutlineDetailDTO queryReportOutlineDetailDTO) {
|
|
|
- ReportOutline reportOutline = reportOutlineService.queryReportOutlineDetail(queryReportOutlineDetailDTO.getId());
|
|
|
- ResponseReportOutlineItemVO responseReportOutlineItemVO = ConvertReportOutlineTool.INSTANCE.convert2ResponseItemDTO(reportOutline);
|
|
|
- return ResultHelper.single(responseReportOutlineItemVO);
|
|
|
- }
|
|
|
+// @ApiOperation(value = "报告概要详情")
|
|
|
+// @PostMapping("/get")
|
|
|
+// public CommonResult<ResponseReportOutlineItemVO> queryReportOutlineDetail(
|
|
|
+// @Valid @RequestBody QueryReportOutlineDetailDTO queryReportOutlineDetailDTO) {
|
|
|
+// ReportOutline reportOutline = reportOutlineService.queryReportOutlineDetail(queryReportOutlineDetailDTO.getId());
|
|
|
+// ResponseReportOutlineItemVO responseReportOutlineItemVO = ConvertReportOutlineTool.INSTANCE.convert2ResponseItemDTO(reportOutline);
|
|
|
+// return ResultHelper.single(responseReportOutlineItemVO);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
- @ApiOperation(value = "更新报告表")
|
|
|
- @PostMapping("/update")
|
|
|
- public CommonResult<ApmResponseUpsertVO> updateReportOutline(
|
|
|
- @Valid @RequestBody UpdateReportOutlineDTO updateReportOutlineDTO) {
|
|
|
- reportOutlineService.updateReportOutline(updateReportOutlineDTO);
|
|
|
- return ResultHelper.single(new ApmResponseUpsertVO(updateReportOutlineDTO.getId()));
|
|
|
- }
|
|
|
+// @ApiOperation(value = "更新报告概要")
|
|
|
+// @PostMapping("/update")
|
|
|
+// public CommonResult<ApmResponseUpsertVO> updateReportOutline(
|
|
|
+// @Valid @RequestBody UpdateReportOutlineDTO updateReportOutlineDTO) {
|
|
|
+// reportOutlineService.updateReportOutline(updateReportOutlineDTO);
|
|
|
+// return ResultHelper.single(new ApmResponseUpsertVO(updateReportOutlineDTO.getId()));
|
|
|
+// }
|
|
|
|
|
|
|
|
|
- @ApiOperation(value = "删除报告表")
|
|
|
- @PostMapping("/delete")
|
|
|
- public CommonResult deleteReportOutline(
|
|
|
- @RequestBody @Valid DeleteReportOutlineDTO deleteReportOutlineDTO) {
|
|
|
- reportOutlineService.deleteReportOutline(deleteReportOutlineDTO.getId());
|
|
|
- return ResultHelper.success();
|
|
|
- }
|
|
|
+// @ApiOperation(value = "删除报告概要")
|
|
|
+// @PostMapping("/delete")
|
|
|
+// public CommonResult deleteReportOutline(
|
|
|
+// @RequestBody @Valid DeleteReportOutlineDTO deleteReportOutlineDTO) {
|
|
|
+// reportOutlineService.deleteReportOutline(deleteReportOutlineDTO.getId());
|
|
|
+// return ResultHelper.success();
|
|
|
+// }
|
|
|
+
|
|
|
|
|
|
+// @ApiOperation(value = "报告概要列表")
|
|
|
+// @PostMapping("/query")
|
|
|
+// public CommonResult<PageList<ResponseReportOutlineListItemVO>> queryReportOutline(
|
|
|
+// @Valid @RequestBody QueryReportOutlineDTO queryReportOutlineDTO) {
|
|
|
+// List<ReportOutline> reportOutlineList = reportOutlineService.queryReportOutlineList(queryReportOutlineDTO);
|
|
|
+// List<ResponseReportOutlineListItemVO> resultList = ConvertReportOutlineTool.INSTANCE.convert2List(reportOutlineList);
|
|
|
+// return ResultHelper.multi(resultList);
|
|
|
+// }
|
|
|
|
|
|
- @ApiOperation(value = "报告表列表")
|
|
|
+ @ApiOperation(value = "报告概要列表, 分页查询")
|
|
|
@PostMapping("/query")
|
|
|
public CommonResult<PageList<ResponseReportOutlineListItemVO>> queryReportOutline(
|
|
|
- @Valid @RequestBody QueryReportOutlineDTO queryReportOutlineDTO) {
|
|
|
- List<ReportOutline> reportOutlineList = reportOutlineService.queryReportOutlineList(queryReportOutlineDTO);
|
|
|
- List<ResponseReportOutlineListItemVO> resultList = ConvertReportOutlineTool.INSTANCE.convert2List(reportOutlineList);
|
|
|
- return ResultHelper.multi(resultList);
|
|
|
+ @Valid @RequestBody PageQueryReportOutlineDTO pageQueryReportOutlineDTO) {
|
|
|
+ IPage<ReportOutline> pagedList = reportOutlineService.pageQueryReportOutline(pageQueryReportOutlineDTO);
|
|
|
+ IPage<ResponseReportOutlineListItemVO> pagedResultList = pagedList.convert(item -> {
|
|
|
+ try {
|
|
|
+ return ConvertReportOutlineTool.INSTANCE.convert2ResponseListItemDTO(item);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new IllegalArgumentException("分页查询,ReportOutline实体类转换为列表对象发生异常", e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return ResultHelper.multi(pagedResultList);
|
|
|
}
|
|
|
|
|
|
- //@ApiOperation(value = "报告表列表, 分页查询")
|
|
|
- //@PostMapping("/query")
|
|
|
- //public CommonResult<PageList<ResponseReportOutlineListItemVO>> queryReportOutline(
|
|
|
- // @Valid @RequestBody PageQueryReportOutlineDTO pageQueryReportOutlineDTO) {
|
|
|
- // IPage<ReportOutline> pagedList = reportOutlineService.pageQueryReportOutline(pageQueryReportOutlineDTO);
|
|
|
- // IPage<ResponseReportOutlineListItemVO> pagedResultList = pagedList.convert(item -> {
|
|
|
- // try {
|
|
|
- // return ConvertReportOutlineTool.INSTANCE.convert2ResponseListItemDTO(item);
|
|
|
- // } catch (Exception e) {
|
|
|
- // throw new IllegalArgumentException("分页查询,ReportOutline实体类转换为列表对象发生异常", e);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // return ResultHelper.multi(pagedResultList);
|
|
|
- //}
|
|
|
+ @ApiOperation(value = "查询用户可选项目范围")
|
|
|
+ @PostMapping("/queryAvailableProjects")
|
|
|
+ public CommonResult<PageList<ResponseReportOutlineListItemVO>> queryAvailableProjects() {
|
|
|
+ // TODO: 2021/5/17 查询用户可选项目范围
|
|
|
+ return ResultHelper.multi(Lists.newArrayList());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询用户可选分区范围")
|
|
|
+ @PostMapping("/queryAvailableAreas")
|
|
|
+ public CommonResult<PageList<ResponseReportOutlineListItemVO>> queryAvailableAreas() {
|
|
|
+ // TODO: 2021/5/17 查询用户可选分区范围
|
|
|
+ return ResultHelper.multi(Lists.newArrayList());
|
|
|
+ }
|
|
|
}
|
|
|
|