Compare commits
22 Commits
21cfba87ea
...
refactor/d
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bff858643 | |||
| 9c678c84bf | |||
| c9cefa3d33 | |||
| 62947ca5e8 | |||
| 7890c4d792 | |||
|
|
219ac30e28 | ||
|
|
ced5b0b09a | ||
| 5bcfadfd85 | |||
| 02b8eefc8d | |||
| 899b74ef27 | |||
| 25cef5dd15 | |||
| 13e0f68289 | |||
| b911a29167 | |||
| 32718378c9 | |||
| c6d94f5a14 | |||
| ed2daf6cfa | |||
| 83f8332cd9 | |||
| 3ea03e3c19 | |||
| d3f4b6a700 | |||
| e6b68bff8c | |||
| 89a78cb5cd | |||
| d7732e8e4a |
142
pom.xml
142
pom.xml
@@ -2,7 +2,7 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>zhyc</groupId>
|
<groupId>zhyc</groupId>
|
||||||
<artifactId>zhyc</artifactId>
|
<artifactId>zhyc</artifactId>
|
||||||
@@ -27,7 +27,14 @@
|
|||||||
<fastjson.version>2.0.53</fastjson.version>
|
<fastjson.version>2.0.53</fastjson.version>
|
||||||
<oshi.version>6.8.1</oshi.version>
|
<oshi.version>6.8.1</oshi.version>
|
||||||
<commons.io.version>2.19.0</commons.io.version>
|
<commons.io.version>2.19.0</commons.io.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<!-- 升级 POI 版本解决 AbstractMethodError -->
|
||||||
|
<poi.version>5.2.3</poi.version>
|
||||||
|
<!-- POI 相关依赖版本 -->
|
||||||
|
<commons-compress.version>1.26.2</commons-compress.version>
|
||||||
|
<xmlbeans.version>5.2.0</xmlbeans.version>
|
||||||
|
<commons-collections4.version>4.4</commons-collections4.version>
|
||||||
|
<curvesapi.version>1.08</curvesapi.version>
|
||||||
|
<commons-math3.version>3.6.1</commons-math3.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<!-- override dependency version -->
|
<!-- override dependency version -->
|
||||||
@@ -35,7 +42,6 @@
|
|||||||
<logback.version>1.2.13</logback.version>
|
<logback.version>1.2.13</logback.version>
|
||||||
<spring-security.version>5.7.12</spring-security.version>
|
<spring-security.version>5.7.12</spring-security.version>
|
||||||
<spring-framework.version>5.3.39</spring-framework.version>
|
<spring-framework.version>5.3.39</spring-framework.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
@@ -149,11 +155,80 @@
|
|||||||
<version>${commons.io.version}</version>
|
<version>${commons.io.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- excel工具 -->
|
<!-- Excel 工具依赖 - 解决 AbstractMethodError -->
|
||||||
|
<!-- 主要 POI 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>${poi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-ooxml</artifactId>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
<version>${poi.version}</version>
|
<version>${poi.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>stax</groupId>
|
||||||
|
<artifactId>stax-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- POI 相关依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-compress</artifactId>
|
||||||
|
<version>${commons-compress.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.xmlbeans</groupId>
|
||||||
|
<artifactId>xmlbeans</artifactId>
|
||||||
|
<version>${xmlbeans.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-collections4</artifactId>
|
||||||
|
<version>${commons-collections4.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.virtuald</groupId>
|
||||||
|
<artifactId>curvesapi</artifactId>
|
||||||
|
<version>${curvesapi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-math3</artifactId>
|
||||||
|
<version>${commons-math3.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 兼容性依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.16.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- velocity代码生成使用模板 -->
|
<!-- velocity代码生成使用模板 -->
|
||||||
@@ -176,6 +251,7 @@
|
|||||||
<artifactId>jjwt</artifactId>
|
<artifactId>jjwt</artifactId>
|
||||||
<version>${jwt.version}</version>
|
<version>${jwt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 验证码 -->
|
<!-- 验证码 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>pro.fessional</groupId>
|
<groupId>pro.fessional</groupId>
|
||||||
@@ -217,6 +293,7 @@
|
|||||||
<artifactId>zhyc-common</artifactId>
|
<artifactId>zhyc-common</artifactId>
|
||||||
<version>${zhyc.version}</version>
|
<version>${zhyc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>zhyc</groupId>
|
<groupId>zhyc</groupId>
|
||||||
<artifactId>zhyc-module</artifactId>
|
<artifactId>zhyc-module</artifactId>
|
||||||
@@ -235,6 +312,7 @@
|
|||||||
<module>zhyc-common</module>
|
<module>zhyc-common</module>
|
||||||
<module>zhyc-module</module>
|
<module>zhyc-module</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -250,6 +328,24 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<!-- 添加依赖分析插件,帮助解决冲突 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.1.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>analyze</id>
|
||||||
|
<goals>
|
||||||
|
<goal>analyze-only</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<failOnWarning>false</failOnWarning>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
@@ -262,6 +358,32 @@
|
|||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<!-- 添加阿里云 Spring Boot 仓库 -->
|
||||||
|
<repository>
|
||||||
|
<id>spring</id>
|
||||||
|
<name>Spring Repository</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/spring</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
|
||||||
|
<!-- 添加 Apache 仓库 -->
|
||||||
|
<repository>
|
||||||
|
<id>apache</id>
|
||||||
|
<name>Apache Repository</name>
|
||||||
|
<url>https://repository.apache.org/content/repositories/releases/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
@@ -276,6 +398,18 @@
|
|||||||
<enabled>false</enabled>
|
<enabled>false</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
|
|
||||||
|
<pluginRepository>
|
||||||
|
<id>spring</id>
|
||||||
|
<name>Spring Plugin Repository</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/spring-plugin</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
24
zhyc-admin/src/main/java/com/zhyc/Event/FarmLoginEvent.java
Normal file
24
zhyc-admin/src/main/java/com/zhyc/Event/FarmLoginEvent.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package com.zhyc.Event;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FarmLoginEvent {
|
||||||
|
|
||||||
|
private final String farmCode;
|
||||||
|
private final Long userId;
|
||||||
|
|
||||||
|
public FarmLoginEvent(String farmCode, Long userId) {
|
||||||
|
this.farmCode = farmCode;
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFarmCode() {
|
||||||
|
return farmCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.zhyc.Routing.Filter;
|
||||||
|
|
||||||
|
import com.zhyc.framework.config.routing.DataSourceKeys;
|
||||||
|
import com.zhyc.framework.datasource.DynamicDataSourceContextHolder;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.bytedeco.opencv.presets.opencv_core;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@Order(value = -100)
|
||||||
|
public class DataSourceRoutingFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||||
|
|
||||||
|
String uri = request.getRequestURI();
|
||||||
|
String username = request.getRemoteUser();
|
||||||
|
log.debug("username:{}",username);
|
||||||
|
try {
|
||||||
|
if (uri.startsWith("/app") || uri.startsWith("/base") || uri.startsWith("/biosafety") || uri.startsWith("/common")
|
||||||
|
|| uri.startsWith("/dairyProducts") || uri.startsWith("/enums") || uri.startsWith("/feed") || uri.startsWith("/frozen") || uri.startsWith("/produce")
|
||||||
|
|| uri.startsWith("sale") || uri.startsWith("/stock") || uri.startsWith("/work") || uri.startsWith("/sheepfold_management")) {
|
||||||
|
log.debug("业务请求 : BUSINESS : {}", uri);
|
||||||
|
if (username.equals("admin")) {
|
||||||
|
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.FARM_1);
|
||||||
|
}else if (username.equals("ry")) {
|
||||||
|
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.FARM_2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.debug("系统请求 : SYSTEM : {}", uri);
|
||||||
|
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.SYSTEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
} finally {
|
||||||
|
// 业务结束后清楚数据源-防止线程复用导致错误
|
||||||
|
DynamicDataSourceContextHolder.clearDataSourceType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
zhyc-admin/src/main/java/com/zhyc/web/mvc/MvcConfig.java
Normal file
17
zhyc-admin/src/main/java/com/zhyc/web/mvc/MvcConfig.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.zhyc.web.mvc;
|
||||||
|
|
||||||
|
import com.zhyc.Routing.Filter.DataSourceRoutingFilter;
|
||||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MvcConfig {
|
||||||
|
@Bean
|
||||||
|
public FilterRegistrationBean<DataSourceRoutingFilter> myFilter() {
|
||||||
|
FilterRegistrationBean<DataSourceRoutingFilter> registrationBean = new FilterRegistrationBean<>();
|
||||||
|
registrationBean.setFilter(new DataSourceRoutingFilter());
|
||||||
|
registrationBean.addUrlPatterns("/*");
|
||||||
|
return registrationBean;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,16 +9,19 @@ spring:
|
|||||||
# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# username: root
|
# username: root
|
||||||
# password: 123456
|
# password: 123456
|
||||||
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://118.182.97.76:3306/zhyc_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: zhyc
|
username: zhyc
|
||||||
password: yszh123
|
password: yszh123
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
farm01:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
enabled: false
|
url: jdbc:mysql://118.182.97.76:3306/zhyc_sheep01?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
url:
|
username: zhyc
|
||||||
username:
|
password: yszh123
|
||||||
password:
|
farm02:
|
||||||
|
url: jdbc:mysql://118.182.97.76:3306/zhyc_sheep02?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: zhyc
|
||||||
|
password: yszh123
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initialSize: 5
|
initialSize: 5
|
||||||
# 最小连接池数量
|
# 最小连接池数量
|
||||||
|
|||||||
@@ -118,6 +118,10 @@
|
|||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class AjaxResult extends HashMap<String, Object>
|
|||||||
return AjaxResult.success(msg, null);
|
return AjaxResult.success(msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功消息
|
* 返回成功消息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
@@ -19,7 +21,6 @@ import com.alibaba.druid.pool.DruidDataSource;
|
|||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||||
import com.alibaba.druid.util.Utils;
|
import com.alibaba.druid.util.Utils;
|
||||||
import com.zhyc.common.enums.DataSourceType;
|
|
||||||
import com.zhyc.common.utils.spring.SpringUtils;
|
import com.zhyc.common.utils.spring.SpringUtils;
|
||||||
import com.zhyc.framework.config.properties.DruidProperties;
|
import com.zhyc.framework.config.properties.DruidProperties;
|
||||||
import com.zhyc.framework.datasource.DynamicDataSource;
|
import com.zhyc.framework.datasource.DynamicDataSource;
|
||||||
@@ -30,12 +31,24 @@ import com.zhyc.framework.datasource.DynamicDataSource;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class DruidConfig
|
public class DruidConfig {
|
||||||
{
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConfigurationProperties("spring.datasource.druid.master")
|
@ConfigurationProperties("spring.datasource.druid.master")
|
||||||
public DataSource masterDataSource(DruidProperties druidProperties)
|
public DataSource masterDataSource(DruidProperties druidProperties) {
|
||||||
{
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
|
return druidProperties.dataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties("spring.datasource.druid.farm01")
|
||||||
|
public DataSource farm1DataSource(DruidProperties druidProperties) {
|
||||||
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
|
return druidProperties.dataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties("spring.datasource.druid.farm02")
|
||||||
|
public DataSource farm2DataSource(DruidProperties druidProperties) {
|
||||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
return druidProperties.dataSource(dataSource);
|
return druidProperties.dataSource(dataSource);
|
||||||
}
|
}
|
||||||
@@ -43,49 +56,49 @@ public class DruidConfig
|
|||||||
@Bean
|
@Bean
|
||||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
@ConfigurationProperties("spring.datasource.druid.slave")
|
||||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||||
public DataSource slaveDataSource(DruidProperties druidProperties)
|
public DataSource slaveDataSource(DruidProperties druidProperties) {
|
||||||
{
|
|
||||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
return druidProperties.dataSource(dataSource);
|
return druidProperties.dataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "dynamicDataSource")
|
@Bean(name = "dynamicDataSource")
|
||||||
@Primary
|
@Primary
|
||||||
public DynamicDataSource dataSource(DataSource masterDataSource)
|
public DataSource dynamicDataSource(
|
||||||
{
|
@Qualifier("masterDataSource") DataSource systemDataSource,
|
||||||
|
@Qualifier("farm1DataSource") DataSource farm1DataSource,
|
||||||
|
@Qualifier("farm2DataSource") DataSource farm2DataSource) {
|
||||||
|
|
||||||
|
// 存储数据源路由
|
||||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
targetDataSources.put("system", systemDataSource);
|
||||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
targetDataSources.put("farm01", farm1DataSource);
|
||||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
targetDataSources.put("farm02", farm2DataSource);
|
||||||
|
|
||||||
|
return new DynamicDataSource(systemDataSource, targetDataSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置数据源
|
* 设置数据源
|
||||||
*
|
*
|
||||||
* @param targetDataSources 备选数据源集合
|
* @param targetDataSources 备选数据源集合
|
||||||
* @param sourceName 数据源名称
|
* @param sourceName 数据源名称
|
||||||
* @param beanName bean名称
|
* @param beanName bean名称
|
||||||
*/
|
*/
|
||||||
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
|
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
DataSource dataSource = SpringUtils.getBean(beanName);
|
DataSource dataSource = SpringUtils.getBean(beanName);
|
||||||
targetDataSources.put(sourceName, dataSource);
|
targetDataSources.put(sourceName, dataSource);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去除监控页面底部的广告
|
* 去除监控页面底部的广告
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
||||||
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
|
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) {
|
||||||
{
|
|
||||||
// 获取web监控页面的参数
|
// 获取web监控页面的参数
|
||||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||||
// 提取common.js的配置路径
|
// 提取common.js的配置路径
|
||||||
@@ -93,16 +106,14 @@ public class DruidConfig
|
|||||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||||
final String filePath = "support/http/resources/js/common.js";
|
final String filePath = "support/http/resources/js/common.js";
|
||||||
// 创建filter进行过滤
|
// 创建filter进行过滤
|
||||||
Filter filter = new Filter()
|
Filter filter = new Filter() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
|
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException {
|
||||||
{
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
// 重置缓冲区,响应头不会被重置
|
// 重置缓冲区,响应头不会被重置
|
||||||
response.resetBuffer();
|
response.resetBuffer();
|
||||||
@@ -113,9 +124,9 @@ public class DruidConfig
|
|||||||
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
||||||
response.getWriter().write(text);
|
response.getWriter().write(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||||
|
|||||||
@@ -111,10 +111,12 @@ public class SecurityConfig
|
|||||||
.authorizeHttpRequests((requests) -> {
|
.authorizeHttpRequests((requests) -> {
|
||||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||||
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
requests.antMatchers("/app/**").permitAll()
|
||||||
|
.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||||
|
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated();
|
.anyRequest().authenticated();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.zhyc.framework.config.routing;
|
||||||
|
|
||||||
|
public interface DataSourceKeys {
|
||||||
|
String SYSTEM = "system";
|
||||||
|
String FARM_1 = "farm01";
|
||||||
|
String FARM_2 = "farm02";
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.framework.web.service;
|
package com.zhyc.framework.web.service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import com.zhyc.framework.datasource.DynamicDataSourceContextHolder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import com.zhyc.common.utils.SecurityUtils;
|
|||||||
import com.zhyc.framework.security.context.AuthenticationContextHolder;
|
import com.zhyc.framework.security.context.AuthenticationContextHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录密码方法
|
* 系统密码服务类,用于处理登录密码验证相关的业务逻辑,包括密码错误次数限制、账户锁定等功能
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@@ -31,7 +31,7 @@ public class SysPasswordService
|
|||||||
private int lockTime;
|
private int lockTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录账户密码错误次数缓存键名
|
* 构建登录账户密码错误次数缓存键名
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return 缓存键key
|
* @return 缓存键key
|
||||||
@@ -41,12 +41,21 @@ public class SysPasswordService
|
|||||||
return CacheConstants.PWD_ERR_CNT_KEY + username;
|
return CacheConstants.PWD_ERR_CNT_KEY + username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证用户登录信息,包括密码匹配验证和错误次数限制检查
|
||||||
|
*
|
||||||
|
* @param user 待验证的系统用户对象
|
||||||
|
* @throws UserPasswordRetryLimitExceedException 当密码错误次数超过限制时抛出异常
|
||||||
|
* @throws UserPasswordNotMatchException 当密码不匹配时抛出异常
|
||||||
|
*/
|
||||||
public void validate(SysUser user)
|
public void validate(SysUser user)
|
||||||
{
|
{
|
||||||
|
// 获取当前认证的用户名和密码
|
||||||
Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext();
|
Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext();
|
||||||
String username = usernamePasswordAuthenticationToken.getName();
|
String username = usernamePasswordAuthenticationToken.getName();
|
||||||
String password = usernamePasswordAuthenticationToken.getCredentials().toString();
|
String password = usernamePasswordAuthenticationToken.getCredentials().toString();
|
||||||
|
|
||||||
|
// 从Redis缓存中获取该用户的密码错误次数
|
||||||
Integer retryCount = redisCache.getCacheObject(getCacheKey(username));
|
Integer retryCount = redisCache.getCacheObject(getCacheKey(username));
|
||||||
|
|
||||||
if (retryCount == null)
|
if (retryCount == null)
|
||||||
@@ -54,28 +63,44 @@ public class SysPasswordService
|
|||||||
retryCount = 0;
|
retryCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查是否达到最大重试次数限制
|
||||||
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
|
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
|
||||||
{
|
{
|
||||||
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
|
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 验证密码是否匹配
|
||||||
if (!matches(user, password))
|
if (!matches(user, password))
|
||||||
{
|
{
|
||||||
|
// 密码不匹配时,增加错误次数并更新缓存
|
||||||
retryCount = retryCount + 1;
|
retryCount = retryCount + 1;
|
||||||
redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
||||||
throw new UserPasswordNotMatchException();
|
throw new UserPasswordNotMatchException();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// 密码匹配成功,清除登录记录缓存
|
||||||
clearLoginRecordCache(username);
|
clearLoginRecordCache(username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证原始密码与用户存储密码是否匹配
|
||||||
|
*
|
||||||
|
* @param user 系统用户对象
|
||||||
|
* @param rawPassword 原始密码字符串
|
||||||
|
* @return 密码匹配返回true,否则返回false
|
||||||
|
*/
|
||||||
public boolean matches(SysUser user, String rawPassword)
|
public boolean matches(SysUser user, String rawPassword)
|
||||||
{
|
{
|
||||||
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
|
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除指定登录名的登录记录缓存
|
||||||
|
*
|
||||||
|
* @param loginName 登录用户名
|
||||||
|
*/
|
||||||
public void clearLoginRecordCache(String loginName)
|
public void clearLoginRecordCache(String loginName)
|
||||||
{
|
{
|
||||||
if (redisCache.hasKey(getCacheKey(loginName)))
|
if (redisCache.hasKey(getCacheKey(loginName)))
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
|
|||||||
throw new ServiceException(MessageUtils.message("user.blocked"));
|
throw new ServiceException(MessageUtils.message("user.blocked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordService.validate(user);
|
// passwordService.validate(user);
|
||||||
|
|
||||||
return createLoginUser(user);
|
return createLoginUser(user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,52 @@
|
|||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Web 核心依赖(提供接口能力) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Tesseract-OCR Java 封装(无需手动操作命令行,简化开发) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.tess4j</groupId>
|
||||||
|
<artifactId>tess4j</artifactId>
|
||||||
|
<version>4.5.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 文件上传相关依赖(Spring Boot 内置,指定版本兼容) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 可选:lombok 简化实体类代码(无需手写 getter/setter) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot 测试核心依赖(包含 @SpringBootTest 等注解) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope> <!-- 仅在测试环境生效,不打包到生产环境,不可省略 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-test</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.zhyc.module.app.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.zhyc.module.app.domain.AppErrorLog;
|
||||||
|
import com.zhyc.module.app.service.IAppErrorLogService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App错误日志Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/error")
|
||||||
|
public class AppErrorLogController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IAppErrorLogService appErrorLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询App错误日志列表
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:app:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<AppErrorLog> list = appErrorLogService.selectAppErrorLogList(appErrorLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出App错误日志列表
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:app:export')")
|
||||||
|
@Log(title = "App错误日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
List<AppErrorLog> list = appErrorLogService.selectAppErrorLogList(appErrorLog);
|
||||||
|
ExcelUtil<AppErrorLog> util = new ExcelUtil<AppErrorLog>(AppErrorLog.class);
|
||||||
|
util.exportExcel(response, list, "App错误日志数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取App错误日志详细信息
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:app:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(appErrorLogService.selectAppErrorLogById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增App错误日志
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:app:add')")
|
||||||
|
@Log(title = "App错误日志", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
return toAjax(appErrorLogService.insertAppErrorLog(appErrorLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改App错误日志
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:app:edit')")
|
||||||
|
@Log(title = "App错误日志", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
return toAjax(appErrorLogService.updateAppErrorLog(appErrorLog));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除App错误日志
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:app:remove')")
|
||||||
|
@Log(title = "App错误日志", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(appErrorLogService.deleteAppErrorLogByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.zhyc.module.app.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.zhyc.module.app.domain.AppSettings;
|
||||||
|
import com.zhyc.module.app.service.IAppSettingsService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用设置Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/settings")
|
||||||
|
public class AppSettingsController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IAppSettingsService appSettingsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用设置列表
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:settings:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<AppSettings> list = appSettingsService.selectAppSettingsList(appSettings);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出应用设置列表
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:settings:export')")
|
||||||
|
@Log(title = "应用设置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, AppSettings appSettings)
|
||||||
|
{
|
||||||
|
List<AppSettings> list = appSettingsService.selectAppSettingsList(appSettings);
|
||||||
|
ExcelUtil<AppSettings> util = new ExcelUtil<AppSettings>(AppSettings.class);
|
||||||
|
util.exportExcel(response, list, "应用设置数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用设置详细信息
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:settings:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(appSettingsService.selectAppSettingsById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增应用设置
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:settings:add')")
|
||||||
|
@Log(title = "应用设置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody AppSettings appSettings)
|
||||||
|
{
|
||||||
|
return toAjax(appSettingsService.insertAppSettings(appSettings));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用设置
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:settings:edit')")
|
||||||
|
@Log(title = "应用设置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody AppSettings appSettings)
|
||||||
|
{
|
||||||
|
return toAjax(appSettingsService.updateAppSettings(appSettings));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用设置
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('app:settings:remove')")
|
||||||
|
@Log(title = "应用设置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(appSettingsService.deleteAppSettingsByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.zhyc.module.app.controller;
|
||||||
|
|
||||||
|
import com.zhyc.common.config.RuoYiConfig;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.module.app.util.OcrRecognizeUtil;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
//图片返回base64
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/image")
|
||||||
|
public class ImageController {
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult getImageBase64(String path) {
|
||||||
|
// 添加空值检查
|
||||||
|
if (path == null || path.trim().isEmpty()) {
|
||||||
|
return AjaxResult.error("路径不能为空");
|
||||||
|
}
|
||||||
|
path = path.replace("/profile", "");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 构建完整的文件路径
|
||||||
|
String fullPath = RuoYiConfig.getProfile() + path;
|
||||||
|
|
||||||
|
// 读取文件并转换为字节数组
|
||||||
|
byte[] fileBytes = java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(fullPath));
|
||||||
|
|
||||||
|
// 将字节数组转换为base64字符串
|
||||||
|
String base64String = java.util.Base64.getEncoder().encodeToString(fileBytes);
|
||||||
|
|
||||||
|
// 获取文件扩展名以确定MIME类型
|
||||||
|
String mimeType = getMimeType(path);
|
||||||
|
|
||||||
|
// 返回base64数据,格式为 data:image/xxx;base64,xxxxx
|
||||||
|
String result = "data:" + mimeType + ";base64," + base64String;
|
||||||
|
|
||||||
|
return AjaxResult.success("操作成功",result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("读取图片失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件扩展名获取MIME类型
|
||||||
|
*/
|
||||||
|
private String getMimeType(String fileName) {
|
||||||
|
String extension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
|
||||||
|
switch (extension) {
|
||||||
|
case "jpg":
|
||||||
|
case "jpeg":
|
||||||
|
return "image/jpeg";
|
||||||
|
case "png":
|
||||||
|
return "image/png";
|
||||||
|
case "gif":
|
||||||
|
return "image/gif";
|
||||||
|
case "bmp":
|
||||||
|
return "image/bmp";
|
||||||
|
default:
|
||||||
|
return "image/jpeg"; // 默认返回jpeg类型
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,22 +8,43 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
//文字识别
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/ocr")
|
@RequestMapping("/ocr")
|
||||||
public class OrcController {
|
public class OrcController {
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult orcSheepNo(String path) {
|
public AjaxResult orcSheepNo(String path) {
|
||||||
// 添加空值检查
|
// 添加空值检查
|
||||||
if (path == null || path.trim().isEmpty()) {
|
if (path == null || path.trim().isEmpty()) {
|
||||||
return AjaxResult.error("路径不能为空");
|
return AjaxResult.error("路径不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
OcrRecognizeUtil ocrRecognizeUtil = new OcrRecognizeUtil();
|
OcrRecognizeUtil ocrRecognizeUtil = new OcrRecognizeUtil();
|
||||||
// 移除 /profile
|
// 移除 /profile
|
||||||
path = path.replace("/profile", "");
|
path = path.replace("/profile", "");
|
||||||
path = RuoYiConfig.getProfile() + path;
|
path = RuoYiConfig.getProfile() + path;
|
||||||
String recognize =ocrRecognizeUtil.recognizeTwo(path);
|
|
||||||
return AjaxResult.success(recognize);
|
// 验证文件是否存在
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return AjaxResult.error("文件不存在: " + path);
|
||||||
|
}
|
||||||
|
if (!file.isFile()) {
|
||||||
|
return AjaxResult.error("路径不是一个有效文件: " + path);
|
||||||
|
}
|
||||||
|
if (!file.canRead()) {
|
||||||
|
return AjaxResult.error("无权限读取文件: " + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
String recognize = ocrRecognizeUtil.recognizeTwo(path);
|
||||||
|
return AjaxResult.success("操作成功", recognize);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("OCR识别失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.zhyc.module.app.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App错误日志对象 app_error_log
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-19
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class AppErrorLog extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID,自增 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 设备唯一标识 */
|
||||||
|
@Excel(name = "设备唯一标识")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** App版本号 */
|
||||||
|
@Excel(name = "App版本号")
|
||||||
|
private String appVersion;
|
||||||
|
|
||||||
|
/** App版本号 */
|
||||||
|
@Excel(name = "App版本号")
|
||||||
|
private Long appCode;
|
||||||
|
|
||||||
|
/** 平台类型 */
|
||||||
|
@Excel(name = "平台类型")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/** 操作系统版本 */
|
||||||
|
@Excel(name = "操作系统版本")
|
||||||
|
private String osVersion;
|
||||||
|
|
||||||
|
/** 错误类型分类 */
|
||||||
|
@Excel(name = "错误类型分类")
|
||||||
|
private String errorType;
|
||||||
|
|
||||||
|
/** 错误代码 */
|
||||||
|
@Excel(name = "错误代码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/** 错误描述信息 */
|
||||||
|
@Excel(name = "错误描述信息")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
/** 错误堆栈跟踪 */
|
||||||
|
@Excel(name = "错误堆栈跟踪")
|
||||||
|
private String stackTrace;
|
||||||
|
|
||||||
|
/** 页面路径 */
|
||||||
|
@Excel(name = "页面路径")
|
||||||
|
private String pageUrl;
|
||||||
|
|
||||||
|
/** API接口地址 */
|
||||||
|
@Excel(name = "API接口地址")
|
||||||
|
private String apiUrl;
|
||||||
|
|
||||||
|
/** API调用参数 */
|
||||||
|
@Excel(name = "API调用参数")
|
||||||
|
private String apiParams;
|
||||||
|
|
||||||
|
/** 网络类型 */
|
||||||
|
@Excel(name = "网络类型")
|
||||||
|
private String networkType;
|
||||||
|
|
||||||
|
/** 屏幕宽度 */
|
||||||
|
@Excel(name = "屏幕宽度")
|
||||||
|
private Long screenWidth;
|
||||||
|
|
||||||
|
/** 屏幕高度 */
|
||||||
|
@Excel(name = "屏幕高度")
|
||||||
|
private Long screenHeight;
|
||||||
|
|
||||||
|
/** 自定义扩展数据,JSON格式 */
|
||||||
|
@Excel(name = "自定义扩展数据,JSON格式")
|
||||||
|
private String customData;
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.zhyc.module.app.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用设置对象 app_settings
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AppSettings extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 用户ID,0为全局 */
|
||||||
|
@Excel(name = "用户ID,0为全局")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 设置键名 */
|
||||||
|
@Excel(name = "设置键名")
|
||||||
|
private String settingKey;
|
||||||
|
|
||||||
|
/** 设置 */
|
||||||
|
@Excel(name = "设置")
|
||||||
|
private String settingValue;
|
||||||
|
|
||||||
|
/** 值类型 */
|
||||||
|
@Excel(name = "值类型")
|
||||||
|
private String settingType;
|
||||||
|
|
||||||
|
/** 设置分组 */
|
||||||
|
@Excel(name = "设置分组")
|
||||||
|
private String settingGroup;
|
||||||
|
|
||||||
|
/** 设置描述 */
|
||||||
|
@Excel(name = "设置描述")
|
||||||
|
private String settingDesc;
|
||||||
|
|
||||||
|
/** 适用平台 */
|
||||||
|
@Excel(name = "适用平台")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/** 适用版本范围 */
|
||||||
|
@Excel(name = "适用版本范围")
|
||||||
|
private String versionRange;
|
||||||
|
|
||||||
|
/** 状态 */
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 逻辑位 */
|
||||||
|
@Excel(name = "逻辑位")
|
||||||
|
private Integer logical;
|
||||||
|
|
||||||
|
/** 自定义扩展数据,JSON格式 */
|
||||||
|
@Excel(name = "自定义扩展数据,JSON格式")
|
||||||
|
private String customData;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.zhyc.module.app.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.module.app.domain.AppErrorLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App错误日志Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-19
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AppErrorLogMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询App错误日志
|
||||||
|
*
|
||||||
|
* @param id App错误日志主键
|
||||||
|
* @return App错误日志
|
||||||
|
*/
|
||||||
|
public AppErrorLog selectAppErrorLogById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询App错误日志列表
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return App错误日志集合
|
||||||
|
*/
|
||||||
|
public List<AppErrorLog> selectAppErrorLogList(AppErrorLog appErrorLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增App错误日志
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAppErrorLog(AppErrorLog appErrorLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改App错误日志
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAppErrorLog(AppErrorLog appErrorLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除App错误日志
|
||||||
|
*
|
||||||
|
* @param id App错误日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppErrorLogById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除App错误日志
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppErrorLogByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.zhyc.module.app.mapper;
|
||||||
|
|
||||||
|
import com.zhyc.module.app.domain.AppSettings;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用设置Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-20
|
||||||
|
*/
|
||||||
|
public interface AppSettingsMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询应用设置
|
||||||
|
*
|
||||||
|
* @param id 应用设置主键
|
||||||
|
* @return 应用设置
|
||||||
|
*/
|
||||||
|
public AppSettings selectAppSettingsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用设置列表
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 应用设置集合
|
||||||
|
*/
|
||||||
|
public List<AppSettings> selectAppSettingsList(AppSettings appSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增应用设置
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAppSettings(AppSettings appSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用设置
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAppSettings(AppSettings appSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用设置
|
||||||
|
*
|
||||||
|
* @param id 应用设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppSettingsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除应用设置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppSettingsByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.zhyc.module.app.service;
|
||||||
|
|
||||||
|
import com.zhyc.module.app.domain.AppErrorLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App错误日志Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-19
|
||||||
|
*/
|
||||||
|
public interface IAppErrorLogService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询App错误日志
|
||||||
|
*
|
||||||
|
* @param id App错误日志主键
|
||||||
|
* @return App错误日志
|
||||||
|
*/
|
||||||
|
public AppErrorLog selectAppErrorLogById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询App错误日志列表
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return App错误日志集合
|
||||||
|
*/
|
||||||
|
public List<AppErrorLog> selectAppErrorLogList(AppErrorLog appErrorLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增App错误日志
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAppErrorLog(AppErrorLog appErrorLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改App错误日志
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAppErrorLog(AppErrorLog appErrorLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除App错误日志
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的App错误日志主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppErrorLogByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除App错误日志信息
|
||||||
|
*
|
||||||
|
* @param id App错误日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppErrorLogById(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.zhyc.module.app.service;
|
||||||
|
|
||||||
|
import com.zhyc.module.app.domain.AppSettings;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用设置Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-20
|
||||||
|
*/
|
||||||
|
public interface IAppSettingsService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询应用设置
|
||||||
|
*
|
||||||
|
* @param id 应用设置主键
|
||||||
|
* @return 应用设置
|
||||||
|
*/
|
||||||
|
public AppSettings selectAppSettingsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用设置列表
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 应用设置集合
|
||||||
|
*/
|
||||||
|
public List<AppSettings> selectAppSettingsList(AppSettings appSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增应用设置
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAppSettings(AppSettings appSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用设置
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAppSettings(AppSettings appSettings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除应用设置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的应用设置主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppSettingsByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用设置信息
|
||||||
|
*
|
||||||
|
* @param id 应用设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAppSettingsById(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.zhyc.module.app.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.module.app.domain.AppErrorLog;
|
||||||
|
import com.zhyc.module.app.mapper.AppErrorLogMapper;
|
||||||
|
import com.zhyc.module.app.service.IAppErrorLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App错误日志Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AppErrorLogServiceImpl implements IAppErrorLogService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private AppErrorLogMapper appErrorLogMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询App错误日志
|
||||||
|
*
|
||||||
|
* @param id App错误日志主键
|
||||||
|
* @return App错误日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AppErrorLog selectAppErrorLogById(Long id)
|
||||||
|
{
|
||||||
|
return appErrorLogMapper.selectAppErrorLogById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询App错误日志列表
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return App错误日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AppErrorLog> selectAppErrorLogList(AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
return appErrorLogMapper.selectAppErrorLogList(appErrorLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增App错误日志
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertAppErrorLog(AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
appErrorLog.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return appErrorLogMapper.insertAppErrorLog(appErrorLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改App错误日志
|
||||||
|
*
|
||||||
|
* @param appErrorLog App错误日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateAppErrorLog(AppErrorLog appErrorLog)
|
||||||
|
{
|
||||||
|
return appErrorLogMapper.updateAppErrorLog(appErrorLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除App错误日志
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的App错误日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAppErrorLogByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return appErrorLogMapper.deleteAppErrorLogByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除App错误日志信息
|
||||||
|
*
|
||||||
|
* @param id App错误日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAppErrorLogById(Long id)
|
||||||
|
{
|
||||||
|
return appErrorLogMapper.deleteAppErrorLogById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.zhyc.module.app.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.module.app.domain.AppSettings;
|
||||||
|
import com.zhyc.module.app.mapper.AppSettingsMapper;
|
||||||
|
import com.zhyc.module.app.service.IAppSettingsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用设置Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AppSettingsServiceImpl implements IAppSettingsService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private AppSettingsMapper appSettingsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用设置
|
||||||
|
*
|
||||||
|
* @param id 应用设置主键
|
||||||
|
* @return 应用设置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AppSettings selectAppSettingsById(Long id)
|
||||||
|
{
|
||||||
|
return appSettingsMapper.selectAppSettingsById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用设置列表
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 应用设置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AppSettings> selectAppSettingsList(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
return appSettingsMapper.selectAppSettingsList(appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增应用设置
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertAppSettings(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
appSettings.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return appSettingsMapper.insertAppSettings(appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用设置
|
||||||
|
*
|
||||||
|
* @param appSettings 应用设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateAppSettings(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
appSettings.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return appSettingsMapper.updateAppSettings(appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除应用设置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的应用设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAppSettingsByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return appSettingsMapper.deleteAppSettingsByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用设置信息
|
||||||
|
*
|
||||||
|
* @param id 应用设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAppSettingsById(Long id)
|
||||||
|
{
|
||||||
|
return appSettingsMapper.deleteAppSettingsById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,17 @@ public class BasSheepController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/earNumbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers =basSheepService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出羊只基本信息列表
|
* 导出羊只基本信息列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class BasSheepTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询羊只类型列表
|
* 查询羊只类型列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:list')")
|
// @PreAuthorize("@ss.hasPermi('base:base:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(BasSheepType basSheepType)
|
public TableDataInfo list(BasSheepType basSheepType)
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,7 @@ public class BasSheepTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出羊只类型列表
|
* 导出羊只类型列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:export')")
|
// @PreAuthorize("@ss.hasPermi('base:base:export')")
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.EXPORT)
|
@Log(title = "羊只类型", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BasSheepType basSheepType)
|
public void export(HttpServletResponse response, BasSheepType basSheepType)
|
||||||
@@ -66,7 +66,7 @@ public class BasSheepTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取羊只类型详细信息
|
* 获取羊只类型详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:query')")
|
// @PreAuthorize("@ss.hasPermi('base:base:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ public class BasSheepTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增羊只类型
|
* 新增羊只类型
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:add')")
|
// @PreAuthorize("@ss.hasPermi('base:base:add')")
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.INSERT)
|
@Log(title = "羊只类型", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody BasSheepType basSheepType)
|
public AjaxResult add(@RequestBody BasSheepType basSheepType)
|
||||||
@@ -87,7 +87,7 @@ public class BasSheepTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改羊只类型
|
* 修改羊只类型
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:edit')")
|
// @PreAuthorize("@ss.hasPermi('base:base:edit')")
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.UPDATE)
|
@Log(title = "羊只类型", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody BasSheepType basSheepType)
|
public AjaxResult edit(@RequestBody BasSheepType basSheepType)
|
||||||
@@ -98,7 +98,7 @@ public class BasSheepTypeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除羊只类型
|
* 删除羊只类型
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:remove')")
|
// @PreAuthorize("@ss.hasPermi('base:base:remove')")
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.DELETE)
|
@Log(title = "羊只类型", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Integer[] ids)
|
public AjaxResult remove(@PathVariable Integer[] ids)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询牧场管理列表
|
* 查询牧场管理列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('ranch:ranch:list')")
|
// @PreAuthorize("@ss.hasPermi('ranch:ranch:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(DaRanch daRanch)
|
public TableDataInfo list(DaRanch daRanch)
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出牧场管理列表
|
* 导出牧场管理列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('ranch:ranch:export')")
|
// @PreAuthorize("@ss.hasPermi('ranch:ranch:export')")
|
||||||
@Log(title = "牧场管理", businessType = BusinessType.EXPORT)
|
@Log(title = "牧场管理", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, DaRanch daRanch)
|
public void export(HttpServletResponse response, DaRanch daRanch)
|
||||||
@@ -67,7 +67,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取牧场管理详细信息
|
* 获取牧场管理详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('ranch:ranch:query')")
|
// @PreAuthorize("@ss.hasPermi('ranch:ranch:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
@@ -77,7 +77,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取指定牧场下的所有羊只耳号
|
* 获取指定牧场下的所有羊只耳号
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getSheepByRanchId/{ranchId}")
|
// @GetMapping("/getSheepByRanchId/{ranchId}")
|
||||||
public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) {
|
public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) {
|
||||||
List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId);
|
List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId);
|
||||||
return AjaxResult.success(sheepList);
|
return AjaxResult.success(sheepList);
|
||||||
@@ -87,7 +87,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增牧场管理
|
* 新增牧场管理
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('ranch:ranch:add')")
|
// @PreAuthorize("@ss.hasPermi('ranch:ranch:add')")
|
||||||
@Log(title = "牧场管理", businessType = BusinessType.INSERT)
|
@Log(title = "牧场管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody DaRanch daRanch)
|
public AjaxResult add(@RequestBody DaRanch daRanch)
|
||||||
@@ -98,7 +98,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改牧场管理
|
* 修改牧场管理
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('ranch:ranch:edit')")
|
// @PreAuthorize("@ss.hasPermi('ranch:ranch:edit')")
|
||||||
@Log(title = "牧场管理", businessType = BusinessType.UPDATE)
|
@Log(title = "牧场管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody DaRanch daRanch)
|
public AjaxResult edit(@RequestBody DaRanch daRanch)
|
||||||
@@ -109,7 +109,7 @@ public class DaRanchController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除牧场管理
|
* 删除牧场管理
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('ranch:ranch:remove')")
|
// @PreAuthorize("@ss.hasPermi('ranch:ranch:remove')")
|
||||||
@Log(title = "牧场管理", businessType = BusinessType.DELETE)
|
@Log(title = "牧场管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
|||||||
@@ -70,6 +70,15 @@ public interface BasSheepMapper
|
|||||||
BasSheep selectBasSheepByManageTags(String manageTags);
|
BasSheep selectBasSheepByManageTags(String manageTags);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
|
|
||||||
|
|
||||||
List<BasSheep> selectBasSheepBySheepfold(String id);
|
List<BasSheep> selectBasSheepBySheepfold(String id);
|
||||||
|
|
||||||
// 根据牧场ID获取羊只列表
|
// 根据牧场ID获取羊只列表
|
||||||
|
|||||||
@@ -28,6 +28,13 @@ public interface IBasSheepService
|
|||||||
*/
|
*/
|
||||||
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
|
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 羊只查询耳号信息
|
||||||
|
*
|
||||||
|
* @param earNumbers 耳号
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public List<String> searchEarNumbers(String earNumbers);
|
||||||
/**
|
/**
|
||||||
* 新增羊只基本信息
|
* 新增羊只基本信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -44,6 +44,16 @@ public class BasSheepServiceImpl implements IBasSheepService
|
|||||||
return basSheepMapper.selectBasSheepList(basSheep);
|
return basSheepMapper.selectBasSheepList(basSheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索羊只 earNumbers
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return basSheepMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 新增羊只基本信息
|
* 新增羊只基本信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class SwDiseaseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询疾病列表
|
* 查询疾病列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('disease:disease:list')")
|
@PreAuthorize("@ss.hasPermi('biosafety:disease:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(SwDisease swDisease)
|
public AjaxResult list(SwDisease swDisease)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ public class SwDiseaseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出疾病列表
|
* 导出疾病列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('disease:disease:export')")
|
@PreAuthorize("@ss.hasPermi('biosafety:disease:export')")
|
||||||
@Log(title = "疾病", businessType = BusinessType.EXPORT)
|
@Log(title = "疾病", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, SwDisease swDisease)
|
public void export(HttpServletResponse response, SwDisease swDisease)
|
||||||
@@ -61,7 +61,7 @@ public class SwDiseaseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取疾病详细信息
|
* 获取疾病详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('disease:disease:query')")
|
@PreAuthorize("@ss.hasPermi('biosafety:disease:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,7 @@ public class SwDiseaseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增疾病
|
* 新增疾病
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('disease:disease:add')")
|
@PreAuthorize("@ss.hasPermi('biosafety:disease:add')")
|
||||||
@Log(title = "疾病", businessType = BusinessType.INSERT)
|
@Log(title = "疾病", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SwDisease swDisease)
|
public AjaxResult add(@RequestBody SwDisease swDisease)
|
||||||
@@ -82,7 +82,7 @@ public class SwDiseaseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改疾病
|
* 修改疾病
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('disease:disease:edit')")
|
@PreAuthorize("@ss.hasPermi('biosafety:disease:edit')")
|
||||||
@Log(title = "疾病", businessType = BusinessType.UPDATE)
|
@Log(title = "疾病", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody SwDisease swDisease)
|
public AjaxResult edit(@RequestBody SwDisease swDisease)
|
||||||
@@ -93,7 +93,7 @@ public class SwDiseaseController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除疾病
|
* 删除疾病
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('disease:disease:remove')")
|
@PreAuthorize("@ss.hasPermi('biosafety:disease:remove')")
|
||||||
@Log(title = "疾病", businessType = BusinessType.DELETE)
|
@Log(title = "疾病", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class Deworm extends BaseEntity
|
|||||||
@Excel(name = "羊只耳号")
|
@Excel(name = "羊只耳号")
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
private String[] sheepNos;
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
@Excel(name = "品种")
|
@Excel(name = "品种")
|
||||||
private String variety;
|
private String variety;
|
||||||
@@ -75,10 +77,7 @@ public class Deworm extends BaseEntity
|
|||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
// public void setGender(String gender) {
|
|
||||||
// this.gender = gender;
|
|
||||||
// this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
|
||||||
// }
|
|
||||||
// 排序查询
|
// 排序查询
|
||||||
private String orderByColumn;
|
private String orderByColumn;
|
||||||
private String isAsc;
|
private String isAsc;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.biosafety.domain;
|
package com.zhyc.module.biosafety.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.module.enums.Gender;
|
import com.zhyc.module.enums.Gender;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -38,6 +40,9 @@ public class Diagnosis extends BaseEntity
|
|||||||
@Excel(name = "羊只耳号")
|
@Excel(name = "羊只耳号")
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
private String[] sheepNos;
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
|
||||||
private Long sheepId;
|
private Long sheepId;
|
||||||
|
|
||||||
@@ -97,12 +102,23 @@ public class Diagnosis extends BaseEntity
|
|||||||
|
|
||||||
private Long sheepfoldId;
|
private Long sheepfoldId;
|
||||||
|
|
||||||
public void setGender(String gender) {
|
|
||||||
this.gender = gender;
|
|
||||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 排序查询
|
// 排序查询
|
||||||
private String orderByColumn;
|
private String orderByColumn;
|
||||||
private String isAsc;
|
private String isAsc;
|
||||||
|
|
||||||
|
public void setGender(String gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
Integer genderCode = Integer.valueOf(gender.trim());
|
||||||
|
this.genderName = Gender.getDescByCode(genderCode);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 如果转换失败,设置为空或默认值
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,13 +31,15 @@ public class Health extends BaseEntity
|
|||||||
/** 羊只id */
|
/** 羊只id */
|
||||||
@Excel(name = "羊只id")
|
@Excel(name = "羊只id")
|
||||||
private Long sheepId;
|
private Long sheepId;
|
||||||
|
|
||||||
private Integer[] sheepIds;
|
private Integer[] sheepIds;
|
||||||
|
|
||||||
/** 羊只id */
|
/** 羊只id */
|
||||||
@Excel(name = "羊只耳号")
|
@Excel(name = "羊只耳号")
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
private String[] sheepNos;
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "品种")
|
@Excel(name = "品种")
|
||||||
private String variety;
|
private String variety;
|
||||||
@@ -70,11 +72,23 @@ public class Health extends BaseEntity
|
|||||||
// 药品使用
|
// 药品使用
|
||||||
private List<SwMedicineUsageDetails> usageDetails;
|
private List<SwMedicineUsageDetails> usageDetails;
|
||||||
|
|
||||||
public void setGender(String gender) {
|
|
||||||
this.gender = gender;
|
|
||||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
|
||||||
}
|
|
||||||
// 排序查询
|
// 排序查询
|
||||||
private String orderByColumn;
|
private String orderByColumn;
|
||||||
private String isAsc;
|
private String isAsc;
|
||||||
|
|
||||||
|
public void setGender(String gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
Integer genderCode = Integer.valueOf(gender.trim());
|
||||||
|
this.genderName = Gender.getDescByCode(genderCode);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 如果转换失败,设置为空或默认值
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public class Immunity extends BaseEntity
|
|||||||
@Excel(name = "羊只耳号")
|
@Excel(name = "羊只耳号")
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
private String[] sheepNos;
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "品种")
|
@Excel(name = "品种")
|
||||||
|
|
||||||
@@ -77,12 +80,24 @@ public class Immunity extends BaseEntity
|
|||||||
|
|
||||||
// 药品使用
|
// 药品使用
|
||||||
private List<SwMedicineUsageDetails> usageDetails;
|
private List<SwMedicineUsageDetails> usageDetails;
|
||||||
public void setGender(String gender) {
|
|
||||||
this.gender = gender;
|
|
||||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
|
||||||
}
|
|
||||||
// 排序查询
|
// 排序查询
|
||||||
private String orderByColumn;
|
private String orderByColumn;
|
||||||
private String isAsc;
|
private String isAsc;
|
||||||
|
|
||||||
|
public void setGender(String gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
Integer genderCode = Integer.valueOf(gender.trim());
|
||||||
|
this.genderName = Gender.getDescByCode(genderCode);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 如果转换失败,设置为空或默认值
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.biosafety.domain;
|
package com.zhyc.module.biosafety.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.module.enums.Gender;
|
import com.zhyc.module.enums.Gender;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -37,6 +39,9 @@ public class QuarantineReport extends BaseEntity
|
|||||||
@Excel(name = "羊只耳号")
|
@Excel(name = "羊只耳号")
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
private String[] sheepNos;
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "羊只类别")
|
@Excel(name = "羊只类别")
|
||||||
private String sheepType;
|
private String sheepType;
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ public class SwMedicineUsage extends BaseEntity
|
|||||||
/** 耳号 */
|
/** 耳号 */
|
||||||
@Excel(name = "耳号",width = 20, needMerge = true)
|
@Excel(name = "耳号",width = 20, needMerge = true)
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
|
||||||
private Integer sheepId;
|
private Integer sheepId;
|
||||||
/** 使用时间 */
|
/** 使用时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class Treatment extends BaseEntity
|
|||||||
@Excel(name = "羊只耳号")
|
@Excel(name = "羊只耳号")
|
||||||
private String sheepNo;
|
private String sheepNo;
|
||||||
private String[] sheepNos;
|
private String[] sheepNos;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
|
||||||
private Long sheepId;
|
private Long sheepId;
|
||||||
// 用于批量新增
|
// 用于批量新增
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zhyc.module.biosafety.service.impl;
|
package com.zhyc.module.biosafety.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import com.zhyc.common.utils.SecurityUtils;
|
import com.zhyc.common.utils.SecurityUtils;
|
||||||
@@ -61,13 +62,13 @@ public class DewormServiceImpl implements IDewormService
|
|||||||
{
|
{
|
||||||
String[] sheepNos = null;
|
String[] sheepNos = null;
|
||||||
if (deworm.getSheepNo() != null && !deworm.getSheepNo().isEmpty()) {
|
if (deworm.getSheepNo() != null && !deworm.getSheepNo().isEmpty()) {
|
||||||
if (deworm.getSheepNo().contains(",")) {
|
if (deworm.getSheepNo().contains(" ")) {
|
||||||
sheepNos = deworm.getSheepNo().split(",");
|
sheepNos = deworm.getSheepNo().split(" ");
|
||||||
} else {
|
deworm.setSheepNos(sheepNos);
|
||||||
sheepNos = new String[]{deworm.getSheepNo()};
|
deworm.setSheepNo(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deworm.setSheepNos(sheepNos);
|
|
||||||
return dewormMapper.selectDewormList(deworm);
|
return dewormMapper.selectDewormList(deworm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,8 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
|||||||
{
|
{
|
||||||
String[] sheepNos = null;
|
String[] sheepNos = null;
|
||||||
if (diagnosis.getSheepNo() != null && !diagnosis.getSheepNo().isEmpty()) {
|
if (diagnosis.getSheepNo() != null && !diagnosis.getSheepNo().isEmpty()) {
|
||||||
if (diagnosis.getSheepNo().contains(",")) {
|
if (diagnosis.getSheepNo().contains(" ")) {
|
||||||
sheepNos = diagnosis.getSheepNo().split(",");
|
sheepNos = diagnosis.getSheepNo().split(" ");
|
||||||
} else {
|
|
||||||
sheepNos = new String[]{diagnosis.getSheepNo()};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diagnosis.setSheepNos(sheepNos);
|
diagnosis.setSheepNos(sheepNos);
|
||||||
|
|||||||
@@ -66,10 +66,8 @@ public class HealthServiceImpl implements IHealthService
|
|||||||
{
|
{
|
||||||
String[] sheepNos = null;
|
String[] sheepNos = null;
|
||||||
if (health.getSheepNo() != null && !health.getSheepNo().isEmpty()) {
|
if (health.getSheepNo() != null && !health.getSheepNo().isEmpty()) {
|
||||||
if (health.getSheepNo().contains(",")) {
|
if (health.getSheepNo().contains(" ")) {
|
||||||
sheepNos = health.getSheepNo().split(",");
|
sheepNos = health.getSheepNo().split(" ");
|
||||||
} else {
|
|
||||||
sheepNos = new String[]{health.getSheepNo()};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
health.setSheepNos(sheepNos);
|
health.setSheepNos(sheepNos);
|
||||||
|
|||||||
@@ -65,10 +65,8 @@ public class ImmunityServiceImpl implements IImmunityService
|
|||||||
{
|
{
|
||||||
String[] sheepNos = null;
|
String[] sheepNos = null;
|
||||||
if (immunity.getSheepNo() != null && !immunity.getSheepNo().isEmpty()) {
|
if (immunity.getSheepNo() != null && !immunity.getSheepNo().isEmpty()) {
|
||||||
if (immunity.getSheepNo().contains(",")) {
|
if (immunity.getSheepNo().contains(" ")) {
|
||||||
sheepNos = immunity.getSheepNo().split(",");
|
sheepNos = immunity.getSheepNo().split(" ");
|
||||||
} else {
|
|
||||||
sheepNos = new String[]{immunity.getSheepNo()};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
immunity.setSheepNos(sheepNos);
|
immunity.setSheepNos(sheepNos);
|
||||||
|
|||||||
@@ -50,10 +50,8 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
|||||||
{
|
{
|
||||||
String[] sheepNos = null;
|
String[] sheepNos = null;
|
||||||
if (quarantineReport.getSheepNo() != null && !quarantineReport.getSheepNo().isEmpty()) {
|
if (quarantineReport.getSheepNo() != null && !quarantineReport.getSheepNo().isEmpty()) {
|
||||||
if (quarantineReport.getSheepNo().contains(",")) {
|
if (quarantineReport.getSheepNo().contains(" ")) {
|
||||||
sheepNos = quarantineReport.getSheepNo().split(",");
|
sheepNos = quarantineReport.getSheepNo().split(" ");
|
||||||
} else {
|
|
||||||
sheepNos = new String[]{quarantineReport.getSheepNo()};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
quarantineReport.setSheepNos(sheepNos);
|
quarantineReport.setSheepNos(sheepNos);
|
||||||
|
|||||||
@@ -46,6 +46,14 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
|
|||||||
@Override
|
@Override
|
||||||
public List<SwMedicineUsage> selectSwMedicineUsageList(SwMedicineUsage swMedicineUsage)
|
public List<SwMedicineUsage> selectSwMedicineUsageList(SwMedicineUsage swMedicineUsage)
|
||||||
{
|
{
|
||||||
|
String[] sheepNos = null;
|
||||||
|
if (swMedicineUsage.getSheepNo() != null && !swMedicineUsage.getSheepNo().isEmpty()) {
|
||||||
|
if (swMedicineUsage.getSheepNo().contains(" ")) {
|
||||||
|
sheepNos = swMedicineUsage.getSheepNo().split(" ");
|
||||||
|
swMedicineUsage.setSheepNos(sheepNos);
|
||||||
|
swMedicineUsage.setSheepNo(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
return swMedicineUsageMapper.selectSwMedicineUsageList(swMedicineUsage);
|
return swMedicineUsageMapper.selectSwMedicineUsageList(swMedicineUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class UserPostController {
|
|||||||
|
|
||||||
// 获取岗位(部门)
|
// 获取岗位(部门)
|
||||||
@GetMapping("/getPost")
|
@GetMapping("/getPost")
|
||||||
public AjaxResult getPost(){
|
public AjaxResult getPost(String postName){
|
||||||
List<Post> list = postService.selectPostList();
|
List<Post> list = postService.selectPostList();
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface PostMapper {
|
public interface PostMapper {
|
||||||
|
|
||||||
@Select("select * from sys_post where status = '0' and post_name like '%部'")
|
@Select("select * from sys_post where status = '0'")
|
||||||
List<Post> selectPostList();
|
List<Post> selectPostList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,16 +28,35 @@ public class NpMilkProdClassesController extends BaseController {
|
|||||||
public TableDataInfo list(
|
public TableDataInfo list(
|
||||||
@RequestParam(required = false) Date datetimeStart,
|
@RequestParam(required = false) Date datetimeStart,
|
||||||
@RequestParam(required = false) Date datetimeEnd,
|
@RequestParam(required = false) Date datetimeEnd,
|
||||||
@RequestParam(required = false) String manageEarNo, // 改为单个字符串,模糊
|
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号数组
|
||||||
@RequestParam(required = false) String factory,
|
@RequestParam(required = false) String factory,
|
||||||
@RequestParam(required = false) Integer classes) {
|
@RequestParam(required = false) Integer classes) {
|
||||||
startPage();
|
startPage();
|
||||||
|
// 修改处:将参数封装进实体,以便 Service 和 Mapper 统一处理
|
||||||
|
NpMilkProdClasses params = new NpMilkProdClasses();
|
||||||
|
params.setAllEarNumbers(allEarNumbers);
|
||||||
|
params.setFactory(factory);
|
||||||
|
params.setClasses(classes);
|
||||||
|
|
||||||
List<NpMilkProdClasses> list = npMilkProdClassesService
|
List<NpMilkProdClasses> list = npMilkProdClassesService
|
||||||
.selectNpMilkProdClassesList(datetimeStart, datetimeEnd,
|
.selectNpMilkProdClassesList(params, datetimeStart, datetimeEnd);
|
||||||
manageEarNo, factory, classes);
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改处:新增耳号模糊查询接口
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:list')")
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = npMilkProdClassesService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:import')")
|
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:import')")
|
||||||
@Log(title = "班次产奶", businessType = BusinessType.IMPORT)
|
@Log(title = "班次产奶", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/import")
|
@PostMapping("/import")
|
||||||
@@ -58,14 +77,19 @@ public class NpMilkProdClassesController extends BaseController {
|
|||||||
public void export(HttpServletResponse response,
|
public void export(HttpServletResponse response,
|
||||||
@RequestParam(required = false) Date datetimeStart,
|
@RequestParam(required = false) Date datetimeStart,
|
||||||
@RequestParam(required = false) Date datetimeEnd,
|
@RequestParam(required = false) Date datetimeEnd,
|
||||||
@RequestParam(required = false) String manageEarNo,
|
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号
|
||||||
@RequestParam(required = false) String factory,
|
@RequestParam(required = false) String factory,
|
||||||
@RequestParam(required = false) Integer classes) {
|
@RequestParam(required = false) Integer classes) {
|
||||||
|
|
||||||
|
NpMilkProdClasses params = new NpMilkProdClasses();
|
||||||
|
params.setAllEarNumbers(allEarNumbers);
|
||||||
|
params.setFactory(factory);
|
||||||
|
params.setClasses(classes);
|
||||||
|
|
||||||
List<NpMilkProdClasses> list = npMilkProdClassesService.selectNpMilkProdClassesList(
|
List<NpMilkProdClasses> list = npMilkProdClassesService.selectNpMilkProdClassesList(
|
||||||
datetimeStart, datetimeEnd, manageEarNo, factory, classes);
|
params, datetimeStart, datetimeEnd);
|
||||||
|
|
||||||
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
|
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
|
||||||
util.exportExcel(response, list, "班次产奶数据");
|
util.exportExcel(response, list, "班次产奶数据");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 奶产量分析控制器
|
* 奶产量分析控制器
|
||||||
* 只保留:分页列表(只读) + 单条查询 + 导出
|
* 保留:分页列表(只读) + 单条查询 + 导出 + 耳号模糊查询
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dairyProducts/sheepMilkAnalysis")
|
@RequestMapping("/dairyProducts/sheepMilkAnalysis")
|
||||||
@@ -26,15 +26,36 @@ public class NpSheepMilkAnalysisController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询奶产量分析列表(只读,分页)
|
* 查询奶产量分析列表(只读,分页)
|
||||||
* 支持参数 manageEarTag(耳号模糊) 和 screenDays(筛选天数)
|
* 支持参数 allEarNumbers(多耳号) 和 screenDays(筛选天数)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(NpSheepMilkAnalysis analysis) {
|
public TableDataInfo list(
|
||||||
startPage(); // 使用PageHelper分页(注意service中第一个DB调用是distinct sheep id)
|
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号参数
|
||||||
|
NpSheepMilkAnalysis analysis) {
|
||||||
|
startPage();
|
||||||
|
|
||||||
|
// 修改处:将接收到的 list 设置进对象
|
||||||
|
if (allEarNumbers != null && !allEarNumbers.isEmpty()) {
|
||||||
|
analysis.setAllEarNumbers(allEarNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisList(analysis);
|
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisList(analysis);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改处:新增搜索耳号接口
|
||||||
|
*/
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = npSheepMilkAnalysisService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取单个分析记录详细信息(按sheepId)
|
* 获取单个分析记录详细信息(按sheepId)
|
||||||
*/
|
*/
|
||||||
@@ -45,11 +66,18 @@ public class NpSheepMilkAnalysisController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出奶产量分析记录(Excel)
|
* 导出奶产量分析记录(Excel)
|
||||||
* 支持manageEarTag与screenDays两个查询条件
|
* 支持 allEarNumbers 与 screenDays 两个查询条件
|
||||||
*/
|
*/
|
||||||
@Log(title = "奶产量分析 导出", businessType = BusinessType.EXPORT)
|
@Log(title = "奶产量分析 导出", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult export(NpSheepMilkAnalysis analysis) {
|
public AjaxResult export(
|
||||||
|
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号参数
|
||||||
|
NpSheepMilkAnalysis analysis) {
|
||||||
|
|
||||||
|
if (allEarNumbers != null && !allEarNumbers.isEmpty()) {
|
||||||
|
analysis.setAllEarNumbers(allEarNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisForExport(analysis);
|
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisForExport(analysis);
|
||||||
ExcelUtil<NpSheepMilkAnalysis> util = new ExcelUtil<>(NpSheepMilkAnalysis.class);
|
ExcelUtil<NpSheepMilkAnalysis> util = new ExcelUtil<>(NpSheepMilkAnalysis.class);
|
||||||
return util.exportExcel(list, "羊奶产量分析数据");
|
return util.exportExcel(list, "羊奶产量分析数据");
|
||||||
|
|||||||
@@ -2,20 +2,19 @@ package com.zhyc.module.dairyProducts.domain;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List; // 引入 List
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class NpMilkProdClasses implements Serializable {
|
public class NpMilkProdClasses implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Long id; // 主键ID
|
private Long id;
|
||||||
private Date createTime; // 创建时间
|
private Date createTime;
|
||||||
private Date updateTime; // 更新时间
|
private Date updateTime;
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "日期", dateFormat = "yyyy-MM-dd") // 添加日期格式
|
@Excel(name = "日期", dateFormat = "yyyy-MM-dd")
|
||||||
private Date datetime;
|
private Date datetime;
|
||||||
|
|
||||||
@Excel(name = "管理耳号")
|
@Excel(name = "管理耳号")
|
||||||
@@ -41,7 +40,19 @@ public class NpMilkProdClasses implements Serializable {
|
|||||||
|
|
||||||
private String sheepId;
|
private String sheepId;
|
||||||
|
|
||||||
|
// 修改处:新增字段用于多耳号查询
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getId() { return id; }
|
public Long getId() { return id; }
|
||||||
public void setId(Long id) { this.id = id; }
|
public void setId(Long id) { this.id = id; }
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.domain;
|
|||||||
|
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List; // 导入List
|
||||||
|
|
||||||
public class NpSheepMilkAnalysis {
|
public class NpSheepMilkAnalysis {
|
||||||
// 唯一键(可用于前端 row-key)
|
// 唯一键(可用于前端 row-key)
|
||||||
@@ -12,6 +13,10 @@ public class NpSheepMilkAnalysis {
|
|||||||
@Excel(name = "耳号")
|
@Excel(name = "耳号")
|
||||||
private String manageEarTag;
|
private String manageEarTag;
|
||||||
|
|
||||||
|
// 修改处:新增多耳号字段
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
@Excel(name = "品种")
|
@Excel(name = "品种")
|
||||||
private String variety;
|
private String variety;
|
||||||
|
|
||||||
@@ -139,6 +144,16 @@ public class NpSheepMilkAnalysis {
|
|||||||
private Date lastUpdate;
|
private Date lastUpdate;
|
||||||
|
|
||||||
// getters and setters
|
// getters and setters
|
||||||
|
|
||||||
|
// 修改处:添加 allEarNumbers 的 getter/setter
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSheepId() { return sheepId; }
|
public String getSheepId() { return sheepId; }
|
||||||
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
|
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface NpMilkProdClassesMapper {
|
public interface NpMilkProdClassesMapper {
|
||||||
|
// 修改处:参数改为接收实体类
|
||||||
List<NpMilkProdClasses> selectNpMilkProdClassesList(
|
List<NpMilkProdClasses> selectNpMilkProdClassesList(
|
||||||
|
@Param("npMilkProdClasses") NpMilkProdClasses npMilkProdClasses,
|
||||||
@Param("datetimeStart") Date datetimeStart,
|
@Param("datetimeStart") Date datetimeStart,
|
||||||
@Param("datetimeEnd") Date datetimeEnd,
|
@Param("datetimeEnd") Date datetimeEnd);
|
||||||
@Param("manageEarNo") String manageEarNo,
|
|
||||||
@Param("factory") String factory,
|
// 修改处:新增搜索方法
|
||||||
@Param("classes") Integer classes);
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
|
|
||||||
int insertNpMilkProdClasses(NpMilkProdClasses row);
|
int insertNpMilkProdClasses(NpMilkProdClasses row);
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,14 @@ public interface NpSheepMilkAnalysisMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据管理耳标筛选,返回distinct的sheepId列表
|
* 根据管理耳标筛选,返回distinct的sheepId列表
|
||||||
|
* 修改处:参数改为对象,支持 allEarNumbers
|
||||||
*/
|
*/
|
||||||
List<String> selectDistinctSheepIds(@Param("manageEarTag") String manageEarTag);
|
List<String> selectDistinctSheepIds(NpSheepMilkAnalysis analysis);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改处:新增耳号模糊查询接口
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据羊只ID查询羊只档案信息,返回Map结构
|
* 根据羊只ID查询羊只档案信息,返回Map结构
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import java.util.List;
|
|||||||
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
|
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
|
||||||
|
|
||||||
public interface INpMilkProdClassesService {
|
public interface INpMilkProdClassesService {
|
||||||
|
// 修改处:参数改为接收实体类,以包含多耳号列表
|
||||||
List<NpMilkProdClasses> selectNpMilkProdClassesList(
|
List<NpMilkProdClasses> selectNpMilkProdClassesList(
|
||||||
|
NpMilkProdClasses npMilkProdClasses,
|
||||||
Date datetimeStart,
|
Date datetimeStart,
|
||||||
Date datetimeEnd,
|
Date datetimeEnd);
|
||||||
String manageEarNo, // 改为单个 String
|
|
||||||
String factory,
|
// 修改处:新增耳号搜索方法
|
||||||
Integer classes);
|
List<String> searchEarNumbers(String query);
|
||||||
|
|
||||||
int importMilkProdClasses(List<NpMilkProdClasses> list);
|
int importMilkProdClasses(List<NpMilkProdClasses> list);
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,9 @@ public interface INpSheepMilkAnalysisService {
|
|||||||
|
|
||||||
List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis);
|
List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis);
|
||||||
|
|
||||||
|
// 修改处:新增模糊查询方法定义
|
||||||
|
List<String> searchEarNumbers(String query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出奶产量分析记录
|
* 导出奶产量分析记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,26 +16,29 @@ public class NpMilkProdClassesServiceImpl implements INpMilkProdClassesService {
|
|||||||
private NpMilkProdClassesMapper mapper;
|
private NpMilkProdClassesMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NpMilkProdClasses> selectNpMilkProdClassesList(Date datetimeStart, Date datetimeEnd,
|
public List<NpMilkProdClasses> selectNpMilkProdClassesList(NpMilkProdClasses npMilkProdClasses, Date datetimeStart, Date datetimeEnd) {
|
||||||
String manageEarNo, String factory, Integer classes) {
|
// 修改处:传递实体对象
|
||||||
return mapper.selectNpMilkProdClassesList(datetimeStart, datetimeEnd, manageEarNo, factory, classes);
|
return mapper.selectNpMilkProdClassesList(npMilkProdClasses, datetimeStart, datetimeEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改处:实现搜索方法
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return mapper.searchEarNumbers(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int importMilkProdClasses(List<NpMilkProdClasses> list) {
|
public int importMilkProdClasses(List<NpMilkProdClasses> list) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (NpMilkProdClasses item : list) {
|
for (NpMilkProdClasses item : list) {
|
||||||
// 根据管理耳号查 sheep_id
|
|
||||||
String sheepId = mapper.selectSheepIdByManageEarNo(item.getManageEarNo());
|
String sheepId = mapper.selectSheepIdByManageEarNo(item.getManageEarNo());
|
||||||
if (sheepId == null) continue;
|
if (sheepId == null) continue;
|
||||||
|
|
||||||
item.setSheepId(sheepId);
|
item.setSheepId(sheepId);
|
||||||
|
|
||||||
// 计算校正奶量
|
|
||||||
Double correctedMilk = calculateCorrectedMilk(item);
|
Double correctedMilk = calculateCorrectedMilk(item);
|
||||||
item.setCorrectedMilk(correctedMilk);
|
item.setCorrectedMilk(correctedMilk);
|
||||||
|
|
||||||
// 插入数据
|
|
||||||
count += mapper.insertNpMilkProdClasses(item);
|
count += mapper.insertNpMilkProdClasses(item);
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
@@ -45,15 +48,12 @@ public class NpMilkProdClassesServiceImpl implements INpMilkProdClassesService {
|
|||||||
Double milk = item.getMilk();
|
Double milk = item.getMilk();
|
||||||
if (milk == null) return null;
|
if (milk == null) return null;
|
||||||
|
|
||||||
// 1. 称重矫正系数
|
|
||||||
Double weightCorrection = mapper.getWeightCorrection(item.getDatetime(), item.getFactory());
|
Double weightCorrection = mapper.getWeightCorrection(item.getDatetime(), item.getFactory());
|
||||||
if (weightCorrection == null) weightCorrection = 1.0;
|
if (weightCorrection == null) weightCorrection = 1.0;
|
||||||
|
|
||||||
// 2. 胎次矫正系数
|
|
||||||
Double parityCorrection = mapper.getParityCorrection(item.getParity());
|
Double parityCorrection = mapper.getParityCorrection(item.getParity());
|
||||||
if (parityCorrection == null) parityCorrection = 1.0;
|
if (parityCorrection == null) parityCorrection = 1.0;
|
||||||
|
|
||||||
// 3. 干物质矫正系数
|
|
||||||
Double dryMatterCorrection = mapper.getDryMatterCorrection(item.getDatetime(), item.getFactory());
|
Double dryMatterCorrection = mapper.getDryMatterCorrection(item.getDatetime(), item.getFactory());
|
||||||
if (dryMatterCorrection == null) dryMatterCorrection = 1.0;
|
if (dryMatterCorrection == null) dryMatterCorrection = 1.0;
|
||||||
|
|
||||||
|
|||||||
@@ -47,12 +47,19 @@ public class NpSheepMilkAnalysisServiceImpl implements INpSheepMilkAnalysisServi
|
|||||||
return ana;
|
return ana;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改处:新增模糊查询实现
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return npSheepMilkAnalysisMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis) {
|
public List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis) {
|
||||||
int screenDays = (analysis != null && analysis.getScreenDays() != null) ? analysis.getScreenDays() : 100;
|
int screenDays = (analysis != null && analysis.getScreenDays() != null) ? analysis.getScreenDays() : 100;
|
||||||
String manageEarTagFilter = (analysis != null) ? analysis.getManageEarTag() : null;
|
|
||||||
|
|
||||||
List<String> sheepIds = npSheepMilkAnalysisMapper.selectDistinctSheepIds(manageEarTagFilter);
|
// 修改处:这里改为直接传 analysis 对象,以便 mapper 可以处理 allEarNumbers
|
||||||
|
List<String> sheepIds = npSheepMilkAnalysisMapper.selectDistinctSheepIds(analysis);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(sheepIds)) return Collections.emptyList();
|
if (CollectionUtils.isEmpty(sheepIds)) return Collections.emptyList();
|
||||||
|
|
||||||
List<NpSheepMilkAnalysis> resultList = new ArrayList<>();
|
List<NpSheepMilkAnalysis> resultList = new ArrayList<>();
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.zhyc.module.feed.controller.Exception;
|
||||||
|
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
public class MaterialExceptionHandler {
|
||||||
|
|
||||||
|
@ExceptionHandler({Exception.class, RuntimeException.class})
|
||||||
|
public AjaxResult handleException(HttpServletRequest request, Exception ex) {
|
||||||
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
|
ajaxResult.put("message", ex.getMessage());
|
||||||
|
ajaxResult.put("url", request.getRequestURL().toString());
|
||||||
|
ajaxResult.put("status", 500);
|
||||||
|
ajaxResult.put("error", "出现了一些错误");
|
||||||
|
return ajaxResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.zhyc.module.feed.service.impl.SgFeedListServiceImpl;
|
import com.zhyc.module.feed.service.impl.SgFeedListServiceImpl;
|
||||||
@@ -39,7 +40,7 @@ public class SgFeedListController extends BaseController {
|
|||||||
private final ISgFeedListService sgFeedListService;
|
private final ISgFeedListService sgFeedListService;
|
||||||
|
|
||||||
|
|
||||||
public static boolean refresh = true;
|
public static final AtomicBoolean refresh = new AtomicBoolean(true);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SgFeedListController(ISgFeedListService sgFeedListService) {
|
public SgFeedListController(ISgFeedListService sgFeedListService) {
|
||||||
@@ -57,9 +58,8 @@ public class SgFeedListController extends BaseController {
|
|||||||
刷新缓存
|
刷新缓存
|
||||||
当配方管理表出现更新 或 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新
|
当配方管理表出现更新 或 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新
|
||||||
*/
|
*/
|
||||||
if (refresh) {
|
if (refresh.compareAndSet(true, false)) {
|
||||||
sgFeedListService.SyncFeedList();
|
sgFeedListService.syncFeedListSafely();
|
||||||
refresh = false;
|
|
||||||
}
|
}
|
||||||
startPage();
|
startPage();
|
||||||
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
|
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class SgFeedPlanController extends BaseController {
|
|||||||
// 计算其他字段值
|
// 计算其他字段值
|
||||||
setPlan(sgFeedPlan);
|
setPlan(sgFeedPlan);
|
||||||
// 通知配料清单刷新数据
|
// 通知配料清单刷新数据
|
||||||
SgFeedListController.refresh = true;
|
SgFeedListController.refresh.set(true);
|
||||||
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
|
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public class SgFeedPlanController extends BaseController {
|
|||||||
// 根据修改后的值重新计算
|
// 根据修改后的值重新计算
|
||||||
setPlan(sgFeedPlan);
|
setPlan(sgFeedPlan);
|
||||||
// 通知配料清单刷新数据
|
// 通知配料清单刷新数据
|
||||||
SgFeedListController.refresh = true;
|
SgFeedListController.refresh.set(true);
|
||||||
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
|
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class SgFeedPlanController extends BaseController {
|
|||||||
@DeleteMapping("/{createDates}")
|
@DeleteMapping("/{createDates}")
|
||||||
public AjaxResult remove(@PathVariable Date[] createDates) {
|
public AjaxResult remove(@PathVariable Date[] createDates) {
|
||||||
// 通知配料清单刷新数据
|
// 通知配料清单刷新数据
|
||||||
SgFeedListController.refresh = true;
|
SgFeedListController.refresh.set(true);
|
||||||
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
|
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ public class SgFormulaManagementController extends BaseController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
|
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
|
||||||
if (null == sgFormulaManagement)
|
if (null == sgFormulaManagement) throw new RuntimeException("ERROR: 数据为空");
|
||||||
throw new RuntimeException("ERROR: 数据为空");
|
|
||||||
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
|
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
|
||||||
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
|
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
@@ -145,7 +144,7 @@ public class SgFormulaManagementController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通知配料清单刷新数据
|
// 通知配料清单刷新数据
|
||||||
SgFeedListController.refresh = true;
|
SgFeedListController.refresh.set(true);
|
||||||
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
|
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +171,7 @@ public class SgFormulaManagementController extends BaseController {
|
|||||||
sgFormulaManagement.setBatchId(batchId);
|
sgFormulaManagement.setBatchId(batchId);
|
||||||
|
|
||||||
// 通知配料清单刷新数据
|
// 通知配料清单刷新数据
|
||||||
SgFeedListController.refresh = true;
|
SgFeedListController.refresh.set(true);
|
||||||
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
|
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.feed.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@@ -24,17 +25,14 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
* 原料Controller
|
* 原料Controller
|
||||||
*
|
*
|
||||||
* @author HashMap
|
* @author HashMap
|
||||||
* @date 2025-08-11
|
* @date 2026-01-16
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/feed/material")
|
@RequestMapping("/feed/material")
|
||||||
public class SgMaterialController extends BaseController
|
public class SgMaterialController extends BaseController
|
||||||
{
|
{
|
||||||
private final ISgMaterialService sgMaterialService;
|
@Autowired
|
||||||
|
private ISgMaterialService sgMaterialService;
|
||||||
public SgMaterialController(ISgMaterialService sgMaterialService) {
|
|
||||||
this.sgMaterialService = sgMaterialService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询原料列表
|
* 查询原料列表
|
||||||
@@ -57,7 +55,7 @@ public class SgMaterialController extends BaseController
|
|||||||
public void export(HttpServletResponse response, SgMaterial sgMaterial)
|
public void export(HttpServletResponse response, SgMaterial sgMaterial)
|
||||||
{
|
{
|
||||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||||
ExcelUtil<SgMaterial> util = new ExcelUtil<>(SgMaterial.class);
|
ExcelUtil<SgMaterial> util = new ExcelUtil<SgMaterial>(SgMaterial.class);
|
||||||
util.exportExcel(response, list, "原料数据");
|
util.exportExcel(response, list, "原料数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +96,7 @@ public class SgMaterialController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('feed:material:remove')")
|
@PreAuthorize("@ss.hasPermi('feed:material:remove')")
|
||||||
@Log(title = "原料", businessType = BusinessType.DELETE)
|
@Log(title = "原料", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{materialIds}")
|
@DeleteMapping("/{materialIds}")
|
||||||
public AjaxResult remove(@PathVariable String[] materialIds)
|
public AjaxResult remove(@PathVariable String[] materialIds)
|
||||||
{
|
{
|
||||||
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
|
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
|
||||||
|
|||||||
@@ -1,15 +1,68 @@
|
|||||||
package com.zhyc.module.feed.domain;
|
package com.zhyc.module.feed.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Setter
|
/**
|
||||||
@Getter
|
* 原料对象 sg_material
|
||||||
public class SgMaterial extends BaseEntity {
|
*
|
||||||
|
* @author HashMap
|
||||||
|
* @date 2026-01-16
|
||||||
|
*/
|
||||||
|
public class SgMaterial extends BaseEntity
|
||||||
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 原料编码 */
|
||||||
|
@Excel(name = "原料编码")
|
||||||
private String materialId;
|
private String materialId;
|
||||||
|
|
||||||
|
/** 原料名称 */
|
||||||
|
@Excel(name = "原料名称")
|
||||||
private String materialName;
|
private String materialName;
|
||||||
private String isGranular;
|
|
||||||
|
/** 颗粒料 */
|
||||||
|
@Excel(name = "颗粒料")
|
||||||
|
private Integer isGranular;
|
||||||
|
|
||||||
|
public void setMaterialId(String materialId)
|
||||||
|
{
|
||||||
|
this.materialId = materialId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaterialId()
|
||||||
|
{
|
||||||
|
return materialId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterialName(String materialName)
|
||||||
|
{
|
||||||
|
this.materialName = materialName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaterialName()
|
||||||
|
{
|
||||||
|
return materialName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsGranular(Integer isGranular)
|
||||||
|
{
|
||||||
|
this.isGranular = isGranular;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsGranular()
|
||||||
|
{
|
||||||
|
return isGranular;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("materialId", getMaterialId())
|
||||||
|
.append("materialName", getMaterialName())
|
||||||
|
.append("isGranular", getIsGranular())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* 原料Mapper接口
|
* 原料Mapper接口
|
||||||
*
|
*
|
||||||
* @author HashMap
|
* @author HashMap
|
||||||
* @date 2025-08-11
|
* @date 2026-01-16
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SgMaterialMapper
|
public interface SgMaterialMapper
|
||||||
|
|||||||
@@ -59,5 +59,7 @@ public interface ISgFeedListService {
|
|||||||
*/
|
*/
|
||||||
int deleteSgFeedListById(Long id);
|
int deleteSgFeedListById(Long id);
|
||||||
|
|
||||||
|
void syncFeedListSafely();
|
||||||
|
|
||||||
void SyncFeedList();
|
void SyncFeedList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.zhyc.module.feed.domain.SgMaterial;
|
|||||||
* 原料Service接口
|
* 原料Service接口
|
||||||
*
|
*
|
||||||
* @author HashMap
|
* @author HashMap
|
||||||
* @date 2025-08-11
|
* @date 2026-01-16
|
||||||
*/
|
*/
|
||||||
public interface ISgMaterialService
|
public interface ISgMaterialService
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,7 @@ public interface ISgMaterialService
|
|||||||
* @param materialId 原料主键
|
* @param materialId 原料主键
|
||||||
* @return 原料
|
* @return 原料
|
||||||
*/
|
*/
|
||||||
SgMaterial selectSgMaterialByMaterialId(String materialId);
|
public SgMaterial selectSgMaterialByMaterialId(String materialId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询原料列表
|
* 查询原料列表
|
||||||
@@ -25,7 +25,7 @@ public interface ISgMaterialService
|
|||||||
* @param sgMaterial 原料
|
* @param sgMaterial 原料
|
||||||
* @return 原料集合
|
* @return 原料集合
|
||||||
*/
|
*/
|
||||||
List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial);
|
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增原料
|
* 新增原料
|
||||||
@@ -33,7 +33,7 @@ public interface ISgMaterialService
|
|||||||
* @param sgMaterial 原料
|
* @param sgMaterial 原料
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int insertSgMaterial(SgMaterial sgMaterial);
|
public int insertSgMaterial(SgMaterial sgMaterial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改原料
|
* 修改原料
|
||||||
@@ -41,7 +41,7 @@ public interface ISgMaterialService
|
|||||||
* @param sgMaterial 原料
|
* @param sgMaterial 原料
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateSgMaterial(SgMaterial sgMaterial);
|
public int updateSgMaterial(SgMaterial sgMaterial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除原料
|
* 批量删除原料
|
||||||
@@ -49,7 +49,7 @@ public interface ISgMaterialService
|
|||||||
* @param materialIds 需要删除的原料主键集合
|
* @param materialIds 需要删除的原料主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteSgMaterialByMaterialIds(String[] materialIds);
|
public int deleteSgMaterialByMaterialIds(String[] materialIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除原料信息
|
* 删除原料信息
|
||||||
@@ -57,5 +57,5 @@ public interface ISgMaterialService
|
|||||||
* @param materialId 原料主键
|
* @param materialId 原料主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteSgMaterialByMaterialId(String materialId);
|
public int deleteSgMaterialByMaterialId(String materialId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.zhyc.module.feed.mapper.SgFeedListMapper;
|
import com.zhyc.module.feed.mapper.SgFeedListMapper;
|
||||||
import com.zhyc.module.feed.domain.SgFeedList;
|
import com.zhyc.module.feed.domain.SgFeedList;
|
||||||
import com.zhyc.module.feed.service.ISgFeedListService;
|
import com.zhyc.module.feed.service.ISgFeedListService;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import static com.zhyc.module.feed.controller.SgFeedListController.refresh;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配料清单Service业务层处理
|
* 配料清单Service业务层处理
|
||||||
@@ -30,7 +34,15 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
|||||||
this.sgFeedListMapper = sgFeedListMapper;
|
this.sgFeedListMapper = sgFeedListMapper;
|
||||||
this.sgFormulaManagementService = sgFormulaManagementService;
|
this.sgFormulaManagementService = sgFormulaManagementService;
|
||||||
this.sgFeedPlanService = sgFeedPlanService;
|
this.sgFeedPlanService = sgFeedPlanService;
|
||||||
// 构造时将数据库初始数据写入缓存
|
// 第一次请求时更新缓存
|
||||||
|
refresh.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在数据源已切换后调用
|
||||||
|
*/
|
||||||
|
public synchronized void initCacheIfNecessary() {
|
||||||
|
// 初次访问时将数据库初始数据写入缓存
|
||||||
List<SgFeedList> feedListsFromDataBase = this.selectSgFeedListList(new SgFeedList());
|
List<SgFeedList> feedListsFromDataBase = this.selectSgFeedListList(new SgFeedList());
|
||||||
for (SgFeedList sgFeedListItem : feedListsFromDataBase) {
|
for (SgFeedList sgFeedListItem : feedListsFromDataBase) {
|
||||||
String key = sgFeedListItem.getFormulaId() + "_" + sgFeedListItem.getFormulaBatchId() + "_" + sgFeedListItem.getDeployDate();
|
String key = sgFeedListItem.getFormulaId() + "_" + sgFeedListItem.getFormulaBatchId() + "_" + sgFeedListItem.getDeployDate();
|
||||||
@@ -157,6 +169,16 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void syncFeedListSafely() {
|
||||||
|
try {
|
||||||
|
SyncFeedList();
|
||||||
|
} catch (Exception e) {
|
||||||
|
refresh.set(true); // 初始化失败,下次还能重试
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
public void SyncFeedList() {
|
public void SyncFeedList() {
|
||||||
HashMap<String, SgFeedList> cacheTemp = new HashMap<>(sgFeedListMap);
|
HashMap<String, SgFeedList> cacheTemp = new HashMap<>(sgFeedListMap);
|
||||||
// 清空旧缓存
|
// 清空旧缓存
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.feed.mapper.SgMaterialMapper;
|
import com.zhyc.module.feed.mapper.SgMaterialMapper;
|
||||||
import com.zhyc.module.feed.domain.SgMaterial;
|
import com.zhyc.module.feed.domain.SgMaterial;
|
||||||
@@ -11,16 +12,12 @@ import com.zhyc.module.feed.service.ISgMaterialService;
|
|||||||
* 原料Service业务层处理
|
* 原料Service业务层处理
|
||||||
*
|
*
|
||||||
* @author HashMap
|
* @author HashMap
|
||||||
* @date 2025-08-11
|
* @date 2026-01-16
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SgMaterialServiceImpl implements ISgMaterialService
|
public class SgMaterialServiceImpl implements ISgMaterialService {
|
||||||
{
|
@Autowired
|
||||||
private final SgMaterialMapper sgMaterialMapper;
|
private SgMaterialMapper sgMaterialMapper;
|
||||||
|
|
||||||
public SgMaterialServiceImpl(SgMaterialMapper sgMaterialMapper) {
|
|
||||||
this.sgMaterialMapper = sgMaterialMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询原料
|
* 查询原料
|
||||||
@@ -29,8 +26,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService
|
|||||||
* @return 原料
|
* @return 原料
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SgMaterial selectSgMaterialByMaterialId(String materialId)
|
public SgMaterial selectSgMaterialByMaterialId(String materialId) {
|
||||||
{
|
|
||||||
return sgMaterialMapper.selectSgMaterialByMaterialId(materialId);
|
return sgMaterialMapper.selectSgMaterialByMaterialId(materialId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,8 +37,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService
|
|||||||
* @return 原料
|
* @return 原料
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial)
|
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial) {
|
||||||
{
|
|
||||||
return sgMaterialMapper.selectSgMaterialList(sgMaterial);
|
return sgMaterialMapper.selectSgMaterialList(sgMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +48,10 @@ public class SgMaterialServiceImpl implements ISgMaterialService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertSgMaterial(SgMaterial sgMaterial)
|
public int insertSgMaterial(SgMaterial sgMaterial) {
|
||||||
{
|
if (sgMaterialMapper.selectSgMaterialByMaterialId(sgMaterial.getMaterialId()) != null) {
|
||||||
|
throw new RuntimeException("重复的编码或名称");
|
||||||
|
}
|
||||||
return sgMaterialMapper.insertSgMaterial(sgMaterial);
|
return sgMaterialMapper.insertSgMaterial(sgMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +62,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateSgMaterial(SgMaterial sgMaterial)
|
public int updateSgMaterial(SgMaterial sgMaterial) {
|
||||||
{
|
|
||||||
return sgMaterialMapper.updateSgMaterial(sgMaterial);
|
return sgMaterialMapper.updateSgMaterial(sgMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,8 +73,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSgMaterialByMaterialIds(String[] materialIds)
|
public int deleteSgMaterialByMaterialIds(String[] materialIds) {
|
||||||
{
|
|
||||||
return sgMaterialMapper.deleteSgMaterialByMaterialIds(materialIds);
|
return sgMaterialMapper.deleteSgMaterialByMaterialIds(materialIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +84,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSgMaterialByMaterialId(String materialId)
|
public int deleteSgMaterialByMaterialId(String materialId) {
|
||||||
{
|
|
||||||
return sgMaterialMapper.deleteSgMaterialByMaterialId(materialId);
|
return sgMaterialMapper.deleteSgMaterialByMaterialId(materialId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询冻精库存列表
|
* 查询冻精库存列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:list')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(DdFs ddFs)
|
public TableDataInfo list(DdFs ddFs)
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出冻精库存列表
|
* 导出冻精库存列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:export')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:export')")
|
||||||
@Log(title = "冻精库存", businessType = BusinessType.EXPORT)
|
@Log(title = "冻精库存", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, DdFs ddFs)
|
public void export(HttpServletResponse response, DdFs ddFs)
|
||||||
@@ -62,7 +62,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取冻精库存详细信息
|
* 获取冻精库存详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:query')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增冻精库存
|
* 新增冻精库存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:add')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:add')")
|
||||||
@Log(title = "冻精库存", businessType = BusinessType.INSERT)
|
@Log(title = "冻精库存", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody DdFs ddFs)
|
public AjaxResult add(@RequestBody DdFs ddFs)
|
||||||
@@ -83,7 +83,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改冻精库存
|
* 修改冻精库存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:edit')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:edit')")
|
||||||
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
|
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody DdFs ddFs)
|
public AjaxResult edit(@RequestBody DdFs ddFs)
|
||||||
@@ -94,7 +94,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除冻精库存
|
* 删除冻精库存
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:remove')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:remove')")
|
||||||
@Log(title = "冻精库存", businessType = BusinessType.DELETE)
|
@Log(title = "冻精库存", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
@@ -105,7 +105,7 @@ public class DdFsController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 批量废弃
|
* 批量废弃
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:discard')")
|
@PreAuthorize("@ss.hasPermi('frozen:sperm:discard')")
|
||||||
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
|
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/discard")
|
@PutMapping("/discard")
|
||||||
public AjaxResult discard(@RequestBody List<DdFs> list) {
|
public AjaxResult discard(@RequestBody List<DdFs> list) {
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class ScBreedPlanController extends BaseController
|
|||||||
return success(scBreedPlanService.selectScBreedPlanById(id));
|
return success(scBreedPlanService.selectScBreedPlanById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增配种计划
|
* 新增配种计划
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.zhyc.module.produce.breed.controller;
|
package com.zhyc.module.produce.breed.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -299,4 +301,52 @@ public class ScDryMilkController extends BaseController
|
|||||||
return error("删除失败: " + e.getMessage());
|
return error("删除失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:quary')")
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = scDryMilkService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量验证耳号
|
||||||
|
*/
|
||||||
|
@GetMapping("/validateBatchEarTags")
|
||||||
|
public AjaxResult validateBatchEarTags(@RequestParam("manageTags") String manageTags) {
|
||||||
|
try {
|
||||||
|
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||||
|
return error("耳号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支持多种分隔符
|
||||||
|
String[] earTagArray = manageTags.split("[\\s,,]+");
|
||||||
|
List<Map<String, Object>> results = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String earTag : earTagArray) {
|
||||||
|
String cleanTag = earTag.trim();
|
||||||
|
if (cleanTag.isEmpty()) continue;
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("earTag", cleanTag);
|
||||||
|
|
||||||
|
Long sheepId = scDryMilkService.selectSheepIdByManageTags(cleanTag);
|
||||||
|
result.put("exists", sheepId != null);
|
||||||
|
result.put("sheepId", sheepId);
|
||||||
|
|
||||||
|
results.add(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(results);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("批量验证耳号失败", e);
|
||||||
|
return error("验证失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,14 +5,7 @@ import java.util.Map;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
@@ -62,7 +55,17 @@ public class ScLambingRecordController extends BaseController {
|
|||||||
return error("查询配种信息失败:" + e.getMessage());
|
return error("查询配种信息失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')")
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = scLambingRecordService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 导出产羔记录列表
|
* 导出产羔记录列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,14 +5,7 @@ import java.util.Map;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
@@ -131,4 +124,19 @@ public class ScMiscarriageRecordController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(scMiscarriageRecordService.deleteScMiscarriageRecordByIds(ids));
|
return toAjax(scMiscarriageRecordService.deleteScMiscarriageRecordByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = scMiscarriageRecordService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -356,4 +356,18 @@ public class ScPregnancyRecordController extends BaseController
|
|||||||
return error("调试测试失败: " + e.getMessage());
|
return error("调试测试失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = scPregnancyRecordService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,14 +5,7 @@ import java.util.Map;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
@@ -245,4 +238,19 @@ public class ScSheepDeathController extends BaseController
|
|||||||
return error("删除失败: " + e.getMessage());
|
return error("删除失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = scSheepDeathService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -6,14 +6,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
@@ -159,4 +152,20 @@ public class ScWeanRecordController extends BaseController {
|
|||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
return toAjax(scWeanRecordService.deleteScWeanRecordByIds(ids));
|
return toAjax(scWeanRecordService.deleteScWeanRecordByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
try {
|
||||||
|
List<String> earNumbers = scWeanRecordService.searchEarNumbers(query);
|
||||||
|
return success(earNumbers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("搜索耳号异常", e);
|
||||||
|
return error("搜索耳号失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.produce.breed.domain;
|
package com.zhyc.module.produce.breed.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -67,5 +69,15 @@ public class ScDryMilk extends BaseEntity
|
|||||||
@Excel(name = "事件类型")
|
@Excel(name = "事件类型")
|
||||||
private String eventType;
|
private String eventType;
|
||||||
|
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -121,6 +121,17 @@ public class ScLambingRecord extends BaseEntity
|
|||||||
@Excel(name = "未留养母羔数量")
|
@Excel(name = "未留养母羔数量")
|
||||||
private Integer unretainedFemaleCount;
|
private Integer unretainedFemaleCount;
|
||||||
|
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
/** 羔羊信息列表(从羊只信息表查询) */
|
/** 羔羊信息列表(从羊只信息表查询) */
|
||||||
private List<SheepLambInfo> lambInfoList;
|
private List<SheepLambInfo> lambInfoList;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.produce.breed.domain;
|
package com.zhyc.module.produce.breed.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
@@ -305,4 +307,15 @@ public class ScMiscarriageRecord extends BaseEntity
|
|||||||
.append("variety", getVariety())
|
.append("variety", getVariety())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.produce.breed.domain;
|
package com.zhyc.module.produce.breed.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -119,4 +121,14 @@ public class ScPregnancyRecord extends BaseEntity
|
|||||||
/** 配后天数 */
|
/** 配后天数 */
|
||||||
@Excel(name = "配后天数")
|
@Excel(name = "配后天数")
|
||||||
private Integer daysAfterMating;
|
private Integer daysAfterMating;
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.produce.breed.domain;
|
package com.zhyc.module.produce.breed.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
@@ -353,4 +355,15 @@ public class ScSheepDeath extends BaseEntity
|
|||||||
.append("isDelete", getIsDelete())
|
.append("isDelete", getIsDelete())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.zhyc.module.produce.breed.domain;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
@@ -94,5 +96,15 @@ public class ScWeanRecord extends BaseEntity {
|
|||||||
@Excel(name = "繁育状态")
|
@Excel(name = "繁育状态")
|
||||||
private String breedingStatus;
|
private String breedingStatus;
|
||||||
|
|
||||||
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
public List<String> getAllEarNumbers() {
|
||||||
|
return allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||||
|
this.allEarNumbers = allEarNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.module.produce.breed.domain.ScDryMilk;
|
import com.zhyc.module.produce.breed.domain.ScDryMilk;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 干奶记录Mapper接口
|
* 干奶记录Mapper接口
|
||||||
@@ -68,4 +69,12 @@ public interface ScDryMilkMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScDryMilkByIds(Long[] ids);
|
public int deleteScDryMilkByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -85,4 +85,6 @@ public interface ScLambingRecordMapper
|
|||||||
* @return 后代总数
|
* @return 后代总数
|
||||||
*/
|
*/
|
||||||
Long countOffspringByRamId(String ramManageTags);
|
Long countOffspringByRamId(String ramManageTags);
|
||||||
|
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流产记录Mapper接口
|
* 流产记录Mapper接口
|
||||||
@@ -67,4 +68,12 @@ public interface ScMiscarriageRecordMapper
|
|||||||
* @return 羊只信息
|
* @return 羊只信息
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -100,4 +100,12 @@ public interface ScPregnancyRecordMapper
|
|||||||
*/
|
*/
|
||||||
Long countPregnantEwesByRamIdAndBreedType(@Param("ramManageTags") String ramManageTags,
|
Long countPregnantEwesByRamIdAndBreedType(@Param("ramManageTags") String ramManageTags,
|
||||||
@Param("breedType") Integer breedType);
|
@Param("breedType") Integer breedType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -86,4 +86,12 @@ public interface ScSheepDeathMapper
|
|||||||
* @return 更新结果
|
* @return 更新结果
|
||||||
*/
|
*/
|
||||||
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 断奶记录Mapper接口
|
* 断奶记录Mapper接口
|
||||||
@@ -75,4 +76,12 @@ public interface ScWeanRecordMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
|
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -60,4 +60,12 @@ public interface IScDryMilkService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScDryMilkById(Long id);
|
public int deleteScDryMilkById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> searchEarNumbers(String query);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,6 @@ public interface IScLambingRecordService {
|
|||||||
* 查询羔羊详情
|
* 查询羔羊详情
|
||||||
*/
|
*/
|
||||||
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId);
|
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId);
|
||||||
|
|
||||||
|
public List<String> searchEarNumbers(String query);
|
||||||
}
|
}
|
||||||
@@ -67,4 +67,11 @@ public interface IScMiscarriageRecordService
|
|||||||
* @return 羊只信息
|
* @return 羊只信息
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> searchEarNumbers(String query);
|
||||||
}
|
}
|
||||||
@@ -75,4 +75,11 @@ public interface IScPregnancyRecordService
|
|||||||
* @return 配种信息
|
* @return 配种信息
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getBreedInfoByManageTags(String manageTags);
|
public Map<String, Object> getBreedInfoByManageTags(String manageTags);
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> searchEarNumbers(String query);
|
||||||
}
|
}
|
||||||
@@ -67,4 +67,12 @@ public interface IScSheepDeathService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScSheepDeathById(Long id);
|
public int deleteScSheepDeathById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> searchEarNumbers(String query);
|
||||||
}
|
}
|
||||||
@@ -66,4 +66,12 @@ public interface IScWeanRecordService {
|
|||||||
* @return 羊只ID
|
* @return 羊只ID
|
||||||
*/
|
*/
|
||||||
public Long selectSheepIdByEarNumber(String earNumber);
|
public Long selectSheepIdByEarNumber(String earNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模糊查询母羊耳号列表
|
||||||
|
*
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> searchEarNumbers(String query);
|
||||||
}
|
}
|
||||||
@@ -138,4 +138,12 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
|
|||||||
{
|
{
|
||||||
return scDryMilkMapper.deleteScDryMilkById(id);
|
return scDryMilkMapper.deleteScDryMilkById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScLambingRecordServiceImpl.java 添加方法
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return scDryMilkMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,10 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
|||||||
return scLambingRecordMapper.getLatestBreedingByEarNumber(earNumber);
|
return scLambingRecordMapper.getLatestBreedingByEarNumber(earNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return scLambingRecordMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 新增产羔记录(包含羔羊详情)
|
* 新增产羔记录(包含羔羊详情)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -167,4 +167,9 @@ public class ScMiscarriageRecordServiceImpl implements IScMiscarriageRecordServi
|
|||||||
|
|
||||||
// 验证通过
|
// 验证通过
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return scMiscarriageRecordMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -271,4 +271,8 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
|||||||
System.err.println("更新羊只怀孕状态失败: " + e.getMessage());
|
System.err.println("更新羊只怀孕状态失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return scPregnancyRecordMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -207,4 +207,9 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
|
|
||||||
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return scSheepDeathMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user