贵阳委托送检

This commit is contained in:
2024-09-02 09:32:27 +08:00
parent 3cdca51a3e
commit f34a1b290e
245 changed files with 55306 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package digital.laboratory.platform.entrustment;
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.cloud.client.discovery.EnableDiscoveryClient;
@EnableDLPSwagger2
@EnableDLPFeignClients
@EnableDiscoveryClient
@EnableDLPResourceServer
@SpringBootApplication(scanBasePackages="digital.laboratory.platform")
public class EntrustmentApplication {
public static void main(String[] args) {
SpringApplication.run(EntrustmentApplication.class, args);
}
}

View File

@@ -0,0 +1,37 @@
package digital.laboratory.platform.entrustment.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-entrustment, 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()));
}
}
}

View File

@@ -0,0 +1,44 @@
package digital.laboratory.platform.entrustment.Interceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* URL拦截, 做对应处理
*
*/
@Component
public class URLInterceptor implements HandlerInterceptor {
private static final Logger logger = LoggerFactory.getLogger(URLInterceptor.class);
/**
* 请求前置处理(后置处理同理)
*
* @param request
* @param response
* @param handler
* @return boolean
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String path = request.getServletPath();
System.out.println(String.format("(entrustment 中的URL拦截) Request ---> Path=%s", path));
return true;
// logger.info(path);
// if (path.matches("xxxxx")) {
// logger.info("requestUrl: {}", path);
// // 进行前置处理
// return true;
// // 或者 return false; 禁用某些请求
// } else {
// return true;
// }
}
}

View File

@@ -0,0 +1,23 @@
package digital.laboratory.platform.entrustment.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 拦截器注入
*
*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private URLInterceptor urlInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry){
registry.addInterceptor(urlInterceptor);
}
}

View File

@@ -0,0 +1,57 @@
package digital.laboratory.platform.entrustment.config;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public abstract class BaseMybatisList2JsonHandler<T> extends BaseTypeHandler<List<T>> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, List<T> parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public List<T> getNullableResult(ResultSet rs, String columnName)
throws SQLException {
String data = rs.getString(columnName);
List<T> r = StringUtils.isBlank(data) ? null : JSON.parseArray(data, (Class<T>) getRawType());
return r;
}
@Override
public List<T> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String data = rs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : JSON.parseArray(data, (Class<T>) getRawType());
}
@Override
public List<T> getNullableResult(CallableStatement cs, int columnIndex)
throws SQLException {
String data = cs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : JSON.parseArray(data, (Class<T>) getRawType());
}
@Override
public List<T> getResult(ResultSet rs, String columnName) throws SQLException {
List<T> r = super.getResult(rs, columnName);
return r;
}
@Override
public List<T> getResult(ResultSet rs, int columnIndex) throws SQLException {
return super.getResult(rs, columnIndex);
}
@Override
public List<T> getResult(CallableStatement cs, int columnIndex) throws SQLException {
return super.getResult(cs, columnIndex);
}
}

View File

@@ -0,0 +1,60 @@
package digital.laboratory.platform.entrustment.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
public abstract class BaseMybatisMap2JsonHandler<T> extends BaseTypeHandler<HashMap<String, T>> {
protected abstract TypeReference getType();
// typeReference = new InstructionBoHashMap();
@Override
public void setNonNullParameter(PreparedStatement ps, int i, HashMap<String, T> parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public HashMap<String, T> getNullableResult(ResultSet rs, String columnName)
throws SQLException {
String data = rs.getString(columnName);
return StringUtils.isBlank(data) ? null : (HashMap<String, T>)JSON.parseObject(data, getType());
}
@Override
public HashMap<String, T> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String data = rs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : (HashMap<String, T>)JSON.parseObject(data, getType());
}
@Override
public HashMap<String, T> getNullableResult(CallableStatement cs, int columnIndex)
throws SQLException {
String data = cs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : (HashMap<String, T>)JSON.parseObject(data, getType());
}
@Override
public HashMap<String, T> getResult(ResultSet rs, String columnName) throws SQLException {
return super.getResult(rs, columnName);
}
@Override
public HashMap<String, T> getResult(ResultSet rs, int columnIndex) throws SQLException {
return super.getResult(rs, columnIndex);
}
@Override
public HashMap<String, T> getResult(CallableStatement cs, int columnIndex) throws SQLException {
return super.getResult(cs, columnIndex);
}
}

View File

@@ -0,0 +1,72 @@
package digital.laboratory.platform.entrustment.config;
import digital.laboratory.platform.common.core.util.R;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.NoHandlerFoundException;
import java.util.HashMap;
import java.util.Map;
/**
* Spring Boot 自定义异常处理
* 所有的异常都派生自 Exception, 如果我们定义了某个异常的处理 Handler, Spring Boot 会调用用对应的异常 Handler, 否则会调用 Exception Handler.
* 有一个前提是在 application.yml 中定义两个属性, 让 springboot 在没有找到 url 的处理器触发异常; 让 springboot 不要自作多情加 /error 这个 map
* mvc:
* throw-exception-if-no-handler-found: true
* web:
* resources:
* add-mappings: false
* 只有如此, springboot 才会触发异常。
*
*/
@ControllerAdvice
public class ErrorController {
@ExceptionHandler(Exception.class)
@ResponseBody
public ResponseEntity error(Exception ex) {
System.out.println("ErrorController.error Exception");
ex.printStackTrace();
Map<String, Object> map = new HashMap<>();
map.put("Exception", ex.getClass().getName());
map.put("message", ex.getMessage());
map.put("localizedMessage", ex.getLocalizedMessage());
map.put("toString", ex.toString());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(R.failed(map, "发生异常 "+ex.getMessage()));
}
@ExceptionHandler(value = {NoHandlerFoundException.class})
@ResponseBody
public ResponseEntity error(NoHandlerFoundException ex) {
//System.out.println("ErrorController.error NoHandlerFoundException");
//ex.printStackTrace();
// //ex.getRawStatusCode()
Map<String, Object> map = new HashMap<>();
map.put("Exception", ex.getClass().getName());
map.put("message", ex.getMessage());
map.put("localizedMessage", ex.getLocalizedMessage());
map.put("requestURL", ex.getRequestURL());
map.put("httpMethod", ex.getHttpMethod());
// map.put("cause", ex.getCause().toString());
map.put("toString", ex.toString());
// map.put("comments", "单独的 ExceptionHandler, 系统管理捕获的全局异常 NoHandlerFoundException");
// //return map;
// //ResponseEntity<Map<String,Object>> r = new ResponseEntity<Map<String,Object>>(map, HttpStatus.INTERNAL_SERVER_ERROR);
// //ResponseEntity<Map<String,Object>> r = new ResponseEntity<Map<String,Object>>(map, HttpStatus.NOT_FOUND);
// //return r;
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body(map);
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(R.failed(map, "没有找到"));
}
}

View File

@@ -0,0 +1,21 @@
package digital.laboratory.platform.entrustment.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
@Configuration
public class MyDatasources {
@Bean(name = "businessDataSource")
@Primary
@ConfigurationProperties(prefix = "dlp.datasource")
public DataSource primaryDataSource() {
return DataSourceBuilder.create().build();
}
}

View File

@@ -0,0 +1,68 @@
package digital.laboratory.platform.entrustment.config;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import digital.laboratory.platform.sewage.entity.UpdateInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@Slf4j
@MappedTypes({List.class}) // 指定与其关联的 Java 类型列表。 如果在 javaType 属性中也同时指定,则注解上的配置将被忽略。
@MappedJdbcTypes(JdbcType.JAVA_OBJECT) // 注解指定与其关联的 JDBC 类型列表。 如果在 jdbcType 属性中也同时指定,则注解上的配置将被忽略。
// public class ProcessInfoListJsonHandler extends BaseMybatisList2JsonHandler<ProcessInfo> {
// }
public class ProcessInfoListJsonHandler extends BaseTypeHandler<List<UpdateInfo>> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, List<UpdateInfo> parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public List<UpdateInfo> getNullableResult(ResultSet rs, String columnName)
throws SQLException {
String data = rs.getString(columnName);
//List<ProcessInfo> r = StringUtils.isBlank(data) ? null : JSON.parseArray(data, (Class<ProcessInfo>) getRawType());
System.out.println(String.format("ProcessInfoListJsonHandler.getNullableResult, data=%s", data));
List<UpdateInfo> r = StringUtils.isBlank(data) ? null : JSON.parseArray(data, UpdateInfo.class);
return r;
}
@Override
public List<UpdateInfo> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String data = rs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : JSON.parseArray(data, UpdateInfo.class);
}
@Override
public List<UpdateInfo> getNullableResult(CallableStatement cs, int columnIndex)
throws SQLException {
String data = cs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : JSON.parseArray(data, UpdateInfo.class);
}
@Override
public List<UpdateInfo> getResult(ResultSet rs, String columnName) throws SQLException {
List<UpdateInfo> r = super.getResult(rs, columnName);
return r;
}
@Override
public List<UpdateInfo> getResult(ResultSet rs, int columnIndex) throws SQLException {
return super.getResult(rs, columnIndex);
}
@Override
public List<UpdateInfo> getResult(CallableStatement cs, int columnIndex) throws SQLException {
return super.getResult(cs, columnIndex);
}
}

View File

@@ -0,0 +1,70 @@
package digital.laboratory.platform.entrustment.config;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@Slf4j
@MappedTypes({List.class}) // 指定与其关联的 Java 类型列表。 如果在 javaType 属性中也同时指定,则注解上的配置将被忽略。
@MappedJdbcTypes(JdbcType.VARCHAR)
// public class StringListJsonHandler extends BaseMybatisList2JsonHandler<String> {
// }
public class StringListJsonHandler extends BaseTypeHandler<List<String>> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, List<String> parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public List<String> getNullableResult(ResultSet rs, String columnName)
throws SQLException {
String data = rs.getString(columnName);
//List<String> r = StringUtils.isBlank(data) ? null : JSON.parseArray(data, (Class<String>) getRawType());
List<String> r = StringUtils.isBlank(data) ? null : JSON.parseArray(data, String.class);
System.out.println(String.format("StringListJsonHandler.getNullableResult, columnName=%s data=%s r=%s", columnName, data, r));
return r;
}
@Override
public List<String> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String data = rs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : JSON.parseArray(data, String.class);
}
@Override
public List<String> getNullableResult(CallableStatement cs, int columnIndex)
throws SQLException {
String data = cs.getString(columnIndex);
return StringUtils.isBlank(data) ? null : JSON.parseArray(data, String.class);
}
@Override
public List<String> getResult(ResultSet rs, String columnName) throws SQLException {
List<String> r = super.getResult(rs, columnName);
System.out.println(String.format("StringListJsonHandler.getResult, columnName=%s r=%s", columnName, r));
return r;
}
@Override
public List<String> getResult(ResultSet rs, int columnIndex) throws SQLException {
return super.getResult(rs, columnIndex);
}
@Override
public List<String> getResult(CallableStatement cs, int columnIndex) throws SQLException {
return super.getResult(cs, columnIndex);
}
}

View File

@@ -0,0 +1,28 @@
package digital.laboratory.platform.entrustment.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/**");
}
@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();
}
}

View File

@@ -0,0 +1,17 @@
package digital.laboratory.platform.entrustment.config.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "countrydrugsystem.apipath")
@Data
public class ApiPathProperties {
private String tokenPath;
private String taskListPath;
private String receivePath;
private String closePath;
private String rejectPath;
private String returnPath;
}

View File

@@ -0,0 +1,18 @@
package digital.laboratory.platform.entrustment.constant;
/**
* 统计的各个中文名称常量接口
*/
public interface EntrustMarkConstants {
String CASE_ACCEPT = "案件受理";
String REVIEW_OR_APPROVAL = "审核/审批";
String SEWAGE_JOB_ACCEPT = "污水任务受理";
String SUB_CENTERS = "分中心";
String PUBLIC_SECURITY_BUREAU = "公安局";
}

View File

@@ -0,0 +1,87 @@
package digital.laboratory.platform.entrustment.controller;
import cn.hutool.core.util.StrUtil;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import feign.Response;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Enumeration;
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/test" )
public class ATestController {
private final RemoteWord2PDFService remoteWord2PDFService;
@GetMapping("/convert")
public String convert() throws IOException {
File file = new File("E:\\01.鉴定委托书--陕西分中心(1).docx");
FileInputStream fis = new FileInputStream(file);
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", file.getName(), "image/jpg", fis);
Response r = remoteWord2PDFService.word2pdf(mockMultipartFile);
fis.close();
File destFile = new File("E:\\", "test.pdf");
FileUtils.copyInputStreamToFile(r.body().asInputStream(), destFile);
return "OK";
}
@GetMapping("/ip")
public String ip(HttpServletRequest request) throws IOException {
String ret = "";
ret += "Request Headers:\n";
ret += "---------------------------------\n";
Enumeration headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()){
String paramName = (String)headerNames.nextElement();
String paramValue = request.getHeader(paramName);
ret += paramName+" = "+paramValue+"\n";
}
ret += "---------------------------------\n";
ret += "\nrequest.getRequestedSessionId(): "+request.getRequestedSessionId();
ret += "\nrequest.getMethod(): "+request.getMethod();
ret += "\nrequest.getRequestURL(): "+request.getRequestURL();
ret += "\nrequest.getRequestURI(): "+request.getRequestURI();
ret += "\nrequest.getPathInfo(): "+request.getPathInfo();
ret += "\nrequest.getContextPath(): "+request.getContextPath();
ret += "\nrequest.getPathTranslated(): "+request.getPathTranslated();
ret += "\nrequest.getQueryString(): "+request.getQueryString();
ret += "\nrequest.getRemoteUser(): "+request.getRemoteUser();
ret += "\nrequest.getRemoteAddr(): "+request.getRemoteAddr();
ret += "\nrequest.getRemoteHost(): "+request.getRemoteHost();
ret += "\nrequest.getRemotePort(): "+request.getRemotePort();
ret += "\nrequest.getAuthType(): "+request.getAuthType();
ret += "\nrequest.getServletPath(): "+request.getServletPath();
return "<pre>"+ret+"</pre>";
}
String localVar = "";
@GetMapping("/var")
public String var(@RequestParam(value = "var", required = false) String var, HttpServletRequest request) throws IOException {
String ret = "";
if (StrUtil.isNotBlank(var)) {
localVar = var;
ret += "Set localVar to ["+localVar+"]\n";
}
ret += "localVar 的值是 ["+localVar+"]\n";
return "<pre>"+ret+"</pre>";
}
}

View File

@@ -0,0 +1,679 @@
package digital.laboratory.platform.entrustment.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
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.constant.CommonConstants;
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.common.oss.service.OssFile;
//import digital.laboratory.platform.common.security.service.DLPUser;
import digital.laboratory.platform.entrustment.entity.*;
import digital.laboratory.platform.othersys.vo.EntrustDataVo;
import digital.laboratory.platform.entrustment.service.CaseEventService;
import digital.laboratory.platform.entrustment.service.CaseEvidenceService;
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
import digital.laboratory.platform.entrustment.service.EntrustmentService;
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
import digital.laboratory.platform.sys.entity.SysOrg;
import digital.laboratory.platform.sys.feign.RemoteOrgService;
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.ByteArrayInputStream;
import java.io.InputStream;
import java.security.Principal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
/**
* 案件事件
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 案件事件 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/case")
@Api(tags = "001-案件管理")
public class CaseEventController {
private final CaseEventService caseEventService;
private final CaseEvidenceService caseEvidenceService;
private final EntrustmentService entrustmentService;
private final EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
private final RemoteOrgService remoteOrgService;
private final OssFile ossFile;
/**
* 通过id查询案件事件
*
* @param id id
* @param forEdit 如果为true, 表示为编辑而取数据, 返回结果中 caseOwnOrgAncestors 属性为案属机构祖先 id 数组
* @return R<CaseEventVO>
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasAnyPermission('CaseGet')")
public R<CaseEventVO> getById(@PathVariable("id") String id, Boolean forEdit) {
CaseEventVO cevo = caseEventService.getCaseVOById(id);
if ((forEdit != null) && (forEdit)) {
System.out.println(String.format("getById forEdit=%s", forEdit));
R<List<String>> rOrg = remoteOrgService.getAncestorids(cevo.getCaseOwnOrgId());
cevo.setCaseOwnOrgAncestors(rOrg.getData());
System.out.println(String.format("getById forEdit=%s getAncestorids=", forEdit, rOrg));
}
// cevo.setCaseOwnOrgAncestors();
return R.ok(cevo);
}
// /**
// * 分页查询
// * @param page 分页对象
// * @param caseEvent 案件事件
// * @return
// */
// @ApiOperation(value = "分页查询", notes = "分页查询")
// @GetMapping("/page" )
// public R getCaseEventPage(Page page, CaseEvent caseEvent) {
// System.out.println(String.format("getCaseEventPage, caseEvent=%s", caseEvent.toString()));
// return R.ok(caseEventService.page(page, Wrappers.<CaseEvent>query()
// ));
// }
/**
* 分页查询
*
* @param page
* @param fromDate
* @param toDate
* @param caseName
* @param caseType
* @return R<IPage < CaseEventVO>>
*/
@GetMapping("/page")
@PreAuthorize("@pms.hasAnyPermission('CaseList')")
public R<IPage<CaseEventVO>> getCaseEventPage(Page page, String fromDate, String toDate, String caseName, String caseType, String orgId, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (!dlpUser.isStaff()) {
orgId = dlpUser.getOrgId(); // 如果不是鉴定中心员工, 则只能看员工所属机构的案件
}
System.out.println(String.format("getCaseEventPage, fromDate=%s, toDate=%s, caseName=%s, caseType=%s", fromDate, toDate, caseName, caseType));
IPage<CaseEventVO> thePage = caseEventService.getCaseVoPage(page, Wrappers.<CaseEvent>query()
.like(StrUtil.isNotBlank(caseName), "cj.case_name", caseName)
.eq(StrUtil.isNotBlank(caseType), "cj.case_type", caseType)
//.eq(StrUtil.isNotBlank(criminalType), "cj.criminal_type", criminalType)
.eq(StrUtil.isNotBlank(orgId), "cj.case_own_org_id", orgId)
.ge(StrUtil.isNotBlank(fromDate), "cj.happen_time", fromDate)
.le(StrUtil.isNotBlank(toDate), "cj.happen_time", toDate)
.orderByDesc("create_time") //按创建时间降序排序
);
R<IPage<CaseEventVO>> r = R.ok(thePage);
return r;
}
// @GetMapping("/list" )
// //@PreAuthorize("@pms.hasPermission('entrustment_caseevent_get')" )
// public R getCaseEventVOList(String fromDate, String toDate, String caseName, String caseType, String criminalType) {
// System.out.println(String.format("getCaseEventVOList, fromDate=%s, toDate=%s, caseName=%s, caseType=%s, criminalType=%s", fromDate, toDate, caseName, caseType, criminalType));
// return R.ok(caseEventService.getCaseVoList(fromDate, toDate, caseName, caseType, criminalType));
// }
//
/**
* 新增案件事件
*
* @param caseEvent 案件事件
* @return R
*/
@ApiOperation(value = "新增案件事件", notes = "新增案件事件。案件名称是必填项; 案件 id 不需要, 由系统自动生成; 案件编号 caseNo 依赖于案件所属单位和案发日期, 如果提供了这两个属性, 系统会自动生成案件编号")
@SysLog("新增案件、事件")
@PostMapping
@PreAuthorize("@pms.hasAnyPermission('CaseCreate')")
public R postAddObject(@RequestBody CaseEvent caseEvent, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (StrUtil.isEmpty(caseEvent.getCaseName())) {
return R.failed("案件名称不能为空!");
}
if (StrUtil.isBlank(caseEvent.getCaseOwnOrgId())) {
caseEvent.setCaseOwnOrgId(dlpUser.getOrgId()); // 设置案件所属机构为用户所属机构, 即使是鉴定中心员工代录, 也先设置为鉴定中心
} else {
if (!dlpUser.isStaff()) {
if (!StrUtil.equalsIgnoreCase(caseEvent.getCaseOwnOrgId(), dlpUser.getOrgId())) {
return R.failed("案件所属单位必须是你所属单位!");
}
}
}
if (caseEventService.postAddObject(caseEvent)) {
return R.ok(caseEvent, "新增案件成功");
} else {
return R.failed(caseEvent, "新增案件失败");
}
}
/**
* 修改案件事件
*
* @param caseEvent 案件事件
* @return R
*/
@ApiOperation(value = "修改案件事件", notes = "修改案件事件")
@SysLog("修改案件事件")
@PutMapping
@PreAuthorize("@pms.hasAnyPermission('CaseEdit')")
public R putUpdateById(@RequestBody CaseEvent caseEvent, HttpServletRequest theHttpServletRequest) {
if (StrUtil.isBlank(caseEvent.getId())) {
return R.failed(caseEvent, "id 不能为空!");
}
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (!dlpUser.isStaff()) {
// 不是鉴定中心员工, 检查一下案件所属机构与用户是不是同一机构
CaseEvent oldCase = caseEventService.getById(caseEvent.getId());
if (oldCase == null || StrUtil.isBlank(oldCase.getCaseOwnOrgId()) || (!StrUtil.equalsIgnoreCase(oldCase.getCaseOwnOrgId(), dlpUser.getOrgId()))) {
return R.failed(caseEvent, "只能修改自己单位的案件!");
}
}
if (StrUtil.isEmpty(caseEvent.getCaseName())) {
return R.failed(caseEvent, "案件名称不能为空!");
}
if (StrUtil.isBlank(caseEvent.getCaseNo())) {
// 如果没有提供案件编码, 生成一个
if ((caseEvent.getHappenTime() != null) && (StrUtil.isNotBlank(caseEvent.getCaseOwnOrgId()))) {
SysOrg caseOwnOrg = null;
R r = remoteOrgService.getById(caseEvent.getCaseOwnOrgId());
if (r.getCode() == CommonConstants.SUCCESS) {
caseOwnOrg = (SysOrg) r.getData();
Date happenTime = Date.from(caseEvent.getHappenTime().atZone(ZoneId.systemDefault()).toInstant());
;
caseEvent.setCaseNo(caseEventService.getNewCaseCode(caseOwnOrg.getOrgCode(), happenTime));
} else {
return R.failed(String.format("没有找到 orgId 为 %s 的机构, 请确认案件所属机构(CaseOwnOrg)的正确性!", caseEvent.getCaseOwnOrgId()));
}
}
}
caseEvent.setCreateBy(null);
caseEvent.setCreateTime(null);
caseEvent.setUpdateBy(dlpUser.getId());
caseEvent.setUpdateTime(LocalDateTime.now());
if (caseEventService.updateById(caseEvent)) {
return R.ok(caseEvent, "保存案件信息成功");
} else {
return R.failed(caseEvent, "保存案件信息失败");
}
}
/**
* 通过id删除案件事件
* 删除案件的前提是这个案件相关的委托从未提交过, 或根本就没有委托
*
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除案件事件", notes = "通过id删除案件事件")
@SysLog("通过id删除案件事件")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasAnyPermission('CaseDelete')")
public R deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) throws Exception {
if (StrUtil.isBlank(id)) {
return R.failed("必须把 caseId 作为路径的一部分提供!");
}
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
CaseEvent ce = caseEventService.deleteById(id, dlpUser);
if (ce != null) {
return R.ok(ce, "案件删除成功");
} else {
return R.failed(ce, "案件删除失败");
}
}
/**
* 取指定案件的附件列表
*
* @param caseId
* @return
*/
@GetMapping("/attachment/{caseId}/list")
@PreAuthorize("@pms.hasAnyPermission('CaseAttachmentList')")
public R getAttachmentList(@PathVariable("caseId") String caseId) {
CaseEvent cj = caseEventService.getById(caseId);
if (cj != null) {
return R.ok(ossFile.fileList(OSSDirectoryConstants.CASE_DIRECTORY + "/" + caseId));
}
return R.failed("不存在这个案件");
}
/**
* 取指定案件的指定附件
*
* @param caseId
* @param fileName
* @param httpServletResponse
* @throws Exception
*/
@GetMapping("/attachment/{caseId}/{fileName}")
@PreAuthorize("@pms.hasAnyPermission('CaseAttachmentDownload')")
public void getAttachmentObj(@PathVariable("caseId") String caseId, @PathVariable String fileName, HttpServletResponse httpServletResponse) throws Exception {
CaseEvent cj = caseEventService.getById(caseId);
if (cj != null) {
try {
ossFile.fileGet(OSSDirectoryConstants.CASE_DIRECTORY + "/" + caseId + "/" + fileName, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(fileName));
} catch (AmazonS3Exception s3e) {
httpServletResponse.sendError(s3e.getStatusCode(), s3e.toString());
} catch (Exception e) {
httpServletResponse.sendError(501, e.toString());
}
} else {
httpServletResponse.sendError(404, "不存在这个案件");
}
}
@PostMapping(value = "/attachment/{caseId}")
@PreAuthorize("@pms.hasAnyPermission('CaseAttachmentUpload')")
public R uploadAttachmentObj(@PathVariable("caseId") String caseId, @RequestPart("file") MultipartFile file) throws Exception {
System.out.println(String.format("uploadPhotoObj: caseId=%s OriginalFilename=%s", caseId, file.getOriginalFilename()));
CaseEvent cj = caseEventService.getById(caseId);
if (cj != null) {
String path = OSSDirectoryConstants.CASE_DIRECTORY + "/" + caseId;
boolean r = ossFile.fileUpload(file, path);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", FileNameUtil.getName(file.getOriginalFilename()));
ResultData.put("path", path);
if (r) {
return R.ok(ResultData, "上传成功");
}
return R.failed(ResultData, "上传失败");
} else {
return R.failed("不存在这个案件");
}
}
@PostMapping(value = "/attachment_base64/{caseId}")
@PreAuthorize("@pms.hasAnyPermission('CaseAttachmentUpload')")
public R uploadAttachmentObj_Base64(@PathVariable("caseId") String caseId, @RequestBody JSONObject jsonParam) throws Exception {
System.out.println(String.format("uploadPhotoObj: caseId=%s jsonParam.size()=%d", caseId, jsonParam.size()));
CaseEvent cj = caseEventService.getById(caseId);
if (cj != null) {
String image = jsonParam.getString("image");
//System.out.println(String.format("image=%s", image));
if (StringUtils.isNotEmpty(image)) {
try {
String suffix = image.substring(11, image.indexOf(";"));
String fileName = DateUtil.format(new Date(), "yyyyMMddHHmmss") + "." + suffix;
System.out.println(String.format("fileName=[%s]", fileName));
//去掉头信息
String imgBase64 = image.substring(image.indexOf(",") + 1);
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(imgBase64);
InputStream is = new ByteArrayInputStream(decoded);
String path = OSSDirectoryConstants.CASE_DIRECTORY + "/" + caseId;
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
ResultData.put("path", path);
boolean r = ossFile.fileSave(path + "/" + fileName, is);
if (r) {
return R.ok(ResultData, "上传成功");
}
return R.failed("上传失败");
} catch (Exception e) {
e.printStackTrace();
return R.failed("上传失败");
}
} else {
return R.failed("上传的数据中没有图像");
}
}
return R.failed("不存在这个案件");
}
@DeleteMapping("/attachment/{caseId}/{fileName}")
@PreAuthorize("@pms.hasAnyPermission('CaseAttachmentDelete')")
public R deleteAttachmentObj(@PathVariable("caseId") String caseId, @PathVariable String fileName) throws Exception {
CaseEvent cj = caseEventService.getById(caseId);
if (cj != null) {
ossFile.fileDelete(OSSDirectoryConstants.CASE_DIRECTORY + "/" + caseId + "/" + fileName);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
return R.ok(ResultData, "删除文件成功");
}
return R.failed("不存在这个案件");
}
//=====================================================================================
/**
* 通过id删除案件事件, 仅供测试使用, 允许级联删除: 案件/物证/委托/检材/样本
* 删除案件的前提是这个案件相关的委托从未提交过, 或根本就没有委托
*
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除案件事件", notes = "通过id删除案件事件")
@SysLog("通过id删除案件事件")
@DeleteMapping("/admin/{id}")
@PreAuthorize("@pms.hasAnyPermission('CaseAdmin')")
public R test_deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) throws Exception {
if (StrUtil.isBlank(id)) {
return R.failed("必须把 caseId 作为路径的一部分提供!");
}
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
CaseEvent ce = caseEventService.getById(id);
if (ce == null) {
return R.failed(String.format("不存在 caseId 为 %s 的案件!", id));
}
if (!dlpUser.isStaff()) {
// 不是鉴定中心员工, 检查一下案件所属机构与用户是不是同一机构
if (StrUtil.isBlank(ce.getCaseOwnOrgId()) || (!StrUtil.equalsIgnoreCase(ce.getCaseOwnOrgId(), dlpUser.getOrgId()))) {
return R.failed("只能删除自己单位的案件!");
}
}
List<Entrustment> entrustmentList = entrustmentService.list(Wrappers.<Entrustment>query()
.eq("case_id", id)
);
// for (Entrustment e : entrustmentList) {
// if (StrUtil.isNotBlank(e.getProcessInstanceId())) {
// return R.failed(String.format("这个案件的委托 %s 已经提交过, 不能删除!", e.getEntrustmentNo()));
// }
// }
//--- 到这里, 没有委托或者所有委托都没有提交过, 原则上可删除这个案件 ---
// 我们要按顺序删除案件相关的东西
for (Entrustment e : entrustmentList) {
// 删除全部检材
List<EntrustmentIdentificationMaterial> eimList = entrustmentIdentificationMaterialService.list(Wrappers.<EntrustmentIdentificationMaterial>query().eq("entrustment_id", e.getId()));
for (EntrustmentIdentificationMaterial eim : eimList) {
// 删除检材的全部附件
List<String> attList = ossFile.fileList(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + eim.getEntrustmentId() + "/" + eim.getId());
for (String attName : attList) {
ossFile.fileDelete(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + eim.getEntrustmentId() + "/" + eim.getId() + "/" + attName);
}
// 删除检材本身
entrustmentIdentificationMaterialService.removeById(eim.getId());
}
// 删除委托的全部附件
List<String> attList = ossFile.fileList(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + e.getId());
for (String attName : attList) {
ossFile.fileDelete(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + e.getId() + "/" + attName);
}
// 删除委托本身
entrustmentService.removeById(e.getId());
}
// 删除全部物证
List<CaseEvidence> evidenceList = caseEvidenceService.list(Wrappers.<CaseEvidence>query().eq("case_id", id));
for (CaseEvidence evidence : evidenceList) {
// 删除物证的全部附件
List<String> attList = ossFile.fileList(OSSDirectoryConstants.CASE_DIRECTORY + "/" + evidence.getCaseId() + "/" + evidence.getId());
for (String attName : attList) {
ossFile.fileDelete(OSSDirectoryConstants.CASE_DIRECTORY + "/" + evidence.getCaseId() + "/" + evidence.getId() + "/" + attName);
}
// 删除物证本身
caseEvidenceService.removeById(evidence.getId());
}
// 删除案件的全部附件
List<String> attList = ossFile.fileList(OSSDirectoryConstants.CASE_DIRECTORY + "/" + id);
for (String attName : attList) {
ossFile.fileDelete(OSSDirectoryConstants.CASE_DIRECTORY + "/" + id + "/" + attName);
}
if (caseEventService.removeById(id)) {
return R.ok(ce, "案件删除成功");
} else {
return R.failed(ce, "案件删除失败");
}
}
// 获取公安部禁毒大数据平台的数据同步到系统
@ApiOperation(value = "获取公安部禁毒大数据平台的数据同步到系统", notes = "接口格式\n" +
"{\n" +
" \"statusCode\": \"SUCCESS\",\n" +
" \"result\": {\n" +
" \"pageCount\": \"1\",\n" +
" \"recordCount\": \"2\",\n" +
" \"list\": [\n" +
" {\n" +
" \"id\": \"cGwrMERuWW50UXhjZEJzaERkaEgzbjNFU09jQi9DWU4=\",\n" +
" \"entrustSerialNumber\": \"WT-2023-0001\",\n" +
" \"status\": \"toAccept\",\n" +
" \"submitTime\": \"2023-05-26 16:02:58\",\n" +
" \"acceptTime\": \"\",\n" +
" \"finishTime\": \"\",\n" +
" \"entrustOrganization\": \"陕西省西安市新城区禁毒大队\",\n" +
" \"scheduledDate\": \"\",\n" +
" \"createUserDeptRegionCode\": \"610102\",\n" +
" \"caseName\": \"张三涉毒案\",\n" +
" \"materialType\": \"inVitro\",\n" +
" \"materialDescribe\": \"粉末2份塑料袋包装\",\n" +
" \"entrustRequirement\": \"对1号检材中的海洛因进行定性分析对2号检材中的甲基苯丙胺进行定性分析\",\n" +
" \"reportSendType\": \"takeFromOneself\",\n" +
" \"analysisStartTime\": \"\",\n" +
" \"analysisEndTime\": \"\",\n" +
" \"userList\": [\n" +
" {\n" +
" \"name\": \"赵小辉\",\n" +
" \"position\": \"科员\",\n" +
" \"cardType\": \"policeOfficerCard\",\n" +
" \"certificatesCode\": \"001223\",\n" +
" \"phone\": \"13965368974\"\n" +
" },\n" +
" {\n" +
" \"name\": \"吴晓辉\",\n" +
" \"position\": \"科员\",\n" +
" \"cardType\": \"policeOfficerCard\",\n" +
" \"certificatesCode\": \"001224\",\n" +
" \"phone\": \"13789562314\"\n" +
" }\n" +
" ],\n" +
" \"materialList\": [\n" +
" {\n" +
" \"index\": 1,\n" +
" \"name\": \"白色颗粒可疑物\",\n" +
" \"colorType\": \"白色\",\n" +
" \"shapeType\": \"粉末\",\n" +
" \"packageType\": \"塑料袋\",\n" +
" \"amount\": 1,\n" +
" \"unit\": \"gram\",\n" +
" \"targetObjectTypeList\": [\n" +
" \"海洛因\"\n" +
" ],\n" +
" \"analysisType\": \"qualitative\"\n" +
" },\n" +
" {\n" +
" \"index\": 2,\n" +
" \"name\": \"黄色颗粒可疑物\",\n" +
" \"colorType\": \"黄色\",\n" +
" \"shapeType\": \"粉末\",\n" +
" \"packageType\": \"塑料袋\",\n" +
" \"amount\": 1,\n" +
" \"unit\": \"gram\",\n" +
" \"targetObjectTypeList\": [\n" +
" \"甲基苯丙胺\"\n" +
" ],\n" +
" \"analysisType\": \"qualitative\"\n" +
" }\n" +
" ],\n" +
" \"analyseRecordList\": []\n" +
" },\n" +
" {\n" +
" \"id\": \"bk8wMFYvdmdXWlg4SE84amlFQThJbzhHZWdqeDNKeUQ=\",\n" +
" \"status\": \"created\",\n" +
" \"submitTime\": \"\",\n" +
" \"acceptTime\": \"\",\n" +
" \"finishTime\": \"\",\n" +
" \"entrustOrganization\": \"陕西省西安市新城区禁毒大队\",\n" +
" \"scheduledDate\": \"\",\n" +
" \"createUserDeptRegionCode\": \"610102\",\n" +
" \"caseName\": \"王翔涉毒案\",\n" +
" \"materialDescribe\": \"粉末1份、块状固体1份塑料袋包装液体1份塑料瓶包装\",\n" +
" \"entrustRequirement\": \"对1号检材中的甲基苯丙胺、海洛因进行定性、定量分析对2号检材中的氯胺酮进行定性分析对3号检材中的氯胺酮进行定量分析\",\n" +
" \"reportSendType\": \"takeFromOneself\",\n" +
" \"analysisStartTime\": \"\",\n" +
" \"analysisEndTime\": \"\",\n" +
" \"userList\": [\n" +
" {\n" +
" \"name\": \"刘1\",\n" +
" \"position\": \"科员\",\n" +
" \"cardType\": \"policeOfficerCard\",\n" +
" \"certificatesCode\": \"002366\",\n" +
" \"phone\": \"13723569874\"\n" +
" },\n" +
" {\n" +
" \"name\": \"刘2\",\n" +
" \"position\": \"科员\",\n" +
" \"cardType\": \"policeOfficerCard\",\n" +
" \"certificatesCode\": \"002367\",\n" +
" \"phone\": \"13652147896\"\n" +
" }\n" +
" ],\n" +
" \"materialList\": [\n" +
" {\n" +
" \"index\": 1,\n" +
" \"name\": \"白色粉末可疑物\",\n" +
" \"colorType\": \"白色\",\n" +
" \"shapeType\": \"粉末\",\n" +
" \"packageType\": \"塑料袋\",\n" +
" \"amount\": 1,\n" +
" \"unit\": \"gram\",\n" +
" \"targetObjectTypeList\": [\n" +
" \"甲基苯丙胺\",\n" +
" \"海洛因\"\n" +
" ],\n" +
" \"analysisType\": \"qualitativeAndRation\"\n" +
" },\n" +
" {\n" +
" \"index\": 2,\n" +
" \"name\": \"红色块状物\",\n" +
" \"colorType\": \"红色\",\n" +
" \"shapeType\": \"块状固体\",\n" +
" \"packageType\": \"塑料袋\",\n" +
" \"amount\": 10,\n" +
" \"unit\": \"gram\",\n" +
" \"targetObjectTypeList\": [\n" +
" \"氯胺酮\"\n" +
" ],\n" +
" \"analysisType\": \"qualitative\"\n" +
" },\n" +
" {\n" +
" \"index\": 3,\n" +
" \"name\": \"黄色不明物\",\n" +
" \"colorType\": \"黄色\",\n" +
" \"shapeType\": \"液体\",\n" +
" \"packageType\": \"塑料瓶\",\n" +
" \"amount\": 1,\n" +
" \"unit\": \"milliliter\",\n" +
" \"targetObjectTypeList\": [\n" +
" \"氯胺酮\"\n" +
" ],\n" +
" \"analysisType\": \"ration\"\n" +
" }\n" +
" ],\n" +
" \"analyseRecordList\": []\n" +
" }\n" +
" ]\n" +
" }\n" +
"}\n" +
"</pre>")
@SysLog("同步案件信息数据到系统")
@PostMapping("/syncInfo")
public R syncCaseEventInfo(@RequestBody EntrustDataVo entrustDataVo) {
/*JSONObject dataObj = jsonParam.getJSONObject("result");
JSONArray dataObjDetailList = dataObj.getJSONArray("list");*/
Map<String, List<Map<String, String>>> caseEvents = caseEventService.syncCaseEventInfo(entrustDataVo, null, true);
return R.ok(caseEvents);
}
@ApiOperation(value = "检查案件是否能修改", notes = "检查案件是否能修改")
@GetMapping("/checkCaseIsEnableModify")
public R checkCaseIsEnableModify(String caseId) {
return R.ok(caseEventService.checkCaseIsEnableModify(caseId), "获取数据成功");
}
//=====================================================================================
// 测试, 创建 100 个案件
@GetMapping("/create100")
public R xxx_TestCreate100() {
for (int i = 0; i < 100; i++) {
CaseEvent cj = new CaseEvent();
cj.setId(IdWorker.get32UUID().toUpperCase());
String ownOrgId = "520100";
String ownOrgCode = "520100";
cj.setHappenTime(LocalDateTime.now());
cj.setCaseName("" + i + "个测试案件");
cj.setCaseType(String.format("%d", RandomUtil.randomInt(1, 6)));
//cj.setCriminalType(String.format("%d",RandomUtil.randomInt(1, 5)*1000));
cj.setCaseArea(RandomUtil.randomNumbers(6));
cj.setCaseAddress(RandomUtil.randomString(100));
cj.setCaseOwnOrgId(ownOrgId);
// 如果没有提供案件编码, 生成一个
Date happenTime = Date.from(cj.getHappenTime().atZone(ZoneId.systemDefault()).toInstant());
;
cj.setCaseNo(caseEventService.getNewCaseCode(ownOrgCode, happenTime));
if (caseEventService.save(cj)) {
System.out.println("新增案件成功");
} else {
System.out.println("新增案件失败");
}
}
return R.ok("100 of case ware Created");
/*this is new update*/
}
}

View File

@@ -0,0 +1,427 @@
package digital.laboratory.platform.entrustment.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
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.constant.OSSDirectoryConstants;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.core.util.TestUtils;
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.entrustment.entity.CaseEvent;
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
import digital.laboratory.platform.entrustment.service.CaseEventService;
import digital.laboratory.platform.entrustment.service.CaseEvidenceService;
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
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.ByteArrayInputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.security.Principal;
import java.time.LocalDateTime;
import java.util.*;
/**
* 与案件相关的物证信息
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 案件的物证管理 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/case_evidence" )
@Api( tags = "002-案件的物证管理")
public class CaseEvidenceController {
private final CaseEventService caseEventService;
private final CaseEvidenceService caseEvidenceService;
private final OssFile ossFile;
/**
* 通过id查询与案件相关的物证信息
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceGet')" )
public R<CaseEvidence> getById(@PathVariable("id" ) String id) {
return R.ok(caseEvidenceService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param caseEvidence 与案件相关的物证信息
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceList')" )
public R getCaseEvidencePage(Page page, CaseEvidence caseEvidence) {
return R.ok(caseEvidenceService.page(page, Wrappers.query(caseEvidence)));
}
/**
* 查询案件的物证数量
* @param caseId 案件id
* @return
*/
@ApiOperation(value = "查询案件的物证数量", notes = "查询案件的物证数量")
@GetMapping("/count" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceList')" )
public R getCaseEvidenceCount(String caseId) {
long count = caseEvidenceService.countByCaseId(caseId);
Map<String, Long> ret = new HashMap<String, Long>();
ret.put("count", count);
return R.ok(count, "查询案件的物证数量成功");
}
@GetMapping("/list" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceList')" )
public R getCaseEvidenceList(String caseId, String caseNo) {
if (StringUtils.isNotBlank(caseNo))
{
CaseEvent cj = caseEventService.getByCaseNo(caseNo);
if (cj != null)
{
caseId = cj.getId();
}
else
{
System.out.println(String.format("提供的 caseNo=%s 没有查找到对应的 caseId", caseNo));
return R.ok(String.format("提供的 caseNo=%s 没有查找到对应的 caseId", caseNo));
}
}
System.out.println(String.format("getCaseEvidenceList, caseNo=%s, caseId=%s", caseNo, caseId));
if (StringUtils.isNotEmpty(caseId))
{
return R.ok(caseEvidenceService.list(Wrappers.<CaseEvidence>query()
.eq("case_id", caseId)
.orderByDesc("create_time")
));
}
else {
return R.ok("caseId 为空");
}
}
/**
* 新增与案件相关的物证信息
* @param caseEvidence 与案件相关的物证信息
* @return R
*/
@ApiOperation(value = "新增与案件相关的物证信息", notes = "新增与案件相关的物证信息")
@SysLog("新增与案件相关的物证信息" )
@PostMapping
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceCreate')" )
public R postAddObject(@RequestBody CaseEvidence caseEvidence) {
if (StrUtil.isBlank(caseEvidence.getCaseId())) {
return R.failed(caseEvidence, "物证必须与某个案件关联, 必须提供 caseId");
}
CaseEvent cj = caseEventService.getById(caseEvidence.getCaseId());
if (cj == null) {
throw new RuntimeException(String.format("不存在 id 为 %s 的案件", caseEvidence.getCaseId()));
}
if (StrUtil.isBlank(cj.getCaseNo())) {
throw new RuntimeException(String.format("对应的案件资料不完整, 不存在案件编号。请先完善案件资料"));
}
caseEvidence.setId(IdWorker.get32UUID().toUpperCase());
if (StrUtil.isBlank(caseEvidence.getEvidenceNo())) {
caseEvidence.setEvidenceNo(caseEvidenceService.getNewEvidenceCode(cj.getCaseNo()));
}
if (caseEvidenceService.save(caseEvidence)) {
return R.ok(caseEvidence, "新增物证成功");
}
else {
return R.failed(caseEvidence, "新增物证失败");
}
}
/**
* 修改与案件相关的物证信息
* @param caseEvidence 与案件相关的物证信息
* @return R
*/
@ApiOperation(value = "修改与案件相关的物证信息", notes = "修改与案件相关的物证信息")
@SysLog("修改与案件相关的物证信息" )
@PutMapping
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceEdit')" )
public R putUpdateById(@RequestBody CaseEvidence caseEvidence, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (StrUtil.isBlank(caseEvidence.getId())) {
return R.failed(caseEvidence, "物证信息中没有物证标识 id");
}
if (StrUtil.isBlank(caseEvidence.getCaseId())) {
return R.failed(caseEvidence, "物证必须与某个案件关联, 必须提供 caseId");
}
CaseEvent cj = caseEventService.getById(caseEvidence.getCaseId());
if (cj == null) {
throw new RuntimeException(String.format("不存在 id 为 %s 的案件", caseEvidence.getCaseId()));
}
if (StrUtil.isBlank(cj.getCaseNo())) {
throw new RuntimeException(String.format("对应的案件资料不完整, 不存在案件编号。请先完善案件资料"));
}
if (StrUtil.isBlank(caseEvidence.getEvidenceNo())) {
caseEvidence.setEvidenceNo(caseEvidenceService.getNewEvidenceCode(cj.getCaseNo()));
}
caseEvidence.setCreateBy(null);
caseEvidence.setCreateTime(null);
caseEvidence.setUpdateBy(dlpUser.getId());
caseEvidence.setUpdateTime(LocalDateTime.now());
if (caseEvidenceService.updateById(caseEvidence)) {
return R.ok(caseEvidence, "保存物证信息成功");
}
else {
return R.failed(caseEvidence, "保存物证信息失败");
}
}
/**
* 通过id删除与案件相关的物证信息
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除与案件相关的物证信息", notes = "通过id删除与案件相关的物证信息")
@SysLog("通过id删除与案件相关的物证信息" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceDelete')" )
public R deleteById(@PathVariable String id) {
if (StrUtil.isBlank(id)) {
return R.failed("必须把物证 id 作为路径的一部分提供!");
}
CaseEvidence evidence = caseEvidenceService.getById(id);
if (evidence == null) {
return R.failed(String.format("不存在 id 为 %s 的物证", id));
}
List<String> attList = ossFile.fileList(OSSDirectoryConstants.CASE_DIRECTORY + "/"+ evidence.getCaseId() + "/" + id);
long attCount = attList.size();
if (attCount>0) {
return R.failed(String.format("这个物证下有 %d 个附件, 必须先删除全部附件后才能删除物证!", attCount));
}
if (caseEvidenceService.removeById(id)) {
return R.ok(evidence, "物证删除成功");
}
else {
return R.failed(evidence, "物证删除失败");
}
}
/**
* 取指定物证的附件列表
* @param evidenceId
* @return
*/
@GetMapping("/attachment/{evidenceId}/list" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceAttachmentList')" )
public R getAttachmentList(@PathVariable("evidenceId") String evidenceId) {
CaseEvidence ce = caseEvidenceService.getById(evidenceId);
if (ce != null) {
return R.ok(ossFile.fileList(OSSDirectoryConstants.CASE_DIRECTORY + "/"+ ce.getCaseId() + "/" + evidenceId));
}
return R.failed("不存在这个物证");
}
/**
* 取指定物证的指定附件
* @param evidenceId
* @param fileName
* @param httpServletResponse
* @throws Exception
*/
@GetMapping("/attachment/{evidenceId}/{fileName}" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceAttachmentDownload')" )
public void getAttachmentObj(@PathVariable("evidenceId") String evidenceId, @PathVariable String fileName, HttpServletResponse httpServletResponse) throws Exception {
CaseEvidence ce = caseEvidenceService.getById(evidenceId);
if (ce != null) {
try {
ossFile.fileGet(OSSDirectoryConstants.CASE_DIRECTORY + "/" + ce.getCaseId() + "/" + evidenceId + "/" + fileName, httpServletResponse.getOutputStream());
httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(fileName));
} catch (AmazonS3Exception s3e) {
httpServletResponse.sendError(s3e.getStatusCode(), s3e.toString());
} catch (Exception e) {
httpServletResponse.sendError(501, e.toString());
}
}
else {
httpServletResponse.sendError(404, "不存在这个物证");
}
}
@PostMapping(value = "/attachment/{evidenceId}" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceAttachmentUpload')" )
public R uploadAttachmentObj(@PathVariable("evidenceId") String evidenceId, @RequestPart("file") MultipartFile file) throws Exception {
CaseEvidence ce = caseEvidenceService.getById(evidenceId);
if (ce != null) {
System.out.println(String.format("uploadPhotoObj: caseId=%s evidenceId=%s OriginalFilename=%s", ce.getCaseId(), evidenceId, file.getOriginalFilename()));
String path = OSSDirectoryConstants.CASE_DIRECTORY + "/" + ce.getCaseId() + "/" + evidenceId;
boolean r = ossFile.fileUpload(file, path);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", FileNameUtil.getName(file.getOriginalFilename()));
ResultData.put("path", path);
if (r) {
return R.ok(ResultData, "上传成功");
}
return R.failed("上传失败");
}
return R.failed("不存在这个物证");
}
@PostMapping(value = "/attachment_base64/{evidenceId}" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceAttachmentUpload')" )
public R uploadAttachmentObj_Base64(@PathVariable("evidenceId") String evidenceId, @RequestBody JSONObject jsonParam) throws Exception {
CaseEvidence ce = caseEvidenceService.getById(evidenceId);
if (ce != null) {
System.out.println(String.format("uploadPhotoObj: caseId=%s evidenceId=%s jsonParam.size()=%d", ce.getCaseId(), evidenceId, jsonParam.size()));
String image = jsonParam.getString("image");
// System.out.println(String.format("image=%s", image));
if (StringUtils.isNotEmpty(image)) {
try {
String suffix = image.substring(11, image.indexOf(";"));
String fileName = DateUtil.format(new Date(), "yyyyMMddHHmmss") + "." + suffix;
System.out.println(String.format("fileName=[%s]", fileName));
//去掉头信息
String imgBase64 = image.substring(image.indexOf(",") + 1);
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(imgBase64);
InputStream is = new ByteArrayInputStream(decoded);
String path = OSSDirectoryConstants.CASE_DIRECTORY + "/" + ce.getCaseId() + "/" + evidenceId ;
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
ResultData.put("path", path);
boolean r = ossFile.fileSave(path+ "/" + fileName, is);
if (r) {
return R.ok(ResultData, "上传成功");
}
return R.failed("上传失败");
} catch (Exception e) {
e.printStackTrace();
return R.failed("上传失败");
}
}
else {
return R.failed("上传的数据中没有图像");
}
}
else {
return R.failed("不存在这个物证");
}
}
@DeleteMapping("/attachment/{evidenceId}/{fileName}" )
@PreAuthorize("@pms.hasAnyPermission('CaseEvidenceAttachmentDelete')" )
public R deleteAttachmentObj(@PathVariable("evidenceId") String evidenceId, @PathVariable String fileName) throws Exception {
CaseEvidence ce = caseEvidenceService.getById(evidenceId);
if (ce != null) {
ossFile.fileDelete(OSSDirectoryConstants.CASE_DIRECTORY + "/"+ ce.getCaseId() + "/" + evidenceId + "/" + fileName);
Map<String, String> ResultData = new HashMap<>();
ResultData.put("fileName", fileName);
return R.ok(ResultData, "删除文件成功");
}
return R.failed("不存在这个物证");
}
//=====================================================================================
// 测试, 为现有的案件创建一些物证
@GetMapping("/create100" )
public R xxx_TestCreate100() {
List<CaseEventVO> cjs = caseEventService.getCaseVoList(null, null, null, null);
for (CaseEvent cj : cjs) {
int num = RandomUtil.randomInt(1, 100);
for (int i = 0; i < num; i++) {
List<CaseEvidence> ces = caseEvidenceService.list(Wrappers.<CaseEvidence>query()
.eq("case_id", cj.getId()));
if (ces.size()>= num) {
break;
}
CaseEvidence ce = new CaseEvidence();
ce.setId(IdWorker.get32UUID().toUpperCase());
ce.setCaseId(cj.getId());
ce.setEvidenceNo(caseEvidenceService.getNewEvidenceCode(cj.getCaseNo()));
ce.setName(cj.getCaseName()+" 的第 "+i+"个物证");
ce.setType(RandomUtil.randomEle(new String[]{"非生物性物证", "生物特性物证"}));
ce.setFieldLabelNo(String.format("现场标牌 %d 号", RandomUtil.randomInt(1, 200)));
ce.setSource(RandomUtil.randomEle(new String[]{"非生物性物证", "生物特性物证"}));
ce.setForm(RandomUtil.randomEle(new String[]{"液体", "粉末", "颗粒物"}));
ce.setQuantity(BigDecimal.valueOf(Math.round(100*RandomUtil.randomDouble(1, 10))/100.0));
ce.setColor(RandomUtil.randomEle(new String[]{"红色", "绿色", "蓝色", "紫色", "白色", "黑色", "咖啡色"}));
ce.setUnit(RandomUtil.randomEle(new String[]{"", "毫克", "", "毫升", "微升", "", ""}));
ce.setPersonName(TestUtils.genPersonName());
ce.setPersonCert(RandomUtil.randomEle(new String[]{"身份证", "警官证", "军官证", "士兵证", "护照"}));
ce.setPersonId(RandomUtil.randomNumbers(18));
//ce.setPersonGender(RandomUtil.randomEle(new String[]{"男", "女", "不明性别"}));
ce.setPersonGender(RandomUtil.randomInt(0, 2));
ce.setPersonAge(RandomUtil.randomInt(16, 80));
ce.setPersonAddress(RandomUtil.randomString(12));
ce.setPersonNationality(RandomUtil.randomEle(new String[]{"中国", "美国", "英国", "法国", "日本"}));
ce.setPersonNation(RandomUtil.randomInt(1, 20));
ce.setPack(RandomUtil.randomEle(new String[]{"纸袋", "纸盒", "散装", "塑料盒"}));
ce.setDescription(
ce.getName()+", "
+ce.getPack()+"包装,"
+"内含 "+ce.getColor()+ce.getForm()
+" "+ce.getQuantity()+" "+ce.getUnit()
);
if (caseEvidenceService.save(ce)) {
System.out.println("新增物证成功");
}
else {
System.out.println("新增物证失败");
}
}
}
return R.ok("已经为每个案件创建了 100 个物证");
}
}

View File

@@ -0,0 +1,175 @@
package digital.laboratory.platform.entrustment.controller;
import digital.laboratory.platform.common.core.constant.CommonConstants;
import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
import digital.laboratory.platform.entrustment.handler.AppStartupRunner;
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
import digital.laboratory.platform.entrustment.service.SampleBoxService;
import digital.laboratory.platform.sewage.utils.QRCodeUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.springframework.web.bind.annotation.*;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/common")
@Api(tags = "000-基础功能")
public class CommonController {
private final EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
private final OssFile ossFile;
private final SampleBoxService sampleBoxService;
/**
* 根据模板生成检材标签的 html, 供 qz 打印使用
*
* @return R<CaseEventVO>
*/
@ApiOperation(value = "根据模板生成检材标签的 html, 供 qz 打印使用", notes = "根据模板生成检材标签的 html, 供 qz 打印使用")
@GetMapping("/imlabel/{id}")
public String getIdentificationMaterialLabel(@PathVariable("id") String id, HttpServletResponse httpServletResponse) throws Exception {
String templateFileName = AppStartupRunner.getCfg(CommonConstants.DLP_CODE_ENTRUSTMENT_LABEL_TEMPLATE_IDENTIFICATION_MATERIAL);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ossFile.fileGet(OSSDirectoryConstants.TEMPLATE_DIRECTORY + "/"+ templateFileName, bos);
String templateString = bos.toString("UTF-8");
bos.close();
try {
// 设置自定义指令使用的类
Velocity.setProperty("userdirective",
"digital.laboratory.platform.entrustment.misc.VelocityQRCodeImage," +
"digital.laboratory.platform.entrustment.misc.VelocityBarCodeImage");
//初始化模板
Velocity.init();
//获取上下文
VelocityContext context = new VelocityContext();
//把数据填入上下文
EntrustmentIdentificationMaterial im = entrustmentIdentificationMaterialService.getById(id);
if (im == null) {
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", id));
}
context.put("im", im);
StringWriter w = new StringWriter();
Velocity.evaluate(context, w, "Velocity", templateString);
w.flush();
return w.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 生成 QRCODE 图像
*
* @param code QRCODE字符串
*
* @return R<CaseEventVO>
*/
@ApiOperation(value = "生成 QRCODE 图像", notes = "生成 QRCODE 图像")
@GetMapping("/qrcode/{code}")
public void genQRCode(@PathVariable("code") String code, HttpServletResponse httpServletResponse) throws IOException {
try {
// QR Code
httpServletResponse.setContentType("image/png");
BufferedImage qrImage = QRCodeUtils.genQRCode(code, 150, 150);
ImageIO.write(qrImage, "png", httpServletResponse.getOutputStream());
} catch (Exception e) {
httpServletResponse.sendError(501, e.toString());
}
}
/**
* 生成 QRCODE 图像
*
* @param code QRCODE字符串
*
* @return R<CaseEventVO>
*/
@ApiOperation(value = "生成 QRCODE 图像 Base64", notes = "生成 QRCODE 图像 Base64")
@GetMapping("/qrcode64/{code}")
public String getQRCodeImageBase64(@PathVariable("code") String code, HttpServletResponse httpServletResponse) throws IOException {
// QR Code
return QRCodeUtils.getQRCodeImageBase64(code, 150, 150);
}
/**
* 生成 BARCODE 图像
*
* @param code QRCODE字符串
*
* @return R<CaseEventVO>
*/
@ApiOperation(value = "生成 QRCODE 图像", notes = "生成 QRCODE 图像")
@GetMapping("/barcode/{code}")
public void getBarCodeImage(@PathVariable("code") String code, @RequestParam(value = "h", required = false) Integer h, @RequestParam(value = "w", required = false) Integer w, HttpServletResponse httpServletResponse) throws IOException {
int width = 400;
int height = 30;
if ((w != null) && (w > 0)) {
width = w;
}
if ((h != null) && (h > 0)) {
height = h;
}
try {
// QR Code
httpServletResponse.setContentType("image/png");
BufferedImage qrImage = QRCodeUtils.getBarCode128Image(code, width, height);
ImageIO.write(qrImage, "png", httpServletResponse.getOutputStream());
} catch (Exception e) {
httpServletResponse.sendError(501, e.toString());
}
}
/**
* 生成 BARCODE 图像
*
* @param code QRCODE字符串
*
* @return R<CaseEventVO>
*/
@ApiOperation(value = "生成 BARCODE 图像 Base64", notes = "生成 BARCODE 图像 Base64")
@GetMapping("/barcode64/{code}")
public String getBarCodeImageBase64(@PathVariable("code") String code, @RequestParam(value = "h", required = false) Integer h, @RequestParam(value = "w", required = false) Integer w, HttpServletResponse httpServletResponse) throws IOException {
int width = 400;
int height = 30;
if ((w != null) && (w > 0)) {
width = w;
}
if ((h != null) && (h > 0)) {
height = h;
}
return QRCodeUtils.getBarCode128ImageBase64(code, width, height);
}
//盒子标签打印
/**
* 打印盒子的标签
* @param sampleBoxID
* @return
* @throws Exception
*/
@ApiOperation(value = "打印盒子标签", notes = "根据盒子ID打印盒子标签")
@GetMapping("/printBoxLabelBarCode/{sampleBoxID}")
public String getSampleBoxLabel(@PathVariable("sampleBoxID") String sampleBoxID) throws Exception{
return sampleBoxService.buildSampleBoxLabelContent(sampleBoxID);
}
}

View File

@@ -0,0 +1,196 @@
package digital.laboratory.platform.entrustment.controller;
import cn.hutool.core.util.StrUtil;
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.entrustment.entity.Deliverer;
import digital.laboratory.platform.entrustment.service.DelivererService;
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.List;
/**
* 送检员
*
* @author Zhang Xiaolong created at 2022-08-16
* @describe 送检员 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/deliverer" )
@Api(value = "deliverer", tags = "008-送检员管理")
public class DelivererController {
private final DelivererService delivererService;
/**
* 通过id查询送检员
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
public R getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Deliverer deliverer = delivererService.getById(id);
if (deliverer != null) {
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), deliverer.getOwnerUserId())) {
return R.ok(deliverer);
}
else {
return R.failed(String.format("你没有权限访问id为 %s 的送检员的数据", id));
}
}
else {
return R.failed(String.format("没有找到id为 %s 的送检员", id));
}
}
/**
* 列表查询
* @param name 查询条件
* @return
*/
@ApiOperation(value = "列表查询", notes = "列表查询\n" +
"参数:\n" +
"<pre>\n" +
"name 送检员名字, 可以模糊查询, 支持 like %name% " +
"</pre>\n" +
"")
@GetMapping("/list" )
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
public R getDelivererList(@RequestParam(value = "name", required = false)String name, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//deliverer.setOwnerUserId(dlpUser.getId());
List<Deliverer> list = delivererService.list(Wrappers.<Deliverer>query()
.eq("owner_user_id", dlpUser.getId()) // 只查询当前用户拥有的送检员
.like(StrUtil.isNotBlank(name), "name", name)
.orderByDesc("name")
);
return R.ok(list);
}
/**
* 分页查询
* @param page 分页对象
* @param deliverer 送检员
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
public R getDelivererPage(Page page, Deliverer deliverer, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
deliverer.setOwnerUserId(dlpUser.getId());
return R.ok(delivererService.page(page, Wrappers.<Deliverer>query()
.eq("owner_user_id", dlpUser.getId()) // 只查询当前用户拥有的送检员
.like(StrUtil.isNotBlank(deliverer.getName()), "name", deliverer.getName())
.orderByDesc("name")
));
}
/**
* 新增送检员
* @param deliverer 送检员
* @return R
*/
@ApiOperation(value = "新增送检员", notes = "新增送检员")
@SysLog("新增送检员" )
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_add')" )
public R postAddObject(@RequestBody Deliverer deliverer, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
deliverer.setOwnerUserId(dlpUser.getId());
deliverer.setId(IdWorker.get32UUID().toUpperCase());
if (delivererService.save(deliverer)) {
return R.ok(deliverer, "新增送检员成功");
}
else {
return R.failed(deliverer, "新增送检员失败");
}
}
/**
* 修改送检员
* @param deliverer 送检员
* @return R
*/
@ApiOperation(value = "修改送检员", notes = "修改送检员")
@SysLog("修改送检员" )
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_edit')" )
public R putUpdateById(@RequestBody Deliverer deliverer, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Deliverer oldDeliverer = delivererService.getById(deliverer.getId());
if (oldDeliverer != null) {
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), oldDeliverer.getOwnerUserId())) {
deliverer.setOwnerUserId(dlpUser.getId());
return R.ok(delivererService.updateById(deliverer));
}
else {
return R.failed(String.format("你没有权限修改id为 %s 的送检员的数据", deliverer.getId()));
}
}
else {
return R.failed(String.format("没有找到id为 %s 的送检员", deliverer.getId()));
}
}
/**
* 通过id删除送检员
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除送检员", notes = "通过id删除送检员")
@SysLog("通过id删除送检员" )
@DeleteMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_del')" )
public R deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Deliverer oldDeliverer = delivererService.getById(id);
if (oldDeliverer != null) {
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), oldDeliverer.getOwnerUserId())) {
if (delivererService.removeById(id)) {
return R.ok(oldDeliverer, "送检员删除成功");
}
else {
return R.failed(oldDeliverer, "送检员删除失败");
}
}
else {
return R.failed(String.format("你没有权限删除id为 %s 的送检员", id));
}
}
else {
return R.failed(String.format("没有找到id为 %s 的送检员", id));
}
}
}

View File

@@ -0,0 +1,167 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.entity.Identification;
import digital.laboratory.platform.entrustment.service.CaseEventService;
import digital.laboratory.platform.entrustment.service.EntrustmentService;
import digital.laboratory.platform.entrustment.service.IdentificationService;
import digital.laboratory.platform.entrustment.vo.IdentificationVO;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 鉴定表,一个鉴定可能会有多个委托
*
* @author Zhang Xiaolong created at 2022-07-15
* @describe 鉴定表,一个鉴定可能会有多个委托 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/identification" )
@Api(value = "identification", tags = "006-鉴定表,一个鉴定可能会有多个委托管理")
public class IdentificationController {
private final IdentificationService identificationService;
@Resource
private CaseEventService caseEventService;
@Resource
private EntrustmentService entrustmentService;
/**
* 通过id查询鉴定表,一个鉴定可能会有多个委托
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_identification_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(identificationService.getById(id));
}
/**
* 废弃了xxxx
* 根据 caseId 取 IdentificationVO 列表, 每个 Entrustment 一行
* @param caseId
* @return R
*/
@ApiOperation(value = "根据 caseId 取 IdentificationVO 列表, 每个 Entrustment 一行", notes = "根据 caseId 取 IdentificationVO 列表, 每个 Entrustment 一行")
@GetMapping("/vo_list_by_case_id" )
// @PreAuthorize("@pms.hasPermission('entrustment_identification_get')" )
public R<List<IdentificationVO>> getIdentificationVOList(String caseId) {
return R.ok(identificationService.getIdentificationVOList(caseId));
}
/**
* 根据 caseId 取 Identification 列表, 供新建的补充委托选择老的 Identification(鉴定), 以使新建的委托作为老的鉴定的一部分
* @param caseId
* @return
*/
@ApiOperation(value = "根据 caseId 取 Identification 列表, 供新建的补充委托选择老的 Identification(鉴定), 以使新建的委托作为老的鉴定的一部分",
notes = "根据 caseId 取 Identification 列表, 供新建的补充委托选择老的 Identification(鉴定), 以使新建的委托作为老的鉴定的一部分")
@GetMapping("/list_by_case" )
// @PreAuthorize("@pms.hasPermission('entrustment_identification_get')" )
public R<List<Entrustment>> getIdentificationListByCaseId(String caseId) {
//return R.ok(identificationService.getIdentificationListByCaseId(caseId));
//求出case 下的委托,并且这些委托是受理后的
List<Entrustment> entrustmentList=entrustmentService.list(Wrappers.<Entrustment>query()
.eq("case_id",caseId)
.ge("status",8)
.le("status",90));
return R.ok(entrustmentList,"获取数据成功");
}
/**
* 分页查询
* @param page 分页对象
* @param identification 鉴定表,一个鉴定可能会有多个委托
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('entrustment_identification_get')" )
public R getIdentificationPage(Page page, Identification identification) {
return R.ok(identificationService.page(page, Wrappers.query(identification)));
}
/**
* 新增鉴定表,一个鉴定可能会有多个委托
* @param identification 鉴定表,一个鉴定可能会有多个委托
* @return R
*/
@ApiOperation(value = "新增鉴定表,一个鉴定可能会有多个委托", notes = "新增鉴定表,一个鉴定可能会有多个委托")
@SysLog("新增鉴定表,一个鉴定可能会有多个委托" )
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_identification_add')" )
public R postAddObject(@RequestBody Identification identification) {
identification.setId(IdWorker.get32UUID().toUpperCase());
if (identificationService.save(identification)) {
return R.ok(identification, "新增鉴定成功");
}
else {
return R.failed(identification, "新增鉴定失败");
}
}
/**
* 修改鉴定表,一个鉴定可能会有多个委托
* @param identification 鉴定表,一个鉴定可能会有多个委托
* @return R
*/
@ApiOperation(value = "修改鉴定表,一个鉴定可能会有多个委托", notes = "修改鉴定表,一个鉴定可能会有多个委托")
@SysLog("修改鉴定表,一个鉴定可能会有多个委托" )
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_identification_edit')" )
public R putUpdateById(@RequestBody Identification identification) {
return R.ok(identificationService.updateById(identification));
}
/**
* 通过id删除鉴定表,一个鉴定可能会有多个委托
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除鉴定表,一个鉴定可能会有多个委托", notes = "通过id删除鉴定表,一个鉴定可能会有多个委托")
@SysLog("通过id删除鉴定表,一个鉴定可能会有多个委托" )
@DeleteMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_identification_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(identificationService.removeById(id));
}
@GetMapping("/create10")
public R create10() {
int foo = 10;
for (int i = 0; i < foo; i++) {
Identification identification = new Identification();
identification.setId(IdWorker.get32UUID().toUpperCase());
String idNo = identificationService.getNewIdentificationNo();
System.out.printf("新的 id=%s identificationNo = %s\n", identification.getId(), idNo);
identification.setIdentificationNo(idNo);
identification.setStatus(0);
identificationService.save(identification);
}
return R.ok("Create 10 Identification samples OK");
}
}

View File

@@ -0,0 +1,315 @@
package digital.laboratory.platform.entrustment.controller;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.entrustment.entity.*;
import digital.laboratory.platform.entrustment.mapper.EntrustmentMapper;
import digital.laboratory.platform.entrustment.service.EntrustmentIdentificationMaterialService;
import digital.laboratory.platform.entrustment.service.SampleBoxService;
import digital.laboratory.platform.entrustment.service.SampleService;
import digital.laboratory.platform.entrustment.vo.SampleBoxLiteVO;
import digital.laboratory.platform.entrustment.vo.SampleBoxVO;
import digital.laboratory.platform.sewage.entity.SewageJob;
import digital.laboratory.platform.sys.entity.entrustment.Sample;
import digital.laboratory.platform.sys.entity.entrustment.SampleBox;
import digital.laboratory.platform.sewage.feign.RemoteSewageJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 受理时样品重新包装的容器
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 受理时检材重新包装的容器 前端控制器
*/
@RestController
@RequestMapping("/papp/entrustment/sample_box")
@Api(value = "sample_box", tags = "005-受理时样品重新包装的容器管理")
public class SampleBoxController {
@Resource
private SampleBoxService sampleBoxService;
@Resource
private SampleService sampleService;
@Resource
private EntrustmentIdentificationMaterialService entrustmentIdentificationMaterialService;
@Resource
private EntrustmentMapper entrustmentMapper;
@Resource
private RemoteSewageJobService remoteSewageJobService;
/**
* 通过id查询受理时样品重新包装的容器
*
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_get')" )
public R<SampleBox> getSampleBoxById(@PathVariable("id") String id) {
return R.ok(sampleBoxService.getById(id));
}
/**
* 分页查询
*
* @param page 分页对象
* @param sampleBox 受理时样品重新包装的容器
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page")
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_get')" )
public R getSampleBoxPage(Page page, SampleBox sampleBox) {
return R.ok(sampleBoxService.page(page, Wrappers.query(sampleBox)));
}
/**
* 列表查询
*
* @param sampleBox 受理时样品重新包装的容器
* @return
*/
@ApiOperation(value = "列表查询", notes = "列表查询")
@GetMapping("/list")
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_get')" )
public R<List<SampleBoxVO>> getSampleBoxList(SampleBox sampleBox) {
// List<String> boxIds=new ArrayList<>();
// List<SampleBox> list = sampleBoxService.list(Wrappers.query(sampleBox));
// list.forEach(item->{
// //查询盒子中的样本数量
// boxIds.add(item.getId());
// });
return R.ok(sampleBoxService.getSampleBoxList(sampleBox));
}
/**
* 新增受理时样品重新包装的容器
*
* @param sampleBox 受理时样品重新包装的容器
* @return R
*/
@ApiOperation(value = "新增受理时样品重新包装的容器", notes = "新增受理时样品重新包装的容器")
@SysLog("新增受理时样品重新包装的容器")
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_add')" )
public R post_CreateNewSampleBox(@RequestBody SampleBox sampleBox) {
if (StrUtil.equalsIgnoreCase(sampleBox.getSource(), "entrustment")) {
if (sampleBox.getEntrustmentId() == null) {
throw new RuntimeException("样本盒必须与某个委托关联, 缺少 entrustmentId");
}
Entrustment entrustment = entrustmentMapper.selectById(sampleBox.getEntrustmentId());
if (entrustment == null) {
throw new RuntimeException(String.format("不存在 id 为 %s 的委托", sampleBox.getEntrustmentId()));
}
if (StrUtil.isBlank(sampleBox.getBoxNo())) {
sampleBox.setBoxNo(sampleBoxService.getNewBoxNoForEntrustment(entrustment.getEntrustmentNo()));
}
} else if (StrUtil.equalsIgnoreCase(sampleBox.getSource(), "sewageJob")) {
if (sampleBox.getJobId() == null) {
throw new RuntimeException("样本盒必须与某个污水任务关联, 缺少 jobId");
}
SewageJob sewageJob = remoteSewageJobService.getSewageJobById(sampleBox.getJobId()).getData();
if (sewageJob == null) {
throw new RuntimeException(String.format("不存在 id 为 %s 的污水任务", sampleBox.getJobId()));
}
if (StrUtil.isBlank(sampleBox.getBoxNo())) {
sampleBox.setBoxNo(sampleBoxService.getNewBoxNoForSewageJob(sewageJob.getJobNo()));
}
}
sampleBox.setId(sampleBoxService.getOrderIdBy16UUId());
if (sampleBoxService.save(sampleBox)) {
return R.ok(sampleBox, "新增样本盒成功");
} else {
return R.failed(sampleBox, "新增样本盒失败");
}
}
/**
* 修改受理时样品重新包装的容器
*
* @param sampleBox 受理时样品重新包装的容器
* @return R
*/
@ApiOperation(value = "修改受理时样品重新包装的容器", notes = "修改受理时样品重新包装的容器")
@SysLog("修改受理时样品重新包装的容器")
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_edit')" )
public R put_UpdateById(@RequestBody SampleBox sampleBox) {
return R.ok(sampleBoxService.updateById(sampleBox));
}
/**
* 通过id删除受理时样品重新包装的容器
*
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除受理时样品重新包装的容器", notes = "通过id删除受理时样品重新包装的容器")
@SysLog("通过id删除受理时样品重新包装的容器")
@DeleteMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_del')" )
public R deleteById(@PathVariable String id) {
// 受理期间的样本, 还未受理完成
SampleBoxLiteVO sblv = sampleBoxService.getSampleBoxLiteVOById(id);
if (sblv == null) {
throw new RuntimeException(String.format("没有这个样本盒, id=%s", id));
}
if (sblv.getSampleNoList().size() > 0) {
throw new RuntimeException(String.format("这个样本盒中还有样品, 你必须清除其中的样品后才能删除它"));
}
// 受理结束后的样本
SampleBoxVO sbv = sampleBoxService.getSampleBoxVOById(id);
if (sbv == null) {
throw new RuntimeException(String.format("没有这个样本盒, id=%s", id));
}
if (sbv.getSampleList().size() > 0) {
throw new RuntimeException(String.format("这个样本盒中还有样品, 你必须清除其中的样品后才能删除它"));
}
// 盒子中没有东西了,可以删除之
if (sampleBoxService.removeById(id)) {
return R.ok(sbv, "案件删除成功");
} else {
return R.failed(sbv, "案件删除失败");
}
}
/**
* 添加样本到盒子中
*
* @param boxId 盒子的 Id
* @param sampleId 样本的 Id
* @return R
*/
@ApiOperation(value = "添加样本到盒子中", notes = "添加样本到盒子中")
@SysLog("添加样本到盒子中")
@PutMapping(value = "/{boxId}/add_sample")
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_edit')" )
public R put_AddSampleToBox(@PathVariable String boxId, String sampleId) {
SampleBox box = sampleBoxService.getById(boxId);
if (box == null) {
throw new RuntimeException(String.format("不存在这个样本盒, Id=%s", boxId));
}
Sample sample = sampleService.getById(sampleId);
if (sample == null) {
throw new RuntimeException(String.format("不存在这个样本, Id=%s", sampleId));
}
sample.setBoxId(boxId);
if (sampleService.updateById(sample)) {
return R.ok(sample, "添加检材中的样本到盒子中成功");
} else {
return R.failed(sample, "添加检材中的样本到盒子失败");
}
}
/**
* 添加检材中的样本到盒子中
*
* @param boxId 盒子的 Id
* @param IdentificationMaterialId 检材的 Id
* @param IdentificationMaterialSampleSerial 检材中的样本序号
* @return R
*/
@ApiOperation(value = "添加检材中的样本到盒子中", notes = "添加检材中的样本到盒子中")
@SysLog("添加检材中的样本到盒子中")
@PutMapping(value = "/{boxId}/add_im_sample")
// @PreAuthorize("@pms.hasPermission('entrustment_sample_box_edit')" )
public R put_AddIMSampleToBox(@PathVariable String boxId, String IdentificationMaterialId, int IdentificationMaterialSampleSerial) {
SampleBox box = sampleBoxService.getById(boxId);
if (box == null) {
throw new RuntimeException(String.format("不存在这个样本盒, Id=%s", boxId));
}
EntrustmentIdentificationMaterial im = entrustmentIdentificationMaterialService.getById(IdentificationMaterialId);
if (im == null) {
throw new RuntimeException(String.format("不存在这个检材, Id=%s", IdentificationMaterialId));
}
if (IdentificationMaterialSampleSerial == 1) {
im.setSample1BoxId(boxId);
} else if (IdentificationMaterialSampleSerial == 2) {
im.setSample2BoxId(boxId);
} else {
throw new RuntimeException(String.format("一个检材只能分为2个样, 不会有样本序号不会大于2"));
}
if (entrustmentIdentificationMaterialService.updateById(im)) {
return R.ok(im, "添加检材中的样本到盒子中成功");
} else {
return R.failed(im, "添加检材中的样本到盒子失败");
}
}
//=====================================================================================
// 测试, 创建 100 个案件
@ApiOperation(value = "测试用: 创建 10 个样本盒子", notes = "创建 10 个样本盒子")
@GetMapping("/create100")
public R xxx_TestCreate100() {
for (int i = 0; i < 10; i++) {
SampleBox box = new SampleBox();
box.setBoxType(RandomUtil.randomEle(new String[]{"小盒", "中盒", "大盒", "小箱", "中箱", "大箱", "文件盒", "特殊"}));
box.setId(IdWorker.get32UUID().toUpperCase());
sampleBoxService.save(box);
}
return R.ok("100 of SampleBox ware Created");
}
@ApiOperation(value = "打印包装袋条码,参数id:包装袋ID\n" +
"type 0:小标签条码1大标签条码")
@GetMapping("/print")
public String printBoxSmallLabel(@RequestParam(value = "id", required = false) String id, @RequestParam(value = "type", required = false) Integer type) {
return sampleBoxService.printBoxLabel(id, type);
}
@PostMapping("/add/box/{opCode}")
public R<SampleBox> controlsSampleBox(@PathVariable(value = "opCode") Integer opCode, @RequestBody SampleBox sampleBox) {
SampleBox box = sampleBoxService.controlsSampleBox(sampleBox, opCode);
return R.ok(box);
}
@ApiOperation(value = "打印包装袋条码,参数boxId:包装袋ID\n" +
"type 0:小标签条码1大标签条码")
@GetMapping("/print/other/{boxId}/{type}")
public String printLabelForOther(@PathVariable(value = "boxId") String boxId, @PathVariable(value = "type") Integer type) {
return sampleBoxService.printLabelForOther(boxId, type);
}
@GetMapping("/get/for/job_id/{jobId}")
@ApiOperation(value = "通过任务ID查询该任务下的所有包装袋",notes = "通过任务ID查询该任务下的所有包装袋")
public R<List<SampleBox>> getSampleBoxForOther(@PathVariable(value = "jobId") String jobId) {
return R.ok(sampleBoxService.list(new LambdaQueryWrapper<SampleBox>().eq(SampleBox::getJobId, jobId)));
}
}

View File

@@ -0,0 +1,97 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.SampleBoxInLog;
import digital.laboratory.platform.entrustment.service.SampleBoxInLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 样品包入库出库日志
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品包入库出库日志 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/sample_box_in_log" )
@Api(value = "sample_box_in_log", tags = "样品包入库出库日志管理")
public class SampleBoxInLogController {
private final SampleBoxInLogService sampleBoxInLogService;
/**
* 通过id查询样品包入库出库日志
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_box_in_log_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(sampleBoxInLogService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param sampleBoxInLog 样品包入库出库日志
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_box_in_log_get')" )
public R getSampleBoxInLogPage(Page page, SampleBoxInLog sampleBoxInLog) {
return R.ok(sampleBoxInLogService.page(page, Wrappers.query(sampleBoxInLog)));
}
/**
* 新增样品包入库出库日志
* @param sampleBoxInLog 样品包入库出库日志
* @return R
*/
@ApiOperation(value = "新增样品包入库出库日志", notes = "新增样品包入库出库日志")
@SysLog("新增样品包入库出库日志" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_box_in_log_add')" )
public R postAddObject(@RequestBody SampleBoxInLog sampleBoxInLog) {
sampleBoxInLog.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(sampleBoxInLogService.save(sampleBoxInLog));
}
/**
* 修改样品包入库出库日志
* @param sampleBoxInLog 样品包入库出库日志
* @return R
*/
@ApiOperation(value = "修改样品包入库出库日志", notes = "修改样品包入库出库日志")
@SysLog("修改样品包入库出库日志" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_box_in_log_edit')" )
public R putUpdateById(@RequestBody SampleBoxInLog sampleBoxInLog) {
return R.ok(sampleBoxInLogService.updateById(sampleBoxInLog));
}
/**
* 通过id删除样品包入库出库日志
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除样品包入库出库日志", notes = "通过id删除样品包入库出库日志")
@SysLog("通过id删除样品包入库出库日志" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_box_in_log_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(sampleBoxInLogService.removeById(id));
}
}

View File

@@ -0,0 +1,104 @@
package digital.laboratory.platform.entrustment.controller;
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.sys.entity.entrustment.Sample;
import digital.laboratory.platform.entrustment.service.SampleService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 检验用的样本
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 检验用的样本 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/sample" )
@Api(value = "sample", tags = "200-检验用的样本管理")
public class SampleController {
private final SampleService sampleService;
/**
* 通过id查询检验用的样本
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(sampleService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param sample 检验用的样本
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_get')" )
public R getSamplePage(Page page, Sample sample) {
return R.ok(sampleService.page(page, Wrappers.query(sample)));
}
/**
* 新增检验用的样本
* @param sample 检验用的样本
* @return R
*/
@ApiOperation(value = "新增检验用的样本", notes = "新增检验用的样本")
@SysLog("新增检验用的样本" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_add')" )
public R postAddObject(@RequestBody Sample sample) {
sample.setId(IdWorker.get32UUID().toUpperCase());
if (sampleService.save(sample)) {
return R.ok(sample, "新增样本成功");
}
else {
return R.failed(sample, "新增样本失败");
}
}
/**
* 修改检验用的样本
* @param sample 检验用的样本
* @return R
*/
@ApiOperation(value = "修改检验用的样本", notes = "修改检验用的样本")
@SysLog("修改检验用的样本" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_edit')" )
public R putUpdateById(@RequestBody Sample sample) {
return R.ok(sampleService.updateById(sample));
}
/**
* 通过id删除检验用的样本
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除检验用的样本", notes = "通过id删除检验用的样本")
@SysLog("通过id删除检验用的样本" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(sampleService.removeById(id));
}
}

View File

@@ -0,0 +1,97 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.SampleStoreChangeDutyLog;
import digital.laboratory.platform.entrustment.service.SampleStoreChangeDutyLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 样品库管理员换班日志
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库管理员换班日志 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/sample_store_change_duty_log" )
@Api(value = "sample_store_change_duty_log", tags = "样品库管理员换班日志管理")
public class SampleStoreChangeDutyLogController {
private final SampleStoreChangeDutyLogService sampleStoreChangeDutyLogService;
/**
* 通过id查询样品库管理员换班日志
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_change_duty_log_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(sampleStoreChangeDutyLogService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param sampleStoreChangeDutyLog 样品库管理员换班日志
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_change_duty_log_get')" )
public R getSampleStoreChangeDutyLogPage(Page page, SampleStoreChangeDutyLog sampleStoreChangeDutyLog) {
return R.ok(sampleStoreChangeDutyLogService.page(page, Wrappers.query(sampleStoreChangeDutyLog)));
}
/**
* 新增样品库管理员换班日志
* @param sampleStoreChangeDutyLog 样品库管理员换班日志
* @return R
*/
@ApiOperation(value = "新增样品库管理员换班日志", notes = "新增样品库管理员换班日志")
@SysLog("新增样品库管理员换班日志" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_change_duty_log_add')" )
public R postAddObject(@RequestBody SampleStoreChangeDutyLog sampleStoreChangeDutyLog) {
sampleStoreChangeDutyLog.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(sampleStoreChangeDutyLogService.save(sampleStoreChangeDutyLog));
}
/**
* 修改样品库管理员换班日志
* @param sampleStoreChangeDutyLog 样品库管理员换班日志
* @return R
*/
@ApiOperation(value = "修改样品库管理员换班日志", notes = "修改样品库管理员换班日志")
@SysLog("修改样品库管理员换班日志" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_change_duty_log_edit')" )
public R putUpdateById(@RequestBody SampleStoreChangeDutyLog sampleStoreChangeDutyLog) {
return R.ok(sampleStoreChangeDutyLogService.updateById(sampleStoreChangeDutyLog));
}
/**
* 通过id删除样品库管理员换班日志
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除样品库管理员换班日志", notes = "通过id删除样品库管理员换班日志")
@SysLog("通过id删除样品库管理员换班日志" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_change_duty_log_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(sampleStoreChangeDutyLogService.removeById(id));
}
}

View File

@@ -0,0 +1,97 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.SampleStore;
import digital.laboratory.platform.entrustment.service.SampleStoreService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 样品库
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/sample_store" )
@Api(value = "sample_store", tags = "样品库管理")
public class SampleStoreController {
private final SampleStoreService sampleStoreService;
/**
* 通过id查询样品库
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(sampleStoreService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param sampleStore 样品库
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_get')" )
public R getSampleStorePage(Page page, SampleStore sampleStore) {
return R.ok(sampleStoreService.page(page, Wrappers.query(sampleStore)));
}
/**
* 新增样品库
* @param sampleStore 样品库
* @return R
*/
@ApiOperation(value = "新增样品库", notes = "新增样品库")
@SysLog("新增样品库" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_add')" )
public R postAddObject(@RequestBody SampleStore sampleStore) {
sampleStore.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(sampleStoreService.save(sampleStore));
}
/**
* 修改样品库
* @param sampleStore 样品库
* @return R
*/
@ApiOperation(value = "修改样品库", notes = "修改样品库")
@SysLog("修改样品库" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_edit')" )
public R putUpdateById(@RequestBody SampleStore sampleStore) {
return R.ok(sampleStoreService.updateById(sampleStore));
}
/**
* 通过id删除样品库
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除样品库", notes = "通过id删除样品库")
@SysLog("通过id删除样品库" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(sampleStoreService.removeById(id));
}
}

View File

@@ -0,0 +1,99 @@
package digital.laboratory.platform.entrustment.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.entrustment.entity.SampleStoreLog;
import digital.laboratory.platform.entrustment.service.SampleStoreLogService;
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 样品库入库出库日志
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库入库出库日志 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/sample_store_log" )
@Api(value = "sample_store_log", tags = "样品库入库出库日志管理")
public class SampleStoreLogController {
private final SampleStoreLogService sampleStoreLogService;
/**
* 通过id查询样品库入库出库日志
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_log_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(sampleStoreLogService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param sampleStoreLog 样品库入库出库日志
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_log_get')" )
public R<IPage<SampleStoreLog>> getSampleStoreLogPage(Page page, SampleStoreLog sampleStoreLog) {
return R.ok(sampleStoreLogService.page(page, Wrappers.query(sampleStoreLog)));
}
/**
* 新增样品库入库出库日志
* @param sampleStoreLog 样品库入库出库日志
* @return R
*/
@ApiOperation(value = "新增样品库入库出库日志", notes = "新增样品库入库出库日志")
@SysLog("新增样品库入库出库日志" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_log_add')" )
public R postAddObject(@RequestBody SampleStoreLog sampleStoreLog) {
sampleStoreLog.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(sampleStoreLogService.save(sampleStoreLog));
}
/**
* 修改样品库入库出库日志
* @param sampleStoreLog 样品库入库出库日志
* @return R
*/
@ApiOperation(value = "修改样品库入库出库日志", notes = "修改样品库入库出库日志")
@SysLog("修改样品库入库出库日志" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_log_edit')" )
public R putUpdateById(@RequestBody SampleStoreLog sampleStoreLog) {
return R.ok(sampleStoreLogService.updateById(sampleStoreLog));
}
/**
* 通过id删除样品库入库出库日志
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除样品库入库出库日志", notes = "通过id删除样品库入库出库日志")
@SysLog("通过id删除样品库入库出库日志" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_sample_store_log_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(sampleStoreLogService.removeById(id));
}
}

View File

@@ -0,0 +1,100 @@
package digital.laboratory.platform.entrustment.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.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.entity.StorageCabinet;
import digital.laboratory.platform.entrustment.service.StorageCabinetService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 暂存柜
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/storage_cabinet" )
@Api( tags = "306-暂存柜管理")
public class StorageCabinetController {
private final StorageCabinetService storageCabinetService;
/**
* 通过id查询暂存柜
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cabinet_get')" )
public R<StorageCabinet> getById(@PathVariable("id" ) String id) {
return R.ok(storageCabinetService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param storageCabinet 暂存柜
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cabinet_get')" )
public R<IPage<StorageCabinet>> getStorageCabinetPage(Page<StorageCabinet> page, StorageCabinet storageCabinet) {
return R.ok(storageCabinetService.page(page, Wrappers.query(storageCabinet)));
}
/**
* 新增暂存柜
* @param storageCabinet 暂存柜
* @return R
*/
@ApiOperation(value = "新增暂存柜", notes = "新增暂存柜")
@SysLog("新增暂存柜" )
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cabinet_add')" )
public R postAddObject(@RequestBody StorageCabinet storageCabinet) {
storageCabinet.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(storageCabinetService.save(storageCabinet));
}
/**
* 修改暂存柜
* @param storageCabinet 暂存柜
* @return R
*/
@ApiOperation(value = "修改暂存柜", notes = "修改暂存柜")
@SysLog("修改暂存柜" )
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cabinet_edit')" )
public R putUpdateById(@RequestBody StorageCabinet storageCabinet) {
return R.ok(storageCabinetService.updateById(storageCabinet));
}
/**
* 通过id删除暂存柜
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除暂存柜", notes = "通过id删除暂存柜")
@SysLog("通过id删除暂存柜" )
@DeleteMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cabinet_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(storageCabinetService.removeById(id));
}
}

View File

@@ -0,0 +1,97 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.StorageCell;
import digital.laboratory.platform.entrustment.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.web.bind.annotation.*;
/**
* 暂存柜,每行一个单元格
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜,每行一个单元格 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/storage_cell" )
@Api( tags = "307-暂存柜,每行一个单元格管理")
public class StorageCellController {
private final StorageCellService storageCellService;
/**
* 通过id查询暂存柜,每行一个单元格
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(storageCellService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param storageCell 暂存柜,每行一个单元格
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_get')" )
public R getStorageCellPage(Page page, StorageCell storageCell) {
return R.ok(storageCellService.page(page, Wrappers.query(storageCell)));
}
/**
* 新增暂存柜,每行一个单元格
* @param storageCell 暂存柜,每行一个单元格
* @return R
*/
@ApiOperation(value = "新增暂存柜,每行一个单元格", notes = "新增暂存柜,每行一个单元格")
@SysLog("新增暂存柜,每行一个单元格" )
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_add')" )
public R postAddObject(@RequestBody StorageCell storageCell) {
storageCell.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(storageCellService.save(storageCell));
}
/**
* 修改暂存柜,每行一个单元格
* @param storageCell 暂存柜,每行一个单元格
* @return R
*/
@ApiOperation(value = "修改暂存柜,每行一个单元格", notes = "修改暂存柜,每行一个单元格")
@SysLog("修改暂存柜,每行一个单元格" )
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_edit')" )
public R putUpdateById(@RequestBody StorageCell storageCell) {
return R.ok(storageCellService.updateById(storageCell));
}
/**
* 通过id删除暂存柜,每行一个单元格
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除暂存柜,每行一个单元格", notes = "通过id删除暂存柜,每行一个单元格")
@SysLog("通过id删除暂存柜,每行一个单元格" )
@DeleteMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(storageCellService.removeById(id));
}
}

View File

@@ -0,0 +1,97 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.StorageCellLog;
import digital.laboratory.platform.entrustment.service.StorageCellLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 暂存柜记录
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜记录 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/storage_cell_log" )
@Api( tags = "308-暂存柜记录管理")
public class StorageCellLogController {
private final StorageCellLogService storageCellLogService;
/**
* 通过id查询暂存柜记录
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_log_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(storageCellLogService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param storageCellLog 暂存柜记录
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_log_get')" )
public R getStorageCellLogPage(Page page, StorageCellLog storageCellLog) {
return R.ok(storageCellLogService.page(page, Wrappers.query(storageCellLog)));
}
/**
* 新增暂存柜记录
* @param storageCellLog 暂存柜记录
* @return R
*/
@ApiOperation(value = "新增暂存柜记录", notes = "新增暂存柜记录")
@SysLog("新增暂存柜记录" )
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_log_add')" )
public R postAddObject(@RequestBody StorageCellLog storageCellLog) {
storageCellLog.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(storageCellLogService.save(storageCellLog));
}
/**
* 修改暂存柜记录
* @param storageCellLog 暂存柜记录
* @return R
*/
@ApiOperation(value = "修改暂存柜记录", notes = "修改暂存柜记录")
@SysLog("修改暂存柜记录" )
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_log_edit')" )
public R putUpdateById(@RequestBody StorageCellLog storageCellLog) {
return R.ok(storageCellLogService.updateById(storageCellLog));
}
/**
* 通过id删除暂存柜记录
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除暂存柜记录", notes = "通过id删除暂存柜记录")
@SysLog("通过id删除暂存柜记录" )
@DeleteMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_storage_cell_log_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(storageCellLogService.removeById(id));
}
}

View File

@@ -0,0 +1,82 @@
package digital.laboratory.platform.entrustment.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.othersys.dto.EntrustQueryParams;
import digital.laboratory.platform.entrustment.entity.EntrustOfThirdSys;
import digital.laboratory.platform.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.service.*;
import digital.laboratory.platform.sys.feign.RemoteDictionaryService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName SynchronizeDataController
* @Description 用于将第三方禁毒数据进行同步和回写的操作
* @Author xy
* @Date 2023/6/05 9:07
* @Version 1.0
**/
@RestController
@RequestMapping("/papp/entrustment/synchronizeData")
@RequiredArgsConstructor
@Api(value = "数据同步处理接口", tags = "数据同步处理接口")
public class SynchronizeDataController {
private final RemoteDictionaryService remoteDictionaryService;//字典接口
private final SynchronizeDataService synchronizeDataService;
//获取数据接口全部写到这里
/**
* 获取远程系统中的委托数据接口
* @return
*/
@GetMapping("/getRemoteEntrustData")
public R handleRemoteData(String entrustStatus) {
String requestEntrustStatus=StringUtils.isNotBlank(entrustStatus)?entrustStatus:"provinceAuditing";
return R.ok(synchronizeDataService.synEntrustDataToMyServer(requestEntrustStatus,"SubCenter"),"数据同步完成");
}
//省级审核接口 //分中心审核
@GetMapping("/provinceAudit")
public R provinceAudit(String userFlag,String entrustID){
//String entrustID="WEFHTXRoQXdVRmM5K1U0N1U0NGI2NUFoMzZOQUhzaTE=";
//String userFlag="Province";//Province或者SubCenter
String dataPath="/api/identify/entrust/{entrustId}/acceptAudit";
//String auditOrAccept="Audit";
try {
return R.ok(synchronizeDataService.auditEntrustByProvinceOrCenter(userFlag,dataPath,entrustID,"success",
"",""),"操作成功");
}catch (Exception e)
{
e.printStackTrace();
return R.ok("","处理失败");
}
}
//新增加一个接口用于同步已受理的数据
@GetMapping("/getRemoteAcceptedEntrustData")
public R getRemoteAcceptedEntrustData(EntrustQueryParams entrustQueryParams) {
//String requestEntrustStatus=StringUtils.isNotBlank(entrustStatus)?entrustStatus:"provinceAuditing";
//return R.ok(synchronizeDataService.synEntrustDataToMyServer(requestEntrustStatus,"SubCenter"),"数据同步完成");
return R.ok(synchronizeDataService.synAcceptedEntrustDataToMyServer(entrustQueryParams),"数据同步完成");
//return R.ok(entrustQueryParams);
}
//分中心受理接口
@GetMapping("/subCenterAccept")
public R subCenterAccept() throws JsonProcessingException {
String entrustID="WEFHTXRoQXdVRmM5K1U0N1U0NGI2NUFoMzZOQUhzaTE=";
String dataPath="/api/identify/entrust/{entrustId}/accept";
Entrustment selfEntrust=new Entrustment();
EntrustOfThirdSys thirdSysEntrust=new EntrustOfThirdSys();
return R.ok(synchronizeDataService.subCenterAccept(dataPath,selfEntrust,thirdSysEntrust),"操作成功");
}
//分中心上传鉴定数据接口
@GetMapping("/subCenterUploadData")
public R subCenterUploadData(){
String dataPath="/api/identify/entrust/{entrustId}/analysis";
String entrustId="";
return R.ok(synchronizeDataService.submitIdentifyResult(dataPath,entrustId),"操作成功");
}
}

View File

@@ -0,0 +1,190 @@
package digital.laboratory.platform.entrustment.controller;
import cn.hutool.core.util.StrUtil;
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.entrustment.entity.Taker;
import digital.laboratory.platform.entrustment.service.TakerService;
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.List;
/**
* 采集员
*
* @author Zhang Xiaolong created at 2022-08-25
* @describe 采集员 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/taker" )
@Api(value = "taker", tags = "007-采集员管理")
public class TakerController {
private final TakerService takerService;
/**
* 通过id查询采集员
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_taker_get')" )
public R getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Taker taker = takerService.getById(id);
if (taker != null) {
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), taker.getOwnerUserId())) {
return R.ok(taker);
}
else {
return R.failed(String.format("你没有权限访问id为 %s 的采集员的数据", id));
}
}
else {
return R.failed(String.format("没有找到id为 %s 的采集员", id));
}
}
/**
* 列表查询
* @param taker 采集员
* @return
*/
@ApiOperation(value = "列表查询", notes = "列表查询")
@GetMapping("/list" )
// @PreAuthorize("@pms.hasPermission('entrustment_deliverer_get')" )
public R getDelivererList(Taker taker, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
taker.setOwnerUserId(dlpUser.getId());
List<Taker> list = takerService.list(Wrappers.<Taker>query()
.eq("owner_user_id", dlpUser.getId()) // 只查询当前用户拥有的采集员
.like(StrUtil.isNotBlank(taker.getName()), "name", taker.getName())
.orderByDesc("name")
);
return R.ok(list);
}
/**
* 分页查询
* @param page 分页对象
* @param taker 采集员
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('entrustment_taker_get')" )
public R getTakerPage(Page page, Taker taker, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
taker.setOwnerUserId(dlpUser.getId());
return R.ok(takerService.page(page, Wrappers.<Taker>query()
.eq("owner_user_id", dlpUser.getId()) // 只查询当前用户拥有的采集员
.like(StrUtil.isNotBlank(taker.getName()), "name", taker.getName())
.orderByDesc("name")
));
}
/**
* 新增采集员
* @param taker 采集员
* @return R
*/
@ApiOperation(value = "新增采集员", notes = "新增采集员")
@SysLog("新增采集员" )
@PostMapping
// @PreAuthorize("@pms.hasPermission('entrustment_taker_add')" )
public R postAddObject(@RequestBody Taker taker, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
taker.setOwnerUserId(dlpUser.getId());
taker.setId(IdWorker.get32UUID().toUpperCase());
return R.ok(takerService.save(taker));
}
/**
* 修改采集员
* @param taker 采集员
* @return R
*/
@ApiOperation(value = "修改采集员", notes = "修改采集员")
@SysLog("修改采集员" )
@PutMapping
// @PreAuthorize("@pms.hasPermission('entrustment_taker_edit')" )
public R putUpdateById(@RequestBody Taker taker, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Taker oldTaker = takerService.getById(taker.getId());
if (oldTaker != null) {
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), oldTaker.getOwnerUserId())) {
taker.setOwnerUserId(dlpUser.getId());
return R.ok(takerService.updateById(taker));
}
else {
return R.failed(String.format("你没有权限修改id为 %s 的采集员的数据", taker.getId()));
}
}
else {
return R.failed(String.format("没有找到id为 %s 的采集员", taker.getId()));
}
}
/**
* 通过id删除采集员
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除采集员", notes = "通过id删除采集员")
@SysLog("通过id删除采集员" )
@DeleteMapping("/{id}" )
// @PreAuthorize("@pms.hasPermission('entrustment_taker_del')" )
public R deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
Taker oldTaker = takerService.getById(id);
if (oldTaker != null) {
if (StrUtil.equalsIgnoreCase(dlpUser.getId(), oldTaker.getOwnerUserId())) {
if (takerService.removeById(id)) {
return R.ok(oldTaker, "采集员删除成功");
}
else {
return R.failed(oldTaker, "采集员删除失败");
}
}
else {
return R.failed(String.format("你没有权限删除id为 %s 的采集员", id));
}
}
else {
return R.failed(String.format("没有找到id为 %s 的采集员", id));
}
}
}

View File

@@ -0,0 +1,97 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.HairJob;
import digital.laboratory.platform.entrustment.entity.SampleStoreLog;
import digital.laboratory.platform.entrustment.service.HairJobService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 毛发检测任务
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 毛发检测任务 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/hair_job" )
@Api(value = "hair_job", tags = "毛发检测任务管理")
public class HairJobController {
private final HairJobService hairJobService;
/**
* 通过id查询毛发检测任务
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(hairJobService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param hairJob 毛发检测任务
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_get')" )
public R<IPage<HairJob>> getHairJobPage(Page page, HairJob hairJob) {
return R.ok(hairJobService.page(page, Wrappers.query(hairJob)));
}
/**
* 新增毛发检测任务
* @param hairJob 毛发检测任务
* @return R
*/
@ApiOperation(value = "新增毛发检测任务", notes = "新增毛发检测任务")
@SysLog("新增毛发检测任务" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_add')" )
public R postAddObject(@RequestBody HairJob hairJob) {
return R.ok(hairJobService.save(hairJob));
}
/**
* 修改毛发检测任务
* @param hairJob 毛发检测任务
* @return R
*/
@ApiOperation(value = "修改毛发检测任务", notes = "修改毛发检测任务")
@SysLog("修改毛发检测任务" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_edit')" )
public R putUpdateById(@RequestBody HairJob hairJob) {
return R.ok(hairJobService.updateById(hairJob));
}
/**
* 通过id删除毛发检测任务
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除毛发检测任务", notes = "通过id删除毛发检测任务")
@SysLog("通过id删除毛发检测任务" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(hairJobService.removeById(id));
}
}

View File

@@ -0,0 +1,96 @@
package digital.laboratory.platform.entrustment.controller;
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.entrustment.entity.HairJobIdentificationMaterial;
import digital.laboratory.platform.entrustment.service.HairJobIdentificationMaterialService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* 毛发任务的检材信息
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 毛发任务的检材信息 前端控制器
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/papp/entrustment/hair_job_identification_material" )
@Api(value = "hair_job_identification_material", tags = "毛发任务的检材信息管理")
public class HairJobIdentificationMaterialControllerx {
private final HairJobIdentificationMaterialService hairJobIdentificationMaterialService;
/**
* 通过id查询毛发任务的检材信息
* @param id id
* @return R
*/
@ApiOperation(value = "通过id查询", notes = "通过id查询")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_get')" )
public R<HairJobIdentificationMaterial> getById(@PathVariable("id" ) String id) {
return R.ok(hairJobIdentificationMaterialService.getById(id));
}
/**
* 分页查询
* @param page 分页对象
* @param hairJobIdentificationMaterial 毛发任务的检材信息
* @return
*/
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_get')" )
public R<IPage<HairJobIdentificationMaterial>> getHairJobIdentificationMaterialPage(Page page, HairJobIdentificationMaterial hairJobIdentificationMaterial) {
return R.ok(hairJobIdentificationMaterialService.page(page, Wrappers.query(hairJobIdentificationMaterial)));
}
/**
* 新增毛发任务的检材信息
* @param hairJobIdentificationMaterial 毛发任务的检材信息
* @return R
*/
@ApiOperation(value = "新增毛发任务的检材信息", notes = "新增毛发任务的检材信息")
@SysLog("新增毛发任务的检材信息" )
@PostMapping
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_add')" )
public R postAddObject(@RequestBody HairJobIdentificationMaterial hairJobIdentificationMaterial) {
return R.ok(hairJobIdentificationMaterialService.save(hairJobIdentificationMaterial));
}
/**
* 修改毛发任务的检材信息
* @param hairJobIdentificationMaterial 毛发任务的检材信息
* @return R
*/
@ApiOperation(value = "修改毛发任务的检材信息", notes = "修改毛发任务的检材信息")
@SysLog("修改毛发任务的检材信息" )
@PutMapping
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_edit')" )
public R putUpdateById(@RequestBody HairJobIdentificationMaterial hairJobIdentificationMaterial) {
return R.ok(hairJobIdentificationMaterialService.updateById(hairJobIdentificationMaterial));
}
/**
* 通过id删除毛发任务的检材信息
* @param id id
* @return R
*/
@ApiOperation(value = "通过id删除毛发任务的检材信息", notes = "通过id删除毛发任务的检材信息")
@SysLog("通过id删除毛发任务的检材信息" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('entrustment_hair_job_identification_material_del')" )
public R deleteById(@PathVariable String id) {
return R.ok(hairJobIdentificationMaterialService.removeById(id));
}
}

View File

@@ -0,0 +1,12 @@
package digital.laboratory.platform.entrustment.dto;
import digital.laboratory.platform.entrustment.entity.Entrustment;
import lombok.Data;
@Data
public class EntrustmentDTO extends Entrustment {
private String caseBrief;
private String caseName;
}

View File

@@ -0,0 +1,13 @@
package digital.laboratory.platform.entrustment.dto;
import lombok.Data;
import java.util.List;
@Data
public class PrintDTO {
private String id;
private String sample;
private Integer type;
}

View File

@@ -0,0 +1,12 @@
package digital.laboratory.platform.entrustment.dto;
import lombok.Data;
import java.util.List;
@Data
public class SampleBoxDTO {
private String boxId;
private String boxType;
private List<String> sampleNoList;
}

View File

@@ -0,0 +1,15 @@
package digital.laboratory.platform.entrustment.entity;
import lombok.Data;
/**
* 回避的鉴定人
* 作为委托的一个属性, 由委托方指定某些鉴定人需要回避
*/
@Data
public class AvoidIdentifier {
String userId; // 用户 Id
String name; // 这是鉴定人的姓名
String reason; // 回避的原因(事由)
}

View File

@@ -0,0 +1,107 @@
package digital.laboratory.platform.entrustment.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 2022-12-08 09:20:12
* @describe 案件、事件 实体类
*/
@Data
@TableName(value = "b_case_event", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "案件、事件")
public class CaseEvent extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 案件编号
*/
@ApiModelProperty(value="案件编号")
private String caseNo;
/**
* 第三方系统(如现勘系统、案事件系统)编号
*/
@ApiModelProperty(value="第三方系统(如现勘系统、案事件系统)编号")
private String thirdPartySysNo;
/**
* 案件名称任务名称
*/
@ApiModelProperty(value="案件名称任务名称")
private String caseName;
/**
* 案件类型
*/
@ApiModelProperty(value="案件类型")
private String caseType;
/**
* 案发时间
*/
@ApiModelProperty(value="案发时间")
private LocalDateTime happenTime;
/**
* 案发地详细地点
*/
@ApiModelProperty(value="案发地详细地点")
private String caseAddress;
/**
* 案发地行政区划编码(到县一级)
*/
@ApiModelProperty(value="案发地行政区划编码(到县一级)")
private String caseArea;
/**
* 案件所属机构
*/
@ApiModelProperty(value="案件所属机构")
private String caseOwnOrgId;
/**
* 案件级别: 0=普通案件, 1=紧急案件, 2=加急案件
*/
@ApiModelProperty(value="案件级别: 0=普通案件, 1=紧急案件, 2=加急案件")
private Integer caseRank;
/**
* 案情简要
*/
@ApiModelProperty(value="案情简要")
private String caseBrief;
/**
* 案件备注
*/
@ApiModelProperty(value="案件备注")
private String comments;
/**
* 数据来源,用于区别数据来自自身系统还是外部系统
*/
@ApiModelProperty(value="数据来源")
private Integer dataSources;
}

View File

@@ -0,0 +1,211 @@
package digital.laboratory.platform.entrustment.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import digital.laboratory.platform.sys.entity.entrustment.IMAdditionalProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 与案件相关的物证信息
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 与案件相关的物证信息 实体类
*/
@Data
@TableName(value = "b_case_evidence", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "与案件相关的物证信息")
public class CaseEvidence extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 本系统物证编号
*/
@ApiModelProperty(value="本系统物证编号")
private String evidenceNo;
/**
* 案件Id
*/
@ApiModelProperty(value="案件Id")
private String caseId;
/**
* 第三方系统(如现勘系统、案事件系统)物证编号
*/
@ApiModelProperty(value="第三方系统(如现勘系统、案事件系统)物证编号")
private String thirdPartySysEvidenceNo;
/**
* 物证名称
*/
@ApiModelProperty(value="物证名称")
private String name;
/**
* 物证类别:1. 非生物性物证;2. 生物特性物证
*/
@ApiModelProperty(value="物证类别:1. 非生物性物证;2. 生物特性物证")
private String type;
/**
* 现场标牌号
*/
@ApiModelProperty(value="现场标牌号")
private String fieldLabelNo;
/**
* 物证来源
*/
@ApiModelProperty(value="物证来源")
private String source;
/**
* 物证颜色
*/
@ApiModelProperty(value="物证颜色")
private String color;
/**
* 物证性状
*/
@ApiModelProperty(value="物证性状")
private String form;
/**
* 物证情况之承载物名称, 例如 棉签 2 棵, 粉末 少许
*/
@ApiModelProperty(value="物证情况之承载物名称, 例如 棉签 2 棵, 粉末 少许")
private String fundName;
/**
* 物证情况之承载物数量, 例如 5 颗, 3包,
*/
@ApiModelProperty(value="物证情况之承载物数量, 例如 5 颗, 3包, ")
private Integer fundQuantity;
/**
* 物证情况之承载物单位, 例如 5 颗, 3包
*/
@ApiModelProperty(value="物证情况之承载物单位, 例如 5 颗, 3包")
private String fundUnit;
/**
* 物证数量, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value="物证数量, 例如 3.8 克 或 4.5毫升")
private BigDecimal quantity;
/**
* 物证单位, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value="物证单位, 例如 3.8 克 或 4.5毫升")
private String unit;
/**
* 附加属性, 如:体积3毫升,密码123,型号abc
*/
@ApiModelProperty(value="附加属性, 如:体积3毫升,密码123,型号abc")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<IMAdditionalProperty> additionalProperties;
/**
* 所有者姓名
*/
@ApiModelProperty(value="所有者姓名")
private String personName;
/**
* 所有者证件类型
*/
@ApiModelProperty(value="所有者证件类型")
private String personCert;
/**
* 所有者证件号
*/
@ApiModelProperty(value="所有者证件号")
private String personId;
/**
* 所有者性别,公安系统编码 1男 2女 0未知
*/
@ApiModelProperty(value="所有者性别,公安系统编码 1男 2女 0未知")
private Integer personGender;
/**
* 所有者国籍
*/
@ApiModelProperty(value="所有者国籍")
private String personNationality;
/**
* 所有者民族编码,公安系统编码
*/
@ApiModelProperty(value="所有者民族编码,公安系统编码")
private Integer personNation;
/**
* 所有者地址
*/
@ApiModelProperty(value="所有者地址")
private String personAddress;
/**
* 所有者年龄
*/
@ApiModelProperty(value="所有者年龄")
private Integer personAge;
/**
* 包装情况:纸袋,纸盒,纸箱,自定义
*/
@ApiModelProperty(value="包装情况:纸袋,纸盒,纸箱,自定义")
private String pack;
/**
* 存储方法:常规,冷藏,特殊
*/
@ApiModelProperty(value="存储方法:常规,冷藏,特殊")
private String storageMethod;
/**
* 描述
*/
@ApiModelProperty(value="描述")
private String description;
/**
* 备注
*/
@ApiModelProperty(value="备注")
private String comments;
/**
* 数据来源,用于区别数据来自自身系统还是外部系统
*/
@ApiModelProperty(value="数据来源")
private Integer dataSources;
}

View File

@@ -0,0 +1,70 @@
package digital.laboratory.platform.entrustment.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 2022-08-16
* @describe 送检员 实体类
*/
@Data
@TableName(value = "b_deliverer", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "送检员")
public class Deliverer extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "id")
private String id;
/**
* 送检员拥有者userId
*/
@ApiModelProperty(value="送检员拥有者userId")
private String ownerUserId;
/**
* 送检员姓名
*/
@ApiModelProperty(value="送检员姓名")
private String name;
/**
* 送检员职务
*/
@ApiModelProperty(value="送检员职务")
private String position;
/**
* 送检员证件名称
*/
@ApiModelProperty(value="送检员证件名称")
private String cert;
/**
* 送检员证件编号
*/
@ApiModelProperty(value="送检员证件编号")
private String idnum;
/**
* 送检员电话
*/
@ApiModelProperty(value="送检员电话")
private String phone;
}

View File

@@ -0,0 +1,35 @@
package digital.laboratory.platform.entrustment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @ClassName EntrustMaterialOfThirdSys
* @Description 检材
* @Author xy
* @Date 2023/6/14 14:12
* @Version 1.0
**/
@Data
@TableName(value = "b_entrust_thirdsys_material", autoResultMap = true)
public class EntrustMaterialOfThirdSys {
private String id;
private String entrustId;
private String order_index;//检材序号
private String name;//检材名称
private String colorType;//颜色
private String shapeType;//形状
private String packageType;//包装
private BigDecimal amount;//数量
private String unit;//单位
private String targetObjectTypeList;//筛查毒品
private String analysisType;//分析类型
//下面的属性要在受理之后才会有值,受理之前都是空的
private BigDecimal analysisSampleAmount;//分析样计数
private BigDecimal retainedSampleAmount;//留存样计数
private BigDecimal totalSampleAmount;//总量
private String sampleUnit;//计量单位
}

View File

@@ -0,0 +1,64 @@
package digital.laboratory.platform.entrustment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @ClassName EntrustOfThirdSys
* @Description TODO
* @Author xy
* @Date 2023/6/13 11:58
* @Version 1.0
**/
@Data
@TableName(value = "b_entrust_thirdsys", autoResultMap = true)
public class EntrustOfThirdSys {
private String id;
private String entrustMainId;//主系统委托书ID
private String entrustSerialNumber;//委托编号
private String acceptSerialNumber;//受理编号 -完整编号
private String serialNumber;//受理编号,短编号
private Integer serialYear;//年序号
private Integer serialIndex;//索引序号
//provinceAuditing:省级审核中, provinceAuditRollback:省级审核退回, acceptAuditing:受理审核中,
// acceptAuditRollback:受理审核退回,toAccept:待受理, accepted:已受理, toAnalyse:待鉴定, analysed:鉴定完成
private String status;
private String provinceName;
private String provinceCode;
private String provinceDeptName;
private LocalDateTime submitTime;
private LocalDateTime acceptTime;
private LocalDateTime finishTime;
private String entrustOrganization;//委托鉴定单位
private LocalDateTime scheduledDate;//预约送检日期
private String createUserDeptRegionCode;//提交人单位所在地区编码
private String caseName;
private String caseCode;
private String caseRemark;
private String materialType;//检材类型 inVitro:缴获物, inVivo:生物样本, other:其他
private String materialDescribe; //检材描述
private String entrustRequirement;//鉴定要求
private String entrustMethod;//鉴定方法
private String originalIdentification;//原鉴定情况
private String reportSendType;//报告发放方式
private String reportSendAddress;//报告发送地址
private LocalDateTime analysisStartTime;//鉴定开始时间
private LocalDateTime analysisEndTime;//鉴定结束时间
private String samplingMethod;//这个属性要在受理之后才会有,表示的意思是:样本的描述,比如 检材全部为分析样 检材全部为留存样,检材分装为分析样和留存样
//送检人信息
private String deliverer1Name;
private String deliverer1Position;
private String deliverer1CardType;
private String deliverer1CertificatesCode;
private String deliverer1Phone;
private String deliverer2Name;
private String deliverer2Position;
private String deliverer2CardType;
private String deliverer2CertificatesCode;
private String deliverer2Phone;
}

View File

@@ -0,0 +1,749 @@
package digital.laboratory.platform.entrustment.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
//import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import digital.laboratory.platform.sewage.entity.UpdateInfo;
import digital.laboratory.platform.sys.entity.DrugLite;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 委托
*
* @author Zhang Xiaolong created at 2022-04-20
* @describe 委托 Mapper 类
*/
@Data
@Accessors(chain = true)
@TableName(value = "b_entrustment", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "委托")
public class Entrustment extends BaseEntity {
/**
* 编号
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="编号")
private String id;
/**
* 案件Id
*/
@ApiModelProperty(value="案件Id")
private String caseId;
/**
* 委托编号
*/
@ApiModelProperty(value="委托编号")
private String entrustmentNo;
/**
* 委托类型: 0=正常司法鉴定委托, 1=案前委托
*/
@ApiModelProperty(value="委托类型: 0=正常司法鉴定委托, 1=案前委托")
private Integer entrustmentType;
/**
* 业务类型: 0=毒品鉴定 1=.....用于对应到各个检验小组
*/
@ApiModelProperty(value="业务类型: 0=毒品鉴定 1=.....用于对应到各个检验小组")
private Integer businessType;
/**
* 对应的流程实例Id
*/
@ApiModelProperty(value="对应的流程实例Id")
private String processInstanceId;
/**
* 受理Id, 通过这个可以得到鉴定号
*/
@ApiModelProperty(value="受理Id, 通过这个可以得到鉴定号")
private String identificationId;
/**
* 委托日期, 鉴定委托书打印日期
*/
@ApiModelProperty(value="委托日期, 鉴定委托书打印日期")
private LocalDateTime entrustmentTime;
/**
* 委托提交者, 后期可能会转给其他人user_id
*/
@ApiModelProperty(value="委托提交者, 后期可能会转给其他人user_id")
private String submitter;
/**
* 提交日期, 提交审核的日期
*/
@ApiModelProperty(value="提交日期, 提交审核的日期")
private LocalDateTime submitTime;
/**
* 鉴定委托单位编码
*/
@ApiModelProperty(value="鉴定委托单位编码")
private String clientOrgId;
/**
* 鉴定委托单位名称
*/
@ApiModelProperty(value="鉴定委托单位名称")
private String clientOrgName;
/**
* 通讯地址
*/
@ApiModelProperty(value="通讯地址")
private String clientAddress;
/**
* 邮政编码
*/
@ApiModelProperty(value="邮政编码")
private String clientPostcode;
/**
* 电话号码
*/
@ApiModelProperty(value="电话号码")
private String clientTel;
/**
* 传真号码
*/
@ApiModelProperty(value="传真号码")
private String clientFax;
/**
* 委托鉴定专业
*/
@ApiModelProperty(value="委托鉴定专业")
private String identificationDomain;
/**
* 鉴定机构名称
*/
@ApiModelProperty(value="鉴定机构名称")
private String identificationOrgName;
/**
* 定性分析
*/
@ApiModelProperty(value="定性分析")
private Boolean qualitativeAnalysis;
/**
* 定量分析
*/
@ApiModelProperty(value="定量分析")
private Boolean quantitativeAnalysis;
/**
* 其他鉴定要求
*/
@ApiModelProperty(value="其他鉴定要求")
private String otherIdentificationRequests;
/**
* 候选毒品列表(drug 对象的 json array)
*/
@ApiModelProperty(value="候选毒品列表(drug 对象的 json array)")
//@TableField(typeHandler = JacksonTypeHandler.class)
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<DrugLite> candidateDrugs;
/**
* 是否由委托方指定鉴定方法
*/
@ApiModelProperty(value="是否由委托方指定鉴定方法")
private Boolean isClientSpecifiedMethod;
/**
* 委托方指定的鉴定方法
*/
@ApiModelProperty(value="委托方指定的鉴定方法")
private String clientSpecifiedMethod;
/**
* 是否有损检验:0=无损,1=有损
*/
@ApiModelProperty(value="是否有损检验:0=无损,1=有损")
private Boolean destructiveAnalysis;
/**
* 检验的其他说明(鉴定事项确认书中要求, 审核人填写)
*/
@ApiModelProperty(value="检验的其他说明(鉴定事项确认书中要求, 审核人填写)")
private String otherIdentificationNotes;
/**
* 是否重新鉴定:0=否,1=重新鉴定
*/
@ApiModelProperty(value="是否重新鉴定:0=否,1=重新鉴定")
private Boolean reidentification;
/**
* 原鉴定机构
*/
@ApiModelProperty(value="原鉴定机构")
private String oldIdentificationOrgName;
/**
* 原鉴定文书
*/
@ApiModelProperty(value="原鉴定文书")
private String oldIdentificationDocument;
/**
* 原鉴定结果
*/
@ApiModelProperty(value="原鉴定结果")
private String oldIdentificationResult;
/**
* 重新鉴定理由
*/
@ApiModelProperty(value="重新鉴定理由")
private String reidentificationReason;
/**
* 回避的鉴定人及回避事由, json 格式
*/
@ApiModelProperty(value="回避的鉴定人及回避事由, json 格式")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<AvoidIdentifier> avoidIdentifier;
/**
* 指定鉴定人, 委托中指定鉴定人
*/
@ApiModelProperty(value="指定鉴定人, 委托中指定鉴定人")
private String specifiedIdentifier;
/**
* 其它约定事项,打印在鉴定事项确认书中的"约定->其他"
*/
@ApiModelProperty(value="其它约定事项,打印在鉴定事项确认书中的\"约定->其他\"")
private String otherAgreement;
/**
* 备注
*/
@ApiModelProperty(value="备注")
private String comments;
/**
* 候选审核人, user_id列表, 逗号分隔
*/
@ApiModelProperty(value="候选审核人, user_id列表, 逗号分隔")
private String checkCandidateUser;
/**
* 审核任务认领人
*/
@ApiModelProperty(value="审核任务认领人")
private String checkClaimUser;
/**
* 审核任务认领时间
*/
@ApiModelProperty(value="审核任务认领时间")
private LocalDateTime checkClaimTime;
/**
* 实际审核人, user_id
*/
@ApiModelProperty(value="实际审核人, user_id")
private String checkUser;
/**
* 审核时间
*/
@ApiModelProperty(value="审核时间")
private LocalDateTime checkTime;
/**
* 审核意见: (审批通过 审批不通过及原因)
*/
@ApiModelProperty(value="审核意见: (审批通过 审批不通过及原因)")
private String checkComments;
/**
* 审核次数记录
*/
@ApiModelProperty(value="审核次数记录")
private Integer checkTimes;
/**
* 专业全部物证检验状态: 0=未全部审核 1=已全部审核
*/
@ApiModelProperty(value="专业全部物证检验状态: 0=未全部审核 1=已全部审核")
private Boolean checkAllIdentificationMaterialConfirmed;
/**
* 候选审批人, user_id列表, 逗号分隔
*/
@ApiModelProperty(value="候选审批人, user_id列表, 逗号分隔")
private String approveCandidateUser;
/**
* 审批任务认领人
*/
@ApiModelProperty(value="审批任务认领人")
private String approveClaimUser;
/**
* 审批任务认领时间
*/
@ApiModelProperty(value="审批任务认领时间")
private LocalDateTime approveClaimTime;
/**
* 实际审批人, user_id
*/
@ApiModelProperty(value="实际审批人, user_id")
private String approveUser;
/**
* 审批时间
*/
@ApiModelProperty(value="审批时间")
private LocalDateTime approveTime;
/**
* 审批意见: (审批通过 审批不通过及原因)
*/
@ApiModelProperty(value="审批意见: (审批通过 审批不通过及原因)")
private String approveComments;
/**
* 审批次数:该字段在审核通过时初始化, 值为0或1时代表初审, 2代表复审
*/
@ApiModelProperty(value="审批次数:该字段在审核通过时初始化, 值为0或1时代表初审, 2代表复审")
private Integer approveTimes;
/**
* 送检确认人user_id
*/
@ApiModelProperty(value="送检确认人user_id")
private String deliverConfirmUser;
/**
* 送检确认时间
*/
@ApiModelProperty(value="送检确认时间")
private LocalDateTime deliverConfirmTime;
/**
* 送检确认意见
*/
@ApiModelProperty(value="送检确认意见")
private String deliverConfirmComments;
/**
* 送检日期
*/
@ApiModelProperty(value="送检日期")
private LocalDateTime deliverTime;
/**
* 送检操作提交用户user_id
*/
@ApiModelProperty(value="送检操作提交用户user_id")
private String deliverSubmitter;
// /**
// * 如果送检人1是系统用户, 记录用户id
// */
// @ApiModelProperty(value="如果送检人1是系统用户, 记录用户id")
// private String deliverer1UserId;
/**
* 送检人1姓名
*/
@ApiModelProperty(value="送检人1姓名")
private String deliverer1Name;
/**
* 送检人1职务
*/
@ApiModelProperty(value="送检人1职务")
private String deliverer1Position;
/**
* 送检人1证件名称
*/
@ApiModelProperty(value="送检人1证件名称")
private String deliverer1Cert;
/**
* 送检人1证件编号
*/
@ApiModelProperty(value="送检人1证件编号")
private String deliverer1Id;
/**
* 送检人1电话
*/
@ApiModelProperty(value="送检人1电话")
private String deliverer1Phone;
// /**
// * 如果送检人2是系统用户, 记录用户id
// */
// @ApiModelProperty(value="如果送检人2是系统用户, 记录用户id")
// private String deliverer2UserId;
/**
* 送检人2姓名
*/
@ApiModelProperty(value="送检人2姓名")
private String deliverer2Name;
/**
* 送检人2职务
*/
@ApiModelProperty(value="送检人2职务")
private String deliverer2Position;
/**
* 送检人2证件名称
*/
@ApiModelProperty(value="送检人2证件名称")
private String deliverer2Cert;
/**
* 送检人2证件编号
*/
@ApiModelProperty(value="送检人2证件编号")
private String deliverer2Id;
/**
* 送检人2电话
*/
@ApiModelProperty(value="送检人2电话")
private String deliverer2Phone;
// /**
// * 受理任务认领人
// */
// @ApiModelProperty(value="受理任务认领人")
// private String acceptClaimUser;
//
// /**
// * 受理任务认领时间
// */
// @ApiModelProperty(value="受理任务认领时间")
// private LocalDateTime acceptClaimTime;
/**
* 受理编号
*/
@ApiModelProperty(value="受理编号")
private String acceptNo;
/**
* 受理人user_id
*/
@ApiModelProperty(value="受理人user_id")
private String acceptUser;
/**
* 受理时间
*/
@ApiModelProperty(value="受理时间")
private LocalDateTime acceptTime;
/**
* 受理意见
*/
@ApiModelProperty(value="受理意见")
private String acceptComments;
/**
* 鉴定事项确认书是否已经打印
*/
@ApiModelProperty(value="鉴定事项确认书是否已经打印")
private Boolean identificationItemsConfirmPrinted;
/**
* 送检受理信息, 以 json 格式记录送检受理各环节的文字意见
*/
@ApiModelProperty(value="送检受理信息, 以 json 格式记录送检受理各环节的文字意见")
// @TableField(typeHandler = JacksonTypeHandler.class)
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<UpdateInfo> processInfo;
/**
* 报告领取方式: 0=自取, 1=代领, 2=邮寄
*/
@ApiModelProperty(value="报告领取方式: 0=自取, 1=代领, 2=邮寄")
private String reportReceiveMode;
/**
* 报告领取人1的 user id
*/
@ApiModelProperty(value="报告领取人1的 user id")
private String reportReceiver1UserId;
/**
* 报告领取人1的姓名
*/
@ApiModelProperty(value="报告领取人1的姓名")
private String reportReceiver1Name;
/**
* 报告领取人1的职务
*/
@ApiModelProperty(value="报告领取人1的职务")
private String reportReceiver1Position;
/**
* 报告领取人1的证件类型
*/
@ApiModelProperty(value="报告领取人1的证件类型")
private String reportReceiver1Cert;
/**
* 报告领取人1的证件号
*/
@ApiModelProperty(value="报告领取人1的证件号")
private String reportReceiver1Id;
/**
* 报告领取人1的电话
*/
@ApiModelProperty(value="报告领取人1的电话")
private String reportReceiver1Phone;
/**
* 报告领取人2的 user id
*/
@ApiModelProperty(value="报告领取人2的 user id")
private String reportReceiver2UserId;
/**
* 报告领取人2的姓名
*/
@ApiModelProperty(value="报告领取人2的姓名")
private String reportReceiver2Name;
/**
* 报告领取人2的职务
*/
@ApiModelProperty(value="报告领取人2的职务")
private String reportReceiver2Position;
/**
* 报告领取人2的证件类型
*/
@ApiModelProperty(value="报告领取人2的证件类型")
private String reportReceiver2Cert;
/**
* 报告领取人2的证件号
*/
@ApiModelProperty(value="报告领取人2的证件号")
private String reportReceiver2Id;
/**
* 报告领取人2的电话
*/
@ApiModelProperty(value="报告领取人2的电话")
private String reportReceiver2Phone;
/**
* 报告发放人user_id(通常是受理员)
*/
@ApiModelProperty(value="报告发放人user_id(通常是受理员)")
private String reportSenderUserId;
/**
* 报告发放时间
*/
@ApiModelProperty(value="报告发放时间")
private LocalDateTime reportSentTime;
/**
* 报告领取人1领取报告时的签名
*/
@ApiModelProperty(value="报告领取人1领取报告时的签名")
private String reportReceiver1Signature;
/**
* 报告领取人2领取报告时的签名
*/
@ApiModelProperty(value="报告领取人2领取报告时的签名")
private String reportReceiver2Signature;
/**
* 检材领取方式: 0=自取, 1=实验室自行处理
*/
@ApiModelProperty(value="检材领取方式: 0=自取, 1=实验室自行处理")
private Integer sampleReceiveMode;
/**
* 如果检材领取人1是系统用户, 记录userId
*/
@ApiModelProperty(value="如果检材领取人1是系统用户, 记录userId")
private String sampleReceiver1UserId;
/**
* 检材领取人1姓名
*/
@ApiModelProperty(value="检材领取人1姓名")
private String sampleReceiver1Name;
/**
* 检材领取人1职位
*/
@ApiModelProperty(value="检材领取人1职位")
private String sampleReceiver1Position;
/**
* 检材领取人1证件类型
*/
@ApiModelProperty(value="检材领取人1证件类型")
private String sampleReceiver1Cret;
/**
* 检材领取人1证件号
*/
@ApiModelProperty(value="检材领取人1证件号")
private String sampleReceiver1Id;
/**
* 检材领取人1电话
*/
@ApiModelProperty(value="检材领取人1电话")
private String sampleReceiver1Phone;
/**
* 如果检材领取人2是系统用户, 记录userId
*/
@ApiModelProperty(value="如果检材领取人2是系统用户, 记录userId")
private String sampleReceiver2UserId;
/**
* 检材领取人2姓名
*/
@ApiModelProperty(value="检材领取人2姓名")
private String sampleReceiver2Name;
/**
* 检材领取人2职位
*/
@ApiModelProperty(value="检材领取人2职位")
private String sampleReceiver2Position;
/**
* 检材领取人2证件类型
*/
@ApiModelProperty(value="检材领取人2证件类型")
private String sampleReceiver2Cret;
/**
* 检材领取人2证件号
*/
@ApiModelProperty(value="检材领取人2证件号")
private String sampleReceiver2Id;
/**
* 检材领取人2电话
*/
@ApiModelProperty(value="检材领取人2电话")
private String sampleReceiver2Phone;
/**
* 检材发放人, 鉴定机构工作人员user_id
*/
@ApiModelProperty(value="检材发放人, 鉴定机构工作人员user_id")
private String sampleSenderUserId;
/**
* 检材发放时间
*/
@ApiModelProperty(value="检材发放时间")
private String sampleSentTime;
/**
* 检材领取人1签名
*/
@ApiModelProperty(value="检材领取人1签名")
private String sampleReceiver1PersonSignature;
/**
* 检材领取人2签名
*/
@ApiModelProperty(value="检材领取人2签名")
private String sampleReceiver2PersonSignnature;
/**
* 状态
*/
@ApiModelProperty(value="状态")
private Integer status;
/**
* 上一个状态
*/
@ApiModelProperty(value="上一个状态")
private Integer previousStatus;
/**
* 数据来源,用于区别数据来自自身系统还是外部系统
*/
@ApiModelProperty(value="数据来源")
private Integer dataSources;
/**
* 第三方数据系统中的委托编号,
*/
@ApiModelProperty(value="禁毒数据平台的委托编号")
private String thirdSysEntrustNo;
/**
* 第三方系统受理编号,
*/
@ApiModelProperty(value="第三方系统受理编号")
private String acceptNoThirdSys;
/**
* 鉴定要求,
*/
@ApiModelProperty(value="鉴定要求")
private String entrustRequirement;
/**
* 邮寄地址,
*/
@ApiModelProperty(value="邮寄地址")
private String postAddress;
/**
* 是否流转
*/
@ApiModelProperty(value="是否流转,0,未流转1是已经流转")
private Integer isTrans;
/**
* 是否退回,
*/
@ApiModelProperty(value="是否退回0未退回-1已退回")
private Integer returnOrNot;
}

View File

@@ -0,0 +1,543 @@
package digital.laboratory.platform.entrustment.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
//import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import digital.laboratory.platform.sys.entity.DrugLite;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import digital.laboratory.platform.sys.entity.entrustment.IMAdditionalProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang.StringUtils;
/**
* 检材信息
*
* @author Zhang Xiaolong created at 2022-04-20
* @describe 检材信息 实体类
*/
@Data
@TableName(value = "b_entrustment_identification_material", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "检材信息")
public class EntrustmentIdentificationMaterial extends BaseEntity {
/**
* 检材id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "检材id")
private String id;
/**
* 检材编号
*/
@ApiModelProperty(value = "检材编号")
private String imNo;
/**
* 物证id
*/
@ApiModelProperty(value = "物证id")
private String evidenceId;
/**
* 案件id
*/
@ApiModelProperty(value = "案件id")
private String caseId;
/**
* 委托id
*/
@ApiModelProperty(value = "委托id")
private String entrustmentId;
/**
* 检材名称
*/
@ApiModelProperty(value = "检材名称")
private String name;
/**
* 检材类别:继承所取物证的类别或从物证类别选择
*/
@ApiModelProperty(value = "检材类别:继承所取物证的类别或从物证类别选择")
private String type;
/**
* 检材类别名称:继承所取物证的类别或从物证类别选择
* 2023/5/31 在咸阳分中心添加
*/
@ApiModelProperty(value = "检材类别名称:继承所取物证的类别或从物证类别选择")
private String typeName;
/**
* 检材颜色:继承所取物证颜色或手动填入
*/
@ApiModelProperty(value = "检材颜色:继承所取物证颜色或手动填入")
private String color;
/**
* 检材性状:继承所取物证性状或从物证性状类别选择
*/
@ApiModelProperty(value = "检材性状:继承所取物证性状或从物证性状类别选择")
private String form;
/**
* 检材性状:继承所取物证性状或从物证性状类别选择
* * 2023/5/31 在咸阳分中心添加
*/
@ApiModelProperty(value = "检材性状名称:继承所取物证性状或从物证性状类别选择")
private String formName;
/**
* 检材情况之承载物名称, 例如 棉签 2 棵, 粉末 少许
*/
@ApiModelProperty(value = "检材情况之承载物名称, 例如 棉签 2 棵, 粉末 少许")
private String fundName;
/**
* 检材情况之承载物数量, 例如 5 颗, 3包
*/
@ApiModelProperty(value = "检材情况之承载物数量, 例如 5 颗, 3包")
private Integer fundQuantity;
/**
* 检材情况之承载物单位, 例如 5 颗, 3包
*/
@ApiModelProperty(value = "检材情况之承载物单位, 例如 5 颗, 3包")
private String fundUnit;
/**
* 检材数量, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value = "检材数量, 例如 3.8 克 或 4.5毫升")
private BigDecimal quantity;
/**
* 计量单位, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value = "计量单位, 例如 3.8 克 或 4.5毫升")
private String unit;
/**
* 附加属性, 如:体积3毫升,密码123,型号abc
*/
@ApiModelProperty(value = "附加属性, 如:体积3毫升,密码123,型号abc")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<IMAdditionalProperty> additionalProperties;
/**
* 提取方法
*/
@ApiModelProperty(value = "提取方法")
private String drawWay;
/**
* 所有者姓名
*/
@ApiModelProperty(value = "所有者姓名")
private String personName;
/**
* 所有者证件类型
*/
@ApiModelProperty(value = "所有者证件类型")
private String personCert;
/**
* 所有者证件号
*/
@ApiModelProperty(value = "所有者证件号")
private String personId;
/**
* 所有者性别,公安系统编码: 1=男 2=女 0=未知
*/
@ApiModelProperty(value = "所有者性别,公安系统编码: 1=男 2=女 0=未知")
private Integer personGender;
/**
* 所有者国籍
*/
@ApiModelProperty(value = "所有者国籍")
private String personNationality;
/**
* 所有者民族编码,公安系统编码
*/
@ApiModelProperty(value = "所有者民族编码,公安系统编码")
private Integer personNation;
/**
* 所有者地址
*/
@ApiModelProperty(value = "所有者地址")
private String personAddress;
/**
* 所有者年龄
*/
@ApiModelProperty(value = "所有者年龄")
private Integer personAge;
/**
* 采集人1姓名
*/
@ApiModelProperty(value = "采集人1姓名")
private String take1Name;
/**
* 采集人1职务
*/
@ApiModelProperty(value = "采集人1职务")
private String take1Position;
/**
* 采集人1证件名称
*/
@ApiModelProperty(value = "采集人1证件名称")
private String take1Cert;
/**
* 采集人1证件号
*/
@ApiModelProperty(value = "采集人1证件号")
private String take1Id;
/**
* 采集人1联系电话
*/
@ApiModelProperty(value = "采集人1联系电话")
private String take1Phone;
/**
* 采集人2姓名
*/
@ApiModelProperty(value = "采集人2姓名")
private String take2Name;
/**
* 采集人2职务
*/
@ApiModelProperty(value = "采集人2职务")
private String take2Position;
/**
* 采集人2证件名称
*/
@ApiModelProperty(value = "采集人2证件名称")
private String take2Cert;
/**
* 采集人2证件号
*/
@ApiModelProperty(value = "采集人2证件号")
private String take2Id;
/**
* 采集人2联系电话
*/
@ApiModelProperty(value = "采集人2联系电话")
private String take2Phone;
/**
* 采集日期
*/
@ApiModelProperty(value = "采集日期")
private LocalDateTime takeTime;
/**
* 见证人姓名
*/
@ApiModelProperty(value = "见证人姓名")
private String witnessName;
/**
* 见证人证件名称
*/
@ApiModelProperty(value = "见证人证件名称")
private String witnessCert;
/**
* 见证人证件号
*/
@ApiModelProperty(value = "见证人证件号")
private String witnessId;
/**
* 包装情况:纸袋,纸盒,纸箱,自定义
*/
@ApiModelProperty(value = "包装情况:纸袋,纸盒,纸箱,自定义")
private String pack;
/**
* 包装情况名称:纸袋,纸盒,纸箱,自定义
* 2023/5/31 在咸阳分中心添加
*/
@ApiModelProperty(value = "包装情况名称:纸袋,纸盒,纸箱,自定义")
private String packName;
/**
* 存储方法:常规,冷藏,特殊
*/
@ApiModelProperty(value = "存储方法:常规,冷藏,特殊")
private String storageMethod;
/**
* 候选毒品列表(drug 对象的 json array)
*/
@ApiModelProperty(value = "候选毒品列表(drug 对象的 json array)")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<DrugLite> candidateDrugs;
/**
* 检材概要
*/
@ApiModelProperty(value = "检材概要")
private String description;
/**
* 审核时间
*/
@ApiModelProperty(value = "审核时间")
private LocalDateTime checkTime;
/**
* 审核是否通过: 1=审核通过
*/
@ApiModelProperty(value = "审核是否通过: 1=审核通过")
private Integer checkPassed;
/**
* 审批时间
*/
@ApiModelProperty(value = "审批时间")
private LocalDateTime approveTime;
/**
* 审批是否通过: 1=审批通过
*/
@ApiModelProperty(value = "审批是否通过: 1=审批通过")
private Integer approvePassed;
/**
* 受理时间
*/
@ApiModelProperty(value = "受理时间")
private LocalDateTime acceptTime;
/**
* 打印出的受理时间因为要将date类型转为String类型
*/
@ApiModelProperty(value = "打印出的受理时间")
@TableField(exist = false)
private String printAcceptTime;
/**
* 是否受理: 0=未受理, 1=已受理, -1=不予受理
*/
@ApiModelProperty(value = "是否受理: 0=未受理, 1=已受理, -1=不予受理")
private Integer acceptPassed;
/**
* 提供的样本1是否存在, 应该总是存在
*/
// @ApiModelProperty(value="提供的样本1是否存在, 应该总是存在")
// private Boolean providedSample1Present;
/**
* 提供的样本1编号
*/
@ApiModelProperty(value = "提供的样本1编号")
private String providedSample1No;
/**
* 提供的样本1承载物数量(重量), 例如 5颗, 3包
*/
@ApiModelProperty(value = "提供的样本1承载物数量(重量), 例如 5颗, 3包")
private Integer providedSample1FundQuantity;
/**
* 提供的样本1数量, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value = "提供的样本1数量, 例如 3.8 克 或 4.5毫升")
private BigDecimal providedSample1Quantity;
/**
* 提供的样本2是否存在
*/
@ApiModelProperty(value = "提供的样本2是否存在")
private Boolean providedSample2Present;
/**
* 提供的样本2编号
*/
@ApiModelProperty(value = "提供的样本2编号")
private String providedSample2No;
/**
* 提供的样本2承载物数量(重量), 例如 5颗, 3包
*/
@ApiModelProperty(value = "提供的样本2承载物数量(重量), 例如 5颗, 3包")
private Integer providedSample2FundQuantity;
/**
* 提供的样本2数量, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value = "提供的样本2数量, 例如 3.8 克 或 4.5毫升")
private BigDecimal providedSample2Quantity;
/**
* 是否已分样: 0=未分样, 1=已分样
*/
@ApiModelProperty(value = "是否已分样: 0=未分样, 1=已分样")
private Boolean splitedSample;
/**
* 样本1是否存在, 应该总是存在
*/
// @ApiModelProperty(value="样本1是否存在, 应该总是存在")
// private Boolean sample1Present;
/**
* 样本1编号
*/
@ApiModelProperty(value = "样本1编号")
private String sample1No;
/**
* 样本1承载物数量(重量), 例如 5颗, 3包
*/
@ApiModelProperty(value = "样本1承载物数量(重量), 例如 5颗, 3包")
private Integer sample1FundQuantity;
/**
* 样本1数量, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value = "样本1数量, 例如 3.8 克 或 4.5毫升")
private BigDecimal sample1Quantity;
/**
* 样本1盒子 id
*/
@ApiModelProperty(value = "样本1盒子 id")
private String sample1BoxId;
/**
* 样本2是否存在
*/
@ApiModelProperty(value = "样本2是否存在")
private Boolean sample2Present;
/**
* 样本2编号
*/
@ApiModelProperty(value = "样本2编号")
private String sample2No;
/**
* 样本2承载物数量(重量), 例如 5颗, 3包
*/
@ApiModelProperty(value = "样本2承载物数量(重量), 例如 5颗, 3包")
private Integer sample2FundQuantity;
/**
* 样本2数量, 例如 3.8 克 或 4.5毫升
*/
@ApiModelProperty(value = "样本2数量, 例如 3.8 克 或 4.5毫升")
private BigDecimal sample2Quantity;
/**
* 样本2盒子 id
*/
@ApiModelProperty(value = "样本2盒子 id")
private String sample2BoxId;
//add by xy 2023-04-15,记录复秤的结果而增加的字段信息
/**
* 样本1复秤后的重量
*/
@ApiModelProperty(value = "样本1的复秤重量")
private BigDecimal sample1RepeatWeigh;
/**
* 样本2复秤后的重量
*/
@ApiModelProperty(value = "样本2的复秤重量")
private BigDecimal sample2RepeatWeigh;
/**
* 分析项目 定性分析,定量分析,定性定量分析,关联性判断 其他
* 1.定性分析 2.定量分析 3.定性定量分析 4.关联性判断 5。其他
*/
private Integer analysisOption;
/**
* 数据来源,用于区别数据来自自身系统还是外部系统
*/
@ApiModelProperty(value = "数据来源")
private Integer dataSources;
/**
* 检材受理编号,一般是绑定检材所属的委托的受理编号
*/
@ApiModelProperty(value = "检材受理编号")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String acceptNo;
/**
* 打印委托书的时候需要对检材的序号,但是这个时候检材又没有受理,所以添加一个顺序号
*/
@ApiModelProperty(value = "委托检材顺序号,由系统根据录入顺序生成")
private Integer orderNo;
public String getOrderNo1() {
return this.orderNo + "号检材";
}
public String getSampleCondition() {
if (this.getSample2FundQuantity() != null && this.getSample2FundQuantity() > 0) {
return this.getSample2FundQuantity() + this.getFundUnit();
} else {
return "";
}
}
/**
* 获取检材的描述性编号(简短称呼),如果还没有受理之前,是没有受理编号的,所以未受理之前,使用不了这个函数
*
* @return
*/
public String getShortNameDes() {
String acceptNo = this.getAcceptNo();
if (StringUtils.isNotBlank(acceptNo)) {
int seqNo = Integer.parseInt(acceptNo.substring(acceptNo.lastIndexOf("-") + 1));
return seqNo + "";
} else {
return "0号";
}
}
/**
* 取检材的序号
*
* @return
*/
public int getIndex() {
String acceptNo = this.getAcceptNo();
if (StringUtils.isNotBlank(acceptNo)) {
int seqNo = Integer.parseInt(acceptNo.substring(acceptNo.lastIndexOf("-") + 1));
return seqNo;
} else {
return 0;
}
}
}

View File

@@ -0,0 +1,107 @@
package digital.laboratory.platform.entrustment.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 2022-07-26
* @describe 毛发检测任务 实体类
*/
@Data
@TableName(value = "b_hair_job", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "毛发检测任务")
public class HairJob extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 根任务id
*/
@ApiModelProperty(value="根任务id")
private String rootId;
/**
* 任务名称
*/
@ApiModelProperty(value="任务名称")
private String name;
/**
* 任务内容描述说明
*/
@ApiModelProperty(value="任务内容描述说明")
private String description;
/**
* 任务编号
*/
@ApiModelProperty(value="任务编号")
private String jobNo;
/**
* 任务发布单位
*/
@ApiModelProperty(value="任务发布单位")
private String jobIssueOrg;
/**
* 任务执行单位
*/
@ApiModelProperty(value="任务执行单位")
private String jobExecOrg;
/**
* 任务来源
*/
@ApiModelProperty(value="任务来源")
private String jobFrom;
/**
* 任务截止日期
*/
@ApiModelProperty(value="任务截止日期")
private LocalDateTime expirationDate;
/**
* 任务开始日期
*/
@ApiModelProperty(value="任务开始日期")
private LocalDateTime startDate;
/**
* 任务备注
*/
@ApiModelProperty(value="任务备注")
private String comments;
/**
* 任务类型: 毛发检测/污水检测...
*/
@ApiModelProperty(value="任务类型: 毛发检测/污水检测...")
private String jobType;
/**
* xxx任务检测类型: 毛发检测:社区戒毒人员检测、公职人员、招考人员。/污水检测:污水处理厂、自然水体、其它水体。...
*/
@ApiModelProperty(value="xxx任务检测类型: 毛发检测:社区戒毒人员检测、公职人员、招考人员。/污水检测:污水处理厂、自然水体、其它水体。...")
private String xxxjobIdentifyType;
}

View File

@@ -0,0 +1,194 @@
package digital.laboratory.platform.entrustment.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 2022-07-26
* @describe 毛发任务的检材信息 实体类
*/
@Data
@TableName(value = "b_hair_job_identification_material", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "毛发任务的检材信息")
public class HairJobIdentificationMaterial extends BaseEntity {
/**
* 检材id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "检材id")
private String id;
/**
* 任务id
*/
@ApiModelProperty(value = "任务id")
private String jobId;
/**
* 任务清单项id
*/
@ApiModelProperty(value = "任务清单项id")
private String jobItemId;
/**
* 检材编号
*/
@ApiModelProperty(value = "检材编号")
private String imNo;
/**
* A样编号
*/
@ApiModelProperty(value = "A样编号")
private String sample1No;
/**
* B样编号
*/
@ApiModelProperty(value = "B样编号")
private String sample2No;
/**
* A样盒子
*/
@ApiModelProperty(value = "A样盒子")
private String sample1BoxId;
/**
* B样盒子
*/
@ApiModelProperty(value = "B样盒子")
private String sample2BoxId;
/**
* 所有者姓名
*/
@ApiModelProperty(value = "所有者姓名")
private String personName;
/**
* 所有者身份证号
*/
@ApiModelProperty(value = "所有者身份证号")
private String personCard;
/**
* 人员类别
*/
@ApiModelProperty(value = "人员类别")
private String personType;
/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称")
private String projectName;
// /**
// * 社区戒毒人员在社区执行时间是否超过 6 个月
// */
// @ApiModelProperty(value = "社区戒毒人员在社区执行时间是否超过 6 个月")
// private String executionTime;
/**
* 曾经吸毒种类
*/
@ApiModelProperty(value = "曾经吸毒种类")
private String drugType;
/**
* 采样人
*/
@ApiModelProperty(value = "采样人")
private String collector;
/**
* 采样单位
*/
@ApiModelProperty(value = "采样单位")
private String collectorGroup;
/**
* 采样时间
*/
@ApiModelProperty(value = "采样时间")
private LocalDateTime collectTime;
/**
* 采样地点
*/
@ApiModelProperty(value = "采样地点")
private String collectPlace;
/**
* 监督人员
*/
@ApiModelProperty(value = "监督人员")
private String supervisor;
/**
* 受理时间
*/
@ApiModelProperty(value = "受理时间")
private LocalDateTime acceptTime;
/**
* 受理是否通过: 0=未受理, 1=受理通过, -1=受理被拒绝
*/
@ApiModelProperty(value = "受理是否通过: 0=未受理, 1=受理通过, -1=受理被拒绝")
private Integer acceptPassed;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String comments;
/**
* 检材名称
*/
@ApiModelProperty(value = "检材名称")
private String name;
/**
* 检材数量
*/
@ApiModelProperty(value = "检材数量")
private BigDecimal quantity;
/**
* A样数量
*/
@ApiModelProperty(value = "A样数量")
private BigDecimal sample1Quantity;
/**
* B样数量
*/
@ApiModelProperty(value = "B样数量")
private BigDecimal sample2Quantity;
/**
* 计量单位
*/
@ApiModelProperty(value = "计量单位")
private String unit;
}

View File

@@ -0,0 +1,46 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 鉴定表,一个鉴定可能会有多个委托 实体类
*/
@Data
@TableName(value = "b_identification", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "鉴定表,一个鉴定可能会有多个委托")
public class Identification extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "id")
private String id;
/**
* 鉴定号,受理号
*/
@ApiModelProperty(value = "鉴定号,受理号")
private String identificationNo;
/**
* 状态: 0=鉴定中,-1=已终止, 1=已结束
*/
@ApiModelProperty(value = "状态: 0=鉴定中,-1=已终止, 1=已结束")
private Integer status;
}

View File

@@ -0,0 +1,77 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 样品包入库出库日志 实体类
*/
@Data
@TableName("b_sample_box_in_log")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样品包入库出库日志")
public class SampleBoxInLog extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 样品id
*/
@ApiModelProperty(value="样品id")
private String boxId;
/**
* 是否入库
*/
@ApiModelProperty(value="是否入库")
private Boolean isIn;
/**
* 入库出库原因编码
*/
@ApiModelProperty(value="入库出库原因编码")
private Integer reason;
/**
* 出入库当事人
*/
@ApiModelProperty(value="出入库当事人")
private String personId;
/**
* 分包的来源盒子id
*/
@ApiModelProperty(value="分包的来源盒子id")
private String fromBox;
/**
* 合包的去向盒子id
*/
@ApiModelProperty(value="合包的去向盒子id")
private String toBox;
/**
* 检材仓库管理员
*/
@ApiModelProperty(value="检材仓库管理员")
private String storeKeeper;
}

View File

@@ -0,0 +1,59 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 样品库 实体类
*/
@Data
@TableName(value = "b_sample_store", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样品库")
public class SampleStore extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 样品库类型: 0=样品库 1=暂存库
*/
@ApiModelProperty(value="样品库类型: 0=样品库 1=暂存库")
private String type;
/**
* 样品库管理员1
*/
@ApiModelProperty(value="样品库管理员1")
private String keeper1;
/**
* 样品库管理员2
*/
@ApiModelProperty(value="样品库管理员2")
private String keeper2;
/**
* comments
*/
@ApiModelProperty(value="comments")
private String comments;
}

View File

@@ -0,0 +1,65 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 样品库管理员换班日志 实体类
*/
@Data
@TableName(value = "b_sample_store_change_duty_log", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样品库管理员换班日志")
public class SampleStoreChangeDutyLog extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 老的样品库管理员1
*/
@ApiModelProperty(value="老的样品库管理员1")
private String oldKeeper1;
/**
* 老的样品库管理员2
*/
@ApiModelProperty(value="老的样品库管理员2")
private String oldKeeper2;
/**
* 新的样品库管理员1
*/
@ApiModelProperty(value="新的样品库管理员1")
private String newKeeper1;
/**
* 新的样品库管理员2
*/
@ApiModelProperty(value="新的样品库管理员2")
private String newKeeper2;
/**
* comments
*/
@ApiModelProperty(value="comments")
private String comments;
}

View File

@@ -0,0 +1,83 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 样品库入库出库日志 实体类
*/
@Data
@TableName(value = "b_sample_store_log", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "样品库入库出库日志")
public class SampleStoreLog extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 样品id
*/
@ApiModelProperty(value="样品id")
private String boxId;
/**
* 是否入库
*/
@ApiModelProperty(value="是否入库")
private Boolean isIn;
/**
* 入库出库原因编码
*/
@ApiModelProperty(value="入库出库原因编码")
private Integer reason;
/**
* 出入库当事人
*/
@ApiModelProperty(value="出入库当事人")
private String personId;
/**
* 分包的来源盒子id
*/
@ApiModelProperty(value="分包的来源盒子id")
private String fromBox;
/**
* 合包的去向盒子id
*/
@ApiModelProperty(value="合包的去向盒子id")
private String toBox;
/**
* 检材仓库管理员1
*/
@ApiModelProperty(value="检材仓库管理员1")
private String storeKeeper1;
/**
* 检材仓库管理员2
*/
@ApiModelProperty(value="检材仓库管理员2")
private String storeKeeper2;
}

View File

@@ -0,0 +1,53 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 检材柜 实体类
*/
@Data
@TableName(value = "b_storage_cabinet", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "检材柜")
public class StorageCabinet extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 柜子编号,用于柜子控制API
*/
@ApiModelProperty(value="柜子编号,用于柜子控制API")
private String cabinetNo;
/**
* 暂存柜类型:待检, 已检待返, 已检待销毁, 长期存放待
*/
@ApiModelProperty(value="暂存柜类型:待检, 已检待返, 已检待销毁, 长期存放待")
private String type;
/**
* comments
*/
@ApiModelProperty(value="comments")
private String comments;
}

View File

@@ -0,0 +1,77 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 暂存柜,每行一个单元格 实体类
*/
@Data
@TableName(value = "b_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 cabinetNo;
/**
* 单元格号
*/
@ApiModelProperty(value="单元格号")
private Integer cellNo;
/**
* 取件码
*/
@ApiModelProperty(value="取件码")
private Integer openCode;
/**
* 取件码过期时间
*/
@ApiModelProperty(value="取件码过期时间")
private LocalDateTime openCodeExpiration;
/**
* 单元格可能性: 0=不可用(保留), 1=可用
*/
@ApiModelProperty(value="单元格可能性: 0=不可用(保留), 1=可用")
private Boolean available;
/**
* 单元格状态: 0=空, 1=已有物品
*/
@ApiModelProperty(value="单元格状态: 0=空, 1=已有物品")
private Boolean status;
/**
* boxId
*/
@ApiModelProperty(value="boxId")
private String boxId;
}

View File

@@ -0,0 +1,53 @@
package digital.laboratory.platform.entrustment.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 2022-07-15
* @describe 暂存柜记录 实体类
*/
@Data
@TableName(value = "b_storage_cell_log", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "暂存柜记录")
public class StorageCellLog extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 单元格标识
*/
@ApiModelProperty(value="单元格标识")
private String cellId;
/**
* 操作: 存放/取出
*/
@ApiModelProperty(value="操作: 存放/取出")
private Boolean operate;
/**
* 存放或取出的盒子
*/
@ApiModelProperty(value="存放或取出的盒子")
private String boxId;
}

View File

@@ -0,0 +1,71 @@
package digital.laboratory.platform.entrustment.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 2022-08-25
* @describe 采集员 实体类
*/
@Data
@TableName(value = "b_taker", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "采集员")
public class Taker extends BaseEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* 采集员拥有者userId
*/
@ApiModelProperty(value="采集员拥有者userId")
private String ownerUserId;
/**
* 采集员姓名
*/
@ApiModelProperty(value="采集员姓名")
private String name;
/**
* 采集员职务
*/
@ApiModelProperty(value="采集员职务")
private String position;
/**
* 采集员证件名称
*/
@ApiModelProperty(value="采集员证件名称")
private String cert;
/**
* 采集员证件编号
*/
@ApiModelProperty(value="采集员证件编号")
private String idnum;
/**
* 采集员电话
*/
@ApiModelProperty(value="采集员电话")
private String phone;
}

View File

@@ -0,0 +1,105 @@
package digital.laboratory.platform.entrustment.enums;
import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 委托状态类
* <p>
* 在委托中除了保存委托的当前状态之外,还保存委托进行当前状态之前的状态。
* 如果两个状态都是待提交, 则说明委托真的是刚创建待提交,而不是从其他的审核、审批节点转过来的。
*
* 状态分为两个部分: 流程中的位置, 原因
* 例如委托在处于"等待提交"时, 这是流程中的位置, 此时创建者可以对委托进行修改、取消、提交等操作。
* 达到这个位置的原因可能是: 已创建等提交、审核被驳回、审批被驳回、送检确认被驳回、受理被拒等
* 业务本身并不关心达到这个位置的原因, 但是用户关心。所以, 我们分成2个部分, 以避免程序的复杂性。
*/
@Getter
@RequiredArgsConstructor
public enum EntrustmentStatusConstants {
ENTRUSTMENT_STATUS_CREATED(0, "待提交"), // 已创建待提交
// ENTRUSTMENT_STATUS_CHECK_REJECTED(-1, "审核被驳回"), // 审核被驳回
// ENTRUSTMENT_STATUS_APPROVE_REJECTED(-2, "审批被驳回"), // 审批被驳回
ENTRUSTMENT_STATUS_WAITING_CHECK_CLAIM(1, "待审核"), // 已提交, 待审核人员认领审核任务
ENTRUSTMENT_STATUS_WAITING_CHECK(2, "审核中"), // 审核任务已认领, 审核中
ENTRUSTMENT_STATUS_WAITING_APPROVE_CLAIM(3, "待审批"), // 审核通过, 待审批人员认领审批任务
ENTRUSTMENT_STATUS_WAITING_APPROVE(4, "审批中"), // 审批任务已认领, 待审批
ENTRUSTMENT_STATUS_WAITING_CONFIRM(5, "待送检确认"), // 审批通过, 待送检确认
ENTRUSTMENT_STATUS_WAITING_DELIVER(6, "送检确认通过, 待送检"),
ENTRUSTMENT_STATUS_WAITING_ACCEPT(7, "已送检待受理"),
//ENTRUSTMENT_STATUS_ACCEPTING(8, "正在受理中"), // 受理过程比较花时间
ENTRUSTMENT_STATUS_ACCEPTED(9, "已受理, 进入检验环节"),
ENTRUSTMENT_STATUS_TEST_FINISH(10, "检验完毕"),
ENTRUSTMENT_STATUS_COMPLETED(99, "委托已完成"), // 已受理, 已完成鉴定, 结束
ENTRUSTMENT_STATUS_TERMINATED(98, "委托已终止"), // 已受理, 无法完成鉴定, 结束
ENTRUSTMENT_STATUS_ABORTED(97, "已中止"); // 在受理之前被中止
// 以下状态信息需要确认
// String ENTRUSTMENT_STATUS_IDENTIFYING = "检验中";
// String ENTRUSTMENT_STATUS_IDENTIFIED = "已检验";
// String ENTRUSTMENT_STATUS_ANALYSED = "已分析";
// String ENTRUSTMENT_STATUS_WAITING_MARK_REPORT = "等制作文书";
// String ENTRUSTMENT_STATUS_COMPLETED = "已完成";
// String ENTRUSTMENT_STATUS_WAITING_REPLENISH_SAMPLES = "待补充样本";
/**
* 流程中的位置
*/
private final int status;
/**
* 描述
*/
private final String description;
public static String getStatusDescription(Integer theStatus) {
if (theStatus == null) {
theStatus = 0;
}
for (EntrustmentStatusConstants st : EntrustmentStatusConstants.values()) {
if (st.getStatus() == theStatus) {
return st.description;
}
}
return "";
}
public static int taskDefinitionKeyToStatus(String taskDefinitionKey) {
if (StrUtil.isBlank(taskDefinitionKey)) {
return -1; // 空的 key
}
if (StrUtil.equalsIgnoreCase(taskDefinitionKey, "entrustmentCreate")) {
return ENTRUSTMENT_STATUS_CREATED.getStatus();
}
else if (StrUtil.equalsIgnoreCase(taskDefinitionKey, "entrustmentCheck")) {
return ENTRUSTMENT_STATUS_WAITING_CHECK_CLAIM.getStatus();
}
else if (StrUtil.equalsIgnoreCase(taskDefinitionKey, "entrustmentApprove")) {
return ENTRUSTMENT_STATUS_WAITING_APPROVE_CLAIM.getStatus();
}
else if (StrUtil.equalsIgnoreCase(taskDefinitionKey, "deliverConfirm")) {
return ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus();
}
else if (StrUtil.equalsIgnoreCase(taskDefinitionKey, "entrustmentWaitforDeliver")) {
return ENTRUSTMENT_STATUS_WAITING_DELIVER.getStatus();
}
else if (StrUtil.equalsIgnoreCase(taskDefinitionKey, "entrustmentAccept")) {
return ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus();
}
else {
return -1;
}
}
public int getStatus() {
return status;
}
}

View File

@@ -0,0 +1,58 @@
package digital.laboratory.platform.entrustment.handler;
import digital.laboratory.platform.common.core.entity.PersonFaceIdentifyInfo;
import digital.laboratory.platform.common.core.util.Msg;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.sewage.entity.PersonalIdentityVerifier;
import digital.laboratory.platform.sewage.feign.RemotePersonalIdentityVerifierService;
import digital.laboratory.platform.sewage.feign.RemoteWebSocketService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class ActiveMQListener {
private static final Logger logger = LoggerFactory.getLogger(ActiveMQListener.class);
@Resource
private RemoteWebSocketService webSocketService;
@Resource
private RemotePersonalIdentityVerifierService personalIdentityVerifierService;
/**
*@Description: three MQ 接收方法
*@Param:
*@return:
*@Author: gyDeBug
*@date: 2021/9/30
**/
@JmsListener(destination = "${config.msgListener.hardwareTopicName}" ,containerFactory = "activeMQJmsListenerContainerFactory")
public void receiveActiveMQ(Msg msg)throws Exception {
Object obj =msg.getData();
if (obj!=null) {
if (obj instanceof PersonFaceIdentifyInfo) {
//== 收到人脸识别消息
PersonFaceIdentifyInfo info = (PersonFaceIdentifyInfo)obj;
//查询该智能设备绑定的客户端电脑IP
try{
R<PersonalIdentityVerifier> data = personalIdentityVerifierService.getById(info.getDeviceId());
if(data.getCode() == 200){
String deviceIp = data.getData().getBindIp();
//推送消息到人脸智能设备绑定的电脑
R result = webSocketService.sendFaceRecognitionData(deviceIp,info);
logger.info("推送消息结果:"+result.getMsg());
}else{
logger.info("==============服务调用异常!");
}
}catch (Exception e){
logger.info("==============服务调用异常!");
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
package digital.laboratory.platform.entrustment.handler;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.config.JmsListenerContainerFactory;
import org.springframework.jms.core.JmsTemplate;
import java.util.ArrayList;
import java.util.Arrays;
/**
* @author gyDeBug
* @version 1.0
* @date 2021/3/30 15:41
* @description:ActiveMq多实例配置。
*/
@Configuration
public class ActiveMqConfigs {
/**
* activqmq 地址 账号密码注入
* @param brokerUrl
* @param username
* @param password
* @return
*/
@Bean(name = "activeMQConnectionFactory")
public ActiveMQConnectionFactory activeMQConnectionFactory(
@Value("${config.activemq.brokerUrl}") String brokerUrl,
@Value("${config.activemq.user}") String username,
@Value("${config.activemq.password}") String password) {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
factory.setBrokerURL( brokerUrl );
factory.setUserName( username );
factory.setPassword( password );
factory.setTrustedPackages(new ArrayList(Arrays.asList(
("digital.laboratory.platform.common.core.util," +
"digital.laboratory.platform.common.core.entity," +
"java.time," +
"java.time.chrono," +
"java.io," +
"java.lang"
).split(","))));
return factory;
}
/**
* JmsTemplate生成
*
* @param connectionFactory
* @param pubSubDmain
* @return
*/
@Bean(name = "activeMQJmsTemplate")
public JmsTemplate activeMQJmsTemplate(
@Qualifier("activeMQConnectionFactory") ActiveMQConnectionFactory connectionFactory,
@Value("${config.activemq.pub-sub-domain}") boolean pubSubDmain) {
JmsTemplate jmsTemplate = new JmsTemplate( connectionFactory );
jmsTemplate.setPubSubDomain( pubSubDmain );
return jmsTemplate;
}
/**
* JmsListener工厂生成
*
* @param connectionFactory
* @param pubSubDmain
* @return
*/
@Bean(name = "activeMQJmsListenerContainerFactory")
public JmsListenerContainerFactory activeMQJmsListenerContainerFactory(
@Qualifier("activeMQConnectionFactory") ActiveMQConnectionFactory connectionFactory,
@Value("${config.activemq.pub-sub-domain}") boolean pubSubDmain) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory( connectionFactory );
factory.setPubSubDomain( pubSubDmain );
return factory;
}
}

View File

@@ -0,0 +1,87 @@
package digital.laboratory.platform.entrustment.handler;
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.entrustmentLetterTemplate}")
public static String entrustmentLetterTemplate;
private final RemoteDictionaryService remoteDictionaryService;
public static Map<String, String> entrustmentConfig = new HashMap<>();
public static Map<String, Dictionary> thirdSysConfig = new HashMap<>();
public static String getCfg(String code) {
return entrustmentConfig.get(code);
}
public static Dictionary getThirdSysCfg(String key) {
return thirdSysConfig.get(key);
}
/**
*
* @param args 参数
* @throws Exception 异常
*
* // @SysLog("委托受理模块初始化") 这里不能使用 @SysLog(), 因为 SysLog 还没有初始化
*/
@Override
public void run(ApplicationArguments args) throws Exception {
// BusinessCodeUtils.removeSymbols("x-*/——0*&……%¥#@xasdf!*&^&%^ 中文、/+)(\n\\xx\rx");
{
// 加载 entrustment 在字典中的配置
loadDictData(CommonConstants.DLP_TYPE_ENTRUSTMENT,1);
//加载第三方系统的对接信息
loadDictData("920f9dd9cd14281e8b488a34c649ff70",2);
for (String key : entrustmentConfig.keySet()) {
System.out.println(String.format("entrustmentConfig[%s]=%s", key, entrustmentConfig.get(key)));
}
}
}
//读取的数据添加到配置中
public void loadDictData(String type,int loadWhere)
{
R<List<Dictionary>> r = remoteDictionaryService.getDictionaryByType(type);
if (Optional.ofNullable(r).isPresent() && (r.getData() != null)) {
List<Dictionary> itemList = r.getData();
if(loadWhere==1)
{
for (Dictionary item : itemList) {
entrustmentConfig.put(item.getCode(), item.getLabel());
}
}
if(loadWhere==2)
{
for (Dictionary item : itemList) {
thirdSysConfig.put(item.getLabel(),item);
}
}
}
}
}

View File

@@ -0,0 +1,39 @@
package digital.laboratory.platform.entrustment.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 digital.laboratory.platform.entrustment.entity.CaseEvent;
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 案件事件 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 案件事件 Mapper 类
*/
@Mapper
public interface CaseEventMapper extends BaseMapper<CaseEvent> {
/**
* 按查询条件查询案件VO
* @param fromDate
* @param toDate
* @param caseName
* @param caseType
* @return
*/
List<CaseEventVO> getCaseVoList(@Param("fromDate")String fromDate, @Param("toDate")String toDate,
@Param("caseName")String caseName,
@Param("caseType")String caseType);
IPage<CaseEventVO> getCaseVoPage(@Param("page") IPage<CaseEvent> page, @Param(Constants.WRAPPER) QueryWrapper<CaseEvent> qw);
CaseEventVO getCaseVOById(@Param("id") String id);
String getMaxCaseNo(String prefix);
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
import org.apache.ibatis.annotations.Mapper;
/**
* 与案件相关的物证信息 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 与案件相关的物证信息 Mapper 类
*/
@Mapper
public interface CaseEvidenceMapper extends BaseMapper<CaseEvidence> {
String getMaxEvidenceNo(String prefix);
}

View File

@@ -0,0 +1,17 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.Deliverer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 送检员 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-08-16
* @describe 送检员 Mapper 类
*/
@Mapper
public interface DelivererMapper extends BaseMapper<Deliverer> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.EntrustMaterialOfThirdSys;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName EntrustDataMaterialVoMapper
* @Description TODO
* @Author xy
* @Date 2023/6/13 16:27
* @Version 1.0
**/
@Mapper
public interface EntrustDataMaterialVoMapper extends BaseMapper<EntrustMaterialOfThirdSys> {
}

View File

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

View File

@@ -0,0 +1,26 @@
package digital.laboratory.platform.entrustment.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.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
import digital.laboratory.platform.entrustment.vo.EntrustmentIdentificationMaterialVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 检材信息 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 检材信息 Mapper 类
*/
@Mapper
public interface EntrustmentIdentificationMaterialMapper extends BaseMapper<EntrustmentIdentificationMaterial> {
String getMaxIdentificationMaterialNo(String prefix);
List<EntrustmentIdentificationMaterialVO> getEntrustmentIdentificationMaterialVOList(@Param(Constants.WRAPPER) QueryWrapper<EntrustmentIdentificationMaterial> qw);
String getMaxMaterialAcceptNo(String prefix);
}

View File

@@ -0,0 +1,36 @@
package digital.laboratory.platform.entrustment.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 digital.laboratory.platform.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
import digital.laboratory.platform.entrustment.vo.EntrustmentVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 委托 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 委托 Mapper 类
*/
@Mapper
public interface EntrustmentMapper extends BaseMapper<Entrustment> {
IPage<EntrustmentVO> getEntrustmentVOPage(@Param("page") IPage<Entrustment> page, @Param(Constants.WRAPPER) QueryWrapper<Entrustment> qw);
List<EntrustmentVO> getEntrustmentVOList(@Param(Constants.WRAPPER) QueryWrapper<Entrustment> qw);
EntrustmentVO getEntrustmentVOById(@Param("id") String id);
String getMaxEntrustmentNo(@Param("prefix") String prefix);
String getMaxEntrustmentNoNew(String prefix);
String getMaxEntrustAcceptNo(String prefix);
String getTypeForDictionary(String id);
}

View File

@@ -0,0 +1,23 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.Identification;
import digital.laboratory.platform.entrustment.vo.IdentificationVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 鉴定表,一个鉴定可能会有多个委托 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-15
* @describe 鉴定表,一个鉴定可能会有多个委托 Mapper 类
*/
@Mapper
public interface IdentificationMapper extends BaseMapper<Identification> {
List<IdentificationVO> getIdentificationVOList(String caseId);
List<Identification> getIdentificationListByCaseId(String caseId);
String getMaxIdentificationNo(String prefix);
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.SampleBoxInLog;
import org.apache.ibatis.annotations.Mapper;
/**
* 样品包入库出库日志 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品包入库出库日志 Mapper 类
*/
@Mapper
public interface SampleBoxInLogMapper extends BaseMapper<SampleBoxInLog> {
}

View File

@@ -0,0 +1,19 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.sys.entity.entrustment.SampleBox;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 受理时检材重新包装的容器 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 受理时检材重新包装的容器 Mapper 类
*/
@Mapper
public interface SampleBoxMapper extends BaseMapper<SampleBox> {
String getMaxBoxNo(@Param("prefix") String prefix);
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.sys.entity.entrustment.Sample;
import org.apache.ibatis.annotations.Mapper;
/**
* 检验用的样本 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 检验用的样本 Mapper 类
*/
@Mapper
public interface SampleMapper extends BaseMapper<Sample> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.SampleStoreChangeDutyLog;
import org.apache.ibatis.annotations.Mapper;
/**
* 样品库管理员换班日志 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库管理员换班日志 Mapper 类
*/
@Mapper
public interface SampleStoreChangeDutyLogMapper extends BaseMapper<SampleStoreChangeDutyLog> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.SampleStoreLog;
import org.apache.ibatis.annotations.Mapper;
/**
* 样品库入库出库日志 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库入库出库日志 Mapper 类
*/
@Mapper
public interface SampleStoreLogMapper extends BaseMapper<SampleStoreLog> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.SampleStore;
import org.apache.ibatis.annotations.Mapper;
/**
* 样品库 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库 Mapper 类
*/
@Mapper
public interface SampleStoreMapper extends BaseMapper<SampleStore> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.StorageCabinet;
import org.apache.ibatis.annotations.Mapper;
/**
* 暂存柜 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜 Mapper 类
*/
@Mapper
public interface StorageCabinetMapper extends BaseMapper<StorageCabinet> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.StorageCellLog;
import org.apache.ibatis.annotations.Mapper;
/**
* 暂存柜记录 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜记录 Mapper 类
*/
@Mapper
public interface StorageCellLogMapper extends BaseMapper<StorageCellLog> {
}

View File

@@ -0,0 +1,16 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.StorageCell;
import org.apache.ibatis.annotations.Mapper;
/**
* 暂存柜,每行一个单元格 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜,每行一个单元格 Mapper 类
*/
@Mapper
public interface StorageCellMapper extends BaseMapper<StorageCell> {
}

View File

@@ -0,0 +1,17 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.Taker;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 采集员 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-08-25
* @describe 采集员 Mapper 类
*/
@Mapper
public interface TakerMapper extends BaseMapper<Taker> {
}

View File

@@ -0,0 +1,17 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.HairJobIdentificationMaterial;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 毛发任务的检材信息 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 毛发任务的检材信息 Mapper 类
*/
@Mapper
public interface HairJobIdentificationMaterialMapper extends BaseMapper<HairJobIdentificationMaterial> {
}

View File

@@ -0,0 +1,17 @@
package digital.laboratory.platform.entrustment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import digital.laboratory.platform.entrustment.entity.HairJob;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 毛发检测任务 Mapper 接口
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 毛发检测任务 Mapper 类
*/
@Mapper
public interface HairJobMapper extends BaseMapper<HairJob> {
}

View File

@@ -0,0 +1,50 @@
package digital.laboratory.platform.entrustment.misc;
import digital.laboratory.platform.entrustment.enums.EntrustmentStatusConstants;
/**
* 流程映射定义
*/
public class ProcessFlowMapper {
public static int getNextStatus(int currentStatus, int opCode) {
int processFlowMapper[][] = {
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK_CLAIM.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK_CLAIM.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_APPROVE_CLAIM.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK.getStatus(), -1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_APPROVE_CLAIM.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_APPROVE.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_APPROVE.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_APPROVE.getStatus(), -1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CHECK.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_APPROVE.getStatus(), -2, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_DELIVER.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_CONFIRM.getStatus(), -1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_DELIVER.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_DELIVER.getStatus(), -1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ABORTED.getStatus()},
// {EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTING.getStatus()},
// {EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTING.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTED.getStatus()},
// {EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTING.getStatus(), -1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus(), 1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_ACCEPTED.getStatus()},
{EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus(), -1, EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()},
};
for (int i = 0; i < processFlowMapper.length; i++) {
if (processFlowMapper[i][0] == currentStatus) {
// 当前状态就是它
if (processFlowMapper[i][1] == opCode) {
// 操作码找到了
return processFlowMapper[i][2];
}
}
}
throw new RuntimeException("流程没有找到对应的下一状态");
}
}

View File

@@ -0,0 +1,58 @@
package digital.laboratory.platform.entrustment.misc;
import digital.laboratory.platform.common.core.constant.OSSDirectoryConstants;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.entrustment.handler.AppStartupRunner;
import lombok.RequiredArgsConstructor;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.io.StringWriter;
import java.util.Map;
@Service
@RequiredArgsConstructor
public class Template2html {
private final OssFile ossFile;
/**
* 根据模板生成检材标签的 html, 供 qz 打印使用
*
* @return html 字符串
*/
public String gethtml(String templateName, Map<String, Object> data) throws Exception {
String templateFileName = AppStartupRunner.getCfg(templateName);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ossFile.fileGet(OSSDirectoryConstants.TEMPLATE_DIRECTORY + "/"+ templateFileName, bos);
String templateString = bos.toString("UTF-8");
bos.close();
try {
// 设置自定义指令使用的类
Velocity.setProperty("userdirective",
"digital.laboratory.platform.entrustment.misc.VelocityQRCodeImage," +
"digital.laboratory.platform.entrustment.misc.VelocityBarCodeImage");
//初始化模板
Velocity.init();
//获取上下文
VelocityContext context = new VelocityContext();
//把数据填入上下文
for (String key : data.keySet()) {
context.put(key, data.get(key));
}
StringWriter w = new StringWriter();
Velocity.evaluate(context, w, "Velocity", templateString);
w.flush();
return w.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -0,0 +1,102 @@
package digital.laboratory.platform.entrustment.misc;
import digital.laboratory.platform.entrustment.QRCodeUtils;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.ASTIntegerLiteral;
import org.apache.velocity.runtime.parser.node.ASTReference;
import org.apache.velocity.runtime.parser.node.ASTStringLiteral;
import org.apache.velocity.runtime.parser.node.Node;
import java.io.IOException;
import java.io.Writer;
public class VelocityBarCodeImage extends Directive {
@Override
public String getName() {
return "barcodeUrlData";
}
@Override
public int getType() {
return LINE;
}
/**
* 渲染指令
*
* 模板中调用时, 格式化为: #qrcode(code [, width, height])
* 参数 code 是必须的, 是字符串, 或字符串变量
* 参数 width 和 height 是可选的, 是整数, 应该大于 0
*
* @param context
* @param writer
* @param node
* @return
* @throws IOException
* @throws ResourceNotFoundException
* @throws ParseErrorException
* @throws MethodInvocationException
*/
@Override
public boolean render(InternalContextAdapter context, Writer writer,
Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
// System.out.println(String.format("node.jjtGetNumChildren()=%d", node.jjtGetNumChildren()));
// for (int i=0; i<node.jjtGetNumChildren(); i++) {
// Node sn = node.jjtGetChild(i);
// System.out.println(String.format("node[%d] value=%s type=%d info=%d line=%d", i, sn.value(context), sn.getType(), sn.getInfo(), sn.getLine() ));
// }
if (node.jjtGetNumChildren()<1) {
throw new IllegalArgumentException("必须要提供一个参数");
//return false;
}
String code = "nocode";
int width = 400;
int height = 30;
if (node.jjtGetNumChildren()>0) {
Node sn = node.jjtGetChild(0);
if ((sn instanceof ASTStringLiteral) || (sn instanceof ASTReference)) {
code = (String)sn.value(context);
}
else {
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
}
}
if (node.jjtGetNumChildren()>1) {
Node sn = node.jjtGetChild(1);
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
Integer w =(Integer)sn.value(context);
if ((w != null) && (w > 0)) {
width = w;
}
}
else {
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
}
}
if (node.jjtGetNumChildren()>2) {
Node sn = node.jjtGetChild(2);
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
Integer h =(Integer)sn.value(context);
if ((h != null) && (h > 0)) {
height = h;
}
}
else {
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
}
}
String r = QRCodeUtils.getBarCode128ImageBase64(code, width, height);
writer.write(r);
return true;
}
}

View File

@@ -0,0 +1,107 @@
package digital.laboratory.platform.entrustment.misc;
import digital.laboratory.platform.entrustment.QRCodeUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.directive.Directive;
import org.apache.velocity.runtime.parser.node.*;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class VelocityQRCodeImage extends Directive {
@Override
public String getName() {
return "qrcodeUrlData";
}
@Override
public int getType() {
return LINE;
}
/**
* 渲染指令
*
* 模板中调用时, 格式化为: #qrcode(code [, width, height])
* 参数 code 是必须的, 是字符串, 或字符串变量
* 参数 width 和 height 是可选的, 是整数, 应该大于 0
*
* @param context
* @param writer
* @param node
* @return
* @throws IOException
* @throws ResourceNotFoundException
* @throws ParseErrorException
* @throws MethodInvocationException
*/
@Override
public boolean render(InternalContextAdapter context, Writer writer,
Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
// System.out.println(String.format("node.jjtGetNumChildren()=%d", node.jjtGetNumChildren()));
// for (int i=0; i<node.jjtGetNumChildren(); i++) {
// Node sn = node.jjtGetChild(i);
// System.out.println(String.format("node[%d] value=%s type=%d info=%d line=%d", i, sn.value(context), sn.getType(), sn.getInfo(), sn.getLine() ));
// }
if (node.jjtGetNumChildren()<1) {
throw new IllegalArgumentException("必须要提供一个参数");
//return false;
}
String code = "nocode";
int width = 150;
int height = 150;
if (node.jjtGetNumChildren()>0) {
Node sn = node.jjtGetChild(0);
if ((sn instanceof ASTStringLiteral) || (sn instanceof ASTReference)) {
code = (String)sn.value(context);
}
else {
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
}
}
if (node.jjtGetNumChildren()>1) {
Node sn = node.jjtGetChild(1);
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
Integer w =(Integer)sn.value(context);
if ((w != null) && (w > 0)) {
width = w;
}
}
else {
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
}
}
if (node.jjtGetNumChildren()>2) {
Node sn = node.jjtGetChild(2);
if ((sn instanceof ASTIntegerLiteral) /*|| (sn instanceof ASTReference)*/) {
Integer h =(Integer)sn.value(context);
if ((h != null) && (h > 0)) {
height = h;
}
}
else {
throw new IllegalArgumentException("未知的参数类型: " + sn.getClass().getName());
}
}
String r = QRCodeUtils.getQRCodeImageBase64(code, width, height);
writer.write(r);
return true;
}
}

View File

@@ -0,0 +1,78 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.entrustment.entity.CaseEvent;
import digital.laboratory.platform.othersys.vo.EntrustDataVo;
import digital.laboratory.platform.entrustment.vo.CaseEventVO;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 案件事件服务类
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 案件事件服务类
*/
public interface CaseEventService extends IService<CaseEvent> {
/**
* 按查询条件查询案件VO
* @param fromDate
* @param toDate
* @param caseName
* @param caseType
* @return
*/
List<CaseEventVO> getCaseVoList(String fromDate, String toDate, String caseName, String caseType);
IPage<CaseEventVO> getCaseVoPage(IPage<CaseEvent> page, QueryWrapper<CaseEvent> qw);
CaseEventVO getCaseVOById(String id);
/**
* 根据案件编号查 Id
* @param caseNo
* @return
*/
CaseEvent getByCaseNo(String caseNo);
/**
* 生成新的案件编码, 本函数仅用于没有现勘系统、没有案事件系统的情况下
* 如果有现勘系统, 则使用现勘系统的案件编号。
* 如果有案事件系统, 则使用案事件系统的案件编号。
*
* 格式:
* <pre>
* A <办案机构 12位> <年月6位> <顺序号4位>
* 例如:
* A 520101 040000 202203 0002
* 合计23位
* 以为贵州省为例, 组织机构编码为 12 位长度, 除使用数字(0~9)之外, 还使用了英文字母(A~Z)
*</pre>
* 作为兼容性考虑, 如果机构编码不足 12 位, 以实际位数为准
*
* @param caseOwnOrgCode
* @param date
* @return
*/
String getNewCaseCode(String caseOwnOrgCode, Date date);
/**
* 检查案件是否有提交审核以后的委托存在
*/
Boolean checkCaseIsEnableModify(String caseId);
/**
* 同步禁毒大数据平台上的案件信息
* @param isUpdate true 是更新 false 是插入
* @param caseId 更新则需要传案件的id, 如果不是更新则传null
* @return
*/
Map<String, List<Map<String, String>>> syncCaseEventInfo(EntrustDataVo entrustDataVo, String caseId, Boolean isUpdate);
boolean postAddObject(CaseEvent caseEvent);
CaseEvent deleteById(String id, DLPUser dlpUser) throws Exception;
}

View File

@@ -0,0 +1,47 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.CaseEvent;
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
import digital.laboratory.platform.othersys.vo.EntrustDataVo;
import java.util.List;
import java.util.Map;
/**
* 与案件相关的物证信息服务类
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 与案件相关的物证信息服务类
*/
public interface CaseEvidenceService extends IService<CaseEvidence> {
/**
* 用于标识某个案件的物证。
* 顺序号使用 6 位的原因, 是现勘系统的物证编码结构就是这样。有可能这 6 位编码中有不同的用途, 并不完全是顺序号。
* 但是我们不得而知。
* 如果该编码由我们系统自己生成, 则使用 6 位顺序号。
* ```
* W <案件编号后 22 位> <顺序号 6 位>
* 例如:
* W 5201010400002020030002 000001
* 合计 29 位
* ```
* 如果有现勘系统, 则使用现勘系统的物证编号。
* 如果有案事件系统, 则使用案事件系统的物证编号。
*
* 作为兼容性考虑, 如果案件编码不足 23 位, 取 除掉第 1 个字符之后的, 即去掉 "A" 字符剩下的
*
* @param caseNo
* @return
*/
String getNewEvidenceCode(String caseNo);
long countByCaseId(String caseId);
/**
* 同步禁毒数据平台上的分物证
*
* @return
*/
List<Map<String, String>> syncCaseEvidenceInfo(EntrustDataVo caseEventObj, CaseEvent caseId, Boolean isUpdate);
}

View File

@@ -0,0 +1,25 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
import digital.laboratory.platform.entrustment.entity.Deliverer;
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
import digital.laboratory.platform.entrustment.entity.Taker;
/**
* 送检员服务类
*
* @author Zhang Xiaolong created at 2022-08-16
* @describe 送检员 服务类
*/
public interface DelivererService extends IService<Deliverer> {
/**
* 更新送检员
* 以送检员的名字为关键字, 如果同名送检员存在, 更新其他属性; 如果同名送检员不存在, 则新增数据库记录
* @param deliverer
*/
boolean renew(Deliverer deliverer);
Deliverer getByName(String name, String ownerUserId);
}

View File

@@ -0,0 +1,115 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.entrustment.dto.PrintDTO;
import digital.laboratory.platform.entrustment.entity.CaseEvidence;
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
import digital.laboratory.platform.entrustment.vo.EntrustmentIdentificationMaterialVO;
import digital.laboratory.platform.entrustment.vo.SampleBoxVO;
import java.util.List;
/**
* 检材信息服务类
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 检材信息服务类
*/
public interface EntrustmentIdentificationMaterialService extends IService<EntrustmentIdentificationMaterial> {
/**
* ## 检材编码
* ```
* JC <物证编号后 28 位> <顺序号4位>
* 例如:
* JC 5201010400002020030002 0000001 0001
* 合计 34 位
* ```
* 一份物证, 有可能会多次送检。每次送检的时候, 在原来的顺序号上递增。
* 定义这个编号的时候有点纠结, 有两个方向的关联: 在案件号上扩充、在物证号上扩充。我们选择在物证号上扩充。
* 检材编码的长度不一定刚好是 34 位!我们取“物证编号后 28 位”时, 其实是去掉物证编码前第1个字符后剩下的部分。
* 如果物证编码不是 29 位, 那么取到的就不是 28 位, 而是物证编码长度减1位。
*
* @param evidenceNo
* @return
*/
String getNewIdentificationMaterialNo(String evidenceNo);
/**
* 创建新的检材
* 根据参数中的物证生成新的检材, 新创建的检材将继承该物证的部分属性
*
* @param ce
* @return
*/
EntrustmentIdentificationMaterial createNewIdentificationMaterial(CaseEvidence ce);
long countByEntrustmentId(String entrustmentId);
List<EntrustmentIdentificationMaterialVO> getEntrustmentIdentificationMaterialVOList(QueryWrapper<EntrustmentIdentificationMaterial> qw);
int setEntrustmentIdentificationMaterialStatusByEntrustment(EntrustmentIdentificationMaterial im, String EntrustmentId);
//生成受理编号
String getNewMaterialAcceptNo(String entrustAcceptNo);
//同步已受理数据的时候,生成受理编号
public String getThirdSysMaterialAcceptNo(String entrustAcceptNo);
//生成案前委托的受理编号
String getNewMaterialAcceptNoForBeforeCase(String entrustBeforeAcceptNo);
//根据盒子ID 查询该盒子下的检材
public List<EntrustmentIdentificationMaterial> getQueryListByBoxID(String boxId, String boxType);
//根据盒子ID分样类型检材ID 删除分样信息
Boolean delSampleBoxInfo(String boxId, String sampleNo, String boxType);
//统计盒子中装了多少样本
SampleBoxVO getBoxCountInfo(String boxId);
//将样本装进盒子
List<EntrustmentIdentificationMaterial> putSampleToBox(String boxId, List<String> sampleNoList, String boxType);
//根据用户ID 获取用户
String getUserNameByEntrustUserID(String userId);
EntrustmentIdentificationMaterial bizCheck_Apply(EntrustmentIdentificationMaterial identificationMaterial, Integer opCode, DLPUser dlpUser);
EntrustmentIdentificationMaterial bizApprove_Apply(EntrustmentIdentificationMaterial identificationMaterial, Integer opCode, DLPUser dlpUser);
EntrustmentIdentificationMaterial bizAccept_Save(EntrustmentIdentificationMaterial identificationMaterial, DLPUser dlpUser);
EntrustmentIdentificationMaterial bizAccept_Apply(EntrustmentIdentificationMaterial identificationMaterial, Integer opCode, DLPUser dlpUser);
EntrustmentIdentificationMaterial createIdentificationMaterialByEvidenceId(EntrustmentIdentificationMaterial identificationMaterial, DLPUser dlpUser);
EntrustmentIdentificationMaterial putUpdateById(EntrustmentIdentificationMaterial identificationMaterial, DLPUser dlpUser);
void saveCollectors(EntrustmentIdentificationMaterial material, DLPUser dlpUser);
EntrustmentIdentificationMaterial settingAcceptSampleInfoDivide(EntrustmentIdentificationMaterial material);
//设置送检单位初始分样信息
EntrustmentIdentificationMaterial settingProviderSampleInfo(EntrustmentIdentificationMaterial material);
EntrustmentIdentificationMaterial settingAcceptSampleInfoNoDivide(EntrustmentIdentificationMaterial material);
EntrustmentIdentificationMaterial deleteById(String id);
boolean saveRepWeigh(String id, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag);
EntrustmentIdentificationMaterial settingRetained(String id, int flag);
List<EntrustmentIdentificationMaterial> createNewIm(List<EntrustmentIdentificationMaterial> identificationMaterial, DLPUser dlpUser);
public List<String> printLabel(List<PrintDTO> printDTOList);
List<String> printManyLabel(List<PrintDTO> printDTOList);
String printMaterialArchives(String entrustmentId) throws Exception;
}

View File

@@ -0,0 +1,244 @@
package digital.laboratory.platform.entrustment.service;
import com.alibaba.fastjson.JSONObject;
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.core.util.R;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.entrustment.dto.EntrustmentDTO;
import digital.laboratory.platform.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
import digital.laboratory.platform.entrustment.vo.EntrustmentVO;
import digital.laboratory.platform.sys.entity.SysUser;
import digital.laboratory.platform.sys.vo.entrustment.MarkersVO;
import digital.laboratory.platform.sys.entity.entrustment.Sample;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* 委托服务类
*
* @author Zhang Xiaolong created at 2022-03-22
* @describe 委托服务类
*/
public interface EntrustmentService extends IService<Entrustment> {
/**
* ## 委托编码
* 用于标识每一次委托。
* 有可能一个案件会有多次委托鉴定, 所以在案件编码后加4位作为顺序号。
*
* ```
* WT <案件编码后 22 位> <顺序号4位>
* 例如:
* WT 5201010400002020030002 0002
* 合计 28 位
* ```
//* @param caseNo
* @return
*/
// String getNewEntrustmentNo(String caseNo);
public String getNewEntrustmentNo();
//生成受理编号
public String getNewAcceptNo();
List<EntrustmentVO> getEntrustmentVOList(QueryWrapper<Entrustment> qw);
IPage<EntrustmentVO> getEntrustmentVOPage(IPage<Entrustment> page, QueryWrapper<Entrustment> qw);
EntrustmentVO getEntrustmentVOById(String id);
/**
* 查询任务
* @param userId
* @param group
* @param processInstanceId
* @param businessKey
* @return
*/
//List<Task> taskQuery(String userId, String group, String processInstanceId, String businessKey);
/**
* 获取任务列表
* 查询条件可以是 userId, groupId, processInstanceId, busincessKey
*/
//List<TaskResponse> taskList(String entrustmentId, String userId);
/**
* 认领任务
* 只有 Assignee 为空才能认领, unclaim 反认领可以置 Assignee 为空
* @param entrustmentId
* @return
*/
//HashMap<String, String> taskClaim(String entrustmentId);
/**
* 反认领任务
* @param entrustmentId
* @return
*/
//HashMap<String, String> taskUnclaim(String entrustmentId);
/**
* 委派任务
* 把任务指定给某个用户, 与 claim 不同之处于无论之前 assignee 是否为空都可以委派。
* 可以在某个用户长期不作为的情况下重新委派给其他人
* @param entrustmentId
* @param userId
* @return
*/
//HashMap<String, String> taskAssigneeSet(String entrustmentId, String userId);
/**
* 提交任务
* @param entrustmentId 委托ID
* @param opCode 操作码: 1=通过, -1=拒绝(驳回), 2...=其他路径
*/
//HashMap<String, Object> taskApply(String entrustmentId, Integer opCode);
/**
* 取指定环节可用的用户列表
* 当流程进行到某个环节的时候, 需要某个用户对这个环节进行处理(通过或不通过)。
* 这里取可用的用户列表
* <p>
* 涉及到的环境有以下几个:
* 1、创建委托及提交
* 委托的提交者就是委托的创建者。不存在不通过的可能。
* 2、审核
* 审核者有几个条件: (1)必须是鉴定中心的工作人员 (2)必须拥有委托审核权限
* 3、审批
* 审核者有几个条件: (1)必须是鉴定中心的工作人员 (2)必须拥有委托审批权限
* 4、送检确认
* 送检确认者有几个条件: (1)必须与委托的创建者是同一个机构, 或上级机构的人 (2)必须拥有委托送检确认权限
* 5、受理
* 受理者有几个条件: (1)必须是鉴定中心的工作人员 (2)必须拥有委托受理权限
*
*
* @return
*/
List<SysUser> taskAvailableUserList_Check();
List<SysUser> taskAvailableUserList_Approve();
List<SysUser> taskAvailableUserList_Confirm(String clientOrgId);
List<SysUser> taskAvailableUserList_Accept();
// List<SysUser> taskAvailableUserList(String entrustmentId);
public long countByCaseId(String caseId);
void Entrustment2Word(EntrustmentVO ev) throws IOException;
// void Entrustment2Word(EntrustmentVO ev, InputStream tempStream, OutputStream) throws IOException;
//初始化送检受理系统数据
void initCaseSendAccept();
//生成鉴定事项确认书
Boolean generateIdentifyItemsBook(String entrustId);
/**
*获取文书名称
* @param entrustId
* @param whatBook entrust-委托书 identItemBook-鉴定事项确认书 identfyBook-鉴定书
* @return
*/
String getBookNameByEntrustId(String entrustId,String whatBook);
/**
* 构建鉴定要求
* @param materialList
* @return
*/
public String buildIdentfyReq(List<EntrustmentIdentificationMaterial> materialList);
/**
* 构造委托书中的鉴定要求
*
* @param materialList
* @return
*/
public String buildEntrustReq(List<EntrustmentIdentificationMaterial> materialList);
/**
* 构建检材描述
* @param materialList
* @return
*/
public String buildMaterialDes(List<EntrustmentIdentificationMaterial> materialList);
//检验完成
public boolean testsFinish(String entrustId);
//查询委托各个状态的数量
public Integer getEntrustStatusCount(List<Integer> statues, DLPUser dlpUser);
//获取案前委托的委托编号
String getNewEntrustAcceptNoForBeforeCase();
//根据年份获取当年的最大号
String getNewEntrustNoByYear(String year);
//合并送检人员的证件照
Boolean getDeliverMergePhoto(String entrustId,String acceptNo,String caseName,String deliverer1Name,String deliverer2Name);
//检查送检人的证件照片是否上传
Boolean checkDeliverPhoto(String entrustId);
//获取委托下的
// String getMaterialMergePhoto(String entrustId, Integer groupCount);
//处理历史数据到流转系统中
Boolean historyDataToTransSys(String status,List<String> entrustIds);
//检查检材是否已经复秤
boolean checkRepeatWeigh(Entrustment entrustment);
//同步的历史数据补充缺失的字段
Boolean updateImportData(String flag);
Entrustment bizSubmitter_Save(Entrustment entrust, DLPUser dlpUser);
Entrustment bizSubmitter_Apply(Entrustment entrust, DLPUser dlpUser);
Entrustment bizChecker_Claim( Entrustment entrust,DLPUser dlpUser);
Entrustment bizChecker_Apply(Entrustment entrust, Integer opCode, DLPUser dlpUser);
Entrustment bizApprover_Claim(Entrustment entrust, DLPUser dlpUser);
Entrustment bizApprover_Apply(Entrustment entrust, Integer opCode, DLPUser dlpUser);
Entrustment bizConfirm_Apply(Entrustment entrust, Integer opCode, DLPUser dlpUser);
Entrustment bizDeliver_Save(Entrustment entrust, DLPUser dlpUser);
Entrustment bizDeliver_Apply(Entrustment entrust, Integer opCode, DLPUser dlpUser);
void bizGetPDFEntrustmentLetter(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse);
Entrustment bizAccept_Save(Entrustment entrust, DLPUser dlpUser);
Entrustment bizAccept_Apply(Entrustment entrust, Integer opCode, DLPUser dlpUser);
List<Sample> getTransferMaterialList(DLPUser dlpUser, Entrustment entrustment);
void bizGetPDFIdentifyItemsConfirmLetter(String id, String pdfOrWord, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse);
void GenerateIdentifyItemsConfirmLetterPDF(EntrustmentVO ev);
Entrustment bizSubmitter_AddEntrustment(Entrustment entrustment, DLPUser dlpUser);
R deleteById(String id, DLPUser dlpUser);
R uploadAttachmentObj_Base64(String entrustmentId, JSONObject jsonParam) throws Exception;
R uploadDeliverPhoto_Base64(String entrustmentId, JSONObject jsonParam);
R uploadAcceptAttachmentObj_Base64(String entrustmentId, JSONObject jsonParam) throws Exception;
R<List<SysUser>> bizGetAvailableUserList(String entrustmentId);
List<MarkersVO> getImQuantityForInspection(DLPUser dlpUser);
Entrustment addNewEmt(EntrustmentDTO entrustmentDTO, DLPUser dlpUser);
List<MarkersVO> getInspectMarkers(DLPUser dlpUser);
List<MarkersVO> getImQuantityForAccept();
List<MarkersVO> getMarkersForOther(DLPUser dlpUser);
List<MarkersVO> getMarkersForEntrustment();
void printSampleFile(String entrustmentId) throws Exception;
boolean synchronizationByMaterialType();
IPage getEntrustmentAndMaterial(Page page, Integer status,String keywords);
boolean isMaterialPhoto(String entrustmentId);
}

View File

@@ -0,0 +1,51 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.Entrustment;
import digital.laboratory.platform.entrustment.entity.Identification;
import digital.laboratory.platform.entrustment.vo.EntrustmentVO;
import digital.laboratory.platform.entrustment.vo.IdentificationVO;
import java.util.List;
/**
* 鉴定表,一个鉴定可能会有多个委托服务类
*
* @author Zhang Xiaolong created at 2022-07-15
* @describe 鉴定表,一个鉴定可能会有多个委托 服务类
*/
public interface IdentificationService extends IService<Identification> {
/**
* ## 鉴定编码
* 用于标识每一个鉴定。
* 有可能一个案件会有多次委托鉴定, 所以在案件编码后加4位作为顺序号。
*
* ```
* WT <案件编码后 22 位> <顺序号4位>
* 例如:
* WT 5201010400002020030002 0002
* 合计 28 位
* ```
* @param caseNo
* @return
*/
String getNewIdentificationNo();
/**
* 根据 caseId 取 IdentificationVO 列表, 每个 Entrustment 一行
* @param caseId
* @return
*/
List<IdentificationVO> getIdentificationVOList(String caseId);
/**
* 根据 caseId 取 Identification 列表, 供新建的补充委托选择老的 Identification(鉴定), 以使新建的委托作为老的鉴定的一部分
* @param caseId
* @return
*/
List<Identification> getIdentificationListByCaseId(String caseId);
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.SampleBoxInLog;
/**
* 样品包入库出库日志服务类
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品包入库出库日志服务类
*/
public interface SampleBoxInLogService extends IService<SampleBoxInLog> {
}

View File

@@ -0,0 +1,85 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.sys.entity.entrustment.SampleBox;
import digital.laboratory.platform.entrustment.vo.SampleBoxLiteVO;
import digital.laboratory.platform.entrustment.vo.SampleBoxVO;
import java.util.List;
/**
* 受理时检材重新包装的容器服务类
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 受理时检材重新包装的容器服务类
*/
public interface SampleBoxService extends IService<SampleBox> {
/**
* ## 根据委托编码生成样本盒编码
* 用于标识每一个样本盒。一个委托最多可以有99个样本盒子
*
* ```
* BZ <委托编码去掉前缀2个字符后剩下22位> <顺序号2位>
* 例如:
* BZ 6101022022100002000001 02
* 合计 26 位
* ```
* @param entrustmentNo
* @return
*/
String getNewBoxNoForEntrustment(String entrustmentNo);
/**
* ## 根据污水任务编码生成样本盒编码
* 用于标识每一个样本盒。一个委托最多可以有9999个样本盒子
*
* ```
* BZ <污水任务编码去掉前缀2个字符后剩下7位> <顺序号4位>
* 例如:
* BZ 2022201 0002
* 合计 13 位
* ```
* @param sewageJobNo
* @return
*/
String getNewBoxNoForSewageJob(String sewageJobNo);
String getNewBoxNoForOther(String newBoxNumber);
/**
* 取指定的样本命盒子的信息, 包含其中的样本编号列表
* 样本编号来自检材清单
* @param id
* @return
*/
SampleBoxLiteVO getSampleBoxLiteVOById(String id);
/**
* 取指定的样本命盒子的信息, 包含其中的样本列表
* 样本列表来自样本表, 必须在相关的委托【受理完成】后才能取到。因为只有受理完成后才会生成样本清单
* 在受理未完成前, 取到的样本列表为空
* @param id
* @return
*/
SampleBoxVO getSampleBoxVOById(String id);
/**
* 构建盒子打印内容
* @param id
* @return
*/
String buildSampleBoxLabelContent(String id) throws Exception;
//获取盒子列表,并附带样本数量的统计属性
List<SampleBoxVO> getSampleBoxList(SampleBox sampleBox);
String printBoxLabel(String id,Integer type);
SampleBox controlsSampleBox(SampleBox sampleBox,Integer opCode);
String printLabelForOther(String boxId, Integer type);
String getOrderIdBy16UUId();
}

View File

@@ -0,0 +1,22 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.EntrustmentIdentificationMaterial;
import digital.laboratory.platform.sys.entity.entrustment.Sample;
import java.util.List;
/**
* 检验用的样本服务类
*
* @author Zhang Xiaolong created at 2022-07-26
* @describe 检验用的样本 服务类
*/
public interface SampleService extends IService<Sample> {
String getNewProvidedSampleNo(String IdentificationMaterialNo, int sampleSerialNumber);
String getNewSampleNo(String IdentificationMaterialNo, int sampleSerialNumber);
List<Sample> createSample(EntrustmentIdentificationMaterial entrustmentIdentificationMaterial,String orgId,String dlpUserId);
// List<Sample> createSample(SewageJobIdentificationMaterial sewageJobIdentificationMaterial,String dlpUserId);
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.SampleStoreChangeDutyLog;
/**
* 样品库管理员换班日志服务类
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库管理员换班日志服务类
*/
public interface SampleStoreChangeDutyLogService extends IService<SampleStoreChangeDutyLog> {
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.SampleStoreLog;
/**
* 样品库入库出库日志服务类
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库入库出库日志服务类
*/
public interface SampleStoreLogService extends IService<SampleStoreLog> {
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.SampleStore;
/**
* 样品库服务类
*
* @author Zhang Xiaolong created at 2022-07-06
* @describe 样品库服务类
*/
public interface SampleStoreService extends IService<SampleStore> {
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.StorageCabinet;
/**
* 暂存柜服务类
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜服务类
*/
public interface StorageCabinetService extends IService<StorageCabinet> {
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.StorageCellLog;
/**
* 暂存柜记录服务类
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜记录服务类
*/
public interface StorageCellLogService extends IService<StorageCellLog> {
}

View File

@@ -0,0 +1,14 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.entrustment.entity.StorageCell;
/**
* 暂存柜,每行一个单元格服务类
*
* @author Zhang Xiaolong created at 2022-04-25
* @describe 暂存柜,每行一个单元格服务类
*/
public interface StorageCellService extends IService<StorageCell> {
}

View File

@@ -0,0 +1,43 @@
package digital.laboratory.platform.entrustment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException;
import digital.laboratory.platform.othersys.dto.EntrustQueryParams;
import digital.laboratory.platform.entrustment.entity.EntrustOfThirdSys;
import digital.laboratory.platform.entrustment.entity.Entrustment;
import digital.laboratory.platform.othersys.vo.SynConnInfoVo;
/**
* @ClassName SynchronizeDataService
* @Description 第三方数据同步服务
* @Author xy
* @Date 2023/6/13 11:00
* @Version 1.0
**/
public interface SynchronizeDataService extends IService<EntrustOfThirdSys>{
//从大数据平台同步已经受理的数据
Boolean synAcceptedEntrustDataToMyServer(EntrustQueryParams queryParams);
void addEntrustThirdSys(EntrustOfThirdSys entrustOfThirdSys);
void updateEntrustThirdSys(EntrustOfThirdSys entrustOfThirdSys);
// 获取系统配置
SynConnInfoVo getSysSynConnInfo();
// 获取token 信息
String getTokenInfo(String whoUse, SynConnInfoVo synConnInfoVo);
//获取禁毒系统的委托数据通过主系统的委托ID
EntrustOfThirdSys getThirdSysEntrustByMainId(String entrustMainId);
//审核
public Boolean auditEntrustByProvinceOrCenter(String userFlag,String dataPath,String thirdSysEntrustID ,String result,
String reMark,String auditOrAccept);
//受理委托
Boolean subCenterAccept(String dataPath, Entrustment selfEntrust, EntrustOfThirdSys thirdSysEntrust) throws JsonProcessingException;
//同步委托数据
Boolean synEntrustDataToMyServer(String entrustStatus,String userFlag);
//提交鉴定结果
Boolean submitIdentifyResult(String dataPath,String entrustId);
}

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