Compare commits
2 Commits
f138074f70
...
refactor/d
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bff858643 | |||
| 9c678c84bf |
24
zhyc-admin/src/main/java/com/zhyc/Event/FarmLoginEvent.java
Normal file
24
zhyc-admin/src/main/java/com/zhyc/Event/FarmLoginEvent.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.zhyc.Event;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FarmLoginEvent {
|
||||
|
||||
private final String farmCode;
|
||||
private final Long userId;
|
||||
|
||||
public FarmLoginEvent(String farmCode, Long userId) {
|
||||
this.farmCode = farmCode;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getFarmCode() {
|
||||
return farmCode;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zhyc.Routing.Filter;
|
||||
|
||||
import com.zhyc.framework.config.routing.DataSourceKeys;
|
||||
import com.zhyc.framework.datasource.DynamicDataSourceContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bytedeco.opencv.presets.opencv_core;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@Order(value = -100)
|
||||
public class DataSourceRoutingFilter extends OncePerRequestFilter {
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
|
||||
String uri = request.getRequestURI();
|
||||
String username = request.getRemoteUser();
|
||||
log.debug("username:{}",username);
|
||||
try {
|
||||
if (uri.startsWith("/app") || uri.startsWith("/base") || uri.startsWith("/biosafety") || uri.startsWith("/common")
|
||||
|| uri.startsWith("/dairyProducts") || uri.startsWith("/enums") || uri.startsWith("/feed") || uri.startsWith("/frozen") || uri.startsWith("/produce")
|
||||
|| uri.startsWith("sale") || uri.startsWith("/stock") || uri.startsWith("/work") || uri.startsWith("/sheepfold_management")) {
|
||||
log.debug("业务请求 : BUSINESS : {}", uri);
|
||||
if (username.equals("admin")) {
|
||||
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.FARM_1);
|
||||
}else if (username.equals("ry")) {
|
||||
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.FARM_2);
|
||||
}
|
||||
} else {
|
||||
log.debug("系统请求 : SYSTEM : {}", uri);
|
||||
DynamicDataSourceContextHolder.setDataSourceType(DataSourceKeys.SYSTEM);
|
||||
}
|
||||
|
||||
filterChain.doFilter(request, response);
|
||||
} finally {
|
||||
// 业务结束后清楚数据源-防止线程复用导致错误
|
||||
DynamicDataSourceContextHolder.clearDataSourceType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,9 +76,6 @@ 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() + "'失败,部门名称已存在");
|
||||
|
||||
17
zhyc-admin/src/main/java/com/zhyc/web/mvc/MvcConfig.java
Normal file
17
zhyc-admin/src/main/java/com/zhyc/web/mvc/MvcConfig.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.zhyc.web.mvc;
|
||||
|
||||
import com.zhyc.Routing.Filter.DataSourceRoutingFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MvcConfig {
|
||||
@Bean
|
||||
public FilterRegistrationBean<DataSourceRoutingFilter> myFilter() {
|
||||
FilterRegistrationBean<DataSourceRoutingFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(new DataSourceRoutingFilter());
|
||||
registrationBean.addUrlPatterns("/*");
|
||||
return registrationBean;
|
||||
}
|
||||
}
|
||||
@@ -9,16 +9,19 @@ spring:
|
||||
# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: 123456
|
||||
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://118.182.97.76:3306/zhyc_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: zhyc
|
||||
password: yszh123
|
||||
# 从库数据源
|
||||
slave:
|
||||
farm01:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
url: jdbc:mysql://118.182.97.76:3306/zhyc_sheep01?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: zhyc
|
||||
password: yszh123
|
||||
farm02:
|
||||
url: jdbc:mysql://118.182.97.76:3306/zhyc_sheep02?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: zhyc
|
||||
password: yszh123
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataScope
|
||||
|
||||
@@ -31,10 +31,6 @@ public class SysDept extends BaseEntity
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
/** 牧场id */
|
||||
private Long ranchId;
|
||||
private String ranchName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
@@ -59,22 +55,6 @@ 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;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
@@ -19,23 +21,34 @@ import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||
import com.alibaba.druid.util.Utils;
|
||||
import com.zhyc.common.enums.DataSourceType;
|
||||
import com.zhyc.common.utils.spring.SpringUtils;
|
||||
import com.zhyc.framework.config.properties.DruidProperties;
|
||||
import com.zhyc.framework.datasource.DynamicDataSource;
|
||||
|
||||
/**
|
||||
* druid 配置多数据源
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class DruidConfig
|
||||
{
|
||||
public class DruidConfig {
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.master")
|
||||
public DataSource masterDataSource(DruidProperties druidProperties)
|
||||
{
|
||||
public DataSource masterDataSource(DruidProperties druidProperties) {
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.farm01")
|
||||
public DataSource farm1DataSource(DruidProperties druidProperties) {
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.farm02")
|
||||
public DataSource farm2DataSource(DruidProperties druidProperties) {
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
@@ -43,49 +56,49 @@ public class DruidConfig
|
||||
@Bean
|
||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||
public DataSource slaveDataSource(DruidProperties druidProperties)
|
||||
{
|
||||
public DataSource slaveDataSource(DruidProperties druidProperties) {
|
||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||
return druidProperties.dataSource(dataSource);
|
||||
}
|
||||
|
||||
@Bean(name = "dynamicDataSource")
|
||||
@Primary
|
||||
public DynamicDataSource dataSource(DataSource masterDataSource)
|
||||
{
|
||||
public DataSource dynamicDataSource(
|
||||
@Qualifier("masterDataSource") DataSource systemDataSource,
|
||||
@Qualifier("farm1DataSource") DataSource farm1DataSource,
|
||||
@Qualifier("farm2DataSource") DataSource farm2DataSource) {
|
||||
|
||||
// 存储数据源路由
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||
targetDataSources.put("system", systemDataSource);
|
||||
targetDataSources.put("farm01", farm1DataSource);
|
||||
targetDataSources.put("farm02", farm2DataSource);
|
||||
|
||||
return new DynamicDataSource(systemDataSource, targetDataSources);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置数据源
|
||||
*
|
||||
*
|
||||
* @param targetDataSources 备选数据源集合
|
||||
* @param sourceName 数据源名称
|
||||
* @param beanName bean名称
|
||||
* @param sourceName 数据源名称
|
||||
* @param beanName bean名称
|
||||
*/
|
||||
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
|
||||
{
|
||||
try
|
||||
{
|
||||
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) {
|
||||
try {
|
||||
DataSource dataSource = SpringUtils.getBean(beanName);
|
||||
targetDataSources.put(sourceName, dataSource);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除监控页面底部的广告
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
||||
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
|
||||
{
|
||||
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) {
|
||||
// 获取web监控页面的参数
|
||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||
// 提取common.js的配置路径
|
||||
@@ -93,16 +106,14 @@ public class DruidConfig
|
||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||
final String filePath = "support/http/resources/js/common.js";
|
||||
// 创建filter进行过滤
|
||||
Filter filter = new Filter()
|
||||
{
|
||||
Filter filter = new Filter() {
|
||||
@Override
|
||||
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
|
||||
{
|
||||
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
throws IOException, ServletException {
|
||||
chain.doFilter(request, response);
|
||||
// 重置缓冲区,响应头不会被重置
|
||||
response.resetBuffer();
|
||||
@@ -113,9 +124,9 @@ public class DruidConfig
|
||||
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
||||
response.getWriter().write(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
public void destroy() {
|
||||
}
|
||||
};
|
||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zhyc.framework.config.routing;
|
||||
|
||||
public interface DataSourceKeys {
|
||||
String SYSTEM = "system";
|
||||
String FARM_1 = "farm01";
|
||||
String FARM_2 = "farm02";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.framework.web.service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.zhyc.framework.datasource.DynamicDataSourceContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
|
||||
@@ -201,10 +201,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -46,7 +46,6 @@ public class BasSheepController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
//查询耳号列表
|
||||
@GetMapping("/earNumbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
@@ -137,6 +136,7 @@ public class BasSheepController extends BaseController {
|
||||
}
|
||||
BasSheep query = new BasSheep();
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -153,6 +153,7 @@ 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);
|
||||
}
|
||||
@@ -189,6 +190,7 @@ public class BasSheepController extends BaseController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断耳号是否存在(用于新增羊只时校验)
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -44,17 +44,6 @@ public class DaSheepfoldController extends BaseController
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主表格:羊舍级别汇总列表
|
||||
*/
|
||||
@GetMapping("/summaryList")
|
||||
public TableDataInfo summaryList(DaSheepfold daSheepfold) {
|
||||
startPage();
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/*
|
||||
* 根据羊舍ids查询羊只id
|
||||
* */
|
||||
|
||||
@@ -115,10 +115,5 @@ public class DaSheepfold extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// 非数据库字段:单栏位羊数(子表格用)
|
||||
private Integer sheepCount;
|
||||
// 非数据库字段:羊舍总羊数(主表格用)
|
||||
private Integer totalSheepCount;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// 创建文件: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;
|
||||
}
|
||||
@@ -30,12 +30,6 @@ public interface DaSheepfoldMapper
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
|
||||
@@ -29,8 +29,6 @@ public interface IDaSheepfoldService
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
@@ -53,7 +51,6 @@ public class BasSheepServiceImpl implements IBasSheepService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "b", userAlias = "b")
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return basSheepMapper.searchEarNumbers(query);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ 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; // 核心修正:导入SLF4J的Logger
|
||||
import org.slf4j.LoggerFactory; // 核心修正:导入SLF4J的LoggerFactory
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -26,11 +24,6 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Autowired
|
||||
private BasSheepMapper basSheepMapper;
|
||||
|
||||
|
||||
// 新增:创建日志对象
|
||||
private static final Logger log = LoggerFactory.getLogger(DaSheepfoldServiceImpl.class);
|
||||
|
||||
|
||||
/**
|
||||
* 查询羊舍管理
|
||||
*
|
||||
@@ -52,44 +45,9 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Override
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold)
|
||||
{
|
||||
|
||||
List<DaSheepfold> sheepfoldList = daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
|
||||
// 新增调试打印:输出每个栏位的羊数
|
||||
log.info("===== 栏位羊数调试 =====");
|
||||
log.info("查询条件:牧场ID={}, 羊舍类型ID={}, 羊舍编号={}",
|
||||
daSheepfold.getRanchId(), daSheepfold.getSheepfoldTypeId(), daSheepfold.getSheepfoldNo());
|
||||
log.info("共查询到{}个栏位", sheepfoldList.size());
|
||||
|
||||
for (DaSheepfold fold : sheepfoldList) {
|
||||
log.info("栏位ID={}, 羊舍编号={}, 排号={}, 栏数={}, 羊数={}",
|
||||
fold.getId(), fold.getSheepfoldNo(), fold.getRowNo(), fold.getColumns(), fold.getSheepCount());
|
||||
}
|
||||
log.info("===== 调试结束 =====\n");
|
||||
return daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) {
|
||||
// List<DaSheepfold> summaryList = daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
//
|
||||
// // 新增调试打印:输出羊舍汇总羊数
|
||||
// log.info("===== 羊舍汇总羊数调试 =====");
|
||||
// log.info("查询条件:牧场ID={}, 羊舍类型ID={}",
|
||||
// daSheepfold.getRanchId(), daSheepfold.getSheepfoldTypeId());
|
||||
// log.info("共查询到{}个羊舍", summaryList.size());
|
||||
//
|
||||
// for (DaSheepfold fold : summaryList) {
|
||||
// log.info("羊舍编号={}, 羊舍名称={}, 总羊数={}",
|
||||
// fold.getSheepfoldNo(), fold.getSheepfoldName(), fold.getTotalSheepCount());
|
||||
// }
|
||||
// log.info("===== 汇总调试结束 =====\n");
|
||||
return daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
|
||||
@@ -78,8 +78,7 @@ public class DewormController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Deworm deworm)
|
||||
{
|
||||
deworm.setDeptId(getDeptId());
|
||||
deworm.setUserId(getUserId());
|
||||
System.out.println(deworm);
|
||||
return toAjax(dewormService.insertDeworm(deworm));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,6 @@ public class DiagnosisController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Diagnosis diagnosis)
|
||||
{
|
||||
diagnosis.setDeptId(getDeptId());
|
||||
diagnosis.setUserId(getUserId());
|
||||
return toAjax(diagnosisService.insertDiagnosis(diagnosis));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,6 @@ public class DisinfectController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Disinfect disinfect)
|
||||
{
|
||||
disinfect.setDeptId(getDeptId());
|
||||
disinfect.setUserId(getUserId());
|
||||
return toAjax(disinfectService.insertDisinfect(disinfect));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,6 @@ public class HealthController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Health health)
|
||||
{
|
||||
health.setDeptId(getDeptId());
|
||||
health.setUserId(getUserId());
|
||||
return toAjax(healthService.insertHealth(health));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,6 @@ public class ImmunityController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Immunity immunity)
|
||||
{
|
||||
immunity.setDeptId(getDeptId());
|
||||
immunity.setUserId(getUserId());
|
||||
return toAjax(immunityService.insertImmunity(immunity));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,6 @@ public class QuarantineReportController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuarantineReport quarantineReport)
|
||||
{
|
||||
quarantineReport.setDeptId(getDeptId());
|
||||
quarantineReport.setUserId(getUserId());
|
||||
return toAjax(quarantineReportService.insertQuarantineReport(quarantineReport));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,6 @@ public class SwMedicineUsageController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SwMedicineUsage swMedicineUsage)
|
||||
{
|
||||
swMedicineUsage.setDeptId(getDeptId());
|
||||
swMedicineUsage.setUserId(getUserId());
|
||||
return toAjax(swMedicineUsageService.insertSwMedicineUsage(swMedicineUsage));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,6 @@ public class TreatmentController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Treatment treatment)
|
||||
{
|
||||
treatment.setDeptId(getDeptId());
|
||||
treatment.setUserId(getUserId());
|
||||
return toAjax(treatmentService.insertTreatment(treatment));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,7 @@ public class Deworm extends BaseEntity
|
||||
@Excel(name = "胎次")
|
||||
private Long parity;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
|
||||
/** 药品使用记录 */
|
||||
@Excel(name = "药品使用记录")
|
||||
@@ -82,5 +81,4 @@ public class Deworm extends BaseEntity
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
}
|
||||
|
||||
@@ -106,9 +106,6 @@ public class Diagnosis extends BaseEntity
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
if (gender != null && !gender.trim().isEmpty()) {
|
||||
|
||||
@@ -61,9 +61,6 @@ public class Disinfect extends BaseEntity
|
||||
/** 药品名称用于查询*/
|
||||
private String mediName;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -69,9 +69,6 @@ public class Health extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -78,9 +78,6 @@ public class Immunity extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -98,9 +98,6 @@ public class QuarantineReport extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
|
||||
@@ -53,9 +53,6 @@ public class SwMedicineUsage extends BaseEntity
|
||||
@Excel(name = "使用类型",width = 20, needMerge = true)
|
||||
private String useType;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录详情信息 */
|
||||
@Excel
|
||||
private List<SwMedicineUsageDetails> swMedicineUsageDetailsList;
|
||||
|
||||
@@ -104,9 +104,6 @@ public class Treatment extends BaseEntity
|
||||
@Excel(name = "药品使用记录id")
|
||||
private Integer usageId;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ 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;
|
||||
@@ -60,7 +58,6 @@ public class DewormServiceImpl implements IDewormService
|
||||
* @return 驱虫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Deworm> selectDewormList(Deworm deworm)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -4,7 +4,6 @@ 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;
|
||||
@@ -61,7 +60,6 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
* @return 诊疗结果
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Diagnosis> selectDiagnosisList(Diagnosis diagnosis)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,8 +2,6 @@ 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;
|
||||
@@ -61,7 +59,6 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
* @return 消毒记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Disinfect> selectDisinfectList(Disinfect disinfect)
|
||||
{
|
||||
return disinfectMapper.selectDisinfectList(disinfect);
|
||||
|
||||
@@ -5,7 +5,6 @@ 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;
|
||||
@@ -63,7 +62,6 @@ public class HealthServiceImpl implements IHealthService
|
||||
* @return 保健
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Health> selectHealthList(Health health)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,8 +2,6 @@ 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;
|
||||
@@ -63,7 +61,6 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
* @return 免疫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Immunity> selectImmunityList(Immunity immunity)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,7 +2,6 @@ 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,8 +2,6 @@ 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;
|
||||
@@ -48,7 +46,6 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
||||
* @return 检疫记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sqr", userAlias = "sqr")
|
||||
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
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.service.ISwMedicineUsageService;
|
||||
@@ -46,7 +44,6 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
|
||||
* @return 药品使用记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "smu", userAlias = "smu")
|
||||
public List<SwMedicineUsage> selectSwMedicineUsageList(SwMedicineUsage swMedicineUsage)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,8 +2,6 @@ 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;
|
||||
@@ -67,7 +65,6 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
* @return 治疗记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "t", userAlias = "t")
|
||||
public List<Treatment> selectTreatmentList(Treatment treatment)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -26,9 +26,7 @@ public class UserPostController {
|
||||
// 根据岗位编码获取用户
|
||||
@GetMapping("/getUser")
|
||||
public AjaxResult getUserPost(String postCode){
|
||||
User user = new User();
|
||||
user.setPostCode(postCode);
|
||||
List<User> list = userService.getUserListByCode(user);
|
||||
List<User> list = userService.getUserListByCode(postCode);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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,7 +1,6 @@
|
||||
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;
|
||||
@@ -9,7 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Post extends BaseEntity {
|
||||
public class Post {
|
||||
|
||||
/** 岗位序号 */
|
||||
@Excel(name = "岗位序号", cellType = Excel.ColumnType.NUMERIC)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -8,10 +7,9 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class User extends BaseEntity {
|
||||
public class User {
|
||||
// 用户id
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
private String userId;
|
||||
// 用户名
|
||||
private String nickName;
|
||||
// 岗位名称
|
||||
@@ -19,5 +17,4 @@ public class User extends BaseEntity {
|
||||
// 岗位编码
|
||||
private String postCode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
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);
|
||||
}
|
||||
@@ -8,5 +8,5 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
|
||||
List<User> getUserListByCode(User user);
|
||||
List<User> getUserListByCode(String postCode);
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ import com.zhyc.module.common.domain.User;
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
List<User> getUserListByCode(User postCode);
|
||||
List<User> getUserListByCode(String postCode);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.zhyc.module.common.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.common.domain.Dept;
|
||||
import com.zhyc.module.common.domain.User;
|
||||
import com.zhyc.module.common.mapper.DeptMapper;
|
||||
import com.zhyc.module.common.mapper.UserMapper;
|
||||
import com.zhyc.module.common.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -16,16 +12,9 @@ import java.util.List;
|
||||
public class UserPostServiceImpl implements UserService {
|
||||
@Autowired
|
||||
UserMapper userMapper;
|
||||
@Autowired
|
||||
DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public List<User> getUserListByCode(User user) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
|
||||
Dept secondLevel = deptMapper.selectTopSecondLevelDept(deptId);
|
||||
user.setDeptId(secondLevel.getDeptId());
|
||||
System.out.println(secondLevel);
|
||||
return userMapper.getUserListByCode(user);
|
||||
public List<User> getUserListByCode(String postCode) {
|
||||
return userMapper.getUserListByCode(postCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.module.feed.service.impl.SgFeedListServiceImpl;
|
||||
@@ -39,7 +40,7 @@ public class SgFeedListController extends BaseController {
|
||||
private final ISgFeedListService sgFeedListService;
|
||||
|
||||
|
||||
public static boolean refresh = true;
|
||||
public static final AtomicBoolean refresh = new AtomicBoolean(true);
|
||||
|
||||
@Autowired
|
||||
public SgFeedListController(ISgFeedListService sgFeedListService) {
|
||||
@@ -57,9 +58,8 @@ public class SgFeedListController extends BaseController {
|
||||
刷新缓存
|
||||
当配方管理表出现更新 或 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新
|
||||
*/
|
||||
if (refresh) {
|
||||
sgFeedListService.SyncFeedList();
|
||||
refresh = false;
|
||||
if (refresh.compareAndSet(true, false)) {
|
||||
sgFeedListService.syncFeedListSafely();
|
||||
}
|
||||
startPage();
|
||||
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
|
||||
@@ -109,8 +109,6 @@ public class SgFeedListController extends BaseController {
|
||||
@Log(title = "配料清单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgFeedList sgFeedList) {
|
||||
sgFeedList.setDeptId(getDeptId());
|
||||
sgFeedList.setUserId(getUserId());
|
||||
return toAjax(sgFeedListService.insertSgFeedList(sgFeedList));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,13 +79,11 @@ public class SgFeedPlanController extends BaseController {
|
||||
if (null == sgFeedPlan) {
|
||||
throw new RuntimeException("数据为空");
|
||||
}
|
||||
sgFeedPlan.setDeptId(getDeptId());
|
||||
sgFeedPlan.setUserId(getUserId());
|
||||
sgFeedPlan.setCreateDate(new Date());
|
||||
// 计算其他字段值
|
||||
setPlan(sgFeedPlan);
|
||||
// 通知配料清单刷新数据
|
||||
SgFeedListController.refresh = true;
|
||||
SgFeedListController.refresh.set(true);
|
||||
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
|
||||
}
|
||||
|
||||
@@ -99,7 +97,7 @@ public class SgFeedPlanController extends BaseController {
|
||||
// 根据修改后的值重新计算
|
||||
setPlan(sgFeedPlan);
|
||||
// 通知配料清单刷新数据
|
||||
SgFeedListController.refresh = true;
|
||||
SgFeedListController.refresh.set(true);
|
||||
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
|
||||
}
|
||||
|
||||
@@ -111,7 +109,7 @@ public class SgFeedPlanController extends BaseController {
|
||||
@DeleteMapping("/{createDates}")
|
||||
public AjaxResult remove(@PathVariable Date[] createDates) {
|
||||
// 通知配料清单刷新数据
|
||||
SgFeedListController.refresh = true;
|
||||
SgFeedListController.refresh.set(true);
|
||||
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,6 @@ public class SgFeedStatisticController extends BaseController {
|
||||
if (null == sgFeedStatistic.getFormulaId() && null == sgFeedStatistic.getFormulaBatchId()) {
|
||||
throw new RuntimeException("ERROR: 数据为空");
|
||||
}
|
||||
sgFeedStatistic.setUserId(getUserId());
|
||||
sgFeedStatistic.setDeptId(getDeptId());
|
||||
List<SgFeedStatistic> isExist = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
|
||||
if (null != isExist && !isExist.isEmpty()) {
|
||||
throw new RuntimeException("WARNING: 数据重复");
|
||||
|
||||
@@ -79,8 +79,6 @@ public class SgFormulaListController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgFormulaList sgFormulaList)
|
||||
{
|
||||
sgFormulaList.setUserId(getUserId());
|
||||
sgFormulaList.setDeptId(getDeptId());
|
||||
return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList));
|
||||
}
|
||||
|
||||
|
||||
@@ -93,10 +93,7 @@ public class SgFormulaManagementController extends BaseController {
|
||||
@PostMapping
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
|
||||
if (null == sgFormulaManagement)
|
||||
throw new RuntimeException("ERROR: 数据为空");
|
||||
sgFormulaManagement.setUserId(getUserId());
|
||||
sgFormulaManagement.setDeptId(getDeptId());
|
||||
if (null == sgFormulaManagement) throw new RuntimeException("ERROR: 数据为空");
|
||||
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
|
||||
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
|
||||
if (exist != null) {
|
||||
@@ -147,7 +144,7 @@ public class SgFormulaManagementController extends BaseController {
|
||||
}
|
||||
|
||||
// 通知配料清单刷新数据
|
||||
SgFeedListController.refresh = true;
|
||||
SgFeedListController.refresh.set(true);
|
||||
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
|
||||
}
|
||||
|
||||
@@ -174,7 +171,7 @@ public class SgFormulaManagementController extends BaseController {
|
||||
sgFormulaManagement.setBatchId(batchId);
|
||||
|
||||
// 通知配料清单刷新数据
|
||||
SgFeedListController.refresh = true;
|
||||
SgFeedListController.refresh.set(true);
|
||||
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhyc.module.feed.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -24,13 +23,14 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 原料Controller
|
||||
*
|
||||
*
|
||||
* @author HashMap
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/feed/material")
|
||||
public class SgMaterialController extends BaseController {
|
||||
public class SgMaterialController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISgMaterialService sgMaterialService;
|
||||
|
||||
@@ -39,7 +39,8 @@ public class SgMaterialController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SgMaterial sgMaterial) {
|
||||
public TableDataInfo list(SgMaterial sgMaterial)
|
||||
{
|
||||
startPage();
|
||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||
return getDataTable(list);
|
||||
@@ -51,7 +52,8 @@ public class SgMaterialController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:export')")
|
||||
@Log(title = "原料", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SgMaterial sgMaterial) {
|
||||
public void export(HttpServletResponse response, SgMaterial sgMaterial)
|
||||
{
|
||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||
ExcelUtil<SgMaterial> util = new ExcelUtil<SgMaterial>(SgMaterial.class);
|
||||
util.exportExcel(response, list, "原料数据");
|
||||
@@ -62,7 +64,8 @@ public class SgMaterialController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:query')")
|
||||
@GetMapping(value = "/{materialId}")
|
||||
public AjaxResult getInfo(@PathVariable("materialId") String materialId) {
|
||||
public AjaxResult getInfo(@PathVariable("materialId") String materialId)
|
||||
{
|
||||
return success(sgMaterialService.selectSgMaterialByMaterialId(materialId));
|
||||
}
|
||||
|
||||
@@ -72,9 +75,8 @@ public class SgMaterialController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:add')")
|
||||
@Log(title = "原料", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgMaterial sgMaterial) {
|
||||
sgMaterial.setUserId(getUserId());
|
||||
sgMaterial.setDeptId(getDeptId());
|
||||
public AjaxResult add(@RequestBody SgMaterial sgMaterial)
|
||||
{
|
||||
return toAjax(sgMaterialService.insertSgMaterial(sgMaterial));
|
||||
}
|
||||
|
||||
@@ -84,7 +86,8 @@ public class SgMaterialController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:edit')")
|
||||
@Log(title = "原料", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SgMaterial sgMaterial) {
|
||||
public AjaxResult edit(@RequestBody SgMaterial sgMaterial)
|
||||
{
|
||||
return toAjax(sgMaterialService.updateSgMaterial(sgMaterial));
|
||||
}
|
||||
|
||||
@@ -93,8 +96,9 @@ public class SgMaterialController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:remove')")
|
||||
@Log(title = "原料", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{materialIds}")
|
||||
public AjaxResult remove(@PathVariable String[] materialIds) {
|
||||
@DeleteMapping("/{materialIds}")
|
||||
public AjaxResult remove(@PathVariable String[] materialIds)
|
||||
{
|
||||
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,36 +19,26 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFeedList extends BaseEntity {
|
||||
public class SgFeedList extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
|
||||
/** 序号 */
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
/** 配方编号 */
|
||||
@Excel(name = "配方编号")
|
||||
private String formulaId;
|
||||
|
||||
/**
|
||||
* 配方批号
|
||||
*/
|
||||
/** 配方批号 */
|
||||
@Excel(name = "配方批号")
|
||||
private String formulaBatchId;
|
||||
|
||||
/**
|
||||
* 饲草班人员
|
||||
*/
|
||||
/** 饲草班人员 */
|
||||
@Excel(name = "饲草班人员")
|
||||
private String zookeeper;
|
||||
|
||||
/**
|
||||
* 配料日期
|
||||
*/
|
||||
/** 配料日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "配料日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deployDate;
|
||||
@@ -61,14 +51,14 @@ public class SgFeedList extends BaseEntity {
|
||||
private Double noonTotal;
|
||||
private Double afternoonTotal;
|
||||
|
||||
private List<SgFormulaList> formulaList;
|
||||
private List<SgFormulaList> formulaList;
|
||||
|
||||
private List<SgFeedPlan> planList;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("formulaBatchId", getFormulaBatchId())
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zhyc.module.feed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -12,144 +11,125 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 饲喂计划对象 sg_feed_plan
|
||||
*
|
||||
*
|
||||
* @author HashMap
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SgFeedPlan extends BaseEntity {
|
||||
public class SgFeedPlan extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
|
||||
/** 创建日期 */
|
||||
private Date createDate;
|
||||
|
||||
/**
|
||||
* 配方编码
|
||||
*/
|
||||
/** 配方编码 */
|
||||
@Excel(name = "配方编码")
|
||||
private String formulaId;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
/** 批号 */
|
||||
@Excel(name = "批号")
|
||||
private String batchId;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
/** 羊舍 */
|
||||
@Excel(name = "羊舍")
|
||||
private Integer sheepHouseId;
|
||||
|
||||
/**
|
||||
* 羊只数量
|
||||
*/
|
||||
/** 羊只数量 */
|
||||
@Excel(name = "羊只数量")
|
||||
private Integer sheepCount;
|
||||
|
||||
/**
|
||||
* 日均计划量
|
||||
*/
|
||||
/** 日均计划量 */
|
||||
@Excel(name = "日均计划量")
|
||||
private Double planDailySize;
|
||||
|
||||
/**
|
||||
* 饲喂比例(早)
|
||||
*/
|
||||
/** 饲喂比例(早) */
|
||||
@Excel(name = "饲喂比例(早)")
|
||||
private Double ratioMorning;
|
||||
|
||||
/**
|
||||
* 饲喂比例(中)
|
||||
*/
|
||||
/** 饲喂比例(中) */
|
||||
@Excel(name = "饲喂比例(中)")
|
||||
private Double ratioNoon;
|
||||
|
||||
/**
|
||||
* 饲喂比例(下)
|
||||
*/
|
||||
/** 饲喂比例(下) */
|
||||
@Excel(name = "饲喂比例(下)")
|
||||
private Double ratioAfternoon;
|
||||
|
||||
/**
|
||||
* 计划量(早)
|
||||
*/
|
||||
/** 计划量(早) */
|
||||
@Excel(name = "计划量(早)")
|
||||
private Double planMorningSize;
|
||||
|
||||
/**
|
||||
* 计划总量(早)
|
||||
*/
|
||||
/** 计划总量(早) */
|
||||
@Excel(name = "计划总量(早)")
|
||||
private Double planMorningTotal;
|
||||
|
||||
/**
|
||||
* 实际量(早)
|
||||
*/
|
||||
/** 实际量(早) */
|
||||
@Excel(name = "实际量(早)")
|
||||
private Double actualMorningSize;
|
||||
|
||||
/**
|
||||
* 计划量(中)
|
||||
*/
|
||||
/** 计划量(中) */
|
||||
@Excel(name = "计划量(中)")
|
||||
private Double planNoonSize;
|
||||
|
||||
/**
|
||||
* 计划总量(中)
|
||||
*/
|
||||
/** 计划总量(中) */
|
||||
@Excel(name = "计划总量(中)")
|
||||
private Double planNoonTotal;
|
||||
|
||||
/**
|
||||
* 实际量(中)
|
||||
*/
|
||||
/** 实际量(中) */
|
||||
@Excel(name = "实际量(中)")
|
||||
private Double actualNoonSize;
|
||||
|
||||
/**
|
||||
* 计划量(下)
|
||||
*/
|
||||
/** 计划量(下) */
|
||||
@Excel(name = "计划量(下)")
|
||||
private Double planAfternoonSize;
|
||||
|
||||
/**
|
||||
* 计划总量(下)
|
||||
*/
|
||||
/** 计划总量(下) */
|
||||
@Excel(name = "计划总量(下)")
|
||||
private Double planAfternoonTotal;
|
||||
|
||||
/**
|
||||
* 实际量(下)
|
||||
*/
|
||||
/** 实际量(下) */
|
||||
@Excel(name = "实际量(下)")
|
||||
private Double actualAfternoonSize;
|
||||
|
||||
/**
|
||||
* 计划饲喂总量
|
||||
*/
|
||||
/** 计划饲喂总量 */
|
||||
@Excel(name = "计划饲喂总量")
|
||||
private Double planFeedTotal;
|
||||
|
||||
/**
|
||||
* 饲草班人员
|
||||
*/
|
||||
/** 饲草班人员 */
|
||||
@Excel(name = "饲草班人员")
|
||||
private String zookeeper;
|
||||
|
||||
/**
|
||||
* 饲喂计划日期
|
||||
*/
|
||||
/** 饲喂计划日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planDate;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("createDate", getCreateDate()).append("formulaId", getFormulaId()).append("batchId", getBatchId()).append("sheepHouseId", getSheepHouseId()).append("sheepCount", getSheepCount()).append("planDailySize", getPlanDailySize()).append("ratioMorning", getRatioMorning()).append("ratioNoon", getRatioNoon()).append("ratioAfternoon", getRatioAfternoon()).append("planMorningSize", getPlanMorningSize()).append("planMorningTotal", getPlanMorningTotal()).append("actualMorningSize", getActualMorningSize()).append("planNoonSize", getPlanNoonSize()).append("planNoonTotal", getPlanNoonTotal()).append("actualNoonSize", getActualNoonSize()).append("planAfternoonSize", getPlanAfternoonSize()).append("planAfternoonTotal", getPlanAfternoonTotal()).append("actualAfternoonSize", getActualAfternoonSize()).append("planFeedTotal", getPlanFeedTotal()).append("zookeeper", getZookeeper()).append("planDate", getPlanDate()).append("remark", getRemark()).toString();
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("createDate", getCreateDate())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("batchId", getBatchId())
|
||||
.append("sheepHouseId", getSheepHouseId())
|
||||
.append("sheepCount", getSheepCount())
|
||||
.append("planDailySize", getPlanDailySize())
|
||||
.append("ratioMorning", getRatioMorning())
|
||||
.append("ratioNoon", getRatioNoon())
|
||||
.append("ratioAfternoon", getRatioAfternoon())
|
||||
.append("planMorningSize", getPlanMorningSize())
|
||||
.append("planMorningTotal", getPlanMorningTotal())
|
||||
.append("actualMorningSize", getActualMorningSize())
|
||||
.append("planNoonSize", getPlanNoonSize())
|
||||
.append("planNoonTotal", getPlanNoonTotal())
|
||||
.append("actualNoonSize", getActualNoonSize())
|
||||
.append("planAfternoonSize", getPlanAfternoonSize())
|
||||
.append("planAfternoonTotal", getPlanAfternoonTotal())
|
||||
.append("actualAfternoonSize", getActualAfternoonSize())
|
||||
.append("planFeedTotal", getPlanFeedTotal())
|
||||
.append("zookeeper", getZookeeper())
|
||||
.append("planDate", getPlanDate())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class SgFeedStatistic extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
|
||||
@@ -9,45 +9,33 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 配方列表对象 sg_formula_list
|
||||
*
|
||||
*
|
||||
* @author HashMap
|
||||
* @date 2025-08-09
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFormulaList extends BaseEntity {
|
||||
public class SgFormulaList extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
|
||||
/** 序号 */
|
||||
private Long code;
|
||||
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
/** 配方编号 */
|
||||
private String formulaId;
|
||||
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
/** 配方编号 */
|
||||
private String batchId;
|
||||
/**
|
||||
* 原料编号
|
||||
*/
|
||||
/** 原料编号 */
|
||||
@Excel(name = "原料编号")
|
||||
private String materialId;
|
||||
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
/** 原料名称 */
|
||||
@Excel(name = "原料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 比例
|
||||
*/
|
||||
/** 比例 */
|
||||
@Excel(name = "比例")
|
||||
private Long ratio;
|
||||
|
||||
@@ -72,14 +60,14 @@ public class SgFormulaList extends BaseEntity {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("code", getCode())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("ratio", getRatio())
|
||||
.append("isGranular", getIsGranular())
|
||||
.append("isSupplement", getIsSupplement())
|
||||
.toString();
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("code", getCode())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("ratio", getRatio())
|
||||
.append("isGranular", getIsGranular())
|
||||
.append("isSupplement", getIsSupplement())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,87 +13,67 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 配方管理对象 sg_formula_management
|
||||
*
|
||||
*
|
||||
* @author HashMap
|
||||
* @date 2025-08-09
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFormulaManagement extends BaseEntity {
|
||||
public class SgFormulaManagement extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
|
||||
/** 配方编号 */
|
||||
private String formulaId;
|
||||
|
||||
/**
|
||||
* 饲养阶段
|
||||
*/
|
||||
/** 饲养阶段 */
|
||||
@Excel(name = "饲养阶段")
|
||||
private String feedStage;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
/** 批号 */
|
||||
@Excel(name = "批号")
|
||||
private String batchId;
|
||||
|
||||
/**
|
||||
* 开始使用时间
|
||||
*/
|
||||
/** 开始使用时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date useStartDate;
|
||||
|
||||
/**
|
||||
* 结束使用时间
|
||||
*/
|
||||
/** 结束使用时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date useEndDate;
|
||||
|
||||
/**
|
||||
* 使用状态
|
||||
*/
|
||||
/** 使用状态 */
|
||||
@Excel(name = "使用状态")
|
||||
private String useState;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 配方列表
|
||||
*/
|
||||
private List<SgFormulaList> sgFormulaList;
|
||||
/** 配方列表 */
|
||||
private List<SgFormulaList> sgFormulaList;
|
||||
|
||||
/**
|
||||
* 子配方
|
||||
*/
|
||||
/** 子配方 */
|
||||
private List<SgFormulaManagement> subFormulaList;
|
||||
|
||||
/**
|
||||
* 查询类型 *
|
||||
/** 查询类型 *
|
||||
* Sub : 子配方查询
|
||||
* query : 类型查询
|
||||
*
|
||||
*/
|
||||
* */
|
||||
private String queryType;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("feedStage", getFeedStage())
|
||||
.append("batchId", getBatchId())
|
||||
.append("useStartDate", getUseStartDate())
|
||||
.append("useEndDate", getUseEndDate())
|
||||
.append("useState", getUseState())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("feedStage", getFeedStage())
|
||||
.append("batchId", getBatchId())
|
||||
.append("useStartDate", getUseStartDate())
|
||||
.append("useEndDate", getUseEndDate())
|
||||
.append("useState", getUseState())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zhyc.module.feed.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
@@ -8,59 +7,62 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 原料对象 sg_material
|
||||
*
|
||||
*
|
||||
* @author HashMap
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
@Data
|
||||
public class SgMaterial extends BaseEntity {
|
||||
public class SgMaterial extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 原料编码
|
||||
*/
|
||||
|
||||
/** 原料编码 */
|
||||
@Excel(name = "原料编码")
|
||||
private String materialId;
|
||||
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
/** 原料名称 */
|
||||
@Excel(name = "原料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 颗粒料
|
||||
*/
|
||||
/** 颗粒料 */
|
||||
@Excel(name = "颗粒料")
|
||||
private Integer isGranular;
|
||||
|
||||
public void setMaterialId(String materialId) {
|
||||
public void setMaterialId(String materialId)
|
||||
{
|
||||
this.materialId = materialId;
|
||||
}
|
||||
|
||||
public String getMaterialId() {
|
||||
public String getMaterialId()
|
||||
{
|
||||
return materialId;
|
||||
}
|
||||
|
||||
public void setMaterialName(String materialName) {
|
||||
public void setMaterialName(String materialName)
|
||||
{
|
||||
this.materialName = materialName;
|
||||
}
|
||||
|
||||
public String getMaterialName() {
|
||||
public String getMaterialName()
|
||||
{
|
||||
return materialName;
|
||||
}
|
||||
|
||||
public void setIsGranular(Integer isGranular) {
|
||||
public void setIsGranular(Integer isGranular)
|
||||
{
|
||||
this.isGranular = isGranular;
|
||||
}
|
||||
|
||||
public Integer getIsGranular() {
|
||||
public Integer getIsGranular()
|
||||
{
|
||||
return isGranular;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("materialId", getMaterialId()).append("materialName", getMaterialName()).append("isGranular", getIsGranular()).toString();
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("isGranular", getIsGranular())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,5 +59,7 @@ public interface ISgFeedListService {
|
||||
*/
|
||||
int deleteSgFeedListById(Long id);
|
||||
|
||||
void syncFeedListSafely();
|
||||
|
||||
void SyncFeedList();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
import com.zhyc.module.feed.domain.SgFormulaManagement;
|
||||
import com.zhyc.module.feed.service.ISgFeedPlanService;
|
||||
@@ -12,6 +11,10 @@ import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFeedListMapper;
|
||||
import com.zhyc.module.feed.domain.SgFeedList;
|
||||
import com.zhyc.module.feed.service.ISgFeedListService;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import static com.zhyc.module.feed.controller.SgFeedListController.refresh;
|
||||
|
||||
/**
|
||||
* 配料清单Service业务层处理
|
||||
@@ -31,7 +34,15 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
||||
this.sgFeedListMapper = sgFeedListMapper;
|
||||
this.sgFormulaManagementService = sgFormulaManagementService;
|
||||
this.sgFeedPlanService = sgFeedPlanService;
|
||||
// 构造时将数据库初始数据写入缓存
|
||||
// 第一次请求时更新缓存
|
||||
refresh.set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在数据源已切换后调用
|
||||
*/
|
||||
public synchronized void initCacheIfNecessary() {
|
||||
// 初次访问时将数据库初始数据写入缓存
|
||||
List<SgFeedList> feedListsFromDataBase = this.selectSgFeedListList(new SgFeedList());
|
||||
for (SgFeedList sgFeedListItem : feedListsFromDataBase) {
|
||||
String key = sgFeedListItem.getFormulaId() + "_" + sgFeedListItem.getFormulaBatchId() + "_" + sgFeedListItem.getDeployDate();
|
||||
@@ -57,7 +68,6 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
||||
* @return 配料清单
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_list_alias", userAlias = "sg_feed_list_alias")
|
||||
public List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList) {
|
||||
return sgFeedListMapper.selectSgFeedListList(sgFeedList);
|
||||
}
|
||||
@@ -159,6 +169,16 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
||||
}
|
||||
}
|
||||
|
||||
public void syncFeedListSafely() {
|
||||
try {
|
||||
SyncFeedList();
|
||||
} catch (Exception e) {
|
||||
refresh.set(true); // 初始化失败,下次还能重试
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public void SyncFeedList() {
|
||||
HashMap<String, SgFeedList> cacheTemp = new HashMap<>(sgFeedListMap);
|
||||
// 清空旧缓存
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhyc.module.feed.service.impl;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFeedPlanMapper;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
@@ -12,13 +11,14 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 饲喂计划Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author HashMap
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SgFeedPlanServiceImpl implements ISgFeedPlanService {
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
{
|
||||
private final SgFeedPlanMapper sgFeedPlanMapper;
|
||||
|
||||
public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) {
|
||||
@@ -27,68 +27,73 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService {
|
||||
|
||||
/**
|
||||
* 查询饲喂计划
|
||||
*
|
||||
*
|
||||
* @param createDate 饲喂计划主键
|
||||
* @return 饲喂计划
|
||||
*/
|
||||
@Override
|
||||
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate) {
|
||||
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate)
|
||||
{
|
||||
return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询饲喂计划列表
|
||||
*
|
||||
*
|
||||
* @param sgFeedPlan 饲喂计划
|
||||
* @return 饲喂计划
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_plan_alias", userAlias = "sg_feed_plan_alias")
|
||||
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan) {
|
||||
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
return sgFeedPlanMapper.selectSgFeedPlanList(sgFeedPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增饲喂计划
|
||||
*
|
||||
*
|
||||
* @param sgFeedPlan 饲喂计划
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan) {
|
||||
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改饲喂计划
|
||||
*
|
||||
*
|
||||
* @param sgFeedPlan 饲喂计划
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan) {
|
||||
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除饲喂计划
|
||||
*
|
||||
*
|
||||
* @param createDates 需要删除的饲喂计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSgFeedPlanByCreateDates(Date[] createDates) {
|
||||
public int deleteSgFeedPlanByCreateDates(Date[] createDates)
|
||||
{
|
||||
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除饲喂计划信息
|
||||
*
|
||||
*
|
||||
* @param createDate 饲喂计划主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSgFeedPlanByCreateDate(Date createDate) {
|
||||
public int deleteSgFeedPlanByCreateDate(Date createDate)
|
||||
{
|
||||
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhyc.module.feed.service.impl;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.feed.domain.SgFeedList;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
@@ -52,7 +51,6 @@ public class SgFeedStatisticServiceImpl implements ISgFeedStatisticService {
|
||||
* @return 饲喂量统计
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_statistic_alias", userAlias = "sg_feed_statistic_alias")
|
||||
public List<SgFeedStatistic> selectSgFeedStatisticList(SgFeedStatistic sgFeedStatistic) {
|
||||
return sgFeedStatisticMapper.selectSgFeedStatisticList(sgFeedStatistic);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
|
||||
import com.zhyc.module.feed.domain.SgFormulaList;
|
||||
@@ -42,7 +41,6 @@ public class SgFormulaListServiceImpl implements ISgFormulaListService {
|
||||
* @return 配方列表
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_formula_list_alias", userAlias = "sg_formula_list_alias")
|
||||
public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) {
|
||||
return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.feed.domain.SgFormulaList;
|
||||
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -47,7 +46,6 @@ public class SgFormulaManagementServiceImpl implements ISgFormulaManagementServi
|
||||
* @return 配方管理
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_formula_management_alias", userAlias = "sg_formula_management_alias")
|
||||
public List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) {
|
||||
List<SgFormulaManagement> sgFormulaManagements =
|
||||
sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgMaterialMapper;
|
||||
@@ -38,7 +37,6 @@ public class SgMaterialServiceImpl implements ISgMaterialService {
|
||||
* @return 原料
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_material_alias", userAlias = "sg_material_alias")
|
||||
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial) {
|
||||
return sgMaterialMapper.selectSgMaterialList(sgMaterial);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,6 @@ package com.zhyc.module.produce.bodyManage.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.service.IBasSheepService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -19,28 +14,28 @@ import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 体尺测量Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/body_measure/body_measure")
|
||||
public class ScBodyMeasureController extends BaseController {
|
||||
public class ScBodyMeasureController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IScBodyMeasureService scBodyMeasureService;
|
||||
@Autowired
|
||||
private IBasSheepService basSheepService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询体尺测量列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScBodyMeasure scBodyMeasure) {
|
||||
public TableDataInfo list(ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
startPage();
|
||||
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
|
||||
return getDataTable(list);
|
||||
@@ -52,7 +47,8 @@ public class ScBodyMeasureController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:export')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure) {
|
||||
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
|
||||
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<ScBodyMeasure>(ScBodyMeasure.class);
|
||||
util.exportExcel(response, list, "体尺测量数据");
|
||||
@@ -63,7 +59,8 @@ public class ScBodyMeasureController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scBodyMeasureService.selectScBodyMeasureById(id));
|
||||
}
|
||||
|
||||
@@ -73,7 +70,8 @@ public class ScBodyMeasureController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:add')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure));
|
||||
}
|
||||
|
||||
@@ -83,7 +81,8 @@ public class ScBodyMeasureController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:edit')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
return toAjax(scBodyMeasureService.updateScBodyMeasure(scBodyMeasure));
|
||||
}
|
||||
|
||||
@@ -92,82 +91,14 @@ public class ScBodyMeasureController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:remove')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scBodyMeasureService.deleteScBodyMeasureByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query){
|
||||
return success(scBodyMeasureService.searchEarNumbers(query.trim()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入体尺测量数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:import')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/import")
|
||||
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<>(ScBodyMeasure.class);
|
||||
List<ScBodyMeasure> list = util.importExcel(file.getInputStream());
|
||||
|
||||
// 数据校验和处理
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ScBodyMeasure measure = list.get(i);
|
||||
try {
|
||||
// 根据耳号查询羊只ID
|
||||
if (StringUtils.isNotBlank(measure.getManageTags())) {
|
||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(measure.getManageTags().trim());
|
||||
if (sheep == null) {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:耳号【")
|
||||
.append(measure.getManageTags()).append("】不存在;");
|
||||
continue;
|
||||
}
|
||||
measure.setSheepId(sheep.getId());
|
||||
} else {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:耳号不能为空;");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 设置默认值
|
||||
measure.setCreateTime(DateUtils.getNowDate());
|
||||
measure.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
scBodyMeasureService.insertScBodyMeasure(measure);
|
||||
successCount++;
|
||||
|
||||
// 更新羊只当前体重
|
||||
if (measure.getCurrentWeight() != null) {
|
||||
BasSheep updateSheep = new BasSheep();
|
||||
updateSheep.setId(measure.getSheepId());
|
||||
updateSheep.setCurrentWeight(measure.getCurrentWeight());
|
||||
basSheepService.updateBasSheep(updateSheep);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:").append(e.getMessage()).append(";");
|
||||
}
|
||||
}
|
||||
|
||||
String msg = String.format("导入完成:成功%d条,失败%d条", successCount, failCount);
|
||||
if (failCount > 0) {
|
||||
msg += ";失败原因:" + errorMsg.toString();
|
||||
}
|
||||
return success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取繁殖状态列表(用于下拉选择)
|
||||
*/
|
||||
@GetMapping("/breedStatus")
|
||||
public AjaxResult listBreedStatus() {
|
||||
return success(scBodyMeasureService.selectBreedStatusList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.zhyc.module.produce.bodyManage.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -65,10 +62,8 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
/**
|
||||
* 测量日期
|
||||
*/
|
||||
@Excel(name = "测量日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date measureDate;
|
||||
@Excel(name = "测量日期")
|
||||
private LocalDate measureDate;
|
||||
/**
|
||||
* 羊只类别
|
||||
*/
|
||||
@@ -87,12 +82,10 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
/**
|
||||
* 出生体重
|
||||
*/
|
||||
@Excel(name = "出生体重")
|
||||
private BigDecimal birthWeight;
|
||||
/**
|
||||
* 断奶体重
|
||||
*/
|
||||
@Excel(name = "断奶体重")
|
||||
private BigDecimal weaningWeight;
|
||||
/**
|
||||
* 当前体重
|
||||
@@ -180,13 +173,6 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "配后天数")
|
||||
private Integer postMatingDay;
|
||||
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -194,22 +180,12 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 月龄查询条件(开始),非数据库字段
|
||||
*/
|
||||
private Integer monthAgeStart;
|
||||
|
||||
/**
|
||||
* 月龄查询条件(结束),非数据库字段
|
||||
*/
|
||||
private Integer monthAgeEnd;
|
||||
}
|
||||
|
||||
@@ -78,13 +78,6 @@ public class ScBodyScore extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -111,13 +111,7 @@ public class ScBreastRating extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhyc.module.produce.bodyManage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -71,9 +69,4 @@ public interface ScBodyMeasureMapper
|
||||
List<ScBodyMeasure> selectScBodyMeasureList(
|
||||
@Param("sc") ScBodyMeasure sc,
|
||||
@Param("manageTagsList") List<String> manageTagsList);
|
||||
|
||||
/**
|
||||
* 查询繁殖状态列表
|
||||
*/
|
||||
List<Map<String, Object>> selectBreedStatusList();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhyc.module.produce.bodyManage.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
|
||||
/**
|
||||
@@ -62,9 +60,4 @@ public interface IScBodyMeasureService
|
||||
public int deleteScBodyMeasureById(Long id);
|
||||
|
||||
List<String> searchEarNumbers(String query);
|
||||
|
||||
/**
|
||||
* 查询繁殖状态列表
|
||||
*/
|
||||
List<Map<String, Object>> selectBreedStatusList();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhyc.module.produce.bodyManage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
@@ -129,9 +127,4 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
||||
{
|
||||
return scBodyMeasureMapper.deleteScBodyMeasureById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectBreedStatusList() {
|
||||
return scBodyMeasureMapper.selectBreedStatusList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,14 @@ import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
|
||||
import com.zhyc.module.produce.breed.service.IScBreedPlanGenerateService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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;
|
||||
@@ -47,9 +54,9 @@ public class ScBreedPlanGenerateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectEwe')")
|
||||
@GetMapping("/selectEwe")
|
||||
public AjaxResult selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags)
|
||||
public AjaxResult selectEligibleEwe()
|
||||
{
|
||||
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe(manageTags);
|
||||
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe();
|
||||
return success(eligibleEwe);
|
||||
}
|
||||
|
||||
@@ -58,9 +65,9 @@ public class ScBreedPlanGenerateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectRam')")
|
||||
@GetMapping("/selectRam")
|
||||
public AjaxResult selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags)
|
||||
public AjaxResult selectEligibleRam()
|
||||
{
|
||||
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam(manageTags);
|
||||
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam();
|
||||
return success(eligibleRam);
|
||||
}
|
||||
|
||||
@@ -242,19 +249,4 @@ public class ScBreedPlanGenerateController extends BaseController
|
||||
{
|
||||
return toAjax(scBreedPlanGenerateService.deleteScBreedPlanGenerateByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mating_plan:generate:query')") // 根据实际权限修改
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
List<String> earNumbers = scBreedPlanGenerateService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,8 +143,8 @@ public class ScBreedRecordController extends BaseController
|
||||
if (scBreedRecord.getBreedType() == null) {
|
||||
return error("配种方式不能为空");
|
||||
}
|
||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 5) {
|
||||
return error("配种方式只能是:1-供体母羊配种、2-同期发情人工授精、3-本交、4-自然发情人工授精、5-胚胎移植");
|
||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 4) {
|
||||
return error("配种方式只能是:1-同期发情、2-本交、3-冲胚、4-自然发情人工授精");
|
||||
}
|
||||
|
||||
// 验证技术员
|
||||
@@ -239,6 +239,4 @@ public class ScBreedRecordController extends BaseController
|
||||
List<ScBreedRecord> records = scBreedRecordService.getBreedRecordsByTimeRange(sheepId, startDate, endDate);
|
||||
return success(records);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -67,15 +65,4 @@ public class ScBreedPlanGenerate extends BaseEntity
|
||||
/** 审批意见 */
|
||||
private String approveRemark;
|
||||
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -21,135 +20,135 @@ public class ScBreedRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// ===================== 基础主键/关联ID字段 =====================
|
||||
// 基础关联ID
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 羊只id */
|
||||
@Excel(name = "羊只id")
|
||||
private Long sheepId;
|
||||
|
||||
/** 配种公羊id */
|
||||
@Excel(name = "配种公羊id")
|
||||
private String ramId;
|
||||
|
||||
/** 配种母羊id */
|
||||
@Excel(name = "配种母羊id")
|
||||
private String eweId;
|
||||
|
||||
// --- 导出及表单顺序 ---
|
||||
@Excel(name = "耳号")
|
||||
private String eweManageTags; // 母羊耳号
|
||||
|
||||
@Excel(name = "品种")
|
||||
private String eweVariety;
|
||||
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType = "配种";
|
||||
|
||||
// 核心注解:指定JSON解析/序列化的日期格式,时区指定为东八区(Asia/Shanghai)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
|
||||
@Excel(name = "配种日期", dateFormat = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
@Excel(name = "配种公羊")
|
||||
private String ramManageTags;
|
||||
|
||||
@Excel(name = "配种公羊品种")
|
||||
private String ramVariety;
|
||||
|
||||
@Excel(name = "供体母羊")
|
||||
private String donorEweNo;
|
||||
|
||||
@Excel(name = "供体母羊品种")
|
||||
private String donorEweVariety;
|
||||
|
||||
@Excel(name = "供体公羊")
|
||||
private String donorRamNo;
|
||||
|
||||
@Excel(name = "供体公羊品种")
|
||||
private String donorRamVariety;
|
||||
|
||||
@Excel(name = "移胚数")
|
||||
private Integer embryoCount;
|
||||
|
||||
/** 1-同期发情, 2-本交, 3-自然发情, 4-胚胎移植 */
|
||||
@Excel(name = "配种方式", readConverterExp = "1=供体母羊配种,2=同期发情人工授精,3=本交,4=胚胎移植,5=自然发情人工授精")
|
||||
private Integer breedType;
|
||||
|
||||
@Excel(name = "配种子类型")
|
||||
private String embryoSubType; // 体内/体外 + 冻胚/鲜胚
|
||||
|
||||
@Excel(name = "月龄")
|
||||
private Integer eweMonthAge;
|
||||
|
||||
@Excel(name = "配种时羊只类别")
|
||||
private String sheepType;
|
||||
|
||||
@Excel(name = "胎次")
|
||||
private Integer eweParity;
|
||||
|
||||
@Excel(name = "孕检记录id")
|
||||
private Integer pregnancyRecordId;
|
||||
|
||||
@Excel(name = "配次")
|
||||
private Integer matingCount;
|
||||
|
||||
@Excel(name = "发情后配种时间")
|
||||
private Long timeSincePlanning;
|
||||
|
||||
@Excel(name = "当前羊舍")
|
||||
private String eweSheepfoldName;
|
||||
|
||||
/** 技术员 */
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
@Excel(name = "繁殖用药")
|
||||
/** 繁殖用药/耗精量 */
|
||||
@Excel(name = "耗精量")
|
||||
private String breedDrugs;
|
||||
|
||||
@Excel(name = "羊只备注")
|
||||
private String eweComment;
|
||||
/** 配种方式 1-同期发情 2-本交 */
|
||||
@Excel(name = "配种方式", readConverterExp = "1=同期发情,2=本交")
|
||||
private Integer breedType;
|
||||
|
||||
// ============ 显示字段 ============
|
||||
|
||||
/** 母羊耳号 */
|
||||
@Excel(name = "耳号")
|
||||
private String eweManageTags;
|
||||
|
||||
/** 母羊品种 */
|
||||
@Excel(name = "品种")
|
||||
private String eweVariety;
|
||||
|
||||
/** 公羊耳号 */
|
||||
@Excel(name = "配种公羊")
|
||||
private String ramManageTags;
|
||||
|
||||
/** 公羊品种 */
|
||||
@Excel(name = "配种公羊品种")
|
||||
private String ramVariety;
|
||||
|
||||
/** 胎次 */
|
||||
@Excel(name = "胎次")
|
||||
private Integer eweParity;
|
||||
|
||||
/** 月龄 */
|
||||
@Excel(name = "月龄")
|
||||
private Integer eweMonthAge;
|
||||
|
||||
/** 羊舍名称 */
|
||||
@Excel(name = "当前羊舍")
|
||||
private String eweSheepfoldName;
|
||||
|
||||
/** 繁育状态 */
|
||||
@Excel(name = "繁育状态")
|
||||
private String eweBreedStatus;
|
||||
|
||||
@Excel(name = "孕检日期")
|
||||
private Date pregnancyCheckDate;
|
||||
|
||||
@Excel(name = "孕检结果")
|
||||
private String pregnancyResult;
|
||||
|
||||
@Excel(name = "配种到孕检间隔(天)")
|
||||
private Integer daysToPregnancyCheck;
|
||||
|
||||
|
||||
@Excel(name = "预产日期")
|
||||
private Date expectedDate;
|
||||
|
||||
@Excel(name = "实产日期")
|
||||
private Date actualLambingDate;
|
||||
|
||||
@Excel(name = "配种时产后天数")
|
||||
private Long daysPostLambing; // 距离上一次产羔
|
||||
|
||||
@Excel(name = "配种时泌乳天数")
|
||||
private Long daysLactation; // 距离上一次孕检且怀孕
|
||||
|
||||
@Excel(name = "配种时配后天数")
|
||||
private Long daysPostMating; // 距离上一次配种
|
||||
|
||||
@Excel(name = "上次配种日期")
|
||||
private Date lastMatingDate;
|
||||
|
||||
@Excel(name = "冻精号")
|
||||
private String frozenSemenNo; // 新增字段:自行输入
|
||||
|
||||
/** 是否性控 */
|
||||
@Excel(name = "是否性控", readConverterExp = "0=否,1=是")
|
||||
private Integer eweControlled;
|
||||
|
||||
@Excel(name = "耗精量")
|
||||
private String spermConsumption;
|
||||
|
||||
@Excel(name = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@Excel(name = "创建日期")
|
||||
private Date createDate;
|
||||
/** 羊只备注 */
|
||||
@Excel(name = "羊只备注")
|
||||
private String eweComment;
|
||||
|
||||
/** 牧场名称 */
|
||||
@Excel(name = "所在牧场")
|
||||
private String ranchName;
|
||||
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
/** 配种方式显示 */
|
||||
@Excel(name = "配种方式")
|
||||
private String matingType;
|
||||
|
||||
/** 羊只类别 */
|
||||
@Excel(name = "配种时羊只类别")
|
||||
private String sheepType;
|
||||
|
||||
/** 配次 */
|
||||
@Excel(name = "配次")
|
||||
private Integer matingCount;
|
||||
|
||||
/** 发情后配种时间 */
|
||||
@Excel(name = "发情后配种时间(小时)")
|
||||
private Long timeSincePlanning;
|
||||
|
||||
/** 牧场ID */
|
||||
private Long ranchId;
|
||||
|
||||
/** 配种计划ID */
|
||||
private Long planId;
|
||||
|
||||
// ============ 新增孕检相关字段 ============
|
||||
|
||||
/** 孕检日期 */
|
||||
@Excel(name = "孕检日期")
|
||||
private Date pregnancyCheckDate;
|
||||
|
||||
/** 孕检结果 */
|
||||
@Excel(name = "孕检结果")
|
||||
private String pregnancyResult;
|
||||
|
||||
/** 孕检方式 */
|
||||
@Excel(name = "孕检方式")
|
||||
private String pregnancyWay;
|
||||
|
||||
/** 胎数 */
|
||||
@Excel(name = "胎数")
|
||||
private Integer fetusCount;
|
||||
|
||||
/** 孕检技术员 */
|
||||
@Excel(name = "孕检技术员")
|
||||
private String pregnancyTechnician;
|
||||
|
||||
/** 孕检备注 */
|
||||
@Excel(name = "孕检备注")
|
||||
private String pregnancyRemark;
|
||||
|
||||
/** 孕检记录ID */
|
||||
private Long pregnancyRecordId;
|
||||
|
||||
/** 配种到孕检间隔天数 */
|
||||
@Excel(name = "配种到孕检间隔(天)")
|
||||
private Integer daysToPregnancyCheck;
|
||||
|
||||
/** 是否已孕检 */
|
||||
@Excel(name = "是否已孕检", readConverterExp = "0=否,1=是")
|
||||
private Integer isPregnancyChecked;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class ScLambDetail extends BaseEntity
|
||||
|
||||
/** 是否留养:0-否,1-是 */
|
||||
@Excel(name = "是否留养")
|
||||
private Boolean isRetained;
|
||||
private Integer isRetained;
|
||||
|
||||
/** 家系 */
|
||||
@Excel(name = "家系")
|
||||
|
||||
@@ -123,21 +123,6 @@ public class ScPregnancyRecord extends BaseEntity
|
||||
private Integer daysAfterMating;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
// 1. 新增字段
|
||||
@Excel(name = "孕检原因")
|
||||
private String reason; // 初检/复检
|
||||
|
||||
// 2. 胚胎移植相关字段 (用于前端显示)
|
||||
@Excel(name = "供体母羊")
|
||||
private String donorEwe;
|
||||
@Excel(name = "供体母羊品种")
|
||||
private String donorEweVariety;
|
||||
@Excel(name = "供体公羊")
|
||||
private String donorRam;
|
||||
@Excel(name = "供体公羊品种")
|
||||
private String donorRamVariety;
|
||||
@Excel(name = "移胚数")
|
||||
private Integer embryoCount;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
|
||||
@@ -128,12 +128,4 @@ public interface ScBreedPlanGenerateMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTempBreedPlanByPlanId(Long planGenerateId);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -145,12 +145,4 @@ public interface ScBreedRecordMapper
|
||||
* @return 配种母羊数
|
||||
*/
|
||||
Long countMatedEwesByRamId(String ramManageTags);
|
||||
|
||||
/**
|
||||
* 根据受体(母羊)耳号查询最新的冲胚记录信息
|
||||
* 用于胚胎移植时自动填充供体和移胚数
|
||||
* @param manageTags 受体母羊耳号
|
||||
* @return 冲胚记录Map
|
||||
*/
|
||||
public Map<String, Object> getFlushRecordByEweNo(@Param("manageTags") String manageTags);
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 配种计划生成Service接口
|
||||
@@ -35,14 +34,14 @@ public interface IScBreedPlanGenerateService
|
||||
*
|
||||
* @return 符合条件的母羊列表
|
||||
*/
|
||||
public List<Map<String, Object>> selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags);
|
||||
public List<Map<String, Object>> selectEligibleEwe();
|
||||
|
||||
/**
|
||||
* 筛选符合条件的公羊
|
||||
*
|
||||
* @return 符合条件的公羊列表
|
||||
*/
|
||||
public List<Map<String, Object>> selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags);
|
||||
public List<Map<String, Object>> selectEligibleRam();
|
||||
|
||||
/**
|
||||
* 自动生成配种计划
|
||||
@@ -121,12 +120,4 @@ public interface IScBreedPlanGenerateService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScBreedPlanGenerateById(Long id);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
@@ -119,6 +119,4 @@ public interface IScBreedRecordService
|
||||
* @return 配种记录集合
|
||||
*/
|
||||
public List<ScBreedRecord> getBreedRecordsByTimeRange(Long sheepId, String startDate, String endDate);
|
||||
|
||||
ScBreedRecord getAutomaticBreedMatch(String manageTags);
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import org.springframework.util.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 配种计划生成Service业务层处理
|
||||
@@ -68,7 +67,7 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
* @return 符合条件的母羊列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags)
|
||||
public List<Map<String, Object>> selectEligibleEwe()
|
||||
{
|
||||
return scBreedPlanGenerateMapper.selectEligibleEwe();
|
||||
}
|
||||
@@ -79,7 +78,7 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
* @return 符合条件的公羊列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags)
|
||||
public List<Map<String, Object>> selectEligibleRam()
|
||||
{
|
||||
return scBreedPlanGenerateMapper.selectEligibleRam();
|
||||
}
|
||||
@@ -103,16 +102,7 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
// 自动生成计划名称:日期+计划类型
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String dateStr = sdf.format(new Date());
|
||||
String planTypeName = "";
|
||||
|
||||
switch (planType) {
|
||||
case 1: planTypeName = "供体母羊配种计划"; break;
|
||||
case 2: planTypeName = "同期发情人工授精计划"; break;
|
||||
case 3: planTypeName = "本交配种计划"; break;
|
||||
case 4: planTypeName = "自然发情人工授精计划"; break;
|
||||
default: planTypeName = "未知配种计划"; break;
|
||||
}
|
||||
|
||||
String planTypeName = (planType == 1) ? "同期发情配种计划" : "本交配种计划";
|
||||
planName = dateStr + planTypeName;
|
||||
|
||||
planGenerate.setPlanName(planName);
|
||||
@@ -147,15 +137,21 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
|
||||
for (int i = 0; i < eweIds.size(); i++) {
|
||||
ScBreedPlan breedPlan = new ScBreedPlan();
|
||||
// 存储公羊ID而不是字符串
|
||||
breedPlan.setRamId(ramIds.get(ramIndex).toString());
|
||||
breedPlan.setEweId(eweIds.get(i).toString());
|
||||
|
||||
// 2. 修改:直接使用 planType 作为 breedType (假设一一对应)
|
||||
// 1=供体母羊配种, 2=同期发情人工授精, 3=本交, 4=自然发情人工授精
|
||||
breedPlan.setBreedType(Long.valueOf(planType));
|
||||
// 根据计划类型设置配种类型:同期发情配种计划->同期发情,本交配种计划->本交
|
||||
if (planType == 1) {
|
||||
breedPlan.setBreedType(1L); // 同期发情
|
||||
} else {
|
||||
breedPlan.setBreedType(2L); // 本交
|
||||
}
|
||||
|
||||
// 插入临时配种计划,关联到生成记录
|
||||
scBreedPlanGenerateMapper.insertTempBreedPlan(planGenerateId, breedPlan);
|
||||
|
||||
// 每个公羊配种指定数量的母羊后,切换到下一个公羊
|
||||
if ((i + 1) % ewesPerRam == 0 && ramIndex < ramIds.size() - 1) {
|
||||
ramIndex++;
|
||||
}
|
||||
@@ -360,32 +356,10 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
// 空行
|
||||
rowNum++;
|
||||
|
||||
String typeName = "";
|
||||
switch (planGenerate.getPlanType()) {
|
||||
case 1: typeName = "供体母羊配种计划"; break;
|
||||
case 2: typeName = "同期发情人工授精计划"; break;
|
||||
case 3: typeName = "本交配种计划"; break;
|
||||
case 4: typeName = "自然发情人工授精计划"; break;
|
||||
default: typeName = "未知"; break;
|
||||
}
|
||||
|
||||
// 基本信息
|
||||
Row infoRow1 = sheet.createRow(rowNum++);
|
||||
infoRow1.createCell(0).setCellValue("计划类型:");
|
||||
String planTypeNameStr;
|
||||
Integer type = planGenerate.getPlanType();
|
||||
if (type != null) {
|
||||
switch (type) {
|
||||
case 1: planTypeNameStr = "供体母羊配种计划"; break;
|
||||
case 2: planTypeNameStr = "同期发情人工授精计划"; break;
|
||||
case 3: planTypeNameStr = "本交配种计划"; break;
|
||||
case 4: planTypeNameStr = "自然发情人工授精计划"; break;
|
||||
default: planTypeNameStr = "未知类型";
|
||||
}
|
||||
} else {
|
||||
planTypeNameStr = "";
|
||||
}
|
||||
infoRow1.createCell(1).setCellValue(planTypeNameStr);
|
||||
infoRow1.createCell(1).setCellValue(planGenerate.getPlanType() == 1 ? "同期发情配种计划" : "本交配种计划");
|
||||
infoRow1.createCell(3).setCellValue("计划日期:");
|
||||
infoRow1.createCell(4).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(planGenerate.getPlanDate()));
|
||||
|
||||
@@ -473,23 +447,14 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
dataRow.createCell(colNum++).setCellValue(getStringValue(detail, "ram_current_weight"));
|
||||
|
||||
// 配种类型
|
||||
Object breedTypeObj = detail.get("breed_type");
|
||||
Object breedType = detail.get("breed_type");
|
||||
String breedTypeName = "未知类型";
|
||||
if (breedTypeObj != null) {
|
||||
try {
|
||||
int typeValue = Integer.parseInt(breedTypeObj.toString());
|
||||
switch (typeValue) {
|
||||
case 1: breedTypeName = "供体母羊配种"; break;
|
||||
case 2: breedTypeName = "同期发情人工授精"; break;
|
||||
case 3: breedTypeName = "本交"; break;
|
||||
case 4: breedTypeName = "自然发情人工授精"; break;
|
||||
default: breedTypeName = "未知类型";
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// ignore
|
||||
}
|
||||
if (breedType != null) {
|
||||
int typeValue = Integer.parseInt(breedType.toString());
|
||||
breedTypeName = typeValue == 1 ? "同期发情" : (typeValue == 2 ? "本交" : "未知类型");
|
||||
}
|
||||
dataRow.createCell(colNum++).setCellValue(breedTypeName);
|
||||
dataRow.createCell(colNum++).setCellValue(breedTypeName);
|
||||
|
||||
// 应用数据样式
|
||||
for (int j = 0; j < headers.length; j++) {
|
||||
if (dataRow.getCell(j) != null) {
|
||||
@@ -572,8 +537,4 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
|
||||
scBreedPlanGenerateMapper.deleteTempBreedPlanByPlanId(id);
|
||||
return scBreedPlanGenerateMapper.deleteScBreedPlanGenerateById(id);
|
||||
}
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scBreedPlanGenerateMapper.searchEarNumbers(query);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zhyc.module.produce.breed.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
@@ -45,47 +44,31 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
|
||||
* @param scBreedRecord 配种记录
|
||||
* @return 配种记录
|
||||
*/
|
||||
// @Override
|
||||
// public List<ScBreedRecord> selectScBreedRecordList(ScBreedRecord scBreedRecord)
|
||||
// {
|
||||
// // 如果查询条件中有耳号,需要先转换为ID
|
||||
// if (StringUtils.isNotEmpty(scBreedRecord.getEweManageTags()))
|
||||
// {
|
||||
// Long eweId = scBreedRecordMapper.getSheepIdByManageTags(scBreedRecord.getEweManageTags());
|
||||
// if (eweId != null)
|
||||
// {
|
||||
// scBreedRecord.setEweId(eweId.toString());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (StringUtils.isNotEmpty(scBreedRecord.getRamManageTags()))
|
||||
// {
|
||||
// Long ramId = scBreedRecordMapper.getRamIdByManageTags(scBreedRecord.getRamManageTags());
|
||||
// if (ramId != null)
|
||||
// {
|
||||
// scBreedRecord.setRamId(ramId.toString());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return scBreedRecordMapper.selectScBreedRecordList(scBreedRecord);
|
||||
// }
|
||||
@Override
|
||||
public List<ScBreedRecord> selectScBreedRecordList(ScBreedRecord scBreedRecord) {
|
||||
// ... (耳号转ID逻辑保持不变) ...
|
||||
// 如果查询条件中有耳号,需要先转换为ID (注意:供体母羊/公羊是直接存字符串的,不需要转ID,只有作为受体的eweId需要转)
|
||||
public List<ScBreedRecord> selectScBreedRecordList(ScBreedRecord scBreedRecord)
|
||||
{
|
||||
// 如果查询条件中有耳号,需要先转换为ID
|
||||
if (StringUtils.isNotEmpty(scBreedRecord.getEweManageTags()))
|
||||
{
|
||||
Long eweId = scBreedRecordMapper.getSheepIdByManageTags(scBreedRecord.getEweManageTags());
|
||||
if (eweId != null)
|
||||
{
|
||||
// 注意:这里仅设置eweId用于查询作为受体的记录
|
||||
// 如果用户想搜"供体母羊"是xxx,Mapper XML中的 OR 逻辑会处理
|
||||
scBreedRecord.setEweId(eweId.toString());
|
||||
}
|
||||
}
|
||||
// ...
|
||||
|
||||
if (StringUtils.isNotEmpty(scBreedRecord.getRamManageTags()))
|
||||
{
|
||||
Long ramId = scBreedRecordMapper.getRamIdByManageTags(scBreedRecord.getRamManageTags());
|
||||
if (ramId != null)
|
||||
{
|
||||
scBreedRecord.setRamId(ramId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return scBreedRecordMapper.selectScBreedRecordList(scBreedRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增配种记录
|
||||
*
|
||||
@@ -189,59 +172,34 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
|
||||
* @param manageTags 母羊管理耳号
|
||||
* @return 配种计划信息
|
||||
*/
|
||||
// @Override
|
||||
// public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags)
|
||||
// {
|
||||
// try {
|
||||
// // 优先从配种计划生成表获取最新计划
|
||||
// Map<String, Object> latestPlan = scBreedRecordMapper.getLatestBreedPlanByEweTags(manageTags);
|
||||
//
|
||||
// if (latestPlan != null && !latestPlan.isEmpty()) {
|
||||
// log.info("从配种计划生成表获取到配种计划: {}", latestPlan);
|
||||
// return latestPlan;
|
||||
// }
|
||||
//
|
||||
// // 如果生成表中没有,则从普通配种计划表获取
|
||||
// Map<String, Object> normalPlan = scBreedRecordMapper.getBreedPlanByEweTags(manageTags);
|
||||
// if (normalPlan != null && !normalPlan.isEmpty()) {
|
||||
// log.info("从配种计划表获取到配种计划: {}", normalPlan);
|
||||
// return normalPlan;
|
||||
// }
|
||||
//
|
||||
// log.warn("未找到母羊耳号 {} 的配种计划信息", manageTags);
|
||||
// return null;
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取配种计划信息时发生异常,母羊耳号: {}", manageTags, e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 简化后的获取配种计划方法:移除冲胚记录自动关联
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags) {
|
||||
public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags)
|
||||
{
|
||||
try {
|
||||
// 1. 仅从配种计划生成表获取(本交、人工授精等普通计划)
|
||||
// 优先从配种计划生成表获取最新计划
|
||||
Map<String, Object> latestPlan = scBreedRecordMapper.getLatestBreedPlanByEweTags(manageTags);
|
||||
|
||||
if (latestPlan != null && !latestPlan.isEmpty()) {
|
||||
log.info("从配种计划生成表获取到配种计划: {}", latestPlan);
|
||||
return latestPlan;
|
||||
}
|
||||
|
||||
// 2. 从普通配种计划表获取
|
||||
// 如果生成表中没有,则从普通配种计划表获取
|
||||
Map<String, Object> normalPlan = scBreedRecordMapper.getBreedPlanByEweTags(manageTags);
|
||||
if (normalPlan != null && !normalPlan.isEmpty()) {
|
||||
log.info("从配种计划表获取到配种计划: {}", normalPlan);
|
||||
return normalPlan;
|
||||
}
|
||||
|
||||
// 胚胎移植逻辑已移至前端手动输入,此处不再查询 sc_embryo_flush
|
||||
log.info("未找到母羊 {} 的普通配种计划", manageTags);
|
||||
log.warn("未找到母羊耳号 {} 的配种计划信息", manageTags);
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("获取配种计划异常", e);
|
||||
log.error("获取配种计划信息时发生异常,母羊耳号: {}", manageTags, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步孕检结果到配种记录
|
||||
*
|
||||
@@ -290,57 +248,45 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
|
||||
|
||||
/**
|
||||
* 新增配种记录
|
||||
*
|
||||
* @param scBreedRecord 配种记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScBreedRecord(ScBreedRecord scBreedRecord)
|
||||
{
|
||||
// 设置创建时间
|
||||
scBreedRecord.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
// 如果是胚胎移植(5),且前端没有传移胚数等信息,可以在这里做一次兜底查询
|
||||
// 但通常前端 form 表单提交时应该已经通过 getLatestBreedPlanByEweTags 填好了
|
||||
|
||||
// 插入记录
|
||||
// 插入配种记录
|
||||
int result = scBreedRecordMapper.insertScBreedRecord(scBreedRecord);
|
||||
|
||||
// 同步更新羊只的基础信息(配种次数、配种日期)
|
||||
// 如果插入成功,同步更新羊只的配种日期
|
||||
if (result > 0 && scBreedRecord.getEweId() != null) {
|
||||
try {
|
||||
Long eweId = Long.parseLong(scBreedRecord.getEweId());
|
||||
scBreedRecordMapper.incrementSheepMatingCount(
|
||||
eweId,
|
||||
scBreedRecord.getCreateTime(),
|
||||
scBreedRecord.getCreateBy()
|
||||
);
|
||||
|
||||
// // 方案1:只更新配种日期(推荐)
|
||||
// scBreedRecordMapper.updateSheepMatingDate(
|
||||
// eweId,
|
||||
// scBreedRecord.getCreateTime(),
|
||||
// scBreedRecord.getCreateBy()
|
||||
// );
|
||||
|
||||
// 方案2:同时更新配种日期和配种次数(如果需要的话,取消下面注释)
|
||||
scBreedRecordMapper.incrementSheepMatingCount(
|
||||
eweId,
|
||||
scBreedRecord.getCreateTime(),
|
||||
scBreedRecord.getCreateBy()
|
||||
);
|
||||
|
||||
log.info("同步更新羊只 {} 的配种日期成功", eweId);
|
||||
} catch (Exception e) {
|
||||
log.error("同步更新羊只配种日期失败", e);
|
||||
// 不影响主流程,只记录日志
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public ScBreedRecord getAutomaticBreedMatch(String manageTags) {
|
||||
// 1. 尝试从配种计划获取 (breed_type: 1, 2, 3, 4)
|
||||
Map<String, Object> plan = scBreedRecordMapper.getLatestBreedPlanByEweTags(manageTags);
|
||||
if (plan != null) {
|
||||
ScBreedRecord record = new ScBreedRecord();
|
||||
record.setBreedType(Integer.parseInt(plan.get("breed_type").toString()));
|
||||
record.setRamManageTags((String) plan.get("ram_manage_tags"));
|
||||
return record;
|
||||
}
|
||||
|
||||
// 2. 尝试从冲胚记录获取
|
||||
Map<String, Object> flushRecord = scBreedRecordMapper.getFlushRecordByEweNo(manageTags);
|
||||
if (flushRecord != null) {
|
||||
ScBreedRecord record = new ScBreedRecord();
|
||||
record.setBreedType(5); // 设定 5 为胚胎移植(您可根据实际调整枚举)
|
||||
record.setEmbryoCount(Integer.parseInt(flushRecord.get("transferred").toString()));
|
||||
record.setDonorEweNo((String) flushRecord.get("donor_female_no"));
|
||||
record.setDonorRamNo((String) flushRecord.get("donor_male_no"));
|
||||
// 根据冲胚记录的存储方式和类型拼接“配种子类型”
|
||||
record.setEmbryoSubType(flushRecord.get("embryo_type") + " " + flushRecord.get("storage_method"));
|
||||
return record;
|
||||
}
|
||||
|
||||
return null; // 均未找到
|
||||
}
|
||||
}
|
||||
@@ -45,10 +45,10 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
VARIETY_NAME_MAP.put(4, "级杂一代");
|
||||
VARIETY_NAME_MAP.put(5, "级杂二代");
|
||||
VARIETY_NAME_MAP.put(6, "级杂三代");
|
||||
VARIETY_NAME_MAP.put(7, "一世代");
|
||||
VARIETY_NAME_MAP.put(8, "二世代");
|
||||
VARIETY_NAME_MAP.put(9, "三世代");
|
||||
VARIETY_NAME_MAP.put(10, "四世代");
|
||||
VARIETY_NAME_MAP.put(7, "1世代");
|
||||
VARIETY_NAME_MAP.put(8, "2世代");
|
||||
VARIETY_NAME_MAP.put(9, "3世代");
|
||||
VARIETY_NAME_MAP.put(10, "4世代");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,24 +142,23 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
// 2. 查询配种记录获取公羊信息
|
||||
Map<String, Object> breedRecord = scEmbryoFlushMapper.selectBreedRecordByEwe(donorFemaleNo);
|
||||
if (breedRecord != null && !breedRecord.isEmpty()) {
|
||||
String maleNo = (String) breedRecord.get("donorMaleNo"); // 这里的 Key 必须对应 SQL 里的别名
|
||||
result.put("donorMaleNo", maleNo);
|
||||
String ramId = (String) breedRecord.get("ramId");
|
||||
result.put("donorMaleNo", ramId);
|
||||
result.put("matingDate", breedRecord.get("matingDate"));
|
||||
|
||||
// 3. 查询公羊品种
|
||||
if (maleNo != null && !maleNo.trim().isEmpty()) {
|
||||
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(maleNo);
|
||||
if (ramId != null && !ramId.trim().isEmpty()) {
|
||||
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
|
||||
if (maleInfo != null && !maleInfo.isEmpty()) {
|
||||
String maleVariety = (String) maleInfo.get("variety");
|
||||
Integer maleVarietyId = getIntValue(maleInfo.get("varietyId"));
|
||||
|
||||
result.put("donorMaleVariety", maleVariety);
|
||||
result.put("donorMaleVarietyId", maleVarietyId);
|
||||
|
||||
// 4. 【关键修复】使用品种名称计算胚胎品种
|
||||
// 这样可以确保无论数据库ID是多少,只要名字是对的就能算出结果
|
||||
Integer mId = getVarietyIdByName(maleVariety);
|
||||
Integer fId = getVarietyIdByName(femaleVariety);
|
||||
|
||||
if (mId != null && fId != null) {
|
||||
String embryoVariety = calculateEmbryoVarietyById(mId, fId);
|
||||
// 4. 根据品种ID计算胚胎品种
|
||||
if (maleVarietyId != null && femaleVarietyId != null) {
|
||||
String embryoVariety = calculateEmbryoVarietyById(maleVarietyId, femaleVarietyId);
|
||||
result.put("embryoVariety", embryoVariety);
|
||||
}
|
||||
}
|
||||
@@ -169,7 +168,6 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 安全获取Integer值
|
||||
*/
|
||||
@@ -294,22 +292,23 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
// 级杂二代(BM)或n世代(SM) × 级杂一代/级杂二代/级杂三代/回交(公) → 世代
|
||||
|
||||
// 判断公羊是否为可产生世代的品种(级杂一代/二代/三代/回交)
|
||||
boolean isMaleCapableOfGeneration = (male >= 3 && male <= 10);
|
||||
boolean isMaleForShidai = (male == VARIETY_JIZA_1 || male == VARIETY_JIZA_2 ||
|
||||
male == VARIETY_JIZA_3 || male == VARIETY_HUIJIAO);
|
||||
|
||||
if (isMaleCapableOfGeneration) {
|
||||
// 级杂二代(母) x 任意合格公羊 -> 一世代
|
||||
if (isMaleForShidai) {
|
||||
// 级杂二代(母) × 以上公羊 → 1世代
|
||||
if (female == VARIETY_JIZA_2) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_1);
|
||||
}
|
||||
// 一世代(母) x 任意合格公羊 -> 二世代
|
||||
// 1世代(母) × 以上公羊 → 2世代
|
||||
if (female == VARIETY_SHIDAI_1) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_2);
|
||||
}
|
||||
// 二世代(母) x 任意合格公羊 -> 三世代
|
||||
// 2世代(母) × 以上公羊 → 3世代
|
||||
if (female == VARIETY_SHIDAI_2) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_3);
|
||||
}
|
||||
// 三世代(母) x 任意合格公羊 -> 四世代
|
||||
// 3世代(母) × 以上公羊 → 4世代
|
||||
if (female == VARIETY_SHIDAI_3) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_4);
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
||||
|
||||
// 设置默认值
|
||||
if (lambDetail.getIsRetained() == null) {
|
||||
lambDetail.setIsRetained(false); // 默认为0(否)
|
||||
lambDetail.setIsRetained(0); // 默认为0(否)
|
||||
}
|
||||
|
||||
// 验证是否留养值的有效性:0-否,1-是
|
||||
if (lambDetail.getIsRetained() != false && lambDetail.getIsRetained() != true) {
|
||||
if (lambDetail.getIsRetained() != 0 && lambDetail.getIsRetained() != 1) {
|
||||
throw new RuntimeException("是否留养值无效,请使用0(否)或1(是)");
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,9 @@ public class ScTransitionInfoController extends BaseController {
|
||||
|
||||
@PutMapping("/approve")
|
||||
public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) {
|
||||
if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) {
|
||||
return AjaxResult.error("转场转入时,接收羊舍ID不能为空");
|
||||
}
|
||||
int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo);
|
||||
return toAjax(rows);
|
||||
}
|
||||
@@ -111,6 +114,4 @@ public class ScTransitionInfoController extends BaseController {
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query){
|
||||
return success(scTransitionInfoService.searchEarNumbers(query.trim()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -31,23 +31,20 @@ public class ScChangeComment extends BaseEntity {
|
||||
* 羊只id
|
||||
*/
|
||||
private String sheepId;
|
||||
|
||||
@Excel(name = "管理耳号")
|
||||
private String manageTags;
|
||||
|
||||
/** 羊舍 */
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 新备注
|
||||
*/
|
||||
@@ -61,25 +58,17 @@ public class ScChangeComment extends BaseEntity {
|
||||
private String oldComment;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
* 事件日期
|
||||
*/
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 前端多耳号条件,非数据库字段
|
||||
*/
|
||||
/** 前端多耳号条件,非数据库字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,11 @@ public class ScChangeEar extends BaseEntity {
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 品种
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 事件类型(改管理耳号/改电子耳号)
|
||||
@@ -47,13 +48,6 @@ public class ScChangeEar extends BaseEntity {
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 选择更改耳号类型(0电子耳号1管理耳号)
|
||||
*/
|
||||
@@ -73,11 +67,17 @@ public class ScChangeEar extends BaseEntity {
|
||||
private String oldTag;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
* 备注
|
||||
*/
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
@@ -85,20 +85,7 @@ public class ScChangeEar extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
|
||||
/**
|
||||
* 在群状态 0-全部 1-在群 2-不在群(列表查询用)
|
||||
*/
|
||||
private Integer inGroup;
|
||||
}
|
||||
|
||||
@@ -31,35 +31,9 @@ public class ScChangeVariety extends BaseEntity {
|
||||
* 羊只id
|
||||
*/
|
||||
private Integer sheepId;
|
||||
|
||||
@Excel(name = "耳号")
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 新品种
|
||||
*/
|
||||
@Excel(name = "新品种")
|
||||
private String varietyNew;
|
||||
|
||||
/**
|
||||
* 旧品种
|
||||
*/
|
||||
@Excel(name = "旧品种")
|
||||
private String varietyOld;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
@@ -68,10 +42,22 @@ public class ScChangeVariety extends BaseEntity {
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 原品种
|
||||
*/
|
||||
@Excel(name = "原品种")
|
||||
private String varietyOld;
|
||||
|
||||
/**
|
||||
* 新品种
|
||||
*/
|
||||
@Excel(name = "新品种")
|
||||
private String varietyNew;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -80,12 +66,18 @@ public class ScChangeVariety extends BaseEntity {
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
* 技术员
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
* 事件日期
|
||||
*/
|
||||
private Integer isDelete;
|
||||
@Excel(name = "事件日期",width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,42 @@ public class ScTransGroup extends BaseEntity {
|
||||
@Excel(name = "耳号")
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群)
|
||||
*/
|
||||
private Integer eventType;
|
||||
@Excel(name = "事件类型")
|
||||
private String eventTypeText;
|
||||
|
||||
/**
|
||||
* 转入羊舍
|
||||
*/
|
||||
private String foldTo;
|
||||
|
||||
/**
|
||||
* 转出羊舍
|
||||
*/
|
||||
private String foldFrom;
|
||||
|
||||
/**
|
||||
* 羊只类型
|
||||
*/
|
||||
private Integer sheepTypeId;
|
||||
@Excel(name = "羊只类型")
|
||||
private String sheepTypeName;
|
||||
|
||||
/**
|
||||
* 转出羊舍名称
|
||||
*/
|
||||
@Excel(name = "转出羊舍")
|
||||
private String foldFromName;
|
||||
|
||||
/**
|
||||
* 转入羊舍名称
|
||||
*/
|
||||
@Excel(name = "转入羊舍")
|
||||
private String foldToName;
|
||||
|
||||
/**
|
||||
* 品种id
|
||||
*/
|
||||
@@ -44,72 +80,40 @@ public class ScTransGroup extends BaseEntity {
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
/**
|
||||
* 事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群)
|
||||
*/
|
||||
private String eventType;
|
||||
@Excel(name = "事件类型")
|
||||
private String eventTypeText;
|
||||
|
||||
/**
|
||||
* 转群日期
|
||||
*/
|
||||
@Excel(name = "转群日期")
|
||||
private String transDate;
|
||||
|
||||
/**
|
||||
* 转入羊舍
|
||||
*/
|
||||
private String foldTo;
|
||||
/**
|
||||
* 转入羊舍名称
|
||||
*/
|
||||
@Excel(name = "转入羊舍")
|
||||
private String foldToName;
|
||||
|
||||
/**
|
||||
* 转出羊舍
|
||||
*/
|
||||
private String foldFrom;
|
||||
/**
|
||||
* 转出羊舍名称
|
||||
*/
|
||||
@Excel(name = "转出羊舍")
|
||||
private String foldFromName;
|
||||
|
||||
private String reason;
|
||||
private Integer reason;
|
||||
/**
|
||||
* 转群原因描述 用于导出
|
||||
*/
|
||||
@Excel(name = "转群原因")
|
||||
private String reasonText;
|
||||
|
||||
/** 转群日期 */
|
||||
@Excel(name = "转群日期")
|
||||
private String transDate;
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 状态描述 用于导出
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String statusText;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 羊只类型
|
||||
*/
|
||||
private Integer sheepTypeId;
|
||||
|
||||
private String sheepTypeName;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群)
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,24 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
@Excel(name = "耳号")
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
|
||||
/**
|
||||
* 转场类型
|
||||
*/
|
||||
private Integer transType;
|
||||
@Excel(name = "转场类型")
|
||||
private String transTypeText;
|
||||
|
||||
/** 转场日期 */
|
||||
@Excel(name = "转场日期")
|
||||
private LocalDate transitionDate;
|
||||
|
||||
/**
|
||||
* 品种id
|
||||
*/
|
||||
@@ -44,23 +62,6 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/** 转场日期 */
|
||||
@Excel(name = "转场日期")
|
||||
private LocalDate transitionDate;
|
||||
|
||||
/**
|
||||
* 转场类型
|
||||
*/
|
||||
private Integer transType;
|
||||
@Excel(name = "转场类型")
|
||||
private String transTypeText;
|
||||
|
||||
/**
|
||||
* 转入牧场
|
||||
*/
|
||||
@@ -68,34 +69,21 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
private String transTo;
|
||||
|
||||
/**
|
||||
* 转出牧场
|
||||
* 当前牧场
|
||||
*/
|
||||
@Excel(name = "转出牧场")
|
||||
@Excel(name = "当前牧场")
|
||||
private String transFrom;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 接收羊舍
|
||||
*/
|
||||
private Long sheepfoldId;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@@ -103,21 +91,12 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
@Excel(name = "状态")
|
||||
private String statusText;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
private Integer isDelete;
|
||||
|
||||
/** 羊只类型ID(查询条件,非数据库字段) */
|
||||
private Long sheepTypeId;
|
||||
|
||||
/**
|
||||
* 当前场区ID(查询条件,关联bas_sheep.ranch_id),非数据库字段
|
||||
*/
|
||||
private Long currentRanchId;
|
||||
|
||||
/**
|
||||
* 当前场区名称(展示用),非数据库字段
|
||||
*/
|
||||
private String currentRanchName;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user