Compare commits
23 Commits
refactor/d
...
57b5415405
| Author | SHA1 | Date | |
|---|---|---|---|
| 57b5415405 | |||
| e233d50b56 | |||
| 72a671fac2 | |||
|
|
f138074f70 | ||
|
|
163cf5e578 | ||
| 504a6a6203 | |||
| 2f6a1a9600 | |||
|
|
5436cb1071 | ||
|
|
7b3f879198 | ||
| 4c6d3f1c49 | |||
| 21eedb8508 | |||
| fa65442f58 | |||
| 52a61c0567 | |||
| 4ab62cd1f2 | |||
|
|
2f0e80868e | ||
| b47aa9b269 | |||
| 5a2f59b02d | |||
| 40fc60ddc9 | |||
| 464126195d | |||
|
|
8f9944d069 | ||
|
|
1736b51fea | ||
| f0acd149c7 | |||
| 086cb43359 |
@@ -76,6 +76,9 @@ public class SysDeptController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (!deptService.checkRanchName(dept)){
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,牧场名称已存在");
|
||||
}
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataScope
|
||||
|
||||
@@ -31,6 +31,10 @@ public class SysDept extends BaseEntity
|
||||
/** 部门名称 */
|
||||
private String deptName;
|
||||
|
||||
/** 牧场id */
|
||||
private Long ranchId;
|
||||
private String ranchName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer orderNum;
|
||||
|
||||
@@ -55,6 +59,22 @@ public class SysDept extends BaseEntity
|
||||
/** 子部门 */
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
public String getRanchName() {
|
||||
return ranchName;
|
||||
}
|
||||
|
||||
public void setRanchName(String ranchName) {
|
||||
this.ranchName = ranchName;
|
||||
}
|
||||
|
||||
public Long getRanchId() {
|
||||
return ranchId;
|
||||
}
|
||||
|
||||
public void setRanchId(Long ranchId) {
|
||||
this.ranchId = ranchId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zhyc.common.core.domain.entity;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 牧场管理对象 da_ranch
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public class SysRanch extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 牧场名称 */
|
||||
private String ranch;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRanch() {
|
||||
return ranch;
|
||||
}
|
||||
|
||||
public void setRanch(String ranch) {
|
||||
this.ranch = ranch;
|
||||
}
|
||||
}
|
||||
@@ -201,6 +201,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -46,6 +46,7 @@ public class BasSheepController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
//查询耳号列表
|
||||
@GetMapping("/earNumbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
@@ -136,7 +137,6 @@ public class BasSheepController extends BaseController {
|
||||
}
|
||||
BasSheep query = new BasSheep();
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -153,7 +153,6 @@ public class BasSheepController extends BaseController {
|
||||
BasSheep query = new BasSheep();
|
||||
query.setSheepfoldId(sheepfoldId.longValue());
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -190,7 +189,6 @@ public class BasSheepController extends BaseController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断耳号是否存在(用于新增羊只时校验)
|
||||
*/
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DaRanchController extends BaseController
|
||||
/**
|
||||
* 获取指定牧场下的所有羊只耳号
|
||||
*/
|
||||
// @GetMapping("/getSheepByRanchId/{ranchId}")
|
||||
@GetMapping("/getSheepByRanchId/{ranchId}")
|
||||
public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) {
|
||||
List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId);
|
||||
return AjaxResult.success(sheepList);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.base.domain.DaSheepfoldSummaryExportVO;
|
||||
import com.zhyc.module.base.service.IDaSheepfoldService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -44,6 +45,17 @@ public class DaSheepfoldController extends BaseController
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主表格:羊舍级别汇总列表
|
||||
*/
|
||||
@GetMapping("/summaryList")
|
||||
public TableDataInfo summaryList(DaSheepfold daSheepfold) {
|
||||
startPage();
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/*
|
||||
* 根据羊舍ids查询羊只id
|
||||
* */
|
||||
@@ -69,6 +81,73 @@ public class DaSheepfoldController extends BaseController
|
||||
util.exportExcel(response, list, "羊舍管理数据");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出羊舍管理汇总列表(主表格数据)- 新增方法
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:export')")
|
||||
@Log(title = "羊舍管理汇总导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportSummary")
|
||||
public void exportSummary(HttpServletResponse response, DaSheepfold daSheepfold) {
|
||||
// 1. 查询汇总数据
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
|
||||
// 2. 转换为导出VO
|
||||
List<DaSheepfoldSummaryExportVO> exportList = convertToExportVO(list);
|
||||
|
||||
// 3. 使用VO类导出Excel
|
||||
ExcelUtil<DaSheepfoldSummaryExportVO> util = new ExcelUtil<>(DaSheepfoldSummaryExportVO.class);
|
||||
util.exportExcel(response, exportList, "羊舍管理汇总数据");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将DaSheepfold列表转换为导出VO列表
|
||||
*/
|
||||
private List<DaSheepfoldSummaryExportVO> convertToExportVO(List<DaSheepfold> daSheepfoldList) {
|
||||
List<DaSheepfoldSummaryExportVO> voList = new ArrayList<>();
|
||||
|
||||
for (DaSheepfold entity : daSheepfoldList) {
|
||||
DaSheepfoldSummaryExportVO vo = new DaSheepfoldSummaryExportVO();
|
||||
|
||||
// 字典翻译:牧场ID -> 牧场名称
|
||||
if (entity.getRanchId() != null) {
|
||||
String ranchName = DictUtils.getDictLabel("da_ranch", entity.getRanchId().toString());
|
||||
vo.setRanchName(ranchName != null ? ranchName : entity.getRanchId().toString());
|
||||
} else {
|
||||
vo.setRanchName("");
|
||||
}
|
||||
|
||||
// 使用汇总查询中的羊舍名称
|
||||
vo.setSheepfoldName(entity.getSheepfoldName() != null ? entity.getSheepfoldName() : "");
|
||||
|
||||
// 字典翻译:羊舍类型ID -> 羊舍类型名称
|
||||
if (entity.getSheepfoldTypeId() != null) {
|
||||
String typeName = DictUtils.getDictLabel("bas_sheepfold_type", entity.getSheepfoldTypeId().toString());
|
||||
vo.setSheepfoldTypeName(typeName != null ? typeName : entity.getSheepfoldTypeId().toString());
|
||||
} else {
|
||||
vo.setSheepfoldTypeName("");
|
||||
}
|
||||
|
||||
// 羊舍编号
|
||||
vo.setSheepfoldNo(entity.getSheepfoldNo() != null ? entity.getSheepfoldNo() : "");
|
||||
|
||||
// 羊数(确保不为空)
|
||||
vo.setTotalSheepCount(entity.getTotalSheepCount() != null ? entity.getTotalSheepCount() : 0);
|
||||
|
||||
// 备注
|
||||
vo.setComment(entity.getComment() != null ? entity.getComment() : "");
|
||||
|
||||
voList.add(vo);
|
||||
}
|
||||
|
||||
return voList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取羊舍管理详细信息
|
||||
*/
|
||||
@@ -101,16 +180,74 @@ public class DaSheepfoldController extends BaseController
|
||||
return toAjax(daSheepfoldService.updateDaSheepfold(daSheepfold));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 删除羊舍管理
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:remove')")
|
||||
// @Log(title = "羊舍管理", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public AjaxResult remove(@PathVariable Long[] ids)
|
||||
// {
|
||||
// return toAjax(daSheepfoldService.deleteDaSheepfoldByIds(ids));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除羊舍管理
|
||||
* 修改后:根据组合条件删除羊圈信息(单条)
|
||||
* 接收ranch_id/sheepfold_no/sheepfold_type_id/sheepfold_name组合条件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:remove')")
|
||||
@Log(title = "羊舍管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(daSheepfoldService.deleteDaSheepfoldByIds(ids));
|
||||
@PreAuthorize("@ss.hasPermi('sheep:sheepfold:remove')")
|
||||
@DeleteMapping("/deleteByCondition")
|
||||
public AjaxResult removeByCondition(@RequestBody DaSheepfold sheepfold) {
|
||||
// 1. 校验核心条件非空(避免条件缺失导致误删)
|
||||
if (sheepfold.getRanchId() == null
|
||||
|| sheepfold.getSheepfoldNo() == null || sheepfold.getSheepfoldNo().isEmpty()
|
||||
|| sheepfold.getSheepfoldTypeId() == null) {
|
||||
return AjaxResult.error("删除失败:核心条件(牧场ID/羊圈编号/羊圈类型ID)不能为空");
|
||||
}
|
||||
// 2. 调用Service执行组合条件删除
|
||||
boolean deleteResult = daSheepfoldService.deleteSheepfoldByCondition(sheepfold);
|
||||
if (deleteResult) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败:未找到匹配条件的记录");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 【扩展】批量删除:接收多条组合条件数据,循环删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep:sheepfold:remove')")
|
||||
@DeleteMapping("/batchDeleteByCondition")
|
||||
public AjaxResult batchRemoveByCondition(@RequestBody List<DaSheepfold> sheepfoldList) {
|
||||
if (sheepfoldList == null || sheepfoldList.isEmpty()) {
|
||||
return AjaxResult.error("删除失败:请选择要删除的羊圈数据");
|
||||
}
|
||||
// 统计成功删除的数量
|
||||
int successCount = 0;
|
||||
for (DaSheepfold sheepfold : sheepfoldList) {
|
||||
// 跳过条件不全的记录
|
||||
if (sheepfold.getRanchId() == null
|
||||
|| sheepfold.getSheepfoldNo() == null || sheepfold.getSheepfoldNo().isEmpty()
|
||||
|| sheepfold.getSheepfoldTypeId() == null) {
|
||||
continue;
|
||||
}
|
||||
if (daSheepfoldService.deleteSheepfoldByCondition(sheepfold)) {
|
||||
successCount++;
|
||||
}
|
||||
}
|
||||
if (successCount == 0) {
|
||||
return AjaxResult.error("批量删除失败:无符合条件的记录可删除");
|
||||
} else {
|
||||
return AjaxResult.success("批量删除成功,共删除" + successCount + "条记录");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 检查羊舍编号是否已存在
|
||||
*/
|
||||
|
||||
@@ -115,5 +115,10 @@ public class DaSheepfold extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// 非数据库字段:单栏位羊数(子表格用)
|
||||
private Integer sheepCount;
|
||||
// 非数据库字段:羊舍总羊数(主表格用)
|
||||
private Integer totalSheepCount;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zhyc.module.base.domain;
|
||||
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍汇总导出VO
|
||||
*/
|
||||
@Data
|
||||
public class DaSheepfoldSummaryExportVO {
|
||||
|
||||
/** 牧场名称 */
|
||||
@Excel(name = "牧场")
|
||||
private String ranchName;
|
||||
|
||||
/** 羊舍名称 */
|
||||
@Excel(name = "羊舍名称")
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 羊舍类型名称 */
|
||||
@Excel(name = "羊舍类型")
|
||||
|
||||
private String sheepfoldTypeName;
|
||||
|
||||
/** 羊舍编号 */
|
||||
@Excel(name = "羊舍编号")
|
||||
private String sheepfoldNo;
|
||||
|
||||
/** 羊舍总羊数 */
|
||||
@Excel(name = "羊数")
|
||||
private Integer totalSheepCount;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// 构造函数
|
||||
public DaSheepfoldSummaryExportVO() {
|
||||
}
|
||||
|
||||
public DaSheepfoldSummaryExportVO(String ranchName, String sheepfoldName,
|
||||
String sheepfoldTypeName, String sheepfoldNo,
|
||||
Integer totalSheepCount, String comment) {
|
||||
this.ranchName = ranchName;
|
||||
this.sheepfoldName = sheepfoldName;
|
||||
this.sheepfoldTypeName = sheepfoldTypeName;
|
||||
this.sheepfoldNo = sheepfoldNo;
|
||||
this.totalSheepCount = totalSheepCount;
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 创建文件:ExportConfig.java
|
||||
package com.zhyc.module.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 导出配置类
|
||||
*/
|
||||
@Data
|
||||
public class ExportConfig {
|
||||
/**
|
||||
* 要导出的列名列表(前端传递的驼峰命名)
|
||||
*/
|
||||
private List<String> columnNames;
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*/
|
||||
private Map<String, Object> queryParams;
|
||||
|
||||
/**
|
||||
* 自定义筛选条件
|
||||
*/
|
||||
private Map<String, Object> customFilterParams;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.base.mapper;
|
||||
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,6 +31,12 @@ public interface DaSheepfoldMapper
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
@@ -64,4 +71,12 @@ public interface DaSheepfoldMapper
|
||||
|
||||
public int selectCount(DaSheepfold daSheepfold);
|
||||
|
||||
// 新增:按组合条件删除的自定义方法(核心)
|
||||
int deleteSheepfoldByCondition(
|
||||
@Param("ranchId") Long ranchId,
|
||||
@Param("sheepfoldNo") String sheepfoldNo,
|
||||
@Param("sheepfoldTypeId") Long sheepfoldTypeId
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public interface IDaSheepfoldService
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
@@ -73,4 +75,8 @@ public interface IDaSheepfoldService
|
||||
|
||||
// 根据羊舍id获取该羊舍的羊
|
||||
List<BasSheep> sheepListById(String id);
|
||||
|
||||
|
||||
/** 新增:根据组合条件删除羊圈记录 */
|
||||
boolean deleteSheepfoldByCondition(DaSheepfold sheepfold);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
@@ -51,6 +53,7 @@ public class BasSheepServiceImpl implements IBasSheepService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "b", userAlias = "b")
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return basSheepMapper.searchEarNumbers(query);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.zhyc.module.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
import com.zhyc.module.base.mapper.DaSheepfoldMapper;
|
||||
import com.zhyc.module.base.service.IDaSheepfoldService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,6 +29,9 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Autowired
|
||||
private BasSheepMapper basSheepMapper;
|
||||
|
||||
// 日志对象
|
||||
private static final Logger log = LoggerFactory.getLogger(DaSheepfoldServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 查询羊舍管理
|
||||
*
|
||||
@@ -45,7 +53,15 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Override
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold)
|
||||
{
|
||||
return daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
List<DaSheepfold> sheepfoldList = daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
return sheepfoldList; // 修复:原代码重复调用Mapper,改为返回已查询的列表
|
||||
}
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) {
|
||||
return daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +112,6 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
return daSheepfoldMapper.deleteDaSheepfoldById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkSheepfoldNoExist(Long ranchId, Long sheepfoldTypeId, String sheepfoldNo) {
|
||||
DaSheepfold query = new DaSheepfold();
|
||||
@@ -111,4 +126,40 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
List<BasSheep> basSheep = basSheepMapper.selectBasSheepBySheepfold(id);
|
||||
return basSheep;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核心实现:根据组合条件删除(完全自定义,无MP依赖)
|
||||
* 条件:ranch_id = ? AND sheepfold_no = ? AND sheepfold_type_id = ?
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteSheepfoldByCondition(DaSheepfold sheepfold) {
|
||||
// 1. 前置校验:仅校验3个核心字段(移除sheepfoldName的校验)
|
||||
if (sheepfold.getRanchId() == null
|
||||
|| !StringUtils.hasText(sheepfold.getSheepfoldNo())
|
||||
|| sheepfold.getSheepfoldTypeId() == null) {
|
||||
log.error("删除失败:核心条件不能为空!牧场ID={}, 羊舍编号={}, 羊舍类型ID={}",
|
||||
sheepfold.getRanchId(), sheepfold.getSheepfoldNo(), sheepfold.getSheepfoldTypeId());
|
||||
throw new IllegalArgumentException("删除失败:牧场ID、羊舍编号、羊舍类型ID不能为空");
|
||||
}
|
||||
|
||||
// 2. 调用Mapper方法:仅传递3个核心字段(移除sheepfoldName)
|
||||
int deleteCount = daSheepfoldMapper.deleteSheepfoldByCondition(
|
||||
sheepfold.getRanchId(),
|
||||
sheepfold.getSheepfoldNo(),
|
||||
sheepfold.getSheepfoldTypeId()
|
||||
);
|
||||
boolean isSuccess = deleteCount > 0;
|
||||
|
||||
// 3. 日志打印:移除sheepfoldName相关内容
|
||||
if (isSuccess) {
|
||||
log.info("成功删除羊舍记录:牧场ID={}, 羊舍编号={}, 羊舍类型ID={}",
|
||||
sheepfold.getRanchId(), sheepfold.getSheepfoldNo(), sheepfold.getSheepfoldTypeId());
|
||||
} else {
|
||||
log.warn("未找到匹配条件的羊舍记录:牧场ID={}, 羊舍编号={}, 羊舍类型ID={}",
|
||||
sheepfold.getRanchId(), sheepfold.getSheepfoldNo(), sheepfold.getSheepfoldTypeId());
|
||||
}
|
||||
|
||||
return isSuccess;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,8 @@ public class DewormController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Deworm deworm)
|
||||
{
|
||||
System.out.println(deworm);
|
||||
deworm.setDeptId(getDeptId());
|
||||
deworm.setUserId(getUserId());
|
||||
return toAjax(dewormService.insertDeworm(deworm));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ public class DiagnosisController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Diagnosis diagnosis)
|
||||
{
|
||||
diagnosis.setDeptId(getDeptId());
|
||||
diagnosis.setUserId(getUserId());
|
||||
return toAjax(diagnosisService.insertDiagnosis(diagnosis));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class DisinfectController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Disinfect disinfect)
|
||||
{
|
||||
disinfect.setDeptId(getDeptId());
|
||||
disinfect.setUserId(getUserId());
|
||||
return toAjax(disinfectService.insertDisinfect(disinfect));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ public class HealthController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Health health)
|
||||
{
|
||||
health.setDeptId(getDeptId());
|
||||
health.setUserId(getUserId());
|
||||
return toAjax(healthService.insertHealth(health));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class ImmunityController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Immunity immunity)
|
||||
{
|
||||
immunity.setDeptId(getDeptId());
|
||||
immunity.setUserId(getUserId());
|
||||
return toAjax(immunityService.insertImmunity(immunity));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class QuarantineReportController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody QuarantineReport quarantineReport)
|
||||
{
|
||||
quarantineReport.setDeptId(getDeptId());
|
||||
quarantineReport.setUserId(getUserId());
|
||||
return toAjax(quarantineReportService.insertQuarantineReport(quarantineReport));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ public class SwMedicineUsageController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SwMedicineUsage swMedicineUsage)
|
||||
{
|
||||
swMedicineUsage.setDeptId(getDeptId());
|
||||
swMedicineUsage.setUserId(getUserId());
|
||||
return toAjax(swMedicineUsageService.insertSwMedicineUsage(swMedicineUsage));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ public class TreatmentController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Treatment treatment)
|
||||
{
|
||||
treatment.setDeptId(getDeptId());
|
||||
treatment.setUserId(getUserId());
|
||||
return toAjax(treatmentService.insertTreatment(treatment));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ public class Deworm extends BaseEntity
|
||||
@Excel(name = "胎次")
|
||||
private Long parity;
|
||||
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录 */
|
||||
@Excel(name = "药品使用记录")
|
||||
@@ -81,4 +82,5 @@ public class Deworm extends BaseEntity
|
||||
// 排序查询
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
}
|
||||
|
||||
@@ -106,6 +106,9 @@ public class Diagnosis extends BaseEntity
|
||||
private String orderByColumn;
|
||||
private String isAsc;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
if (gender != null && !gender.trim().isEmpty()) {
|
||||
|
||||
@@ -61,6 +61,9 @@ public class Disinfect extends BaseEntity
|
||||
/** 药品名称用于查询*/
|
||||
private String mediName;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@ public class Health extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ public class Immunity extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -98,6 +98,9 @@ public class QuarantineReport extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
||||
|
||||
@@ -53,6 +53,9 @@ public class SwMedicineUsage extends BaseEntity
|
||||
@Excel(name = "使用类型",width = 20, needMerge = true)
|
||||
private String useType;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
/** 药品使用记录详情信息 */
|
||||
@Excel
|
||||
private List<SwMedicineUsageDetails> swMedicineUsageDetailsList;
|
||||
|
||||
@@ -104,6 +104,9 @@ public class Treatment extends BaseEntity
|
||||
@Excel(name = "药品使用记录id")
|
||||
private Integer usageId;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
|
||||
// 药品使用
|
||||
private List<SwMedicineUsageDetails> usageDetails;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -58,6 +60,7 @@ public class DewormServiceImpl implements IDewormService
|
||||
* @return 驱虫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Deworm> selectDewormList(Deworm deworm)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
@@ -60,6 +61,7 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
* @return 诊疗结果
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Diagnosis> selectDiagnosisList(Diagnosis diagnosis)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -59,6 +61,7 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
* @return 消毒记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sd", userAlias = "sd")
|
||||
public List<Disinfect> selectDisinfectList(Disinfect disinfect)
|
||||
{
|
||||
return disinfectMapper.selectDisinfectList(disinfect);
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -62,6 +63,7 @@ public class HealthServiceImpl implements IHealthService
|
||||
* @return 保健
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Health> selectHealthList(Health health)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -61,6 +63,7 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
* @return 免疫
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Immunity> selectImmunityList(Immunity immunity)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.biosafety.domain.QuarantineItems;
|
||||
import com.zhyc.module.biosafety.mapper.QuarantineItemsMapper;
|
||||
import com.zhyc.module.biosafety.service.IQuarantineItemsService;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -46,6 +48,7 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
||||
* @return 检疫记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sqr", userAlias = "sqr")
|
||||
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.biosafety.service.ISwMedicineUsageService;
|
||||
@@ -44,6 +46,7 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
|
||||
* @return 药品使用记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "smu", userAlias = "smu")
|
||||
public List<SwMedicineUsage> selectSwMedicineUsageList(SwMedicineUsage swMedicineUsage)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
@@ -65,6 +67,7 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
* @return 治疗记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "t", userAlias = "t")
|
||||
public List<Treatment> selectTreatmentList(Treatment treatment)
|
||||
{
|
||||
String[] sheepNos = null;
|
||||
|
||||
@@ -26,7 +26,9 @@ public class UserPostController {
|
||||
// 根据岗位编码获取用户
|
||||
@GetMapping("/getUser")
|
||||
public AjaxResult getUserPost(String postCode){
|
||||
List<User> list = userService.getUserListByCode(postCode);
|
||||
User user = new User();
|
||||
user.setPostCode(postCode);
|
||||
List<User> list = userService.getUserListByCode(user);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Dept extends BaseEntity {
|
||||
private Long deptId;
|
||||
private Long parentId;
|
||||
private String ancestors;
|
||||
private String deptName;
|
||||
private String orderNum;
|
||||
private String leader;
|
||||
private String phone;
|
||||
private String email;
|
||||
private String status;
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -8,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Post {
|
||||
public class Post extends BaseEntity {
|
||||
|
||||
/** 岗位序号 */
|
||||
@Excel(name = "岗位序号", cellType = Excel.ColumnType.NUMERIC)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.common.domain;
|
||||
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -7,9 +8,10 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class User {
|
||||
public class User extends BaseEntity {
|
||||
// 用户id
|
||||
private String userId;
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
// 用户名
|
||||
private String nickName;
|
||||
// 岗位名称
|
||||
@@ -17,4 +19,5 @@ public class User {
|
||||
// 岗位编码
|
||||
private String postCode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zhyc.module.common.mapper;
|
||||
|
||||
import com.zhyc.module.common.domain.Dept;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeptMapper {
|
||||
/**
|
||||
* 根据部门ID查询其所属二级部门(排除根部门)
|
||||
*/
|
||||
Dept selectTopSecondLevelDept(Long deptId);
|
||||
}
|
||||
@@ -8,5 +8,5 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
|
||||
List<User> getUserListByCode(String postCode);
|
||||
List<User> getUserListByCode(User user);
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ import com.zhyc.module.common.domain.User;
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
List<User> getUserListByCode(String postCode);
|
||||
List<User> getUserListByCode(User postCode);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.zhyc.module.common.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.common.domain.Dept;
|
||||
import com.zhyc.module.common.domain.User;
|
||||
import com.zhyc.module.common.mapper.DeptMapper;
|
||||
import com.zhyc.module.common.mapper.UserMapper;
|
||||
import com.zhyc.module.common.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -12,9 +16,16 @@ import java.util.List;
|
||||
public class UserPostServiceImpl implements UserService {
|
||||
@Autowired
|
||||
UserMapper userMapper;
|
||||
@Autowired
|
||||
DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public List<User> getUserListByCode(String postCode) {
|
||||
return userMapper.getUserListByCode(postCode);
|
||||
public List<User> getUserListByCode(User user) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
|
||||
Dept secondLevel = deptMapper.selectTopSecondLevelDept(deptId);
|
||||
user.setDeptId(secondLevel.getDeptId());
|
||||
System.out.println(secondLevel);
|
||||
return userMapper.getUserListByCode(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 鲜奶生产,成品检验记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-18
|
||||
*/
|
||||
@RestController
|
||||
@@ -77,6 +76,11 @@ public class NpFreshMilkInspController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NpFreshMilkInsp npFreshMilkInsp)
|
||||
{
|
||||
// === 修改开始:注入当前用户和部门ID ===
|
||||
npFreshMilkInsp.setUserId(getUserId());
|
||||
npFreshMilkInsp.setDeptId(getDeptId());
|
||||
// === 修改结束 ===
|
||||
|
||||
return toAjax(npFreshMilkInspService.insertNpFreshMilkInsp(npFreshMilkInsp));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,10 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
public TableDataInfo list(
|
||||
@RequestParam(required = false) Date datetimeStart,
|
||||
@RequestParam(required = false) Date datetimeEnd,
|
||||
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号数组
|
||||
@RequestParam(required = false) List<String> allEarNumbers,
|
||||
@RequestParam(required = false) String factory,
|
||||
@RequestParam(required = false) Integer classes) {
|
||||
startPage();
|
||||
// 修改处:将参数封装进实体,以便 Service 和 Mapper 统一处理
|
||||
NpMilkProdClasses params = new NpMilkProdClasses();
|
||||
params.setAllEarNumbers(allEarNumbers);
|
||||
params.setFactory(factory);
|
||||
@@ -43,9 +42,6 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改处:新增耳号模糊查询接口
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:list')")
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
@@ -64,6 +60,16 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
try {
|
||||
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
|
||||
List<NpMilkProdClasses> list = util.importExcel(file.getInputStream());
|
||||
|
||||
// === 修改开始:循环注入当前用户和部门ID ===
|
||||
Long userId = getUserId();
|
||||
Long deptId = getDeptId();
|
||||
for (NpMilkProdClasses item : list) {
|
||||
item.setUserId(userId);
|
||||
item.setDeptId(deptId);
|
||||
}
|
||||
// === 修改结束 ===
|
||||
|
||||
int rows = npMilkProdClassesService.importMilkProdClasses(list);
|
||||
return success("成功导入 " + rows + " 行数据");
|
||||
} catch (Exception e) {
|
||||
@@ -77,7 +83,7 @@ public class NpMilkProdClassesController extends BaseController {
|
||||
public void export(HttpServletResponse response,
|
||||
@RequestParam(required = false) Date datetimeStart,
|
||||
@RequestParam(required = false) Date datetimeEnd,
|
||||
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号
|
||||
@RequestParam(required = false) List<String> allEarNumbers,
|
||||
@RequestParam(required = false) String factory,
|
||||
@RequestParam(required = false) Integer classes) {
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生乳检验记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@RestController
|
||||
@@ -78,6 +77,11 @@ public class NpRawMilkInspeController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NpRawMilkInspe npRawMilkInspe)
|
||||
{
|
||||
// === 修改开始:注入当前用户和部门ID ===
|
||||
npRawMilkInspe.setUserId(getUserId());
|
||||
npRawMilkInspe.setDeptId(getDeptId());
|
||||
// === 修改结束 ===
|
||||
|
||||
return toAjax(npRawMilkInspeService.insertNpRawMilkInspe(npRawMilkInspe));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 酸奶生产,成品检疫记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@RestController
|
||||
@@ -78,6 +77,11 @@ public class NpYogurtInspController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NpYogurtInsp npYogurtInsp)
|
||||
{
|
||||
// === 修改开始:注入当前用户和部门ID ===
|
||||
npYogurtInsp.setUserId(getUserId());
|
||||
npYogurtInsp.setDeptId(getDeptId());
|
||||
// === 修改结束 ===
|
||||
|
||||
return toAjax(npYogurtInspService.insertNpYogurtInsp(npYogurtInsp));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 干物质校正Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@RestController
|
||||
@@ -77,6 +76,9 @@ public class XzDryMatterCorrectionController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody XzDryMatterCorrection xzDryMatterCorrection)
|
||||
{
|
||||
// 自动填充用户ID和部门ID
|
||||
xzDryMatterCorrection.setUserId(getUserId());
|
||||
xzDryMatterCorrection.setDeptId(getDeptId());
|
||||
return toAjax(xzDryMatterCorrectionService.insertXzDryMatterCorrection(xzDryMatterCorrection));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 称重校正Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@RestController
|
||||
@@ -78,6 +77,9 @@ public class XzWegihCorrectionController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody XzWegihCorrection xzWegihCorrection)
|
||||
{
|
||||
// 自动填充用户ID和部门ID
|
||||
xzWegihCorrection.setUserId(getUserId());
|
||||
xzWegihCorrection.setDeptId(getDeptId());
|
||||
return toAjax(xzWegihCorrectionService.insertXzWegihCorrection(xzWegihCorrection));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 鲜奶生产,成品检验记录对象 np_fresh_milk_insp
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-18
|
||||
*/
|
||||
@Data
|
||||
@@ -85,4 +84,12 @@ public class NpFreshMilkInsp extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String commnet;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,14 @@ public class NpMilkInOutStore extends BaseEntity {
|
||||
@Excel(name = "爱特退回酸奶")
|
||||
private BigDecimal returnYogurt;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
// --- getters and setters ---
|
||||
public Integer getId() { return id; }
|
||||
public void setId(Integer id) { this.id = id; }
|
||||
@@ -125,4 +133,10 @@ public class NpMilkInOutStore extends BaseEntity {
|
||||
|
||||
public BigDecimal getReturnYogurt() { return returnYogurt; }
|
||||
public void setReturnYogurt(BigDecimal returnYogurt) { this.returnYogurt = returnYogurt; }
|
||||
|
||||
public Long getUserId() { return userId; }
|
||||
public void setUserId(Long userId) { this.userId = userId; }
|
||||
|
||||
public Long getDeptId() { return deptId; }
|
||||
public void setDeptId(Long deptId) { this.deptId = deptId; }
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.zhyc.module.dairyProducts.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List; // 引入 List
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
|
||||
@@ -40,11 +40,19 @@ public class NpMilkProdClasses implements Serializable {
|
||||
|
||||
private String sheepId;
|
||||
|
||||
// 修改处:新增字段用于多耳号查询
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
// Getters and Setters
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
// --- Getters and Setters ---
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
@@ -88,4 +96,10 @@ public class NpMilkProdClasses implements Serializable {
|
||||
|
||||
public String getSheepId() { return sheepId; }
|
||||
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
|
||||
|
||||
public Long getUserId() { return userId; }
|
||||
public void setUserId(Long userId) { this.userId = userId; }
|
||||
|
||||
public Long getDeptId() { return deptId; }
|
||||
public void setDeptId(Long deptId) { this.deptId = deptId; }
|
||||
}
|
||||
@@ -451,4 +451,12 @@ public class NpRawMilkInspe extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@@ -10,8 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 酸奶生产,成品检疫记录对象 np_yogurt_insp
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@Data
|
||||
@@ -86,4 +85,12 @@ public class NpYogurtInsp extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
}
|
||||
@@ -32,4 +32,9 @@ public class XzDryMatterCorrection extends BaseEntity {
|
||||
@Excel(name = "干物质系数")
|
||||
private Double coefficient;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -45,5 +45,9 @@ public class XzWegihCorrection extends BaseEntity
|
||||
@Excel(name = "称重系数")
|
||||
private Double coefficient;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -8,16 +8,49 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface NpMilkInOutStoreMapper {
|
||||
/**
|
||||
* 动态列查询
|
||||
*/
|
||||
List<Map<String,Object>> selectWithColumns(
|
||||
@Param("start") Date start, @Param("end") Date end,
|
||||
@Param("feedSources") List<String> feedSources,
|
||||
@Param("saleDestinations") List<String> saleDestinations
|
||||
);
|
||||
int insertStore(NpMilkInOutStore store);
|
||||
void insertFeedRecord(@Param("storeId") Integer storeId, @Param("source") String source, @Param("amount") java.math.BigDecimal amount);
|
||||
void insertSaleRecord(@Param("storeId") Integer storeId, @Param("destination") String dest, @Param("amount") java.math.BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 插入主表
|
||||
*/
|
||||
int insertStore(NpMilkInOutStore store);
|
||||
|
||||
/**
|
||||
* 插入饲喂子表(已修正:增加 userId 和 deptId 参数)
|
||||
*/
|
||||
void insertFeedRecord(
|
||||
@Param("storeId") Integer storeId,
|
||||
@Param("source") String source,
|
||||
@Param("amount") java.math.BigDecimal amount,
|
||||
@Param("userId") Long userId,
|
||||
@Param("deptId") Long deptId
|
||||
);
|
||||
|
||||
/**
|
||||
* 插入销售子表(已修正:增加 userId 和 deptId 参数)
|
||||
*/
|
||||
void insertSaleRecord(
|
||||
@Param("storeId") Integer storeId,
|
||||
@Param("destination") String dest,
|
||||
@Param("amount") java.math.BigDecimal amount,
|
||||
@Param("userId") Long userId,
|
||||
@Param("deptId") Long deptId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取饲喂来源列表(用于动态列头)
|
||||
*/
|
||||
List<String> selectFeedSources();
|
||||
|
||||
/**
|
||||
* 获取销售去向列表(用于动态列头)
|
||||
*/
|
||||
List<String> selectSaleDestinations();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpFreshMilkInspMapper;
|
||||
@@ -10,8 +11,7 @@ import com.zhyc.module.dairyProducts.service.INpFreshMilkInspService;
|
||||
|
||||
/**
|
||||
* 鲜奶生产,成品检验记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-18
|
||||
*/
|
||||
@Service
|
||||
@@ -22,8 +22,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 查询鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param id 鲜奶生产,成品检验记录主键
|
||||
* * @param id 鲜奶生产,成品检验记录主键
|
||||
* @return 鲜奶生产,成品检验记录
|
||||
*/
|
||||
@Override
|
||||
@@ -34,11 +33,11 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 查询鲜奶生产,成品检验记录列表
|
||||
*
|
||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* @return 鲜奶生产,成品检验记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "a", userAlias = "a")
|
||||
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp)
|
||||
{
|
||||
return npFreshMilkInspMapper.selectNpFreshMilkInspList(npFreshMilkInsp);
|
||||
@@ -46,8 +45,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 新增鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -59,8 +57,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 修改鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -71,8 +68,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 批量删除鲜奶生产,成品检验记录
|
||||
*
|
||||
* @param ids 需要删除的鲜奶生产,成品检验记录主键
|
||||
* * @param ids 需要删除的鲜奶生产,成品检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -83,8 +79,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||
|
||||
/**
|
||||
* 删除鲜奶生产,成品检验记录信息
|
||||
*
|
||||
* @param id 鲜奶生产,成品检验记录主键
|
||||
* * @param id 鲜奶生产,成品检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper;
|
||||
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
|
||||
@@ -19,6 +21,7 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
||||
private NpMilkInOutStoreMapper mapper;
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "s", userAlias = "s")
|
||||
public List<Map<String, Object>> selectWithDynamicColumns(Date start, Date end) {
|
||||
List<String> feed = mapper.selectFeedSources();
|
||||
List<String> sale = mapper.selectSaleDestinations();
|
||||
@@ -58,25 +61,46 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
||||
|
||||
@Override
|
||||
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
|
||||
// === 修改开始:获取当前用户和部门ID ===
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
// === 修改结束 ===
|
||||
|
||||
for (Map<String,Object> row : rows) {
|
||||
// 提取主表字段
|
||||
NpMilkInOutStore store = new NpMilkInOutStore();
|
||||
// 这里假设 Excel 中的"日期"格式是标准的 yyyy-MM-dd,如果格式不对可能会报错,建议加 try-catch 或格式化处理
|
||||
store.setDatetime(java.sql.Date.valueOf(row.get("日期").toString()));
|
||||
store.setNum(Integer.valueOf(row.get("羊数").toString()));
|
||||
// ... 设置其它固定字段 ...
|
||||
|
||||
// 手动填充其它主表字段,这里省略了具体的 get 调用,请根据您的 Excel 列名自行补充
|
||||
// store.setColostSheep(...);
|
||||
|
||||
// === 修改开始:给主表实体注入用户和部门ID ===
|
||||
store.setUserId(userId);
|
||||
store.setDeptId(deptId);
|
||||
// === 修改结束 ===
|
||||
|
||||
mapper.insertStore(store);
|
||||
Integer sid = store.getId();
|
||||
|
||||
// 其余列为动态饲喂或销售,根据字典决定分类:
|
||||
for (Map.Entry<String,Object> ent: row.entrySet()) {
|
||||
String col = ent.getKey();
|
||||
// 跳过固定列
|
||||
if (col.equals("日期") || col.equals("羊数") || col.equals("id")) continue;
|
||||
if (ent.getValue() == null || "".equals(ent.getValue().toString())) continue;
|
||||
|
||||
BigDecimal amt = new BigDecimal(ent.getValue().toString());
|
||||
|
||||
if (mapper.selectFeedSources().contains(col)) {
|
||||
mapper.insertFeedRecord(sid, col, amt);
|
||||
// === 修改开始:插入饲喂子表时传入 userId 和 deptId ===
|
||||
mapper.insertFeedRecord(sid, col, amt, userId, deptId);
|
||||
} else if (mapper.selectSaleDestinations().contains(col)) {
|
||||
mapper.insertSaleRecord(sid, col, amt);
|
||||
// === 修改开始:插入销售子表时传入 userId 和 deptId ===
|
||||
mapper.insertSaleRecord(sid, col, amt, userId, deptId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpMilkProdClassesMapper;
|
||||
import com.zhyc.module.dairyProducts.service.INpMilkProdClassesService;
|
||||
@@ -16,6 +17,7 @@ public class NpMilkProdClassesServiceImpl implements INpMilkProdClassesService {
|
||||
private NpMilkProdClassesMapper mapper;
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "mpc", userAlias = "mpc")
|
||||
public List<NpMilkProdClasses> selectNpMilkProdClassesList(NpMilkProdClasses npMilkProdClasses, Date datetimeStart, Date datetimeEnd) {
|
||||
// 修改处:传递实体对象
|
||||
return mapper.selectNpMilkProdClassesList(npMilkProdClasses, datetimeStart, datetimeEnd);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpRawMilkInspeMapper;
|
||||
@@ -10,8 +11,7 @@ import com.zhyc.module.dairyProducts.service.INpRawMilkInspeService;
|
||||
|
||||
/**
|
||||
* 生乳检验记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Service
|
||||
@@ -22,8 +22,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 查询生乳检验记录
|
||||
*
|
||||
* @param id 生乳检验记录主键
|
||||
* * @param id 生乳检验记录主键
|
||||
* @return 生乳检验记录
|
||||
*/
|
||||
@Override
|
||||
@@ -34,11 +33,11 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 查询生乳检验记录列表
|
||||
*
|
||||
* @param npRawMilkInspe 生乳检验记录
|
||||
* * @param npRawMilkInspe 生乳检验记录
|
||||
* @return 生乳检验记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "a", userAlias = "a")
|
||||
public List<NpRawMilkInspe> selectNpRawMilkInspeList(NpRawMilkInspe npRawMilkInspe)
|
||||
{
|
||||
return npRawMilkInspeMapper.selectNpRawMilkInspeList(npRawMilkInspe);
|
||||
@@ -46,8 +45,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 新增生乳检验记录
|
||||
*
|
||||
* @param npRawMilkInspe 生乳检验记录
|
||||
* * @param npRawMilkInspe 生乳检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -59,8 +57,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 修改生乳检验记录
|
||||
*
|
||||
* @param npRawMilkInspe 生乳检验记录
|
||||
* * @param npRawMilkInspe 生乳检验记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -71,8 +68,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 批量删除生乳检验记录
|
||||
*
|
||||
* @param ids 需要删除的生乳检验记录主键
|
||||
* * @param ids 需要删除的生乳检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -83,8 +79,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||
|
||||
/**
|
||||
* 删除生乳检验记录信息
|
||||
*
|
||||
* @param id 生乳检验记录主键
|
||||
* * @param id 生乳检验记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.dairyProducts.domain.NpYogurtInsp;
|
||||
import com.zhyc.module.dairyProducts.mapper.NpYogurtInspMapper;
|
||||
import com.zhyc.module.dairyProducts.service.INpYogurtInspService;
|
||||
@@ -10,8 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 酸奶生产,成品检疫记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@Service
|
||||
@@ -22,8 +22,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 查询酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param id 酸奶生产,成品检疫记录主键
|
||||
* * @param id 酸奶生产,成品检疫记录主键
|
||||
* @return 酸奶生产,成品检疫记录
|
||||
*/
|
||||
@Override
|
||||
@@ -34,11 +33,11 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 查询酸奶生产,成品检疫记录列表
|
||||
*
|
||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* @return 酸奶生产,成品检疫记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "a", userAlias = "a")
|
||||
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp)
|
||||
{
|
||||
return npYogurtInspMapper.selectNpYogurtInspList(npYogurtInsp);
|
||||
@@ -46,8 +45,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 新增酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -59,8 +57,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 修改酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -71,8 +68,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 批量删除酸奶生产,成品检疫记录
|
||||
*
|
||||
* @param ids 需要删除的酸奶生产,成品检疫记录主键
|
||||
* * @param ids 需要删除的酸奶生产,成品检疫记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -83,8 +79,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
||||
|
||||
/**
|
||||
* 删除酸奶生产,成品检疫记录信息
|
||||
*
|
||||
* @param id 酸奶生产,成品检疫记录主键
|
||||
* * @param id 酸奶生产,成品检疫记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -6,11 +6,11 @@ import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.dairyProducts.mapper.XzDryMatterCorrectionMapper;
|
||||
import com.zhyc.module.dairyProducts.domain.XzDryMatterCorrection;
|
||||
import com.zhyc.module.dairyProducts.service.IXzDryMatterCorrectionService;
|
||||
import com.zhyc.common.annotation.DataScope; // 引入数据权限注解
|
||||
|
||||
/**
|
||||
* 干物质校正Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@Service
|
||||
@@ -21,8 +21,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 查询干物质校正
|
||||
*
|
||||
* @param id 干物质校正主键
|
||||
* * @param id 干物质校正主键
|
||||
* @return 干物质校正
|
||||
*/
|
||||
@Override
|
||||
@@ -33,11 +32,11 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 查询干物质校正列表
|
||||
*
|
||||
* @param xzDryMatterCorrection 干物质校正
|
||||
* * @param xzDryMatterCorrection 干物质校正
|
||||
* @return 干物质校正
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "d") // 添加数据权限注解
|
||||
public List<XzDryMatterCorrection> selectXzDryMatterCorrectionList(XzDryMatterCorrection xzDryMatterCorrection)
|
||||
{
|
||||
return xzDryMatterCorrectionMapper.selectXzDryMatterCorrectionList(xzDryMatterCorrection);
|
||||
@@ -102,8 +101,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 批量删除干物质校正
|
||||
*
|
||||
* @param ids 需要删除的干物质校正主键
|
||||
* * @param ids 需要删除的干物质校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -114,8 +112,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
||||
|
||||
/**
|
||||
* 删除干物质校正信息
|
||||
*
|
||||
* @param id 干物质校正主键
|
||||
* * @param id 干物质校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -8,13 +8,13 @@ import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.module.dairyProducts.domain.XzWegihCorrection;
|
||||
import com.zhyc.module.dairyProducts.mapper.XzWegihCorrectionMapper;
|
||||
import com.zhyc.module.dairyProducts.service.IXzWegihCorrectionService;
|
||||
import com.zhyc.common.annotation.DataScope; // 引入数据权限注解
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 称重校正Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
@Service
|
||||
@@ -25,8 +25,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 查询称重校正
|
||||
*
|
||||
* @param id 称重校正主键
|
||||
* * @param id 称重校正主键
|
||||
* @return 称重校正
|
||||
*/
|
||||
@Override
|
||||
@@ -37,11 +36,11 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 查询称重校正列表
|
||||
*
|
||||
* @param xzWegihCorrection 称重校正
|
||||
* * @param xzWegihCorrection 称重校正
|
||||
* @return 称重校正
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "w", userAlias = "w") // 添加数据权限注解
|
||||
public List<XzWegihCorrection> selectXzWegihCorrectionList(XzWegihCorrection xzWegihCorrection)
|
||||
{
|
||||
return xzWegihCorrectionMapper.selectXzWegihCorrectionList(xzWegihCorrection);
|
||||
@@ -106,8 +105,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 批量删除称重校正
|
||||
*
|
||||
* @param ids 需要删除的称重校正主键
|
||||
* * @param ids 需要删除的称重校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@@ -118,8 +116,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
||||
|
||||
/**
|
||||
* 删除称重校正信息
|
||||
*
|
||||
* @param id 称重校正主键
|
||||
* * @param id 称重校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -109,6 +109,8 @@ public class SgFeedListController extends BaseController {
|
||||
@Log(title = "配料清单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgFeedList sgFeedList) {
|
||||
sgFeedList.setDeptId(getDeptId());
|
||||
sgFeedList.setUserId(getUserId());
|
||||
return toAjax(sgFeedListService.insertSgFeedList(sgFeedList));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ public class SgFeedPlanController extends BaseController {
|
||||
if (null == sgFeedPlan) {
|
||||
throw new RuntimeException("数据为空");
|
||||
}
|
||||
sgFeedPlan.setDeptId(getDeptId());
|
||||
sgFeedPlan.setUserId(getUserId());
|
||||
sgFeedPlan.setCreateDate(new Date());
|
||||
// 计算其他字段值
|
||||
setPlan(sgFeedPlan);
|
||||
|
||||
@@ -84,6 +84,8 @@ public class SgFeedStatisticController extends BaseController {
|
||||
if (null == sgFeedStatistic.getFormulaId() && null == sgFeedStatistic.getFormulaBatchId()) {
|
||||
throw new RuntimeException("ERROR: 数据为空");
|
||||
}
|
||||
sgFeedStatistic.setUserId(getUserId());
|
||||
sgFeedStatistic.setDeptId(getDeptId());
|
||||
List<SgFeedStatistic> isExist = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
|
||||
if (null != isExist && !isExist.isEmpty()) {
|
||||
throw new RuntimeException("WARNING: 数据重复");
|
||||
|
||||
@@ -79,6 +79,8 @@ public class SgFormulaListController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgFormulaList sgFormulaList)
|
||||
{
|
||||
sgFormulaList.setUserId(getUserId());
|
||||
sgFormulaList.setDeptId(getDeptId());
|
||||
return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList));
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,8 @@ public class SgFormulaManagementController extends BaseController {
|
||||
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
|
||||
if (null == sgFormulaManagement)
|
||||
throw new RuntimeException("ERROR: 数据为空");
|
||||
sgFormulaManagement.setUserId(getUserId());
|
||||
sgFormulaManagement.setDeptId(getDeptId());
|
||||
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
|
||||
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
|
||||
if (exist != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -29,8 +30,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/feed/material")
|
||||
public class SgMaterialController extends BaseController
|
||||
{
|
||||
public class SgMaterialController extends BaseController {
|
||||
@Autowired
|
||||
private ISgMaterialService sgMaterialService;
|
||||
|
||||
@@ -39,8 +39,7 @@ public class SgMaterialController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SgMaterial sgMaterial)
|
||||
{
|
||||
public TableDataInfo list(SgMaterial sgMaterial) {
|
||||
startPage();
|
||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||
return getDataTable(list);
|
||||
@@ -52,8 +51,7 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:export')")
|
||||
@Log(title = "原料", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SgMaterial sgMaterial)
|
||||
{
|
||||
public void export(HttpServletResponse response, SgMaterial sgMaterial) {
|
||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||
ExcelUtil<SgMaterial> util = new ExcelUtil<SgMaterial>(SgMaterial.class);
|
||||
util.exportExcel(response, list, "原料数据");
|
||||
@@ -64,8 +62,7 @@ public class SgMaterialController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:query')")
|
||||
@GetMapping(value = "/{materialId}")
|
||||
public AjaxResult getInfo(@PathVariable("materialId") String materialId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("materialId") String materialId) {
|
||||
return success(sgMaterialService.selectSgMaterialByMaterialId(materialId));
|
||||
}
|
||||
|
||||
@@ -75,8 +72,9 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:add')")
|
||||
@Log(title = "原料", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgMaterial sgMaterial)
|
||||
{
|
||||
public AjaxResult add(@RequestBody SgMaterial sgMaterial) {
|
||||
sgMaterial.setUserId(getUserId());
|
||||
sgMaterial.setDeptId(getDeptId());
|
||||
return toAjax(sgMaterialService.insertSgMaterial(sgMaterial));
|
||||
}
|
||||
|
||||
@@ -86,8 +84,7 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:edit')")
|
||||
@Log(title = "原料", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SgMaterial sgMaterial)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody SgMaterial sgMaterial) {
|
||||
return toAjax(sgMaterialService.updateSgMaterial(sgMaterial));
|
||||
}
|
||||
|
||||
@@ -97,8 +94,7 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:remove')")
|
||||
@Log(title = "原料", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{materialIds}")
|
||||
public AjaxResult remove(@PathVariable String[] materialIds)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable String[] materialIds) {
|
||||
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,26 +19,36 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFeedList extends BaseEntity
|
||||
{
|
||||
public class SgFeedList extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 配方编号 */
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
@Excel(name = "配方编号")
|
||||
private String formulaId;
|
||||
|
||||
/** 配方批号 */
|
||||
/**
|
||||
* 配方批号
|
||||
*/
|
||||
@Excel(name = "配方批号")
|
||||
private String formulaBatchId;
|
||||
|
||||
/** 饲草班人员 */
|
||||
/**
|
||||
* 饲草班人员
|
||||
*/
|
||||
@Excel(name = "饲草班人员")
|
||||
private String zookeeper;
|
||||
|
||||
/** 配料日期 */
|
||||
/**
|
||||
* 配料日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "配料日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deployDate;
|
||||
@@ -58,7 +68,7 @@ public class SgFeedList extends BaseEntity
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("formulaBatchId", getFormulaBatchId())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.feed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -17,119 +18,138 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SgFeedPlan extends BaseEntity
|
||||
{
|
||||
public class SgFeedPlan extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 创建日期 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private Date createDate;
|
||||
|
||||
/** 配方编码 */
|
||||
/**
|
||||
* 配方编码
|
||||
*/
|
||||
@Excel(name = "配方编码")
|
||||
private String formulaId;
|
||||
|
||||
/** 批号 */
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "批号")
|
||||
private String batchId;
|
||||
|
||||
/** 羊舍 */
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "羊舍")
|
||||
private Integer sheepHouseId;
|
||||
|
||||
/** 羊只数量 */
|
||||
/**
|
||||
* 羊只数量
|
||||
*/
|
||||
@Excel(name = "羊只数量")
|
||||
private Integer sheepCount;
|
||||
|
||||
/** 日均计划量 */
|
||||
/**
|
||||
* 日均计划量
|
||||
*/
|
||||
@Excel(name = "日均计划量")
|
||||
private Double planDailySize;
|
||||
|
||||
/** 饲喂比例(早) */
|
||||
/**
|
||||
* 饲喂比例(早)
|
||||
*/
|
||||
@Excel(name = "饲喂比例(早)")
|
||||
private Double ratioMorning;
|
||||
|
||||
/** 饲喂比例(中) */
|
||||
/**
|
||||
* 饲喂比例(中)
|
||||
*/
|
||||
@Excel(name = "饲喂比例(中)")
|
||||
private Double ratioNoon;
|
||||
|
||||
/** 饲喂比例(下) */
|
||||
/**
|
||||
* 饲喂比例(下)
|
||||
*/
|
||||
@Excel(name = "饲喂比例(下)")
|
||||
private Double ratioAfternoon;
|
||||
|
||||
/** 计划量(早) */
|
||||
/**
|
||||
* 计划量(早)
|
||||
*/
|
||||
@Excel(name = "计划量(早)")
|
||||
private Double planMorningSize;
|
||||
|
||||
/** 计划总量(早) */
|
||||
/**
|
||||
* 计划总量(早)
|
||||
*/
|
||||
@Excel(name = "计划总量(早)")
|
||||
private Double planMorningTotal;
|
||||
|
||||
/** 实际量(早) */
|
||||
/**
|
||||
* 实际量(早)
|
||||
*/
|
||||
@Excel(name = "实际量(早)")
|
||||
private Double actualMorningSize;
|
||||
|
||||
/** 计划量(中) */
|
||||
/**
|
||||
* 计划量(中)
|
||||
*/
|
||||
@Excel(name = "计划量(中)")
|
||||
private Double planNoonSize;
|
||||
|
||||
/** 计划总量(中) */
|
||||
/**
|
||||
* 计划总量(中)
|
||||
*/
|
||||
@Excel(name = "计划总量(中)")
|
||||
private Double planNoonTotal;
|
||||
|
||||
/** 实际量(中) */
|
||||
/**
|
||||
* 实际量(中)
|
||||
*/
|
||||
@Excel(name = "实际量(中)")
|
||||
private Double actualNoonSize;
|
||||
|
||||
/** 计划量(下) */
|
||||
/**
|
||||
* 计划量(下)
|
||||
*/
|
||||
@Excel(name = "计划量(下)")
|
||||
private Double planAfternoonSize;
|
||||
|
||||
/** 计划总量(下) */
|
||||
/**
|
||||
* 计划总量(下)
|
||||
*/
|
||||
@Excel(name = "计划总量(下)")
|
||||
private Double planAfternoonTotal;
|
||||
|
||||
/** 实际量(下) */
|
||||
/**
|
||||
* 实际量(下)
|
||||
*/
|
||||
@Excel(name = "实际量(下)")
|
||||
private Double actualAfternoonSize;
|
||||
|
||||
/** 计划饲喂总量 */
|
||||
/**
|
||||
* 计划饲喂总量
|
||||
*/
|
||||
@Excel(name = "计划饲喂总量")
|
||||
private Double planFeedTotal;
|
||||
|
||||
/** 饲草班人员 */
|
||||
/**
|
||||
* 饲草班人员
|
||||
*/
|
||||
@Excel(name = "饲草班人员")
|
||||
private String zookeeper;
|
||||
|
||||
/** 饲喂计划日期 */
|
||||
/**
|
||||
* 饲喂计划日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planDate;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("createDate", getCreateDate())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("batchId", getBatchId())
|
||||
.append("sheepHouseId", getSheepHouseId())
|
||||
.append("sheepCount", getSheepCount())
|
||||
.append("planDailySize", getPlanDailySize())
|
||||
.append("ratioMorning", getRatioMorning())
|
||||
.append("ratioNoon", getRatioNoon())
|
||||
.append("ratioAfternoon", getRatioAfternoon())
|
||||
.append("planMorningSize", getPlanMorningSize())
|
||||
.append("planMorningTotal", getPlanMorningTotal())
|
||||
.append("actualMorningSize", getActualMorningSize())
|
||||
.append("planNoonSize", getPlanNoonSize())
|
||||
.append("planNoonTotal", getPlanNoonTotal())
|
||||
.append("actualNoonSize", getActualNoonSize())
|
||||
.append("planAfternoonSize", getPlanAfternoonSize())
|
||||
.append("planAfternoonTotal", getPlanAfternoonTotal())
|
||||
.append("actualAfternoonSize", getActualAfternoonSize())
|
||||
.append("planFeedTotal", getPlanFeedTotal())
|
||||
.append("zookeeper", getZookeeper())
|
||||
.append("planDate", getPlanDate())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("createDate", getCreateDate()).append("formulaId", getFormulaId()).append("batchId", getBatchId()).append("sheepHouseId", getSheepHouseId()).append("sheepCount", getSheepCount()).append("planDailySize", getPlanDailySize()).append("ratioMorning", getRatioMorning()).append("ratioNoon", getRatioNoon()).append("ratioAfternoon", getRatioAfternoon()).append("planMorningSize", getPlanMorningSize()).append("planMorningTotal", getPlanMorningTotal()).append("actualMorningSize", getActualMorningSize()).append("planNoonSize", getPlanNoonSize()).append("planNoonTotal", getPlanNoonTotal()).append("actualNoonSize", getActualNoonSize()).append("planAfternoonSize", getPlanAfternoonSize()).append("planAfternoonTotal", getPlanAfternoonTotal()).append("actualAfternoonSize", getActualAfternoonSize()).append("planFeedTotal", getPlanFeedTotal()).append("zookeeper", getZookeeper()).append("planDate", getPlanDate()).append("remark", getRemark()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ import java.util.List;
|
||||
@Getter
|
||||
public class SgFeedStatistic extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
|
||||
@@ -15,27 +15,39 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFormulaList extends BaseEntity
|
||||
{
|
||||
public class SgFormulaList extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long code;
|
||||
|
||||
/** 配方编号 */
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
private String formulaId;
|
||||
|
||||
/** 配方编号 */
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
private String batchId;
|
||||
/** 原料编号 */
|
||||
/**
|
||||
* 原料编号
|
||||
*/
|
||||
@Excel(name = "原料编号")
|
||||
private String materialId;
|
||||
|
||||
/** 原料名称 */
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
@Excel(name = "原料名称")
|
||||
private String materialName;
|
||||
|
||||
/** 比例 */
|
||||
/**
|
||||
* 比例
|
||||
*/
|
||||
@Excel(name = "比例")
|
||||
private Long ratio;
|
||||
|
||||
@@ -60,7 +72,7 @@ public class SgFormulaList extends BaseEntity
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("code", getCode())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("materialId", getMaterialId())
|
||||
|
||||
@@ -19,54 +19,74 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFormulaManagement extends BaseEntity
|
||||
{
|
||||
public class SgFormulaManagement extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 配方编号 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
private String formulaId;
|
||||
|
||||
/** 饲养阶段 */
|
||||
/**
|
||||
* 饲养阶段
|
||||
*/
|
||||
@Excel(name = "饲养阶段")
|
||||
private String feedStage;
|
||||
|
||||
/** 批号 */
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "批号")
|
||||
private String batchId;
|
||||
|
||||
/** 开始使用时间 */
|
||||
/**
|
||||
* 开始使用时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date useStartDate;
|
||||
|
||||
/** 结束使用时间 */
|
||||
/**
|
||||
* 结束使用时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date useEndDate;
|
||||
|
||||
/** 使用状态 */
|
||||
/**
|
||||
* 使用状态
|
||||
*/
|
||||
@Excel(name = "使用状态")
|
||||
private String useState;
|
||||
|
||||
/** 备注 */
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 配方列表 */
|
||||
/**
|
||||
* 配方列表
|
||||
*/
|
||||
private List<SgFormulaList> sgFormulaList;
|
||||
|
||||
/** 子配方 */
|
||||
/**
|
||||
* 子配方
|
||||
*/
|
||||
private List<SgFormulaManagement> subFormulaList;
|
||||
|
||||
/** 查询类型 *
|
||||
/**
|
||||
* 查询类型 *
|
||||
* Sub : 子配方查询
|
||||
* query : 类型查询
|
||||
* */
|
||||
*
|
||||
*/
|
||||
private String queryType;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("feedStage", getFeedStage())
|
||||
.append("batchId", getBatchId())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.feed.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
@@ -11,58 +12,55 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
* @author HashMap
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class SgMaterial extends BaseEntity
|
||||
{
|
||||
@Data
|
||||
public class SgMaterial extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 原料编码 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 原料编码
|
||||
*/
|
||||
@Excel(name = "原料编码")
|
||||
private String materialId;
|
||||
|
||||
/** 原料名称 */
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
@Excel(name = "原料名称")
|
||||
private String materialName;
|
||||
|
||||
/** 颗粒料 */
|
||||
/**
|
||||
* 颗粒料
|
||||
*/
|
||||
@Excel(name = "颗粒料")
|
||||
private Integer isGranular;
|
||||
|
||||
public void setMaterialId(String materialId)
|
||||
{
|
||||
public void setMaterialId(String materialId) {
|
||||
this.materialId = materialId;
|
||||
}
|
||||
|
||||
public String getMaterialId()
|
||||
{
|
||||
public String getMaterialId() {
|
||||
return materialId;
|
||||
}
|
||||
|
||||
public void setMaterialName(String materialName)
|
||||
{
|
||||
public void setMaterialName(String materialName) {
|
||||
this.materialName = materialName;
|
||||
}
|
||||
|
||||
public String getMaterialName()
|
||||
{
|
||||
public String getMaterialName() {
|
||||
return materialName;
|
||||
}
|
||||
|
||||
public void setIsGranular(Integer isGranular)
|
||||
{
|
||||
public void setIsGranular(Integer isGranular) {
|
||||
this.isGranular = isGranular;
|
||||
}
|
||||
|
||||
public Integer getIsGranular()
|
||||
{
|
||||
public Integer getIsGranular() {
|
||||
return isGranular;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("isGranular", getIsGranular())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("materialId", getMaterialId()).append("materialName", getMaterialName()).append("isGranular", getIsGranular()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
import com.zhyc.module.feed.domain.SgFormulaManagement;
|
||||
import com.zhyc.module.feed.service.ISgFeedPlanService;
|
||||
@@ -56,6 +57,7 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
||||
* @return 配料清单
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_list_alias", userAlias = "sg_feed_list_alias")
|
||||
public List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList) {
|
||||
return sgFeedListMapper.selectSgFeedListList(sgFeedList);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFeedPlanMapper;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
@@ -16,9 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
{
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SgFeedPlanServiceImpl implements ISgFeedPlanService {
|
||||
private final SgFeedPlanMapper sgFeedPlanMapper;
|
||||
|
||||
public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) {
|
||||
@@ -32,8 +32,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 饲喂计划
|
||||
*/
|
||||
@Override
|
||||
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate)
|
||||
{
|
||||
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate) {
|
||||
return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate);
|
||||
}
|
||||
|
||||
@@ -44,8 +43,8 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 饲喂计划
|
||||
*/
|
||||
@Override
|
||||
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
@DataScope(deptAlias = "sg_feed_plan_alias", userAlias = "sg_feed_plan_alias")
|
||||
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan) {
|
||||
return sgFeedPlanMapper.selectSgFeedPlanList(sgFeedPlan);
|
||||
}
|
||||
|
||||
@@ -56,8 +55,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan) {
|
||||
return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan);
|
||||
}
|
||||
|
||||
@@ -68,8 +66,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan) {
|
||||
return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan);
|
||||
}
|
||||
|
||||
@@ -80,8 +77,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSgFeedPlanByCreateDates(Date[] createDates)
|
||||
{
|
||||
public int deleteSgFeedPlanByCreateDates(Date[] createDates) {
|
||||
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates);
|
||||
}
|
||||
|
||||
@@ -92,8 +88,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSgFeedPlanByCreateDate(Date createDate)
|
||||
{
|
||||
public int deleteSgFeedPlanByCreateDate(Date createDate) {
|
||||
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.feed.domain.SgFeedList;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
@@ -51,6 +52,7 @@ public class SgFeedStatisticServiceImpl implements ISgFeedStatisticService {
|
||||
* @return 饲喂量统计
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_statistic_alias", userAlias = "sg_feed_statistic_alias")
|
||||
public List<SgFeedStatistic> selectSgFeedStatisticList(SgFeedStatistic sgFeedStatistic) {
|
||||
return sgFeedStatisticMapper.selectSgFeedStatisticList(sgFeedStatistic);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
|
||||
import com.zhyc.module.feed.domain.SgFormulaList;
|
||||
@@ -41,6 +42,7 @@ public class SgFormulaListServiceImpl implements ISgFormulaListService {
|
||||
* @return 配方列表
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_formula_list_alias", userAlias = "sg_formula_list_alias")
|
||||
public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) {
|
||||
return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.feed.domain.SgFormulaList;
|
||||
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -46,6 +47,7 @@ public class SgFormulaManagementServiceImpl implements ISgFormulaManagementServi
|
||||
* @return 配方管理
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_formula_management_alias", userAlias = "sg_formula_management_alias")
|
||||
public List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) {
|
||||
List<SgFormulaManagement> sgFormulaManagements =
|
||||
sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgMaterialMapper;
|
||||
@@ -37,6 +38,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService {
|
||||
* @return 原料
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_material_alias", userAlias = "sg_material_alias")
|
||||
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial) {
|
||||
return sgMaterialMapper.selectSgMaterialList(sgMaterial);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@ package com.zhyc.module.produce.bodyManage.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.service.IBasSheepService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -14,6 +19,7 @@ import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 体尺测量Controller
|
||||
@@ -23,19 +29,18 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/body_measure/body_measure")
|
||||
public class ScBodyMeasureController extends BaseController
|
||||
{
|
||||
public class ScBodyMeasureController extends BaseController {
|
||||
@Autowired
|
||||
private IScBodyMeasureService scBodyMeasureService;
|
||||
|
||||
@Autowired
|
||||
private IBasSheepService basSheepService;
|
||||
|
||||
/**
|
||||
* 查询体尺测量列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public TableDataInfo list(ScBodyMeasure scBodyMeasure) {
|
||||
startPage();
|
||||
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
|
||||
return getDataTable(list);
|
||||
@@ -47,8 +52,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:export')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure) {
|
||||
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
|
||||
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<ScBodyMeasure>(ScBodyMeasure.class);
|
||||
util.exportExcel(response, list, "体尺测量数据");
|
||||
@@ -59,8 +63,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(scBodyMeasureService.selectScBodyMeasureById(id));
|
||||
}
|
||||
|
||||
@@ -70,8 +73,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:add')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||
return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure));
|
||||
}
|
||||
|
||||
@@ -81,8 +83,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:edit')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||
return toAjax(scBodyMeasureService.updateScBodyMeasure(scBodyMeasure));
|
||||
}
|
||||
|
||||
@@ -92,13 +93,81 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:remove')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(scBodyMeasureService.deleteScBodyMeasureByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query){
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
return success(scBodyMeasureService.searchEarNumbers(query.trim()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入体尺测量数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:import')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/import")
|
||||
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<>(ScBodyMeasure.class);
|
||||
List<ScBodyMeasure> list = util.importExcel(file.getInputStream());
|
||||
|
||||
// 数据校验和处理
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ScBodyMeasure measure = list.get(i);
|
||||
try {
|
||||
// 根据耳号查询羊只ID
|
||||
if (StringUtils.isNotBlank(measure.getManageTags())) {
|
||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(measure.getManageTags().trim());
|
||||
if (sheep == null) {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:耳号【")
|
||||
.append(measure.getManageTags()).append("】不存在;");
|
||||
continue;
|
||||
}
|
||||
measure.setSheepId(sheep.getId());
|
||||
} else {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:耳号不能为空;");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 设置默认值
|
||||
measure.setCreateTime(DateUtils.getNowDate());
|
||||
measure.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
scBodyMeasureService.insertScBodyMeasure(measure);
|
||||
successCount++;
|
||||
|
||||
// 更新羊只当前体重
|
||||
if (measure.getCurrentWeight() != null) {
|
||||
BasSheep updateSheep = new BasSheep();
|
||||
updateSheep.setId(measure.getSheepId());
|
||||
updateSheep.setCurrentWeight(measure.getCurrentWeight());
|
||||
basSheepService.updateBasSheep(updateSheep);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:").append(e.getMessage()).append(";");
|
||||
}
|
||||
}
|
||||
|
||||
String msg = String.format("导入完成:成功%d条,失败%d条", successCount, failCount);
|
||||
if (failCount > 0) {
|
||||
msg += ";失败原因:" + errorMsg.toString();
|
||||
}
|
||||
return success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取繁殖状态列表(用于下拉选择)
|
||||
*/
|
||||
@GetMapping("/breedStatus")
|
||||
public AjaxResult listBreedStatus() {
|
||||
return success(scBodyMeasureService.selectBreedStatusList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.zhyc.module.produce.bodyManage.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -62,8 +65,10 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
/**
|
||||
* 测量日期
|
||||
*/
|
||||
@Excel(name = "测量日期")
|
||||
private LocalDate measureDate;
|
||||
@Excel(name = "测量日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date measureDate;
|
||||
/**
|
||||
* 羊只类别
|
||||
*/
|
||||
@@ -82,10 +87,12 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
/**
|
||||
* 出生体重
|
||||
*/
|
||||
@Excel(name = "出生体重")
|
||||
private BigDecimal birthWeight;
|
||||
/**
|
||||
* 断奶体重
|
||||
*/
|
||||
@Excel(name = "断奶体重")
|
||||
private BigDecimal weaningWeight;
|
||||
/**
|
||||
* 当前体重
|
||||
@@ -173,6 +180,13 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "配后天数")
|
||||
private Integer postMatingDay;
|
||||
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -180,12 +194,22 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 月龄查询条件(开始),非数据库字段
|
||||
*/
|
||||
private Integer monthAgeStart;
|
||||
|
||||
/**
|
||||
* 月龄查询条件(结束),非数据库字段
|
||||
*/
|
||||
private Integer monthAgeEnd;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,13 @@ public class ScBodyScore extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,13 @@ public class ScBreastRating extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.bodyManage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -69,4 +71,9 @@ public interface ScBodyMeasureMapper
|
||||
List<ScBodyMeasure> selectScBodyMeasureList(
|
||||
@Param("sc") ScBodyMeasure sc,
|
||||
@Param("manageTagsList") List<String> manageTagsList);
|
||||
|
||||
/**
|
||||
* 查询繁殖状态列表
|
||||
*/
|
||||
List<Map<String, Object>> selectBreedStatusList();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.bodyManage.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
|
||||
/**
|
||||
@@ -60,4 +62,9 @@ public interface IScBodyMeasureService
|
||||
public int deleteScBodyMeasureById(Long id);
|
||||
|
||||
List<String> searchEarNumbers(String query);
|
||||
|
||||
/**
|
||||
* 查询繁殖状态列表
|
||||
*/
|
||||
List<Map<String, Object>> selectBreedStatusList();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.bodyManage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
@@ -127,4 +129,9 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
||||
{
|
||||
return scBodyMeasureMapper.deleteScBodyMeasureById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectBreedStatusList() {
|
||||
return scBodyMeasureMapper.selectBreedStatusList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,7 @@ import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
|
||||
import com.zhyc.module.produce.breed.service.IScBreedPlanGenerateService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.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;
|
||||
@@ -54,9 +47,9 @@ public class ScBreedPlanGenerateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectEwe')")
|
||||
@GetMapping("/selectEwe")
|
||||
public AjaxResult selectEligibleEwe()
|
||||
public AjaxResult selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags)
|
||||
{
|
||||
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe();
|
||||
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe(manageTags);
|
||||
return success(eligibleEwe);
|
||||
}
|
||||
|
||||
@@ -65,9 +58,9 @@ public class ScBreedPlanGenerateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectRam')")
|
||||
@GetMapping("/selectRam")
|
||||
public AjaxResult selectEligibleRam()
|
||||
public AjaxResult selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags)
|
||||
{
|
||||
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam();
|
||||
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam(manageTags);
|
||||
return success(eligibleRam);
|
||||
}
|
||||
|
||||
@@ -249,4 +242,19 @@ public class ScBreedPlanGenerateController extends BaseController
|
||||
{
|
||||
return toAjax(scBreedPlanGenerateService.deleteScBreedPlanGenerateByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mating_plan:generate:query')") // 根据实际权限修改
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
List<String> earNumbers = scBreedPlanGenerateService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,8 +143,8 @@ public class ScBreedRecordController extends BaseController
|
||||
if (scBreedRecord.getBreedType() == null) {
|
||||
return error("配种方式不能为空");
|
||||
}
|
||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 4) {
|
||||
return error("配种方式只能是:1-同期发情、2-本交、3-冲胚、4-自然发情人工授精");
|
||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 5) {
|
||||
return error("配种方式只能是:1-供体母羊配种、2-同期发情人工授精、3-本交、4-自然发情人工授精、5-胚胎移植");
|
||||
}
|
||||
|
||||
// 验证技术员
|
||||
@@ -239,4 +239,6 @@ public class ScBreedRecordController extends BaseController
|
||||
List<ScBreedRecord> records = scBreedRecordService.getBreedRecordsByTimeRange(sheepId, startDate, endDate);
|
||||
return success(records);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.zhyc.module.produce.breed.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -29,8 +28,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 干奶记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* * @author ruoyi
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@RestController
|
||||
@@ -51,24 +49,55 @@ public class ScDryMilkController extends BaseController
|
||||
public TableDataInfo list(ScDryMilk scDryMilk)
|
||||
{
|
||||
try {
|
||||
// 添加调试日志
|
||||
// 处理耳号多选:将逗号/空格分隔的字符串转为List
|
||||
if (scDryMilk.getManageTags() != null && !scDryMilk.getManageTags().trim().isEmpty()) {
|
||||
logger.info("搜索耳号参数: [{}]", scDryMilk.getManageTags());
|
||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
||||
if (scDryMilk.getManageTagsList() == null) {
|
||||
scDryMilk.setManageTagsList(new ArrayList<>());
|
||||
}
|
||||
String[] tags = scDryMilk.getManageTags().trim().split("[,,\\s]+");
|
||||
scDryMilk.getManageTagsList().addAll(Arrays.asList(tags));
|
||||
}
|
||||
|
||||
// 处理技术员多选:将逗号分隔的字符串转为List
|
||||
if (scDryMilk.getTecahnician() != null && !scDryMilk.getTecahnician().trim().isEmpty()) {
|
||||
if (scDryMilk.getTechnicianList() == null) {
|
||||
scDryMilk.setTechnicianList(new ArrayList<>());
|
||||
}
|
||||
String[] techs = scDryMilk.getTecahnician().trim().split("[,,\\s]+");
|
||||
scDryMilk.getTechnicianList().addAll(Arrays.asList(techs));
|
||||
}
|
||||
|
||||
startPage();
|
||||
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
||||
|
||||
logger.info("查询到干奶记录数量: {}", list.size());
|
||||
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询干奶记录列表失败", e);
|
||||
return getDataTable(new java.util.ArrayList<>());
|
||||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程搜索耳号列表
|
||||
*/
|
||||
@GetMapping("/searchEarNumbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam(value = "query", required = false) String query)
|
||||
{
|
||||
if (query == null) query = "";
|
||||
List<String> list = scDryMilkService.selectSheepEarNumberList(query);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程搜索技术员列表
|
||||
*/
|
||||
@GetMapping("/searchTechnicians")
|
||||
public AjaxResult searchTechnicians(@RequestParam(value = "query", required = false) String query)
|
||||
{
|
||||
if (query == null) query = "";
|
||||
List<String> list = scDryMilkService.selectTechnicianList(query);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出干奶记录列表
|
||||
*/
|
||||
@@ -78,8 +107,14 @@ public class ScDryMilkController extends BaseController
|
||||
public void export(HttpServletResponse response, ScDryMilk scDryMilk)
|
||||
{
|
||||
try {
|
||||
// 导出也需要支持多选查询
|
||||
if (scDryMilk.getManageTags() != null) {
|
||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
||||
String[] tags = scDryMilk.getManageTags().trim().split("[,,\\s]+");
|
||||
scDryMilk.setManageTagsList(Arrays.asList(tags));
|
||||
}
|
||||
if (scDryMilk.getTecahnician() != null) {
|
||||
String[] techs = scDryMilk.getTecahnician().trim().split("[,,\\s]+");
|
||||
scDryMilk.setTechnicianList(Arrays.asList(techs));
|
||||
}
|
||||
|
||||
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
||||
@@ -97,90 +132,21 @@ public class ScDryMilkController extends BaseController
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
try {
|
||||
if (id == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
ScDryMilk result = scDryMilkService.selectScDryMilkById(id);
|
||||
if (result == null) {
|
||||
return error("记录不存在");
|
||||
}
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取干奶记录详细信息失败,ID: " + id, e);
|
||||
return error("获取记录详细信息失败: " + e.getMessage());
|
||||
}
|
||||
return success(scDryMilkService.selectScDryMilkById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号查询羊只ID - 新增耳号验证功能
|
||||
*/
|
||||
@GetMapping("/validateEarTag")
|
||||
public AjaxResult validateEarTag(@RequestParam("manageTags") String manageTags)
|
||||
{
|
||||
try {
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("耳号不能为空");
|
||||
}
|
||||
|
||||
String cleanTag = manageTags.trim();
|
||||
logger.info("验证耳号: [{}]", cleanTag);
|
||||
|
||||
Long sheepId = scDryMilkService.selectSheepIdByManageTags(cleanTag);
|
||||
if (sheepId == null) {
|
||||
logger.warn("耳号 [{}] 不存在", cleanTag);
|
||||
return error("该耳号不存在,请检查输入");
|
||||
}
|
||||
|
||||
logger.info("验证耳号成功,羊只ID: {}", sheepId);
|
||||
return AjaxResult.success("耳号验证通过", sheepId);
|
||||
} catch (Exception e) {
|
||||
logger.error("验证耳号失败,耳号: " + manageTags, e);
|
||||
return error("验证耳号时出错: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号查询羊只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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取羊舍列表 - 用于嵌套选择
|
||||
* 获取羊舍列表
|
||||
*/
|
||||
@GetMapping("/sheepfoldList")
|
||||
public AjaxResult getSheepfoldList(@RequestParam(value = "ranchId", required = false) Long ranchId,
|
||||
@RequestParam(value = "sheepfoldTypeId", required = false) Long sheepfoldTypeId)
|
||||
public AjaxResult getSheepfoldList(DaSheepfold daSheepfold)
|
||||
{
|
||||
try {
|
||||
DaSheepfold query = new DaSheepfold();
|
||||
if (ranchId != null) {
|
||||
query.setRanchId(ranchId);
|
||||
}
|
||||
if (sheepfoldTypeId != null) {
|
||||
query.setSheepfoldTypeId(sheepfoldTypeId);
|
||||
}
|
||||
|
||||
List<DaSheepfold> sheepfoldList = daSheepfoldService.selectDaSheepfoldList(query);
|
||||
logger.info("查询羊舍列表,牧场ID: {}, 类型ID: {}, 结果数量: {}", ranchId, sheepfoldTypeId, sheepfoldList.size());
|
||||
|
||||
return success(sheepfoldList);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取羊舍列表失败", e);
|
||||
return error("获取羊舍列表失败: " + e.getMessage());
|
||||
}
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增干奶记录
|
||||
* 新增干奶记录 (支持批量录入)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:add')")
|
||||
@Log(title = "干奶记录", businessType = BusinessType.INSERT)
|
||||
@@ -188,43 +154,41 @@ public class ScDryMilkController extends BaseController
|
||||
public AjaxResult add(@RequestBody ScDryMilk scDryMilk)
|
||||
{
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scDryMilk == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scDryMilk.getManageTags() == null || scDryMilk.getManageTags().trim().isEmpty()) {
|
||||
if (scDryMilk == null || scDryMilk.getManageTags() == null) {
|
||||
return error("耳号不能为空");
|
||||
}
|
||||
|
||||
if (scDryMilk.getDatetime() == null) {
|
||||
return error("干奶日期不能为空");
|
||||
// 批量解析耳号
|
||||
String[] tags = scDryMilk.getManageTags().trim().split("[\\s,,\n]+");
|
||||
int successCount = 0;
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
|
||||
for (String tag : tags) {
|
||||
if (tag.isEmpty()) continue;
|
||||
|
||||
Long sheepId = scDryMilkService.selectSheepIdByManageTags(tag);
|
||||
if (sheepId == null) {
|
||||
errorMsg.append(tag).append("不存在; ");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (scDryMilk.getStatus() == null) {
|
||||
return error("请选择是否使用乳头封闭剂");
|
||||
ScDryMilk newItem = new ScDryMilk();
|
||||
newItem.setSheepId(String.valueOf(sheepId));
|
||||
newItem.setDatetime(scDryMilk.getDatetime());
|
||||
newItem.setStatus(scDryMilk.getStatus());
|
||||
newItem.setSheepfold(scDryMilk.getSheepfold());
|
||||
newItem.setTecahnician(scDryMilk.getTecahnician());
|
||||
newItem.setComment(scDryMilk.getComment());
|
||||
newItem.setCreateBy(getUsername());
|
||||
|
||||
scDryMilkService.insertScDryMilk(newItem);
|
||||
successCount++;
|
||||
}
|
||||
|
||||
// 清理输入参数
|
||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
||||
if (scDryMilk.getTecahnician() != null) {
|
||||
scDryMilk.setTecahnician(scDryMilk.getTecahnician().trim());
|
||||
}
|
||||
if (scDryMilk.getComment() != null) {
|
||||
scDryMilk.setComment(scDryMilk.getComment().trim());
|
||||
}
|
||||
|
||||
logger.info("新增干奶记录,耳号: {}", scDryMilk.getManageTags());
|
||||
|
||||
int result = scDryMilkService.insertScDryMilk(scDryMilk);
|
||||
if (result > 0) {
|
||||
// 重新查询插入的记录,包含自动生成的创建时间
|
||||
ScDryMilk insertedRecord = scDryMilkService.selectScDryMilkById(scDryMilk.getId());
|
||||
logger.info("新增干奶记录成功,记录ID: {}", scDryMilk.getId());
|
||||
return success(insertedRecord);
|
||||
} else {
|
||||
return error("新增失败");
|
||||
if (errorMsg.length() > 0) {
|
||||
return warn("成功录入 " + successCount + " 条。失败详情:" + errorMsg.toString());
|
||||
}
|
||||
return success("成功录入 " + successCount + " 条记录");
|
||||
} catch (Exception e) {
|
||||
logger.error("新增干奶记录失败", e);
|
||||
return error("新增失败: " + e.getMessage());
|
||||
@@ -239,39 +203,7 @@ public class ScDryMilkController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScDryMilk scDryMilk)
|
||||
{
|
||||
try {
|
||||
if (scDryMilk == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scDryMilk.getId() == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
// 清理输入参数
|
||||
if (scDryMilk.getManageTags() != null) {
|
||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
||||
}
|
||||
if (scDryMilk.getTecahnician() != null) {
|
||||
scDryMilk.setTecahnician(scDryMilk.getTecahnician().trim());
|
||||
}
|
||||
if (scDryMilk.getComment() != null) {
|
||||
scDryMilk.setComment(scDryMilk.getComment().trim());
|
||||
}
|
||||
|
||||
logger.info("修改干奶记录,ID: {}", scDryMilk.getId());
|
||||
|
||||
int result = scDryMilkService.updateScDryMilk(scDryMilk);
|
||||
if (result > 0) {
|
||||
logger.info("修改干奶记录成功");
|
||||
return success("修改成功");
|
||||
} else {
|
||||
return error("修改失败,记录可能不存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("修改干奶记录失败", e);
|
||||
return error("修改失败: " + e.getMessage());
|
||||
}
|
||||
return toAjax(scDryMilkService.updateScDryMilk(scDryMilk));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,71 +214,6 @@ public class ScDryMilkController extends BaseController
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
try {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return error("删除的记录ID不能为空");
|
||||
return toAjax(scDryMilkService.deleteScDryMilkByIds(ids));
|
||||
}
|
||||
|
||||
logger.info("删除干奶记录,IDs: {}", java.util.Arrays.toString(ids));
|
||||
|
||||
int result = scDryMilkService.deleteScDryMilkByIds(ids);
|
||||
if (result > 0) {
|
||||
logger.info("删除干奶记录成功,删除数量: {}", result);
|
||||
return success("删除成功");
|
||||
} else {
|
||||
return error("删除失败,记录可能不存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("删除干奶记录失败", e);
|
||||
return error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:quary')")
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
List<String> earNumbers = scDryMilkService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量验证耳号
|
||||
*/
|
||||
@GetMapping("/validateBatchEarTags")
|
||||
public AjaxResult validateBatchEarTags(@RequestParam("manageTags") String manageTags) {
|
||||
try {
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("耳号不能为空");
|
||||
}
|
||||
|
||||
// 支持多种分隔符
|
||||
String[] earTagArray = manageTags.split("[\\s,,]+");
|
||||
List<Map<String, Object>> results = new ArrayList<>();
|
||||
|
||||
for (String earTag : earTagArray) {
|
||||
String cleanTag = earTag.trim();
|
||||
if (cleanTag.isEmpty()) continue;
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("earTag", cleanTag);
|
||||
|
||||
Long sheepId = scDryMilkService.selectSheepIdByManageTags(cleanTag);
|
||||
result.put("exists", sheepId != null);
|
||||
result.put("sheepId", sheepId);
|
||||
|
||||
results.add(result);
|
||||
}
|
||||
|
||||
return success(results);
|
||||
} catch (Exception e) {
|
||||
logger.error("批量验证耳号失败", e);
|
||||
return error("验证失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,12 +5,19 @@ import java.util.Map;
|
||||
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.*;
|
||||
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.RequestParam;
|
||||
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.common.exception.ServiceException;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||
import com.zhyc.module.biosafety.service.ISwDiseaseService;
|
||||
@@ -41,19 +48,35 @@ public class ScSheepDeathController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
try {
|
||||
startPage();
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询羊只死淘记录列表失败", e);
|
||||
return getDataTable(new java.util.ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据管理耳号查询羊只信息
|
||||
* 搜索管理耳号(用于下拉提示)
|
||||
*/
|
||||
@GetMapping("/search/earNo")
|
||||
public AjaxResult searchEarNo(@RequestParam("query") String query) {
|
||||
return success(scSheepDeathService.selectDistinctManageTags(query == null ? "" : query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索技术员(用于下拉提示)
|
||||
*/
|
||||
@GetMapping("/search/technician")
|
||||
public AjaxResult searchTechnician(@RequestParam("query") String query) {
|
||||
return success(scSheepDeathService.selectDistinctTechnician(query == null ? "" : query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理人(用于下拉提示)
|
||||
*/
|
||||
@GetMapping("/search/handler")
|
||||
public AjaxResult searchHandler(@RequestParam("query") String query) {
|
||||
return success(scSheepDeathService.selectDistinctHandler(query == null ? "" : query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||
@GetMapping("/sheepInfo/{manageTags}")
|
||||
public AjaxResult getSheepInfo(@PathVariable("manageTags") String manageTags)
|
||||
@@ -62,7 +85,6 @@ public class ScSheepDeathController extends BaseController
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
Map<String, Object> sheepInfo = scSheepDeathService.selectSheepFileByManageTags(manageTags.trim());
|
||||
if (sheepInfo != null) {
|
||||
return success(sheepInfo);
|
||||
@@ -70,187 +92,63 @@ public class ScSheepDeathController extends BaseController
|
||||
return error("未找到该耳号对应的羊只信息");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询羊只信息失败,管理耳号: " + manageTags, e);
|
||||
return error("查询羊只信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取疾病树形列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||
@GetMapping("/disease/tree")
|
||||
public AjaxResult getDiseaseTree()
|
||||
{
|
||||
try {
|
||||
List<SwDisease> diseaseList = swDiseaseService.selectSwDiseaseList(new SwDisease());
|
||||
return success(diseaseList);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取疾病树形列表失败", e);
|
||||
return error("获取疾病列表失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出羊只死淘记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:export')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScSheepDeath scSheepDeath)
|
||||
{
|
||||
try {
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
ExcelUtil<ScSheepDeath> util = new ExcelUtil<ScSheepDeath>(ScSheepDeath.class);
|
||||
util.exportExcel(response, list, "羊只死淘记录数据");
|
||||
} catch (Exception e) {
|
||||
logger.error("导出羊只死淘记录失败", e);
|
||||
// 可以在这里返回错误响应
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取羊只死淘记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
try {
|
||||
if (id == null) {
|
||||
return error("记录ID不能为空");
|
||||
return success(scSheepDeathService.selectScSheepDeathById(id));
|
||||
}
|
||||
|
||||
ScSheepDeath result = scSheepDeathService.selectScSheepDeathById(id);
|
||||
if (result == null) {
|
||||
return error("记录不存在");
|
||||
}
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取羊只死淘记录详细信息失败,ID: " + id, e);
|
||||
return error("获取记录详细信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只死淘记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:add')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScSheepDeath scSheepDeath)
|
||||
{
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scSheepDeath == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
||||
if (scSheepDeath == null || scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getDeathDate() == null) {
|
||||
return error("死淘日期不能为空");
|
||||
}
|
||||
|
||||
int result = scSheepDeathService.insertScSheepDeath(scSheepDeath);
|
||||
if (result > 0) {
|
||||
return success("新增成功");
|
||||
} else {
|
||||
return error("新增失败");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("新增羊只死淘记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
return toAjax(scSheepDeathService.insertScSheepDeath(scSheepDeath));
|
||||
} catch (Exception e) {
|
||||
logger.error("新增羊只死淘记录失败", e);
|
||||
return error("新增失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改羊只死淘记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:edit')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScSheepDeath scSheepDeath)
|
||||
{
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scSheepDeath == null) {
|
||||
return error("请求参数不能为空");
|
||||
return toAjax(scSheepDeathService.updateScSheepDeath(scSheepDeath));
|
||||
}
|
||||
|
||||
if (scSheepDeath.getId() == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getDeathDate() == null) {
|
||||
return error("死淘日期不能为空");
|
||||
}
|
||||
|
||||
int result = scSheepDeathService.updateScSheepDeath(scSheepDeath);
|
||||
if (result > 0) {
|
||||
return success("修改成功");
|
||||
} else {
|
||||
return error("修改失败,记录可能不存在");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("修改羊只死淘记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("修改羊只死淘记录失败", e);
|
||||
return error("修改失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除羊只死淘记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:remove')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
try {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return error("删除的记录ID不能为空");
|
||||
}
|
||||
|
||||
int result = scSheepDeathService.deleteScSheepDeathByIds(ids);
|
||||
if (result > 0) {
|
||||
return success("删除成功");
|
||||
} else {
|
||||
return error("删除失败,记录可能不存在");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("删除羊只死淘记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("删除羊只死淘记录失败", e);
|
||||
return error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
List<String> earNumbers = scSheepDeathService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
return toAjax(scSheepDeathService.deleteScSheepDeathByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -17,9 +18,6 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 断奶记录Controller
|
||||
*
|
||||
* @author zhyc
|
||||
* @date 2024-01-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/Weaning/weaning_record")
|
||||
@@ -38,6 +36,16 @@ public class ScWeanRecordController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【新增】模糊查询耳号列表 (用于前端下拉框远程搜索)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:list')")
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
List<String> list = scWeanRecordService.searchEarNumbers(query);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出断奶记录列表
|
||||
*/
|
||||
@@ -80,7 +88,6 @@ public class ScWeanRecordController extends BaseController {
|
||||
@Log(title = "断奶记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScWeanRecord scWeanRecord) {
|
||||
// 验证耳号是否存在
|
||||
if (scWeanRecord.getEarNumber() != null) {
|
||||
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
||||
if (sheepId == null) {
|
||||
@@ -88,20 +95,10 @@ public class ScWeanRecordController extends BaseController {
|
||||
}
|
||||
scWeanRecord.setSheepId(sheepId);
|
||||
}
|
||||
|
||||
// 验证必要字段
|
||||
if (scWeanRecord.getSheepId() == null) {
|
||||
return error("羊只信息不能为空");
|
||||
}
|
||||
if (scWeanRecord.getDatetime() == null) {
|
||||
return error("断奶日期不能为空");
|
||||
}
|
||||
if (scWeanRecord.getWeight() == null) {
|
||||
return error("断奶重量不能为空");
|
||||
}
|
||||
if (scWeanRecord.getStatus() == null) {
|
||||
return error("是否留养不能为空");
|
||||
}
|
||||
if (scWeanRecord.getSheepId() == null) return error("羊只信息不能为空");
|
||||
if (scWeanRecord.getDatetime() == null) return error("断奶日期不能为空");
|
||||
if (scWeanRecord.getWeight() == null) return error("断奶重量不能为空");
|
||||
if (scWeanRecord.getStatus() == null) return error("是否留养不能为空");
|
||||
|
||||
scWeanRecord.setCreateBy(getUsername());
|
||||
return toAjax(scWeanRecordService.insertScWeanRecord(scWeanRecord));
|
||||
@@ -114,32 +111,11 @@ public class ScWeanRecordController extends BaseController {
|
||||
@Log(title = "断奶记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScWeanRecord scWeanRecord) {
|
||||
// 验证耳号是否存在
|
||||
if (scWeanRecord.getEarNumber() != null) {
|
||||
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
||||
if (sheepId == null) {
|
||||
return error("耳号不存在,请检查后重新输入");
|
||||
}
|
||||
if (sheepId == null) return error("耳号不存在");
|
||||
scWeanRecord.setSheepId(sheepId);
|
||||
}
|
||||
|
||||
// 验证必要字段
|
||||
if (scWeanRecord.getId() == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
if (scWeanRecord.getSheepId() == null) {
|
||||
return error("羊只信息不能为空");
|
||||
}
|
||||
if (scWeanRecord.getDatetime() == null) {
|
||||
return error("断奶日期不能为空");
|
||||
}
|
||||
if (scWeanRecord.getWeight() == null) {
|
||||
return error("断奶重量不能为空");
|
||||
}
|
||||
if (scWeanRecord.getStatus() == null) {
|
||||
return error("是否留养不能为空");
|
||||
}
|
||||
|
||||
return toAjax(scWeanRecordService.updateScWeanRecord(scWeanRecord));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -65,4 +67,15 @@ public class ScBreedPlanGenerate extends BaseEntity
|
||||
/** 审批意见 */
|
||||
private String approveRemark;
|
||||
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user