Merge remote-tracking branch 'main/main'
This commit is contained in:
commit
4652469299
@ -51,6 +51,10 @@ spring:
|
|||||||
messages:
|
messages:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
|
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
profiles:
|
profiles:
|
||||||
active: druid
|
active: druid
|
||||||
# 文件上传
|
# 文件上传
|
||||||
@ -112,6 +116,7 @@ pagehelper:
|
|||||||
supportMethodsArguments: true
|
supportMethodsArguments: true
|
||||||
params: count=countSql
|
params: count=countSql
|
||||||
|
|
||||||
|
|
||||||
# Swagger配置
|
# Swagger配置
|
||||||
swagger:
|
swagger:
|
||||||
# 是否开启swagger
|
# 是否开启swagger
|
||||||
@ -127,3 +132,6 @@ xss:
|
|||||||
excludes: /system/notice
|
excludes: /system/notice
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,115 @@
|
|||||||
|
package com.zhyc.module.produce.drymilk.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;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
|
||||||
|
import com.zhyc.module.produce.drymilk.service.IScDryMilkService;
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干奶记录Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/drymilk/drymilk")
|
||||||
|
public class ScDryMilkController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IScDryMilkService scDryMilkService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询干奶记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出干奶记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:export')")
|
||||||
|
@Log(title = "干奶记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
||||||
|
ExcelUtil<ScDryMilk> util = new ExcelUtil<ScDryMilk>(ScDryMilk.class);
|
||||||
|
util.exportExcel(response, list, "干奶记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取干奶记录详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(scDryMilkService.selectScDryMilkById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据耳号查询羊只ID
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:query')")
|
||||||
|
@GetMapping(value = "/sheep/{manageTags}")
|
||||||
|
public AjaxResult getSheepIdByManageTags(@PathVariable("manageTags") String manageTags)
|
||||||
|
{
|
||||||
|
Long sheepId = scDryMilkService.selectSheepIdByManageTags(manageTags);
|
||||||
|
return success(sheepId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增干奶记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:add')")
|
||||||
|
@Log(title = "干奶记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
return toAjax(scDryMilkService.insertScDryMilk(scDryMilk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改干奶记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:edit')")
|
||||||
|
@Log(title = "干奶记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
return toAjax(scDryMilkService.updateScDryMilk(scDryMilk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除干奶记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:remove')")
|
||||||
|
@Log(title = "干奶记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(scDryMilkService.deleteScDryMilkByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,189 @@
|
|||||||
|
package com.zhyc.module.produce.drymilk.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;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干奶记录对象 sc_dry_milk
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-15
|
||||||
|
*/
|
||||||
|
public class ScDryMilk extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 羊只id */
|
||||||
|
@Excel(name = "羊只id")
|
||||||
|
private String sheepId;
|
||||||
|
|
||||||
|
/** 干奶日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "干奶日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date datetime;
|
||||||
|
|
||||||
|
/** 是否使用乳头封闭剂 */
|
||||||
|
@Excel(name = "是否使用乳头封闭剂")
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/** 转入羊舍id */
|
||||||
|
@Excel(name = "转入羊舍id")
|
||||||
|
private Long sheepfold;
|
||||||
|
|
||||||
|
/** 技术员 */
|
||||||
|
@Excel(name = "技术员")
|
||||||
|
private String tecahnician;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
// 以下为联表查询字段,不存储在sc_dry_milk表中
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "耳号")
|
||||||
|
private String manageTags;
|
||||||
|
|
||||||
|
/** 品种 */
|
||||||
|
@Excel(name = "品种")
|
||||||
|
private String variety;
|
||||||
|
|
||||||
|
/** 羊舍名称 */
|
||||||
|
@Excel(name = "转入羊舍")
|
||||||
|
private String sheepfoldName;
|
||||||
|
|
||||||
|
/** 事件类型 */
|
||||||
|
@Excel(name = "事件类型")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setSheepId(String sheepId)
|
||||||
|
{
|
||||||
|
this.sheepId = sheepId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepId()
|
||||||
|
{
|
||||||
|
return sheepId;
|
||||||
|
}
|
||||||
|
public void setDatetime(Date datetime)
|
||||||
|
{
|
||||||
|
this.datetime = datetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDatetime()
|
||||||
|
{
|
||||||
|
return datetime;
|
||||||
|
}
|
||||||
|
public void setStatus(Long status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setSheepfold(Long sheepfold)
|
||||||
|
{
|
||||||
|
this.sheepfold = sheepfold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSheepfold()
|
||||||
|
{
|
||||||
|
return sheepfold;
|
||||||
|
}
|
||||||
|
public void setTecahnician(String tecahnician)
|
||||||
|
{
|
||||||
|
this.tecahnician = tecahnician;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTecahnician()
|
||||||
|
{
|
||||||
|
return tecahnician;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment)
|
||||||
|
{
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment()
|
||||||
|
{
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManageTags(String manageTags)
|
||||||
|
{
|
||||||
|
this.manageTags = manageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManageTags()
|
||||||
|
{
|
||||||
|
return manageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVariety(String variety)
|
||||||
|
{
|
||||||
|
this.variety = variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVariety()
|
||||||
|
{
|
||||||
|
return variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepfoldName(String sheepfoldName)
|
||||||
|
{
|
||||||
|
this.sheepfoldName = sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepfoldName()
|
||||||
|
{
|
||||||
|
return sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(String eventType)
|
||||||
|
{
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventType()
|
||||||
|
{
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("sheepId", getSheepId())
|
||||||
|
.append("datetime", getDatetime())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("sheepfold", getSheepfold())
|
||||||
|
.append("tecahnician", getTecahnician())
|
||||||
|
.append("comment", getComment())
|
||||||
|
.append("manageTags", getManageTags())
|
||||||
|
.append("variety", getVariety())
|
||||||
|
.append("sheepfoldName", getSheepfoldName())
|
||||||
|
.append("eventType", getEventType())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.zhyc.module.produce.drymilk.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干奶记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-15
|
||||||
|
*/
|
||||||
|
public interface ScDryMilkMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询干奶记录
|
||||||
|
*
|
||||||
|
* @param id 干奶记录主键
|
||||||
|
* @return 干奶记录
|
||||||
|
*/
|
||||||
|
public ScDryMilk selectScDryMilkById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询干奶记录列表
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 干奶记录集合
|
||||||
|
*/
|
||||||
|
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据耳号查询羊只ID
|
||||||
|
*
|
||||||
|
* @param manageTags 管理耳号
|
||||||
|
* @return 羊只ID
|
||||||
|
*/
|
||||||
|
public Long selectSheepIdByManageTags(String manageTags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增干奶记录
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改干奶记录
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除干奶记录
|
||||||
|
*
|
||||||
|
* @param id 干奶记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScDryMilkById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除干奶记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScDryMilkByIds(Long[] ids);
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.zhyc.module.produce.drymilk.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干奶记录Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-15
|
||||||
|
*/
|
||||||
|
public interface IScDryMilkService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询干奶记录
|
||||||
|
*
|
||||||
|
* @param id 干奶记录主键
|
||||||
|
* @return 干奶记录
|
||||||
|
*/
|
||||||
|
public ScDryMilk selectScDryMilkById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询干奶记录列表
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 干奶记录集合
|
||||||
|
*/
|
||||||
|
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
|
Long selectSheepIdByManageTags(String manageTags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增干奶记录
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改干奶记录
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除干奶记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的干奶记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScDryMilkByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除干奶记录信息
|
||||||
|
*
|
||||||
|
* @param id 干奶记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScDryMilkById(Long id);
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
package com.zhyc.module.produce.drymilk.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.zhyc.module.produce.drymilk.mapper.ScDryMilkMapper;
|
||||||
|
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
|
||||||
|
import com.zhyc.module.produce.drymilk.service.IScDryMilkService;
|
||||||
|
import com.zhyc.common.utils.StringUtils;
|
||||||
|
import com.zhyc.common.exception.ServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干奶记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ScDryMilkServiceImpl implements IScDryMilkService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ScDryMilkMapper scDryMilkMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询干奶记录
|
||||||
|
*
|
||||||
|
* @param id 干奶记录主键
|
||||||
|
* @return 干奶记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ScDryMilk selectScDryMilkById(Long id)
|
||||||
|
{
|
||||||
|
return scDryMilkMapper.selectScDryMilkById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询干奶记录列表
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 干奶记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
return scDryMilkMapper.selectScDryMilkList(scDryMilk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据耳号查询羊只ID
|
||||||
|
*
|
||||||
|
* @param manageTags 管理耳号
|
||||||
|
* @return 羊只ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long selectSheepIdByManageTags(String manageTags)
|
||||||
|
{
|
||||||
|
return scDryMilkMapper.selectSheepIdByManageTags(manageTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增干奶记录
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertScDryMilk(ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
// 如果传入的是耳号,需要转换为羊只ID
|
||||||
|
if (StringUtils.isNotEmpty(scDryMilk.getManageTags()) && StringUtils.isEmpty(scDryMilk.getSheepId()))
|
||||||
|
{
|
||||||
|
Long sheepId = scDryMilkMapper.selectSheepIdByManageTags(scDryMilk.getManageTags());
|
||||||
|
if (sheepId == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("未找到对应耳号的羊只信息");
|
||||||
|
}
|
||||||
|
scDryMilk.setSheepId(String.valueOf(sheepId));
|
||||||
|
}
|
||||||
|
return scDryMilkMapper.insertScDryMilk(scDryMilk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改干奶记录
|
||||||
|
*
|
||||||
|
* @param scDryMilk 干奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateScDryMilk(ScDryMilk scDryMilk)
|
||||||
|
{
|
||||||
|
// 如果传入的是耳号,需要转换为羊只ID
|
||||||
|
if (StringUtils.isNotEmpty(scDryMilk.getManageTags()) && StringUtils.isEmpty(scDryMilk.getSheepId()))
|
||||||
|
{
|
||||||
|
Long sheepId = scDryMilkMapper.selectSheepIdByManageTags(scDryMilk.getManageTags());
|
||||||
|
if (sheepId == null)
|
||||||
|
{
|
||||||
|
throw new ServiceException("未找到对应耳号的羊只信息");
|
||||||
|
}
|
||||||
|
scDryMilk.setSheepId(String.valueOf(sheepId));
|
||||||
|
}
|
||||||
|
return scDryMilkMapper.updateScDryMilk(scDryMilk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除干奶记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的干奶记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteScDryMilkByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return scDryMilkMapper.deleteScDryMilkByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除干奶记录信息
|
||||||
|
*
|
||||||
|
* @param id 干奶记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteScDryMilkById(Long id)
|
||||||
|
{
|
||||||
|
return scDryMilkMapper.deleteScDryMilkById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.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;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanService;
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mating_plan/mating_plan")
|
||||||
|
public class ScBreedPlanController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IScBreedPlanService scBreedPlanService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ScBreedPlan> list = scBreedPlanService.selectScBreedPlanList(scBreedPlan);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出配种计划列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:export')")
|
||||||
|
@Log(title = "配种计划", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
List<ScBreedPlan> list = scBreedPlanService.selectScBreedPlanList(scBreedPlan);
|
||||||
|
ExcelUtil<ScBreedPlan> util = new ExcelUtil<ScBreedPlan>(ScBreedPlan.class);
|
||||||
|
util.exportExcel(response, list, "配种计划数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配种计划详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(scBreedPlanService.selectScBreedPlanById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:add')")
|
||||||
|
@Log(title = "配种计划", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanService.insertScBreedPlan(scBreedPlan));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:edit')")
|
||||||
|
@Log(title = "配种计划", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanService.updateScBreedPlan(scBreedPlan));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:remove')")
|
||||||
|
@Log(title = "配种计划", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanService.deleteScBreedPlanByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,188 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
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;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
|
||||||
|
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanService;
|
||||||
|
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanGenerateService;
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划生成Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mating_plan/generate")
|
||||||
|
public class ScBreedPlanGenerateController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IScBreedPlanGenerateService scBreedPlanGenerateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ScBreedPlanGenerate scBreedPlanGenerate)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ScBreedPlanGenerate> list = scBreedPlanGenerateService.selectScBreedPlanGenerateList(scBreedPlanGenerate);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的母羊
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectEwe')")
|
||||||
|
@GetMapping("/selectEwe")
|
||||||
|
public AjaxResult selectEligibleEwe()
|
||||||
|
{
|
||||||
|
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe();
|
||||||
|
return success(eligibleEwe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的公羊
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectRam')")
|
||||||
|
@GetMapping("/selectRam")
|
||||||
|
public AjaxResult selectEligibleRam()
|
||||||
|
{
|
||||||
|
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam();
|
||||||
|
return success(eligibleRam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动生成配种计划
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:auto')")
|
||||||
|
@PostMapping("/auto")
|
||||||
|
@Log(title = "自动生成配种计划", businessType = BusinessType.INSERT)
|
||||||
|
public AjaxResult autoGenerateBreedPlan(@RequestBody Map<String, Object> params)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 安全的类型转换
|
||||||
|
List<?> eweIdsRaw = (List<?>) params.get("eweIds");
|
||||||
|
List<?> ramIdsRaw = (List<?>) params.get("ramIds");
|
||||||
|
|
||||||
|
if (eweIdsRaw == null || ramIdsRaw == null) {
|
||||||
|
return error("参数不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> eweIds = eweIdsRaw.stream()
|
||||||
|
.map(obj -> {
|
||||||
|
if (obj instanceof Integer) {
|
||||||
|
return ((Integer) obj).longValue();
|
||||||
|
} else if (obj instanceof Long) {
|
||||||
|
return (Long) obj;
|
||||||
|
} else {
|
||||||
|
return Long.valueOf(obj.toString());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Long> ramIds = ramIdsRaw.stream()
|
||||||
|
.map(obj -> {
|
||||||
|
if (obj instanceof Integer) {
|
||||||
|
return ((Integer) obj).longValue();
|
||||||
|
} else if (obj instanceof Long) {
|
||||||
|
return (Long) obj;
|
||||||
|
} else {
|
||||||
|
return Long.valueOf(obj.toString());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
ScBreedPlanGenerate planGenerate = scBreedPlanGenerateService.autoGenerateBreedPlan(eweIds, ramIds);
|
||||||
|
return success(planGenerate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("自动生成配种计划失败", e);
|
||||||
|
return error("自动生成配种计划失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配种计划生成详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(scBreedPlanGenerateService.selectScBreedPlanGenerateById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存配种计划生成
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:add')")
|
||||||
|
@Log(title = "配种计划生成", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ScBreedPlanGenerate scBreedPlanGenerate)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanGenerateService.insertScBreedPlanGenerate(scBreedPlanGenerate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划生成
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:edit')")
|
||||||
|
@Log(title = "配种计划生成", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ScBreedPlanGenerate scBreedPlanGenerate)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanGenerateService.updateScBreedPlanGenerate(scBreedPlanGenerate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批配种计划
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:approve')")
|
||||||
|
@Log(title = "审批配种计划", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/approve/{id}")
|
||||||
|
public AjaxResult approve(@PathVariable Long id)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanGenerateService.approveBreedPlan(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配种计划详情
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:view')")
|
||||||
|
@GetMapping("/view/{id}")
|
||||||
|
public AjaxResult viewBreedPlan(@PathVariable Long id)
|
||||||
|
{
|
||||||
|
Map<String, Object> planDetails = scBreedPlanGenerateService.getBreedPlanDetails(id);
|
||||||
|
return success(planDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划生成
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mating_plan:generate:remove')")
|
||||||
|
@Log(title = "配种计划生成", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(scBreedPlanGenerateService.deleteScBreedPlanGenerateByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划对象 sc_breed_plan
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public class ScBreedPlan extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 公羊id */
|
||||||
|
@Excel(name = "公羊id")
|
||||||
|
private String ramId;
|
||||||
|
|
||||||
|
/** 母羊id */
|
||||||
|
@Excel(name = "母羊id")
|
||||||
|
private String eweId;
|
||||||
|
|
||||||
|
/** 配种类型 */
|
||||||
|
@Excel(name = "配种类型")
|
||||||
|
private Long breedType;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRamId(String ramId)
|
||||||
|
{
|
||||||
|
this.ramId = ramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRamId()
|
||||||
|
{
|
||||||
|
return ramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEweId(String eweId)
|
||||||
|
{
|
||||||
|
this.eweId = eweId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEweId()
|
||||||
|
{
|
||||||
|
return eweId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreedType(Long breedType)
|
||||||
|
{
|
||||||
|
this.breedType = breedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBreedType()
|
||||||
|
{
|
||||||
|
return breedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("ramId", getRamId())
|
||||||
|
.append("eweId", getEweId())
|
||||||
|
.append("breedType", getBreedType())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,194 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.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;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划生成对象 sc_breed_plan_generate
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public class ScBreedPlanGenerate extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 计划名称 */
|
||||||
|
@Excel(name = "计划名称")
|
||||||
|
private String planName;
|
||||||
|
|
||||||
|
/** 计划类型:1-同期发情配种计划 */
|
||||||
|
@Excel(name = "计划类型")
|
||||||
|
private Integer planType;
|
||||||
|
|
||||||
|
/** 计划日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "计划日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date planDate;
|
||||||
|
|
||||||
|
/** 总母羊数 */
|
||||||
|
@Excel(name = "总母羊数")
|
||||||
|
private Integer totalEweCount;
|
||||||
|
|
||||||
|
/** 总公羊数 */
|
||||||
|
@Excel(name = "总公羊数")
|
||||||
|
private Integer totalRamCount;
|
||||||
|
|
||||||
|
/** 配种比例 */
|
||||||
|
@Excel(name = "配种比例")
|
||||||
|
private String breedRatio;
|
||||||
|
|
||||||
|
/** 状态:0-待审批,1-已审批,2-已拒绝 */
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/** 审批人 */
|
||||||
|
@Excel(name = "审批人")
|
||||||
|
private String approver;
|
||||||
|
|
||||||
|
/** 审批时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date approveTime;
|
||||||
|
|
||||||
|
/** 审批意见 */
|
||||||
|
private String approveRemark;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlanName(String planName)
|
||||||
|
{
|
||||||
|
this.planName = planName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlanName()
|
||||||
|
{
|
||||||
|
return planName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlanType(Integer planType)
|
||||||
|
{
|
||||||
|
this.planType = planType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPlanType()
|
||||||
|
{
|
||||||
|
return planType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlanDate(Date planDate)
|
||||||
|
{
|
||||||
|
this.planDate = planDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getPlanDate()
|
||||||
|
{
|
||||||
|
return planDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalEweCount(Integer totalEweCount)
|
||||||
|
{
|
||||||
|
this.totalEweCount = totalEweCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTotalEweCount()
|
||||||
|
{
|
||||||
|
return totalEweCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalRamCount(Integer totalRamCount)
|
||||||
|
{
|
||||||
|
this.totalRamCount = totalRamCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTotalRamCount()
|
||||||
|
{
|
||||||
|
return totalRamCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreedRatio(String breedRatio)
|
||||||
|
{
|
||||||
|
this.breedRatio = breedRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBreedRatio()
|
||||||
|
{
|
||||||
|
return breedRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Integer status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApprover(String approver)
|
||||||
|
{
|
||||||
|
this.approver = approver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApprover()
|
||||||
|
{
|
||||||
|
return approver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApproveTime(Date approveTime)
|
||||||
|
{
|
||||||
|
this.approveTime = approveTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getApproveTime()
|
||||||
|
{
|
||||||
|
return approveTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApproveRemark(String approveRemark)
|
||||||
|
{
|
||||||
|
this.approveRemark = approveRemark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApproveRemark()
|
||||||
|
{
|
||||||
|
return approveRemark;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("planName", getPlanName())
|
||||||
|
.append("planType", getPlanType())
|
||||||
|
.append("planDate", getPlanDate())
|
||||||
|
.append("totalEweCount", getTotalEweCount())
|
||||||
|
.append("totalRamCount", getTotalRamCount())
|
||||||
|
.append("breedRatio", getBreedRatio())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("approver", getApprover())
|
||||||
|
.append("approveTime", getApproveTime())
|
||||||
|
.append("approveRemark", getApproveRemark())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,172 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划详情对象 sc_breed_plan_temp
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public class ScBreedPlanTemp extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 配种计划生成ID */
|
||||||
|
private Long planGenerateId;
|
||||||
|
|
||||||
|
/** 公羊ID */
|
||||||
|
@Excel(name = "公羊ID")
|
||||||
|
private String ramId;
|
||||||
|
|
||||||
|
/** 母羊ID */
|
||||||
|
@Excel(name = "母羊ID")
|
||||||
|
private String eweId;
|
||||||
|
|
||||||
|
/** 配种类型 */
|
||||||
|
@Excel(name = "配种类型")
|
||||||
|
private Long breedType;
|
||||||
|
|
||||||
|
/** 公羊管理耳号 */
|
||||||
|
@Excel(name = "公羊管理耳号")
|
||||||
|
private String ramManageTags;
|
||||||
|
|
||||||
|
/** 公羊品种 */
|
||||||
|
@Excel(name = "公羊品种")
|
||||||
|
private String ramVariety;
|
||||||
|
|
||||||
|
/** 母羊管理耳号 */
|
||||||
|
@Excel(name = "母羊管理耳号")
|
||||||
|
private String eweManageTags;
|
||||||
|
|
||||||
|
/** 母羊品种 */
|
||||||
|
@Excel(name = "母羊品种")
|
||||||
|
private String eweVariety;
|
||||||
|
|
||||||
|
/** 母羊体重 */
|
||||||
|
@Excel(name = "母羊体重")
|
||||||
|
private Double eweWeight;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlanGenerateId(Long planGenerateId)
|
||||||
|
{
|
||||||
|
this.planGenerateId = planGenerateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPlanGenerateId()
|
||||||
|
{
|
||||||
|
return planGenerateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRamId(String ramId)
|
||||||
|
{
|
||||||
|
this.ramId = ramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRamId()
|
||||||
|
{
|
||||||
|
return ramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEweId(String eweId)
|
||||||
|
{
|
||||||
|
this.eweId = eweId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEweId()
|
||||||
|
{
|
||||||
|
return eweId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreedType(Long breedType)
|
||||||
|
{
|
||||||
|
this.breedType = breedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBreedType()
|
||||||
|
{
|
||||||
|
return breedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRamManageTags(String ramManageTags)
|
||||||
|
{
|
||||||
|
this.ramManageTags = ramManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRamManageTags()
|
||||||
|
{
|
||||||
|
return ramManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRamVariety(String ramVariety)
|
||||||
|
{
|
||||||
|
this.ramVariety = ramVariety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRamVariety()
|
||||||
|
{
|
||||||
|
return ramVariety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEweManageTags(String eweManageTags)
|
||||||
|
{
|
||||||
|
this.eweManageTags = eweManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEweManageTags()
|
||||||
|
{
|
||||||
|
return eweManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEweVariety(String eweVariety)
|
||||||
|
{
|
||||||
|
this.eweVariety = eweVariety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEweVariety()
|
||||||
|
{
|
||||||
|
return eweVariety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEweWeight(Double eweWeight)
|
||||||
|
{
|
||||||
|
this.eweWeight = eweWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getEweWeight()
|
||||||
|
{
|
||||||
|
return eweWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("planGenerateId", getPlanGenerateId())
|
||||||
|
.append("ramId", getRamId())
|
||||||
|
.append("eweId", getEweId())
|
||||||
|
.append("breedType", getBreedType())
|
||||||
|
.append("ramManageTags", getRamManageTags())
|
||||||
|
.append("ramVariety", getRamVariety())
|
||||||
|
.append("eweManageTags", getEweManageTags())
|
||||||
|
.append("eweVariety", getEweVariety())
|
||||||
|
.append("eweWeight", getEweWeight())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划生成Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public interface ScBreedPlanGenerateMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成
|
||||||
|
*
|
||||||
|
* @param id 配种计划生成主键
|
||||||
|
* @return 配种计划生成
|
||||||
|
*/
|
||||||
|
public ScBreedPlanGenerate selectScBreedPlanGenerateById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成列表
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 配种计划生成集合
|
||||||
|
*/
|
||||||
|
public List<ScBreedPlanGenerate> selectScBreedPlanGenerateList(ScBreedPlanGenerate scBreedPlanGenerate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的母羊
|
||||||
|
*
|
||||||
|
* @return 符合条件的母羊列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectEligibleEwe();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的公羊
|
||||||
|
*
|
||||||
|
* @return 符合条件的公羊列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectEligibleRam();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划生成
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入临时配种计划
|
||||||
|
*
|
||||||
|
* @param planGenerateId 配种计划生成ID
|
||||||
|
* @param breedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertTempBreedPlan(@Param("planGenerateId") Long planGenerateId,
|
||||||
|
@Param("breedPlan") ScBreedPlan breedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划生成
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将临时配种计划转为正式配种计划
|
||||||
|
*
|
||||||
|
* @param planGenerateId 配种计划生成ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int transferTempToFormal(Long planGenerateId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配种计划详情
|
||||||
|
*
|
||||||
|
* @param planGenerateId 配种计划生成ID
|
||||||
|
* @return 配种计划详情列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectBreedPlanDetails(Long planGenerateId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划生成
|
||||||
|
*
|
||||||
|
* @param id 配种计划生成主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanGenerateById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除配种计划生成
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanGenerateByIds(Long[] ids);
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public interface ScBreedPlanMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询配种计划
|
||||||
|
*
|
||||||
|
* @param id 配种计划主键
|
||||||
|
* @return 配种计划
|
||||||
|
*/
|
||||||
|
public ScBreedPlan selectScBreedPlanById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划列表
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 配种计划集合
|
||||||
|
*/
|
||||||
|
public List<ScBreedPlan> selectScBreedPlanList(ScBreedPlan scBreedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertScBreedPlan(ScBreedPlan scBreedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateScBreedPlan(ScBreedPlan scBreedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划
|
||||||
|
*
|
||||||
|
* @param id 配种计划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除配种计划
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanByIds(Long[] ids);
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划生成Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public interface IScBreedPlanGenerateService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成
|
||||||
|
*
|
||||||
|
* @param id 配种计划生成主键
|
||||||
|
* @return 配种计划生成
|
||||||
|
*/
|
||||||
|
public ScBreedPlanGenerate selectScBreedPlanGenerateById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成列表
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 配种计划生成集合
|
||||||
|
*/
|
||||||
|
public List<ScBreedPlanGenerate> selectScBreedPlanGenerateList(ScBreedPlanGenerate scBreedPlanGenerate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的母羊
|
||||||
|
*
|
||||||
|
* @return 符合条件的母羊列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectEligibleEwe();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的公羊
|
||||||
|
*
|
||||||
|
* @return 符合条件的公羊列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectEligibleRam();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动生成配种计划
|
||||||
|
*
|
||||||
|
* @param eweIds 母羊ID列表
|
||||||
|
* @param ramIds 公羊ID列表
|
||||||
|
* @return 生成的配种计划
|
||||||
|
*/
|
||||||
|
public ScBreedPlanGenerate autoGenerateBreedPlan(List<Long> eweIds, List<Long> ramIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划生成
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划生成
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批配种计划
|
||||||
|
*
|
||||||
|
* @param id 配种计划ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int approveBreedPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配种计划详情
|
||||||
|
*
|
||||||
|
* @param id 配种计划ID
|
||||||
|
* @return 配种计划详情
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getBreedPlanDetails(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除配种计划生成
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的配种计划生成主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanGenerateByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划生成信息
|
||||||
|
*
|
||||||
|
* @param id 配种计划生成主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanGenerateById(Long id);
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
public interface IScBreedPlanService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询配种计划
|
||||||
|
*
|
||||||
|
* @param id 配种计划主键
|
||||||
|
* @return 配种计划
|
||||||
|
*/
|
||||||
|
public ScBreedPlan selectScBreedPlanById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划列表
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 配种计划集合
|
||||||
|
*/
|
||||||
|
public List<ScBreedPlan> selectScBreedPlanList(ScBreedPlan scBreedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertScBreedPlan(ScBreedPlan scBreedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateScBreedPlan(ScBreedPlan scBreedPlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除配种计划
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的配种计划主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划信息
|
||||||
|
*
|
||||||
|
* @param id 配种计划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteScBreedPlanById(Long id);
|
||||||
|
}
|
@ -0,0 +1,240 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import com.zhyc.common.utils.SecurityUtils;
|
||||||
|
import com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanGenerateMapper;
|
||||||
|
import com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanMapper;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanGenerateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划生成Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ScBreedPlanGenerateMapper scBreedPlanGenerateMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScBreedPlanMapper scBreedPlanMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成
|
||||||
|
*
|
||||||
|
* @param id 配种计划生成主键
|
||||||
|
* @return 配种计划生成
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ScBreedPlanGenerate selectScBreedPlanGenerateById(Long id)
|
||||||
|
{
|
||||||
|
return scBreedPlanGenerateMapper.selectScBreedPlanGenerateById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划生成列表
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 配种计划生成
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ScBreedPlanGenerate> selectScBreedPlanGenerateList(ScBreedPlanGenerate scBreedPlanGenerate)
|
||||||
|
{
|
||||||
|
return scBreedPlanGenerateMapper.selectScBreedPlanGenerateList(scBreedPlanGenerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的母羊
|
||||||
|
*
|
||||||
|
* @return 符合条件的母羊列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectEligibleEwe()
|
||||||
|
{
|
||||||
|
return scBreedPlanGenerateMapper.selectEligibleEwe();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选符合条件的公羊
|
||||||
|
*
|
||||||
|
* @return 符合条件的公羊列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectEligibleRam()
|
||||||
|
{
|
||||||
|
return scBreedPlanGenerateMapper.selectEligibleRam();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动生成配种计划
|
||||||
|
*
|
||||||
|
* @param eweIds 母羊ID列表
|
||||||
|
* @param ramIds 公羊ID列表
|
||||||
|
* @return 生成的配种计划
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ScBreedPlanGenerate autoGenerateBreedPlan(List<Long> eweIds, List<Long> ramIds)
|
||||||
|
{
|
||||||
|
// 创建配种计划生成记录
|
||||||
|
ScBreedPlanGenerate planGenerate = new ScBreedPlanGenerate();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String dateStr = sdf.format(new Date());
|
||||||
|
planGenerate.setPlanName(dateStr + "同期发情配种计划");
|
||||||
|
planGenerate.setPlanType(1);
|
||||||
|
planGenerate.setPlanDate(new Date());
|
||||||
|
planGenerate.setTotalEweCount(eweIds.size());
|
||||||
|
planGenerate.setTotalRamCount(ramIds.size());
|
||||||
|
|
||||||
|
// 计算配种比例
|
||||||
|
double ratio = (double) eweIds.size() / ramIds.size();
|
||||||
|
planGenerate.setBreedRatio(String.format("%.1f:1", ratio));
|
||||||
|
planGenerate.setStatus(0); // 待审批
|
||||||
|
planGenerate.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
planGenerate.setCreateTime(new Date());
|
||||||
|
|
||||||
|
// 保存配种计划生成记录
|
||||||
|
scBreedPlanGenerateMapper.insertScBreedPlanGenerate(planGenerate);
|
||||||
|
|
||||||
|
// 生成具体的配种计划
|
||||||
|
generateBreedPlanDetails(planGenerate.getId(), eweIds, ramIds);
|
||||||
|
|
||||||
|
return planGenerate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成具体的配种计划详情
|
||||||
|
*/
|
||||||
|
private void generateBreedPlanDetails(Long planGenerateId, List<Long> eweIds, List<Long> ramIds)
|
||||||
|
{
|
||||||
|
int ramIndex = 0;
|
||||||
|
int ewesPerRam = (int) Math.ceil((double) eweIds.size() / ramIds.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < eweIds.size(); i++) {
|
||||||
|
ScBreedPlan breedPlan = new ScBreedPlan();
|
||||||
|
breedPlan.setRamId(ramIds.get(ramIndex).toString());
|
||||||
|
breedPlan.setEweId(eweIds.get(i).toString());
|
||||||
|
breedPlan.setBreedType(1L); // 默认配种类型
|
||||||
|
|
||||||
|
// 插入临时配种计划,关联到生成记录
|
||||||
|
scBreedPlanGenerateMapper.insertTempBreedPlan(planGenerateId, breedPlan);
|
||||||
|
|
||||||
|
// 每个公羊配种指定数量的母羊后,切换到下一个公羊
|
||||||
|
if ((i + 1) % ewesPerRam == 0 && ramIndex < ramIds.size() - 1) {
|
||||||
|
ramIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划生成
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate)
|
||||||
|
{
|
||||||
|
scBreedPlanGenerate.setCreateTime(new Date());
|
||||||
|
return scBreedPlanGenerateMapper.insertScBreedPlanGenerate(scBreedPlanGenerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划生成
|
||||||
|
*
|
||||||
|
* @param scBreedPlanGenerate 配种计划生成
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate)
|
||||||
|
{
|
||||||
|
scBreedPlanGenerate.setUpdateTime(new Date());
|
||||||
|
return scBreedPlanGenerateMapper.updateScBreedPlanGenerate(scBreedPlanGenerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批配种计划
|
||||||
|
*
|
||||||
|
* @param id 配种计划ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int approveBreedPlan(Long id)
|
||||||
|
{
|
||||||
|
// 更新审批状态
|
||||||
|
ScBreedPlanGenerate planGenerate = new ScBreedPlanGenerate();
|
||||||
|
planGenerate.setId(id);
|
||||||
|
planGenerate.setStatus(1); // 已审批
|
||||||
|
planGenerate.setApprover(SecurityUtils.getUsername());
|
||||||
|
planGenerate.setApproveTime(new Date());
|
||||||
|
planGenerate.setUpdateTime(new Date());
|
||||||
|
|
||||||
|
int result = scBreedPlanGenerateMapper.updateScBreedPlanGenerate(planGenerate);
|
||||||
|
|
||||||
|
// 将临时配种计划转为正式配种计划
|
||||||
|
if (result > 0) {
|
||||||
|
scBreedPlanGenerateMapper.transferTempToFormal(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配种计划详情
|
||||||
|
*
|
||||||
|
* @param id 配种计划ID
|
||||||
|
* @return 配种计划详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getBreedPlanDetails(Long id)
|
||||||
|
{
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
|
// 获取配种计划基本信息
|
||||||
|
ScBreedPlanGenerate planGenerate = scBreedPlanGenerateMapper.selectScBreedPlanGenerateById(id);
|
||||||
|
result.put("planInfo", planGenerate);
|
||||||
|
|
||||||
|
// 获取配种计划详情列表
|
||||||
|
List<Map<String, Object>> planDetails = scBreedPlanGenerateMapper.selectBreedPlanDetails(id);
|
||||||
|
result.put("planDetails", planDetails);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除配种计划生成
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的配种计划生成主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteScBreedPlanGenerateByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return scBreedPlanGenerateMapper.deleteScBreedPlanGenerateByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划生成信息
|
||||||
|
*
|
||||||
|
* @param id 配种计划生成主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteScBreedPlanGenerateById(Long id)
|
||||||
|
{
|
||||||
|
return scBreedPlanGenerateMapper.deleteScBreedPlanGenerateById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.zhyc.module.produce.mating_plan.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanMapper;
|
||||||
|
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
|
||||||
|
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配种计划Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ScBreedPlanServiceImpl implements IScBreedPlanService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ScBreedPlanMapper scBreedPlanMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划
|
||||||
|
*
|
||||||
|
* @param id 配种计划主键
|
||||||
|
* @return 配种计划
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ScBreedPlan selectScBreedPlanById(Long id)
|
||||||
|
{
|
||||||
|
return scBreedPlanMapper.selectScBreedPlanById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配种计划列表
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 配种计划
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ScBreedPlan> selectScBreedPlanList(ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
return scBreedPlanMapper.selectScBreedPlanList(scBreedPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配种计划
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertScBreedPlan(ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
return scBreedPlanMapper.insertScBreedPlan(scBreedPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配种计划
|
||||||
|
*
|
||||||
|
* @param scBreedPlan 配种计划
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateScBreedPlan(ScBreedPlan scBreedPlan)
|
||||||
|
{
|
||||||
|
return scBreedPlanMapper.updateScBreedPlan(scBreedPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除配种计划
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的配种计划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteScBreedPlanByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return scBreedPlanMapper.deleteScBreedPlanByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配种计划信息
|
||||||
|
*
|
||||||
|
* @param id 配种计划主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteScBreedPlanById(Long id)
|
||||||
|
{
|
||||||
|
return scBreedPlanMapper.deleteScBreedPlanById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -65,4 +65,12 @@ public interface ScWeanRecordMapper {
|
|||||||
* @return 羊只ID
|
* @return 羊只ID
|
||||||
*/
|
*/
|
||||||
public Long selectSheepIdByEarNumber(String earNumber);
|
public Long selectSheepIdByEarNumber(String earNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据耳号更新bas_sheep表中的断奶信息
|
||||||
|
*
|
||||||
|
* @param scWeanRecord 断奶记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper;
|
import com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper;
|
||||||
import com.zhyc.module.produce.wean.domain.ScWeanRecord;
|
import com.zhyc.module.produce.wean.domain.ScWeanRecord;
|
||||||
import com.zhyc.module.produce.wean.service.IScWeanRecordService;
|
import com.zhyc.module.produce.wean.service.IScWeanRecordService;
|
||||||
@ -48,6 +49,7 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertScWeanRecord(ScWeanRecord scWeanRecord) {
|
public int insertScWeanRecord(ScWeanRecord scWeanRecord) {
|
||||||
// 如果前端传递的是耳号,需要先获取羊只ID
|
// 如果前端传递的是耳号,需要先获取羊只ID
|
||||||
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
|
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
|
||||||
@ -57,7 +59,16 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
scWeanRecord.setCreateTime(DateUtils.getNowDate());
|
scWeanRecord.setCreateTime(DateUtils.getNowDate());
|
||||||
return scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
|
|
||||||
|
// 插入断奶记录
|
||||||
|
int result = scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
|
||||||
|
|
||||||
|
// 同步更新bas_sheep表中的断奶信息
|
||||||
|
if (result > 0 && scWeanRecord.getEarNumber() != null) {
|
||||||
|
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,6 +78,7 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateScWeanRecord(ScWeanRecord scWeanRecord) {
|
public int updateScWeanRecord(ScWeanRecord scWeanRecord) {
|
||||||
// 如果前端传递的是耳号,需要先获取羊只ID
|
// 如果前端传递的是耳号,需要先获取羊只ID
|
||||||
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
|
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
|
||||||
@ -75,7 +87,16 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
|
|||||||
scWeanRecord.setSheepId(sheepId);
|
scWeanRecord.setSheepId(sheepId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
|
|
||||||
|
// 更新断奶记录
|
||||||
|
int result = scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
|
||||||
|
|
||||||
|
// 同步更新bas_sheep表中的断奶信息
|
||||||
|
if (result > 0 && scWeanRecord.getEarNumber() != null) {
|
||||||
|
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,6 +119,17 @@
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 根据耳号更新bas_sheep表中的断奶信息 -->
|
||||||
|
<update id="updateBasSheepWeaningInfo" parameterType="ScWeanRecord">
|
||||||
|
update bas_sheep
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="datetime != null">weaning_date = #{datetime},</if>
|
||||||
|
<if test="weight != null">weaning_weight = #{weight},</if>
|
||||||
|
<if test="electronicTags != null and electronicTags != ''">electronic_tags = #{electronicTags},</if>
|
||||||
|
</trim>
|
||||||
|
where manage_tags = #{earNumber}
|
||||||
|
</update>
|
||||||
|
|
||||||
<!-- 删除断奶记录 -->
|
<!-- 删除断奶记录 -->
|
||||||
<delete id="deleteScWeanRecordById" parameterType="Long">
|
<delete id="deleteScWeanRecordById" parameterType="Long">
|
||||||
delete from sc_wean_record where id = #{id}
|
delete from sc_wean_record where id = #{id}
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
<?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">
|
||||||
|
<mapper namespace="com.zhyc.module.produce.drymilk.mapper.ScDryMilkMapper">
|
||||||
|
|
||||||
|
<resultMap type="ScDryMilk" id="ScDryMilkResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="sheepId" column="sheep_id" />
|
||||||
|
<result property="datetime" column="datetime" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="sheepfold" column="sheepfold" />
|
||||||
|
<result property="tecahnician" column="tecahnician" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="comment" column="comment" />
|
||||||
|
<!-- 联表查询字段 -->
|
||||||
|
<result property="manageTags" column="bs_manage_tags" />
|
||||||
|
<result property="variety" column="variety" />
|
||||||
|
<result property="sheepfoldName" column="sheepfold_name" />
|
||||||
|
<result property="eventType" column="event_type" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectScDryMilkVo">
|
||||||
|
select d.id, d.sheep_id, d.datetime, d.status, d.sheepfold, d.tecahnician,
|
||||||
|
d.create_by, d.create_time, d.comment,
|
||||||
|
s.bs_manage_tags, s.variety, s.sheepfold_name,
|
||||||
|
'干奶' as event_type
|
||||||
|
from sc_dry_milk d
|
||||||
|
left join sheep_file s on d.sheep_id = s.id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
|
||||||
|
<include refid="selectScDryMilkVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="sheepId != null and sheepId != ''"> and d.sheep_id = #{sheepId}</if>
|
||||||
|
<if test="manageTags != null and manageTags != ''"> and s.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
|
||||||
|
<if test="datetime != null "> and d.datetime = #{datetime}</if>
|
||||||
|
<if test="status != null "> and d.status = #{status}</if>
|
||||||
|
<if test="sheepfold != null "> and d.sheepfold = #{sheepfold}</if>
|
||||||
|
<if test="tecahnician != null and tecahnician != ''"> and d.tecahnician like concat('%', #{tecahnician}, '%')</if>
|
||||||
|
<if test="createBy != null and createBy != ''"> and d.create_by = #{createBy}</if>
|
||||||
|
<if test="createTime != null "> and d.create_time = #{createTime}</if>
|
||||||
|
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
|
||||||
|
</where>
|
||||||
|
order by d.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
|
||||||
|
<include refid="selectScDryMilkVo"/>
|
||||||
|
where d.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据耳号查询羊只ID -->
|
||||||
|
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||||
|
select id from sheep_file where bs_manage_tags = #{manageTags}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertScDryMilk" parameterType="ScDryMilk" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sc_dry_milk
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="sheepId != null">sheep_id,</if>
|
||||||
|
<if test="datetime != null">datetime,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="sheepfold != null">sheepfold,</if>
|
||||||
|
<if test="tecahnician != null">tecahnician,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="comment != null">comment,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
|
<if test="datetime != null">#{datetime},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="sheepfold != null">#{sheepfold},</if>
|
||||||
|
<if test="tecahnician != null">#{tecahnician},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="comment != null">#{comment},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateScDryMilk" parameterType="ScDryMilk">
|
||||||
|
update sc_dry_milk
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||||
|
<if test="datetime != null">datetime = #{datetime},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
||||||
|
<if test="tecahnician != null">tecahnician = #{tecahnician},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteScDryMilkById" parameterType="Long">
|
||||||
|
delete from sc_dry_milk where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteScDryMilkByIds" parameterType="String">
|
||||||
|
delete from sc_dry_milk where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
@ -0,0 +1,208 @@
|
|||||||
|
<?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">
|
||||||
|
<mapper namespace="com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanGenerateMapper">
|
||||||
|
|
||||||
|
<resultMap type="ScBreedPlanGenerate" id="ScBreedPlanGenerateResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="planName" column="plan_name" />
|
||||||
|
<result property="planType" column="plan_type" />
|
||||||
|
<result property="planDate" column="plan_date" />
|
||||||
|
<result property="totalEweCount" column="total_ewe_count" />
|
||||||
|
<result property="totalRamCount" column="total_ram_count" />
|
||||||
|
<result property="breedRatio" column="breed_ratio" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="approver" column="approver" />
|
||||||
|
<result property="approveTime" column="approve_time" />
|
||||||
|
<result property="approveRemark" column="approve_remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectScBreedPlanGenerateVo">
|
||||||
|
select id, plan_name, plan_type, plan_date, total_ewe_count, total_ram_count,
|
||||||
|
breed_ratio, status, approver, approve_time, approve_remark,
|
||||||
|
create_by, create_time, update_by, update_time
|
||||||
|
from sc_breed_plan_generate
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectScBreedPlanGenerateList" parameterType="ScBreedPlanGenerate" resultMap="ScBreedPlanGenerateResult">
|
||||||
|
<include refid="selectScBreedPlanGenerateVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
|
||||||
|
<if test="planType != null"> and plan_type = #{planType}</if>
|
||||||
|
<if test="planDate != null"> and plan_date = #{planDate}</if>
|
||||||
|
<if test="status != null"> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectScBreedPlanGenerateById" parameterType="Long" resultMap="ScBreedPlanGenerateResult">
|
||||||
|
<include refid="selectScBreedPlanGenerateVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 筛选符合条件的母羊 -->
|
||||||
|
<select id="selectEligibleEwe" resultType="Map">
|
||||||
|
select
|
||||||
|
sf.id,
|
||||||
|
sf.bs_manage_tags,
|
||||||
|
sf.variety,
|
||||||
|
sf.name as sheep_type,
|
||||||
|
sf.gender,
|
||||||
|
sf.month_age,
|
||||||
|
sf.current_weight,
|
||||||
|
sf.post_lambing_day,
|
||||||
|
sf.breed
|
||||||
|
from sheep_file sf
|
||||||
|
where sf.gender = 1
|
||||||
|
and sf.is_delete = 0
|
||||||
|
and (sf.status_id = 1 or sf.status_id is null)
|
||||||
|
and (
|
||||||
|
-- 青年羊或超龄羊的配种条件
|
||||||
|
(sf.name in ('青年羊', '超龄羊') and (
|
||||||
|
(sf.variety = '湖羊' and sf.month_age >= 7.5 and sf.current_weight >= 33) or
|
||||||
|
(sf.variety = '东佛里生' and sf.month_age >= 9 and sf.current_weight >= 50) or
|
||||||
|
(sf.variety not in ('湖羊', '东佛里生') and sf.month_age >= 9 and sf.current_weight >= 50)
|
||||||
|
))
|
||||||
|
or
|
||||||
|
-- 泌乳羊或种母羊的配种条件
|
||||||
|
(sf.name in ('泌乳羊', '种母羊') and sf.post_lambing_day > 45 and sf.current_weight > 0)
|
||||||
|
)
|
||||||
|
order by sf.variety, sf.month_age desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 筛选符合条件的公羊 -->
|
||||||
|
<select id="selectEligibleRam" resultType="Map">
|
||||||
|
select
|
||||||
|
sf.id,
|
||||||
|
sf.manage_tags as bs_manage_tags,
|
||||||
|
bv.variety as variety,
|
||||||
|
bst.name as sheep_type,
|
||||||
|
sf.gender,
|
||||||
|
TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) as month_age,
|
||||||
|
sf.current_weight,
|
||||||
|
bbs.breed as breed
|
||||||
|
from bas_sheep sf
|
||||||
|
left join bas_sheep_variety bv on sf.variety_id = bv.id
|
||||||
|
left join bas_sheep_type bst on sf.type_id = bst.id
|
||||||
|
left join bas_breed_status bbs on sf.breed_status_id = bbs.id
|
||||||
|
where sf.gender = 2
|
||||||
|
and sf.is_delete = 0
|
||||||
|
and sf.status_id = 1
|
||||||
|
and (
|
||||||
|
-- 青年羊或超龄羊的参配条件
|
||||||
|
(bst.name in ('青年羊', '超龄羊') and (
|
||||||
|
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 7.5 and sf.current_weight >= 33) or
|
||||||
|
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50) or
|
||||||
|
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50)
|
||||||
|
))
|
||||||
|
or
|
||||||
|
-- 其他类型公羊
|
||||||
|
bst.name not in ('青年羊', '超龄羊')
|
||||||
|
)
|
||||||
|
order by bv.variety, TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertScBreedPlanGenerate" parameterType="ScBreedPlanGenerate" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sc_breed_plan_generate
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="planName != null">plan_name,</if>
|
||||||
|
<if test="planType != null">plan_type,</if>
|
||||||
|
<if test="planDate != null">plan_date,</if>
|
||||||
|
<if test="totalEweCount != null">total_ewe_count,</if>
|
||||||
|
<if test="totalRamCount != null">total_ram_count,</if>
|
||||||
|
<if test="breedRatio != null">breed_ratio,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="approver != null">approver,</if>
|
||||||
|
<if test="approveTime != null">approve_time,</if>
|
||||||
|
<if test="approveRemark != null">approve_remark,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="planName != null">#{planName},</if>
|
||||||
|
<if test="planType != null">#{planType},</if>
|
||||||
|
<if test="planDate != null">#{planDate},</if>
|
||||||
|
<if test="totalEweCount != null">#{totalEweCount},</if>
|
||||||
|
<if test="totalRamCount != null">#{totalRamCount},</if>
|
||||||
|
<if test="breedRatio != null">#{breedRatio},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="approver != null">#{approver},</if>
|
||||||
|
<if test="approveTime != null">#{approveTime},</if>
|
||||||
|
<if test="approveRemark != null">#{approveRemark},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 插入临时配种计划 -->
|
||||||
|
<insert id="insertTempBreedPlan">
|
||||||
|
insert into sc_breed_plan_temp (plan_generate_id, ram_id, ewe_id, breed_type, create_time)
|
||||||
|
values (#{planGenerateId}, #{breedPlan.ramId}, #{breedPlan.eweId}, #{breedPlan.breedType}, now())
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateScBreedPlanGenerate" parameterType="ScBreedPlanGenerate">
|
||||||
|
update sc_breed_plan_generate
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="planName != null">plan_name = #{planName},</if>
|
||||||
|
<if test="planType != null">plan_type = #{planType},</if>
|
||||||
|
<if test="planDate != null">plan_date = #{planDate},</if>
|
||||||
|
<if test="totalEweCount != null">total_ewe_count = #{totalEweCount},</if>
|
||||||
|
<if test="totalRamCount != null">total_ram_count = #{totalRamCount},</if>
|
||||||
|
<if test="breedRatio != null">breed_ratio = #{breedRatio},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="approver != null">approver = #{approver},</if>
|
||||||
|
<if test="approveTime != null">approve_time = #{approveTime},</if>
|
||||||
|
<if test="approveRemark != null">approve_remark = #{approveRemark},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 将临时配种计划转为正式配种计划 -->
|
||||||
|
<insert id="transferTempToFormal">
|
||||||
|
insert into sc_breed_plan (ram_id, ewe_id, breed_type)
|
||||||
|
select ram_id, ewe_id, breed_type
|
||||||
|
from sc_breed_plan_temp
|
||||||
|
where plan_generate_id = #{planGenerateId}
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 获取配种计划详情 -->
|
||||||
|
<select id="selectBreedPlanDetails" parameterType="Long" resultType="Map">
|
||||||
|
select
|
||||||
|
temp.id,
|
||||||
|
temp.ram_id,
|
||||||
|
temp.ewe_id,
|
||||||
|
temp.breed_type,
|
||||||
|
ram.bs_manage_tags as ram_manage_tags,
|
||||||
|
ram.variety as ram_variety,
|
||||||
|
ewe.bs_manage_tags as ewe_manage_tags,
|
||||||
|
ewe.variety as ewe_variety,
|
||||||
|
ewe.current_weight as ewe_weight
|
||||||
|
from sc_breed_plan_temp temp
|
||||||
|
left join sheep_file ram on temp.ram_id = ram.id
|
||||||
|
left join sheep_file ewe on temp.ewe_id = ewe.id
|
||||||
|
where temp.plan_generate_id = #{planGenerateId}
|
||||||
|
order by temp.ram_id, temp.ewe_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteScBreedPlanGenerateById" parameterType="Long">
|
||||||
|
delete from sc_breed_plan_generate where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteScBreedPlanGenerateByIds" parameterType="String">
|
||||||
|
delete from sc_breed_plan_generate where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
@ -0,0 +1,66 @@
|
|||||||
|
<?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">
|
||||||
|
<mapper namespace="com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanMapper">
|
||||||
|
|
||||||
|
<resultMap type="ScBreedPlan" id="ScBreedPlanResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="ramId" column="ram_id" />
|
||||||
|
<result property="eweId" column="ewe_id" />
|
||||||
|
<result property="breedType" column="breed_type" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectScBreedPlanVo">
|
||||||
|
select id, ram_id, ewe_id, breed_type from sc_breed_plan
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectScBreedPlanList" parameterType="ScBreedPlan" resultMap="ScBreedPlanResult">
|
||||||
|
<include refid="selectScBreedPlanVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="ramId != null and ramId != ''"> and ram_id = #{ramId}</if>
|
||||||
|
<if test="eweId != null and eweId != ''"> and ewe_id = #{eweId}</if>
|
||||||
|
<if test="breedType != null "> and breed_type = #{breedType}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectScBreedPlanById" parameterType="Long" resultMap="ScBreedPlanResult">
|
||||||
|
<include refid="selectScBreedPlanVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertScBreedPlan" parameterType="ScBreedPlan" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sc_breed_plan
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ramId != null">ram_id,</if>
|
||||||
|
<if test="eweId != null">ewe_id,</if>
|
||||||
|
<if test="breedType != null">breed_type,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ramId != null">#{ramId},</if>
|
||||||
|
<if test="eweId != null">#{eweId},</if>
|
||||||
|
<if test="breedType != null">#{breedType},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateScBreedPlan" parameterType="ScBreedPlan">
|
||||||
|
update sc_breed_plan
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="ramId != null">ram_id = #{ramId},</if>
|
||||||
|
<if test="eweId != null">ewe_id = #{eweId},</if>
|
||||||
|
<if test="breedType != null">breed_type = #{breedType},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteScBreedPlanById" parameterType="Long">
|
||||||
|
delete from sc_breed_plan where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteScBreedPlanByIds" parameterType="String">
|
||||||
|
delete from sc_breed_plan where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user