冻胚冻精完善
This commit is contained in:
parent
5ae4af6c44
commit
f957987079
@ -1,17 +1,14 @@
|
||||
package com.zhyc.module.frozen.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
@ -77,6 +74,7 @@ public class DdFeController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DdFe ddFe)
|
||||
{
|
||||
ddFe.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(ddFeService.insertDdFe(ddFe));
|
||||
}
|
||||
|
||||
@ -101,4 +99,58 @@ public class DdFeController extends BaseController
|
||||
{
|
||||
return toAjax(ddFeService.deleteDdFeByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据供体母羊耳号获取最近一次冲胚信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
|
||||
@GetMapping("/getFlushInfoByEwe/{eweNo}")
|
||||
public AjaxResult getFlushInfoByEwe(@PathVariable("eweNo") String eweNo) {
|
||||
if (StringUtils.isBlank(eweNo)) {
|
||||
return error("耳号不能为空");
|
||||
}
|
||||
Map<String, Object> echo = ddFeService.getLastFlushInfoByEwe(eweNo.trim());
|
||||
return echo == null ? error("该母羊无冲胚记录,请先录入冲胚记录") : success(echo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据母羊耳号 + 胚胎等级 返回该等级数量
|
||||
* 无记录返回 0
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
|
||||
@GetMapping("/getQtyByGrade")
|
||||
public AjaxResult getQtyByGrade(@RequestParam String eweNo,
|
||||
@RequestParam String grade) {
|
||||
Map<String, Object> flush = ddFeService.getLastFlushInfoByEwe(eweNo);
|
||||
if (flush == null) return success(0);
|
||||
|
||||
Integer qty;
|
||||
switch (grade) {
|
||||
case "A": qty = (Integer) flush.getOrDefault("gradeA", 0); break;
|
||||
case "B": qty = (Integer) flush.getOrDefault("gradeB", 0); break;
|
||||
case "C": qty = (Integer) flush.getOrDefault("gradeC", 0); break;
|
||||
case "D": qty = (Integer) flush.getOrDefault("gradeD", 0); break;
|
||||
case "囊胚": qty = (Integer) flush.getOrDefault("cell24", 0); break;
|
||||
case "桑椹胚": qty = (Integer) flush.getOrDefault("cell8", 0); break;
|
||||
default: qty = 0;
|
||||
}
|
||||
return success(qty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量废弃
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:discard')")
|
||||
@Log(title = "冻胚库存", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/batchDiscard")
|
||||
public AjaxResult batchDiscard(@RequestBody List<DdFe> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("请选择要废弃的记录");
|
||||
}
|
||||
list.forEach(dto -> {
|
||||
dto.setStatus("废弃");
|
||||
ddFeService.discard(dto);
|
||||
});
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,4 +101,14 @@ public class DdFsController extends BaseController
|
||||
{
|
||||
return toAjax(ddFsService.deleteDdFsByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量废弃
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sperm:sperm:discard')")
|
||||
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/discard")
|
||||
public AjaxResult discard(@RequestBody List<DdFs> list) {
|
||||
return AjaxResult.success(ddFsService.discard(list));
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ public class DdFe extends BaseEntity
|
||||
private Long id;
|
||||
|
||||
/** 胚胎编号 YS+日期+序号 */
|
||||
@Excel(name = "胚胎编号 YS+日期+序号")
|
||||
@Excel(name = "胚胎编号")
|
||||
private String code;
|
||||
|
||||
/** 冻胚日期(事件录入日) */
|
||||
@Excel(name = "冻胚日期", readConverterExp = "事=件录入日")
|
||||
@Excel(name = "冻胚日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date freezeDate;
|
||||
|
||||
@ -46,11 +46,11 @@ public class DdFe extends BaseEntity
|
||||
private String deBreed;
|
||||
|
||||
/** 胚胎品种(自动生成) */
|
||||
@Excel(name = "胚胎品种", readConverterExp = "自=动生成")
|
||||
@Excel(name = "胚胎品种")
|
||||
private String embBreed;
|
||||
|
||||
/** 胚胎阶段等级('A', 'B', 'C', 'D', '囊胚', '桑椹胚') */
|
||||
@Excel(name = "胚胎阶段等级('A', 'B', 'C', 'D', '囊胚', '桑椹胚')")
|
||||
@Excel(name = "胚胎阶段等级")
|
||||
private String grade;
|
||||
|
||||
/** 胚胎数量 */
|
||||
@ -58,11 +58,11 @@ public class DdFe extends BaseEntity
|
||||
private Long qty;
|
||||
|
||||
/** 是否性控 1是 0否 */
|
||||
@Excel(name = "是否性控 1是 0否")
|
||||
@Excel(name = "是否性控",readConverterExp = "1=是,0=否")
|
||||
private Integer sexCtl;
|
||||
|
||||
/** 状态(0正常1销售 2自用3废弃) */
|
||||
@Excel(name = "状态(0正常1销售 2自用3废弃)")
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/** 技术员 */
|
||||
@ -82,12 +82,12 @@ public class DdFe extends BaseEntity
|
||||
private Long rackId;
|
||||
|
||||
/** 出库日期(出库后回写) */
|
||||
@Excel(name = "出库日期", readConverterExp = "出=库后回写")
|
||||
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date outDate;
|
||||
|
||||
/** 废弃原因(废弃时填写) */
|
||||
@Excel(name = "废弃原因", readConverterExp = "废=弃时填写")
|
||||
@Excel(name = "废弃原因")
|
||||
private String discardTxt;
|
||||
|
||||
public void setId(Long id)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.frozen.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@ -9,244 +10,245 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 冻精库存对象 dd_fs
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-29
|
||||
*/
|
||||
public class DdFs extends BaseEntity
|
||||
{
|
||||
public class DdFs extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 冻精号/公羊耳号 */
|
||||
@Excel(name = "冻精号/公羊耳号")
|
||||
/**
|
||||
* 冻精号/公羊耳号
|
||||
*/
|
||||
@Excel(name = "冻精号")
|
||||
private String code;
|
||||
|
||||
/** 冻精日期(事件录入日) */
|
||||
@Excel(name = "冻精日期", readConverterExp = "事=件录入日")
|
||||
/**
|
||||
* 冻精日期(事件录入日)
|
||||
*/
|
||||
@Excel(name = "冻精日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date freezeDt;
|
||||
|
||||
/** 冻精品种(同公羊品种) */
|
||||
@Excel(name = "冻精品种", readConverterExp = "同=公羊品种")
|
||||
/**
|
||||
* 冻精品种(同公羊品种)
|
||||
*/
|
||||
@Excel(name = "冻精品种")
|
||||
private String breed;
|
||||
|
||||
/** 生产批次(日期格式) */
|
||||
@Excel(name = "生产批次", readConverterExp = "日=期格式")
|
||||
/**
|
||||
* 生产批次(日期格式)
|
||||
*/
|
||||
@Excel(name = "生产批次")
|
||||
private String batch;
|
||||
|
||||
/** 规格(0.25mL,0.5mL) */
|
||||
@Excel(name = "规格(0.25mL,0.5mL)")
|
||||
/**
|
||||
* 规格(0.25mL,0.5mL)
|
||||
*/
|
||||
@Excel(name = "规格")
|
||||
private String spec;
|
||||
|
||||
/** 数量(支) */
|
||||
@Excel(name = "数量", readConverterExp = "支=")
|
||||
/**
|
||||
* 数量(支)
|
||||
*/
|
||||
@Excel(name = "数量")
|
||||
private Long qty;
|
||||
|
||||
/** 是否性控 1是 0否 */
|
||||
@Excel(name = "是否性控 1是 0否")
|
||||
/**
|
||||
* 是否性控 1是 0否
|
||||
*/
|
||||
@Excel(name = "是否性控", readConverterExp = "1=是,0=否")
|
||||
private Integer sexCtl;
|
||||
|
||||
/** 状态(0正常1销售2自用3废弃) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常1销售2自用3废弃")
|
||||
/**
|
||||
* 状态(0正常1销售2自用3废弃)
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String stat;
|
||||
|
||||
/** 技术员 */
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String tech;
|
||||
|
||||
/** 液氮罐ID */
|
||||
/**
|
||||
* 液氮罐ID
|
||||
*/
|
||||
@Excel(name = "液氮罐ID")
|
||||
private Long tankId;
|
||||
|
||||
/** 提桶ID */
|
||||
/**
|
||||
* 提桶ID
|
||||
*/
|
||||
@Excel(name = "提桶ID")
|
||||
private Long bucketId;
|
||||
|
||||
/** 冷冻架ID */
|
||||
/**
|
||||
* 冷冻架ID
|
||||
*/
|
||||
@Excel(name = "冷冻架ID")
|
||||
private Long rackId;
|
||||
|
||||
/** 出库日期(出库后回写) */
|
||||
@Excel(name = "出库日期", readConverterExp = "出=库后回写")
|
||||
/**
|
||||
* 出库日期(出库后回写)
|
||||
*/
|
||||
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date outDt;
|
||||
|
||||
/** 废弃原因 */
|
||||
/**
|
||||
* 废弃原因
|
||||
*/
|
||||
@Excel(name = "废弃原因")
|
||||
private String discardTxt;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setCode(String code)
|
||||
{
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setFreezeDt(Date freezeDt)
|
||||
{
|
||||
public void setFreezeDt(Date freezeDt) {
|
||||
this.freezeDt = freezeDt;
|
||||
}
|
||||
|
||||
public Date getFreezeDt()
|
||||
{
|
||||
public Date getFreezeDt() {
|
||||
return freezeDt;
|
||||
}
|
||||
|
||||
public void setBreed(String breed)
|
||||
{
|
||||
public void setBreed(String breed) {
|
||||
this.breed = breed;
|
||||
}
|
||||
|
||||
public String getBreed()
|
||||
{
|
||||
public String getBreed() {
|
||||
return breed;
|
||||
}
|
||||
|
||||
public void setBatch(String batch)
|
||||
{
|
||||
public void setBatch(String batch) {
|
||||
this.batch = batch;
|
||||
}
|
||||
|
||||
public String getBatch()
|
||||
{
|
||||
public String getBatch() {
|
||||
return batch;
|
||||
}
|
||||
|
||||
public void setSpec(String spec)
|
||||
{
|
||||
public void setSpec(String spec) {
|
||||
this.spec = spec;
|
||||
}
|
||||
|
||||
public String getSpec()
|
||||
{
|
||||
public String getSpec() {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public void setQty(Long qty)
|
||||
{
|
||||
public void setQty(Long qty) {
|
||||
this.qty = qty;
|
||||
}
|
||||
|
||||
public Long getQty()
|
||||
{
|
||||
public Long getQty() {
|
||||
return qty;
|
||||
}
|
||||
|
||||
public void setSexCtl(Integer sexCtl)
|
||||
{
|
||||
public void setSexCtl(Integer sexCtl) {
|
||||
this.sexCtl = sexCtl;
|
||||
}
|
||||
|
||||
public Integer getSexCtl()
|
||||
{
|
||||
public Integer getSexCtl() {
|
||||
return sexCtl;
|
||||
}
|
||||
|
||||
public void setStat(String stat)
|
||||
{
|
||||
public void setStat(String stat) {
|
||||
this.stat = stat;
|
||||
}
|
||||
|
||||
public String getStat()
|
||||
{
|
||||
public String getStat() {
|
||||
return stat;
|
||||
}
|
||||
|
||||
public void setTech(String tech)
|
||||
{
|
||||
public void setTech(String tech) {
|
||||
this.tech = tech;
|
||||
}
|
||||
|
||||
public String getTech()
|
||||
{
|
||||
public String getTech() {
|
||||
return tech;
|
||||
}
|
||||
|
||||
public void setTankId(Long tankId)
|
||||
{
|
||||
public void setTankId(Long tankId) {
|
||||
this.tankId = tankId;
|
||||
}
|
||||
|
||||
public Long getTankId()
|
||||
{
|
||||
public Long getTankId() {
|
||||
return tankId;
|
||||
}
|
||||
|
||||
public void setBucketId(Long bucketId)
|
||||
{
|
||||
public void setBucketId(Long bucketId) {
|
||||
this.bucketId = bucketId;
|
||||
}
|
||||
|
||||
public Long getBucketId()
|
||||
{
|
||||
public Long getBucketId() {
|
||||
return bucketId;
|
||||
}
|
||||
|
||||
public void setRackId(Long rackId)
|
||||
{
|
||||
public void setRackId(Long rackId) {
|
||||
this.rackId = rackId;
|
||||
}
|
||||
|
||||
public Long getRackId()
|
||||
{
|
||||
public Long getRackId() {
|
||||
return rackId;
|
||||
}
|
||||
|
||||
public void setOutDt(Date outDt)
|
||||
{
|
||||
public void setOutDt(Date outDt) {
|
||||
this.outDt = outDt;
|
||||
}
|
||||
|
||||
public Date getOutDt()
|
||||
{
|
||||
public Date getOutDt() {
|
||||
return outDt;
|
||||
}
|
||||
|
||||
public void setDiscardTxt(String discardTxt)
|
||||
{
|
||||
public void setDiscardTxt(String discardTxt) {
|
||||
this.discardTxt = discardTxt;
|
||||
}
|
||||
|
||||
public String getDiscardTxt()
|
||||
{
|
||||
public String getDiscardTxt() {
|
||||
return discardTxt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("code", getCode())
|
||||
.append("freezeDt", getFreezeDt())
|
||||
.append("breed", getBreed())
|
||||
.append("batch", getBatch())
|
||||
.append("spec", getSpec())
|
||||
.append("qty", getQty())
|
||||
.append("sexCtl", getSexCtl())
|
||||
.append("stat", getStat())
|
||||
.append("tech", getTech())
|
||||
.append("tankId", getTankId())
|
||||
.append("bucketId", getBucketId())
|
||||
.append("rackId", getRackId())
|
||||
.append("outDt", getOutDt())
|
||||
.append("discardTxt", getDiscardTxt())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("code", getCode())
|
||||
.append("freezeDt", getFreezeDt())
|
||||
.append("breed", getBreed())
|
||||
.append("batch", getBatch())
|
||||
.append("spec", getSpec())
|
||||
.append("qty", getQty())
|
||||
.append("sexCtl", getSexCtl())
|
||||
.append("stat", getStat())
|
||||
.append("tech", getTech())
|
||||
.append("tankId", getTankId())
|
||||
.append("bucketId", getBucketId())
|
||||
.append("rackId", getRackId())
|
||||
.append("outDt", getOutDt())
|
||||
.append("discardTxt", getDiscardTxt())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.zhyc.module.frozen.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.frozen.domain.DdFe;
|
||||
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 冻胚库存Mapper接口
|
||||
@ -58,4 +62,14 @@ public interface DdFeMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDdFeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 按母羊耳号取最新一条冲胚记录(只读)
|
||||
*/
|
||||
Map<String,Object> selectFlushByEwe(@Param("eweNo") String eweNo);
|
||||
|
||||
/**
|
||||
* 废弃更新(只改状态、出库日期、废弃原因、更新人)
|
||||
*/
|
||||
int updateDiscard(DdFe dto);
|
||||
}
|
||||
|
||||
@ -1,19 +1,20 @@
|
||||
package com.zhyc.module.frozen.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.frozen.domain.DdFe;
|
||||
|
||||
/**
|
||||
* 冻胚库存Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-29
|
||||
*/
|
||||
public interface IDdFeService
|
||||
{
|
||||
public interface IDdFeService {
|
||||
/**
|
||||
* 查询冻胚库存
|
||||
*
|
||||
*
|
||||
* @param id 冻胚库存主键
|
||||
* @return 冻胚库存
|
||||
*/
|
||||
@ -21,7 +22,7 @@ public interface IDdFeService
|
||||
|
||||
/**
|
||||
* 查询冻胚库存列表
|
||||
*
|
||||
*
|
||||
* @param ddFe 冻胚库存
|
||||
* @return 冻胚库存集合
|
||||
*/
|
||||
@ -29,7 +30,7 @@ public interface IDdFeService
|
||||
|
||||
/**
|
||||
* 新增冻胚库存
|
||||
*
|
||||
*
|
||||
* @param ddFe 冻胚库存
|
||||
* @return 结果
|
||||
*/
|
||||
@ -37,7 +38,7 @@ public interface IDdFeService
|
||||
|
||||
/**
|
||||
* 修改冻胚库存
|
||||
*
|
||||
*
|
||||
* @param ddFe 冻胚库存
|
||||
* @return 结果
|
||||
*/
|
||||
@ -45,7 +46,7 @@ public interface IDdFeService
|
||||
|
||||
/**
|
||||
* 批量删除冻胚库存
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的冻胚库存主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -53,9 +54,17 @@ public interface IDdFeService
|
||||
|
||||
/**
|
||||
* 删除冻胚库存信息
|
||||
*
|
||||
*
|
||||
* @param id 冻胚库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDdFeById(Long id);
|
||||
|
||||
/**
|
||||
* 根据母羊耳号取最近一次冲胚信息
|
||||
*/
|
||||
Map<String, Object> getLastFlushInfoByEwe(String eweNo);
|
||||
|
||||
// 废弃
|
||||
int discard(DdFe dto);
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
package com.zhyc.module.frozen.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.module.frozen.domain.DdFs;
|
||||
|
||||
/**
|
||||
* 冻精库存Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-29
|
||||
*/
|
||||
public interface IDdFsService
|
||||
{
|
||||
public interface IDdFsService {
|
||||
/**
|
||||
* 查询冻精库存
|
||||
*
|
||||
*
|
||||
* @param id 冻精库存主键
|
||||
* @return 冻精库存
|
||||
*/
|
||||
@ -21,7 +21,7 @@ public interface IDdFsService
|
||||
|
||||
/**
|
||||
* 查询冻精库存列表
|
||||
*
|
||||
*
|
||||
* @param ddFs 冻精库存
|
||||
* @return 冻精库存集合
|
||||
*/
|
||||
@ -29,7 +29,7 @@ public interface IDdFsService
|
||||
|
||||
/**
|
||||
* 新增冻精库存
|
||||
*
|
||||
*
|
||||
* @param ddFs 冻精库存
|
||||
* @return 结果
|
||||
*/
|
||||
@ -37,7 +37,7 @@ public interface IDdFsService
|
||||
|
||||
/**
|
||||
* 修改冻精库存
|
||||
*
|
||||
*
|
||||
* @param ddFs 冻精库存
|
||||
* @return 结果
|
||||
*/
|
||||
@ -45,7 +45,7 @@ public interface IDdFsService
|
||||
|
||||
/**
|
||||
* 批量删除冻精库存
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的冻精库存主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -53,9 +53,12 @@ public interface IDdFsService
|
||||
|
||||
/**
|
||||
* 删除冻精库存信息
|
||||
*
|
||||
*
|
||||
* @param id 冻精库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDdFsById(Long id);
|
||||
|
||||
//废弃
|
||||
int discard(List<DdFs> list);
|
||||
}
|
||||
|
||||
@ -1,13 +1,22 @@
|
||||
package com.zhyc.module.frozen.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
|
||||
import com.zhyc.module.produce.breed.mapper.ScEmbryoFlushMapper;
|
||||
import com.zhyc.module.produce.breed.service.IScEmbryoFlushService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.frozen.mapper.DdFeMapper;
|
||||
import com.zhyc.module.frozen.domain.DdFe;
|
||||
import com.zhyc.module.frozen.service.IDdFeService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 冻胚库存Service业务层处理
|
||||
*
|
||||
@ -19,7 +28,10 @@ public class DdFeServiceImpl implements IDdFeService
|
||||
{
|
||||
@Autowired
|
||||
private DdFeMapper ddFeMapper;
|
||||
|
||||
@Autowired
|
||||
private ScEmbryoFlushMapper scEmbryoFlushMapper;
|
||||
@Autowired
|
||||
private IScEmbryoFlushService scEmbryoFlushService;
|
||||
/**
|
||||
* 查询冻胚库存
|
||||
*
|
||||
@ -92,4 +104,44 @@ public class DdFeServiceImpl implements IDdFeService
|
||||
{
|
||||
return ddFeMapper.deleteDdFeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getLastFlushInfoByEwe(String eweNo) {
|
||||
// 1. 冲胚数据(冻胚自己的 SQL)
|
||||
Map<String, Object> flush = ddFeMapper.selectFlushByEwe(eweNo);
|
||||
if (flush == null) return null;
|
||||
|
||||
String ramId = (String) flush.get("ramId");
|
||||
if (StringUtils.isBlank(ramId)) return null;
|
||||
|
||||
// 2. 公羊品种
|
||||
Map<String, Object> ram = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
|
||||
String ramBreed = (String) ram.get("variety");
|
||||
|
||||
// 3. 母羊品种
|
||||
Map<String, Object> ewe = scEmbryoFlushMapper.selectSheepInfoByManageTag(eweNo);
|
||||
String eweBreed = (String) ewe.get("variety");
|
||||
|
||||
// 4. 胚胎品种
|
||||
String embryoBreed = scEmbryoFlushService.calculateEmbryoVariety(ramBreed, eweBreed);
|
||||
|
||||
// 5. 封装 4 字段
|
||||
Map<String, Object> rsp = new HashMap<>(8);
|
||||
rsp.put("drId", ramId);
|
||||
rsp.put("drBreed", ramBreed);
|
||||
rsp.put("deBreed", eweBreed);
|
||||
rsp.put("embBreed", embryoBreed);
|
||||
// 如果以后需要等级数量,也从这个 flush map 里取
|
||||
rsp.put("gradeA", flush.get("gradeA"));
|
||||
rsp.put("gradeB", flush.get("gradeB"));
|
||||
rsp.put("gradeC", flush.get("gradeC"));
|
||||
rsp.put("gradeD", flush.get("gradeD"));
|
||||
return rsp;
|
||||
}
|
||||
|
||||
// 废弃
|
||||
@Override
|
||||
public int discard(DdFe dto) {
|
||||
return ddFeMapper.updateDiscard(dto);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,95 +1,129 @@
|
||||
package com.zhyc.module.frozen.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.BasSheepVariety;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
import com.zhyc.module.base.mapper.BasSheepVarietyMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.frozen.mapper.DdFsMapper;
|
||||
import com.zhyc.module.frozen.domain.DdFs;
|
||||
import com.zhyc.module.frozen.service.IDdFsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 冻精库存Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-29
|
||||
*/
|
||||
@Service
|
||||
public class DdFsServiceImpl implements IDdFsService
|
||||
{
|
||||
public class DdFsServiceImpl implements IDdFsService {
|
||||
@Autowired
|
||||
private DdFsMapper ddFsMapper;
|
||||
@Autowired
|
||||
private BasSheepMapper basSheepMapper;
|
||||
@Autowired
|
||||
private BasSheepVarietyMapper basSheepVarietyMapper;
|
||||
|
||||
/**
|
||||
* 查询冻精库存
|
||||
*
|
||||
*
|
||||
* @param id 冻精库存主键
|
||||
* @return 冻精库存
|
||||
*/
|
||||
@Override
|
||||
public DdFs selectDdFsById(Long id)
|
||||
{
|
||||
public DdFs selectDdFsById(Long id) {
|
||||
return ddFsMapper.selectDdFsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询冻精库存列表
|
||||
*
|
||||
*
|
||||
* @param ddFs 冻精库存
|
||||
* @return 冻精库存
|
||||
*/
|
||||
@Override
|
||||
public List<DdFs> selectDdFsList(DdFs ddFs)
|
||||
{
|
||||
public List<DdFs> selectDdFsList(DdFs ddFs) {
|
||||
return ddFsMapper.selectDdFsList(ddFs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增冻精库存
|
||||
*
|
||||
*
|
||||
* @param ddFs 冻精库存
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDdFs(DdFs ddFs)
|
||||
{
|
||||
public int insertDdFs(DdFs ddFs) {
|
||||
BasSheep ram = basSheepMapper.selectBasSheepByManageTags(ddFs.getCode());
|
||||
if (ram == null) {
|
||||
throw new ServiceException("公羊不存在");
|
||||
}
|
||||
if (ram.getStatusId() == null || !ram.getStatusId().equals(1L)) {
|
||||
throw new ServiceException("羊只不在群");
|
||||
}
|
||||
if (ram.getGender() == null || !ram.getGender().equals(2L)) {
|
||||
throw new ServiceException("该耳号对应不是公羊");
|
||||
}
|
||||
|
||||
if (ddFs.getBreed() == null || ddFs.getBreed().trim().isEmpty()) {
|
||||
BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(ram.getVarietyId());
|
||||
ddFs.setBreed(variety == null ? "" : variety.getVariety());
|
||||
}
|
||||
ddFs.setCreateTime(DateUtils.getNowDate());
|
||||
return ddFsMapper.insertDdFs(ddFs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改冻精库存
|
||||
*
|
||||
*
|
||||
* @param ddFs 冻精库存
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDdFs(DdFs ddFs)
|
||||
{
|
||||
public int updateDdFs(DdFs ddFs) {
|
||||
return ddFsMapper.updateDdFs(ddFs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除冻精库存
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的冻精库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDdFsByIds(Long[] ids)
|
||||
{
|
||||
public int deleteDdFsByIds(Long[] ids) {
|
||||
return ddFsMapper.deleteDdFsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除冻精库存信息
|
||||
*
|
||||
*
|
||||
* @param id 冻精库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDdFsById(Long id)
|
||||
{
|
||||
public int deleteDdFsById(Long id) {
|
||||
return ddFsMapper.deleteDdFsById(id);
|
||||
}
|
||||
|
||||
// 废弃
|
||||
@Override
|
||||
public int discard(List<DdFs> list) {
|
||||
return list.stream()
|
||||
.mapToInt(item -> {
|
||||
DdFs update = new DdFs();
|
||||
update.setId(item.getId());
|
||||
update.setStat("废弃");
|
||||
update.setDiscardTxt(item.getDiscardTxt());
|
||||
return ddFsMapper.updateDdFs(update);
|
||||
})
|
||||
.sum();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,49 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.frozen.mapper.DdFeMapper">
|
||||
|
||||
|
||||
<resultMap type="com.zhyc.module.frozen.domain.DdFe" id="DdFeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="code" column="code" />
|
||||
<result property="freezeDate" column="freeze_date" />
|
||||
<result property="drId" column="dr_id" />
|
||||
<result property="drBreed" column="dr_breed" />
|
||||
<result property="deId" column="de_id" />
|
||||
<result property="deBreed" column="de_breed" />
|
||||
<result property="embBreed" column="emb_breed" />
|
||||
<result property="grade" column="grade" />
|
||||
<result property="qty" column="qty" />
|
||||
<result property="sexCtl" column="sex_ctl" />
|
||||
<result property="status" column="status" />
|
||||
<result property="tech" column="tech" />
|
||||
<result property="tankId" column="tank_id" />
|
||||
<result property="bucketId" column="bucket_id" />
|
||||
<result property="rackId" column="rack_id" />
|
||||
<result property="outDate" column="out_date" />
|
||||
<result property="discardTxt" column="discard_txt" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="code" column="code"/>
|
||||
<result property="freezeDate" column="freeze_date"/>
|
||||
<result property="drId" column="dr_id"/>
|
||||
<result property="drBreed" column="dr_breed"/>
|
||||
<result property="deId" column="de_id"/>
|
||||
<result property="deBreed" column="de_breed"/>
|
||||
<result property="embBreed" column="emb_breed"/>
|
||||
<result property="grade" column="grade"/>
|
||||
<result property="qty" column="qty"/>
|
||||
<result property="sexCtl" column="sex_ctl"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="tech" column="tech"/>
|
||||
<result property="tankId" column="tank_id"/>
|
||||
<result property="bucketId" column="bucket_id"/>
|
||||
<result property="rackId" column="rack_id"/>
|
||||
<result property="outDate" column="out_date"/>
|
||||
<result property="discardTxt" column="discard_txt"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDdFeVo">
|
||||
select id, code, freeze_date, dr_id, dr_breed, de_id, de_breed, emb_breed, grade, qty, sex_ctl, status, tech, tank_id, bucket_id, rack_id, out_date, discard_txt, remark, create_by, create_time from dd_fe
|
||||
select id,
|
||||
code,
|
||||
freeze_date,
|
||||
dr_id,
|
||||
dr_breed,
|
||||
de_id,
|
||||
de_breed,
|
||||
emb_breed,
|
||||
grade,
|
||||
qty,
|
||||
sex_ctl,
|
||||
status,
|
||||
tech,
|
||||
tank_id,
|
||||
bucket_id,
|
||||
rack_id,
|
||||
out_date,
|
||||
discard_txt,
|
||||
remark,
|
||||
create_by,
|
||||
create_time
|
||||
from dd_fe
|
||||
</sql>
|
||||
|
||||
<select id="selectDdFeList" parameterType="DdFe" resultMap="DdFeResult">
|
||||
<include refid="selectDdFeVo"/>
|
||||
<where>
|
||||
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
|
||||
<if test="freezeDate != null "> and freeze_date = #{freezeDate}</if>
|
||||
<if test="grade != null and grade != ''"> and grade = #{grade}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="tech != null and tech != ''"> and tech = #{tech}</if>
|
||||
<if test="outDate != null "> and out_date = #{outDate}</if>
|
||||
<where>
|
||||
<if test="code != null and code != ''">and code like concat('%', #{code}, '%')</if>
|
||||
<if test="grade != null and grade != ''">and grade = #{grade}</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
<if test="tech != null and tech != ''">and tech = #{tech}</if>
|
||||
<if test="outDate != null "> and out_date = #{outDate}</if>
|
||||
<if test="params.beginFreezeDate != null and params.endFreezeDate != null">
|
||||
and freeze_date between #{params.beginFreezeDate} and #{params.endFreezeDate}
|
||||
</if>
|
||||
<if test="params.beginOutDate != null and params.endOutDate != null">
|
||||
and out_date between #{params.beginOutDate} and #{params.endOutDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDdFeById" parameterType="Long" resultMap="DdFeResult">
|
||||
<include refid="selectDdFeVo"/>
|
||||
where id = #{id}
|
||||
@ -72,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="freezeDate != null">#{freezeDate},</if>
|
||||
@ -94,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDdFe" parameterType="DdFe">
|
||||
@ -125,13 +151,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteDdFeById" parameterType="Long">
|
||||
delete from dd_fe where id = #{id}
|
||||
delete
|
||||
from dd_fe
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDdFeByIds" parameterType="String">
|
||||
delete from dd_fe where id in
|
||||
delete from dd_fe where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectFlushByEwe" resultType="map">
|
||||
SELECT grade_a gradeA,
|
||||
grade_b gradeB,
|
||||
grade_c gradeC,
|
||||
grade_d gradeD,
|
||||
cell_2_4 cell24,
|
||||
cell_8 cell8,
|
||||
donor_male_no ramId
|
||||
FROM sc_embryo_flush
|
||||
WHERE donor_female_no = #{eweNo}
|
||||
ORDER BY flush_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="updateDiscard" parameterType="DdFe">
|
||||
UPDATE dd_fe
|
||||
SET status = #{status},
|
||||
discard_txt = #{discardTxt}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -33,9 +33,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectDdFsVo"/>
|
||||
<where>
|
||||
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
|
||||
<if test="freezeDt != null "> and freeze_dt = #{freezeDt}</if>
|
||||
<if test="tech != null and tech != ''"> and tech like concat('%', #{tech}, '%')</if>
|
||||
<if test="outDt != null "> and out_dt = #{outDt}</if>
|
||||
<if test="params.beginFreezeDt != null and params.endFreezeDt != null">
|
||||
and freeze_dt between #{params.beginFreezeDt} and #{params.endFreezeDt}
|
||||
</if>
|
||||
<if test="params.beginOutDt != null and params.endOutDt != null">
|
||||
and out_dt between #{params.beginOutDt} and #{params.endOutDt}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@ -102,30 +102,7 @@
|
||||
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
|
||||
ORDER BY
|
||||
<choose>
|
||||
<when test="orderBy == 'weaningWeight'">bs.weaning_weight</when>
|
||||
<when test="orderBy == 'bodyLength'">sm.body_length</when>
|
||||
<when test="orderBy == 'birthWeight'">bs.birth_weight</when>
|
||||
<when test="orderBy == 'currentWeight'">bs.current_weight</when>
|
||||
<when test="orderBy == 'lactationDay'">bs.lactation_day</when>
|
||||
<when test="orderBy == 'gestationDay'">bs.gestation_day</when>
|
||||
<when test="orderBy == 'postMatingDay'">post_mating_day</when>
|
||||
<when test="orderBy == 'parity'">bs.parity</when>
|
||||
<when test="orderBy == 'height'">sm.height</when>
|
||||
<when test="orderBy == 'bust'">sm.bust</when>
|
||||
<when test="orderBy == 'pipeLength'">sm.pipe_length</when>
|
||||
<when test="orderBy == 'chestDepth'">sm.chest_depth</when>
|
||||
<when test="orderBy == 'hipHeight'">sm.hip_height</when>
|
||||
<when test="orderBy == 'rumpWidth'">sm.rump_width</when>
|
||||
<when test="orderBy == 'rumpHeignt'">sm.rump_heignt</when>
|
||||
<when test="orderBy == 'hipWidth'">sm.hip_width</when>
|
||||
<when test="orderBy == 'hipCrossHeight'">sm.hip_cross_height</when>
|
||||
<otherwise>${orderBy}</otherwise>
|
||||
</choose>
|
||||
${sortDirection}
|
||||
</if>
|
||||
<if test="true">ORDER BY sm.create_time DESC</if>
|
||||
</select>
|
||||
|
||||
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">
|
||||
|
||||
@ -58,12 +58,7 @@
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
|
||||
ORDER BY sbs.${orderBy} ${sortDirection}
|
||||
</if>
|
||||
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
|
||||
ORDER BY sbs.create_time DESC
|
||||
</if>
|
||||
<if test="true">ORDER BY sbs.create_time DESC</if>
|
||||
</select>
|
||||
|
||||
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">
|
||||
|
||||
@ -56,13 +56,7 @@
|
||||
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
|
||||
ORDER BY sbr.${orderBy} ${sortDirection}
|
||||
</if>
|
||||
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
|
||||
ORDER BY sbr.create_time DESC
|
||||
</if>
|
||||
|
||||
<if test="true">ORDER BY sbr.create_time DESC</if>
|
||||
</select>
|
||||
|
||||
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user