|
|
@@ -6,15 +6,19 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthReportPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthReportRespVO;
|
|
|
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.mysql.qhse.report.QhseMonthReportMapper;
|
|
|
import cn.iocoder.yudao.module.pms.service.qhse.report.QhseMonthReportService;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
+import com.google.common.collect.ImmutableMap;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
@@ -27,8 +31,10 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
@@ -47,6 +53,10 @@ public class QhseMonthReportController {
|
|
|
private AdminUserApi adminUserApi;
|
|
|
@Autowired
|
|
|
private DeptApi deptApi;
|
|
|
+ @Autowired
|
|
|
+ private DeptService deptService;
|
|
|
+ @Autowired
|
|
|
+ private QhseMonthReportMapper qhseMonthReportMapper;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建资料")
|
|
|
@@ -85,6 +95,13 @@ public class QhseMonthReportController {
|
|
|
@Operation(summary = "获得资料分页")
|
|
|
@PreAuthorize("@ss.hasPermission('rq:qhse-month-report:query')")
|
|
|
public CommonResult<PageResult<QhseMonthReportRespVO>> getQhseMonthReportPage(@Valid QhseMonthReportPageReqVO pageReqVO) {
|
|
|
+ Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
+ Set<Long> ids = new HashSet<>();
|
|
|
+ if (Objects.nonNull(loginUserDeptId)) {
|
|
|
+ ids = deptService.getChildDeptIdListFromCache(loginUserDeptId);
|
|
|
+ ids.add(loginUserDeptId);
|
|
|
+ }
|
|
|
+ pageReqVO.setDeptIds(ids);
|
|
|
PageResult<QhseMonthReportDO> pageResult = qhseMonthReportService.getQhseMonthReportPage(pageReqVO);
|
|
|
List<QhseMonthReportRespVO> collect = pageResult.getList().stream().map(e -> {
|
|
|
QhseMonthReportRespVO qhseMonthReportRespVO = new QhseMonthReportRespVO();
|
|
|
@@ -127,4 +144,51 @@ public class QhseMonthReportController {
|
|
|
BeanUtils.toBean(list, QhseMonthReportRespVO.class));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @PostMapping("/approval/{id}")
|
|
|
+ public CommonResult<String> approvalMonthReport(@PathVariable Long id) {
|
|
|
+ assert Objects.nonNull(id);
|
|
|
+ QhseMonthReportDO qhseMonthReport = qhseMonthReportService.getQhseMonthReport(id);
|
|
|
+ qhseMonthReport.setStatus("approved");//审批通过
|
|
|
+ qhseMonthReportMapper.updateById(qhseMonthReport);
|
|
|
+ return success("审批完成");
|
|
|
+ }
|
|
|
+ @PostMapping("/reject")
|
|
|
+ public CommonResult<String> rejectMonthReport(@RequestBody ImmutableMap<String, String> map) {
|
|
|
+ assert Objects.nonNull(map);
|
|
|
+ Long id = Long.parseLong(map.get("id").toString());
|
|
|
+ String rejectDesc = map.get("rejectDesc").toString();
|
|
|
+ QhseMonthReportDO qhseMonthReport = qhseMonthReportService.getQhseMonthReport(id);
|
|
|
+ qhseMonthReport.setStatus("reject");//审批拒绝
|
|
|
+ qhseMonthReport.setRejectDesc(rejectDesc);
|
|
|
+ qhseMonthReportMapper.updateById(qhseMonthReport);
|
|
|
+ return success("审批完成");
|
|
|
+ }
|
|
|
+//
|
|
|
+// @GetMapping("/company/page")
|
|
|
+// @Operation(summary = "获得公司级别的月报分页")
|
|
|
+// @PreAuthorize("@ss.hasPermission('rq:qhse-month-report:query')")
|
|
|
+// public CommonResult<PageResult<QhseMonthReportRespVO>> getQhseMonthReportCompanyPage(@Valid QhseMonthReportPageReqVO pageReqVO) {
|
|
|
+// PageResult<QhseMonthReportDO> pageResult = qhseMonthReportService.getQhseMonthReportPage(pageReqVO);
|
|
|
+// 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());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (Objects.nonNull(qhseMonthReportRespVO.getDeptId())){
|
|
|
+// DeptRespDTO dept = deptApi.getDept(qhseMonthReportRespVO.getDeptId());
|
|
|
+// if (Objects.nonNull(dept)){
|
|
|
+// qhseMonthReportRespVO.setDeptName(dept.getName());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return qhseMonthReportRespVO;
|
|
|
+// }).collect(Collectors.toList());
|
|
|
+// return success(new PageResult<>(collect, pageResult.getTotal()));
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
}
|