feat (farm): 基地规划-网格信息
- 添加字段 网格信息
This commit is contained in:
@@ -84,6 +84,26 @@ public class BaseInfoRespVO {
|
|||||||
private String plotManager;
|
private String plotManager;
|
||||||
@Schema(description = "地块坐标")
|
@Schema(description = "地块坐标")
|
||||||
private String plotPoint;
|
private String plotPoint;
|
||||||
|
@Schema(description = "网格信息")
|
||||||
|
private List<GridInfo> gridOverviewList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class GridInfo{
|
||||||
|
@Schema(description = "网格ID")
|
||||||
|
private String id;
|
||||||
|
@Schema(description = "网格类型")
|
||||||
|
private String type;
|
||||||
|
@Schema(description = "网格类型-名称")
|
||||||
|
private String typeName;
|
||||||
|
@Schema(description = "网格-行")
|
||||||
|
private Integer row;
|
||||||
|
@Schema(description = "网格-列")
|
||||||
|
private Integer column;
|
||||||
|
@Schema(description = "网格-颜色")
|
||||||
|
private String color;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ public class BaseNameRespVO {
|
|||||||
|
|
||||||
@Schema(description = "地块总面积")
|
@Schema(description = "地块总面积")
|
||||||
private BigDecimal plotArea;
|
private BigDecimal plotArea;
|
||||||
|
|
||||||
|
@Schema(description = "剩余面积")
|
||||||
|
private BigDecimal remainingArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseNameRespVO(String id, String name) {
|
public BaseNameRespVO(String id, String name) {
|
||||||
|
|||||||
@@ -85,7 +85,9 @@ public class ProductionPlanRespVO {
|
|||||||
private Double predictedArea;
|
private Double predictedArea;
|
||||||
@Schema(description = "剩余面积")
|
@Schema(description = "剩余面积")
|
||||||
private Double remainingArea;
|
private Double remainingArea;
|
||||||
@Schema(description = "占地面积")
|
// @Schema(description = "可用面积")
|
||||||
|
// private Double usableArea;
|
||||||
|
@Schema(description = "占地面积(百分比)")
|
||||||
private Integer usagePercentage;
|
private Integer usagePercentage;
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
public class GridInfoPageReqVO extends PageParam {
|
public class GridInfoPageReqVO extends PageParam {
|
||||||
|
|
||||||
@Schema(description = "类型", example = "2")
|
@Schema(description = "类型", example = "2")
|
||||||
private byte[] type;
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "行")
|
@Schema(description = "行")
|
||||||
private String manager;
|
private String gridRow;
|
||||||
|
|
||||||
@Schema(description = "列")
|
@Schema(description = "列")
|
||||||
private BigDecimal area;
|
private String gridColumn;
|
||||||
|
|
||||||
@Schema(description = "颜色")
|
@Schema(description = "颜色")
|
||||||
private String color;
|
private String color;
|
||||||
|
|||||||
@@ -19,15 +19,15 @@ public class GridInfoRespVO {
|
|||||||
|
|
||||||
@Schema(description = "类型", example = "2")
|
@Schema(description = "类型", example = "2")
|
||||||
@ExcelProperty("类型")
|
@ExcelProperty("类型")
|
||||||
private byte[] type;
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "行")
|
@Schema(description = "行")
|
||||||
@ExcelProperty("行")
|
@ExcelProperty("行")
|
||||||
private String manager;
|
private String gridRow;
|
||||||
|
|
||||||
@Schema(description = "列")
|
@Schema(description = "列")
|
||||||
@ExcelProperty("列")
|
@ExcelProperty("列")
|
||||||
private BigDecimal area;
|
private String gridColumn;
|
||||||
|
|
||||||
@Schema(description = "颜色")
|
@Schema(description = "颜色")
|
||||||
@ExcelProperty("颜色")
|
@ExcelProperty("颜色")
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ public class GridInfoSaveReqVO {
|
|||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(description = "类型", example = "2")
|
@Schema(description = "类型", example = "2")
|
||||||
private byte[] type;
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "行")
|
@Schema(description = "行")
|
||||||
private String manager;
|
private String gridRow;
|
||||||
|
|
||||||
@Schema(description = "列")
|
@Schema(description = "列")
|
||||||
private BigDecimal area;
|
private String gridColumn;
|
||||||
|
|
||||||
@Schema(description = "颜色")
|
@Schema(description = "颜色")
|
||||||
private String color;
|
private String color;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.math.BigDecimal;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class GridInfoDO extends BaseDO {
|
public class GridInfoDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@@ -33,28 +32,29 @@ public class GridInfoDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
private byte[] type;
|
private String type;
|
||||||
/**
|
/**
|
||||||
* 行
|
* 行
|
||||||
*/
|
*/
|
||||||
private String manager;
|
private String gridRow;
|
||||||
/**
|
/**
|
||||||
* 列
|
* 列
|
||||||
*/
|
*/
|
||||||
private BigDecimal area;
|
private String gridColumn;
|
||||||
/**
|
/**
|
||||||
* 颜色
|
* 颜色
|
||||||
*/
|
*/
|
||||||
private String color;
|
private String color;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String describe;
|
||||||
/**
|
/**
|
||||||
* 地块id
|
* 地块id
|
||||||
*/
|
*/
|
||||||
private String plotId;
|
private String plotId;
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 租户编号
|
||||||
*/
|
*/
|
||||||
private String describe;
|
|
||||||
|
|
||||||
@Schema(description = "租户编号")
|
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.mysql.gridinfo;
|
package cn.iocoder.yudao.module.farm.dal.mysql.gridinfo;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -20,8 +18,8 @@ public interface GridInfoMapper extends BaseMapperX<GridInfoDO> {
|
|||||||
default PageResult<GridInfoDO> selectPage(GridInfoPageReqVO reqVO) {
|
default PageResult<GridInfoDO> selectPage(GridInfoPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<GridInfoDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<GridInfoDO>()
|
||||||
.eqIfPresent(GridInfoDO::getType, reqVO.getType())
|
.eqIfPresent(GridInfoDO::getType, reqVO.getType())
|
||||||
.eqIfPresent(GridInfoDO::getManager, reqVO.getManager())
|
.eqIfPresent(GridInfoDO::getGridRow, reqVO.getGridRow())
|
||||||
.eqIfPresent(GridInfoDO::getArea, reqVO.getArea())
|
.eqIfPresent(GridInfoDO::getGridColumn, reqVO.getGridColumn())
|
||||||
.eqIfPresent(GridInfoDO::getColor, reqVO.getColor())
|
.eqIfPresent(GridInfoDO::getColor, reqVO.getColor())
|
||||||
.betweenIfPresent(GridInfoDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(GridInfoDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.eqIfPresent(GridInfoDO::getTenantId, reqVO.getTenantId())
|
.eqIfPresent(GridInfoDO::getTenantId, reqVO.getTenantId())
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class CommonConstants {
|
|||||||
|
|
||||||
public static Map<Integer, String> PLAN_MAP = new HashMap<>();
|
public static Map<Integer, String> PLAN_MAP = new HashMap<>();
|
||||||
public static Map<String, String> LIFE_CYCLE_MAP = new HashMap<>();
|
public static Map<String, String> LIFE_CYCLE_MAP = new HashMap<>();
|
||||||
|
public static Map<String, String> GRID_TYPE = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PLAN_MAP.put(PLAN_STATUS_1, "未开始");
|
PLAN_MAP.put(PLAN_STATUS_1, "未开始");
|
||||||
@@ -43,6 +44,9 @@ public class CommonConstants {
|
|||||||
|
|
||||||
LIFE_CYCLE_MAP.put("1", "一年生");
|
LIFE_CYCLE_MAP.put("1", "一年生");
|
||||||
LIFE_CYCLE_MAP.put("10", "多年生");
|
LIFE_CYCLE_MAP.put("10", "多年生");
|
||||||
|
|
||||||
|
GRID_TYPE.put("1", "养殖类型");
|
||||||
|
GRID_TYPE.put("2", "水产类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模型类型 (1:模型模板; 2:引用案例)
|
// 模型类型 (1:模型模板; 2:引用案例)
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.vo.*;
|
import cn.iocoder.yudao.module.farm.controller.admin.baseinfo.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.gridinfo.GridInfoDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
||||||
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;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.gridinfo.GridInfoMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
||||||
@@ -16,11 +18,13 @@ import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMappe
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
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;
|
||||||
@@ -48,6 +52,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
private SpeciesLibraryMapper speciesLibraryMapper;
|
private SpeciesLibraryMapper speciesLibraryMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private PersonnelManagementMapper personnelManagementMapper;
|
private PersonnelManagementMapper personnelManagementMapper;
|
||||||
|
@Resource
|
||||||
|
private GridInfoMapper gridInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,7 +131,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
List<BaseNameRespVO.PlotInfoVO> childList = new ArrayList<>();
|
List<BaseNameRespVO.PlotInfoVO> childList = new ArrayList<>();
|
||||||
for (PlotInfoDO aDo : plotInfoDOS) {
|
for (PlotInfoDO aDo : plotInfoDOS) {
|
||||||
if (aDo.getBaseId().equals(key)) {
|
if (aDo.getBaseId().equals(key)) {
|
||||||
childList.add(new BaseNameRespVO.PlotInfoVO(aDo.getPlotId(), aDo.getPlotName(), aDo.getPlotArea()));
|
BigDecimal remainingArea = BigDecimal.valueOf(2.00); // todo
|
||||||
|
childList.add(new BaseNameRespVO.PlotInfoVO(aDo.getPlotId(), aDo.getPlotName(), aDo.getPlotArea(),remainingArea));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
obj.setChildren(childList);
|
obj.setChildren(childList);
|
||||||
@@ -201,10 +208,19 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
List<BaseInfoRespVO.PlotInfo> targetList = new ArrayList<>();
|
List<BaseInfoRespVO.PlotInfo> targetList = new ArrayList<>();
|
||||||
for (PlotInfoDO aDo : plotList) {
|
for (PlotInfoDO aDo : plotList) {
|
||||||
String plotManager = employeeMap.getOrDefault(aDo.getEmployeeId(), "系统");
|
String plotManager = employeeMap.getOrDefault(aDo.getEmployeeId(), "系统");
|
||||||
BaseInfoRespVO.PlotInfo target = new BaseInfoRespVO.PlotInfo(aDo.getId(), aDo.getPlotName(), aDo.getPlotColor(), aDo.getPlotArea(), plotManager,aDo.getPoint());
|
List<BaseInfoRespVO.GridInfo> gridInfos = this.packageGridInfo(aDo.getId());
|
||||||
|
BaseInfoRespVO.PlotInfo target = new BaseInfoRespVO.PlotInfo(aDo.getId(), aDo.getPlotName(), aDo.getPlotColor(), aDo.getPlotArea(), plotManager,aDo.getPoint(),gridInfos);
|
||||||
targetList.add(target);
|
targetList.add(target);
|
||||||
}
|
}
|
||||||
obj.setPlotOverviewList(targetList);
|
obj.setPlotOverviewList(targetList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<BaseInfoRespVO.GridInfo> packageGridInfo(String plotId) {
|
||||||
|
List<GridInfoDO> gridList = gridInfoMapper.selectList("plot_id", plotId);
|
||||||
|
if (ObjectUtils.isEmpty(gridList)) {
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
return BeanUtils.toBean(gridList, BaseInfoRespVO.GridInfo.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user