环境指标
This commit is contained in:
@@ -50,5 +50,25 @@ public class ModelEnvironmentIndexPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "租户id", example = "20667")
|
||||
private String tenantId;
|
||||
/**
|
||||
* 设备分类名称
|
||||
*/
|
||||
private String deviceClassName;
|
||||
/**
|
||||
* 指示范围
|
||||
*/
|
||||
private String sampleValue;
|
||||
/**
|
||||
* 指示说明
|
||||
*/
|
||||
private String indicatorDescription;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 环境指标名称
|
||||
*/
|
||||
private String indicatorsName;
|
||||
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 模型管理-环境指标 Response VO")
|
||||
@Data
|
||||
@@ -65,4 +65,25 @@ public class ModelEnvironmentIndexRespVO {
|
||||
@ExcelProperty("租户id")
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 设备分类名称
|
||||
*/
|
||||
private String deviceClassName;
|
||||
/**
|
||||
* 指示范围
|
||||
*/
|
||||
private String sampleValue;
|
||||
/**
|
||||
* 指示说明
|
||||
*/
|
||||
private String indicatorDescription;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 环境指标名称
|
||||
*/
|
||||
private String indicatorsName;
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,25 @@ public class ModelEnvironmentIndexSaveReqVO {
|
||||
@Schema(description = "租户id", example = "20667")
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 设备分类名称
|
||||
*/
|
||||
private String deviceClassName;
|
||||
/**
|
||||
* 指示范围
|
||||
*/
|
||||
private String sampleValue;
|
||||
/**
|
||||
* 指示说明
|
||||
*/
|
||||
private String indicatorDescription;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 环境指标名称
|
||||
*/
|
||||
private String indicatorsName;
|
||||
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package cn.iocoder.yudao.module.farm.dal.dataobject.modelenvironmentindex;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 模型管理-环境指标 DO
|
||||
@@ -72,4 +71,24 @@ public class ModelEnvironmentIndexDO extends BaseDO {
|
||||
private String plotName;
|
||||
|
||||
private String tenantId;
|
||||
/**
|
||||
* 设备分类名称
|
||||
*/
|
||||
private String deviceClassName;
|
||||
/**
|
||||
* 指示范围
|
||||
*/
|
||||
private String sampleValue;
|
||||
/**
|
||||
* 指示说明
|
||||
*/
|
||||
private String indicatorDescription;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 环境指标名称
|
||||
*/
|
||||
private String indicatorsName;
|
||||
}
|
||||
@@ -1,27 +1,24 @@
|
||||
package cn.iocoder.yudao.module.farm.service.modelenvironmentindex;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelenvironmentindex.ModelEnvironmentIndexDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.environmentindexconfig.EnvironmentIndexConfigDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelenvironmentindex.ModelEnvironmentIndexDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.deviceclassify.DeviceClassifyMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.environmentindexconfig.EnvironmentIndexConfigMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelenvironmentindex.ModelEnvironmentIndexMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.MODEL_ENVIRONMENT_INDEX_NOT_EXISTS;
|
||||
|
||||
@@ -36,6 +33,10 @@ public class ModelEnvironmentIndexServiceImpl implements ModelEnvironmentIndexSe
|
||||
|
||||
@Resource
|
||||
private ModelEnvironmentIndexMapper modelEnvironmentIndexMapper;
|
||||
@Resource
|
||||
private EnvironmentIndexConfigMapper environmentIndexConfigMapper;
|
||||
@Resource
|
||||
private DeviceClassifyMapper deviceClassifyMapper;
|
||||
|
||||
@Override
|
||||
public String createModelEnvironmentIndex(ModelEnvironmentIndexSaveReqVO createReqVO) {
|
||||
@@ -44,6 +45,11 @@ public class ModelEnvironmentIndexServiceImpl implements ModelEnvironmentIndexSe
|
||||
ModelEnvironmentIndexDO modelEnvironmentIndex = BeanUtils.toBean(createReqVO, ModelEnvironmentIndexDO.class);
|
||||
modelEnvironmentIndex.setId(IdUtil.fastUUID());
|
||||
modelEnvironmentIndex.setTenantId(String.valueOf(user.getTenantId()));
|
||||
EnvironmentIndexConfigDO environmentIndexConfigDO = environmentIndexConfigMapper.selectById(modelEnvironmentIndex.getIndicators());
|
||||
modelEnvironmentIndex.setIndicatorsName(environmentIndexConfigDO.getName());
|
||||
modelEnvironmentIndex.setIndicatorDescription(environmentIndexConfigDO.getDescription());
|
||||
DeviceClassifyDO deviceClassifyDO = deviceClassifyMapper.selectById(modelEnvironmentIndex.getDeviceClass());
|
||||
modelEnvironmentIndex.setDeviceClassName(deviceClassifyDO.getName());
|
||||
modelEnvironmentIndexMapper.insert(modelEnvironmentIndex);
|
||||
|
||||
// 返回
|
||||
@@ -73,7 +79,7 @@ public class ModelEnvironmentIndexServiceImpl implements ModelEnvironmentIndexSe
|
||||
modelEnvironmentIndexMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateModelEnvironmentIndexExists(String id) {
|
||||
private void validateModelEnvironmentIndexExists(String id) {
|
||||
if (modelEnvironmentIndexMapper.selectById(id) == null) {
|
||||
throw exception(MODEL_ENVIRONMENT_INDEX_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user