fix (farm): 首页,生产计划
- 任务进度条 - 模型管理, 分页显示字段筛选
This commit is contained in:
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
|||||||
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.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -25,6 +26,7 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/farm/remote")
|
@RequestMapping("/farm/remote")
|
||||||
@Validated
|
@Validated
|
||||||
|
@PermitAll
|
||||||
public class ApiController {
|
public class ApiController {
|
||||||
|
|
||||||
private final ProductionPlanService productionPlanService;
|
private final ProductionPlanService productionPlanService;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class HomeInfo {
|
|||||||
private Double growArea;
|
private Double growArea;
|
||||||
@Schema(description = "在种作物数量")
|
@Schema(description = "在种作物数量")
|
||||||
private Integer beingCrop;
|
private Integer beingCrop;
|
||||||
@Schema(description = "农事任务数量")
|
@Schema(description = "生产计划任务数量")
|
||||||
private Integer taskCount;
|
private Integer taskCount;
|
||||||
@Schema(description = "物联设备数量")
|
@Schema(description = "物联设备数量")
|
||||||
private Integer lotCount;
|
private Integer lotCount;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.framework.util;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelmanagement.ModelManagementDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.modelmanagement.ModelManagementDO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ public class ModelManagementConvertUtil {
|
|||||||
respVO.setId(modelManagementDO.getId());
|
respVO.setId(modelManagementDO.getId());
|
||||||
respVO.setModelName(modelManagementDO.getModelName());
|
respVO.setModelName(modelManagementDO.getModelName());
|
||||||
respVO.setSpeciesId(modelManagementDO.getSpeciesId());
|
respVO.setSpeciesId(modelManagementDO.getSpeciesId());
|
||||||
respVO.setSpeciesName(modelManagementDO.getSpeciesName());
|
respVO.setSpeciesName(StringUtils.substringAfterLast(modelManagementDO.getSpeciesName(), "/"));
|
||||||
respVO.setCycle(modelManagementDO.getCycle());
|
respVO.setCycle(modelManagementDO.getCycle());
|
||||||
respVO.setCycleName(LIFE_CYCLE_MAP.get(modelManagementDO.getCycle()));
|
respVO.setCycleName(LIFE_CYCLE_MAP.get(modelManagementDO.getCycle()));
|
||||||
respVO.setHarvest(modelManagementDO.getHarvest());
|
respVO.setHarvest(modelManagementDO.getHarvest());
|
||||||
|
|||||||
@@ -361,16 +361,21 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
public ProductionPlanResp2VO.ModelInfo getModelManagement(ProductionPlanDO planObj, Map<String, String> employeeNameMap) {
|
public ProductionPlanResp2VO.ModelInfo getModelManagement(ProductionPlanDO planObj, Map<String, String> employeeNameMap) {
|
||||||
|
|
||||||
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", planObj.getBaseId());
|
BaseInfoDO baseObj = baseInfoMapper.selectOne("id", planObj.getBaseId());
|
||||||
if (baseObj != null) {
|
if (baseObj == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String employeeId = baseObj.getManager();
|
String employeeId = baseObj.getManager();
|
||||||
ModelManagementDO modelManagementDo = modelManagementService.getModelManagement("id", planObj.getSpeciesModelId());
|
ModelManagementDO modelManagementDo = modelManagementService.getModelManagement("id", planObj.getSpeciesModelId());
|
||||||
String managementCycleName = modelManagementService.getModelCycleName(planObj.getSpeciesModelId());
|
String managementCycleName = modelManagementService.getModelCycleName(planObj.getSpeciesModelId());
|
||||||
|
|
||||||
// 农事记录进度
|
// 农事记录进度
|
||||||
int progressNumerator = 1; // 生产计划 - 农事记录 条数
|
// 任务进度 - 分子 (添加到: 种植中心-农事记录里的记录数)
|
||||||
int progressDenominator = 1; // 农事记录总数 (引用模型 - 农事记录)
|
int progressNumerator = farmingRecordService.getFarmRecordCount(planObj.getId());
|
||||||
String progressRatio = ""; // 百分比
|
// 任务进度 - 分母 (引用模型中的所有模型周期的农事记录总和)
|
||||||
String progressBar = "1/100"; // 进度条
|
int progressDenominator = modelManagementService.getFarmRecordCount(planObj.getSpeciesModelId());
|
||||||
|
String progressBar = progressNumerator + "/" + progressDenominator; // 进度条
|
||||||
|
String progressRatio = (int) Math.round((double) progressNumerator / progressDenominator * 100) + "%";
|
||||||
|
|
||||||
ProductionPlanResp2VO.ModelInfo modelInfo = new ProductionPlanResp2VO.ModelInfo();
|
ProductionPlanResp2VO.ModelInfo modelInfo = new ProductionPlanResp2VO.ModelInfo();
|
||||||
modelInfo.setId(modelManagementDo.getId());
|
modelInfo.setId(modelManagementDo.getId());
|
||||||
@@ -392,9 +397,6 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
modelInfo.setBaseName(planObj.getBaseName());
|
modelInfo.setBaseName(planObj.getBaseName());
|
||||||
modelInfo.setBaseManager(employeeNameMap.get(employeeId)); // 分割,
|
modelInfo.setBaseManager(employeeNameMap.get(employeeId)); // 分割,
|
||||||
return modelInfo;
|
return modelInfo;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,4 +75,11 @@ public interface FarmingRecordService {
|
|||||||
void createFarmingRecordList(List<FarmingRecordSaveReqVO> farmingRecordSaveReqVOList);
|
void createFarmingRecordList(List<FarmingRecordSaveReqVO> farmingRecordSaveReqVOList);
|
||||||
|
|
||||||
int getFarmRecordOverview(String baseId);
|
int getFarmRecordOverview(String baseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取农事记录数量
|
||||||
|
* @param planId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getFarmRecordCount(String planId);
|
||||||
}
|
}
|
||||||
@@ -246,4 +246,12 @@ public class FarmingRecordServiceImpl implements FarmingRecordService {
|
|||||||
return count.intValue();
|
return count.intValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFarmRecordCount(String planId) {
|
||||||
|
LambdaQueryWrapperX<FarmingRecordDO> x = new LambdaQueryWrapperX<>();
|
||||||
|
x.eq(FarmingRecordDO::getProductionPlanId, planId);
|
||||||
|
Long count = farmingRecordMapper.selectCount(x);
|
||||||
|
return count.intValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface HomeService {
|
public interface HomeService {
|
||||||
|
|
||||||
|
|
||||||
List<HomeInfo> getHomeInfoList(String baseId);
|
List<HomeInfo> getHomeInfoList(String baseId);
|
||||||
/**
|
/**
|
||||||
* 首页综合信息
|
* 首页综合信息
|
||||||
@@ -23,14 +22,6 @@ public interface HomeService {
|
|||||||
*/
|
*/
|
||||||
HomeInfo getHomeInfo(String baseId);
|
HomeInfo getHomeInfo(String baseId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 首页概要信息
|
|
||||||
* @param baseId 基地ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
OutlinedInfoVO getOutlinedInfo(String baseId);
|
|
||||||
|
|
||||||
List<BaseNameVO> getBaseNameList();
|
List<BaseNameVO> getBaseNameList();
|
||||||
|
|
||||||
Map<String, Object> getCompanyBaseFarming();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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.BaseNameVO;
|
||||||
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.HomeInfo.*;
|
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.dal.dataobject.baseinfo.BaseInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||||
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.dal.dataobject.productionplan.ProductionPlanDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||||
@@ -12,6 +11,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibrary
|
|||||||
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.cropFarmingCenter.CropFarmingCenterService;
|
import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterService;
|
||||||
import cn.iocoder.yudao.module.farm.service.deviceplotrelation.DevicePlotRelationService;
|
import cn.iocoder.yudao.module.farm.service.deviceplotrelation.DevicePlotRelationService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
||||||
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
||||||
@@ -24,7 +24,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -48,8 +47,9 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
private final PersonnelManagementService personnelManagementService;
|
private final PersonnelManagementService personnelManagementService;
|
||||||
private final ModelManagementService modelManagementService;
|
private final ModelManagementService modelManagementService;
|
||||||
private final SpeciesLibraryService speciesLibraryService;
|
private final SpeciesLibraryService speciesLibraryService;
|
||||||
|
private final FarmingRecordService farmingRecordService;
|
||||||
|
|
||||||
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService) {
|
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService, FarmingRecordService farmingRecordService) {
|
||||||
this.baseInfoService = baseInfoService;
|
this.baseInfoService = baseInfoService;
|
||||||
this.plotInfoService = plotInfoService;
|
this.plotInfoService = plotInfoService;
|
||||||
this.productionPlanService = productionPlanService;
|
this.productionPlanService = productionPlanService;
|
||||||
@@ -58,6 +58,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
this.personnelManagementService = personnelManagementService;
|
this.personnelManagementService = personnelManagementService;
|
||||||
this.modelManagementService = modelManagementService;
|
this.modelManagementService = modelManagementService;
|
||||||
this.speciesLibraryService = speciesLibraryService;
|
this.speciesLibraryService = speciesLibraryService;
|
||||||
|
this.farmingRecordService = farmingRecordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,7 +124,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
res.setBaseArea(BigDecimalUtil.roundedViaMath(baseObj.getArea()));
|
res.setBaseArea(BigDecimalUtil.roundedViaMath(baseObj.getArea()));
|
||||||
res.setManager(employeeName);
|
res.setManager(employeeName);
|
||||||
res.setPoint(baseObj.getPoint());
|
res.setPoint(baseObj.getPoint());
|
||||||
res.setPointName(""); // TODO: 2025/8/31 需要前端传入,才能获取
|
res.setPointName(""); // TODO: 2025/8/31 需要前端传入,才能获取 行政区划
|
||||||
res.setBeingPlot(plotRatio);
|
res.setBeingPlot(plotRatio);
|
||||||
res.setBeingCrop(growingCropCount);
|
res.setBeingCrop(growingCropCount);
|
||||||
return res;
|
return res;
|
||||||
@@ -171,8 +172,11 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
if (ObjectUtils.isEmpty(predictedArea)) {
|
if (ObjectUtils.isEmpty(predictedArea)) {
|
||||||
predictedArea = 0.00;
|
predictedArea = 0.00;
|
||||||
}
|
}
|
||||||
String growFlag = ObjectUtils.isEmpty(predictedArea) ? GROW_FLAG_2 : GROW_FLAG_1;
|
String growFlag = predictedArea == 0.0 ? GROW_FLAG_2 : GROW_FLAG_1;
|
||||||
|
// 在种作物数量
|
||||||
int growingCropCount = productionPlanService.getGrowingCropCount(e.getBaseId(), e.getPlotId());
|
int growingCropCount = productionPlanService.getGrowingCropCount(e.getBaseId(), e.getPlotId());
|
||||||
|
// 生产计划数量
|
||||||
|
int taskCount = productionPlanService.getPlanCount(e.getPlotId());
|
||||||
|
|
||||||
PlotOrCropInfo t = new PlotOrCropInfo();
|
PlotOrCropInfo t = new PlotOrCropInfo();
|
||||||
t.setLabel(label);
|
t.setLabel(label);
|
||||||
@@ -183,7 +187,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
t.setGrowFlag(growFlag);
|
t.setGrowFlag(growFlag);
|
||||||
t.setGrowArea(predictedArea);
|
t.setGrowArea(predictedArea);
|
||||||
t.setBeingCrop(growingCropCount);
|
t.setBeingCrop(growingCropCount);
|
||||||
t.setTaskCount(0); // TODO: 2025/8/31 农事任务数量
|
t.setTaskCount(taskCount);
|
||||||
t.setLotCount(0); // TODO: 2025/8/31 物联设备数量
|
t.setLotCount(0); // TODO: 2025/8/31 物联设备数量
|
||||||
t.setManager(employeeName);
|
t.setManager(employeeName);
|
||||||
t.setQrCodeUrl(""); // TODO: 2025/8/31 暂无
|
t.setQrCodeUrl(""); // TODO: 2025/8/31 暂无
|
||||||
@@ -204,6 +208,12 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null);
|
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null);
|
||||||
// 模型管理-管理周期名称
|
// 模型管理-管理周期名称
|
||||||
String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId());
|
String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId());
|
||||||
|
// 任务进度 - 分子 (添加到: 种植中心-农事记录里的记录数)
|
||||||
|
int progressBarNumerator = farmingRecordService.getFarmRecordCount(e.getId());
|
||||||
|
// 任务进度 - 分母 (引用模型中的所有模型周期的农事记录总和)
|
||||||
|
int progressBarDenominator = modelManagementService.getFarmRecordCount(e.getSpeciesModelId());
|
||||||
|
// 任务进度
|
||||||
|
String progressBar = progressBarNumerator +"/"+progressBarDenominator;
|
||||||
|
|
||||||
PlanInfo target = new PlanInfo();
|
PlanInfo target = new PlanInfo();
|
||||||
target.setBaseId(e.getBaseId());
|
target.setBaseId(e.getBaseId());
|
||||||
@@ -214,9 +224,9 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
target.setPlantSpeciesName(beingCropName);
|
target.setPlantSpeciesName(beingCropName);
|
||||||
target.setPlanNumber(e.getPlanNumber());
|
target.setPlanNumber(e.getPlanNumber());
|
||||||
target.setCycleName(cycleName);
|
target.setCycleName(cycleName);
|
||||||
target.setProgressBar("1/10"); // TODO: 2025/9/1
|
target.setProgressBar(progressBar);
|
||||||
target.setProgressBarNumerator(1); // TODO: 2025/9/1
|
target.setProgressBarNumerator(progressBarNumerator);
|
||||||
target.setProgressBarDenominator(10); // TODO: 2025/9/1
|
target.setProgressBarDenominator(progressBarDenominator);
|
||||||
target.setPredictedArea(Double.valueOf(beingPlotArea));
|
target.setPredictedArea(Double.valueOf(beingPlotArea));
|
||||||
target.setPredictedYields(e.getPredictedYields());
|
target.setPredictedYields(e.getPredictedYields());
|
||||||
target.setPlanStatus(e.getPlanStatus());
|
target.setPlanStatus(e.getPlanStatus());
|
||||||
@@ -231,37 +241,12 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
return targetList;
|
return targetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OutlinedInfoVO getOutlinedInfo(String baseId) {
|
|
||||||
OutlinedInfoVO res = new OutlinedInfoVO();
|
|
||||||
res.setTaskCount(0); // todo 任务数量
|
|
||||||
res.setWarningCount(0); // todo 告警数量
|
|
||||||
res.setIotCount(0); // todo 物联设备
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseNameVO> getBaseNameList() {
|
public List<BaseNameVO> getBaseNameList() {
|
||||||
List<BaseInfoDO> baseNameList = baseInfoService.getBaseInfos();
|
List<BaseInfoDO> baseNameList = baseInfoService.getBaseInfos();
|
||||||
return baseNameList.stream().map(e -> new BaseNameVO(e.getId(), e.getName())).collect(Collectors.toList());
|
return baseNameList.stream().map(e -> new BaseNameVO(e.getId(), e.getName())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getCompanyBaseFarming() {
|
|
||||||
LoginUser user = getLoginUser();
|
|
||||||
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
|
|
||||||
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量
|
|
||||||
Double totalArea = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积
|
|
||||||
int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
|
|
||||||
map.put("baseCount", baseCount);
|
|
||||||
map.put("cropCount", cropCount);
|
|
||||||
map.put("totalArea", totalArea);
|
|
||||||
map.put("personnelCount", personnelCount);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BaseOverviewInfo getCompanyInfo() {
|
private BaseOverviewInfo getCompanyInfo() {
|
||||||
LoginUser user = getLoginUser();
|
LoginUser user = getLoginUser();
|
||||||
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
|
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
|
||||||
|
|||||||
@@ -97,4 +97,11 @@ public interface ModelManagementService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ModelManagementForPlanRespVO> getModelManagementForPlan(String speciesId);
|
List<ModelManagementForPlanRespVO> getModelManagementForPlan(String speciesId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过引用模型ID 获取所有管理周期下的农事记录总和
|
||||||
|
* @param speciesModelId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getFarmRecordCount(String speciesModelId);
|
||||||
}
|
}
|
||||||
@@ -587,6 +587,20 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFarmRecordCount(String speciesModelId) {
|
||||||
|
LambdaQueryWrapperX<ModelCycleDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
wrapperX.eq(ModelCycleDO::getModelId, speciesModelId);
|
||||||
|
wrapperX.eq(ModelCycleDO::getTenantId, getLoginUser().getTenantId());
|
||||||
|
List<ModelCycleDO> cycleDOS = modelCycleMapper.selectList(wrapperX);
|
||||||
|
long count = 0;
|
||||||
|
for (ModelCycleDO cycleDO : cycleDOS) {
|
||||||
|
Long operationCount = modelFarmingOperationMapper.selectCount("cycle_id", cycleDO.getId());
|
||||||
|
count += operationCount;
|
||||||
|
}
|
||||||
|
return (int) count;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -210,4 +210,11 @@ public interface ProductionPlanService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(FarmingDistributionReqVO req);
|
CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(FarmingDistributionReqVO req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用地块ID 获取该地块的计划数量
|
||||||
|
* @param plotId
|
||||||
|
* @return 获取该地块的计划数量
|
||||||
|
*/
|
||||||
|
int getPlanCount(String plotId);
|
||||||
}
|
}
|
||||||
@@ -412,4 +412,10 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||||||
public CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(FarmingDistributionReqVO req) {
|
public CommonResult<List<FarmingDistributionRespVO>> getFarmingDistributionChart(FarmingDistributionReqVO req) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlanCount(String plotId) {
|
||||||
|
List<ProductionPlanDO> planDOList = productionPlanMapper.selectList("plot_id", plotId);
|
||||||
|
return planDOList.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user