feat (farm): 删除冗余代码 (补充提交)
- 数字驾驶舱-告警/预警统计
This commit is contained in:
@@ -123,12 +123,6 @@ public class ApiController {
|
|||||||
return productionPlanService.getPlantingPlanCompletionChart(req);
|
return productionPlanService.getPlantingPlanCompletionChart(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/digital-cockpit/chart/disaster-statistics")
|
|
||||||
@Operation(summary = "数字驾驶舱-灾害统计-灾害分析")
|
|
||||||
public CommonResult<List<DisasterAnalysisRespVO>> getDisasterStatisticsChart(@Valid @RequestBody DisasterAnalysisReqVO req) {
|
|
||||||
return screenDisasterDataService.getDisasterStatisticsChart(req); // TODO: 2025/9/4 未实现
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/digital-cockpit/chart/farming-distribution")
|
@PostMapping("/digital-cockpit/chart/farming-distribution")
|
||||||
@Operation(summary = "数字驾驶舱-灾害统计-农事分布")
|
@Operation(summary = "数字驾驶舱-灾害统计-农事分布")
|
||||||
public CommonResult<FarmingDistributionRespVO> getFarmingDistributionChart(@Valid @RequestBody FarmingDistributionReqVO req) {
|
public CommonResult<FarmingDistributionRespVO> getFarmingDistributionChart(@Valid @RequestBody FarmingDistributionReqVO req) {
|
||||||
@@ -147,6 +141,12 @@ public class ApiController {
|
|||||||
return deviceInfoService.getDeviceMonitoring(req);// TODO: 2025/9/25
|
return deviceInfoService.getDeviceMonitoring(req);// TODO: 2025/9/25
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/digital-cockpit/chart/disaster-statistics")
|
||||||
|
@Operation(summary = "数字驾驶舱-灾害统计-灾害分析")
|
||||||
|
public CommonResult<List<DisasterAnalysisRespVO>> getDisasterStatisticsChart(@Valid @RequestBody DisasterAnalysisReqVO req) {
|
||||||
|
return screenDisasterDataService.getDisasterStatisticsChart(req); // TODO: 2025/9/4 未实现
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/digital-cockpit/chart/warning-message")
|
@PostMapping("/digital-cockpit/chart/warning-message")
|
||||||
@Operation(summary = "数字驾驶舱-告警/预警统计")
|
@Operation(summary = "数字驾驶舱-告警/预警统计")
|
||||||
public CommonResult<WarningMessageRespVO> getMessageWarning(@Valid WarningMessageReqVO req) {
|
public CommonResult<WarningMessageRespVO> getMessageWarning(@Valid WarningMessageReqVO req) {
|
||||||
|
|||||||
@@ -5,16 +5,20 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.*;
|
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.*;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.modelmanagement.ModelManagementDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||||
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.service.companyinfo.CompanyInfoService;
|
import cn.iocoder.yudao.module.farm.service.companyinfo.CompanyInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.service.deviceinfo.DeviceInfoService;
|
import cn.iocoder.yudao.module.farm.service.deviceinfo.DeviceInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.modelcycle.ModelCycleService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -22,6 +26,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||||
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.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
|
|
||||||
@@ -42,14 +47,16 @@ public class DigitalCockpitController {
|
|||||||
private final DeviceInfoService deviceInfoService;
|
private final DeviceInfoService deviceInfoService;
|
||||||
private final ProductionPlanService productionPlanService;
|
private final ProductionPlanService productionPlanService;
|
||||||
private final FarmingRecordService farmingRecordService;
|
private final FarmingRecordService farmingRecordService;
|
||||||
|
private final ModelManagementService modelManagementService;
|
||||||
|
|
||||||
public DigitalCockpitController(BaseInfoService baseInfoService, PlotInfoService plotInfoService, CompanyInfoService companyInfoService, DeviceInfoService deviceInfoService, ProductionPlanService productionPlanService, FarmingRecordService farmingRecordService) {
|
public DigitalCockpitController(BaseInfoService baseInfoService, PlotInfoService plotInfoService, CompanyInfoService companyInfoService, DeviceInfoService deviceInfoService, ProductionPlanService productionPlanService, FarmingRecordService farmingRecordService, ModelManagementService modelManagementService) {
|
||||||
this.baseInfoService = baseInfoService;
|
this.baseInfoService = baseInfoService;
|
||||||
this.plotInfoService = plotInfoService;
|
this.plotInfoService = plotInfoService;
|
||||||
this.companyInfoService = companyInfoService;
|
this.companyInfoService = companyInfoService;
|
||||||
this.deviceInfoService = deviceInfoService;
|
this.deviceInfoService = deviceInfoService;
|
||||||
this.productionPlanService = productionPlanService;
|
this.productionPlanService = productionPlanService;
|
||||||
this.farmingRecordService = farmingRecordService;
|
this.farmingRecordService = farmingRecordService;
|
||||||
|
this.modelManagementService = modelManagementService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/company-info")
|
@GetMapping("/company-info")
|
||||||
@@ -119,6 +126,7 @@ public class DigitalCockpitController {
|
|||||||
@Parameter(name = "year", description = "查询条件: 年份", required = true)
|
@Parameter(name = "year", description = "查询条件: 年份", required = true)
|
||||||
public CommonResult<List<CropStatisticsRespVO>> getCropStatisticsInfo(@RequestParam("baseId") String baseId,
|
public CommonResult<List<CropStatisticsRespVO>> getCropStatisticsInfo(@RequestParam("baseId") String baseId,
|
||||||
@RequestParam("year") String year) {
|
@RequestParam("year") String year) {
|
||||||
|
// TODO: 2025/9/24 待实现
|
||||||
List<CropStatisticsRespVO> res = new ArrayList<>();
|
List<CropStatisticsRespVO> res = new ArrayList<>();
|
||||||
res.add(new CropStatisticsRespVO("香菜",1000,1200));
|
res.add(new CropStatisticsRespVO("香菜",1000,1200));
|
||||||
return success(res);
|
return success(res);
|
||||||
@@ -130,7 +138,7 @@ public class DigitalCockpitController {
|
|||||||
@Parameter(name = "year", description = "查询条件: 年份", required = true)
|
@Parameter(name = "year", description = "查询条件: 年份", required = true)
|
||||||
public CommonResult<List<YieldStatisticsRespVO>> getYieldStatisticsInfo(@RequestParam("baseId") String baseId,
|
public CommonResult<List<YieldStatisticsRespVO>> getYieldStatisticsInfo(@RequestParam("baseId") String baseId,
|
||||||
@RequestParam("year") String year) {
|
@RequestParam("year") String year) {
|
||||||
|
// TODO: 2025/9/24 待实现
|
||||||
List<YieldStatisticsRespVO> res = new ArrayList<>();
|
List<YieldStatisticsRespVO> res = new ArrayList<>();
|
||||||
res.add(new YieldStatisticsRespVO("香菜",10000,16000));
|
res.add(new YieldStatisticsRespVO("香菜",10000,16000));
|
||||||
return success(res);
|
return success(res);
|
||||||
@@ -143,6 +151,7 @@ public class DigitalCockpitController {
|
|||||||
public CommonResult<List<ActualYieldStatisticsRespVO>> getActualYieldStatisticsInfo(@RequestParam("baseId") String baseId,
|
public CommonResult<List<ActualYieldStatisticsRespVO>> getActualYieldStatisticsInfo(@RequestParam("baseId") String baseId,
|
||||||
@RequestParam("year") String year) {
|
@RequestParam("year") String year) {
|
||||||
|
|
||||||
|
// TODO: 2025/9/24 待实现
|
||||||
List<ActualYieldStatisticsRespVO> res = new ArrayList<>();
|
List<ActualYieldStatisticsRespVO> res = new ArrayList<>();
|
||||||
res.add(new ActualYieldStatisticsRespVO("香菜",10000,10001));
|
res.add(new ActualYieldStatisticsRespVO("香菜",10000,10001));
|
||||||
return success(res);
|
return success(res);
|
||||||
@@ -152,6 +161,7 @@ public class DigitalCockpitController {
|
|||||||
@Operation(summary = "农事分布")
|
@Operation(summary = "农事分布")
|
||||||
@Parameter(name = "baseId", description = "基地ID", required = true)
|
@Parameter(name = "baseId", description = "基地ID", required = true)
|
||||||
public CommonResult<FarmRecordsRespVO> getFarmRecords(@RequestParam("baseId") String baseId) {
|
public CommonResult<FarmRecordsRespVO> getFarmRecords(@RequestParam("baseId") String baseId) {
|
||||||
|
// TODO: 2025/9/24 待实现
|
||||||
FarmRecordsRespVO res = new FarmRecordsRespVO();
|
FarmRecordsRespVO res = new FarmRecordsRespVO();
|
||||||
res.setTotalCount(0);
|
res.setTotalCount(0);
|
||||||
res.setOverdueStatusCount(0);
|
res.setOverdueStatusCount(0);
|
||||||
@@ -172,6 +182,7 @@ public class DigitalCockpitController {
|
|||||||
@Operation(summary = "设备统计")
|
@Operation(summary = "设备统计")
|
||||||
@Parameter(name = "baseId", description = "基地ID", required = true)
|
@Parameter(name = "baseId", description = "基地ID", required = true)
|
||||||
public CommonResult<DeviceInfoRespVO> getDeviceInfo(@RequestParam("baseId") String baseId) {
|
public CommonResult<DeviceInfoRespVO> getDeviceInfo(@RequestParam("baseId") String baseId) {
|
||||||
|
// TODO: 2025/9/24 待实现
|
||||||
DeviceInfoRespVO res = new DeviceInfoRespVO();
|
DeviceInfoRespVO res = new DeviceInfoRespVO();
|
||||||
res.setTotal(17);
|
res.setTotal(17);
|
||||||
res.setDeviceInfos(
|
res.setDeviceInfos(
|
||||||
@@ -190,4 +201,21 @@ public class DigitalCockpitController {
|
|||||||
return success("暂时不做");
|
return success("暂时不做");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/species/get")
|
||||||
|
@Operation(summary = "引用次数最多的模型物种信息")
|
||||||
|
@Parameter(name = "baseId", description = "基地ID", required = true)
|
||||||
|
public CommonResult<PlanSpeciesRespVO> getPlanSpeciesInfo(@RequestParam("baseId") String baseId) {
|
||||||
|
|
||||||
|
ModelManagementDO mObj = modelManagementService.getTopQuoteCount();
|
||||||
|
if (ObjectUtils.isEmpty(mObj)) {
|
||||||
|
return error(500,"还未创建模型");
|
||||||
|
}
|
||||||
|
PlanSpeciesRespVO res = new PlanSpeciesRespVO();
|
||||||
|
res.setImage(mObj.getSpeciesImage());
|
||||||
|
res.setName(mObj.getSpeciesName());
|
||||||
|
res.setCycleName(mObj.getCycleName());
|
||||||
|
res.setDesc(mObj.getDescription());
|
||||||
|
return success(res);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 计划引用最多的物种
|
||||||
|
* @author: binda
|
||||||
|
* @date: 2025/9/27 15:02
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PlanSpeciesRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "物种图片")
|
||||||
|
private String image;
|
||||||
|
@Schema(description = "物种分类名称")
|
||||||
|
private String name;
|
||||||
|
@Schema(description = "物种描述")
|
||||||
|
private String desc;
|
||||||
|
@Schema(description = "物种生命周期")
|
||||||
|
private String cycleName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class TokenCacheService {
|
public abstract class TokenCacheService {
|
||||||
|
|
||||||
|
// 水肥机: token两个小时
|
||||||
|
// 土壤: 一分钟最多采集6次数据,其他没限制
|
||||||
public final Map<String, TokenInfo> tokenCacheMap = new ConcurrentHashMap<>();
|
public final Map<String, TokenInfo> tokenCacheMap = new ConcurrentHashMap<>();
|
||||||
private final Map<String, List<DeviceInfo>> deviceCacheMap = new ConcurrentHashMap<>();
|
private final Map<String, List<DeviceInfo>> deviceCacheMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -104,4 +104,6 @@ public interface ModelManagementService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getFarmRecordCount(String speciesModelId);
|
int getFarmRecordCount(String speciesModelId);
|
||||||
|
|
||||||
|
ModelManagementDO getTopQuoteCount();
|
||||||
}
|
}
|
||||||
@@ -600,6 +600,23 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
return (int) count;
|
return (int) count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelManagementDO getTopQuoteCount() {
|
||||||
|
LambdaQueryWrapperX<ModelManagementDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
wrapperX.eq(ModelManagementDO::getTenantId, getLoginUser().getTenantId());
|
||||||
|
List<ModelManagementDO> mList = modelManagementMapper.selectList(wrapperX);
|
||||||
|
|
||||||
|
if (mList == null || mList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用Stream找到quoteCount最大的记录
|
||||||
|
Optional<ModelManagementDO> mostQuoted = mList.stream()
|
||||||
|
.max(Comparator.comparingInt(ModelManagementDO::getQuoteCount));
|
||||||
|
|
||||||
|
return mostQuoted.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
private List<ModelCycleDO> getModelCycleListByModelId(String modelId) {
|
private List<ModelCycleDO> getModelCycleListByModelId(String modelId) {
|
||||||
LambdaQueryWrapperX<ModelCycleDO> wrapperXx = new LambdaQueryWrapperX<>();
|
LambdaQueryWrapperX<ModelCycleDO> wrapperXx = new LambdaQueryWrapperX<>();
|
||||||
wrapperXx.eq(ModelCycleDO::getModelId, modelId);
|
wrapperXx.eq(ModelCycleDO::getModelId, modelId);
|
||||||
|
|||||||
Reference in New Issue
Block a user