parent
fcb3d491c1
commit
17b1421b33
@ -0,0 +1,15 @@ |
|||||||
|
FROM moxm/java:1.8-full |
||||||
|
|
||||||
|
RUN mkdir -p /sys-admin-service |
||||||
|
|
||||||
|
WORKDIR /sys-admin-service |
||||||
|
|
||||||
|
ARG JAR_FILE=target/sys-admin-service.jar |
||||||
|
|
||||||
|
COPY ${JAR_FILE} app.jar |
||||||
|
|
||||||
|
EXPOSE 5202 |
||||||
|
|
||||||
|
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom" |
||||||
|
|
||||||
|
CMD sleep 60; java -jar app.jar $JAVA_OPTS |
@ -0,0 +1,188 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>DigitalLaboratoryPlatform</artifactId> |
||||||
|
<version>2022.10.11-snapshots</version> |
||||||
|
</parent> |
||||||
|
|
||||||
|
<artifactId>dlp-admin-service</artifactId> |
||||||
|
<packaging>jar</packaging> |
||||||
|
|
||||||
|
<description>系统管理服务, 提供用户、机构、权限等基础管理功能</description> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
<!--upms api、model 模块--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-admin-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>digital.laboratory.platform</groupId>--> |
||||||
|
<!-- <artifactId>dlp-bpmn-api</artifactId>--> |
||||||
|
<!-- <version>2022.10.11-snapshots</version>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
<!--文件管理--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-oss</artifactId> |
||||||
|
<version>2022.10.11-snapshots</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--安全模块--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-security</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--日志处理--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-log</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--接口文档--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-swagger</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--mybatis 模块--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-mybatis</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.baomidou</groupId> |
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--注册中心客户端--> |
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba.cloud</groupId> |
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--配置中心客户端--> |
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba.cloud</groupId> |
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--undertow容器--> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-undertow</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--单元测试--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-test</artifactId> |
||||||
|
</dependency> |
||||||
|
<!--临时使用,不使用了,将其注释掉--> |
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>org.apache.poi</groupId>--> |
||||||
|
<!-- <artifactId>poi</artifactId>--> |
||||||
|
<!-- <version>5.2.3</version>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>org.apache.poi</groupId>--> |
||||||
|
<!-- <artifactId>poi-ooxml</artifactId>--> |
||||||
|
<!-- <version>5.2.3</version>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
|
||||||
|
<!-- 测试PDF SERVER--> |
||||||
|
<dependency> |
||||||
|
<groupId>digital.laboratory.platform</groupId> |
||||||
|
<artifactId>dlp-common-remote-word2pdf</artifactId> |
||||||
|
<version>2022.10.11-snapshots</version> |
||||||
|
<scope>compile</scope> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>io.fabric8</groupId> |
||||||
|
<artifactId>docker-maven-plugin</artifactId> |
||||||
|
</plugin> |
||||||
|
|
||||||
|
<plugin> |
||||||
|
<groupId>org.codehaus.mojo</groupId> |
||||||
|
<artifactId>build-helper-maven-plugin</artifactId> |
||||||
|
<version>3.0.0</version> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>timestamp-property</id> |
||||||
|
<goals> |
||||||
|
<goal>timestamp-property</goal> |
||||||
|
</goals> |
||||||
|
<configuration> |
||||||
|
<name>timestamp</name> |
||||||
|
<pattern>yyyy-MM-dd HH:mm:ss</pattern> |
||||||
|
<locale>zh_CN</locale> |
||||||
|
<timeZone>Asia/Shanghai</timeZone> |
||||||
|
</configuration> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
<!-- 20230210 add xyl 这里是因为mvn 打包的时候会报错(Missing POM for org.apache.maven.surefire:surefire-junit3:jar |
||||||
|
),所以我添加了下面这段)--> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-surefire-plugin</artifactId> |
||||||
|
<version>2.12.4</version> |
||||||
|
<configuration> |
||||||
|
<skipTests>true</skipTests> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
|
||||||
|
<plugin> |
||||||
|
<artifactId>maven-resources-plugin</artifactId> |
||||||
|
<version>3.1.0</version> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>copy-resource-one</id> |
||||||
|
<phase>install</phase> |
||||||
|
<goals> |
||||||
|
<goal>copy-resources</goal> |
||||||
|
</goals> |
||||||
|
<configuration> |
||||||
|
<outputDirectory>${basedir}/../../out</outputDirectory> |
||||||
|
<resources> |
||||||
|
<resource> |
||||||
|
<directory>${basedir}/target</directory> |
||||||
|
<includes> |
||||||
|
<include>${project.artifactId}.jar</include> |
||||||
|
</includes> |
||||||
|
</resource> |
||||||
|
</resources> |
||||||
|
</configuration> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
|
||||||
|
</plugins> |
||||||
|
<resources> |
||||||
|
<resource> |
||||||
|
<directory>src/main/resources</directory> |
||||||
|
<filtering>true</filtering> |
||||||
|
<excludes> |
||||||
|
<exclude>**/*.xlsx</exclude> |
||||||
|
<exclude>**/*.xls</exclude> |
||||||
|
</excludes> |
||||||
|
</resource> |
||||||
|
<resource> |
||||||
|
<directory>src/main/resources</directory> |
||||||
|
<filtering>false</filtering> |
||||||
|
<includes> |
||||||
|
<include>**/*.xlsx</include> |
||||||
|
<include>**/*.xls</include> |
||||||
|
</includes> |
||||||
|
</resource> |
||||||
|
</resources> |
||||||
|
</build> |
||||||
|
|
||||||
|
</project> |
@ -0,0 +1,26 @@ |
|||||||
|
package digital.laboratory.platform; |
||||||
|
|
||||||
|
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 |
||||||
|
@EnableDLPResourceServer |
||||||
|
@EnableDLPFeignClients |
||||||
|
@EnableDiscoveryClient |
||||||
|
@SpringBootApplication |
||||||
|
public class DLPAdminServiceApplication { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
SpringApplication.run(DLPAdminServiceApplication.class, args); |
||||||
|
} |
||||||
|
|
||||||
|
// @Bean
|
||||||
|
// RestTemplate restTemplate() {
|
||||||
|
// return new RestTemplate();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
} |
@ -0,0 +1,75 @@ |
|||||||
|
package digital.laboratory.platform.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.bind.annotation.ResponseStatus; |
||||||
|
import org.springframework.web.client.HttpClientErrorException; |
||||||
|
import org.springframework.web.context.request.WebRequest; |
||||||
|
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, "没有找到")); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,43 @@ |
|||||||
|
package digital.laboratory.platform.config; |
||||||
|
|
||||||
|
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("======================================================================================"));
|
||||||
|
//System.out.println(String.format("dlp-admin-service, FeignOauth2RequestInterceptor(), feignTarget().name()=%s target.url=%s url=%s path=%s", requestTemplate.feignTarget().name(), requestTemplate.feignTarget().url(), requestTemplate.url(), requestTemplate.path()));
|
||||||
|
|
||||||
|
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())); |
||||||
|
} |
||||||
|
else { |
||||||
|
//System.out.println(String.format("authentication=%s", authentication));
|
||||||
|
|
||||||
|
} |
||||||
|
//System.out.println(String.format("======================================================================================"));
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package digital.laboratory.platform.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; |
||||||
|
|
||||||
|
//@EnableOAuth2Sso
|
||||||
|
@Configuration |
||||||
|
|
||||||
|
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void configure(WebSecurity web) { |
||||||
|
web.ignoring().antMatchers("/", "/static/**", "/favicon.ico**", "/login", "/login-callback", "/admin/v2/**", "/sys/v2/**","/comm/dictionary/getVueStoreDictList"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void configure(HttpSecurity http) throws Exception { |
||||||
|
|
||||||
|
http.csrf().disable() |
||||||
|
.authorizeRequests() |
||||||
|
// .antMatchers("/", "/static/**", "/static/dist/**", "/hello**", "/favicon.ico**").permitAll()
|
||||||
|
.anyRequest().permitAll(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package digital.laboratory.platform.config; |
||||||
|
|
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import org.springframework.boot.web.servlet.error.ErrorController; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
public class NotFoundException implements ErrorController { |
||||||
|
|
||||||
|
// @Override |
||||||
|
// public String getErrorPath() { |
||||||
|
// return "/error"; |
||||||
|
// } |
||||||
|
|
||||||
|
@RequestMapping(value = {"/error"}) |
||||||
|
@ResponseBody |
||||||
|
public R error(HttpServletRequest request) { |
||||||
|
Map<String, String> data = new HashMap<>(); |
||||||
|
//data.put("requestURL", request.getRequestURL().toString()); |
||||||
|
//data.put("requestURI", request.getRequestURI()); |
||||||
|
//data.put("pathInfo", request.getPathInfo()); |
||||||
|
data.put("queryString", request.getQueryString()); |
||||||
|
//data.put("servletPath", request.getServletPath()); |
||||||
|
//data.put("httpServletMapping", request.getHttpServletMapping().toString()); |
||||||
|
String requestUri = (String)request.getAttribute("javax.servlet.error.request_uri"); |
||||||
|
if (requestUri!=null) { |
||||||
|
data.put("requestURI", requestUri); |
||||||
|
} |
||||||
|
|
||||||
|
System.out.println(String.format("404 not found by SysAdminApplication, URL=%s", request.getRequestURL().toString())); |
||||||
|
return R.failed(data,"请求地址没有找到"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,297 @@ |
|||||||
|
package digital.laboratory.platform.sys; |
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||||
|
import digital.laboratory.platform.common.core.exception.CheckedException; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.beans.factory.annotation.Value; |
||||||
|
import org.springframework.http.*; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.ui.Model; |
||||||
|
import org.springframework.util.LinkedMultiValueMap; |
||||||
|
import org.springframework.util.MultiValueMap; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
import org.springframework.web.client.HttpClientErrorException; |
||||||
|
import org.springframework.web.client.RestTemplate; |
||||||
|
|
||||||
|
import javax.servlet.http.Cookie; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import java.io.IOException; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
|
||||||
|
@Controller |
||||||
|
public class LoginController { |
||||||
|
@Autowired |
||||||
|
RestTemplate restTemplate; |
||||||
|
|
||||||
|
String authServerURL = ""; |
||||||
|
String clientId = ""; |
||||||
|
String clientSecret = ""; |
||||||
|
|
||||||
|
@Value("${authServerURL}") |
||||||
|
public void setAuthServerURL(String authServerURL) { |
||||||
|
this.authServerURL = authServerURL; |
||||||
|
} |
||||||
|
|
||||||
|
@Value("${clientId}") |
||||||
|
public void setClientId(String clientId) { |
||||||
|
this.clientId = clientId; |
||||||
|
} |
||||||
|
@Value("${clientSecret}") |
||||||
|
public void setClientSecret(String clientSecret) { |
||||||
|
this.clientSecret = clientSecret; |
||||||
|
} |
||||||
|
|
||||||
|
// 之前已经向 authServer 提交用户名和密码并通过, authServer将重定向到这个地址, 并把 code 作为参数
|
||||||
|
// 我们应该向 authServer 获取 token, 并保存 token 到 cookie 中, 然后重定向到 /
|
||||||
|
@GetMapping("/login-callback") |
||||||
|
public void login_callback(String code, String access_token, HttpServletRequest request, HttpServletResponse response) throws IOException { |
||||||
|
|
||||||
|
|
||||||
|
System.out.println(String.format("login_callback start... >>>>>")); |
||||||
|
|
||||||
|
System.out.println(String.format("access_token = %s", access_token)); |
||||||
|
System.out.println(String.format("request.getQueryString() = %s", request.getQueryString())); |
||||||
|
System.out.println(String.format("request.getRequestURI() = %s", request.getRequestURI())); |
||||||
|
System.out.println(String.format("request.getServletPath() = %s", request.getServletPath())); |
||||||
|
System.out.println(String.format("request.getPathTranslated() = %s", request.getPathTranslated())); |
||||||
|
System.out.println(String.format("request.getContextPath() = %s", request.getContextPath())); |
||||||
|
System.out.println(String.format("request.getRequestURL() = %s", request.getRequestURL().toString())); |
||||||
|
System.out.println(String.format("request.getPathTranslated() = %s", request.getPathTranslated())); |
||||||
|
//System.out.println(String.format("request.getContextPath() = %s", request.getHeaders().toString()));
|
||||||
|
System.out.println(String.format("request.getPathInfo() = %s", request.getPathInfo())); |
||||||
|
System.out.println(String.format("request.getTrailerFields() = %s", request.getTrailerFields().toString())); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (code != null) { |
||||||
|
// 请求的 URI 中带有 code
|
||||||
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); |
||||||
|
map.add("code", code); |
||||||
|
map.add("client_id", "UserManagement"); |
||||||
|
map.add("client_secret", "um87990016"); |
||||||
|
map.add("redirect_uri", "http://localhost:8080/login-callback"); |
||||||
|
map.add("grant_type", "authorization_code"); |
||||||
|
System.out.println(String.format("code=%s", code)); |
||||||
|
System.out.println(String.format("map=%s", map.toString())); |
||||||
|
Map<String,String> resp = restTemplate.postForObject("http://dlp-auth-server:5201/oauth/token", map, Map.class); |
||||||
|
String my_access_token = resp.get("access_token"); |
||||||
|
System.out.println("access_token=["+my_access_token+"]"); |
||||||
|
map.add("access_token", my_access_token); |
||||||
|
|
||||||
|
//String token_expires_in = resp.get("expires_in");
|
||||||
|
|
||||||
|
response.addCookie(new Cookie("token_type", resp.get("token_type"))); |
||||||
|
response.addCookie(new Cookie("access_token", resp.get("access_token"))); |
||||||
|
response.addCookie(new Cookie("refresh_token", resp.get("refresh_token"))); |
||||||
|
//response.addCookie(new Cookie("token_expires_in", token_expires_in));
|
||||||
|
|
||||||
|
for (String key : resp.keySet()) { |
||||||
|
System.out.println(String.format("RESP key = [%s] value = [%s]", key, resp.get(key))); |
||||||
|
} |
||||||
|
|
||||||
|
// try {
|
||||||
|
// HttpHeaders headers = new HttpHeaders();
|
||||||
|
// headers.add("Authorization", "Bearer " + access_token);
|
||||||
|
// HttpEntity<Object> httpEntity = new HttpEntity<>(headers);
|
||||||
|
// ResponseEntity<String> entity = restTemplate.exchange("http://192.168.2.99:4000/user/info", HttpMethod.GET, httpEntity, String.class);
|
||||||
|
//
|
||||||
|
// mv.addObject("msg", entity.getBody());
|
||||||
|
// }
|
||||||
|
// catch(Exception e) {
|
||||||
|
// mv.addObject("msg", "调用资源服务器异常 ");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
//return R.ok(userService.getUserInfo(user));
|
||||||
|
} |
||||||
|
else if (access_token != null) { |
||||||
|
// 请求的 URI 中带有 access_token。如果 授权类型为 Implicit, 则重定向的 URI 中带有 access_token, 而不是 code
|
||||||
|
// response.addCookie(new Cookie("token_type", resp.get("token_type")));
|
||||||
|
// response.addCookie(new Cookie("access_token", access_token));
|
||||||
|
// response.addCookie(new Cookie("refresh_token", resp.get("refresh_token")));
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
try { |
||||||
|
System.out.println(String.format("request.getPathInfo()=%s", request.getPathInfo())); |
||||||
|
System.out.println(String.format("request.getAuthType()=%s", request.getAuthType())); |
||||||
|
System.out.println(String.format("request.getContextPath()=%s", request.getContextPath())); |
||||||
|
System.out.println(String.format("request.getCookies()=%s", request.getCookies().toString())); |
||||||
|
System.out.println(String.format("request.getPathTranslated()=%s", request.getPathTranslated())); |
||||||
|
System.out.println(String.format("request.getPathInfo()=%s", request.getPathInfo())); |
||||||
|
System.out.println(String.format("request.getRequestURI()=%s", request.getRequestURI())); |
||||||
|
System.out.println(String.format("request.getRemoteUser()=%s", request.getRemoteUser())); |
||||||
|
System.out.println(String.format("request.getRequestedSessionId()=%s", request.getRequestedSessionId())); |
||||||
|
System.out.println(String.format("request.getRequestURL()=%s", request.getRequestURL().toString())); |
||||||
|
// System.out.println(String.format("request.getUserPrincipal()=%s", request.getUserPrincipal().toString()));
|
||||||
|
System.out.println(String.format("request.getServletPath()=%s", request.getServletPath())); |
||||||
|
System.out.println(String.format("request.getSession()=%s", request.getSession().toString())); |
||||||
|
} |
||||||
|
catch(Exception e) { |
||||||
|
//System.out.println(String.format("show request info excepted, e:%s", e.getStackTrace()));
|
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
|
||||||
|
// response.sendRedirect("/");
|
||||||
|
response.sendRedirect("http://localhost:8080/"); |
||||||
|
|
||||||
|
System.out.println(String.format("login_callback exit")); |
||||||
|
|
||||||
|
//mv.setViewName("redirect:/");
|
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/hello") |
||||||
|
public String hello(String code, Model model) { |
||||||
|
if (code != null) { |
||||||
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); |
||||||
|
map.add("code", code); |
||||||
|
map.add("client_id", "UserManagement"); |
||||||
|
map.add("client_secret", "um87990016"); |
||||||
|
map.add("redirect_uri", "http://192.168.1.99:4000/hello"); |
||||||
|
map.add("grant_type", "authorization_code"); |
||||||
|
System.out.println(String.format("code=%s", code)); |
||||||
|
System.out.println(String.format("map=%s", map.toString())); |
||||||
|
Map<String,String> resp = restTemplate.postForObject(authServerURL, map, Map.class); |
||||||
|
String access_token = resp.get("access_token"); |
||||||
|
System.out.println("access_token=["+access_token+"]"); |
||||||
|
map.add("access_token", access_token); |
||||||
|
/* |
||||||
|
try { |
||||||
|
HttpHeaders headers = new HttpHeaders(); |
||||||
|
headers.add("Authorization", "Bearer " + access_token); |
||||||
|
HttpEntity<Object> httpEntity = new HttpEntity<>(headers); |
||||||
|
ResponseEntity<String> entity = restTemplate.exchange("http://192.168.2.99:4000/user/info", HttpMethod.GET, httpEntity, String.class); |
||||||
|
model.addAttribute("msg", entity.getBody()); |
||||||
|
} |
||||||
|
catch(Exception e) { |
||||||
|
model.addAttribute("msg", "调用资源服务器异常 "); |
||||||
|
} |
||||||
|
*/ |
||||||
|
model.addAllAttributes(map); |
||||||
|
|
||||||
|
} |
||||||
|
return "index"; |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/list") |
||||||
|
@ResponseBody |
||||||
|
public String list() { |
||||||
|
return "index /list, authServerURL="+authServerURL; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// @Resource
|
||||||
|
// private HttpServletResponse response;
|
||||||
|
//HttpServletResponse response;
|
||||||
|
/** |
||||||
|
* 这是 OAuth2 的 password 授权类型. 浏览器向资源拥有者(本程序, client)提交用户名和密码, |
||||||
|
* client 向 AuthServer 提交 用户名和密码, 以及 client_id&client_secret后, AuthServer 直接颁发 access_token |
||||||
|
* 参考 https://datatracker.ietf.org/doc/html/rfc6749#section-4.3
|
||||||
|
* |
||||||
|
* @param username |
||||||
|
* @param password |
||||||
|
* @param request |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping("/login") |
||||||
|
//@ResponseBody
|
||||||
|
public void login(@RequestParam("username") String username, @RequestParam("password") String password, HttpServletRequest request, HttpServletResponse response) throws IOException { |
||||||
|
// System.out.println(String.format("post login start... >>>>>"));
|
||||||
|
// System.out.println(String.format("username=%s, password=%s", username, password));
|
||||||
|
// System.out.println(String.format("authServerURL=%s", authServerURL));
|
||||||
|
|
||||||
|
//---- 记录客户端的 id ---------------------------
|
||||||
|
boolean clientIdExists = false; |
||||||
|
|
||||||
|
Cookie[] cookies = request.getCookies(); |
||||||
|
if (cookies!= null) { |
||||||
|
// System.out.println(String.format("Cookie 数量: %d", cookies.length));
|
||||||
|
for (int i = 0; i < cookies.length; i++) { |
||||||
|
// System.out.println(String.format("Cookie %d: Name=%s, toString:=%s", i, cookies[i].getName(), cookies[i].toString()));
|
||||||
|
if (StrUtil.equalsIgnoreCase("client-id", cookies[i].getName())) { |
||||||
|
// System.out.println(String.format("---> get client-id=%s", cookies[i].toString()));
|
||||||
|
clientIdExists = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
else { |
||||||
|
// System.out.println(String.format("客户端没有任何 Cookie"));
|
||||||
|
} |
||||||
|
if (!clientIdExists) { |
||||||
|
// clientId 不存在, 生成一个, 我们要用这个 clientId 来跟踪用户的电脑
|
||||||
|
Cookie cookie = new Cookie("client-id", IdWorker.get32UUID().toUpperCase()); |
||||||
|
response.addCookie(cookie); |
||||||
|
// System.out.println(String.format("---> set client-id=%s", cookie.toString()));
|
||||||
|
} |
||||||
|
|
||||||
|
//---- 以上 记录客户端的 id ---------------------------
|
||||||
|
|
||||||
|
//HttpServletResponse resp = new HttpServletResponse();
|
||||||
|
//请求头
|
||||||
|
HttpHeaders headers = new HttpHeaders(); |
||||||
|
|
||||||
|
String clientCredential = clientId+":"+clientSecret; |
||||||
|
byte[] clientCredentialBytes = clientCredential.getBytes(StandardCharsets.UTF_8); |
||||||
|
byte[] encoded; |
||||||
|
try { |
||||||
|
encoded = Base64.encode(clientCredentialBytes, false); |
||||||
|
} |
||||||
|
catch (IllegalArgumentException e) { |
||||||
|
throw new CheckedException("Failed to encode basic authentication token"); |
||||||
|
} |
||||||
|
String clientCredentialBase64 = new String(encoded, StandardCharsets.UTF_8); |
||||||
|
headers.add("Authorization", "Basic "+clientCredentialBase64); |
||||||
|
|
||||||
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
||||||
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); |
||||||
|
map.add("grant_type", "password"); |
||||||
|
map.add("username", username); |
||||||
|
map.add("password", password); |
||||||
|
HttpEntity<MultiValueMap> entity = new HttpEntity<MultiValueMap>(map, headers); |
||||||
|
|
||||||
|
String resp; |
||||||
|
try { |
||||||
|
resp = restTemplate.postForObject(authServerURL, entity, String.class); |
||||||
|
// System.out.println(String.format("调用鉴权, 返回=%s", resp));
|
||||||
|
response.setStatus(200); |
||||||
|
response.getWriter().print(resp); |
||||||
|
} |
||||||
|
catch (HttpClientErrorException ex) { |
||||||
|
// System.out.println(String.format("调用鉴权发生异常 ex=%s", ex.toString()));
|
||||||
|
// System.out.println(String.format("111 ex.getRawStatusCode()=%d, ex.getStatusText()=%s", ex.getRawStatusCode(), ex.getStatusText()));
|
||||||
|
// System.out.println(String.format("ex.getResponseBodyAsString()=%s", ex.getResponseBodyAsString()));
|
||||||
|
// System.out.println(String.format("ex.getResponseHeaders()=%s", ex.getResponseHeaders().toString()));
|
||||||
|
// System.out.println(String.format("ex... ContentType().getType()=%s", ex.getResponseHeaders().getContentType().getType()));
|
||||||
|
// System.out.println(String.format("ex... ContentType().toS()=%s", ex.getResponseHeaders().getContentType().toString()));
|
||||||
|
|
||||||
|
// ex.printStackTrace();
|
||||||
|
response.reset(); |
||||||
|
response.setStatus(ex.getRawStatusCode()); |
||||||
|
response.setContentType("application/json; charset=utf-8"); |
||||||
|
response.getWriter().print(ex.getResponseBodyAsString()); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//Map<String,String> resp = restTemplate.postForObject(authServerURL+"?grant_type=password&username="+username+"&password="+password, map, Map.class);
|
||||||
|
|
||||||
|
// Cookie token_type = new Cookie("token_type", resp.get("token_type"));
|
||||||
|
// Cookie access_token = new Cookie("access_token", resp.get("access_token"));
|
||||||
|
// Cookie refresh_token = new Cookie("refresh_token", resp.get("refresh_token"));
|
||||||
|
//
|
||||||
|
// response.addCookie(new Cookie("token_type", resp.get("token_type")));
|
||||||
|
// response.addCookie(new Cookie("access_token", resp.get("access_token")));
|
||||||
|
// response.addCookie(new Cookie("refresh_token", resp.get("refresh_token")));
|
||||||
|
//response.addCookie(new Cookie("token_expires_in", token_expires_in));
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.service.AppService; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUser; |
||||||
|
import digital.laboratory.platform.sys.service.SysUserService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lengleng |
||||||
|
* @date 2021/9/16 移动端登录 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/app") |
||||||
|
@Api(tags = "手机管理", description="未使用", hidden=true) |
||||||
|
public class AppController { |
||||||
|
|
||||||
|
private final AppService appService; |
||||||
|
|
||||||
|
private final SysUserService userService; |
||||||
|
|
||||||
|
@Inner(value = false) |
||||||
|
@GetMapping("/{mobile}") |
||||||
|
public R sendSmsCode(@PathVariable String mobile) { |
||||||
|
return appService.sendSmsCode(mobile); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取指定用户全部信息 |
||||||
|
* @param mobile 手机号 |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@GetMapping("/info/{mobile}") |
||||||
|
public R infoByMobile(@PathVariable String mobile) { |
||||||
|
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getPoliceNo, mobile)); |
||||||
|
if (user == null) { |
||||||
|
return R.failed(String.format("用户信息为空 %s", mobile)); |
||||||
|
} |
||||||
|
return R.ok(userService.getUserInfo(user)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,305 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.entity.Area; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.sys.service.AreaService; |
||||||
|
import digital.laboratory.platform.sys.vo.AreaVO; |
||||||
|
import digital.laboratory.platform.common.core.constant.CacheConstants; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.cache.annotation.Cacheable; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 省/地/县 3级行政区划 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong |
||||||
|
* created at 2022-03-10 09:45:58 |
||||||
|
* @describe 省/地/县 3级行政区划前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/area") |
||||||
|
@Api( tags = "01-行政区划管理") |
||||||
|
public class CommAreaController { |
||||||
|
private final AreaService areaService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过 id 查询对象 |
||||||
|
* @param id 对象的 id |
||||||
|
* @return 对象信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/{id}") |
||||||
|
public R getById(@PathVariable String id) { |
||||||
|
return R.ok(areaService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过 id 查询对象 |
||||||
|
* @param id 对象的 id |
||||||
|
* @return 对象信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/inner/{id}") |
||||||
|
@Inner |
||||||
|
public R innerGetById(@PathVariable String id) { |
||||||
|
return R.ok(areaService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询对象列表 |
||||||
|
* @param page 分页对象 |
||||||
|
* @return 分页对象 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R<IPage> getPage(Page page, Area area) { |
||||||
|
page.setOrders(OrderItem.ascs("id", "name")); |
||||||
|
|
||||||
|
return R.ok(areaService.page(page, Wrappers.<Area>query() |
||||||
|
.like(area.getId()!=null,"id", area.getId()) |
||||||
|
.like(area.getName()!=null,"name", area.getName()) |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取省列表 |
||||||
|
* @return 同类型字典 |
||||||
|
*/ |
||||||
|
@GetMapping("/provinces") |
||||||
|
@Cacheable(value = CacheConstants.AREA_PROVINCES_DETAILS) |
||||||
|
public R<List<Area>> getProvinces() { |
||||||
|
return R.ok(areaService.list(Wrappers.<Area>query() |
||||||
|
.like("id", "__0000") |
||||||
|
.orderByAsc("sort") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取省列表 |
||||||
|
* @return 同类型字典 |
||||||
|
*/ |
||||||
|
@GetMapping("/inner/provinces") |
||||||
|
@Inner |
||||||
|
@Cacheable(value = CacheConstants.AREA_PROVINCES_DETAILS) |
||||||
|
public R<List<Area>> innerGetProvinces() { |
||||||
|
return R.ok(areaService.list(Wrappers.<Area>query() |
||||||
|
.like("id", "__0000") |
||||||
|
.orderByAsc("sort") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取指定省的地市列表 |
||||||
|
* @param provinceId 省 |
||||||
|
* @return 地市列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/cities/{provinceId}") |
||||||
|
@Cacheable(value = CacheConstants.AREA_CITIES_DETAILS, key = "#provinceId") |
||||||
|
public R<List<Area>> getCitys(@PathVariable String provinceId) { |
||||||
|
if (provinceId.length()<2) { |
||||||
|
return R.failed("省代码不能小于2位"); |
||||||
|
} |
||||||
|
provinceId = provinceId.substring(0, 2); |
||||||
|
return R.ok(areaService.list(Wrappers.<Area>query() |
||||||
|
.like("id", provinceId +"__00") |
||||||
|
.ne("id", provinceId +"0000") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取指定省的地市列表 |
||||||
|
* @param provinceId 省 |
||||||
|
* @return 地市列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/inner/cities/{provinceId}") |
||||||
|
@Inner |
||||||
|
@Cacheable(value = CacheConstants.AREA_CITIES_DETAILS, key = "#provinceId") |
||||||
|
public R<List<Area>> innerGetCitys(@PathVariable String provinceId) { |
||||||
|
if (provinceId.length()<2) { |
||||||
|
return R.failed("省代码不能小于2位"); |
||||||
|
} |
||||||
|
provinceId = provinceId.substring(0, 2); |
||||||
|
return R.ok(areaService.list(Wrappers.<Area>query() |
||||||
|
.like("id", provinceId +"__00") |
||||||
|
.ne("id", provinceId +"0000") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取指定地市的区县列表 |
||||||
|
* @param cityId 地市 |
||||||
|
* @return 区县列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/districts/{cityId}") |
||||||
|
@Cacheable(value = CacheConstants.AREA_DISTRICTS_DETAILS, key = "#cityId") |
||||||
|
public R<List<Area>> getDistricts(@PathVariable String cityId) { |
||||||
|
if (cityId.length()<4) { |
||||||
|
return R.failed("地市代码不能小于4位"); |
||||||
|
} |
||||||
|
cityId = cityId.substring(0, 4); |
||||||
|
return R.ok(areaService.list(Wrappers.<Area>query() |
||||||
|
.like("id", cityId +"__") |
||||||
|
.ne("id", cityId +"00") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取指定地市的区县列表 |
||||||
|
* @param cityId 地市 |
||||||
|
* @return 区县列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/inner/districts/{cityId}") |
||||||
|
@Inner |
||||||
|
@Cacheable(value = CacheConstants.AREA_DISTRICTS_DETAILS, key = "#cityId") |
||||||
|
public R<List<Area>> innerGetDistricts(@PathVariable String cityId) { |
||||||
|
if (cityId.length()<4) { |
||||||
|
return R.failed("地市代码不能小于4位"); |
||||||
|
} |
||||||
|
cityId = cityId.substring(0, 4); |
||||||
|
return R.ok(areaService.list(Wrappers.<Area>query() |
||||||
|
.like("id", cityId +"__") |
||||||
|
.ne("id", cityId +"00") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 取指定区域的下属子区域
|
||||||
|
// * @param dispCode 地市
|
||||||
|
// * @return 下一级区域列表
|
||||||
|
// */
|
||||||
|
// @GetMapping("/sub_area")
|
||||||
|
//// @Cacheable(value = CacheConstants.AREA_SUB_DETAILS, key = "#code")
|
||||||
|
// public R<List<AreaVO>> getSubAreas(String dispCode) {
|
||||||
|
// if (StrUtil.isBlank(dispCode) || "000000".equals(dispCode)) {
|
||||||
|
// // 没有提供 code 或 code 是 000000, 表示要取全部省
|
||||||
|
// return R.ok(areaService.listAreaVO(Wrappers.<Area>query()
|
||||||
|
// .like("code", "__0000")
|
||||||
|
// .orderByAsc("sort")
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// if (dispCode.length()!=6) {
|
||||||
|
// return R.failed("区域代码必须是6位");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ("0000".equals(dispCode.substring(2, 6))) {
|
||||||
|
// // 提供的是省代码, 取下属地州市
|
||||||
|
// String cityCode = dispCode.substring(0, 2);
|
||||||
|
// return R.ok(areaService.listAreaVO(Wrappers.<Area>query()
|
||||||
|
// .like("disp_code", cityCode+"__00")
|
||||||
|
// .ne("disp_code", cityCode+"0000")
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
// else if ("00".equals(dispCode.substring(4, 6))) {
|
||||||
|
// // 提供的是地州市代码, 取下属区县
|
||||||
|
// String cityCode = dispCode.substring(0, 4);
|
||||||
|
// return R.ok(areaService.listAreaVO(Wrappers.<Area>query()
|
||||||
|
// .like("disp_code", cityCode+"__")
|
||||||
|
// .ne("disp_code", cityCode+"00")
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// List<AreaVO> empty = new ArrayList<AreaVO>();
|
||||||
|
// return R.ok(empty);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询区域 |
||||||
|
* 查询条件: id/parentId/name |
||||||
|
* @param area 地市 |
||||||
|
* @return 区域VO 列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/vo") |
||||||
|
// @Cacheable(value = CacheConstants.AREA_SUB_DETAILS, key = "#code")
|
||||||
|
public R<List<AreaVO>> listAreaVO(Area area) { |
||||||
|
return R.ok(areaService.listAreaVO(Wrappers.<Area>query() |
||||||
|
.like(StrUtil.isNotBlank(area.getName()), "name", area.getName()) |
||||||
|
.eq(StrUtil.isNotBlank(area.getId()), "id", area.getId()) |
||||||
|
.eq(StrUtil.isNotBlank(area.getParentId()), "parent_id", area.getParentId()) |
||||||
|
.orderByAsc("sort") |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据地区名字查询地区id |
||||||
|
* @param provinceName |
||||||
|
* @param cityName |
||||||
|
* @param areaName |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/name/{provinceName}/{cityName}/{areaName}") |
||||||
|
public R<Map<String, String>> listAreaVOByName(@PathVariable("provinceName") String provinceName, |
||||||
|
@PathVariable("cityName")String cityName, |
||||||
|
@PathVariable("areaName")String areaName) { |
||||||
|
Map<String, String> areaMap = new HashMap<>(); |
||||||
|
|
||||||
|
QueryWrapper<Area> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.eq(StrUtil.isNotBlank(provinceName),"name", provinceName); // 先查询省的id
|
||||||
|
Area province = areaService.getOne(queryWrapper); |
||||||
|
if (province != null) { |
||||||
|
// 添加查询到的省的id
|
||||||
|
areaMap.put("provinceId", province.getId()); |
||||||
|
|
||||||
|
// 判断是否是直辖市
|
||||||
|
if (!provinceName.equals(cityName)) { |
||||||
|
// 查询市
|
||||||
|
queryWrapper = new QueryWrapper<Area>(); |
||||||
|
queryWrapper.eq("parent_id", province.getId()); |
||||||
|
queryWrapper.eq(StrUtil.isNotBlank(cityName),"name", cityName); // 查询市
|
||||||
|
|
||||||
|
Area city = areaService.getOne(queryWrapper); |
||||||
|
if (city != null) { |
||||||
|
// 添加查询到的市的id
|
||||||
|
areaMap.put("cityId", city.getId()); |
||||||
|
if (areaName.equals(cityName)) { |
||||||
|
areaMap.put("areaId", city.getId()); |
||||||
|
} |
||||||
|
} else { |
||||||
|
throw new RuntimeException(String.format("找不到名字为 %s 的地区", cityName)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
// 该地区是直辖市
|
||||||
|
// 添加查询到的省的id
|
||||||
|
areaMap.put("cityId", province.getId()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (areaMap.get("cityId") != null && !areaName.equals(cityName)) { |
||||||
|
// 查询区县的
|
||||||
|
queryWrapper = new QueryWrapper<Area>(); |
||||||
|
queryWrapper.eq("parent_id", areaMap.get("cityId")); |
||||||
|
queryWrapper.eq(StrUtil.isNotBlank(areaName),"name", areaName); // 查询区县的
|
||||||
|
Area area = areaService.getOne(queryWrapper); |
||||||
|
if (area != null) { |
||||||
|
// 添加查询到的区县的id
|
||||||
|
areaMap.put("areaId", area.getId()); |
||||||
|
} |
||||||
|
// else {
|
||||||
|
// throw new RuntimeException(String.format("找不到名字为 %s 的地区", areaName));
|
||||||
|
// }
|
||||||
|
} |
||||||
|
} else { |
||||||
|
throw new RuntimeException(String.format("找不到名字为 %s 的地区", provinceName)); |
||||||
|
} |
||||||
|
|
||||||
|
return R.ok(areaMap); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,95 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
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.Business; |
||||||
|
import digital.laboratory.platform.sys.service.BusinessService; |
||||||
|
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.*; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/business" ) |
||||||
|
@Api(value = "business", tags = "业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用管理") |
||||||
|
public class CommBusinessController { |
||||||
|
|
||||||
|
private final BusinessService businessService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_get')" ) |
||||||
|
public R getById(@PathVariable("id" ) String id) { |
||||||
|
return R.ok(businessService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param business 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_get')" ) |
||||||
|
public R getBusinessPage(Page page, Business business) { |
||||||
|
return R.ok(businessService.page(page, Wrappers.query(business))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @param business 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用", notes = "新增业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用") |
||||||
|
@SysLog("新增业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用" ) |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_add')" ) |
||||||
|
public R postAddObject(@RequestBody Business business) { |
||||||
|
return R.ok(businessService.save(business)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @param business 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用", notes = "修改业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用") |
||||||
|
@SysLog("修改业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用" ) |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_edit')" ) |
||||||
|
public R putUpdateById(@RequestBody Business business) { |
||||||
|
return R.ok(businessService.updateById(business)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用", notes = "通过id删除业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用") |
||||||
|
@SysLog("通过id删除业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_del')" ) |
||||||
|
public R deleteById(@PathVariable String id) { |
||||||
|
return R.ok(businessService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,95 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
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.BusinessDepartment; |
||||||
|
import digital.laboratory.platform.sys.service.BusinessDepartmentService; |
||||||
|
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-15 |
||||||
|
* @describe 鉴定中心的业务部门设置 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/business_department" ) |
||||||
|
@Api(value = "business_department", tags = "鉴定中心的业务部门设置管理") |
||||||
|
public class CommBusinessDepartmentController { |
||||||
|
|
||||||
|
private final BusinessDepartmentService businessDepartmentService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询鉴定中心的业务部门设置 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_department_get')" ) |
||||||
|
public R getById(@PathVariable("id" ) String id) { |
||||||
|
return R.ok(businessDepartmentService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param businessDepartment 鉴定中心的业务部门设置 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_department_get')" ) |
||||||
|
public R getBusinessDepartmentPage(Page page, BusinessDepartment businessDepartment) { |
||||||
|
return R.ok(businessDepartmentService.page(page, Wrappers.query(businessDepartment))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增鉴定中心的业务部门设置 |
||||||
|
* @param businessDepartment 鉴定中心的业务部门设置 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增鉴定中心的业务部门设置", notes = "新增鉴定中心的业务部门设置") |
||||||
|
@SysLog("新增鉴定中心的业务部门设置" ) |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_department_add')" ) |
||||||
|
public R postAddObject(@RequestBody BusinessDepartment businessDepartment) { |
||||||
|
return R.ok(businessDepartmentService.save(businessDepartment)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改鉴定中心的业务部门设置 |
||||||
|
* @param businessDepartment 鉴定中心的业务部门设置 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改鉴定中心的业务部门设置", notes = "修改鉴定中心的业务部门设置") |
||||||
|
@SysLog("修改鉴定中心的业务部门设置" ) |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_department_edit')" ) |
||||||
|
public R putUpdateById(@RequestBody BusinessDepartment businessDepartment) { |
||||||
|
return R.ok(businessDepartmentService.updateById(businessDepartment)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除鉴定中心的业务部门设置 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除鉴定中心的业务部门设置", notes = "通过id删除鉴定中心的业务部门设置") |
||||||
|
@SysLog("通过id删除鉴定中心的业务部门设置" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_department_del')" ) |
||||||
|
public R deleteById(@PathVariable String id) { |
||||||
|
return R.ok(businessDepartmentService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,95 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
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.BusinessRDepartment; |
||||||
|
import digital.laboratory.platform.sys.service.BusinessRDepartmentService; |
||||||
|
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-15 |
||||||
|
* @describe 业务与专业检验室的关系 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/business_r_department" ) |
||||||
|
@Api(value = "business_r_department", tags = "业务与专业检验室的关系管理") |
||||||
|
public class CommBusinessRDepartmentController { |
||||||
|
|
||||||
|
private final BusinessRDepartmentService businessRDepartmentService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询业务与专业检验室的关系 |
||||||
|
* @param departmentId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{departmentId}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_r_department_get')" ) |
||||||
|
public R getById(@PathVariable("departmentId" ) String departmentId) { |
||||||
|
return R.ok(businessRDepartmentService.getById(departmentId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param businessRDepartment 业务与专业检验室的关系 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_r_department_get')" ) |
||||||
|
public R getBusinessRDepartmentPage(Page page, BusinessRDepartment businessRDepartment) { |
||||||
|
return R.ok(businessRDepartmentService.page(page, Wrappers.query(businessRDepartment))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增业务与专业检验室的关系 |
||||||
|
* @param businessRDepartment 业务与专业检验室的关系 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增业务与专业检验室的关系", notes = "新增业务与专业检验室的关系") |
||||||
|
@SysLog("新增业务与专业检验室的关系" ) |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_r_department_add')" ) |
||||||
|
public R postAddObject(@RequestBody BusinessRDepartment businessRDepartment) { |
||||||
|
return R.ok(businessRDepartmentService.save(businessRDepartment)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改业务与专业检验室的关系 |
||||||
|
* @param businessRDepartment 业务与专业检验室的关系 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改业务与专业检验室的关系", notes = "修改业务与专业检验室的关系") |
||||||
|
@SysLog("修改业务与专业检验室的关系" ) |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_r_department_edit')" ) |
||||||
|
public R putUpdateById(@RequestBody BusinessRDepartment businessRDepartment) { |
||||||
|
return R.ok(businessRDepartmentService.updateById(businessRDepartment)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除业务与专业检验室的关系 |
||||||
|
* @param departmentId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除业务与专业检验室的关系", notes = "通过id删除业务与专业检验室的关系") |
||||||
|
@SysLog("通过id删除业务与专业检验室的关系" ) |
||||||
|
@DeleteMapping("/{departmentId}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_business_r_department_del')" ) |
||||||
|
public R deleteById(@PathVariable String departmentId) { |
||||||
|
return R.ok(businessRDepartmentService.removeById(departmentId)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,220 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||||
|
import digital.laboratory.platform.sys.entity.Deliverer; |
||||||
|
import digital.laboratory.platform.sys.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("/comm/deliverer" ) |
||||||
|
@Api(value = "deliverer", tags = "送检员管理") |
||||||
|
public class CommDelivererController { |
||||||
|
|
||||||
|
private final DelivererService delivererService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过名字查询送检员 |
||||||
|
* |
||||||
|
* @param name |
||||||
|
* |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过名字查询送检员", notes = "通过名字查询送检员, 如果没有找到, 则返回数据为 null") |
||||||
|
@GetMapping("/name/{name}") |
||||||
|
public R<Deliverer> getByName(@PathVariable("name")String name, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
Deliverer deliverer = delivererService.getByName(name, dlpUser.getId()); |
||||||
|
if (deliverer != null) { |
||||||
|
return R.ok(deliverer, "取送检员信息成功"); |
||||||
|
} |
||||||
|
else { |
||||||
|
return R.failed(String.format("没有找到名字为 %s 的送检员", name)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询送检员 |
||||||
|
* |
||||||
|
* @param id id |
||||||
|
* |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}") |
||||||
|
public R<Deliverer> 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 { |
||||||
|
throw new RuntimeException(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") |
||||||
|
public R<List<Deliverer>> 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") |
||||||
|
public R<IPage<Deliverer>> 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
|
||||||
|
// public R<Deliverer> 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 {
|
||||||
|
// throw new RuntimeException("新增送检员失败");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 修改或创建送检员 更新存储的送检员信息 |
||||||
|
* |
||||||
|
* @param deliverer 送检员 |
||||||
|
* |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改送检员", notes = "修改送检员。如果送检员存在则更新, 如果不存在则新增") |
||||||
|
@SysLog("修改送检员") |
||||||
|
@PutMapping |
||||||
|
public R<Boolean> putUpdateById(@RequestBody Deliverer deliverer, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
|
||||||
|
deliverer.setOwnerUserId(dlpUser.getId()); |
||||||
|
|
||||||
|
if (delivererService.renew(deliverer)) { |
||||||
|
return R.ok(true, "更新送检员信息成功"); |
||||||
|
} |
||||||
|
else { |
||||||
|
//throw new RuntimeException(String.format("更新送检员[%s]信息出错", deliverer.getName()));
|
||||||
|
return R.ok(false, String.format("更新送检员[%s]信息出错", deliverer.getName())); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除送检员 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除送检员", notes = "通过id删除送检员") |
||||||
|
@SysLog("通过id删除送检员" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
public R<Deliverer> 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 { |
||||||
|
throw new RuntimeException("送检员删除失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
else { |
||||||
|
throw new RuntimeException(String.format("你没有权限删除id为 %s 的送检员", id)); |
||||||
|
} |
||||||
|
} |
||||||
|
else { |
||||||
|
throw new RuntimeException(String.format("没有找到id为 %s 的送检员", id)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,328 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import digital.laboratory.platform.sys.entity.Dictionary; |
||||||
|
import digital.laboratory.platform.sys.vo.DictVueStoreVo; |
||||||
|
import digital.laboratory.platform.sys.vo.DictionaryVO; |
||||||
|
import digital.laboratory.platform.sys.service.DictionaryService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.common.security.util.SecurityUtils; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiImplicitParam; |
||||||
|
import io.swagger.annotations.ApiImplicitParams; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 字典表 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019-03-19 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/dictionary") |
||||||
|
@Api(tags = "02-字典管理") |
||||||
|
public class CommDictionaryController { |
||||||
|
private final DictionaryService dictionaryService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 取全部字典信息 |
||||||
|
* @return 字典列表 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "取字典列表", notes = "取字典列表") |
||||||
|
@GetMapping |
||||||
|
public R getDictionaryList() { |
||||||
|
return R.ok(dictionaryService.list(Wrappers.emptyWrapper())); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 返回树形字典集合 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 树形权限 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "取字典分支树", notes = "取字典分支树") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name="parentId",value="分支树的标识",required=true,paramType="query"), |
||||||
|
}) |
||||||
|
@GetMapping(value = "/tree") |
||||||
|
public R getTree(String parentId) { |
||||||
|
return R.ok(dictionaryService.treeDictionary(parentId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 内部调用 |
||||||
|
* @param parentId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/insideTree") |
||||||
|
public List<Dictionary> insideTreeData(String parentId) { |
||||||
|
return dictionaryService.list(Wrappers.<Dictionary>lambdaQuery() |
||||||
|
.orderByAsc(Dictionary::getSort)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping(value = "/treeParentData") |
||||||
|
public R getTreeParentData(String parentId) { |
||||||
|
return R.ok(dictionaryService.getTreeParentDictionary()); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 通过ID查询字典信息 |
||||||
|
* @param id ID |
||||||
|
* @return 字典信息 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过ID查询字典信息", notes = "通过ID查询字典信息") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name="id",value="id",required=true,paramType="path"), |
||||||
|
}) |
||||||
|
@GetMapping("/{id}") |
||||||
|
public R getById(@PathVariable String id) { |
||||||
|
//throw new RuntimeException("搞个异常试一下");
|
||||||
|
return R.ok(dictionaryService.getById(id)); |
||||||
|
} |
||||||
|
@GetMapping("/getDictByID") |
||||||
|
public Dictionary getDictByID(String dictID) |
||||||
|
{ |
||||||
|
return dictionaryService.getById(dictID); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 通过ID查询字典信息 |
||||||
|
* @param id ID |
||||||
|
* @return 字典信息 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过ID查询字典信息, 仅供内部模块调用", notes = "通过ID查询字典信息, 仅供内部模块调用") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name="id",value="id",required=true,paramType="path"), |
||||||
|
}) |
||||||
|
@GetMapping("/inner/{id}") |
||||||
|
@Inner |
||||||
|
public R innerGetById(@PathVariable String id) { |
||||||
|
return R.ok(dictionaryService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过字典类型查找字典 |
||||||
|
* @param type 类型 |
||||||
|
* @return 同类型字典 |
||||||
|
*/ |
||||||
|
@GetMapping("/inner/type/{type}") |
||||||
|
@Inner |
||||||
|
// @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type")
|
||||||
|
public R<List<Dictionary>> innerGetDictionaryByType(@PathVariable String type) { |
||||||
|
return R.ok(dictionaryService.list(Wrappers.<Dictionary>query() |
||||||
|
.eq("type", type) |
||||||
|
.orderByAsc("sort") |
||||||
|
.orderByAsc("id"))); |
||||||
|
// return R.ok(sysDictionaryService.list(Wrappers.<Dictionary>query().lambda().like(true, "type", type, SqlLike.DEFAULT)));
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询字典信息 |
||||||
|
* @param page 分页对象 |
||||||
|
* @return 分页对象 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询字典信息", notes = "分页查询字典信息\n"+ |
||||||
|
"查询条件:\n"+ |
||||||
|
"page 分页信息\n"+ |
||||||
|
"dict 查询条件组成的字典对象, 具体有以下几个属性:\n"+ |
||||||
|
" module/type/code/label/description/comments 这些查询条件都是 like 方式\n" + |
||||||
|
" 这几个查询条件之间是 and 关系。\n" + |
||||||
|
"例如 type=abc 表示查询字典type属性中包含abc的全部字典\n" + |
||||||
|
"例如 type=abc&code=def 表示查询字典type属性中包含abc并且code属性中包含def的全部字典\n"+ |
||||||
|
"实际调用时, 并不是直接提供page和dict对象, 而是提供page的属性和dict的属性, 后端接口程序会自动组装成对象\n"+ |
||||||
|
"" |
||||||
|
) |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name="page",value="page",required=true,paramType="query"), |
||||||
|
@ApiImplicitParam(name="dict",value="查询条件",required=false,paramType="query"), |
||||||
|
}) |
||||||
|
@GetMapping("/page") |
||||||
|
public R<IPage> getDictionaryPage(Page page, Dictionary dict) { |
||||||
|
page.setOrders(OrderItem.ascs("type", "code")); |
||||||
|
//System.out.println(String.format("CommDictionaryController.getDictPage(), dict=%s", dict.toString()));
|
||||||
|
//System.out.println(String.format("CommDictionaryController.getDictPage(), page=%s", page.toString()));
|
||||||
|
|
||||||
|
|
||||||
|
return R.ok(dictionaryService.page(page, Wrappers.<Dictionary>query() |
||||||
|
.like(dict.getModule()!=null,"module", dict.getModule()) |
||||||
|
.like(dict.getType()!=null,"type", dict.getType()) |
||||||
|
.like(dict.getCode()!=null,"code", dict.getCode()) |
||||||
|
.like(dict.getLabel()!=null,"label", dict.getLabel()) |
||||||
|
.like(dict.getDescription()!=null,"description", dict.getDescription()) |
||||||
|
.like(dict.getComments()!=null,"comments", dict.getComments()) |
||||||
|
)); |
||||||
|
|
||||||
|
|
||||||
|
//return R.ok(sysDictionaryService.page(page, Wrappers.query(dict)));
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 取全部类型 |
||||||
|
* @return 同类型字典 |
||||||
|
*/ |
||||||
|
@GetMapping("/types") |
||||||
|
// @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type")
|
||||||
|
public R<List<Dictionary>> getDictionaryTypes(String module) { |
||||||
|
List<Dictionary> list = dictionaryService.listTypes(module); |
||||||
|
return R.ok(list); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过字典类型查找字典 |
||||||
|
* @param type 类型 |
||||||
|
* @return 同类型字典 |
||||||
|
*/ |
||||||
|
@GetMapping("/type/{type}") |
||||||
|
// @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type")
|
||||||
|
public R<List<Dictionary>> getDictionaryByType(@PathVariable String type) { |
||||||
|
return R.ok(dictionaryService.list(Wrappers.<Dictionary>query() |
||||||
|
.eq("type", type) |
||||||
|
//.notLike("label","常用")
|
||||||
|
.orderByAsc("sort") |
||||||
|
.orderByAsc("id"))); |
||||||
|
} |
||||||
|
//一次查出多个字典的值,比如页面刚加载的时候,就希望一次加载多个字典到Vue store 中
|
||||||
|
@GetMapping("/getVueStoreDictList") |
||||||
|
public R<List<DictVueStoreVo>> getDictByInit(@RequestParam List<String> typeList) |
||||||
|
{ |
||||||
|
long beginTime1=System.currentTimeMillis(); |
||||||
|
List<DictVueStoreVo> retData=dictionaryService.getVueStoreLoadDictList(typeList); |
||||||
|
long beginTime2=System.currentTimeMillis(); |
||||||
|
System.out.println(beginTime1+"#"+beginTime2); |
||||||
|
return R.ok(retData); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 通过字典类型查找字典 |
||||||
|
* @param type 类型 |
||||||
|
* @return 同类型字典 |
||||||
|
*/ |
||||||
|
@GetMapping("/typeLike/{type}") |
||||||
|
// @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type")
|
||||||
|
public R getDictionaryByTypeLike(@PathVariable String type) { |
||||||
|
return R.ok(dictionaryService.list(Wrappers.<Dictionary>query() |
||||||
|
.like("type", type) |
||||||
|
.orderByAsc("sort") |
||||||
|
.orderByAsc("id"))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加字典 |
||||||
|
* @param dictionary 字典信息 |
||||||
|
* @return success、false |
||||||
|
*/ |
||||||
|
@SysLog("添加字典") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_dict_add')") |
||||||
|
public R add(@Valid @RequestBody Dictionary dictionary) { |
||||||
|
// String username = SecurityUtils.getUser().getUsername();
|
||||||
|
// dictionary.setCreateBy(username);
|
||||||
|
// dictionary.setUpdateBy(username);
|
||||||
|
boolean r = dictionaryService.save(dictionary); |
||||||
|
if (r) { |
||||||
|
return R.ok("添加字典项成功"); |
||||||
|
} |
||||||
|
else { |
||||||
|
return R.failed("添加字典项失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除字典, 并且清除字典缓存 |
||||||
|
* @param id ID |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@SysLog("删除字典") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_dict_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
//dictionaryService.removeDictionary(id);
|
||||||
|
dictionaryService.deleteDictionary(id); |
||||||
|
return R.ok("删除字典项成功"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改字典 |
||||||
|
* @param dictionary 字典信息 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
@SysLog("修改字典") |
||||||
|
//@PreAuthorize("@pms.hasPermission('sys_dict_edit')")
|
||||||
|
public R updateById(@Valid @RequestBody Dictionary dictionary) { |
||||||
|
String username = SecurityUtils.getUser().getUsername(); |
||||||
|
dictionary.setUpdateBy(username); |
||||||
|
dictionaryService.updateDictionary(dictionary); |
||||||
|
return R.ok("修改字典项成功"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 字典列表 |
||||||
|
* 查询条件: id/parentId/name |
||||||
|
* @param dictionary 字典id |
||||||
|
* @return 字典VO 列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/vo") |
||||||
|
@Inner |
||||||
|
public R<List<DictionaryVO>> listDictionaryVO(Dictionary dictionary) { |
||||||
|
return R.ok(dictionaryService.listDictionaryVO(Wrappers.<Dictionary>query() |
||||||
|
.like(StrUtil.isNotBlank(dictionary.getLabel()), "label", dictionary.getLabel()) |
||||||
|
.eq(StrUtil.isNotBlank(dictionary.getId()), "id", dictionary.getId()) |
||||||
|
.eq(StrUtil.isNotBlank(dictionary.getType()), "type", dictionary.getType()) |
||||||
|
.orderByAsc("sort") |
||||||
|
)); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 内部调用添加字典 |
||||||
|
* @return success、false |
||||||
|
*/ |
||||||
|
@SysLog("内部调用查询字典") |
||||||
|
@GetMapping("/inner/query") |
||||||
|
public R queryDictionaryVO(@RequestParam(value = "label") String label, |
||||||
|
@RequestParam(value = "id") String id) { |
||||||
|
// 根据label 和 type 去查询字典
|
||||||
|
List<DictionaryVO> dictionaryVOS = dictionaryService.listDictionaryVO(Wrappers.<Dictionary>query() |
||||||
|
.eq(StrUtil.isNotBlank(label), "label", label) |
||||||
|
.like(StrUtil.isNotBlank(id), "type", id) |
||||||
|
.orderByAsc("sort") |
||||||
|
); |
||||||
|
|
||||||
|
// 查询不到则把这个新的类型添加到字典里
|
||||||
|
if (dictionaryVOS == null || dictionaryVOS.size() == 0 || dictionaryVOS.get(0) == null) { |
||||||
|
|
||||||
|
Dictionary dictionary = dictionaryService.addThirdPartyDictionary(label, id); |
||||||
|
if (dictionary != null) { |
||||||
|
return R.ok(dictionary.getId()); |
||||||
|
} else { |
||||||
|
return R.failed("添加字典失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return R.ok(dictionaryVOS.get(0).getId()); |
||||||
|
} |
||||||
|
@GetMapping("/oldDictTreeVo") |
||||||
|
public R<List<DictionaryVO>> oldDictTreeVo(String parentId) { |
||||||
|
return R.ok(dictionaryService.listDictionaryVO(Wrappers.<Dictionary>query() |
||||||
|
.eq(StrUtil.isNotBlank(parentId), "type", parentId) |
||||||
|
//.notLike("label","常用")
|
||||||
|
.orderByAsc("sort") |
||||||
|
)); |
||||||
|
} |
||||||
|
@PutMapping("/replayClient") |
||||||
|
public R replayClient(){ |
||||||
|
return R.ok(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,233 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import cn.hutool.core.lang.Assert; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import cn.hutool.poi.excel.ExcelReader; |
||||||
|
import cn.hutool.poi.excel.ExcelUtil; |
||||||
|
import com.alibaba.cloud.commons.lang.StringUtils; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.sys.entity.Drug; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugLite; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugType; |
||||||
|
import digital.laboratory.platform.sys.service.DrugService; |
||||||
|
import digital.laboratory.platform.sys.service.DrugTypeService; |
||||||
|
import digital.laboratory.platform.sys.vo.SuspiciousDrugVO; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.cglib.beans.BeanCopier; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.io.File; |
||||||
|
import java.text.ParseException; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.time.format.DateTimeFormatter; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品清单 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品清单 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/comm/drug" ) |
||||||
|
@Api(value = "drug", tags = "毒品清单管理") |
||||||
|
public class CommDrugController { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private DrugService drugService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private DrugTypeService drugTypeService; |
||||||
|
/** |
||||||
|
* 通过id查询毒品清单 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_get')" )
|
||||||
|
public R<Drug> getById(@PathVariable("id" ) String id) { |
||||||
|
return R.ok(drugService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提供给内部服务通过id查询 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "提供给内部服务通过id查询", notes = "提供给内部服务通过id查询") |
||||||
|
@GetMapping("/inner/{id}" ) |
||||||
|
@Inner(value = false) |
||||||
|
public R<Drug> innerGetById(@PathVariable("id" ) String id) { |
||||||
|
return R.ok(drugService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@ApiOperation("获取所有顶层毒品类型的数据,以map的列表返回") |
||||||
|
@GetMapping("/drugMapList") |
||||||
|
public R< List<SuspiciousDrugVO>> drugMapList(String drugType, String name, String englishName, String casCode) { |
||||||
|
return R.ok(drugService.drugMapList(drugType, name, englishName, casCode)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过毒品名称查询毒品清单 |
||||||
|
* @param name name |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过名称查询", notes = "通过名称查询") |
||||||
|
@GetMapping("/name/{name}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_get')" )
|
||||||
|
public R<DrugLite> getByName(@PathVariable("name" ) String name) { |
||||||
|
if (StrUtil.isBlank(name)) { |
||||||
|
throw new RuntimeException("名称不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<Drug> list = drugService.list(Wrappers.<Drug>query().eq("name", name)); |
||||||
|
if (list == null || list.size() == 0) { |
||||||
|
return R.ok(); |
||||||
|
} |
||||||
|
Drug drug = list.get(0); |
||||||
|
DrugLite drugLite = new DrugLite(); |
||||||
|
final BeanCopier beanCopier = BeanCopier.create(Drug.class, DrugLite.class, false); |
||||||
|
beanCopier.copy(drug, drugLite, null); |
||||||
|
return R.ok(drugLite); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询毒品列表 |
||||||
|
* @param drug 查询条件(name, alias => like) |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "常用毒品查询列表", notes = "常用毒品查询列表") |
||||||
|
@GetMapping("/list" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_get')" )
|
||||||
|
public R getDrugPage(Drug drug) { |
||||||
|
List<DrugType> drugTypeList=drugTypeService.list(Wrappers.<DrugType>lambdaQuery() |
||||||
|
.eq(DrugType::getName,"常规毒品")); |
||||||
|
Assert.notEmpty(drugTypeList,"系统中并没有找到 常规毒品 分类"); |
||||||
|
|
||||||
|
List<Drug> r = drugService.list(Wrappers.<Drug>query() |
||||||
|
.like(StrUtil.isNotBlank(drug.getName()), "name", drug.getName()) |
||||||
|
.like(StrUtil.isNotBlank(drug.getAlias()), "english_name", drug.getEnglishName()) |
||||||
|
.like(StrUtil.isNotBlank(drug.getCasCode()), "cas_code", drug.getCasCode()) |
||||||
|
.eq("drug_type", drugTypeList.get(0).getId())//只查询NPS的毒品列表
|
||||||
|
); |
||||||
|
return R.ok(r); |
||||||
|
} |
||||||
|
//NPS 毒品清单
|
||||||
|
@ApiOperation(value = "查询NPS的毒品列表",notes = "查询NPS的毒品列表") |
||||||
|
@GetMapping("/getNPSDrugList") |
||||||
|
public R getNPSDrugList(Drug drug){ |
||||||
|
List<DrugType> drugTypeList=drugTypeService.list(Wrappers.<DrugType>lambdaQuery() |
||||||
|
.eq(DrugType::getName,"常规毒品")); |
||||||
|
Assert.notEmpty(drugTypeList,"系统中并没有找到 NPS毒品 分类"); |
||||||
|
//根据这个ID查询出下面的子类ID
|
||||||
|
List<Drug> r = drugService.list(Wrappers.<Drug>query() |
||||||
|
.like(StrUtil.isNotBlank(drug.getName()), "name", drug.getName()) |
||||||
|
.like(StrUtil.isNotBlank(drug.getEnglishName()), "english_name", drug.getEnglishName()) |
||||||
|
.like(StrUtil.isNotBlank(drug.getCasCode()), "cas_code", drug.getCasCode()) |
||||||
|
.like(StrUtil.isNotBlank(drug.getCode()), "code", drug.getCode()) |
||||||
|
.eq(drug.getPublishTime()!=null, "publish_time", drug.getPublishTime()) |
||||||
|
.eq(drug.getImplementTime()!=null, "implement_time", drug.getImplementTime()) |
||||||
|
.ne("drug_type", drugTypeList.get(0).getId())//只查询NPS的毒品列表
|
||||||
|
|
||||||
|
); |
||||||
|
return R.ok(r); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param drug 毒品清单 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_get')" )
|
||||||
|
public R<IPage<Drug>> getDrugPage(Page page, Drug drug) { |
||||||
|
return R.ok(drugService.getDrugPage(page,drug)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增毒品清单 |
||||||
|
* @param drug 毒品清单 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增毒品清单", notes = "新增毒品清单") |
||||||
|
@SysLog("新增毒品清单" ) |
||||||
|
@PostMapping |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_add')" )
|
||||||
|
public R postAddObject(@RequestBody Drug drug) { |
||||||
|
return R.ok(drugService.addDrug(drug)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改毒品清单 |
||||||
|
* @param drug 毒品清单 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改毒品清单", notes = "修改毒品清单") |
||||||
|
@SysLog("修改毒品清单" ) |
||||||
|
@PutMapping |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_edit')" )
|
||||||
|
public R putUpdateById(@RequestBody Drug drug) { |
||||||
|
return R.ok(drugService.updateById(drug)); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 通过id删除毒品清单 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除毒品清单", notes = "通过id删除毒品清单") |
||||||
|
@SysLog("通过id删除毒品清单" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_del')" )
|
||||||
|
public R deleteById(@PathVariable String id) { |
||||||
|
return R.ok(drugService.removeById(id)); |
||||||
|
} |
||||||
|
//导入NPS毒品筛查列表
|
||||||
|
@PostMapping("/importNPSExcelData") |
||||||
|
public R importNPSExcelData() throws ParseException { |
||||||
|
File file= FileUtil.file("D:\\禁毒大数据平台\\整理之后的数据.xlsx"); |
||||||
|
ExcelReader excelReader=ExcelUtil.getReader(file); |
||||||
|
List<List<Object>> excelDataList=excelReader.read(); |
||||||
|
List<Drug> drugList=new ArrayList<>(); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||||
|
for(int i=0;i<excelDataList.size();i++){ |
||||||
|
if(i>1){ |
||||||
|
//0=编号 1=名称 2=英文名称 3=cas编号 4=发布日期
|
||||||
|
//5=实施日期 6=来源,7=备注
|
||||||
|
Drug drug=new Drug(); |
||||||
|
drug.setId(IdWorker.get32UUID()); |
||||||
|
drug.setCode(excelDataList.get(i).get(0).toString().trim()); |
||||||
|
drug.setName(excelDataList.get(i).get(1).toString().trim()); |
||||||
|
drug.setEnglishName(excelDataList.get(i).get(2).toString().trim()); |
||||||
|
drug.setCasCode(excelDataList.get(i).get(3)!=null?excelDataList.get(i).get(3).toString().trim():""); |
||||||
|
drug.setPublishTime(LocalDateTime.parse(excelDataList.get(i).get(4).toString().trim()+" 00:00:00",formatter)); |
||||||
|
drug.setImplementTime(LocalDateTime.parse(excelDataList.get(i).get(5).toString().trim()+" 00:00:00",formatter)); |
||||||
|
drug.setSource(excelDataList.get(i).get(6).toString().trim()); |
||||||
|
drug.setComments(excelDataList.get(i).get(7)!=null?excelDataList.get(i).get(7).toString().trim():""); |
||||||
|
drug.setOrderIndex(Integer.parseInt(excelDataList.get(i).get(0).toString().trim())); |
||||||
|
drug.setDrugType("1"); |
||||||
|
System.out.println("添加完了一条,编号是:--------------------------------------"+drug.getCode()); |
||||||
|
drugList.add(drug); |
||||||
|
} |
||||||
|
} |
||||||
|
return R.ok(drugService.saveBatch(drugList)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,94 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
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.DrugRType; |
||||||
|
import digital.laboratory.platform.sys.service.DrugRTypeService; |
||||||
|
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-06-23 |
||||||
|
* @describe 毒品-类型关系映射表 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/drug_r_type" ) |
||||||
|
@Api(value = "drug_r_type", tags = "毒品-类型关系映射表管理") |
||||||
|
public class CommDrugRTypeController { |
||||||
|
|
||||||
|
private final DrugRTypeService drugRTypeService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询毒品-类型关系映射表 |
||||||
|
* @param drugId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{drugId}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_r_type_get')" )
|
||||||
|
public R getById(@PathVariable("drugId" ) String drugId) { |
||||||
|
return R.ok(drugRTypeService.getById(drugId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param drugRType 毒品-类型关系映射表 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_r_type_get')" )
|
||||||
|
public R getDrugRTypePage(Page page, DrugRType drugRType) { |
||||||
|
return R.ok(drugRTypeService.page(page, Wrappers.query(drugRType))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增毒品-类型关系映射表 |
||||||
|
* @param drugRType 毒品-类型关系映射表 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增毒品-类型关系映射表", notes = "新增毒品-类型关系映射表") |
||||||
|
@SysLog("新增毒品-类型关系映射表" ) |
||||||
|
@PostMapping |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_r_type_add')" )
|
||||||
|
public R postAddObject(@RequestBody DrugRType drugRType) { |
||||||
|
return R.ok(drugRTypeService.save(drugRType)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改毒品-类型关系映射表 |
||||||
|
* @param drugRType 毒品-类型关系映射表 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改毒品-类型关系映射表", notes = "修改毒品-类型关系映射表") |
||||||
|
@SysLog("修改毒品-类型关系映射表" ) |
||||||
|
@PutMapping |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_r_type_edit')" )
|
||||||
|
public R putUpdateById(@RequestBody DrugRType drugRType) { |
||||||
|
return R.ok(drugRTypeService.updateById(drugRType)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除毒品-类型关系映射表 |
||||||
|
* @param drugId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除毒品-类型关系映射表", notes = "通过id删除毒品-类型关系映射表") |
||||||
|
@SysLog("通过id删除毒品-类型关系映射表" ) |
||||||
|
@DeleteMapping("/{drugId}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_r_type_del')" )
|
||||||
|
public R deleteById(@PathVariable String drugId) { |
||||||
|
return R.ok(drugRTypeService.removeById(drugId)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,130 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert; |
||||||
|
import com.alibaba.cloud.commons.lang.StringUtils; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.sys.entity.Drug; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugType; |
||||||
|
import digital.laboratory.platform.sys.service.DrugService; |
||||||
|
import digital.laboratory.platform.sys.service.DrugTypeService; |
||||||
|
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-06-23 |
||||||
|
* @describe 毒品分类 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/drug_type" ) |
||||||
|
@Api(value = "drug_type", tags = "毒品分类管理") |
||||||
|
public class CommDrugTypeController { |
||||||
|
|
||||||
|
private final DrugTypeService drugTypeService; |
||||||
|
@Resource |
||||||
|
private DrugService drugService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询毒品分类 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_type_get')" )
|
||||||
|
public R getById(@PathVariable("id" ) String id) { |
||||||
|
return R.ok(drugTypeService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param drugType 毒品分类 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_type_get')" )
|
||||||
|
public R getDrugTypePage(Page page, DrugType drugType) { |
||||||
|
|
||||||
|
return R.ok(drugTypeService.page(page, Wrappers.query(drugType))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增毒品分类 |
||||||
|
* @param drugType 毒品分类 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增毒品分类", notes = "新增毒品分类") |
||||||
|
@SysLog("新增毒品分类" ) |
||||||
|
@PostMapping |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_type_add')" )
|
||||||
|
public R postAddObject(@RequestBody DrugType drugType) { |
||||||
|
Assert.notBlank(drugType.getName(),"类别名称不能为空"); |
||||||
|
Assert.notBlank(drugType.getPid(),"父节点ID不能为空"); |
||||||
|
return R.ok(drugTypeService.addDrugType(drugType)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改毒品分类 |
||||||
|
* @param drugType 毒品分类 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改毒品分类", notes = "修改毒品分类") |
||||||
|
@SysLog("修改毒品分类" ) |
||||||
|
@PutMapping |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_type_edit')" )
|
||||||
|
public R putUpdateById(@RequestBody DrugType drugType) { |
||||||
|
Assert.notBlank(drugType.getName(),"类别名称不能为空"); |
||||||
|
List<DrugType> list=drugTypeService.list(Wrappers.<DrugType>lambdaQuery() |
||||||
|
.eq(DrugType::getName,drugType.getName()) |
||||||
|
.ne(DrugType::getId,drugType.getId())); |
||||||
|
if(list.size()>0){ |
||||||
|
return R.failed("类别名称不能重复"); |
||||||
|
} |
||||||
|
return R.ok(drugTypeService.updateById(drugType)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除毒品分类 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除毒品分类", notes = "通过id删除毒品分类") |
||||||
|
@SysLog("通过id删除毒品分类" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
// @PreAuthorize("@pms.hasPermission('common_drug_type_del')" )
|
||||||
|
public R deleteById(@PathVariable String id) { |
||||||
|
//删除的时候,需要判断这个类别下是否有毒品
|
||||||
|
List<Drug> drugList= drugService.list(Wrappers.<Drug>lambdaQuery() |
||||||
|
.eq(Drug::getDrugType,id)); |
||||||
|
if(drugList.size()>0){ |
||||||
|
return R.failed("该分类下还有毒品清单,不能删除,请先移除该分类下的毒品清单"); |
||||||
|
} |
||||||
|
return R.ok(drugTypeService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
// new add 8-30
|
||||||
|
//以树的形式将类型组织数据,方便UI前端显示
|
||||||
|
@ApiOperation(value = "通过Pid获取结构树", notes = "通过Pid获取结构树") |
||||||
|
@GetMapping("/getDrugTypeTreeData") |
||||||
|
public R getDrugTypeTreeData(String pid){ |
||||||
|
if(StringUtils.isBlank(pid)){ |
||||||
|
pid="0"; |
||||||
|
} |
||||||
|
return R.ok(drugTypeService.getDrugTypeTreeData(pid),"获取数据成功"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,147 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2025, lengleng All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the pig4cloud.com developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: lengleng (wangiegie@gmail.com) |
||||||
|
*/ |
||||||
|
|
||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
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.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.sys.entity.PublicParam; |
||||||
|
import digital.laboratory.platform.sys.service.PublicParamService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.http.HttpHeaders; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 公共参数 |
||||||
|
* |
||||||
|
* @author Lucky |
||||||
|
* @date 2019-04-29 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/public_param") |
||||||
|
@Tag(name = "公共参数配置") |
||||||
|
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) |
||||||
|
public class CommPublicParamController { |
||||||
|
|
||||||
|
private final PublicParamService publicParamService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过key查询公共参数值 |
||||||
|
* @param publicKey |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Inner(value = false) |
||||||
|
@Operation(summary = "查询公共参数值", description = "根据key查询公共参数值") |
||||||
|
@GetMapping("/public_value/{publicKey}") |
||||||
|
public R<String> innerPublicKey(@PathVariable("publicKey") String publicKey) { |
||||||
|
return R.ok(publicParamService.getSysPublicParamKeyToValue(publicKey)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param publicParam 公共参数 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Operation(summary = "分页查询", description = "分页查询, 查询参数:\n" + |
||||||
|
"page - 分页参数\n" + |
||||||
|
"paramName - 参数名称, like 模糊查询\n" + |
||||||
|
"paramKey - 参数键, like 模糊查询") |
||||||
|
@GetMapping("/page") |
||||||
|
public R getSysPublicParamPage(Page page, PublicParam publicParam) { |
||||||
|
// return R.ok(publicParamService.page(page,
|
||||||
|
// Wrappers.<PublicParam>lambdaQuery()
|
||||||
|
// .like(StrUtil.isNotBlank(publicParam.getParamName()), PublicParam::getParamName,
|
||||||
|
// publicParam.getParamName())
|
||||||
|
// .like(StrUtil.isNotBlank(publicParam.getParamKey()), PublicParam::getParamKey,
|
||||||
|
// publicParam.getParamKey())));
|
||||||
|
|
||||||
|
return R.ok(publicParamService.page(page, Wrappers.<PublicParam>query() |
||||||
|
.like(StrUtil.isNotBlank(publicParam.getParamName()), "param_name", publicParam.getParamName()) |
||||||
|
.like(StrUtil.isNotBlank(publicParam.getParamKey()), "param_key", publicParam.getParamKey()))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询公共参数 |
||||||
|
* @param publicId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@Operation(summary = "通过id查询公共参数", description = "通过id查询公共参数") |
||||||
|
@GetMapping("/{publicId}") |
||||||
|
public R<PublicParam> getById(@PathVariable("publicId") Long publicId) { |
||||||
|
return R.ok(publicParamService.getById(publicId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增公共参数 |
||||||
|
* @param publicParam 公共参数 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@Operation(summary = "新增公共参数", description = "新增公共参数") |
||||||
|
@SysLog("新增公共参数") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_publicparam_add')") |
||||||
|
public R post_AddNewParam(@RequestBody PublicParam publicParam) { |
||||||
|
return R.ok(publicParamService.save(publicParam)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改公共参数 |
||||||
|
* @param publicParam 公共参数 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@Operation(summary = "修改公共参数", description = "修改公共参数") |
||||||
|
@SysLog("修改公共参数") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_publicparam_edit')") |
||||||
|
public R put_UpdateById(@RequestBody PublicParam publicParam) { |
||||||
|
return publicParamService.updateParam(publicParam); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除公共参数 |
||||||
|
* @param publicId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@Operation(summary = "删除公共参数", description = "删除公共参数") |
||||||
|
@SysLog("删除公共参数") |
||||||
|
@DeleteMapping("/{publicId}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_publicparam_del')") |
||||||
|
public R delete_RemoveById(@PathVariable Long publicId) { |
||||||
|
return publicParamService.removeParam(publicId); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 同步参数 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@SysLog("同步参数") |
||||||
|
@PutMapping("/sync") |
||||||
|
public R sync() { |
||||||
|
return publicParamService.syncParamCache(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,107 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.dto.UserDTO; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUser; |
||||||
|
import digital.laboratory.platform.sys.service.StaffService; |
||||||
|
import digital.laboratory.platform.sys.service.SysUserService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.sys.vo.Staff; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 涉及用户的公共服务 |
||||||
|
*/ |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/user") |
||||||
|
@Api(tags = "04-涉及用户的公共服务") |
||||||
|
public class CommUserController { |
||||||
|
|
||||||
|
private final SysUserService userService; |
||||||
|
private final StaffService staffService; |
||||||
|
// private final SysRolePermissionService rolePermissionService;
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询对指定的机构拥有某些权限的用户列表。 |
||||||
|
* |
||||||
|
* 还可以通过 includeSubOrg, 对用户进行筛选。 |
||||||
|
* includeSubOrg 为 true 时, 如果指定机构是某用户所属机构的下属机构时该用户有效; |
||||||
|
* includeSubOrg 为 false 时, 只有当指定机构是某用户所属机构时该用户有效; |
||||||
|
* @param orgId 机构 id |
||||||
|
* param includeSubOrg 是否包含子机构 |
||||||
|
* @param permissions 权限集合 |
||||||
|
* @return 用户列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/bypermissions") |
||||||
|
public R<List<SysUser>> GetUsersByPermission(@RequestParam("orgId") String orgId, @RequestParam("permissions") List<String> permissions) { |
||||||
|
//rolePermissionService
|
||||||
|
return R.ok(userService.listUsersByPermission(orgId, false, permissions)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询用户 |
||||||
|
* @param page 参数集 |
||||||
|
* @param userDTO 查询参数列表 |
||||||
|
* @return 用户集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R getUserPage(Page page, UserDTO userDTO) { |
||||||
|
return R.ok(userService.getUserWithRolePage(page, userDTO)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 注册新用户接口 |
||||||
|
* @param userDto |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "注册新用户",notes = "用于开放注册时,调用的接口") |
||||||
|
@PostMapping("/registerUser") |
||||||
|
public R registerUser(@Valid @RequestBody UserDTO userDto){ |
||||||
|
return R.ok(userService.registerUser(userDto)); |
||||||
|
} |
||||||
|
|
||||||
|
//前端登录修改用户信息
|
||||||
|
@ApiOperation(value = "前端登录修改自己的基本信息",notes = "前端登录修改自己的基本信息") |
||||||
|
@PostMapping("/updateFrontUserInfo") |
||||||
|
public R updateFrontUserInfo(@Valid @RequestBody UserDTO userDto){ |
||||||
|
Assert.notBlank(userDto.getUserId(),"用户ID不能为空"); |
||||||
|
return R.ok(userService.updateFrontUserInfo(userDto),"数据操作成功"); |
||||||
|
} |
||||||
|
// @ApiOperation(value = "快速创建特殊工作人员",notes = "快速创建特殊工作人员")
|
||||||
|
@PostMapping("/addSpecialUserInfo") |
||||||
|
public R addSpecialUserInfo(@Valid @RequestBody List<UserDTO> userDTOList){ |
||||||
|
for (UserDTO userDTO : userDTOList) { |
||||||
|
Assert.notBlank(userDTO.getUsername(),"用户名不能为空"); |
||||||
|
} |
||||||
|
return R.ok(userService.addSpecialUserInfo(userDTOList),"数据成功"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工列表查询 |
||||||
|
* @param staff 鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "列表查询", notes = "列表查询") |
||||||
|
@GetMapping("/staff/list" ) |
||||||
|
public R<List<Staff>> getStaffList(Staff staff) { |
||||||
|
|
||||||
|
List<Staff> staffs = staffService.getStaffVOList(Wrappers.<Staff>query() |
||||||
|
.like(StrUtil.isNotBlank(staff.getName()), "u.name", staff.getName()) |
||||||
|
.orderByAsc("u.name") |
||||||
|
); |
||||||
|
return R.ok(staffs); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.dto.UserDTO; |
||||||
|
import digital.laboratory.platform.sys.service.SysOrgService; |
||||||
|
import digital.laboratory.platform.sys.service.SysUserService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.security.util.SecurityUtils; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
/** |
||||||
|
* 当前用户相关的功能 |
||||||
|
* |
||||||
|
* @author zhangxl |
||||||
|
* @date 2021-12-28 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/currentuser") |
||||||
|
@Api(tags = "03-当前用户管理") |
||||||
|
public class CurrentUserController { |
||||||
|
|
||||||
|
private final SysUserService userService; |
||||||
|
private final SysOrgService sysOrgService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取当前用户全部信息 |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
//@GetMapping(value = { "/detail" })
|
||||||
|
@GetMapping |
||||||
|
@ApiOperation("获取当前用户全部信息") |
||||||
|
public R getUserInfo() { |
||||||
|
String userId = SecurityUtils.getUser().getId(); |
||||||
|
return R.ok(userService.getUserVoById(userId)); |
||||||
|
} |
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 返回当前用户可代表的机构树
|
||||||
|
// * @return 树形机构
|
||||||
|
// */
|
||||||
|
// @GetMapping(value = "/user-can-represent-tree")
|
||||||
|
// public R getCurrentUserCanRepresentOrgTree() {
|
||||||
|
// return R.ok(sysOrgService.getCurrentUserCanRepresentOrgTree());
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 修改个人信息 |
||||||
|
* @param userDto userDto |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("修改个人信息") |
||||||
|
@PutMapping("/edit") |
||||||
|
public R putCurrentUserInfoUpdate(@Valid @RequestBody UserDTO userDto) { |
||||||
|
String userId = SecurityUtils.getUser().getId(); |
||||||
|
if (! userId.equals(userDto.getUserId())) { |
||||||
|
return R.failed("只能修改当前用户的信息"); |
||||||
|
} |
||||||
|
return R.ok(userService.updateUserInfo(userDto)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,112 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.EntrustTemplateInfo; |
||||||
|
import digital.laboratory.platform.sys.query.EntrustTemplateInfoQuery; |
||||||
|
import digital.laboratory.platform.sys.service.EntrustTemplateInfoService; |
||||||
|
import digital.laboratory.platform.sys.enums.TemplateTypeEnums; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Arrays; |
||||||
|
import java.util.List; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* 委托检材--检出定性定量结果信息 |
||||||
|
* |
||||||
|
* @author chenjiangbao |
||||||
|
* @describe 委托检材--检出定性定量结果信息相关接口 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/comm/entrustTemplateInfo") |
||||||
|
@Api(tags = "019-委托送检中案情简要等内容的模板信息相关接口") |
||||||
|
public class EntrustTemplateInfoController { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private EntrustTemplateInfoService entrustTemplateInfoService; |
||||||
|
|
||||||
|
// 内部静态类,用于封装枚举数据
|
||||||
|
private static class EnumResponse { |
||||||
|
private final int code; |
||||||
|
private final String desc; |
||||||
|
|
||||||
|
public EnumResponse(int code, String desc) { |
||||||
|
this.code = code; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDesc() { |
||||||
|
return desc; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@ApiOperation("获取所有模板的类型值") |
||||||
|
@GetMapping("/allTemplateType") |
||||||
|
public R<List<EnumResponse>> allTemplateType() { |
||||||
|
List<EnumResponse> enumResponseList = Arrays.stream(TemplateTypeEnums.values()) |
||||||
|
.map(value -> new EnumResponse(value.getCode(), value.getDesc())) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
return R.ok(enumResponseList); |
||||||
|
} |
||||||
|
|
||||||
|
@ApiOperation("获取模板的分页接口") |
||||||
|
@PostMapping("/page") |
||||||
|
public R<IPage<EntrustTemplateInfo>> pageEntrustTemplateInfo(@RequestBody EntrustTemplateInfoQuery query) { |
||||||
|
return R.ok( |
||||||
|
entrustTemplateInfoService.page( |
||||||
|
new Page<>(query.getCurrent(), query.getSize()), |
||||||
|
Wrappers.<EntrustTemplateInfo>lambdaQuery() |
||||||
|
.eq(query.getType() != null, EntrustTemplateInfo::getTemplateType, query.getType()) |
||||||
|
.orderByDesc(EntrustTemplateInfo::getCreateTime) |
||||||
|
) |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
@ApiOperation("录入模板信息") |
||||||
|
@PostMapping("/save") |
||||||
|
public R<EntrustTemplateInfo> addEntrustTemplateInfo(@RequestBody @Valid EntrustTemplateInfo info) { |
||||||
|
EntrustTemplateInfo isExist = entrustTemplateInfoService.getOne( |
||||||
|
Wrappers.<EntrustTemplateInfo>lambdaQuery() |
||||||
|
.eq(EntrustTemplateInfo::getTemplateName, info.getTemplateName()) |
||||||
|
.eq(EntrustTemplateInfo::getTemplateType, info.getTemplateType()) |
||||||
|
); |
||||||
|
if (isExist != null) { |
||||||
|
return R.failed(String.format("在模板类型为 [%s] 中已经存在模板名称为 [%s] 的模板!", |
||||||
|
TemplateTypeEnums.fromCode(info.getTemplateType()).getDesc(), |
||||||
|
info.getTemplateName())); |
||||||
|
} |
||||||
|
entrustTemplateInfoService.save(info); |
||||||
|
return R.ok(info); |
||||||
|
} |
||||||
|
|
||||||
|
@ApiOperation("更新模板信息") |
||||||
|
@PutMapping("/update") |
||||||
|
public R<List<EntrustTemplateInfo>> update(@RequestBody List<EntrustTemplateInfo> infoList) { |
||||||
|
for (EntrustTemplateInfo info : infoList) { |
||||||
|
|
||||||
|
EntrustTemplateInfo isExist = entrustTemplateInfoService.getById(info.getId()); |
||||||
|
if (isExist == null) { |
||||||
|
return R.failed("数据在系统中不存在!"); |
||||||
|
} |
||||||
|
entrustTemplateInfoService.updateById(info); |
||||||
|
} |
||||||
|
return R.ok(infoList); |
||||||
|
} |
||||||
|
|
||||||
|
@ApiOperation("删除模板信息") |
||||||
|
@PostMapping("/delete") |
||||||
|
public R<Boolean> delete(@RequestBody List<String> ids) { |
||||||
|
return R.ok(entrustTemplateInfoService.removeByIds(ids)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,97 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil; |
||||||
|
import digital.laboratory.platform.sys.service.SysFileService; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.entity.SysFile; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.SneakyThrows; |
||||||
|
import org.springframework.core.io.ClassPathResource; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件管理 |
||||||
|
* |
||||||
|
* @author Luckly |
||||||
|
* @date 2021-09-11 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/sys/file") |
||||||
|
@Api( tags = "文件管理") |
||||||
|
public class FileController { |
||||||
|
|
||||||
|
private final SysFileService sysFileService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param sysFile 文件管理 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page") |
||||||
|
public R getSysFilePage(Page page, SysFile sysFile) { |
||||||
|
return R.ok(sysFileService.page(page, Wrappers.query(sysFile))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除文件管理 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除文件管理", notes = "通过id删除文件管理") |
||||||
|
@SysLog("删除文件管理") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_file_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
return R.ok(sysFileService.deleteFile(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 上传文件 文件名采用uuid,避免原始文件名中带"-"符号导致下载的时候解析出现异常 |
||||||
|
* @param file 资源 |
||||||
|
* @return R(/ admin / bucketName / filename) |
||||||
|
*/ |
||||||
|
@PostMapping(value = "/upload") |
||||||
|
public R upload(@RequestPart("file") MultipartFile file) { |
||||||
|
return sysFileService.uploadFile(file); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取文件 |
||||||
|
* @param bucket 桶名称 |
||||||
|
* @param fileName 文件空间/名称 |
||||||
|
* @param response |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Inner(false) |
||||||
|
@GetMapping("/{bucket}/{fileName}") |
||||||
|
public void file(@PathVariable String bucket, @PathVariable String fileName, HttpServletResponse response) { |
||||||
|
sysFileService.getFile(bucket, fileName, response); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取本地(resources)文件 |
||||||
|
* @param fileName 文件名称 |
||||||
|
* @param response 本地文件 |
||||||
|
*/ |
||||||
|
@SneakyThrows |
||||||
|
@GetMapping("/local/{fileName}") |
||||||
|
public void localFile(@PathVariable String fileName, HttpServletResponse response) { |
||||||
|
ClassPathResource resource = new ClassPathResource("file/" + fileName); |
||||||
|
response.setContentType("application/octet-stream; charset=UTF-8"); |
||||||
|
IoUtil.copy(resource.getInputStream(), response.getOutputStream()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author xy |
||||||
|
* @version 1.0 |
||||||
|
* @title LcBpmnController |
||||||
|
* @description |
||||||
|
* @create 2024/3/4 16:57 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/lcBpmn") |
||||||
|
public class LcBpmnController { |
||||||
|
// private final RemoteFlowManagerService remoteFlowManagerService;
|
||||||
|
// //添加流程
|
||||||
|
// @PostMapping("/createFlowInfo")
|
||||||
|
// private R createFlowInfo(@RequestBody FlowInfo flowInfo){
|
||||||
|
// System.out.println("添加流程信息的控制器-------------------------------------"+flowInfo);
|
||||||
|
// return remoteFlowManagerService.createFlowInfo(flowInfo);
|
||||||
|
// }
|
||||||
|
// @PostMapping("/uploadBpmnFile")
|
||||||
|
// private R uploadBpmnFile(@RequestPart("bpmnFile") MultipartFile bpmnFile, String fileType){
|
||||||
|
// R r=remoteFlowManagerService.uploadBpmn(bpmnFile,fileType);
|
||||||
|
// return r;
|
||||||
|
// }
|
||||||
|
// //获取流程列表
|
||||||
|
// @GetMapping("/getFlowList")
|
||||||
|
// private R getFlowList(Page page,FlowInfo flowInfo){
|
||||||
|
// R r=remoteFlowManagerService.getFlowInfoList(page,flowInfo);
|
||||||
|
// return r;
|
||||||
|
// }
|
||||||
|
// //修改流程信息
|
||||||
|
// @PostMapping("/updateFlowInfo")
|
||||||
|
// private R updateFlowInfo(@RequestBody FlowInfo flowInfo){
|
||||||
|
// return remoteFlowManagerService.updateFlowInfo(flowInfo);
|
||||||
|
// }
|
||||||
|
// //删除流程信息
|
||||||
|
// @GetMapping("/deleteFlowInfo")
|
||||||
|
// private R deleteFlowInfo(String flowInfoId){
|
||||||
|
// return remoteFlowManagerService.deleteProcessByFlowId(flowInfoId);
|
||||||
|
// }
|
||||||
|
// //部署流程
|
||||||
|
// @GetMapping("/deployFlowInfo")
|
||||||
|
// private R deployFlow(String flowInfoId){
|
||||||
|
// return remoteFlowManagerService.deploy(flowInfoId);
|
||||||
|
// }
|
||||||
|
} |
@ -0,0 +1,79 @@ |
|||||||
|
|
||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.service.SysLogService; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.dto.SysLogDTO; |
||||||
|
import digital.laboratory.platform.sys.entity.SysLog; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
//import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 日志表 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/log") |
||||||
|
@Api(tags = "日志管理") |
||||||
|
public class LogController { |
||||||
|
|
||||||
|
private final SysLogService sysLogService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 简单分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param sysLog 系统日志 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R getLogPage(Page page, SysLogDTO sysLog) { |
||||||
|
return R.ok(sysLogService.getLogByPage(page, sysLog)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除日志 |
||||||
|
* @param id ID |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_log_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
return R.ok(sysLogService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 插入日志 |
||||||
|
* @param sysLog 日志实体 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@PostMapping |
||||||
|
public R save(@Valid @RequestBody SysLog sysLog) { |
||||||
|
return R.ok(sysLogService.save(sysLog)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出excel 表格 |
||||||
|
* @param sysLog 查询条件 |
||||||
|
* @return EXCEL |
||||||
|
*/ |
||||||
|
// @ResponseExcel
|
||||||
|
// @GetMapping("/export")
|
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_log_import_export')")
|
||||||
|
// public List<SysLog> export(SysLogDTO sysLog) {
|
||||||
|
// return sysLogService.getLogList(sysLog);
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,140 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||||
|
import digital.laboratory.platform.sys.entity.SysMenu; |
||||||
|
import digital.laboratory.platform.sys.service.SysMenuService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.security.Principal; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* 菜单管理控制器 |
||||||
|
* @date 2017/10/31 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/menu") |
||||||
|
@Api(tags = "15-菜单管理", description="") |
||||||
|
public class MenuController { |
||||||
|
|
||||||
|
private final SysMenuService sysMenuService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回当前用户的树形菜单集合 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 当前用户的树形菜单 |
||||||
|
*/ |
||||||
|
@GetMapping |
||||||
|
public R getUserMenu(String parentId, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser)((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
// System.out.println(String.format("GET getUserMenu() /: parentId=%s",parentId));
|
||||||
|
// 获取符合条件的菜单
|
||||||
|
// Set<SysMenu> sysMenuList = sysMenuService
|
||||||
|
// .findMenuByRoleIds(SecurityUtils.getRoles());
|
||||||
|
|
||||||
|
Set<SysMenu> sysMenuList = sysMenuService |
||||||
|
.findMenuByUserId(dlpUser.getId()); |
||||||
|
|
||||||
|
return R.ok(sysMenuService.filterMenu(sysMenuList, parentId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回树形菜单集合 |
||||||
|
* @param menu 父节点的 menu |
||||||
|
* @return 树形菜单 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/treemenu") |
||||||
|
public R getTreeMenu(String menu) { |
||||||
|
System.out.println(String.format("GET getTreeMenu() /treemenu: menu=%s",menu)); |
||||||
|
return R.ok(sysMenuService.treeMenuByMenu(menu)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回树形菜单集合 |
||||||
|
* @param lazy 是否是懒加载 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 树形菜单 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/tree") |
||||||
|
public R getTree(boolean lazy, String parentId) { |
||||||
|
System.out.println(String.format("GET getTree() /tree: parentId=%s",parentId)); |
||||||
|
return R.ok(sysMenuService.treeMenuByParentId(lazy, parentId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回岗位的菜单集合 |
||||||
|
* @param roleId 岗位ID |
||||||
|
* @return 属性集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/tree/{roleId}") |
||||||
|
public R getMenusByRoleId(@PathVariable String roleId) { |
||||||
|
System.out.println(String.format("GET getRoleTree() /tree/{roleId}: roleId=%s",roleId)); |
||||||
|
List<String> roleIds = new ArrayList<String>(); |
||||||
|
roleIds.add(roleId); |
||||||
|
return R.ok(sysMenuService.findMenuByRoleIds(roleIds).stream().map(SysMenu::getMenuId) |
||||||
|
.collect(Collectors.toList())); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询菜单的详细信息 |
||||||
|
* @param id 菜单ID |
||||||
|
* @return 菜单详细信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/{id}") |
||||||
|
public R getById(@PathVariable String id) { |
||||||
|
System.out.println(String.format("GET getById() /{id}: id=%s",id)); |
||||||
|
return R.ok(sysMenuService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增菜单 |
||||||
|
* @param sysMenu 菜单信息 |
||||||
|
* @return 含ID 菜单信息 |
||||||
|
*/ |
||||||
|
@SysLog("新增菜单") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_menu_add')") |
||||||
|
public R addMenu(@Valid @RequestBody SysMenu sysMenu) { |
||||||
|
sysMenuService.save(sysMenu); |
||||||
|
return R.ok(sysMenu); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除菜单 |
||||||
|
* @param id 菜单ID |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("删除菜单") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_menu_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
return R.ok(sysMenuService.removeMenuById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新菜单 |
||||||
|
* @param sysMenu |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@SysLog("更新菜单") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_menu_edit')") |
||||||
|
public R update(@Valid @RequestBody SysMenu sysMenu) { |
||||||
|
return R.ok(sysMenuService.updateMenuById(sysMenu)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,205 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||||
|
import digital.laboratory.platform.sys.entity.Message; |
||||||
|
import digital.laboratory.platform.sys.service.MessageService; |
||||||
|
import digital.laboratory.platform.sys.vo.MessageVO; |
||||||
|
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 2023-02-02 |
||||||
|
* @describe 消息 前端控制器 |
||||||
|
* |
||||||
|
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 |
||||||
|
* 这里写什么: |
||||||
|
* 为前端提供数据, 接受前端的数据 |
||||||
|
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
||||||
|
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
||||||
|
* 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/comm/message" ) |
||||||
|
@Api(value = "message", tags = "消息管理") |
||||||
|
public class MessageController { |
||||||
|
|
||||||
|
private final MessageService messageService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询消息 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id获取消息", notes = "通过id获取消息") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
public R<Message> getById(@PathVariable("id" ) String id, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
Message message = messageService.getMessageById(id, dlpUser.getId()); |
||||||
|
return R.ok(message); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param text 查询消息内容 |
||||||
|
* @param isread 是否已读 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
public R<IPage<MessageVO>> getMessagePage(Page<Message> page, String text, Boolean isread, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
IPage<MessageVO> messageList = messageService.getMessagePage(page, text, isread, dlpUser.getId()); |
||||||
|
return R.ok(messageList); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 列表查询 |
||||||
|
* @param text 查询消息内容 |
||||||
|
* @param isread 是否已读 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "列表查询", notes = "列表查询") |
||||||
|
@GetMapping("/list" ) |
||||||
|
public R<List<MessageVO>> getMessageList(String text, Boolean isread, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
List<MessageVO> messageList = messageService.getMessageList(text, isread, dlpUser.getId()); |
||||||
|
return R.ok(messageList); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送消息 |
||||||
|
* @param receiverId 收件人id |
||||||
|
* @param msg 消息内容 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "发送消息", notes = "发送消息") |
||||||
|
@SysLog("发送消息" ) |
||||||
|
@PostMapping("/send_to_user/{receiverId}" ) |
||||||
|
public R postSendMessageToUser(@RequestBody String msg, @PathVariable("receiverId") String receiverId, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
if (messageService.sendMessageToUser(receiverId, msg, dlpUser.getId())) { |
||||||
|
return R.ok("消息发送成功"); |
||||||
|
} |
||||||
|
else { |
||||||
|
return R.ok("消息发送失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送消息 |
||||||
|
* @param orgId |
||||||
|
* @param includeSubOrg |
||||||
|
* @param permissions |
||||||
|
* @param msg 消息内容 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "发送消息", notes = "发送消息") |
||||||
|
@SysLog("发送消息" ) |
||||||
|
@PostMapping("/send_by_org_permission" ) |
||||||
|
public R postSendMessage(@RequestBody String msg, |
||||||
|
@RequestParam(value = "orgId", required = true) String orgId, |
||||||
|
@RequestParam(value = "includeSubOrg", required = false) Boolean includeSubOrg, |
||||||
|
@RequestParam(value = "permissions", required = false) List<String> permissions, |
||||||
|
HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
if (messageService.sendMessage(orgId, includeSubOrg, permissions, msg, dlpUser.getId())) { |
||||||
|
return R.ok("消息发送成功"); |
||||||
|
} |
||||||
|
else { |
||||||
|
return R.ok("消息发送失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 新增消息
|
||||||
|
// * @param message 消息
|
||||||
|
// * @return R
|
||||||
|
// */
|
||||||
|
// @ApiOperation(value = "新增消息", notes = "新增消息")
|
||||||
|
// @SysLog("新增消息" )
|
||||||
|
// @PostMapping
|
||||||
|
// @PreAuthorize("@pms.hasPermission('common_message_add')" )
|
||||||
|
// public R<Message> postAddObject(@RequestBody Message message, HttpServletRequest theHttpServletRequest) {
|
||||||
|
// Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||||
|
// DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||||
|
//
|
||||||
|
// message.setId(IdWorker.get32UUID().toUpperCase());
|
||||||
|
// if (messageService.save(message)) {
|
||||||
|
// return R.ok(message, "对象创建成功");
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// return R.failed(message, "对象创建失败");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 修改消息
|
||||||
|
// * @param message 消息
|
||||||
|
// * @return R
|
||||||
|
// */
|
||||||
|
// @ApiOperation(value = "修改消息", notes = "修改消息")
|
||||||
|
// @SysLog("修改消息" )
|
||||||
|
// @PutMapping
|
||||||
|
// @PreAuthorize("@pms.hasPermission('common_message_edit')" )
|
||||||
|
// public R<Message> putUpdateById(@RequestBody Message message, HttpServletRequest theHttpServletRequest) {
|
||||||
|
// Principal principal = theHttpServletRequest.getUserPrincipal();
|
||||||
|
// DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
|
||||||
|
//
|
||||||
|
// if (messageService.updateById(message)) {
|
||||||
|
// return R.ok(message, "保存对象成功");
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// return R.failed(message, "保存对象失败");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除消息 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除消息", notes = "通过id删除消息") |
||||||
|
@SysLog("通过id删除消息" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('common_message_del')" ) |
||||||
|
public R<Message> deleteById(@PathVariable String id, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
Message oldMessage = messageService.getById(id); |
||||||
|
|
||||||
|
if (messageService.removeById(id)) { |
||||||
|
return R.ok(oldMessage, "对象删除成功"); |
||||||
|
} |
||||||
|
else { |
||||||
|
return R.failed(oldMessage, "对象删除失败"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,90 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.service.SysOauthClientDetailsService; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.entity.SysOauthClientDetails; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2018-05-15 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/client") |
||||||
|
@Api( tags = "客户端管理") |
||||||
|
public class OauthClientDetailsController { |
||||||
|
|
||||||
|
private final SysOauthClientDetailsService sysOauthClientDetailsService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询 |
||||||
|
* @param clientId clientId |
||||||
|
* @return SysOauthClientDetails |
||||||
|
*/ |
||||||
|
@GetMapping("/{clientId}") |
||||||
|
public R getByClientId(@PathVariable String clientId) { |
||||||
|
return R.ok(sysOauthClientDetailsService |
||||||
|
.list(Wrappers.<SysOauthClientDetails>lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 简单分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param sysOauthClientDetails 系统终端 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R getOauthClientDetailsPage(Page page, SysOauthClientDetails sysOauthClientDetails) { |
||||||
|
return R.ok(sysOauthClientDetailsService.page(page, Wrappers.query(sysOauthClientDetails))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加 |
||||||
|
* @param sysOauthClientDetails 实体 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("添加终端") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_client_add')") |
||||||
|
public R add(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) { |
||||||
|
return R.ok(sysOauthClientDetailsService.save(sysOauthClientDetails)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
* @param id ID |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("删除终端") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_client_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
return R.ok(sysOauthClientDetailsService.removeClientDetailsById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑 |
||||||
|
* @param sysOauthClientDetails 实体 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("编辑终端") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_client_edit')") |
||||||
|
public R update(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) { |
||||||
|
return R.ok(sysOauthClientDetailsService.updateClientDetailsById(sysOauthClientDetails)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,372 @@ |
|||||||
|
|
||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.sys.entity.Area; |
||||||
|
import digital.laboratory.platform.sys.service.SysOrgService; |
||||||
|
import digital.laboratory.platform.sys.service.SysUserService; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysOrg; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.sys.vo.AreaVO; |
||||||
|
import digital.laboratory.platform.sys.vo.OrgVO; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.security.Principal; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 机构管理 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/org") |
||||||
|
@Api(tags = "11-机构管理", description="机构管理") |
||||||
|
public class OrgController { |
||||||
|
|
||||||
|
private final SysOrgService sysOrgService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* |
||||||
|
* @return SysOrg |
||||||
|
*/ |
||||||
|
@GetMapping("/{id}") |
||||||
|
// @Inner(value = false)
|
||||||
|
public R getById(@PathVariable String id) { |
||||||
|
return R.ok(sysOrgService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* |
||||||
|
* @return SysOrg |
||||||
|
*/ |
||||||
|
@GetMapping("/without_token/{id}") |
||||||
|
@Inner(value = false) |
||||||
|
public R getByIdWithoutToken(@PathVariable String id) { |
||||||
|
return R.ok(sysOrgService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据机构名查询机构信息 |
||||||
|
* |
||||||
|
* @param orgname 机构名 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/details") |
||||||
|
public R getByName(String orgname,String parentID) { |
||||||
|
SysOrg condition = new SysOrg(); |
||||||
|
condition.setName(orgname); |
||||||
|
condition.setParentId(parentID); |
||||||
|
return R.ok(sysOrgService.getOne(new QueryWrapper<>(condition))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回机构树的全部, 这个应该数据量很大, 应该会很少使用 |
||||||
|
* |
||||||
|
* @return 机构树 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/tree") |
||||||
|
public R getOrgTree() { |
||||||
|
return R.ok(sysOrgService.listAllOrgTree()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回子机构列表, 不含隔代的后裔 |
||||||
|
* |
||||||
|
* @return 机构树 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/sub_org/{orgId}") |
||||||
|
public R getSubOrg(@PathVariable String orgId) { |
||||||
|
return R.ok(sysOrgService.getSubOrg(orgId)); |
||||||
|
// SysOrg condition = new SysOrg();
|
||||||
|
// condition.setParentId(orgId);
|
||||||
|
// return R.ok(sysOrgService.listObjs(new QueryWrapper<>(condition)));
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回指定机构的后裔树, 不含该机构本身 |
||||||
|
* |
||||||
|
* @return 机构树 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/descendants/{orgId}") |
||||||
|
public R getDescendantTree(@PathVariable String orgId) { |
||||||
|
return R.ok(sysOrgService.listDescendantTree(orgId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 全部后裔的 Id 列表, 不含该机构本身 |
||||||
|
* |
||||||
|
* @return 机构树 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/descendants_list/{orgId}") |
||||||
|
public R getDescendantsId(@PathVariable String orgId) { |
||||||
|
return R.ok(sysOrgService.getDescendantList(orgId)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 查收子级id列表
|
||||||
|
// * @return 返回子级id列表
|
||||||
|
// */
|
||||||
|
// @Inner
|
||||||
|
// @GetMapping(value = "/child-id/{orgId}")
|
||||||
|
// public R<List<String>> listChildOrgId(@PathVariable String orgId) {
|
||||||
|
// return R.ok(sysOrgService.listDescendantsId(orgId));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 返回用户可代表的机构树
|
||||||
|
// * @return 树形机构
|
||||||
|
// */
|
||||||
|
// @GetMapping(value = "/user-can-represent-tree/{id}")
|
||||||
|
// public R getAncestorsAndDescendantsOrgTree(@PathVariable String id) {
|
||||||
|
// if ((id != null) && (! id.isEmpty())) {
|
||||||
|
// String orgId = userService.getUserVoById(id).getOrgId();
|
||||||
|
// return R.ok(sysOrgService.getAncestorsAndDescendantsOrgTree(orgId));
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// return R.failed("必须提供正确的 orgId");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 返回当前用户机构树, 多根树, 去除用户所属机构后的各个分支 |
||||||
|
* |
||||||
|
* @return 树形机构 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/user-trees") |
||||||
|
public R listCurrentUserOrgTrees() { |
||||||
|
return R.ok(sysOrgService.listCurrentUserOrgTrees()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回当前用户机构树, 单根树, 树为用户所属机构 |
||||||
|
* |
||||||
|
* @return 树形机构 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/user-tree") |
||||||
|
public R listCurrentUserOrgTree() { |
||||||
|
return R.ok(sysOrgService.listCurrentUserOrgTree()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回当前用户机构树, 单根树, 树为用户所属机构 |
||||||
|
* |
||||||
|
* @return 树形机构 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/listOrgTreeByOrgId") |
||||||
|
public R listOrgTreeByOrgId(String orgId) { |
||||||
|
return R.ok(sysOrgService.listOrgTreeByOrgId(orgId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询机构列表 |
||||||
|
* 查询条件: name/alias/orgId/parentId |
||||||
|
* |
||||||
|
* @return 列表 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/vo") |
||||||
|
public R<List<OrgVO>> listAreaVO(SysOrg org) { |
||||||
|
return R.ok(sysOrgService.listAreaVO(Wrappers.<SysOrg>query() |
||||||
|
.like(StrUtil.isNotBlank(org.getName()), "name", org.getName()) |
||||||
|
.like(StrUtil.isNotBlank(org.getAlias()), "alias", org.getAlias()) |
||||||
|
.eq(StrUtil.isNotBlank(org.getOrgId()), "org_id", org.getOrgId()) |
||||||
|
.eq(StrUtil.isNotBlank(org.getParentId()), "parent_id", org.getParentId()) |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 根据用户userId 和 权限(permission) 查询对应的机构
|
||||||
|
// * 用户拥有一些机构岗位, 这些岗位有不同的权限。我们反查用户对哪些机构拥有指定的权限
|
||||||
|
// * 结果会是一些机构的 orgId (依赖用户是否代表对应机构的下属机构, 可能包含子机构)
|
||||||
|
// * 对于多个岗位, 只返回一个岗位的机构树
|
||||||
|
// * @param userId 用户
|
||||||
|
// * @param permission 权限
|
||||||
|
// * @return 机构树
|
||||||
|
// */
|
||||||
|
// @GetMapping("/representOrgTree")
|
||||||
|
// public R getRepresentOrgTreeByUserRolePermission(String userId, String permission) {
|
||||||
|
// return R.ok(sysOrgService.listUserRepresentOrgTreesByPermission(userId, permission));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 根据用户userId 和 权限(permission) 查询对应的机构
|
||||||
|
// * 用户拥有一些机构岗位, 这些岗位有不同的权限。我们反查用户对哪些机构拥有指定的权限
|
||||||
|
// * 结果会是一些机构的 orgId (依赖用户是否代表对应机构的下属机构, 可能包含子机构)
|
||||||
|
// * 返回全部机构列表
|
||||||
|
// * @param userId 用户
|
||||||
|
// * @param permission 权限
|
||||||
|
// * @return 机构列表
|
||||||
|
// */
|
||||||
|
// @GetMapping("/representOrgs")
|
||||||
|
// public R getRepresentOrgsByUserRolePermission(String userId, String permission) {
|
||||||
|
// return R.ok(sysOrgService.listUserRepresentOrgsByPermission(userId, permission));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 添加 |
||||||
|
* |
||||||
|
* @param sysOrg 实体 |
||||||
|
* |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("添加机构") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_org_add')") |
||||||
|
public R addOrg(@Valid @RequestBody SysOrg sysOrg) { |
||||||
|
|
||||||
|
return R.ok(sysOrgService.addOrg(sysOrg)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("删除机构") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_org_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
return R.ok(sysOrgService.removeOrgById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑 |
||||||
|
* |
||||||
|
* @param sysOrg 实体 |
||||||
|
* |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("编辑机构") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_org_edit')") |
||||||
|
public R update(@Valid @RequestBody SysOrg sysOrg, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
sysOrg.setCreateBy(null); |
||||||
|
sysOrg.setCreateTime(null); |
||||||
|
sysOrg.setUpdateBy(dlpUser.getId()); |
||||||
|
sysOrg.setUpdateTime(LocalDateTime.now()); |
||||||
|
//sysOrg.setUpdateTime(LocalDateTime.now());
|
||||||
|
// sysOrg.setUpdateTime(null);
|
||||||
|
// sysOrg.setUpdateBy(null);
|
||||||
|
|
||||||
|
return R.ok(sysOrgService.updateOrgById(sysOrg)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 当机构隶属关系有变更时, 修改机构及下属机构的祖先字段
|
||||||
|
// * 这主要是为了方便前端在修改涉及机构的字段时,提供了机构的祖先,前端容易一级一级的展示当前机构的从属关系
|
||||||
|
// *
|
||||||
|
// * @param sysOrg
|
||||||
|
// */
|
||||||
|
// private void updateOrgAncestors(SysOrg sysOrg) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询机构的祖先 id |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* |
||||||
|
* @return ids array |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@GetMapping("/ancestorids/{id}") |
||||||
|
public R<List<String>> innerGetAncestorids(@PathVariable String id) { |
||||||
|
List<SysOrg> orgList = sysOrgService.list(); |
||||||
|
List<String> ancestorids = new ArrayList<>(); |
||||||
|
|
||||||
|
String currentOrgId = id; |
||||||
|
while (StrUtil.isNotBlank(currentOrgId)) { |
||||||
|
boolean found = false; |
||||||
|
for (SysOrg org : orgList) { |
||||||
|
if (org.getOrgId().equals(currentOrgId)) { |
||||||
|
ancestorids.add(0, currentOrgId); |
||||||
|
currentOrgId = org.getParentId(); |
||||||
|
found = true; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
if (! found) { |
||||||
|
break; // 前面的 for 循环没有找到, 说明出错了, 中止, 不然就会死循环了
|
||||||
|
} |
||||||
|
} |
||||||
|
System.out.println(String.format("getAncestorids(), id=%s ancestorids=%s", id, ancestorids)); |
||||||
|
return R.ok(ancestorids); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询机构列表 |
||||||
|
* 查询条件: name/alias/orgId/parentId/area_code |
||||||
|
* |
||||||
|
* @return 列表 |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@PostMapping(value = "/inner/list") |
||||||
|
public R<List<SysOrg>> innerGetOrgList(@RequestBody SysOrg org) { |
||||||
|
System.out.println(String.format("innerGetOrgList, org=%s",org.toString())); |
||||||
|
|
||||||
|
return R.ok(sysOrgService.list(Wrappers.<SysOrg>query() |
||||||
|
.like(StrUtil.isNotBlank(org.getName()), "name", org.getName()) |
||||||
|
.like(StrUtil.isNotBlank(org.getAlias()), "alias", org.getAlias()) |
||||||
|
.eq(StrUtil.isNotBlank(org.getOrgId()), "org_id", org.getOrgId()) |
||||||
|
.eq(StrUtil.isNotBlank(org.getParentId()), "parent_id", org.getParentId()) |
||||||
|
.eq(StrUtil.isNotBlank(org.getAreaCode()), "area_code", org.getAreaCode()) |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 检测机构名称是否存在 |
||||||
|
* @param orgname |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping("/checkOrgExist") |
||||||
|
public R checkOrgExist(String orgname) |
||||||
|
{ |
||||||
|
return R.ok(sysOrgService.checkOrgNameExist(orgname)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仅提供内部服务使用接口 |
||||||
|
* 根据机构id获取机构的地址省市 |
||||||
|
*/ |
||||||
|
@GetMapping("/fetchProvinceCityInfoByOrgId") |
||||||
|
public R<List<Area>> fetchProvinceCityInfoByOrgId(@RequestParam("orgId") String orgId) { |
||||||
|
List<Area> areaList = sysOrgService.fetchProvinceCityInfoByOrgId(orgId); |
||||||
|
return R.ok(areaList); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,116 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.entity.SysPermission; |
||||||
|
import digital.laboratory.platform.sys.service.SysPermissionService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.security.util.SecurityUtils; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/permission") |
||||||
|
@Api(tags = "13-权限管理", description="权限管理") |
||||||
|
public class PermissionController { |
||||||
|
|
||||||
|
private final SysPermissionService sysPermissionService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回当前用户的树形权限集合 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 当前用户的树形权限 |
||||||
|
*/ |
||||||
|
@GetMapping |
||||||
|
public R getUserPermission(String parentId) { |
||||||
|
// 获取符合条件的权限
|
||||||
|
Set<SysPermission> sysPermissionList = sysPermissionService |
||||||
|
.findPermissionByRoleId(SecurityUtils.getRoles()); |
||||||
|
return R.ok(sysPermissionService.filterPermission(sysPermissionList, parentId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回树形权限集合 |
||||||
|
* @param lazy 是否是懒加载 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 树形权限 |
||||||
|
*/ |
||||||
|
@GetMapping(value = "/tree") |
||||||
|
public R getTree(boolean lazy, String parentId) { |
||||||
|
return R.ok(sysPermissionService.treePermission(lazy, parentId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回岗位的权限集合 |
||||||
|
* @param roleId 岗位ID |
||||||
|
* @return 属性集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/tree/{roleId}") |
||||||
|
public R getRoleTree(@PathVariable String roleId) { |
||||||
|
List<String> roleIds = new ArrayList<String>(); |
||||||
|
roleIds.add(roleId); |
||||||
|
return R.ok(sysPermissionService.findPermissionByRoleId(roleIds).stream().map(SysPermission::getPermissionId) |
||||||
|
.collect(Collectors.toList())); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询权限的详细信息 |
||||||
|
* @param id 权限ID |
||||||
|
* @return 权限详细信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/{id}") |
||||||
|
public R getById(@PathVariable String id) { |
||||||
|
return R.ok(sysPermissionService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
//==================================================================================================================
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增权限 |
||||||
|
* @param sysPermission 权限信息 |
||||||
|
* @return 含ID 权限信息 |
||||||
|
*/ |
||||||
|
@SysLog("新增权限") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_permission_add')") |
||||||
|
public R add(@Valid @RequestBody SysPermission sysPermission) { |
||||||
|
System.out.println(String.format("新增权限, id=%s name=%s permission=%s ", sysPermission.getPermissionId(), sysPermission.getName(), sysPermission.getPermission())); |
||||||
|
sysPermissionService.save(sysPermission); |
||||||
|
return R.ok(sysPermission); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除权限 |
||||||
|
* @param id 权限ID |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("删除权限") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_permission_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
System.out.println(String.format("删除权限, id=%s", id)); |
||||||
|
return R.ok(sysPermissionService.removePermissionById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新权限 |
||||||
|
* @param sysPermission |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@SysLog("更新权限") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_permission_edit')") |
||||||
|
public R update(@Valid @RequestBody SysPermission sysPermission) { |
||||||
|
System.out.println(String.format("修改权限, id=%s name=%s permission=%s ", sysPermission.getPermissionId(), sysPermission.getName(), sysPermission.getPermission())); |
||||||
|
return R.ok(sysPermissionService.updatePermissionById(sysPermission)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.sys.entity.PersonalIdentityVerifier; |
||||||
|
import digital.laboratory.platform.sys.service.PersonalIdentityVerifierService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 智能身份识别终端配置 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2023-02-21 |
||||||
|
* @describe 智能身份识别终端配置 前端控制器 |
||||||
|
* |
||||||
|
* 这是与表示层的接口, 不应该接业务逻辑写在这里, 业务逻辑应该写在 service 中 |
||||||
|
* 这里写什么: |
||||||
|
* 为前端提供数据, 接受前端的数据 |
||||||
|
* 为前端提供的数据, 从 service 取得后, 可以做一些适当的加工, 这种加工不是业务层面的, 只能是数据格式上, 为方便前端处理 |
||||||
|
* 接受前端的数据, 每一个函数的参数可以先做一些整理后, 再调用 service 中的函数。这里对参数的整理, 应该只是格式上的, 而不能是业务上的 |
||||||
|
* 数据层在 mapper 中, 数据层不涉及业务, 只管技术上的 对象<->表 之间的转换 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/personal_identity_verifier" ) |
||||||
|
@Api(value = "personal_identity_verifier", tags = "智能身份识别终端配置管理") |
||||||
|
public class PersonalIdentityVerifierController { |
||||||
|
|
||||||
|
private final PersonalIdentityVerifierService personalIdentityVerifierService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询智能身份识别终端配置 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
@Inner |
||||||
|
public R<PersonalIdentityVerifier> getById(@PathVariable("id" ) String id) { |
||||||
|
PersonalIdentityVerifier personalIdentityVerifier = personalIdentityVerifierService.getById(id); |
||||||
|
return R.restResult(personalIdentityVerifier,200,"查询成功!"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package digital.laboratory.platform.sewage.controller; |
||||||
|
|
||||||
|
import com.pig4cloud.pig.admin.api.dto.UserDTO; |
||||||
|
import com.pig4cloud.pig.admin.service.SysUserService; |
||||||
|
import com.pig4cloud.pig.common.core.util.R; |
||||||
|
import com.pig4cloud.pig.common.log.annotation.SysLog; |
||||||
|
import com.pig4cloud.pig.common.security.annotation.Inner; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lengleng |
||||||
|
* @date 2022/3/30 |
||||||
|
* |
||||||
|
* 客户端注册功能 register.user = false |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/register") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@ConditionalOnProperty(name = "register.user", matchIfMissing = true) |
||||||
|
public class RegisterController { |
||||||
|
|
||||||
|
private final SysUserService userService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 注册用户 |
||||||
|
* @param userDto 用户信息 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@Inner(value = false) |
||||||
|
@SysLog("注册用户") |
||||||
|
@PostMapping("/user") |
||||||
|
public R<Boolean> registerUser(@RequestBody UserDTO userDto) { |
||||||
|
return userService.registerUser(userDto); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,339 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
||||||
|
import digital.laboratory.platform.sys.dto.SysRoleDTO; |
||||||
|
import digital.laboratory.platform.sys.dto.SysRoleTypeDTO; |
||||||
|
import digital.laboratory.platform.sys.dto.SysRoleTypeUserDTO; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUser; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUserRole; |
||||||
|
import digital.laboratory.platform.sys.entity.SysRole; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.service.*; |
||||||
|
import digital.laboratory.platform.sys.vo.RoleVO; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/role") |
||||||
|
@Api(tags = "14-岗位管理") |
||||||
|
public class RoleController { |
||||||
|
|
||||||
|
private final SysRoleService sysRoleService; |
||||||
|
private final SysRolePermissionService sysRolePermissionService; |
||||||
|
private final SysRoleTypeService sysRoleTypeService; |
||||||
|
|
||||||
|
private final SysUserRoleService sysUserRoleService; |
||||||
|
|
||||||
|
private final SysUserService sysUserService; |
||||||
|
// private final SysRoleMenuService sysRoleMenuService;
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询岗位信息 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* @return 岗位信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/{id}") |
||||||
|
public R getById(@PathVariable Integer id) { |
||||||
|
return R.ok(sysRoleService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加岗位 |
||||||
|
* |
||||||
|
* @param sysRole 岗位信息 |
||||||
|
* @return success、false |
||||||
|
*/ |
||||||
|
@SysLog("添加岗位") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_role_add')") |
||||||
|
public R add(@Valid @RequestBody SysRole sysRole) { |
||||||
|
// String username = SecurityUtils.getUser().getUsername();
|
||||||
|
// sysRole.setCreateBy(username);
|
||||||
|
// sysRole.setUpdateBy(username);
|
||||||
|
return R.ok(sysRoleService.save(sysRole)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改岗位 |
||||||
|
* |
||||||
|
* @param sysRole 岗位信息 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("修改岗位") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_role_edit')") |
||||||
|
public R update(@Valid @RequestBody SysRole sysRole) { |
||||||
|
return R.ok(sysRoleService.updateById(sysRole)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除岗位 |
||||||
|
* |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@SysLog("删除岗位") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_role_del')") |
||||||
|
public R removeById(@PathVariable String id) { |
||||||
|
return R.ok(sysRoleService.removeRoleById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取岗位列表 |
||||||
|
* |
||||||
|
* @return 岗位列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
public R getRoleList() { |
||||||
|
List<SysRole> list = sysRoleService.list(Wrappers.emptyWrapper()); |
||||||
|
//将岗位按照ID分组
|
||||||
|
Map<String, List<SysRole>> map = list.stream().collect(Collectors.groupingBy(item -> item.getRoleId().substring(0, 2))); |
||||||
|
Set<String> roleIdSet = map.keySet(); |
||||||
|
ArrayList<String> roleIdList = new ArrayList<>(roleIdSet); |
||||||
|
//排序
|
||||||
|
Collections.sort(roleIdList, new Comparator<String>() { |
||||||
|
@Override |
||||||
|
public int compare(String o1, String o2) { |
||||||
|
return Integer.compare(Integer.parseInt(o1), Integer.parseInt(o2)); |
||||||
|
} |
||||||
|
}); |
||||||
|
ArrayList<SysRoleDTO> sysRoleDTOS = new ArrayList<>(); |
||||||
|
//这里有个ID为index,是因为前端需要这个参数来遍历
|
||||||
|
Integer index = 1; |
||||||
|
for (String roleId : roleIdList) { |
||||||
|
SysRoleDTO sysRoleDTO = new SysRoleDTO(); |
||||||
|
List<SysRole> roleList = map.get(roleId); |
||||||
|
|
||||||
|
//将同一系统的岗位再次进行排序
|
||||||
|
Collections.sort(roleList, new Comparator<SysRole>() { |
||||||
|
@Override |
||||||
|
public int compare(SysRole o1, SysRole o2) { |
||||||
|
int roleId1 = Integer.parseInt(o1.getRoleId()); |
||||||
|
int roleId2 = Integer.parseInt(o2.getRoleId()); |
||||||
|
return Integer.compare(roleId1, roleId2); |
||||||
|
} |
||||||
|
}); |
||||||
|
//因为管理员岗位与送检受理系统岗位都是10开头的ID,所以手动处理一下
|
||||||
|
if (roleId.equals("10")) { |
||||||
|
List<SysRole> sysRoles = new ArrayList<>(); |
||||||
|
SysRole sysRole1 = roleList.get(0); |
||||||
|
SysRole sysRole2 = roleList.get(1); |
||||||
|
sysRoles.add(sysRole1); |
||||||
|
sysRoles.add(sysRole2); |
||||||
|
roleList.remove(sysRole1); |
||||||
|
roleList.remove(sysRole2); |
||||||
|
SysRoleDTO sysRole = new SysRoleDTO("管理员岗", sysRoles, index); |
||||||
|
index++; |
||||||
|
sysRoleDTOS.add(sysRole); |
||||||
|
} |
||||||
|
sysRoleDTO.setRoleId(index); |
||||||
|
sysRoleDTO.setRoleList(roleList); |
||||||
|
switch (roleId) { |
||||||
|
case "10": |
||||||
|
sysRoleDTO.setRoleSysTem("送检受理系统"); |
||||||
|
break; |
||||||
|
case "11": |
||||||
|
sysRoleDTO.setRoleSysTem("污水任务系统"); |
||||||
|
break; |
||||||
|
case "23": |
||||||
|
sysRoleDTO.setRoleSysTem("毛发任务系统"); |
||||||
|
break; |
||||||
|
case "24": |
||||||
|
sysRoleDTO.setRoleSysTem("检材管理系统"); |
||||||
|
break; |
||||||
|
case "25": |
||||||
|
sysRoleDTO.setRoleSysTem("检材流转系统"); |
||||||
|
break; |
||||||
|
case "26": |
||||||
|
sysRoleDTO.setRoleSysTem("试剂耗材管理系统"); |
||||||
|
break; |
||||||
|
case "27": |
||||||
|
break; |
||||||
|
case "29": |
||||||
|
sysRoleDTO.setRoleSysTem("仪器设备管理系统"); |
||||||
|
break; |
||||||
|
case "30": |
||||||
|
sysRoleDTO.setRoleSysTem("环境管理系统"); |
||||||
|
break; |
||||||
|
case "31": |
||||||
|
break; |
||||||
|
case "32": |
||||||
|
sysRoleDTO.setRoleSysTem("方法管理系统"); |
||||||
|
break; |
||||||
|
case "35": |
||||||
|
sysRoleDTO.setRoleSysTem("档案管理系统"); |
||||||
|
break; |
||||||
|
case "37": |
||||||
|
sysRoleDTO.setRoleSysTem("事件(筛查)系统"); |
||||||
|
break; |
||||||
|
case "38": |
||||||
|
sysRoleDTO.setRoleSysTem("人员管理系统"); |
||||||
|
break; |
||||||
|
case "39": |
||||||
|
sysRoleDTO.setRoleSysTem("鉴定文书管理系统"); |
||||||
|
break; |
||||||
|
case "40": |
||||||
|
sysRoleDTO.setRoleSysTem("检验鉴定系统"); |
||||||
|
break; |
||||||
|
case "50": |
||||||
|
sysRoleDTO.setRoleSysTem("综合统计管理岗"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(sysRoleDTO.getRoleSysTem())) { |
||||||
|
sysRoleDTOS.add(sysRoleDTO); |
||||||
|
index++; |
||||||
|
} |
||||||
|
} |
||||||
|
return R.ok(sysRoleDTOS); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据岗位类别获取岗位列表 |
||||||
|
* |
||||||
|
* @return 根据岗位类别获取岗位列表 |
||||||
|
*/ |
||||||
|
@SysLog("根据岗位类别获取岗位列表") |
||||||
|
@GetMapping("/typeList/{id}") |
||||||
|
public R getRoletypeList(@PathVariable String id) { |
||||||
|
return R.ok(sysRoleService.list(Wrappers.<SysRole>query().eq("role_type", id))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分配岗位类别给用户 |
||||||
|
* |
||||||
|
* @return 分配岗位类别给用户 |
||||||
|
*/ |
||||||
|
@SysLog("分配岗位类别给用户") |
||||||
|
@PostMapping("/typeUser") |
||||||
|
public R addUserRoleType(@RequestBody SysRoleTypeUserDTO sysRoleTypeUserDTO) { |
||||||
|
|
||||||
|
return R.ok(sysRoleService.addUserRoleType(sysRoleTypeUserDTO)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* /** |
||||||
|
* 分页查询岗位信息 |
||||||
|
* |
||||||
|
* @param page 分页对象 |
||||||
|
* @return 分页对象 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R getRolePage(Page page, SysRole sysRole) { |
||||||
|
//如果有类型的时候,应该查询出这个类型下的所有类型
|
||||||
|
List<String> idLsit = new ArrayList<>(); |
||||||
|
if (StringUtils.isNotBlank(sysRole.getRoleType())) { |
||||||
|
idLsit = sysRoleTypeService.getTreeChild(sysRole.getRoleType()); |
||||||
|
} |
||||||
|
return R.ok(sysRoleService.page(page, Wrappers.<SysRole>query() |
||||||
|
.like(StringUtils.isNotBlank(sysRole.getRoleName()), "role_name", sysRole.getRoleName()) |
||||||
|
//.like(StringUtils.isNotBlank(sysRole.getRoleId()),"",sysRole.getRoleId())
|
||||||
|
.in(idLsit.size() > 0, "role_type", idLsit))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* /** |
||||||
|
* 分配岗位类别 |
||||||
|
* |
||||||
|
* @param sysRoleTypeDTO 传入参数 |
||||||
|
* @return boolean; |
||||||
|
*/ |
||||||
|
@SysLog("分配岗位类别") |
||||||
|
@PutMapping("/addType") |
||||||
|
public R addRoleType(@RequestBody SysRoleTypeDTO sysRoleTypeDTO) { |
||||||
|
return R.ok(sysRoleService.addRoleType(sysRoleTypeDTO)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* /** |
||||||
|
* 移除岗位的岗位类别 |
||||||
|
* |
||||||
|
* @param sysRoleList 岗位数组 |
||||||
|
* @return boolean; |
||||||
|
*/ |
||||||
|
@SysLog("移除岗位类别") |
||||||
|
@DeleteMapping("/removeType") |
||||||
|
public R removeRoleType(@RequestBody List<SysRole> sysRoleList) { |
||||||
|
return R.ok(sysRoleService.removeRoleType(sysRoleList)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 更新岗位权限 |
||||||
|
* |
||||||
|
* @param roleVo 岗位对象 |
||||||
|
* @return success、false |
||||||
|
*/ |
||||||
|
@SysLog("更新岗位权限") |
||||||
|
@PutMapping("/permission") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_role_perm')") |
||||||
|
public R saveRolePermissions(@RequestBody RoleVO roleVo) { |
||||||
|
SysRole sysRole = sysRoleService.getById(roleVo.getRoleId()); |
||||||
|
return R.ok(sysRolePermissionService.saveRolePermissions(sysRole.getRoleId(), roleVo.getPermissionIds())); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取岗位下的用户ID |
||||||
|
* |
||||||
|
* @param roleType |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/getRoleContainsUser") |
||||||
|
public R getRoleContainsUser(String roleType) { |
||||||
|
List<SysUser> retUserList = new ArrayList<>(); |
||||||
|
//取出这个岗位类型包含的岗位
|
||||||
|
List<String> typeIdList = sysRoleTypeService.getTreeChild(roleType); |
||||||
|
|
||||||
|
List<SysRole> roleList = sysRoleService.list(Wrappers.<SysRole>query() |
||||||
|
.in(typeIdList.size() > 0, "role_type", typeIdList)); |
||||||
|
|
||||||
|
List<String> roleIdList = new ArrayList<>();//将这些岗位转化为岗位ID
|
||||||
|
roleList.forEach(role -> { |
||||||
|
roleIdList.add(role.getRoleId()); |
||||||
|
}); |
||||||
|
if (roleIdList.size() > 0) { |
||||||
|
List<String> userIdList = new ArrayList<>(); |
||||||
|
//根据这些岗位查询出对应的用户
|
||||||
|
List<SysUserRole> sysUserRoleList = sysUserRoleService.list(Wrappers.<SysUserRole>query() |
||||||
|
.in("role_id", roleIdList)); |
||||||
|
sysUserRoleList.forEach(sysUserRole -> { |
||||||
|
userIdList.add(sysUserRole.getUserId()); |
||||||
|
}); |
||||||
|
|
||||||
|
if (userIdList.size() > 0) { |
||||||
|
retUserList = sysUserService.list(Wrappers.<SysUser>query() |
||||||
|
.in("user_id", userIdList)); |
||||||
|
return R.ok(retUserList); |
||||||
|
} else { |
||||||
|
return R.ok(retUserList); |
||||||
|
} |
||||||
|
} else { |
||||||
|
return R.ok(retUserList); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 更新岗位菜单
|
||||||
|
// * @param roleVo 岗位对象
|
||||||
|
// * @return success、false
|
||||||
|
// */
|
||||||
|
// @SysLog("更新岗位菜单")
|
||||||
|
// @PutMapping("/menu")
|
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_perm')")
|
||||||
|
// public R saveRoleMenus(@RequestBody RoleVO roleVo) {
|
||||||
|
// SysRole sysRole = sysRoleService.getById(roleVo.getRoleId());
|
||||||
|
// return R.ok(sysRoleMenuService.saveRoleMenus(sysRole.getRoleCode(), roleVo.getRoleId(), roleVo.getMenuIds()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,177 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.util.RandomUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
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.core.util.TestUtils; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.sys.entity.PartialStaff; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUser; |
||||||
|
import digital.laboratory.platform.sys.service.StaffService; |
||||||
|
import digital.laboratory.platform.sys.service.SysUserService; |
||||||
|
import digital.laboratory.platform.sys.vo.Staff; |
||||||
|
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 java.util.List; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-12 |
||||||
|
* @describe 鉴定中心员工, 这是用户名的扩充表 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/staff" ) |
||||||
|
@Api(tags = "21-鉴定中心员工, 这是用户表的扩充") |
||||||
|
public class StaffController { |
||||||
|
|
||||||
|
private final StaffService staffService; |
||||||
|
private final SysUserService userService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @param userId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{userId}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('StaffGet')" ) |
||||||
|
public R getById(@PathVariable("userId" ) String userId) { |
||||||
|
return R.ok(staffService.getById(userId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param staff 鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('StaffList')" ) |
||||||
|
public R<IPage<Staff>> getStaffPage(Page page, Staff staff) { |
||||||
|
IPage<Staff> thePage = staffService.getStaffVOPage(page, Wrappers.<Staff>query() |
||||||
|
.like(StrUtil.isNotBlank(staff.getName()), "u.name", staff.getName()) |
||||||
|
.like(StrUtil.isNotBlank(staff.getUsername()), "u.username", staff.getUsername()) |
||||||
|
.eq(StrUtil.isNotBlank(staff.getPoliceNo()), "u.police_no", staff.getPoliceNo()) |
||||||
|
.orderByAsc("u.name") |
||||||
|
); |
||||||
|
return R.ok(thePage); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 列表查询 |
||||||
|
* @param staff 鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "列表查询", notes = "列表查询") |
||||||
|
@GetMapping("/list" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('StaffList')" ) |
||||||
|
public R<List<Staff>> getStaffList(Staff staff) { |
||||||
|
|
||||||
|
List<Staff> staffs = staffService.getStaffVOList(Wrappers.<Staff>query() |
||||||
|
.like(StrUtil.isNotBlank(staff.getName()), "u.name", staff.getName()) |
||||||
|
.orderByAsc("u.name") |
||||||
|
); |
||||||
|
return R.ok(staffs); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @param partialStaff 鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增鉴定中心员工, 这是用户名的扩充表", notes = "新增鉴定中心员工, 这是用户名的扩充表") |
||||||
|
@SysLog("新增鉴定中心员工, 这是用户名的扩充表" ) |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('StaffCreate')" ) |
||||||
|
public R postAddObject(@RequestBody PartialStaff partialStaff) { |
||||||
|
return R.ok(staffService.save(partialStaff)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @param partialStaff 鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改鉴定中心员工, 这是用户名的扩充表", notes = "修改鉴定中心员工, 这是用户名的扩充表") |
||||||
|
@SysLog("修改鉴定中心员工, 这是用户名的扩充表" ) |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('StaffEdit')" ) |
||||||
|
public R putUpdateById(@RequestBody PartialStaff partialStaff) { |
||||||
|
return R.ok(staffService.updateById(partialStaff)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除鉴定中心员工, 这是用户名的扩充表 |
||||||
|
* @param userId id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除鉴定中心员工, 这是用户名的扩充表", notes = "通过id删除鉴定中心员工, 这是用户名的扩充表") |
||||||
|
@SysLog("通过id删除鉴定中心员工, 这是用户名的扩充表" ) |
||||||
|
@DeleteMapping("/{userId}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('StaffDelete')" ) |
||||||
|
public R deleteById(@PathVariable String userId) { |
||||||
|
return R.ok(staffService.removeById(userId)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// 测试, 创建 20 个员工
|
||||||
|
@GetMapping("/create20" ) |
||||||
|
public R create20() { |
||||||
|
for (int i=0; i<20; i++) |
||||||
|
{ |
||||||
|
SysUser user = new SysUser(); |
||||||
|
|
||||||
|
user.setUserId(IdWorker.get32UUID().toUpperCase()); |
||||||
|
user.setUsername("partialStaff"+RandomUtil.randomString(RandomUtil.randomInt(1, 6))); |
||||||
|
user.setEnabled(true); |
||||||
|
user.setPassword("$2a$10$Q/8pJPrJLzCSMup8akH3y.Nxra4H/jGdBQTNDyl70W5Rz8EatLtmO"); |
||||||
|
user.setPoliceType(RandomUtil.randomInt(0, 2)); |
||||||
|
user.setPoliceNo(RandomUtil.randomNumbers(8)); |
||||||
|
user.setNativePlace(TestUtils.genAddress(i)); |
||||||
|
|
||||||
|
//当前时间字符串, 格式: yyyy-MM-dd HH:mm:ss
|
||||||
|
String now = DateUtil.now(); |
||||||
|
//当前日期字符串, 格式: yyyy-MM-dd
|
||||||
|
String today= DateUtil.today(); |
||||||
|
user.setName("测试用户-"+today+"-"+String.format("%d", i)); |
||||||
|
user.setFormerName("测试用户曾用名-"+today+"-"+String.format("%d", i)); |
||||||
|
|
||||||
|
user.setGender(RandomUtil.randomInt(2)); |
||||||
|
user.setNation(TestUtils.genNation()); |
||||||
|
user.setMaritalStatus(TestUtils.genMaritalStatus()); |
||||||
|
user.setMilitaryServiceStatus(TestUtils.genMilitaryServiceStatus()); |
||||||
|
user.setEducationalLevel(TestUtils.genEducationalLevel()); |
||||||
|
user.setBirthPlace(TestUtils.genAddress(i)); |
||||||
|
user.setCertificateType(TestUtils.genCertificateType()); |
||||||
|
user.setCertificateNo(RandomUtil.randomNumbers(18)); |
||||||
|
user.setIdentificationCardNo(RandomUtil.randomNumbers(18)); |
||||||
|
user.setMobile(TestUtils.genMobile()); |
||||||
|
user.setEmail(RandomUtil.randomStringUpper(10)+"@"+RandomUtil.randomStringUpper(10)+".COM"); |
||||||
|
user.setAddress(TestUtils.genAddress(i)); |
||||||
|
|
||||||
|
user.setPosition(TestUtils.genPosition()); |
||||||
|
|
||||||
|
userService.save(user); |
||||||
|
|
||||||
|
PartialStaff partialStaff = new PartialStaff(); |
||||||
|
partialStaff.setUserId(user.getUserId()); |
||||||
|
staffService.save(partialStaff); |
||||||
|
} |
||||||
|
return R.ok("已经创建 20 个员工"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,95 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
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.StaffTrainingPlan; |
||||||
|
import digital.laboratory.platform.sys.service.StaffTrainingPlanService; |
||||||
|
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-12 |
||||||
|
* @describe 员工培训计划 前端控制器 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/staff_training_plan" ) |
||||||
|
@Api( tags = "员工培训计划管理") |
||||||
|
public class StaffTrainingPlanController { |
||||||
|
|
||||||
|
private final StaffTrainingPlanService staffTrainingPlanService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询员工培训计划 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id查询", notes = "通过id查询") |
||||||
|
@GetMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_staff_training_plan_get')" ) |
||||||
|
public R getById(@PathVariable("id" ) String id) { |
||||||
|
return R.ok(staffTrainingPlanService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param staffTrainingPlan 员工培训计划 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||||
|
@GetMapping("/page" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_staff_training_plan_get')" ) |
||||||
|
public R getStaffTrainingPlanPage(Page page, StaffTrainingPlan staffTrainingPlan) { |
||||||
|
return R.ok(staffTrainingPlanService.page(page, Wrappers.query(staffTrainingPlan))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增员工培训计划 |
||||||
|
* @param staffTrainingPlan 员工培训计划 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增员工培训计划", notes = "新增员工培训计划") |
||||||
|
@SysLog("新增员工培训计划" ) |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_staff_training_plan_add')" ) |
||||||
|
public R postAddObject(@RequestBody StaffTrainingPlan staffTrainingPlan) { |
||||||
|
return R.ok(staffTrainingPlanService.save(staffTrainingPlan)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改员工培训计划 |
||||||
|
* @param staffTrainingPlan 员工培训计划 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改员工培训计划", notes = "修改员工培训计划") |
||||||
|
@SysLog("修改员工培训计划" ) |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_staff_training_plan_edit')" ) |
||||||
|
public R putUpdateById(@RequestBody StaffTrainingPlan staffTrainingPlan) { |
||||||
|
return R.ok(staffTrainingPlanService.updateById(staffTrainingPlan)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除员工培训计划 |
||||||
|
* @param id id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过id删除员工培训计划", notes = "通过id删除员工培训计划") |
||||||
|
@SysLog("通过id删除员工培训计划" ) |
||||||
|
@DeleteMapping("/{id}" ) |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_staff_training_plan_del')" ) |
||||||
|
public R deleteById(@PathVariable String id) { |
||||||
|
return R.ok(staffTrainingPlanService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,120 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||||
|
import digital.laboratory.platform.sys.entity.SysRoleType; |
||||||
|
import digital.laboratory.platform.sys.service.SysRoleTypeService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiImplicitParam; |
||||||
|
import io.swagger.annotations.ApiImplicitParams; |
||||||
|
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; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/roletype") |
||||||
|
@Api(value = "RoleType", tags = "岗位类别管理") |
||||||
|
public class SysRoleTypeController { |
||||||
|
private final SysRoleTypeService sysRoleTypeService; |
||||||
|
/** |
||||||
|
* 新增岗位类别 |
||||||
|
* |
||||||
|
* @param sysRoleType |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "新增岗位类别", notes = "新增岗位类别") |
||||||
|
@PostMapping() |
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_type_add')")
|
||||||
|
public R addRoleType(@RequestBody SysRoleType sysRoleType, HttpServletRequest theHttpServletRequest) { |
||||||
|
|
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
return R.ok(sysRoleTypeService.addRoleType(sysRoleType)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改岗位类别 |
||||||
|
* |
||||||
|
* @param sysRoleType |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "修改岗位类别", notes = "修改岗位类别") |
||||||
|
@PutMapping() |
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_type_edit')")
|
||||||
|
public R editRoleType(@RequestBody SysRoleType sysRoleType, HttpServletRequest theHttpServletRequest) { |
||||||
|
|
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
if (sysRoleTypeService.updateById(sysRoleType)) { |
||||||
|
return R.ok(sysRoleType); |
||||||
|
} else return R.failed(sysRoleType, "修改失败"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除岗位类别 |
||||||
|
* |
||||||
|
* @param id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "删除岗位类别", notes = "删除岗位类别") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_type_del')")
|
||||||
|
public R delRoleType(@PathVariable String id, HttpServletRequest theHttpServletRequest) { |
||||||
|
|
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
if (sysRoleTypeService.delSysRoleType(id)) { |
||||||
|
return R.ok("删除成功"); |
||||||
|
} else return R.failed("删除失败"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询岗位类别 |
||||||
|
* |
||||||
|
* @param id |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "通过ID查询岗位类别", notes = "通过ID查询岗位类别") |
||||||
|
@GetMapping("/{id}") |
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_type_get)")
|
||||||
|
public R getRoleType(@PathVariable String id, HttpServletRequest theHttpServletRequest) { |
||||||
|
|
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
return R.ok(sysRoleTypeService.getSysRoleType(id)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回树形字典集合 |
||||||
|
* |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 树形权限 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "取岗位类别分支树", notes = "取岗位类别分支树") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name = "parentId", value = "分支树的标识", required = true, paramType = "query"), |
||||||
|
}) |
||||||
|
|
||||||
|
@GetMapping("/tree") |
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_type_get')")
|
||||||
|
public R treeSysRoleType(String parentId, HttpServletRequest theHttpServletRequest) { |
||||||
|
return R.ok(sysRoleTypeService.treeSysRoleType(parentId)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping(value = "/treeParentData") |
||||||
|
// @PreAuthorize("@pms.hasPermission('sys_role_type_get')")
|
||||||
|
public R getTreeParentSysRoleType(String parentId) { |
||||||
|
return R.ok(sysRoleTypeService.getTreeParentSysRoleType()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.feign.RemoteTokenService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lengleng |
||||||
|
* @date 2018/9/4 getTokenPage 管理 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/token") |
||||||
|
@Api(tags = "令牌管理") |
||||||
|
public class TokenController { |
||||||
|
|
||||||
|
private final RemoteTokenService remoteTokenService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页token 信息 |
||||||
|
* @param params 参数集 |
||||||
|
* @return token集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R token(@RequestParam Map<String, Object> params) { |
||||||
|
return remoteTokenService.getTokenPage(params); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
* @param id ID |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_token_del')") |
||||||
|
public R<Boolean> delete(@PathVariable String id) { |
||||||
|
return remoteTokenService.removeToken(id); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,492 @@ |
|||||||
|
package digital.laboratory.platform.sys.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.util.RandomUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||||
|
import digital.laboratory.platform.common.core.util.TestUtils; |
||||||
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; |
||||||
|
import digital.laboratory.platform.sys.entity.PartialStaff; |
||||||
|
import digital.laboratory.platform.sys.entity.SysOrg; |
||||||
|
import digital.laboratory.platform.sys.entity.SysRole; |
||||||
|
import digital.laboratory.platform.sys.service.StaffService; |
||||||
|
import digital.laboratory.platform.sys.service.SysOrgService; |
||||||
|
import digital.laboratory.platform.sys.service.SysUserService; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import digital.laboratory.platform.sys.dto.UserDTO; |
||||||
|
import digital.laboratory.platform.sys.dto.UserInfo; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUser; |
||||||
|
import digital.laboratory.platform.sys.vo.Staff; |
||||||
|
import digital.laboratory.platform.sys.vo.UserInfoVO; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.common.log.annotation.SysLog; |
||||||
|
import digital.laboratory.platform.common.security.annotation.Inner; |
||||||
|
import digital.laboratory.platform.common.security.util.SecurityUtils; |
||||||
|
import io.swagger.annotations.*; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||||
|
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.PutMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import 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 javax.validation.Valid; |
||||||
|
import java.security.Principal; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lengleng |
||||||
|
* @date 2019/2/1 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/sys/user") |
||||||
|
@Api(tags = "12-用户管理", description = "用户管理, 通常需要有管理员身份才能进行的操作") |
||||||
|
public class UserController { |
||||||
|
|
||||||
|
private final SysUserService userService; |
||||||
|
private final SysOrgService sysOrgService; |
||||||
|
private final StaffService staffService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取当前用户全部信息 |
||||||
|
* |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
@GetMapping(value = {"/info"}) |
||||||
|
@ApiOperation("获取当前用户全部信息") |
||||||
|
public R getUserInfo(HttpServletRequest request) { |
||||||
|
|
||||||
|
//System.out.println(String.format("getRemoteAddr=%s getRemoteHost=%s getRemotePort=%d", request.getRemoteAddr(), request.getRemoteHost(), request.getRemotePort()));
|
||||||
|
String username = SecurityUtils.getUser().getUsername(); |
||||||
|
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, username)); |
||||||
|
//SysUser user = userService.getUserByUsername(username);
|
||||||
|
|
||||||
|
if (user == null) { |
||||||
|
return R.failed("获取当前用户信息失败"); |
||||||
|
} |
||||||
|
UserInfo userInfo = userService.getUserInfo(user); |
||||||
|
UserInfoVO vo = new UserInfoVO(); |
||||||
|
vo.setSysUser(userInfo.getSysUser()); |
||||||
|
List<SysRole> roleList = userInfo.getRoleList(); |
||||||
|
vo.setRoleList(roleList); |
||||||
|
vo.setRoles(userInfo.getRoles()); |
||||||
|
vo.setPermissions(userInfo.getPermissions()); |
||||||
|
vo.setOrg(userInfo.getOrg()); |
||||||
|
return R.ok(vo); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取指定用户全部信息 |
||||||
|
* |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@GetMapping("/info/{username}") |
||||||
|
public R innerGetUserInfoByUsername(@PathVariable String username) { |
||||||
|
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, username)); |
||||||
|
//SysUser user = userService.getUserByUsername(username);
|
||||||
|
if (user == null) { |
||||||
|
return R.failed(String.format("用户信息为空 %s", username)); |
||||||
|
} |
||||||
|
return R.ok(userService.getUserInfo(user)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取当前用户管理的全部用户 id |
||||||
|
* |
||||||
|
* @return 用户 id 集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/manageids") |
||||||
|
public R<List<String>> getManageUserIds() { |
||||||
|
//return R.ok(userService.listUserIdByOrgIds(orgIds));
|
||||||
|
Page page = new Page(); |
||||||
|
UserDTO userDTO = new UserDTO(); |
||||||
|
IPage ipage = userService.getUserWithRolePage(page, userDTO); |
||||||
|
|
||||||
|
return R.ok(ipage.getRecords()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 根据机构id, 查询对应的用户 id 集合 |
||||||
|
* |
||||||
|
* @param orgIds 机构id 集合 |
||||||
|
* @return 用户 id 集合 |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@GetMapping("/ids") |
||||||
|
public R<List<String>> innerGetUserIdsByOrgIds(@RequestParam("orgIds") Set<String> orgIds) { |
||||||
|
return R.ok(userService.listUserIdByOrgIds(orgIds)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询用户信息 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/{id}") |
||||||
|
@ApiOperation(value = "根据 userId 取用户详细信息", notes = "返回的用户信息中有详细的用户信息, 除了对应的用户表中该用户所有字段信息之外, 还提供了机构名称(orgName)、用户岗位列表(userRoleList)。\n" + |
||||||
|
"userRoleList是一个数组, 每一个元素包含userId、roleId、representOrgId、representOrgName、representSubOrg等, 还包含对应岗位的完整信息。\n" + |
||||||
|
"这个接口提供的数据尽量保证完整性, 调用者得到的数据是完整的, 不需要再次调用其他的接口去获取对应数据的进一步信息。") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name = "id", value = "要查询的用户的 userId", required = true, dataType = "string", example = "1", paramType = "query") |
||||||
|
}) |
||||||
|
public R getById(@PathVariable String id) { |
||||||
|
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
// if (authentication != null) {
|
||||||
|
// Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
|
||||||
|
// String ppp = authorities.stream().map(GrantedAuthority::getAuthority)
|
||||||
|
// .filter(StringUtils::hasText)
|
||||||
|
// .filter(x -> PatternMatchUtils.simpleMatch(permission, x))
|
||||||
|
// .findAny().get();
|
||||||
|
// }
|
||||||
|
///////////
|
||||||
|
return R.ok(userService.getUserVoById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据用户名查询用户信息 |
||||||
|
* |
||||||
|
* @param username 用户名 |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/brief/{username}") |
||||||
|
public R getUserBriefByUsername(@PathVariable String username) { |
||||||
|
// SysUser condition = new SysUser();
|
||||||
|
// condition.setUsername(username);
|
||||||
|
// return R.ok(userService.getOne(new QueryWrapper<>(condition)));
|
||||||
|
|
||||||
|
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, username)); |
||||||
|
//SysUser user = userService.getUserByUsername(username);
|
||||||
|
return R.ok(user); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除用户信息 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@SysLog("删除用户信息") |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_user_del')") |
||||||
|
public R deleteUserById(@PathVariable String id) { |
||||||
|
SysUser sysUser = userService.getById(id); |
||||||
|
return R.ok(userService.removeUserById(sysUser)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加用户 |
||||||
|
* |
||||||
|
* @param userDto 用户信息 |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("添加用户") |
||||||
|
@PostMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_user_add')") |
||||||
|
public R postUserAdd(@RequestBody UserDTO userDto, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
System.out.println(String.format("添加新用户, username=%s userId=%s", userDto.getUsername(), userDto.getUserId())); |
||||||
|
List<SysOrg> orgList = sysOrgService.getDescendantList(dlpUser.getOrgId()); |
||||||
|
//如果添加的用户和当前用户的机构ID相同,则直接添加进去,否则的话,需要判断是否是当前用户机构的子机构
|
||||||
|
if (StrUtil.equalsIgnoreCase(dlpUser.getOrgId(), userDto.getOrgId())) { |
||||||
|
return R.ok(userService.addUser(userDto)); |
||||||
|
} |
||||||
|
for (SysOrg org : orgList) { |
||||||
|
if (StrUtil.equalsIgnoreCase(org.getOrgId(), userDto.getOrgId())) { |
||||||
|
// 新增用户的机构 是 当前用户的下属机构
|
||||||
|
return R.ok(userService.addUser(userDto)); |
||||||
|
} |
||||||
|
} |
||||||
|
throw new RuntimeException("用户所属机构只能是你所属机构,或你所属机构的下级机构"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新用户信息 |
||||||
|
* |
||||||
|
* @param userDto 用户信息 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
@SysLog("更新用户信息") |
||||||
|
@PutMapping |
||||||
|
@PreAuthorize("@pms.hasPermission('sys_user_edit')") |
||||||
|
public R putUserUpdate(@Valid @RequestBody UserDTO userDto, HttpServletRequest theHttpServletRequest) { |
||||||
|
Principal principal = theHttpServletRequest.getUserPrincipal(); |
||||||
|
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); |
||||||
|
|
||||||
|
System.out.println(String.format("更新用户信息, username=%s userId=%s avatar=%s", userDto.getUsername(), userDto.getUserId(), userDto.getAvatar())); |
||||||
|
List<SysOrg> orgList = sysOrgService.getDescendantList(dlpUser.getOrgId()); |
||||||
|
//如果添加的用户和当前用户的机构ID相同,则直接更新,否则的话,需要判断是否是当前用户机构的子机构
|
||||||
|
if (StrUtil.equals(dlpUser.getOrgId(), userDto.getOrgId())) { |
||||||
|
return R.ok(userService.updateUser(userDto)); |
||||||
|
} |
||||||
|
for (SysOrg org : orgList) { |
||||||
|
if (StrUtil.equalsIgnoreCase(org.getOrgId(), userDto.getOrgId())) { |
||||||
|
// 待修改用户的机构 是 当前用户的下属机构
|
||||||
|
return R.ok(userService.updateUser(userDto)); |
||||||
|
} |
||||||
|
} |
||||||
|
throw new RuntimeException("用户所属机构只能是你所属机构,或你所属机构的下级机构"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询用户 |
||||||
|
* |
||||||
|
* @param page 参数集 |
||||||
|
* @param userDTO 查询参数列表 |
||||||
|
* @return 用户集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public R getUserPage(Page page, UserDTO userDTO) { |
||||||
|
return R.ok(userService.getUserWithRolePage(page, userDTO)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询用户列表 |
||||||
|
* |
||||||
|
* @return 用户集合 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
public R getUserList() { |
||||||
|
return R.ok(userService.list()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 按 org_id 查用户列表 |
||||||
|
* |
||||||
|
* @param orgId 机构标识 |
||||||
|
* @return 用户集合 |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "按 org_id 查用户列表", notes = "按 org_id 查用户列表\n" + |
||||||
|
"使用场景是: 创建员工时, 需要选择机构为分中心的用户。\n" |
||||||
|
) |
||||||
|
@GetMapping("/list_by_org") |
||||||
|
public R getUserListByOrg(String orgId) { |
||||||
|
if (StrUtil.isBlank(orgId)) { |
||||||
|
throw new RuntimeException("必须提供 orgId 作为参数"); |
||||||
|
} |
||||||
|
//创建员工时,获取的用户必须是没有被添加成员工的数据,所以此处需要过滤一下
|
||||||
|
List<PartialStaff> staffList = staffService.list(); |
||||||
|
List<String> staffUserIds = new ArrayList<String>(); |
||||||
|
for (PartialStaff partialStaffObj : staffList) { |
||||||
|
staffUserIds.add(partialStaffObj.getUserId()); |
||||||
|
} |
||||||
|
List<SysUser> userList = userService.list(Wrappers.<SysUser>query() |
||||||
|
.eq(StrUtil.isNotBlank(orgId), "org_id", orgId) |
||||||
|
.notIn(staffList != null, "user_id", staffUserIds) |
||||||
|
.orderByAsc("name") |
||||||
|
); |
||||||
|
return R.ok(userList); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/staff_list") |
||||||
|
public R<List<Staff>> getStaffList(@RequestParam("name") String name) { |
||||||
|
|
||||||
|
System.out.println(String.format("getStaffList(), name=%s", name)); |
||||||
|
|
||||||
|
List<Staff> staffs = userService.getStaffList(Wrappers.<Staff>query() |
||||||
|
.like(StrUtil.isNotBlank(name), "u.name", name) |
||||||
|
.orderByAsc("u.name") |
||||||
|
); |
||||||
|
return R.ok(staffs); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询对指定的机构拥有某些权限的用户列表。 |
||||||
|
* <p> |
||||||
|
* 还可以通过 includeSubOrg, 对用户进行筛选。 |
||||||
|
* includeSubOrg 为 true 时, 如果指定机构是某用户所属机构的下属机构时该用户有效; |
||||||
|
* includeSubOrg 为 false 时, 只有当指定机构是某用户所属机构时该用户有效; |
||||||
|
* |
||||||
|
* @param orgId 机构 id |
||||||
|
* param includeSubOrg 是否包含子机构 |
||||||
|
* @param permissions 权限集合 |
||||||
|
* @return 用户列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/bypermissions") |
||||||
|
public R<List<SysUser>> GetUsersByPermission(@RequestParam("orgId") String orgId, @RequestParam("permissions") List<String> permissions) { |
||||||
|
//rolePermissionService
|
||||||
|
return R.ok(userService.listUsersByPermission(orgId, false, permissions)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询对指定的机构拥有某些权限的用户列表。 |
||||||
|
* <p> |
||||||
|
* 还可以通过 includeSubOrg, 对用户进行筛选。 |
||||||
|
* includeSubOrg 为 true 时, 如果指定机构是某用户所属机构的下属机构时该用户有效; |
||||||
|
* includeSubOrg 为 false 时, 只有当指定机构是某用户所属机构时该用户有效; |
||||||
|
* |
||||||
|
* @param orgId 机构 id |
||||||
|
* param includeSubOrg 是否包含子机构 |
||||||
|
* @param permissions 权限集合 |
||||||
|
* @return 用户列表 |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@GetMapping("/inner_bypermissions") |
||||||
|
public R<List<SysUser>> innerGetUsersByPermission(@RequestParam("orgId") String orgId, @RequestParam("permissions") List<String> permissions) { |
||||||
|
return R.ok(userService.listUsersByPermission(orgId, false, permissions)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 审核注册的用户,注册用户是需要管理员审核才能启用 |
||||||
|
* |
||||||
|
* @param userId |
||||||
|
* @param op_code |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperation(value = "审核用户", notes = "新注册的用户需要审核才可使用\n") |
||||||
|
@PutMapping("/reviewUser") |
||||||
|
public R reviewRegisterUser(@RequestParam("userId") String userId, @RequestParam("op_code") boolean op_code) throws Exception { |
||||||
|
if (StrUtil.isBlank(userId) || userId == null) { |
||||||
|
throw new Exception("用户ID不能为空"); |
||||||
|
} |
||||||
|
return R.ok(userService.reviewUser(userId, op_code)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改个人信息 |
||||||
|
* |
||||||
|
* @param userDto userDto |
||||||
|
* @return success/false |
||||||
|
*/ |
||||||
|
@SysLog("修改个人信息") |
||||||
|
@PutMapping("/edit") |
||||||
|
public R putCurrentUserInfoUpdate(@Valid @RequestBody UserDTO userDto) { |
||||||
|
return R.ok(userService.updateUserInfo(userDto)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param username 用户名称 |
||||||
|
* @return 上级机构用户列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/ancestor/{username}") |
||||||
|
public R getAncestorUserListByUsername(@PathVariable String username) { |
||||||
|
return R.ok(userService.listAncestorUsersByUsername(username)); |
||||||
|
} |
||||||
|
|
||||||
|
//==================================================================================================================
|
||||||
|
// 以下是管理员使用的接口
|
||||||
|
// 这些提供给管理员使用, 处理的数据不是管理员这个用户本身的数据, 而是其他用户的数据
|
||||||
|
//==================================================================================================================
|
||||||
|
|
||||||
|
//==================================================================================================================
|
||||||
|
// 以下是内部使用的接口
|
||||||
|
//==================================================================================================================
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过 ID 查询用户信息 |
||||||
|
* |
||||||
|
* @param id ID |
||||||
|
* @return 用户信息 |
||||||
|
*/ |
||||||
|
@Inner |
||||||
|
@GetMapping("/inner_get_by_id/{id}") |
||||||
|
public R<SysUser> innerGetById(@PathVariable String id) { |
||||||
|
return R.ok(userService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据部门名称和是否是部门领导查询用户信息 |
||||||
|
* |
||||||
|
* @param department |
||||||
|
* @param deptHeader |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/by_department_and_dept_header") |
||||||
|
public R<List<SysUser>> getUserInfoByDepartmentAndDeptHeader(@RequestParam("department") String department, |
||||||
|
@RequestParam("deptHeader") Integer deptHeader) { |
||||||
|
|
||||||
|
if (StrUtil.isBlank(department)) { |
||||||
|
throw new RuntimeException("部门不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
if (deptHeader == null) { |
||||||
|
throw new RuntimeException("是否部门领导不能为空"); |
||||||
|
} |
||||||
|
|
||||||
|
List<SysUser> sysUserList = userService.list( |
||||||
|
Wrappers.<SysUser>query() |
||||||
|
.eq("department", department.trim()) // 防止参数传递过来时有空格
|
||||||
|
.eq("dept_header", deptHeader)); // 是否部门领导: 0=不是, 1=正职领导, 2=副职领导
|
||||||
|
|
||||||
|
return R.ok(sysUserList); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================================
|
||||||
|
// 以下是测试使用的接口
|
||||||
|
//==================================================================================================================
|
||||||
|
|
||||||
|
// 测试, 创建 100 个案件
|
||||||
|
@GetMapping("/create100") |
||||||
|
public R xxx_TestCreate100() { |
||||||
|
for (int i = 0; i < 100; i++) { |
||||||
|
SysUser user = new SysUser(); |
||||||
|
|
||||||
|
user.setUserId(IdWorker.get32UUID().toUpperCase()); |
||||||
|
user.setUsername(RandomUtil.randomString(RandomUtil.randomInt(4, 10))); |
||||||
|
user.setEnabled(true); |
||||||
|
user.setPassword("$2a$10$Q/8pJPrJLzCSMup8akH3y.Nxra4H/jGdBQTNDyl70W5Rz8EatLtmO"); |
||||||
|
user.setPoliceType(RandomUtil.randomInt(0, 2)); |
||||||
|
user.setPoliceNo(RandomUtil.randomNumbers(8)); |
||||||
|
user.setNativePlace(TestUtils.genAddress(i)); |
||||||
|
|
||||||
|
//当前时间字符串, 格式: yyyy-MM-dd HH:mm:ss
|
||||||
|
String now = DateUtil.now(); |
||||||
|
//当前日期字符串, 格式: yyyy-MM-dd
|
||||||
|
String today = DateUtil.today(); |
||||||
|
user.setName("测试用户-" + today + "-" + String.format("%d", i)); |
||||||
|
user.setFormerName("测试用户曾用名-" + today + "-" + String.format("%d", i)); |
||||||
|
|
||||||
|
user.setGender(RandomUtil.randomInt(2)); |
||||||
|
user.setNation(TestUtils.genNation()); |
||||||
|
user.setMaritalStatus(TestUtils.genMaritalStatus()); |
||||||
|
user.setMilitaryServiceStatus(TestUtils.genMilitaryServiceStatus()); |
||||||
|
user.setEducationalLevel(TestUtils.genEducationalLevel()); |
||||||
|
user.setBirthPlace(TestUtils.genAddress(i)); |
||||||
|
user.setCertificateType(TestUtils.genCertificateType()); |
||||||
|
user.setCertificateNo(RandomUtil.randomNumbers(18)); |
||||||
|
user.setIdentificationCardNo(RandomUtil.randomNumbers(18)); |
||||||
|
user.setMobile(TestUtils.genMobile()); |
||||||
|
user.setEmail(RandomUtil.randomStringUpper(10) + "@" + RandomUtil.randomStringUpper(10) + ".COM"); |
||||||
|
user.setAddress(TestUtils.genAddress(i)); |
||||||
|
|
||||||
|
user.setPosition(TestUtils.genPosition()); |
||||||
|
|
||||||
|
userService.save(user); |
||||||
|
} |
||||||
|
return R.ok("已经创建 100 个用户"); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/del/signature/{userId}") |
||||||
|
@ApiOperation(value = "删除电子签名",notes = "通过传入用户ID,直接删除该用户电子签名数据") |
||||||
|
public R deleteSignature(@PathVariable String userId) { |
||||||
|
SysUser user = userService.getById(userId); |
||||||
|
if (user == null) { |
||||||
|
throw new RuntimeException(String.format("未能查到ID为:" + userId + "的用户信息")); |
||||||
|
} |
||||||
|
user.setSignature(""); |
||||||
|
return userService.updateById(user) ? R.ok("删除成功") : R.failed("删除失败"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package digital.laboratory.platform.sys.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 digital.laboratory.platform.common.mybatis.base.BaseEntity; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank; |
||||||
|
import javax.validation.constraints.NotNull; |
||||||
|
|
||||||
|
/** |
||||||
|
* 委托送检中案情简要等内容的模板信息表 |
||||||
|
* @TableName b_entrust_template_info |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@TableName(value ="b_entrust_template_info") |
||||||
|
@ApiModel(value = "EntrustTemplateInfo", description = "委托送检中案情简要等内容的模板信息表") |
||||||
|
public class EntrustTemplateInfo extends BaseEntity { |
||||||
|
/** |
||||||
|
* 主键id |
||||||
|
*/ |
||||||
|
@ApiModelProperty("id主键") |
||||||
|
@TableId(value = "ID", type = IdType.ASSIGN_ID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 模板名称 |
||||||
|
*/ |
||||||
|
@ApiModelProperty("模板名称") |
||||||
|
@NotBlank(message = "模板名称不能为空!") |
||||||
|
private String templateName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 模板内容 |
||||||
|
*/ |
||||||
|
@ApiModelProperty("模板内容") |
||||||
|
@NotBlank(message = "模板内容不能为空!") |
||||||
|
private String templateContent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 模板类型,比如:0 - 案情简要 |
||||||
|
*/ |
||||||
|
@ApiModelProperty("模板类型,比如:0 - 案情简要") |
||||||
|
@NotNull(message = "模板类型不能为空!") |
||||||
|
private Integer templateType; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package digital.laboratory.platform.sys.enums; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
public enum TemplateTypeEnums { |
||||||
|
|
||||||
|
TEMPLATE_CASE_BRIEF(0, "案情简要模板"), |
||||||
|
; |
||||||
|
|
||||||
|
|
||||||
|
private final Integer code; |
||||||
|
|
||||||
|
private final String desc; |
||||||
|
|
||||||
|
TemplateTypeEnums(Integer code, String desc) { |
||||||
|
this.code = code; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
// 根据名称获取状态值
|
||||||
|
public static TemplateTypeEnums fromCode(Integer code) { |
||||||
|
for (TemplateTypeEnums entrustAlterApplyStatus : values()) { |
||||||
|
if (entrustAlterApplyStatus.getCode().equals(code)) { |
||||||
|
return entrustAlterApplyStatus; |
||||||
|
} |
||||||
|
} |
||||||
|
throw new IllegalArgumentException("No enum constant with code: " + code); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.Area; |
||||||
|
import digital.laboratory.platform.sys.vo.AreaVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 省/地/县 3级行政区划 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong |
||||||
|
* @since 2022-03-10 09:45:58 |
||||||
|
* @describe 省/地/县 3级行政区划mapper类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface AreaMapper extends BaseMapper<Area> { |
||||||
|
List<AreaVO> listAreaVO(@Param(Constants.WRAPPER) QueryWrapper<Area> qw); |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.BusinessDepartment; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 鉴定中心的业务部门设置 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 鉴定中心的业务部门设置 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface BusinessDepartmentMapper extends BaseMapper<BusinessDepartment> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.Business; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface BusinessMapper extends BaseMapper<Business> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.BusinessRDepartment; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 业务与专业检验室的关系 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 业务与专业检验室的关系 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface BusinessRDepartmentMapper extends BaseMapper<BusinessRDepartment> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.CaseType; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 案件类型编码表 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-07 |
||||||
|
* @describe 案件类型编码表 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CaseTypeMapper extends BaseMapper<CaseType> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sewage.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.common.entity.CriminalType; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 犯罪类型编码表 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-07 |
||||||
|
* @describe 犯罪类型编码表 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CriminalTypeMapper extends BaseMapper<CriminalType> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.Deliverer; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 送检员 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-08-16 |
||||||
|
* @describe 送检员 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DelivererMapper extends BaseMapper<Deliverer> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.Dictionary; |
||||||
|
import digital.laboratory.platform.sys.vo.DictionaryVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 字典表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author zhangxl |
||||||
|
* @since 2021-12-28 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DictionaryMapper extends BaseMapper<Dictionary> { |
||||||
|
|
||||||
|
//List<Dictionary> listByType(String type);
|
||||||
|
|
||||||
|
List<Dictionary> listTypes(String module); |
||||||
|
|
||||||
|
List<DictionaryVO> listDictionaryVO(@Param(Constants.WRAPPER) QueryWrapper<Dictionary> qw); |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.Drug; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品清单 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品清单 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DrugMapper extends BaseMapper<Drug> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugRType; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品-类型关系映射表 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品-类型关系映射表 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DrugRTypeMapper extends BaseMapper<DrugRType> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugType; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品分类 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品分类 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DrugTypeMapper extends BaseMapper<DrugType> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.EntrustTemplateInfo; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author ChenJiangBao |
||||||
|
* @description 针对表【b_entrust_template_info(委托送检中案情简要等内容的模板信息表)】的数据库操作Mapper |
||||||
|
* @createDate 2025-01-08 14:12:41 |
||||||
|
* @Entity digital.laboratory.platform.entrustment.entity.EntrustTemplateInfo |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface EntrustTemplateInfoMapper extends BaseMapper<EntrustTemplateInfo> { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,25 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.Message; |
||||||
|
import digital.laboratory.platform.sys.vo.MessageVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 消息 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2023-02-02 |
||||||
|
* @describe 消息 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface MessageMapper extends BaseMapper<Message> { |
||||||
|
IPage<MessageVO> getMessageVOPage(@Param("page") IPage<Message> page, @Param(Constants.WRAPPER) QueryWrapper<Message> qw); |
||||||
|
List<MessageVO> getMessageVOList(@Param(Constants.WRAPPER) QueryWrapper<Message> qw); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.PersonalIdentityVerifier; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 智能身份识别终端配置 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2023-02-22 |
||||||
|
* @describe 智能身份识别终端配置 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface PersonalIdentityVerifierMapper extends BaseMapper<PersonalIdentityVerifier> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.PartialStaff; |
||||||
|
import digital.laboratory.platform.sys.vo.Staff; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 鉴定中心员工, 这是用户名的扩充表 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-12 |
||||||
|
* @describe 鉴定中心员工, 这是用户名的扩充表 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface StaffMapper extends BaseMapper<PartialStaff> { |
||||||
|
IPage<Staff> getStaffVOPage(@Param("page") IPage<Staff> page, @Param(Constants.WRAPPER) QueryWrapper<Staff> qw); |
||||||
|
List<Staff> getStaffVOList(@Param(Constants.WRAPPER) QueryWrapper<Staff> qw); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.StaffRDepartment; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工与业务室的关系 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 员工与业务室的关系 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface StaffRDepartmentMapper extends BaseMapper<StaffRDepartment> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.StaffTrainingPlan; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工培训计划 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-12 |
||||||
|
* @describe 员工培训计划 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface StaffTrainingPlanMapper extends BaseMapper<StaffTrainingPlan> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.StaffTrainingRecord; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工培训记录 Mapper 接口 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 员工培训记录 Mapper 类 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface StaffTrainingRecordMapper extends BaseMapper<StaffTrainingRecord> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysFile; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件管理 |
||||||
|
* |
||||||
|
* @author Luckly |
||||||
|
* @date 2019-06-18 17:18:42 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysFileMapper extends BaseMapper<SysFile> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysLog; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 日志表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysLogMapper extends BaseMapper<SysLog> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysMenu; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 菜单权限表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysMenuMapper extends BaseMapper<SysMenu> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过岗位编号查询菜单 |
||||||
|
* @param roleIds 岗位ID |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Set<SysMenu> listMenusByRoleId(List<String> roleIds); |
||||||
|
|
||||||
|
Set<SysMenu> listMenusByUserId(String userId); |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysOauthClientDetails; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysOauthClientDetailsMapper extends BaseMapper<SysOauthClientDetails> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.SysOrg; |
||||||
|
import digital.laboratory.platform.sys.vo.OrgVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 机构管理 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysOrgMapper extends BaseMapper<SysOrg> { |
||||||
|
List<OrgVO> listOrgVO(@Param(Constants.WRAPPER) QueryWrapper<SysOrg> qw); |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.entity.SysPermission; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 权限权限表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysPermissionMapper extends BaseMapper<SysPermission> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过岗位 roleIds 查询权限 |
||||||
|
* @param roleIds 岗位ID |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Set<SysPermission> listPermissionsByRoleId(List<String> roleIds); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2025, lengleng All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the pig4cloud.com developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: lengleng (wangiegie@gmail.com) |
||||||
|
*/ |
||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.PublicParam; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 公共参数配置 |
||||||
|
* |
||||||
|
* @author Lucky |
||||||
|
* @date 2019-04-29 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysPublicParamMapper extends BaseMapper<PublicParam> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.entity.SysUserRole; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysRole; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface SysRoleMapper extends BaseMapper<SysRole> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过用户ID, 查询岗位信息 |
||||||
|
* @param userId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<SysRole> listRolesByUserId(String userId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过权限查询岗位 |
||||||
|
* @param permission 岗位ID |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Set<SysUserRole> listUserRolesByPermission(@Param("userId")String userId, @Param("permission")String permission); |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sewage.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sewage.entity.SysRoleMenu; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 岗位菜单表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.entity.SysRolePermission; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 岗位权限表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysRolePermissionMapper extends BaseMapper<SysRolePermission> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.SysRoleType; |
||||||
|
import digital.laboratory.platform.sys.vo.SysRoleTypeVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface SysRoleTypeMapper extends BaseMapper<SysRoleType> { |
||||||
|
|
||||||
|
SysRoleTypeVO getSysRoleType(String id); |
||||||
|
|
||||||
|
List<SysRoleTypeVO> getSysRoleTypeList(@Param(Constants.WRAPPER)QueryWrapper qw); |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUser; |
||||||
|
import digital.laboratory.platform.sys.vo.Staff; |
||||||
|
import digital.laboratory.platform.sys.vo.UserVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 用户表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysUserMapper extends BaseMapper<SysUser> { |
||||||
|
|
||||||
|
// SysUser getUserByUsername(String username); // xxx
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过用户名查询用户信息(含有岗位信息) |
||||||
|
* |
||||||
|
* @param username 用户名 |
||||||
|
* |
||||||
|
* @return userVo |
||||||
|
*/ |
||||||
|
UserVO getUserVoByUsername(String username); |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询用户信息(含岗位) |
||||||
|
* |
||||||
|
* @param page 分页 |
||||||
|
* @param qw 查询参数 |
||||||
|
* |
||||||
|
* @return list |
||||||
|
*/ |
||||||
|
IPage<List<UserVO>> getUserVosPage(Page page, @Param(Constants.WRAPPER) QueryWrapper<UserVO> qw); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID查询用户信息 |
||||||
|
* |
||||||
|
* @param id 用户ID |
||||||
|
* |
||||||
|
* @return userVo |
||||||
|
*/ |
||||||
|
UserVO getUserVoById(String id); |
||||||
|
|
||||||
|
|
||||||
|
//List<UserVO> selectVoList(@Param("query") UserDTO userDTO);
|
||||||
|
|
||||||
|
List<SysUser> listAllUsersByPermission(@Param("permissions") List<String> permissions); |
||||||
|
|
||||||
|
List<Staff> getStaffList(@Param(Constants.WRAPPER) QueryWrapper<Staff> qw); |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package digital.laboratory.platform.sys.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUserRole; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 用户岗位表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据用户Id删除该用户的岗位关系 |
||||||
|
* @param userId 用户ID |
||||||
|
* @return boolean |
||||||
|
* @author 寻欢·李 |
||||||
|
* @date 2017年12月7日 16:31:38 |
||||||
|
*/ |
||||||
|
Boolean deleteByUserId(@Param("userId") String userId); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package digital.laboratory.platform.sys.query; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.time.LocalDate; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ApiModel(value = "BaseQuery", description = "基础查询对象") |
||||||
|
public class BaseQuery { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "分页参数,每页多少条, 默认10") |
||||||
|
private Long size = 10L; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "分页参数, 当前页, 默认1") |
||||||
|
private Long current = 1L; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "关键字,支持 案件名称查询") |
||||||
|
private String keywords; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始日期") |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||||
|
private LocalDate startDate; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束日期") |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||||
|
private LocalDate endDate; |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package digital.laboratory.platform.sys.query; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* 申请修改委托消息 查询对象(分页查询、列表查询) |
||||||
|
* |
||||||
|
* @author Chen |
||||||
|
* @since 1.0.0 2024-08-14 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ApiModel(description = "申请修改委托消息 查询对象(分页查询、列表查询)") |
||||||
|
public class EntrustTemplateInfoQuery extends BaseQuery { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板类型") |
||||||
|
private Integer type; |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lengleng |
||||||
|
* @date 2018/11/14 |
||||||
|
*/ |
||||||
|
public interface AppService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送手机验证码 |
||||||
|
* @param mobile mobile |
||||||
|
* @return code |
||||||
|
*/ |
||||||
|
R<Boolean> sendSmsCode(String mobile); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.Area; |
||||||
|
import digital.laboratory.platform.sys.vo.AreaVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 省/地/县 3级行政区划 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong |
||||||
|
* @since 2022-03-10 09:45:58 |
||||||
|
* @describe 省/地/县 3级行政区划服务类 |
||||||
|
*/ |
||||||
|
public interface AreaService extends IService<Area> { |
||||||
|
/** |
||||||
|
* 获取所有的省份列表 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<Area> getProvinces(); |
||||||
|
List<AreaVO> listAreaVO(QueryWrapper<Area> qw); |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.BusinessDepartment; |
||||||
|
|
||||||
|
/** |
||||||
|
* 鉴定中心的业务部门设置服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 鉴定中心的业务部门设置 服务类 |
||||||
|
*/ |
||||||
|
public interface BusinessDepartmentService extends IService<BusinessDepartment> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.BusinessRDepartment; |
||||||
|
|
||||||
|
/** |
||||||
|
* 业务与专业检验室的关系服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 业务与专业检验室的关系 服务类 |
||||||
|
*/ |
||||||
|
public interface BusinessRDepartmentService extends IService<BusinessRDepartment> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.Business; |
||||||
|
|
||||||
|
/** |
||||||
|
* 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 业务分类,目前只有:司法鉴定、污水检测任务、先进性检测任务。数据中的id不能变,代码中会直接使用 服务类 |
||||||
|
*/ |
||||||
|
public interface BusinessService extends IService<Business> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.Deliverer; |
||||||
|
|
||||||
|
/** |
||||||
|
* 送检员服务类 |
||||||
|
* |
||||||
|
* @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); |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
|
||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.Dictionary; |
||||||
|
import digital.laboratory.platform.sys.vo.DictVueStoreVo; |
||||||
|
import digital.laboratory.platform.sys.vo.DictionaryVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 字典表 |
||||||
|
* |
||||||
|
* @author zhangxl |
||||||
|
* @date 2021-12-28 |
||||||
|
*/ |
||||||
|
public interface DictionaryService extends IService<Dictionary> { |
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 通过字典类型列出字典项
|
||||||
|
// * @param type
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// List<Dictionary> listByType(String type);
|
||||||
|
|
||||||
|
List<Tree<String>> treeDictionary(String parentId); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
List<Tree<String>> getTreeParentDictionary(); |
||||||
|
/** |
||||||
|
* 返回全部类型, 去重 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<Dictionary> listTypes(String module); |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加字典 |
||||||
|
* @param dictionary |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean addDictionary(Dictionary dictionary); |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据ID 删除字典 |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
void removeDictionary(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新字典 |
||||||
|
* @param sysDirectory 字典 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
void updateDictionary(Dictionary sysDirectory); |
||||||
|
|
||||||
|
List<DictionaryVO> listDictionaryVO(QueryWrapper<Dictionary> qw); |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加第三方字典数据 |
||||||
|
*/ |
||||||
|
Dictionary addThirdPartyDictionary(String label, String id); |
||||||
|
/** |
||||||
|
* 删除数据字典 |
||||||
|
*/ |
||||||
|
Boolean deleteDictionary(String dictId); |
||||||
|
/** |
||||||
|
* 获取VUE Store 加载的时候,需要一次加载的字典 |
||||||
|
*/ |
||||||
|
List<DictVueStoreVo> getVueStoreLoadDictList(List<String> typeList); |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugRType; |
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品-类型关系映射表服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品-类型关系映射表服务类 |
||||||
|
*/ |
||||||
|
public interface DrugRTypeService extends IService<DrugRType> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
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.sys.entity.Drug; |
||||||
|
import digital.laboratory.platform.sys.vo.SuspiciousDrugVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品清单服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品清单服务类 |
||||||
|
*/ |
||||||
|
public interface DrugService extends IService<Drug> { |
||||||
|
|
||||||
|
//添加毒品筛查列表
|
||||||
|
public Boolean addDrug(Drug drug); |
||||||
|
//根据根节点查出这个类下有多少个毒品
|
||||||
|
int getDrugCountByRootId(String rootId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取所有顶层毒品类型的数据,以map的列表返回 |
||||||
|
* @param drugType |
||||||
|
* @param name |
||||||
|
* @param englishName |
||||||
|
* @param casCode |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<SuspiciousDrugVO> drugMapList(String drugType, String name, String englishName, String casCode); |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page |
||||||
|
* @param drug |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
IPage<Drug> getDrugPage(Page page, Drug drug); |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.DrugType; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 毒品分类服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-06-23 |
||||||
|
* @describe 毒品分类服务类 |
||||||
|
*/ |
||||||
|
public interface DrugTypeService extends IService<DrugType> { |
||||||
|
//获取树形结构的数据
|
||||||
|
List<Tree<String>> getDrugTypeTreeData(String pig); |
||||||
|
//新增一个类型
|
||||||
|
DrugType addDrugType(DrugType drugType); |
||||||
|
//根据类型ID,找出跟节点ID
|
||||||
|
String getRootID(String drugTypeId); |
||||||
|
//找出这个根的所有节点
|
||||||
|
List<String> getAllNodeByRootId(String rootId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 构建毒品类型的父子关系映射 |
||||||
|
*/ |
||||||
|
Map<String, List<String>> buildDrugTypeHierarchy(List<DrugType> allDrugTypes); |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.EntrustTemplateInfo; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author ChenJiangBao |
||||||
|
* @description 针对表【b_entrust_template_info(委托送检中案情简要等内容的模板信息表)】的数据库操作Service |
||||||
|
* @createDate 2025-01-08 14:12:41 |
||||||
|
*/ |
||||||
|
public interface EntrustTemplateInfoService extends IService<EntrustTemplateInfo> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
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.sys.entity.Message; |
||||||
|
import digital.laboratory.platform.sys.vo.MessageVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 消息服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2023-02-02 |
||||||
|
* @describe 消息 服务类 |
||||||
|
*/ |
||||||
|
public interface MessageService extends IService<Message> { |
||||||
|
|
||||||
|
Message getMessageById(String messageId, String ownerId); |
||||||
|
|
||||||
|
IPage<MessageVO> getMessagePage(Page<Message> page, String text, Boolean isread, String ownerId); |
||||||
|
|
||||||
|
List<MessageVO> getMessageList(String text, Boolean isread, String ownerId); |
||||||
|
|
||||||
|
boolean sendMessageToUser(String receiver, String text, String sender); |
||||||
|
|
||||||
|
boolean sendMessage(String orgId, boolean includeSubOrg, List<String> permissions, String text, String sender); |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.PersonalIdentityVerifier; |
||||||
|
|
||||||
|
/** |
||||||
|
* 智能身份识别终端配置服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2023-02-21 |
||||||
|
* @describe 智能身份识别终端配置 服务类 |
||||||
|
*/ |
||||||
|
public interface PersonalIdentityVerifierService extends IService<PersonalIdentityVerifier> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2025, lengleng All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the pig4cloud.com developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: lengleng (wangiegie@gmail.com) |
||||||
|
*/ |
||||||
|
|
||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import digital.laboratory.platform.sys.entity.PublicParam; |
||||||
|
|
||||||
|
/** |
||||||
|
* 公共参数配置 |
||||||
|
* |
||||||
|
* @author Lucky |
||||||
|
* @date 2019-04-29 |
||||||
|
*/ |
||||||
|
public interface PublicParamService extends IService<PublicParam> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过key查询公共参数指定值 |
||||||
|
* @param publicKey |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
String getSysPublicParamKeyToValue(String publicKey); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新参数 |
||||||
|
* @param publicParam |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
R updateParam(PublicParam publicParam); |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除参数 |
||||||
|
* @param publicId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
R removeParam(Long publicId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 同步缓存 |
||||||
|
* @return R |
||||||
|
*/ |
||||||
|
R syncParamCache(); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.StaffRDepartment; |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工与业务室的关系服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 员工与业务室的关系 服务类 |
||||||
|
*/ |
||||||
|
public interface StaffRDepartmentService extends IService<StaffRDepartment> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package digital.laboratory.platform.sys.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.sys.entity.PartialStaff; |
||||||
|
import digital.laboratory.platform.sys.vo.Staff; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 鉴定中心员工, 这是用户名的扩充表服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-12 |
||||||
|
* @describe 鉴定中心员工, 这是用户名的扩充表服务类 |
||||||
|
*/ |
||||||
|
public interface StaffService extends IService<PartialStaff> { |
||||||
|
IPage<Staff> getStaffVOPage(IPage<Staff> page, QueryWrapper<Staff> qw); |
||||||
|
List<Staff> getStaffVOList(QueryWrapper<Staff> qw); |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.StaffTrainingPlan; |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工培训计划服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-04-12 |
||||||
|
* @describe 员工培训计划服务类 |
||||||
|
*/ |
||||||
|
public interface StaffTrainingPlanService extends IService<StaffTrainingPlan> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.StaffTrainingRecord; |
||||||
|
|
||||||
|
/** |
||||||
|
* 员工培训记录服务类 |
||||||
|
* |
||||||
|
* @author Zhang Xiaolong created at 2022-07-15 |
||||||
|
* @describe 员工培训记录 服务类 |
||||||
|
*/ |
||||||
|
public interface StaffTrainingRecordService extends IService<StaffTrainingRecord> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.SysFile; |
||||||
|
import digital.laboratory.platform.common.core.util.R; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文件管理 |
||||||
|
* |
||||||
|
* @author Luckly |
||||||
|
* @date 2019-06-18 17:18:42 |
||||||
|
*/ |
||||||
|
public interface SysFileService extends IService<SysFile> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 上传文件 |
||||||
|
* @param file |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
R uploadFile(MultipartFile file); |
||||||
|
|
||||||
|
/** |
||||||
|
* 读取文件 |
||||||
|
* @param bucket 桶名称 |
||||||
|
* @param fileName 文件名称 |
||||||
|
* @param response 输出流 |
||||||
|
*/ |
||||||
|
void getFile(String bucket, String fileName, HttpServletResponse response); |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除文件 |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean deleteFile(String id); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.dto.SysLogDTO; |
||||||
|
import digital.laboratory.platform.sys.entity.SysLog; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 日志表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysLogService extends IService<SysLog> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询日志 |
||||||
|
* @param page |
||||||
|
* @param sysLog |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Page<SysLog> getLogByPage(Page page, SysLogDTO sysLog); |
||||||
|
|
||||||
|
/** |
||||||
|
* 列表查询日志 |
||||||
|
* @param sysLog 查询条件 |
||||||
|
* @return List |
||||||
|
*/ |
||||||
|
List<SysLog> getLogList(SysLogDTO sysLog); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.SysMenu; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 菜单权限表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysMenuService extends IService<SysMenu> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过岗位编号查询URL 权限 |
||||||
|
* @param roleIds 岗位ID |
||||||
|
* @return 菜单列表 |
||||||
|
*/ |
||||||
|
Set<SysMenu> findMenuByRoleIds(List<String> roleIds); |
||||||
|
|
||||||
|
Set<SysMenu> findMenuByUserId(String userId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 级联删除菜单 |
||||||
|
* @param id 菜单ID |
||||||
|
* @return true成功, false失败 |
||||||
|
*/ |
||||||
|
Boolean removeMenuById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新菜单信息 |
||||||
|
* @param sysMenu 菜单信息 |
||||||
|
* @return 成功、失败 |
||||||
|
*/ |
||||||
|
Boolean updateMenuById(SysMenu sysMenu); |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据菜单标识构建树 |
||||||
|
* @param menu 菜单标识 |
||||||
|
* @return 菜单树 |
||||||
|
*/ |
||||||
|
List<Tree<String>> treeMenuByMenu(String menu); |
||||||
|
|
||||||
|
/** |
||||||
|
* 构建树 |
||||||
|
* @param lazy 是否是懒加载 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 菜单树 |
||||||
|
*/ |
||||||
|
List<Tree<String>> treeMenuByParentId(boolean lazy, String parentId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询菜单 |
||||||
|
* @param menuSet |
||||||
|
* @param parentId |
||||||
|
* @return 菜单树 |
||||||
|
*/ |
||||||
|
List<Tree<String>> filterMenu(Set<SysMenu> menuSet, String parentId); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.SysOauthClientDetails; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysOauthClientDetailsService extends IService<SysOauthClientDetails> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过ID删除客户端 |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean removeClientDetailsById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据客户端信息 |
||||||
|
* @param sysOauthClientDetails |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean updateClientDetailsById(SysOauthClientDetails sysOauthClientDetails); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,117 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.Area; |
||||||
|
import digital.laboratory.platform.sys.entity.SysOrg; |
||||||
|
import digital.laboratory.platform.sys.vo.OrgVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 机构管理 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysOrgService extends IService<SysOrg> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询机构树 |
||||||
|
* @return 树 |
||||||
|
*/ |
||||||
|
List<Tree<String>> listAllOrgTree(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询用户机构树, 单根树, 树为用户所属机构 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Tree<String> listCurrentUserOrgTree(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询用户机构树, 多根树, 去除用户所属机构后的各个分支 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<Tree<String>> listCurrentUserOrgTrees(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回子机构列表, 不含隔代的后裔 |
||||||
|
* @param orgId 机构id |
||||||
|
* @return List<String> |
||||||
|
*/ |
||||||
|
List<SysOrg> getSubOrg(String orgId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 列举指定机构的祖先和后裔树 |
||||||
|
* 从指定节点开始, 向下是所属的全部机构, 向上是其父节点, 一直回溯到根 |
||||||
|
* @param orgId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public List<Tree<String>> getAncestorsAndDescendantsOrgTree(String orgId); // 列举指定机构的祖先和后裔树
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询当前用户可代表的机构树 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<Tree<String>> getCurrentUserCanRepresentOrgTree(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加信息机构 |
||||||
|
* @param sysOrg |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean addOrg(SysOrg sysOrg); |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除机构 |
||||||
|
* @param id 机构 ID |
||||||
|
* @return 成功、失败 |
||||||
|
*/ |
||||||
|
Boolean removeOrgById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新机构 |
||||||
|
* @param sysOrg 机构信息 |
||||||
|
* @return 成功、失败 |
||||||
|
*/ |
||||||
|
Boolean updateOrgById(SysOrg sysOrg); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查找指定机构的子机构id列表 |
||||||
|
* @param orgId 机构id |
||||||
|
* @return List<String> |
||||||
|
*/ |
||||||
|
List<SysOrg> getDescendantList(String orgId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查找指定机构的子机构列表 |
||||||
|
* @param orgId 机构id |
||||||
|
* @return List<SysOrg> |
||||||
|
*/ |
||||||
|
public List<Tree<String>> listDescendantTree(String orgId); |
||||||
|
|
||||||
|
List<OrgVO> listAreaVO(QueryWrapper<SysOrg> qw); |
||||||
|
|
||||||
|
/** |
||||||
|
* 检查机构是否已经存在,如果存在返回true,不存在返回false |
||||||
|
* @param orgName |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean checkOrgNameExist(String orgName); |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据机构id返回机构树 |
||||||
|
* @param orgId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Tree<String> listOrgTreeByOrgId(String orgId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 仅提供内部服务使用接口 |
||||||
|
* 根据机构id获取机构的地址省市 |
||||||
|
*/ |
||||||
|
List<Area> fetchProvinceCityInfoByOrgId(String orgId); |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree; |
||||||
|
import digital.laboratory.platform.sys.entity.SysPermission; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 权限权限表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysPermissionService extends IService<SysPermission> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过岗位 roleIds 查询URL 权限 |
||||||
|
* @param roleIds 岗位IDs |
||||||
|
* @return 权限列表 |
||||||
|
*/ |
||||||
|
Set<SysPermission> findPermissionByRoleId(List<String> roleIds); |
||||||
|
|
||||||
|
/** |
||||||
|
* 级联删除权限 |
||||||
|
* @param id 权限ID |
||||||
|
* @return true成功, false失败 |
||||||
|
*/ |
||||||
|
Boolean removePermissionById(String id); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新权限信息 |
||||||
|
* @param sysPermission 权限信息 |
||||||
|
* @return 成功、失败 |
||||||
|
*/ |
||||||
|
Boolean updatePermissionById(SysPermission sysPermission); |
||||||
|
|
||||||
|
/** |
||||||
|
* 构建树 |
||||||
|
* @param lazy 是否是懒加载 |
||||||
|
* @param parentId 父节点ID |
||||||
|
* @return 权限树 |
||||||
|
*/ |
||||||
|
List<Tree<String>> treePermission(boolean lazy, String parentId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询权限 |
||||||
|
* @param permissionSet |
||||||
|
* @param parentId |
||||||
|
* @return 权限树 |
||||||
|
*/ |
||||||
|
List<Tree<String>> filterPermission(Set<SysPermission> permissionSet, String parentId); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.entity.SysRolePermission; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 岗位权限表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysRolePermissionService extends IService<SysRolePermission> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新岗位权限 |
||||||
|
* @param role |
||||||
|
* @param roleId 岗位 |
||||||
|
* @param permissionIds 权限ID拼成的字符串, 每个id之间根据逗号分隔 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean saveRolePermissions(String roleId, String permissionIds); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.dto.SysRoleTypeDTO; |
||||||
|
import digital.laboratory.platform.sys.dto.SysRoleTypeUserDTO; |
||||||
|
import digital.laboratory.platform.sys.entity.SysUserRole; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.SysRole; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author lengleng |
||||||
|
* @since 2019/2/1 |
||||||
|
*/ |
||||||
|
public interface SysRoleService extends IService<SysRole> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过权限查询岗位 |
||||||
|
* @param permission 权限名 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public Set<SysUserRole> findUserRolesByPermission(String userId, String permission); |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过岗位ID, 删除岗位 |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
Boolean removeRoleById(String id); |
||||||
|
|
||||||
|
boolean addRoleType(SysRoleTypeDTO sysRoleTypeDTO); |
||||||
|
|
||||||
|
boolean removeRoleType(List<SysRole> sysRoleList); |
||||||
|
|
||||||
|
boolean addUserRoleType(SysRoleTypeUserDTO sysRoleTypeUserDTO); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package digital.laboratory.platform.sys.service; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import digital.laboratory.platform.sys.entity.SysRoleType; |
||||||
|
import digital.laboratory.platform.sys.vo.SysRoleTypeVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysRoleTypeService extends IService<SysRoleType> { |
||||||
|
SysRoleType addRoleType(SysRoleType sysRoleType); |
||||||
|
|
||||||
|
SysRoleType editRoleType(SysRoleType sysRoleType); |
||||||
|
|
||||||
|
boolean delSysRoleType(String id); |
||||||
|
|
||||||
|
SysRoleTypeVO getSysRoleType(String id); |
||||||
|
|
||||||
|
List<SysRoleTypeVO> getSysRoleTypeList(); |
||||||
|
|
||||||
|
List<Tree<String>> treeSysRoleType(String parentId); |
||||||
|
|
||||||
|
List<Tree<String>> getTreeParentSysRoleType(); |
||||||
|
|
||||||
|
//返回某个类型和他的后代
|
||||||
|
List<String> getTreeChild(String parentID); |
||||||
|
//新增岗位类别信息
|
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue