Compare commits
83 Commits
899b74ef27
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f65048d16 | |||
|
|
4755a327eb | ||
|
|
2a39664c38 | ||
|
|
b26a803aab | ||
| 6261b65040 | |||
| 73a6e881e3 | |||
| ca54b5f544 | |||
| e9e5e88a73 | |||
| 5693ca46c0 | |||
|
|
68cd6b0e60 | ||
|
|
1a5e98f70f | ||
| 0fc748bbfd | |||
| b8b15604b3 | |||
| 5abf1cbff4 | |||
| 48d82ce7c0 | |||
| e624f971de | |||
| 18f7808b67 | |||
| 2f646ba797 | |||
|
|
4818ed5fc5 | ||
|
|
204bbc5ee2 | ||
|
|
e3774cfde4 | ||
| 1f3cac240b | |||
|
|
6b6770c99e | ||
| 187b4ea840 | |||
| 3443f080fb | |||
| 7d72107144 | |||
|
|
4dd01245fc | ||
|
|
bbc19b47ca | ||
| 404fd4837a | |||
| 38dc069ca1 | |||
| 198c6eb263 | |||
| 708589b420 | |||
| b4d3943e6a | |||
| b84c35fe65 | |||
| 094da396c1 | |||
| d9a621d6a7 | |||
| 7bce9a0774 | |||
| 5cf769c9f5 | |||
| fb80399602 | |||
| 7dbe337a93 | |||
| 591b6d537f | |||
| 928fe4d9bc | |||
|
|
d637bf5bc1 | ||
| 4ddc661987 | |||
| 7cc0f806ba | |||
| de244cc1d3 | |||
| 6e575fdd21 | |||
| 51d1c5d145 | |||
|
|
e177df656f | ||
| fd16c66412 | |||
| 68ea3b2721 | |||
| 2c17d04b7a | |||
| 9ed2039df0 | |||
| 57b5415405 | |||
| e233d50b56 | |||
| 72a671fac2 | |||
|
|
f138074f70 | ||
|
|
163cf5e578 | ||
| 504a6a6203 | |||
| 2f6a1a9600 | |||
|
|
5436cb1071 | ||
|
|
7b3f879198 | ||
| 4c6d3f1c49 | |||
| 21eedb8508 | |||
| fa65442f58 | |||
| 52a61c0567 | |||
| 4ab62cd1f2 | |||
|
|
2f0e80868e | ||
| b47aa9b269 | |||
| 5a2f59b02d | |||
| 40fc60ddc9 | |||
| 464126195d | |||
|
|
8f9944d069 | ||
|
|
1736b51fea | ||
| f0acd149c7 | |||
| 086cb43359 | |||
| c9cefa3d33 | |||
| 62947ca5e8 | |||
| 7890c4d792 | |||
|
|
219ac30e28 | ||
|
|
ced5b0b09a | ||
| 5bcfadfd85 | |||
| 02b8eefc8d |
14
pom.xml
14
pom.xml
@@ -190,7 +190,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- POI 相关依赖 -->
|
||||
@@ -259,6 +259,18 @@
|
||||
<version>${kaptcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ... existing code ... -->
|
||||
|
||||
<!-- Tess4J OCR 工具 -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
<version>4.5.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<!-- ... existing code ... -->
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>zhyc</groupId>
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- Tess4J OCR 识别 -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.tess4j</groupId>
|
||||
<artifactId>tess4j</artifactId>
|
||||
</dependency>
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
|
||||
@@ -76,6 +76,9 @@ public class SysDeptController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (!deptService.checkRanchName(dept)){
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,牧场名称已存在");
|
||||
}
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
|
||||
@@ -7,8 +7,8 @@ spring:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: 123456
|
||||
# username: zhyc
|
||||
# password: zhyc1234
|
||||
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: zhyc
|
||||
password: yszh123
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataScope
|
||||
|
||||
@@ -31,6 +31,10 @@ public class SysDept extends BaseEntity
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
/** 牧场id */
|
||||
private Long ranchId;
|
||||
private String ranchName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
@@ -55,6 +59,22 @@ public class SysDept extends BaseEntity
|
||||
/** 子部门 */
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
public String getRanchName() {
|
||||
return ranchName;
|
||||
}
|
||||
|
||||
public void setRanchName(String ranchName) {
|
||||
this.ranchName = ranchName;
|
||||
}
|
||||
|
||||
public Long getRanchId() {
|
||||
return ranchId;
|
||||
}
|
||||
|
||||
public void setRanchId(Long ranchId) {
|
||||
this.ranchId = ranchId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zhyc.common.core.domain.entity;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 牧场管理对象 da_ranch
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public class SysRanch extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 牧场名称 */
|
||||
private String ranch;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRanch() {
|
||||
return ranch;
|
||||
}
|
||||
|
||||
public void setRanch(String ranch) {
|
||||
this.ranch = ranch;
|
||||
}
|
||||
}
|
||||
@@ -111,10 +111,12 @@ public class SecurityConfig
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录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("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.framework.security.context.AuthenticationContextHolder;
|
||||
|
||||
/**
|
||||
* 登录密码方法
|
||||
* 系统密码服务类,用于处理登录密码验证相关的业务逻辑,包括密码错误次数限制、账户锁定等功能
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@@ -31,7 +31,7 @@ public class SysPasswordService
|
||||
private int lockTime;
|
||||
|
||||
/**
|
||||
* 登录账户密码错误次数缓存键名
|
||||
* 构建登录账户密码错误次数缓存键名
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return 缓存键key
|
||||
@@ -41,12 +41,21 @@ public class SysPasswordService
|
||||
return CacheConstants.PWD_ERR_CNT_KEY + username;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户登录信息,包括密码匹配验证和错误次数限制检查
|
||||
*
|
||||
* @param user 待验证的系统用户对象
|
||||
* @throws UserPasswordRetryLimitExceedException 当密码错误次数超过限制时抛出异常
|
||||
* @throws UserPasswordNotMatchException 当密码不匹配时抛出异常
|
||||
*/
|
||||
public void validate(SysUser user)
|
||||
{
|
||||
// 获取当前认证的用户名和密码
|
||||
Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext();
|
||||
String username = usernamePasswordAuthenticationToken.getName();
|
||||
String password = usernamePasswordAuthenticationToken.getCredentials().toString();
|
||||
|
||||
// 从Redis缓存中获取该用户的密码错误次数
|
||||
Integer retryCount = redisCache.getCacheObject(getCacheKey(username));
|
||||
|
||||
if (retryCount == null)
|
||||
@@ -54,28 +63,44 @@ public class SysPasswordService
|
||||
retryCount = 0;
|
||||
}
|
||||
|
||||
// 检查是否达到最大重试次数限制
|
||||
if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
|
||||
{
|
||||
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
|
||||
}
|
||||
|
||||
// 验证密码是否匹配
|
||||
if (!matches(user, password))
|
||||
{
|
||||
// 密码不匹配时,增加错误次数并更新缓存
|
||||
retryCount = retryCount + 1;
|
||||
redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 密码匹配成功,清除登录记录缓存
|
||||
clearLoginRecordCache(username);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证原始密码与用户存储密码是否匹配
|
||||
*
|
||||
* @param user 系统用户对象
|
||||
* @param rawPassword 原始密码字符串
|
||||
* @return 密码匹配返回true,否则返回false
|
||||
*/
|
||||
public boolean matches(SysUser user, String rawPassword)
|
||||
{
|
||||
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除指定登录名的登录记录缓存
|
||||
*
|
||||
* @param loginName 登录用户名
|
||||
*/
|
||||
public void clearLoginRecordCache(String loginName)
|
||||
{
|
||||
if (redisCache.hasKey(getCacheKey(loginName)))
|
||||
|
||||
@@ -54,7 +54,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
|
||||
throw new ServiceException(MessageUtils.message("user.blocked"));
|
||||
}
|
||||
|
||||
passwordService.validate(user);
|
||||
// passwordService.validate(user);
|
||||
|
||||
return createLoginUser(user);
|
||||
}
|
||||
|
||||
@@ -155,6 +155,56 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</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>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</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,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);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.zhyc.module.base.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
@@ -46,6 +44,18 @@ public class BasSheepController extends BaseController {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出羊只基本信息列表
|
||||
*/
|
||||
@@ -74,6 +84,11 @@ public class BasSheepController extends BaseController {
|
||||
@Log(title = "羊只基本信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasSheep basSheep) {
|
||||
|
||||
// 新增下面这两行:从当前登录态中获取部门ID和用户ID,并赋值给即将保存的实体
|
||||
basSheep.setDeptId(getDeptId());
|
||||
basSheep.setUserId(getUserId());
|
||||
|
||||
return toAjax(basSheepService.insertBasSheep(basSheep));
|
||||
}
|
||||
|
||||
@@ -98,26 +113,69 @@ public class BasSheepController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号查询
|
||||
* 批量查询羊只耳号状态
|
||||
*/
|
||||
@GetMapping("/byManageTags/{manageTags}")
|
||||
public AjaxResult byManageTags(@PathVariable String manageTags) {
|
||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||
if (sheep == null) {
|
||||
return error("未找到对应的羊只");
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
// 补品种名称
|
||||
BasSheepVariety variety = basSheepVarietyService.selectBasSheepVarietyById(sheep.getVarietyId());
|
||||
sheep.setVarietyName(variety == null ? "" : variety.getVariety());
|
||||
// 批量查询模式 - 使用空格或逗号分割
|
||||
String[] tags = manageTags.split("[\\s,,]+");
|
||||
|
||||
return success(sheep);
|
||||
try {
|
||||
// 过滤掉空值并去重
|
||||
List<String> validTags = Arrays.stream(tags)
|
||||
.map(String::trim)
|
||||
.filter(tag -> !tag.isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (validTags.isEmpty()) {
|
||||
return error("有效的耳号不能为空");
|
||||
}
|
||||
|
||||
// 查询所有存在的羊只
|
||||
List<BasSheep> existingSheep = basSheepService.selectBasSheepByManageTagsList(validTags);
|
||||
if (validTags.size() == 1 && existingSheep.size() == 1) {
|
||||
return success(existingSheep.get(0)); //直接返回羊只对象
|
||||
}
|
||||
Set<String> existingTagSet = existingSheep.stream()
|
||||
.map(BasSheep::getManageTags)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 分别统计在羊群和不在羊群的耳号
|
||||
List<String> inHerd = new ArrayList<>();
|
||||
List<String> notInHerd = new ArrayList<>();
|
||||
|
||||
for (String tag : validTags) {
|
||||
if (existingTagSet.contains(tag)) {
|
||||
inHerd.add(tag);
|
||||
} else {
|
||||
notInHerd.add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("inHerd", inHerd);
|
||||
result.put("notInHerd", notInHerd);
|
||||
result.put("total", validTags.size());
|
||||
result.put("inHerdCount", inHerd.size());
|
||||
result.put("notInHerdCount", notInHerd.size());
|
||||
result.put("sheepDetails", existingSheep);
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("批量查询羊只状态异常", e);
|
||||
return error("批量查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据羊只类型ID查询羊只列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
|
||||
// @PreAuthorize("@ss.hasPermi('sheep:sheep:queryByType')")
|
||||
@GetMapping("/listByTypeId")
|
||||
public TableDataInfo listByTypeId(Integer typeId) {
|
||||
if (typeId == null) {
|
||||
@@ -125,7 +183,6 @@ public class BasSheepController extends BaseController {
|
||||
}
|
||||
BasSheep query = new BasSheep();
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -142,7 +199,6 @@ public class BasSheepController extends BaseController {
|
||||
BasSheep query = new BasSheep();
|
||||
query.setSheepfoldId(sheepfoldId.longValue());
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -179,7 +235,6 @@ public class BasSheepController extends BaseController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断耳号是否存在(用于新增羊只时校验)
|
||||
*/
|
||||
|
||||
@@ -69,6 +69,10 @@ public class BasSheepGroupController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasSheepGroup basSheepGroup)
|
||||
{
|
||||
// 👇 新增这两行赋值语句
|
||||
basSheepGroup.setDeptId(getDeptId());
|
||||
basSheepGroup.setUserId(getUserId());
|
||||
|
||||
return toAjax(basSheepGroupService.insertBasSheepGroup(basSheepGroup));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DaRanchController extends BaseController
|
||||
/**
|
||||
* 获取指定牧场下的所有羊只耳号
|
||||
*/
|
||||
// @GetMapping("/getSheepByRanchId/{ranchId}")
|
||||
@GetMapping("/getSheepByRanchId/{ranchId}")
|
||||
public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) {
|
||||
List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId);
|
||||
return AjaxResult.success(sheepList);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.base.domain.DaSheepfoldSummaryExportVO;
|
||||
import com.zhyc.module.base.service.IDaSheepfoldService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -44,6 +45,18 @@ public class DaSheepfoldController extends BaseController
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主表格:羊舍级别汇总列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:list')")
|
||||
@GetMapping("/summaryList")
|
||||
public TableDataInfo summaryList(DaSheepfold daSheepfold) {
|
||||
startPage();
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/*
|
||||
* 根据羊舍ids查询羊只id
|
||||
* */
|
||||
@@ -69,6 +82,73 @@ public class DaSheepfoldController extends BaseController
|
||||
util.exportExcel(response, list, "羊舍管理数据");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出羊舍管理汇总列表(主表格数据)- 新增方法
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:export')")
|
||||
@Log(title = "羊舍管理汇总导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportSummary")
|
||||
public void exportSummary(HttpServletResponse response, DaSheepfold daSheepfold) {
|
||||
// 1. 查询汇总数据
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
|
||||
// 2. 转换为导出VO
|
||||
List<DaSheepfoldSummaryExportVO> exportList = convertToExportVO(list);
|
||||
|
||||
// 3. 使用VO类导出Excel
|
||||
ExcelUtil<DaSheepfoldSummaryExportVO> util = new ExcelUtil<>(DaSheepfoldSummaryExportVO.class);
|
||||
util.exportExcel(response, exportList, "羊舍管理汇总数据");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将DaSheepfold列表转换为导出VO列表
|
||||
*/
|
||||
private List<DaSheepfoldSummaryExportVO> convertToExportVO(List<DaSheepfold> daSheepfoldList) {
|
||||
List<DaSheepfoldSummaryExportVO> voList = new ArrayList<>();
|
||||
|
||||
for (DaSheepfold entity : daSheepfoldList) {
|
||||
DaSheepfoldSummaryExportVO vo = new DaSheepfoldSummaryExportVO();
|
||||
|
||||
// 字典翻译:牧场ID -> 牧场名称
|
||||
if (entity.getRanchId() != null) {
|
||||
String ranchName = DictUtils.getDictLabel("da_ranch", entity.getRanchId().toString());
|
||||
vo.setRanchName(ranchName != null ? ranchName : entity.getRanchId().toString());
|
||||
} else {
|
||||
vo.setRanchName("");
|
||||
}
|
||||
|
||||
// 使用汇总查询中的羊舍名称
|
||||
vo.setSheepfoldName(entity.getSheepfoldName() != null ? entity.getSheepfoldName() : "");
|
||||
|
||||
// 字典翻译:羊舍类型ID -> 羊舍类型名称
|
||||
if (entity.getSheepfoldTypeId() != null) {
|
||||
String typeName = DictUtils.getDictLabel("bas_sheepfold_type", entity.getSheepfoldTypeId().toString());
|
||||
vo.setSheepfoldTypeName(typeName != null ? typeName : entity.getSheepfoldTypeId().toString());
|
||||
} else {
|
||||
vo.setSheepfoldTypeName("");
|
||||
}
|
||||
|
||||
// 羊舍编号
|
||||
vo.setSheepfoldNo(entity.getSheepfoldNo() != null ? entity.getSheepfoldNo() : "");
|
||||
|
||||
// 羊数(确保不为空)
|
||||
vo.setTotalSheepCount(entity.getTotalSheepCount() != null ? entity.getTotalSheepCount() : 0);
|
||||
|
||||
// 备注
|
||||
vo.setComment(entity.getComment() != null ? entity.getComment() : "");
|
||||
|
||||
voList.add(vo);
|
||||
}
|
||||
|
||||
return voList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取羊舍管理详细信息
|
||||
*/
|
||||
@@ -87,6 +167,10 @@ public class DaSheepfoldController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DaSheepfold daSheepfold)
|
||||
{
|
||||
// 👇 新增这两行赋值语句
|
||||
daSheepfold.setDeptId(getDeptId());
|
||||
daSheepfold.setUserId(getUserId());
|
||||
|
||||
return toAjax(daSheepfoldService.insertDaSheepfold(daSheepfold));
|
||||
}
|
||||
|
||||
@@ -101,16 +185,74 @@ public class DaSheepfoldController extends BaseController
|
||||
return toAjax(daSheepfoldService.updateDaSheepfold(daSheepfold));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 删除羊舍管理
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:remove')")
|
||||
// @Log(title = "羊舍管理", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public AjaxResult remove(@PathVariable Long[] ids)
|
||||
// {
|
||||
// return toAjax(daSheepfoldService.deleteDaSheepfoldByIds(ids));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除羊舍管理
|
||||
* 修改后:根据组合条件删除羊圈信息(单条)
|
||||
* 接收ranch_id/sheepfold_no/sheepfold_type_id/sheepfold_name组合条件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:remove')")
|
||||
@Log(title = "羊舍管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(daSheepfoldService.deleteDaSheepfoldByIds(ids));
|
||||
@PreAuthorize("@ss.hasPermi('sheep:sheepfold:remove')")
|
||||
@DeleteMapping("/deleteByCondition")
|
||||
public AjaxResult removeByCondition(@RequestBody DaSheepfold sheepfold) {
|
||||
// 1. 校验核心条件非空(避免条件缺失导致误删)
|
||||
if (sheepfold.getRanchId() == null
|
||||
|| sheepfold.getSheepfoldNo() == null || sheepfold.getSheepfoldNo().isEmpty()
|
||||
|| sheepfold.getSheepfoldTypeId() == null) {
|
||||
return AjaxResult.error("删除失败:核心条件(牧场ID/羊圈编号/羊圈类型ID)不能为空");
|
||||
}
|
||||
// 2. 调用Service执行组合条件删除
|
||||
boolean deleteResult = daSheepfoldService.deleteSheepfoldByCondition(sheepfold);
|
||||
if (deleteResult) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败:未找到匹配条件的记录");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 【扩展】批量删除:接收多条组合条件数据,循环删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep:sheepfold:remove')")
|
||||
@DeleteMapping("/batchDeleteByCondition")
|
||||
public AjaxResult batchRemoveByCondition(@RequestBody List<DaSheepfold> sheepfoldList) {
|
||||
if (sheepfoldList == null || sheepfoldList.isEmpty()) {
|
||||
return AjaxResult.error("删除失败:请选择要删除的羊圈数据");
|
||||
}
|
||||
// 统计成功删除的数量
|
||||
int successCount = 0;
|
||||
for (DaSheepfold sheepfold : sheepfoldList) {
|
||||
// 跳过条件不全的记录
|
||||
if (sheepfold.getRanchId() == null
|
||||
|| sheepfold.getSheepfoldNo() == null || sheepfold.getSheepfoldNo().isEmpty()
|
||||
|| sheepfold.getSheepfoldTypeId() == null) {
|
||||
continue;
|
||||
}
|
||||
if (daSheepfoldService.deleteSheepfoldByCondition(sheepfold)) {
|
||||
successCount++;
|
||||
}
|
||||
}
|
||||
if (successCount == 0) {
|
||||
return AjaxResult.error("批量删除失败:无符合条件的记录可删除");
|
||||
} else {
|
||||
return AjaxResult.success("批量删除成功,共删除" + successCount + "条记录");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 检查羊舍编号是否已存在
|
||||
*/
|
||||
|
||||
@@ -8,25 +8,21 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
import com.zhyc.common.core.text.Convert;
|
||||
import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.service.ISheepFileService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 羊只档案Controller
|
||||
*
|
||||
* @author wyt
|
||||
* * @author wyt
|
||||
* @date 2025-07-13
|
||||
*/
|
||||
@RestController
|
||||
@@ -52,7 +48,7 @@ public class SheepFileController extends BaseController
|
||||
Integer pageSize = 10;
|
||||
|
||||
if (queryParams != null && !queryParams.isEmpty()) {
|
||||
// 提取分页参数
|
||||
// ------------------ 1. 处理分页参数 ------------------
|
||||
if (queryParams.containsKey("pageNum") && queryParams.get("pageNum") != null) {
|
||||
try {
|
||||
pageNum = Integer.parseInt(queryParams.get("pageNum").toString());
|
||||
@@ -60,7 +56,6 @@ public class SheepFileController extends BaseController
|
||||
// 使用默认值
|
||||
}
|
||||
} else if (queryParams.containsKey("page") && queryParams.get("page") != null) {
|
||||
// 如果 pageNum 不存在,则尝试使用 page
|
||||
try {
|
||||
pageNum = Integer.parseInt(queryParams.get("page").toString());
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -68,15 +63,13 @@ public class SheepFileController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (queryParams.containsKey("pageSize") && queryParams.get("pageSize") != null) {
|
||||
try {
|
||||
pageSize = Integer.parseInt(queryParams.get("pageSize").toString());
|
||||
} catch (NumberFormatException e) {
|
||||
// 使用默认值
|
||||
}
|
||||
}else if (queryParams.containsKey("limit") && queryParams.get("limit") != null) {
|
||||
// 如果 pageSize 不存在,则尝试使用 limit
|
||||
} else if (queryParams.containsKey("limit") && queryParams.get("limit") != null) {
|
||||
try {
|
||||
pageSize = Integer.parseInt(queryParams.get("limit").toString());
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -84,7 +77,25 @@ public class SheepFileController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 提取常规查询参数到 SheepFile 对象
|
||||
// ------------------ 2. 核心修复:处理 List 多选参数 ------------------
|
||||
// 使用 parseList 方法兼容处理 List、Array、逗号分隔字符串
|
||||
sheepFile.setAllEarNumbers(parseList(queryParams.get("allEarNumbers")));
|
||||
sheepFile.setAllEleEarNumbers(parseList(queryParams.get("allEleEarNumbers")));
|
||||
sheepFile.setAllBreedingStatus(parseList(queryParams.get("allBreedingStatus")));
|
||||
sheepFile.setAllSheepTypes(parseList(queryParams.get("allSheepTypes")));
|
||||
|
||||
// 性别处理 (需要将 String/Integer 转为 Long)
|
||||
List<String> genderStrs = parseList(queryParams.get("allGenders"));
|
||||
if (genderStrs != null && !genderStrs.isEmpty()) {
|
||||
List<Long> genderLongs = new ArrayList<>();
|
||||
for (String s : genderStrs) {
|
||||
Long v = convertToLong(s);
|
||||
if(v != null) genderLongs.add(v);
|
||||
}
|
||||
sheepFile.setAllGenders(genderLongs);
|
||||
}
|
||||
|
||||
// ------------------ 3. 处理常规单值参数 ------------------
|
||||
if (queryParams.containsKey("bsManageTags") && queryParams.get("bsManageTags") != null) {
|
||||
sheepFile.setBsManageTags(queryParams.get("bsManageTags").toString());
|
||||
}
|
||||
@@ -110,23 +121,17 @@ public class SheepFileController extends BaseController
|
||||
sheepFile.setBreed(queryParams.get("breed").toString());
|
||||
}
|
||||
|
||||
// 移除已经处理的参数,剩下的作为自定义筛选参数
|
||||
// ------------------ 4. 提取自定义参数 (排除已处理的键) ------------------
|
||||
// 定义需要跳过的key,防止重复处理
|
||||
Set<String> processedKeys = new HashSet<>(Arrays.asList(
|
||||
"pageNum", "pageSize", "page", "limit",
|
||||
"bsManageTags", "electronicTags", "drRanch", "variety", "name", "gender", "statusId", "breed",
|
||||
"allEarNumbers", "allEleEarNumbers", "allGenders", "allBreedingStatus", "allSheepTypes"
|
||||
));
|
||||
|
||||
for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
// 跳过常规参数和分页参数
|
||||
if ("bsManageTags".equals(key) || "electronicTags".equals(key) ||
|
||||
"drRanch".equals(key) || "variety".equals(key) ||
|
||||
"name".equals(key) || "gender".equals(key) ||
|
||||
"statusId".equals(key) || "breed".equals(key) ||
|
||||
"pageNum".equals(key) || "pageSize".equals(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 添加到自定义参数中
|
||||
if (value != null) {
|
||||
customParams.put(key, value);
|
||||
if (!processedKeys.contains(entry.getKey()) && entry.getValue() != null) {
|
||||
customParams.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,10 +140,45 @@ public class SheepFileController extends BaseController
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
|
||||
// 调用支持复杂查询的Service方法
|
||||
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
|
||||
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition( sheepFile,customParams);
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助方法:统一解析各种格式的数组参数
|
||||
* 支持:List, String[] (数组), Object[] (数组), "A,B" (逗号分隔字符串)
|
||||
*/
|
||||
private List<String> parseList(Object obj) {
|
||||
if (obj == null) return null;
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
if (obj instanceof List) {
|
||||
// JSON 传来的通常是 List
|
||||
for (Object o : (List<?>) obj) {
|
||||
if (o != null) result.add(o.toString());
|
||||
}
|
||||
} else if (obj.getClass().isArray()) {
|
||||
// 如果是数组
|
||||
if (obj instanceof Object[]) {
|
||||
for (Object o : (Object[]) obj) {
|
||||
if (o != null) result.add(o.toString());
|
||||
}
|
||||
} else if (obj instanceof String[]) {
|
||||
Collections.addAll(result, (String[]) obj);
|
||||
}
|
||||
} else if (obj instanceof String) {
|
||||
// 如果是逗号分隔字符串
|
||||
String s = (String) obj;
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
String[] split = s.split(",");
|
||||
Collections.addAll(result, split);
|
||||
}
|
||||
}
|
||||
|
||||
return result.isEmpty() ? null : result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换对象为Long类型
|
||||
*/
|
||||
@@ -170,66 +210,97 @@ public class SheepFileController extends BaseController
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
// 构建查询条件对象
|
||||
SheepFile sheepFile = new SheepFile();
|
||||
Map<String, Object> customParams = new HashMap<>();
|
||||
|
||||
// 解析所有请求参数
|
||||
Map<String, String[]> parameterMap = request.getParameterMap();
|
||||
|
||||
// 1. 更直接地获取前端参数
|
||||
String exportIdsStr = request.getParameter("exportIds");
|
||||
String visibleColumnsStr = request.getParameter("visibleColumns");
|
||||
|
||||
// 2. 遍历其他条件
|
||||
for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String[] values = entry.getValue();
|
||||
|
||||
if (values != null && values.length > 0 && StringUtils.isNotBlank(values[0])) {
|
||||
String value = values[0];
|
||||
|
||||
// 使用若依框架的工具方法处理参数
|
||||
switch (key) {
|
||||
case "bsManageTags":
|
||||
sheepFile.setBsManageTags(convertToString(value));
|
||||
break;
|
||||
case "electronicTags":
|
||||
sheepFile.setElectronicTags(convertToString(value));
|
||||
break;
|
||||
case "drRanch":
|
||||
sheepFile.setDrRanch(convertToString(value));
|
||||
break;
|
||||
case "variety":
|
||||
sheepFile.setVariety(convertToString(value));
|
||||
break;
|
||||
case "name":
|
||||
sheepFile.setName(convertToString(value));
|
||||
break;
|
||||
case "gender":
|
||||
sheepFile.setGender(Convert.toLong(value));
|
||||
break;
|
||||
case "statusId":
|
||||
sheepFile.setStatusId(Convert.toLong(value));
|
||||
break;
|
||||
case "breed":
|
||||
sheepFile.setBreed(convertToString(value));
|
||||
break;
|
||||
case "pageNum":
|
||||
case "pageSize":
|
||||
// 忽略分页参数
|
||||
case "bsManageTags": sheepFile.setBsManageTags(convertToString(value)); break;
|
||||
case "electronicTags": sheepFile.setElectronicTags(convertToString(value)); break;
|
||||
case "drRanch": sheepFile.setDrRanch(convertToString(value)); break;
|
||||
case "variety": sheepFile.setVariety(convertToString(value)); break;
|
||||
case "name": sheepFile.setName(convertToString(value)); break;
|
||||
case "gender": sheepFile.setGender(Convert.toLong(value)); break;
|
||||
case "statusId": sheepFile.setStatusId(Convert.toLong(value)); break;
|
||||
case "breed": sheepFile.setBreed(convertToString(value)); break;
|
||||
case "allEarNumbers": sheepFile.setAllEarNumbers(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allEleEarNumbers": sheepFile.setAllEleEarNumbers(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allBreedingStatus": sheepFile.setAllBreedingStatus(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allSheepTypes": sheepFile.setAllSheepTypes(new ArrayList<>(Arrays.asList(values))); break;
|
||||
case "allGenders":
|
||||
List<Long> genderList = new ArrayList<>();
|
||||
for(String v : values){
|
||||
Long l = Convert.toLong(v);
|
||||
if(l != null) genderList.add(l);
|
||||
}
|
||||
sheepFile.setAllGenders(genderList);
|
||||
break;
|
||||
case "pageNum": case "pageSize": case "exportIds": case "visibleColumns":
|
||||
break; // 忽略这些非数据库实体的字段
|
||||
default:
|
||||
// 自定义参数
|
||||
customParams.put(key, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 调用Service获取数据
|
||||
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
|
||||
// 3. 获取数据并执行行过滤
|
||||
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(sheepFile,customParams);
|
||||
if (StringUtils.isNotBlank(exportIdsStr)) {
|
||||
List<String> exportIdList = Arrays.asList(exportIdsStr.split(","));
|
||||
list = list.stream()
|
||||
.filter(item -> exportIdList.contains(String.valueOf(item.getId())))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
// 使用若依框架的Excel工具类导出
|
||||
// 4. 执行列过滤
|
||||
ExcelUtil<SheepFile> util = new ExcelUtil<>(SheepFile.class);
|
||||
|
||||
if (StringUtils.isNotBlank(visibleColumnsStr)) {
|
||||
// 清理字符串可能的空格并转为List
|
||||
List<String> visibleColumns = Arrays.asList(visibleColumnsStr.split("\\s*,\\s*"));
|
||||
List<String> colsToHide = new ArrayList<>();
|
||||
|
||||
Class<?> clazz = SheepFile.class;
|
||||
while (clazz != null) {
|
||||
for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {
|
||||
if (field.isAnnotationPresent(com.zhyc.common.annotation.Excel.class)) {
|
||||
if (!visibleColumns.contains(field.getName())) {
|
||||
colsToHide.add(field.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
|
||||
// 【核心修复】一次性把所有的字段数组传进去,规避若依底层循环覆盖的 Bug
|
||||
if (!colsToHide.isEmpty()) {
|
||||
util.hideColumn(colsToHide.toArray(new String[0]));
|
||||
}
|
||||
}
|
||||
|
||||
util.exportExcel(response, list, "羊只档案数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增:模糊搜索耳号接口 (用于前端下拉框远程搜索)
|
||||
*/
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query)
|
||||
{
|
||||
return success(sheepFileService.searchEarNumbers(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转换工具方法
|
||||
@@ -260,72 +331,46 @@ public class SheepFileController extends BaseController
|
||||
return success(sheep);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/stat/sheepType")
|
||||
public AjaxResult statSheepType() {
|
||||
return success(sheepFileService.countBySheepType());
|
||||
return success(sheepFileService.countBySheepType(new SheepFile()));
|
||||
}
|
||||
|
||||
@GetMapping("/stat/breedStatus")
|
||||
public AjaxResult statBreedStatus() {
|
||||
return success(sheepFileService.countByBreedStatus());
|
||||
return success(sheepFileService.countByBreedStatus(new SheepFile()));
|
||||
}
|
||||
|
||||
@GetMapping("/stat/variety")
|
||||
public AjaxResult statVariety() {
|
||||
return success(sheepFileService.countByVariety());
|
||||
return success(sheepFileService.countByVariety(new SheepFile()));
|
||||
}
|
||||
|
||||
@GetMapping("/stat/lactationParity")
|
||||
public AjaxResult statLactationParity() {
|
||||
return success(sheepFileService.countParityOfLactation());
|
||||
return success(sheepFileService.countParityOfLactation(new SheepFile()));
|
||||
}
|
||||
|
||||
// 在群总数
|
||||
@GetMapping("/stat/inGroupCount")
|
||||
public AjaxResult inGroupCount() {
|
||||
return success(sheepFileService.countInGroup());
|
||||
return success(sheepFileService.countInGroup(new SheepFile()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增API:获取字段的唯一值列表
|
||||
*
|
||||
* 这个API为前端自定义筛选功能提供数据支持
|
||||
* 当用户选择某个字段进行筛选时,前端调用此接口获取该字段的所有可能值
|
||||
*
|
||||
* @param fieldName 字段名(数据库列名)
|
||||
* @return AjaxResult 包含字段值列表的响应结果
|
||||
*
|
||||
* 接口地址:GET /sheep_file/sheep_file/field/{fieldName}
|
||||
*
|
||||
* 使用示例:
|
||||
* 前端请求:GET /sheep_file/sheep_file/field/bs_manage_tags
|
||||
* 后端返回:{ "code": 200, "msg": "操作成功", "data": ["AF00001", "AF00002", "AF00003"] }
|
||||
*
|
||||
* 安全说明:
|
||||
* - 使用白名单机制防止SQL注入
|
||||
* - 只有预定义的字段名可以被查询
|
||||
*/
|
||||
@GetMapping("/field/{fieldName}")
|
||||
public AjaxResult getFieldValues(@PathVariable String fieldName) {
|
||||
try {
|
||||
// 调用Service层获取字段唯一值
|
||||
List<String> fieldValues = sheepFileService.getFieldValues(fieldName);
|
||||
|
||||
// 返回成功响应,包含字段值列表
|
||||
return AjaxResult.success("获取字段值成功", fieldValues);
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
// 处理字段名不合法的异常
|
||||
// 这种情况通常是因为前端传入了不在白名单中的字段名
|
||||
return AjaxResult.error("请求的字段名不合法: " + e.getMessage());
|
||||
|
||||
} catch (Exception e) {
|
||||
// 处理其他未知异常
|
||||
// 记录日志并返回友好的错误信息
|
||||
logger.error("获取字段值失败,字段名: " + fieldName, e);
|
||||
return AjaxResult.error("系统错误,获取字段值失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.zhyc.module.base.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.base.util.SheepPedigreeExcelUtils;
|
||||
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.module.base.domain.SheepPedigree;
|
||||
import com.zhyc.module.base.service.ISheepPedigreeService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* VIEWController
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/pedigree")
|
||||
public class SheepPedigreeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISheepPedigreeService sheepPedigreeService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询VIEW列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:pedigree:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SheepPedigree sheepPedigree)
|
||||
{
|
||||
startPage();
|
||||
List<SheepPedigree> list = sheepPedigreeService.selectSheepPedigreeList(sheepPedigree);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出VIEW列表
|
||||
*/
|
||||
|
||||
// 在Controller/Service中注入工具类
|
||||
@Autowired
|
||||
private SheepPedigreeExcelUtils sheepPedigreeExcelUtils;
|
||||
@PreAuthorize("@ss.hasPermi('system:pedigree:export')")
|
||||
@Log(title = "VIEW", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SheepPedigree sheepPedigree) throws Exception {
|
||||
List<SheepPedigree> dataList = sheepPedigreeService.selectSheepPedigreeList(sheepPedigree);
|
||||
// 调用实例方法(而非静态方法)
|
||||
sheepPedigreeExcelUtils.export(response, dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取VIEW详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:pedigree:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sheepPedigreeService.selectSheepPedigreeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增VIEW
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:pedigree:add')")
|
||||
@Log(title = "VIEW", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SheepPedigree sheepPedigree)
|
||||
{
|
||||
return toAjax(sheepPedigreeService.insertSheepPedigree(sheepPedigree));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改VIEW
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:pedigree:edit')")
|
||||
@Log(title = "VIEW", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SheepPedigree sheepPedigree)
|
||||
{
|
||||
return toAjax(sheepPedigreeService.updateSheepPedigree(sheepPedigree));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除VIEW
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:pedigree:remove')")
|
||||
@Log(title = "VIEW", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sheepPedigreeService.deleteSheepPedigreeByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,14 @@ public class BasSheep extends BaseEntity
|
||||
@Excel(name = "母号id")
|
||||
private Long motherId;
|
||||
|
||||
/** 外祖父耳号 */
|
||||
@Excel(name = "外祖父")
|
||||
private String grandpa;
|
||||
|
||||
/** 外祖母耳号 */
|
||||
@Excel(name = "外祖母")
|
||||
private String grandma;
|
||||
|
||||
/** 受体id */
|
||||
@Excel(name = "受体id")
|
||||
private Long receptorId;
|
||||
@@ -181,4 +189,11 @@ public class BasSheep extends BaseEntity
|
||||
private Long isDelete;
|
||||
|
||||
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,24 @@ public class BasSheepGroup extends TreeEntity
|
||||
|
||||
private Integer isLeaf;
|
||||
|
||||
// 新增数据隔离字段
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,70 +19,6 @@ public class DaSheepfold extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getRanchId() {
|
||||
return ranchId;
|
||||
}
|
||||
|
||||
public void setRanchId(Long ranchId) {
|
||||
this.ranchId = ranchId;
|
||||
}
|
||||
|
||||
public String getSheepfoldName() {
|
||||
return sheepfoldName;
|
||||
}
|
||||
|
||||
public void setSheepfoldName(String sheepfoldName) {
|
||||
this.sheepfoldName = sheepfoldName;
|
||||
}
|
||||
|
||||
public Long getSheepfoldTypeId() {
|
||||
return sheepfoldTypeId;
|
||||
}
|
||||
|
||||
public void setSheepfoldTypeId(Long sheepfoldTypeId) {
|
||||
this.sheepfoldTypeId = sheepfoldTypeId;
|
||||
}
|
||||
|
||||
public String getSheepfoldNo() {
|
||||
return sheepfoldNo;
|
||||
}
|
||||
|
||||
public void setSheepfoldNo(String sheepfoldNo) {
|
||||
this.sheepfoldNo = sheepfoldNo;
|
||||
}
|
||||
|
||||
public String getRowNo() {
|
||||
return rowNo;
|
||||
}
|
||||
|
||||
public void setRowNo(String rowNo) {
|
||||
this.rowNo = rowNo;
|
||||
}
|
||||
|
||||
public String getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public void setColumns(String columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
/** 羊舍id */
|
||||
@Excel(name = "羊舍id")
|
||||
private Long id;
|
||||
@@ -115,5 +51,16 @@ public class DaSheepfold extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// 非数据库字段:单栏位羊数(子表格用)
|
||||
private Integer sheepCount;
|
||||
// 非数据库字段:羊舍总羊数(主表格用)
|
||||
private Integer totalSheepCount;
|
||||
|
||||
|
||||
// 👇 新增数据隔离字段
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zhyc.module.base.domain;
|
||||
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍汇总导出VO
|
||||
*/
|
||||
@Data
|
||||
public class DaSheepfoldSummaryExportVO {
|
||||
|
||||
/** 牧场名称 */
|
||||
@Excel(name = "牧场")
|
||||
private String ranchName;
|
||||
|
||||
/** 羊舍名称 */
|
||||
@Excel(name = "羊舍名称")
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 羊舍类型名称 */
|
||||
@Excel(name = "羊舍类型")
|
||||
|
||||
private String sheepfoldTypeName;
|
||||
|
||||
/** 羊舍编号 */
|
||||
@Excel(name = "羊舍编号")
|
||||
private String sheepfoldNo;
|
||||
|
||||
/** 羊舍总羊数 */
|
||||
@Excel(name = "羊数")
|
||||
private Integer totalSheepCount;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// 构造函数
|
||||
public DaSheepfoldSummaryExportVO() {
|
||||
}
|
||||
|
||||
public DaSheepfoldSummaryExportVO(String ranchName, String sheepfoldName,
|
||||
String sheepfoldTypeName, String sheepfoldNo,
|
||||
Integer totalSheepCount, String comment) {
|
||||
this.ranchName = ranchName;
|
||||
this.sheepfoldName = sheepfoldName;
|
||||
this.sheepfoldTypeName = sheepfoldTypeName;
|
||||
this.sheepfoldNo = sheepfoldNo;
|
||||
this.totalSheepCount = totalSheepCount;
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 创建文件:ExportConfig.java
|
||||
package com.zhyc.module.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 导出配置类
|
||||
*/
|
||||
@Data
|
||||
public class ExportConfig {
|
||||
/**
|
||||
* 要导出的列名列表(前端传递的驼峰命名)
|
||||
*/
|
||||
private List<String> columnNames;
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*/
|
||||
private Map<String, Object> queryParams;
|
||||
|
||||
/**
|
||||
* 自定义筛选条件
|
||||
*/
|
||||
private Map<String, Object> customFilterParams;
|
||||
}
|
||||
@@ -8,11 +8,11 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 羊只档案对象 sheep_file
|
||||
*
|
||||
* @author wyt
|
||||
* * @author wyt
|
||||
* @date 2025-07-13
|
||||
*/
|
||||
@Data
|
||||
@@ -29,6 +29,10 @@ public class SheepFile extends BaseEntity
|
||||
@Excel(name = "管理耳号")
|
||||
private String bsManageTags;
|
||||
|
||||
/** ================= 新增:多选查询字段 ================= */
|
||||
/** 耳号集合(多选/模糊查询用) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
/** 牧场id */
|
||||
// @Excel(name = "牧场id")
|
||||
private Long ranchId;
|
||||
@@ -49,6 +53,10 @@ public class SheepFile extends BaseEntity
|
||||
@Excel(name = "电子耳号")
|
||||
private String electronicTags;
|
||||
|
||||
/** ================= 新增:多选查询字段 ================= */
|
||||
/** 电子耳号集合(多选查询用) */
|
||||
private List<String> allEleEarNumbers;
|
||||
|
||||
/** 品种id */
|
||||
// @Excel(name = "品种id")
|
||||
private Long varietyId;
|
||||
@@ -65,14 +73,22 @@ public class SheepFile extends BaseEntity
|
||||
@Excel(name = "羊只类型")
|
||||
private String name;
|
||||
|
||||
/** ================= 新增:多选查询字段 ================= */
|
||||
/** 羊只类型集合(多选查询用) */
|
||||
private List<String> allSheepTypes;
|
||||
|
||||
// /** 性别 */
|
||||
//// @Excel(name = "性别")
|
||||
// private Long gender;
|
||||
|
||||
/** 性别 - 使用字典转换 */
|
||||
@Excel(name = "性别", dictType = "sheep_gender") // 添加 dictType
|
||||
@Excel(name = "性别", dictType = "sheep_gender")
|
||||
private Long gender;
|
||||
|
||||
/** ================= 新增:多选查询字段 ================= */
|
||||
/** 性别集合(多选查询用) */
|
||||
private List<Long> allGenders;
|
||||
|
||||
/** 出生日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@@ -103,7 +119,6 @@ public class SheepFile extends BaseEntity
|
||||
@Excel(name = "羊只状态", dictType = "sheep_status")
|
||||
private Long statusId;
|
||||
|
||||
|
||||
/** 断奶体重 */
|
||||
@Excel(name = "断奶体重")
|
||||
private Double weaningWeight;
|
||||
@@ -129,6 +144,10 @@ public class SheepFile extends BaseEntity
|
||||
@Excel(name = "繁殖状态")
|
||||
private String breed;
|
||||
|
||||
/** ================= 新增:多选查询字段 ================= */
|
||||
/** 繁殖状态集合(多选查询用) */
|
||||
private List<String> allBreedingStatus;
|
||||
|
||||
/** 父号id */
|
||||
// @Excel(name = "父号id")
|
||||
private Long bsFatherId;
|
||||
@@ -301,5 +320,9 @@ public class SheepFile extends BaseEntity
|
||||
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
/** 用户编号 */
|
||||
private Long userId;
|
||||
|
||||
/** 部门编号 */
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -0,0 +1,996 @@
|
||||
package com.zhyc.module.base.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
/**
|
||||
* VIEW对象 sheep_pedigree
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-04
|
||||
*/
|
||||
public class SheepPedigree extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String bsManageTags;
|
||||
|
||||
/** 牧场id */
|
||||
@Excel(name = "牧场id")
|
||||
private Long ranchId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String drRanch;
|
||||
|
||||
/** 羊舍id */
|
||||
@Excel(name = "羊舍id")
|
||||
private Long sheepfoldId;
|
||||
|
||||
/** 羊舍名称 */
|
||||
@Excel(name = "羊舍名称")
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 电子耳号 */
|
||||
@Excel(name = "电子耳号")
|
||||
private String electronicTags;
|
||||
|
||||
/** 品种id */
|
||||
@Excel(name = "品种id")
|
||||
private Long varietyId;
|
||||
|
||||
/** 品种 */
|
||||
@Excel(name = "品种")
|
||||
private String variety;
|
||||
|
||||
/** 家系 */
|
||||
@Excel(name = "家系")
|
||||
private String family;
|
||||
|
||||
/** 羊只类型 */
|
||||
@Excel(name = "羊只类型")
|
||||
private String name;
|
||||
|
||||
/** 性别 */
|
||||
@Excel(name = "性别")
|
||||
private Long gender;
|
||||
|
||||
/** 出生日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long dayAge;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long monthAge;
|
||||
|
||||
/** 胎次 */
|
||||
@Excel(name = "胎次")
|
||||
private Long parity;
|
||||
|
||||
/** 出生体重 */
|
||||
@Excel(name = "出生体重")
|
||||
private Long birthWeight;
|
||||
|
||||
/** 断奶日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date weaningDate;
|
||||
|
||||
/** 羊只状态 */
|
||||
@Excel(name = "羊只状态")
|
||||
private Long statusId;
|
||||
|
||||
/** 断奶体重 */
|
||||
@Excel(name = "断奶体重")
|
||||
private Long weaningWeight;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long weaningDayAge;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private BigDecimal weaningDailyGain;
|
||||
|
||||
/** 当前体重 */
|
||||
@Excel(name = "当前体重")
|
||||
private Long currentWeight;
|
||||
|
||||
/** 繁育状态id */
|
||||
@Excel(name = "繁育状态id")
|
||||
private Long breedStatusId;
|
||||
|
||||
/** 繁殖状态 */
|
||||
@Excel(name = "繁殖状态")
|
||||
private String breed;
|
||||
|
||||
/** 父号id */
|
||||
@Excel(name = "父号id")
|
||||
private Long bsFatherId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String fatherManageTags;
|
||||
|
||||
/** 母号id */
|
||||
@Excel(name = "母号id")
|
||||
private Long bsMotherId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String motherManageTags;
|
||||
|
||||
/** 受体id */
|
||||
@Excel(name = "受体id")
|
||||
private Long receptorId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String receptorManageTags;
|
||||
|
||||
/** 父号id */
|
||||
@Excel(name = "父号id")
|
||||
private Long fatherFatherId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "祖父管理耳号")
|
||||
private String grandfatherManageTags;
|
||||
|
||||
/** 母号id */
|
||||
@Excel(name = "母号id")
|
||||
private Long fatherMotherId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "祖母管理耳号")
|
||||
private String grandmotherManageTags;
|
||||
|
||||
/** 父号id */
|
||||
@Excel(name = "父号id")
|
||||
private Long fatherId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String maternalGrandfatherManageTags;
|
||||
|
||||
/** 母号id */
|
||||
@Excel(name = "母号id")
|
||||
private Long motherId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String maternalGrandmotherManageTags;
|
||||
|
||||
/** 配种日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date matingDate;
|
||||
|
||||
/** 配种类型 */
|
||||
@Excel(name = "配种类型")
|
||||
private Long matingTypeId;
|
||||
|
||||
/** 孕检日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "孕检日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date pregDate;
|
||||
|
||||
/** 产羔日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "产羔日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date lambingDate;
|
||||
|
||||
/** 产羔时怀孕天数 */
|
||||
@Excel(name = "产羔时怀孕天数")
|
||||
private Long lambingDay;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long matingDay;
|
||||
|
||||
/** 怀孕天数 */
|
||||
@Excel(name = "怀孕天数")
|
||||
private Long gestationDay;
|
||||
|
||||
/** 预产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date expectedDate;
|
||||
|
||||
/** 产后天数 */
|
||||
@Excel(name = "产后天数")
|
||||
private Long postLambingDay;
|
||||
|
||||
/** 泌乳天数 */
|
||||
@Excel(name = "泌乳天数")
|
||||
private Long lactationDay;
|
||||
|
||||
/** 空怀天数 */
|
||||
@Excel(name = "空怀天数")
|
||||
private Long anestrousDay;
|
||||
|
||||
/** 配种次数 */
|
||||
@Excel(name = "配种次数")
|
||||
private Long matingCounts;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long matingTotal;
|
||||
|
||||
/** 累计流产次数 */
|
||||
@Excel(name = "累计流产次数")
|
||||
private Long miscarriageCounts;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 是否性控 */
|
||||
@Excel(name = "是否性控")
|
||||
private Long controlled;
|
||||
|
||||
/** 体况评分 */
|
||||
@Excel(name = "体况评分")
|
||||
private Long body;
|
||||
|
||||
/** 乳房评分 */
|
||||
@Excel(name = "乳房评分")
|
||||
private Long breast;
|
||||
|
||||
/** 入群来源 */
|
||||
@Excel(name = "入群来源")
|
||||
private String source;
|
||||
|
||||
/** 入群日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "入群日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date sourceDate;
|
||||
|
||||
/** 来源牧场id */
|
||||
@Excel(name = "来源牧场id")
|
||||
private Long sourceRanchId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "来源牧场", readConverterExp = "$column.readConverterExp()")
|
||||
private String sourceRanch;
|
||||
|
||||
/** 是否删除 */
|
||||
@Excel(name = "是否删除")
|
||||
private Long isDelete;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "毛色", readConverterExp = "$column.readConverterExp()")
|
||||
private String sheepColor;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "等级", readConverterExp = "$column.readConverterExp()")
|
||||
private String groupName;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setBsManageTags(String bsManageTags)
|
||||
{
|
||||
this.bsManageTags = bsManageTags;
|
||||
}
|
||||
|
||||
public String getBsManageTags()
|
||||
{
|
||||
return bsManageTags;
|
||||
}
|
||||
|
||||
public void setRanchId(Long ranchId)
|
||||
{
|
||||
this.ranchId = ranchId;
|
||||
}
|
||||
|
||||
public Long getRanchId()
|
||||
{
|
||||
return ranchId;
|
||||
}
|
||||
|
||||
public void setDrRanch(String drRanch)
|
||||
{
|
||||
this.drRanch = drRanch;
|
||||
}
|
||||
|
||||
public String getDrRanch()
|
||||
{
|
||||
return drRanch;
|
||||
}
|
||||
|
||||
public void setSheepfoldId(Long sheepfoldId)
|
||||
{
|
||||
this.sheepfoldId = sheepfoldId;
|
||||
}
|
||||
|
||||
public Long getSheepfoldId()
|
||||
{
|
||||
return sheepfoldId;
|
||||
}
|
||||
|
||||
public void setSheepfoldName(String sheepfoldName)
|
||||
{
|
||||
this.sheepfoldName = sheepfoldName;
|
||||
}
|
||||
|
||||
public String getSheepfoldName()
|
||||
{
|
||||
return sheepfoldName;
|
||||
}
|
||||
|
||||
public void setElectronicTags(String electronicTags)
|
||||
{
|
||||
this.electronicTags = electronicTags;
|
||||
}
|
||||
|
||||
public String getElectronicTags()
|
||||
{
|
||||
return electronicTags;
|
||||
}
|
||||
|
||||
public void setVarietyId(Long varietyId)
|
||||
{
|
||||
this.varietyId = varietyId;
|
||||
}
|
||||
|
||||
public Long getVarietyId()
|
||||
{
|
||||
return varietyId;
|
||||
}
|
||||
|
||||
public void setVariety(String variety)
|
||||
{
|
||||
this.variety = variety;
|
||||
}
|
||||
|
||||
public String getVariety()
|
||||
{
|
||||
return variety;
|
||||
}
|
||||
|
||||
public void setFamily(String family)
|
||||
{
|
||||
this.family = family;
|
||||
}
|
||||
|
||||
public String getFamily()
|
||||
{
|
||||
return family;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setGender(Long gender)
|
||||
{
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public Long getGender()
|
||||
{
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setBirthday(Date birthday)
|
||||
{
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public Date getBirthday()
|
||||
{
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setDayAge(Long dayAge)
|
||||
{
|
||||
this.dayAge = dayAge;
|
||||
}
|
||||
|
||||
public Long getDayAge()
|
||||
{
|
||||
return dayAge;
|
||||
}
|
||||
|
||||
public void setMonthAge(Long monthAge)
|
||||
{
|
||||
this.monthAge = monthAge;
|
||||
}
|
||||
|
||||
public Long getMonthAge()
|
||||
{
|
||||
return monthAge;
|
||||
}
|
||||
|
||||
public void setParity(Long parity)
|
||||
{
|
||||
this.parity = parity;
|
||||
}
|
||||
|
||||
public Long getParity()
|
||||
{
|
||||
return parity;
|
||||
}
|
||||
|
||||
public void setBirthWeight(Long birthWeight)
|
||||
{
|
||||
this.birthWeight = birthWeight;
|
||||
}
|
||||
|
||||
public Long getBirthWeight()
|
||||
{
|
||||
return birthWeight;
|
||||
}
|
||||
|
||||
public void setWeaningDate(Date weaningDate)
|
||||
{
|
||||
this.weaningDate = weaningDate;
|
||||
}
|
||||
|
||||
public Date getWeaningDate()
|
||||
{
|
||||
return weaningDate;
|
||||
}
|
||||
|
||||
public void setStatusId(Long statusId)
|
||||
{
|
||||
this.statusId = statusId;
|
||||
}
|
||||
|
||||
public Long getStatusId()
|
||||
{
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public void setWeaningWeight(Long weaningWeight)
|
||||
{
|
||||
this.weaningWeight = weaningWeight;
|
||||
}
|
||||
|
||||
public Long getWeaningWeight()
|
||||
{
|
||||
return weaningWeight;
|
||||
}
|
||||
|
||||
public void setWeaningDayAge(Long weaningDayAge)
|
||||
{
|
||||
this.weaningDayAge = weaningDayAge;
|
||||
}
|
||||
|
||||
public Long getWeaningDayAge()
|
||||
{
|
||||
return weaningDayAge;
|
||||
}
|
||||
|
||||
public void setWeaningDailyGain(BigDecimal weaningDailyGain)
|
||||
{
|
||||
this.weaningDailyGain = weaningDailyGain;
|
||||
}
|
||||
|
||||
public BigDecimal getWeaningDailyGain()
|
||||
{
|
||||
return weaningDailyGain;
|
||||
}
|
||||
|
||||
public void setCurrentWeight(Long currentWeight)
|
||||
{
|
||||
this.currentWeight = currentWeight;
|
||||
}
|
||||
|
||||
public Long getCurrentWeight()
|
||||
{
|
||||
return currentWeight;
|
||||
}
|
||||
|
||||
public void setBreedStatusId(Long breedStatusId)
|
||||
{
|
||||
this.breedStatusId = breedStatusId;
|
||||
}
|
||||
|
||||
public Long getBreedStatusId()
|
||||
{
|
||||
return breedStatusId;
|
||||
}
|
||||
|
||||
public void setBreed(String breed)
|
||||
{
|
||||
this.breed = breed;
|
||||
}
|
||||
|
||||
public String getBreed()
|
||||
{
|
||||
return breed;
|
||||
}
|
||||
|
||||
public void setBsFatherId(Long bsFatherId)
|
||||
{
|
||||
this.bsFatherId = bsFatherId;
|
||||
}
|
||||
|
||||
public Long getBsFatherId()
|
||||
{
|
||||
return bsFatherId;
|
||||
}
|
||||
|
||||
public void setFatherManageTags(String fatherManageTags)
|
||||
{
|
||||
this.fatherManageTags = fatherManageTags;
|
||||
}
|
||||
|
||||
public String getFatherManageTags()
|
||||
{
|
||||
return fatherManageTags;
|
||||
}
|
||||
|
||||
public void setBsMotherId(Long bsMotherId)
|
||||
{
|
||||
this.bsMotherId = bsMotherId;
|
||||
}
|
||||
|
||||
public Long getBsMotherId()
|
||||
{
|
||||
return bsMotherId;
|
||||
}
|
||||
|
||||
public void setMotherManageTags(String motherManageTags)
|
||||
{
|
||||
this.motherManageTags = motherManageTags;
|
||||
}
|
||||
|
||||
public String getMotherManageTags()
|
||||
{
|
||||
return motherManageTags;
|
||||
}
|
||||
|
||||
public void setReceptorId(Long receptorId)
|
||||
{
|
||||
this.receptorId = receptorId;
|
||||
}
|
||||
|
||||
public Long getReceptorId()
|
||||
{
|
||||
return receptorId;
|
||||
}
|
||||
|
||||
public void setReceptorManageTags(String receptorManageTags)
|
||||
{
|
||||
this.receptorManageTags = receptorManageTags;
|
||||
}
|
||||
|
||||
public String getReceptorManageTags()
|
||||
{
|
||||
return receptorManageTags;
|
||||
}
|
||||
|
||||
public void setFatherFatherId(Long fatherFatherId)
|
||||
{
|
||||
this.fatherFatherId = fatherFatherId;
|
||||
}
|
||||
|
||||
public Long getFatherFatherId()
|
||||
{
|
||||
return fatherFatherId;
|
||||
}
|
||||
|
||||
public void setGrandfatherManageTags(String grandfatherManageTags)
|
||||
{
|
||||
this.grandfatherManageTags = grandfatherManageTags;
|
||||
}
|
||||
|
||||
public String getGrandfatherManageTags()
|
||||
{
|
||||
return grandfatherManageTags;
|
||||
}
|
||||
|
||||
public void setFatherMotherId(Long fatherMotherId)
|
||||
{
|
||||
this.fatherMotherId = fatherMotherId;
|
||||
}
|
||||
|
||||
public Long getFatherMotherId()
|
||||
{
|
||||
return fatherMotherId;
|
||||
}
|
||||
|
||||
public void setGrandmotherManageTags(String grandmotherManageTags)
|
||||
{
|
||||
this.grandmotherManageTags = grandmotherManageTags;
|
||||
}
|
||||
|
||||
public String getGrandmotherManageTags()
|
||||
{
|
||||
return grandmotherManageTags;
|
||||
}
|
||||
|
||||
public void setFatherId(Long fatherId)
|
||||
{
|
||||
this.fatherId = fatherId;
|
||||
}
|
||||
|
||||
public Long getFatherId()
|
||||
{
|
||||
return fatherId;
|
||||
}
|
||||
|
||||
public void setMaternalGrandfatherManageTags(String maternalGrandfatherManageTags)
|
||||
{
|
||||
this.maternalGrandfatherManageTags = maternalGrandfatherManageTags;
|
||||
}
|
||||
|
||||
public String getMaternalGrandfatherManageTags()
|
||||
{
|
||||
return maternalGrandfatherManageTags;
|
||||
}
|
||||
|
||||
public void setMotherId(Long motherId)
|
||||
{
|
||||
this.motherId = motherId;
|
||||
}
|
||||
|
||||
public Long getMotherId()
|
||||
{
|
||||
return motherId;
|
||||
}
|
||||
|
||||
public void setMaternalGrandmotherManageTags(String maternalGrandmotherManageTags)
|
||||
{
|
||||
this.maternalGrandmotherManageTags = maternalGrandmotherManageTags;
|
||||
}
|
||||
|
||||
public String getMaternalGrandmotherManageTags()
|
||||
{
|
||||
return maternalGrandmotherManageTags;
|
||||
}
|
||||
|
||||
public void setMatingDate(Date matingDate)
|
||||
{
|
||||
this.matingDate = matingDate;
|
||||
}
|
||||
|
||||
public Date getMatingDate()
|
||||
{
|
||||
return matingDate;
|
||||
}
|
||||
|
||||
public void setMatingTypeId(Long matingTypeId)
|
||||
{
|
||||
this.matingTypeId = matingTypeId;
|
||||
}
|
||||
|
||||
public Long getMatingTypeId()
|
||||
{
|
||||
return matingTypeId;
|
||||
}
|
||||
|
||||
public void setPregDate(Date pregDate)
|
||||
{
|
||||
this.pregDate = pregDate;
|
||||
}
|
||||
|
||||
public Date getPregDate()
|
||||
{
|
||||
return pregDate;
|
||||
}
|
||||
|
||||
public void setLambingDate(Date lambingDate)
|
||||
{
|
||||
this.lambingDate = lambingDate;
|
||||
}
|
||||
|
||||
public Date getLambingDate()
|
||||
{
|
||||
return lambingDate;
|
||||
}
|
||||
|
||||
public void setLambingDay(Long lambingDay)
|
||||
{
|
||||
this.lambingDay = lambingDay;
|
||||
}
|
||||
|
||||
public Long getLambingDay()
|
||||
{
|
||||
return lambingDay;
|
||||
}
|
||||
|
||||
public void setMatingDay(Long matingDay)
|
||||
{
|
||||
this.matingDay = matingDay;
|
||||
}
|
||||
|
||||
public Long getMatingDay()
|
||||
{
|
||||
return matingDay;
|
||||
}
|
||||
|
||||
public void setGestationDay(Long gestationDay)
|
||||
{
|
||||
this.gestationDay = gestationDay;
|
||||
}
|
||||
|
||||
public Long getGestationDay()
|
||||
{
|
||||
return gestationDay;
|
||||
}
|
||||
|
||||
public void setExpectedDate(Date expectedDate)
|
||||
{
|
||||
this.expectedDate = expectedDate;
|
||||
}
|
||||
|
||||
public Date getExpectedDate()
|
||||
{
|
||||
return expectedDate;
|
||||
}
|
||||
|
||||
public void setPostLambingDay(Long postLambingDay)
|
||||
{
|
||||
this.postLambingDay = postLambingDay;
|
||||
}
|
||||
|
||||
public Long getPostLambingDay()
|
||||
{
|
||||
return postLambingDay;
|
||||
}
|
||||
|
||||
public void setLactationDay(Long lactationDay)
|
||||
{
|
||||
this.lactationDay = lactationDay;
|
||||
}
|
||||
|
||||
public Long getLactationDay()
|
||||
{
|
||||
return lactationDay;
|
||||
}
|
||||
|
||||
public void setAnestrousDay(Long anestrousDay)
|
||||
{
|
||||
this.anestrousDay = anestrousDay;
|
||||
}
|
||||
|
||||
public Long getAnestrousDay()
|
||||
{
|
||||
return anestrousDay;
|
||||
}
|
||||
|
||||
public void setMatingCounts(Long matingCounts)
|
||||
{
|
||||
this.matingCounts = matingCounts;
|
||||
}
|
||||
|
||||
public Long getMatingCounts()
|
||||
{
|
||||
return matingCounts;
|
||||
}
|
||||
|
||||
public void setMatingTotal(Long matingTotal)
|
||||
{
|
||||
this.matingTotal = matingTotal;
|
||||
}
|
||||
|
||||
public Long getMatingTotal()
|
||||
{
|
||||
return matingTotal;
|
||||
}
|
||||
|
||||
public void setMiscarriageCounts(Long miscarriageCounts)
|
||||
{
|
||||
this.miscarriageCounts = miscarriageCounts;
|
||||
}
|
||||
|
||||
public Long getMiscarriageCounts()
|
||||
{
|
||||
return miscarriageCounts;
|
||||
}
|
||||
|
||||
public void setComment(String comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getComment()
|
||||
{
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setControlled(Long controlled)
|
||||
{
|
||||
this.controlled = controlled;
|
||||
}
|
||||
|
||||
public Long getControlled()
|
||||
{
|
||||
return controlled;
|
||||
}
|
||||
|
||||
public void setBody(Long body)
|
||||
{
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public Long getBody()
|
||||
{
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBreast(Long breast)
|
||||
{
|
||||
this.breast = breast;
|
||||
}
|
||||
|
||||
public Long getBreast()
|
||||
{
|
||||
return breast;
|
||||
}
|
||||
|
||||
public void setSource(String source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getSource()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSourceDate(Date sourceDate)
|
||||
{
|
||||
this.sourceDate = sourceDate;
|
||||
}
|
||||
|
||||
public Date getSourceDate()
|
||||
{
|
||||
return sourceDate;
|
||||
}
|
||||
|
||||
public void setSourceRanchId(Long sourceRanchId)
|
||||
{
|
||||
this.sourceRanchId = sourceRanchId;
|
||||
}
|
||||
|
||||
public Long getSourceRanchId()
|
||||
{
|
||||
return sourceRanchId;
|
||||
}
|
||||
|
||||
public void setSourceRanch(String sourceRanch)
|
||||
{
|
||||
this.sourceRanch = sourceRanch;
|
||||
}
|
||||
|
||||
public String getSourceRanch()
|
||||
{
|
||||
return sourceRanch;
|
||||
}
|
||||
|
||||
public void setIsDelete(Long isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Long getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setSheepColor(String sheepColor)
|
||||
{
|
||||
this.sheepColor = sheepColor;
|
||||
}
|
||||
|
||||
public String getSheepColor()
|
||||
{
|
||||
return sheepColor;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName)
|
||||
{
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getGroupName()
|
||||
{
|
||||
return groupName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("bsManageTags", getBsManageTags())
|
||||
.append("ranchId", getRanchId())
|
||||
.append("drRanch", getDrRanch())
|
||||
.append("sheepfoldId", getSheepfoldId())
|
||||
.append("sheepfoldName", getSheepfoldName())
|
||||
.append("electronicTags", getElectronicTags())
|
||||
.append("varietyId", getVarietyId())
|
||||
.append("variety", getVariety())
|
||||
.append("family", getFamily())
|
||||
.append("name", getName())
|
||||
.append("gender", getGender())
|
||||
.append("birthday", getBirthday())
|
||||
.append("dayAge", getDayAge())
|
||||
.append("monthAge", getMonthAge())
|
||||
.append("parity", getParity())
|
||||
.append("birthWeight", getBirthWeight())
|
||||
.append("weaningDate", getWeaningDate())
|
||||
.append("statusId", getStatusId())
|
||||
.append("weaningWeight", getWeaningWeight())
|
||||
.append("weaningDayAge", getWeaningDayAge())
|
||||
.append("weaningDailyGain", getWeaningDailyGain())
|
||||
.append("currentWeight", getCurrentWeight())
|
||||
.append("breedStatusId", getBreedStatusId())
|
||||
.append("breed", getBreed())
|
||||
.append("bsFatherId", getBsFatherId())
|
||||
.append("fatherManageTags", getFatherManageTags())
|
||||
.append("bsMotherId", getBsMotherId())
|
||||
.append("motherManageTags", getMotherManageTags())
|
||||
.append("receptorId", getReceptorId())
|
||||
.append("receptorManageTags", getReceptorManageTags())
|
||||
.append("fatherFatherId", getFatherFatherId())
|
||||
.append("grandfatherManageTags", getGrandfatherManageTags())
|
||||
.append("fatherMotherId", getFatherMotherId())
|
||||
.append("grandmotherManageTags", getGrandmotherManageTags())
|
||||
.append("fatherId", getFatherId())
|
||||
.append("maternalGrandfatherManageTags", getMaternalGrandfatherManageTags())
|
||||
.append("motherId", getMotherId())
|
||||
.append("maternalGrandmotherManageTags", getMaternalGrandmotherManageTags())
|
||||
.append("matingDate", getMatingDate())
|
||||
.append("matingTypeId", getMatingTypeId())
|
||||
.append("pregDate", getPregDate())
|
||||
.append("lambingDate", getLambingDate())
|
||||
.append("lambingDay", getLambingDay())
|
||||
.append("matingDay", getMatingDay())
|
||||
.append("gestationDay", getGestationDay())
|
||||
.append("expectedDate", getExpectedDate())
|
||||
.append("postLambingDay", getPostLambingDay())
|
||||
.append("lactationDay", getLactationDay())
|
||||
.append("anestrousDay", getAnestrousDay())
|
||||
.append("matingCounts", getMatingCounts())
|
||||
.append("matingTotal", getMatingTotal())
|
||||
.append("miscarriageCounts", getMiscarriageCounts())
|
||||
.append("comment", getComment())
|
||||
.append("controlled", getControlled())
|
||||
.append("body", getBody())
|
||||
.append("breast", getBreast())
|
||||
.append("source", getSource())
|
||||
.append("sourceDate", getSourceDate())
|
||||
.append("sourceRanchId", getSourceRanchId())
|
||||
.append("sourceRanch", getSourceRanch())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("isDelete", getIsDelete())
|
||||
.append("sheepColor", getSheepColor())
|
||||
.append("groupName", getGroupName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -70,6 +71,15 @@ public interface BasSheepMapper
|
||||
BasSheep selectBasSheepByManageTags(String manageTags);
|
||||
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param sheep 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(BasSheep sheep);
|
||||
|
||||
|
||||
List<BasSheep> selectBasSheepBySheepfold(String id);
|
||||
|
||||
// 根据牧场ID获取羊只列表
|
||||
@@ -82,4 +92,5 @@ public interface BasSheepMapper
|
||||
int existsByElectronicTag(@Param("tag") String tag);
|
||||
|
||||
|
||||
List<BasSheep> selectBasSheepByManageTagsList(@Param("manageTagsList") List<String> manageTagsList, @Param("sheep")BasSheep sheep);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.base.mapper;
|
||||
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,6 +31,12 @@ public interface DaSheepfoldMapper
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
@@ -64,4 +71,12 @@ public interface DaSheepfoldMapper
|
||||
|
||||
public int selectCount(DaSheepfold daSheepfold);
|
||||
|
||||
// 新增:按组合条件删除的自定义方法(核心)
|
||||
int deleteSheepfoldByCondition(
|
||||
@Param("ranchId") Long ranchId,
|
||||
@Param("sheepfoldNo") String sheepfoldNo,
|
||||
@Param("sheepfoldTypeId") Long sheepfoldTypeId
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.zhyc.module.base.mapper;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,13 +25,19 @@ public interface SheepFileMapper
|
||||
public SheepFile selectSheepFileById(Long id);
|
||||
|
||||
/**
|
||||
* 查询羊只档案列表
|
||||
* 查询羊只档案列表 (基础查询)
|
||||
*
|
||||
* @param sheepFile 羊只档案
|
||||
* @return 羊只档案集合
|
||||
*/
|
||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile);
|
||||
|
||||
/**
|
||||
* 新增:模糊查询耳号列表(用于下拉框远程搜索)
|
||||
* @param query 搜索关键字
|
||||
* @return 匹配的耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
|
||||
/**
|
||||
* 根据管理耳号查询
|
||||
@@ -43,69 +47,49 @@ public interface SheepFileMapper
|
||||
*/
|
||||
SheepFile selectSheepByManageTags(String tags);
|
||||
|
||||
|
||||
// 在群羊只总数
|
||||
Long countInGroup();
|
||||
|
||||
Long countInGroup(SheepFile sheep);
|
||||
|
||||
// 羊只类别分布(按 name 分组)
|
||||
List<Map<String,Object>> countBySheepType();
|
||||
List<Map<String,Object>> countBySheepType(SheepFile sheep);
|
||||
|
||||
// 繁育状态分布(按 breed 分组)
|
||||
List<Map<String,Object>> countByBreedStatus();
|
||||
List<Map<String,Object>> countByBreedStatus(SheepFile sheep);
|
||||
|
||||
// 品种分布(按 variety 分组)
|
||||
List<Map<String,Object>> countByVariety();
|
||||
List<Map<String,Object>> countByVariety(SheepFile sheep);
|
||||
|
||||
// 泌乳羊胎次分布(name = '泌乳羊' 时按 parity 分组)
|
||||
List<Map<String,Object>> countParityOfLactation();
|
||||
|
||||
List<Map<String,Object>> countParityOfLactation(SheepFile sheep);
|
||||
|
||||
/**
|
||||
* 新增方法:获取指定字段的唯一值列表
|
||||
*
|
||||
* 这个方法用于查询数据库中某个字段的所有不重复的值
|
||||
* 主要用于前端筛选条件中的下拉选项数据
|
||||
*
|
||||
* @param fieldName 字段名(数据库表中的列名)
|
||||
* @return 该字段的所有唯一值列表,按字母顺序排序
|
||||
*
|
||||
* 使用场景示例:
|
||||
* - 用户选择"耳号"字段时,返回所有不重复的耳号
|
||||
* - 用户选择"品种"字段时,返回所有不重复的品种名称
|
||||
* 获取指定字段的唯一值列表 (配合 XML 中的 selectFieldValues)
|
||||
*/
|
||||
List<String> selectFieldValues(String fieldName);
|
||||
List<String> selectFieldValues(@Param("fieldName") String fieldName);
|
||||
|
||||
/**
|
||||
* 根据复杂条件查询羊只档案列表
|
||||
*
|
||||
* @param params 查询参数映射
|
||||
* @param sheepFile 原有的查询条件(保持兼容)
|
||||
* @return 羊只档案列表
|
||||
* 核心修复:根据复杂条件查询羊只档案列表
|
||||
* 对应 XML 中的 <select id="selectSheepFileListByCondition">
|
||||
* 必须使用 @Param 注解以便 XML 能正确识别两个参数
|
||||
*/
|
||||
List<SheepFile> selectSheepFileListByCondition(
|
||||
@Param("params") Map<String, Object> params,
|
||||
@Param("sheepFile") SheepFile sheepFile
|
||||
);
|
||||
|
||||
// 修改:使用 @SelectProvider 并指定 ResultMap
|
||||
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectByCondition")
|
||||
@ResultMap("SheepFileResult") // 重要:指定使用 XML 中定义的 ResultMap
|
||||
List<SheepFile> selectByCondition(
|
||||
@Param("sheepFile") SheepFile sheepFile,
|
||||
@Param("conditions") Map<String, Object> conditions
|
||||
@Param("params") Map<String, Object> params
|
||||
);
|
||||
|
||||
// 修改:获取字段值的方法
|
||||
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectFieldValues")
|
||||
List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
|
||||
// /**
|
||||
// * 保留原有 Provider 方法 (若项目其他地方有用到)
|
||||
// */
|
||||
// @SelectProvider(type = SheepFileSqlProvider.class, method = "selectByCondition")
|
||||
// @ResultMap("SheepFileResult")
|
||||
// List<SheepFile> selectByCondition(
|
||||
// @Param("sheepFile") SheepFile sheepFile,
|
||||
// @Param("conditions") Map<String, Object> conditions
|
||||
// );
|
||||
//
|
||||
// @SelectProvider(type = SheepFileSqlProvider.class, method = "selectFieldValues")
|
||||
// List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有公羊(gender=2)
|
||||
*
|
||||
* @return 公羊列表
|
||||
*/
|
||||
/**
|
||||
* 查询所有公羊(gender=2)
|
||||
* @return 公羊列表
|
||||
@@ -118,4 +102,24 @@ public interface SheepFileMapper
|
||||
* @return 羊只信息
|
||||
*/
|
||||
SheepFile selectSheepFileByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 新增羊只档案 (对应 XML 中的 insert)
|
||||
*/
|
||||
public int insertSheepFile(SheepFile sheepFile);
|
||||
|
||||
/**
|
||||
* 修改羊只档案 (对应 XML 中的 update)
|
||||
*/
|
||||
public int updateSheepFile(SheepFile sheepFile);
|
||||
|
||||
/**
|
||||
* 删除羊只档案 (对应 XML 中的 delete)
|
||||
*/
|
||||
public int deleteSheepFileById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除羊只档案 (对应 XML 中的 delete)
|
||||
*/
|
||||
public int deleteSheepFileByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.zhyc.module.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.module.base.domain.SheepPedigree;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* VIEWMapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-04
|
||||
*/
|
||||
public interface SheepPedigreeMapper
|
||||
{
|
||||
/**
|
||||
* 查询VIEW
|
||||
*
|
||||
* @param id VIEW主键
|
||||
* @return VIEW
|
||||
*/
|
||||
public SheepPedigree selectSheepPedigreeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询VIEW列表
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return VIEW集合
|
||||
*/
|
||||
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree);
|
||||
|
||||
/**
|
||||
* 新增VIEW
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSheepPedigree(SheepPedigree sheepPedigree);
|
||||
|
||||
/**
|
||||
* 修改VIEW
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSheepPedigree(SheepPedigree sheepPedigree);
|
||||
|
||||
/**
|
||||
* 删除VIEW
|
||||
*
|
||||
* @param id VIEW主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSheepPedigreeById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除VIEW
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSheepPedigreeByIds(Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据int类型id查询繁育状态名称
|
||||
* @param id 主键id(int类型)
|
||||
* @return 繁育状态名称(breed列的值)
|
||||
*/
|
||||
String selectBreedNameById(@Param("id") Long id);
|
||||
}
|
||||
@@ -28,6 +28,13 @@ public interface IBasSheepService
|
||||
*/
|
||||
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
|
||||
|
||||
/**
|
||||
* 羊只查询耳号信息
|
||||
*
|
||||
* @param earNumbers 耳号
|
||||
* @return 结果
|
||||
*/
|
||||
public List<String> searchEarNumbers(String earNumbers);
|
||||
/**
|
||||
* 新增羊只基本信息
|
||||
*
|
||||
@@ -64,6 +71,12 @@ public interface IBasSheepService
|
||||
* 根据羊只耳号获取羊只
|
||||
*/
|
||||
BasSheep selectBasSheepByManageTags(String trim);
|
||||
/**
|
||||
* 根据管理耳号列表批量查询羊只
|
||||
*/
|
||||
List<BasSheep> selectBasSheepByManageTagsList(List<String> manageTagsList);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据牧场ID获取羊只列表
|
||||
|
||||
@@ -29,6 +29,8 @@ public interface IDaSheepfoldService
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
@@ -73,4 +75,8 @@ public interface IDaSheepfoldService
|
||||
|
||||
// 根据羊舍id获取该羊舍的羊
|
||||
List<BasSheep> sheepListById(String id);
|
||||
|
||||
|
||||
/** 新增:根据组合条件删除羊圈记录 */
|
||||
boolean deleteSheepfoldByCondition(DaSheepfold sheepfold);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.base.service;
|
||||
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -8,64 +9,47 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 羊只档案Service接口
|
||||
*
|
||||
* @author wyt
|
||||
* * @author wyt
|
||||
* @date 2025-07-13
|
||||
*/
|
||||
public interface ISheepFileService
|
||||
{
|
||||
/**
|
||||
* 查询羊只档案
|
||||
*
|
||||
* @param id 羊只档案主键
|
||||
* * @param id 羊只档案主键
|
||||
* @return 羊只档案
|
||||
*/
|
||||
public SheepFile selectSheepFileById(Long id);
|
||||
|
||||
/**
|
||||
* 查询羊只档案列表
|
||||
*
|
||||
* @param sheepFile 羊只档案
|
||||
* * @param sheepFile 羊只档案
|
||||
* @return 羊只档案集合
|
||||
*/
|
||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile);
|
||||
|
||||
/**
|
||||
* 新增:搜索耳号接口
|
||||
*/
|
||||
List<String> searchEarNumbers(String query);
|
||||
|
||||
SheepFile selectBasSheepByManageTags(String trim);
|
||||
|
||||
Long countInGroup();
|
||||
Long countInGroup(SheepFile sheepFile);
|
||||
|
||||
List<Map<String,Object>> countBySheepType();
|
||||
List<Map<String,Object>> countByBreedStatus();
|
||||
List<Map<String,Object>> countByVariety();
|
||||
List<Map<String,Object>> countParityOfLactation();
|
||||
List<Map<String,Object>> countBySheepType(SheepFile sheepFile);
|
||||
List<Map<String,Object>> countByBreedStatus(SheepFile sheepFile);
|
||||
List<Map<String,Object>> countByVariety(SheepFile sheepFile);
|
||||
List<Map<String,Object>> countParityOfLactation(SheepFile sheepFile);
|
||||
|
||||
/**
|
||||
* 新增方法:获取指定字段的唯一值列表
|
||||
*
|
||||
* 这个方法为前端筛选功能提供数据支持
|
||||
* 当用户选择某个字段进行筛选时,调用此方法获取该字段的所有可能值
|
||||
*
|
||||
* @param fieldName 字段名(需要是数据库表中的列名)
|
||||
* @return 该字段的所有唯一值列表
|
||||
* @throws IllegalArgumentException 当字段名不在白名单中时抛出异常
|
||||
*
|
||||
* 示例用法:
|
||||
* List<String> earTags = getFieldValues("bs_manage_tags");
|
||||
* // 返回结果可能是:["AF00001", "AF00002", "AF00003", ...]
|
||||
* 获取指定字段的唯一值列表
|
||||
*/
|
||||
List<String> getFieldValues(String fieldName);
|
||||
|
||||
/**
|
||||
* 根据复杂条件查询羊只档案列表
|
||||
*
|
||||
* @param params 查询参数映射
|
||||
* @param sheepFile 原有的查询条件
|
||||
* @return 羊只档案列表
|
||||
*/
|
||||
List<SheepFile> selectSheepFileListByCondition(
|
||||
Map<String, Object> params,
|
||||
SheepFile sheepFile
|
||||
@Param("sheepFile") SheepFile sheepFile,
|
||||
@Param("params") Map<String, Object> params
|
||||
);
|
||||
|
||||
@Transactional
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zhyc.module.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.module.base.domain.SheepPedigree;
|
||||
|
||||
/**
|
||||
* VIEWService接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-04
|
||||
*/
|
||||
public interface ISheepPedigreeService
|
||||
{
|
||||
/**
|
||||
* 查询VIEW
|
||||
*
|
||||
* @param id VIEW主键
|
||||
* @return VIEW
|
||||
*/
|
||||
public SheepPedigree selectSheepPedigreeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询VIEW列表
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return VIEW集合
|
||||
*/
|
||||
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree);
|
||||
|
||||
/**
|
||||
* 新增VIEW
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSheepPedigree(SheepPedigree sheepPedigree);
|
||||
|
||||
/**
|
||||
* 修改VIEW
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSheepPedigree(SheepPedigree sheepPedigree);
|
||||
|
||||
/**
|
||||
* 批量删除VIEW
|
||||
*
|
||||
* @param ids 需要删除的VIEW主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSheepPedigreeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除VIEW信息
|
||||
*
|
||||
* @param id VIEW主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSheepPedigreeById(Long id);
|
||||
|
||||
public String getBreedNameById(Long id);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheepGroup;
|
||||
@@ -45,6 +46,7 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
|
||||
// {
|
||||
// return basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup);
|
||||
// }
|
||||
@DataScope(deptAlias = "g", userAlias = "g")
|
||||
@Override
|
||||
public List<BasSheepGroup> selectBasSheepGroupList(BasSheepGroup basSheepGroup) {
|
||||
List<BasSheepGroup> groups = basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup);
|
||||
@@ -122,6 +124,7 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
|
||||
return basSheepGroupMapper.deleteBasSheepGroupByGroupId(groupId);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "g", userAlias = "g")
|
||||
@Override
|
||||
public List<BasSheepGroup> selectLeafNodes() {
|
||||
List<BasSheepGroup> leafNodes = basSheepGroupMapper.selectLeafNodes();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
@@ -44,6 +48,29 @@ public class BasSheepServiceImpl implements IBasSheepService
|
||||
return basSheepMapper.selectBasSheepList(basSheep);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索羊只 earNumbers
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
BasSheep basSheep = new BasSheep();
|
||||
basSheep.setManageTags(query);
|
||||
return basSheepMapper.searchEarNumbers(basSheep);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<BasSheep> selectBasSheepByManageTagsList(List<String> manageTagsList) {
|
||||
if (manageTagsList == null || manageTagsList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return basSheepMapper.selectBasSheepByManageTagsList(manageTagsList,new BasSheep());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只基本信息
|
||||
*
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
import com.zhyc.module.base.mapper.DaSheepfoldMapper;
|
||||
import com.zhyc.module.base.service.IDaSheepfoldService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,6 +30,9 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Autowired
|
||||
private BasSheepMapper basSheepMapper;
|
||||
|
||||
// 日志对象
|
||||
private static final Logger log = LoggerFactory.getLogger(DaSheepfoldServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 查询羊舍管理
|
||||
*
|
||||
@@ -42,10 +51,22 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
* @param daSheepfold 羊舍管理
|
||||
* @return 羊舍管理
|
||||
*/
|
||||
@DataScope(deptAlias = "ds", userAlias = "ds")
|
||||
@Override
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold)
|
||||
{
|
||||
return daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
List<DaSheepfold> sheepfoldList = daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
return sheepfoldList; // 修复:原代码重复调用Mapper,改为返回已查询的列表
|
||||
}
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
@DataScope(deptAlias = "ds", userAlias = "ds")
|
||||
@Override
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) {
|
||||
List<DaSheepfold> sheepfoldList = daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
return sheepfoldList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +117,6 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
return daSheepfoldMapper.deleteDaSheepfoldById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkSheepfoldNoExist(Long ranchId, Long sheepfoldTypeId, String sheepfoldNo) {
|
||||
DaSheepfold query = new DaSheepfold();
|
||||
@@ -111,4 +131,40 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
List<BasSheep> basSheep = basSheepMapper.selectBasSheepBySheepfold(id);
|
||||
return basSheep;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核心实现:根据组合条件删除(完全自定义,无MP依赖)
|
||||
* 条件:ranch_id = ? AND sheepfold_no = ? AND sheepfold_type_id = ?
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteSheepfoldByCondition(DaSheepfold sheepfold) {
|
||||
// 1. 前置校验:仅校验3个核心字段(移除sheepfoldName的校验)
|
||||
if (sheepfold.getRanchId() == null
|
||||
|| !StringUtils.hasText(sheepfold.getSheepfoldNo())
|
||||
|| sheepfold.getSheepfoldTypeId() == null) {
|
||||
log.error("删除失败:核心条件不能为空!牧场ID={}, 羊舍编号={}, 羊舍类型ID={}",
|
||||
sheepfold.getRanchId(), sheepfold.getSheepfoldNo(), sheepfold.getSheepfoldTypeId());
|
||||
throw new IllegalArgumentException("删除失败:牧场ID、羊舍编号、羊舍类型ID不能为空");
|
||||
}
|
||||
|
||||
// 2. 调用Mapper方法:仅传递3个核心字段(移除sheepfoldName)
|
||||
int deleteCount = daSheepfoldMapper.deleteSheepfoldByCondition(
|
||||
sheepfold.getRanchId(),
|
||||
sheepfold.getSheepfoldNo(),
|
||||
sheepfold.getSheepfoldTypeId()
|
||||
);
|
||||
boolean isSuccess = deleteCount > 0;
|
||||
|
||||
// 3. 日志打印:移除sheepfoldName相关内容
|
||||
if (isSuccess) {
|
||||
log.info("成功删除羊舍记录:牧场ID={}, 羊舍编号={}, 羊舍类型ID={}",
|
||||
sheepfold.getRanchId(), sheepfold.getSheepfoldNo(), sheepfold.getSheepfoldTypeId());
|
||||
} else {
|
||||
log.warn("未找到匹配条件的羊舍记录:牧场ID={}, 羊舍编号={}, 羊舍类型ID={}",
|
||||
sheepfold.getRanchId(), sheepfold.getSheepfoldNo(), sheepfold.getSheepfoldTypeId());
|
||||
}
|
||||
|
||||
return isSuccess;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
// 新增这一行导入
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.BreedRamFile;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
@@ -11,12 +14,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 羊只档案Service业务层处理
|
||||
*
|
||||
* @author wyt
|
||||
* * @author wyt
|
||||
* @date 2025-07-13
|
||||
*/
|
||||
@Service
|
||||
@@ -24,11 +27,11 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
@Autowired
|
||||
private SheepFileMapper sheepFileMapper;
|
||||
|
||||
@Autowired
|
||||
private IBreedRamFileService breedRamFileService;
|
||||
|
||||
/**
|
||||
* 查询羊只档案
|
||||
*
|
||||
* @param id 羊只档案主键
|
||||
* @return 羊只档案
|
||||
*/
|
||||
@Override
|
||||
public SheepFile selectSheepFileById(Long id) {
|
||||
@@ -37,42 +40,55 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
|
||||
/**
|
||||
* 查询羊只档案列表
|
||||
*
|
||||
* @param sheepFile 羊只档案
|
||||
* @return 羊只档案
|
||||
*/
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile) {
|
||||
return sheepFileMapper.selectSheepFileList(sheepFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增:模糊搜索耳号实现
|
||||
*/
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return sheepFileMapper.searchEarNumbers(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SheepFile selectBasSheepByManageTags(String tags) {
|
||||
return sheepFileMapper.selectSheepByManageTags(tags);
|
||||
}
|
||||
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countBySheepType() {
|
||||
return sheepFileMapper.countBySheepType();
|
||||
public List<Map<String, Object>> countBySheepType(SheepFile sheepFile) {
|
||||
return sheepFileMapper.countBySheepType(sheepFile);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countByBreedStatus() {
|
||||
return sheepFileMapper.countByBreedStatus();
|
||||
public List<Map<String, Object>> countByBreedStatus(SheepFile sheepFile) {
|
||||
return sheepFileMapper.countByBreedStatus(sheepFile);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countByVariety() {
|
||||
return sheepFileMapper.countByVariety();
|
||||
public List<Map<String, Object>> countByVariety(SheepFile sheepFile) {
|
||||
return sheepFileMapper.countByVariety(sheepFile);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<Map<String, Object>> countParityOfLactation() {
|
||||
return sheepFileMapper.countParityOfLactation();
|
||||
public List<Map<String, Object>> countParityOfLactation(SheepFile sheepFile) {
|
||||
return sheepFileMapper.countParityOfLactation(sheepFile);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public Long countInGroup() { return sheepFileMapper.countInGroup(); }
|
||||
public Long countInGroup(SheepFile sheepFile) {
|
||||
return sheepFileMapper.countInGroup(sheepFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定字段的唯一值列表
|
||||
@@ -84,31 +100,44 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
throw new IllegalArgumentException("非法的字段名: " + fieldName + ",请检查字段名是否正确");
|
||||
}
|
||||
|
||||
// 第二步:调用新的 Provider 方法
|
||||
// 注意:这里调用的是 selectFieldValuesByProvider,不是 selectFieldValues
|
||||
return sheepFileMapper.selectFieldValuesByProvider(fieldName);
|
||||
// 调用Mapper
|
||||
// 注意:这里假设 Mapper 中有 selectFieldValues 方法
|
||||
// 如果你的 Mapper XML 中 id 是 selectFieldValues,请确保 Mapper 接口一致
|
||||
return sheepFileMapper.selectFieldValues(fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核心修复:复杂条件查询
|
||||
* 必须调用 Mapper 中对应的 XML 方法 (selectSheepFileListByCondition)
|
||||
* 并且传递 sheepFile 对象以启用 <foreach> 列表查询
|
||||
*/
|
||||
@DataScope(deptAlias = "sf", userAlias = "sf")
|
||||
@Override
|
||||
public List<SheepFile> selectSheepFileListByCondition(Map<String, Object> params, SheepFile sheepFile) {
|
||||
// 验证并处理参数
|
||||
public List<SheepFile> selectSheepFileListByCondition( SheepFile sheepFile,Map<String, Object> params) {
|
||||
// 1. 验证并处理自定义参数 (驼峰转下划线、安全检查)
|
||||
Map<String, Object> safeConditions = processConditions(params);
|
||||
|
||||
// 调用新的 Provider 方法
|
||||
List<SheepFile> result = sheepFileMapper.selectByCondition(sheepFile, safeConditions);
|
||||
|
||||
|
||||
return result;
|
||||
|
||||
System.out.println("sheepFile.params: " + (sheepFile.getParams() != null ? sheepFile.getParams().get("dataScope") : "null"));
|
||||
// 2. 调用 Mapper
|
||||
// 这里必须使用与 XML 中 <select id="selectSheepFileListByCondition"> 对应的方法
|
||||
return sheepFileMapper.selectSheepFileListByCondition(sheepFile,safeConditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertSheepFile(SheepFile sheepFile) {
|
||||
// int rows = sheepFileMapper.insertSheepFile(sheepFile);
|
||||
// if (rows > 0) { syncToBreedRamFile(sheepFile); }
|
||||
// return rows;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateSheepFile(SheepFile sheepFile) {
|
||||
// int rows = sheepFileMapper.updateSheepFile(sheepFile);
|
||||
// if (rows > 0) { syncToBreedRamFile(sheepFile); }
|
||||
// return rows;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -126,12 +155,13 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
String fieldName = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
// 将前端字段名转换为数据库字段名
|
||||
// 将前端字段名转换为数据库字段名 (例如: fatherManageTags -> father_manage_tags)
|
||||
// 这对于 XML 中的 ${key} = #{value} 至关重要
|
||||
String dbFieldName = convertToDbFieldName(fieldName);
|
||||
|
||||
// 验证字段名是否安全
|
||||
if (isValidFieldName(dbFieldName)) {
|
||||
// 处理值,确保不是 Character 类型
|
||||
// 处理值
|
||||
Object safeValue = value;
|
||||
if (value != null) {
|
||||
String strValue = value.toString();
|
||||
@@ -140,23 +170,17 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
if (strValue.startsWith("GT:") || strValue.startsWith("LT:") ||
|
||||
strValue.startsWith("GE:") || strValue.startsWith("LE:")) {
|
||||
String numPart = strValue.substring(3);
|
||||
// 验证数字部分是否安全(防止 SQL 注入)
|
||||
// 验证数字部分是否安全
|
||||
if (isNumeric(numPart)) {
|
||||
safeValue = strValue;
|
||||
} else {
|
||||
// 如果不是数字,忽略这个条件
|
||||
System.out.println("警告:范围条件的值不是数字: " + fieldName + " = " + strValue);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// 其他值直接使用字符串
|
||||
safeValue = strValue;
|
||||
}
|
||||
}
|
||||
safeParams.put(dbFieldName, safeValue);
|
||||
} else {
|
||||
// 记录日志
|
||||
System.out.println("警告:忽略非法字段名: " + fieldName + " -> " + dbFieldName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,61 +215,17 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
* 扩展字段名白名单验证
|
||||
*/
|
||||
private boolean isValidFieldName(String fieldName) {
|
||||
// 扩展允许查询的字段白名单
|
||||
// 字段白名单
|
||||
String[] allowedFields = {
|
||||
"id",
|
||||
"bs_manage_tags", // 管理耳号
|
||||
"electronic_tags", // 电子耳号
|
||||
"dr_ranch", // 牧场名称
|
||||
"sheepfold_name", // 羊舍名称
|
||||
"variety", // 品种
|
||||
"family", // 家系
|
||||
"name", // 羊只类型
|
||||
"gender", // 性别
|
||||
"birthday", // 出生日期
|
||||
"day_age", // 日龄
|
||||
"month_age", // 月龄
|
||||
"parity", // 胎次
|
||||
"birth_weight", // 出生体重
|
||||
"weaning_date", // 断奶日期
|
||||
"status_id", // 羊只状态
|
||||
"weaning_weight", // 断奶体重
|
||||
"current_weight", // 当前体重
|
||||
"weaning_day_age", // 断奶日龄
|
||||
"weaning_daily_gain", // 断奶日增重
|
||||
"breed", // 繁殖状态
|
||||
"father_manage_tags", // 父亲耳号
|
||||
"mother_manage_tags", // 母亲耳号
|
||||
"receptor_manage_tags", // 受体耳号
|
||||
"grandfather_manage_tags", // 祖父耳号
|
||||
"grandmother_manage_tags", // 祖母耳号
|
||||
"maternal_grandfather_manage_tags", // 外祖父耳号
|
||||
"maternal_grandmother_manage_tags", // 外祖母耳号
|
||||
"mating_date", // 配种日期
|
||||
"mating_type_id", // 配种类型
|
||||
"preg_date", // 孕检日期
|
||||
"lambing_date", // 产羔日期
|
||||
"lambing_day", // 产羔时怀孕天数
|
||||
"mating_day", // 配后天数
|
||||
"gestation_day", // 怀孕天数
|
||||
"expected_date", // 预产日期
|
||||
"post_lambing_day", // 产后天数
|
||||
"lactation_day", // 泌乳天数
|
||||
"anestrous_day", // 空怀天数
|
||||
"mating_counts", // 配种次数
|
||||
"mating_total", // 累计配种次数
|
||||
"miscarriage_counts", // 累计流产次数
|
||||
"comment", // 备注
|
||||
"controlled", // 是否性控
|
||||
"body", // 体况评分
|
||||
"breast", // 乳房评分
|
||||
"source", // 入群来源
|
||||
"source_date", // 入群日期
|
||||
"source_ranch", // 来源牧场
|
||||
"update_by", // 修改人
|
||||
"update_time", // 修改日期
|
||||
"create_by", // 创建人
|
||||
"create_time" // 创建日期
|
||||
"id", "bs_manage_tags", "electronic_tags", "dr_ranch", "sheepfold_name", "variety", "family",
|
||||
"name", "gender", "birthday", "day_age", "month_age", "parity", "birth_weight", "weaning_date",
|
||||
"status_id", "weaning_weight", "current_weight", "weaning_day_age", "weaning_daily_gain", "breed",
|
||||
"father_manage_tags", "mother_manage_tags", "receptor_manage_tags", "grandfather_manage_tags",
|
||||
"grandmother_manage_tags", "maternal_grandfather_manage_tags", "maternal_grandmother_manage_tags",
|
||||
"mating_date", "mating_type_id", "preg_date", "lambing_date", "lambing_day", "mating_day",
|
||||
"gestation_day", "expected_date", "post_lambing_day", "lactation_day", "anestrous_day",
|
||||
"mating_counts", "mating_total", "miscarriage_counts", "comment", "controlled", "body", "breast",
|
||||
"source", "source_date", "source_ranch", "update_by", "update_time", "create_by", "create_time"
|
||||
};
|
||||
|
||||
for (String allowedField : allowedFields) {
|
||||
@@ -257,45 +237,32 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IBreedRamFileService breedRamFileService; // 注入种公羊服务
|
||||
|
||||
/**
|
||||
* 新增羊只档案
|
||||
*/
|
||||
|
||||
/**
|
||||
* 同步公羊数据到种公羊档案表
|
||||
*/
|
||||
private void syncToBreedRamFile(SheepFile sheepFile) {
|
||||
try {
|
||||
// 检查是否已存在
|
||||
BreedRamFile existingRam = breedRamFileService.selectBreedRamFileByOrdinaryEarNumber(
|
||||
sheepFile.getBsManageTags()
|
||||
);
|
||||
|
||||
if (existingRam != null) {
|
||||
// 已存在,更新
|
||||
BreedRamFile updateRam = convertToBreedRamFile(sheepFile);
|
||||
updateRam.setId(existingRam.getId());
|
||||
breedRamFileService.updateBreedRamFile(updateRam);
|
||||
} else {
|
||||
// 不存在,新增
|
||||
BreedRamFile newRam = convertToBreedRamFile(sheepFile);
|
||||
breedRamFileService.insertBreedRamFile(newRam);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录日志,但不影响主流
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将SheepFile转换为BreedRamFile
|
||||
*/
|
||||
private BreedRamFile convertToBreedRamFile(SheepFile sheepFile) {
|
||||
BreedRamFile breedRamFile = new BreedRamFile();
|
||||
|
||||
// 基本信息
|
||||
breedRamFile.setOrdinaryEarNumber(sheepFile.getBsManageTags());
|
||||
breedRamFile.setRanchId(sheepFile.getRanchId());
|
||||
breedRamFile.setRanchName(sheepFile.getDrRanch());
|
||||
@@ -307,15 +274,13 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
breedRamFile.setSheepCategory(sheepFile.getName());
|
||||
breedRamFile.setBirthday(sheepFile.getBirthday());
|
||||
|
||||
// 体重相关
|
||||
breedRamFile.setBirthWeight(BigDecimal.valueOf(sheepFile.getBirthWeight()));
|
||||
if (sheepFile.getBirthWeight() != null) breedRamFile.setBirthWeight(BigDecimal.valueOf(sheepFile.getBirthWeight()));
|
||||
breedRamFile.setWeaningDate(sheepFile.getWeaningDate());
|
||||
breedRamFile.setWeaningDayAge(sheepFile.getWeaningDayAge());
|
||||
breedRamFile.setWeaningWeight(BigDecimal.valueOf(sheepFile.getWeaningWeight()));
|
||||
breedRamFile.setWeaningDailyGain(BigDecimal.valueOf(sheepFile.getWeaningDailyGain()));
|
||||
breedRamFile.setCurrentWeight(BigDecimal.valueOf(sheepFile.getCurrentWeight()));
|
||||
if (sheepFile.getWeaningWeight() != null) breedRamFile.setWeaningWeight(BigDecimal.valueOf(sheepFile.getWeaningWeight()));
|
||||
if (sheepFile.getWeaningDailyGain() != null) breedRamFile.setWeaningDailyGain(BigDecimal.valueOf(sheepFile.getWeaningDailyGain()));
|
||||
if (sheepFile.getCurrentWeight() != null) breedRamFile.setCurrentWeight(BigDecimal.valueOf(sheepFile.getCurrentWeight()));
|
||||
|
||||
// 家系信息
|
||||
breedRamFile.setFatherNumber(sheepFile.getFatherManageTags());
|
||||
breedRamFile.setMotherNumber(sheepFile.getMotherManageTags());
|
||||
breedRamFile.setGrandfatherNumber(sheepFile.getGrandfatherManageTags());
|
||||
@@ -323,7 +288,6 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
breedRamFile.setMaternalGrandfatherNumber(sheepFile.getMaternalGrandfatherManageTags());
|
||||
breedRamFile.setMaternalGrandmotherNumber(sheepFile.getMaternalGrandmotherManageTags());
|
||||
|
||||
// 审计信息
|
||||
breedRamFile.setCreateBy(sheepFile.getCreateBy());
|
||||
breedRamFile.setCreateTime(sheepFile.getCreateTime());
|
||||
breedRamFile.setUpdateBy(sheepFile.getUpdateBy());
|
||||
@@ -332,5 +296,4 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
||||
|
||||
return breedRamFile;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.base.mapper.SheepPedigreeMapper;
|
||||
import com.zhyc.module.base.domain.SheepPedigree;
|
||||
import com.zhyc.module.base.service.ISheepPedigreeService;
|
||||
|
||||
/**
|
||||
* VIEWService业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-04
|
||||
*/
|
||||
@Service
|
||||
public class SheepPedigreeServiceImpl implements ISheepPedigreeService
|
||||
{
|
||||
@Autowired
|
||||
private SheepPedigreeMapper sheepPedigreeMapper;
|
||||
|
||||
/**
|
||||
* 查询VIEW
|
||||
*
|
||||
* @param id VIEW主键
|
||||
* @return VIEW
|
||||
*/
|
||||
@Override
|
||||
public SheepPedigree selectSheepPedigreeById(Long id)
|
||||
{
|
||||
return sheepPedigreeMapper.selectSheepPedigreeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询VIEW列表
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return VIEW
|
||||
*/
|
||||
@Override
|
||||
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree)
|
||||
{
|
||||
return sheepPedigreeMapper.selectSheepPedigreeList(sheepPedigree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增VIEW
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSheepPedigree(SheepPedigree sheepPedigree)
|
||||
{
|
||||
sheepPedigree.setCreateTime(DateUtils.getNowDate());
|
||||
return sheepPedigreeMapper.insertSheepPedigree(sheepPedigree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改VIEW
|
||||
*
|
||||
* @param sheepPedigree VIEW
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSheepPedigree(SheepPedigree sheepPedigree)
|
||||
{
|
||||
sheepPedigree.setUpdateTime(DateUtils.getNowDate());
|
||||
return sheepPedigreeMapper.updateSheepPedigree(sheepPedigree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除VIEW
|
||||
*
|
||||
* @param ids 需要删除的VIEW主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSheepPedigreeByIds(Long[] ids)
|
||||
{
|
||||
return sheepPedigreeMapper.deleteSheepPedigreeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除VIEW信息
|
||||
*
|
||||
* @param id VIEW主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSheepPedigreeById(Long id)
|
||||
{
|
||||
return sheepPedigreeMapper.deleteSheepPedigreeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBreedNameById(Long id) {
|
||||
if (id == null) { // int类型id为空直接返回空
|
||||
return "";
|
||||
}
|
||||
return sheepPedigreeMapper.selectBreedNameById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,511 @@
|
||||
package com.zhyc.module.base.util;
|
||||
|
||||
import com.zhyc.module.base.domain.SheepPedigree;
|
||||
import com.zhyc.module.base.service.ISheepPedigreeService;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.common.utils.DictUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 羊只系谱自定义Excel导出工具(适配羊只系谱表(2)样式)
|
||||
*/
|
||||
@Component
|
||||
public class SheepPedigreeExcelUtils {
|
||||
// 日期格式化
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// 注入Service接口
|
||||
@Autowired
|
||||
private ISheepPedigreeService sheepPedigreeService;
|
||||
|
||||
/**
|
||||
* 导出指定bsManageTags的羊只系谱(符合羊只系谱表(2)样式)
|
||||
*/
|
||||
public void export(HttpServletResponse response, List<SheepPedigree> dataList) throws Exception {
|
||||
// 1. 创建Excel工作簿和工作表
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet sheet = workbook.createSheet("羊只系谱");
|
||||
// 设置列宽(6列,索引0-5)
|
||||
sheet.setColumnWidth(0, 15 * 256); // 第1列
|
||||
sheet.setColumnWidth(1, 15 * 256); // 第2列
|
||||
sheet.setColumnWidth(2, 15 * 256); // 第3列
|
||||
sheet.setColumnWidth(3, 15 * 256); // 第4列
|
||||
sheet.setColumnWidth(4, 15 * 256); // 第5列
|
||||
sheet.setColumnWidth(5, 15 * 256); // 第6列
|
||||
|
||||
// 2. 定义样式(新增:通用边框样式,所有单元格都应用)
|
||||
CellStyle titleStyle = createTitleStyle(workbook);
|
||||
CellStyle blockTitleStyle = createBlockTitleStyle(workbook);
|
||||
CellStyle contentStyle = createContentStyle(workbook);
|
||||
CellStyle borderStyle = createBorderStyle(workbook); // 纯边框样式,用于空单元格
|
||||
|
||||
int rowNum = 0;
|
||||
// 遍历数据
|
||||
for (SheepPedigree pedigree : dataList) {
|
||||
// ========== 1. 大标题:羊只系谱 ==========
|
||||
Row titleRow = sheet.createRow(rowNum++);
|
||||
titleRow.setHeightInPoints(25);
|
||||
Cell titleCell = titleRow.createCell(0);
|
||||
titleCell.setCellValue("羊只系谱");
|
||||
titleCell.setCellStyle(titleStyle);
|
||||
// 给标题行所有列应用边框
|
||||
fillRowWithBorder(titleRow, 0, 5, borderStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
|
||||
|
||||
// ========== 2. 基础信息区块 ==========
|
||||
// 普通耳号
|
||||
Row earTagRow = sheet.createRow(rowNum++);
|
||||
earTagRow.setHeightInPoints(20);
|
||||
Cell earTagLabelCell = earTagRow.createCell(0);
|
||||
earTagLabelCell.setCellValue("普通耳号");
|
||||
earTagLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
String earTagContent = pedigree.getBsManageTags() != null ? pedigree.getBsManageTags() : "";
|
||||
Cell earTagValueCell = earTagRow.createCell(1);
|
||||
earTagValueCell.setCellValue(earTagContent);
|
||||
earTagValueCell.setCellStyle(contentStyle);
|
||||
|
||||
// 给当前行所有列填充边框
|
||||
fillRowWithBorder(earTagRow, 0, 5, borderStyle);
|
||||
CellRangeAddress earTagMerge = new CellRangeAddress(
|
||||
rowNum - 1,
|
||||
rowNum - 1,
|
||||
1,
|
||||
5
|
||||
);
|
||||
sheet.addMergedRegion(earTagMerge);
|
||||
|
||||
// 品种 + 类别
|
||||
Row varietyRow = sheet.createRow(rowNum++);
|
||||
varietyRow.setHeightInPoints(20);
|
||||
Cell varietyLabelCell = varietyRow.createCell(0);
|
||||
varietyLabelCell.setCellValue("品种");
|
||||
varietyLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
String varietyContent = pedigree.getVariety() != null ? pedigree.getVariety() : "";
|
||||
Cell varietyValueCell = varietyRow.createCell(1);
|
||||
varietyValueCell.setCellValue(varietyContent);
|
||||
varietyValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell categoryLabelCell = varietyRow.createCell(2);
|
||||
categoryLabelCell.setCellValue("类别");
|
||||
categoryLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
String categoryContent = pedigree.getName() != null ? pedigree.getName() : "";
|
||||
Cell categoryValueCell = varietyRow.createCell(3);
|
||||
categoryValueCell.setCellValue(categoryContent);
|
||||
categoryValueCell.setCellStyle(contentStyle);
|
||||
|
||||
// 填充边框
|
||||
fillRowWithBorder(varietyRow, 0, 5, borderStyle);
|
||||
CellRangeAddress categoryMerge = new CellRangeAddress(
|
||||
rowNum - 1,
|
||||
rowNum - 1,
|
||||
3,
|
||||
5
|
||||
);
|
||||
sheet.addMergedRegion(categoryMerge);
|
||||
|
||||
// 性别 + 出生重量 + 出生日期
|
||||
Row genderRow = sheet.createRow(rowNum++);
|
||||
genderRow.setHeightInPoints(20);
|
||||
Cell genderLabelCell = genderRow.createCell(0);
|
||||
genderLabelCell.setCellValue("性别");
|
||||
genderLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell genderValueCell = genderRow.createCell(1);
|
||||
genderValueCell.setCellValue(getGenderText(pedigree.getGender()));
|
||||
genderValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell birthWeightLabelCell = genderRow.createCell(2);
|
||||
birthWeightLabelCell.setCellValue("出生重量");
|
||||
birthWeightLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell birthWeightValueCell = genderRow.createCell(3);
|
||||
String birthWeightContent = pedigree.getBirthWeight() != null ? pedigree.getBirthWeight() + "kg" : "";
|
||||
birthWeightValueCell.setCellValue(birthWeightContent);
|
||||
birthWeightValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell birthDateLabelCell = genderRow.createCell(4);
|
||||
birthDateLabelCell.setCellValue("出生日期");
|
||||
birthDateLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell birthDateValueCell = genderRow.createCell(5);
|
||||
String birthDate = pedigree.getBirthday() != null ? DATE_FORMAT.format(pedigree.getBirthday()) : "";
|
||||
birthDateValueCell.setCellValue(birthDate);
|
||||
birthDateValueCell.setCellStyle(contentStyle);
|
||||
|
||||
// 填充边框
|
||||
fillRowWithBorder(genderRow, 0, 5, borderStyle);
|
||||
|
||||
// 毛色 + 月龄 + 状态
|
||||
Row furColorRow = sheet.createRow(rowNum++);
|
||||
furColorRow.setHeightInPoints(20);
|
||||
Cell furColorLabelCell = furColorRow.createCell(0);
|
||||
furColorLabelCell.setCellValue("毛色");
|
||||
furColorLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell furColorValueCell = furColorRow.createCell(1);
|
||||
String furColorContent = pedigree.getSheepColor() != null ? pedigree.getSheepColor() : "";
|
||||
furColorValueCell.setCellValue(furColorContent);
|
||||
furColorValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell monthAgeLabelCell = furColorRow.createCell(2);
|
||||
monthAgeLabelCell.setCellValue("月龄");
|
||||
monthAgeLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell monthAgeValueCell = furColorRow.createCell(3);
|
||||
String monthAgeContent = pedigree.getMonthAge() != null ? pedigree.getMonthAge() + "月" : "";
|
||||
monthAgeValueCell.setCellValue(monthAgeContent);
|
||||
monthAgeValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell statusLabelCell = furColorRow.createCell(4);
|
||||
statusLabelCell.setCellValue("状态");
|
||||
statusLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Map<Object, String> statusDict = new HashMap<>();
|
||||
statusDict.put(1L, "在群");
|
||||
statusDict.put(2L, "不在群");
|
||||
statusDict.put(null, "");
|
||||
|
||||
Object statusId = pedigree.getStatusId();
|
||||
String statusContent = statusDict.getOrDefault(statusId, "未知状态");
|
||||
|
||||
Cell statusValueCell = furColorRow.createCell(5);
|
||||
statusValueCell.setCellValue(statusContent);
|
||||
statusValueCell.setCellStyle(contentStyle);
|
||||
|
||||
// 填充边框
|
||||
fillRowWithBorder(furColorRow, 0, 5, borderStyle);
|
||||
|
||||
// 繁育状态 + 来源
|
||||
Row breedStatusRow = sheet.createRow(rowNum++);
|
||||
breedStatusRow.setHeightInPoints(20);
|
||||
int currentRow = rowNum - 1;
|
||||
|
||||
Cell breedStatusLabelCell = breedStatusRow.createCell(0);
|
||||
breedStatusLabelCell.setCellValue("繁育状态");
|
||||
breedStatusLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell breedStatusValueCell = breedStatusRow.createCell(1);
|
||||
String breedStatusContent = "";
|
||||
try {
|
||||
Object breedObj = pedigree.getBreed();
|
||||
if (breedObj != null) {
|
||||
breedStatusContent = breedObj.toString().trim();
|
||||
}
|
||||
if (breedStatusContent == null || breedStatusContent.isEmpty()) {
|
||||
breedStatusContent = "";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
breedStatusContent = "";
|
||||
}
|
||||
breedStatusValueCell.setCellValue(breedStatusContent);
|
||||
breedStatusValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell sourceLabelCell = breedStatusRow.createCell(2);
|
||||
sourceLabelCell.setCellValue("来源");
|
||||
sourceLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell sourceValueCell = breedStatusRow.createCell(3);
|
||||
String sourceCode = pedigree.getSource() != null ? pedigree.getSource().toString() : "";
|
||||
String sourceContent = "";
|
||||
try {
|
||||
sourceContent = DictUtils.getDictLabel("source", sourceCode, "");
|
||||
} catch (Exception e) {
|
||||
sourceContent = "";
|
||||
System.err.println("来源字典映射失败:" + e.getMessage());
|
||||
}
|
||||
sourceValueCell.setCellValue(sourceContent);
|
||||
sourceValueCell.setCellStyle(contentStyle);
|
||||
|
||||
// 填充边框
|
||||
fillRowWithBorder(breedStatusRow, 0, 5, borderStyle);
|
||||
CellRangeAddress sourceMerge = new CellRangeAddress(
|
||||
currentRow,
|
||||
currentRow,
|
||||
3,
|
||||
5
|
||||
);
|
||||
sheet.addMergedRegion(sourceMerge);
|
||||
|
||||
// 等级 + 家系
|
||||
Row levelRow = sheet.createRow(rowNum++);
|
||||
levelRow.setHeightInPoints(20);
|
||||
int currentLevelRow = rowNum - 1;
|
||||
|
||||
Cell levelLabelCell = levelRow.createCell(0);
|
||||
levelLabelCell.setCellValue("等级");
|
||||
levelLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell levelValueCell = levelRow.createCell(1);
|
||||
String levelContent = pedigree.getGroupName() != null ? pedigree.getGroupName() : "";
|
||||
levelValueCell.setCellValue(levelContent);
|
||||
levelValueCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell familyLabelCell = levelRow.createCell(2);
|
||||
familyLabelCell.setCellValue("家系");
|
||||
familyLabelCell.setCellStyle(contentStyle);
|
||||
|
||||
Cell familyValueCell = levelRow.createCell(3);
|
||||
String familyContent = pedigree.getFamily() != null ? pedigree.getFamily() : "";
|
||||
familyValueCell.setCellValue(familyContent);
|
||||
familyValueCell.setCellStyle(contentStyle);
|
||||
|
||||
// 填充边框
|
||||
fillRowWithBorder(levelRow, 0, 5, borderStyle);
|
||||
CellRangeAddress familyMerge = new CellRangeAddress(
|
||||
currentLevelRow,
|
||||
currentLevelRow,
|
||||
3,
|
||||
5
|
||||
);
|
||||
sheet.addMergedRegion(familyMerge);
|
||||
|
||||
// ========== 3. 系谱信息区块(最终修复版) ==========
|
||||
Row pedigreeTitleRow = sheet.createRow(rowNum++);
|
||||
pedigreeTitleRow.setHeightInPoints(25); // 区块标题行高
|
||||
Cell pedigreeTitleCell = pedigreeTitleRow.createCell(0);
|
||||
pedigreeTitleCell.setCellValue("系谱信息");
|
||||
pedigreeTitleCell.setCellStyle(blockTitleStyle);
|
||||
// 填充标题行边框
|
||||
fillRowWithBorder(pedigreeTitleRow, 0, 5, borderStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
|
||||
|
||||
// 系谱区块起始行(此时rowNum是系谱内容第1行)
|
||||
int pedigreeStartRow = rowNum;
|
||||
int pedigreeTotalRows = 12;
|
||||
// 统一设置系谱12行的行高+填充边框
|
||||
for (int i = 0; i < pedigreeTotalRows; i++) {
|
||||
Row tempRow = sheet.createRow(pedigreeStartRow + i);
|
||||
tempRow.setHeightInPoints(20);
|
||||
// 给每行的0-5列都填充边框样式
|
||||
fillRowWithBorder(tempRow, 0, 5, borderStyle);
|
||||
}
|
||||
|
||||
// ========== 1. 羊只列:第1列合并12行 ==========
|
||||
Row sheepRow = sheet.getRow(pedigreeStartRow);
|
||||
Cell sheepCell = sheepRow.createCell(0);
|
||||
String sheepValue = pedigree.getBsManageTags() != null && !pedigree.getBsManageTags().isEmpty()
|
||||
? "羊只:" + pedigree.getBsManageTags()
|
||||
: "羊只:无";
|
||||
sheepCell.setCellValue(sheepValue);
|
||||
sheepCell.setCellStyle(contentStyle); // 覆盖为内容样式(带边框+字体)
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow,
|
||||
pedigreeStartRow + 11,
|
||||
0,
|
||||
0
|
||||
));
|
||||
|
||||
// ========== 2. 父耳号:第2-3列合并前6行 ==========
|
||||
Row fatherRow = sheet.getRow(pedigreeStartRow);
|
||||
Cell fatherCell = fatherRow.createCell(1);
|
||||
String fatherValue = pedigree.getFatherManageTags() != null && !pedigree.getFatherManageTags().isEmpty()
|
||||
? "父耳号:" + pedigree.getFatherManageTags()
|
||||
: "父耳号:无";
|
||||
fatherCell.setCellValue(fatherValue);
|
||||
fatherCell.setCellStyle(contentStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow,
|
||||
pedigreeStartRow + 5,
|
||||
1,
|
||||
2
|
||||
));
|
||||
|
||||
// ========== 3. 母耳号:第2-3列合并后6行 ==========
|
||||
Row motherRow = sheet.getRow(pedigreeStartRow + 6);
|
||||
Cell motherCell = motherRow.createCell(1);
|
||||
String motherValue = pedigree.getMotherManageTags() != null && !pedigree.getMotherManageTags().isEmpty()
|
||||
? "母耳号:" + pedigree.getMotherManageTags()
|
||||
: "母耳号:无";
|
||||
motherCell.setCellValue(motherValue);
|
||||
motherCell.setCellStyle(contentStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow + 6,
|
||||
pedigreeStartRow + 11,
|
||||
1,
|
||||
2
|
||||
));
|
||||
|
||||
// ========== 4. 祖父耳号:第4-6列合并1-3行 ==========
|
||||
Row grandFatherRow = sheet.getRow(pedigreeStartRow);
|
||||
Cell grandFatherCell = grandFatherRow.createCell(3);
|
||||
String grandFatherValue = pedigree.getGrandfatherManageTags() != null && !pedigree.getGrandfatherManageTags().isEmpty()
|
||||
? "祖父耳号:" + pedigree.getGrandfatherManageTags()
|
||||
: "祖父耳号:无";
|
||||
grandFatherCell.setCellValue(grandFatherValue);
|
||||
grandFatherCell.setCellStyle(contentStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow,
|
||||
pedigreeStartRow + 2,
|
||||
3,
|
||||
5
|
||||
));
|
||||
|
||||
// ========== 5. 祖母耳号:第4-6列合并4-6行 ==========
|
||||
Row grandMotherRow = sheet.getRow(pedigreeStartRow + 3);
|
||||
Cell grandMotherCell = grandMotherRow.createCell(3);
|
||||
String grandMotherValue = pedigree.getGrandmotherManageTags() != null && !pedigree.getGrandmotherManageTags().isEmpty()
|
||||
? "祖母耳号:" + pedigree.getGrandmotherManageTags()
|
||||
: "祖母耳号:无";
|
||||
grandMotherCell.setCellValue(grandMotherValue);
|
||||
grandMotherCell.setCellStyle(contentStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow + 3,
|
||||
pedigreeStartRow + 5,
|
||||
3,
|
||||
5
|
||||
));
|
||||
|
||||
// ========== 6. 外祖父耳号:第4-6列合并7-9行 ==========
|
||||
Row maternalGrandFatherRow = sheet.getRow(pedigreeStartRow + 6);
|
||||
Cell maternalGrandFatherCell = maternalGrandFatherRow.createCell(3);
|
||||
String maternalGrandFatherValue = pedigree.getMaternalGrandfatherManageTags() != null && !pedigree.getMaternalGrandfatherManageTags().isEmpty()
|
||||
? "外祖父耳号:" + pedigree.getMaternalGrandfatherManageTags()
|
||||
: "外祖父耳号:无";
|
||||
maternalGrandFatherCell.setCellValue(maternalGrandFatherValue);
|
||||
maternalGrandFatherCell.setCellStyle(contentStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow + 6,
|
||||
pedigreeStartRow + 8,
|
||||
3,
|
||||
5
|
||||
));
|
||||
|
||||
// ========== 7. 外祖母耳号:第4-6列合并10-12行 ==========
|
||||
Row maternalGrandMotherRow = sheet.getRow(pedigreeStartRow + 9);
|
||||
Cell maternalGrandMotherCell = maternalGrandMotherRow.createCell(3);
|
||||
String maternalGrandMotherValue = pedigree.getMaternalGrandmotherManageTags() != null && !pedigree.getMaternalGrandmotherManageTags().isEmpty()
|
||||
? "外祖母耳号:" + pedigree.getMaternalGrandmotherManageTags()
|
||||
: "外祖母耳号:无";
|
||||
maternalGrandMotherCell.setCellValue(maternalGrandMotherValue);
|
||||
maternalGrandMotherCell.setCellStyle(contentStyle);
|
||||
sheet.addMergedRegion(new CellRangeAddress(
|
||||
pedigreeStartRow + 9,
|
||||
pedigreeStartRow + 11,
|
||||
3,
|
||||
5
|
||||
));
|
||||
|
||||
// 更新rowNum到系谱区块结束行+1
|
||||
rowNum = pedigreeStartRow + pedigreeTotalRows;
|
||||
|
||||
}
|
||||
|
||||
// ========== 4. 输出Excel ==========
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("羊只系谱_" + System.currentTimeMillis(), "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
|
||||
OutputStream os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
os.flush();
|
||||
os.close();
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
// ========== 新增:填充整行边框的工具方法 ==========
|
||||
private void fillRowWithBorder(Row row, int startCol, int endCol, CellStyle borderStyle) {
|
||||
for (int col = startCol; col <= endCol; col++) {
|
||||
Cell cell = row.getCell(col);
|
||||
if (cell == null) {
|
||||
cell = row.createCell(col);
|
||||
}
|
||||
// 仅当单元格无样式时设置边框样式(避免覆盖已有内容样式)
|
||||
if (cell.getCellStyle() == null || cell.getCellStyle().getBorderTop() == BorderStyle.NONE) {
|
||||
cell.setCellStyle(borderStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 样式定义 ==========
|
||||
private static CellStyle createTitleStyle(Workbook workbook) {
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
Font font = workbook.createFont();
|
||||
font.setFontName("微软雅黑");
|
||||
font.setFontHeightInPoints((short) 16);
|
||||
font.setBold(true);
|
||||
style.setFont(font);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
// 标题样式带完整边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
return style;
|
||||
}
|
||||
|
||||
private static CellStyle createBlockTitleStyle(Workbook workbook) {
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
Font font = workbook.createFont();
|
||||
font.setFontName("微软雅黑");
|
||||
font.setFontHeightInPoints((short) 14);
|
||||
font.setBold(true);
|
||||
style.setFont(font);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
// 区块标题带完整边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
return style;
|
||||
}
|
||||
|
||||
private static CellStyle createContentStyle(Workbook workbook) {
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
Font font = workbook.createFont();
|
||||
font.setFontName("微软雅黑");
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
style.setFont(font);
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
// 内容样式带完整边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
return style;
|
||||
}
|
||||
|
||||
// 新增:纯边框样式(用于空单元格)
|
||||
private static CellStyle createBorderStyle(Workbook workbook) {
|
||||
CellStyle style = workbook.createCellStyle();
|
||||
// 仅设置边框,无字体/背景色(避免覆盖内容样式)
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
style.setAlignment(HorizontalAlignment.LEFT);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
return style;
|
||||
}
|
||||
|
||||
// 性别数字转文字
|
||||
private static String getGenderText(Long gender) {
|
||||
if (gender == null) return "";
|
||||
switch (gender.intValue()) {
|
||||
case 1: return "母";
|
||||
case 2: return "公";
|
||||
case 3: return "阉羊";
|
||||
case 4: return "兼性";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,16 @@ public class DewormController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:deworm:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
Deworm deworm = new Deworm();
|
||||
deworm.setSheepNo(sheepNo);
|
||||
List<String> list = dewormService.selectSheepNoList(deworm);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出驱虫列表
|
||||
*/
|
||||
@@ -78,7 +88,8 @@ public class DewormController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Deworm deworm)
|
||||
{
|
||||
System.out.println(deworm);
|
||||
deworm.setDeptId(getDeptId());
|
||||
deworm.setUserId(getUserId());
|
||||
return toAjax(dewormService.insertDeworm(deworm));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.biosafety.domain.Deworm;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -77,6 +79,8 @@ public class DiagnosisController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Diagnosis diagnosis)
|
||||
{
|
||||
diagnosis.setDeptId(getDeptId());
|
||||
diagnosis.setUserId(getUserId());
|
||||
return toAjax(diagnosisService.insertDiagnosis(diagnosis));
|
||||
}
|
||||
|
||||
@@ -112,4 +116,15 @@ public class DiagnosisController extends BaseController
|
||||
{
|
||||
return toAjax(diagnosisService.deleteDiagnosisByIds(ids));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:diagnosis:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
Diagnosis diagnosis = new Diagnosis();
|
||||
diagnosis.setSheepNo(sheepNo);
|
||||
List<String> list = diagnosisService.selectSheepNoList(diagnosis);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.biosafety.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.biosafety.service.IDisinfectService;
|
||||
@@ -78,6 +80,8 @@ public class DisinfectController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Disinfect disinfect)
|
||||
{
|
||||
disinfect.setDeptId(getDeptId());
|
||||
disinfect.setUserId(getUserId());
|
||||
return toAjax(disinfectService.insertDisinfect(disinfect));
|
||||
}
|
||||
|
||||
@@ -102,4 +106,13 @@ public class DisinfectController extends BaseController
|
||||
{
|
||||
return toAjax(disinfectService.deleteDisinfectByIds(ids));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:disinfect:list')")
|
||||
@GetMapping("/searchSheepfold")
|
||||
public AjaxResult getSheepfoldList(String sheepfold){
|
||||
Disinfect disinfect = new Disinfect();
|
||||
disinfect.setSheepfoldName(sheepfold);
|
||||
List<Object[]> list = disinfectService.selectSheepfoldList(disinfect);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.biosafety.domain.Deworm;
|
||||
import com.zhyc.module.biosafety.service.IHealthService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -79,6 +80,8 @@ public class HealthController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Health health)
|
||||
{
|
||||
health.setDeptId(getDeptId());
|
||||
health.setUserId(getUserId());
|
||||
return toAjax(healthService.insertHealth(health));
|
||||
}
|
||||
|
||||
@@ -103,4 +106,15 @@ public class HealthController extends BaseController
|
||||
{
|
||||
return toAjax(healthService.deleteHealthByIds(ids));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:health:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
Health health = new Health();
|
||||
health.setSheepNo(sheepNo);
|
||||
List<String> list = healthService.selectSheepNoList(health);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.biosafety.domain.Health;
|
||||
import com.zhyc.module.biosafety.service.IImmunityService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -78,6 +79,8 @@ public class ImmunityController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Immunity immunity)
|
||||
{
|
||||
immunity.setDeptId(getDeptId());
|
||||
immunity.setUserId(getUserId());
|
||||
return toAjax(immunityService.insertImmunity(immunity));
|
||||
}
|
||||
|
||||
@@ -102,4 +105,15 @@ public class ImmunityController extends BaseController
|
||||
{
|
||||
return toAjax(immunityService.deleteImmunityByIds(ids));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:immunity:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
Immunity immunity = new Immunity();
|
||||
immunity.setSheepNo(sheepNo);
|
||||
List<String> list = immunityService.selectSheepNoList(immunity);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.biosafety.domain.Health;
|
||||
import com.zhyc.module.biosafety.domain.QuarantineReport;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -78,6 +79,8 @@ public class QuarantineReportController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuarantineReport quarantineReport)
|
||||
{
|
||||
quarantineReport.setDeptId(getDeptId());
|
||||
quarantineReport.setUserId(getUserId());
|
||||
return toAjax(quarantineReportService.insertQuarantineReport(quarantineReport));
|
||||
}
|
||||
|
||||
@@ -102,4 +105,15 @@ public class QuarantineReportController extends BaseController
|
||||
{
|
||||
return toAjax(quarantineReportService.deleteQuarantineReportByIds(ids));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:quarantine:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
QuarantineReport report = new QuarantineReport();
|
||||
report.setSheepNo(sheepNo);
|
||||
List<String> list = quarantineReportService.selectSheepNoList(report);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.biosafety.domain.Health;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
||||
import com.zhyc.module.biosafety.service.ISwMedicineUsageService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -84,6 +85,8 @@ public class SwMedicineUsageController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SwMedicineUsage swMedicineUsage)
|
||||
{
|
||||
swMedicineUsage.setDeptId(getDeptId());
|
||||
swMedicineUsage.setUserId(getUserId());
|
||||
return toAjax(swMedicineUsageService.insertSwMedicineUsage(swMedicineUsage));
|
||||
}
|
||||
|
||||
@@ -108,4 +111,14 @@ public class SwMedicineUsageController extends BaseController
|
||||
{
|
||||
return toAjax(swMedicineUsageService.deleteSwMedicineUsageByIds(ids));
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:usageInfo:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
SwMedicineUsage usage = new SwMedicineUsage();
|
||||
usage.setSheepNo(sheepNo);
|
||||
List<String> list = swMedicineUsageService.selectSheepNoList(usage);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.biosafety.domain.Health;
|
||||
import com.zhyc.module.biosafety.domain.Treatment;
|
||||
import com.zhyc.module.biosafety.service.ITreatmentService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -78,6 +79,8 @@ public class TreatmentController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Treatment treatment)
|
||||
{
|
||||
treatment.setDeptId(getDeptId());
|
||||
treatment.setUserId(getUserId());
|
||||
return toAjax(treatmentService.insertTreatment(treatment));
|
||||
}
|
||||
|
||||
@@ -102,4 +105,15 @@ public class TreatmentController extends BaseController
|
||||
{
|
||||
return toAjax(treatmentService.deleteTreatmentByIds(ids));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('biosafety:treatment:list')")
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult getSheepNoList(String sheepNo)
|
||||
{
|
||||
Treatment treatment = new Treatment();
|
||||
treatment.setSheepNo(sheepNo);
|
||||
List<String> list = treatmentService.selectSheepNoList(treatment);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class Deworm extends BaseEntity
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
private Long[] ids;
|
||||
|
||||
private Long sheepId;
|
||||
|
||||
@@ -35,6 +36,8 @@ public class Deworm extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
@Excel(name = "品种")
|
||||
private String variety;
|
||||
@@ -52,10 +55,11 @@ public class Deworm extends BaseEntity
|
||||
@Excel(name = "胎次")
|
||||
private Long parity;
|
||||
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录 */
|
||||
@Excel(name = "药品使用记录")
|
||||
// @Excel(name = "药品使用记录")
|
||||
private Integer usageId;
|
||||
|
||||
|
||||
@@ -75,11 +79,28 @@ public class Deworm extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// public void setGender(String gender) {
|
||||
// this.gender = gender;
|
||||
// this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
// }
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.module.enums.Gender;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -24,9 +26,10 @@ public class Diagnosis extends BaseEntity
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
private Long[] ids;
|
||||
|
||||
/** 治疗记录id */
|
||||
@Excel(name = "治疗记录")
|
||||
// @Excel(name = "治疗记录")
|
||||
private Long treatId;
|
||||
private Integer[] treatIds;
|
||||
/** 时间日期 */
|
||||
@@ -38,6 +41,9 @@ public class Diagnosis extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
private Long sheepId;
|
||||
|
||||
@@ -75,6 +81,8 @@ public class Diagnosis extends BaseEntity
|
||||
|
||||
/** 诊疗结果 */
|
||||
@Excel(name = "诊疗结果")
|
||||
private String resultName;
|
||||
/** 诊断结果 */
|
||||
private String result;
|
||||
|
||||
/** 开始时间 */
|
||||
@@ -97,12 +105,45 @@ public class Diagnosis extends BaseEntity
|
||||
|
||||
private Long sheepfoldId;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
}
|
||||
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
if (result != null && !result.trim().isEmpty()) {
|
||||
try {
|
||||
Integer resultCode = Integer.valueOf(result.trim());
|
||||
this.resultName = Gender.getDescByCode(resultCode);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果转换失败,设置为空或默认值
|
||||
this.resultName = null;
|
||||
}
|
||||
} else {
|
||||
this.resultName = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class Disinfect extends BaseEntity
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
private Long[] ids;
|
||||
|
||||
/** 羊舍id */
|
||||
@Excel(name = "羊舍")
|
||||
@@ -43,12 +44,12 @@ public class Disinfect extends BaseEntity
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/** 消毒方式 */
|
||||
@Excel(name = "消毒方式")
|
||||
/** 消毒方式:0喷雾 1撒布 2浸泡 3熏蒸 4其他 */
|
||||
@Excel(name = "消毒方式", readConverterExp = "0=喷雾,1=撒布,2=浸泡,3=熏蒸,4=其他")
|
||||
private String way;
|
||||
|
||||
/** 药品使用记录id */
|
||||
@Excel(name = "药品使用记录id")
|
||||
// @Excel(name = "药品使用记录id")
|
||||
private Integer usageId;
|
||||
|
||||
/** 比例 */
|
||||
@@ -61,6 +62,9 @@ public class Disinfect extends BaseEntity
|
||||
/** 药品名称用于查询*/
|
||||
private String mediName;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ public class Health extends BaseEntity
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
private Long[] ids;
|
||||
|
||||
/** 保健日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@@ -29,15 +30,17 @@ public class Health extends BaseEntity
|
||||
private Date datetime;
|
||||
|
||||
/** 羊只id */
|
||||
@Excel(name = "羊只id")
|
||||
// @Excel(name = "羊只id")
|
||||
private Long sheepId;
|
||||
|
||||
private Integer[] sheepIds;
|
||||
|
||||
/** 羊只id */
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
@Excel(name = "品种")
|
||||
private String variety;
|
||||
@@ -55,7 +58,7 @@ public class Health extends BaseEntity
|
||||
private Long parity;
|
||||
|
||||
/** 用药记录 */
|
||||
@Excel(name = "用药记录")
|
||||
// @Excel(name = "用药记录")
|
||||
private Integer usageId;
|
||||
|
||||
|
||||
@@ -67,14 +70,34 @@ public class Health extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
}
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ public class Immunity extends BaseEntity
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
private Long[] ids;
|
||||
|
||||
/** 羊只id */
|
||||
@Excel(name = "羊只id")
|
||||
private Long sheepId;
|
||||
|
||||
private Integer[] sheepIds;
|
||||
@@ -37,9 +37,11 @@ public class Immunity extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
@Excel(name = "品种")
|
||||
|
||||
private String variety;
|
||||
@Excel(name = "羊只类别")
|
||||
private String sheepType;
|
||||
@@ -58,7 +60,7 @@ public class Immunity extends BaseEntity
|
||||
private Long parity;
|
||||
|
||||
/** 使用记录 */
|
||||
@Excel(name = "使用记录")
|
||||
// @Excel(name = "使用记录")
|
||||
private Integer usageId;
|
||||
|
||||
|
||||
@@ -75,14 +77,34 @@ public class Immunity extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
}
|
||||
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
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,7 +1,11 @@
|
||||
package com.zhyc.module.biosafety.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.module.biosafety.enums.QuarantineResult;
|
||||
import com.zhyc.module.biosafety.enums.QuarantineStatus;
|
||||
import com.zhyc.module.enums.Gender;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -37,6 +41,15 @@ public class QuarantineReport extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
@Excel(name = "品种")
|
||||
private String variety;
|
||||
/** 检疫日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "检疫日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date datetime;
|
||||
|
||||
@Excel(name = "羊只类别")
|
||||
private String sheepType;
|
||||
@@ -51,10 +64,7 @@ public class QuarantineReport extends BaseEntity
|
||||
private String breed;
|
||||
|
||||
|
||||
/** 检疫日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "检疫日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date datetime;
|
||||
|
||||
|
||||
/** 检疫项目 */
|
||||
|
||||
@@ -83,19 +93,68 @@ public class QuarantineReport extends BaseEntity
|
||||
|
||||
/** 检疫结果 */
|
||||
@Excel(name = "检疫结果")
|
||||
private String resultName;
|
||||
private String result;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String statusName;
|
||||
private Integer status;
|
||||
|
||||
/** 备注*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(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;
|
||||
}
|
||||
}
|
||||
// 检疫结果转换
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
if (result != null && !result.trim().isEmpty()) {
|
||||
try {
|
||||
Integer resultCode = Integer.valueOf(result.trim());
|
||||
this.resultName = QuarantineResult.getDescByCode(resultCode);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果转换失败,设置为空或默认值
|
||||
this.resultName = null;
|
||||
}
|
||||
} else {
|
||||
this.genderName = null;
|
||||
}
|
||||
}
|
||||
// 检疫状态
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
if (status != null) {
|
||||
try {
|
||||
this.statusName = QuarantineStatus.getDescByCode(status);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果转换失败,设置为空或默认值
|
||||
this.statusName = null;
|
||||
}
|
||||
} else {
|
||||
this.statusName = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 排序查询
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.module.biosafety.enums.PrescriptionType;
|
||||
import com.zhyc.module.biosafety.enums.TreatmentStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -26,18 +28,24 @@ public class SwMedicineUsage extends BaseEntity
|
||||
|
||||
/** id */
|
||||
private Integer id;
|
||||
private Long[] ids;
|
||||
|
||||
/** 使用名称 */
|
||||
@Excel(name = "使用名称",width = 20, needMerge = true)
|
||||
private String name;
|
||||
|
||||
/** 羊舍名称 */
|
||||
@Excel(name = "使用名称" ,width = 20, needMerge = true)
|
||||
@Excel(name = "羊舍名称" ,width = 20, needMerge = true)
|
||||
private String sheepfoldName;
|
||||
private Integer sheepfoldId;
|
||||
/** 耳号 */
|
||||
@Excel(name = "耳号",width = 20, needMerge = true)
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
private Integer sheepId;
|
||||
/** 使用时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@@ -46,11 +54,29 @@ public class SwMedicineUsage extends BaseEntity
|
||||
|
||||
/** 使用类型 */
|
||||
@Excel(name = "使用类型",width = 20, needMerge = true)
|
||||
private String useTypeName;
|
||||
private String useType;
|
||||
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录详情信息 */
|
||||
@Excel
|
||||
private List<SwMedicineUsageDetails> swMedicineUsageDetailsList;
|
||||
|
||||
|
||||
/** 状态转换 */
|
||||
public void setUseType(String useType) {
|
||||
this.useType = useType;
|
||||
this.useTypeName = null;
|
||||
if (useType != null && !useType.trim().isEmpty()) {
|
||||
try {
|
||||
this.useTypeName = PrescriptionType.getDescByCode(Integer.valueOf(useType.trim()));
|
||||
} catch (NumberFormatException ex) {
|
||||
// 可选:记录日志、或抛业务异常
|
||||
this.useTypeName = "未知";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.module.biosafety.enums.TreatmentStatus;
|
||||
import com.zhyc.module.enums.Gender;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -25,6 +26,7 @@ public class Treatment extends BaseEntity
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
private Long[] ids;
|
||||
|
||||
/** 诊疗记录id */
|
||||
private Long diagId;
|
||||
@@ -33,6 +35,9 @@ public class Treatment extends BaseEntity
|
||||
@Excel(name = "羊只耳号")
|
||||
private String sheepNo;
|
||||
private String[] sheepNos;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
|
||||
private Long sheepId;
|
||||
// 用于批量新增
|
||||
@@ -94,19 +99,38 @@ public class Treatment extends BaseEntity
|
||||
private String veterinary;
|
||||
/** 治疗状态 */
|
||||
@Excel(name = "治疗状态")
|
||||
private String statusName;
|
||||
private String status;
|
||||
|
||||
|
||||
/** 药品使用记录id */
|
||||
@Excel(name = "药品使用记录id")
|
||||
|
||||
private Integer usageId;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
|
||||
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
/** 性别转换 */
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender; // 保留原始字符串
|
||||
this.genderName = null; // 先清空
|
||||
@@ -119,8 +143,18 @@ public class Treatment extends BaseEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 状态转换 */
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
this.statusName = null;
|
||||
if (status != null && !status.trim().isEmpty()) {
|
||||
try {
|
||||
this.statusName = TreatmentStatus.getDescByCode(Integer.valueOf(status.trim()));
|
||||
} catch (NumberFormatException ex) {
|
||||
// 可选:记录日志、或抛业务异常
|
||||
this.statusName = "未知";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.zhyc.module.biosafety.enums;
|
||||
|
||||
|
||||
/**
|
||||
* 诊疗结果枚举
|
||||
*/
|
||||
public enum DiagnosisResult {
|
||||
|
||||
ABANDONED(0, "放弃"),
|
||||
CURED(1, "已治愈"),
|
||||
IN_TREATMENT(2, "治疗中"),
|
||||
COMPLETED(3, "治疗完成");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
DiagnosisResult(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return "";
|
||||
}
|
||||
for (DiagnosisResult result : values()) {
|
||||
if (result.code == code) {
|
||||
return result.desc;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static DiagnosisResult getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (DiagnosisResult result : values()) {
|
||||
if (result.code == code) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据描述获取code
|
||||
*/
|
||||
public static Integer getCodeByDesc(String desc) {
|
||||
if (desc == null || desc.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (DiagnosisResult result : values()) {
|
||||
if (result.desc.equals(desc)) {
|
||||
return result.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.zhyc.module.biosafety.enums;
|
||||
|
||||
/**
|
||||
* 消毒方式枚举
|
||||
*/
|
||||
public enum DisinfectionMethod {
|
||||
|
||||
SPRAY(0, "喷雾"),
|
||||
SCATTER(1, "撒布"),
|
||||
SOAK(2, "浸泡"),
|
||||
FUMIGATE(3, "熏蒸"),
|
||||
OTHER(4, "其他");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
DisinfectionMethod(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return "";
|
||||
}
|
||||
for (DisinfectionMethod method : values()) {
|
||||
if (method.code == code) {
|
||||
return method.desc;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static DisinfectionMethod getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (DisinfectionMethod method : values()) {
|
||||
if (method.code == code) {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据描述获取code
|
||||
*/
|
||||
public static Integer getCodeByDesc(String desc) {
|
||||
if (desc == null || desc.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (DisinfectionMethod method : values()) {
|
||||
if (method.desc.equals(desc)) {
|
||||
return method.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zhyc.module.biosafety.enums;
|
||||
|
||||
|
||||
/**
|
||||
* 处方类型枚举
|
||||
*/
|
||||
public enum PrescriptionType {
|
||||
|
||||
IMMUNITY(0, "免疫"),
|
||||
DEWORMING(1, "驱虫"),
|
||||
HEALTH_CARE(2, "保健"),
|
||||
DISINFECTION(3, "消毒"),
|
||||
DISEASE_TREATMENT(4, "疾病治疗");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
PrescriptionType(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return "";
|
||||
}
|
||||
for (PrescriptionType type : values()) {
|
||||
if (type.code == code) {
|
||||
return type.desc;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static PrescriptionType getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (PrescriptionType type : values()) {
|
||||
if (type.code == code) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据描述获取code
|
||||
*/
|
||||
public static Integer getCodeByDesc(String desc) {
|
||||
if (desc == null || desc.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (PrescriptionType type : values()) {
|
||||
if (type.desc.equals(desc)) {
|
||||
return type.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.zhyc.module.biosafety.enums;
|
||||
|
||||
/**
|
||||
* 检疫结果枚举
|
||||
*/
|
||||
public enum QuarantineResult {
|
||||
|
||||
NEGATIVE(0, "阴性"),
|
||||
POSITIVE(1, "阳性");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
QuarantineResult(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return "";
|
||||
}
|
||||
for (QuarantineResult result : values()) {
|
||||
if (result.code == code) {
|
||||
return result.desc;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static QuarantineResult getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (QuarantineResult result : values()) {
|
||||
if (result.code == code) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据描述获取code
|
||||
*/
|
||||
public static Integer getCodeByDesc(String desc) {
|
||||
if (desc == null || desc.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (QuarantineResult result : values()) {
|
||||
if (result.desc.equals(desc)) {
|
||||
return result.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.zhyc.module.biosafety.enums;
|
||||
|
||||
|
||||
/**
|
||||
* 检疫状态枚举
|
||||
*/
|
||||
public enum QuarantineStatus {
|
||||
|
||||
PENDING(0, "送检中"),
|
||||
TESTED(1, "已检测");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
QuarantineStatus(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取描述
|
||||
*/
|
||||
public static String getDescByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return "";
|
||||
}
|
||||
for (QuarantineStatus status : values()) {
|
||||
if (status.code == code) {
|
||||
return status.desc;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static QuarantineStatus getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (QuarantineStatus status : values()) {
|
||||
if (status.code == code) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据描述获取code
|
||||
*/
|
||||
public static Integer getCodeByDesc(String desc) {
|
||||
if (desc == null || desc.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (QuarantineStatus status : values()) {
|
||||
if (status.desc.equals(desc)) {
|
||||
return status.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zhyc.module.biosafety.enums;
|
||||
|
||||
/**
|
||||
* 治疗状态枚举
|
||||
*/
|
||||
public enum TreatmentStatus {
|
||||
|
||||
ABANDONED(-1, "放弃", 0),
|
||||
IN_TREATMENT(0, "治疗中", 1),
|
||||
TREATMENT_COMPLETED(1, "治疗完成", 2),
|
||||
CURED(2, "已治愈", 3);
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
private final int sort;
|
||||
|
||||
TreatmentStatus(int code, String desc, int sort) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public static String getDescByCode(Integer code) {
|
||||
for (TreatmentStatus status : values()) {
|
||||
if (status.code == code) {
|
||||
return status.desc;
|
||||
}
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
@@ -61,4 +61,6 @@ public interface DewormMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDewormByIds(Long[] ids);
|
||||
|
||||
List<String> selectSheepNoList(Deworm deworm);
|
||||
}
|
||||
|
||||
@@ -60,4 +60,6 @@ public interface DiagnosisMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDiagnosisByIds(Long[] ids);
|
||||
|
||||
List<String> selectSheepNoList(Diagnosis diagnosis);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.biosafety.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.zhyc.module.biosafety.domain.Disinfect;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -60,4 +61,6 @@ public interface DisinfectMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDisinfectByIds(Long[] ids);
|
||||
|
||||
List<Object[]> selectSheepfoldList(Disinfect disinfect);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface HealthMapper
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询保健
|
||||
*
|
||||
@@ -60,4 +63,6 @@ public interface HealthMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHealthByIds(Long[] ids);
|
||||
|
||||
List<String> selectSheepNoList(Health health);
|
||||
}
|
||||
|
||||
@@ -60,4 +60,6 @@ public interface ImmunityMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteImmunityByIds(Long[] ids);
|
||||
|
||||
List<String> selectSheepNoList(Immunity immunity);
|
||||
}
|
||||
|
||||
@@ -61,4 +61,6 @@ public interface QuarantineReportMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteQuarantineReportByIds(Long[] ids);
|
||||
|
||||
List<String> selectSheepNoList(QuarantineReport report);
|
||||
}
|
||||
|
||||
@@ -89,4 +89,6 @@ public interface SwMedicineUsageMapper
|
||||
public int deleteSwMedicineUsageDetailsByMediUsage(Integer id);
|
||||
|
||||
List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id);
|
||||
|
||||
List<String> selectSheepNoList(SwMedicineUsage usage);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface TreatmentMapper
|
||||
|
||||
|
||||
List<Treatment> selectTreatmentStatus(Long sheepId);
|
||||
|
||||
List<String> selectSheepNoList(Treatment treatment);
|
||||
}
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface IDewormService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDewormById(Long id);
|
||||
|
||||
List<String> selectSheepNoList(Deworm deworm);
|
||||
}
|
||||
|
||||
@@ -61,4 +61,6 @@ public interface IDiagnosisService
|
||||
public int deleteDiagnosisById(Long id);
|
||||
|
||||
int insertDiagnosisList(Diagnosis diagnosis);
|
||||
|
||||
List<String> selectSheepNoList(Diagnosis diagnosis);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.biosafety.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.module.biosafety.domain.Disinfect;
|
||||
|
||||
/**
|
||||
@@ -58,4 +59,6 @@ public interface IDisinfectService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDisinfectById(Long id);
|
||||
|
||||
List<Object[]> selectSheepfoldList(Disinfect disinfect);
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface IHealthService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHealthById(Long id);
|
||||
|
||||
List<String> selectSheepNoList(Health health);
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface IImmunityService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteImmunityById(Long id);
|
||||
|
||||
List<String> selectSheepNoList(Immunity immunity);
|
||||
}
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface IQuarantineReportService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteQuarantineReportById(Long id);
|
||||
|
||||
List<String> selectSheepNoList(QuarantineReport report);
|
||||
}
|
||||
|
||||
@@ -61,4 +61,6 @@ public interface ISwMedicineUsageService
|
||||
public int deleteSwMedicineUsageById(Integer id);
|
||||
|
||||
List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id);
|
||||
|
||||
List<String> selectSheepNoList(SwMedicineUsage usage);
|
||||
}
|
||||
|
||||
@@ -60,4 +60,6 @@ public interface ITreatmentService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTreatmentById(Long id);
|
||||
|
||||
List<String> selectSheepNoList(Treatment treatment);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -57,17 +60,18 @@ public class DewormServiceImpl implements IDewormService
|
||||
* @return 驱虫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Deworm> selectDewormList(Deworm deworm)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
if (deworm.getSheepNo() != null && !deworm.getSheepNo().isEmpty()) {
|
||||
if (deworm.getSheepNo().contains(",")) {
|
||||
sheepNos = deworm.getSheepNo().split(",");
|
||||
} else {
|
||||
sheepNos = new String[]{deworm.getSheepNo()};
|
||||
}
|
||||
}
|
||||
if (deworm.getSheepNo().contains(" ")) {
|
||||
sheepNos = deworm.getSheepNo().split(" ");
|
||||
deworm.setSheepNos(sheepNos);
|
||||
deworm.setSheepNo(null);
|
||||
}
|
||||
}
|
||||
|
||||
return dewormMapper.selectDewormList(deworm);
|
||||
}
|
||||
|
||||
@@ -168,4 +172,10 @@ public class DewormServiceImpl implements IDewormService
|
||||
{
|
||||
return dewormMapper.deleteDewormById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(Deworm deworm) {
|
||||
return dewormMapper.selectSheepNoList(deworm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
import com.zhyc.module.biosafety.domain.Deworm;
|
||||
import com.zhyc.module.biosafety.domain.Treatment;
|
||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
|
||||
@@ -60,14 +62,13 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
* @return 诊疗结果
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Diagnosis> selectDiagnosisList(Diagnosis diagnosis)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
if (diagnosis.getSheepNo() != null && !diagnosis.getSheepNo().isEmpty()) {
|
||||
if (diagnosis.getSheepNo().contains(",")) {
|
||||
sheepNos = diagnosis.getSheepNo().split(",");
|
||||
} else {
|
||||
sheepNos = new String[]{diagnosis.getSheepNo()};
|
||||
if (diagnosis.getSheepNo().contains(" ")) {
|
||||
sheepNos = diagnosis.getSheepNo().split(" ");
|
||||
}
|
||||
}
|
||||
diagnosis.setSheepNos(sheepNos);
|
||||
@@ -220,4 +221,10 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
return diagnosisMapper.deleteDiagnosisById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(Diagnosis diagnosis) {
|
||||
return diagnosisMapper.selectSheepNoList(diagnosis);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -59,6 +61,7 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
* @return 消毒记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Disinfect> selectDisinfectList(Disinfect disinfect)
|
||||
{
|
||||
return disinfectMapper.selectDisinfectList(disinfect);
|
||||
@@ -146,4 +149,10 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
{
|
||||
return disinfectMapper.deleteDisinfectById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<Object[]> selectSheepfoldList(Disinfect disinfect) {
|
||||
return disinfectMapper.selectSheepfoldList(disinfect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
import com.zhyc.module.biosafety.domain.Deworm;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
|
||||
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
|
||||
@@ -62,14 +64,13 @@ public class HealthServiceImpl implements IHealthService
|
||||
* @return 保健
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Health> selectHealthList(Health health)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
if (health.getSheepNo() != null && !health.getSheepNo().isEmpty()) {
|
||||
if (health.getSheepNo().contains(",")) {
|
||||
sheepNos = health.getSheepNo().split(",");
|
||||
} else {
|
||||
sheepNos = new String[]{health.getSheepNo()};
|
||||
if (health.getSheepNo().contains(" ")) {
|
||||
sheepNos = health.getSheepNo().split(" ");
|
||||
}
|
||||
}
|
||||
health.setSheepNos(sheepNos);
|
||||
@@ -165,4 +166,11 @@ public class HealthServiceImpl implements IHealthService
|
||||
{
|
||||
return healthMapper.deleteHealthById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(Health health) {
|
||||
return healthMapper.selectSheepNoList(health);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
import com.zhyc.module.biosafety.domain.Deworm;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
|
||||
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
|
||||
@@ -61,14 +64,13 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
* @return 免疫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Immunity> selectImmunityList(Immunity immunity)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
if (immunity.getSheepNo() != null && !immunity.getSheepNo().isEmpty()) {
|
||||
if (immunity.getSheepNo().contains(",")) {
|
||||
sheepNos = immunity.getSheepNo().split(",");
|
||||
} else {
|
||||
sheepNos = new String[]{immunity.getSheepNo()};
|
||||
if (immunity.getSheepNo().contains(" ")) {
|
||||
sheepNos = immunity.getSheepNo().split(" ");
|
||||
}
|
||||
}
|
||||
immunity.setSheepNos(sheepNos);
|
||||
@@ -169,4 +171,10 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
{
|
||||
return immunityMapper.deleteImmunityById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(Immunity immunity) {
|
||||
return immunityMapper.selectSheepNoList(immunity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.biosafety.domain.QuarantineItems;
|
||||
import com.zhyc.module.biosafety.mapper.QuarantineItemsMapper;
|
||||
import com.zhyc.module.biosafety.service.IQuarantineItemsService;
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.service.impl.SheepFileServiceImpl;
|
||||
import com.zhyc.module.biosafety.domain.Immunity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.biosafety.mapper.QuarantineReportMapper;
|
||||
@@ -46,14 +49,13 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
||||
* @return 检疫记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sqr", userAlias = "sqr")
|
||||
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
if (quarantineReport.getSheepNo() != null && !quarantineReport.getSheepNo().isEmpty()) {
|
||||
if (quarantineReport.getSheepNo().contains(",")) {
|
||||
sheepNos = quarantineReport.getSheepNo().split(",");
|
||||
} else {
|
||||
sheepNos = new String[]{quarantineReport.getSheepNo()};
|
||||
if (quarantineReport.getSheepNo().contains(" ")) {
|
||||
sheepNos = quarantineReport.getSheepNo().split(" ");
|
||||
}
|
||||
}
|
||||
quarantineReport.setSheepNos(sheepNos);
|
||||
@@ -84,6 +86,7 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
||||
BeanUtils.copyProperties(quarantineReport, quarantine);
|
||||
quarantine.setSheepId(sheepFile.getId());
|
||||
quarantine.setSheepNo(sheepFile.getElectronicTags());
|
||||
quarantine.setVariety(sheepFile.getVariety() != null ? sheepFile.getVariety() : "");
|
||||
quarantine.setSheepType(sheepFile.getName());
|
||||
|
||||
// 性别前端处理
|
||||
@@ -134,4 +137,10 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
||||
{
|
||||
return quarantineReportMapper.deleteQuarantineReportById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(QuarantineReport report) {
|
||||
return quarantineReportMapper.selectSheepNoList(report);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.biosafety.domain.Immunity;
|
||||
import com.zhyc.module.biosafety.service.ISwMedicineUsageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -44,8 +47,17 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
|
||||
* @return 药品使用记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "smu", userAlias = "smu")
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -141,4 +153,10 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(SwMedicineUsage usage) {
|
||||
return swMedicineUsageMapper.selectSheepNoList(usage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,20 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
import com.zhyc.module.Exception.BusinessException;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
|
||||
import com.zhyc.module.biosafety.domain.*;
|
||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
|
||||
import com.zhyc.module.biosafety.domain.Treatment;
|
||||
import com.zhyc.module.biosafety.service.ITreatmentService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -65,6 +64,7 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
* @return 治疗记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "t", userAlias = "t")
|
||||
public List<Treatment> selectTreatmentList(Treatment treatment)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
@@ -240,6 +240,12 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
return treatmentMapper.deleteTreatmentById(id);
|
||||
}
|
||||
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
@Override
|
||||
public List<String> selectSheepNoList(Treatment treatment) {
|
||||
return treatmentMapper.selectSheepNoList(treatment);
|
||||
}
|
||||
|
||||
public void updateTreatmentStatus(Long sheepId) {
|
||||
List<Treatment> treatments=treatmentMapper.selectTreatmentStatus(sheepId);
|
||||
Diagnosis diagnosis = new Diagnosis();
|
||||
|
||||
@@ -26,14 +26,25 @@ public class UserPostController {
|
||||
// 根据岗位编码获取用户
|
||||
@GetMapping("/getUser")
|
||||
public AjaxResult getUserPost(String postCode){
|
||||
List<User> list = userService.getUserListByCode(postCode);
|
||||
User user = new User();
|
||||
if (postCode != null){
|
||||
user.setPostName(postCode);
|
||||
}
|
||||
List<User> list = userService.getUserListByCode(user);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
// 获取岗位(部门)
|
||||
@GetMapping("/getPost")
|
||||
public AjaxResult getPost(String postName){
|
||||
List<Post> list = postService.selectPostList();
|
||||
List<Post> list = postService.selectPostList(postName);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
// 获取岗位班组
|
||||
@GetMapping("/getPostTeam")
|
||||
public AjaxResult getPostTeam(){
|
||||
List<Post> list = postService.selectPostList("班");
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Dept extends BaseEntity {
|
||||
private Long deptId;
|
||||
private Long parentId;
|
||||
private String ancestors;
|
||||
private String deptName;
|
||||
private String orderNum;
|
||||
private String leader;
|
||||
private String phone;
|
||||
private String email;
|
||||
private String status;
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -8,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Post {
|
||||
public class Post extends BaseEntity {
|
||||
|
||||
/** 岗位序号 */
|
||||
@Excel(name = "岗位序号", cellType = Excel.ColumnType.NUMERIC)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -7,9 +8,10 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class User {
|
||||
public class User extends BaseEntity {
|
||||
// 用户id
|
||||
private String userId;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
// 用户名
|
||||
private String nickName;
|
||||
// 岗位名称
|
||||
@@ -17,4 +19,5 @@ public class User {
|
||||
// 岗位编码
|
||||
private String postCode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zhyc.module.common.mapper;
|
||||
|
||||
import com.zhyc.module.common.domain.Dept;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeptMapper {
|
||||
/**
|
||||
* 根据部门ID查询其所属二级部门(排除根部门)
|
||||
*/
|
||||
Dept selectTopSecondLevelDept(Long deptId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user