种公羊档案修改

This commit is contained in:
zyk 2025-12-25 19:02:27 +08:00
parent 454c5bcb73
commit 54f7df70ca
2 changed files with 105 additions and 21 deletions

View File

@ -1,3 +1,95 @@
//package com.zhyc.module.produce.breed.domain;
//
//import java.math.BigDecimal;
//import java.util.Date;
//import java.util.List;
//
//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;
//
///**
// * 羔羊详情对象 sc_lamb_detail
// *
// * @author ruoyi
// * @date 2025-07-11
// */
//@Data
//@NoArgsConstructor
//@AllArgsConstructor
//public class ScLambDetail extends BaseEntity
//{
// private static final long serialVersionUID = 1L;
//
// /** 主键ID */
// private Long id;
//
// /** 产羔记录ID */
// @Excel(name = "产羔记录ID")
// private Long lambingRecordId;
//
// /** 羔羊耳号 */
// @Excel(name = "羔羊耳号")
// private String lambEarNumber;
//
// /** 羔羊品种ID */
// @Excel(name = "羔羊品种ID")
// private Integer lambBreed; // 改为Integer类型存储品种ID
//
// /** 性别 */
// @Excel(name = "性别")
// private Integer gender;
//
// /** 出生重量 */
// @Excel(name = "出生重量")
// private BigDecimal birthWeight;
//
// /** 是否留养 */
// @Excel(name = "是否留养")
// private Boolean isRetained;
//
// /** 家系 */
// @Excel(name = "家系")
// private String lineage;
//
// /** 生日 */
// @JsonFormat(pattern = "yyyy-MM-dd")
// @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
// private Date birthday;
//
// private List<ScLambDetail> lambDetails;
//
// /** 母羊ID */
// private Long motherId;
//
// /** 父羊ID */
// private Long fatherId;
//
// /** 牧场ID */
// private Integer ranchId;
//
// /** 羊舍ID */
// private Integer sheepfoldId;
//
// /** 胎次 */
// private Integer parity;
//
// // getter和setter方法
// public void setId(Long id)
// {
// this.id = id;
// }
//
// public Long getId()
// {
// return id;
// }
//
//
//}
package com.zhyc.module.produce.breed.domain;
import java.math.BigDecimal;
@ -37,9 +129,9 @@ public class ScLambDetail extends BaseEntity
/** 羔羊品种ID */
@Excel(name = "羔羊品种ID")
private Integer lambBreed; // 改为Integer类型存储品种ID
private Integer lambBreed;
/** 性别 */
/** 性别1-母2-公3-阉羊4-兼性 */
@Excel(name = "性别")
private Integer gender;
@ -47,9 +139,9 @@ public class ScLambDetail extends BaseEntity
@Excel(name = "出生重量")
private BigDecimal birthWeight;
/** 是否留养 */
/** 是否留养0-否1-是 */
@Excel(name = "是否留养")
private Boolean isRetained;
private Integer isRetained;
/** 家系 */
@Excel(name = "家系")
@ -76,17 +168,4 @@ public class ScLambDetail extends BaseEntity
/** 胎次 */
private Integer parity;
// getter和setter方法
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
}

View File

@ -92,9 +92,9 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
throw new RuntimeException("羔羊性别不能为空");
}
// 验证性别值的有效性假设0=母羊1=公羊
if (lambDetail.getGender() < 0 || lambDetail.getGender() > 1) {
throw new RuntimeException("羔羊性别值无效,请使用0母羊或1公羊");
// 验证性别值的有效性1-2-3-阉羊4-兼性
if (lambDetail.getGender() < 1 || lambDetail.getGender() > 4) {
throw new RuntimeException("羔羊性别值无效,请使用1、2、3阉羊或4兼性");
}
// 检查耳号是否已存在
@ -105,7 +105,12 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
// 设置默认值
if (lambDetail.getIsRetained() == null) {
lambDetail.setIsRetained(false);
lambDetail.setIsRetained(0); // 默认为0
}
// 验证是否留养值的有效性0-1-
if (lambDetail.getIsRetained() != 0 && lambDetail.getIsRetained() != 1) {
throw new RuntimeException("是否留养值无效请使用0或1");
}
if (lambDetail.getBirthday() == null) {