|
@@ -14,11 +14,15 @@ import javax.servlet.http.*;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
@@ -26,6 +30,8 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
|
+import static cn.iocoder.yudao.module.museums.enums.ErrorCodeConstants.NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS;
|
|
|
+import static cn.iocoder.yudao.module.museums.enums.ErrorCodeConstants.SPECIMEN_OUTBOUND_NOT_EXISTS;
|
|
|
|
|
|
import cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound.vo.*;
|
|
|
import cn.iocoder.yudao.module.museums.dal.dataobject.specimenoutbound.SpecimenOutboundDO;
|
|
@@ -60,19 +66,22 @@ public class SpecimenOutboundController {
|
|
|
@PostMapping("/approve")
|
|
|
@Operation(summary = "审批通过")
|
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:approve')")
|
|
|
- public CommonResult<Void> approveSpecimenOutbound(@RequestParam("id") Long id) {
|
|
|
- // 更新状态为审批通过,并插入当前时间作为审批时间
|
|
|
- specimenOutboundService.updateStatus(id, 1, LocalDateTime.now(), null);
|
|
|
+ public CommonResult<Void> approveSpecimenOutbound(@RequestBody SpecimenOutboundApprovalReqVO req) {
|
|
|
+ req.setApproveUsers(getLoginUserId()); // 获取操作员ID
|
|
|
+ req.setApprovalTime(LocalDateTime.now()); // 设置当前时间
|
|
|
+ req.setStatus(1); // 设置审批状态为通过
|
|
|
+ specimenOutboundService.updateStatus(req);
|
|
|
return success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/reject")
|
|
|
@Operation(summary = "审批驳回")
|
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:reject')")
|
|
|
- public CommonResult<Void> rejectSpecimenOutbound(@RequestParam("id") Long id,
|
|
|
- @RequestParam("processInstanceId") String processInstanceId) {
|
|
|
- // 更新状态为审批驳回,并插入当前时间作为审批时间
|
|
|
- specimenOutboundService.updateStatus(id, 2, LocalDateTime.now(), processInstanceId);
|
|
|
+ public CommonResult<Void> rejectSpecimenOutbound(@Valid @RequestBody SpecimenOutboundApprovalReqVO req) {
|
|
|
+ req.setApproveUsers(getLoginUserId()); // 获取操作员ID
|
|
|
+ req.setApprovalTime(LocalDateTime.now()); // 设置当前时间
|
|
|
+ req.setStatus(2); // 设置审批状态为驳回
|
|
|
+ specimenOutboundService.updateStatus(req);
|
|
|
return success(null);
|
|
|
}
|
|
|
|
|
@@ -112,6 +121,26 @@ public class SpecimenOutboundController {
|
|
|
return success(BeanUtils.toBean(specimenOutbound, SpecimenOutboundRespVO.class));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/getReturn")
|
|
|
+ @Operation(summary = "获得标本回库信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+ public CommonResult<SpecimenOutboundRespVO> getSpecimenReturnInformation(@RequestParam("id") Long id) {
|
|
|
+ SpecimenOutboundDO specimenOutbound = specimenOutboundService.getSpecimenReturnInformation(id);
|
|
|
+ if (specimenOutbound != null && specimenOutbound.getStatus() == 4) {
|
|
|
+ SpecimenOutboundRespVO respVO = new SpecimenOutboundRespVO();
|
|
|
+ respVO.setReturner(specimenOutbound.getReturner());
|
|
|
+ respVO.setReceiver(specimenOutbound.getReceiver());
|
|
|
+ respVO.setReturnDate(specimenOutbound.getReturnDate());
|
|
|
+ respVO.setRemarks(specimenOutbound.getRemarks());
|
|
|
+ respVO.setSpecimenCondition(specimenOutbound.getSpecimenCondition());
|
|
|
+ return success(respVO);
|
|
|
+ } else {
|
|
|
+ throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得标本出库回库信息分页")
|
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
@@ -133,4 +162,129 @@ public class SpecimenOutboundController {
|
|
|
BeanUtils.toBean(list, SpecimenOutboundRespVO.class));
|
|
|
}
|
|
|
|
|
|
+ //工作台
|
|
|
+ //根据出库的登记情况统计本年标本出库信息。
|
|
|
+ @GetMapping("/statistics/outgoing/{year}")
|
|
|
+ @Operation(summary = "根据出库登记情况统计本年标本出库信息")
|
|
|
+ @Parameter(name = "year", description = "年份", required = true, example = "2024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+ public CommonResult<List<SpecimenOutboundDO>> getOutboundStatistics(@PathVariable int year) {
|
|
|
+ List<SpecimenOutboundDO> outboundStatistics = specimenOutboundService.getOutboundStatistics(year);
|
|
|
+ return success(outboundStatistics);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/statistics/return/{year}")
|
|
|
+ @Operation(summary = "统计本年标本回库信息")
|
|
|
+ @Parameter(name = "year", description = "年份", required = true, example = "2024")
|
|
|
+ public CommonResult<List<SpecimenOutboundDO>> getReturnStatistics(@PathVariable int year) {
|
|
|
+ List<SpecimenOutboundDO> result = specimenOutboundService.getReturnStatistics(year);
|
|
|
+ return success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+// @GetMapping("/outboundOrder")
|
|
|
+// @Operation(summary = "获得标本出库单")
|
|
|
+// @Parameter(name = "infoIds", description = "标本ID列表", required = true, example = "1,2,3,4")
|
|
|
+// @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+// public CommonResult<List<SpecimenOutboundInfoVO>> getSpecimenOutbound(@RequestParam("infoIds") String infoIds) {
|
|
|
+// List<Long> ids = Arrays.stream(infoIds.split(","))
|
|
|
+// .map(Long::valueOf)
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// List<SpecimenOutboundDO> specimenOutbounds = specimenOutboundService.getSpecimenOutboundsByIds(ids);
|
|
|
+//
|
|
|
+// // 手动转换 SpecimenOutboundDO 到 SpecimenOutboundRespVO
|
|
|
+// List<SpecimenOutboundInfoVO> response = specimenOutbounds.stream()
|
|
|
+// .map(outbound -> {
|
|
|
+// SpecimenOutboundInfoVO vo = new SpecimenOutboundInfoVO();
|
|
|
+// vo.setId(outbound.getId());
|
|
|
+// vo.setChineseName(outbound.getChineseName());
|
|
|
+// vo.setSpecimenNumber(outbound.getSpecimenNumber());
|
|
|
+// vo.setApplicantName(outbound.getApplicantName());
|
|
|
+// vo.setApplicationDate(outbound.getApplicationDate());
|
|
|
+// vo.setImagePath(outbound.getImagePath());
|
|
|
+// vo.setStorageLocation(outbound.getStorageLocation());
|
|
|
+// // 这里可以继续设置其他字段
|
|
|
+// return vo;
|
|
|
+// })
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+ //能用
|
|
|
+// return success(response);
|
|
|
+// }
|
|
|
+
|
|
|
+// @GetMapping("/specimenInfo")
|
|
|
+// @Operation(summary = "获得标本信息")
|
|
|
+// @Parameter(name = "outboundOrderId", description = "标本出库回库表的ID", required = true, example = "1")
|
|
|
+// @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+// public CommonResult<List<SpecimenOutboundInfoVO>> getSpecimenInfo(@RequestParam("outboundOrderId") Long outboundOrderId) {
|
|
|
+// // 根据出库单ID获取信息
|
|
|
+// List<SpecimenOutboundDO> specimenOutbounds = specimenOutboundService.getSpecimenOutboundsByOutboundOrderId(outboundOrderId);
|
|
|
+//
|
|
|
+// // 手动转换 SpecimenOutboundDO 到 SpecimenOutboundInfoVO
|
|
|
+// List<SpecimenOutboundInfoVO> response = specimenOutbounds.stream()
|
|
|
+// .map(outbound -> {
|
|
|
+// SpecimenOutboundInfoVO vo = new SpecimenOutboundInfoVO();
|
|
|
+// vo.setInfoId(outbound.getInfoId()); // 直接获取infoId
|
|
|
+// vo.setImagePath(outbound.getImagePath());
|
|
|
+// vo.setStorageLocation(outbound.getStorageLocation());
|
|
|
+// vo.setSpecimenNumber(outbound.getSpecimenNumber());
|
|
|
+// return vo;
|
|
|
+// })
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// return success(response);
|
|
|
+// }
|
|
|
+
|
|
|
+// @GetMapping("/specimenInfo")
|
|
|
+// @Operation(summary = "获得标本信息")
|
|
|
+// @Parameter(name = "outboundOrderId", description = "标本出库回库表的ID", required = true, example = "1")
|
|
|
+// @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+// public CommonResult<List<SpecimenOutboundInfoVO>> getSpecimenInfo(@RequestParam("outboundOrderId") Long outboundOrderId) {
|
|
|
+// // 根据出库单ID获取信息
|
|
|
+// List<SpecimenOutboundDO> specimenOutbounds = specimenOutboundService.getSpecimenOutboundsByOutboundOrderId(outboundOrderId);
|
|
|
+//
|
|
|
+// // 手动转换 SpecimenOutboundDO 到 SpecimenOutboundInfoVO
|
|
|
+// List<SpecimenOutboundInfoVO> response = specimenOutbounds.stream()
|
|
|
+// .map(outbound -> {
|
|
|
+// SpecimenOutboundInfoVO vo = new SpecimenOutboundInfoVO();
|
|
|
+// vo.setInfoId(outbound.getInfoId()); // 直接获取infoId
|
|
|
+// vo.setImagePath(outbound.getImagePath());
|
|
|
+// vo.setStorageLocation(outbound.getStorageLocation());
|
|
|
+// vo.setSpecimenNumber(outbound.getSpecimenNumber());
|
|
|
+// return vo;
|
|
|
+// })
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// return success(response);
|
|
|
+// }
|
|
|
+
|
|
|
+// @GetMapping("/specimenInfo")
|
|
|
+// @Operation(summary = "获得标本出库回库信息")
|
|
|
+// @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+// @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+// public CommonResult<SpecimenOutboundWithInfoRespVO> getSpecimen(@RequestParam("id") Long id) {
|
|
|
+// SpecimenOutboundWithInfoRespVO specimenOutbound = specimenOutboundService.getSpecimenOutboundWithInfo(id);
|
|
|
+//
|
|
|
+// if (specimenOutbound == null) {
|
|
|
+// throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
|
|
|
+// }
|
|
|
+//
|
|
|
+// return success(specimenOutbound);
|
|
|
+// }
|
|
|
+
|
|
|
+ @GetMapping("/specimenInfo")
|
|
|
+ @Operation(summary = "获得标本出库回库信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
|
|
|
+ public CommonResult<SpecimenOutboundWithInfoRespVO> getSpecimen(@RequestParam("id") Long id) {
|
|
|
+ SpecimenOutboundWithInfoRespVO specimenOutbound = specimenOutboundService.getSpecimenOutboundWithInfo(id);
|
|
|
+
|
|
|
+ if (specimenOutbound == null) {
|
|
|
+ throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
|
|
|
+ }
|
|
|
+
|
|
|
+ return success(specimenOutbound);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|