添加毒品库实体和service、mapper接口

master
陈江保 1 week ago
commit b51b9c28a2
  1. 0
      README.md
  2. 518
      db/repository.sql
  3. 238
      pom.xml
  4. 41
      src/main/java/digital/laboratory/platform/imr/IdentificationMaterialRepositoryApplication.java
  5. 77
      src/main/java/digital/laboratory/platform/imr/component/DateUtils.java
  6. 62
      src/main/java/digital/laboratory/platform/imr/component/GetClientIPUtil.java
  7. 28
      src/main/java/digital/laboratory/platform/imr/config/WebSecurityConfigurer.java
  8. 428
      src/main/java/digital/laboratory/platform/imr/controller/CabinetOpenController.java
  9. 295
      src/main/java/digital/laboratory/platform/imr/controller/DestructionPublicityController.java
  10. 15
      src/main/java/digital/laboratory/platform/imr/controller/DrugDepotsController.java
  11. 212
      src/main/java/digital/laboratory/platform/imr/controller/ReviewApprovalController.java
  12. 680
      src/main/java/digital/laboratory/platform/imr/controller/SampleApplyController.java
  13. 472
      src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseApplyController.java
  14. 594
      src/main/java/digital/laboratory/platform/imr/controller/SampleOutWarehouseController.java
  15. 947
      src/main/java/digital/laboratory/platform/imr/controller/SamplePutInStorageController.java
  16. 274
      src/main/java/digital/laboratory/platform/imr/controller/StorageCellController.java
  17. 354
      src/main/java/digital/laboratory/platform/imr/controller/StorageCupboardController.java
  18. 309
      src/main/java/digital/laboratory/platform/imr/controller/StorageRoomController.java
  19. 45
      src/main/java/digital/laboratory/platform/imr/dto/ApplyDTO.java
  20. 22
      src/main/java/digital/laboratory/platform/imr/dto/CombinationOut.java
  21. 61
      src/main/java/digital/laboratory/platform/imr/dto/DepositDTO.java
  22. 52
      src/main/java/digital/laboratory/platform/imr/dto/DepositToDTO.java
  23. 16
      src/main/java/digital/laboratory/platform/imr/dto/DestroyOutboundDTO.java
  24. 54
      src/main/java/digital/laboratory/platform/imr/dto/DestructionPublicityDTO.java
  25. 22
      src/main/java/digital/laboratory/platform/imr/dto/IconDTO.java
  26. 48
      src/main/java/digital/laboratory/platform/imr/dto/InRepositoryDTO.java
  27. 32
      src/main/java/digital/laboratory/platform/imr/dto/InnerSampleOutbound.java
  28. 47
      src/main/java/digital/laboratory/platform/imr/dto/OutWarehouseApplyDTO.java
  29. 41
      src/main/java/digital/laboratory/platform/imr/dto/PrintTableDTO.java
  30. 38
      src/main/java/digital/laboratory/platform/imr/dto/PublicityDTO.java
  31. 41
      src/main/java/digital/laboratory/platform/imr/dto/QueryApplyDTO.java
  32. 64
      src/main/java/digital/laboratory/platform/imr/dto/QueryDTO.java
  33. 47
      src/main/java/digital/laboratory/platform/imr/dto/QuerySampleDTO.java
  34. 32
      src/main/java/digital/laboratory/platform/imr/dto/QueryStorageDTO.java
  35. 32
      src/main/java/digital/laboratory/platform/imr/dto/ReturnOutboundDTO.java
  36. 40
      src/main/java/digital/laboratory/platform/imr/dto/ReviewApprovalDTO.java
  37. 20
      src/main/java/digital/laboratory/platform/imr/dto/ReviewSampleDetail.java
  38. 22
      src/main/java/digital/laboratory/platform/imr/dto/SampleApplyQueryDTO.java
  39. 17
      src/main/java/digital/laboratory/platform/imr/dto/SampleInfo.java
  40. 25
      src/main/java/digital/laboratory/platform/imr/dto/UpdateStorageDateDTO.java
  41. 46
      src/main/java/digital/laboratory/platform/imr/dto/UseOutboundDTO.java
  42. 18
      src/main/java/digital/laboratory/platform/imr/dto/UserInfoDTO.java
  43. 25
      src/main/java/digital/laboratory/platform/imr/dto/VerificationCode.java
  44. 39
      src/main/java/digital/laboratory/platform/imr/entity/AssociationOpen.java
  45. 70
      src/main/java/digital/laboratory/platform/imr/entity/CabinetOpeningRecord.java
  46. 51
      src/main/java/digital/laboratory/platform/imr/entity/DestructionDetail.java
  47. 86
      src/main/java/digital/laboratory/platform/imr/entity/DestructionPublicity.java
  48. 103
      src/main/java/digital/laboratory/platform/imr/entity/DrugCaseInfo.java
  49. 109
      src/main/java/digital/laboratory/platform/imr/entity/DrugMaterialInfo.java
  50. 102
      src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferAnalysisAnnex.java
  51. 102
      src/main/java/digital/laboratory/platform/imr/entity/IdentificationMaterialTransferRetainedAnnex.java
  52. 24
      src/main/java/digital/laboratory/platform/imr/entity/InventorySample.java
  53. 51
      src/main/java/digital/laboratory/platform/imr/entity/OutWarehouseDetailed.java
  54. 39
      src/main/java/digital/laboratory/platform/imr/entity/PrintSampleInAndOutInfo.java
  55. 141
      src/main/java/digital/laboratory/platform/imr/entity/SampleApply.java
  56. 57
      src/main/java/digital/laboratory/platform/imr/entity/SampleApplyDetailed.java
  57. 89
      src/main/java/digital/laboratory/platform/imr/entity/SampleInboundAndOutboundTable.java
  58. 70
      src/main/java/digital/laboratory/platform/imr/entity/SampleInboundRecord.java
  59. 91
      src/main/java/digital/laboratory/platform/imr/entity/SampleOutWarehouseApply.java
  60. 70
      src/main/java/digital/laboratory/platform/imr/entity/SampleOutboundRecord.java
  61. 150
      src/main/java/digital/laboratory/platform/imr/entity/SampleStorage.java
  62. 77
      src/main/java/digital/laboratory/platform/imr/entity/StorageCell.java
  63. 110
      src/main/java/digital/laboratory/platform/imr/entity/StorageCupboard.java
  64. 75
      src/main/java/digital/laboratory/platform/imr/entity/StorageRoom.java
  65. 31
      src/main/java/digital/laboratory/platform/imr/entity/enums/ApplyStatus.java
  66. 26
      src/main/java/digital/laboratory/platform/imr/entity/enums/OutApplyStatus.java
  67. 29
      src/main/java/digital/laboratory/platform/imr/entity/enums/OutboundType.java
  68. 24
      src/main/java/digital/laboratory/platform/imr/entity/enums/ReleaseStatus.java
  69. 28
      src/main/java/digital/laboratory/platform/imr/entity/enums/WarehouseMark.java
  70. 61
      src/main/java/digital/laboratory/platform/imr/feign/TransferFeignService.java
  71. 21
      src/main/java/digital/laboratory/platform/imr/feign/dto/UpdateHolderDTO.java
  72. 130
      src/main/java/digital/laboratory/platform/imr/handle/AppStartupRunner.java
  73. 37
      src/main/java/digital/laboratory/platform/imr/interceptor/FeignOauth2RequestInterceptor.java
  74. 10
      src/main/java/digital/laboratory/platform/imr/mapper/AssociationOpenMapper.java
  75. 24
      src/main/java/digital/laboratory/platform/imr/mapper/CabinetOpeningRecordMapper.java
  76. 38
      src/main/java/digital/laboratory/platform/imr/mapper/DestructionDetailMapper.java
  77. 42
      src/main/java/digital/laboratory/platform/imr/mapper/DestructionPublicityMapper.java
  78. 18
      src/main/java/digital/laboratory/platform/imr/mapper/DrugCaseInfoMapper.java
  79. 18
      src/main/java/digital/laboratory/platform/imr/mapper/DrugMaterialInfoMapper.java
  80. 21
      src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferAnalysisAnnexMapper.java
  81. 21
      src/main/java/digital/laboratory/platform/imr/mapper/IdentificationMaterialTransferRetainedAnnexMapper.java
  82. 20
      src/main/java/digital/laboratory/platform/imr/mapper/OutWarehouseDetailedMapper.java
  83. 26
      src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyDetailedMapper.java
  84. 52
      src/main/java/digital/laboratory/platform/imr/mapper/SampleApplyMapper.java
  85. 82
      src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundAndOutboundTableMapper.java
  86. 30
      src/main/java/digital/laboratory/platform/imr/mapper/SampleInboundRecordMapper.java
  87. 61
      src/main/java/digital/laboratory/platform/imr/mapper/SampleOutWarehouseApplyMapper.java
  88. 24
      src/main/java/digital/laboratory/platform/imr/mapper/SampleOutboundRecordMapper.java
  89. 173
      src/main/java/digital/laboratory/platform/imr/mapper/SampleStorageMapper.java
  90. 27
      src/main/java/digital/laboratory/platform/imr/mapper/StorageCellMapper.java
  91. 26
      src/main/java/digital/laboratory/platform/imr/mapper/StorageCupboardMapper.java
  92. 26
      src/main/java/digital/laboratory/platform/imr/mapper/StorageRoomMapper.java
  93. 9
      src/main/java/digital/laboratory/platform/imr/service/AssociationOpenService.java
  94. 30
      src/main/java/digital/laboratory/platform/imr/service/CabinetOpeningRecordService.java
  95. 31
      src/main/java/digital/laboratory/platform/imr/service/DestructionPublicityService.java
  96. 13
      src/main/java/digital/laboratory/platform/imr/service/DrugCaseInfoService.java
  97. 13
      src/main/java/digital/laboratory/platform/imr/service/DrugMaterialInfoService.java
  98. 14
      src/main/java/digital/laboratory/platform/imr/service/OutWarehouseDetailedService.java
  99. 42
      src/main/java/digital/laboratory/platform/imr/service/ReviewApprovalService.java
  100. 42
      src/main/java/digital/laboratory/platform/imr/service/SampleApplyService.java
  101. Some files were not shown because too many files have changed in this diff Show More

File diff suppressed because one or more lines are too long

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>digital.laboratory.platform</groupId>
<artifactId>DigitalLaboratoryPlatform</artifactId>
<version>2022.10.11-snapshots</version>
</parent>
<artifactId>dlp-repository</artifactId>
<packaging>jar</packaging>
<description>DLP 的检材仓库管理</description>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.version>5.7.1</junit.version>
</properties>
<dependencies>
<!--注册中心客户端-->
<!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-discovery -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2021.1</version>
</dependency>
<!--<dependency>
<groupId>com.deepoove.poi</groupId>
<artifactId>poi-tl</artifactId>
<version>1.12.0</version>
</dependency>-->
<!--配置中心客户端-->
<!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2021.1</version>
</dependency>
<!-- swagger -->
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-swagger</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!-- poi-tl word 模板处理器 http://deepoove.com/poi-tl -->
<dependency>
<groupId>com.deepoove</groupId>
<artifactId>poi-tl</artifactId>
<version>1.12.0</version>
</dependency>
<!-- for MockMultipartFile-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-oss</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-remote-word2pdf</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-seata</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.5.5</version>
</dependency>
<!--断路器依赖-->
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-feign</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!--security-->
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-security</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!--JDBC相关-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--core 工具类-->
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-core</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!-- 数据库 mysql依赖 -->
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<!--undertow容器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!-- log -->
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-log</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!-- 业务数据的依赖 -->
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-admin-api</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>timestamp-property</id>
<goals>
<goal>timestamp-property</goal>
</goals>
<configuration>
<name>timestamp</name>
<pattern>yyyy-MM-dd HH:mm:ss</pattern>
<locale>zh_CN</locale>
<timeZone>Asia/Shanghai</timeZone>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../out</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target</directory>
<includes>
<include>${project.artifactId}.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,41 @@
package digital.laboratory.platform.imr;
import digital.laboratory.platform.common.feign.annotation.EnableDLPFeignClients;
import digital.laboratory.platform.common.security.annotation.EnableDLPResourceServer;
import digital.laboratory.platform.common.swagger.annotation.EnableDLPSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration // ???
@EnableDLPSwagger2
@EnableDLPFeignClients
@EnableDiscoveryClient
@EnableDLPResourceServer
@SpringBootApplication(scanBasePackages="digital.laboratory.platform")
@EnableCaching
public class IdentificationMaterialRepositoryApplication {
public static void main(String[] args) {
SpringApplication.run(IdentificationMaterialRepositoryApplication.class, args);
// System.out.println("\n\n\n");
// System.out.println("-----------------------------");
// System.out.println("end of Spring Application main()");
// System.out.println("-----------------------------");
// System.out.println("\n\n\n");
}
// @Bean
// RestTemplate restTemplate() {
// return new RestTemplate();
// }
//
}

@ -0,0 +1,77 @@
package digital.laboratory.platform.imr.component;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
* @Description:
* @Author: fangzh
* @CreateDate: 2020-11-18 17:53
*/
public class DateUtils {
/**
* 获取当前的分钟
*
* @return
*/
public static String getTime() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String min = dateString.substring(14, 16);
return min;
}
public static String formatDateByPattern(Date date,String dateFormat) {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
String formatTimeStr = null;
if (date != null) {
formatTimeStr = sdf.format(date);
}
return formatTimeStr;
}
public static String parseToCron(LocalDateTime taskTime) {
//Date-->LocalDateTime
Date date = toDate(taskTime);
//规定cron表达式格式
String cronFormat = "ss mm HH dd MM ? yyyy";
return formatDateByPattern(date, cronFormat);
}
public static String getCron(Date date) {
String dateFormat = "ss mm HH dd MM ? yyyy";
return formatDateByPattern(date, dateFormat);
}
public static Date toDate(LocalDateTime localDateTime) {
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
public static String localDateTimeToStr(LocalDateTime localDateTime){
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String dateStr = localDateTime.format(fmt);
return dateStr ;
}
}

@ -0,0 +1,62 @@
package digital.laboratory.platform.imr.component;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
@Slf4j
public class GetClientIPUtil {
public static String getIpAddress(HttpServletRequest request) {
String ip = null;
// x-forwarded-for : Squid 服务代理
String ipAddresses = request.getHeader("X-Forwarded-For");
log.info("====ipAddresses: {}", ipAddresses);
// 获取所有头信息
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerKey = headerNames.nextElement();
String header = request.getHeader(headerKey);
System.out.println(headerKey + ":::" + header);
}
System.out.println("headerNames: " + JSON.toJSONString(headerNames));
String unknown = "unknown";
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
//Proxy-Client-IP:apache 服务代理
ipAddresses = request.getHeader("Proxy-Client-IP");
}
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
//WL-Proxy-Client-IP:weblogic 服务代理
ipAddresses = request.getHeader("WL-Proxy-Client-IP");
}
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
//HTTP_CLIENT_IP:有些代理服务器
ipAddresses = request.getHeader("HTTP_CLIENT_IP");
}
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
//X-Real-IP:nginx服务代理
ipAddresses = request.getHeader("X-Real-IP");
}
//有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP
if (ipAddresses != null && ipAddresses.length() != 0) {
ip = ipAddresses.split(",")[0];
}
//还是不能获取到,最后再通过request.getRemoteAddr();获取
if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
ip = request.getRemoteAddr();
}
return ip;
}
}

@ -0,0 +1,28 @@
package digital.laboratory.platform.imr.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.context.SecurityContextHolder;
//@EnableOAuth2Sso
@Configuration
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) {
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
web.ignoring().antMatchers("/", "/static/**", "/static/dist/**", "/hello**", "/favicon.ico**", "/login", "/login-callback", "/v2/**", "/papp/v2/**", "/papp/entrustment/common/**","/cabinetOpen/temperatureAndHumidity","/cabinetOpen/statisticsSampleCount/**");
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/", "/static/**", "/static/dist/**", "/hello**", "/favicon.ico**", "/login", "/login-callback", "/v2/**", "/papp/v2/**", "/papp/entrustment/common/**").permitAll()
.anyRequest().permitAll();
}
}

@ -0,0 +1,428 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.component.GetClientIPUtil;
import digital.laboratory.platform.imr.dto.DepositToDTO;
import digital.laboratory.platform.imr.dto.QueryDTO;
import digital.laboratory.platform.imr.dto.UseOutboundDTO;
import digital.laboratory.platform.imr.dto.UserInfoDTO;
import digital.laboratory.platform.imr.entity.CabinetOpeningRecord;
import digital.laboratory.platform.imr.entity.SampleStorage;
import digital.laboratory.platform.imr.mapper.DestructionDetailMapper;
import digital.laboratory.platform.imr.mapper.SampleStorageMapper;
import digital.laboratory.platform.imr.service.CabinetOpeningRecordService;
import digital.laboratory.platform.imr.vo.CabinetSampleVO;
import digital.laboratory.platform.imr.vo.StatisticsCount;
import digital.laboratory.platform.sys.feign.RemoteEnvironmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping("/cabinetOpen" )
@Api(value = "cabinetOpen", tags = "智能物证柜管理")
public class CabinetOpenController {
private static final PasswordEncoder ENCODER = new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("MD5");
public final SampleStorageMapper storageMapper;
private final DestructionDetailMapper ddMapper;
public final RemoteEnvironmentService environmentService;
public final CabinetOpeningRecordService openingRecordService;
/*
通过请求获取id判断是属于哪个房间获取温湿度
这个接口不需要验证
*/
@ApiOperation(value = "获取房间号", notes = "获取房间号")
@GetMapping("/getRoom" )
public R getRoom(HttpServletRequest request){
//根据ip判断属于那个房间
String ipAddress = GetClientIPUtil.getIpAddress(request);
String roomNo = "";
switch (ipAddress) {
case "192.168.30.243":
roomNo = "702";
break;
case "192.168.30.241":
roomNo = "709";
break;
case "192.168.10.242":
roomNo = "602";
break;
case "192.168.10.241":
roomNo = "609";
break;
case "192.168.10.243":
roomNo = "605";
break;
default:
roomNo = "709";
}
return R.ok(roomNo,"查询成功");
}
@ApiOperation(value = "通过请求获取ip判断是属于哪个房间获取温湿度", notes = "通过请求获取ip判断是属于哪个房间获取温湿度")
@GetMapping("/temperatureAndHumidity" )
public R temperatureAndHumidity(HttpServletRequest request){
//根据ip判断属于那个房间
String ipAddress = GetClientIPUtil.getIpAddress(request);
String roomNo = "";
switch (ipAddress) {
case "192.168.30.243":
roomNo = "702";
break;
case "192.168.30.241":
roomNo = "709";
break;
case "192.168.10.242":
roomNo = "602";
break;
case "192.168.10.241":
roomNo = "609";
break;
case "192.168.10.243":
roomNo = "605";
break;
default:
roomNo = "706";
}
R<Map<String, Double>> humiture = environmentService.getHumitureByRoomNo(roomNo);
return R.ok(humiture,"查询成功");
}
/*
统计仓库模块的检材/样本
*/
@ApiOperation(value = "统计仓库模块的检材/样本type=1仓库现有样本总数;2出库待归还样本;3.退还出库/销毁出库样本", notes = "统计仓库模块的检材/样本")
@GetMapping("/statisticsSampleCount/{type}" )
public R<List<StatisticsCount>> statisticsSampleCount(@PathVariable("type") Integer type,HttpServletRequest request){
//根据ip判断属于那个房间
String ipAddress = GetClientIPUtil.getIpAddress(request);
String roomNo = "";
switch (ipAddress) {
case "192.168.30.243":
roomNo = "702";
break;
case "192.168.30.241":
roomNo = "709";
break;
case "192.168.10.242":
roomNo = "602";
break;
case "192.168.10.241":
roomNo = "609";
break;
case "192.168.10.243":
roomNo = "605";
break;
default:
roomNo = "706";
}
ArrayList<StatisticsCount> list = new ArrayList<>();
if(type==1){
//仓库现有样本(要区分房间)
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status",2);
queryWrapper.eq("room_no",roomNo);
Long count = storageMapper.selectCount(queryWrapper);
list.add(new StatisticsCount("inbound",count));
} else if (type==2) {
//出库待归还样本
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status",3);
queryWrapper.eq("is_return",1);
queryWrapper.eq("room_no",roomNo);
Long count = storageMapper.selectCount(queryWrapper);
list.add(new StatisticsCount("return",count));
} else if (type==3) {
//出库样本
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status",3);
queryWrapper.eq("room_no",roomNo);
Long count = storageMapper.selectCount(queryWrapper);
list.add(new StatisticsCount("outbound",count));
}
return R.ok(list,"查询成功");
}
/*
扫码查询检材接口
*/
@ApiOperation(value = "扫码查询检材接口/支持样本编号入库/取检码出库", notes = "扫码查询检材接口")
@GetMapping("/scanCode/{number}" )
public R<List<CabinetSampleVO>> scanCode(@PathVariable("number") String number){
if(StrUtil.isEmpty(number)){
throw new RuntimeException("编号不能为空");
}
List<CabinetSampleVO> vo = openingRecordService.scanCode(number);
return R.ok(vo,"查询成功");
}
/*
批量入库时扫码查询
*/
@ApiOperation(value = "批量入库时扫码查询", notes = "批量入库时扫码查询")
@GetMapping("/batchScanCode/{number}" )
public R<List<CabinetSampleVO>> batchScanCode(@PathVariable("number") String number){
if(StrUtil.isEmpty(number)){
throw new RuntimeException("编号不能为空");
}
List<CabinetSampleVO> vo = openingRecordService.batchScanCode(number);
if(vo==null || vo.size()==0){
return R.failed("当前编号未查询到任何数据,请检查是否错误");
}else {
return R.ok(vo,"查询成功");
}
}
/*
扫码查询检材推荐位置入库(选择位置后确认入库)
*/
@ApiOperation(value = "扫码推荐位置入库/批量入库--确认按钮--", notes = "扫码推荐位置入库--确认按钮")
@PostMapping("/scanCodePromptInbound" )
public R<String> scanCodePromptInbound(@RequestBody DepositToDTO dto, HttpServletRequest theHttpServletRequest){
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
openingRecordService.scanCodePromptInbound(dto,dlpUser);
return R.ok("存储成功","存储成功");
}
/*
扫码查询检材显示存储位置出库(确认出库)
*/
@ApiOperation(value = "扫码推荐出库--这里传入单个sampleId和监督人id", notes = "扫码推荐出库")
@PostMapping("/scanCodePromptOutbound" )
public R<String> scanCodePromptOutbound(@RequestBody UseOutboundDTO dto, HttpServletRequest theHttpServletRequest){
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(StrUtil.isEmpty(dto.getSupervisorId())){
throw new RuntimeException("监督人不能为空");
}
openingRecordService.scanCodePromptOutbound(dto,dlpUser);
return R.ok("出库成功","出库成功");
}
/*
智能柜修改sample质量
*/
@ApiOperation(value = "智能柜修改sample质量", notes = "智能柜修改sample质量")
@PostMapping("/updateSampleQuality")
public R<String> updateSampleQuality(String sampleId,double sampleQuality){
if(StrUtil.isEmpty(sampleId)){
throw new RuntimeException("id不能为空");
}
//查询并修改
openingRecordService.updateSampleQuality(sampleId,sampleQuality);
return R.ok(null,"修改质量成功");
}
/*
根据取检码查询检材信息
*/
@ApiOperation(value = "根据取检码查询检材信息", notes = "根据取检码查询检材信息")
@GetMapping("/querySampleByCode" )
public R<List<CabinetSampleVO>> querySampleByCode(String code,HttpServletRequest request){
//根据ip判断属于那个房间
String ipAddress = GetClientIPUtil.getIpAddress(request);
String roomNo = "";
switch (ipAddress) {
case "192.168.30.243":
roomNo = "702";
break;
case "192.168.30.241":
roomNo = "709";
break;
case "192.168.10.242":
roomNo = "602";
break;
case "192.168.10.241":
roomNo = "609";
break;
case "192.168.10.243":
roomNo = "605";
break;
default:
roomNo = "709";
}
List<CabinetSampleVO> list = openingRecordService.querySampleByCode(code,roomNo);
return R.ok(list,"查询成功");
}
/*
领用出库
*/
@ApiOperation(value = "领用出库--这里传code和监督人id和sampleIds样本id集合", notes = "领用出库")
@PostMapping("/useOutbound")
public R<String> useOutbound(@RequestBody UseOutboundDTO dto, HttpServletRequest theHttpServletRequest){
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(StrUtil.isEmpty(dto.getSupervisorId())){
throw new RuntimeException("监督人不能为空");
}
openingRecordService.useOutbound(dto,dlpUser);
return R.ok("出库成功","出库成功");
}
/*
强制开箱forceOpen
*/
@ApiOperation(value = "强制开箱--这里传cellId和监督人id", notes = "强制开箱")
@PostMapping("/forceOpen" )
public R<String> forceOpen(@RequestBody UseOutboundDTO dto, HttpServletRequest theHttpServletRequest){
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(StrUtil.isEmpty(dto.getSupervisorId())){
throw new RuntimeException("监督人不能为空");
}
if(StrUtil.isEmpty(dto.getPassword())){
throw new RuntimeException("请填写密码");
}
String s = dlpUser.getPassword();
String password = s.replace("{MD5}", "");
Assert.isTrue(ENCODER.matches(dto.getPassword(), password), "密码错误, 请重试");
openingRecordService.forceOpen(dto,dlpUser);
return R.ok("出库成功","出库成功");
}
/*
查询人接口
*/
@ApiOperation(value = "查询人接口", notes = "查询人接口")
@GetMapping("/getUserInfo" )
public R getApprove(String name, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//查询全部接收人
List<UserInfoDTO> user = ddMapper.getApprove(name,dlpUser.getId());
return R.ok(user,"查询成功");
}
/*
分页查询开箱记录
*/
@ApiOperation(value = "分页查询开箱记录", notes = "分页查询开箱记录")
@GetMapping("/page/openRecord" )
public R<IPage<CabinetOpeningRecord>> openRecord(QueryDTO dto, HttpServletRequest theHttpServletRequest){
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
String ipAddress = GetClientIPUtil.getIpAddress(theHttpServletRequest);
String roomNo = "";
switch (ipAddress) {
case "192.168.30.243":
roomNo = "702";
break;
case "192.168.30.241":
roomNo = "709";
break;
case "192.168.10.242":
roomNo = "602";
break;
case "192.168.10.241":
roomNo = "609";
break;
case "192.168.10.243":
roomNo = "605";
break;
default:
roomNo = "706";
}
Page<CabinetOpeningRecord> recordPage = new Page<>(dto.getCurrent(), dto.getSize());
QueryWrapper<CabinetOpeningRecord> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StrUtil.isNotEmpty(dto.getName()),"open_person",dto.getName());
queryWrapper.eq("warehouse",roomNo);
queryWrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"open_time",dto.getBeginDate(),dto.getFinishDate());
queryWrapper.orderByDesc("open_time");
IPage<CabinetOpeningRecord> thisPage = openingRecordService.page(recordPage,queryWrapper);
return R.ok(thisPage,"查询成功");
}
}

@ -0,0 +1,295 @@
package digital.laboratory.platform.imr.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.DestructionPublicityDTO;
import digital.laboratory.platform.imr.dto.PublicityDTO;
import digital.laboratory.platform.imr.dto.QueryDTO;
import digital.laboratory.platform.imr.dto.UserInfoDTO;
import digital.laboratory.platform.imr.entity.DestructionPublicity;
import digital.laboratory.platform.imr.entity.SampleStorage;
import digital.laboratory.platform.imr.mapper.DestructionDetailMapper;
import digital.laboratory.platform.imr.mapper.DestructionPublicityMapper;
import digital.laboratory.platform.imr.mapper.SampleStorageMapper;
import digital.laboratory.platform.imr.service.DestructionPublicityService;
import digital.laboratory.platform.imr.vo.DestructionPublicityVO;
import digital.laboratory.platform.imr.vo.OutSampleVO;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;
import java.util.Arrays;
import java.util.List;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-23
* @describe 前端控制器
*
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/destruction_publicity" )
@Api(value = "destruction_publicity", tags = "检材销毁与公示管理")
public class DestructionPublicityController {
private final DestructionPublicityService dpService;
private final DestructionDetailMapper ddMapper;
private final DestructionPublicityMapper dpMapper;
private final SampleStorageMapper storageMapper;
/**
* 通过id查询
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询公示详情", notes = "通过id查询公示详情")
@GetMapping("/getOneById/{id}" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" )
public R<DestructionPublicity> getOneById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
if(id==null||"".equals((id))){
throw new RuntimeException(String.format("申请id不能为空" ));
}
DestructionPublicity vo = dpService.getOneById(id);
return R.ok(vo);
}
/**
* 分页查询
* @param dto 分页对象
* @param dto
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" )
public R<IPage<DestructionPublicityVO>> getDestructionPublicityPage(PublicityDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Page<DestructionPublicity> page = new Page<>(dto.getCurrent(),dto.getSize());
IPage<DestructionPublicityVO> vo = dpService.getDestructionPublicityPage(page,Wrappers.<DestructionPublicity>query()
.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"release_date",dto.getBeginDate(),dto.getFinishDate())
.eq("status",dto.getStatus())
);
return R.ok(vo,"查询成功");
}
/**
* 列表查询
*/
/**
* 新增
* @param dto
* @return R
*/
@ApiOperation(value = "创建检材销毁与公示", notes = "新增")
@SysLog("新增" )
@PostMapping("/createPublicity")
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_add')" )
public R createPublicity(@RequestBody DestructionPublicityDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (dto.getDestroyDate()==null||
dto.getReviewerId()==null||
dto.getDestroyCompany()==null||
dto.getSampleIds().isEmpty()
){
throw new RuntimeException(String.format("公示数据不能为空"));
}
DestructionPublicityVO vo = null;
if(dto.getId()==null){
vo = dpService.createPublicity(dto,dlpUser);
}else {
vo = dpService.updatePublicity(dto,dlpUser);
}
if (vo!=null){
return R.ok(vo,"公示创建成功");
}else{
return R.failed("公示创建失败");
}
}
/**
* 修改
* @param dto
* @return R
*/
@ApiOperation(value = "修改", notes = "修改")
@SysLog("修改" )
@PutMapping("/updatePublicity")
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_edit')" )
public R<DestructionPublicity> updatePublicity(@RequestBody DestructionPublicityDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (dto.getDestroyDate()==null||
dto.getReviewerId()==null||
dto.getDestroyCompany()==null||
dto.getSampleIds().isEmpty()||
dto.getId()==null
){
throw new RuntimeException(String.format("创建销毁与申请的数据不能为空"));
}
DestructionPublicityVO vo = dpService.updatePublicity(dto,dlpUser);
if (vo!=null){
return R.ok(vo,"操作成功");
}else{
return R.failed("操作失败");
}
}
/**
* 单个通过id删除
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除", notes = "通过id删除")
@SysLog("通过id删除" )
@DeleteMapping("/delete/{id}" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_del')" )
public R deleteOneById(@PathVariable("id") String id) {
dpService.deleteOneById(id);
return R.ok(null,"删除成功");
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@SysLog("通过id删除" )
@DeleteMapping("/deleteList" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_del')" )
public R deleteOneById(@RequestBody List<String> ids) {
for (String id : ids) {
dpService.deleteOneById(id);
}
return R.ok(null,"删除成功");
}
@ApiOperation(value = "查询审核人接口", notes = "查询审核人接口")
@GetMapping("/getApprove" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" )
public R getApprove(String name, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//查询全部接收人
List<UserInfoDTO> user = ddMapper.getApprove(name,dlpUser.getId());
return R.ok(user,"查询成功");
}
/**
* 发布/提交
*/
@ApiOperation(value = "发布/提交", notes = "发布/提交")
@PutMapping("/release" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_edit')" )
public R release(String id, HttpServletRequest theHttpServletRequest) {
if(id == null){
throw new RuntimeException(String.format("id不能为空"));
}
DestructionPublicity vo = dpService.release(id);
return R.ok(vo,"发布成功");
}
/*
查询可公示的样本(审核审批成功后的)
*/
@ApiOperation(value = "查询可公示的样本(审核审批成功后的)", notes = "查询可公示的样本(审核审批成功后的)")
@GetMapping("/getSampleInfo" )
@PreAuthorize("@pms.hasPermission('imr_destruction_publicity_get')" )
public R getSampleInfo(QueryDTO dto) {
List<String> sampleIds = Arrays.asList(dto.getSampleIds().split(","));
int size = sampleIds.size();
if ("".equals(dto.getSampleIds())){
size = sampleIds.size()-1;
}
if(dto.getTotal()!=0){
int num = 0;//去重后目前能分的页数
if((dto.getTotal()-size)%8==0){
num = (dto.getTotal()-size)/8;
}else {
num = (dto.getTotal()-size)/8+1;
}
System.out.println(num);
if(dto.getCurrent()>num){
//求余数
int a = dto.getTotal()%8;//求最后一页的剩余条数
if(a==0){
a=8;
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}else {
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}
}
}
Page<SampleStorage> page = new Page<>(dto.getCurrent(),dto.getSize());
IPage<OutSampleVO> sampleVOIPage = storageMapper.getSampleInfo(page,Wrappers.<SampleStorage>query()
.notIn(!sampleIds.isEmpty(),"storage.sample_id",sampleIds)//去重数组sampleIds
.like(!dto.getName().isEmpty(),"storage.name",dto.getName())
.eq("storage.early_warning",2) //只能查找通过审核审批的样本
.eq("s.status",7)//状态等于待销毁
);
List<OutSampleVO> records = sampleVOIPage.getRecords();
for (OutSampleVO vo : records) {
vo.setSampleId(vo.getId());
}
return R.ok(sampleVOIPage,"查询成功");
}
}

@ -0,0 +1,15 @@
package digital.laboratory.platform.imr.controller;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@RequestMapping("/drugDepots" )
@Api(value = "DrugDepotsController", tags = "毒品库信息管理接口")
public class DrugDepotsController {
}

@ -0,0 +1,212 @@
package digital.laboratory.platform.imr.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.QueryApplyDTO;
import digital.laboratory.platform.imr.dto.ReviewApprovalDTO;
import digital.laboratory.platform.imr.dto.ReviewSampleDetail;
import digital.laboratory.platform.imr.dto.SampleApplyQueryDTO;
import digital.laboratory.platform.imr.entity.SampleApply;
import digital.laboratory.platform.imr.entity.enums.ApplyStatus;
import digital.laboratory.platform.imr.mapper.SampleApplyDetailedMapper;
import digital.laboratory.platform.imr.mapper.SampleApplyMapper;
import digital.laboratory.platform.imr.service.ReviewApprovalService;
import digital.laboratory.platform.imr.service.SampleApplyService;
import digital.laboratory.platform.imr.vo.ApplySampleVO;
import digital.laboratory.platform.imr.vo.SampleApplyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* 自定义审核/审批控制层
* 这个controller应用与检材申请的审核审批
* 外带+销毁
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/review_approval" )
@Api(value = "review_approval", tags = "样本申请审核审批")
public class ReviewApprovalController {
private final ReviewApprovalService reviewApprovalService;
private final SampleApplyService sampleApplyService;
/*
---------------审核模块分页(加权限)------------------
*/
/**
*
*/
/* @ApiOperation(value = "一级审核员分页查询", notes = "一级审核员分页查询")
@GetMapping("firstAudit/page" )
@PreAuthorize("@pms.hasPermission('imr_sample_apply_get_firstAudit')" )
public R<IPage<SampleApplyVO>> getPage( @RequestBody SampleApplyQueryDTO dto) {
return null;
}*/
@ApiOperation(value = "查询申请详情", notes = "查询申请详情")
@SysLog("查询申请详情" )
@GetMapping("/getDetail")
@PreAuthorize("@pms.hasPermission('imr_review_and_approval')" )
public R<SampleApplyVO> getDetail(String id) {
if(id==null){
throw new RuntimeException(String.format("申请id不能为空" ));
}
SampleApplyVO sampleApply = sampleApplyService.getDetail(id);
return R.ok(sampleApply);
}
@ApiOperation(value = "审核分页查询", notes = "审核分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('imr_review_and_approval')" )
public R<IPage<SampleApplyVO>> getAuditPage(QueryApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Page<SampleApply> page = new Page<>(dto.getCurrent(),dto.getSize());
QueryWrapper<SampleApply> queryWrapper = new QueryWrapper<>();
ArrayList<Integer> list = new ArrayList<>();
Set<String> permissions = dlpUser.getPermissions();//判断权限
//System.out.println(permissions);
for (String permission : permissions) {
if ("imr_sample_apply_first_audit".equals(permission)) {
//
queryWrapper.eq("apply_type",1);
if(dto.getStatus()==null){//审核初页面(不应该有销毁申请)
queryWrapper.eq("application_status",1);
}else {//点击通过页面时
if(dto.getStatus()==0){
//返回全部
queryWrapper.and(Wrapper->Wrapper.le("application_status",-2)
.or().ge("application_status",2)
);
}else {
//通过status==1/不通过status==-1
if(dto.getStatus()==1){
queryWrapper.ge("application_status",2);
}
if(dto.getStatus()==-1){
queryWrapper.le("application_status",-2);
}
}
}
break;
} else if ("imr_sample_apply_secondary_audit".equals(permission)) {
//二级审核员(不应该有销毁申请)
queryWrapper.eq("apply_type",1);
if(dto.getStatus()==null){
queryWrapper.eq("application_status",2);
}else {
if(dto.getStatus()==0){
//返回全部
queryWrapper.and(Wrapper->Wrapper.le("application_status",-3)
.or().ge("application_status",3)
);
/*queryWrapper.le("application_status",-3).or()
.ge("application_status",3);//大于=3的后面所有*/
}else {
//通过status==1/不通过status==-1
if(dto.getStatus()==1){
queryWrapper.ge("application_status",3);
}
if(dto.getStatus()==-1){
queryWrapper.le("application_status",-3);
}
}
}
break;
}else if ("imr_sample_apply_approval".equals(permission)) {
//审批人
if(dto.getStatus()==null){
queryWrapper.eq("application_status",3);
}else {
if(dto.getStatus()==0){
list.add(-4);//二级不通过
list.add(4);//通过/不通过
queryWrapper.in("application_status",list);
}else {
//通过status==1/不通过status==-1
if(dto.getStatus()==1){
queryWrapper.eq("application_status",4);
}
if(dto.getStatus()==-1){
queryWrapper.eq("application_status",-4);
}
}
}
break;
}
}
//判断权限查询条件设置完毕
queryWrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate());
queryWrapper.orderByDesc("application_date");
IPage<SampleApplyVO> applyVOPage = sampleApplyService.getApplyPage(page, queryWrapper);
return R.ok(applyVOPage,"查询成功");
}
/**
* 审核审批
* @param dto
* @param theHttpServletRequest
* @return
*/
@ApiOperation(value = "检材申请审核审批", notes = "检材申请审核审批")
@PutMapping("/sampleApply/approval" )
@PreAuthorize("@pms.hasPermission('imr_review_and_approval')" )
public R applyApproval(@RequestBody ReviewApprovalDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Set<String> permissions = dlpUser.getPermissions();//判断权限
SampleApplyVO sampleApplyVO = null;
for (String permission : permissions) {
if ("imr_sample_apply_first_audit".equals(permission)) {
//一级审核员
sampleApplyVO = reviewApprovalService.firstAudit(dto, dlpUser);
break;
} else if ("imr_sample_apply_secondary_audit".equals(permission)) {
//二级审核员
reviewApprovalService.secondaryAudit(dto, dlpUser);
break;
}else if ("imr_sample_apply_approval".equals(permission)) {
//审批人
reviewApprovalService.approval(dto,dlpUser);
break;
}
}
return R.ok(sampleApplyVO,"审核成功");
}
}

@ -0,0 +1,680 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.io.IoUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.imr.dto.ApplyDTO;
import digital.laboratory.platform.imr.dto.QueryApplyDTO;
import digital.laboratory.platform.imr.dto.QueryDTO;
import digital.laboratory.platform.imr.entity.SampleApply;
import digital.laboratory.platform.imr.entity.SampleStorage;
import digital.laboratory.platform.imr.mapper.SampleApplyDetailedMapper;
import digital.laboratory.platform.imr.mapper.SampleStorageMapper;
import digital.laboratory.platform.imr.service.SampleApplyService;
import digital.laboratory.platform.imr.vo.ApplySampleVO;
import digital.laboratory.platform.imr.vo.BaseSampleVO;
import digital.laboratory.platform.imr.vo.SampleApplyVO;
import feign.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.security.Principal;
import java.util.*;
/**
* 检材申请实体类
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 检材申请实体类 前端控制器
*
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sample_apply" )
@Api(value = "sample_apply", tags = "检材申请管理--外带+销毁")
public class SampleApplyController {
private final SampleApplyService sampleApplyService;
private final OssFile ossFile;
private final RemoteWord2PDFService remoteWord2PDFService;
private final SampleStorageMapper storageMapper;
/**
* 提供id查询申请详情
*/
@ApiOperation(value = "查询申请详情", notes = "查询申请详情")
@SysLog("查询申请详情" )
@GetMapping("/getDetail")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_get')" )
public R<SampleApplyVO> getDetail(String id) {
if(id==null){
throw new RuntimeException("申请id不能为空");
}
SampleApplyVO sampleApply = sampleApplyService.getDetail(id);
return R.ok(sampleApply);
}
@ApiOperation(value = "申请人查询销毁申请--分页", notes = "申请人查询申请--分页")
@SysLog("申请人查询申请--分页" )
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('imr_sample_des_apply')" )
public R<IPage<SampleApplyVO>> getApplyPage(QueryApplyDTO dto,HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Page<SampleApply> page = new Page<>(dto.getCurrent(),dto.getSize());
if(dto.getApplyType()==null){
throw new RuntimeException(String.format("需要传递申请类型参数" ));
}
QueryWrapper<SampleApply> wrapper = new QueryWrapper<>();
wrapper.eq("apply_type",dto.getApplyType());
if(!dlpUser.getPermissions().contains("imr_inbound_or_outbound")){
//如果不是检材管理员只能看见自己的
wrapper.eq("applicant_id",dlpUser.getId());
}
wrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate());
if(dto.getStatus()!=null){
wrapper.eq("application_status",dto.getStatus());
}else {
wrapper.ne("application_status",4);
}
wrapper.orderByDesc("application_date");//申请时间排序
IPage<SampleApplyVO> vo = sampleApplyService.getApplyPage(page,wrapper);
return R.ok(vo,"查询成功");
}
@ApiOperation(value = "申请人查询外带申请--分页", notes = "申请人查询申请--分页")
@SysLog("申请人查询申请--分页" )
@GetMapping("/list")
@PreAuthorize("@pms.hasPermission('imr_sample_out_apply')" )
public R<IPage<SampleApplyVO>> getApplyList(QueryApplyDTO dto,HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Page<SampleApply> page = new Page<>(dto.getCurrent(),dto.getSize());
if(dto.getApplyType()==null){
throw new RuntimeException("需要传递申请类型参数");
}
QueryWrapper<SampleApply> wrapper = new QueryWrapper<>();
wrapper.eq("apply_type",dto.getApplyType());
wrapper.eq("applicant_id",dlpUser.getId());
wrapper.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate());
if(dto.getStatus()!=null){
wrapper.eq("application_status",dto.getStatus());
}else {
wrapper.ne("application_status",4);
}
wrapper.orderByDesc("application_date");//申请时间排序
IPage<SampleApplyVO> vo = sampleApplyService.getApplyPage(page,wrapper);
return R.ok(vo,"查询成功");
}
/**
* 创建并保存检材申请
* @param dto
* @return R
*/
@ApiOperation(value = "创建并保存检材申请", notes = "创建并保存检材申请")
@SysLog("创建并保存检材申请" )
@PostMapping("/createAndSave")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_add')" )
public R<SampleApplyVO> createAndSave(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(dto.getApplyType()==null){
throw new RuntimeException("必须提供一个申请类型/外带/销毁");
}
if(dto.getSampleId()==null ||dto.getSampleId().size()==0){
throw new RuntimeException("样本信息不能为空");
}
SampleApplyVO applyVO = null;
if(dto.getId()==null||"".equals(dto.getId())) {
applyVO = sampleApplyService.createAndSave(dto, dlpUser);
}else {
applyVO = sampleApplyService.updateAndSave(dto, dlpUser);
}
return R.ok(applyVO,"保存成功");
}
/**
* 根据当前持有人去查询数据
* 问题:1.创建完流转后当前持有人数据显示问题
*
* 设定查询有两个条件需要满
* 1.当前持有人id
* 2.当前的样本状态!=4;(不等于流转中)---这个是目前的想法
*/
@ApiOperation(value = "创建外带申请--根据当前持有人去查询数据", notes = "根据当前持有人去查询数据")
@GetMapping("/getSampleInfoByHolder" )
@PreAuthorize("@pms.hasPermission('imr_sample_apply_get')" )
public R<IPage<BaseSampleVO>> getSampleInfoByHolder(QueryDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
List<String> sampleIds = Arrays.asList(dto.getSampleIds().split(","));
int size = sampleIds.size();
if ("".equals(dto.getSampleIds())){
size = sampleIds.size()-1;
}
if(dto.getTotal()!=0){
int num = 0;//去重后目前能分的页数
if((dto.getTotal()-size)%8==0){
num = (dto.getTotal()-size)/8;
}else {
num = (dto.getTotal()-size)/8+1;
}
System.out.println(num);
if(dto.getCurrent()>num){
//求余数
int a = dto.getTotal()%8;//求最后一页的剩余条数
if(a==0){
a=8;
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}else {
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}
}
}
Page<SampleStorage> samplePage = new Page<>(dto.getCurrent(),dto.getSize());
IPage<BaseSampleVO> sampleVOS = storageMapper.getSampleInfoByHolder(samplePage,Wrappers.<SampleStorage>query()
.notIn(!sampleIds.isEmpty(),"s.id",sampleIds)//去重数组id
.like(!dto.getName().isEmpty(),"s.name",dto.getName())
.eq("s.holder",dlpUser.getId())
.eq("s.status",1)//状态为出库
.ne("s.status",12)//当前状态不等于申请中
);
return R.ok(sampleVOS,"查询成功");
}
/**
* 根据当前持有人去查询数据
* 问题:1.创建完流转后当前持有人数据显示问题
*
* 设定查询有两个条件需要满足
* 1.当前持有人id
* 2.当前的样本状态!=4;(不等于流转中)---这个是目前的想法
*/
@ApiOperation(value = "当前仓库库存样本--创建销毁申请", notes = "当前仓库库存样本--创建销毁申请")
@GetMapping("/getSampleInfoByRepository" )
@PreAuthorize("@pms.hasPermission('imr_sample_apply_get')" )
public R<IPage<BaseSampleVO>> getSampleInfoByRepository(QueryDTO dto) {
List<String> sampleIds = Arrays.asList(dto.getSampleIds().split(","));
int size = sampleIds.size();
if ("".equals(dto.getSampleIds())){
size = sampleIds.size()-1;
}
if(dto.getTotal()!=0){
int num = 0;//去重后目前能分的页数
if((dto.getTotal()-size)%8==0){
num = (dto.getTotal()-size)/8;
}else {
num = (dto.getTotal()-size)/8+1;
}
System.out.println(num);
if(dto.getCurrent()>num){
//求余数
int a = dto.getTotal()%8;//求最后一页的剩余条数
if(a==0){
a=8;
}
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}
}
Page<SampleStorage> samplePage = new Page<>(dto.getCurrent(),dto.getSize());
IPage<BaseSampleVO> sampleVOS = storageMapper.getDestructionSample(samplePage,Wrappers.<SampleStorage>query()
.notIn(!sampleIds.isEmpty(),"storage.sample_id",sampleIds)//去重数组id
.like(!dto.getName().isEmpty(),"storage.name",dto.getName())
.eq("storage.status",2)//在仓库的
.eq("storage.early_warning",1)//在仓库已经到销毁时间了的
.ne("s.status",12 )//当前状态不等于申请中
.ne("s.status",8)//该样本没有被销毁
);
return R.ok(sampleVOS,"查询成功");
}
/**
* 创建并提交检材申请(创建直接点提交)
* @param dto
* @return R
*/
@ApiOperation(value = "创建并提交检材申请", notes = "创建并提交检材申请")
@SysLog("创建并提交检材申请" )
@PostMapping("/createAndSubmit")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_add')" )
public R<SampleApplyVO> createAndSubmit(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (dto.getApplyType() == null) {
throw new RuntimeException(String.format("必须提供一个申请类型/外带/销毁"));
}
if (dto.getSampleId().isEmpty()) {
throw new RuntimeException(String.format("样本信息不能为空"));
}
if (dto.getSampleId().size() == 0) {
throw new RuntimeException(String.format("样本信息不能为空"));
}
SampleApplyVO applyVO = null;
if(dto.getId()==null||"".equals(dto.getId())) {
applyVO = sampleApplyService.createAndSubmit(dto, dlpUser);
}else {
applyVO = sampleApplyService.updateAndSubmit(dto, dlpUser);
}
return R.ok(applyVO, "创建成功");
}
/**
*单个提交申请
*/
@ApiOperation(value = "单个提交申请", notes = "单个提交申请")
@SysLog("单个提交申请" )
@PutMapping("/submitApplyOne")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" )
public R<SampleApplyVO> submitApplyOne(String id){
if(id==null){
throw new RuntimeException(String.format("id不能为空"));
}
SampleApplyVO vo = sampleApplyService.submitApplyOne(id);
return R.ok(vo, "提交成功");
}
/**
* 批量提交申请
*/
@ApiOperation(value = "批量提交申请", notes = "批量提交申请")
@SysLog("批量提交申请" )
@PutMapping("/submitApplyList")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" )
public R submitApplyList(@RequestBody List<String> ids){
if (ids.isEmpty()){
throw new RuntimeException(String.format("请选择提交的申请" ));
}
for (String id : ids) {
sampleApplyService.submitApplyOne(id);
}
return R.ok(null,"提交成功");
}
/**
* 单个撤回withdrawal
*/
@ApiOperation(value = "单个撤回", notes = "单个撤回")
@SysLog("单个撤回" )
@PutMapping("/withdrawalOne/{id}")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" )
public R withdrawalOne(@PathVariable("id") String id){
if(id==null){
throw new RuntimeException(String.format("id不能为空"));
}
SampleApplyVO vo = sampleApplyService.withdrawalOne(id);
return R.ok(vo, "撤回成功");
}
/**
* 批量撤回
*/
@ApiOperation(value = "批量撤回", notes = "批量撤回")
@SysLog("批量撤回" )
@PutMapping("/withdrawalList")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" )
public R withdrawalList(@RequestBody List<String> ids){
if (ids.isEmpty()){
throw new RuntimeException(String.format("请选择撤回的申请" ));
}
for (String id:ids) {
sampleApplyService.withdrawalOne(id);
}
return R.ok(null,"撤回成功");
}
/**
* 单个删除
* @param id id
* @return R
*/
@ApiOperation(value = "单个删除", notes = "单个删除")
@SysLog("通过id删除检材申请实体类" )
@DeleteMapping("/deleteApplyOne/{id}" )
@PreAuthorize("@pms.hasPermission('imr_sample_apply_del')" )
public R deleteApplyOne(@PathVariable("id") String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (id.isEmpty()){
throw new RuntimeException(String.format("删除数据id不存在"));
}
sampleApplyService.deleteOne(id);
return R.ok(null, "删除成功");
}
/**
* 批量删除
* @param ids
* @return R
*/
@ApiOperation(value = "批量删除", notes = "批量删除")
@SysLog("批量删除" )
@DeleteMapping("/deleteApplyList" )
@PreAuthorize("@pms.hasPermission('imr_sample_apply_del')" )
public R deleteApplyList(@RequestBody List<String> ids, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(ids.isEmpty()){
throw new RuntimeException(String.format("删除数据id不能为空"));
}
for (String id:ids) {
sampleApplyService.deleteOne(id);
}
return R.ok(null, "对象删除成功");
}
/**
* 修改并提交检材申请实体类(修改的设定为直接提交)修改应该叫修改并提交
* 1.待提交
* 2.审核审批不通过状态?
* 2的情况比较特殊,这种已经审批过的修改应该是重新创建一条数据?
* @param dto 检材申请实体类
* @return R
*/
@ApiOperation(value = "修改并提交申请", notes = "修改并提交申请")
@SysLog("修改检材申请实体类" )
@PutMapping("/updateAndSubmit")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" )
public R<SampleApplyVO> updateAndSubmit(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (dto.getId()==null){
throw new RuntimeException(String.format("申请id不能为空"));
}
if(dto.getSampleId().isEmpty()){
throw new RuntimeException(String.format("选择样本不能为空"));
}
SampleApplyVO vo = sampleApplyService.updateAndSubmit(dto,dlpUser);
return R.ok(vo,"修改成功");
}
@ApiOperation(value = "修改并保存", notes = "修改并保存")
@SysLog("修改并保存" )
@PutMapping("/updateAndSave")
@PreAuthorize("@pms.hasPermission('imr_sample_apply_edit')" )
public R<SampleApplyVO> updateAndSave(@RequestBody ApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (dto.getId()==null){
throw new RuntimeException(String.format("申请id不能为空"));
}
if(dto.getSampleId().isEmpty()){
throw new RuntimeException(String.format("选择样本不能为空"));
}
SampleApplyVO vo = sampleApplyService.updateAndSave(dto,dlpUser);
return R.ok(vo,"修改成功");
}
/**
* 下载鉴定委托书
*
* @param id
*
* @return
*/
@ApiOperation(value = "下载申请表格", notes = "下载申请表格。如果还没有创建, 立即创建: 根据鉴定申请信息内容的内容创建PDF格式的鉴定委托书, 并保存到 MinIO 存储中")
@SysLog("创建鉴定委托书")
@GetMapping("/print/apply")
// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')")
public void bizGetPDFSampleApplyTable(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
System.out.println("bizApplyWord.................");
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//查询数据
SampleApplyVO detail = sampleApplyService.getDetail(id);
if (detail == null) {
throw new RuntimeException(String.format("没有找到该申请"));
}
if (detail.getApplicationStatus().getStatus()!=4) {
throw new RuntimeException("申请状态必须在[审批通过]之后才能打印申请表格");
}
/*if (!dlpUser.isStaff()) {
if (!StrUtil.equalsIgnoreCase(ev.getClientOrgId(), dlpUser.getOrgId())) {
throw new RuntimeException("您只能打印自己所在机构的委托");
}
}*/
String applyFileName = "";
if(detail.getApplyType()==1){//外带申请
applyFileName = "携带毒品外出申请表-"+detail.getId();
//String entrustmentLetterFileName = "鉴定委托书-" + ev.getEntrustmentNo();
}else {
applyFileName = "待销毁检材样本报批表-"+detail.getId();
}
String pdfFilePath = "document" + "/"+"application" + "/" + detail.getId() + "/" + applyFileName + ".pdf";
try {
if (!ossFile.objectExist(pdfFilePath)) {
GenerateSampleApplyTablePDF(detail,theHttpServletRequest,httpServletResponse);
}
ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(applyFileName);
} catch (Exception e) {
System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage()));
e.printStackTrace();
}
}
private void GenerateSampleApplyTablePDF(SampleApplyVO applyVO , HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
System.out.println("GenerateSampleApplyTablePDF.................");
//try {
//---------------
// 构造对象 Map
//Map<String, Object> dm = BeanMap.create(ev); //ClassUtils.objectToMap(ev);
//Map<String, Object> dm = ClassUtils.objectToMap(applyVO);
Map<String, Object> dm = new HashMap<>();
//dm.put("size", 1);//号
dm.put("applicantName", applyVO.getApplicantName());//申请人
dm.put("reason", applyVO.getReason());//原因
dm.put("id", LocalDateTimeUtil.format(applyVO.getApplicationDate(), "yyyy"));//设置为年份
dm.put("applicationDate", LocalDateTimeUtil.format(applyVO.getApplicationDate(), "yyyy年MM月dd日"));//申请时间
if(applyVO.getApplyType()==1){
dm.put("firstAuditorName",applyVO.getFirstAuditorName());//一级审核人
dm.put("firstAuditDate",LocalDateTimeUtil.format(applyVO.getFirstAuditDate(), "yyyy年MM月dd日"));//一级时间
dm.put("firstAuditOpinion",applyVO.getFirstAuditOpinion());//一级意见
dm.put("secondaryAuditName",applyVO.getSecondaryAuditName());//二级人
dm.put("secondaryAuditDate",LocalDateTimeUtil.format(applyVO.getSecondaryAuditDate(), "yyyy年MM月dd日"));//二级时间
dm.put("secondaryAuditOpinion",applyVO.getSecondaryAuditOpinion());//二级意见
}
dm.put("approverName",applyVO.getApproverName());//审批人
dm.put("approvalDate",LocalDateTimeUtil.format(applyVO.getApprovalDate(), "yyyy年MM月dd日"));//审批时间
dm.put("approverOpinion",applyVO.getApproverOpinion());//审批意见
dm.put("applyQuantity",applyVO.getApplyQuantity());//数量
String str = "";
List<String> sampleNos = new ArrayList<>();
for (ApplySampleVO sampleVO : applyVO.getSampleVO()) {
if(sampleVO.getStatus()==1){
str=str+sampleVO.getSampleNo()+"\n";
}
}
dm.put("sampleNo",str);
//-----------------------------
// 生成 word 版本的 鉴定委托书
String applyFileName = "";
if (applyVO.getApplyType() == 1) {//外带申请
applyFileName = "携带毒品外出申请表-" + applyVO.getId();
} else {
applyFileName = "待销毁检材样本报批表-" + applyVO.getId();
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
if (applyVO.getApplyType() == 1) {//外带申请
ossFile.fileGet("template" + "/" + "携带毒品外出申请表模板.docx", bos);
} else {
ossFile.fileGet("template" + "/" + "待销毁检材报批申请表模板.docx", bos);
}
byte[] templateArray = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(templateArray);
bos.close();
// 现在 bis 是模板的 InputStream
ConfigureBuilder builder = Configure.builder().buildGramer("${", "}").useSpringEL(false);
XWPFTemplate template = XWPFTemplate.compile(bis, builder.build()).render(dm);
bis.close();
ByteArrayOutputStream fosWord = new ByteArrayOutputStream();
template.write(fosWord);
template.close();
//------------
ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray());
fosWord.close();
//MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord);
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord);
Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
fisWord.close();
ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE);
ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
outPDF.close();
ossFile.fileSave("document" + "/" + "application" + "/" + applyVO.getId() + "/" + applyFileName + ".pdf", isPDF);
isPDF.close();
System.out.println("转换为 PDF 结束");
}
}

@ -0,0 +1,472 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.CombinationOut;
import digital.laboratory.platform.imr.dto.OutWarehouseApplyDTO;
import digital.laboratory.platform.imr.dto.QueryDTO;
import digital.laboratory.platform.imr.entity.SampleOutWarehouseApply;
import digital.laboratory.platform.imr.entity.SampleStorage;
import digital.laboratory.platform.imr.mapper.SampleStorageMapper;
import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService;
import digital.laboratory.platform.imr.vo.OutSampleVO;
import digital.laboratory.platform.imr.vo.RepositorySampleVO;
import digital.laboratory.platform.imr.vo.SampleOutWarehouseApplyVO;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 样本出库申请实体类
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 样本出库申请实体类 前端控制器
* <p>
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sample_out_warehouse_apply")
@Api(value = "sample_out_warehouse_apply", tags = "领用出库申请管理")
public class SampleOutWarehouseApplyController {
private final SampleOutWarehouseApplyService sampleOutWarehouseApplyService;
private final SampleStorageMapper storageMapper;
/**
* 通过id查询样本出库申请实体类
*
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_get')")
public R<SampleOutWarehouseApplyVO> getById(@PathVariable("id") String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
SampleOutWarehouseApplyVO outWarehouseApplyVO = sampleOutWarehouseApplyService.getOutWarehouseDetailedById(id);
if (outWarehouseApplyVO != null) {
return R.ok(outWarehouseApplyVO, "查询成功");
} else {
return R.failed("查询失败");
}
}
/**
* 分页查询
*
* @param dto 查询参数
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_get')")
public R<IPage<SampleOutWarehouseApplyVO>> getSampleOutWarehouseApplyPage(QueryDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
QueryWrapper<SampleOutWarehouseApply> query = Wrappers.<SampleOutWarehouseApply>query();
query.eq("applicant_id", dlpUser.getId());
query.between(dto.getBeginDate() != null && dto.getFinishDate() != null, "application_date", dto.getBeginDate(), dto.getFinishDate());
query.orderByDesc("create_time");
if (dto.getStatus() == 0) {//返回待审核和待使用的数据
ArrayList<Integer> integers = new ArrayList<>();
integers.add(1);
integers.add(2);
query.in("status", integers);
} else if (dto.getStatus() == 1) {
query.eq("status", 1);
} else if (dto.getStatus() == 2) {
query.eq("status", 2);
} else if (dto.getStatus() == 3) {
query.eq("status", 3);
}
if (dto.getStatus() == 4) {//全部数据--出库模块备用
ArrayList<Integer> integers = new ArrayList<>();
integers.add(1);
integers.add(2);
integers.add(3);
query.in("status", integers);
}
Page<SampleOutWarehouseApply> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<SampleOutWarehouseApplyVO> thisPage = sampleOutWarehouseApplyService.getSampleOutWarehouseApplyVOPage(page, query);
return R.ok(thisPage, "查询出库申请成功");
}
@ApiOperation(value = "列表查询", notes = "列表查询")
@GetMapping("/list")
@PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_list')")
public R<IPage<SampleOutWarehouseApply>> getSampleOutWarehouseApplyList(Page<SampleOutWarehouseApply> page, SampleOutWarehouseApply sampleOutWarehouseApply, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
IPage<SampleOutWarehouseApply> thisList = sampleOutWarehouseApplyService.getSampleOutWarehouseApplyVOList(Wrappers.<SampleOutWarehouseApply>query()
.eq("applicant_id", dlpUser.getId())
.eq(sampleOutWarehouseApply.getStatus() != null, "status", sampleOutWarehouseApply.getStatus())
.orderByDesc("create_time")
);
return R.ok(thisList, "查询出库申请成功");
}
/**
* 查询当前已经存入仓库的样本信息(全部查询)
*/
@ApiOperation(value = "创建领用申请时的查询样本接口--分页", notes = "创建领用申请时的查询样本接口--分页")
@GetMapping("/getSampleInfo")
@PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_list')")
public R getSampleInfo(QueryDTO dto) {
List<String> sampleIds = Arrays.asList(dto.getSampleIds().split(","));
if (dto.getType() == 1) {//任务
IPage<OutSampleVO> sampleVOIPage2 = new Page<>();
List<OutSampleVO> records1 = new ArrayList<>();
if (dto.getType() == 1) {
Integer begin = (dto.getCurrent() - 1) * dto.getSize();
CombinationOut combinationOut = new CombinationOut(sampleIds, begin, dto.getSize(), dto.getName());
//获取仓库现有样本;并进行事件分类
//1.委托
List<OutSampleVO> vo1 = storageMapper.getWTSample(combinationOut);
if (!vo1.isEmpty()) {
records1.addAll(vo1);
}
List<OutSampleVO> vo2 = storageMapper.getWSSample(combinationOut);
if (!vo2.isEmpty()) {
records1.addAll(vo2);
}
List<OutSampleVO> vo3 = storageMapper.getMFSample(combinationOut);
if (!vo3.isEmpty()) {
records1.addAll(vo3);
}
List<OutSampleVO> vo4 = storageMapper.getSJSample(combinationOut);
if (!vo4.isEmpty()) {
records1.addAll(vo4);
}
List<OutSampleVO> vo5 = storageMapper.getTZSample(combinationOut);
if (!vo5.isEmpty()) {
records1.addAll(vo5);
}
}
if (records1.size() == 0) {
return R.ok(sampleVOIPage2, "暂无数据");
}
Collections.sort(records1, new Comparator<OutSampleVO>() {
@Override
public int compare(OutSampleVO o1, OutSampleVO o2) {
return o1.getRoomNo().compareTo(o2.getSampleNo());
}
});
List<OutSampleVO> records2 = new ArrayList<>();
sampleVOIPage2.setSize(dto.getSize());
int pageCurrent = (dto.getCurrent() - 1) * dto.getSize();
int pageTotal = 0;
if (records1.size() % dto.getSize() == 0) {
pageTotal = records1.size() / dto.getSize();
} else {
pageTotal = records1.size() / dto.getSize() + 1;
}
if (pageCurrent + dto.getSize() <= records1.size()) {
records2 = records1.subList(pageCurrent, pageCurrent + dto.getSize());
} else if (records1.size() % dto.getSize() > sampleIds.size() - 1) {
records2 = records1.subList(pageCurrent, records1.size());
} else if (dto.getCurrent() > pageTotal) {
records2 = records1.subList(pageCurrent - dto.getSize(), records1.size());
} else {
records2 = records1.subList(pageCurrent, records1.size());
}
sampleVOIPage2.setTotal(records1.size());//不分页总数
sampleVOIPage2.setRecords(records2);
return R.ok(sampleVOIPage2, "查询成功");
} else {
// int size = sampleIds.size();
// if ("".equals(dto.getSampleIds())) {
// size = sampleIds.size() - 1;
// }
// if (dto.getTotal() != 0) {
// int num = 0;//去重后目前能分的页数
//
// if ((dto.getTotal() - size) % 8 == 0) {
// num = (dto.getTotal() - size) / 8;
// } else {
// num = (dto.getTotal() - size) / 8 + 1;
// }
//
//
// if (dto.getCurrent() > num) {
// //求余数
// int a = dto.getTotal() % 8;//求最后一页的剩余条数
// if (a == 0) {
// a = 8;
// }
// if (sampleIds.size() >= a) {
// dto.setCurrent(num);
// }
// }
// }
// Page<SampleStorage> page = new Page<>(dto.getCurrent(), dto.getSize());
List<OutSampleVO> sampleVOList = storageMapper.getSampleInfoList(Wrappers.<SampleStorage>query()
.and(StringUtils.isNotBlank(dto.getName()), qw -> qw
.like("storage.name", dto.getName())
.or()
.like("sample_no", dto.getName()))
.notIn(!sampleIds.isEmpty(), "storage.sample_id", sampleIds)//去重数组sampleIds
.eq("storage.status", 2) //只能查找存入仓库的样本数据
.eq("s.status", 2)//并且sample实际状态为2
.like(StringUtils.isNotBlank(dto.getRoomNo()), "storage.room_no", dto.getRoomNo())
.orderByDesc("sample_no")
);
for (OutSampleVO vo : sampleVOList) {
vo.setSampleId(vo.getId());
String eventName = "";
//entrustment/hairJob/sewageJob
if (vo.getSource().equals("entrustment")) {
//委托
eventName = storageMapper.getEntrustmentName(vo.getSampleId());
} else if (vo.getSource().equals("hairJob")) {
//毛发
eventName = storageMapper.getHairJobName(vo.getSampleId());
} else if (vo.getSource().equals("sewageJob")) {
//污水
eventName = storageMapper.getSewageJobName(vo.getSampleId());
} else if (vo.getSource().contains("Event")) {//通用事件
//内部录入
eventName = storageMapper.getEventName(vo.getSampleId());
} else {
//特征分析
eventName = storageMapper.getFeatureName(vo.getSampleId());
}
vo.setEventName(eventName);
}
Map<String, List<OutSampleVO>> map = sampleVOList.stream().collect(Collectors.groupingBy(item -> item.getSource()));
List<OutSampleVO> entrustmentSampleList = map.get("entrustment");
List<OutSampleVO> outSampleVOS = new ArrayList<>();
if (entrustmentSampleList != null && entrustmentSampleList.size() > 0) {
sampleVOList.removeAll(entrustmentSampleList);
Collections.sort(entrustmentSampleList, new Comparator<OutSampleVO>() {
@Override
public int compare(OutSampleVO o1, OutSampleVO o2) {
String[] split1 = o1.getSampleNo().split("-");
String[] split2 = o2.getSampleNo().split("-");
// 先比较年份
int yearComparison = split2[0].compareTo(split1[0]);
if (yearComparison != 0) {
return yearComparison;
}
// 再比较序号
int num1 = Integer.parseInt(split2[1]);
int num2 = Integer.parseInt(split1[1]);
if (num1 - num2 != 0) {
return num1 - num2;
}
// 再比较尾号
int num3 = Integer.parseInt(split1[2]);
int num4 = Integer.parseInt(split2[2]);
return num3 - num4;
}
});
outSampleVOS.addAll(entrustmentSampleList);
}
outSampleVOS.addAll(sampleVOList);
return R.ok(outSampleVOS, "查询成功");
}
}
/**
* 查询当前已经存入仓库的样本信息(根据当前登录人查询对应部门的sample信息)
*/
/**
* 新增样本出库申请实体类
*
* @param dto 样本出库申请实体类
* @return R
*/
@ApiOperation(value = "新增样本出库申请实体类", notes = "新增样本出库申请实体类")
@SysLog("新增样本出库申请实体类")
@PostMapping("/addOutApply")
@PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_add')")
public R<SampleOutWarehouseApply> postAddOutApply(@RequestBody OutWarehouseApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//数据校验
if (dto.getSampleIds() == null || dto.getSampleIds().size() == 0) {
throw new RuntimeException("申请出库检材不能为空");
}
if (dto.getReturnDate() == null) {
throw new RuntimeException("归还时间不能为空");
}
if ("".equals(dto.getAppraiserId()) || dto.getAppraiserId().isEmpty()) {
throw new RuntimeException("鉴定人不能为空");
}
SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.createOutApply(dto, dlpUser);
if (vo != null) {
return R.ok(vo, "创建出库申请成功");
} else {
return R.failed("创建出库申请失败");
}
}
/**
* 创建样本出库申请(接口2)
*
* @param dto
* @param theHttpServletRequest
* @return
*/
@ApiOperation(value = "创建样本出库申请(老版本)", notes = "创建样本出库申请(老版本)")
@SysLog("创建样本出库申请")
@PostMapping("/createOutRepositoryApply")
@PreAuthorize("@pms.hasPermission('imr_sample_out_warehouse_apply_add')")
public R createOutRepositoryApply(@RequestBody OutWarehouseApplyDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//数据校验
if (dto.getSampleIds().isEmpty()) {
throw new RuntimeException("申请检材不能为空");
}
if (dto.getReturnDate() == null) {
throw new RuntimeException("归还时间不能为空");
}
if ("".equals(dto.getAppraiserId()) || dto.getAppraiserId().isEmpty()) {
throw new RuntimeException("鉴定人不能为空");
}
SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.createOutRepositoryApply(dto, dlpUser);
if (vo != null) {
return R.ok(vo, "创建出库申请成功");
} else {
return R.failed("创建出库申请失败");
}
}
@ApiOperation(value = "取检条码打印",
notes = "取检条码打印")
@SysLog("检材条码打印")
@GetMapping("/print_QR_code")
public String printgetSampleQRCode(String code) {
return sampleOutWarehouseApplyService.buildEventImLabelContent(code);
}
/**
* 以下为新创建接口----------------------------------------------------------------------
*/
@GetMapping("/testQuery")
public R testQuery(QueryDTO dto) {
List<String> sampleIds = Arrays.asList(dto.getSampleIds().split(","));
IPage<OutSampleVO> sampleVOIPage2 = new Page<>();
List<OutSampleVO> records1 = new ArrayList<>();
int total = 0;
if (dto.getType() == 1) {
Integer begin = (dto.getCurrent() - 1) * dto.getSize();
CombinationOut combinationOut = new CombinationOut(sampleIds, begin, dto.getSize(), dto.getName());
//获取仓库现有样本;并进行事件分类
//1.委托
List<OutSampleVO> vo1 = storageMapper.getWTSample(combinationOut);
if (!vo1.isEmpty()) {
total = total + vo1.size();
records1.addAll(vo1);
}
//2.污水
List<OutSampleVO> vo2 = storageMapper.getWSSample(combinationOut);
if (!vo2.isEmpty()) {
total = total + vo2.size();
records1.addAll(vo2);
}
//3.毛发
List<OutSampleVO> vo3 = storageMapper.getMFSample(combinationOut);
if (!vo3.isEmpty()) {
total = total + vo3.size();
records1.addAll(vo3);
}
//4.事件
List<OutSampleVO> vo4 = storageMapper.getSJSample(combinationOut);
if (!vo4.isEmpty()) {
total = total + vo4.size();
records1.addAll(vo4);
}
}
sampleVOIPage2.setTotal(total);
sampleVOIPage2.setRecords(records1);
return R.ok(sampleVOIPage2, "查询成功");
}
/*if(pageCurrent<records1.size()){
if(pageCurrent+dto.getSize()<=records1.size()){
records2 = records1.subList(pageCurrent,pageCurrent+dto.getSize());
}else {
if(records1.size()%dto.getSize()>sampleIds.size()-1){
records2 = records1.subList(pageCurrent,records1.size());
}else {
if(dto.getCurrent()>=2){
records2 = records1.subList(pageCurrent-dto.getSize(),records1.size());
}else {
records2 = records1.subList(0,records1.size());
}
}
}
}*/
/*if(records1.size()%dto.getSize()>sampleIds.size()-1){
records2 = records1.subList(pageCurrent,records1.size());
}else {
if (dto.getCurrent() > Math.ceil((float)records1.size()/dto.getSize())) {
records2 = records1.subList(pageCurrent - dto.getSize(), records1.size());
} else {
records2 = records1.subList(pageCurrent, records1.size());
}
}*/
}

@ -0,0 +1,594 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.imr.dto.*;
import digital.laboratory.platform.imr.entity.*;
import digital.laboratory.platform.imr.entity.enums.OutboundType;
import digital.laboratory.platform.imr.mapper.DestructionDetailMapper;
import digital.laboratory.platform.imr.mapper.SampleOutWarehouseApplyMapper;
import digital.laboratory.platform.imr.mapper.SampleOutboundRecordMapper;
import digital.laboratory.platform.imr.mapper.SampleStorageMapper;
import digital.laboratory.platform.imr.service.DestructionPublicityService;
import digital.laboratory.platform.imr.service.SampleOutWarehouseApplyService;
import digital.laboratory.platform.imr.service.SampleOutWarehouseService;
import digital.laboratory.platform.imr.vo.*;
import feign.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.security.Principal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 自定义出库controller
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sample_out_Warehouse" )
@Api(value = "sample_out_Warehouse", tags = "样本出库管理")
public class SampleOutWarehouseController {
private final SampleOutWarehouseApplyService sampleOutWarehouseApplyService;
private final DestructionPublicityService destructionPublicityService;
private final DestructionDetailMapper destructionDetailMapper;
private final SampleOutWarehouseApplyMapper outWarehouseApplyMapper;
private final SampleOutWarehouseService warehouseService;
private final SampleStorageMapper storageMapper;
private final SampleOutboundRecordMapper outboundRecordMapper;
private final RemoteWord2PDFService remoteWord2PDFService;
private final OssFile ossFile;
/**
* 分页查询
* @param dto 查询参数管理员可以看见所有数据
* @return
*/
@ApiOperation(value = "出库模块领用出库申请--分页查询", notes = "出库模块领用出库申请--分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" )
public R<IPage<SampleOutWarehouseApplyVO>> getSampleOutWarehouseApplyPage(QueryDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
QueryWrapper<SampleOutWarehouseApply> query = Wrappers.<SampleOutWarehouseApply>query();
query.between(dto.getBeginDate()!=null && dto.getFinishDate()!=null,"application_date",dto.getBeginDate(),dto.getFinishDate());
query.orderByDesc("create_time");
if (dto.getStatus()==0){//返回待审核和待使用的数据
ArrayList<Integer> integers = new ArrayList<>();
integers.add(1);
integers.add(2);
integers.add(3);
query.in("status",integers);
}else if (dto.getStatus()==1){
query.eq("status",1);
}
else if (dto.getStatus()==2){
query.eq("status",2);
}
else if (dto.getStatus()==3){
query.eq("status",3);
}
Page<SampleOutWarehouseApply> page = new Page<>(dto.getCurrent(),dto.getSize());
IPage<SampleOutWarehouseApplyVO> thisPage = sampleOutWarehouseApplyService.getSampleOutWarehouseApplyVOPage(page,query);
return R.ok(thisPage,"查询出库申请成功");
}
/**
* 检材管理员看见领用出库申请然后点击同意出库
*/
@ApiOperation(value = "检材管理员--确认同意领用申请", notes = "检材管理员--确认同意领用申请")
@PutMapping("/reconfirmApply" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R reconfirmApply(String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (id.isEmpty()){
throw new RuntimeException(String.format("id不能为空"));
}
SampleOutWarehouseApplyVO applyVO = sampleOutWarehouseApplyService.reconfirmApply(id,dlpUser.getId());
return R.ok(applyVO,"确认成功");
}
/**
* 根据"取检码"查询相关信息
*/
@ApiOperation(value = "根据取检码查询相关信息", notes = "根据取检码查询相关信息")
@SysLog("根据取检码查询相关信息" )
@GetMapping("/code/{code}" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<SampleOutWarehouseApplyVO> getInfoByCode(@PathVariable("code" ) String code, HttpServletRequest theHttpServletRequest) {
if ("".equals(code)||code.isEmpty()) {
throw new RuntimeException(String.format("取检码不能为空"));
}
SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.getInfoByCode(code);
if (vo!=null) {
return R.ok(vo,"查询成功");
}else {
return R.failed("查询失败");
}
}
/**
* 根据"取检码"验证出库信息(确认出库)
* Confirm Outbound
*/
@ApiOperation(value = "根据取检码验证出库信息(确认出库)", notes = "根据取检码验证出库信息(确认出库)")
@SysLog("根据取检码验证出库信息(确认出库)" )
@PutMapping("/confirmOutbound" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')")
public R<SampleOutWarehouseApplyVO> confirmOutbound(@RequestBody VerificationCode dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(dto.getSampleIds().isEmpty()){
throw new RuntimeException("领用申请样本id不能为空");
}
if(StrUtil.isEmpty(dto.getCode())){
throw new RuntimeException("'取检码不能为空'");
}
SampleOutWarehouseApplyVO vo = sampleOutWarehouseApplyService.confirmOutbound(dto,dlpUser);
return R.ok(vo,"确认出库成功");
}
/**
* 退还/销毁出库---待销毁样本列表查询
*/
@ApiOperation(value = "待销毁或退还出库的样本查询接口", notes = "待销毁或退还出库的样本查询接口--分页")
@GetMapping("/toBeDestroyed/page" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R getToBeDestroyedSample(QueryDTO dto) {
List<String> sampleIds = Arrays.asList(dto.getSampleIds().split(","));
int size = sampleIds.size();
if ("".equals(dto.getSampleIds())){
size = sampleIds.size()-1;
}
if(dto.getTotal()!=0){
int num = 0;//去重后目前能分的页数
if((dto.getTotal()-size)%8==0){
num = (dto.getTotal()-size)/8;
}else {
num = (dto.getTotal()-size)/8+1;
}
System.out.println(num);
if(dto.getCurrent()>num){
//求余数
int a = dto.getTotal()%8;//求最后一页的剩余条数
if(a==0){
a=8;
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}else {
if(sampleIds.size()>=a){
dto.setCurrent(num);
}
}
}
}
Page<SampleStorage> page = new Page<>(dto.getCurrent(),dto.getSize());
/*
* 两个条件
* 审核通过待销毁状态-->=2
* 销毁申请通过的不能再退还中出现
*
* 还在仓库--status==2
*/
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.notIn(!sampleIds.isEmpty(),"storage.sample_id",sampleIds);//去重数组sampleIds
queryWrapper.like(!dto.getName().isEmpty(),"storage.name",dto.getName());
queryWrapper.eq("storage.status",2); //只能查找存入仓库的样本数据
if(dto.getStatus()==null){
queryWrapper.ne("storage.early_warning",2); //如果是退还出库不需要去查询销毁申请通过的检材
}else {
queryWrapper.eq("storage.early_warning",dto.getStatus());//销毁出库就只查询销毁申请通过的
}
//queryWrapper.eq(dto.getStatus()!=null,"storage.early_warning",dto.getStatus());
IPage<BaseSampleVO> sampleVOIPage = storageMapper.getSampleInfoTwo(page,queryWrapper);
return R.ok(sampleVOIPage,"查询成功");
}
/**
* 退还出库自动查询退还单位
*/
@ApiOperation(value = "退还出库查询委托方", notes = "退还出库查询委托方")
@GetMapping("/returnOutboundQuery" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R returnOutboundQuery(String sampleId) {
String orgName = storageMapper.returnOutboundQuery(sampleId);
return R.ok(orgName,"查询成功");
}
/**
* 退还出库
*/
@ApiOperation(value = "退还出库", notes = "退还出库")
@PutMapping("/returnOutbound" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R returnOutbound(@RequestBody ReturnOutboundDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if(dto.getSampleIds().isEmpty()){
throw new RuntimeException("样本信息不能为空");
}
if(dto.getReturnInstitution().isEmpty()){
throw new RuntimeException("退还单位不能为空");
}
warehouseService.returnOutbound(dto,dlpUser);
return R.ok("退还出库成功");
}
/**
* 销毁出库
*/
@ApiOperation(value = "销毁出库", notes = "销毁出库")
@PutMapping("/destroyOutbound" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R destroyOutbound(@RequestBody DestroyOutboundDTO dto, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
/*
*这里销毁出库可能要先判断是否公示了
*/
// LambdaQueryWrapper<DestructionDetail> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.in(DestructionDetail::getSampleId, dto.getSampleIds());
// queryWrapper.orderByDesc(DestructionDetail::getUpdateTime);
// List<DestructionDetail> destructionDetails = destructionDetailMapper.selectList(queryWrapper); // 查询该dto中的样本id 是否已经公示
// // 根据公示id 进行分类
// Map<String, List<DestructionDetail>> collect = destructionDetails.stream().collect(Collectors.groupingBy(item -> item.getDestructionId()));
// collect.forEach((k, v) -> {
// // 根据公示详情中关联的公示id 查公示
// DestructionPublicity oneById = destructionPublicityService.getOneById(k);
// if (oneById == null || oneById.getStatus() != 1) {
// // 公示如果查不到或者状态不为1 则提示需要公示
// throw new RuntimeException("请先进行销毁公示在出口!");
// }
// });
if(dto.getSampleIds().isEmpty()){
throw new RuntimeException("样本信息不能为空");
}
warehouseService.destroyOutbound(dto,dlpUser);
return R.ok("销毁出库成功");
}
/**
* 入库样本记录分页
*/
@ApiOperation(value = "出库记录分页", notes = "出库记录分页")
@GetMapping("/outboundRecord/page" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" )
public R<IPage<OutboundRecordVO>> outboundRecord(QuerySampleDTO dto) {
Page<SampleOutboundRecord> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<OutboundRecordVO> sampleVOIPage = outboundRecordMapper.outboundRecord(page, Wrappers.<SampleOutboundRecord>query()
.like(!dto.getName().isEmpty(), "outbound.name", dto.getName())
.orderByDesc("create_time")
);
List<OutboundRecordVO> records = sampleVOIPage.getRecords();
for (OutboundRecordVO record : records) {
record.setStatusCode(record.getOutboundType().getStatus());
if(record.getOutboundType() == OutboundType.RETURN){
record.setRecipientName(record.getRecipientId());//退还的比较特殊
}
//销毁出库
}
return R.ok(sampleVOIPage, "查询成功");
}
/**
* 待归还样本toBeReturned
*/
@ApiOperation(value = "待归还样本--分页", notes = "待归还样本--分页")
@GetMapping("/toBeReturned/page" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" )
public R<IPage<ToBeReturnVO>> toBeReturned(QuerySampleDTO dto) {
Page<SampleStorage> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<ToBeReturnVO> sampleVOIPage = storageMapper.toBeReturned(page, Wrappers.<SampleStorage>query()
.like(!dto.getName().isEmpty(), "storage.name", dto.getName())
.eq("is_return",1)//只查询需要归还的
.eq("storage.status",3)
.orderByAsc("storage.update_time")
);
List<ToBeReturnVO> records = sampleVOIPage.getRecords();
for (ToBeReturnVO toBeReturnVO : records) {
String eventName = "";
//entrustment/hairJob/sewageJob
switch (toBeReturnVO.getSource()) {
case "entrustment":
//委托
eventName = storageMapper.getEntrustmentName(toBeReturnVO.getSampleId());
break;
case "hairJob":
//毛发
eventName = storageMapper.getHairJobName(toBeReturnVO.getSampleId());
break;
case "sewageJob":
//污水
eventName = storageMapper.getSewageJobName(toBeReturnVO.getSampleId());
break;
case "Event污水":
case "Event毛发":
//内部录入
eventName = storageMapper.getEventName(toBeReturnVO.getSampleId());
break;
default:
//特征分析
eventName = storageMapper.getFeatureName(toBeReturnVO.getSampleId());
break;
}
toBeReturnVO.setEventName(eventName);
}
return R.ok(sampleVOIPage, "查询成功");
}
/**
* 查询单个待归还样本
*/
@ApiOperation(value = "待归还样本--详情", notes = "待归还样本--详情")
@GetMapping("/toBeReturned/detail" )
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" )
public R<RecipientDTO> toBeReturnedDetail(String sampleId) {
RecipientDTO sampleVOIPage = storageMapper.toBeReturnedDetail(sampleId);
return R.ok(sampleVOIPage, "查询成功");
}
/**
* 出库模块对应角标
*/
@ApiOperation(value = "出库模块对应角标0.待确认出库申请;2.出库待归还", notes = "出库模块对应角标0.待确认出库申请;2.出库待归还")
@GetMapping("/inboundIcon/count" )
//@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R<List<IconDTO>> getIconCount() {
//出库申请
QueryWrapper<SampleOutWarehouseApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status",1);//待确认(出库申请带确认)
Long count = outWarehouseApplyMapper.selectCount(queryWrapper);
IconDTO destroyed = new IconDTO(count, 0, "destroyed");
//出库待归还
QueryWrapper<SampleStorage> wrapper = new QueryWrapper<>();
wrapper.eq("is_return",1);//需要归还
wrapper.eq("status",3);//领用出库了
Long selectCount = storageMapper.selectCount(wrapper);
IconDTO aReturn = new IconDTO(selectCount, 2, "return");
ArrayList<IconDTO> iconDTOS = new ArrayList<>();
iconDTOS.add(destroyed);
iconDTOS.add(aReturn);
return R.ok(iconDTOS,"查询成功");
}
/**-------出库清单*/
/**
* 出库清单
*
* @param ids
*
* @return
*/
@ApiOperation(value = "出库清单", notes = "出库清单")
@SysLog("出库清单")
@PostMapping("/print/inventory")
// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')")
public void bizGetPDFInventory(@RequestBody List<String> ids, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
System.out.println("bizApplyWord.................");
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//查询数据
List<InventorySample> voList = storageMapper.getSampleInventory(new QueryWrapper<SampleStorage>()
.in("storage.id", ids)//查询该集合中相关样本数据
);
if (voList.isEmpty()) {
throw new RuntimeException("未查询到相关信息");
}
String id = IdWorker.get32UUID().toUpperCase();
String applyFileName = "检材出库清单-"+id;
String pdfFilePath = "document" + "/"+"inventory" + "/" + id + "/" + applyFileName + ".pdf";
try {
//直接调用pdf方法
GenerateSampleApplyTablePDF(voList,id,theHttpServletRequest,httpServletResponse);
ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(applyFileName);
} catch (Exception e) {
System.out.printf("minioFile objectExist() Exception. %s%n", e.getLocalizedMessage());
e.printStackTrace();
}
}
private void GenerateSampleApplyTablePDF(List<InventorySample> voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
System.out.println("GenerateSampleApplyTablePDF.................");
//-----------------------------
// 生成 word 版本的 鉴定委托书
String applyFileName = "检材出库清单-"+id;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ossFile.fileGet("template" + "/" + "检材出库清单模板.docx", bos);
byte[] templateArray = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(templateArray);
bos.close();
for (int i = 0;i<voList.size();i++) {
InventorySample inventorySample = voList.get(i);
inventorySample.setNumber(i+1);
}
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
Configure config = Configure.builder().
bind("voList", policy).build();
/**
* 循环表格
*/
XWPFTemplate template = XWPFTemplate.compile(bis, config).render(
new HashMap<String, Object>() {{
put("voList", voList);
}}
);
bis.close();
ByteArrayOutputStream fosWord = new ByteArrayOutputStream();
template.write(fosWord);
template.close();
//------------
ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray());
fosWord.close();
//MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord);
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord);
Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
fisWord.close();
ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE);
ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
outPDF.close();
ossFile.fileSave("document" + "/" + "inventory" + "/" + id + "/" + applyFileName + ".pdf", isPDF);
isPDF.close();
System.out.println("转换为 PDF 结束");
}
/**
* 催还
*/
}

@ -0,0 +1,947 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.common.security.annotation.Inner;
import digital.laboratory.platform.common.security.util.SecurityUtils;
import digital.laboratory.platform.imr.dto.*;
import digital.laboratory.platform.imr.entity.*;
import digital.laboratory.platform.imr.mapper.*;
import digital.laboratory.platform.imr.service.SamplePutInStorageService;
import digital.laboratory.platform.imr.vo.*;
import feign.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.security.Principal;
import java.time.LocalDate;
import java.util.*;
/**
* @author Zhang Xiaolong created at 2023-03-21
* @describe 前端控制器
* <p>
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
/**
* 样本入库controller
* 入库相关接口
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/sample_put_in_storage")
@Api(value = "sample_inbound_or_outbound", tags = "样本入库管理")
public class SamplePutInStorageController {
private final SamplePutInStorageService samplePutInStorageService;
private final SampleStorageMapper storageMapper;
private final RemoteWord2PDFService remoteWord2PDFService;
private final SampleApplyMapper asMapper;
private final OssFile ossFile;
private final SampleOutWarehouseApplyMapper outWarehouseApplyMapper;
private final SampleInboundAndOutboundTableMapper tableMapper;
/**
* 获取已录入仓库样本(分页)
*/
@ApiOperation(value = "获取已录入仓库样本(分页)", notes = "获取已录入仓库样本(分页)")
@GetMapping("/repositorySample/page")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<IPage<RepositorySampleVO>> getSampleVOList(QuerySampleDTO dto) {
Page<SampleStorage> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<RepositorySampleVO> sampleVOIPage = samplePutInStorageService.getSampleVOList(page, Wrappers.<SampleStorage>query()
.like(StrUtil.isNotEmpty(dto.getName()), "storage.name", dto.getName())
.eq(StrUtil.isNotEmpty(dto.getSampleType()), "storage.sample_type", dto.getSampleType())
.eq("storage.status", dto.getStatus())
.between(dto.getBeginDate() != null && dto.getFinishDate() != null, "in_repository_date", dto.getBeginDate(), dto.getFinishDate())
.orderByDesc("create_time")
);
return R.ok(sampleVOIPage, "查询成功");
}
/**
* 入库样本记录分页
*/
@ApiOperation(value = "入库样本记录分页", notes = "入库样本记录分页")
@GetMapping("/inboundRecord/page")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<IPage<InboundRecordVO>> inboundRecord(QuerySampleDTO dto) {
Page<SampleInboundRecord> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<InboundRecordVO> sampleVOIPage = samplePutInStorageService.inboundRecord(page, Wrappers.<SampleInboundRecord>query()
.like(StrUtil.isNotEmpty(dto.getName()), "inbound.name", dto.getName())
.orderByDesc("create_time")
);
return R.ok(sampleVOIPage, "查询成功");
}
/**
* 待销毁样本预警
*/
@ApiOperation(value = "待销毁样本预警", notes = "待销毁样本预警")
@GetMapping("/destructionWarning/page")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R destructionWarning(QuerySampleDTO dto) {
Page<SampleStorage> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<RepositorySampleVO> sampleVOIPage = samplePutInStorageService.getDestructionVO(page, Wrappers.<SampleStorage>query()
.like(StrUtil.isNotEmpty(dto.getName()), "storage.name", dto.getName())
.eq("early_warning", 1)
.eq("storage.status", 2)//只能查看当前入库的
.orderByDesc("create_time")
);
return R.ok(sampleVOIPage, "查询成功");
}
/**
* 查询单个存放样本信息
* sample信息+详情(出入库登记表)
*/
@ApiOperation(value = "查询单个存放样本信息--这个id不是样本id", notes = "查询单个存放样本信息")
@GetMapping("/detailed")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<RepositorySampleVO> getSampleDetailed(String id) {
if (StrUtil.isEmpty(id)) {
throw new RuntimeException("查询id不能为空");
}
RepositorySampleVO sampleVO = samplePutInStorageService.getSampleDetailed(id);
return R.ok(sampleVO, "查询成功");
}
/**
* 根据样本编号获取主要信息
* (扫码枪扫描)
*/
@ApiOperation(value = "根据样本编号获取主要信息(入库)", notes = "根据样本编号获取主要信息(入库)")
@GetMapping("/getSampleInfoByNo")
@Inner(value = false)
//@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')" )
public R<List<OutSampleVO>> getSampleInfoByNo(String sampleNo) {
if (sampleNo == null || "".equals(sampleNo)) {
return R.failed(null);
}
List<OutSampleVO> vo = samplePutInStorageService.getSampleListByNo(sampleNo);
if (!vo.isEmpty()) {
return R.ok(vo, "查询成功");
} else {
return R.failed(vo, String.format("编号为" + sampleNo + "的样本不存在请重试"));
}
}
@ApiOperation(value = "修改sample质量", notes = "修改sample质量")
@PostMapping("/updateSampleQuality")
public R<String> updateSampleQuality(String sampleId, double sampleQuality) {
if (StrUtil.isEmpty(sampleId)) {
throw new RuntimeException("id不能为空");
}
//查询并修改
samplePutInStorageService.updateSampleQuality(sampleId, sampleQuality);
return R.ok(null, "修改质量成功");
}
/**
* 扫码入库查看详情信息
*/
@ApiOperation(value = "获取sample主要的详情信息", notes = "获取sample主要的详情信息")
@GetMapping("/getSampleDetailInfo")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<BaseSampleDetail> getSampleDetailInfo(String id) {
if (id == null || "".equals(id)) {
return R.failed(null);
}
BaseSampleDetail sampleDetail = storageMapper.getSampleDetailInfo(id);
if (sampleDetail != null) {
if (sampleDetail.getSource().equals("entrustment") && sampleDetail.getQuantity() == 0) {
sampleDetail.setQuantity(storageMapper.getQuality(sampleDetail.getId()));
}
return R.ok(sampleDetail, "查询成功");
} else {
return R.failed("查询失败");
}
}
/**
* 默认没有仓库样本表
* 外部关联一张样本存储表格
* (接口2)(不考虑样本入库质量)
* 根据检材样本编号录入仓库(入库)
* 确认入库按钮
*/
@ApiOperation(value = "根据编号录入仓库(入库)--不考虑质量", notes = "根据编号录入仓库(入库)--不考虑质量")
@PostMapping("/sampleEntryRepository")
//@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound')" )
public R sampleEntryRepository(@RequestBody List<String> sampleNos, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (sampleNos != null) {
throw new RuntimeException("入库样本编号不能为空");
}
List<OutSampleVO> vo = samplePutInStorageService.sampleEntryRepository(sampleNos, dlpUser);
if (vo != null) {
return R.ok(vo, "样本入库成功,本次入库样本数为" + sampleNos.size() + "份");
} else {
return R.failed("入库失败");
}
}
/**
* 默认没有仓库样本表
* 外部关联一张样本存储表格
* (接口3)
* 根据检材样本编号录入仓库(入库)
* <p>
* 这里需要手动填写入库时的质量和计量单位(流转)
* <p>
* 确认入库按钮
*/
@ApiOperation(value = "根据样本编号录入仓库(入库)--考虑质量", notes = "根据样本编号录入仓库(入库)--考虑质量")
@PostMapping("/sampleInRepository")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_add')")
public R sampleInRepository(@RequestBody List<InRepositoryDTO> sample, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (sample == null) {
throw new RuntimeException("入库样本编号不能为空");
}
List<OutSampleVO> vo = samplePutInStorageService.sampleInRepository(sample, dlpUser);
if (vo != null) {
return R.ok(vo, "样本入库成功,本次入库样本数为" + sample.size() + "份");
} else {
return R.failed("入库失败");
}
}
/**
* 待存放样本查询
*/
@ApiOperation(value = "待存放样本查询", notes = "待存放样本查询")
@GetMapping("/getToBeStoredSample")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<IPage<RepositorySampleVO>> getToBeStoredSample(QueryDTO dto) {
Page<SampleStorage> page = new Page<>(dto.getCurrent(), dto.getSize());
IPage<RepositorySampleVO> sampleVOS = storageMapper.getToBeStoredSample(page, Wrappers.<SampleStorage>query()
.like(StrUtil.isNotEmpty(dto.getName()), "storage.name", dto.getName())
.eq("storage.status", 1)
);
return R.ok(sampleVOS, "查询成功");
}
/**
* 检材存放
*/
@ApiOperation(value = "选择样本存放到格子(存放)", notes = "选择样本存放到格子(存放)")
@PostMapping("/sampleDepositRepository")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')")
public R sampleDepositRepository(@RequestBody DepositDTO dto) {
if (dto.getIds() == null) {
throw new RuntimeException("样本不能为空");
}
if (StrUtil.isEmpty(dto.getCellId())) {
throw new RuntimeException("存放位置不能为空");
}
List<OutSampleVO> vo = samplePutInStorageService.sampleDepositRepository(dto);
return R.ok(vo, "已成功存入" + vo.get(0).getStorageLocation());
}
/**
* 点击存放格子时展示对应内部的存放样本信息
*/
@ApiOperation(value = "通过样本id获取格子中存放的样本信息", notes = "通过样本id获取格子中存放的样本信息")
@GetMapping("/getStoredSample")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_get')")
public R<List<OutSampleVO>> getStoredSample(String cellId) {
if (cellId == null || "".equals(cellId)) {
throw new RuntimeException("格子id不能为空");
}
ArrayList<OutSampleVO> outSampleVOS = new ArrayList<>();
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("storage_cell_id", cellId);
queryWrapper.eq("status", 2);//已经入库的
List<SampleStorage> storages = storageMapper.selectList(queryWrapper);
for (SampleStorage storage : storages) {
OutSampleVO sampleVO = storageMapper.getSampleById(storage.getSampleId());
if (sampleVO != null) {
outSampleVOS.add(sampleVO);
}
}
Collections.sort(outSampleVOS, new Comparator<OutSampleVO>() {
@Override
public int compare(OutSampleVO o1, OutSampleVO o2) {
String[] split1 = o1.getSampleNo().split("-");
String[] split2 = o2.getSampleNo().split("-");
// 先比较年份
int yearComparison = split2[0].compareTo(split1[0]);
if (yearComparison != 0) {
return yearComparison;
}
// 再比较序号
int num1 = Integer.parseInt(split2[1]);
int num2 = Integer.parseInt(split1[1]);
if (num1 - num2 != 0) {
return num1 - num2;
}
// 再比较尾号
int num3 = Integer.parseInt(split1[2]);
int num4 = Integer.parseInt(split2[2]);
return num3 - num4;
}
});
if (!outSampleVOS.isEmpty()) {
return R.ok(outSampleVOS, "查询成功");
} else {
return R.failed("当前格子未存放样本");
}
}
/**
* 修改存储期限
*/
@ApiOperation(value = "修改存储期限", notes = "修改存储期限")
@PutMapping("/updateStorageDate")
@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')")
public R updateStorageLocation(@RequestBody UpdateStorageDateDTO dto) {
if (dto.getStorageDate().isBefore(LocalDate.now())) {
throw new RuntimeException("请选择正确的时间");
}
UpdateWrapper<SampleStorage> wrapper = new UpdateWrapper<>();
wrapper.eq("id", dto.getId());
wrapper.set("storage_date", dto.getStorageDate());
wrapper.set("early_warning", 0);//销毁预警为0
storageMapper.update(null, wrapper);
return R.ok("修改成功");
}
/**
* 销毁预警角标
*/
@ApiOperation(value = "销毁预警角标", notes = "销毁预警角标")
@GetMapping("/destroyed/count")
//@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R<List<IconDTO>> getIconCount() {
//查询当前待销毁检材数量
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("early_warning", 1);
queryWrapper.eq("status", 2);//只能查看当前入库的
Long count = storageMapper.selectCount(queryWrapper);
IconDTO destroyed = new IconDTO(count, 1, "destroyed");
ArrayList<IconDTO> iconDTOS = new ArrayList<>();
iconDTOS.add(destroyed);
return R.ok(iconDTOS, "查询成功");
}
//待存放检材角标(--检材存放提示角标)
/*@ApiOperation(value = "待存放检材角标", notes = "待存放检材角标")
@GetMapping("/getToBeStoredIcon/count" )
//@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound_edit')" )
public R<List<IconDTO>> getToBeStoredIcon() {
//查询当前待存放检材的数量
QueryWrapper<SampleStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status",1);//只能查看当前入库的
Long count = storageMapper.selectCount(queryWrapper);
IconDTO toBeStored = new IconDTO(count, 1, "toBeStored");
ArrayList<IconDTO> iconDTOS = new ArrayList<>();
iconDTOS.add(toBeStored);
return R.ok(iconDTOS,"查询成功");
}*/
//----------------------------------------------------------
/*
*/
@ApiOperation(value = "一个检材入库时的可选检材列表", notes = "一个检材入库时的可选检材列表")
@GetMapping("/choseSampleList")
public R<Map<String, List<OutSampleVO>>> choseSampleList(String keyWords) {
Map<String, List<OutSampleVO>> map = samplePutInStorageService.choseSampleList(keyWords);
return R.ok(map, "查询成功");
}
@ApiOperation(value = "临时入库接口,修改检材状态")
@PutMapping("/tempSampleIn")
public R temporaryProcessSampleIn(@RequestBody List<OutSampleVO> vos) {
samplePutInStorageService.temporaryProcessSampleIn(vos, SecurityUtils.getUser());
return R.ok();
}
/**
* 生成出入库登记表
*
* @param
*/
@ApiOperation(value = "生成出入库单个登记表", notes = "生成出入库单个登记表。如果还没有创建, 立即创建: 根据鉴定申请信息内容的内容创建PDF格式的鉴定委托书, 并保存到 MinIO 存储中")
@SysLog("生成出入库登记表")
@GetMapping("/print/inAndOutTable")
// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')")
public R bizGetPDFSampleInAndOutTable(String sampleId, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
System.out.println("bizApplyWord.................");
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//查询数据
BaseSampleDetail sampleDetailInfo = storageMapper.getSampleDetailInfo(sampleId);
if (sampleDetailInfo == null) {
throw new RuntimeException("没有找到检材相关信息");
}
List<InAndOutInfos> inAndOutInfos = tableMapper.getInandOutTableInfo(sampleId);
if (inAndOutInfos == null || inAndOutInfos.size() == 0) {
throw new RuntimeException("没有找到检材出入库相关信息");
}
String id = IdWorker.get32UUID().toUpperCase();
String applyFileName = "检材出入库登记表-" + id;
String pdfFilePath = "document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx";
try {
//直接调用生成
GenerateSampleApplyTablePDF(inAndOutInfos, id, theHttpServletRequest, httpServletResponse);
return R.ok(pdfFilePath);
// ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream());
// httpServletResponse.setContentType(applyFileName);
} catch (Exception e) {
System.out.printf("minioFile objectExist() Exception. %s%n", e.getLocalizedMessage());
e.printStackTrace();
return R.failed("生成失败!");
}
}
private void GenerateSampleApplyTablePDF(List<InAndOutInfos> inAndOutInfos, String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
System.out.println("GenerateSampleApplyTablePDF.................");
//-----------------------------
// 生成 word 版本的 鉴定委托书
String applyFileName = "检材出入库登记表-" + id;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ossFile.fileGet("template" + "/" + "检材样本出入库登记表模板.docx", bos);
byte[] templateArray = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(templateArray);
bos.close();
for (int i = 0; i < inAndOutInfos.size(); i++) {
InAndOutInfos table = inAndOutInfos.get(i);
table.setNumber(i + 1);
if (inAndOutInfos.get(i).getSampleType().equals("A")) {
inAndOutInfos.get(i).setSampleType("分析样");
} else {
inAndOutInfos.get(i).setSampleType("留存样");
}
}
// int size = inAndOutInfos.size();
// int index = 0;
// if (size < 12) {
// index = 12 - size;
// for (int i = 0; i < index; i++) {
// InAndOutInfos inAndOutInfos1 = new InAndOutInfos();
// inAndOutInfos1.setSampleType("");
// inAndOutInfos1.setSampleNo("");
// inAndOutInfos1.setNumber(null);
// inAndOutInfos1.setWarehousingDate(null);
// inAndOutInfos1.setAppraiserName("");
// inAndOutInfos1.setReturnTime(null);
// inAndOutInfos1.setImName(null);
// inAndOutInfos1.setRemarks("");
// inAndOutInfos.add(inAndOutInfos1);
// }
// } else if (size > 12) {
// index = size % 12;
// if (index != 0) {
// for (int i = 0; i < index; i++) {
// InAndOutInfos inAndOutInfos1 = new InAndOutInfos();
// inAndOutInfos1.setSampleType("");
// inAndOutInfos1.setSampleNo("");
// inAndOutInfos1.setNumber(null);
// inAndOutInfos1.setWarehousingDate(null);
// inAndOutInfos1.setAppraiserName("");
// inAndOutInfos1.setReturnTime(null);
// inAndOutInfos1.setImName(null);
// inAndOutInfos1.setRemarks("");
// inAndOutInfos.add(inAndOutInfos1);
// }
// }
// }
//
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
Configure config = Configure.builder().
bind("inAndOutInfos", policy).build();
/**
* 循环表格
*/
XWPFTemplate template = XWPFTemplate.compile(bis, config).render(
new HashMap<String, Object>() {{
put("inAndOutInfos", inAndOutInfos);
put("year", LocalDateTimeUtil.format(LocalDate.now(), "yyyy"));//将年份设置为编号
}}
);
bis.close();
ByteArrayOutputStream fosWord = new ByteArrayOutputStream();
template.write(fosWord);
template.close();
//------------
ByteArrayInputStream fisWord = new ByteArrayInputStream(fosWord.toByteArray());
fosWord.close();
boolean ret = ossFile.fileSave("document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx", fisWord);
if (ret) {
System.out.println("生成word成功~~~~~~~~~~~~~~~~~~~~~~" + "document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx");
} else {
System.out.println("生成word失败~~~~~~~~~~~~~~~~~~~~~~");
}
//MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord);
// MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord);
// Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
// fisWord.close();
//
//
// ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
// IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE);
// ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
// outPDF.close();
// isPDF.close();
//
//
// System.out.println("转换为 PDF 结束");
}
/**
* 返回当前样本管理中所存在的委托/任务列表
*/
@ApiOperation(value = "返回任务/委托列表", notes = "返回任务/委托列表")
@GetMapping("/event/list")
public R<List<BaseEvent>> eventList(String name) {
ArrayList<BaseEvent> baseEvents = new ArrayList<>();
//查询毛发
List<String> hairJobIds = tableMapper.queryHairJob();
//查询相关事件信息
if (hairJobIds != null) {
for (String id : hairJobIds) {
BaseEvent baseEvent = new BaseEvent();
String hairJobName = tableMapper.getHairJobName(id, name);
if (hairJobName != null) {
baseEvent.setEventId(id);
baseEvent.setEventName(hairJobName);
baseEvent.setSource("hairJob");
baseEvents.add(baseEvent);
}
}
}
//查询污水
List<String> sewageJobIds = tableMapper.querySewageJob();
if (sewageJobIds != null) {
for (String id : sewageJobIds) {
BaseEvent baseEvent = new BaseEvent();
String sewageJobName = tableMapper.getSewageJobName(id, name);
if (sewageJobName != null) {
baseEvent.setEventId(id);
baseEvent.setEventName(sewageJobName);
baseEvent.setSource("sewageJob");
baseEvents.add(baseEvent);
}
}
}
//查询委托
List<String> entrustmentIds = tableMapper.queryEntrustment();
if (entrustmentIds != null) {
for (String id : entrustmentIds) {
BaseEvent baseEvent = new BaseEvent();
String entrustmentName = tableMapper.getEntrustmentName(id, name);
if (entrustmentName != null) {
baseEvent.setEventId(id);
baseEvent.setEventName(entrustmentName);
baseEvent.setSource("entrustment");
baseEvents.add(baseEvent);
}
}
}
//查询事件
List<String> eventIds = tableMapper.queryEvent();
if (eventIds != null) {
for (String id : eventIds) {
BaseEvent baseEvent = new BaseEvent();
String eventName = tableMapper.getEventName(id, name);
if (eventName != null) {
baseEvent.setEventId(id);
baseEvent.setEventName(eventName);
baseEvent.setSource("Event");
baseEvents.add(baseEvent);
}
}
}
//查询特征分析
List<String> featureIds = tableMapper.queryFeature();
if (featureIds != null) {
for (String id : featureIds) {
BaseEvent baseEvent = new BaseEvent();
String eventName = tableMapper.getFeatureName(id, name);
if (eventName != null) {
baseEvent.setEventId(id);
baseEvent.setEventName(eventName);
baseEvent.setSource("feature");
baseEvents.add(baseEvent);
}
}
}
return R.ok(baseEvents, "查询成功");
}
/**
* 按照时间段来生成出入库登记表
*/
@ApiOperation(value = "按时间/委托段生成登记表", notes = "按时间/委托段生成登记表。如果还没有创建, 立即创建: 根据鉴定申请信息内容的内容创建PDF格式的鉴定委托书, 并保存到 MinIO 存储中")
@SysLog("生成出入库登记表")
@GetMapping("/print/inAndOutTableByDateOrEvent")
// @PreAuthorize("@pms.hasPermission('EntrustmentEdit')")
public R bizGetPDFSampleInAndOutTableByDate(PrintTableDTO dto, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
System.out.println("bizApplyWord.................");
List<InAndOutInfos> inAndOutInfos = new ArrayList<>();
List<String> sampleIds = null;
if (dto.getType() == 1) {
//委托/任务
switch (dto.getSource()) {
case "entrustment":
//委托(对应样本表中所有检材样本id)
sampleIds = tableMapper.getSampleIdsByEw(dto.getEventId());
break;
case "hairJob":
//毛发
sampleIds = tableMapper.getSampleIdsByHj(dto.getEventId());
break;
case "sewageJob":
//污水
sampleIds = tableMapper.getSampleIdsBySj(dto.getEventId());
break;
case "Event":
//事件
sampleIds = tableMapper.getSampleIdsByTy(dto.getEventId());
break;
default:
//特征分析
sampleIds = tableMapper.getSampleIdsByTz(dto.getEventId());
break;
}
if (sampleIds != null) {
for (String sampleId : sampleIds) {
List<InAndOutInfos> inAndOutTableInfo = tableMapper.getInandOutTableInfo(sampleId);
if (inAndOutTableInfo != null) {
inAndOutInfos.addAll(inAndOutTableInfo);
}
}
}
} else {
//根据时间
inAndOutInfos = tableMapper.getInandOutTableInfoByDate(dto.getBeginDate(), dto.getFinishDate());
}
//查询数据
if (inAndOutInfos.size() == 0) {
throw new RuntimeException("没有找到检材出入库相关信息");
}
String id = IdWorker.get32UUID().toUpperCase();
String applyFileName = "检材出入库登记表-" + id;
;
String pdfFilePath = "document" + "/" + "repository" + "/" + id + "/" + applyFileName + ".docx";
;
try {
//直接调用生成
GenerateSampleApplyTablePDF(inAndOutInfos, id, theHttpServletRequest, httpServletResponse);
return R.ok(pdfFilePath);
} catch (Exception e) {
System.out.println(String.format("minioFile objectExist() Exception. %s", e.getLocalizedMessage()));
e.printStackTrace();
}
return R.ok(pdfFilePath);
}
/**
* 检材管理首页子模块所有角标
* .检材流转
* 1.待接收+2.待见证
* .入库管理
* 1.销毁预警
* .出库管理
* 1.待确认出库申请+2.待归还
* .审核审批
* 1.待审核/待审批
*/
@ApiOperation(value = "检材管理首页子模块所有角标", notes = "检材管理首页子模块所有角标")
@SysLog("检材管理首页子模块所有角标")
@GetMapping("/getAllModuleIcon")
//@PreAuthorize("@pms.hasPermission('imr_inbound_or_outbound')")
public R<List<IconDTO>> getAllModuleIcon(HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
/*Set<String> permissions = dlpUser.getPermissions();
if(permissions.contains("imr_sample_apply_first_audit")){
//一级审核
} else if (permissions.contains("imr_sample_apply_secondary_audit")) {
//二级审核
} else if (permissions.contains("imr_sample_apply_approval")) {
//审批
}*/
ArrayList<IconDTO> iconDTOS = new ArrayList<>();
//1.检材流转
IconDTO count1 = samplePutInStorageService.getTransferIconCount(dlpUser.getId());
if (count1 != null) {
iconDTOS.add(count1);
}
//入库管理--销毁预警
QueryWrapper<SampleStorage> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("early_warning", 1);
queryWrapper1.eq("status", 2);//只能查看当前入库的
Long destroyed = storageMapper.selectCount(queryWrapper1);
IconDTO count2 = null;
if (destroyed != 0) {
count2 = new IconDTO(destroyed, 3, "inbound");
iconDTOS.add(count2);
}
//出库管理--待归还+待确认
Long countReturn = storageMapper.selectCount(Wrappers.<SampleStorage>query()
.eq("status", 3)
.eq("is_return", 1)//需要归还
);
//出库申请
Long countConfirm = outWarehouseApplyMapper.selectCount(Wrappers.<SampleOutWarehouseApply>query()
.eq("status", 1)//待确认
);
IconDTO count3 = null;
if (countReturn + countConfirm != 0) {
count3 = new IconDTO(countReturn + countConfirm, 4, "outbound");
iconDTOS.add(count3);
}
//审核/审批
return R.ok(iconDTOS, "查询成功");
}
/*
getExternalModuleIcon
获取部分模块的角标
*/
@ApiOperation(value = "获取部分模块的角标", notes = "获取部分模块的角标")
@GetMapping("/getExternalModuleIcon")
public R<List<IconVO>> getExternalModuleIcon(HttpServletRequest theHttpServletRequest) {
ArrayList<IconVO> list = new ArrayList<>();
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Set<String> permissions = dlpUser.getPermissions();
//流转(imt_sample_transfer_get)
if (permissions.contains("imt_sample_transfer_get")) {
int count = storageMapper.queryTransfer(dlpUser.getId());
if (count != 0) {
IconVO iconVO = new IconVO("sample-circulation", true);
list.add(iconVO);
}
}
if (permissions.contains("imr_sample_out_warehouse_apply_get")) {
//出库申请申请人是自己并且待操作的数据
QueryWrapper<SampleOutWarehouseApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", 2);//已经创建待使用
queryWrapper.eq("applicant_id", dlpUser.getId());
Long count = outWarehouseApplyMapper.selectCount(queryWrapper);
if (count != 0) {
IconVO iconVO = new IconVO("outapplication", true);
list.add(iconVO);
}
}
if (permissions.contains("imr_inbound_or_outbound")) {
//出库 待操作的数据 出库申请+领用待归还的
QueryWrapper<SampleStorage> wrapper1 = new QueryWrapper<>();
wrapper1.eq("is_return", 1);//只查询需要归还的
wrapper1.eq("status", 3);
Long count1 = storageMapper.selectCount(wrapper1);
QueryWrapper<SampleOutWarehouseApply> wrapper2 = new QueryWrapper<>();
wrapper2.eq("status", 1);//待确定的数据
Long count2 = outWarehouseApplyMapper.selectCount(wrapper2);
if (count1 + count2 != 0) {
IconVO iconVO = new IconVO("outbound-management", true);
list.add(iconVO);
}
}
if (permissions.contains("imr_inbound_or_outbound")) {
//入库
QueryWrapper<SampleStorage> wrapper1 = new QueryWrapper<>();
wrapper1.eq("early_warning", 1);
wrapper1.eq("status", 2);//只能查看当前入库的
Long count1 = storageMapper.selectCount(wrapper1);
if (count1 != 0) {
IconVO iconVO = new IconVO("warehousing-management", true);
list.add(iconVO);
}
}
//审核审批
if (permissions.contains("imr_sample_apply_first_audit")) {
//一级审核员
QueryWrapper<SampleApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("application_status", 1);
Long count1 = asMapper.selectCount(queryWrapper);
if (count1 != 0) {
IconVO iconVO = new IconVO("review-approval", true);
list.add(iconVO);
}
} else if (permissions.contains("imr_sample_apply_secondary_audit")) {
//二级审核员
QueryWrapper<SampleApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("application_status", 2);
Long count1 = asMapper.selectCount(queryWrapper);
if (count1 != 0) {
IconVO iconVO = new IconVO("review-approval", true);
list.add(iconVO);
}
} else if (permissions.contains("imr_sample_apply_approval")) {
//审批人
QueryWrapper<SampleApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("application_status", 3);
Long count1 = asMapper.selectCount(queryWrapper);
if (count1 != 0) {
IconVO iconVO = new IconVO("review-approval", true);
list.add(iconVO);
}
}
if (list.size() > 0) {
return R.ok(list, "查询成功");
} else {
return R.failed("暂无数据");
}
}
}

@ -0,0 +1,274 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.io.file.FileNameUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.QueryStorageDTO;
import digital.laboratory.platform.imr.entity.StorageCell;
import digital.laboratory.platform.imr.entity.StorageCupboard;
import digital.laboratory.platform.imr.mapper.StorageCellMapper;
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper;
import digital.laboratory.platform.imr.service.StorageCellService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.activation.MimetypesFileTypeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import digital.laboratory.platform.common.oss.service.OssFile;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 前端控制器
*
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/storage_cell" )
@Api(value = "storage_cell", tags = "存储柜子对应格子管理")
public class StorageCellController {
private final StorageCellService storageCellService;
private final StorageCellMapper cellMapper;
private final StorageCupboardMapper cupboardMapper;
private final OssFile ossFile;
/**
* 通过id查询
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('imr_storage_cell_get')" )
public R<StorageCell> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
StorageCell storageCell = storageCellService.getById(id);
return R.ok(storageCell);
//return R.ok(storageCellService.getById(id));
}
/**
* 上传图片
* @param cellId
* @param file
* @return
* @throws Exception
*/
@ApiOperation(value = "上传格子图片", notes = "上传格子图片")
@PostMapping(value = " /{cellId}")
//@PreAuthorize("@pms.hasPermission('roomUpload')")
public R uploadAttachmentObj(@PathVariable("cellId") String cellId, @RequestPart("file") MultipartFile file) throws Exception {
StorageCell storageCell = cellMapper.selectById(cellId);
if (storageCell != null) {
String path = "cell" + "/" + cellId;
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
ResultData.put("path", path);
if (r) {
//修改数据库
storageCell.setCellPhoto(path);
storageCell.setFileName(fileName);
cellMapper.updateById(storageCell);
return R.ok(ResultData, "上传成功");
}
return R.failed("上传失败");
}
return R.failed(null, "这个格子不存在");
}
/*HairSample hs = hairSampleService.getById(hairSampleId);
if (hs != null) {
try {
// 获取样品所属的任务信息
HairJob hairJob = hairJobService.getById(hs.getJobId());
if (hairJob == null) {
throw new RuntimeException(String.format("任务id为 %s 的任务不存在", hs.getJobId()));
}
String rootId;
// 获取根任务id
if (hairJob.getRootTaskId().equals("0")) {
rootId = hairJob.getId();
} else {
rootId = hairJob.getRootTaskId();
}
ossFile.fileGet("hair_job" + "/" + rootId + "/" + hairSampleId + "/" + fileName, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(hs.getPicture()));
} catch (AmazonS3Exception s3e) {
httpServletResponse.sendError(s3e.getStatusCode(), s3e.toString());
} catch (Exception e) {
httpServletResponse.sendError(501, e.toString());
}
}
else {
httpServletResponse.sendError(404, "不存在这个毛发样品");
}*/
@ApiOperation(value = "柜子列表查询接口--存储管理", notes = "柜子列表查询接口--存储管理")
@GetMapping("/cell/list" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<IPage<StorageCell>> getStorageRoomPage(QueryStorageDTO dto){
Page<StorageCell> page = new Page<>();
IPage<StorageCell> storageList = cellMapper.getStorageCellPage(page,Wrappers.<StorageCell>query()
.eq(!dto.getId().isEmpty(),"id",dto.getId())
.orderByDesc("create_time")
);
return R.ok(storageList,"查询成功");
}
/**
*
* @param dto
* @return
*/
@ApiOperation(value = "格子分页查询--入库模块使用", notes = "格子分页查询--入库模块使用")
@GetMapping("/page" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<IPage<StorageCell>> getStorageRoomList(QueryStorageDTO dto) {
Page<StorageCell> page = new Page<>(dto.getCurrent(),dto.getSize());
IPage<StorageCell> storage = cellMapper.getStorageCellPage(page,Wrappers.<StorageCell>query()
.eq("cupboard_id",dto.getId())
.orderByDesc("sort")
);
return R.ok(storage,"查询成功");
}
/**
* 通过id删除
* @return R
*/
@ApiOperation(value = "通过格子id删除图片", notes = "通过格子id删除图片")
@SysLog("通过id删除" )
@DeleteMapping("/deletePicture/{cellId}" )
//@PreAuthorize("@pms.hasPermission('imr_storage_cell_del')" )
public R deleteById(@PathVariable("cellId") String cellId) throws Exception {
StorageCell storageCell = cellMapper.selectById(cellId);
if(storageCell==null){
throw new RuntimeException(String.format("当前格子数据不存在"));
}
if(storageCell.getCellPhoto()!=null && storageCell.getFileName()!=null ){
//删除图片
ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName());
storageCell.setCellPhoto("");
storageCell.setFileName("");
cellMapper.updateById(storageCell);
}
return R.ok("删除成功");
}
/**
* 通过id删除
* @return R
*/
@ApiOperation(value = "批量删除格子", notes = "批量删除格子")
@SysLog("通过id删除" )
@DeleteMapping("/deleteCell" )
//@PreAuthorize("@pms.hasPermission('imr_storage_cell_del')" )
public R deleteById(@RequestBody List<String> cellIds) throws Exception {
List<StorageCell> storageCells = cellMapper.selectBatchIds(cellIds);
for (StorageCell storageCell : storageCells) {
if(storageCell.getStatus()){
throw new RuntimeException(String.format("编号为"+storageCell.getCellNo()+"的格子已存放东西"));
}
}
for (StorageCell storageCell : storageCells) {
//删除数据库数据
cellMapper.deleteById(storageCell.getId());
if(storageCell.getCellPhoto()!=null && storageCell.getFileName()!=null ){
//删除图片
ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName());
}
//更新对应格子的规格数据
StorageCupboard storageCupboard = cupboardMapper.selectById(storageCell.getCupboardId());
storageCupboard.setSpecifications(storageCupboard.getSpecifications()-1);//删除一个减-
//获取对应格子数量
/*QueryWrapper<StorageCell> wrapper = new QueryWrapper<>();
wrapper.eq("cupboard_id",storageCell.getCupboardId());
cellMapper.selectCount(wrapper);*/
cupboardMapper.updateById(storageCupboard);
}
return R.ok("删除成功");
}
/**
* 通过柜子id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}"
*/
@ApiOperation(value = "通过格子id和文件名获取图片--存储管理", notes = "通过格子id和文件名获取图片--存储管理")
@GetMapping("/getCellPicture/{cellId}/{fileName}")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public void getRoomPicture (@PathVariable("cellId") String cellId,
@PathVariable("fileName") String fileName,
HttpServletResponse httpServletResponse) throws Exception {
StorageCell storageCell = storageCellService.getById(cellId);
if (storageCell == null) {
throw new RuntimeException(String.format("当前柜子数据不存在"));
}
ossFile.fileGet("cell" + "/" + storageCell.getId() + "/" + fileName, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageCell.getFileName()));
}
}

@ -0,0 +1,354 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.io.file.FileNameUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.QueryStorageDTO;
import digital.laboratory.platform.imr.entity.StorageCell;
import digital.laboratory.platform.imr.entity.StorageCupboard;
import digital.laboratory.platform.imr.entity.StorageRoom;
import digital.laboratory.platform.imr.mapper.StorageCellMapper;
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper;
import digital.laboratory.platform.imr.service.StorageCupboardService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.activation.MimetypesFileTypeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import digital.laboratory.platform.common.oss.service.OssFile;
import static com.alibaba.fastjson.util.IOUtils.stringSize;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 前端控制器
*
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/storage_cupboard" )
@Api(value = "storage_cupboard", tags = "柜子管理")
public class StorageCupboardController {
private final StorageCupboardService storageCupboardService;
private final StorageCupboardMapper cupboardMapper;
private final StorageCellMapper cellMapper;
private final OssFile ossFile;
/**
* 通过id查询
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('imr_storage_cupboard_get')" )
public R<StorageCupboard> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
StorageCupboard storageCupboard = storageCupboardService.getById(id);
return R.ok(storageCupboard);
//return R.ok(storageCupboardService.getById(id));
}
@ApiOperation(value = "柜子列表查询接口--存储管理", notes = "柜子列表查询接口--存储管理")
@GetMapping("/cupboard/list" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<IPage<StorageCupboard>> getStorageRoomPage(QueryStorageDTO dto){
Page<StorageCupboard> page = new Page<>(dto.getCurrent(),dto.getSize());
IPage<StorageCupboard> storageCupboardList = cupboardMapper.getStorageCupboardPage(page,Wrappers.<StorageCupboard>query()
.eq(!dto.getId().isEmpty(),"id",dto.getId())
.orderByDesc("create_time")
);
return R.ok(storageCupboardList,"查询成功");
}
/* @ApiOperation(value = "修改--上传柜子图片", notes = "修改--上传柜子图片")
@PostMapping(value = "/uploadCupboard/{cupboardId}")
//@PreAuthorize("@pms.hasPermission('roomUpload')")
public R uploadAttachmentObj(@PathVariable("cupboardId") String cupboardId, @RequestPart("file") MultipartFile file) throws Exception {
StorageCupboard storageCupboard = cupboardMapper.selectById(cupboardId);
if (storageCupboard != null) {
String path = "cupboard" + "/" + cupboardId;
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
ResultData.put("path", path);
if (r) {
//修改数据库
storageCupboard.setCupboardPhoto(path);
storageCupboard.setFileName(fileName);
cupboardMapper.updateById(storageCupboard);
return R.ok(ResultData, "上传成功");
}
return R.failed("上传失败");
}
return R.failed(null, "这个柜子不存在");
}*/
/**
* 新增
* @param storageCupboard
* @return R
*/
@ApiOperation(value = "添加存储柜--存储管理", notes = "添加存储柜--存储管理")
@SysLog("添加存储柜--存储管理" )
@PostMapping("/createStorageCupboard")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_add')" )
public R<StorageCupboard> postAddObject(StorageCupboard storageCupboard, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false) MultipartFile file)throws Exception {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (storageCupboard.getRoomId() == null) {
throw new RuntimeException(String.format("柜子必须关联格子"));
}
if (storageCupboard.getSpecifications() == null) {
throw new RuntimeException(String.format("柜子必须要填写规格"));
}
if (storageCupboard.getCupboardNo() == null) {
throw new RuntimeException(String.format("柜子编号不能为空"));
}
storageCupboard.setId(IdWorker.get32UUID().toUpperCase());
if (file != null) {
String path = "cupboard" + "/" + storageCupboard.getId();
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
if (r) {
storageCupboard.setCupboardPhoto(path);
storageCupboard.setFileName(fileName);
cupboardMapper.insert(storageCupboard);
//根据柜子规格创建格子
for (Integer a = 1; a <= storageCupboard.getSpecifications(); a++) {
StorageCell storageCell = new StorageCell();
storageCell.setId(IdWorker.get32UUID().toUpperCase());
storageCell.setStatus(true);//默认未存入东西
storageCell.setCupboardId(storageCupboard.getId());
//取柜子的编号前几位
String head = storageCupboard.getCupboardNo().substring(0, 3);
//制定格子编号生成规则
String str = "CL";
String number = getNumber(a);
storageCell.setCellNo(str + head + number);
cellMapper.insert(storageCell);
}
return R.ok(storageCupboard, "创建成功");
} else {
//删除图片
ossFile.fileDelete("cupboard" + "/" + storageCupboard.getId() + "/" + fileName);
return R.failed("创建失败");
}
} else {
cupboardMapper.insert(storageCupboard);
return R.ok(storageCupboard, "创建成功");
}
}
/**
* 修改
* @param storageCupboard
* @return R
*/
@ApiOperation(value = "修改--存储管理(数据修改+图片修改)", notes = "修改--存储管理")
@SysLog("修改")
@PutMapping("/updateCupboard")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_edit')" )
public R<StorageCupboard> putUpdateById (StorageCupboard storageCupboard, HttpServletRequest
theHttpServletRequest, @RequestPart(value = "file", required = false) MultipartFile file)throws Exception {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
StorageCupboard cupboard = storageCupboardService.getById(storageCupboard.getId());//数据库数据
if(cupboard==null){
throw new RuntimeException(String.format("当前修改数据不存在"));
}
if ((int)storageCupboard.getSpecifications()!=(int)cupboard.getSpecifications()) {
throw new RuntimeException(String.format("不允许修改"));
}
if (file != null) {
String path = "cupboard" + "/" + storageCupboard.getId();
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
if (r) {
storageCupboard.setCupboardPhoto(path);
storageCupboard.setFileName(fileName);
cupboardMapper.updateById(storageCupboard);
return R.ok(storageCupboard, "修改成功");
} else {
return R.failed("修改失败");
}
} else {
if(cupboard.getCupboardPhoto()!=null && cupboard.getFileName()!=null) {
//删除图片
ossFile.fileDelete("cupboard" + "/" + cupboard.getId() + "/" + cupboard.getFileName());
}
storageCupboard.setFileName(null);
storageCupboard.setCupboardPhoto(null);
cupboardMapper.updateById(storageCupboard);
return R.ok(storageCupboard, "修改成功");
}
}
/**
* 通过id删除
* @param id id
* @return R
**/
@ApiOperation(value = "通过id删除柜子--存储管理", notes = "通过id删除柜子--存储管理")
@SysLog("通过id删除")
@DeleteMapping("deleteCupboard/{id}")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" )
public R<StorageCupboard> deleteById (@PathVariable String id, HttpServletRequest theHttpServletRequest) throws
Exception {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
QueryWrapper<StorageCell> wrapper = new QueryWrapper<>();
wrapper.eq("cupboard_id", id);
List<StorageCell> storageCells = cellMapper.selectList(wrapper);
for (StorageCell storageCell : storageCells) {
if (!storageCell.getStatus()) {
throw new RuntimeException(String.format("当前柜子中"+storageCell.getCellNo()+"格子还存有物品"));
}
}
//删除柜子
StorageCupboard storageCupboard = storageCupboardService.getById(id);
if (storageCupboard.getCupboardPhoto() != null && storageCupboard.getFileName() != null) {
//删除图片
ossFile.fileDelete("cupboard" + "/" + storageCupboard.getId() + "/" + storageCupboard.getFileName());
}
if (storageCupboardService.removeById(id)) {
QueryWrapper<StorageCell> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("cupboard_id",id);
cellMapper.delete(queryWrapper);//删除格子
//删除对应格子照片
for (StorageCell storageCell : storageCells) {
if (storageCell.getCellPhoto() != null && storageCell.getFileName() != null) {
//删除图片
ossFile.fileDelete("cell" + "/" + storageCell.getId() + "/" + storageCell.getFileName());
}
}
return R.ok(storageCupboard, "对象删除成功");
} else {
return R.failed(storageCupboard, "对象删除失败");
}
}
/**
* 通过柜子id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}"
*/
@ApiOperation(value = "通过柜子id和文件名获取图片--存储管理", notes = "通过柜子id和文件名获取图片--存储管理")
@GetMapping("/getCupboardPicture/{cupboardId}/{fileName}")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public void getRoomPicture (@PathVariable("cupboardId") String cupboardId,
@PathVariable("fileName") String fileName,
HttpServletResponse httpServletResponse) throws Exception {
StorageCupboard storageCupboard = storageCupboardService.getById(cupboardId);
if (storageCupboard == null) {
throw new RuntimeException(String.format("当前柜子数据不存在"));
}
ossFile.fileGet("cupboard" + "/" + storageCupboard.getId() + "/" + fileName, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageCupboard.getFileName()));
}
/**
*
* @param
* @return
**/
@ApiOperation(value = "柜子列表查询--下拉框的", notes = "柜子列表查询--下拉框的")
@GetMapping("/list/{roomId}")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<List<StorageCupboard>> getStorageRoomList (@PathVariable("roomId") String roomId ){
List<StorageCupboard> storage = cupboardMapper.getStorageCupboardList(Wrappers.<StorageCupboard>query()
.eq("room_id", roomId)
.ne("status", 0)//排除不可用的柜子
.orderByDesc("sort")
);
return R.ok(storage, "查询成功");
}
public static String getNumber(Integer a){
String number = "";
Integer i = stringSize(a);
if(i==1){
number="000"+a.toString();
}else if(i==2){
number="00"+a.toString();
}else if(i==3){
number="0"+a.toString();
}
return number;
}
}

@ -0,0 +1,309 @@
package digital.laboratory.platform.imr.controller;
import cn.hutool.core.io.file.FileNameUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.entity.StorageCupboard;
import digital.laboratory.platform.imr.entity.StorageRoom;
import digital.laboratory.platform.imr.mapper.StorageCupboardMapper;
import digital.laboratory.platform.imr.mapper.StorageRoomMapper;
import digital.laboratory.platform.imr.service.StorageRoomService;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.common.core.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.activation.MimetypesFileTypeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 前端控制器
*
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service
* 这里写什么:
* 为前端提供数据, 接受前端的数据
* 为前端提供的数据, service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数这里对参数的整理, 应该只是格式上的, 而不能是业务上的
* 数据层在 mapper , 数据层不涉及业务, 只管技术上的 对象<-> 之间的转换
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/storage_room" )
@Api(value = "storage_room", tags = "房间管理")
public class StorageRoomController {
private final StorageRoomMapper roomMapper;
private final StorageRoomService storageRoomService;
private final StorageCupboardMapper cupboardMapper;
private final OssFile ossFile;
/* @ApiOperation(value = "上传房间图片", notes = "上传房间图片")
@PostMapping(value = "/uploadRoom/{roomId}")
@PreAuthorize("@pms.hasPermission('roomUpload')")
public R uploadAttachmentObj(@PathVariable("roomId") String roomId, @RequestPart("file") MultipartFile file) throws Exception {
StorageRoom storageRoom = roomMapper.selectById(roomId);
if (storageRoom != null) {
String path = "room" + "/" + roomId;
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
ResultData.put("path", path);
if (r) {
//修改数据库
storageRoom.setRoomPhoto(path);
storageRoom.setFileName(fileName);
roomMapper.updateById(storageRoom);
return R.ok(ResultData, "上传成功");
}
return R.failed("上传失败");
}
return R.failed(null, "这个房间不存在");
}*/
/**
* 通过id查询
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<StorageRoom> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
StorageRoom storageRoom = storageRoomService.getById(id);
return R.ok(storageRoom);
//return R.ok(storageRoomService.getById(id));
}
/**
* 分页查询
* @param roomName
* @return
*/
@ApiOperation(value = "存储室列表查询接口--存储管理", notes = "存储室列表查询接口--存储管理")
@GetMapping("/room/list" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<List<StorageRoom>> getStorageRoomPage(String roomName){
List<StorageRoom> storageRoomList = roomMapper.getStorageRoomPage(Wrappers.<StorageRoom>query()
.like(!roomName.isEmpty(),"name",roomName)
.orderByDesc("create_time")
);
return R.ok(storageRoomList,"查询成功");
}
/**
* 新增
* @param storageRoom
* @return R
*/
@ApiOperation(value = "添加存储室--存储管理(上传或不上传图片)", notes = "添加存储室--存储管理")
@SysLog("添加存储室" )
@PostMapping("/createStorageRoom")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_add')" )
public R<StorageRoom> postAddObject(StorageRoom storageRoom, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false) MultipartFile file)throws Exception {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
storageRoom.setId(IdWorker.get32UUID().toUpperCase());
if(file!=null){
String path = "room" + "/" + storageRoom.getId();
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
if (r) {
storageRoom.setRoomPhoto(path);
storageRoom.setFileName(fileName);
roomMapper.insert(storageRoom);
return R.ok(storageRoom, "创建成功");
}
else {
//删除图片
ossFile.fileDelete("room" + "/" + storageRoom.getId() + "/" + fileName);
return R.failed("创建失败");
}
}else {
roomMapper.insert(storageRoom);
return R.ok(storageRoom, "创建成功");
}
}
/**
* 修改
* @return R
*/
@ApiOperation(value = "修改--存储管理(数据修改+图片修改)", notes = "修改--存储管理")
@SysLog("修改" )
@PutMapping("/updateRoom")
//@PreAuthorize("@pms.hasPermission('imr_storage_room_edit')" )
public R<StorageRoom> putUpdateById(StorageRoom storageRoom, HttpServletRequest theHttpServletRequest,@RequestPart(value = "file",required = false)MultipartFile file)throws Exception {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
StorageRoom room = roomMapper.selectById(storageRoom.getId());
if(room==null){
throw new RuntimeException(String.format("存储室数据不存在"));
}
if(file!=null){
String path = "room" + "/" + storageRoom.getId();
String fileName = FileNameUtil.getName(file.getOriginalFilename());
boolean r = ossFile.fileUpload(file, path);
if (r) {
storageRoom.setRoomPhoto(path);
storageRoom.setFileName(fileName);
roomMapper.updateById(storageRoom);
return R.ok(storageRoom, "修改成功");
}
else {
return R.failed("修改失败");
}
}else {
//判断数据库是否存储照片
if(room.getRoomPhoto() != null && room.getFileName()!=null){
//删除图片
ossFile.fileDelete("room" + "/" + room.getId() + "/" + room.getFileName());
}
//修改数据
storageRoom.setFileName("");
storageRoom.setRoomPhoto("");
roomMapper.updateById(storageRoom);
return R.ok(storageRoom, "修改成功");
}
}
/**
* 通过id删除
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除房间--存储管理", notes = "通过id删除--存储管理")
@SysLog("通过id删除" )
@DeleteMapping("deleteRoom/{id}" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" )
public R<StorageRoom> deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) throws Exception {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
QueryWrapper<StorageCupboard> wrapper = new QueryWrapper<>();
wrapper.eq("room_id",id);
List<StorageCupboard> storageCupboards = cupboardMapper.selectList(wrapper);
if (storageCupboards!=null){
throw new RuntimeException(String.format("当前房间还存在柜子不允许删除"));
}
StorageRoom storageRoom = storageRoomService.getById(id);
if(storageRoom.getRoomPhoto()!=null && storageRoom.getFileName()!=null){
//删除图片
ossFile.fileDelete("room" + "/" + storageRoom.getId() + "/" + storageRoom.getFileName());
}
if (storageRoomService.removeById(id)) {
return R.ok(storageRoom, "对象删除成功");
}
else {
return R.failed(storageRoom, "对象删除失败");
}
}
/**
* 通过房间id和文件名获取图片"/getRoomPicture/{roomId}/{fileName}"
*/
@ApiOperation(value = "通过房间id和文件名获取图片", notes = "通过房间id和文件名获取图片")
@GetMapping("/getRoomPicture/{roomId}/{fileName}" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public void getRoomPicture(@PathVariable("roomId") String roomId,
@PathVariable("fileName") String fileName,
HttpServletResponse httpServletResponse) throws Exception {
StorageRoom storageRoom = roomMapper.selectById(roomId);
if(storageRoom==null){
throw new RuntimeException(String.format("当前房间数据不存在"));
}
ossFile.fileGet("room" + "/" + storageRoom.getId() + "/" + fileName, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(storageRoom.getFileName()));
}
/*
@ApiOperation(value = "删除图片", notes = "删除图片")
@SysLog("通过id删除" )
@DeleteMapping("deleteRoom/{id}" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_del')" )
*/
/**
* 列表
* @param
* @return
*/
@ApiOperation(value = "房间列表查询--下拉框的", notes = "房间列表查询--下拉框的")
@GetMapping("/list" )
//@PreAuthorize("@pms.hasPermission('imr_storage_room_get')" )
public R<List<StorageRoom>> getStorageRoomList() {
List<StorageRoom> storage = roomMapper.getStorageRoomList(Wrappers.<StorageRoom>query()
.orderByDesc("sort")
);
return R.ok(storage,"查询成功");
}
}

@ -0,0 +1,45 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 创建/修改申请DTO
*/
@Data
@ApiModel(value = "ApplyDTO",description = "创建修改申请dto")
public class ApplyDTO {
/**
* 申请id
*/
@ApiModelProperty(value = "申请id--主键id")
private String id;
/**
* 样本id
*/
@ApiModelProperty(value = "选择的样本id集合")
private List<String> sampleId;
/**
* 申请原因
*/
@ApiModelProperty(value="申请原因")
private String reason;
/**
* 申请类型(如果是一个接口就要使用该字段)
*
* destroy销毁
* Carry外带
*/
@ApiModelProperty(value="申请类型/1.外带/2.销毁--必须传的字段")
private Integer applyType;
}

@ -0,0 +1,22 @@
package digital.laboratory.platform.imr.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@Data
@AllArgsConstructor
public class CombinationOut {
private List<String> sampleIds;//去重数组id
private Integer begin;//计算分页开始数
private Integer size;//每页显示条数
private String name;//模糊匹配名字
}

@ -0,0 +1,61 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 检材/样本存放dto
*
*/
@Data
@ApiModel(value = "样本存放dto")
public class DepositDTO {
//可多个检材存放到一个格子
/**
* buildingLv:'', //楼层
* roomNo:'', //房间号
* boxId: '', //柜子id
* cabinetName
*/
@ApiModelProperty(value="楼层")
private String buildingLv;
@ApiModelProperty(value="房间号")
private String roomNo;
@ApiModelProperty(value="柜子名称")
private String cabinetName;
@ApiModelProperty(value="柜子id")
private String boxId;
/**
* 样本存放id---主键id
*/
@ApiModelProperty(value="样本存放id---主键id")
private List<String> ids;
@ApiModelProperty(value="详细位置")
private String storageLocation;
/**
* 存放格子id
*/
@ApiModelProperty(value="存放格子id")
private String cellId;
@ApiModelProperty(value="格子状态")
private String cellStatus;
}

@ -0,0 +1,52 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "存储dto")
public class DepositToDTO {
@ApiModelProperty(value="楼层")
private String buildingLv;
@ApiModelProperty(value="房间号")
private String roomNo;
@ApiModelProperty(value="柜子名称")
private String cabinetName;
@ApiModelProperty(value="柜子id")
private String boxId;
@ApiModelProperty(value="监督人id")
private String supervisorId;
@ApiModelProperty(value="样本信息")
private List<SampleInfo> sampleInfo;
@ApiModelProperty(value="详细位置")
private String storageLocation;
/**
* 存放格子id
*/
@ApiModelProperty(value="存放格子id")
private String cellId;
@ApiModelProperty(value="格子状态")
private String cellStatus;
@ApiModelProperty(value="入库质量")
private double quality;
}

@ -0,0 +1,16 @@
package digital.laboratory.platform.imr.dto;
import lombok.Data;
import java.util.List;
@Data
public class DestroyOutboundDTO {
private List<String> sampleIds;
private String supervisor;//监督人
}

@ -0,0 +1,54 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class DestructionPublicityDTO {
/**
* 主键id
*/
private String id;
/**
* 审核人id
*/
@ApiModelProperty(value="审核人id")
private String reviewerId;
/**
* 销毁单位
*/
@ApiModelProperty(value="销毁单位")
private String destroyCompany;
/**
* 销毁时间
*/
@ApiModelProperty(value="销毁时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate destroyDate;
/**
* 备注
*/
@ApiModelProperty(value="备注")
private String remarks;
/**
*
*/
@ApiModelProperty(value="销毁公示样本id集合--sampleIds")
private List<String> sampleIds;
}

@ -0,0 +1,22 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@ApiModel(value = "显示图标")
@AllArgsConstructor
public class IconDTO {
@ApiModelProperty(value = "数量")
private Long number;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "描述类型")
private String type;
}

@ -0,0 +1,48 @@
package digital.laboratory.platform.imr.dto;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 入库DTO
*/
@Data
@ApiModel(value = "样本入库dto")
public class InRepositoryDTO {
/**
* 样本编号
*/
@ApiModelProperty(value="样本编号")
private String sampleNo;
/**
* 样本入库时质量(这里更确切应该是流转的质量)
*/
@ApiModelProperty(value="入库质量/体积")
private BigDecimal quality;
/**
* 监督人
*/
@ApiModelProperty(value="监督人")
private String supervisor;
/**
* 计量单位
*/
@ApiModelProperty(value="计量单位")
private String unit;
}

@ -0,0 +1,32 @@
package digital.laboratory.platform.imr.dto;
import java.time.LocalDateTime;
/**
* 内部样本出库DTO
*/
public class InnerSampleOutbound {
/**
* id
* 样本id
*/
private String id;
/**
* 领取人Id
*/
private String recipientId;
/**
* 归还时间
*/
private LocalDateTime returnDate;
/**
* 原因
*/
private String cause;
}

@ -0,0 +1,47 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* 创建出库申请DTO
*/
@Data
public class OutWarehouseApplyDTO implements Serializable {
/**
* 出库用途
*/
@ApiModelProperty(value="出库用途")
private String purpose;
/**
* 归还日期
*/
@ApiModelProperty(value="归还日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate returnDate;
/**
* 鉴定人id
*/
@ApiModelProperty(value="鉴定人id")
private String appraiserId;
/**
* 出库的样本id集合
*/
@ApiModelProperty(value="样本id集合")
List<String> sampleIds;
}

@ -0,0 +1,41 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
@ApiModel(value = "按时间或委托生成检材出入库登记表")
public class PrintTableDTO {
@ApiModelProperty(value = "打印筛选条件1.委托/任务;2.时间")
private Integer type;
@ApiModelProperty(value = "委托/任务id")
private String EventId;
@ApiModelProperty(value = "mf--毛发/wt--委托/ws--污水--其他....")
private String source;
@ApiModelProperty(value = "事件名称")
private String EventName;
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate beginDate;
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate finishDate;
}

@ -0,0 +1,38 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
@ApiModel(value = "PublicityDTO",description = "销毁与公示dto")
public class PublicityDTO {
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate beginDate;
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate finishDate;
@ApiModelProperty(value = "当前申请的状态")
private Integer status;//状态
/**
* 当前页
*/
@ApiModelProperty(value = "当前页")
private Integer current;
/**
* 每页显示条数
*/
@ApiModelProperty(value = "每页显示条数")
private Integer size;
}

@ -0,0 +1,41 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
@ApiModel(value="查询申请通用DTO")
public class QueryApplyDTO {
@ApiModelProperty(value = "申请类型(1.外带//2.销毁)")
private Integer applyType;//名称
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate beginDate;
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate finishDate;
@ApiModelProperty(value = "当前申请的状态")
private Integer status;//状态
/**
* 当前页
*/
@ApiModelProperty(value = "当前页")
private Integer current;
/**
* 每页显示条数
*/
@ApiModelProperty(value = "每页显示条数")
private Integer size;
}

@ -0,0 +1,64 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.util.List;
@Data
@ApiModel(value = "通用的查询参数dto--选择其中部分数据作为查询参数")
public class QueryDTO {
//以下为查询条件
@ApiModelProperty(value = "名称")
private String name;//名称
@ApiModelProperty(value = "样本id集合")
private String sampleIds;//名称
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate beginDate;
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate finishDate;
@ApiModelProperty(value = "状态--必带参数")
private Integer status;//状态
/**
* 当前页
*/
@ApiModelProperty(value = "当前页")
private Integer current;
/**
* 每页显示条数
*/
@ApiModelProperty(value = "每页显示条数")
private Integer size;
@ApiModelProperty(value = "总量")
private Integer total;
@ApiModelProperty(value = "查询类型字段1.按照样本模糊查询;2.按照任务模糊查询")
private Integer type;
@ApiModelProperty(value = "查询参数:房间号")
private String roomNo;
}

@ -0,0 +1,47 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 仓库查询样本DTO
*/
@Data
@ApiModel(value = "仓库查询样本dto")
public class QuerySampleDTO {
@ApiModelProperty(value = "样本名称")
private String name;//名称
@ApiModelProperty(value = "样本类型")
private String sampleType;//
// private String sampleNo;//编号
@ApiModelProperty(value = "入库开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate beginDate;
@ApiModelProperty(value = "入库结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate finishDate;
@ApiModelProperty(value = "状态--必带参数")
private Integer status;//状态
@ApiModelProperty(value = "当前页")
private Integer current;
/**
* 每页显示条数
*/
@ApiModelProperty(value = "每页显示条数")
private Integer size;
}

@ -0,0 +1,32 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 查询房间--柜子--格子对应的dto
*/
@Data
@ApiModel(value = "查询存储相关的dto")
public class QueryStorageDTO {
@ApiModelProperty(value = "id--这个id可以是房间/柜子")
private String id;
@ApiModelProperty(value = "name--这个name可以是房间/柜子")
private String name;
@ApiModelProperty(value = "当前页")
private Integer current;
@ApiModelProperty(value = "每页显示条数")
private Integer size;
}

@ -0,0 +1,32 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 退还出库dto
*/
@Data
@ApiModel(value = "退还出库dto")
public class ReturnOutboundDTO {
@ApiModelProperty(value = "退还出库id集合")
List<String> sampleIds;
@ApiModelProperty(value = "退还单位")
String returnInstitution;
@ApiModelProperty(value = "备注")
String remark;
@ApiModelProperty(value = "监督人")
String supervisor;
}

@ -0,0 +1,40 @@
package digital.laboratory.platform.imr.dto;
import digital.laboratory.platform.imr.entity.enums.ApplyStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.w3c.dom.stylesheets.LinkStyle;
import java.util.List;
/**
* 审核审批DTO
*/
@Data
@ApiModel(value = "ReviewApprovalDTO",description = "审核审批带头")
public class ReviewApprovalDTO {
/**
* 申请id
*/
@ApiModelProperty(value = "申请id")
private String applyId;
@ApiModelProperty(value = "可对单个样本进行审核审批的dto")
private List<ReviewSampleDetail> reviewSampleDetails;
/**
* 审核审批状态(枚举)
*/
@ApiModelProperty(value = "审核审批状态:通过/不通过")
private Integer status;
/**
* 意见
*/
@ApiModelProperty(value = "意见")
private String opinion;
}

@ -0,0 +1,20 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="ReviewSampleDetail",description = "单个审核dto")
public class ReviewSampleDetail {
@ApiModelProperty(value = "单个样本申请明细id--不是sample_id")
private String id;
/**
* 审核审批状态(枚举)
*/
@ApiModelProperty(value = "单个样本审核审批状态:1.通过/-1不通过")
private Integer status;
}

@ -0,0 +1,22 @@
package digital.laboratory.platform.imr.dto;
import lombok.Data;
/**
* 销毁/外带申请查询dto
*/
@Data
public class SampleApplyQueryDTO {
private String name;//名称
private String sampleNo;//编号
private Integer status;//状态
private String applyType;//必带条件;样本类型
}

@ -0,0 +1,17 @@
package digital.laboratory.platform.imr.dto;
import lombok.Data;
@Data
public class SampleInfo {
private String sampleId;
private String sampleName;
private double quality;
}

@ -0,0 +1,25 @@
package digital.laboratory.platform.imr.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ApiModel
@Data
public class UpdateStorageDateDTO {
@ApiModelProperty(value = "id--主键id")
private String id;
@ApiModelProperty(value = "存放期限")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate storageDate;
}

@ -0,0 +1,46 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "通用对象;需要什么就赋值什么")
public class UseOutboundDTO {
@ApiModelProperty(value = "格子id")
private String cellId;
@ApiModelProperty(value = "房间号")
private String roomNo;
@ApiModelProperty(value = "位置")
private String location;
@ApiModelProperty(value = "当前账户密码")
private String password;
@ApiModelProperty(value = "取检码")
private String code;
@ApiModelProperty(value = "监督人id")
private String supervisorId;
@ApiModelProperty(value = "样本id集合")
private List<String> sampleIds;
@ApiModelProperty(value = "样本id")
private String sampleId;
private Integer type;
private Integer number;
private String cabinetId;
}

@ -0,0 +1,18 @@
package digital.laboratory.platform.imr.dto;
import lombok.Data;
@Data
public class UserInfoDTO {
private String name;
private String department;//部门
private String userId;
private String position;
}

@ -0,0 +1,25 @@
package digital.laboratory.platform.imr.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "校验取检码DTO")
public class VerificationCode {
@ApiModelProperty(value = "样本id数组")
private List<String> sampleIds;
@ApiModelProperty(value = "取检码")
private String code;
@ApiModelProperty(value = "监督人")
private String supervisor;
}

@ -0,0 +1,39 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@TableName(value = "association_open", autoResultMap = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "样本关联开箱记录表")
public class AssociationOpen extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* sample_id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
@ApiModelProperty(value="开箱记录id")
private String openId;
}

@ -0,0 +1,70 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
@Data
@TableName(value = "cabinet_opening_record", autoResultMap = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "智能物证柜开箱记录")
public class CabinetOpeningRecord extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 销毁公示id
*/
@ApiModelProperty(value="存储位置:表示那个格子开箱了")
private String storageLocation;
/**
* 开箱时间
*/
@ApiModelProperty(value="开箱时间")
private LocalDateTime openTime;
@ApiModelProperty(value="开箱人--检材管理员")
private String openPerson;
@ApiModelProperty(value="申请人--检材管理员")
private String applyPerson;
@ApiModelProperty(value="监督人--这里直接存名字")
private String supervisor;
@ApiModelProperty(value="开箱类型:1.扫码开柜2.取检码开柜3.强制/点选开柜")
private String openType;
@ApiModelProperty(value="开箱用途:1.检材出库2.检材入库")
private String openPurpose;
@ApiModelProperty(value="仓库,标识是哪一个仓库")
private String warehouse;
}

@ -0,0 +1,51 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-23 11:59:56
* @describe 实体类
*/
@Data
@TableName(value = "destruction_detail", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "销毁公示明细实体类")
public class DestructionDetail extends BaseEntity {
/**
* 主键id
*/
@TableId
@ApiModelProperty(value="主键id")
private String id;
/**
* 销毁公示id
*/
@ApiModelProperty(value="销毁公示id")
private String destructionId;
/**
* 销毁样本id
*/
@ApiModelProperty(value="销毁样本id")
private String sampleId;
}

@ -0,0 +1,86 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import digital.laboratory.platform.imr.entity.enums.ReleaseStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-23 11:57:26
* @describe 实体类
*/
@Data
@TableName(value = "destruction_publicity", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "检材销毁与公示管理")
public class DestructionPublicity extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 申请人id
*/
@ApiModelProperty(value="申请人id")
private String applicantId;
/**
* 审核人id
*/
@ApiModelProperty(value="审核人id")
private String reviewerId;
/**
* 销毁样本数量
*/
@ApiModelProperty(value="销毁样本数量")
private Integer destroyQuantity;
/**
* 销毁单位
*/
@ApiModelProperty(value="销毁单位")
private String destroyCompany;
/**
* 销毁时间
*/
@ApiModelProperty(value="销毁时间")
private LocalDate destroyDate;
/**
* 备注
*/
@ApiModelProperty(value="备注")
private String remarks;
/**
* 未发布/已发布
*/
@ApiModelProperty(value="-1未发布/1已发布")
private Integer status;
/**
* 发布时间
*/
@ApiModelProperty(value="发布时间")
private LocalDateTime ReleaseDate;
}

@ -0,0 +1,103 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 毒品库中关联的案事件信息
* @TableName b_drug_case_info
*/
@TableName(value ="b_drug_case_info")
@Data
public class DrugCaseInfo extends BaseEntity implements Serializable {
/**
* 主键标识
*/
@TableId
private String id;
/**
* 案事件名称
*/
private String caseName;
/**
* 案件编号
*/
private String caseNo;
/**
* 送缴单位
*/
private String handingOverOrg;
/**
* 送缴日期
*/
private LocalDateTime handingOverDate;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DrugCaseInfo other = (DrugCaseInfo) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCaseName() == null ? other.getCaseName() == null : this.getCaseName().equals(other.getCaseName()))
&& (this.getCaseNo() == null ? other.getCaseNo() == null : this.getCaseNo().equals(other.getCaseNo()))
&& (this.getHandingOverOrg() == null ? other.getHandingOverOrg() == null : this.getHandingOverOrg().equals(other.getHandingOverOrg()))
&& (this.getHandingOverDate() == null ? other.getHandingOverDate() == null : this.getHandingOverDate().equals(other.getHandingOverDate()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
&& (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCaseName() == null) ? 0 : getCaseName().hashCode());
result = prime * result + ((getCaseNo() == null) ? 0 : getCaseNo().hashCode());
result = prime * result + ((getHandingOverOrg() == null) ? 0 : getHandingOverOrg().hashCode());
result = prime * result + ((getHandingOverDate() == null) ? 0 : getHandingOverDate().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", caseName=").append(caseName);
sb.append(", caseNo=").append(caseNo);
sb.append(", handingOverOrg=").append(handingOverOrg);
sb.append(", handingOverDate=").append(handingOverDate);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,109 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
/**
* 毒品库中的毒品检材信息
* @TableName b_drug_material_info
*/
@TableName(value ="b_drug_material_info")
@Data
public class DrugMaterialInfo extends BaseEntity implements Serializable {
/**
* 主键标识
*/
@TableId
private String id;
/**
* 关联的案件id
*/
private String caseId;
/**
* 毒品检材编号
*/
private String drugNo;
/**
* 毒品检材名称
*/
private String drugName;
/**
* 质量/体积
*/
private String massVolume;
/**
* 包装是否完整 1 完整 | 0 不完整
*/
private Integer packageComplete;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DrugMaterialInfo other = (DrugMaterialInfo) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCaseId() == null ? other.getCaseId() == null : this.getCaseId().equals(other.getCaseId()))
&& (this.getDrugNo() == null ? other.getDrugNo() == null : this.getDrugNo().equals(other.getDrugNo()))
&& (this.getDrugName() == null ? other.getDrugName() == null : this.getDrugName().equals(other.getDrugName()))
&& (this.getMassVolume() == null ? other.getMassVolume() == null : this.getMassVolume().equals(other.getMassVolume()))
&& (this.getPackageComplete() == null ? other.getPackageComplete() == null : this.getPackageComplete().equals(other.getPackageComplete()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
&& (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCaseId() == null) ? 0 : getCaseId().hashCode());
result = prime * result + ((getDrugNo() == null) ? 0 : getDrugNo().hashCode());
result = prime * result + ((getDrugName() == null) ? 0 : getDrugName().hashCode());
result = prime * result + ((getMassVolume() == null) ? 0 : getMassVolume().hashCode());
result = prime * result + ((getPackageComplete() == null) ? 0 : getPackageComplete().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", caseId=").append(caseId);
sb.append(", drugNo=").append(drugNo);
sb.append(", drugName=").append(drugName);
sb.append(", massVolume=").append(massVolume);
sb.append(", packageComplete=").append(packageComplete);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,102 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-05-08 17:32:13
* @describe 实体类
*/
@Data
@TableName(value = "b_identification_material_transfer_analysis_annex", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "分析样出入库(流转记录附属表)")
public class IdentificationMaterialTransferAnalysisAnnex extends BaseEntity {
/**
* 流转附件表id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="流转附件表id")
private String id;
/**
* 分析样入库时间
*/
@ApiModelProperty(value="分析样入库时间")
private LocalDateTime analysisSampleInboundDate;
/**
* 分析样出库时间
*/
@ApiModelProperty(value="分析样出库时间")
private LocalDateTime analysisSampleOutboundDate;
/**
* 分析样入库质量
*/
@ApiModelProperty(value="分析样入库质量")
private BigDecimal analysisSampleInboundQuality;
/**
* 分析样出库质量
*/
@ApiModelProperty(value="分析样出库质量")
private BigDecimal analysisSampleOutboundQuality;
/**
* 入库样本管理员id
*/
@ApiModelProperty(value="入库样本管理员id")
private String inboundAdminId;
/**
* 出库样本管理员id
*/
@ApiModelProperty(value="出库样本管理员id")
private String outboundAdminId;
/**
* 入库监督人id
*/
@ApiModelProperty(value="入库监督人id")
private String inboundAppraiserId;
/**
* 出库监督人id
*/
@ApiModelProperty(value="出库监督人id")
private String outboundAppraiserId;
/**
* 入库经手人
*/
@ApiModelProperty(value="入库经手人")
private String inboundHandledBy;
/**
* 出库经手人
*/
@ApiModelProperty(value="出库经手人")
private String outboundHandledBy;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
}

@ -0,0 +1,102 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-05-08 17:32:13
* @describe 实体类
*/
@Data
@TableName(value = "b_identification_material_transfer_retained_annex", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "留存样出入库(流转记录附属表)")
public class IdentificationMaterialTransferRetainedAnnex extends BaseEntity {
/**
* 流转附件表id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="流转附件表id")
private String id;
/**
* 留存样入库时间
*/
@ApiModelProperty(value="留存样入库时间")
private LocalDateTime retainedSampleInboundDate;
/**
* 留存样出库时间
*/
@ApiModelProperty(value="留存样出库时间")
private LocalDateTime retainedSampleOutboundDate;
/**
* 留存样入库质量
*/
@ApiModelProperty(value="留存样入库质量")
private BigDecimal retainedSampleInboundQuality;
/**
* 留存样出库质量
*/
@ApiModelProperty(value="留存样出库质量")
private BigDecimal retainedSampleOutboundQuality;
/**
* 入库样本管理员id
*/
@ApiModelProperty(value="入库样本管理员id")
private String inboundAdminId;
/**
* 出库样本管理员id
*/
@ApiModelProperty(value="出库样本管理员id")
private String outboundAdminId;
/**
* 入库监督人id
*/
@ApiModelProperty(value="入库监督人id")
private String inboundAppraiserId;
/**
* 出库监督人id
*/
@ApiModelProperty(value="出库监督人id")
private String outboundAppraiserId;
/**
* 入库经手人
*/
@ApiModelProperty(value="入库经手人")
private String inboundHandledBy;
/**
* 出库经手人
*/
@ApiModelProperty(value="出库经手人")
private String outboundHandledBy;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
}

@ -0,0 +1,24 @@
package digital.laboratory.platform.imr.entity;
import lombok.Data;
@Data
public class InventorySample {
private Integer Number;
private String sampleNo;
private String name;
private String sampleType;
private String storageLocation;
}

@ -0,0 +1,51 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 出库明细
*
* @author Zhang Xiaolong created at 2023-03-17 11:23:41
* @describe 出库明细 实体类
*/
@Data
@TableName(value = "out_warehouse_detailed", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "出库明细")
public class OutWarehouseDetailed extends BaseEntity {
/**
* --主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="--主键id")
private String id;
/**
* 申请id
*/
@ApiModelProperty(value="申请id")
private String applyId;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
}

@ -0,0 +1,39 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 定时任务
*/
@Data
public class PrintSampleInAndOutInfo {
private Integer Number;
private String sampleNo;//执行周期
private String sampleType;
private String warehousingDate;//入库时间
private String outWarehouseDate;//出库时间
private String appraiserName;
private String imName;
private String remarks;
private String returnTime;
}

@ -0,0 +1,141 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import digital.laboratory.platform.imr.entity.enums.ApplyStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 检材申请实体类
*
* 销毁申请+外带申请
* 申请状态用于区分两者
*
* @author Zhang Xiaolong created at 2023-03-17 11:51:42
* @describe 检材申请实体类 实体类
*/
@Data
@TableName(value = "sample_apply", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "检材申请实体类")
public class SampleApply extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 申请人id
*/
@ApiModelProperty(value="申请人id")
private String applicantId;
/**
* 申请日期
*/
@ApiModelProperty(value="申请日期")
private LocalDateTime applicationDate;
/**
* 申请状态
*/
@ApiModelProperty(value="申请状态")
private ApplyStatus applicationStatus;
/**
* 申请重量
*/
@ApiModelProperty(value="申请重量")
private Double applyQuality;
/**
* 重量单位
*/
@ApiModelProperty(value="重量单位")
private String unit;
/**
* 申请数量
*/
@ApiModelProperty(value="申请样本数量数量")
private Integer applyQuantity;
/**
* 审批人审批时间
*/
@ApiModelProperty(value="审批人审批时间")
private LocalDateTime approvalDate;
/**
* 审批人id
*/
@ApiModelProperty(value="审批人id")
private String approverId;
/**
* 审批人意见
*/
@ApiModelProperty(value="审批人意见")
private String approverOpinion;
/**
* 一级审核员id
*/
@ApiModelProperty(value="一级审核员id")
private String firstAuditorId;
/**
* -一级审核时间
*/
@ApiModelProperty(value="-一级审核时间")
private LocalDateTime firstAuditDate;
/**
* 一级审核意见
*/
@ApiModelProperty(value="一级审核意见")
private String firstAuditOpinion;
/**
* 申请原因
*/
@ApiModelProperty(value="申请原因")
private String reason;
/**
* 二级审核时间
*/
@ApiModelProperty(value="二级审核时间")
private LocalDateTime secondaryAuditDate;
/**
* 二级审核意见
*/
@ApiModelProperty(value="二级审核意见")
private String secondaryAuditOpinion;
/**
* 二级审核员id
*/
@ApiModelProperty(value="二级审核员id")
private String secondaryAuditorId;
/**
* 申请类型
*/
@ApiModelProperty(value="申请类型:1.检材外带申请;2.检材销毁申请")
private Integer applyType;
}

@ -0,0 +1,57 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-04-16 23:35:51
* @describe 实体类
*/
@Data
@TableName(value = "sample_apply_detailed", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样本申请明细")
public class SampleApplyDetailed extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
/**
* 申请id
*/
@ApiModelProperty(value="申请id")
private String applyId;
/**
* 1通过/-1不通过
*/
@ApiModelProperty(value="1通过/0.待审核审批/-1不通过")
private Integer status;
}

@ -0,0 +1,89 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-21 10:29:03
* @describe 实体类
*/
@Data
@TableName(value = "sample_inbound_and_outbound_table", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "检材出入库登记表")
public class SampleInboundAndOutboundTable extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 鉴定人
*/
@ApiModelProperty(value="鉴定人")
private String appraiserId;
/**
* 分析样出库时间
*/
@ApiModelProperty(value="分析样出库时间")
private LocalDateTime outWarehouseDate;
/**
* 备注
*/
@ApiModelProperty(value="备注")
private String remarks;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
/**
* 入库时间
*/
@ApiModelProperty(value="入库时间")
private LocalDateTime warehousingDate;
/**
* 检材管理员
*/
@ApiModelProperty(value="检材管理员")
private String imAdministrators;
/**
* 存放人
*/
@ApiModelProperty(value="存放人")
private String recipient;
@ApiModelProperty(value="归还时间")
private LocalDateTime returnTime;
@ApiModelProperty(value="入库监督人")
private String inboundSupervisor;
@ApiModelProperty(value="出库监督人")
private String outboundSupervisor;
}

@ -0,0 +1,70 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-04-10 23:44:10
* @describe 实体类
*/
@Data
@TableName(value = "sample_inbound_record", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "")
public class SampleInboundRecord extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 入库时间
*/
@ApiModelProperty(value="入库时间")
private LocalDateTime warehousingDate;
/**
* 检材管理员
*/
@ApiModelProperty(value="检材管理员")
private String imAdministrators;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
/**
* 入库人id
*/
@ApiModelProperty(value="入库人id")
private String warehousingPersonId;
@ApiModelProperty(value="样本名称")
private String name;
/**
* 备注
*/
@ApiModelProperty(value="备注")
private String remarks;
}

@ -0,0 +1,91 @@
package digital.laboratory.platform.imr.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import digital.laboratory.platform.imr.entity.enums.OutApplyStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 样本出库申请实体类
*
* @author Zhang Xiaolong created at 2023-03-17 11:51:42
* @describe 样本出库申请实体类 实体类
*/
@Data
@TableName(value = "sample_out_warehouse_apply", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样本出库申请实体类")
public class SampleOutWarehouseApply extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 申请人id
*/
@ApiModelProperty(value="申请人id")
private String applicantId;
/**
* 申请时间
*/
@ApiModelProperty(value="申请时间")
private LocalDateTime applicationDate;
/**
* 出库用途
*/
@ApiModelProperty(value="出库用途")
private String purpose;
/**
* 归还日期
*/
@ApiModelProperty(value="归还日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JSONField(format = "yyyy-MM-dd")
private LocalDate returnDate;
/**
* 取检码
*/
@ApiModelProperty(value="取检码")
private String sampleCodeNumber;
/**
* 鉴定人id
*/
@ApiModelProperty(value="鉴定人id")
private String appraiserId;
/**
* 申请状态
*/
@ApiModelProperty(value="申请状态")
private OutApplyStatus status;
/**
* 检材管理员
* */
@ApiModelProperty(value="检材管理员id")
private String imAdministratorsId;
}

@ -0,0 +1,70 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import digital.laboratory.platform.imr.entity.enums.OutboundType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-04-15 10:20:58
* @describe 实体类
*/
@Data
@TableName(value = "sample_outbound_record", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样本出库记录")
public class SampleOutboundRecord extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 样本id
*/
@ApiModelProperty(value="样本id")
private String sampleId;
/**
* 领取人id
*/
@ApiModelProperty(value="领取人id")
private String recipientId;
/**
* 原因/备注
*/
@ApiModelProperty(value="原因/备注")
private String reason;
/**
* 样本名称
*/
@ApiModelProperty(value="样本名称")
private String name;
/**
* 出库类型:1.领用/2.销毁/3.退还
*/
@ApiModelProperty(value="出库类型:1.领用/2.销毁/3.退还")
private OutboundType outboundType;
@ApiModelProperty(value="出库时间")
private LocalDateTime outboundDate;
}

@ -0,0 +1,150 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-27 14:50:05
* @describe 实体类
*
* 样本存储实体类
* 外建表格关联,样本入库时录入
* 录入要判断
*/
@Data
@TableName(value = "b_sample_storage", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样本存储")
public class SampleStorage extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 存储的样本id
*/
@ApiModelProperty(value="存储的样本id")
private String sampleId;
/**
* 存储位置
*/
@ApiModelProperty(value="存储位置")
private String storageLocation;
/**
* 状态:已出库/已入库/待存放
*/
@ApiModelProperty(value="状态:/1.已入库待存放/2.已入库已存放 3.已出库")
private Integer status;
/**
* 存储期限
*/
@ApiModelProperty(value="存储期限")
private LocalDateTime storageDate;
/**
* 存放人;拿来入库的人
*/
@ApiModelProperty(value="存放人ID")
private String depositorId;
/**
* 领取人id
*/
@ApiModelProperty(value="领取人")
private String recipientId;
/**
* 入库时间
*/
@ApiModelProperty(value="入库时间")
private LocalDateTime inRepositoryDate;
/**
* 出库时间
*/
@ApiModelProperty(value="出库时间")
private LocalDateTime outRepositoryDate;
/**
* 存储格子id
*/
@ApiModelProperty(value="存储格子id")
private String storageCellId;
/**
* 销毁标识
*/
@ApiModelProperty(value="销毁标识")
private Integer earlyWarning; //预留的字段 0.还未到销毁;1.已到销毁时间;(2.销毁审核通过;--后端业务字段)
/**
* 质量/体积
*/
@ApiModelProperty(value="质量/体积")
private BigDecimal quality;
/**
* 计量单位
*/
@ApiModelProperty(value="计量单位")
private String unit;
@ApiModelProperty(value="样本名称")
private String name;
@ApiModelProperty(value = "样本类型")
private String sampleType;
@ApiModelProperty(value = "是否需要归还(-1不需要;1.需要归还)")
private Integer isReturn;
@ApiModelProperty(value = "归还时间")
private LocalDate returnTime;
@ApiModelProperty(value = "出库用途")
private String purpose;
@ApiModelProperty(value="楼层")
private String buildingLv;
@ApiModelProperty(value="房间号")
private String roomNo;
@ApiModelProperty(value="柜子名称")
private String cabinetName;
@ApiModelProperty(value="柜子id")
private String boxId;
}

@ -0,0 +1,77 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-17 11:48:03
* @describe 实体类
*/
@Data
@TableName(value = "storage_cell", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "存储格子")
public class StorageCell extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 格子编号
*/
@ApiModelProperty(value="格子编号")
private String cellNo;
/**
* 状态:可用/不可用
*/
@ApiModelProperty(value="是否存放物品 true存放/false未存放")
private Boolean status;
/**
* 排序
*/
@ApiModelProperty(value="排序")
private Long sort;
/**
* 柜子id
*/
@ApiModelProperty(value="柜子id")
private String cupboardId;
/**
* 格子照片
*/
@ApiModelProperty(value="格子照片")
private String cellPhoto;
/**
* 格子描述
*/
@ApiModelProperty(value="格子描述")
private String content;
/**
* 文件名称
*/
@ApiModelProperty(value="文件名称")
private String fileName;
}

@ -0,0 +1,110 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-17 11:45:58
* @describe 实体类
*/
@Data
@TableName(value = "storage_cupboard", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "")
public class StorageCupboard extends BaseEntity {
/**
* 柜子id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="柜子id")
private String id;
/**
* 柜子名称
*/
@ApiModelProperty(value="柜子名称")
private String name;
/**
* 柜子编号
*/
@ApiModelProperty(value="柜子编号")
private String cupboardNo;
/**
* 规格
*/
@ApiModelProperty(value="规格")
private Integer specifications;
/**
* 存储类型(测试)
*/
@ApiModelProperty(value="存储类型(测试)")
private String storageType;
/**
* 状态(存满/为存满)--测试数据
*/
@ApiModelProperty(value="状态(true.正常使用;false停止使用)--测试数据")
private Boolean status;
/**
* 房间id
*/
@ApiModelProperty(value="房间id")
private String roomId;
/**
* 柜子照片
*/
@ApiModelProperty(value="柜子照片")
private String cupboardPhoto;
/**
* updateBy
*/
@ApiModelProperty(value="updateBy")
private String updateBy;
/**
* 排序
*/
@ApiModelProperty(value="排序")
private Long sort;
/**
* 文件名称
*/
@ApiModelProperty(value="文件名称")
private String fileName;
@ApiModelProperty(value="类型:柜子/货架")
private String cupboardType;
@ApiModelProperty(value="1规则/-1不规则")
private Integer rule;
}

@ -0,0 +1,75 @@
package digital.laboratory.platform.imr.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author Zhang Xiaolong created at 2023-03-17 11:44:05
* @describe 实体类
*/
@Data
@TableName(value = "storage_room", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "房间")
public class StorageRoom extends BaseEntity {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="主键id")
private String id;
/**
* 房间名称(冷冻356)
*/
@ApiModelProperty(value="房间名称(冷冻356)")
private String name;
/**
* 房间位置(3楼356)
*/
@ApiModelProperty(value="房间位置(3楼356)")
private String roomLocation;
/**
* 房间照片
*/
@ApiModelProperty(value="房间照片")
private String roomPhoto;
/**
* updateBy
*/
@ApiModelProperty(value="updateBy")
private String updateBy;
/**
* 排序
*/
@ApiModelProperty(value="排序")
private Long sort;
/**
* 文件名称
*/
@ApiModelProperty(value="文件名称")
private String fileName;
}

@ -0,0 +1,31 @@
package digital.laboratory.platform.imr.entity.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 申请的状态
*/
@Getter
@RequiredArgsConstructor
public enum ApplyStatus {
//FAIL
FIRST_LEVEL_FAIL(-2,"一级审核不通过"),
SECOND_LEVEL_FAIL(-3,"二级审核不通过"),
APPROVAL_FAILED(-4,"审批不通过"),
TO_BE_SUBMITTED(0,"已创建待提交"),
WITHDRAWN(-1,"已撤回"),
FIRST_LEVEL(1,"待一级审核"),
SECOND_LEVEL(2,"待二级审核"),
PENDING_APPROVAL(3,"待审批"),
APPROVED(4,"审批通过");
@EnumValue//标记数据库存的值是status
private final int status;
@JsonValue//标记返回前端字段
private final String description;
}

@ -0,0 +1,26 @@
package digital.laboratory.platform.imr.entity.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 出库申请状态
*/
@Getter
@RequiredArgsConstructor
public enum OutApplyStatus {
TO_BE_CONFIRMED(1,"已创建待确认"),
SUCCESS(2,"已确认待使用"),
ALREADY_USED(3,"已使用");
@EnumValue//标记数据库存的值是status
private final int status;
@JsonValue//标记返回前端字段
private final String description;
}

@ -0,0 +1,29 @@
package digital.laboratory.platform.imr.entity.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum OutboundType {
USE(1,"领用出库"),
DESTRUCTION(2,"销毁出库"),
RETURN(3,"退还出库"),
SCANCODE(4,"扫码出库"),
FORCE(5,"强制出库");
@EnumValue//标记数据库存的值是status
private final int status;
@JsonValue//标记返回前端字段
private final String description;
}

@ -0,0 +1,24 @@
package digital.laboratory.platform.imr.entity.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 公示发布状态
*/
@Getter
@RequiredArgsConstructor
public enum ReleaseStatus {
NOT_PUBLISHED(-1,"未发布"),
PUBLISHED(1,"已发布");
@EnumValue//标记数据库存的值是status
private final int status;
@JsonValue//标记返回前端字段
private final String description;
}

@ -0,0 +1,28 @@
package digital.laboratory.platform.imr.entity.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Data;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 样本出入库标识
*/
@Getter
@RequiredArgsConstructor
public enum WarehouseMark {
STORAGE_IN_WAREHOUSE(1,"已入库"),
LEAVE_THE_WAREHOUSE(-1,"已出库");
@EnumValue//标记数据库存的值是mark
private final int mark;
@JsonValue//标记返回前端字段
private final String description;
}

@ -0,0 +1,61 @@
package digital.laboratory.platform.imr.feign;
import digital.laboratory.platform.common.core.constant.SecurityConstants;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.feign.dto.UpdateHolderDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.math.BigDecimal;
/**
* 这个feign接口是用于调整流转模块的其他信息
*/
@FeignClient("dlp-identification-material-transfer")
public interface TransferFeignService {
/*@PutMapping(value = "/sample_transfer/test",headers = SecurityConstants.HEADER_FROM_IN)
@LoadBalanced
public void testTransfer();*/
/**
* 修改样本当前持有人
*/
@PutMapping(value = "/sample/holder",headers = SecurityConstants.HEADER_FROM_IN)
void updateSampleHolder(@RequestBody UpdateHolderDTO dto );//样本id和当前持有人id
/**
* 出库添加流转记录表(不考虑流转质量)
* 入库-->出库也不需要使用质量
*/
@PostMapping(value = "/sample_transfer/out/{sampleId}/{userId}",headers = SecurityConstants.HEADER_FROM_IN)
void addTransferByOut(@PathVariable("sampleId") String sampleId,@PathVariable("userId") String userId);
/**
* 入库添加流转记录表(考虑流转质量)
*/
@PostMapping(value = "/sample_transfer/in/{sampleId}/{unit}/{quality}/{userId}",headers = SecurityConstants.HEADER_FROM_IN)
void addTransferByIn(@PathVariable("sampleId") String sampleId, @PathVariable("unit") String unit, @PathVariable("quality") BigDecimal quality, @PathVariable("userId") String userId);
/**
* 入库添加流转记录表(不考虑流转质量)
*/
@PostMapping(value = "/sample_transfer/inbound/{sampleId}/{userId}",headers = SecurityConstants.HEADER_FROM_IN)
void addTransferByInbound(@PathVariable("sampleId") String sampleId,@PathVariable("userId") String userId);
/**
* 修改当前样本sample表格中状态
*/
@PostMapping(value = "/sample/updateStatus/{sampleId}/{status}",headers = SecurityConstants.HEADER_FROM_IN)
void updateStatus(@PathVariable("sampleId") String sampleId,@PathVariable("status") Integer status);
}

@ -0,0 +1,21 @@
package digital.laboratory.platform.imr.feign.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UpdateHolderDTO {
private String sampleId;//样本id
private String holder;//当前持有人
}

@ -0,0 +1,130 @@
//package digital.laboratory.platform.imr.handle;
//
//import digital.laboratory.platform.common.core.constant.CommonConstants;
//import digital.laboratory.platform.common.core.util.R;
//import digital.laboratory.platform.sys.entity.Dictionary;
//import digital.laboratory.platform.sys.feign.RemoteDictionaryService;
//import lombok.RequiredArgsConstructor;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Optional;
//
///**
// * App 启动类
// * 当 Spring Application 启动完成后, 会调用这个类的 run() 方法进行一些最后的初始化。
// * 我们在这个方法中从数据库加载一些全局的配置
// *
// * @author Zhang Xiaolong
// */
//
//@Component
//@RequiredArgsConstructor
//public class AppStartupRunner implements ApplicationRunner {
//
// // @Value("${dlp.entrustment.processDefinitionId}")
// // public static String processDefinitionId;
//
// //public static boolean clientChoiceCheckers;
// //public static boolean checkerChoiceApprovers;
// //public static boolean singleOperateUser;
//
// // @Value("${dlp.entrustment.temporaryPath}")
// //public static String temporaryPath;
//
// @Value("${dlp.entrustment.entrustmentLetterTemplate}")
// public static String entrustmentLetterTemplate;
//
// private final RemoteDictionaryService remoteDictionaryService;
//
// public static Map<String, String> entrustmentConfig = new HashMap<>();
//
// public static String getCfg(String code) {
// return entrustmentConfig.get(code);
// }
//
// /**
// *
// * @param args 参数
// * @throws Exception 异常
// *
// * // @SysLog("委托受理模块初始化") 这里不能使用 @SysLog(), 因为 SysLog 还没有初始化
// */
// @Override
// public void run(ApplicationArguments args) throws Exception {
//// BusinessCodeUtils.removeSymbols("x-*/)——0*&……%¥#@xasdf!*&^&%^ 中文、/+)(()\n\\xx\rx");
//
// {
// // 加载 entrustment 在字典中的配置
// R<List<Dictionary>> r = remoteDictionaryService.getDictionaryByType(CommonConstants.DLP_TYPE_ENTRUSTMENT);
// if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// List<Dictionary> itemList = r.getData();
// for (Dictionary item : itemList) {
// entrustmentConfig.put(item.getCode(), item.getLabel());
// }
// }
//
// for (String key : entrustmentConfig.keySet()) {
// System.out.println(String.format("entrustmentConfig[%s]=%s", key, entrustmentConfig.get(key)));
// }
// }
//
// // {
// // R<HashMap<String, String>> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_PROCESS_DEFINITION_ID);
// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// // processDefinitionId = r.getData().get("label");
// // }
// // }
// // {
// // R<HashMap<String, String>> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_CLIENT_CHOICE_CHECKERS);
// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// // clientChoiceCheckers = "1".equals(r.getData().get("label"));
// // }
// // }
// // {
// // R<HashMap<String, String>> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_CHECKER_CHOICE_APPROVERS);
// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// // checkerChoiceApprovers = "1".equals(r.getData().get("label"));
// // }
// // }
// // {
// // R<HashMap<String, String>> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_CLIENT_SINGLE_OPERATE_USER);
// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// // singleOperateUser = "1".equals(r.getData().get("label"));
// // }
// // }
// // {
// // R<HashMap<String, String>> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_TEMPORARY_PATH);
// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// // temporaryPath = r.getData().get("label");
// // }
// // if (StrUtil.isEmpty(temporaryPath)) {
// // temporaryPath =new File(System.getProperty("user.dir")+"/temp").getCanonicalPath();
// // }
// //
// // System.out.printf("临时目录是 %s%n", temporaryPath);
// // File tempPathFile = new File(temporaryPath);
// // if (! tempPathFile.exists()) {
// // System.out.printf("临时目录 %s 不存在, 创建之...%n", tempPathFile.getCanonicalPath());
// // if (!tempPathFile.mkdirs()) {
// // System.out.printf("创建临时目录 %s 失败!%n", tempPathFile.getCanonicalPath());
// // }
// // }
// // }
//
// // {
// // R<HashMap<String, String>> r = remoteDictionaryService.innerGetById(CommonConstants.DLP_ENTRUSTMENT_LETTER_TEMPLATE_PATH);
// // if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
// // entrustmentLetterTemplate = r.getData().get("label");
// // }
// // }
//
// }
//
//
//}

@ -0,0 +1,37 @@
package digital.laboratory.platform.imr.interceptor;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
/**
* Feign 请求拦截器
* Feign Client 向业务系统发出请求的时候, Token 带上, 以用户自己的身份调用业务系统
* 目的是在业务系统中识别用户是谁, 允许或禁止用户进行对应的操作
*/
@Configuration
public class FeignOauth2RequestInterceptor implements RequestInterceptor {
private final String AUTHORIZATION_HEADER = "Authorization";
private final String BEARER_TOKEN_TYPE = "Bearer";
@Override
public void apply(RequestTemplate requestTemplate) {
System.out.println(String.format("dlp-repository, FeignOauth2RequestInterceptor()..."));
SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication authentication = securityContext.getAuthentication();
if (authentication != null && authentication.getDetails() instanceof OAuth2AuthenticationDetails) {
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) authentication.getDetails();
System.out.println(String.format("FeignOauth2RequestInterceptor() Authorization, token=%s", details.getTokenValue()));
requestTemplate.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER_TOKEN_TYPE, details.getTokenValue()));
}
}
}

@ -0,0 +1,10 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.AssociationOpen;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AssociationOpenMapper extends BaseMapper<AssociationOpen> {
}

@ -0,0 +1,24 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.CabinetOpeningRecord;
import digital.laboratory.platform.imr.vo.CabinetSampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface CabinetOpeningRecordMapper extends BaseMapper<CabinetOpeningRecord> {
List<CabinetSampleVO> scanCode(@Param("number") String number);
CabinetSampleVO getSampleById(@Param("sampleId")String sampleId);
List<CabinetSampleVO> batchScanCode(@Param("number")String number);
void updateSampleQuality(@Param("sampleId")String sampleId,
@Param("sampleQuality")double sampleQuality);
}

@ -0,0 +1,38 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.dto.UserInfoDTO;
import digital.laboratory.platform.imr.entity.DestructionDetail;
import digital.laboratory.platform.imr.entity.DestructionPublicity;
import digital.laboratory.platform.imr.vo.DestructionPublicityVO;
import digital.laboratory.platform.imr.vo.OutSampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-24
* @describe Mapper
*/
@Mapper
public interface DestructionDetailMapper extends BaseMapper<DestructionDetail> {
/**
* 查询审核人
* @param name
* @param id
* @return
*/
List<UserInfoDTO> getApprove(@Param("name") String name,@Param("userId") String id);
List<OutSampleVO> getPublicityDetail(String id);
}

@ -0,0 +1,42 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.DestructionPublicity;
import digital.laboratory.platform.imr.vo.DestructionPublicityVO;
import digital.laboratory.platform.imr.vo.OutSampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-23
* @describe Mapper
*/
@Mapper
public interface DestructionPublicityMapper extends BaseMapper<DestructionPublicity> {
//List<OutSampleVO> getPublicityDetail(String id);
/**
* 查询单个vo
* @param page
* @param qw
* @return
*/
/*
分页
*/
IPage<DestructionPublicityVO> getDestructionPublicityPage(@Param("page") Page<DestructionPublicity> page, @Param(Constants.WRAPPER) QueryWrapper<DestructionPublicity> qw);
DestructionPublicityVO getPublicityVO(String id);
}

@ -0,0 +1,18 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.DrugCaseInfo;
/**
* @author ChenJiangBao
* @description 针对表b_drug_case_info(毒品库中关联的案事件信息)的数据库操作Mapper
* @createDate 2024-11-07 12:04:42
* @Entity generator.entity.DrugCaseInfo
*/
public interface DrugCaseInfoMapper extends BaseMapper<DrugCaseInfo> {
}

@ -0,0 +1,18 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.DrugMaterialInfo;
/**
* @author ChenJiangBao
* @description 针对表b_drug_material_info(毒品库中的毒品检材信息)的数据库操作Mapper
* @createDate 2024-11-07 12:04:42
* @Entity generator.entity.DrugMaterialInfo
*/
public interface DrugMaterialInfoMapper extends BaseMapper<DrugMaterialInfo> {
}

@ -0,0 +1,21 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.IdentificationMaterialTransferAnalysisAnnex;
import digital.laboratory.platform.imr.vo.AnalysisSample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-05-08
* @describe Mapper
*/
@Mapper
public interface IdentificationMaterialTransferAnalysisAnnexMapper extends BaseMapper<IdentificationMaterialTransferAnalysisAnnex> {
List<AnalysisSample> getSampleTransfer(@Param("sampleId") String sampleId);
}

@ -0,0 +1,21 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.IdentificationMaterialTransferRetainedAnnex;
import digital.laboratory.platform.imr.vo.RetainedSample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-05-08
* @describe Mapper
*/
@Mapper
public interface IdentificationMaterialTransferRetainedAnnexMapper extends BaseMapper<IdentificationMaterialTransferRetainedAnnex> {
List<RetainedSample> getSampleTransfer(@Param("sampleId") String sampleId);
}

@ -0,0 +1,20 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.OutWarehouseDetailed;
import digital.laboratory.platform.imr.vo.OutSampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 出库明细 Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 出库明细 Mapper
*/
@Mapper
public interface OutWarehouseDetailedMapper extends BaseMapper<OutWarehouseDetailed> {
}

@ -0,0 +1,26 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.SampleApplyDetailed;
import digital.laboratory.platform.imr.vo.ApplySampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-04-17
* @describe Mapper
*/
@Mapper
public interface SampleApplyDetailedMapper extends BaseMapper<SampleApplyDetailed> {
/**
* 申请id获取样本详情
* @param id
* @return
*/
List<ApplySampleVO> getDetail(String id);
}

@ -0,0 +1,52 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.SampleApply;
import digital.laboratory.platform.imr.vo.SampleApplyVO;
import digital.laboratory.platform.imr.vo.StatusSampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 检材申请实体类 Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 检材申请实体类 Mapper
*/
@Mapper
public interface SampleApplyMapper extends BaseMapper<SampleApply> {
//SampleApplyVO getSampleApplyInfo(String id);
/**
* 申请vo
* @param page
* @param qw
* @return
*/
//IPage<SampleApplyVO> getApplyVOPage(@Param("page") Page<SampleApply> page, @Param(Constants.WRAPPER)QueryWrapper<SampleApply> qw);
SampleApplyVO getSampleApply(String id);
/**
*
* @param page
* @param qw
* @return
*/
IPage<SampleApplyVO> getApplyPage(@Param("page")Page<SampleApply> page,@Param(Constants.WRAPPER) QueryWrapper<SampleApply> qw);
/**
* 获取样本状态及其他信息
* @param sampleId
* @return
*/
StatusSampleVO getSampleInfo(String sampleId);
}

@ -0,0 +1,82 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.imr.entity.SampleInboundAndOutboundTable;
import digital.laboratory.platform.imr.vo.InAndOutInfos;
import digital.laboratory.platform.imr.vo.RepositorySampleVO;
import digital.laboratory.platform.imr.vo.SampleTableVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-21
* @describe Mapper
*/
@Mapper
public interface SampleInboundAndOutboundTableMapper extends BaseMapper<SampleInboundAndOutboundTable> {
/**
* 出入库登记表信息
* @param sampleId
* @return
*/
List<SampleTableVO> getTableVO(String sampleId);
/**
* 获取单个检材出入库打印对象
* @param sampleId
* @return
*/
List<InAndOutInfos> getInandOutTableInfo(String sampleId);
//根据时间段
List<InAndOutInfos> getInandOutTableInfoByDate(@Param("beginDate") LocalDate beginDate,@Param("finishDate") LocalDate finishDate);
String getEntrustmentName(@Param("id")String entrustmentId,@Param("name")String name);
String getHairJobName(@Param("id")String hairJobId,@Param("name")String name);
String getSewageJobName(@Param("id")String sewageJobId,@Param("name")String name);
String getEventName(@Param("id")String eventId,@Param("name")String name);
String getFeatureName(@Param("id")String eventId,@Param("name")String name);
//分组查询毛发任务id
List<String> queryHairJob();
//分组查询污水任务id
List<String> querySewageJob();
//分组查询委托id
List<String> queryEntrustment();
//分组查询事件id
List<String> queryEvent();
List<String> queryFeature();
//委托样本
List<String> getSampleIdsByEw(@Param("eventId") String eventId);
//毛发样本
List<String> getSampleIdsByHj(@Param("eventId")String eventId);
//污水样本
List<String> getSampleIdsBySj(@Param("eventId")String eventId);
List<String> getSampleIdsByTy(@Param("eventId")String eventId);
List<String> getSampleIdsByTz(@Param("eventId")String eventId);
}

@ -0,0 +1,30 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.SampleInboundRecord;
import digital.laboratory.platform.imr.vo.InboundRecordVO;
import digital.laboratory.platform.imr.vo.RepositorySampleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-04-10
* @describe Mapper
*/
@Mapper
public interface SampleInboundRecordMapper extends BaseMapper<SampleInboundRecord> {
/**
* 入库记录分页
* @param page
* @param qw
* @return
*/
IPage<InboundRecordVO> inboundRecord(@Param("page") Page<SampleInboundRecord> page, @Param(Constants.WRAPPER) QueryWrapper<SampleInboundRecord> qw);
}

@ -0,0 +1,61 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.SampleOutWarehouseApply;
import digital.laboratory.platform.imr.vo.CellVO;
import digital.laboratory.platform.imr.vo.SampleOutWarehouseApplyVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 样本出库申请实体类 Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 样本出库申请实体类 Mapper
*/
@Mapper
public interface SampleOutWarehouseApplyMapper extends BaseMapper<SampleOutWarehouseApply> {
/**
* 获取出库申请信息+明细
*/
SampleOutWarehouseApplyVO getOutApplyDetail(String id);
/**
* 获取出库申请信息+明细第二版
*/
SampleOutWarehouseApplyVO getSampleOutRepositoryInfo(String id);
/**
* 出库申请分页
* @param page
* @param qw
* @return
*/
IPage<SampleOutWarehouseApplyVO> getSampleOutWarehouseApplyVOPage(@Param("page") Page<SampleOutWarehouseApply> page, @Param(Constants.WRAPPER)QueryWrapper<SampleOutWarehouseApply> qw);
/**
* 出库申请列表
* @param qw
* @return
*/
IPage<SampleOutWarehouseApply> getSampleOutWarehouseApplyVOList(@Param(Constants.WRAPPER)QueryWrapper<SampleOutWarehouseApply> qw);
/**
* 通过取检材码获取出库信息
* @param code
* @return
*/
SampleOutWarehouseApplyVO getInfoByCode(@Param("code") String code);
//通过格子ID查询他的位置信息
CellVO getCellLocation(@Param("id") String id);
}

@ -0,0 +1,24 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.SampleOutboundRecord;
import digital.laboratory.platform.imr.vo.OutboundRecordVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-04-15
* @describe Mapper
*/
@Mapper
public interface SampleOutboundRecordMapper extends BaseMapper<SampleOutboundRecord> {
IPage<OutboundRecordVO> outboundRecord(@Param("page") Page<SampleOutboundRecord> page,@Param(Constants.WRAPPER) QueryWrapper<SampleOutboundRecord> qw);
}

@ -0,0 +1,173 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.dto.CombinationOut;
import digital.laboratory.platform.imr.entity.InventorySample;
import digital.laboratory.platform.imr.entity.SampleStorage;
import digital.laboratory.platform.imr.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-27
* @describe Mapper
*/
@Mapper
public interface SampleStorageMapper extends BaseMapper<SampleStorage> {
/**
* sample_storage表中样本详细信息
* @param id
* @return
*/
RepositorySampleVO getSampleDetailed(String id);
/**
* 通过id获取样本信息
* @param sampleId
* @return
*/
OutSampleVO getSampleById(String sampleId);
/**
* 通过编号获取样本信息
* @param sampleNo
* @return
*/
OutSampleVO getSampleByNo(String sampleNo);
/**
* 通过编号获取样本信息集合
* @param sampleNo
* @return
*/
List<OutSampleVO> getSampleListByNo(String sampleNo);
/**
* 待存放样本列表
* @param
* @return
*/
IPage<RepositorySampleVO> getToBeStoredSample(@Param("page") Page<SampleStorage> page,@Param(Constants.WRAPPER)QueryWrapper qw);
/**
* 仓库现有样本分页
* @param page
* @param qw
* @return
*/
IPage<RepositorySampleVO> getSampleVOList(@Param("page") Page<SampleStorage> page,@Param(Constants.WRAPPER) QueryWrapper<SampleStorage> qw);
/**
* 查询仓库现有样本并且状态不在领用中
* @param page
* @param notIn
* @return
*/
IPage<OutSampleVO> getSampleInfo(@Param("page")Page<SampleStorage> page, @Param(Constants.WRAPPER)QueryWrapper<SampleStorage> qw);
List<OutSampleVO> getSampleInfoList(@Param(Constants.WRAPPER)QueryWrapper<SampleStorage> qw);
IPage<BaseSampleVO> getSampleInfoTwo(@Param("page")Page<SampleStorage> page, @Param(Constants.WRAPPER)QueryWrapper<SampleStorage> qw);
/**
* 待归还样本id
* @param page
* @param updateTime
* @return
*/
IPage<ToBeReturnVO> toBeReturned(@Param("page")Page<SampleStorage> page, @Param(Constants.WRAPPER) QueryWrapper<SampleStorage> updateTime);
/*
归还详情
*/
RecipientDTO toBeReturnedDetail(String sampleId);
/**
* 创建申请查询样本接口
* @param samplePage
* @param ne
* @return
*/
IPage<BaseSampleVO> getSampleInfoByHolder(@Param("page") Page<SampleStorage> samplePage,@Param(Constants.WRAPPER) QueryWrapper<SampleStorage> ne);
IPage<BaseSampleVO> getDestructionSample(@Param("page") Page<SampleStorage> samplePage,@Param(Constants.WRAPPER) QueryWrapper<SampleStorage> ne);
/**
* 出库清单数据
* @param ids
* @return
*/
List<InventorySample> getSampleInventory(@Param(Constants.WRAPPER) QueryWrapper<SampleStorage> ne);
/**
* 入库查看样本详情
* @param id
* @return
*/
BaseSampleDetail getSampleDetailInfo(String id);
String getEntrustmentName(@Param("id")String entrustmentId);
String getHairJobName(@Param("id")String hairJobId);
String getSewageJobName(@Param("id")String sewageJobId);
//通用检材受理
String getEventName(@Param("id")String sampleId);
String getFeatureName(@Param("id")String sampleId);
//查询委托方
String returnOutboundQuery(@Param("id")String sampleId);
/*------------额外的测试接口*/
List<OutSampleVO> getWTSample(@Param("dto")CombinationOut combinationOut);
List<OutSampleVO> getWSSample(@Param("dto")CombinationOut combinationOut);
List<OutSampleVO> getMFSample(@Param("dto")CombinationOut combinationOut);
List<OutSampleVO> getSJSample(@Param("dto")CombinationOut combinationOut);
List<OutSampleVO> getTZSample(@Param("dto")CombinationOut combinationOut);
Long getTransferCount(String id);
Long getWitnessCount(String id);
int queryTransfer(@Param("userId")String userId);
String getUserName(@Param("userId")String userId);
List<OutSampleVO> choseSampleList();
double getQuality(@Param("id")String sampleId);
}

@ -0,0 +1,27 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.StorageCell;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe Mapper
*/
@Mapper
public interface StorageCellMapper extends BaseMapper<StorageCell> {
/*
格子分页
*/
IPage<StorageCell> getStorageCellPage(@Param("page") Page<StorageCell> page,@Param(Constants.WRAPPER) QueryWrapper<StorageCell> qw);
}

@ -0,0 +1,26 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.imr.entity.StorageCupboard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe Mapper
*/
@Mapper
public interface StorageCupboardMapper extends BaseMapper<StorageCupboard> {
List<StorageCupboard> getStorageCupboardList(@Param(Constants.WRAPPER)QueryWrapper<StorageCupboard> orderByDesc);
IPage<StorageCupboard> getStorageCupboardPage(@Param("page") Page<StorageCupboard> page,@Param(Constants.WRAPPER) QueryWrapper<StorageCupboard> orderByDesc);
}

@ -0,0 +1,26 @@
package digital.laboratory.platform.imr.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import digital.laboratory.platform.imr.entity.StorageRoom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper 接口
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe Mapper
*/
@Mapper
public interface StorageRoomMapper extends BaseMapper<StorageRoom> {
List<StorageRoom> getStorageRoomList(@Param(Constants.WRAPPER) QueryWrapper<StorageRoom> qw);
List<StorageRoom> getStorageRoomPage(@Param(Constants.WRAPPER)QueryWrapper<StorageRoom> orderByDesc);
}

@ -0,0 +1,9 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.imr.entity.AssociationOpen;
import digital.laboratory.platform.imr.entity.CabinetOpeningRecord;
public interface AssociationOpenService extends IService<AssociationOpen> {
}

@ -0,0 +1,30 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.DepositToDTO;
import digital.laboratory.platform.imr.dto.UseOutboundDTO;
import digital.laboratory.platform.imr.entity.CabinetOpeningRecord;
import digital.laboratory.platform.imr.entity.DestructionPublicity;
import digital.laboratory.platform.imr.vo.CabinetSampleVO;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
public interface CabinetOpeningRecordService extends IService<CabinetOpeningRecord> {
List<CabinetSampleVO> scanCode(String number);
void scanCodePromptInbound(DepositToDTO dto, DLPUser dlpUser);
void scanCodePromptOutbound(UseOutboundDTO dto, DLPUser dlpUser);
void forceOpen(UseOutboundDTO dto, DLPUser dlpUser);
List<CabinetSampleVO> querySampleByCode(String code,String roomNo);
void useOutbound(UseOutboundDTO dto, DLPUser dlpUser);
List<CabinetSampleVO> batchScanCode(String number);
void updateSampleQuality(String sampleId, double sampleQuality);
}

@ -0,0 +1,31 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.DestructionPublicityDTO;
import digital.laboratory.platform.imr.entity.DestructionPublicity;
import digital.laboratory.platform.imr.vo.DestructionPublicityVO;
/**
* 服务类
*
* @author Zhang Xiaolong created at 2023-03-23
* @describe 服务类
*/
public interface DestructionPublicityService extends IService<DestructionPublicity> {
DestructionPublicityVO createPublicity(DestructionPublicityDTO dto, DLPUser dlpUser);
DestructionPublicityVO updatePublicity(DestructionPublicityDTO dto, DLPUser dlpUser);
void deleteOneById(String id);
IPage<DestructionPublicityVO> getDestructionPublicityPage(Page<DestructionPublicity> page, QueryWrapper<DestructionPublicity> eq);
DestructionPublicity getOneById(String id);
DestructionPublicity release(String id);
}

@ -0,0 +1,13 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.imr.entity.DrugCaseInfo;
/**
* @author ChenJiangBao
* @description 针对表b_drug_case_info(毒品库中关联的案事件信息)的数据库操作Service
* @createDate 2024-11-07 12:04:42
*/
public interface DrugCaseInfoService extends IService<DrugCaseInfo> {
}

@ -0,0 +1,13 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.imr.entity.DrugMaterialInfo;
/**
* @author ChenJiangBao
* @description 针对表b_drug_material_info(毒品库中的毒品检材信息)的数据库操作Service
* @createDate 2024-11-07 12:04:42
*/
public interface DrugMaterialInfoService extends IService<DrugMaterialInfo> {
}

@ -0,0 +1,14 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.imr.entity.OutWarehouseDetailed;
/**
* 出库明细服务类
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 出库明细 服务类
*/
public interface OutWarehouseDetailedService extends IService<OutWarehouseDetailed> {
}

@ -0,0 +1,42 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.ReviewApprovalDTO;
import digital.laboratory.platform.imr.entity.SampleApply;
import digital.laboratory.platform.imr.vo.SampleApplyVO;
import java.util.List;
public interface ReviewApprovalService {
/**
* 一级审核
* @param dto
* @param dlpUser
* @return
*/
SampleApplyVO firstAudit(ReviewApprovalDTO dto, DLPUser dlpUser);
/**
* 二级审核
* @param dto
* @param dlpUser
* @return
*/
SampleApplyVO secondaryAudit(ReviewApprovalDTO dto, DLPUser dlpUser);
/**
* 审批
* @param dto
* @param dlpUser
* @return
*/
SampleApplyVO approval(ReviewApprovalDTO dto, DLPUser dlpUser);
//IPage<SampleApplyVO> getAuditPage(Page<SampleApply> page, QueryWrapper<SampleApply> qw);
//List<SampleApplyVO> getAuditList(QueryWrapper<SampleApply> qw);
}

@ -0,0 +1,42 @@
package digital.laboratory.platform.imr.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.imr.dto.ApplyDTO;
import digital.laboratory.platform.imr.entity.SampleApply;
import digital.laboratory.platform.imr.vo.SampleApplyVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 检材申请实体类服务类
*
* @author Zhang Xiaolong created at 2023-03-17
* @describe 检材申请实体类 服务类
*/
public interface SampleApplyService extends IService<SampleApply> {
SampleApplyVO createAndSave(ApplyDTO dto, DLPUser dlpUser);
SampleApplyVO getDetail(String id);
SampleApplyVO createAndSubmit(ApplyDTO dto, DLPUser dlpUser);
SampleApplyVO submitApplyOne(String id);
IPage<SampleApplyVO> getApplyPage(Page<SampleApply> page,QueryWrapper<SampleApply> orderByDesc);
SampleApplyVO withdrawalOne(String id);
void deleteOne(String id);
SampleApplyVO updateAndSubmit(ApplyDTO dto, DLPUser dlpUser);
SampleApplyVO updateAndSave(ApplyDTO dto, DLPUser dlpUser);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save