调整字段描述
parent
6a67849aaf
commit
c35a8ab56b
|
|
@ -17,6 +17,10 @@ public class ScheduledTask {
|
|||
|
||||
@Scheduled(fixedDelay = 60000)
|
||||
public void scheduledTask() {
|
||||
String OS = System.getProperty("os.name").toLowerCase();
|
||||
// 简单粗暴的判断,在 linux 环境下运行时,为生成环境
|
||||
if (OS.contains("linux")) {
|
||||
iDeviceDataService.syncData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.whdc.zhdbaqapi.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
||||
import com.whdc.zhdbaqapi.model.dto.IntegerIdDto;
|
||||
|
|
@ -14,7 +12,6 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -79,7 +76,7 @@ public class DeviceInfoController {
|
|||
@ApiOperation(value = "Excel数据导入")
|
||||
@PostMapping("/imp")
|
||||
public ResultJson<DeviceInfoImpVo> imp(@RequestParam(value = "file") @RequestPart MultipartFile file) throws Exception {
|
||||
if(file == null){
|
||||
if (file == null) {
|
||||
return ResultJson.error("无效文件");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 主键id
|
||||
*/
|
||||
@ApiParam(value = "主键id")
|
||||
@ApiModelProperty(value = "主键id", dataType = "java.lang.Integer")
|
||||
@ApiModelProperty(value = "主键id", dataType = "java.lang.Integer", position = 1)
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 测点编号
|
||||
*/
|
||||
@ApiParam(value = "测点编号")
|
||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String", required = true)
|
||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String", required = true, position = 2)
|
||||
@Excel(name = "测点编号")
|
||||
@NotEmpty(message = "测点编号必填")
|
||||
@TableField("STATION_CODE")
|
||||
|
|
@ -55,7 +55,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 测站编码(MCU)
|
||||
*/
|
||||
@ApiParam(value = "测站编码(MCU)")
|
||||
@ApiModelProperty(value = "测站编码(MCU)", dataType = "java.lang.String")
|
||||
@ApiModelProperty(value = "测站编码(MCU)", dataType = "java.lang.String", required = true, position = 3)
|
||||
@Excel(name = "测站编码(MCU)")
|
||||
@NotEmpty(message = "测站编码(MCU)必填")
|
||||
@TableField("DEVICE_ID")
|
||||
|
|
@ -65,7 +65,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 通道号
|
||||
*/
|
||||
@ApiParam(value = "通道号")
|
||||
@ApiModelProperty(value = "通道号", dataType = "java.lang.Integer", required = true)
|
||||
@ApiModelProperty(value = "通道号", dataType = "java.lang.Integer", required = true, position = 4)
|
||||
@Excel(name = "通道号")
|
||||
@NotNull(message = "通道号必填")
|
||||
@Max(message = "通道号最大值 7", value = 7)
|
||||
|
|
@ -77,7 +77,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 温度率定系娄(K)
|
||||
*/
|
||||
@ApiParam(value = "温度率定系娄(K)")
|
||||
@ApiModelProperty(value = "温度率定系娄(K)", dataType = "java.math.BigDecimal", required = true)
|
||||
@ApiModelProperty(value = "温度率定系娄(K)", dataType = "java.math.BigDecimal", required = true, position = 5)
|
||||
@Excel(name = "温度率定系娄(K)")
|
||||
@NotNull(message = "温度率定系娄(K)必填")
|
||||
@TableField("TEMPERATURE_K")
|
||||
|
|
@ -87,7 +87,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 初始温度读数
|
||||
*/
|
||||
@ApiParam(value = "初始温度读数")
|
||||
@ApiModelProperty(value = "初始温度读数", dataType = "java.lang.Double", required = true)
|
||||
@ApiModelProperty(value = "初始温度读数", dataType = "java.lang.Double", required = true, position = 6)
|
||||
@Excel(name = "初始温度读数")
|
||||
@NotNull(message = "初始温度读数必填")
|
||||
@TableField("START_TEMPERATURE")
|
||||
|
|
@ -97,7 +97,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 率定系数(G)
|
||||
*/
|
||||
@ApiParam(value = "率定系数(G)")
|
||||
@ApiModelProperty(value = "率定系数(G)", dataType = "java.math.BigDecimal", required = true)
|
||||
@ApiModelProperty(value = "率定系数(G)", dataType = "java.math.BigDecimal", required = true, position = 7)
|
||||
@Excel(name = "率定系数(G)")
|
||||
@NotNull(message = "率定系数(G)必填")
|
||||
@TableField("CALIBRATION_COEFFICIENT")
|
||||
|
|
@ -107,7 +107,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 初始读数。单位是“模数”, 乘 1000 后开方得到频率值
|
||||
*/
|
||||
@ApiParam(value = "初始读数")
|
||||
@ApiModelProperty(value = "初始读数", notes = "单位是“模数”, 乘 1000 后开方得到频率值", dataType = "java.math.BigDecimal", required = true)
|
||||
@ApiModelProperty(value = "初始读数", notes = "单位是“模数”, 乘 1000 后开方得到频率值", dataType = "java.math.BigDecimal", required = true, position = 8)
|
||||
@Excel(name = "初始读数")
|
||||
@NotNull(message = "初始读数必填")
|
||||
@TableField("INITIAL_READING")
|
||||
|
|
@ -117,7 +117,7 @@ public class DeviceInfo implements Serializable {
|
|||
* 项目名称
|
||||
*/
|
||||
@ApiParam(value = "项目名称")
|
||||
@ApiModelProperty(value = "项目名称", dataType = "java.lang.String")
|
||||
@ApiModelProperty(value = "项目名称", dataType = "java.lang.String", position = 9)
|
||||
@Excel(name = "工程或项目名称")
|
||||
@TableField("PROJECT_NAME")
|
||||
private String projectName;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,36 @@ public class DeviceInfoServiceimpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean save(DeviceInfo entity) {
|
||||
if (baseMapper.checkValidStationCode(entity.getStationCode()) != null) {
|
||||
throw new MyException("stationCode=" + entity.getStationCode() + " 已被其他有效数据使用,不能恢复");
|
||||
}
|
||||
|
||||
entity.setCreateDate(new Date());
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean updateById(DeviceInfo entity) {
|
||||
DeviceInfo old = baseMapper.checkValidStationCode(entity.getStationCode());
|
||||
if (old != null && !old.getId().equals(entity.getId())) {
|
||||
throw new MyException("stationCode=" + entity.getStationCode() + " 已被其他有效数据使用,不能恢复");
|
||||
}
|
||||
entity.setModificationTime(new Date());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean removeById(Serializable id) {
|
||||
DeviceInfo entity = baseMapper.selectById(id);
|
||||
entity.setDel(1);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean restore(Integer id) {
|
||||
|
|
@ -129,26 +159,4 @@ public class DeviceInfoServiceimpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|||
throw new MyException("导入异常!" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean save(DeviceInfo entity) {
|
||||
entity.setCreateDate(new Date());
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean updateById(DeviceInfo entity) {
|
||||
entity.setModificationTime(new Date());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean removeById(Serializable id) {
|
||||
DeviceInfo entity = baseMapper.selectById(id);
|
||||
entity.setDel(1);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue