fix (farm): 地块
- 地块数量多导致加载数据缓慢问题
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.farm.controller.admin.home;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
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.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.PlotListRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.service.home.HomeService;
|
import cn.iocoder.yudao.module.farm.service.home.HomeService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.WeatherUtil;
|
import cn.iocoder.yudao.module.farm.utils.WeatherUtil;
|
||||||
@@ -14,7 +15,6 @@ import jakarta.annotation.security.PermitAll;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
@@ -49,7 +49,14 @@ public class HomeController {
|
|||||||
return success(homeService.getHomeInfo(baseId));
|
return success(homeService.getHomeInfo(baseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "农场首页-地块详情")
|
@Operation(summary = "农场首页-地块详情-集合")
|
||||||
|
@GetMapping("/plot/list")
|
||||||
|
@Parameter(name = "baseId", description = "基地ID")
|
||||||
|
public CommonResult<List<PlotListRespVO>> listPlotInfo(@RequestParam("baseId") String baseId) {
|
||||||
|
return success(homeService.listPlotInfo(baseId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "农场首页-地块详情") // 在用
|
||||||
@GetMapping("/plot/get")
|
@GetMapping("/plot/get")
|
||||||
@Parameter(name = "plotId", description = "地块ID")
|
@Parameter(name = "plotId", description = "地块ID")
|
||||||
public CommonResult<HomeInfo.PlotInfo> getPlotInfo(@RequestParam("plotId") String plotId) {
|
public CommonResult<HomeInfo.PlotInfo> getPlotInfo(@RequestParam("plotId") String plotId) {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: TODO
|
||||||
|
* @author: binda
|
||||||
|
* @date: 2025/11/17 20:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PlotListRespVO {
|
||||||
|
@Schema(description = "基地名称")
|
||||||
|
private String baseName;
|
||||||
|
@Schema(description = "地块ID")
|
||||||
|
private String plotId;
|
||||||
|
@Schema(description = "地块名称")
|
||||||
|
private String plotName;
|
||||||
|
@Schema(description = "地块面积")
|
||||||
|
private BigDecimal plotArea;
|
||||||
|
@Schema(description = "基地坐标")
|
||||||
|
private String point;
|
||||||
|
@Schema(description = "基地颜色")
|
||||||
|
private String plotColor;
|
||||||
|
|
||||||
|
@Schema(description = "基地负责人")
|
||||||
|
private String manager;
|
||||||
|
@Schema(description = "在种面积")
|
||||||
|
private String beingBaseArea;
|
||||||
|
@Schema(description = "在种作物-名称")
|
||||||
|
private String beingCropName;
|
||||||
|
}
|
||||||
@@ -3,10 +3,13 @@ package cn.iocoder.yudao.module.farm.dal.mysql.plotinfo;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.PlotListRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.PlotInfoPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.PlotInfoPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地块 Mapper
|
* 地块 Mapper
|
||||||
*
|
*
|
||||||
@@ -28,4 +31,5 @@ public interface PlotInfoMapper extends BaseMapperX<PlotInfoDO> {
|
|||||||
.orderByDesc(PlotInfoDO::getCreateTime));
|
.orderByDesc(PlotInfoDO::getCreateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<PlotListRespVO> listPlotInfo(String baseId);
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,10 @@ 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.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.PlotListRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 首页接口
|
* @description: 首页接口
|
||||||
@@ -33,4 +33,6 @@ public interface HomeService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QrDetailsRespVO scanQrCodes(String baseId,String tenantId);
|
QrDetailsRespVO scanQrCodes(String baseId,String tenantId);
|
||||||
|
|
||||||
|
List<PlotListRespVO> listPlotInfo(String baseId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.DeviceMon
|
|||||||
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.PlotListRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.PlotLesseeDetailsRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.PlotLesseeDetailsRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||||
@@ -30,6 +31,7 @@ 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.Collections;
|
||||||
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;
|
||||||
@@ -115,12 +117,81 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
return new HomeInfo(null, null,baseList);
|
return new HomeInfo(null, null,baseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlotInfo getPlotInfo(String plotId) {
|
||||||
|
// 员工集合 <id,name>
|
||||||
|
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||||
|
|
||||||
|
PlotInfoDO pObj = plotInfoService.getPlotInfo(plotId);
|
||||||
|
BaseInfoDO bOjb = baseInfoService.getBaseInfo(pObj.getBaseId());
|
||||||
|
|
||||||
|
return this.getPlotInfo(pObj,bOjb,employeeNameMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BaseNameVO> getBaseNameList() {
|
||||||
|
List<BaseInfoDO> baseNameList = baseInfoService.getBaseInfos();
|
||||||
|
if (ObjectUtils.isEmpty(baseNameList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return baseNameList.stream().map(e -> new BaseNameVO(e.getId(), e.getName())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QrDetailsRespVO scanQrCodes(String baseId,String tenantId) {
|
||||||
|
BaseInfoDO bObj = baseInfoService.getBaseInfo(baseId);
|
||||||
|
if (ObjectUtils.isEmpty(bObj)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<QrDetailsRespVO.PlotInfo> plotList = new ArrayList<>();
|
||||||
|
List<PlotInfoDO> plotInfos = plotInfoService.getPlotInfos(baseId);
|
||||||
|
for (PlotInfoDO p : plotInfos) {
|
||||||
|
List<PlotLesseeDetailsRespVO> ls = this.getLs(p.getId());
|
||||||
|
List<DeviceMonitorDataRespVO> ds = this.getDs(p.getId(),tenantId);
|
||||||
|
|
||||||
|
QrDetailsRespVO.PlotInfo targetP = new QrDetailsRespVO.PlotInfo();
|
||||||
|
targetP.setPlotName(p.getPlotName());
|
||||||
|
targetP.setPlotManagerName(p.getEmployeeName());
|
||||||
|
targetP.setPlotArea(p.getPlotArea().intValue());
|
||||||
|
targetP.setDeviceInfos(ds);
|
||||||
|
targetP.setLesseeInfos(ls);
|
||||||
|
plotList.add(targetP);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QrDetailsRespVO res = new QrDetailsRespVO();
|
||||||
|
res.setBaseName(bObj.getName());
|
||||||
|
res.setBaseManagerName(bObj.getManagerName());
|
||||||
|
res.setBaseArea(bObj.getArea().intValue());
|
||||||
|
res.setPlotCount(plotList.size());
|
||||||
|
res.setPlotInfo(plotList);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlotListRespVO> listPlotInfo(String baseId) {
|
||||||
|
return plotInfoService.listPlotInfo(baseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PlotInfo> getPlotInfoList(BaseInfoDO baseObj) {
|
||||||
|
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseObj.getId(), baseObj.getName());
|
||||||
|
List<PlotInfo> targetList = BeanUtils.toBean(plotList, PlotInfo.class);
|
||||||
|
targetList.forEach(e -> {
|
||||||
|
List<PlotPopupFrame> plotPopupFrame = this.getPlotPopupFrame(e.getPlotId(), e.getManager());
|
||||||
|
e.setPlotPopupFrames(plotPopupFrame.get(0));
|
||||||
|
});
|
||||||
|
|
||||||
|
return targetList;
|
||||||
|
}
|
||||||
|
|
||||||
private BaseInfo getBaseInfo(BaseInfoDO baseObj) {
|
private BaseInfo getBaseInfo(BaseInfoDO baseObj) {
|
||||||
String baseId = baseObj.getId();
|
String baseId = baseObj.getId();
|
||||||
String baseName = baseObj.getName();
|
String baseName = baseObj.getName();
|
||||||
String point = baseObj.getPoint();
|
String point = baseObj.getPoint();
|
||||||
List<PlotInfo> plotInfos = this.getPlotInfoList(baseObj);
|
// List<PlotInfo> plotInfos = this.getPlotInfoList(baseObj);
|
||||||
return new BaseInfo(baseId,baseName,point,plotInfos);
|
List<PlotInfo> plotInfos = Collections.EMPTY_LIST;
|
||||||
|
return new BaseInfo(baseId, baseName, point, plotInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private StatisticalInfo getStatisticalInfo(String baseId) {
|
private StatisticalInfo getStatisticalInfo(String baseId) {
|
||||||
@@ -129,7 +200,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer taskCount = productionPlanService.getTodayTaskCount(baseId);
|
Integer taskCount = productionPlanService.getTodayTaskCount(baseId);
|
||||||
Integer warningCount = 0; // TODO: 2025/9/1 告警数量
|
Integer warningCount = 0; // TODO: 2025/9/1 告警数量
|
||||||
Integer iotCount = deviceService.countDevice(baseId, getLoginUser().getTenantId().toString());
|
Integer iotCount = deviceService.countDevice(baseId, getLoginUser().getTenantId().toString());
|
||||||
return new StatisticalInfo(taskCount,warningCount,iotCount);
|
return new StatisticalInfo(taskCount,warningCount,iotCount);
|
||||||
}
|
}
|
||||||
@@ -179,17 +250,31 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
return targetList;
|
return targetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private List<PlotLesseeDetailsRespVO> getLs(String plotId) {
|
||||||
public PlotInfo getPlotInfo(String plotId) {
|
return plotLesseeService.getPlotLesseeHistoryList(plotId);
|
||||||
// 员工集合 <id,name>
|
|
||||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
|
||||||
|
|
||||||
PlotInfoDO pObj = plotInfoService.getPlotInfo(plotId);
|
|
||||||
BaseInfoDO bOjb = baseInfoService.getBaseInfo(pObj.getBaseId());
|
|
||||||
|
|
||||||
return this.getPlotInfo(pObj,bOjb,employeeNameMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<DeviceMonitorDataRespVO> getDs(String plotId,String tenantId) {
|
||||||
|
return deviceService.deviceList(plotId,tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseOverviewInfo getCompanyInfo() {
|
||||||
|
LoginUser user = getLoginUser();
|
||||||
|
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
|
||||||
|
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量
|
||||||
|
// Double temp = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积
|
||||||
|
Double temp = baseInfoService.getBaseTotalArea(user.getTenantId().toString()); // 总面积
|
||||||
|
int totalArea = 0;
|
||||||
|
if (!ObjectUtils.isEmpty(temp)) {
|
||||||
|
totalArea = (int) Math.round(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员
|
||||||
|
return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private PlotInfo getPlotInfo(PlotInfoDO e, BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
|
private PlotInfo getPlotInfo(PlotInfoDO e, BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
|
||||||
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
||||||
// 地块详情 (包含计划信息)
|
// 地块详情 (包含计划信息)
|
||||||
@@ -214,18 +299,6 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PlotInfo> getPlotInfoList(BaseInfoDO baseObj) {
|
|
||||||
|
|
||||||
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseObj.getId(), baseObj.getName());
|
|
||||||
List<PlotInfo> targetList = BeanUtils.toBean(plotList, PlotInfo.class);
|
|
||||||
targetList.forEach(e -> {
|
|
||||||
List<PlotPopupFrame> plotPopupFrame = this.getPlotPopupFrame(e.getPlotId(), e.getManager());
|
|
||||||
e.setPlotPopupFrames(plotPopupFrame.get(0));
|
|
||||||
});
|
|
||||||
|
|
||||||
return targetList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PlotOrCropInfo getPlotOrCropInfoList(PlotInfoDO e, String label, String employeeName) {
|
private PlotOrCropInfo getPlotOrCropInfoList(PlotInfoDO e, String label, String employeeName) {
|
||||||
Double predictedArea = productionPlanService.getBeingPlotArea(e.getPlotId());
|
Double predictedArea = productionPlanService.getBeingPlotArea(e.getPlotId());
|
||||||
if (ObjectUtils.isEmpty(predictedArea)) {
|
if (ObjectUtils.isEmpty(predictedArea)) {
|
||||||
@@ -324,69 +397,4 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
}
|
}
|
||||||
return targetList;
|
return targetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BaseNameVO> getBaseNameList() {
|
|
||||||
List<BaseInfoDO> baseNameList = baseInfoService.getBaseInfos();
|
|
||||||
if (ObjectUtils.isEmpty(baseNameList)) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
return baseNameList.stream().map(e -> new BaseNameVO(e.getId(), e.getName())).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QrDetailsRespVO scanQrCodes(String baseId,String tenantId) {
|
|
||||||
BaseInfoDO bObj = baseInfoService.getBaseInfo(baseId);
|
|
||||||
if (ObjectUtils.isEmpty(bObj)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<QrDetailsRespVO.PlotInfo> plotList = new ArrayList<>();
|
|
||||||
List<PlotInfoDO> plotInfos = plotInfoService.getPlotInfos(baseId);
|
|
||||||
for (PlotInfoDO p : plotInfos) {
|
|
||||||
List<PlotLesseeDetailsRespVO> ls = this.getLs(p.getId());
|
|
||||||
List<DeviceMonitorDataRespVO> ds = this.getDs(p.getId(),tenantId);
|
|
||||||
|
|
||||||
QrDetailsRespVO.PlotInfo targetP = new QrDetailsRespVO.PlotInfo();
|
|
||||||
targetP.setPlotName(p.getPlotName());
|
|
||||||
targetP.setPlotManagerName(p.getEmployeeName());
|
|
||||||
targetP.setPlotArea(p.getPlotArea().intValue());
|
|
||||||
targetP.setDeviceInfos(ds);
|
|
||||||
targetP.setLesseeInfos(ls);
|
|
||||||
plotList.add(targetP);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QrDetailsRespVO res = new QrDetailsRespVO();
|
|
||||||
res.setBaseName(bObj.getName());
|
|
||||||
res.setBaseManagerName(bObj.getManagerName());
|
|
||||||
res.setBaseArea(bObj.getArea().intValue());
|
|
||||||
res.setPlotCount(plotList.size());
|
|
||||||
res.setPlotInfo(plotList);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<PlotLesseeDetailsRespVO> getLs(String plotId) {
|
|
||||||
return plotLesseeService.getPlotLesseeHistoryList(plotId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DeviceMonitorDataRespVO> getDs(String plotId,String tenantId) {
|
|
||||||
return deviceService.deviceList(plotId,tenantId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BaseOverviewInfo getCompanyInfo() {
|
|
||||||
LoginUser user = getLoginUser();
|
|
||||||
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
|
|
||||||
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量
|
|
||||||
// Double temp = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积
|
|
||||||
Double temp = baseInfoService.getBaseTotalArea(user.getTenantId().toString()); // 总面积
|
|
||||||
int totalArea = 0;
|
|
||||||
if (!ObjectUtils.isEmpty(temp)) {
|
|
||||||
totalArea = (int) Math.round(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员
|
|
||||||
return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.plotinfo;
|
package cn.iocoder.yudao.module.farm.service.plotinfo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.PlotListRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.RegularPlotInfoRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.RegularPlotInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||||
@@ -110,4 +111,10 @@ public interface PlotInfoService {
|
|||||||
|
|
||||||
Long countPlotByTenantId(String tenantId);
|
Long countPlotByTenantId(String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取在种地块集合
|
||||||
|
* @param baseId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PlotListRespVO> listPlotInfo(String baseId);
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
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.home.vo.PlotListRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.RegularPlotInfoRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.RegularPlotInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||||
@@ -303,6 +304,13 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
return plotInfoMapper.selectCount(wrapperX);
|
return plotInfoMapper.selectCount(wrapperX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlotListRespVO> listPlotInfo(String baseId) {
|
||||||
|
List<PlotListRespVO> pList = plotInfoMapper.listPlotInfo(baseId);
|
||||||
|
|
||||||
|
return pList;
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 私有方法 ====================
|
// ==================== 私有方法 ====================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,4 +9,34 @@
|
|||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<select id="listPlotInfo" resultType="cn.iocoder.yudao.module.farm.controller.admin.home.vo.PlotListRespVO">
|
||||||
|
SELECT
|
||||||
|
fpi.plot_id AS plotId,
|
||||||
|
fpi.plot_name AS plotName,
|
||||||
|
fpi.plot_area AS plotArea,
|
||||||
|
fpi.plot_color AS plotColor,
|
||||||
|
fpi.point AS point,
|
||||||
|
fbi.name AS baseName,
|
||||||
|
fpm.name AS manager,
|
||||||
|
COALESCE(SUM(fpp.predicted_area), 0) AS beingBaseArea,
|
||||||
|
GROUP_CONCAT(DISTINCT fsl.cultivar_name SEPARATOR ',') AS beingCropName
|
||||||
|
FROM farm_plot_info fpi
|
||||||
|
LEFT JOIN farm_base_info fbi ON fpi.base_id = fbi.id AND fbi.deleted = 0
|
||||||
|
LEFT JOIN farm_personnel_management fpm ON fpi.employee_id = fpm.id AND fpm.deleted = 0
|
||||||
|
LEFT JOIN farm_production_plan fpp ON fpi.plot_id = fpp.plot_id AND fpp.deleted = 0 AND fpp.plan_status = 2
|
||||||
|
LEFT JOIN farm_species_library fsl ON fpp.plant_species_code = fsl.id AND fsl.deleted = 0
|
||||||
|
WHERE fpi.deleted = 0
|
||||||
|
<if test="baseId != null and baseId != ''">
|
||||||
|
AND fpi.base_id = #{baseId}
|
||||||
|
</if>
|
||||||
|
GROUP BY fpi.plot_id,
|
||||||
|
fpi.plot_name,
|
||||||
|
fpi.plot_area,
|
||||||
|
fpi.plot_color,
|
||||||
|
fpi.point,
|
||||||
|
fbi.name,
|
||||||
|
fpm.name
|
||||||
|
ORDER BY fpi.create_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user