fix (farm): 模型管理

- 模型周期 图片展示
This commit is contained in:
达富斌
2025-09-11 16:54:47 +08:00
parent 2f940991f2
commit 8bba62b5ff
8 changed files with 30 additions and 6 deletions

View File

@@ -78,9 +78,9 @@ public class HomeInfo {
@Schema(description = "基地数量") @Schema(description = "基地数量")
private Integer baseCount; private Integer baseCount;
@Schema(description = "总面积")
private Integer cropCount;
@Schema(description = "在种作物数量") @Schema(description = "在种作物数量")
private Integer cropCount;
@Schema(description = "总面积")
private Integer totalArea; private Integer totalArea;
@Schema(description = "在职员工人数") @Schema(description = "在职员工人数")
private Integer personnelCount; private Integer personnelCount;

View File

@@ -42,6 +42,7 @@ public class ModelCycleRespVO {
@Schema(description = "阶段图片") @Schema(description = "阶段图片")
@ExcelProperty("阶段图片") @ExcelProperty("阶段图片")
private String stageImage; private String stageImage;
private List<String> stageImageList;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@ExcelProperty("创建时间") @ExcelProperty("创建时间")

View File

@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.farm.controller.admin.modelcycle.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.List;
@Schema(description = "管理后台 - 模型管理-管理周期新增/修改 Request VO") @Schema(description = "管理后台 - 模型管理-管理周期新增/修改 Request VO")
@Data @Data
public class ModelCycleSaveReqVO { public class ModelCycleSaveReqVO {
@@ -24,6 +26,7 @@ public class ModelCycleSaveReqVO {
@Schema(description = "阶段图片") @Schema(description = "阶段图片")
private String stageImage; private String stageImage;
private List<String> stageImageList;
@Schema(description = "基地id", example = "3265") @Schema(description = "基地id", example = "3265")
private String baseId; private String baseId;

View File

@@ -79,7 +79,9 @@ public class ModelManagementRespVO {
private String tenantName; private String tenantName;
private String userName; private String userName;
@Schema(description = "发布状态")
private int isRelease; private int isRelease;
@Schema(description = "引用次数")
private int quoteCount; private int quoteCount;
@Schema(description = "物种图片") @Schema(description = "物种图片")
private String speciesImage; private String speciesImage;

View File

@@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.farm.dal.dataobject.modelcycle; package cn.iocoder.yudao.module.farm.dal.dataobject.modelcycle;
import cn.iocoder.yudao.module.farm.framework.util.ImageCollectionUtil;
import lombok.*; import lombok.*;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.util.List;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@@ -56,6 +57,8 @@ public class ModelCycleDO extends BaseDO {
* 阶段图片 * 阶段图片
*/ */
private String stageImage; private String stageImage;
@TableField(exist = false)
private List<String> stageImageList;
/** /**
* 基地id * 基地id
*/ */
@@ -74,4 +77,11 @@ public class ModelCycleDO extends BaseDO {
private String plotName; private String plotName;
private String tenantId; private String tenantId;
public List<String> getImageList() {
if (stageImageList == null) {
stageImageList = ImageCollectionUtil.toImageList(this.stageImage);
}
return stageImageList;
}
} }

View File

@@ -265,8 +265,9 @@ public class HomeServiceImpl implements HomeService {
private BaseOverviewInfo getCompanyInfo() { private BaseOverviewInfo getCompanyInfo() {
LoginUser user = getLoginUser(); LoginUser user = getLoginUser();
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量 int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量 int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数mong量
Double temp = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积 // Double temp = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积
Double temp = baseInfoService.getBaseTotalArea(user.getTenantId().toString()); // 总面积
int totalArea = 0; int totalArea = 0;
if (!ObjectUtils.isEmpty(temp)) { if (!ObjectUtils.isEmpty(temp)) {
totalArea = (int) Math.round(temp); totalArea = (int) Math.round(temp);

View File

@@ -44,6 +44,9 @@ public class ModelCycleServiceImpl implements ModelCycleService {
ModelCycleDO modelCycle = BeanUtils.toBean(createReqVO, ModelCycleDO.class); ModelCycleDO modelCycle = BeanUtils.toBean(createReqVO, ModelCycleDO.class);
modelCycle.setId(IdUtil.fastUUID()); modelCycle.setId(IdUtil.fastUUID());
modelCycle.setTenantId(String.valueOf(user.getTenantId())); modelCycle.setTenantId(String.valueOf(user.getTenantId()));
for (String image : createReqVO.getStageImageList()) {
modelCycle.setStageImage(image);
}
modelCycleMapper.insert(modelCycle); modelCycleMapper.insert(modelCycle);
// 返回 // 返回
return modelCycle.getId(); return modelCycle.getId();
@@ -54,6 +57,9 @@ public class ModelCycleServiceImpl implements ModelCycleService {
// 校验存在 // 校验存在
validateModelCycleExists(updateReqVO.getId()); validateModelCycleExists(updateReqVO.getId());
// 更新 // 更新
for (String image : updateReqVO.getStageImageList()) {
updateReqVO.setStageImage(image);
}
ModelCycleDO updateObj = BeanUtils.toBean(updateReqVO, ModelCycleDO.class); ModelCycleDO updateObj = BeanUtils.toBean(updateReqVO, ModelCycleDO.class);
modelCycleMapper.updateById(updateObj); modelCycleMapper.updateById(updateObj);
} }

View File

@@ -299,6 +299,7 @@ public class ModelManagementServiceImpl implements ModelManagementService {
List<ModelCycleDO> list = modelCycleMapper.selectListByModelId(id); List<ModelCycleDO> list = modelCycleMapper.selectListByModelId(id);
list.forEach(cycle -> { list.forEach(cycle -> {
ModelCycleRespVO vo = BeanUtils.toBean(cycle, ModelCycleRespVO.class); ModelCycleRespVO vo = BeanUtils.toBean(cycle, ModelCycleRespVO.class);
vo.setStageImageList(cycle.getStageImageList());
//环境指标 //环境指标
List<ModelEnvironmentIndexDO> environmentIndexDO = modelEnvironmentIndexMapper.selectByCycleId(cycle.getId()); List<ModelEnvironmentIndexDO> environmentIndexDO = modelEnvironmentIndexMapper.selectByCycleId(cycle.getId());
vo.setEnvironmentIndexDOS(environmentIndexDO); vo.setEnvironmentIndexDOS(environmentIndexDO);