fix (farm): 模型管理
- 模型周期 图片展示
This commit is contained in:
@@ -78,9 +78,9 @@ public class HomeInfo {
|
||||
|
||||
@Schema(description = "基地数量")
|
||||
private Integer baseCount;
|
||||
@Schema(description = "总面积")
|
||||
private Integer cropCount;
|
||||
@Schema(description = "在种作物数量")
|
||||
private Integer cropCount;
|
||||
@Schema(description = "总面积")
|
||||
private Integer totalArea;
|
||||
@Schema(description = "在职员工人数")
|
||||
private Integer personnelCount;
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ModelCycleRespVO {
|
||||
@Schema(description = "阶段图片")
|
||||
@ExcelProperty("阶段图片")
|
||||
private String stageImage;
|
||||
private List<String> stageImageList;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
|
||||
@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.farm.controller.admin.modelcycle.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 模型管理-管理周期新增/修改 Request VO")
|
||||
@Data
|
||||
public class ModelCycleSaveReqVO {
|
||||
@@ -24,6 +26,7 @@ public class ModelCycleSaveReqVO {
|
||||
|
||||
@Schema(description = "阶段图片")
|
||||
private String stageImage;
|
||||
private List<String> stageImageList;
|
||||
|
||||
@Schema(description = "基地id", example = "3265")
|
||||
private String baseId;
|
||||
|
||||
@@ -79,7 +79,9 @@ public class ModelManagementRespVO {
|
||||
private String tenantName;
|
||||
|
||||
private String userName;
|
||||
@Schema(description = "发布状态")
|
||||
private int isRelease;
|
||||
@Schema(description = "引用次数")
|
||||
private int quoteCount;
|
||||
@Schema(description = "物种图片")
|
||||
private String speciesImage;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package cn.iocoder.yudao.module.farm.dal.dataobject.modelcycle;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.framework.util.ImageCollectionUtil;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
@@ -56,6 +57,8 @@ public class ModelCycleDO extends BaseDO {
|
||||
* 阶段图片
|
||||
*/
|
||||
private String stageImage;
|
||||
@TableField(exist = false)
|
||||
private List<String> stageImageList;
|
||||
/**
|
||||
* 基地id
|
||||
*/
|
||||
@@ -74,4 +77,11 @@ public class ModelCycleDO extends BaseDO {
|
||||
private String plotName;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
public List<String> getImageList() {
|
||||
if (stageImageList == null) {
|
||||
stageImageList = ImageCollectionUtil.toImageList(this.stageImage);
|
||||
}
|
||||
return stageImageList;
|
||||
}
|
||||
}
|
||||
@@ -265,8 +265,9 @@ public class HomeServiceImpl implements HomeService {
|
||||
private BaseOverviewInfo getCompanyInfo() {
|
||||
LoginUser user = getLoginUser();
|
||||
int baseCount = baseInfoService.getBaseCount(user.getTenantId()); // 基地数量
|
||||
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数量
|
||||
Double temp = cropFarmingCenterService.getTotalArea(user.getTenantId()); // 总面积
|
||||
int cropCount = cropFarmingCenterService.getCropCount(user.getTenantId()); // 作物数mong量
|
||||
// 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);
|
||||
|
||||
@@ -44,6 +44,9 @@ public class ModelCycleServiceImpl implements ModelCycleService {
|
||||
ModelCycleDO modelCycle = BeanUtils.toBean(createReqVO, ModelCycleDO.class);
|
||||
modelCycle.setId(IdUtil.fastUUID());
|
||||
modelCycle.setTenantId(String.valueOf(user.getTenantId()));
|
||||
for (String image : createReqVO.getStageImageList()) {
|
||||
modelCycle.setStageImage(image);
|
||||
}
|
||||
modelCycleMapper.insert(modelCycle);
|
||||
// 返回
|
||||
return modelCycle.getId();
|
||||
@@ -54,6 +57,9 @@ public class ModelCycleServiceImpl implements ModelCycleService {
|
||||
// 校验存在
|
||||
validateModelCycleExists(updateReqVO.getId());
|
||||
// 更新
|
||||
for (String image : updateReqVO.getStageImageList()) {
|
||||
updateReqVO.setStageImage(image);
|
||||
}
|
||||
ModelCycleDO updateObj = BeanUtils.toBean(updateReqVO, ModelCycleDO.class);
|
||||
modelCycleMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@@ -299,6 +299,7 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
||||
List<ModelCycleDO> list = modelCycleMapper.selectListByModelId(id);
|
||||
list.forEach(cycle -> {
|
||||
ModelCycleRespVO vo = BeanUtils.toBean(cycle, ModelCycleRespVO.class);
|
||||
vo.setStageImageList(cycle.getStageImageList());
|
||||
//环境指标
|
||||
List<ModelEnvironmentIndexDO> environmentIndexDO = modelEnvironmentIndexMapper.selectByCycleId(cycle.getId());
|
||||
vo.setEnvironmentIndexDOS(environmentIndexDO);
|
||||
|
||||
Reference in New Issue
Block a user