Merge remote-tracking branch 'origin/main'

# Conflicts:
#	zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java
This commit is contained in:
ll 2025-08-25 16:38:04 +08:00
commit 3dd5d37076
206 changed files with 5591 additions and 2841 deletions

View File

@ -3,7 +3,6 @@ package com.zhyc;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/** /**
* 启动程序 * 启动程序

View File

@ -8,6 +8,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;

View File

@ -66,6 +66,21 @@ public class SecurityUtils
} }
} }
/**
* 用户昵称
**/
public static String getNickName()
{
try
{
return getLoginUser().getUser().getNickName();
}
catch (Exception e)
{
throw new ServiceException("获取用户昵称异常", HttpStatus.UNAUTHORIZED);
}
}
/** /**
* 获取用户 * 获取用户
**/ **/

View File

@ -4,7 +4,6 @@ import java.lang.reflect.Method;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -12,7 +11,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.RedisScript; import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.stereotype.Component;
import com.zhyc.common.annotation.RateLimiter; import com.zhyc.common.annotation.RateLimiter;
import com.zhyc.common.enums.LimitType; import com.zhyc.common.enums.LimitType;
import com.zhyc.common.exception.ServiceException; import com.zhyc.common.exception.ServiceException;

View File

@ -1,9 +1,6 @@
package com.zhyc.framework.config; package com.zhyc.framework.config;
import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript; import org.springframework.data.redis.core.script.DefaultRedisScript;

View File

@ -8,7 +8,6 @@ import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BasSheepVariety; import com.zhyc.module.base.domain.BasSheepVariety;
import com.zhyc.module.base.mapper.BasSheepMapper;
import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.base.service.IBasSheepService;
import com.zhyc.module.base.service.IBasSheepVarietyService; import com.zhyc.module.base.service.IBasSheepVarietyService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;

View File

@ -1,12 +1,15 @@
package com.zhyc.module.base.controller; package com.zhyc.module.base.controller;
import java.util.Arrays; import java.io.IOException;
import java.util.List; import java.util.*;
import java.util.Map; import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.core.domain.entity.SysDictData;
import com.zhyc.common.utils.StringUtils; import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.domain.BasGroupTreeVo;
import com.zhyc.module.base.domain.BasSheepGroupMapping; import com.zhyc.module.base.domain.BasSheepGroupMapping;
import com.zhyc.module.base.domain.BasSheepGroupExportVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -22,6 +25,13 @@ import com.zhyc.common.core.page.TableDataInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
// 1. 引入若依字典工具
import com.zhyc.common.utils.DictUtils;
/** /**
* 羊只分组关联Controller * 羊只分组关联Controller
@ -33,6 +43,20 @@ import org.slf4j.LoggerFactory;
@RequestMapping("/sheep_grouping/sheep_grouping") @RequestMapping("/sheep_grouping/sheep_grouping")
public class BasSheepGroupMappingController extends BaseController public class BasSheepGroupMappingController extends BaseController
{ {
// 工具方法LocalDateTime -> Date
private Date toDate(Object obj) {
if (obj == null) {
return null;
}
if (obj instanceof Date) {
return (Date) obj;
}
if (obj instanceof LocalDateTime) {
return Date.from(((LocalDateTime) obj).atZone(ZoneId.systemDefault()).toInstant());
}
throw new IllegalArgumentException("不支持的日期类型:" + obj.getClass());
}
@Autowired @Autowired
private IBasSheepGroupMappingService basSheepGroupMappingService; private IBasSheepGroupMappingService basSheepGroupMappingService;
@ -73,16 +97,73 @@ public class BasSheepGroupMappingController extends BaseController
/** /**
* 导出羊只分组关联列表 * 导出羊只分组关联列表
*/ */
// @PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:export')")
// @Log(title = "羊只分组关联", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, BasSheepGroupMapping basSheepGroupMapping)
// {
// List<BasSheepGroupMapping> list = basSheepGroupMappingService.selectBasSheepGroupMappingList(basSheepGroupMapping);
// ExcelUtil<BasSheepGroupMapping> util = new ExcelUtil<BasSheepGroupMapping>(BasSheepGroupMapping.class);
// util.exportExcel(response, list, "羊只分组关联数据");
// }
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:export')") @PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:export')")
@Log(title = "羊只分组关联", businessType = BusinessType.EXPORT) @Log(title = "羊只分组关联", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, BasSheepGroupMapping basSheepGroupMapping) public void exportJoin(HttpServletResponse response,
{ @RequestParam(required = false) Long sheepId,
List<BasSheepGroupMapping> list = basSheepGroupMappingService.selectBasSheepGroupMappingList(basSheepGroupMapping); @RequestParam(required = false) Long groupId,
ExcelUtil<BasSheepGroupMapping> util = new ExcelUtil<BasSheepGroupMapping>(BasSheepGroupMapping.class); @RequestParam(required = false) String bsManageTags) throws IOException {
util.exportExcel(response, list, "羊只分组关联数据");
// 1. 把前端传来的耳号字符串转 List
List<String> earList = null;
if (StringUtils.hasText(bsManageTags)) {
earList = Arrays.asList(bsManageTags.split("[,\\s]+"));
}
// 2. 先查出来这里返回 List<Map<String,Object>>
List<Map<String, Object>> list = basSheepGroupMappingService
.selectBasSheepGroupMappingList(sheepId, groupId, earList);
// 放在 stream 外面避免每次都查缓存
Map<String, String> genderMap = new HashMap<>();
List<SysDictData> genderDict = DictUtils.getDictCache("sheep_gender");
if (genderDict != null) {
genderDict.forEach(d -> genderMap.put(d.getDictValue(), d.getDictLabel()));
}
// 3. Map VO
List<BasSheepGroupExportVo> voList = list.stream()
.map(m -> {
BasSheepGroupExportVo vo = new BasSheepGroupExportVo();
vo.setGroupId(m.get("group_id") == null ? null : ((Number) m.get("group_id")).longValue());
vo.setGroupName((String) m.get("group_name"));
vo.setBsManageTags((String) m.get("bs_manage_tags"));
vo.setVariety((String) m.get("variety"));
vo.setFamily((String) m.get("family"));
vo.setName((String) m.get("name"));
vo.setGender(m.get("gender") == null ? null : ((Number) m.get("gender")).longValue());
Long genderCode = m.get("gender") == null ? null : ((Number) m.get("gender")).longValue();
vo.setGender(genderCode);
vo.setGenderText(genderMap.get(String.valueOf(genderCode)));
vo.setBirthday(toDate(m.get("birthday")));
vo.setMonthAge(m.get("month_age") == null ? null : ((Number) m.get("month_age")).longValue());
vo.setParity(m.get("parity") == null ? null : ((Number) m.get("parity")).longValue());
vo.setBirthWeight(m.get("birth_weight") == null ? null : ((Number) m.get("birth_weight")).longValue());
vo.setWeaningWeight(m.get("weaning_weight") == null ? null : ((Number) m.get("weaning_weight")).longValue());
vo.setCurrentWeight(m.get("current_weight") == null ? null : ((Number) m.get("current_weight")).longValue());
vo.setBreed((String) m.get("breed"));
vo.setFatherManageTags((String) m.get("father_manage_tags"));
vo.setMotherManageTags((String) m.get("mother_manage_tags"));
return vo;
})
.collect(Collectors.toList());
// 4. 导出
ExcelUtil<BasSheepGroupExportVo> util = new ExcelUtil<>(BasSheepGroupExportVo.class);
util.exportExcel(response, voList, "羊只分组关联数据");
} }
/** /**
* 获取羊只分组关联详细信息 * 获取羊只分组关联详细信息
*/ */
@ -144,5 +225,13 @@ public class BasSheepGroupMappingController extends BaseController
} }
/**
* 树形分组下拉框
*/
@GetMapping("/group/tree")
public AjaxResult groupTree() {
return success(basSheepGroupMappingService.selectGroupTree());
}
} }

View File

@ -1,12 +1,8 @@
package com.zhyc.module.base.controller; package com.zhyc.module.base.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.base.service.IBasSheepService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -14,7 +14,11 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DictUtils;
/** /**
* 羊舍管理Controller * 羊舍管理Controller
@ -119,4 +123,73 @@ public class DaSheepfoldController extends BaseController
boolean exist = daSheepfoldService.checkSheepfoldNoExist(ranchId, sheepfoldTypeId, sheepfoldNo); boolean exist = daSheepfoldService.checkSheepfoldNoExist(ranchId, sheepfoldTypeId, sheepfoldNo);
return AjaxResult.success(exist); return AjaxResult.success(exist);
} }
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:list')")
@GetMapping("/seatMap")
public AjaxResult seatMap() {
List<DaSheepfold> flat = daSheepfoldService.selectDaSheepfoldList(new DaSheepfold());
Map<Long, Map<String, Object>> tree = new LinkedHashMap<>();
for (DaSheepfold s : flat) {
Long ranchId = s.getRanchId();
Long typeId = s.getSheepfoldTypeId();
String foldNo = s.getSheepfoldNo();
String rowNo = s.getRowNo();
String columns = s.getColumns();
// 翻译字典
String ranchName = DictUtils.getDictLabel("da_ranch", String.valueOf(ranchId));
String typeName = DictUtils.getDictLabel("bas_sheepfold_type", String.valueOf(typeId));
// 牧场
Map<String, Object> ranch = tree.computeIfAbsent(ranchId, k -> {
Map<String, Object> r = new LinkedHashMap<>();
r.put("ranchId", k);
r.put("ranchName", ranchName);
r.put("types", new ArrayList<>());
return r;
});
// 类型
Map<String, Object> type = ((List<Map<String, Object>>) ranch.get("types")).stream()
.filter(t -> typeId.equals(t.get("typeId")))
.findFirst()
.orElseGet(() -> {
Map<String, Object> t = new LinkedHashMap<>();
t.put("typeId", typeId);
t.put("typeName", typeName);
t.put("folds", new ArrayList<>());
((List<Map<String, Object>>) ranch.get("types")).add(t);
return t;
});
// 羊舍
Map<String, Object> fold = ((List<Map<String, Object>>) type.get("folds")).stream()
.filter(f -> foldNo.equals(f.get("foldNo")))
.findFirst()
.orElseGet(() -> {
Map<String, Object> f = new LinkedHashMap<>();
f.put("foldNo", foldNo);
f.put("rows", new ArrayList<>());
((List<Map<String, Object>>) type.get("folds")).add(f);
return f;
});
//
Map<String, Object> row = ((List<Map<String, Object>>) fold.get("rows")).stream()
.filter(r -> rowNo.equals(r.get("rowNo")))
.findFirst()
.orElseGet(() -> {
Map<String, Object> newRow = new LinkedHashMap<>();
newRow.put("rowNo", rowNo);
newRow.put("columns", new ArrayList<>());
((List<Map<String, Object>>) fold.get("rows")).add(newRow);
return newRow;
});
// 将列号添加到对应的行
((List<String>) row.get("columns")).add(columns);
}
return success(new ArrayList<>(tree.values()));
}
} }

View File

@ -6,7 +6,6 @@ import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.core.page.TableDataInfo;
import com.zhyc.common.enums.BusinessType; import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.service.ISheepFileService; import com.zhyc.module.base.service.ISheepFileService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -0,0 +1,11 @@
package com.zhyc.module.base.domain;
import lombok.Data;
import java.util.List;
@Data
public class BasGroupTreeVo {
private Long groupId;
private String groupName;
private Long parentId;
private List<BasGroupTreeVo> children;
}

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -5,8 +5,6 @@ import com.zhyc.common.core.domain.TreeEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* 分组管理对象 bas_sheep_group * 分组管理对象 bas_sheep_group

View File

@ -0,0 +1,235 @@
package com.zhyc.module.base.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BasSheepGroupExportVo extends BaseEntity {
private static final long serialVersionUID = 1L;
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
private Long groupId;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/** 分组名称 */
@Excel(name = "分组名称")
private String groupName;
/** 管理耳号 */
@Excel(name = "耳号")
private String bsManageTags;
/** 品种 */
@Excel(name = "品种")
private String variety;
/** 性别 */
private Long gender;
public String getGenderText() {
return genderText;
}
public void setGenderText(String genderText) {
this.genderText = genderText;
}
/* 性别文本,真正导出的列 */
@Excel(name = "性别")
private String genderText;
/** 羊只类型 */
@Excel(name = "羊只类型")
private String name;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** 胎次 */
@Excel(name = "胎次")
private Long parity;
/** 月龄 */
@Excel(name = "月龄")
private Long monthAge;
/** 繁殖状态 */
@Excel(name = "繁殖状态")
private String breed;
/** 出生体重 */
@Excel(name = "出生体重")
private Long birthWeight;
/** 断奶体重 */
@Excel(name = "断奶体重")
private Long weaningWeight;
/** 当前体重 */
@Excel(name = "当前体重")
private Long currentWeight;
/** 父亲管理耳号 */
@Excel(name = "父号")
private String fatherManageTags;
/** 母亲管理耳号 */
@Excel(name = "母号")
private String motherManageTags;
/** 家系 */
@Excel(name = "家系")
private String family;
public String getBsManageTags() {
return bsManageTags;
}
public void setBsManageTags(String bsManageTags) {
this.bsManageTags = bsManageTags;
}
public String getVariety() {
return variety;
}
public void setVariety(String variety) {
this.variety = variety;
}
public String getFamily() {
return family;
}
public void setFamily(String family) {
this.family = family;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getGender() {
return gender;
}
public void setGender(Long gender) {
this.gender = gender;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Long getMonthAge() {
return monthAge;
}
public void setMonthAge(Long monthAge) {
this.monthAge = monthAge;
}
public Long getParity() {
return parity;
}
public void setParity(Long parity) {
this.parity = parity;
}
public Long getBirthWeight() {
return birthWeight;
}
public void setBirthWeight(Long birthWeight) {
this.birthWeight = birthWeight;
}
public Long getWeaningWeight() {
return weaningWeight;
}
public void setWeaningWeight(Long weaningWeight) {
this.weaningWeight = weaningWeight;
}
public Long getCurrentWeight() {
return currentWeight;
}
public void setCurrentWeight(Long currentWeight) {
this.currentWeight = currentWeight;
}
public String getBreed() {
return breed;
}
public void setBreed(String breed) {
this.breed = breed;
}
public String getFatherManageTags() {
return fatherManageTags;
}
public void setFatherManageTags(String fatherManageTags) {
this.fatherManageTags = fatherManageTags;
}
public String getMotherManageTags() {
return motherManageTags;
}
public void setMotherManageTags(String motherManageTags) {
this.motherManageTags = motherManageTags;
}
}

View File

@ -3,8 +3,6 @@ package com.zhyc.module.base.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
@ -33,4 +31,13 @@ public class BasSheepGroupMapping extends BaseEntity
@Excel(name = "分组ID") @Excel(name = "分组ID")
private Long groupId; private Long groupId;
@Excel(name = "耳号")
private String bsManageTags; // 或者 List<String>其他类型
public String getBsManageTags() {
return bsManageTags;
}
public void setBsManageTags(String bsManageTags) {
this.bsManageTags = bsManageTags;
}
} }

View File

@ -3,9 +3,6 @@ package com.zhyc.module.base.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
/** /**

View File

@ -3,8 +3,6 @@ package com.zhyc.module.base.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -3,9 +3,6 @@ package com.zhyc.module.base.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
/** /**

View File

@ -5,8 +5,6 @@ import com.zhyc.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* 羊舍管理对象 da_sheepfold * 羊舍管理对象 da_sheepfold
@ -21,6 +19,70 @@ public class DaSheepfold extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRanchId() {
return ranchId;
}
public void setRanchId(Long ranchId) {
this.ranchId = ranchId;
}
public String getSheepfoldName() {
return sheepfoldName;
}
public void setSheepfoldName(String sheepfoldName) {
this.sheepfoldName = sheepfoldName;
}
public Long getSheepfoldTypeId() {
return sheepfoldTypeId;
}
public void setSheepfoldTypeId(Long sheepfoldTypeId) {
this.sheepfoldTypeId = sheepfoldTypeId;
}
public String getSheepfoldNo() {
return sheepfoldNo;
}
public void setSheepfoldNo(String sheepfoldNo) {
this.sheepfoldNo = sheepfoldNo;
}
public String getRowNo() {
return rowNo;
}
public void setRowNo(String rowNo) {
this.rowNo = rowNo;
}
public String getColumns() {
return columns;
}
public void setColumns(String columns) {
this.columns = columns;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
/** 羊舍id */ /** 羊舍id */
@Excel(name = "羊舍id") @Excel(name = "羊舍id")
private Long id; private Long id;

View File

@ -6,8 +6,6 @@ import com.zhyc.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date; import java.util.Date;

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.zhyc.module.base.domain.BasSheepGroupMapping; import com.zhyc.module.base.domain.BasSheepGroupMapping;
import com.zhyc.module.base.domain.BasGroupTreeVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -85,4 +86,6 @@ public interface BasSheepGroupMappingMapper
List<BasSheepGroupMapping> selectListByGroupId(@Param("groupId") Long groupId); List<BasSheepGroupMapping> selectListByGroupId(@Param("groupId") Long groupId);
List<BasGroupTreeVo> selectGroupTree();
} }

View File

@ -3,6 +3,7 @@ package com.zhyc.module.base.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.BasSheep;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2025-07-15 * @date 2025-07-15
*/ */
@Mapper
public interface BasSheepMapper public interface BasSheepMapper
{ {
/** /**

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.module.base.domain.BasGroupTreeVo;
import com.zhyc.module.base.domain.BasSheepGroupMapping; import com.zhyc.module.base.domain.BasSheepGroupMapping;
/** /**
@ -70,4 +71,9 @@ public interface IBasSheepGroupMappingService
public int deleteBasSheepGroupMappingById(Long id); public int deleteBasSheepGroupMappingById(Long id);
public AjaxResult addByEarTags(List<String> earTags, Long groupId); public AjaxResult addByEarTags(List<String> earTags, Long groupId);
/**
* 树形分组下拉框
*/
List<BasGroupTreeVo> selectGroupTree();
} }

View File

@ -2,7 +2,6 @@ package com.zhyc.module.base.service;
import java.util.List; import java.util.List;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BasSheepType; import com.zhyc.module.base.domain.BasSheepType;
/** /**

View File

@ -4,12 +4,14 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.module.base.domain.BasGroupTreeVo;
import com.zhyc.module.base.domain.BasSheepGroupMapping; import com.zhyc.module.base.domain.BasSheepGroupMapping;
import com.zhyc.module.base.mapper.BasSheepGroupMappingMapper; import com.zhyc.module.base.mapper.BasSheepGroupMappingMapper;
import com.zhyc.module.base.service.IBasSheepGroupMappingService; import com.zhyc.module.base.service.IBasSheepGroupMappingService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* 羊只分组关联Service业务层处理 * 羊只分组关联Service业务层处理
* *
@ -185,5 +187,29 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer
} }
private List<BasGroupTreeVo> buildTree(List<BasGroupTreeVo> all) {
Map<Long, BasGroupTreeVo> map = all.stream()
.collect(Collectors.toMap(BasGroupTreeVo::getGroupId, v -> v));
List<BasGroupTreeVo> tree = new ArrayList<>();
for (BasGroupTreeVo n : all) {
if (n.getParentId() == null || n.getParentId() == 0L) {
tree.add(n);
} else {
BasGroupTreeVo parent = map.get(n.getParentId());
if (parent != null) {
if (parent.getChildren() == null) {
parent.setChildren(new ArrayList<>());
}
parent.getChildren().add(n);
}
}
}
return tree;
}
@Override
public List<BasGroupTreeVo> selectGroupTree() {
List<BasGroupTreeVo> list = basSheepGroupMappingMapper.selectGroupTree();
return buildTree(list);
}
} }

View File

@ -2,7 +2,6 @@ package com.zhyc.module.base.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.module.base.domain.BasSheep;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.base.mapper.BasSheepTypeMapper; import com.zhyc.module.base.mapper.BasSheepTypeMapper;

View File

@ -1,6 +1,5 @@
package com.zhyc.module.base.service.impl; package com.zhyc.module.base.service.impl;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.base.service.ISheepFileService; import com.zhyc.module.base.service.ISheepFileService;

View File

@ -80,6 +80,17 @@ public class DiagnosisController extends BaseController
return toAjax(diagnosisService.insertDiagnosis(diagnosis)); return toAjax(diagnosisService.insertDiagnosis(diagnosis));
} }
/**
* 新增批量诊疗结果
*/
@PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:add')")
@Log(title = "诊疗结果", businessType = BusinessType.INSERT)
@PostMapping("/adds")
public AjaxResult adds(@RequestBody Diagnosis diagnosis)
{
return toAjax(diagnosisService.insertDiagnosisList(diagnosis));
}
/** /**
* 修改诊疗结果 * 修改诊疗结果
*/ */

View File

@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.module.biosafety.service.IHealthService; import com.zhyc.module.biosafety.service.IHealthService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -97,7 +98,7 @@ public class HealthController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('biosafety:health:remove')") @PreAuthorize("@ss.hasPermi('biosafety:health:remove')")
@Log(title = "保健", businessType = BusinessType.DELETE) @Log(title = "保健", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
{ {
return toAjax(healthService.deleteHealthByIds(ids)); return toAjax(healthService.deleteHealthByIds(ids));

View File

@ -7,13 +7,11 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
/** /**
* 驱虫对象 sw_deworm * 驱虫对象 sw_dih
* *
* @author ruoyi * @author ruoyi
* @date 2025-07-15 * @date 2025-07-15

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
@ -29,6 +27,7 @@ public class Diagnosis extends BaseEntity
/** 治疗记录id */ /** 治疗记录id */
@Excel(name = "治疗记录") @Excel(name = "治疗记录")
private Long treatId; private Long treatId;
private Integer[] treatIds;
/** 羊只id */ /** 羊只id */
@Excel(name = "羊只耳号") @Excel(name = "羊只耳号")

View File

@ -7,8 +7,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
@ -60,6 +58,8 @@ public class Disinfect extends BaseEntity
/** 备注 */ /** 备注 */
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
/** 药品名称用于查询*/
private String mediName;
// 药品使用 // 药品使用
private List<SwMedicineUsageDetails> usageDetails; private List<SwMedicineUsageDetails> usageDetails;

View File

@ -7,8 +7,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -3,8 +3,6 @@ package com.zhyc.module.biosafety.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import org.apache.ibatis.type.Alias; import org.apache.ibatis.type.Alias;

View File

@ -3,8 +3,6 @@ package com.zhyc.module.biosafety.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -3,8 +3,6 @@ package com.zhyc.module.biosafety.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.TreeEntity; import com.zhyc.common.core.domain.TreeEntity;

View File

@ -3,8 +3,6 @@ package com.zhyc.module.biosafety.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -1,12 +1,12 @@
package com.zhyc.module.biosafety.domain; package com.zhyc.module.biosafety.domain;
import java.util.Date;
import java.util.List; import java.util.List;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
@ -30,6 +30,18 @@ public class SwMedicineUsage extends BaseEntity
@Excel(name = "使用名称") @Excel(name = "使用名称")
private String name; private String name;
/** 羊舍名称 */
@Excel(name = "使用名称")
private String sheepfoldName;
private Integer sheepfoldId;
/** 耳号 */
@Excel(name = "耳号")
private String sheepNo;
private Integer sheepId;
/** 使用时间 */
@Excel(name = "使用时间")
private Date datetime;
/** 使用类型 */ /** 使用类型 */
@Excel(name = "使用类型") @Excel(name = "使用类型")
private String useType; private String useType;

View File

@ -1,13 +1,14 @@
package com.zhyc.module.biosafety.domain; package com.zhyc.module.biosafety.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 药品使用记录详情对象 sw_medicine_usage_details * 药品使用记录详情对象 sw_medicine_usage_details
* *
@ -48,6 +49,11 @@ public class SwMedicineUsageDetails extends BaseEntity
@Excel(name = "使用方法") @Excel(name = "使用方法")
private String usageId; private String usageId;
/** 使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date usetime;
/** 生产厂家 */ /** 生产厂家 */
@Excel(name = "生产厂家") @Excel(name = "生产厂家")
private String manufacturer; private String manufacturer;

View File

@ -49,90 +49,4 @@ public class SwPrescription extends BaseEntity
/** 处方详情信息 */ /** 处方详情信息 */
private List<SwPresDetail> swPresDetailList; private List<SwPresDetail> swPresDetailList;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNo(String no)
{
this.no = no;
}
public String getNo()
{
return no;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setPersType(Integer persType)
{
this.persType = persType;
}
public Integer getPersType()
{
return persType;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public List<SwPresDetail> getSwPresDetailList()
{
return swPresDetailList;
}
public void setSwPresDetailList(List<SwPresDetail> swPresDetailList)
{
this.swPresDetailList = swPresDetailList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("no", getNo())
.append("name", getName())
.append("persType", getPersType())
.append("comment", getComment())
.append("status", getStatus())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("swPresDetailList", getSwPresDetailList())
.toString();
}
} }

View File

@ -3,8 +3,6 @@ package com.zhyc.module.biosafety.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -3,8 +3,6 @@ package com.zhyc.module.biosafety.domain;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -1,6 +1,5 @@
package com.zhyc.module.biosafety.domain; package com.zhyc.module.biosafety.domain;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -8,8 +7,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
@ -92,6 +89,10 @@ public class Treatment extends BaseEntity
/** 兽医 */ /** 兽医 */
@Excel(name = "兽医") @Excel(name = "兽医")
private String veterinary; private String veterinary;
/** 治疗状态 */
@Excel(name = "治疗状态")
private String status;
/** 药品使用记录id */ /** 药品使用记录id */
@Excel(name = "药品使用记录id") @Excel(name = "药品使用记录id")

View File

@ -63,4 +63,7 @@ public interface TreatmentMapper
public int deleteTreatmentByIds(Long[] ids); public int deleteTreatmentByIds(Long[] ids);
int insertTreatmentList(List<Treatment> treatments); int insertTreatmentList(List<Treatment> treatments);
List<Treatment> selectTreatmentStatus(Long sheepId);
} }

View File

@ -59,4 +59,6 @@ public interface IDiagnosisService
* @return 结果 * @return 结果
*/ */
public int deleteDiagnosisById(Long id); public int deleteDiagnosisById(Long id);
int insertDiagnosisList(Diagnosis diagnosis);
} }

View File

@ -3,7 +3,6 @@ package com.zhyc.module.biosafety.service;
import java.util.List; import java.util.List;
import com.zhyc.module.biosafety.domain.Treatment; import com.zhyc.module.biosafety.domain.Treatment;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 治疗记录Service接口 * 治疗记录Service接口

View File

@ -10,7 +10,6 @@ import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Deworm; import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -73,12 +72,13 @@ public class DewormServiceImpl implements IDewormService
@Transactional @Transactional
public int insertDeworm(Deworm deworm) public int insertDeworm(Deworm deworm)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
// 使用记录的文件 // 使用记录的文件
SwMedicineUsage medicineUsage = new SwMedicineUsage(); SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setSwMedicineUsageDetailsList(deworm.getUsageDetails()); medicineUsage.setSwMedicineUsageDetailsList(deworm.getUsageDetails());
medicineUsage.setName("羊只驱虫"); medicineUsage.setName("羊只驱虫");
medicineUsage.setUseType("1"); medicineUsage.setUseType("1");
medicineUsage.setDatetime(deworm.getDatetime());
List<Deworm> deworms = new ArrayList<>(); List<Deworm> deworms = new ArrayList<>();
@ -96,6 +96,8 @@ public class DewormServiceImpl implements IDewormService
dew.setGender(String.valueOf(sheepFile.getGender())); dew.setGender(String.valueOf(sheepFile.getGender()));
dew.setBreed(sheepFile.getBreed()); dew.setBreed(sheepFile.getBreed());
dew.setParity(sheepFile.getParity()); dew.setParity(sheepFile.getParity());
medicineUsage.setSheepId(sheepId);
// 获取药品使用记录的id // 获取药品使用记录的id
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
dew.setUsageId(usageId); dew.setUsageId(usageId);
@ -116,7 +118,7 @@ public class DewormServiceImpl implements IDewormService
@Transactional @Transactional
public int updateDeworm(Deworm deworm) public int updateDeworm(Deworm deworm)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
for (SwMedicineUsageDetails usageDetail : deworm.getUsageDetails()) { for (SwMedicineUsageDetails usageDetail : deworm.getUsageDetails()) {
usageDetail.setMediUsage(deworm.getUsageId()); usageDetail.setMediUsage(deworm.getUsageId());
} }

View File

@ -1,5 +1,6 @@
package com.zhyc.module.biosafety.service.impl; package com.zhyc.module.biosafety.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -9,13 +10,18 @@ import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.BasSheepMapper; import com.zhyc.module.base.mapper.BasSheepMapper;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.mapper.DiagnosisMapper; import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.domain.Diagnosis; import com.zhyc.module.biosafety.domain.Diagnosis;
import com.zhyc.module.biosafety.service.IDiagnosisService; import com.zhyc.module.biosafety.service.IDiagnosisService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* 诊疗结果Service业务层处理 * 诊疗结果Service业务层处理
* *
@ -31,6 +37,8 @@ public class DiagnosisServiceImpl implements IDiagnosisService
private SheepFileMapper sheepFileMapper; private SheepFileMapper sheepFileMapper;
@Autowired @Autowired
private BasSheepMapper sheepMapper; private BasSheepMapper sheepMapper;
@Autowired
private TreatmentMapper treatmentMapper;
/** /**
* 查询诊疗结果 * 查询诊疗结果
@ -72,19 +80,90 @@ public class DiagnosisServiceImpl implements IDiagnosisService
diagnosis.setGender(String.valueOf(sheepFile.getGender())); diagnosis.setGender(String.valueOf(sheepFile.getGender()));
diagnosis.setMonthAge(sheepFile.getMonthAge()); diagnosis.setMonthAge(sheepFile.getMonthAge());
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
diagnosis.setCreateBy(username); diagnosis.setCreateBy(username);
diagnosis.setCreateTime(DateUtils.getNowDate()); diagnosis.setCreateTime(DateUtils.getNowDate());
if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())){
BasSheep basSheep = new BasSheep(); if (diagnosis.getSheepfoldId() != null)
basSheep.setId(diagnosis.getSheepId()); if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())) {
basSheep.setSheepfoldId(diagnosis.getSheepfoldId()); BasSheep basSheep = new BasSheep();
sheepMapper.updateBasSheep(basSheep); basSheep.setId(diagnosis.getSheepId());
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
sheepMapper.updateBasSheep(basSheep);
}
// 更改治疗记录的状态
Treatment treatment = new Treatment();
treatment.setId(diagnosis.getTreatId());
if (diagnosis.getResult().equals("0")){
treatment.setStatus("-1");
treatmentMapper.updateTreatment(treatment);
}else if (diagnosis.getResult().equals("1")){
treatment.setStatus("2");
treatmentMapper.updateTreatment(treatment);
} }
// 转入其他羊舍 // 转入其他羊舍
return diagnosisMapper.insertDiagnosis(diagnosis); return diagnosisMapper.insertDiagnosis(diagnosis);
} }
@Override
@Transactional
public int insertDiagnosisList(Diagnosis diagnosis) {
if (diagnosis.getTreatIds() != null && diagnosis.getTreatIds().length > 0){
for (Integer treatId : diagnosis.getTreatIds()) {
System.out.println(treatId);
Treatment treatment = treatmentMapper.selectTreatmentById(Long.valueOf(treatId));
System.out.println(treatment);
// BasSheep basSheep = sheepMapper.selectBasSheepById(treatment.getSheepId());
Diagnosis diag = new Diagnosis();
BeanUtils.copyProperties(treatment,diag);
diag.setResult(diagnosis.getResult());
diag.setParity(String.valueOf(treatment.getParity()));
// treatment diagnosis 是你的两个实体对象
Date start = treatment.getDatetime(); // 已经是 Date
Date end = diagnosis.getDatetime(); // 已经是 Date
diag.setBegindate(start);
diag.setEnddate(end);
long oneDayMillis = 24 * 60 * 60 * 1000L;
long days = (end.getTime() / oneDayMillis) - (start.getTime() / oneDayMillis);
if (days<0){
days=0;
}
diag.setTreatDay(days);
diag.setTreatId(treatment.getId());
String username = SecurityUtils.getLoginUser().getUser().getNickName();
diag.setCreateBy(username);
diag.setCreateTime(DateUtils.getNowDate());
diagnosisMapper.insertDiagnosis(diag);
treatment.setDiagId(diag.getId());
// 更改治疗记录的状态
if (diagnosis.getResult().equals("0")){
treatment.setStatus("-1");
treatmentMapper.updateTreatment(treatment);
}else if (diagnosis.getResult().equals("1")){
treatment.setStatus("2");
treatmentMapper.updateTreatment(treatment);
}
if (diagnosis.getSheepfoldId() != null){
BasSheep basSheep = new BasSheep();
basSheep.setId(diagnosis.getSheepId());
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
sheepMapper.updateBasSheep(basSheep);
}
}
}
return 1;
}
/** /**
* 修改诊疗结果 * 修改诊疗结果
* *
@ -98,7 +177,7 @@ public class DiagnosisServiceImpl implements IDiagnosisService
BasSheep basSheep = new BasSheep(); BasSheep basSheep = new BasSheep();
basSheep.setId(diagnosis.getSheepId()); basSheep.setId(diagnosis.getSheepId());
basSheep.setSheepfoldId(diagnosis.getSheepfoldId()); basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
basSheep.setUpdateBy(username); basSheep.setUpdateBy(username);
basSheep.setUpdateTime(DateUtils.getNowDate()); basSheep.setUpdateTime(DateUtils.getNowDate());
diagnosis.setUpdateBy(username); diagnosis.setUpdateBy(username);
@ -130,4 +209,5 @@ public class DiagnosisServiceImpl implements IDiagnosisService
{ {
return diagnosisMapper.deleteDiagnosisById(id); return diagnosisMapper.deleteDiagnosisById(id);
} }
} }

View File

@ -5,9 +5,7 @@ import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
@ -75,12 +73,13 @@ public class DisinfectServiceImpl implements IDisinfectService
@Override @Override
public int insertDisinfect(Disinfect disinfect) public int insertDisinfect(Disinfect disinfect)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
// 使用记录的文件 // 使用记录的文件
SwMedicineUsage medicineUsage = new SwMedicineUsage(); SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setSwMedicineUsageDetailsList(disinfect.getUsageDetails()); medicineUsage.setSwMedicineUsageDetailsList(disinfect.getUsageDetails());
medicineUsage.setName("羊舍消毒"); medicineUsage.setName("羊舍消毒");
medicineUsage.setUseType("3"); medicineUsage.setUseType("3");
medicineUsage.setDatetime(disinfect.getDatetime());
List<Disinfect> disinfects = new ArrayList<>(); List<Disinfect> disinfects = new ArrayList<>();
@ -92,6 +91,8 @@ public class DisinfectServiceImpl implements IDisinfectService
Disinfect dis = new Disinfect(); Disinfect dis = new Disinfect();
BeanUtils.copyProperties(disinfect,dis); BeanUtils.copyProperties(disinfect,dis);
dis.setSheepfoldId(sheepfold); dis.setSheepfoldId(sheepfold);
medicineUsage.setSheepfoldId(sheepfold);
// 获取药品使用记录的id // 获取药品使用记录的id
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
dis.setUsageId(usageId); dis.setUsageId(usageId);
@ -116,7 +117,7 @@ public class DisinfectServiceImpl implements IDisinfectService
} }
medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(disinfect.getUsageId()); medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(disinfect.getUsageId());
medicineUsageMapper.batchSwMedicineUsageDetails(disinfect.getUsageDetails()); medicineUsageMapper.batchSwMedicineUsageDetails(disinfect.getUsageDetails());
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
disinfect.setUpdateBy(username); disinfect.setUpdateBy(username);
disinfect.setUpdateTime(DateUtils.getNowDate()); disinfect.setUpdateTime(DateUtils.getNowDate());
return disinfectMapper.updateDisinfect(disinfect); return disinfectMapper.updateDisinfect(disinfect);

View File

@ -1,5 +1,6 @@
package com.zhyc.module.biosafety.service.impl; package com.zhyc.module.biosafety.service.impl;
import java.beans.Transient;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
@ -7,7 +8,6 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Health;
import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
@ -71,16 +71,18 @@ public class HealthServiceImpl implements IHealthService
* @param health 保健 * @param health 保健
* @return 结果 * @return 结果
*/ */
@Transient
@Override @Override
public int insertHealth(Health health) public int insertHealth(Health health)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
// 使用记录的文件 // 使用记录的文件
SwMedicineUsage medicineUsage = new SwMedicineUsage(); SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setSwMedicineUsageDetailsList(health.getUsageDetails()); medicineUsage.setSwMedicineUsageDetailsList(health.getUsageDetails());
medicineUsage.setName("羊只保健"); medicineUsage.setName("羊只保健");
medicineUsage.setUseType("2"); medicineUsage.setUseType("2");
medicineUsage.setDatetime(health.getDatetime());
List<Health> healths = new ArrayList<>(); List<Health> healths = new ArrayList<>();
health.setCreateBy(username); health.setCreateBy(username);
@ -97,6 +99,7 @@ public class HealthServiceImpl implements IHealthService
heal.setBreed(sheepFile.getBreed()); heal.setBreed(sheepFile.getBreed());
heal.setParity(sheepFile.getParity()); heal.setParity(sheepFile.getParity());
medicineUsage.setSheepId(sheepId);
// 获取药品使用记录的id // 获取药品使用记录的id
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
@ -120,7 +123,7 @@ public class HealthServiceImpl implements IHealthService
} }
medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(health.getUsageId()); medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(health.getUsageId());
medicineUsageMapper.batchSwMedicineUsageDetails(health.getUsageDetails()); medicineUsageMapper.batchSwMedicineUsageDetails(health.getUsageDetails());
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
health.setUpdateBy(username); health.setUpdateBy(username);
health.setUpdateTime(DateUtils.getNowDate()); health.setUpdateTime(DateUtils.getNowDate());
return healthMapper.updateHealth(health); return healthMapper.updateHealth(health);

View File

@ -7,7 +7,6 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
@ -76,15 +75,17 @@ public class ImmunityServiceImpl implements IImmunityService
@Override @Override
public int insertImmunity(Immunity immunity) public int insertImmunity(Immunity immunity)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
// 使用记录的文件 // 使用记录的文件
SwMedicineUsage medicineUsage = new SwMedicineUsage(); SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setSwMedicineUsageDetailsList(immunity.getUsageDetails()); medicineUsage.setSwMedicineUsageDetailsList(immunity.getUsageDetails());
medicineUsage.setName("羊只免疫"); medicineUsage.setName("羊只免疫");
medicineUsage.setUseType("0"); medicineUsage.setUseType("0");
medicineUsage.setDatetime(immunity.getDatetime());
medicineUsage.setCreateBy(username); medicineUsage.setCreateBy(username);
List<Immunity> immunities = new ArrayList<>(); List<Immunity> immunities = new ArrayList<>();
immunity.setUpdateBy(username); immunity.setUpdateBy(username);
@ -102,6 +103,8 @@ public class ImmunityServiceImpl implements IImmunityService
imm.setGender(String.valueOf(sheepFile.getGender())); imm.setGender(String.valueOf(sheepFile.getGender()));
imm.setBreed(sheepFile.getBreed()); imm.setBreed(sheepFile.getBreed());
imm.setParity(sheepFile.getParity()); imm.setParity(sheepFile.getParity());
medicineUsage.setSheepId(sheepId);
// 获取药品使用记录的id // 获取药品使用记录的id
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
@ -129,6 +132,8 @@ public class ImmunityServiceImpl implements IImmunityService
} }
medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(immunity.getUsageId()); medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(immunity.getUsageId());
medicineUsageMapper.batchSwMedicineUsageDetails(immunity.getUsageDetails()); medicineUsageMapper.batchSwMedicineUsageDetails(immunity.getUsageDetails());
String username = SecurityUtils.getLoginUser().getUser().getNickName();
immunity.setUpdateBy(username);
immunity.setUpdateTime(DateUtils.getNowDate()); immunity.setUpdateTime(DateUtils.getNowDate());
return immunityMapper.updateImmunity(immunity); return immunityMapper.updateImmunity(immunity);
} }

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.service.impl.SheepFileServiceImpl; import com.zhyc.module.base.service.impl.SheepFileServiceImpl;
@ -61,10 +60,10 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
@Override @Override
public int insertQuarantineReport(QuarantineReport quarantineReport) public int insertQuarantineReport(QuarantineReport quarantineReport)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
quarantineReport.setCreateBy(username); quarantineReport.setCreateBy(username);
quarantineReport.setCreateTime(DateUtils.getNowDate()); quarantineReport.setCreateTime(DateUtils.getNowDate());
if (quarantineReport.getResult()==null){ if (quarantineReport.getResult()==null || quarantineReport.getResult().length()==0){
quarantineReport.setStatus(0); quarantineReport.setStatus(0);
}else { }else {
quarantineReport.setStatus(1); quarantineReport.setStatus(1);
@ -97,7 +96,7 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
@Override @Override
public int updateQuarantineReport(QuarantineReport quarantineReport) public int updateQuarantineReport(QuarantineReport quarantineReport)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
quarantineReport.setUpdateBy(username); quarantineReport.setUpdateBy(username);
quarantineReport.setUpdateTime(DateUtils.getNowDate()); quarantineReport.setUpdateTime(DateUtils.getNowDate());
return quarantineReportMapper.updateQuarantineReport(quarantineReport); return quarantineReportMapper.updateQuarantineReport(quarantineReport);

View File

@ -59,7 +59,7 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
@Override @Override
public int insertSwMedicineUsage(SwMedicineUsage swMedicineUsage) public int insertSwMedicineUsage(SwMedicineUsage swMedicineUsage)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
swMedicineUsage.setCreateBy(username); swMedicineUsage.setCreateBy(username);
swMedicineUsage.setCreateTime(DateUtils.getNowDate()); swMedicineUsage.setCreateTime(DateUtils.getNowDate());
int rows = swMedicineUsageMapper.insertSwMedicineUsage(swMedicineUsage); int rows = swMedicineUsageMapper.insertSwMedicineUsage(swMedicineUsage);
@ -77,7 +77,7 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
@Override @Override
public int updateSwMedicineUsage(SwMedicineUsage swMedicineUsage) public int updateSwMedicineUsage(SwMedicineUsage swMedicineUsage)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
swMedicineUsage.setUpdateBy(username); swMedicineUsage.setUpdateBy(username);
swMedicineUsage.setUpdateTime(DateUtils.getNowDate()); swMedicineUsage.setUpdateTime(DateUtils.getNowDate());
swMedicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(swMedicineUsage.getId()); swMedicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(swMedicineUsage.getId());

View File

@ -59,7 +59,8 @@ public class SwPrescriptionServiceImpl implements ISwPrescriptionService
@Override @Override
public int insertSwPrescription(SwPrescription swPrescription) public int insertSwPrescription(SwPrescription swPrescription)
{ {
String username = SecurityUtils.getUsername(); // 获取创建人的用户名称
String username = SecurityUtils.getLoginUser().getUser().getNickName();
swPrescription.setCreateBy(username); swPrescription.setCreateBy(username);
swPrescription.setCreateTime(DateUtils.getNowDate()); swPrescription.setCreateTime(DateUtils.getNowDate());
int rows = swPrescriptionMapper.insertSwPrescription(swPrescription); int rows = swPrescriptionMapper.insertSwPrescription(swPrescription);
@ -77,7 +78,7 @@ public class SwPrescriptionServiceImpl implements ISwPrescriptionService
@Override @Override
public int updateSwPrescription(SwPrescription swPrescription) public int updateSwPrescription(SwPrescription swPrescription)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
swPrescription.setUpdateBy(username); swPrescription.setUpdateBy(username);
swPrescription.setUpdateTime(DateUtils.getNowDate()); swPrescription.setUpdateTime(DateUtils.getNowDate());
swPrescriptionMapper.deleteSwPresDetailByPersId(swPrescription.getId()); swPrescriptionMapper.deleteSwPresDetailByPersId(swPrescription.getId());

View File

@ -7,9 +7,10 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.base.service.impl.SheepFileServiceImpl; import com.zhyc.module.biosafety.domain.Diagnosis;
import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -35,6 +36,8 @@ public class TreatmentServiceImpl implements ITreatmentService
private SwMedicineUsageMapper medicineUsageMapper; private SwMedicineUsageMapper medicineUsageMapper;
@Autowired @Autowired
private SheepFileMapper sheepFileMapper; private SheepFileMapper sheepFileMapper;
@Autowired
private DiagnosisMapper diagnosisMapper;
/** /**
* 查询治疗记录 * 查询治疗记录
@ -48,7 +51,9 @@ public class TreatmentServiceImpl implements ITreatmentService
Treatment treatment = treatmentMapper.selectTreatmentById(id); Treatment treatment = treatmentMapper.selectTreatmentById(id);
// 获取药品使用记录 // 获取药品使用记录
SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(treatment.getUsageId()); SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(treatment.getUsageId());
treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList()); if (swMedicineUsage!=null){
treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList());
}
return treatment; return treatment;
} }
@ -74,16 +79,18 @@ public class TreatmentServiceImpl implements ITreatmentService
@Transactional @Transactional
public int insertTreatment(Treatment treatment) public int insertTreatment(Treatment treatment)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
// 使用记录的文件 // 使用记录的文件
SwMedicineUsage medicineUsage = new SwMedicineUsage(); SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails()); medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails());
medicineUsage.setName("羊只治疗"); medicineUsage.setName("羊只治疗");
medicineUsage.setUseType("4"); medicineUsage.setUseType("4");
medicineUsage.setDatetime(treatment.getDatetime());
medicineUsage.setCreateBy(username); medicineUsage.setCreateBy(username);
medicineUsage.setCreateTime(DateUtils.getNowDate()); medicineUsage.setCreateTime(DateUtils.getNowDate());
// 新增单挑数据 // 新增单挑数据
if (treatment.getSheepId()!=null){ if (treatment.getSheepId()!=null){
medicineUsage.setSheepId(Math.toIntExact(treatment.getSheepId()));
// 药品使用记录 // 药品使用记录
Integer id=medicineUsageService.insertSwMedicineUsage(medicineUsage); Integer id=medicineUsageService.insertSwMedicineUsage(medicineUsage);
// 药品使用记录id // 药品使用记录id
@ -109,6 +116,8 @@ public class TreatmentServiceImpl implements ITreatmentService
treat.setParity(sheepFile.getParity()); treat.setParity(sheepFile.getParity());
treat.setLactDay(sheepFile.getLactationDay()); treat.setLactDay(sheepFile.getLactationDay());
treat.setGestDay(sheepFile.getGestationDay()); treat.setGestDay(sheepFile.getGestationDay());
medicineUsage.setSheepId(Integer.valueOf(sheepId));
// 获取药品使用记录的id // 获取药品使用记录的id
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
System.out.println(medicineUsage); System.out.println(medicineUsage);
@ -135,7 +144,7 @@ public class TreatmentServiceImpl implements ITreatmentService
@Transactional @Transactional
public int updateTreatment(Treatment treatment) public int updateTreatment(Treatment treatment)
{ {
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
for (SwMedicineUsageDetails usageDetail : treatment.getUsageDetails()) { for (SwMedicineUsageDetails usageDetail : treatment.getUsageDetails()) {
usageDetail.setMediUsage(treatment.getUsageId()); usageDetail.setMediUsage(treatment.getUsageId());
} }
@ -173,4 +182,21 @@ public class TreatmentServiceImpl implements ITreatmentService
{ {
return treatmentMapper.deleteTreatmentById(id); return treatmentMapper.deleteTreatmentById(id);
} }
public void updateTreatmentStatus(Long sheepId) {
List<Treatment> treatments=treatmentMapper.selectTreatmentStatus(sheepId);
Diagnosis diagnosis = new Diagnosis();
for (Treatment treatment : treatments) {
if (treatment.getDiagId()!=null){
diagnosis.setId(treatment.getDiagId());
diagnosis.setResult("-1");
diagnosisMapper.updateDiagnosis(diagnosis);
if (treatment.getDiagId()!=null){
Treatment treat = new Treatment();
treat.setId(treatment.getId());
treatmentMapper.updateTreatment(treat);
}
}
}
}
} }

View File

@ -0,0 +1,27 @@
package com.zhyc.module.common.controller;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.module.common.domain.UserPost;
import com.zhyc.module.common.service.UserPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
//人员用户
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
UserPostService userPostService;
@GetMapping()
public AjaxResult getUserPost(String postCode){
List<UserPost> list = userPostService.getUserPostListByCode(postCode);
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,14 @@
package com.zhyc.module.common.domain;
import lombok.Data;
@Data
public class UserPost {
// 用户名
private String nickName;
// 用户
private String postName;
// 岗位编码
private String postCode;
}

View File

@ -0,0 +1,12 @@
package com.zhyc.module.common.mapper;
import com.zhyc.module.common.domain.UserPost;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UserPostMapper {
List<UserPost> getUserPostListByCode(String postCode);
}

View File

@ -0,0 +1,9 @@
package com.zhyc.module.common.service;
import com.zhyc.module.common.domain.UserPost;
import java.util.List;
public interface UserPostService {
List<UserPost> getUserPostListByCode(String postCode);
}

View File

@ -0,0 +1,19 @@
package com.zhyc.module.common.service.impl;
import com.zhyc.module.common.domain.UserPost;
import com.zhyc.module.common.mapper.UserPostMapper;
import com.zhyc.module.common.service.UserPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserPostServiceImpl implements UserPostService {
@Autowired
UserPostMapper userPostMapper;
@Override
public List<UserPost> getUserPostListByCode(String postCode) {
return userPostMapper.getUserPostListByCode(postCode);
}
}

View File

@ -4,7 +4,6 @@ import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType; import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService; import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.core.page.TableDataInfo;

View File

@ -2,13 +2,10 @@ package com.zhyc.module.dairyProducts.controller;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.module.dairyProducts.domain.Ranch;
import com.zhyc.module.dairyProducts.service.IRanchService; import com.zhyc.module.dairyProducts.service.IRanchService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/dairyProducts/ranch") @RequestMapping("/dairyProducts/ranch")
public class RanchController extends BaseController { public class RanchController extends BaseController {

View File

@ -19,7 +19,6 @@ import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.dairyProducts.domain.XzParityCorrection; import com.zhyc.module.dairyProducts.domain.XzParityCorrection;
import com.zhyc.module.dairyProducts.service.IXzParityCorrectionService; import com.zhyc.module.dairyProducts.service.IXzParityCorrectionService;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/** /**
* 胎次校正Controller * 胎次校正Controller

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -347,8 +347,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -26,42 +26,4 @@ public class XzParityCorrection extends BaseEntity
@Excel(name = "系数") @Excel(name = "系数")
private Double coef; private Double coef;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setParity(Integer parity)
{
this.parity = parity;
}
public Integer getParity()
{
return parity;
}
public void setCoef(Double coef)
{
this.coef = coef;
}
public Double getCoef()
{
return coef;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parity", getParity())
.append("coef", getCoef())
.toString();
}
} }

View File

@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;

View File

@ -1,6 +1,5 @@
package com.zhyc.module.dairyProducts.service; package com.zhyc.module.dairyProducts.service;
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Date; import java.util.Date;

View File

@ -1,104 +0,0 @@
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedDetails;
import com.zhyc.module.feed.service.ISgFeedDetailsService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂记录详情Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/details")
public class SgFeedDetailsController extends BaseController
{
@Autowired
private ISgFeedDetailsService sgFeedDetailsService;
/**
* 查询饲喂记录详情列表
*/
@PreAuthorize("@ss.hasPermi('feed:details:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedDetails sgFeedDetails)
{
startPage();
List<SgFeedDetails> list = sgFeedDetailsService.selectSgFeedDetailsList(sgFeedDetails);
return getDataTable(list);
}
/**
* 导出饲喂记录详情列表
*/
@PreAuthorize("@ss.hasPermi('feed:details:export')")
@Log(title = "饲喂记录详情", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedDetails sgFeedDetails)
{
List<SgFeedDetails> list = sgFeedDetailsService.selectSgFeedDetailsList(sgFeedDetails);
ExcelUtil<SgFeedDetails> util = new ExcelUtil<SgFeedDetails>(SgFeedDetails.class);
util.exportExcel(response, list, "饲喂记录详情数据");
}
/**
* 获取饲喂记录详情详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:details:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFeedDetailsService.selectSgFeedDetailsById(id));
}
/**
* 新增饲喂记录详情
*/
@PreAuthorize("@ss.hasPermi('feed:details:add')")
@Log(title = "饲喂记录详情", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedDetails sgFeedDetails)
{
return toAjax(sgFeedDetailsService.insertSgFeedDetails(sgFeedDetails));
}
/**
* 修改饲喂记录详情
*/
@PreAuthorize("@ss.hasPermi('feed:details:edit')")
@Log(title = "饲喂记录详情", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedDetails sgFeedDetails)
{
return toAjax(sgFeedDetailsService.updateSgFeedDetails(sgFeedDetails));
}
/**
* 删除饲喂记录详情
*/
@PreAuthorize("@ss.hasPermi('feed:details:remove')")
@Log(title = "饲喂记录详情", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFeedDetailsService.deleteSgFeedDetailsByIds(ids));
}
}

View File

@ -1,104 +0,0 @@
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedInfo;
import com.zhyc.module.feed.service.ISgFeedInfoService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂记录Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/info")
public class SgFeedInfoController extends BaseController
{
@Autowired
private ISgFeedInfoService sgFeedInfoService;
/**
* 查询饲喂记录列表
*/
@PreAuthorize("@ss.hasPermi('feed:info:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedInfo sgFeedInfo)
{
startPage();
List<SgFeedInfo> list = sgFeedInfoService.selectSgFeedInfoList(sgFeedInfo);
return getDataTable(list);
}
/**
* 导出饲喂记录列表
*/
@PreAuthorize("@ss.hasPermi('feed:info:export')")
@Log(title = "饲喂记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedInfo sgFeedInfo)
{
List<SgFeedInfo> list = sgFeedInfoService.selectSgFeedInfoList(sgFeedInfo);
ExcelUtil<SgFeedInfo> util = new ExcelUtil<SgFeedInfo>(SgFeedInfo.class);
util.exportExcel(response, list, "饲喂记录数据");
}
/**
* 获取饲喂记录详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFeedInfoService.selectSgFeedInfoById(id));
}
/**
* 新增饲喂记录
*/
@PreAuthorize("@ss.hasPermi('feed:info:add')")
@Log(title = "饲喂记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedInfo sgFeedInfo)
{
return toAjax(sgFeedInfoService.insertSgFeedInfo(sgFeedInfo));
}
/**
* 修改饲喂记录
*/
@PreAuthorize("@ss.hasPermi('feed:info:edit')")
@Log(title = "饲喂记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedInfo sgFeedInfo)
{
return toAjax(sgFeedInfoService.updateSgFeedInfo(sgFeedInfo));
}
/**
* 删除饲喂记录
*/
@PreAuthorize("@ss.hasPermi('feed:info:remove')")
@Log(title = "饲喂记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFeedInfoService.deleteSgFeedInfoByIds(ids));
}
}

View File

@ -0,0 +1,134 @@
package com.zhyc.module.feed.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.feed.service.impl.SgFeedListServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedList;
import com.zhyc.module.feed.service.ISgFeedListService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配料清单Controller
*
* @author HashMap
* @date 2025-08-19
*/
@RestController
@RequestMapping("/feed/FeedList")
public class SgFeedListController extends BaseController {
private final ISgFeedListService sgFeedListService;
public static boolean refresh = true;
@Autowired
public SgFeedListController(ISgFeedListService sgFeedListService) {
this.sgFeedListService = sgFeedListService;
}
/**
* 查询配料清单列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:list')")
@GetMapping("/list")
@Transactional(rollbackFor = Exception.class)
public TableDataInfo list(SgFeedList sgFeedList) {
/*
刷新缓存
当配方管理表出现更新 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新
*/
if (refresh) {
sgFeedListService.SyncFeedList();
refresh = false;
}
startPage();
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
// map 中已有的数据替换 list 中的元素
List<SgFeedList> replacedList = new ArrayList<>();
for (SgFeedList item : list) {
String key = item.getFormulaId() + "_" + item.getFormulaBatchId();
// 从缓存中取出完整对象
SgFeedList itemInCache = SgFeedListServiceImpl.getSgFeedListMap().getOrDefault(key, item);
// 将数据库查询的基本信息替换掉缓存中去除的内容 - 前端展示与修改需要
itemInCache.setId(item.getId());
itemInCache.setFormulaBatchId(item.getFormulaBatchId());
itemInCache.setFormulaId(item.getFormulaId());
itemInCache.setZookeeper(item.getZookeeper());
itemInCache.setDeployDate(item.getDeployDate());
// 替换为 map 中的对象
replacedList.add(itemInCache);
}
return getDataTable(replacedList);
}
/**
* 导出配料清单列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:export')")
@Log(title = "配料清单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedList sgFeedList) {
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
ExcelUtil<SgFeedList> util = new ExcelUtil<>(SgFeedList.class);
util.exportExcel(response, list, "配料清单数据");
}
/**
* 获取配料清单详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(sgFeedListService.selectSgFeedListById(id));
}
/**
* 新增配料清单
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:add')")
@Log(title = "配料清单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedList sgFeedList) {
return toAjax(sgFeedListService.insertSgFeedList(sgFeedList));
}
/**
* 修改配料清单
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:edit')")
@Log(title = "配料清单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedList sgFeedList) {
return toAjax(sgFeedListService.updateSgFeedList(sgFeedList));
}
/**
* 删除配料清单
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:remove')")
@Log(title = "配料清单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@Transactional(rollbackFor = Exception.class)
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sgFeedListService.deleteSgFeedListByIds(ids));
}
}

View File

@ -3,6 +3,8 @@ package com.zhyc.module.feed.controller;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.feed.domain.SgFeedPlan;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -16,21 +18,19 @@ import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType; import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedPlan;
import com.zhyc.module.feed.service.ISgFeedPlanService; import com.zhyc.module.feed.service.ISgFeedPlanService;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.core.page.TableDataInfo;
/** /**
* 饲喂计划Controller * 饲喂计划Controller
* *
* @author HashMap * @author HashMap
* @date 2025-08-08 * @date 2025-08-14
*/ */
@RestController @RestController
@RequestMapping("/feed/FeedPlan") @RequestMapping("/feed/FeedPlan")
public class SgFeedPlanController extends BaseController public class SgFeedPlanController extends BaseController {
{
private final ISgFeedPlanService sgFeedPlanService; private final ISgFeedPlanService sgFeedPlanService;
public SgFeedPlanController(ISgFeedPlanService sgFeedPlanService) { public SgFeedPlanController(ISgFeedPlanService sgFeedPlanService) {
@ -42,8 +42,7 @@ public class SgFeedPlanController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:list')") @PreAuthorize("@ss.hasPermi('feed:FeedPlan:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SgFeedPlan sgFeedPlan) public TableDataInfo list(SgFeedPlan sgFeedPlan) {
{
startPage(); startPage();
List<SgFeedPlan> list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan); List<SgFeedPlan> list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan);
return getDataTable(list); return getDataTable(list);
@ -55,8 +54,7 @@ public class SgFeedPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:export')") @PreAuthorize("@ss.hasPermi('feed:FeedPlan:export')")
@Log(title = "饲喂计划", businessType = BusinessType.EXPORT) @Log(title = "饲喂计划", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SgFeedPlan sgFeedPlan) public void export(HttpServletResponse response, SgFeedPlan sgFeedPlan) {
{
List<SgFeedPlan> list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan); List<SgFeedPlan> list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan);
ExcelUtil<SgFeedPlan> util = new ExcelUtil<>(SgFeedPlan.class); ExcelUtil<SgFeedPlan> util = new ExcelUtil<>(SgFeedPlan.class);
util.exportExcel(response, list, "饲喂计划数据"); util.exportExcel(response, list, "饲喂计划数据");
@ -67,8 +65,7 @@ public class SgFeedPlanController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:query')") @PreAuthorize("@ss.hasPermi('feed:FeedPlan:query')")
@GetMapping(value = "/{createDate}") @GetMapping(value = "/{createDate}")
public AjaxResult getInfo(@PathVariable("createDate") Date createDate) public AjaxResult getInfo(@PathVariable("createDate") Date createDate) {
{
return success(sgFeedPlanService.selectSgFeedPlanByCreateDate(createDate)); return success(sgFeedPlanService.selectSgFeedPlanByCreateDate(createDate));
} }
@ -78,8 +75,15 @@ public class SgFeedPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:add')") @PreAuthorize("@ss.hasPermi('feed:FeedPlan:add')")
@Log(title = "饲喂计划", businessType = BusinessType.INSERT) @Log(title = "饲喂计划", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SgFeedPlan sgFeedPlan) public AjaxResult add(@RequestBody SgFeedPlan sgFeedPlan) {
{ if (null == sgFeedPlan) {
throw new RuntimeException("数据为空");
}
sgFeedPlan.setCreateDate(new Date());
// 计算其他字段值
setPlan(sgFeedPlan);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan)); return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
} }
@ -89,8 +93,11 @@ public class SgFeedPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:edit')") @PreAuthorize("@ss.hasPermi('feed:FeedPlan:edit')")
@Log(title = "饲喂计划", businessType = BusinessType.UPDATE) @Log(title = "饲喂计划", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan) public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan) {
{ // 根据修改后的值重新计算
setPlan(sgFeedPlan);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan)); return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
} }
@ -99,9 +106,26 @@ public class SgFeedPlanController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:remove')") @PreAuthorize("@ss.hasPermi('feed:FeedPlan:remove')")
@Log(title = "饲喂计划", businessType = BusinessType.DELETE) @Log(title = "饲喂计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{createDates}") @DeleteMapping("/{createDates}")
public AjaxResult remove(@PathVariable Date[] createDates) public AjaxResult remove(@PathVariable Date[] createDates) {
{ // 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates)); return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
} }
/**
* 设定计划值
* 用于添加和修改
*/
private void setPlan(SgFeedPlan sgFeedPlan) {
// 根据羊舍ID获取羊只数量
int countByFoldId = sgFeedPlanService.getSheepCountByFoldId(sgFeedPlan.getSheepHouseId());
sgFeedPlan.setSheepCount(countByFoldId);
// 计算总计划量
sgFeedPlan.setPlanFeedTotal(countByFoldId * sgFeedPlan.getPlanDailySize());
// 计算早中晚计划量
sgFeedPlan.setPlanMorningSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioMorning() / 100));
sgFeedPlan.setPlanNoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioNoon() / 100));
sgFeedPlan.setPlanAfternoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioAfternoon() / 100));
}
} }

View File

@ -1,104 +0,0 @@
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedRatio;
import com.zhyc.module.feed.service.ISgFeedRatioService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂比例Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/ratio")
public class SgFeedRatioController extends BaseController
{
@Autowired
private ISgFeedRatioService sgFeedRatioService;
/**
* 查询饲喂比例列表
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedRatio sgFeedRatio)
{
startPage();
List<SgFeedRatio> list = sgFeedRatioService.selectSgFeedRatioList(sgFeedRatio);
return getDataTable(list);
}
/**
* 导出饲喂比例列表
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:export')")
@Log(title = "饲喂比例", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedRatio sgFeedRatio)
{
List<SgFeedRatio> list = sgFeedRatioService.selectSgFeedRatioList(sgFeedRatio);
ExcelUtil<SgFeedRatio> util = new ExcelUtil<SgFeedRatio>(SgFeedRatio.class);
util.exportExcel(response, list, "饲喂比例数据");
}
/**
* 获取饲喂比例详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFeedRatioService.selectSgFeedRatioById(id));
}
/**
* 新增饲喂比例
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:add')")
@Log(title = "饲喂比例", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedRatio sgFeedRatio)
{
return toAjax(sgFeedRatioService.insertSgFeedRatio(sgFeedRatio));
}
/**
* 修改饲喂比例
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:edit')")
@Log(title = "饲喂比例", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedRatio sgFeedRatio)
{
return toAjax(sgFeedRatioService.updateSgFeedRatio(sgFeedRatio));
}
/**
* 删除饲喂比例
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:remove')")
@Log(title = "饲喂比例", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFeedRatioService.deleteSgFeedRatioByIds(ids));
}
}

View File

@ -0,0 +1,129 @@
package com.zhyc.module.feed.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.uuid.UUID;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedStatistic;
import com.zhyc.module.feed.service.ISgFeedStatisticService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂量统计Controller
*
* @author HashMap
* @date 2025-08-23
*/
@RestController
@RequestMapping("/feed/FeedStatistic")
@Transactional(rollbackFor = Exception.class)
public class SgFeedStatisticController extends BaseController {
private final ISgFeedStatisticService sgFeedStatisticService;
public SgFeedStatisticController(ISgFeedStatisticService sgFeedStatisticService) {
this.sgFeedStatisticService = sgFeedStatisticService;
}
/**
* 查询饲喂量统计列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedStatistic:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedStatistic sgFeedStatistic) {
startPage();
List<SgFeedStatistic> list = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
return getDataTable(list);
}
/**
* 导出饲喂量统计列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedStatistic:export')")
@Log(title = "饲喂量统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedStatistic sgFeedStatistic) {
List<SgFeedStatistic> list = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
ExcelUtil<SgFeedStatistic> util = new ExcelUtil<>(SgFeedStatistic.class);
util.exportExcel(response, list, "饲喂量统计数据");
}
/**
* 获取饲喂量统计详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:FeedStatistic:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(sgFeedStatisticService.selectSgFeedStatisticById(id));
}
/**
* 新增饲喂量统计
*/
@PreAuthorize("@ss.hasPermi('feed:FeedStatistic:add')")
@Log(title = "饲喂量统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedStatistic sgFeedStatistic) {
if (null == sgFeedStatistic.getFormulaId() && null == sgFeedStatistic.getFormulaBatchId()) {
throw new RuntimeException("ERROR: 数据为空");
}
List<SgFeedStatistic> isExist = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
if (null != isExist && !isExist.isEmpty()) {
throw new RuntimeException("WARNING: 数据重复");
}
// 设定唯一标识符主键
sgFeedStatistic.setId(UUID.randomUUID().toString());
/*
* 初始化数据
* 弃用: 此处不再需要初始化前端选定批号后会触发预载, 此处再初始化会覆盖前端后续的自定义数据
*/
// sgFeedStatisticService.getInitSgFeedStatistic(sgFeedStatistic);
return toAjax(sgFeedStatisticService.insertSgFeedStatistic(sgFeedStatistic));
}
/**
* 修改饲喂量统计
*/
@PreAuthorize("@ss.hasPermi('feed:FeedStatistic:edit')")
@Log(title = "饲喂量统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedStatistic sgFeedStatistic) {
return toAjax(sgFeedStatisticService.updateSgFeedStatistic(sgFeedStatistic));
}
/**
* 删除饲喂量统计
*/
@PreAuthorize("@ss.hasPermi('feed:FeedStatistic:remove')")
@Log(title = "饲喂量统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(sgFeedStatisticService.deleteSgFeedStatisticByIds(ids));
}
@GetMapping("/init")
public TableDataInfo getInitData(SgFeedStatistic sgFeedStatistic){
sgFeedStatisticService.getInitSgFeedStatistic(sgFeedStatistic);
// 兼容写法 - 实际只是为了返回一个 sgFeedStatistic
List<SgFeedStatistic> list = new ArrayList<>();
list.add(sgFeedStatistic);
return getDataTable(list);
}
}

View File

@ -1,104 +0,0 @@
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFodder;
import com.zhyc.module.feed.service.ISgFodderService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 原料Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/fodder")
public class SgFodderController extends BaseController
{
@Autowired
private ISgFodderService sgFodderService;
/**
* 查询原料列表
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:list')")
@GetMapping("/list")
public TableDataInfo list(SgFodder sgFodder)
{
startPage();
List<SgFodder> list = sgFodderService.selectSgFodderList(sgFodder);
return getDataTable(list);
}
/**
* 导出原料列表
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:export')")
@Log(title = "原料", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFodder sgFodder)
{
List<SgFodder> list = sgFodderService.selectSgFodderList(sgFodder);
ExcelUtil<SgFodder> util = new ExcelUtil<SgFodder>(SgFodder.class);
util.exportExcel(response, list, "原料数据");
}
/**
* 获取原料详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFodderService.selectSgFodderById(id));
}
/**
* 新增原料
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:add')")
@Log(title = "原料", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFodder sgFodder)
{
return toAjax(sgFodderService.insertSgFodder(sgFodder));
}
/**
* 修改原料
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:edit')")
@Log(title = "原料", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFodder sgFodder)
{
return toAjax(sgFodderService.updateSgFodder(sgFodder));
}
/**
* 删除原料
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:remove')")
@Log(title = "原料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFodderService.deleteSgFodderByIds(ids));
}
}

View File

@ -143,6 +143,9 @@ public class SgFormulaManagementController extends BaseController {
sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId()); sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId());
sgFormulaListService.insertSgFormulaList(sgFormulaListItem); sgFormulaListService.insertSgFormulaList(sgFormulaListItem);
} }
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement)); return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
} }
@ -167,6 +170,9 @@ public class SgFormulaManagementController extends BaseController {
} }
// 前置检查完毕 执行删除 // 前置检查完毕 执行删除
sgFormulaManagement.setBatchId(batchId); sgFormulaManagement.setBatchId(batchId);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement)); return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
} }
} }

View File

@ -3,7 +3,6 @@ package com.zhyc.module.feed.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; 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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;

View File

@ -1,82 +0,0 @@
package com.zhyc.module.feed.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂记录详情对象 sg_feed_details
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFeedDetails extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 原料id */
@Excel(name = "原料id")
private String fodder;
/** 数量 */
@Excel(name = "数量")
private Long number;
/** 单位 */
@Excel(name = "单位")
private String nuit;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setFodder(String fodder)
{
this.fodder = fodder;
}
public String getFodder()
{
return fodder;
}
public void setNumber(Long number)
{
this.number = number;
}
public Long getNumber()
{
return number;
}
public void setNuit(String nuit)
{
this.nuit = nuit;
}
public String getNuit()
{
return nuit;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("fodder", getFodder())
.append("number", getNumber())
.append("nuit", getNuit())
.toString();
}
}

View File

@ -1,252 +0,0 @@
package com.zhyc.module.feed.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂记录对象 sg_feed_info
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFeedInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 配方编码 */
@Excel(name = "配方编码")
private Long formulaId;
/** 羊舍 */
@Excel(name = "羊舍")
private String sheepfoldId;
/** 日均计划量 */
@Excel(name = "日均计划量")
private Long average;
/** 早上计划量(通过饲喂比例算出来) */
@Excel(name = "早上计划量(通过饲喂比例算出来)")
private Long planMonring;
/** 实际添加(早) */
@Excel(name = "实际添加", readConverterExp = "早=")
private Long actualMonring;
/** 中午计划量 */
@Excel(name = "中午计划量")
private Long planNoon;
/** 实际添加(中) */
@Excel(name = "实际添加", readConverterExp = "中=")
private Long actualNoon;
/** 下午计划量 */
@Excel(name = "下午计划量")
private Long planEvenig;
/** 实际添加(下) */
@Excel(name = "实际添加", readConverterExp = "下=")
private Long actualEvening;
/** 颗粒原料 */
@Excel(name = "颗粒原料")
private Long particle;
/** 其他原料 */
@Excel(name = "其他原料")
private Long other;
/** 补饲饲料 */
@Excel(name = "补饲饲料")
private Long replenish;
/** 饲喂日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "饲喂日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDate;
/** 备注 */
@Excel(name = "备注")
private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setFormulaId(Long formulaId)
{
this.formulaId = formulaId;
}
public Long getFormulaId()
{
return formulaId;
}
public void setSheepfoldId(String sheepfoldId)
{
this.sheepfoldId = sheepfoldId;
}
public String getSheepfoldId()
{
return sheepfoldId;
}
public void setAverage(Long average)
{
this.average = average;
}
public Long getAverage()
{
return average;
}
public void setPlanMonring(Long planMonring)
{
this.planMonring = planMonring;
}
public Long getPlanMonring()
{
return planMonring;
}
public void setActualMonring(Long actualMonring)
{
this.actualMonring = actualMonring;
}
public Long getActualMonring()
{
return actualMonring;
}
public void setPlanNoon(Long planNoon)
{
this.planNoon = planNoon;
}
public Long getPlanNoon()
{
return planNoon;
}
public void setActualNoon(Long actualNoon)
{
this.actualNoon = actualNoon;
}
public Long getActualNoon()
{
return actualNoon;
}
public void setPlanEvenig(Long planEvenig)
{
this.planEvenig = planEvenig;
}
public Long getPlanEvenig()
{
return planEvenig;
}
public void setActualEvening(Long actualEvening)
{
this.actualEvening = actualEvening;
}
public Long getActualEvening()
{
return actualEvening;
}
public void setParticle(Long particle)
{
this.particle = particle;
}
public Long getParticle()
{
return particle;
}
public void setOther(Long other)
{
this.other = other;
}
public Long getOther()
{
return other;
}
public void setReplenish(Long replenish)
{
this.replenish = replenish;
}
public Long getReplenish()
{
return replenish;
}
public void setPlanDate(Date planDate)
{
this.planDate = planDate;
}
public Date getPlanDate()
{
return planDate;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("formulaId", getFormulaId())
.append("sheepfoldId", getSheepfoldId())
.append("average", getAverage())
.append("planMonring", getPlanMonring())
.append("actualMonring", getActualMonring())
.append("planNoon", getPlanNoon())
.append("actualNoon", getActualNoon())
.append("planEvenig", getPlanEvenig())
.append("actualEvening", getActualEvening())
.append("particle", getParticle())
.append("other", getOther())
.append("replenish", getReplenish())
.append("planDate", getPlanDate())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,67 @@
package com.zhyc.module.feed.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 配料清单对象 sg_feed_list
*
* @author HashMap
* @date 2025-08-19
*/
@Setter
@Getter
public class SgFeedList extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 序号 */
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;
private SgFormulaManagement rootFormula;
private SgFeedPlan rootPlan;
private Double morningTotal;
private Double noonTotal;
private Double afternoonTotal;
private List<SgFormulaList> formulaList;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("formulaId", getFormulaId())
.append("formulaBatchId", getFormulaBatchId())
.append("zookeeper", getZookeeper())
.append("deployDate", getDeployDate())
.toString();
}
}

View File

@ -13,86 +13,88 @@ import com.zhyc.common.core.domain.BaseEntity;
* 饲喂计划对象 sg_feed_plan * 饲喂计划对象 sg_feed_plan
* *
* @author HashMap * @author HashMap
* @date 2025-08-08 * @date 2025-08-14
*/ */
@Setter
@Getter @Getter
@Setter
public class SgFeedPlan extends BaseEntity public class SgFeedPlan extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 创建日期 */ /** 创建日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate; private Date createDate;
/** 配方编码 */ /** 配方编码 */
@Excel(name = "配方编码") @Excel(name = "配方编码")
private String formulaId; private String formulaId;
/** 批号 */
@Excel(name = "批号")
private String batchId;
/** 羊舍 */ /** 羊舍 */
@Excel(name = "羊舍") @Excel(name = "羊舍")
private Long sheepHouseId; private Integer sheepHouseId;
/** 羊只数量 */ /** 羊只数量 */
@Excel(name = "羊只数量") @Excel(name = "羊只数量")
private Long sheepCount; private Integer sheepCount;
/** 日均计划量 */ /** 日均计划量 */
@Excel(name = "日均计划量") @Excel(name = "日均计划量")
private Long planDailySize; private Double planDailySize;
/** 计划量(早) */
@Excel(name = "计划量(早)")
private Long planMorningSize;
/** 计划总量(早) */
@Excel(name = "计划总量(早)")
private Long planMorningTotal;
/** 饲喂比例(早) */ /** 饲喂比例(早) */
@Excel(name = "饲喂比例(早)") @Excel(name = "饲喂比例(早)")
private Long ratioMorning; private Double ratioMorning;
/** 实际量(早) */
@Excel(name = "实际量(早)")
private Long actualMorningSize;
/** 计划量(中) */
@Excel(name = "计划量(中)")
private Long planNoonSize;
/** 计划总量(中) */
@Excel(name = "计划总量(中)")
private Long planNoonTotal;
/** 实际量(中) */
@Excel(name = "实际量(中)")
private Long actualNoonSize;
/** 饲喂比例(中) */ /** 饲喂比例(中) */
@Excel(name = "饲喂比例(中)") @Excel(name = "饲喂比例(中)")
private Long ratioNoon; private Double ratioNoon;
/** 计划量(下) */
@Excel(name = "计划量(下)")
private Long planAfternoonSize;
/** 计划总量(下) */
@Excel(name = "计划总量(下)")
private Long planAfternoonTotal;
/** 实际量(下) */
@Excel(name = "实际量(下)")
private Long actualAfternoonSize;
/** 饲喂比例(下) */ /** 饲喂比例(下) */
@Excel(name = "饲喂比例(下)") @Excel(name = "饲喂比例(下)")
private Long ratioAfternoon; 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 = "计划饲喂总量") @Excel(name = "计划饲喂总量")
private Long planFeedTotal; private Double planFeedTotal;
/** 饲草班人员 */ /** 饲草班人员 */
@Excel(name = "饲草班人员") @Excel(name = "饲草班人员")
@ -108,21 +110,22 @@ public class SgFeedPlan extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("createDate", getCreateDate()) .append("createDate", getCreateDate())
.append("formulaId", getFormulaId()) .append("formulaId", getFormulaId())
.append("batchId", getBatchId())
.append("sheepHouseId", getSheepHouseId()) .append("sheepHouseId", getSheepHouseId())
.append("sheepCount", getSheepCount()) .append("sheepCount", getSheepCount())
.append("planDailySize", getPlanDailySize()) .append("planDailySize", getPlanDailySize())
.append("ratioMorning", getRatioMorning())
.append("ratioNoon", getRatioNoon())
.append("ratioAfternoon", getRatioAfternoon())
.append("planMorningSize", getPlanMorningSize()) .append("planMorningSize", getPlanMorningSize())
.append("planMorningTotal", getPlanMorningTotal()) .append("planMorningTotal", getPlanMorningTotal())
.append("ratioMorning", getRatioMorning())
.append("actualMorningSize", getActualMorningSize()) .append("actualMorningSize", getActualMorningSize())
.append("planNoonSize", getPlanNoonSize()) .append("planNoonSize", getPlanNoonSize())
.append("planNoonTotal", getPlanNoonTotal()) .append("planNoonTotal", getPlanNoonTotal())
.append("actualNoonSize", getActualNoonSize()) .append("actualNoonSize", getActualNoonSize())
.append("ratioNoon", getRatioNoon())
.append("planAfternoonSize", getPlanAfternoonSize()) .append("planAfternoonSize", getPlanAfternoonSize())
.append("planAfternoonTotal", getPlanAfternoonTotal()) .append("planAfternoonTotal", getPlanAfternoonTotal())
.append("actualAfternoonSize", getActualAfternoonSize()) .append("actualAfternoonSize", getActualAfternoonSize())
.append("ratioAfternoon", getRatioAfternoon())
.append("planFeedTotal", getPlanFeedTotal()) .append("planFeedTotal", getPlanFeedTotal())
.append("zookeeper", getZookeeper()) .append("zookeeper", getZookeeper())
.append("planDate", getPlanDate()) .append("planDate", getPlanDate())

View File

@ -1,82 +0,0 @@
package com.zhyc.module.feed.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂比例对象 sg_feed_ratio
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFeedRatio extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 早晨计划比列 */
@Excel(name = "早晨计划比列")
private String morning;
/** 中午计划比例 */
@Excel(name = "中午计划比例")
private String noon;
/** 下午计划比例 */
@Excel(name = "下午计划比例")
private String evening;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMorning(String morning)
{
this.morning = morning;
}
public String getMorning()
{
return morning;
}
public void setNoon(String noon)
{
this.noon = noon;
}
public String getNoon()
{
return noon;
}
public void setEvening(String evening)
{
this.evening = evening;
}
public String getEvening()
{
return evening;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("morning", getMorning())
.append("noon", getNoon())
.append("evening", getEvening())
.toString();
}
}

View File

@ -0,0 +1,98 @@
package com.zhyc.module.feed.domain;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.module.base.domain.DaSheepfold;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
import java.util.Date;
import java.util.List;
/**
* 饲喂量统计对象 sg_feed_statistic
*
* @author HashMap
* @date 2025-08-23
*/
@Setter
@Getter
public class SgFeedStatistic extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* UUID
*/
private String id;
/**
* 配方编号
*/
@Excel(name = "配方编号")
private String formulaId;
/**
* 配方批号
*/
@Excel(name = "配方批号")
private String formulaBatchId;
/**
* 羊只数量
*/
@Excel(name = "羊只数量")
private Long sheepFoldCount;
/**
* 青贮损耗比例
*/
@Excel(name = "青贮损耗比例")
private String silageLossRate;
/**
* 总饲喂量
*/
@Excel(name = "总饲喂量")
private Double feedTotalSize;
/**
* 日均饲喂量
*/
@Excel(name = "日均饲喂量")
private Double feedDailySize;
/**
* 配方列表
*/
@Excel(name = "配方列表")
private List<SgFormulaList> materialList;
/**
* 羊舍列表
*/
@Excel(name = "羊舍列表")
private List<DaSheepfold> sheepFoldList;
@Excel(name = "日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date feedDate;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("formulaId", getFormulaId())
.append("formulaBatchId", getFormulaBatchId())
.append("sheepFoldCount", getSheepFoldCount())
.append("silageLossRate", getSilageLossRate())
.append("feedTotalSize", getFeedTotalSize())
.append("feedDailySize", getFeedDailySize())
.append("materialList", getMaterialList())
.append("sheepFoldList", getSheepFoldList())
.toString();
}
}

View File

@ -1,67 +0,0 @@
package com.zhyc.module.feed.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 原料对象 sg_fodder
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFodder extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 0补饲饲料1配方原料2颗粒原料 */
@Excel(name = "0补饲饲料1配方原料2颗粒原料")
private Long fodderType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setFodderType(Long fodderType)
{
this.fodderType = fodderType;
}
public Long getFodderType()
{
return fodderType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("fodderType", getFodderType())
.toString();
}
}

View File

@ -39,14 +39,25 @@ public class SgFormulaList extends BaseEntity
@Excel(name = "比例") @Excel(name = "比例")
private Long ratio; private Long ratio;
/** 颗粒原料 */ /**
* 颗粒原料
* 当前不局限于 "是否颗粒原料" 而且多种类型的标识符
*/
@Excel(name = "颗粒原料") @Excel(name = "颗粒原料")
private String isGranular; private String isGranular;
/** 补饲 */ /**
* 补饲
* 当前用作饲喂类型标识
*/
@Excel(name = "补饲") @Excel(name = "补饲")
private String isSupplement; private String isSupplement;
/**
* 添加量 - 供其他一些统计模块使用
*/
private Double feedSize;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,61 +0,0 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedDetails;
/**
* 饲喂记录详情Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFeedDetailsMapper
{
/**
* 查询饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 饲喂记录详情
*/
public SgFeedDetails selectSgFeedDetailsById(Long id);
/**
* 查询饲喂记录详情列表
*
* @param sgFeedDetails 饲喂记录详情
* @return 饲喂记录详情集合
*/
public List<SgFeedDetails> selectSgFeedDetailsList(SgFeedDetails sgFeedDetails);
/**
* 新增饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int insertSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 修改饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int updateSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 删除饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 结果
*/
public int deleteSgFeedDetailsById(Long id);
/**
* 批量删除饲喂记录详情
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFeedDetailsByIds(Long[] ids);
}

View File

@ -1,61 +0,0 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedInfo;
/**
* 饲喂记录Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFeedInfoMapper
{
/**
* 查询饲喂记录
*
* @param id 饲喂记录主键
* @return 饲喂记录
*/
public SgFeedInfo selectSgFeedInfoById(Long id);
/**
* 查询饲喂记录列表
*
* @param sgFeedInfo 饲喂记录
* @return 饲喂记录集合
*/
public List<SgFeedInfo> selectSgFeedInfoList(SgFeedInfo sgFeedInfo);
/**
* 新增饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
public int insertSgFeedInfo(SgFeedInfo sgFeedInfo);
/**
* 修改饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
public int updateSgFeedInfo(SgFeedInfo sgFeedInfo);
/**
* 删除饲喂记录
*
* @param id 饲喂记录主键
* @return 结果
*/
public int deleteSgFeedInfoById(Long id);
/**
* 批量删除饲喂记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFeedInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedList;
import org.apache.ibatis.annotations.Mapper;
/**
* 配料清单Mapper接口
*
* @author HashMap
* @date 2025-08-19
*/
@Mapper
public interface SgFeedListMapper
{
/**
* 查询配料清单
*
* @param id 配料清单主键
* @return 配料清单
*/
SgFeedList selectSgFeedListById(Long id);
/**
* 查询配料清单列表
*
* @param sgFeedList 配料清单
* @return 配料清单集合
*/
List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList);
/**
* 新增配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
int insertSgFeedList(SgFeedList sgFeedList);
/**
* 修改配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
int updateSgFeedList(SgFeedList sgFeedList);
/**
* 删除配料清单
*
* @param id 配料清单主键
* @return 结果
*/
int deleteSgFeedListById(Long id);
/**
* 批量删除配料清单
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSgFeedListByIds(Long[] ids);
}

View File

@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
* 饲喂计划Mapper接口 * 饲喂计划Mapper接口
* *
* @author HashMap * @author HashMap
* @date 2025-08-08 * @date 2025-08-14
*/ */
@Mapper @Mapper
public interface SgFeedPlanMapper public interface SgFeedPlanMapper
@ -20,7 +20,7 @@ public interface SgFeedPlanMapper
* @param createDate 饲喂计划主键 * @param createDate 饲喂计划主键
* @return 饲喂计划 * @return 饲喂计划
*/ */
SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate); public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate);
/** /**
* 查询饲喂计划列表 * 查询饲喂计划列表
@ -28,7 +28,7 @@ public interface SgFeedPlanMapper
* @param sgFeedPlan 饲喂计划 * @param sgFeedPlan 饲喂计划
* @return 饲喂计划集合 * @return 饲喂计划集合
*/ */
List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan); public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan);
/** /**
* 新增饲喂计划 * 新增饲喂计划
@ -36,7 +36,7 @@ public interface SgFeedPlanMapper
* @param sgFeedPlan 饲喂计划 * @param sgFeedPlan 饲喂计划
* @return 结果 * @return 结果
*/ */
int insertSgFeedPlan(SgFeedPlan sgFeedPlan); public int insertSgFeedPlan(SgFeedPlan sgFeedPlan);
/** /**
* 修改饲喂计划 * 修改饲喂计划
@ -44,7 +44,7 @@ public interface SgFeedPlanMapper
* @param sgFeedPlan 饲喂计划 * @param sgFeedPlan 饲喂计划
* @return 结果 * @return 结果
*/ */
int updateSgFeedPlan(SgFeedPlan sgFeedPlan); public int updateSgFeedPlan(SgFeedPlan sgFeedPlan);
/** /**
* 删除饲喂计划 * 删除饲喂计划
@ -52,7 +52,7 @@ public interface SgFeedPlanMapper
* @param createDate 饲喂计划主键 * @param createDate 饲喂计划主键
* @return 结果 * @return 结果
*/ */
int deleteSgFeedPlanByCreateDate(Date createDate); public int deleteSgFeedPlanByCreateDate(Date createDate);
/** /**
* 批量删除饲喂计划 * 批量删除饲喂计划
@ -60,5 +60,7 @@ public interface SgFeedPlanMapper
* @param createDates 需要删除的数据主键集合 * @param createDates 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
int deleteSgFeedPlanByCreateDates(Date[] createDates); public int deleteSgFeedPlanByCreateDates(Date[] createDates);
int selectSheepCountByFoldId(Integer foldId);
} }

View File

@ -1,61 +0,0 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedRatio;
/**
* 饲喂比例Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFeedRatioMapper
{
/**
* 查询饲喂比例
*
* @param id 饲喂比例主键
* @return 饲喂比例
*/
public SgFeedRatio selectSgFeedRatioById(Long id);
/**
* 查询饲喂比例列表
*
* @param sgFeedRatio 饲喂比例
* @return 饲喂比例集合
*/
public List<SgFeedRatio> selectSgFeedRatioList(SgFeedRatio sgFeedRatio);
/**
* 新增饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
public int insertSgFeedRatio(SgFeedRatio sgFeedRatio);
/**
* 修改饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
public int updateSgFeedRatio(SgFeedRatio sgFeedRatio);
/**
* 删除饲喂比例
*
* @param id 饲喂比例主键
* @return 结果
*/
public int deleteSgFeedRatioById(Long id);
/**
* 批量删除饲喂比例
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFeedRatioByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedStatistic;
import org.apache.ibatis.annotations.Mapper;
/**
* 饲喂量统计Mapper接口
*
* @author HashMap
* @date 2025-08-23
*/
@Mapper
public interface SgFeedStatisticMapper
{
/**
* 查询饲喂量统计
*
* @param id 饲喂量统计主键
* @return 饲喂量统计
*/
SgFeedStatistic selectSgFeedStatisticById(String id);
/**
* 查询饲喂量统计列表
*
* @param sgFeedStatistic 饲喂量统计
* @return 饲喂量统计集合
*/
List<SgFeedStatistic> selectSgFeedStatisticList(SgFeedStatistic sgFeedStatistic);
/**
* 新增饲喂量统计
*
* @param sgFeedStatistic 饲喂量统计
* @return 结果
*/
int insertSgFeedStatistic(SgFeedStatistic sgFeedStatistic);
/**
* 修改饲喂量统计
*
* @param sgFeedStatistic 饲喂量统计
* @return 结果
*/
int updateSgFeedStatistic(SgFeedStatistic sgFeedStatistic);
/**
* 删除饲喂量统计
*
* @param id 饲喂量统计主键
* @return 结果
*/
int deleteSgFeedStatisticById(String id);
/**
* 批量删除饲喂量统计
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSgFeedStatisticByIds(String[] ids);
}

View File

@ -1,61 +0,0 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFodder;
/**
* 原料Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFodderMapper
{
/**
* 查询原料
*
* @param id 原料主键
* @return 原料
*/
public SgFodder selectSgFodderById(Long id);
/**
* 查询原料列表
*
* @param sgFodder 原料
* @return 原料集合
*/
public List<SgFodder> selectSgFodderList(SgFodder sgFodder);
/**
* 新增原料
*
* @param sgFodder 原料
* @return 结果
*/
public int insertSgFodder(SgFodder sgFodder);
/**
* 修改原料
*
* @param sgFodder 原料
* @return 结果
*/
public int updateSgFodder(SgFodder sgFodder);
/**
* 删除原料
*
* @param id 原料主键
* @return 结果
*/
public int deleteSgFodderById(Long id);
/**
* 批量删除原料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFodderByIds(Long[] ids);
}

View File

@ -0,0 +1,38 @@
package com.zhyc.module.feed.mapper.TypeHandler;
import com.alibaba.fastjson2.JSON;
import com.zhyc.module.base.domain.DaSheepfold;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@MappedTypes(List.class)
public class DaSheepfoldHandler extends BaseTypeHandler<List<DaSheepfold>> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i,
List<DaSheepfold> parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public List<DaSheepfold> getNullableResult(ResultSet rs, String columnName) throws SQLException {
return JSON.parseArray(rs.getString(columnName), DaSheepfold.class);
}
@Override
public List<DaSheepfold> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return JSON.parseArray(rs.getString(columnIndex), DaSheepfold.class);
}
@Override
public List<DaSheepfold> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return JSON.parseArray(cs.getString(columnIndex), DaSheepfold.class);
}
}

View File

@ -0,0 +1,42 @@
package com.zhyc.module.feed.mapper.TypeHandler;
import com.alibaba.fastjson2.JSON;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class JsonTypeHandler<T> extends BaseTypeHandler<T> {
private final Class<T> type;
public JsonTypeHandler(Class<T> type) {
this.type = type;
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public T getNullableResult(ResultSet rs, String columnName) throws SQLException {
String json = rs.getString(columnName);
return JSON.parseObject(json, type);
}
@Override
public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
String json = rs.getString(columnIndex);
return JSON.parseObject(json, type);
}
@Override
public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
String json = cs.getString(columnIndex);
return JSON.parseObject(json, type);
}
}

View File

@ -0,0 +1,37 @@
package com.zhyc.module.feed.mapper.TypeHandler;
import com.alibaba.fastjson2.JSON;
import com.zhyc.module.feed.domain.SgFormulaList;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@MappedTypes(List.class)
public class SgFormulaListHandler extends BaseTypeHandler<List<SgFormulaList>> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i,
List<SgFormulaList> parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i, JSON.toJSONString(parameter));
}
@Override
public List<SgFormulaList> getNullableResult(ResultSet rs, String columnName) throws SQLException {
return JSON.parseArray(rs.getString(columnName), SgFormulaList.class);
}
@Override
public List<SgFormulaList> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return JSON.parseArray(rs.getString(columnIndex), SgFormulaList.class);
}
@Override
public List<SgFormulaList> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return JSON.parseArray(cs.getString(columnIndex), SgFormulaList.class);
}
}

View File

@ -1,61 +0,0 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedDetails;
/**
* 饲喂记录详情Service接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface ISgFeedDetailsService
{
/**
* 查询饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 饲喂记录详情
*/
public SgFeedDetails selectSgFeedDetailsById(Long id);
/**
* 查询饲喂记录详情列表
*
* @param sgFeedDetails 饲喂记录详情
* @return 饲喂记录详情集合
*/
public List<SgFeedDetails> selectSgFeedDetailsList(SgFeedDetails sgFeedDetails);
/**
* 新增饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int insertSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 修改饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int updateSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 批量删除饲喂记录详情
*
* @param ids 需要删除的饲喂记录详情主键集合
* @return 结果
*/
public int deleteSgFeedDetailsByIds(Long[] ids);
/**
* 删除饲喂记录详情信息
*
* @param id 饲喂记录详情主键
* @return 结果
*/
public int deleteSgFeedDetailsById(Long id);
}

Some files were not shown because too many files have changed in this diff Show More