diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java index d4bfeb6..7b72788 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java @@ -6,6 +6,7 @@ import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.enums.BusinessType; import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.service.IDaSheepfoldService; import org.springframework.beans.factory.annotation.Autowired; @@ -39,6 +40,17 @@ public class DaSheepfoldController extends BaseController List list = daSheepfoldService.selectDaSheepfoldList(daSheepfold); return getDataTable(list); } + /* + * 根据羊舍ids查询羊只id + * */ + + @GetMapping("/getSheepById") + public AjaxResult getSheepfold(@RequestParam String id) { + List list = daSheepfoldService.sheepListById(id); + return AjaxResult.success(list); + } + + /** * 导出羊舍管理列表 diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java index 7fd6fa5..8a2cf3a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java @@ -3,6 +3,7 @@ package com.zhyc.module.base.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -14,6 +15,7 @@ import java.util.Date; * @author wyt * @date 2025-07-13 */ +@Data public class SheepFile extends BaseEntity { private static final long serialVersionUID = 1L; @@ -263,673 +265,5 @@ public class SheepFile extends BaseEntity /** 是否删除 */ private Long isDelete; - public void setId(Long id) - { - this.id = id; - } - public Long getId() - { - return id; - } - - public void setBsManageTags(String bsManageTags) - { - this.bsManageTags = bsManageTags; - } - - public String getBsManageTags() - { - return bsManageTags; - } - - public void setRanchId(Long ranchId) - { - this.ranchId = ranchId; - } - - public Long getRanchId() - { - return ranchId; - } - - public void setDrRanch(String drRanch) - { - this.drRanch = drRanch; - } - - public String getDrRanch() - { - return drRanch; - } - - public void setSheepfoldId(Long sheepfoldId) - { - this.sheepfoldId = sheepfoldId; - } - - public Long getSheepfoldId() - { - return sheepfoldId; - } - - public void setSheepfoldName(String sheepfoldName) - { - this.sheepfoldName = sheepfoldName; - } - - public String getSheepfoldName() - { - return sheepfoldName; - } - - public void setElectronicTags(String electronicTags) - { - this.electronicTags = electronicTags; - } - - public String getElectronicTags() - { - return electronicTags; - } - - public void setVarietyId(Long varietyId) - { - this.varietyId = varietyId; - } - - public Long getVarietyId() - { - return varietyId; - } - - public void setVariety(String variety) - { - this.variety = variety; - } - - public String getVariety() - { - return variety; - } - - public void setFamily(String family) - { - this.family = family; - } - - public String getFamily() - { - return family; - } - - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - public void setGender(Long gender) - { - this.gender = gender; - } - - public Long getGender() - { - return gender; - } - - public void setBirthday(Date birthday) - { - this.birthday = birthday; - } - - public Date getBirthday() - { - return birthday; - } - - public void setDayAge(Long dayAge) - { - this.dayAge = dayAge; - } - - public Long getDayAge() - { - return dayAge; - } - - public void setMonthAge(Long monthAge) - { - this.monthAge = monthAge; - } - - public Long getMonthAge() - { - return monthAge; - } - - public void setParity(Long parity) - { - this.parity = parity; - } - - public Long getParity() - { - return parity; - } - - public void setBirthWeight(Long birthWeight) - { - this.birthWeight = birthWeight; - } - - public Long getBirthWeight() - { - return birthWeight; - } - - public void setWeaningDate(Date weaningDate) - { - this.weaningDate = weaningDate; - } - - public Date getWeaningDate() - { - return weaningDate; - } - - public void setStatusId(Long statusId) - { - this.statusId = statusId; - } - - public Long getStatusId() - { - return statusId; - } - - public void setWeaningWeight(Long weaningWeight) - { - this.weaningWeight = weaningWeight; - } - - public Long getWeaningWeight() - { - return weaningWeight; - } - - public void setCurrentWeight(Long currentWeight) - { - this.currentWeight = currentWeight; - } - - public Long getCurrentWeight() - { - return currentWeight; - } - - public void setBreedStatusId(Long breedStatusId) - { - this.breedStatusId = breedStatusId; - } - - public Long getBreedStatusId() - { - return breedStatusId; - } - - public void setBreed(String breed) - { - this.breed = breed; - } - - public String getBreed() - { - return breed; - } - - public void setBsFatherId(Long bsFatherId) - { - this.bsFatherId = bsFatherId; - } - - public Long getBsFatherId() - { - return bsFatherId; - } - - public void setFatherManageTags(String fatherManageTags) - { - this.fatherManageTags = fatherManageTags; - } - - public String getFatherManageTags() - { - return fatherManageTags; - } - - public void setBsMotherId(Long bsMotherId) - { - this.bsMotherId = bsMotherId; - } - - public Long getBsMotherId() - { - return bsMotherId; - } - - public void setMotherManageTags(String motherManageTags) - { - this.motherManageTags = motherManageTags; - } - - public String getMotherManageTags() - { - return motherManageTags; - } - - public void setReceptorId(Long receptorId) - { - this.receptorId = receptorId; - } - - public Long getReceptorId() - { - return receptorId; - } - - public void setReceptorManageTags(String receptorManageTags) - { - this.receptorManageTags = receptorManageTags; - } - - public String getReceptorManageTags() - { - return receptorManageTags; - } - - public void setFatherFatherId(Long fatherFatherId) - { - this.fatherFatherId = fatherFatherId; - } - - public Long getFatherFatherId() - { - return fatherFatherId; - } - - public void setGrandfatherManageTags(String grandfatherManageTags) - { - this.grandfatherManageTags = grandfatherManageTags; - } - - public String getGrandfatherManageTags() - { - return grandfatherManageTags; - } - - public void setFatherMotherId(Long fatherMotherId) - { - this.fatherMotherId = fatherMotherId; - } - - public Long getFatherMotherId() - { - return fatherMotherId; - } - - public void setGrandmotherManageTags(String grandmotherManageTags) - { - this.grandmotherManageTags = grandmotherManageTags; - } - - public String getGrandmotherManageTags() - { - return grandmotherManageTags; - } - - public void setFatherId(Long fatherId) - { - this.fatherId = fatherId; - } - - public Long getFatherId() - { - return fatherId; - } - - public void setMaternalGrandfatherManageTags(String maternalGrandfatherManageTags) - { - this.maternalGrandfatherManageTags = maternalGrandfatherManageTags; - } - - public String getMaternalGrandfatherManageTags() - { - return maternalGrandfatherManageTags; - } - - public void setMotherId(Long motherId) - { - this.motherId = motherId; - } - - public Long getMotherId() - { - return motherId; - } - - public void setMaternalGrandmotherManageTags(String maternalGrandmotherManageTags) - { - this.maternalGrandmotherManageTags = maternalGrandmotherManageTags; - } - - public String getMaternalGrandmotherManageTags() - { - return maternalGrandmotherManageTags; - } - - public void setMatingDate(Date matingDate) - { - this.matingDate = matingDate; - } - - public Date getMatingDate() - { - return matingDate; - } - - public void setMatingTypeId(Long matingTypeId) - { - this.matingTypeId = matingTypeId; - } - - public Long getMatingTypeId() - { - return matingTypeId; - } - - public void setPregDate(Date pregDate) - { - this.pregDate = pregDate; - } - - public Date getPregDate() - { - return pregDate; - } - - public void setLambingDate(Date lambingDate) - { - this.lambingDate = lambingDate; - } - - public Date getLambingDate() - { - return lambingDate; - } - - public void setLambingDay(Long lambingDay) - { - this.lambingDay = lambingDay; - } - - public Long getLambingDay() - { - return lambingDay; - } - - public void setMatingDay(Long matingDay) - { - this.matingDay = matingDay; - } - - public Long getMatingDay() - { - return matingDay; - } - - public void setGestationDay(Long gestationDay) - { - this.gestationDay = gestationDay; - } - - public Long getGestationDay() - { - return gestationDay; - } - - public void setExpectedDate(Date expectedDate) - { - this.expectedDate = expectedDate; - } - - public Date getExpectedDate() - { - return expectedDate; - } - - public void setPostLambingDay(Long postLambingDay) - { - this.postLambingDay = postLambingDay; - } - - public Long getPostLambingDay() - { - return postLambingDay; - } - - public void setLactationDay(Long lactationDay) - { - this.lactationDay = lactationDay; - } - - public Long getLactationDay() - { - return lactationDay; - } - - public void setAnestrousDay(Long anestrousDay) - { - this.anestrousDay = anestrousDay; - } - - public Long getAnestrousDay() - { - return anestrousDay; - } - - public void setMatingCounts(Long matingCounts) - { - this.matingCounts = matingCounts; - } - - public Long getMatingCounts() - { - return matingCounts; - } - - public void setMatingTotal(Long matingTotal) - { - this.matingTotal = matingTotal; - } - - public Long getMatingTotal() - { - return matingTotal; - } - - public void setMiscarriageCounts(Long miscarriageCounts) - { - this.miscarriageCounts = miscarriageCounts; - } - - public Long getMiscarriageCounts() - { - return miscarriageCounts; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getComment() - { - return comment; - } - - public void setControlled(Long controlled) - { - this.controlled = controlled; - } - - public Long getControlled() - { - return controlled; - } - - public void setBody(Long body) - { - this.body = body; - } - - public Long getBody() - { - return body; - } - - public void setBreast(Long breast) - { - this.breast = breast; - } - - public Long getBreast() - { - return breast; - } - - public void setSource(String source) - { - this.source = source; - } - - public String getSource() - { - return source; - } - - public void setSourceDate(Date sourceDate) - { - this.sourceDate = sourceDate; - } - - public Date getSourceDate() - { - return sourceDate; - } - - public void setSourceRanchId(Long sourceRanchId) - { - this.sourceRanchId = sourceRanchId; - } - - public Long getSourceRanchId() - { - return sourceRanchId; - } - - public void setSourceRanch(String sourceRanch) - { - this.sourceRanch = sourceRanch; - } - - public String getSourceRanch() - { - return sourceRanch; - } - - public void setIsDelete(Long isDelete) - { - this.isDelete = isDelete; - } - - public Long getIsDelete() - { - return isDelete; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("bsManageTags", getBsManageTags()) - .append("ranchId", getRanchId()) - .append("drRanch", getDrRanch()) - .append("sheepfoldId", getSheepfoldId()) - .append("sheepfoldName", getSheepfoldName()) - .append("electronicTags", getElectronicTags()) - .append("varietyId", getVarietyId()) - .append("variety", getVariety()) - .append("family", getFamily()) - .append("name", getName()) - .append("gender", getGender()) - .append("birthday", getBirthday()) - .append("dayAge", getDayAge()) - .append("monthAge", getMonthAge()) - .append("parity", getParity()) - .append("birthWeight", getBirthWeight()) - .append("weaningDate", getWeaningDate()) - .append("statusId", getStatusId()) - .append("weaningWeight", getWeaningWeight()) - .append("currentWeight", getCurrentWeight()) - .append("breedStatusId", getBreedStatusId()) - .append("breed", getBreed()) - .append("bsFatherId", getBsFatherId()) - .append("fatherManageTags", getFatherManageTags()) - .append("bsMotherId", getBsMotherId()) - .append("motherManageTags", getMotherManageTags()) - .append("receptorId", getReceptorId()) - .append("receptorManageTags", getReceptorManageTags()) - .append("fatherFatherId", getFatherFatherId()) - .append("grandfatherManageTags", getGrandfatherManageTags()) - .append("fatherMotherId", getFatherMotherId()) - .append("grandmotherManageTags", getGrandmotherManageTags()) - .append("fatherId", getFatherId()) - .append("maternalGrandfatherManageTags", getMaternalGrandfatherManageTags()) - .append("motherId", getMotherId()) - .append("maternalGrandmotherManageTags", getMaternalGrandmotherManageTags()) - .append("matingDate", getMatingDate()) - .append("matingTypeId", getMatingTypeId()) - .append("pregDate", getPregDate()) - .append("lambingDate", getLambingDate()) - .append("lambingDay", getLambingDay()) - .append("matingDay", getMatingDay()) - .append("gestationDay", getGestationDay()) - .append("expectedDate", getExpectedDate()) - .append("postLambingDay", getPostLambingDay()) - .append("lactationDay", getLactationDay()) - .append("anestrousDay", getAnestrousDay()) - .append("matingCounts", getMatingCounts()) - .append("matingTotal", getMatingTotal()) - .append("miscarriageCounts", getMiscarriageCounts()) - .append("comment", getComment()) - .append("controlled", getControlled()) - .append("body", getBody()) - .append("breast", getBreast()) - .append("source", getSource()) - .append("sourceDate", getSourceDate()) - .append("sourceRanchId", getSourceRanchId()) - .append("sourceRanch", getSourceRanch()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("isDelete", getIsDelete()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java index b565a9c..91febb6 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java @@ -67,4 +67,5 @@ public interface BasSheepMapper BasSheep selectBasSheepByManageTags(String manageTags); + List selectBasSheepBySheepfold(String id); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaSheepfoldService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaSheepfoldService.java index fa2486f..26bac8f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaSheepfoldService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaSheepfoldService.java @@ -1,5 +1,6 @@ package com.zhyc.module.base.service; +import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.DaSheepfold; import java.util.List; @@ -69,4 +70,7 @@ public interface IDaSheepfoldService * @return 是否已存在 */ boolean checkSheepfoldNoExist(Long ranchId, Long sheepfoldTypeId, String sheepfoldNo); + +// 根据羊舍id获取该羊舍的羊 + List sheepListById(String id); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaSheepfoldServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaSheepfoldServiceImpl.java index ac74ecd..4753929 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaSheepfoldServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaSheepfoldServiceImpl.java @@ -1,6 +1,8 @@ package com.zhyc.module.base.service.impl; +import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.DaSheepfold; +import com.zhyc.module.base.mapper.BasSheepMapper; import com.zhyc.module.base.mapper.DaSheepfoldMapper; import com.zhyc.module.base.service.IDaSheepfoldService; import org.springframework.beans.factory.annotation.Autowired; @@ -19,6 +21,8 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService { @Autowired private DaSheepfoldMapper daSheepfoldMapper; + @Autowired + private BasSheepMapper basSheepMapper; /** * 查询羊舍管理 @@ -101,4 +105,10 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService query.setSheepfoldNo(sheepfoldNo); return daSheepfoldMapper.selectCount(query) > 0; } + + @Override + public List sheepListById(String id) { + List basSheep = basSheepMapper.selectBasSheepBySheepfold(id); + return basSheep; + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java index bfa931f..9d3dd21 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java @@ -24,6 +24,10 @@ public class QuarantineReport extends BaseEntity /** id */ private Long id; + +// 羊只耳号 + private String[] ids; + /** 羊只 */ private Long sheepId; @@ -34,9 +38,9 @@ public class QuarantineReport extends BaseEntity @Excel(name = "羊只性别") private String gender; @Excel(name = "月龄") - private Integer monthAge; + private Long monthAge; @Excel(name = "胎次") - private Integer parity; + private Long parity; @Excel(name = "繁育状态") private String breed; @@ -73,11 +77,15 @@ public class QuarantineReport extends BaseEntity /** 检疫结果 */ @Excel(name = "检疫结果") - private Long result; + private String result; /** 状态 */ @Excel(name = "状态") - private Long status; + private Integer status; + + /** 备注*/ + @Excel(name = "备注") + private String comment; } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java index b913852..5987f23 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java @@ -34,7 +34,7 @@ public interface QuarantineReportMapper * @param quarantineReport 检疫记录 * @return 结果 */ - public int insertQuarantineReport(QuarantineReport quarantineReport); + public int insertQuarantineReport(List quarantineReport); /** * 修改检疫记录 diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java index 7c693f5..dec6015 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java @@ -1,7 +1,12 @@ package com.zhyc.module.biosafety.service.impl; +import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.StringUtils; +import com.zhyc.common.utils.bean.BeanUtils; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.service.impl.SheepFileServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.mapper.QuarantineReportMapper; @@ -19,6 +24,8 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService { @Autowired private QuarantineReportMapper quarantineReportMapper; + @Autowired + private SheepFileServiceImpl sheepFileService; /** * 查询检疫记录 @@ -54,7 +61,28 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService public int insertQuarantineReport(QuarantineReport quarantineReport) { quarantineReport.setCreateTime(DateUtils.getNowDate()); - return quarantineReportMapper.insertQuarantineReport(quarantineReport); + if (quarantineReport.getResult()==null){ + quarantineReport.setStatus(0); + }else { + quarantineReport.setStatus(1); + } + List list = new ArrayList(); + for (String sheepId : quarantineReport.getIds()) { + SheepFile sheepFile = sheepFileService.selectSheepFileById(Long.parseLong(sheepId)); + QuarantineReport quarantine= new QuarantineReport(); + BeanUtils.copyProperties(quarantineReport, quarantine); + quarantine.setSheepId(sheepFile.getId()); + quarantine.setSheepNo(sheepFile.getElectronicTags()); + quarantine.setSheepType(sheepFile.getName()); + +// 性别前端处理 + quarantine.setGender(String.valueOf(sheepFile.getGender())); + quarantine.setMonthAge(sheepFile.getMonthAge()); + quarantine.setParity(sheepFile.getParity()); + quarantine.setBreed(sheepFile.getBreed()); + list.add(quarantine); + } + return quarantineReportMapper.insertQuarantineReport(list); } /** diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml index 9e3928c..dc16f45 100644 --- a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml @@ -104,12 +104,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE s.id = #{id} - + + + manage_tags = #{manageTags} + + + + + diff --git a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml index 525c60c..19a7401 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml @@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -56,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - insert into sw_quarantine_report - - sheep_id, - datetime, - quar_item, - sample_type, - sampler, - quar_officer, - result, - status, - update_by, - update_time, - create_by, - create_time, - - - #{sheepId}, - #{datetime}, - #{quarItem}, - #{sampleType}, - #{sampler}, - #{quarOfficer}, - #{result}, - #{status}, - #{updateBy}, - #{updateTime}, - #{createBy}, - #{createTime}, - + + INSERT INTO sw_quarantine_report + ( + sheep_id, + sheep_type, + month_age, + parity, + breed, + gender, + datetime, + quar_item, + sample_type, + sampler, + quar_officer, + result, + status, + update_by, + update_time, + create_by, + create_time + ) + VALUES + + ( + #{item.sheepId}, + #{item.sheepType}, + #{item.monthAge}, + #{item.parity}, + #{item.breed}, + #{item.gender}, + #{item.datetime}, + #{item.quarItem}, + #{item.sampleType}, + #{item.sampler}, + #{item.quarOfficer}, + #{item.result}, + #{item.status}, + #{item.updateBy}, + #{item.updateTime}, + #{item.createBy}, + #{item.createTime} + ) +