|
|
|
|
@@ -8,6 +8,7 @@ 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;
|
|
|
|
|
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
|
|
|
|
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
|
|
|
|
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.deviceplotrelation.DevicePlotRelationService;
|
|
|
|
|
@@ -15,6 +16,7 @@ import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementServi
|
|
|
|
|
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.productionplan.ProductionPlanService;
|
|
|
|
|
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
|
|
|
|
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
|
|
|
|
import cn.iocoder.yudao.module.farm.utils.LeafletjsUtil;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
@@ -26,7 +28,6 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
|
|
|
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.*;
|
|
|
|
|
@@ -46,8 +47,9 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
private final CropFarmingCenterService cropFarmingCenterService;
|
|
|
|
|
private final PersonnelManagementService personnelManagementService;
|
|
|
|
|
private final ModelManagementService modelManagementService;
|
|
|
|
|
private final SpeciesLibraryService speciesLibraryService;
|
|
|
|
|
|
|
|
|
|
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService) {
|
|
|
|
|
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService) {
|
|
|
|
|
this.baseInfoService = baseInfoService;
|
|
|
|
|
this.plotInfoService = plotInfoService;
|
|
|
|
|
this.productionPlanService = productionPlanService;
|
|
|
|
|
@@ -55,6 +57,7 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
this.cropFarmingCenterService = cropFarmingCenterService;
|
|
|
|
|
this.personnelManagementService = personnelManagementService;
|
|
|
|
|
this.modelManagementService = modelManagementService;
|
|
|
|
|
this.speciesLibraryService = speciesLibraryService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -128,16 +131,14 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<PlotPopupFrame> getPlotPopupFrame(BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
|
|
|
|
|
private List<PlotPopupFrame> getPlotPopupFrame(String plotId, Map<String, String> employeeNameMap) {
|
|
|
|
|
List<PlotPopupFrame> targetList = new ArrayList<>();
|
|
|
|
|
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseObj.getId());
|
|
|
|
|
for (PlotInfoDO e : plotList) {
|
|
|
|
|
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
|
|
|
|
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), e.getPlotArea());
|
|
|
|
|
String beingCropName = productionPlanService.getBeingCropName(e.getPlotId());
|
|
|
|
|
PlotInfoDO e = plotInfoService.getPlotInfo(plotId);
|
|
|
|
|
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
|
|
|
|
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), e.getPlotArea());
|
|
|
|
|
String beingCropName = productionPlanService.getBeingCropName(e.getPlotId());
|
|
|
|
|
|
|
|
|
|
targetList.add(new PlotPopupFrame(beingPlotArea,employeeName,beingCropName));
|
|
|
|
|
}
|
|
|
|
|
targetList.add(new PlotPopupFrame(beingPlotArea,employeeName,beingCropName));
|
|
|
|
|
return targetList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -149,7 +150,7 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
// 地块详情 (包含计划信息)
|
|
|
|
|
PlotOrCropInfo plotOrCropInfo = this.getPlotOrCropInfoList(e,"地块详情",employeeName);
|
|
|
|
|
// 地块浮框信息
|
|
|
|
|
List<PlotPopupFrame> plotPopupFrame = this.getPlotPopupFrame(baseObj, employeeNameMap);
|
|
|
|
|
List<PlotPopupFrame> plotPopupFrame = this.getPlotPopupFrame(e.getId(), employeeNameMap);
|
|
|
|
|
|
|
|
|
|
PlotInfo t = new PlotInfo();
|
|
|
|
|
t.setBaseId(e.getBaseId());
|
|
|
|
|
@@ -200,6 +201,9 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
String beingCropName = productionPlanService.getPlantSpeciesCodeForName(e.getPlantSpeciesCode());
|
|
|
|
|
String cycleName = modelManagementService.getModelCycleName(e.getSpeciesModelId());
|
|
|
|
|
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), null);
|
|
|
|
|
// SpeciesLibraryDO speciesLibrary = speciesLibraryService.getSpeciesLibrary(e.getPlantSpeciesCode());
|
|
|
|
|
// List<String> planModelImage = speciesLibrary.getImageList();
|
|
|
|
|
List<String> planModelImage = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
PlanInfo target = new PlanInfo();
|
|
|
|
|
target.setBaseId(e.getBaseId());
|
|
|
|
|
@@ -210,7 +214,9 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
target.setPlantSpeciesName(beingCropName);
|
|
|
|
|
target.setPlanNumber(e.getPlanNumber());
|
|
|
|
|
target.setCycleName(cycleName);
|
|
|
|
|
target.setProgressBar("0/10"); // TODO: 2025/9/1
|
|
|
|
|
target.setProgressBar("1/10"); // TODO: 2025/9/1
|
|
|
|
|
target.setProgressBarNumerator(1); // TODO: 2025/9/1
|
|
|
|
|
target.setProgressBarDenominator(10); // TODO: 2025/9/1
|
|
|
|
|
target.setPredictedArea(Double.valueOf(beingPlotArea));
|
|
|
|
|
target.setPredictedYields(e.getPredictedYields());
|
|
|
|
|
target.setPlanStatus(e.getPlanStatus());
|
|
|
|
|
@@ -219,6 +225,7 @@ public class HomeServiceImpl implements HomeService {
|
|
|
|
|
target.setPlanSubStatusName(PLAN_MAP.getOrDefault(e.getPlanSubStatus(), "逾期未开始"));
|
|
|
|
|
String pointsInPolygon = LeafletjsUtil.generateRandomPointsInPolygon(plotObj.getPoint());
|
|
|
|
|
target.setPlanModelPoint(pointsInPolygon);
|
|
|
|
|
target.setPlanModelImage(planModelImage);
|
|
|
|
|
targetList.add(target);
|
|
|
|
|
}
|
|
|
|
|
return targetList;
|
|
|
|
|
|