Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -93,8 +93,14 @@ public class ProductionPlanResp2VO {
|
||||
private Double predictedArea;
|
||||
@Schema(description = "预计产量")
|
||||
private Integer predictedYields;
|
||||
@Schema(description = "任务进度")
|
||||
@Schema(description = "任务进度",example = "1/10")
|
||||
private String progressBar;
|
||||
@Schema(description = "任务百分比",example = "10")
|
||||
private String progressRatio;
|
||||
@Schema(description = "任务进度分子",example = "1")
|
||||
private Integer progressNumerator;
|
||||
@Schema(description = "任务进度分母",example = "10")
|
||||
private Integer progressDenominator;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "基地负责人")
|
||||
|
||||
@@ -44,14 +44,6 @@ public class ProductionPlanRespVO {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate harvestStartDate;
|
||||
|
||||
// @Schema(description = "计划开始日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd")
|
||||
// private LocalDate plantingStartDate;
|
||||
//
|
||||
// @Schema(description = "计划结束日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd")
|
||||
// private LocalDate plantingEndDate;
|
||||
|
||||
@Schema(description = "计划执行状态")
|
||||
private Integer planStatus;
|
||||
@Schema(description = "计划执行状态-名称")
|
||||
|
||||
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.farm.controller.admin.home;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.BaseNameVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfoVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.OutlinedInfoVO;
|
||||
import cn.iocoder.yudao.module.farm.service.home.HomeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -34,8 +34,8 @@ public class HomeController {
|
||||
@Parameter(name = "baseId", description = "基地ID", required = true)
|
||||
@Operation(summary = "农场首页")
|
||||
@GetMapping("/{baseId}")
|
||||
public CommonResult<HomeInfoVO> getBaseInfo(@PathVariable("baseId") String baseId) {
|
||||
HomeInfoVO res = homeService.getHomeInfo(baseId);
|
||||
public CommonResult<HomeInfo> getBaseInfo(@PathVariable("baseId") String baseId) {
|
||||
HomeInfo res = homeService.getHomeInfo(baseId);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.home.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: 首页信息
|
||||
* @author: binda
|
||||
* @date: 2025/8/31 16:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HomeInfo {
|
||||
|
||||
@Schema(description = "基地统计信息概述")
|
||||
private BaseOverviewInfo baseOverviewInfo;
|
||||
@Schema(description = "基地弹框信息")
|
||||
private BasePopupFrame basePopupFrame;
|
||||
@Schema(description = "地块集合")
|
||||
private List<PlotInfo> plotInfos;
|
||||
@Schema(description = "计划集合")
|
||||
private List<PlanInfo> planInfos;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class BaseOverviewInfo {
|
||||
@Schema(description = "基地ID")
|
||||
private String baseId;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "基地面积")
|
||||
private BigDecimal baseArea;
|
||||
@Schema(description = "基地负责人")
|
||||
private String manager;
|
||||
@Schema(description = "基地所在区划名称")
|
||||
private String pointName;
|
||||
@Schema(description = "基地坐标")
|
||||
private String point;
|
||||
@Schema(description = "在种地块")
|
||||
private Integer beingPlot;
|
||||
@Schema(description = "在种作物数量")
|
||||
private Integer beingCrop;
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class BasePopupFrame {
|
||||
@Schema(description = "在种面积")
|
||||
private String beingBaseArea;
|
||||
@Schema(description = "基地负责人")
|
||||
private String manager;
|
||||
@Schema(description = "在种作物-名称")
|
||||
private String beingCropName;
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class PlotInfo {
|
||||
@Schema(description = "基地ID")
|
||||
private String baseId;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "基地面积")
|
||||
private BigDecimal baseArea;
|
||||
@Schema(description = "基地负责人")
|
||||
private String manager;
|
||||
@Schema(description = "基地坐标")
|
||||
private String point;
|
||||
@Schema(description = "地块或作物集合")
|
||||
private PlotOrCropInfo plotOrCropInfo;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class PlotOrCropInfo {
|
||||
@Schema(description = "在种作物-名称")
|
||||
private String label;
|
||||
@Schema(description = "基地ID")
|
||||
private String baseId;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "种植状态 (1: 在种; 2: 未种;)")
|
||||
private String growFlag;
|
||||
@Schema(description = "种植面积")
|
||||
private Double growArea;
|
||||
@Schema(description = "在种作物数量")
|
||||
private Integer beingCrop;
|
||||
@Schema(description = "农事任务数量")
|
||||
private Integer taskCount;
|
||||
@Schema(description = "物联设备数量")
|
||||
private Integer lotCount;
|
||||
@Schema(description = "地块负责人")
|
||||
private String manager;
|
||||
@Schema(description = "二维码Url")
|
||||
private String qrCodeUrl;
|
||||
@Schema(description = "计划集合")
|
||||
private List<PlanInfo> planInfos;
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class PlanInfo {
|
||||
@Schema(description = "基地ID")
|
||||
private String baseId;
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
@Schema(description = "基地负责人")
|
||||
private String manager;
|
||||
|
||||
@Schema(description = "物种名称")
|
||||
private String plantSpeciesCode;
|
||||
@Schema(description = "计划编号")
|
||||
private String planNumber;
|
||||
@Schema(description = "管理周期名称")
|
||||
private String cycleName;
|
||||
@Schema(description = "任务进度")
|
||||
private String progressBar;
|
||||
@Schema(description = "种植面积")
|
||||
private Double predictedArea;
|
||||
@Schema(description = "预计产量")
|
||||
private Integer predictedYields;
|
||||
@Schema(description = "计划执行状态")
|
||||
private Integer planStatus;
|
||||
@Schema(description = "计划执行状态-名称")
|
||||
private String planStatusName;
|
||||
@Schema(description = "计划执行子状态")
|
||||
private Integer planSubStatus;
|
||||
@Schema(description = "计划执行子状态-名称")
|
||||
private String planSubStatusName;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
* @date: 2025/8/14 19:56
|
||||
*/
|
||||
@Data
|
||||
public class HomeInfoVO {
|
||||
public class HomeInfo2VO {
|
||||
|
||||
private BaseInfoVO baseInfo;
|
||||
private List<PlotInfoVO> plotInfoVOS;
|
||||
@@ -366,6 +366,9 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
modelInfo.setPredictedArea(planObj.getPredictedArea());
|
||||
modelInfo.setPredictedYields(planObj.getPredictedYields());
|
||||
modelInfo.setProgressBar("1/10"); // TODO: 2025/8/30
|
||||
modelInfo.setProgressRatio("10"); // TODO: 2025/8/31
|
||||
modelInfo.setProgressNumerator(1);
|
||||
modelInfo.setProgressDenominator(10);
|
||||
modelInfo.setBaseName(planObj.getBaseName());
|
||||
modelInfo.setBaseManager(employeeNameMap.get(employeeId)); // 分割,
|
||||
return modelInfo;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package cn.iocoder.yudao.module.farm.service.home;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.BaseNameVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfoVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo2VO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.OutlinedInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -18,7 +19,9 @@ public interface HomeService {
|
||||
* @param baseId 基地ID
|
||||
* @return
|
||||
*/
|
||||
HomeInfoVO getHomeInfo(String baseId);
|
||||
HomeInfo getHomeInfo(String baseId);
|
||||
|
||||
HomeInfo2VO getHomeInfo2(String baseId);
|
||||
|
||||
/**
|
||||
* 首页概要信息
|
||||
|
||||
@@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.farm.service.home;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.BaseNameVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfoVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo.*;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo2VO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.OutlinedInfoVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||
@@ -47,10 +49,102 @@ public class HomeServiceImpl implements HomeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeInfoVO getHomeInfo(String baseId) {
|
||||
public HomeInfo getHomeInfo(String baseId) {
|
||||
|
||||
BaseOverviewInfo baseOverviewInfo = this.getBaseOverviewInfo(baseId);
|
||||
BasePopupFrame basePopupFrame = this.getBasePopupFrame(baseId);
|
||||
List<PlotInfo> plotInfos = this.getPlotInfoList(baseId);
|
||||
List<PlanInfo> planInfos = this.getPlanInfoList("");
|
||||
|
||||
return new HomeInfo(baseOverviewInfo,basePopupFrame,plotInfos,planInfos);
|
||||
}
|
||||
|
||||
private BaseOverviewInfo getBaseOverviewInfo(String baseId) {
|
||||
BaseInfoDO aDo = baseInfoService.getBaseInfo(baseId);
|
||||
BaseOverviewInfo res = new BaseOverviewInfo();
|
||||
res.setBaseId(aDo.getId());
|
||||
res.setBaseName(aDo.getName());
|
||||
res.setBaseArea(aDo.getArea());
|
||||
res.setManager(aDo.getManager()); // TODO: 2025/8/31 code 转 name
|
||||
res.setPointName(""); // TODO: 2025/8/31 应该取不到
|
||||
res.setPoint(aDo.getPoint());
|
||||
res.setBeingPlot(0); // TODO: 2025/8/31 在种地块数量
|
||||
res.setBeingCrop(0); // TODO: 2025/8/31 在种作物数量
|
||||
return res;
|
||||
}
|
||||
|
||||
private BasePopupFrame getBasePopupFrame(String baseId) {
|
||||
BasePopupFrame res = new BasePopupFrame();
|
||||
res.setBeingBaseArea(""); // TODO: 2025/8/31 在种面积 : 300/350亩
|
||||
res.setManager(""); // TODO: 2025/8/31 code 转 name
|
||||
res.setBeingCropName(""); // TODO: 2025/8/31 在种物种名称
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<PlotInfo> getPlotInfoList(String baseId) {
|
||||
List<PlotInfo> targetList = new ArrayList<>();
|
||||
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseId);
|
||||
for (PlotInfoDO e : plotList) {
|
||||
PlotInfo t = new PlotInfo();
|
||||
t.setBaseId(e.getBaseId());
|
||||
t.setBaseName(e.getPlotName());
|
||||
t.setBaseArea(e.getPlotArea());
|
||||
t.setManager(e.getEmployeeId()); // TODO: 2025/8/31 code -> name
|
||||
t.setPoint(e.getPoint());
|
||||
PlotOrCropInfo plotOrCropInfo = this.getPlotOrCropInfoList(baseId,"地块详情"); // TODO: 2025/8/31
|
||||
t.setPlotOrCropInfo(plotOrCropInfo);
|
||||
targetList.add(t);
|
||||
}
|
||||
return targetList;
|
||||
}
|
||||
|
||||
private PlotOrCropInfo getPlotOrCropInfoList(String baseId,String label) {
|
||||
BaseInfoDO b = baseInfoService.getBaseInfo(baseId);
|
||||
PlotOrCropInfo t = new PlotOrCropInfo();
|
||||
t.setLabel(label);
|
||||
t.setBaseId(b.getId());
|
||||
t.setBaseName(b.getName());
|
||||
t.setGrowFlag("在种"); // TODO: 2025/8/31
|
||||
t.setGrowArea(0.00); // TODO: 2025/8/31 种植面积
|
||||
t.setBeingCrop(0); // TODO: 2025/8/31 在种作物数量
|
||||
t.setTaskCount(0); // TODO: 2025/8/31 农事任务数量
|
||||
t.setLotCount(0); // TODO: 2025/8/31 物联设备数量
|
||||
t.setManager(""); // TODO: 2025/8/31 地块负责人
|
||||
t.setQrCodeUrl(""); // TODO: 2025/8/31 暂无
|
||||
t.setPlanInfos(this.getPlanInfoList("")); // TODO: 2025/8/31 plotId
|
||||
return t;
|
||||
}
|
||||
|
||||
private List<PlanInfo> getPlanInfoList(String plotId) {
|
||||
List<PlanInfo> targetList = new ArrayList<>();
|
||||
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans(plotId);
|
||||
for (ProductionPlanDO aDo : plans) {
|
||||
PlanInfo target = new PlanInfo();
|
||||
target.setBaseId("");
|
||||
target.setBaseName("");
|
||||
target.setManager("");
|
||||
target.setPlantSpeciesCode("");
|
||||
target.setPlanNumber("");
|
||||
target.setCycleName("");
|
||||
target.setProgressBar("");
|
||||
target.setPredictedArea(0.0);
|
||||
target.setPredictedYields(0);
|
||||
target.setPlanStatus(0);
|
||||
target.setPlanStatusName("");
|
||||
target.setPlanSubStatus(0);
|
||||
target.setPlanSubStatusName("");
|
||||
targetList.add(target);
|
||||
}
|
||||
return targetList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HomeInfo2VO getHomeInfo2(String baseId) {
|
||||
|
||||
// 地块信息
|
||||
List<HomeInfoVO.PlotInfoVO> plotInfoVOs = this.getPlots(baseId);
|
||||
List<HomeInfo2VO.PlotInfoVO> plotInfoVOs = this.getPlots(baseId);
|
||||
|
||||
int plotCount = 0; // 在种地块
|
||||
int plotTotalCount = 0; // 地块总数
|
||||
@@ -62,7 +156,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
// 基地信息
|
||||
BaseInfoDO baseInfoDO = baseInfoService.getBaseInfo(baseId);
|
||||
|
||||
HomeInfoVO.BaseInfoVO baseInfoVO = new HomeInfoVO.BaseInfoVO();
|
||||
HomeInfo2VO.BaseInfoVO baseInfoVO = new HomeInfo2VO.BaseInfoVO();
|
||||
baseInfoVO.setId(baseInfoDO.getId());
|
||||
baseInfoVO.setArea(baseInfoDO.getArea());
|
||||
baseInfoVO.setPointName(""); // todo 需要从坐标json中解析坐标名称
|
||||
@@ -72,7 +166,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
baseInfoVO.setCropCount(cropCount);
|
||||
baseInfoVO.setCropTotalCount(cropTotalCount);
|
||||
|
||||
HomeInfoVO res = new HomeInfoVO();
|
||||
HomeInfo2VO res = new HomeInfo2VO();
|
||||
res.setBaseInfo(baseInfoVO);
|
||||
res.setPlotInfoVOS(plotInfoVOs);
|
||||
return res;
|
||||
@@ -84,18 +178,18 @@ public class HomeServiceImpl implements HomeService {
|
||||
* @param baseId 基地ID
|
||||
* @return 地块集合
|
||||
*/
|
||||
private List<HomeInfoVO.PlotInfoVO> getPlots(String baseId) {
|
||||
private List<HomeInfo2VO.PlotInfoVO> getPlots(String baseId) {
|
||||
// 地块信息
|
||||
List<PlotInfoDO> plotInfos = plotInfoService.getPlotInfos(baseId);
|
||||
List<HomeInfoVO.PlotInfoVO> resList = new ArrayList<>();
|
||||
List<HomeInfo2VO.PlotInfoVO> resList = new ArrayList<>();
|
||||
plotInfos.forEach(e -> {
|
||||
String plotId = e.getPlotId();
|
||||
|
||||
// 任务信息
|
||||
List<ProductionPlanDO> productionPlanInfos = productionPlanService.getProductionPlans(plotId);
|
||||
List<HomeInfoVO.ProductionPlanVO> plans = new ArrayList<>();
|
||||
List<HomeInfo2VO.ProductionPlanVO> plans = new ArrayList<>();
|
||||
productionPlanInfos.forEach(ee -> {
|
||||
HomeInfoVO.ProductionPlanVO planVO = new HomeInfoVO.ProductionPlanVO();
|
||||
HomeInfo2VO.ProductionPlanVO planVO = new HomeInfo2VO.ProductionPlanVO();
|
||||
planVO.setId(ee.getId());
|
||||
// planVO.setPlantSpecies(ee.getPlantSpecies());
|
||||
// planVO.setCultivationAreaId(ee.getCultivationAreaId());
|
||||
@@ -108,7 +202,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
plans.add(planVO); // todo 任务负责人
|
||||
});
|
||||
|
||||
HomeInfoVO.PlotInfoVO plotVO = new HomeInfoVO.PlotInfoVO();
|
||||
HomeInfo2VO.PlotInfoVO plotVO = new HomeInfo2VO.PlotInfoVO();
|
||||
plotVO.setPlotId(plotId);
|
||||
plotVO.setPlotName(e.getPlotName());
|
||||
plotVO.setPlotArea(e.getPlotArea());
|
||||
@@ -127,8 +221,6 @@ public class HomeServiceImpl implements HomeService {
|
||||
|
||||
@Override
|
||||
public OutlinedInfoVO getOutlinedInfo(String baseId) {
|
||||
|
||||
|
||||
OutlinedInfoVO res = new OutlinedInfoVO();
|
||||
res.setTaskCount(0); // todo 任务数量
|
||||
res.setWarningCount(0); // todo 告警数量
|
||||
|
||||
Reference in New Issue
Block a user