|
@@ -11,9 +11,12 @@ import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthRepo
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthReportSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthReportSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.report.QhseMonthReportDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.report.QhseMonthReportDO;
|
|
|
import cn.iocoder.yudao.module.pms.service.qhse.report.QhseMonthReportService;
|
|
import cn.iocoder.yudao.module.pms.service.qhse.report.QhseMonthReportService;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -23,6 +26,8 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -36,6 +41,8 @@ public class QhseMonthReportController {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private QhseMonthReportService qhseMonthReportService;
|
|
private QhseMonthReportService qhseMonthReportService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建资料")
|
|
@Operation(summary = "创建资料")
|
|
@@ -75,7 +82,18 @@ public class QhseMonthReportController {
|
|
|
@PreAuthorize("@ss.hasPermission('rq:qhse-month-report:query')")
|
|
@PreAuthorize("@ss.hasPermission('rq:qhse-month-report:query')")
|
|
|
public CommonResult<PageResult<QhseMonthReportRespVO>> getQhseMonthReportPage(@Valid QhseMonthReportPageReqVO pageReqVO) {
|
|
public CommonResult<PageResult<QhseMonthReportRespVO>> getQhseMonthReportPage(@Valid QhseMonthReportPageReqVO pageReqVO) {
|
|
|
PageResult<QhseMonthReportDO> pageResult = qhseMonthReportService.getQhseMonthReportPage(pageReqVO);
|
|
PageResult<QhseMonthReportDO> pageResult = qhseMonthReportService.getQhseMonthReportPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, QhseMonthReportRespVO.class));
|
|
|
|
|
|
|
+ List<QhseMonthReportRespVO> collect = pageResult.getList().stream().map(e -> {
|
|
|
|
|
+ QhseMonthReportRespVO qhseMonthReportRespVO = new QhseMonthReportRespVO();
|
|
|
|
|
+ BeanUtils.copyProperties(e, qhseMonthReportRespVO);
|
|
|
|
|
+ if (Objects.nonNull(qhseMonthReportRespVO.getDutyPerson())){
|
|
|
|
|
+ AdminUserRespDTO user = adminUserApi.getUser(qhseMonthReportRespVO.getDutyPerson());
|
|
|
|
|
+ if (Objects.nonNull(user)){
|
|
|
|
|
+ qhseMonthReportRespVO.setPersonName(user.getNickname());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return qhseMonthReportRespVO;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ return success(new PageResult<>(collect, pageResult.getTotal()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
@GetMapping("/export-excel")
|