From e965c9c35cdc43e7f7cd0776d870645adfd7d1c8 Mon Sep 17 00:00:00 2001 From: HashMap Date: Tue, 12 Aug 2025 15:55:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(module):=20=E9=A5=B2=E5=96=82=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20-=20=E9=85=8D=E6=96=B9=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 完成饲喂管理模块中的配方管理部分 --- .../feed/controller/SgFeedPlanController.java | 107 +++++++++++ .../controller/SgFormulaListController.java | 106 +++++++++++ .../SgFormulaManagementController.java | 172 ++++++++++++++++++ .../feed/controller/SgMaterialController.java | 107 +++++++++++ .../zhyc/module/feed/domain/SgFeedPlan.java | 132 ++++++++++++++ .../module/feed/domain/SgFormulaList.java | 62 +++++++ .../feed/domain/SgFormulaManagement.java | 79 ++++++++ .../zhyc/module/feed/domain/SgMaterial.java | 15 ++ .../module/feed/mapper/SgFeedPlanMapper.java | 64 +++++++ .../feed/mapper/SgFormulaListMapper.java | 71 ++++++++ .../mapper/SgFormulaManagementMapper.java | 65 +++++++ .../module/feed/mapper/SgMaterialMapper.java | 63 +++++++ .../feed/service/ISgFeedPlanService.java | 62 +++++++ .../feed/service/ISgFormulaListService.java | 63 +++++++ .../service/ISgFormulaManagementService.java | 66 +++++++ .../feed/service/ISgMaterialService.java | 61 +++++++ .../service/impl/SgFeedPlanServiceImpl.java | 99 ++++++++++ .../impl/SgFormulaListServiceImpl.java | 97 ++++++++++ .../impl/SgFormulaManagementServiceImpl.java | 135 ++++++++++++++ .../service/impl/SgMaterialServiceImpl.java | 96 ++++++++++ .../service/impl/WzStockInServiceImpl.java | 4 +- .../mapper/feed/SgFeedPlanMapper.xml | 137 ++++++++++++++ .../mapper/feed/SgFormulaListMapper.xml | 87 +++++++++ .../mapper/feed/SgFormulaManagementMapper.xml | 82 +++++++++ .../mapper/feed/SgMaterialMapper.xml | 64 +++++++ 25 files changed, 2095 insertions(+), 1 deletion(-) create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaListController.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgMaterialController.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFeedPlan.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaList.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaManagement.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgMaterial.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFeedPlanMapper.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaListMapper.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaManagementMapper.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgMaterialMapper.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFeedPlanService.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaListService.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaManagementService.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgMaterialService.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFeedPlanServiceImpl.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaListServiceImpl.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaManagementServiceImpl.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgMaterialServiceImpl.java create mode 100644 zhyc-module/src/main/resources/mapper/feed/SgFeedPlanMapper.xml create mode 100644 zhyc-module/src/main/resources/mapper/feed/SgFormulaListMapper.xml create mode 100644 zhyc-module/src/main/resources/mapper/feed/SgFormulaManagementMapper.xml create mode 100644 zhyc-module/src/main/resources/mapper/feed/SgMaterialMapper.xml diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java new file mode 100644 index 0000000..ad2a6a2 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java @@ -0,0 +1,107 @@ +package com.zhyc.module.feed.controller; + +import java.util.Date; +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.SgFeedPlan; +import com.zhyc.module.feed.service.ISgFeedPlanService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 饲喂计划Controller + * + * @author HashMap + * @date 2025-08-08 + */ +@RestController +@RequestMapping("/feed/FeedPlan") +public class SgFeedPlanController extends BaseController +{ + private final ISgFeedPlanService sgFeedPlanService; + + public SgFeedPlanController(ISgFeedPlanService sgFeedPlanService) { + this.sgFeedPlanService = sgFeedPlanService; + } + + /** + * 查询饲喂计划列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FeedPlan:list')") + @GetMapping("/list") + public TableDataInfo list(SgFeedPlan sgFeedPlan) + { + startPage(); + List list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan); + return getDataTable(list); + } + + /** + * 导出饲喂计划列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FeedPlan:export')") + @Log(title = "饲喂计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SgFeedPlan sgFeedPlan) + { + List list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan); + ExcelUtil util = new ExcelUtil<>(SgFeedPlan.class); + util.exportExcel(response, list, "饲喂计划数据"); + } + + /** + * 获取饲喂计划详细信息 + */ + @PreAuthorize("@ss.hasPermi('feed:FeedPlan:query')") + @GetMapping(value = "/{createDate}") + public AjaxResult getInfo(@PathVariable("createDate") Date createDate) + { + return success(sgFeedPlanService.selectSgFeedPlanByCreateDate(createDate)); + } + + /** + * 新增饲喂计划 + */ + @PreAuthorize("@ss.hasPermi('feed:FeedPlan:add')") + @Log(title = "饲喂计划", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SgFeedPlan sgFeedPlan) + { + return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan)); + } + + /** + * 修改饲喂计划 + */ + @PreAuthorize("@ss.hasPermi('feed:FeedPlan:edit')") + @Log(title = "饲喂计划", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan) + { + return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan)); + } + + /** + * 删除饲喂计划 + */ + @PreAuthorize("@ss.hasPermi('feed:FeedPlan:remove')") + @Log(title = "饲喂计划", businessType = BusinessType.DELETE) + @DeleteMapping("/{createDates}") + public AjaxResult remove(@PathVariable Date[] createDates) + { + return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaListController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaListController.java new file mode 100644 index 0000000..fb6a83b --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaListController.java @@ -0,0 +1,106 @@ +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.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.SgFormulaList; +import com.zhyc.module.feed.service.ISgFormulaListService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 配方列表Controller + * + * @author HashMap + * @date 2025-08-09 + */ +@RestController +@RequestMapping("/feed/FormulaList") +public class SgFormulaListController extends BaseController +{ + private final ISgFormulaListService sgFormulaListService; + + public SgFormulaListController(ISgFormulaListService sgFormulaListService) { + this.sgFormulaListService = sgFormulaListService; + } + + /** + * 查询配方列表列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaList:list')") + @GetMapping("/list") + public TableDataInfo list(SgFormulaList sgFormulaList) + { + startPage(); + List list = sgFormulaListService.selectSgFormulaListList(sgFormulaList); + return getDataTable(list); + } + + /** + * 导出配方列表列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaList:export')") + @Log(title = "配方列表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SgFormulaList sgFormulaList) + { + List list = sgFormulaListService.selectSgFormulaListList(sgFormulaList); + ExcelUtil util = new ExcelUtil<>(SgFormulaList.class); + util.exportExcel(response, list, "配方列表数据"); + } + + /** + * 获取配方列表详细信息 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaList:query')") + @GetMapping(value = "/{code}") + public AjaxResult getInfo(@PathVariable("code") Long code) + { + return success(sgFormulaListService.selectSgFormulaListByCode(code)); + } + + /** + * 新增配方列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaList:add')") + @Log(title = "配方列表", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SgFormulaList sgFormulaList) + { + return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList)); + } + + /** + * 修改配方列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaList:edit')") + @Log(title = "配方列表", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SgFormulaList sgFormulaList) + { + return toAjax(sgFormulaListService.updateSgFormulaList(sgFormulaList)); + } + + /** + * 删除配方列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaList:remove')") + @Log(title = "配方列表", businessType = BusinessType.DELETE) + @DeleteMapping("/{codes}") + public AjaxResult remove(@PathVariable Long[] codes) + { + return toAjax(sgFormulaListService.deleteSgFormulaListByCodes(codes)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java new file mode 100644 index 0000000..3f33ae2 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java @@ -0,0 +1,172 @@ +package com.zhyc.module.feed.controller; + +import java.util.List; +import java.util.Objects; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.feed.domain.SgFormulaList; +import com.zhyc.module.feed.service.ISgFormulaListService; +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.SgFormulaManagement; +import com.zhyc.module.feed.service.ISgFormulaManagementService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 配方管理Controller + * + * @author HashMap + * @date 2025-08-09 + */ +@RestController +@RequestMapping("/feed/FormulaManagement") +public class SgFormulaManagementController extends BaseController { + private final ISgFormulaManagementService sgFormulaManagementService; + private final ISgFormulaListService sgFormulaListService; + + public SgFormulaManagementController(ISgFormulaManagementService sgFormulaManagementService, ISgFormulaListService sgFormulaListService) { + this.sgFormulaManagementService = sgFormulaManagementService; + this.sgFormulaListService = sgFormulaListService; + } + + /** + * 查询配方管理列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaManagement:list')") + @GetMapping("/list") + public TableDataInfo list(SgFormulaManagement sgFormulaManagement) { + startPage(); + // 非查询详情时设定BatchId为0查询配方模板 + if (null != sgFormulaManagement && !Objects.equals(sgFormulaManagement.getQueryType(), "query")) { + sgFormulaManagement.setBatchId("0"); + } + List FormulaManagement = sgFormulaManagementService.selectSgFormulaManagementList(sgFormulaManagement); + for (SgFormulaManagement sgFormulaManagementItem : FormulaManagement) { + SgFormulaManagement query = new SgFormulaManagement(); + query.setFormulaId(sgFormulaManagementItem.getFormulaId()); + query.setQueryType("Sub"); + List subFormula = sgFormulaManagementService.selectSgFormulaManagementList(query); + sgFormulaManagementItem.setSubFormulaList(subFormula); + } + return getDataTable(FormulaManagement); + } + + /** + * 导出配方管理列表 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaManagement:export')") + @Log(title = "配方管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SgFormulaManagement sgFormulaManagement) { + List list = sgFormulaManagementService.selectSgFormulaManagementList(sgFormulaManagement); + ExcelUtil util = new ExcelUtil<>(SgFormulaManagement.class); + util.exportExcel(response, list, "配方管理数据"); + } + + /** + * 获取配方管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaManagement:query')") + @GetMapping(value = "/{formulaId}") + public AjaxResult getInfo(@PathVariable("formulaId") String formulaId) { + return success(sgFormulaManagementService.selectSgFormulaManagementByFormulaId(formulaId)); + } + + /** + * 新增配方管理 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaManagement:add')") + @Log(title = "配方管理", businessType = BusinessType.INSERT) + @PostMapping + @Transactional(rollbackFor = Exception.class) + public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) { + if (null == sgFormulaManagement) + throw new RuntimeException("ERROR: 数据为空"); + if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) { + SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId()); + if (exist != null) { + throw new RuntimeException("WARNING: 配方编码重复,录入失败"); + } + } else { + SgFormulaManagement exist = new SgFormulaManagement(); + exist.setFormulaId(sgFormulaManagement.getFormulaId()); + exist.setBatchId(sgFormulaManagement.getBatchId()); + if (!sgFormulaManagementService.selectSgFormulaManagementList(exist).isEmpty()) { + throw new RuntimeException("WARNING: 批号重复,录入失败"); + } + } + List sgFormulaList = sgFormulaManagement.getSgFormulaList(); + for (SgFormulaList sgFormulaListItem : sgFormulaList) { + // 前端引用模板数据时会引用主键Code,在插入前置为空 + sgFormulaListItem.setCode(null); + sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId()); + sgFormulaListItem.setBatchId(sgFormulaManagement.getBatchId()); + sgFormulaListService.insertSgFormulaList(sgFormulaListItem); + } + return toAjax(sgFormulaManagementService.insertSgFormulaManagement(sgFormulaManagement)); + } + + /** + * 修改配方管理 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaManagement:edit')") + @Log(title = "配方管理", businessType = BusinessType.UPDATE) + @PutMapping + @Transactional(rollbackFor = Exception.class) + public AjaxResult edit(@RequestBody SgFormulaManagement sgFormulaManagement) { + List sgFormulaList = sgFormulaManagement.getSgFormulaList(); + if (null != sgFormulaManagement.getFormulaId() && null != sgFormulaManagement.getBatchId()) { + SgFormulaList delete = new SgFormulaList(); + delete.setFormulaId(sgFormulaManagement.getFormulaId()); + delete.setBatchId(sgFormulaManagement.getBatchId()); + sgFormulaListService.deleteSgFormulaListByFormulaIdAndBatchId(delete); + } else { + throw new RuntimeException("FormulaID & BatchID不能为空"); + } + + // 配方表同步更新 + for (SgFormulaList sgFormulaListItem : sgFormulaList) { + sgFormulaListItem.setBatchId(sgFormulaManagement.getBatchId()); + sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId()); + sgFormulaListService.insertSgFormulaList(sgFormulaListItem); + } + return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement)); + } + + /** + * 删除配方管理 + */ + @PreAuthorize("@ss.hasPermi('feed:FormulaManagement:remove')") + @Log(title = "配方管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{formulaId}/{batchId}") + @Transactional(rollbackFor = Exception.class) + public AjaxResult remove(@PathVariable String formulaId, @PathVariable String batchId) { + SgFormulaManagement sgFormulaManagement = new SgFormulaManagement(); + sgFormulaManagement.setFormulaId(formulaId); + sgFormulaManagement.setBatchId(batchId); + if (sgFormulaManagement.getBatchId().equals("0")) { + sgFormulaManagement.setBatchId(null); + List list = sgFormulaManagementService.selectSgFormulaManagementList(sgFormulaManagement); + if (list.size() > 1) { + throw new RuntimeException("WARNING 该配方正被使用,无法删除"); + } + sgFormulaManagement.setBatchId(batchId); + } + // 前置检查完毕 执行删除 + sgFormulaManagement.setBatchId(batchId); + return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgMaterialController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgMaterialController.java new file mode 100644 index 0000000..8f4c789 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgMaterialController.java @@ -0,0 +1,107 @@ +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.SgMaterial; +import com.zhyc.module.feed.service.ISgMaterialService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 原料Controller + * + * @author HashMap + * @date 2025-08-11 + */ +@RestController +@RequestMapping("/feed/material") +public class SgMaterialController extends BaseController +{ + private final ISgMaterialService sgMaterialService; + + public SgMaterialController(ISgMaterialService sgMaterialService) { + this.sgMaterialService = sgMaterialService; + } + + /** + * 查询原料列表 + */ + @PreAuthorize("@ss.hasPermi('feed:material:list')") + @GetMapping("/list") + public TableDataInfo list(SgMaterial sgMaterial) + { + startPage(); + List list = sgMaterialService.selectSgMaterialList(sgMaterial); + return getDataTable(list); + } + + /** + * 导出原料列表 + */ + @PreAuthorize("@ss.hasPermi('feed:material:export')") + @Log(title = "原料", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SgMaterial sgMaterial) + { + List list = sgMaterialService.selectSgMaterialList(sgMaterial); + ExcelUtil util = new ExcelUtil<>(SgMaterial.class); + util.exportExcel(response, list, "原料数据"); + } + + /** + * 获取原料详细信息 + */ + @PreAuthorize("@ss.hasPermi('feed:material:query')") + @GetMapping(value = "/{materialId}") + public AjaxResult getInfo(@PathVariable("materialId") String materialId) + { + return success(sgMaterialService.selectSgMaterialByMaterialId(materialId)); + } + + /** + * 新增原料 + */ + @PreAuthorize("@ss.hasPermi('feed:material:add')") + @Log(title = "原料", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SgMaterial sgMaterial) + { + return toAjax(sgMaterialService.insertSgMaterial(sgMaterial)); + } + + /** + * 修改原料 + */ + @PreAuthorize("@ss.hasPermi('feed:material:edit')") + @Log(title = "原料", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SgMaterial sgMaterial) + { + return toAjax(sgMaterialService.updateSgMaterial(sgMaterial)); + } + + /** + * 删除原料 + */ + @PreAuthorize("@ss.hasPermi('feed:material:remove')") + @Log(title = "原料", businessType = BusinessType.DELETE) + @DeleteMapping("/{materialIds}") + public AjaxResult remove(@PathVariable String[] materialIds) + { + return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFeedPlan.java b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFeedPlan.java new file mode 100644 index 0000000..596eac2 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFeedPlan.java @@ -0,0 +1,132 @@ +package com.zhyc.module.feed.domain; + +import java.util.Date; +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_plan + * + * @author HashMap + * @date 2025-08-08 + */ +@Setter +@Getter +public class SgFeedPlan extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 创建日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date createDate; + + /** 配方编码 */ + @Excel(name = "配方编码") + private String formulaId; + + /** 羊舍 */ + @Excel(name = "羊舍") + private Long sheepHouseId; + + /** 羊只数量 */ + @Excel(name = "羊只数量") + private Long sheepCount; + + /** 日均计划量 */ + @Excel(name = "日均计划量") + private Long planDailySize; + + /** 计划量(早) */ + @Excel(name = "计划量(早)") + private Long planMorningSize; + + /** 计划总量(早) */ + @Excel(name = "计划总量(早)") + private Long planMorningTotal; + + /** 饲喂比例(早) */ + @Excel(name = "饲喂比例(早)") + private Long ratioMorning; + + /** 实际量(早) */ + @Excel(name = "实际量(早)") + private Long actualMorningSize; + + /** 计划量(中) */ + @Excel(name = "计划量(中)") + private Long planNoonSize; + + /** 计划总量(中) */ + @Excel(name = "计划总量(中)") + private Long planNoonTotal; + + /** 实际量(中) */ + @Excel(name = "实际量(中)") + private Long actualNoonSize; + + /** 饲喂比例(中) */ + @Excel(name = "饲喂比例(中)") + private Long ratioNoon; + + /** 计划量(下) */ + @Excel(name = "计划量(下)") + private Long planAfternoonSize; + + /** 计划总量(下) */ + @Excel(name = "计划总量(下)") + private Long planAfternoonTotal; + + /** 实际量(下) */ + @Excel(name = "实际量(下)") + private Long actualAfternoonSize; + + /** 饲喂比例(下) */ + @Excel(name = "饲喂比例(下)") + private Long ratioAfternoon; + + /** 计划饲喂总量 */ + @Excel(name = "计划饲喂总量") + private Long planFeedTotal; + + /** 饲草班人员 */ + @Excel(name = "饲草班人员") + private String zookeeper; + + /** 饲喂计划日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date planDate; + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("createDate", getCreateDate()) + .append("formulaId", getFormulaId()) + .append("sheepHouseId", getSheepHouseId()) + .append("sheepCount", getSheepCount()) + .append("planDailySize", getPlanDailySize()) + .append("planMorningSize", getPlanMorningSize()) + .append("planMorningTotal", getPlanMorningTotal()) + .append("ratioMorning", getRatioMorning()) + .append("actualMorningSize", getActualMorningSize()) + .append("planNoonSize", getPlanNoonSize()) + .append("planNoonTotal", getPlanNoonTotal()) + .append("actualNoonSize", getActualNoonSize()) + .append("ratioNoon", getRatioNoon()) + .append("planAfternoonSize", getPlanAfternoonSize()) + .append("planAfternoonTotal", getPlanAfternoonTotal()) + .append("actualAfternoonSize", getActualAfternoonSize()) + .append("ratioAfternoon", getRatioAfternoon()) + .append("planFeedTotal", getPlanFeedTotal()) + .append("zookeeper", getZookeeper()) + .append("planDate", getPlanDate()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaList.java b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaList.java new file mode 100644 index 0000000..03ab542 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaList.java @@ -0,0 +1,62 @@ +package com.zhyc.module.feed.domain; + +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_formula_list + * + * @author HashMap + * @date 2025-08-09 + */ +@Setter +@Getter +public class SgFormulaList extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 序号 */ + private Long code; + + /** 配方编号 */ + private String formulaId; + + /** 配方编号 */ + private String batchId; + /** 原料编号 */ + @Excel(name = "原料编号") + private String materialId; + + /** 原料名称 */ + @Excel(name = "原料名称") + private String materialName; + + /** 比例 */ + @Excel(name = "比例") + private Long ratio; + + /** 颗粒原料 */ + @Excel(name = "颗粒原料") + private String isGranular; + + /** 补饲 */ + @Excel(name = "补饲") + private String isSupplement; + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("code", getCode()) + .append("formulaId", getFormulaId()) + .append("materialId", getMaterialId()) + .append("materialName", getMaterialName()) + .append("ratio", getRatio()) + .append("isGranular", getIsGranular()) + .append("isSupplement", getIsSupplement()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaManagement.java b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaManagement.java new file mode 100644 index 0000000..3fa8563 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgFormulaManagement.java @@ -0,0 +1,79 @@ +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_formula_management + * + * @author HashMap + * @date 2025-08-09 + */ +@Setter +@Getter +public class SgFormulaManagement extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 配方编号 */ + private String formulaId; + + /** 饲养阶段 */ + @Excel(name = "饲养阶段") + private String feedStage; + + /** 批号 */ + @Excel(name = "批号") + private String batchId; + + /** 开始使用时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date useStartDate; + + /** 结束使用时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date useEndDate; + + /** 使用状态 */ + @Excel(name = "使用状态") + private String useState; + + /** 备注 */ + @Excel(name = "备注") + private String remark; + + /** 配方列表 */ + private List sgFormulaList; + + /** 子配方 */ + private List subFormulaList; + + /** 查询类型 * + * Sub : 子配方查询 + * query : 类型查询 + * */ + private String queryType; + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("formulaId", getFormulaId()) + .append("feedStage", getFeedStage()) + .append("batchId", getBatchId()) + .append("useStartDate", getUseStartDate()) + .append("useEndDate", getUseEndDate()) + .append("useState", getUseState()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgMaterial.java b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgMaterial.java new file mode 100644 index 0000000..a9634be --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/domain/SgMaterial.java @@ -0,0 +1,15 @@ +package com.zhyc.module.feed.domain; + +import com.zhyc.common.core.domain.BaseEntity; +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter +public class SgMaterial extends BaseEntity { + private static final long serialVersionUID = 1L; + + private String materialId; + private String materialName; + private String isGranular; +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFeedPlanMapper.java b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFeedPlanMapper.java new file mode 100644 index 0000000..7ea4493 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFeedPlanMapper.java @@ -0,0 +1,64 @@ +package com.zhyc.module.feed.mapper; + +import java.util.Date; +import java.util.List; +import com.zhyc.module.feed.domain.SgFeedPlan; +import org.apache.ibatis.annotations.Mapper; + +/** + * 饲喂计划Mapper接口 + * + * @author HashMap + * @date 2025-08-08 + */ +@Mapper +public interface SgFeedPlanMapper +{ + /** + * 查询饲喂计划 + * + * @param createDate 饲喂计划主键 + * @return 饲喂计划 + */ + SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate); + + /** + * 查询饲喂计划列表 + * + * @param sgFeedPlan 饲喂计划 + * @return 饲喂计划集合 + */ + List selectSgFeedPlanList(SgFeedPlan sgFeedPlan); + + /** + * 新增饲喂计划 + * + * @param sgFeedPlan 饲喂计划 + * @return 结果 + */ + int insertSgFeedPlan(SgFeedPlan sgFeedPlan); + + /** + * 修改饲喂计划 + * + * @param sgFeedPlan 饲喂计划 + * @return 结果 + */ + int updateSgFeedPlan(SgFeedPlan sgFeedPlan); + + /** + * 删除饲喂计划 + * + * @param createDate 饲喂计划主键 + * @return 结果 + */ + int deleteSgFeedPlanByCreateDate(Date createDate); + + /** + * 批量删除饲喂计划 + * + * @param createDates 需要删除的数据主键集合 + * @return 结果 + */ + int deleteSgFeedPlanByCreateDates(Date[] createDates); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaListMapper.java b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaListMapper.java new file mode 100644 index 0000000..4d13b9e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaListMapper.java @@ -0,0 +1,71 @@ +package com.zhyc.module.feed.mapper; + +import java.util.List; +import com.zhyc.module.feed.domain.SgFormulaList; +import org.apache.ibatis.annotations.Mapper; + +/** + * 配方列表Mapper接口 + * + * @author HashMap + * @date 2025-08-09 + */ +@Mapper +public interface SgFormulaListMapper +{ + /** + * 查询配方列表 + * + * @param code 配方列表主键 + * @return 配方列表 + */ + SgFormulaList selectSgFormulaListByCode(Long code); + + /** + * 查询配方列表列表 + * + * @param sgFormulaList 配方列表 + * @return 配方列表集合 + */ + List selectSgFormulaListList(SgFormulaList sgFormulaList); + + /** + * 新增配方列表 + * + * @param sgFormulaList 配方列表 + * @return 结果 + */ + int insertSgFormulaList(SgFormulaList sgFormulaList); + + /** + * 修改配方列表 + * + * @param sgFormulaList 配方列表 + * @return 结果 + */ + int updateSgFormulaList(SgFormulaList sgFormulaList); + + /** + * 删除配方列表 + * + * @param code 配方列表主键 + * @return 结果 + */ + int deleteSgFormulaListByCode(Long code); + + /** + * 批量删除配方列表 + * + * @param codes 需要删除的数据主键集合 + * @return 结果 + */ + int deleteSgFormulaListByCodes(Long[] codes); + + /** + * 批量删除配方列表 + * + * @param sgFormulaList 参数实体 + * @return 结果 + */ + int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaManagementMapper.java b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaManagementMapper.java new file mode 100644 index 0000000..ff782e9 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgFormulaManagementMapper.java @@ -0,0 +1,65 @@ +package com.zhyc.module.feed.mapper; + +import java.util.List; +import com.zhyc.module.feed.domain.SgFormulaManagement; +import org.apache.ibatis.annotations.Mapper; + +/** + * 配方管理Mapper接口 + * + * @author HashMap + * @date 2025-08-09 + */ +@Mapper +public interface SgFormulaManagementMapper +{ + /** + * 查询配方管理 + * + * @param formulaId 配方管理主键 + * @return 配方管理 + */ + SgFormulaManagement selectSgFormulaManagementByFormulaId(String formulaId); + + /** + * 查询配方管理列表 + * + * @param sgFormulaManagement 配方管理 + * @return 配方管理集合 + */ + List selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement); + + /** + * 新增配方管理 + * + * @param sgFormulaManagement 配方管理 + * @return 结果 + */ + int insertSgFormulaManagement(SgFormulaManagement sgFormulaManagement); + + /** + * 修改配方管理 + * + * @param sgFormulaManagement 配方管理 + * @return 结果 + */ + int updateSgFormulaManagement(SgFormulaManagement sgFormulaManagement); + + /** + * 删除配方管理 + * + * @param formulaId 配方管理主键 + * @return 结果 + */ + int deleteSgFormulaManagementByFormulaId(String formulaId); + + /** + * 批量删除配方管理 + * + * @param formulaIds 需要删除的数据主键集合 + * @return 结果 + */ + int deleteSgFormulaManagementByFormulaIds(String[] formulaIds); + + int deleteSgFormulaManagement(SgFormulaManagement sgFormulaManagement); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgMaterialMapper.java b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgMaterialMapper.java new file mode 100644 index 0000000..a7a3d70 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/mapper/SgMaterialMapper.java @@ -0,0 +1,63 @@ +package com.zhyc.module.feed.mapper; + +import java.util.List; +import com.zhyc.module.feed.domain.SgMaterial; +import org.apache.ibatis.annotations.Mapper; + +/** + * 原料Mapper接口 + * + * @author HashMap + * @date 2025-08-11 + */ +@Mapper +public interface SgMaterialMapper +{ + /** + * 查询原料 + * + * @param materialId 原料主键 + * @return 原料 + */ + public SgMaterial selectSgMaterialByMaterialId(String materialId); + + /** + * 查询原料列表 + * + * @param sgMaterial 原料 + * @return 原料集合 + */ + public List selectSgMaterialList(SgMaterial sgMaterial); + + /** + * 新增原料 + * + * @param sgMaterial 原料 + * @return 结果 + */ + public int insertSgMaterial(SgMaterial sgMaterial); + + /** + * 修改原料 + * + * @param sgMaterial 原料 + * @return 结果 + */ + public int updateSgMaterial(SgMaterial sgMaterial); + + /** + * 删除原料 + * + * @param materialId 原料主键 + * @return 结果 + */ + public int deleteSgMaterialByMaterialId(String materialId); + + /** + * 批量删除原料 + * + * @param materialIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSgMaterialByMaterialIds(String[] materialIds); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFeedPlanService.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFeedPlanService.java new file mode 100644 index 0000000..3b172e0 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFeedPlanService.java @@ -0,0 +1,62 @@ +package com.zhyc.module.feed.service; + +import java.util.Date; +import java.util.List; +import com.zhyc.module.feed.domain.SgFeedPlan; + +/** + * 饲喂计划Service接口 + * + * @author HashMap + * @date 2025-08-08 + */ +public interface ISgFeedPlanService +{ + /** + * 查询饲喂计划 + * + * @param createDate 饲喂计划主键 + * @return 饲喂计划 + */ + SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate); + + /** + * 查询饲喂计划列表 + * + * @param sgFeedPlan 饲喂计划 + * @return 饲喂计划集合 + */ + List selectSgFeedPlanList(SgFeedPlan sgFeedPlan); + + /** + * 新增饲喂计划 + * + * @param sgFeedPlan 饲喂计划 + * @return 结果 + */ + int insertSgFeedPlan(SgFeedPlan sgFeedPlan); + + /** + * 修改饲喂计划 + * + * @param sgFeedPlan 饲喂计划 + * @return 结果 + */ + int updateSgFeedPlan(SgFeedPlan sgFeedPlan); + + /** + * 批量删除饲喂计划 + * + * @param createDates 需要删除的饲喂计划主键集合 + * @return 结果 + */ + int deleteSgFeedPlanByCreateDates(Date[] createDates); + + /** + * 删除饲喂计划信息 + * + * @param createDate 饲喂计划主键 + * @return 结果 + */ + int deleteSgFeedPlanByCreateDate(Date createDate); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaListService.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaListService.java new file mode 100644 index 0000000..288308d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaListService.java @@ -0,0 +1,63 @@ +package com.zhyc.module.feed.service; + +import java.util.List; +import com.zhyc.module.feed.domain.SgFormulaList; + +/** + * 配方列表Service接口 + * + * @author HashMap + * @date 2025-08-09 + */ +public interface ISgFormulaListService +{ + /** + * 查询配方列表 + * + * @param code 配方列表主键 + * @return 配方列表 + */ + SgFormulaList selectSgFormulaListByCode(Long code); + + /** + * 查询配方列表列表 + * + * @param sgFormulaList 配方列表 + * @return 配方列表集合 + */ + List selectSgFormulaListList(SgFormulaList sgFormulaList); + + /** + * 新增配方列表 + * + * @param sgFormulaList 配方列表 + * @return 结果 + */ + int insertSgFormulaList(SgFormulaList sgFormulaList); + + /** + * 修改配方列表 + * + * @param sgFormulaList 配方列表 + * @return 结果 + */ + int updateSgFormulaList(SgFormulaList sgFormulaList); + + /** + * 批量删除配方列表 + * + * @param codes 需要删除的配方列表主键集合 + * @return 结果 + */ + int deleteSgFormulaListByCodes(Long[] codes); + + /** + * 删除配方列表信息 + * + * @param code 配方列表主键 + * @return 结果 + */ + int deleteSgFormulaListByCode(Long code); + + int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaManagementService.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaManagementService.java new file mode 100644 index 0000000..55d0156 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgFormulaManagementService.java @@ -0,0 +1,66 @@ +package com.zhyc.module.feed.service; + +import java.util.List; +import com.zhyc.module.feed.domain.SgFormulaManagement; + +/** + * 配方管理Service接口 + * + * @author HashMap + * @date 2025-08-09 + */ +public interface ISgFormulaManagementService +{ + /** + * 查询配方管理 + * + * @param formulaId 配方管理主键 + * @return 配方管理 + */ + SgFormulaManagement selectSgFormulaManagementByFormulaId(String formulaId); + + /** + * 查询配方管理列表 + * + * @param sgFormulaManagement 配方管理 + * @return 配方管理集合 + */ + List selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement); + + /** + * 新增配方管理 + * + * @param sgFormulaManagement 配方管理 + * @return 结果 + */ + int insertSgFormulaManagement(SgFormulaManagement sgFormulaManagement); + + /** + * 修改配方管理 + * + * @param sgFormulaManagement 配方管理 + * @return 结果 + */ + int updateSgFormulaManagement(SgFormulaManagement sgFormulaManagement); + + /** + * 批量删除配方管理 + * + * @param formulaIds 需要删除的配方管理主键集合 + * @return 结果 + */ + int deleteSgFormulaManagementByFormulaIds(String[] formulaIds); + + /** + * 删除配方管理信息 + * + * @param formulaId 配方管理主键 + * @return 结果 + */ + int deleteSgFormulaManagementByFormulaId(String formulaId); + + /*** + * 删除配方管理信息 + */ + int deleteSgFormulaManagement(SgFormulaManagement sgFormulaManagement); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgMaterialService.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgMaterialService.java new file mode 100644 index 0000000..ba1e6ac --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/ISgMaterialService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.feed.service; + +import java.util.List; +import com.zhyc.module.feed.domain.SgMaterial; + +/** + * 原料Service接口 + * + * @author HashMap + * @date 2025-08-11 + */ +public interface ISgMaterialService +{ + /** + * 查询原料 + * + * @param materialId 原料主键 + * @return 原料 + */ + SgMaterial selectSgMaterialByMaterialId(String materialId); + + /** + * 查询原料列表 + * + * @param sgMaterial 原料 + * @return 原料集合 + */ + List selectSgMaterialList(SgMaterial sgMaterial); + + /** + * 新增原料 + * + * @param sgMaterial 原料 + * @return 结果 + */ + int insertSgMaterial(SgMaterial sgMaterial); + + /** + * 修改原料 + * + * @param sgMaterial 原料 + * @return 结果 + */ + int updateSgMaterial(SgMaterial sgMaterial); + + /** + * 批量删除原料 + * + * @param materialIds 需要删除的原料主键集合 + * @return 结果 + */ + int deleteSgMaterialByMaterialIds(String[] materialIds); + + /** + * 删除原料信息 + * + * @param materialId 原料主键 + * @return 结果 + */ + int deleteSgMaterialByMaterialId(String materialId); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFeedPlanServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFeedPlanServiceImpl.java new file mode 100644 index 0000000..937cd32 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFeedPlanServiceImpl.java @@ -0,0 +1,99 @@ +package com.zhyc.module.feed.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.stereotype.Service; +import com.zhyc.module.feed.mapper.SgFeedPlanMapper; +import com.zhyc.module.feed.domain.SgFeedPlan; +import com.zhyc.module.feed.service.ISgFeedPlanService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 饲喂计划Service业务层处理 + * + * @author HashMap + * @date 2025-08-08 + */ +@Service +@Transactional(rollbackFor=Exception.class) +public class SgFeedPlanServiceImpl implements ISgFeedPlanService +{ + private final SgFeedPlanMapper sgFeedPlanMapper; + + public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) { + this.sgFeedPlanMapper = sgFeedPlanMapper; + } + + /** + * 查询饲喂计划 + * + * @param createDate 饲喂计划主键 + * @return 饲喂计划 + */ + @Override + public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate) + { + return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate); + } + + /** + * 查询饲喂计划列表 + * + * @param sgFeedPlan 饲喂计划 + * @return 饲喂计划 + */ + @Override + public List selectSgFeedPlanList(SgFeedPlan sgFeedPlan) + { + return sgFeedPlanMapper.selectSgFeedPlanList(sgFeedPlan); + } + + /** + * 新增饲喂计划 + * + * @param sgFeedPlan 饲喂计划 + * @return 结果 + */ + @Override + public int insertSgFeedPlan(SgFeedPlan sgFeedPlan) + { + return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan); + } + + /** + * 修改饲喂计划 + * + * @param sgFeedPlan 饲喂计划 + * @return 结果 + */ + @Override + public int updateSgFeedPlan(SgFeedPlan sgFeedPlan) + { + return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan); + } + + /** + * 批量删除饲喂计划 + * + * @param createDates 需要删除的饲喂计划主键 + * @return 结果 + */ + @Override + public int deleteSgFeedPlanByCreateDates(Date[] createDates) + { + return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates); + } + + /** + * 删除饲喂计划信息 + * + * @param createDate 饲喂计划主键 + * @return 结果 + */ + @Override + public int deleteSgFeedPlanByCreateDate(Date createDate) + { + return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaListServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaListServiceImpl.java new file mode 100644 index 0000000..f26eb3a --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaListServiceImpl.java @@ -0,0 +1,97 @@ +package com.zhyc.module.feed.service.impl; + +import java.util.List; +import java.util.Objects; + +import org.springframework.stereotype.Service; +import com.zhyc.module.feed.mapper.SgFormulaListMapper; +import com.zhyc.module.feed.domain.SgFormulaList; +import com.zhyc.module.feed.service.ISgFormulaListService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 配方列表Service业务层处理 + * + * @author HashMap + * @date 2025-08-09 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SgFormulaListServiceImpl implements ISgFormulaListService { + private final SgFormulaListMapper sgFormulaListMapper; + + public SgFormulaListServiceImpl(SgFormulaListMapper sgFormulaListMapper) { + this.sgFormulaListMapper = sgFormulaListMapper; + } + + /** + * 查询配方列表 + * + * @param code 配方列表主键 + * @return 配方列表 + */ + @Override + public SgFormulaList selectSgFormulaListByCode(Long code) { + return sgFormulaListMapper.selectSgFormulaListByCode(code); + } + + /** + * 查询配方列表列表 + * + * @param sgFormulaList 配方列表 + * @return 配方列表 + */ + @Override + public List selectSgFormulaListList(SgFormulaList sgFormulaList) { + return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList); + } + + /** + * 新增配方列表 + * + * @param sgFormulaList 配方列表 + * @return 结果 + */ + @Override + public int insertSgFormulaList(SgFormulaList sgFormulaList) { + return sgFormulaListMapper.insertSgFormulaList(sgFormulaList); + } + + /** + * 修改配方列表 + * + * @param sgFormulaList 配方列表 + * @return 结果 + */ + @Override + public int updateSgFormulaList(SgFormulaList sgFormulaList) { + return sgFormulaListMapper.updateSgFormulaList(sgFormulaList); + } + + /** + * 批量删除配方列表 + * + * @param codes 需要删除的配方列表主键 + * @return 结果 + */ + @Override + public int deleteSgFormulaListByCodes(Long[] codes) { + return sgFormulaListMapper.deleteSgFormulaListByCodes(codes); + } + + /** + * 删除配方列表信息 + * + * @param code 配方列表主键 + * @return 结果 + */ + @Override + public int deleteSgFormulaListByCode(Long code) { + return sgFormulaListMapper.deleteSgFormulaListByCode(code); + } + + @Override + public int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList) { + return sgFormulaListMapper.deleteSgFormulaListByFormulaIdAndBatchId(sgFormulaList); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaManagementServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaManagementServiceImpl.java new file mode 100644 index 0000000..b07028f --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgFormulaManagementServiceImpl.java @@ -0,0 +1,135 @@ +package com.zhyc.module.feed.service.impl; + +import java.util.Iterator; +import java.util.List; +import java.util.Objects; + +import com.zhyc.module.feed.domain.SgFormulaList; +import com.zhyc.module.feed.mapper.SgFormulaListMapper; +import org.springframework.stereotype.Service; +import com.zhyc.module.feed.mapper.SgFormulaManagementMapper; +import com.zhyc.module.feed.domain.SgFormulaManagement; +import com.zhyc.module.feed.service.ISgFormulaManagementService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 配方管理Service业务层处理 + * + * @author HashMap + * @date 2025-08-09 + */ +@Service +public class SgFormulaManagementServiceImpl implements ISgFormulaManagementService { + private final SgFormulaManagementMapper sgFormulaManagementMapper; + private final SgFormulaListMapper sgFormulaListMapper; + + public SgFormulaManagementServiceImpl(SgFormulaManagementMapper sgFormulaManagementMapper, SgFormulaListMapper sgFormulaListMapper) { + this.sgFormulaManagementMapper = sgFormulaManagementMapper; + this.sgFormulaListMapper = sgFormulaListMapper; + } + + /** + * 查询配方管理 + * + * @param formulaId 配方管理主键 + * @return 配方管理 + */ + @Override + public SgFormulaManagement selectSgFormulaManagementByFormulaId(String formulaId) { + return sgFormulaManagementMapper.selectSgFormulaManagementByFormulaId(formulaId); + } + + /** + * 查询配方管理列表 + * + * @param sgFormulaManagement 配方管理 + * @return 配方管理 + */ + @Override + public List selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) { + List sgFormulaManagements = + sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement); + + Iterator iterator = sgFormulaManagements.iterator(); + while (iterator.hasNext()) { + SgFormulaManagement formulaManagement = iterator.next(); + // 子查询中去除重复的父项 + if (formulaManagement != null + && sgFormulaManagement.getQueryType() != null + && sgFormulaManagement.getQueryType().equals("Sub") + && Objects.equals(formulaManagement.getBatchId(), "0")) { + iterator.remove(); // 安全删除 + continue; // 删除后跳过本次循环 + } + // 绑定配方列表 + if (formulaManagement != null + && formulaManagement.getFormulaId() != null + && formulaManagement.getBatchId() != null) { + SgFormulaList sgFormulaList = new SgFormulaList(); + sgFormulaList.setFormulaId(formulaManagement.getFormulaId()); + sgFormulaList.setBatchId(formulaManagement.getBatchId()); + List formulaLists = + sgFormulaListMapper.selectSgFormulaListList(sgFormulaList); + formulaManagement.setSgFormulaList(formulaLists); + } + } + + return sgFormulaManagements; + } + + + /** + * 新增配方管理 + * + * @param sgFormulaManagement 配方管理 + * @return 结果 + */ + @Override + public int insertSgFormulaManagement(SgFormulaManagement sgFormulaManagement) { + return sgFormulaManagementMapper.insertSgFormulaManagement(sgFormulaManagement); + } + + /** + * 修改配方管理 + * + * @param sgFormulaManagement 配方管理 + * @return 结果 + */ + @Override + public int updateSgFormulaManagement(SgFormulaManagement sgFormulaManagement) { + return sgFormulaManagementMapper.updateSgFormulaManagement(sgFormulaManagement); + } + + /** + * 批量删除配方管理 + * + * @param formulaIds 需要删除的配方管理主键 + * @return 结果 + */ + @Override + public int deleteSgFormulaManagementByFormulaIds(String[] formulaIds) { + return sgFormulaManagementMapper.deleteSgFormulaManagementByFormulaIds(formulaIds); + } + + /** + * 删除配方管理信息 + * + * @param formulaId 配方管理主键 + * @return 结果 + */ + @Override + public int deleteSgFormulaManagementByFormulaId(String formulaId) { + return sgFormulaManagementMapper.deleteSgFormulaManagementByFormulaId(formulaId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteSgFormulaManagement(SgFormulaManagement sgFormulaManagement) { + // 删除关联配方表 + SgFormulaList sgFormulaList = new SgFormulaList(); + sgFormulaList.setFormulaId(sgFormulaManagement.getFormulaId()); + sgFormulaList.setBatchId(sgFormulaManagement.getBatchId()); + sgFormulaListMapper.deleteSgFormulaListByFormulaIdAndBatchId(sgFormulaList); + return sgFormulaManagementMapper.deleteSgFormulaManagement(sgFormulaManagement); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgMaterialServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgMaterialServiceImpl.java new file mode 100644 index 0000000..b858ae3 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/service/impl/SgMaterialServiceImpl.java @@ -0,0 +1,96 @@ +package com.zhyc.module.feed.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Service; +import com.zhyc.module.feed.mapper.SgMaterialMapper; +import com.zhyc.module.feed.domain.SgMaterial; +import com.zhyc.module.feed.service.ISgMaterialService; + +/** + * 原料Service业务层处理 + * + * @author HashMap + * @date 2025-08-11 + */ +@Service +public class SgMaterialServiceImpl implements ISgMaterialService +{ + private final SgMaterialMapper sgMaterialMapper; + + public SgMaterialServiceImpl(SgMaterialMapper sgMaterialMapper) { + this.sgMaterialMapper = sgMaterialMapper; + } + + /** + * 查询原料 + * + * @param materialId 原料主键 + * @return 原料 + */ + @Override + public SgMaterial selectSgMaterialByMaterialId(String materialId) + { + return sgMaterialMapper.selectSgMaterialByMaterialId(materialId); + } + + /** + * 查询原料列表 + * + * @param sgMaterial 原料 + * @return 原料 + */ + @Override + public List selectSgMaterialList(SgMaterial sgMaterial) + { + return sgMaterialMapper.selectSgMaterialList(sgMaterial); + } + + /** + * 新增原料 + * + * @param sgMaterial 原料 + * @return 结果 + */ + @Override + public int insertSgMaterial(SgMaterial sgMaterial) + { + return sgMaterialMapper.insertSgMaterial(sgMaterial); + } + + /** + * 修改原料 + * + * @param sgMaterial 原料 + * @return 结果 + */ + @Override + public int updateSgMaterial(SgMaterial sgMaterial) + { + return sgMaterialMapper.updateSgMaterial(sgMaterial); + } + + /** + * 批量删除原料 + * + * @param materialIds 需要删除的原料主键 + * @return 结果 + */ + @Override + public int deleteSgMaterialByMaterialIds(String[] materialIds) + { + return sgMaterialMapper.deleteSgMaterialByMaterialIds(materialIds); + } + + /** + * 删除原料信息 + * + * @param materialId 原料主键 + * @return 结果 + */ + @Override + public int deleteSgMaterialByMaterialId(String materialId) + { + return sgMaterialMapper.deleteSgMaterialByMaterialId(materialId); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/stock/service/impl/WzStockInServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/stock/service/impl/WzStockInServiceImpl.java index 7632654..7af887f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/stock/service/impl/WzStockInServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/stock/service/impl/WzStockInServiceImpl.java @@ -107,13 +107,15 @@ public class WzStockInServiceImpl implements IWzStockInService { int successNum = 0; int failureNum = 0; int sameNum = 0; + boolean emptyTable = true; StringBuilder successMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder(); try { WzStockIn earliestStockIn = wzStockInMapper.getEarliestStockIn(); + if (null != earliestStockIn) emptyTable = false; System.out.println(earliestStockIn); for (WzStockIn wzStockIn : StockInList) { - if (earliestStockIn.getDocDate().getTime() >= wzStockIn.getDocDate().getTime()) { + if (!emptyTable && earliestStockIn.getDocDate().getTime() >= wzStockIn.getDocDate().getTime()) { sameNum++; continue; } diff --git a/zhyc-module/src/main/resources/mapper/feed/SgFeedPlanMapper.xml b/zhyc-module/src/main/resources/mapper/feed/SgFeedPlanMapper.xml new file mode 100644 index 0000000..fe2b6e3 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/feed/SgFeedPlanMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select create_date, formula_id, sheep_house_id, sheep_count, plan_daily_size, plan_morning_size, plan_morning_total, ratio_morning, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, ratio_noon, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, ratio_afternoon, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan + + + + + + + + insert into sg_feed_plan + + create_date, + formula_id, + sheep_house_id, + sheep_count, + plan_daily_size, + plan_morning_size, + plan_morning_total, + ratio_morning, + actual_morning_size, + plan_noon_size, + plan_noon_total, + actual_noon_size, + ratio_noon, + plan_afternoon_size, + plan_afternoon_total, + actual_afternoon_size, + ratio_afternoon, + plan_feed_total, + zookeeper, + plan_date, + remark, + + + #{createDate}, + #{formulaId}, + #{sheepHouseId}, + #{sheepCount}, + #{planDailySize}, + #{planMorningSize}, + #{planMorningTotal}, + #{ratioMorning}, + #{actualMorningSize}, + #{planNoonSize}, + #{planNoonTotal}, + #{actualNoonSize}, + #{ratioNoon}, + #{planAfternoonSize}, + #{planAfternoonTotal}, + #{actualAfternoonSize}, + #{ratioAfternoon}, + #{planFeedTotal}, + #{zookeeper}, + #{planDate}, + #{remark}, + + + + + update sg_feed_plan + + formula_id = #{formulaId}, + sheep_house_id = #{sheepHouseId}, + sheep_count = #{sheepCount}, + plan_daily_size = #{planDailySize}, + plan_morning_size = #{planMorningSize}, + plan_morning_total = #{planMorningTotal}, + ratio_morning = #{ratioMorning}, + actual_morning_size = #{actualMorningSize}, + plan_noon_size = #{planNoonSize}, + plan_noon_total = #{planNoonTotal}, + actual_noon_size = #{actualNoonSize}, + ratio_noon = #{ratioNoon}, + plan_afternoon_size = #{planAfternoonSize}, + plan_afternoon_total = #{planAfternoonTotal}, + actual_afternoon_size = #{actualAfternoonSize}, + ratio_afternoon = #{ratioAfternoon}, + plan_feed_total = #{planFeedTotal}, + zookeeper = #{zookeeper}, + plan_date = #{planDate}, + remark = #{remark}, + + where create_date = #{createDate} + + + + delete from sg_feed_plan where create_date = #{createDate} + + + + delete from sg_feed_plan where create_date in + + #{createDate} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/feed/SgFormulaListMapper.xml b/zhyc-module/src/main/resources/mapper/feed/SgFormulaListMapper.xml new file mode 100644 index 0000000..f422ccb --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/feed/SgFormulaListMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + select code, formula_id, material_id, material_name, ratio, is_granular, is_supplement from sg_formula_list + + + + + + + + insert into sg_formula_list + + code, + formula_id, + batch_id, + material_id, + material_name, + ratio, + is_granular, + is_supplement, + + + #{code}, + #{formulaId}, + #{batchId}, + #{materialId}, + #{materialName}, + #{ratio}, + #{isGranular}, + #{isSupplement}, + + + + + update sg_formula_list + + formula_id = #{formulaId}, + material_id = #{materialId}, + material_name = #{materialName}, + ratio = #{ratio}, + is_granular = #{isGranular}, + is_supplement = #{isSupplement}, + + where code = #{code} + + + + delete from sg_formula_list where code = #{code} + + + + delete from sg_formula_list where code in + + #{code} + + + + + DELETE FROM sg_formula_list WHERE formula_id = #{formulaId} AND batch_id = #{batchId} + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/feed/SgFormulaManagementMapper.xml b/zhyc-module/src/main/resources/mapper/feed/SgFormulaManagementMapper.xml new file mode 100644 index 0000000..17602f1 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/feed/SgFormulaManagementMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + select formula_id, feed_stage, batch_id, use_start_date, use_end_date, use_state, remark from sg_formula_management + + + + + + + + insert into sg_formula_management + + formula_id, + feed_stage, + batch_id, + use_start_date, + use_end_date, + use_state, + remark, + + + #{formulaId}, + #{feedStage}, + #{batchId}, + #{useStartDate}, + #{useEndDate}, + #{useState}, + #{remark}, + + + + + update sg_formula_management + + feed_stage = #{feedStage}, + use_start_date = #{useStartDate}, + use_end_date = #{useEndDate}, + use_state = #{useState}, + remark = #{remark}, + + where formula_id = #{formulaId} AND batch_id = #{batchId} + + + + delete from sg_formula_management where formula_id = #{formulaId} + + + + delete from sg_formula_management where formula_id in + + #{formulaId} + + + + delete from sg_formula_management where formula_id = #{formulaId} and batch_id = #{batchId} + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/feed/SgMaterialMapper.xml b/zhyc-module/src/main/resources/mapper/feed/SgMaterialMapper.xml new file mode 100644 index 0000000..f4960c9 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/feed/SgMaterialMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + select material_id, material_name, is_granular from sg_material + + + + + + + + insert into sg_material + + material_id, + material_name, + is_granular, + + + #{materialId}, + #{materialName}, + #{isGranular}, + + + + + update sg_material + + material_name = #{materialName}, + is_granular = #{isGranular}, + + where material_id = #{materialId} + + + + delete from sg_material where material_id = #{materialId} + + + + delete from sg_material where material_id in + + #{materialId} + + + \ No newline at end of file