master
parent
46395a31ba
commit
303fb35ae9
5
pom.xml
5
pom.xml
|
|
@ -65,6 +65,11 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ -->
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
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;
|
||||
import com.whdc.zhdbaqapi.model.dto.StationCodeDto;
|
||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
||||
import com.whdc.zhdbaqapi.model.vo.DeviceInfoImpVo;
|
||||
import com.whdc.zhdbaqapi.service.IDeviceInfoService;
|
||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -25,6 +28,7 @@ import java.util.List;
|
|||
@Api(tags = "设备信息 - Controller")
|
||||
@RestController
|
||||
@RequestMapping("/v1/deviceInfo")
|
||||
@Slf4j
|
||||
public class DeviceInfoController {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -71,4 +75,14 @@ public class DeviceInfoController {
|
|||
public ResultJson<IPage<DeviceInfo>> page(@RequestBody FindDeviceDto findDto) {
|
||||
return ResultJson.ok(iDeviceInfoService.page(findDto));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Excel数据导入")
|
||||
@PostMapping("/imp")
|
||||
public ResultJson<DeviceInfoImpVo> imp(@RequestParam(value = "file") @RequestPart MultipartFile file) throws Exception {
|
||||
if(file == null){
|
||||
return ResultJson.error("无效文件");
|
||||
}
|
||||
|
||||
return ResultJson.ok(iDeviceInfoService.imp(file.getInputStream()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author 李赛
|
||||
|
|
@ -32,4 +33,19 @@ public interface DeviceInfoMapper extends BaseMapper<DeviceInfo> {
|
|||
* @return
|
||||
*/
|
||||
IPage<DeviceInfo> page(@Param("page") IPage<SysUser> page, @Param("obj") FindDeviceDto findDto);
|
||||
|
||||
/**
|
||||
* 按 stationCode 查询
|
||||
*
|
||||
* @param scs
|
||||
* @return
|
||||
*/
|
||||
List<DeviceInfo> listBySC(Set<String> scs);
|
||||
|
||||
/**
|
||||
* 检查 station_code 是否有效
|
||||
* @param stationCode
|
||||
* @return
|
||||
*/
|
||||
DeviceInfo checkValidStationCode(String stationCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ public class FindDeviceDto extends FindPageDto {
|
|||
@ApiModelProperty(value = "站点编码", dataType = "java.lang.String")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty(value = "测头编码", dataType = "java.lang.String")
|
||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String")
|
||||
private String stationCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import java.io.Serializable;
|
|||
public class StationCodeDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiParam(value = "测头编码", example = "")
|
||||
@ApiModelProperty(value = "测头编码", dataType = "java.lang.String")
|
||||
@NotBlank(message = "测头编码")
|
||||
@ApiParam(value = "测点编号", example = "")
|
||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String")
|
||||
@NotBlank(message = "测点编号")
|
||||
private String stationCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.whdc.zhdbaqapi.model.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
|
@ -41,11 +42,12 @@ public class DeviceInfo implements Serializable {
|
|||
private Integer id;
|
||||
|
||||
/**
|
||||
* 测头编码
|
||||
* 测点编号
|
||||
*/
|
||||
@ApiParam(value = "测头编码")
|
||||
@ApiModelProperty(value = "测头编码", dataType = "java.lang.String", required = true)
|
||||
@NotEmpty(message = "测头编码必填")
|
||||
@ApiParam(value = "测点编号")
|
||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String", required = true)
|
||||
@Excel(name = "测点编号")
|
||||
@NotEmpty(message = "测点编号必填")
|
||||
@TableField("STATION_CODE")
|
||||
private String stationCode;
|
||||
|
||||
|
|
@ -54,6 +56,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "测站编码(MCU)")
|
||||
@ApiModelProperty(value = "测站编码(MCU)", dataType = "java.lang.String")
|
||||
@Excel(name = "测站编码(MCU)")
|
||||
@NotEmpty(message = "测站编码(MCU)必填")
|
||||
@TableField("DEVICE_ID")
|
||||
private String deviceId;
|
||||
|
|
@ -63,6 +66,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "通道号")
|
||||
@ApiModelProperty(value = "通道号", dataType = "java.lang.Integer", required = true)
|
||||
@Excel(name = "通道号")
|
||||
@NotNull(message = "通道号必填")
|
||||
@Max(message = "通道号最大值 7", value = 7)
|
||||
@Min(message = "通道号最小值 0", value = 0)
|
||||
|
|
@ -72,9 +76,10 @@ public class DeviceInfo implements Serializable {
|
|||
/**
|
||||
* 温度率定系娄(K)
|
||||
*/
|
||||
@ApiParam(value = "温度率定系娄(K)")
|
||||
@ApiModelProperty(value = "温度率定系娄(K)", dataType = "java.math.BigDecimal", required = true)
|
||||
@NotNull(message = "温度率定系娄(K)必填")
|
||||
@ApiParam(value = "温度率定系娄(K)")
|
||||
@ApiModelProperty(value = "温度率定系娄(K)", dataType = "java.math.BigDecimal", required = true)
|
||||
@Excel(name = "温度率定系娄(K)")
|
||||
@NotNull(message = "温度率定系娄(K)必填")
|
||||
@TableField("TEMPERATURE_K")
|
||||
private BigDecimal temperatureK;
|
||||
|
||||
|
|
@ -83,6 +88,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "初始温度读数")
|
||||
@ApiModelProperty(value = "初始温度读数", dataType = "java.lang.Double", required = true)
|
||||
@Excel(name = "初始温度读数")
|
||||
@NotNull(message = "初始温度读数必填")
|
||||
@TableField("START_TEMPERATURE")
|
||||
private BigDecimal startTemperature;
|
||||
|
|
@ -90,9 +96,10 @@ public class DeviceInfo implements Serializable {
|
|||
/**
|
||||
* 率定系数(G)
|
||||
*/
|
||||
@ApiParam(value = "率定系数(G)")
|
||||
@ApiModelProperty(value = "率定系数(G)", dataType = "java.math.BigDecimal", required = true)
|
||||
@NotNull(message = "率定系数(G)必填")
|
||||
@ApiParam(value = "率定系数(G)")
|
||||
@ApiModelProperty(value = "率定系数(G)", dataType = "java.math.BigDecimal", required = true)
|
||||
@Excel(name = "率定系数(G)")
|
||||
@NotNull(message = "率定系数(G)必填")
|
||||
@TableField("CALIBRATION_COEFFICIENT")
|
||||
private BigDecimal calibrationCoefficient;
|
||||
|
||||
|
|
@ -101,6 +108,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "初始读数")
|
||||
@ApiModelProperty(value = "初始读数", notes = "单位是“模数”, 乘 1000 后开方得到频率值", dataType = "java.math.BigDecimal", required = true)
|
||||
@Excel(name = "初始读数")
|
||||
@NotNull(message = "初始读数必填")
|
||||
@TableField("INITIAL_READING")
|
||||
private BigDecimal initialReading;
|
||||
|
|
@ -110,6 +118,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "项目名称")
|
||||
@ApiModelProperty(value = "项目名称", dataType = "java.lang.String")
|
||||
@Excel(name = "工程或项目名称")
|
||||
@TableField("PROJECT_NAME")
|
||||
private String projectName;
|
||||
|
||||
|
|
@ -118,6 +127,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "备注")
|
||||
@ApiModelProperty(value = "备注", dataType = "java.lang.String")
|
||||
@Excel(name = "备注")
|
||||
@TableField("REMARK")
|
||||
private String remark;
|
||||
|
||||
|
|
@ -126,6 +136,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "监理工程师")
|
||||
@ApiModelProperty(value = "监理工程师", dataType = "java.lang.String")
|
||||
@Excel(name = "监理工程师")
|
||||
@TableField("SUPERVISOR")
|
||||
private String supervisor;
|
||||
|
||||
|
|
@ -160,6 +171,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "埋设示意图")
|
||||
@ApiModelProperty(value = "埋设示意图", dataType = "java.lang.String")
|
||||
@Excel(name = "埋设示意图说明")
|
||||
@TableField("SKETCH_MAP")
|
||||
private String sketchMap;
|
||||
|
||||
|
|
@ -169,6 +181,7 @@ public class DeviceInfo implements Serializable {
|
|||
@ApiParam(value = "日期")
|
||||
@ApiModelProperty(value = "日期", dataType = "java.util.Date")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Excel(name = "日期")
|
||||
@TableField("CREATE_DATE")
|
||||
private Date createDate;
|
||||
|
||||
|
|
@ -177,6 +190,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "埋设及填表人")
|
||||
@ApiModelProperty(value = "埋设及填表人", dataType = "java.lang.String")
|
||||
@Excel(name = "埋设及填表人")
|
||||
@TableField("BURIED_PERSONNEL")
|
||||
private String buriedPersonnel;
|
||||
|
||||
|
|
@ -185,6 +199,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "校验人")
|
||||
@ApiModelProperty(value = "校验人", dataType = "java.lang.String")
|
||||
@Excel(name = "校验人")
|
||||
@TableField("CHECK_PERSONNEL")
|
||||
private String checkPersonnel;
|
||||
|
||||
|
|
@ -193,6 +208,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "技术负责人")
|
||||
@ApiModelProperty(value = "技术负责人", dataType = "java.lang.String")
|
||||
@Excel(name = "技术负责人")
|
||||
@TableField("TECHNICAL_DIRECTOR")
|
||||
private String technicalDirector;
|
||||
|
||||
|
|
@ -201,6 +217,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "下游水位(m)")
|
||||
@ApiModelProperty(value = "下游水位(m)", dataType = "java.lang.Double")
|
||||
@Excel(name = "下游水位")
|
||||
@TableField("TAILWATER_LEVEL")
|
||||
private Double tailwaterLevel;
|
||||
|
||||
|
|
@ -209,22 +226,25 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "上游水位(m)")
|
||||
@ApiModelProperty(value = "上游水位(m)", dataType = "java.lang.Double")
|
||||
@Excel(name = "上游水位")
|
||||
@TableField("HEADWATER_LEVEL")
|
||||
private Double headwaterLevel;
|
||||
|
||||
/**
|
||||
* 天气(℃)
|
||||
* 天气
|
||||
*/
|
||||
@ApiParam(value = "天气(℃)")
|
||||
@ApiModelProperty(value = "天气(℃)", dataType = "java.lang.Double")
|
||||
@ApiParam(value = "天气")
|
||||
@ApiModelProperty(value = "天气", dataType = "java.lang.String")
|
||||
@Excel(name = "天气")
|
||||
@TableField("WEATHER")
|
||||
private Double weather;
|
||||
private String weather;
|
||||
|
||||
/**
|
||||
* 气压
|
||||
*/
|
||||
@ApiParam(value = "气压")
|
||||
@ApiModelProperty(value = "气压", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "气压")
|
||||
@TableField("AIR_PRESSURE")
|
||||
private BigDecimal airPressure;
|
||||
|
||||
|
|
@ -233,6 +253,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "气温")
|
||||
@ApiModelProperty(value = "气温", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "气温")
|
||||
@TableField("AIR_TEMPERATURE")
|
||||
private BigDecimal airTemperature;
|
||||
|
||||
|
|
@ -241,79 +262,89 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "埋设日期")
|
||||
@ApiModelProperty(value = "埋设日期", dataType = "java.util.Date")
|
||||
@Excel(name = "埋设日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@TableField("EMBEDDING_DATE")
|
||||
private Date embeddingDate;
|
||||
|
||||
/**
|
||||
* 埋设完毕读数
|
||||
* 埋设完毕读数(Hz,kHz)
|
||||
*/
|
||||
@ApiParam(value = "埋设完毕读数")
|
||||
@ApiModelProperty(value = "埋设完毕读数", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "埋设完毕读数(Hz,kHz)")
|
||||
@ApiModelProperty(value = "埋设完毕读数(Hz,kHz)", dataType = "java.lang.String")
|
||||
@Excel(name = "埋设完毕读数(Hz,kHz)")
|
||||
@TableField("EMBEDDING_FINISH_READING")
|
||||
private BigDecimal embeddingFinishReading;
|
||||
private String embeddingFinishReading;
|
||||
|
||||
/**
|
||||
* 零压读数
|
||||
* 零压读数(Hz,kHz)
|
||||
*/
|
||||
@ApiParam(value = "零压读数")
|
||||
@ApiModelProperty(value = "零压读数", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "零压读数(Hz,kHz)")
|
||||
@ApiModelProperty(value = "零压读数(Hz,kHz)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "零压读数(Hz,kHz)")
|
||||
@TableField("ZERO_PRESSURE_READINGS")
|
||||
private BigDecimal zeroPressureReadings;
|
||||
|
||||
/**
|
||||
* 就位后读数
|
||||
* 就位后读数(Hz,kHz)
|
||||
*/
|
||||
@ApiParam(value = "就位后读数")
|
||||
@ApiModelProperty(value = "就位后读数", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "就位后读数(Hz,kHz)")
|
||||
@ApiModelProperty(value = "就位后读数(Hz,kHz)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "就位后读数(Hz,kHz)")
|
||||
@TableField("END_READINGS")
|
||||
private BigDecimal endReadings;
|
||||
|
||||
/**
|
||||
* 入孔前读数
|
||||
* 入孔前读数(Hz,kHz)
|
||||
*/
|
||||
@ApiParam(value = "入孔前读数")
|
||||
@ApiModelProperty(value = "入孔前读数", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "入孔前读数(Hz,kHz)")
|
||||
@ApiModelProperty(value = "入孔前读数(Hz,kHz)", dataType = "java.lang.String")
|
||||
@Excel(name = "入孔前读数(Hz,kHz)")
|
||||
@TableField("START_READINGS")
|
||||
private BigDecimal startReadings;
|
||||
private String startReadings;
|
||||
|
||||
/**
|
||||
* 孔内水深
|
||||
*/
|
||||
@ApiParam(value = "孔内水深")
|
||||
@ApiModelProperty(value = "孔内水深", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "孔内水深")
|
||||
@TableField("DRAFT")
|
||||
private BigDecimal draft;
|
||||
|
||||
/**
|
||||
* 现场室内读数
|
||||
* 现场室内读数(Hz,kHz)
|
||||
*/
|
||||
@ApiParam(value = "现场室内读数")
|
||||
@ApiModelProperty(value = "现场室内读数", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "现场室内读数(Hz,kHz)")
|
||||
@ApiModelProperty(value = "现场室内读数(Hz,kHz)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "现场室内读数(Hz,kHz)")
|
||||
@TableField("READINGS")
|
||||
private BigDecimal readings;
|
||||
|
||||
/**
|
||||
* 大坝轴距
|
||||
* 坝轴距(m)
|
||||
*/
|
||||
@ApiParam(value = "大坝轴距")
|
||||
@ApiModelProperty(value = "大坝轴距", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "坝轴距(m)")
|
||||
@ApiModelProperty(value = "坝轴距(m)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "坝轴距(m)")
|
||||
@TableField("DAM_WHEELBASE")
|
||||
private BigDecimal damWheelbase;
|
||||
|
||||
/**
|
||||
* 柱号
|
||||
* 桩号(m)
|
||||
*/
|
||||
@ApiParam(value = "柱号")
|
||||
@ApiModelProperty(value = "柱号", dataType = "java.lang.String")
|
||||
@ApiParam(value = "桩号(m)")
|
||||
@ApiModelProperty(value = "桩号(m)", dataType = "java.lang.String")
|
||||
@Excel(name = "桩号(m)")
|
||||
@TableField("COLUMN_NO")
|
||||
private String columnNo;
|
||||
|
||||
/**
|
||||
* 埋设高程
|
||||
* 埋设高程(m)
|
||||
*/
|
||||
@ApiParam(value = "埋设高程")
|
||||
@ApiModelProperty(value = "埋设高程", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "埋设高程(m)")
|
||||
@ApiModelProperty(value = "埋设高程(m)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "埋设高程(m)")
|
||||
@TableField("EMBEDDING_ELEVATION")
|
||||
private BigDecimal embeddingElevation;
|
||||
|
||||
|
|
@ -322,14 +353,16 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "电缆长度标记")
|
||||
@ApiModelProperty(value = "电缆长度标记", dataType = "java.lang.String")
|
||||
@Excel(name = "电缆长度标记(m)")
|
||||
@TableField("CABLE_LENGTH_MARK")
|
||||
private String cableLengthMark;
|
||||
|
||||
/**
|
||||
* 电缆长度
|
||||
* 电缆长度(m)
|
||||
*/
|
||||
@ApiParam(value = "电缆长度")
|
||||
@ApiModelProperty(value = "电缆长度", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "电缆长度(m)")
|
||||
@ApiModelProperty(value = "电缆长度(m)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "电缆长度(m)")
|
||||
@TableField("CABLE_LENGTH")
|
||||
private BigDecimal cableLength;
|
||||
|
||||
|
|
@ -337,23 +370,26 @@ public class DeviceInfo implements Serializable {
|
|||
* 测头内阻
|
||||
*/
|
||||
@ApiParam(value = "测头内阻")
|
||||
@ApiModelProperty(value = "测头内阻", dataType = "java.math.BigDecimal")
|
||||
@ApiModelProperty(value = "测头内阻", dataType = "java.lang.String")
|
||||
@Excel(name = "测头内阻")
|
||||
@TableField("RESISTANCE")
|
||||
private BigDecimal resistance;
|
||||
private String resistance;
|
||||
|
||||
/**
|
||||
* 量程
|
||||
*/
|
||||
@ApiParam(value = "量程")
|
||||
@ApiModelProperty(value = "量程", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "量程")
|
||||
@TableField("RANGE")
|
||||
private BigDecimal range;
|
||||
|
||||
/**
|
||||
* 传感器系数
|
||||
* 传感器系数K(kpa/Hz,kHz)
|
||||
*/
|
||||
@ApiParam(value = "传感器系数")
|
||||
@ApiModelProperty(value = "传感器系数", dataType = "java.math.BigDecimal")
|
||||
@ApiParam(value = "传感器系数K(kpa/Hz,kHz)")
|
||||
@ApiModelProperty(value = "传感器系数K(kpa/Hz,kHz)", dataType = "java.math.BigDecimal")
|
||||
@Excel(name = "传感器系数K(kpa/Hz,kHz)")
|
||||
@TableField("SENSOR_COEFFICIENT")
|
||||
private BigDecimal sensorCoefficient;
|
||||
|
||||
|
|
@ -362,6 +398,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "生产厂家")
|
||||
@ApiModelProperty(value = "生产厂家", dataType = "java.lang.String")
|
||||
@Excel(name = "生产厂家")
|
||||
@TableField("MANUFACTURER")
|
||||
private String manufacturer;
|
||||
|
||||
|
|
@ -370,6 +407,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "测头编号")
|
||||
@ApiModelProperty(value = "测头编号", dataType = "java.lang.String")
|
||||
@Excel(name = "测头编号")
|
||||
@TableField("MEASURING_PROBE_NO")
|
||||
private String measuringProbeNo;
|
||||
|
||||
|
|
@ -378,6 +416,7 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "稳定水位")
|
||||
@ApiModelProperty(value = "稳定水位", dataType = "java.lang.Double")
|
||||
@Excel(name = "稳定水位")
|
||||
@TableField("STEADY_WATER_LEVEL")
|
||||
private Double steadyWaterLevel;
|
||||
|
||||
|
|
@ -386,22 +425,25 @@ public class DeviceInfo implements Serializable {
|
|||
*/
|
||||
@ApiParam(value = "初见水位")
|
||||
@ApiModelProperty(value = "初见水位", dataType = "java.lang.Double")
|
||||
@Excel(name = "初见水位")
|
||||
@TableField("INITIAL_WATER_LEVEL")
|
||||
private Double initialWaterLevel;
|
||||
|
||||
/**
|
||||
* 钻孔直径
|
||||
*/
|
||||
@ApiParam(value = "钻孔直径")
|
||||
@ApiModelProperty(value = "钻孔直径", dataType = "java.lang.String")
|
||||
@ApiParam(value = "钻孔直径(mm)")
|
||||
@ApiModelProperty(value = "钻孔直径(mm)", dataType = "java.lang.String")
|
||||
@Excel(name = "钻孔直径(mm)")
|
||||
@TableField("DRILLING_SIZE")
|
||||
private String drillingSize;
|
||||
|
||||
/**
|
||||
* 转孔编号
|
||||
* 钻孔编号
|
||||
*/
|
||||
@ApiParam(value = "转孔编号")
|
||||
@ApiModelProperty(value = "转孔编号", dataType = "java.lang.String")
|
||||
@ApiParam(value = "钻孔编号")
|
||||
@ApiModelProperty(value = "钻孔编号", dataType = "java.lang.String")
|
||||
@Excel(name = "钻孔编号")
|
||||
@TableField("DRILLING_NO")
|
||||
private String drillingNo;
|
||||
|
||||
|
|
|
|||
|
|
@ -94,11 +94,11 @@ public class DeviceDataVo {
|
|||
|
||||
|
||||
/**
|
||||
* 测头编码
|
||||
* 测点编号
|
||||
*/
|
||||
@ApiParam(value = "测头编码")
|
||||
@ApiModelProperty(value = "测头编码", dataType = "java.lang.String", required = true)
|
||||
@NotEmpty(message = "测头编码必填")
|
||||
@ApiParam(value = "测点编号")
|
||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String", required = true)
|
||||
@NotEmpty(message = "测点编号必填")
|
||||
private String stationCode;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.whdc.zhdbaqapi.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 李赛
|
||||
* @date 2022-07-22 11:42
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true) // chain = true 实现链式调用
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性
|
||||
public class DeviceInfoImpVo {
|
||||
@ApiModelProperty("成功读取记录条数")
|
||||
private int load;
|
||||
|
||||
@ApiModelProperty("成功入库记录条数")
|
||||
private int success;
|
||||
|
||||
@ApiModelProperty("入库失败记录条数")
|
||||
private int fail;
|
||||
|
||||
@ApiModelProperty("入库失败记录")
|
||||
private List<DeviceInfo> err;
|
||||
|
||||
@ApiModelProperty("消息")
|
||||
private String msg;
|
||||
}
|
||||
|
|
@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
||||
import com.whdc.zhdbaqapi.model.vo.DeviceInfoImpVo;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -39,4 +41,12 @@ public interface IDeviceInfoService extends IService<DeviceInfo> {
|
|||
* @return
|
||||
*/
|
||||
IPage<DeviceInfo> page(FindDeviceDto findDto);
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
DeviceInfoImpVo imp(InputStream file);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class DeviceDataServiceImpl extends ServiceImpl<DeviceDataMapper, DeviceD
|
|||
List<CklatRecord> rows = getRemoteData(deviceId, di.getChannelNum(), lasttm);
|
||||
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
log.debug("没有取到数据 " + deviceId);
|
||||
log.debug("没有取到数据 " + deviceId + ", " + di.getChannelNum());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,25 @@
|
|||
package com.whdc.zhdbaqapi.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.whdc.zhdbaqapi.constant.Constants;
|
||||
import com.whdc.zhdbaqapi.exception.MyException;
|
||||
import com.whdc.zhdbaqapi.mapper.DeviceInfoMapper;
|
||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
||||
import com.whdc.zhdbaqapi.model.vo.DeviceInfoImpVo;
|
||||
import com.whdc.zhdbaqapi.service.IDeviceInfoService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author 李赛
|
||||
|
|
@ -30,6 +36,15 @@ public class DeviceInfoServiceimpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean restore(Integer id) {
|
||||
DeviceInfo entity = baseMapper.selectById(id);
|
||||
|
||||
if (entity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (baseMapper.checkValidStationCode(entity.getStationCode()) != null) {
|
||||
throw new MyException(entity.getStationCode() + " 已被其他有效数据使用,不能恢复");
|
||||
}
|
||||
|
||||
entity.setDel(0);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
|
@ -50,6 +65,71 @@ public class DeviceInfoServiceimpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|||
return baseMapper.page(findDto.getPage(), findDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DeviceInfoImpVo imp(InputStream file) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
try {
|
||||
List<DeviceInfo> list = ExcelImportUtil.importExcel(file, DeviceInfo.class, params);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return new DeviceInfoImpVo().setLoad(0).setSuccess(0).setFail(0).setMsg("没有读取有有效数据");
|
||||
}
|
||||
|
||||
List<DeviceInfo> err = new ArrayList<>();
|
||||
List<DeviceInfo> impList = new ArrayList<>();
|
||||
Set<String> scs = new HashSet<>();
|
||||
Map<String, DeviceInfo> chkMap = new HashMap<>();
|
||||
|
||||
for (DeviceInfo di : list) {
|
||||
if (StringUtils.isBlank(di.getStationCode())) {
|
||||
err.add(di);
|
||||
} else {
|
||||
scs.add(di.getStationCode());
|
||||
}
|
||||
}
|
||||
|
||||
if (scs.isEmpty() || err.size() == list.size()) {
|
||||
return new DeviceInfoImpVo().setLoad(list.size()).setSuccess(0).setFail(err.size()).setErr(err).setMsg("没有读取到有效的测点编号");
|
||||
}
|
||||
|
||||
if (scs.size() != list.size()) {
|
||||
return new DeviceInfoImpVo().setLoad(list.size()).setSuccess(0).setFail(err.size()).setErr(err).setMsg("有重复的测点编号,请检查后再导入");
|
||||
}
|
||||
|
||||
List<DeviceInfo> chkscs = baseMapper.listBySC(scs);
|
||||
if (chkscs.size() == scs.size()) {
|
||||
return new DeviceInfoImpVo().setLoad(list.size()).setSuccess(0).setFail(err.size()).setErr(err).setMsg("测点编号全部已存在");
|
||||
}
|
||||
|
||||
for (DeviceInfo dbdi : chkscs) {
|
||||
chkMap.put(dbdi.getStationCode(), dbdi);
|
||||
}
|
||||
|
||||
for (DeviceInfo di : list) {
|
||||
if (chkMap.containsKey(di.getStationCode())) {
|
||||
err.add(di);
|
||||
} else {
|
||||
impList.add(di);
|
||||
}
|
||||
}
|
||||
|
||||
if (impList.isEmpty()) {
|
||||
return new DeviceInfoImpVo().setLoad(list.size()).setSuccess(0).setFail(err.size()).setErr(err).setMsg("测点编号全部已存在");
|
||||
}
|
||||
|
||||
if (super.saveBatch(impList)) {
|
||||
return new DeviceInfoImpVo().setLoad(list.size()).setSuccess(impList.size()).setFail(err.size()).setErr(err).setMsg("成功");
|
||||
} else {
|
||||
return new DeviceInfoImpVo().setLoad(list.size()).setSuccess(0).setFail(err.size()).setErr(err).setMsg("失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new MyException("导入异常!" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(Constants.CACHE_NAME)
|
||||
public boolean save(DeviceInfo entity) {
|
||||
|
|
|
|||
|
|
@ -32,4 +32,18 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listBySC" resultType="com.whdc.zhdbaqapi.model.entity.DeviceInfo">
|
||||
SELECT ID, STATION_CODE FROM DEVICE_INFO
|
||||
WHERE DEL = 0
|
||||
AND STATION_CODE IN
|
||||
<foreach collection="scs" item="sc" index="index" open="(" close=")" separator=",">
|
||||
#{sc}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="checkValidStationCode" resultType="com.whdc.zhdbaqapi.model.entity.DeviceInfo">
|
||||
SELECT ID, STATION_CODE FROM DEVICE_INFO
|
||||
WHERE DEL = 0
|
||||
AND STATION_CODE = #{stationCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue