|
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound;
|
|
import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.museums.dal.mysql.specimenoutbound.SpecimenOutboundMapper;
|
|
import cn.iocoder.yudao.module.museums.dal.mysql.specimenoutbound.SpecimenOutboundMapper;
|
|
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
|
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
|
|
|
+import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -16,6 +17,7 @@ import javax.servlet.http.*;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
@@ -47,6 +49,8 @@ public class SpecimenOutboundController {
|
|
private SpecimenOutboundService specimenOutboundService;
|
|
private SpecimenOutboundService specimenOutboundService;
|
|
@Resource
|
|
@Resource
|
|
private PermissionApi permissionApi;
|
|
private PermissionApi permissionApi;
|
|
|
|
+ @Resource
|
|
|
|
+ private AdminUserMapper adminUserMapper;
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建标本出库申请")
|
|
@Operation(summary = "创建标本出库申请")
|
|
@@ -150,19 +154,69 @@ public class SpecimenOutboundController {
|
|
return success(result);
|
|
return success(result);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// @GetMapping("/export-excel")
|
|
|
|
+// @Operation(summary = "导出标本出库回库信息 Excel")
|
|
|
|
+// @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:export')")
|
|
|
|
+// @ApiAccessLog(operateType = EXPORT)
|
|
|
|
+// public void exportSpecimenOutboundExcel(@Valid SpecimenOutboundPageReqVO pageReqVO,
|
|
|
|
+// HttpServletResponse response) throws IOException {
|
|
|
|
+// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
+// List<SpecimenOutboundDO> list = specimenOutboundService.getSpecimenOutboundPage(pageReqVO).getList();
|
|
|
|
+// List<SpecimenOutboundDO> newList= BeanUtils.toBean(list,);
|
|
|
|
+//// list.forEach(specimenOutbound->{
|
|
|
|
+////
|
|
|
|
+//// });
|
|
|
|
+// // 导出 Excel
|
|
|
|
+// ExcelUtils.write(response, "标本出库回库信息.xls", "数据", SpecimenOutboundRespVO.class,
|
|
|
|
+// BeanUtils.toBean(list, SpecimenOutboundRespVO.class));
|
|
|
|
+// }
|
|
|
|
+
|
|
@GetMapping("/export-excel")
|
|
@GetMapping("/export-excel")
|
|
@Operation(summary = "导出标本出库回库信息 Excel")
|
|
@Operation(summary = "导出标本出库回库信息 Excel")
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:export')")
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:export')")
|
|
@ApiAccessLog(operateType = EXPORT)
|
|
@ApiAccessLog(operateType = EXPORT)
|
|
public void exportSpecimenOutboundExcel(@Valid SpecimenOutboundPageReqVO pageReqVO,
|
|
public void exportSpecimenOutboundExcel(@Valid SpecimenOutboundPageReqVO pageReqVO,
|
|
- HttpServletResponse response) throws IOException {
|
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
List<SpecimenOutboundDO> list = specimenOutboundService.getSpecimenOutboundPage(pageReqVO).getList();
|
|
List<SpecimenOutboundDO> list = specimenOutboundService.getSpecimenOutboundPage(pageReqVO).getList();
|
|
|
|
+
|
|
|
|
+ // 转换成 SpecimenOutboundExcelRespVO 并替换字段为用户昵称
|
|
|
|
+ List<SpecimenOutboundExcelRespVO> responseList = list.stream().map(specimenOutbound -> {
|
|
|
|
+ SpecimenOutboundExcelRespVO respVO = BeanUtils.toBean(specimenOutbound, SpecimenOutboundExcelRespVO.class);
|
|
|
|
+
|
|
|
|
+ // 替换字段为用户昵称
|
|
|
|
+ if (specimenOutbound.getOperator() != null) {
|
|
|
|
+ String operatorNickname = adminUserMapper.selectNicknameByUserId(specimenOutbound.getOperator());
|
|
|
|
+ respVO.setOperatorNickname(operatorNickname); // 出库员
|
|
|
|
+ }
|
|
|
|
+ if (specimenOutbound.getTwoOperator() != null) {
|
|
|
|
+ String twoOperatorNickname = adminUserMapper.selectNicknameByUserId(specimenOutbound.getTwoOperator());
|
|
|
|
+ respVO.setTwoOperatorNickname(twoOperatorNickname); // 出库确认员
|
|
|
|
+ }
|
|
|
|
+ if (specimenOutbound.getReturnConfirm() != null) {
|
|
|
|
+ String returnConfirmNickname = adminUserMapper.selectNicknameByUserId(specimenOutbound.getReturnConfirm());
|
|
|
|
+ respVO.setReturnConfirmNickname(returnConfirmNickname); // 一回库确认员
|
|
|
|
+ }
|
|
|
|
+ if (specimenOutbound.getTwoReturnConfirm() != null) {
|
|
|
|
+ String twoReturnConfirmNickname = adminUserMapper.selectNicknameByUserId(specimenOutbound.getTwoReturnConfirm());
|
|
|
|
+ respVO.setTwoReturnConfirmNickname(twoReturnConfirmNickname); // 二回库确认员
|
|
|
|
+ }
|
|
|
|
+ if (specimenOutbound.getApproveUsers() != null) {
|
|
|
|
+ String approveUsersNickname = adminUserMapper.selectNicknameByUserId(specimenOutbound.getApproveUsers());
|
|
|
|
+ respVO.setApproveUsersNickname(approveUsersNickname); // 一审审批员
|
|
|
|
+ }
|
|
|
|
+ if (specimenOutbound.getTwoApproveUsers() != null) {
|
|
|
|
+ String twoApproveUsersNickname = adminUserMapper.selectNicknameByUserId(specimenOutbound.getTwoApproveUsers());
|
|
|
|
+ respVO.setTwoApproveUsersNickname(twoApproveUsersNickname); // 二审审批员
|
|
|
|
+ }
|
|
|
|
+ return respVO;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
// 导出 Excel
|
|
// 导出 Excel
|
|
- ExcelUtils.write(response, "标本出库回库信息.xls", "数据", SpecimenOutboundRespVO.class,
|
|
|
|
- BeanUtils.toBean(list, SpecimenOutboundRespVO.class));
|
|
|
|
|
|
+ ExcelUtils.write(response, "标本出库回库信息.xls", "数据", SpecimenOutboundExcelRespVO.class, responseList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//工作台
|
|
//工作台
|
|
//统计本年标本每月出库数量。
|
|
//统计本年标本每月出库数量。
|
|
@GetMapping("/statistics/outgoing/{year}")
|
|
@GetMapping("/statistics/outgoing/{year}")
|