Merge remote-tracking branch 'origin/main'
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;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
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.framework.common.util.date.DateUtils.*;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||||
@@ -237,4 +238,17 @@ public class CropFarmingCenterController {
|
|||||||
return success(res);
|
return success(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* === === 微信端 === ===
|
||||||
|
*/
|
||||||
|
@GetMapping("/production-plan/wx/page")
|
||||||
|
@Operation(summary = "生产计划-分页(微信端)")
|
||||||
|
public CommonResult<PageResult<ProductionPlanResp2VO>> getProductionPlanPageForWx(@Valid ProductionPlanPage2ReqVO pageReqVO) {
|
||||||
|
PageResult<ProductionPlanResp2VO> page = cropFarmingCenterService.getProductionPlanPage2(pageReqVO);
|
||||||
|
List<ProductionPlanResp2VO> list = page.getList();
|
||||||
|
List<ProductionPlanResp2VO> resetList = list.stream().filter(vo -> !"project".equals(vo.getType())).collect(Collectors.toList());
|
||||||
|
long size = resetList.size();
|
||||||
|
return success(new PageResult<ProductionPlanResp2VO>(resetList,size));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.plotinfo;
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.wx.RegularPlotInfoRespVO;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -101,4 +100,13 @@ public class PlotInfoController {
|
|||||||
BeanUtils.toBean(list, PlotInfoRespVO.class));
|
BeanUtils.toBean(list, PlotInfoRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* === === 微信端 === ===
|
||||||
|
*/
|
||||||
|
@GetMapping("/wx/plot-device/list")
|
||||||
|
@Operation(summary = "微信端-常用地块集合")
|
||||||
|
public CommonResult<List<RegularPlotInfoRespVO>> getRegularPlotInfoList() {
|
||||||
|
return success(plotInfoService.getRegularPlotInfoList());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.wx;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 微信端 常用地块集合
|
||||||
|
* @author: binda
|
||||||
|
* @date: 2025/9/14 14:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class RegularPlotInfoRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "地块ID")
|
||||||
|
private String plotId;
|
||||||
|
@Schema(description = "地块名称")
|
||||||
|
private String plotName;
|
||||||
|
@Schema(description = "在线设备数量")
|
||||||
|
private Integer onlineDeviceCount;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.service.plotinfo;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.wx.RegularPlotInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -93,4 +94,10 @@ public interface PlotInfoService {
|
|||||||
boolean validatePlotExistByBaseId(String id);
|
boolean validatePlotExistByBaseId(String id);
|
||||||
|
|
||||||
boolean validateTotalPlotArea(String baseId, BigDecimal baseArea);
|
boolean validateTotalPlotArea(String baseId, BigDecimal baseArea);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信端 - 获取常用地块集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RegularPlotInfoRespVO> getRegularPlotInfoList();
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.PlotInfoSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.plotinfo.vo.wx.RegularPlotInfoRespVO;
|
||||||
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.mysql.baseinfo.BaseInfoMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
||||||
@@ -191,4 +192,13 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RegularPlotInfoRespVO> getRegularPlotInfoList() {
|
||||||
|
List<PlotInfoDO> plotInfoDOS = plotInfoMapper.selectList();
|
||||||
|
return plotInfoDOS.stream().map(e -> {
|
||||||
|
int onlineDeviceCount = 0; // TODO: 2025/9/14 设备还未接入
|
||||||
|
return new RegularPlotInfoRespVO(e.getPlotId(), e.getPlotName(), onlineDeviceCount);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -67,6 +67,7 @@ flowable:
|
|||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||||
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
global-config:
|
global-config:
|
||||||
db-config:
|
db-config:
|
||||||
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
||||||
@@ -282,6 +283,7 @@ yudao:
|
|||||||
- /admin-api/system/auth/get-phone-number
|
- /admin-api/system/auth/get-phone-number
|
||||||
- /admin-api/system/auth/api/user-add
|
- /admin-api/system/auth/api/user-add
|
||||||
- /admin-api/system/auth/api/user-info
|
- /admin-api/system/auth/api/user-info
|
||||||
|
- /admin-api/farm/remote
|
||||||
ignore-visit-urls:
|
ignore-visit-urls:
|
||||||
- /admin-api/system/user/profile/**
|
- /admin-api/system/user/profile/**
|
||||||
- /admin-api/system/auth/**
|
- /admin-api/system/auth/**
|
||||||
|
|||||||
Reference in New Issue
Block a user