refactor (farm): 投入品重构
- 涉及到的模块: - 基础数据管理 - 投入品 (模版类型) - 模型管理 - 农事记录 - 投入品(引用类型) - 生产中心 - 农事记录 - 投入品使用记录
This commit is contained in:
@@ -145,6 +145,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system</artifactId>
|
||||
<version>2025.08-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Validation for @Valid/@NotNull etc. -->
|
||||
<!-- <dependency>-->
|
||||
|
||||
@@ -244,4 +244,5 @@ public class CropFarmingCenterController {
|
||||
return success(res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdata
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.InputLibraryPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.InputLibraryRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.InputLibrarySaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.*;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||
import cn.iocoder.yudao.module.farm.manager.inputs.InputsManager;
|
||||
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputsService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -37,19 +40,24 @@ import cn.iocoder.yudao.module.farm.service.inputlibrary.InputLibraryService;
|
||||
@Validated
|
||||
public class InputLibraryController {
|
||||
|
||||
@Resource
|
||||
private InputLibraryService inputLibraryService;
|
||||
private final InputsManager inputsManager;
|
||||
private final InputsService inputsService;
|
||||
|
||||
public InputLibraryController(InputsManager inputsManager, InputsService inputsService) {
|
||||
this.inputsManager = inputsManager;
|
||||
this.inputsService = inputsService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建投入品库维护")
|
||||
public CommonResult<String> createInputLibrary(@Valid @RequestBody InputLibrarySaveReqVO createReqVO) {
|
||||
return success(inputLibraryService.createInputLibrary(createReqVO));
|
||||
public CommonResult<String> createInputLibrary(@Valid @RequestBody InputsSaveReqVO createReqVO) {
|
||||
return success(inputsManager.createInputsForTemplateType(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新投入品库维护")
|
||||
public CommonResult<Boolean> updateInputLibrary(@Valid @RequestBody InputLibrarySaveReqVO updateReqVO) {
|
||||
inputLibraryService.updateInputLibrary(updateReqVO);
|
||||
public CommonResult<Boolean> updateInputLibrary(@Valid @RequestBody InputsSaveReqVO updateReqVO) {
|
||||
inputsService.updateInputs(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -57,7 +65,7 @@ public class InputLibraryController {
|
||||
@Operation(summary = "删除投入品库维护")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteInputLibrary(@RequestParam("id") String id) {
|
||||
inputLibraryService.deleteInputLibrary(id);
|
||||
inputsService.deleteInputs(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -65,35 +73,50 @@ public class InputLibraryController {
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除投入品库维护")
|
||||
public CommonResult<Boolean> deleteInputLibraryList(@RequestParam("ids") List<String> ids) {
|
||||
inputLibraryService.deleteInputLibraryListByIds(ids);
|
||||
inputsService.deleteInputsListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得投入品库维护")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<InputLibraryRespVO> getInputLibrary(@RequestParam("id") String id) {
|
||||
InputLibraryDO inputLibrary = inputLibraryService.getInputLibrary(id);
|
||||
return success(BeanUtils.toBean(inputLibrary, InputLibraryRespVO.class));
|
||||
public CommonResult<InputsRespVO> getInputLibrary(@RequestParam("id") String id) {
|
||||
InputsRespVO inputs = inputsManager.getInputDetails(id);
|
||||
return success(inputs);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得投入品库维护分页")
|
||||
public CommonResult<PageResult<InputLibraryRespVO>> getInputLibraryPage(@Valid InputLibraryPageReqVO pageReqVO) {
|
||||
PageResult<InputLibraryDO> pageResult = inputLibraryService.getInputLibraryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, InputLibraryRespVO.class));
|
||||
public CommonResult<PageResult<InputsRespVO>> getInputLibraryPage(@Valid InputsPageReqVO pageReqVO) {
|
||||
PageResult<InputsRespVO> pageResult = inputsManager.getInputsPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出投入品库维护 Excel")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportInputLibraryExcel(@Valid InputLibraryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<InputLibraryDO> list = inputLibraryService.getInputLibraryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "投入品库维护.xls", "数据", InputLibraryRespVO.class,
|
||||
BeanUtils.toBean(list, InputLibraryRespVO.class));
|
||||
// @GetMapping("/export-excel")
|
||||
// @Operation(summary = "导出投入品库维护 Excel")
|
||||
// @ApiAccessLog(operateType = EXPORT)
|
||||
// public void exportInputLibraryExcel(@Valid InputLibraryPageReqVO pageReqVO,
|
||||
// HttpServletResponse response) throws IOException {
|
||||
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
// List<InputLibraryDO> list = inputLibraryService.getInputLibraryPage(pageReqVO).getList();
|
||||
// // 导出 Excel
|
||||
// ExcelUtils.write(response, "投入品库维护.xls", "数据", InputLibraryRespVO.class,
|
||||
// BeanUtils.toBean(list, InputLibraryRespVO.class));
|
||||
// }
|
||||
|
||||
@GetMapping("/sync")
|
||||
@Operation(summary = "同步至wms")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> syncInputLibrary(@RequestParam("id") String id) {
|
||||
inputsManager.syncToWms(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/drop-down-box")
|
||||
@Operation(summary = "投入品下拉框")
|
||||
public CommonResult<List<InputsDropDownListRespVO>> syncInputLibrary() {
|
||||
List<InputsDropDownListRespVO> res = inputsManager.getInputsDropDownList();
|
||||
return success(res);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author: binda
|
||||
* @date: 2025/10/17 21:37
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InputsDetailReqVO {
|
||||
private String id;
|
||||
private Integer inputCategory;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: binda
|
||||
* @date: 2025/10/17 22:26
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InputsDropDownListRespVO {
|
||||
|
||||
private String id;
|
||||
@Schema(description = "投入品名称")
|
||||
private String inputName;
|
||||
|
||||
@Schema(description = "投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||
private Integer inputCategory;
|
||||
private String inputCategoryName;
|
||||
|
||||
@Schema(description = "投入品用量")
|
||||
private Integer inputUsage;
|
||||
@Schema(description = " 当前规格类型 (1: 按单品; 2: 按规格)")
|
||||
private Integer currentSpecType;
|
||||
private String currentSpecTypeName;
|
||||
|
||||
@Schema(description = "投入品单价")
|
||||
private BigDecimal inputPrice;
|
||||
@Schema(description = "投入品规格")
|
||||
private String inputSpec;
|
||||
@Schema(description = "投入品单位")
|
||||
private String inputUnit;
|
||||
private String inputUnitName;
|
||||
@Schema(description = "投入品规格单位")
|
||||
private String specUnit;
|
||||
private String specUnitName;
|
||||
|
||||
@Schema(description = "用法")
|
||||
private String remark;
|
||||
}
|
||||
@@ -3,18 +3,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdata
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 投入品分页 Request VO")
|
||||
@Data
|
||||
@@ -23,35 +14,13 @@ public class InputsPageReqVO extends PageParam {
|
||||
@Schema(description = "投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||
private Integer inputCategory;
|
||||
|
||||
@Schema(description = "投入品类型", example = "2")
|
||||
@Schema(description = "投入品类型")
|
||||
private String inputType;
|
||||
|
||||
@Schema(description = "投入品名称", example = "芋艿")
|
||||
@Schema(description = "投入品名称")
|
||||
private String inputName;
|
||||
|
||||
@Schema(description = "投入品单价", example = "11570")
|
||||
private BigDecimal inputPrice;
|
||||
|
||||
@Schema(description = "投入品单位")
|
||||
private String inputUnit;
|
||||
|
||||
@Schema(description = "投入品规格")
|
||||
private String inputSpec;
|
||||
|
||||
@Schema(description = "投入品规格单位")
|
||||
private String specUnit;
|
||||
|
||||
@Schema(description = "投入品用量")
|
||||
private BigDecimal inputUsage;
|
||||
|
||||
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)", example = "1")
|
||||
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)")
|
||||
private Integer usageStatus;
|
||||
|
||||
@Schema(description = "投入品备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 投入品 Response VO")
|
||||
@@ -26,44 +20,78 @@ public class InputsRespVO {
|
||||
@ExcelProperty("投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||
private Integer inputCategory;
|
||||
|
||||
@Schema(description = "投入品类型", example = "2")
|
||||
@Schema(description = "投入品类型")
|
||||
@ExcelProperty("投入品类型")
|
||||
private String inputType;
|
||||
private String inputTypeName;
|
||||
|
||||
@Schema(description = "投入品名称", example = "芋艿")
|
||||
@Schema(description = "投入品名称")
|
||||
@ExcelProperty("投入品名称")
|
||||
private String inputName;
|
||||
|
||||
@Schema(description = "投入品单价", example = "11570")
|
||||
@Schema(description = "投入品单价")
|
||||
@ExcelProperty("投入品单价")
|
||||
private BigDecimal inputPrice;
|
||||
|
||||
@Schema(description = "投入品单位")
|
||||
@ExcelProperty("投入品单位")
|
||||
private String inputUnit;
|
||||
|
||||
@Schema(description = "投入品规格")
|
||||
@Schema(description = "投入品规格") // 规格数量
|
||||
@ExcelProperty("投入品规格")
|
||||
private String inputSpec;
|
||||
|
||||
@Schema(description = "投入品规格单位")
|
||||
@Schema(description = "投入品单位") // 单品
|
||||
@ExcelProperty("投入品单位")
|
||||
private String inputUnit;
|
||||
private String inputUnitName;
|
||||
|
||||
@Schema(description = "投入品规格单位") // 规格
|
||||
@ExcelProperty("投入品规格单位")
|
||||
private String specUnit;
|
||||
private String specUnitName;
|
||||
|
||||
@Schema(description = "投入品用量")
|
||||
@ExcelProperty("投入品用量")
|
||||
private BigDecimal inputUsage;
|
||||
private Integer inputUsage;
|
||||
|
||||
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)", example = "1")
|
||||
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)")
|
||||
@ExcelProperty("投入品使用状态 (1:启用; 0:停用;)")
|
||||
private Integer usageStatus;
|
||||
private String usageStatusName;
|
||||
|
||||
@Schema(description = "投入品备注", example = "你说的对")
|
||||
@Schema(description = "同步标识符 (1: 已同步; 0: 未同步;)")
|
||||
@ExcelProperty("投入品使用状态")
|
||||
private Integer syncFlag;
|
||||
private String syncFlagName;
|
||||
|
||||
@Schema(description = "当前规格类型 (1: 按单品; 2: 按规格)")
|
||||
@ExcelProperty("当前规格类型")
|
||||
private Integer currentSpecType;
|
||||
private String currentSpecTypeName;
|
||||
|
||||
@Schema(description = "投入品备注")
|
||||
@ExcelProperty("投入品备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "可用库存数量")
|
||||
private Integer availableQuantity;
|
||||
|
||||
@Schema(description = "现货库存数量")
|
||||
private Integer onHandQuantity;
|
||||
|
||||
@Schema(description = "库存预警数量")
|
||||
private Integer reservedQuantity;
|
||||
|
||||
// 登记证号 非必填
|
||||
private String registration;
|
||||
// 提供厂商 非必填
|
||||
private String manufacturer;
|
||||
// 药物类型 非必填
|
||||
private Integer drugType;
|
||||
// 有效成分 非必填
|
||||
private String activePrinciple;
|
||||
// 稀释倍液 非必填
|
||||
private Integer diluted;
|
||||
}
|
||||
@@ -15,31 +15,44 @@ public class InputsSaveReqVO {
|
||||
@Schema(description = "投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||
private Integer inputCategory;
|
||||
|
||||
@Schema(description = "投入品类型", example = "2")
|
||||
@Schema(description = "投入品类型")
|
||||
private String inputType;
|
||||
|
||||
@Schema(description = "投入品名称", example = "芋艿")
|
||||
@Schema(description = "投入品名称")
|
||||
private String inputName;
|
||||
|
||||
@Schema(description = "投入品单价", example = "11570")
|
||||
@Schema(description = "投入品单价")
|
||||
private BigDecimal inputPrice;
|
||||
|
||||
@Schema(description = "投入品单位")
|
||||
private String inputUnit;
|
||||
|
||||
@Schema(description = "投入品规格")
|
||||
private String inputSpec;
|
||||
|
||||
@Schema(description = "投入品单位")
|
||||
private String inputUnit;
|
||||
|
||||
@Schema(description = "投入品规格单位")
|
||||
private String specUnit;
|
||||
|
||||
@Schema(description = "投入品用量")
|
||||
private BigDecimal inputUsage;
|
||||
private Integer inputUsage;
|
||||
|
||||
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)", example = "1")
|
||||
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)")
|
||||
private Integer usageStatus;
|
||||
|
||||
@Schema(description = "投入品备注", example = "你说的对")
|
||||
@Schema(description = "同步标识符 (1: 已同步; 0: 未同步;)")
|
||||
private Integer syncFlag;
|
||||
|
||||
@Schema(description = "投入品备注")
|
||||
private String remark;
|
||||
|
||||
// 登记证号 非必填
|
||||
private String registration;
|
||||
// 提供厂商 非必填
|
||||
private String manufacturer;
|
||||
// 药物类型 非必填
|
||||
private Integer drugType;
|
||||
// 有效成分 非必填
|
||||
private String activePrinciple;
|
||||
// 稀释倍液 非必填
|
||||
private Integer diluted;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ public class ModelFarmingOperationController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得模型管理-农事操作")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
public CommonResult<ModelFarmingOperationRespVO> getModelFarmingOperation(@RequestParam("id") String id) {
|
||||
ModelFarmingOperationRespVO modelFarmingOperation = modelFarmingOperationService.getModelFarmingOperation(id);
|
||||
return success(modelFarmingOperation);
|
||||
|
||||
@@ -79,5 +79,8 @@ public class ModelFarmingOperationRespVO {
|
||||
@Schema(description = "可修改状态 (1:是; 0:否;)", example = "31485")
|
||||
private Integer usableType;
|
||||
|
||||
@Schema(description = "投入品id集合")
|
||||
private String inputsIds;
|
||||
|
||||
private List<ModelFarmingOperationInputDO> farmingOperationInputDOS;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class FarmingRecordDO extends BaseDO {
|
||||
*/
|
||||
private String taskTime;
|
||||
/**
|
||||
* 任务计划 (1: 开始; 2: 结束;)
|
||||
* 任务计划 (0: 未开始; 1: 开始; 2: 结束;)
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
@@ -87,25 +87,11 @@ public class FarmingRecordDO extends BaseDO {
|
||||
*/
|
||||
@TableField(value = "feedback_image_url")
|
||||
private String feedbackImageUrl;
|
||||
|
||||
/**
|
||||
* 执行反馈-图片URL集合(业务层使用)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> feedbackImageUrlList;
|
||||
|
||||
/**
|
||||
* 任务时间集合
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> taskTimeList;
|
||||
|
||||
/**
|
||||
* 执行人集合
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> executorList;
|
||||
|
||||
/**
|
||||
* 逻辑删除标识符
|
||||
*/
|
||||
@@ -124,6 +110,32 @@ public class FarmingRecordDO extends BaseDO {
|
||||
private String plotName;
|
||||
|
||||
private String tenantId;
|
||||
/**
|
||||
* 引用类型投入品id集合 (逗号分隔)
|
||||
*/
|
||||
private String inputsIds;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务时间集合
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> taskTimeList;
|
||||
/**
|
||||
* 执行人集合
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> executorList;
|
||||
@TableField(exist = false)
|
||||
private List<FarmingRecordInputDO> investGoodsList;
|
||||
|
||||
|
||||
@@ -3,11 +3,7 @@ package cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@@ -36,10 +32,15 @@ public class InputsDO extends BaseDO {
|
||||
* 投入品分类 (1: 模版分类; 2: 引用分类)
|
||||
*/
|
||||
private Integer inputCategory;
|
||||
@TableField(exist = false)
|
||||
private String inputCategoryName;
|
||||
|
||||
/**
|
||||
* 投入品类型
|
||||
*/
|
||||
private String inputType;
|
||||
@TableField(exist = false)
|
||||
private String inputTypeName;
|
||||
/**
|
||||
* 投入品名称
|
||||
*/
|
||||
@@ -48,29 +49,74 @@ public class InputsDO extends BaseDO {
|
||||
* 投入品单价
|
||||
*/
|
||||
private BigDecimal inputPrice;
|
||||
/**
|
||||
* 投入品单位
|
||||
*/
|
||||
private String inputUnit;
|
||||
/**
|
||||
* 投入品规格
|
||||
*/
|
||||
private String inputSpec;
|
||||
/**
|
||||
* 投入品单位
|
||||
*/
|
||||
private String inputUnit;
|
||||
@TableField(exist = false)
|
||||
private String inputUnitName;
|
||||
/**
|
||||
* 投入品规格单位
|
||||
*/
|
||||
private String specUnit;
|
||||
@TableField(exist = false)
|
||||
private String specUnitName;
|
||||
|
||||
/**
|
||||
* 当前规格类型 (1: 按单品; 2: 按规格)
|
||||
*/
|
||||
private Integer currentSpecType;
|
||||
@TableField(exist = false)
|
||||
private String currentSpecTypeName;
|
||||
/**
|
||||
* 投入品用量
|
||||
*/
|
||||
private BigDecimal inputUsage;
|
||||
private Integer inputUsage;
|
||||
/**
|
||||
* 投入品使用状态 (1:启用; 0:停用;)
|
||||
*/
|
||||
private Integer usageStatus;
|
||||
@TableField(exist = false)
|
||||
private String usageStatusName;
|
||||
/**
|
||||
* 同步标识符 (1: 已同步; 0: 未同步;)
|
||||
*/
|
||||
private Integer syncFlag;
|
||||
@TableField(exist = false)
|
||||
private String syncFlagName;
|
||||
/**
|
||||
* 投入品备注
|
||||
*/
|
||||
private String remark;
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 可用库存数量
|
||||
*/
|
||||
private Integer availableQuantity;
|
||||
/**
|
||||
* 现货库存数量
|
||||
*/
|
||||
private Integer onHandQuantity;
|
||||
/**
|
||||
* 库存预警数量
|
||||
*/
|
||||
private Integer reservedQuantity;
|
||||
|
||||
|
||||
|
||||
// 登记证号 非必填
|
||||
private String registration;
|
||||
// 提供厂商 非必填
|
||||
private String manufacturer;
|
||||
// 药物类型 非必填
|
||||
private Integer drugType;
|
||||
// 有效成分 非必填
|
||||
private String activePrinciple;
|
||||
// 稀释倍液 非必填
|
||||
private Integer diluted;
|
||||
}
|
||||
|
||||
@@ -61,11 +61,6 @@ public class ModelFarmingOperationDO extends BaseDO {
|
||||
* 操作示意图
|
||||
*/
|
||||
private String sketch;
|
||||
/**
|
||||
* 操作示意图集合(业务层使用)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> sketchList;
|
||||
/**
|
||||
* 基地id
|
||||
*/
|
||||
@@ -82,8 +77,23 @@ public class ModelFarmingOperationDO extends BaseDO {
|
||||
* 地块
|
||||
*/
|
||||
private String plotName;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
/**
|
||||
* 引用类型投入品id集合 (逗号分隔)
|
||||
*/
|
||||
private String inputsIds;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 操作示意图集合(业务层使用)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> sketchList;
|
||||
@TableField(exist = false)
|
||||
private List<ModelFarmingOperationInputDO> investGoodsList;
|
||||
|
||||
|
||||
@@ -20,15 +20,8 @@ public interface InputsMapper extends BaseMapperX<InputsDO> {
|
||||
.eqIfPresent(InputsDO::getInputCategory, reqVO.getInputCategory())
|
||||
.eqIfPresent(InputsDO::getInputType, reqVO.getInputType())
|
||||
.likeIfPresent(InputsDO::getInputName, reqVO.getInputName())
|
||||
.eqIfPresent(InputsDO::getInputPrice, reqVO.getInputPrice())
|
||||
.eqIfPresent(InputsDO::getInputUnit, reqVO.getInputUnit())
|
||||
.eqIfPresent(InputsDO::getInputSpec, reqVO.getInputSpec())
|
||||
.eqIfPresent(InputsDO::getSpecUnit, reqVO.getSpecUnit())
|
||||
.eqIfPresent(InputsDO::getInputUsage, reqVO.getInputUsage())
|
||||
.eqIfPresent(InputsDO::getUsageStatus, reqVO.getUsageStatus())
|
||||
.eqIfPresent(InputsDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(InputsDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(InputsDO::getId));
|
||||
.orderByDesc(InputsDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,54 +39,8 @@ public class CommonConstants {
|
||||
public final static String NEWS_TYPE_4 = "4"; // 1: 要闻;2:速递;3:热搜;4: 重磅; 99:其他
|
||||
public final static String NEWS_TYPE_99 = "99"; // 1: 要闻;2:速递;3:热搜;4: 重磅; 99:其他
|
||||
|
||||
|
||||
|
||||
public static Map<Integer, String> PLAN_MAP = new HashMap<>();
|
||||
public static Map<String, String> LIFE_CYCLE_MAP = new HashMap<>();
|
||||
public static Map<String, String> GRID_TYPE = new HashMap<>();
|
||||
public static Map<Integer,String> DEVICE_STATE_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> BINDING_STATE_MAP = new HashMap<>();
|
||||
public static Map<String,String> NEWS_TYPE_MAP = new HashMap<>();
|
||||
public static Map<String,String> ONLINE_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> LEASE_STATUS_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
PLAN_MAP.put(PLAN_STATUS_1, "未开始");
|
||||
PLAN_MAP.put(PLAN_STATUS_2, "进行中");
|
||||
PLAN_MAP.put(PLAN_STATUS_3, "已完成");
|
||||
PLAN_MAP.put(PLAN_STATUS_4, "逾期");
|
||||
PLAN_MAP.put(PLAN_STATUS_5, "逾期未开始");
|
||||
PLAN_MAP.put(PLAN_STATUS_6, "逾期未结束");
|
||||
PLAN_MAP.put(PLAN_STATUS_7, "已结束");
|
||||
|
||||
LIFE_CYCLE_MAP.put("1", "一年生");
|
||||
LIFE_CYCLE_MAP.put("2", "半年生");
|
||||
LIFE_CYCLE_MAP.put("10", "多年生");
|
||||
|
||||
GRID_TYPE.put("1", "养殖类型");
|
||||
GRID_TYPE.put("2", "水产类型");
|
||||
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_0,"未激活");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_1,"在线");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_2,"离线");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_3,"维护中");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_4,"故障");
|
||||
|
||||
BINDING_STATE_MAP.put(0,"未绑定");
|
||||
BINDING_STATE_MAP.put(1,"已绑定");
|
||||
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_1,"要闻");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_2,"速递");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_3,"热搜");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_4,"重磅");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_99,"其他");
|
||||
|
||||
ONLINE_MAP.put("online", "在线");
|
||||
ONLINE_MAP.put("offline", "离线");
|
||||
|
||||
LEASE_STATUS_MAP.put(1, "已租");
|
||||
LEASE_STATUS_MAP.put(0, "未租");
|
||||
}
|
||||
public final static Integer INPUT_TYPE_1 = 1; // 1: 模版类型
|
||||
public final static Integer INPUT_TYPE_2 = 2; // 1: 引用类型
|
||||
|
||||
// 模型类型 (1:模型模板; 2:引用案例)
|
||||
public final static Integer MODEL_TYPE_1 = 1;
|
||||
@@ -125,4 +79,79 @@ public class CommonConstants {
|
||||
public final static String DEVICE_TYPE_SOIL = "soil";
|
||||
public final static String DEVICE_TYPE_WF = "water_fertilizer";
|
||||
public final static String DEVICE_TYPE_VIDEO_MONITOR = "video_monitor";
|
||||
|
||||
public final static Integer CURRENT_SPEC_TYPE_1 = 1; // 当前规格类型 (1: 按单品; 2: 按规格)
|
||||
public final static Integer CURRENT_SPEC_TYPE_2 = 2; // 当前规格类型 (1: 按单品; 2: 按规格)
|
||||
|
||||
public final static Integer SYNC_FLAG_YES = 1; // 同步标识符 (1: 已同步; 0: 未同步;)
|
||||
public final static Integer SYNC_FLAG_NO = 0; // 同步标识符 (1: 已同步; 0: 未同步;)
|
||||
|
||||
public final static Integer INPUT_CATEGORY_1 = 1; // 模版类型
|
||||
public final static Integer INPUT_CATEGORY_2 = 2; // 引用类型
|
||||
|
||||
public static Map<Integer, String> PLAN_MAP = new HashMap<>();
|
||||
public static Map<String, String> LIFE_CYCLE_MAP = new HashMap<>();
|
||||
public static Map<String, String> GRID_TYPE = new HashMap<>();
|
||||
public static Map<Integer,String> DEVICE_STATE_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> BINDING_STATE_MAP = new HashMap<>();
|
||||
public static Map<String,String> NEWS_TYPE_MAP = new HashMap<>();
|
||||
public static Map<String,String> ONLINE_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> LEASE_STATUS_MAP = new HashMap<>();
|
||||
|
||||
public static Map<Integer,String> CURRENT_SPEC_TYPE_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> SYNC_FLAG_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> USAGE_STATUS_MAP = new HashMap<>();
|
||||
public static Map<Integer,String> INPUT_CATEGORY_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
INPUT_CATEGORY_MAP.put(INPUT_CATEGORY_1,"模版类型");
|
||||
INPUT_CATEGORY_MAP.put(INPUT_CATEGORY_2,"引用类型");
|
||||
|
||||
|
||||
USAGE_STATUS_MAP.put(YES_CODE,"启用");
|
||||
USAGE_STATUS_MAP.put(NO_CODE,"停用");
|
||||
|
||||
CURRENT_SPEC_TYPE_MAP.put(CURRENT_SPEC_TYPE_1, "按单品");
|
||||
CURRENT_SPEC_TYPE_MAP.put(CURRENT_SPEC_TYPE_2, "按规格");
|
||||
|
||||
SYNC_FLAG_MAP.put(SYNC_FLAG_YES, "已同步");
|
||||
SYNC_FLAG_MAP.put(SYNC_FLAG_NO, "未同步");
|
||||
|
||||
PLAN_MAP.put(PLAN_STATUS_1, "未开始");
|
||||
PLAN_MAP.put(PLAN_STATUS_2, "进行中");
|
||||
PLAN_MAP.put(PLAN_STATUS_3, "已完成");
|
||||
PLAN_MAP.put(PLAN_STATUS_4, "逾期");
|
||||
PLAN_MAP.put(PLAN_STATUS_5, "逾期未开始");
|
||||
PLAN_MAP.put(PLAN_STATUS_6, "逾期未结束");
|
||||
PLAN_MAP.put(PLAN_STATUS_7, "已结束");
|
||||
|
||||
LIFE_CYCLE_MAP.put("1", "一年生");
|
||||
LIFE_CYCLE_MAP.put("2", "半年生");
|
||||
LIFE_CYCLE_MAP.put("10", "多年生");
|
||||
|
||||
GRID_TYPE.put("1", "养殖类型");
|
||||
GRID_TYPE.put("2", "水产类型");
|
||||
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_0,"未激活");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_1,"在线");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_2,"离线");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_3,"维护中");
|
||||
DEVICE_STATE_MAP.put(DEVICE_STATE_4,"故障");
|
||||
|
||||
BINDING_STATE_MAP.put(0,"未绑定");
|
||||
BINDING_STATE_MAP.put(1,"已绑定");
|
||||
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_1,"要闻");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_2,"速递");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_3,"热搜");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_4,"重磅");
|
||||
NEWS_TYPE_MAP.put(NEWS_TYPE_99,"其他");
|
||||
|
||||
ONLINE_MAP.put("online", "在线");
|
||||
ONLINE_MAP.put("offline", "离线");
|
||||
|
||||
LEASE_STATUS_MAP.put(1, "已租");
|
||||
LEASE_STATUS_MAP.put(0, "未租");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
package cn.iocoder.yudao.module.farm.manager.inputs;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelfarmingoperation.vo.ModelFarmingOperationRespVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||
import cn.iocoder.yudao.module.farm.manager.inputs.dto.wms.InputCategoryDTO;
|
||||
import cn.iocoder.yudao.module.farm.manager.inputs.service.WmsStockRemoteService;
|
||||
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
||||
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputUsageRecordsService;
|
||||
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputsService;
|
||||
import cn.iocoder.yudao.module.farm.service.modelfarmingoperation.ModelFarmingOperationService;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.*;
|
||||
|
||||
/**
|
||||
* @description: 投入品
|
||||
* @author: binda
|
||||
* @date: 2025/10/17 14:27
|
||||
*/
|
||||
@Service
|
||||
public class InputsManager {
|
||||
|
||||
private final InputsService inputsService;
|
||||
private final InputUsageRecordsService inputUsageRecordsService;
|
||||
private final WmsStockRemoteService wmsStockService;
|
||||
private final DictDataService dictDataService;
|
||||
private final FarmingRecordService farmingRecordService;
|
||||
private final ModelFarmingOperationService modelFarmingOperationService;
|
||||
|
||||
public InputsManager(InputsService inputsService, InputUsageRecordsService inputUsageRecordsService, WmsStockRemoteService wmsStockService, DictDataService dictDataService, FarmingRecordService farmingRecordService, ModelFarmingOperationService modelFarmingOperationService) {
|
||||
this.inputsService = inputsService;
|
||||
this.inputUsageRecordsService = inputUsageRecordsService;
|
||||
this.wmsStockService = wmsStockService;
|
||||
this.dictDataService = dictDataService;
|
||||
this.farmingRecordService = farmingRecordService;
|
||||
this.modelFarmingOperationService = modelFarmingOperationService;
|
||||
}
|
||||
|
||||
private final String ASSET_TYPE = "asset_type"; // 投入品类型
|
||||
private final String ITEMS_UNIT = "asset_unit"; // 规格-单位 (eg: 斤,吨..)
|
||||
private final String SPECIFICATION_PRICE = "asset_price"; // 单品-单位 (eg: 捆,箱..)
|
||||
|
||||
private Map<String, String> getDictTypeMap(String dictType) {
|
||||
List<DictDataDO> dictDataList = dictDataService.getDictDataList(NO_CODE, dictType);
|
||||
return dictDataList.stream()
|
||||
// 按 sort 字段降序排序(数字大的在上面)
|
||||
.sorted((o1, o2) -> o2.getSort().compareTo(o1.getSort()))
|
||||
// 收集到 Map 中
|
||||
.collect(Collectors.toMap(
|
||||
DictDataDO::getValue, // key 映射
|
||||
DictDataDO::getLabel, // value 映射
|
||||
(oldValue, newValue) -> oldValue, // 键冲突时的处理策略
|
||||
LinkedHashMap::new // 使用 LinkedHashMap 保持排序顺序
|
||||
));
|
||||
}
|
||||
|
||||
private void covertStr(InputsDO e,Map<String, String> m,Map<String, String> m2,Map<String, String> m3) {
|
||||
e.setUsageStatusName(USAGE_STATUS_MAP.get(e.getUsageStatus()));
|
||||
e.setSyncFlagName(SYNC_FLAG_MAP.get(e.getSyncFlag()));
|
||||
e.setCurrentSpecTypeName(CURRENT_SPEC_TYPE_MAP.get(e.getCurrentSpecType()));
|
||||
e.setInputTypeName(m.get(e.getInputType()));
|
||||
e.setInputUnitName(m2.get(e.getInputUnit()));
|
||||
e.setSpecUnitName(m3.get(e.getSpecUnit()));
|
||||
}
|
||||
|
||||
/*
|
||||
* ============================
|
||||
* 基础数据管理 - 投入品 (模版类型)
|
||||
* ============================
|
||||
*/
|
||||
|
||||
public String createInputsForTemplateType(InputsSaveReqVO req) {
|
||||
// 新增本地投入品
|
||||
req.setInputCategory(INPUT_TYPE_1);
|
||||
String id = inputsService.createInputs(req);
|
||||
|
||||
// todo 同步给WMS系统
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
this.syncToWms(id);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean syncToWms(String id) {
|
||||
InputCategoryDTO syncDTO = new InputCategoryDTO();
|
||||
String code = wmsStockService.syncInputCategory(syncDTO);
|
||||
if (!StringUtils.equals(code, "success")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
InputsSaveReqVO req = new InputsSaveReqVO();
|
||||
req.setId(id);
|
||||
req.setSyncFlag(CommonConstants.YES_CODE);
|
||||
inputsService.updateInputs(req);
|
||||
return true;
|
||||
}
|
||||
|
||||
public PageResult<InputsRespVO> getInputsPage(InputsPageReqVO req) {
|
||||
|
||||
Map<String, String> inputTypeNameMap = this.getDictTypeMap(ASSET_TYPE);
|
||||
Map<String, String> itemsNameMap = this.getDictTypeMap(ITEMS_UNIT);
|
||||
Map<String, String> specificationNameMap = this.getDictTypeMap(SPECIFICATION_PRICE);
|
||||
|
||||
req.setInputCategory(CommonConstants.INPUT_TYPE_1);
|
||||
PageResult<InputsDO> source = inputsService.getInputsPage(req);
|
||||
source.getList().stream().forEach(e -> {
|
||||
covertStr(e, inputTypeNameMap, itemsNameMap, specificationNameMap);
|
||||
});
|
||||
|
||||
PageResult<InputsRespVO> res = BeanUtils.toBean(source, InputsRespVO.class);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
public InputsRespVO getInputDetails(String id) {
|
||||
|
||||
Map<String, String> inputTypeNameMap = this.getDictTypeMap(ASSET_TYPE);
|
||||
Map<String, String> itemsNameMap = this.getDictTypeMap(ITEMS_UNIT);
|
||||
Map<String, String> specificationNameMap = this.getDictTypeMap(SPECIFICATION_PRICE);
|
||||
|
||||
InputsDO source = inputsService.getInputs(new InputsDetailReqVO(id, INPUT_CATEGORY_1));
|
||||
covertStr(source, inputTypeNameMap, itemsNameMap, specificationNameMap);
|
||||
|
||||
InputsRespVO res = BeanUtils.toBean(source, InputsRespVO.class);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
public List<InputsDropDownListRespVO> getInputsDropDownList() {
|
||||
Map<String, String> inputTypeNameMap = this.getDictTypeMap(ASSET_TYPE);
|
||||
Map<String, String> itemsNameMap = this.getDictTypeMap(ITEMS_UNIT);
|
||||
Map<String, String> specificationNameMap = this.getDictTypeMap(SPECIFICATION_PRICE);
|
||||
|
||||
List<InputsDO> source = inputsService.getInputsListForTemplateType();
|
||||
source.stream().forEach(e -> {
|
||||
covertStr(e, inputTypeNameMap, itemsNameMap, specificationNameMap);
|
||||
});
|
||||
return BeanUtils.toBean(source,InputsDropDownListRespVO.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* =================================================
|
||||
* 模型管理 - 农事记录 - 投入品 (引用类型)
|
||||
* =================================================
|
||||
*/
|
||||
|
||||
public void createInputsForReferenceType(InputsSaveReqVO req) {
|
||||
req.setInputCategory(INPUT_TYPE_2);
|
||||
String id = inputsService.createInputs(req);
|
||||
}
|
||||
|
||||
PageResult<InputsRespVO> getInputsPageForReferenceType(String mfId,InputsPageReqVO req) {
|
||||
|
||||
ModelFarmingOperationRespVO modelFarmingOperation = modelFarmingOperationService.getModelFarmingOperation(mfId);
|
||||
String inputsIds = modelFarmingOperation.getInputsIds();
|
||||
List<String> ids = Arrays.stream(inputsIds.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
|
||||
Map<String, String> inputTypeNameMap = this.getDictTypeMap(ASSET_TYPE);
|
||||
Map<String, String> itemsNameMap = this.getDictTypeMap(ITEMS_UNIT);
|
||||
Map<String, String> specificationNameMap = this.getDictTypeMap(SPECIFICATION_PRICE);
|
||||
|
||||
req.setInputCategory(CommonConstants.INPUT_TYPE_2);
|
||||
PageResult<InputsDO> source = inputsService.getInputsPage(req);
|
||||
source.getList().stream().forEach(e -> {
|
||||
covertStr(e, inputTypeNameMap, itemsNameMap, specificationNameMap);
|
||||
});
|
||||
|
||||
PageResult<InputsRespVO> res = BeanUtils.toBean(source, InputsRespVO.class);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ===============================
|
||||
* 种植中心 - 农事记录 - 投入品使用记录
|
||||
* ===============================
|
||||
*/
|
||||
|
||||
public void createInputUsageRecords(InputsSaveReqVO req) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.farm.manager.inputs.dto.wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: mws 物料库存 同步接口请求实体
|
||||
* @author: binda
|
||||
* @date: 2025/10/17 15:29
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InputCategoryDTO {
|
||||
private String id;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.farm.manager.inputs.service;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.manager.inputs.dto.wms.InputCategoryDTO;
|
||||
|
||||
/**
|
||||
* @description: wms系统 物料库存接口
|
||||
* @author: binda
|
||||
* @data: 2025/10/17 15:27
|
||||
*/
|
||||
public interface WmsStockRemoteService {
|
||||
// TODO: 2025/10/17
|
||||
String syncInputCategory(InputCategoryDTO inputCategoryDTO);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.farm.manager.inputs.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.manager.inputs.dto.wms.InputCategoryDTO;
|
||||
import cn.iocoder.yudao.module.farm.manager.inputs.service.WmsStockRemoteService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author: binda
|
||||
* @date: 2025/10/20 09:55
|
||||
*/
|
||||
@Service
|
||||
public class WmsStockRemoteServiceImpl implements WmsStockRemoteService {
|
||||
@Override
|
||||
public String syncInputCategory(InputCategoryDTO inputCategoryDTO) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatam
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 投入品使用记录 Service 接口
|
||||
|
||||
@@ -3,12 +3,12 @@ package cn.iocoder.yudao.module.farm.service.inputlibrary;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsDetailReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 投入品 Service 接口
|
||||
@@ -53,6 +53,8 @@ public interface InputsService {
|
||||
* @return 投入品
|
||||
*/
|
||||
InputsDO getInputs(String id);
|
||||
InputsDO getInputs(InputsDetailReqVO req);
|
||||
List<InputsDO> getInputsListForTemplateType();
|
||||
|
||||
/**
|
||||
* 获得投入品分页
|
||||
|
||||
@@ -2,10 +2,14 @@ package cn.iocoder.yudao.module.farm.service.inputlibrary;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsDetailReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputsMapper;
|
||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -17,6 +21,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -33,8 +38,13 @@ public class InputsServiceImpl implements InputsService {
|
||||
|
||||
@Override
|
||||
public String createInputs(InputsSaveReqVO createReqVO) {
|
||||
Long tenantId = getLoginUser().getTenantId();
|
||||
String id = IdUtil.fastUUID();
|
||||
|
||||
// 插入
|
||||
InputsDO inputs = BeanUtils.toBean(createReqVO, InputsDO.class);
|
||||
inputs.setId(id);
|
||||
inputs.setTenantId(String.valueOf(tenantId));
|
||||
inputsMapper.insert(inputs);
|
||||
|
||||
// 返回
|
||||
@@ -76,6 +86,31 @@ public class InputsServiceImpl implements InputsService {
|
||||
return inputsMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputsDO getInputs(InputsDetailReqVO req) {
|
||||
Long tenantId = getLoginUser().getTenantId();
|
||||
|
||||
// LambdaQueryWrapperX<InputsDO> x = new LambdaQueryWrapperX<>();
|
||||
// x.eq(InputsDO::getId, req.getId());
|
||||
// x.eq(InputsDO::getInputCategory, req.getInputCategory());
|
||||
// x.eq(InputsDO::getDeleted, CommonConstants.NO_CODE);
|
||||
// x.eq(InputsDO::getTenantId, tenantId);
|
||||
|
||||
return inputsMapper.selectOne(InputsDO::getId,req.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InputsDO> getInputsListForTemplateType() {
|
||||
Long tenantId = getLoginUser().getTenantId();
|
||||
|
||||
LambdaQueryWrapperX<InputsDO> x = new LambdaQueryWrapperX<>();
|
||||
x.eq(InputsDO::getInputCategory, CommonConstants.INPUT_CATEGORY_1);
|
||||
x.eq(InputsDO::getDeleted, CommonConstants.NO_CODE);
|
||||
x.eq(InputsDO::getTenantId, tenantId);
|
||||
|
||||
return inputsMapper.selectList(x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InputsDO> getInputsPage(InputsPageReqVO pageReqVO) {
|
||||
return inputsMapper.selectPage(pageReqVO);
|
||||
|
||||
Reference in New Issue
Block a user