添加projectId,并修改bug

This commit is contained in:
2025-01-09 18:19:16 +08:00
parent 83ba7cd354
commit da663fff45
21 changed files with 133 additions and 40 deletions

View File

@ -68,5 +68,5 @@ public interface IDeviceRealtimedataMeteorologyService extends IService<DeviceRe
* 获取最新的一条气象数据
* @return
*/
public Map<String,Object> getLatestWeatherRealtimedata();
public Map<String,Object> getLatestWeatherRealtimedata(String deviceEncoding);
}

View File

@ -107,31 +107,33 @@ public class DeviceRealtimedataMeteorologyServiceImpl extends ServiceImpl<Device
* @return
*/
@Override
public Map<String,Object> getLatestWeatherRealtimedata(){
public Map<String,Object> getLatestWeatherRealtimedata(String deviceEncoding){
Map<String,Object> rest= new HashMap<>();
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.orderByDesc("real_time");
queryWrapper.eq("device_id",deviceEncoding);
queryWrapper.last("limit 1");
DeviceRealtimedataMeteorology meteorology = deviceRealtimedataMeteorologyMapper.selectOne(queryWrapper);
System.err.println(meteorology.getDeviceId()+"最新一条气象数据,时间:"+meteorology.getRealTime());
List<DeviceProperties> devicePropertiesList = new ArrayList<>();
rest.put("props",devicePropertiesList);
if(Objects.isNull(meteorology)){
return rest;
}
devicePropertiesList.add(DeviceProperties.builder().name("空气温度").value(meteorology.getAirTemp().toString()).unit("°C").build());
devicePropertiesList.add(DeviceProperties.builder().name("空气湿度").value(meteorology.getAirHumi().toString()).unit("%").build());
devicePropertiesList.add(DeviceProperties.builder().name("风速").value(meteorology.getWindSpeed().toString()).unit("m/s").build());
devicePropertiesList.add(DeviceProperties.builder().name("空气温度").value(meteorology.getAirTemp()==null?"":meteorology.getAirTemp().toString()).unit("°C").build());
devicePropertiesList.add(DeviceProperties.builder().name("空气湿度").value(meteorology.getAirHumi()==null?"":meteorology.getAirHumi().toString()).unit("%").build());
devicePropertiesList.add(DeviceProperties.builder().name("风速").value(meteorology.getWindSpeed()==null?"":meteorology.getWindSpeed().toString()).unit("m/s").build());
devicePropertiesList.add(DeviceProperties.builder().name("风向").value(windDirMap(meteorology.getWindDir())).unit("").build());
devicePropertiesList.add(DeviceProperties.builder().name("大气压力").value(meteorology.getAirPre().toString()).unit("hPa").build());
devicePropertiesList.add(DeviceProperties.builder().name("光照度").value(meteorology.getGuangzhao().toString()).unit("lx").build());
devicePropertiesList.add(DeviceProperties.builder().name("光合有效辐射").value(meteorology.getFushe().toString()).unit("Lux").build());
devicePropertiesList.add(DeviceProperties.builder().name("累积雨量").value(meteorology.getSumRain().toString()).unit("mm").build());
devicePropertiesList.add(DeviceProperties.builder().name("瞬时雨量").value(meteorology.getInsRain().toString()).unit("mm").build());
devicePropertiesList.add(DeviceProperties.builder().name("日雨量").value(meteorology.getDayRain().toString()).unit("mm").build());
devicePropertiesList.add(DeviceProperties.builder().name("蒸发量").value(meteorology.getZhengfa().toString()).unit("t/h").build());
devicePropertiesList.add(DeviceProperties.builder().name("土壤温度").value(meteorology.getSoilTemp().toString()).unit("°C").build());
devicePropertiesList.add(DeviceProperties.builder().name("土壤湿度").value(meteorology.getSoilHumi().toString()).unit("%").build());
devicePropertiesList.add(DeviceProperties.builder().name("大气压力").value(meteorology.getAirPre()==null?"":meteorology.getAirPre().toString()).unit("hPa").build());
devicePropertiesList.add(DeviceProperties.builder().name("光照度").value(meteorology.getGuangzhao()==null?"":meteorology.getGuangzhao().toString()).unit("lx").build());
devicePropertiesList.add(DeviceProperties.builder().name("光合有效辐射").value(meteorology.getFushe()==null?"":meteorology.getFushe().toString()).unit("Lux").build());
devicePropertiesList.add(DeviceProperties.builder().name("累积雨量").value(meteorology.getSumRain()==null?"":meteorology.getSumRain().toString()).unit("mm").build());
devicePropertiesList.add(DeviceProperties.builder().name("瞬时雨量").value(meteorology.getInsRain()==null?"":meteorology.getInsRain().toString()).unit("mm").build());
devicePropertiesList.add(DeviceProperties.builder().name("日雨量").value(meteorology.getDayRain()==null?"":meteorology.getDayRain().toString()).unit("mm").build());
devicePropertiesList.add(DeviceProperties.builder().name("蒸发量").value(meteorology.getZhengfa()==null?"":meteorology.getZhengfa().toString()).unit("t/h").build());
devicePropertiesList.add(DeviceProperties.builder().name("土壤温度").value(meteorology.getSoilTemp()==null?"":meteorology.getSoilTemp().toString()).unit("°C").build());
devicePropertiesList.add(DeviceProperties.builder().name("土壤湿度").value(meteorology.getSoilHumi()==null?"":meteorology.getSoilHumi().toString()).unit("%").build());
Map<String,Object> info=new HashMap<>();
info.put("deviceEncoding", meteorology.getDeviceId());

View File

@ -93,4 +93,9 @@ private static final long serialVersionUID = 1L;
@ApiModelProperty("状态1在线0离线")
private Long status;
/** projectId */
@Excel(name = "projectId")
@ApiModelProperty("projectId")
private String projectId;
}

View File

@ -89,4 +89,9 @@ private static final long serialVersionUID = 1L;
/** 删除标志0代表存在2代表删除 */
private Integer delFlag;
/** 项目id */
@Excel(name = "项目id")
@ApiModelProperty("项目id")
private Long projectId;
}

View File

@ -99,4 +99,9 @@ private static final long serialVersionUID = 1L;
@ApiModelProperty("状态1在线0离线")
private Long status;
/** 项目id */
@Excel(name = "项目id")
@ApiModelProperty("项目id")
private Long projectId;
}

View File

@ -126,4 +126,11 @@ public class DeviceInformationMonitor extends BaseEntity
@ApiModelProperty("accessToken")
private String accessToken;
/** projectId */
@Excel(name = "projectId")
@ApiModelProperty("projectId")
private Long projectId;
}

View File

@ -90,4 +90,9 @@ private static final long serialVersionUID = 1L;
@ApiModelProperty("状态1在线0离线")
private Long status;
/** 项目id */
@Excel(name = "项目id")
@ApiModelProperty("项目id")
private Long projectId;
}

View File

@ -88,4 +88,9 @@ private static final long serialVersionUID = 1L;
@ApiModelProperty("状态1在线0离线")
private Long status;
/** 项目id */
@Excel(name = "项目id")
@ApiModelProperty("项目id")
private Long projectId;
}

View File

@ -34,13 +34,26 @@ public class DeviceInformationManager {
/**
* 获取所有设备
*/
public Map<String,Object> getAllDeviceCount() {
List<DeviceInformationMeteorology> meteorologieList = meteorologyMapper.selectDeviceInformationMeteorologyList(null);
List<DeviceInformationMiaoqing> miaoqingList = miaoqingMapper.selectDeviceInformationMiaoqingList(null);
List<DeviceInformationMoisture> moistureList= moistureMapper.selectDeviceInformationMoistureList(null);
List<DeviceInformationMonitor> monitorList = monitorMapper.selectDeviceInformationMonitorList(null);
List<DeviceInformationTargetpests> targetpestList= targetpestsMapper.selectDeviceInformationTargetpestsList(null);
List<DeviceInformationWorms> wormList = wormsMapper.selectDeviceInformationWormsList(null);
public Map<String,Object> getAllDeviceCount(Long projectId) {
System.err.println("projectId:"+projectId);
DeviceInformationMeteorology informationMeteorology=new DeviceInformationMeteorology();
informationMeteorology.setProjectId(String.valueOf(projectId));
DeviceInformationMiaoqing informationMiaoqing=new DeviceInformationMiaoqing();
informationMiaoqing.setProjectId(projectId);
DeviceInformationMoisture informationMoisture=new DeviceInformationMoisture();
informationMoisture.setProjectId(projectId);
DeviceInformationMonitor informationMonitor=new DeviceInformationMonitor();
informationMonitor.setProjectId(projectId);
DeviceInformationTargetpests informationTargetpests=new DeviceInformationTargetpests();
informationTargetpests.setProjectId(projectId);
DeviceInformationWorms informationWorms=new DeviceInformationWorms();
informationWorms.setProjectId(projectId);
List<DeviceInformationMeteorology> meteorologieList = meteorologyMapper.selectDeviceInformationMeteorologyList(informationMeteorology);
List<DeviceInformationMiaoqing> miaoqingList = miaoqingMapper.selectDeviceInformationMiaoqingList(informationMiaoqing);
List<DeviceInformationMoisture> moistureList= moistureMapper.selectDeviceInformationMoistureList(informationMoisture);
List<DeviceInformationMonitor> monitorList = monitorMapper.selectDeviceInformationMonitorList(informationMonitor);
List<DeviceInformationTargetpests> targetpestList= targetpestsMapper.selectDeviceInformationTargetpestsList(informationTargetpests);
List<DeviceInformationWorms> wormList = wormsMapper.selectDeviceInformationWormsList(informationWorms);
Map<String,Object> resp =new HashMap<>();
resp.put("meteorologieTotal",meteorologieList.size());

View File

@ -22,10 +22,11 @@
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectDeviceInformationMeteorologyVo">
select id, name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by from iot_device_information_meteorology
select id, name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by,project_id from iot_device_information_meteorology
</sql>
<select id="selectDeviceInformationMeteorologyList" parameterType="DeviceInformationMeteorology" resultMap="DeviceInformationMeteorologyResult">
@ -42,6 +43,7 @@
<if test="nameProject != null and nameProject != ''"> and name_project = #{nameProject}</if>
<if test="constructionYear != null "> and construction_year = #{constructionYear}</if>
<if test="dockingMethod != null and dockingMethod != ''"> and docking_method = #{dockingMethod}</if>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
</where>
</select>
@ -69,6 +71,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -87,6 +90,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
@ -109,6 +113,7 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>

View File

@ -22,10 +22,11 @@
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectDeviceInformationMiaoqingVo">
select id, name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by from iot_device_information_miaoQing
select id, name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by,project_id from iot_device_information_miaoQing
</sql>
<select id="selectDeviceInformationMiaoqingList" parameterType="DeviceInformationMiaoqing" resultMap="DeviceInformationMiaoqingResult">
@ -42,6 +43,7 @@
<if test="nameProject != null and nameProject != ''"> and name_project = #{nameProject}</if>
<if test="constructionYear != null "> and construction_year = #{constructionYear}</if>
<if test="dockingMethod != null and dockingMethod != ''"> and docking_method = #{dockingMethod}</if>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
</where>
</select>
@ -69,6 +71,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -87,6 +90,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
@ -109,6 +113,7 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>

View File

@ -23,10 +23,11 @@
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectDeviceInformationMoistureVo">
select id, name, products_name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by from iot_device_information_moisture
select id, name, products_name, device_brand, device_type, device_encoding, type, longitude, latitude, installation_location, name_project, construction_year, docking_method, del_flag, create_time, create_by, update_time, update_by, project_id from iot_device_information_moisture
</sql>
<select id="selectDeviceInformationMoistureList" parameterType="DeviceInformationMoisture" resultMap="DeviceInformationMoistureResult">
@ -44,6 +45,7 @@
<if test="nameProject != null and nameProject != ''"> and name_project = #{nameProject}</if>
<if test="constructionYear != null "> and construction_year = #{constructionYear}</if>
<if test="dockingMethod != null and dockingMethod != ''"> and docking_method = #{dockingMethod}</if>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
</where>
</select>
@ -72,6 +74,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -91,6 +94,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
@ -114,6 +118,7 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>

View File

@ -27,10 +27,11 @@
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="playUrl" column="play_url" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectDeviceInformationMonitorVo">
select id, name, device_encoding, type, longitude, latitude, installation_location, device_brand, device_type, name_project, construction_year, affiliation_township, management_leader, management_leader_telephone, management_unit, remarks_information, del_flag, create_time, create_by, update_time, update_by, play_url from iot_device_information_monitor
select id, name, device_encoding, type, longitude, latitude, installation_location, device_brand, device_type, name_project, construction_year, affiliation_township, management_leader, management_leader_telephone, management_unit, remarks_information, del_flag, create_time, create_by, update_time, update_by, play_url,project_id from iot_device_information_monitor
</sql>
<select id="selectDeviceInformationMonitorList" parameterType="DeviceInformationMonitor" resultMap="DeviceInformationMonitorResult">
@ -52,6 +53,7 @@
<if test="managementUnit != null and managementUnit != ''"> and management_unit = #{managementUnit}</if>
<if test="remarksInformation != null and remarksInformation != ''"> and remarks_information = #{remarksInformation}</if>
<if test="playUrl != null and playUrl != ''"> and play_url = #{playUrl}</if>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
</where>
</select>
@ -84,6 +86,7 @@
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="playUrl != null">play_url,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -107,6 +110,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="playUrl != null">#{playUrl},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
@ -134,6 +138,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="playUrl != null">play_url = #{playUrl},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>

View File

@ -22,10 +22,11 @@
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="name" column="name" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectDeviceInformationTargetpestsVo">
select id, device_brand, type, device_type, power_supply, device_encoding, address_code, installation_location, longitude, latitude, docking_method, del_flag, create_time, create_by, update_time, update_by, name from iot_device_information_targetPests
select id, device_brand, type, device_type, power_supply, device_encoding, address_code, installation_location, longitude, latitude, docking_method, del_flag, create_time, create_by, update_time, update_by, name,project_id from iot_device_information_targetPests
</sql>
<select id="selectDeviceInformationTargetpestsList" parameterType="DeviceInformationTargetpests" resultMap="DeviceInformationTargetpestsResult">
@ -42,6 +43,7 @@
<if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
<if test="dockingMethod != null and dockingMethod != ''"> and docking_method = #{dockingMethod}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
</where>
</select>
@ -69,6 +71,7 @@
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="name != null">name,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceBrand != null">#{deviceBrand},</if>
@ -87,6 +90,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="name != null">#{name},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
@ -109,6 +113,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="name != null">name = #{name},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>

View File

@ -21,6 +21,7 @@
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectDeviceInformationWormsVo">
@ -40,6 +41,7 @@
<if test="nameProject != null and nameProject != ''"> and name_project = #{nameProject}</if>
<if test="constructionYear != null "> and construction_year = #{constructionYear}</if>
<if test="dockingMethod != null and dockingMethod != ''"> and docking_method = #{dockingMethod}</if>
<if test="projectId != null and projectId != ''"> and project_id = #{projectId}</if>
</where>
</select>
@ -66,6 +68,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -83,6 +86,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
@ -104,6 +108,7 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>