feat (farm): 种植中心-农事记录
- 添加筛选条件 状态
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.Objects;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.FARMING_RECORD_TASK_STATUS_MAP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 生产中心
|
* @description: 生产中心
|
||||||
@@ -206,7 +207,11 @@ public class CropFarmingCenterController {
|
|||||||
@Operation(summary = "农事记录-分页")
|
@Operation(summary = "农事记录-分页")
|
||||||
public CommonResult<PageResult<FarmingRecordRespVO>> getFarmingRecordPage(@Valid FarmingRecordPageReqVO pageReqVO) {
|
public CommonResult<PageResult<FarmingRecordRespVO>> getFarmingRecordPage(@Valid FarmingRecordPageReqVO pageReqVO) {
|
||||||
PageResult<FarmingRecordDO> pageResult = cropFarmingCenterService.getFarmingRecordPage(pageReqVO);
|
PageResult<FarmingRecordDO> pageResult = cropFarmingCenterService.getFarmingRecordPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, FarmingRecordRespVO.class));
|
PageResult<FarmingRecordRespVO> target = BeanUtils.toBean(pageResult, FarmingRecordRespVO.class);
|
||||||
|
for (FarmingRecordRespVO f : target.getList()) {
|
||||||
|
f.setTaskStatusName(FARMING_RECORD_TASK_STATUS_MAP.get(f.getTaskStatus()));
|
||||||
|
}
|
||||||
|
return success(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/farming-record/get/{id}")
|
@GetMapping("/farming-record/get/{id}")
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class FarmingRecordRespVO {
|
|||||||
@Schema(description = "任务范围")
|
@Schema(description = "任务范围")
|
||||||
@ExcelProperty("任务范围")
|
@ExcelProperty("任务范围")
|
||||||
private String taskScope;
|
private String taskScope;
|
||||||
|
private Integer taskStatus;
|
||||||
|
private String taskStatusName;
|
||||||
|
|
||||||
@Schema(description = "任务时间")
|
@Schema(description = "任务时间")
|
||||||
@ExcelProperty("任务时间")
|
@ExcelProperty("任务时间")
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class CommonConstants {
|
|||||||
public final static String GROW_FLAG_1 = "在种";
|
public final static String GROW_FLAG_1 = "在种";
|
||||||
public final static String GROW_FLAG_2 = "空闲";
|
public final static String GROW_FLAG_2 = "空闲";
|
||||||
|
|
||||||
|
public final static Integer FARMING_RECORD_STATUS_0 = 0; //未开始
|
||||||
public final static Integer FARMING_RECORD_STATUS_1 = 1; //开始
|
public final static Integer FARMING_RECORD_STATUS_1 = 1; //开始
|
||||||
public final static Integer FARMING_RECORD_STATUS_2 = 2; // "结束";
|
public final static Integer FARMING_RECORD_STATUS_2 = 2; // "结束";
|
||||||
|
|
||||||
@@ -102,8 +103,14 @@ public class CommonConstants {
|
|||||||
public static Map<Integer,String> SYNC_FLAG_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> USAGE_STATUS_MAP = new HashMap<>();
|
||||||
public static Map<Integer,String> INPUT_CATEGORY_MAP = new HashMap<>();
|
public static Map<Integer,String> INPUT_CATEGORY_MAP = new HashMap<>();
|
||||||
|
public static Map<Integer,String> FARMING_RECORD_TASK_STATUS_MAP = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
FARMING_RECORD_TASK_STATUS_MAP.put(FARMING_RECORD_STATUS_0, "未开始");
|
||||||
|
FARMING_RECORD_TASK_STATUS_MAP.put(FARMING_RECORD_STATUS_1, "开始");
|
||||||
|
FARMING_RECORD_TASK_STATUS_MAP.put(FARMING_RECORD_STATUS_2, "结束");
|
||||||
|
|
||||||
INPUT_CATEGORY_MAP.put(INPUT_CATEGORY_1,"模版类型");
|
INPUT_CATEGORY_MAP.put(INPUT_CATEGORY_1,"模版类型");
|
||||||
INPUT_CATEGORY_MAP.put(INPUT_CATEGORY_2,"引用类型");
|
INPUT_CATEGORY_MAP.put(INPUT_CATEGORY_2,"引用类型");
|
||||||
|
|
||||||
|
|||||||
@@ -588,29 +588,31 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FarmingRecordRespVO getFarmingRecord(String id) {
|
public FarmingRecordRespVO getFarmingRecord(String id) {
|
||||||
|
|
||||||
FarmingRecordDO farmingRecord = farmingRecordService.getFarmingRecord(id);
|
FarmingRecordDO farmingRecord = farmingRecordService.getFarmingRecord(id);
|
||||||
|
|
||||||
List<FarmingRecordRespVO.FarmingRecordInputVO> list = new ArrayList<>();
|
|
||||||
for (FarmingRecordInputDO fr : farmingRecord.getInvestGoodsList()) {
|
|
||||||
FarmingRecordRespVO.FarmingRecordInputVO target = new FarmingRecordRespVO.FarmingRecordInputVO();
|
|
||||||
target.setId(fr.getId());
|
|
||||||
target.setInputsId(fr.getInputChildCategory());
|
|
||||||
target.setAssetType(fr.getInputParentCategory());
|
|
||||||
target.setDose(fr.getDosage());
|
|
||||||
target.setUsage(fr.getUsage());
|
|
||||||
|
|
||||||
int diluted = fr.getDilutionRatio() != null ? Integer.parseInt(fr.getDilutionRatio()) : 0;
|
|
||||||
target.setDiluted(diluted);
|
|
||||||
int packageUnit = fr.getSingleUseUnit() != null ? Integer.parseInt(fr.getSingleUseUnit()) : 0;
|
|
||||||
target.setPackageUnit(packageUnit);
|
|
||||||
int unit = fr.getSingleUseOption() != null ? Integer.parseInt(fr.getSingleUseOption()) : 0;
|
|
||||||
target.setUnit(unit);
|
|
||||||
list.add(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
FarmingRecordRespVO res = BeanUtils.toBean(farmingRecord, FarmingRecordRespVO.class);
|
FarmingRecordRespVO res = BeanUtils.toBean(farmingRecord, FarmingRecordRespVO.class);
|
||||||
res.setInvestGoodsList(list);
|
res.setTaskStatusName(FARMING_RECORD_TASK_STATUS_MAP.get(res.getTaskStatus()));
|
||||||
|
|
||||||
|
// List<FarmingRecordRespVO.FarmingRecordInputVO> list = new ArrayList<>();
|
||||||
|
// for (FarmingRecordInputDO fr : farmingRecord.getInvestGoodsList()) {
|
||||||
|
// FarmingRecordRespVO.FarmingRecordInputVO target = new FarmingRecordRespVO.FarmingRecordInputVO();
|
||||||
|
// target.setId(fr.getId());
|
||||||
|
// target.setInputsId(fr.getInputChildCategory());
|
||||||
|
// target.setAssetType(fr.getInputParentCategory());
|
||||||
|
// target.setDose(fr.getDosage());
|
||||||
|
// target.setUsage(fr.getUsage());
|
||||||
|
//
|
||||||
|
// int diluted = fr.getDilutionRatio() != null ? Integer.parseInt(fr.getDilutionRatio()) : 0;
|
||||||
|
// target.setDiluted(diluted);
|
||||||
|
// int packageUnit = fr.getSingleUseUnit() != null ? Integer.parseInt(fr.getSingleUseUnit()) : 0;
|
||||||
|
// target.setPackageUnit(packageUnit);
|
||||||
|
// int unit = fr.getSingleUseOption() != null ? Integer.parseInt(fr.getSingleUseOption()) : 0;
|
||||||
|
// target.setUnit(unit);
|
||||||
|
// list.add(target);
|
||||||
|
// }
|
||||||
|
// res.setInvestGoodsList(list);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user