From 9059261b4d9745a7ac721397844a409342f18946 Mon Sep 17 00:00:00 2001 From: XMnhwj_BackTechnologyDevelopment <3512363680@qq.com> Date: Tue, 9 May 2023 17:23:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?2023-05-09=2017:21:52=20=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A4=A7=E5=B1=8F=E7=9A=84=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 4 +- .../psdc/entity/PsdcDevicePowerHdata96.java | 216 ++++++++++++++++++ .../psdc/entity/res/PsdcDevicePowerRes.java | 30 +++ .../entity/res/PsdcThermometerDataRes.java | 45 ++++ .../com/psdc/mapper/PsdcControlLogMapper.java | 1 + .../com/psdc/mapper/PsdcDeviceMapper.java | 10 +- .../mapper/PsdcDevicePowerHdata96Mapper.java | 23 ++ .../psdc/mapper/PsdcElectricHtdataMapper.java | 9 +- .../psdc/mapper/PsdcElectricRtdataMapper.java | 3 +- .../mapper/PsdcThermometerHtdataMapper.java | 13 +- .../mapper/PsdcThermometerRtdataMapper.java | 10 +- .../IPsdcThermometerHtdataService.java | 23 ++ .../PsdcThermometerHtdataServiceImpl.java | 87 +++++++ .../mapper/business/PsdcDeviceMapper.xml | 14 ++ .../business/PsdcDevicePowerHdata96Mapper.xml | 123 ++++++++++ .../business/PsdcElectricHtdataMapper.xml | 12 + .../business/PsdcElectricRtdataMapper.xml | 14 +- .../business/PsdcThermometerHtdataMapper.xml | 28 ++- .../business/PsdcThermometerRtdataMapper.xml | 25 +- .../controller/control/ManualControl.java | 2 +- .../java/com/psdc/controller/index/Index.java | 30 +++ 21 files changed, 699 insertions(+), 23 deletions(-) create mode 100644 psdc-business/src/main/java/com/psdc/entity/PsdcDevicePowerHdata96.java create mode 100644 psdc-business/src/main/java/com/psdc/entity/res/PsdcDevicePowerRes.java create mode 100644 psdc-business/src/main/java/com/psdc/entity/res/PsdcThermometerDataRes.java create mode 100644 psdc-business/src/main/java/com/psdc/mapper/PsdcDevicePowerHdata96Mapper.java create mode 100644 psdc-business/src/main/java/com/psdc/service/IPsdcThermometerHtdataService.java create mode 100644 psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java create mode 100644 psdc-business/src/main/resources/mapper/business/PsdcDevicePowerHdata96Mapper.xml diff --git a/psdc-admin/src/main/resources/application-dev.yml b/psdc-admin/src/main/resources/application-dev.yml index d4ac1c3..c75ccfb 100644 --- a/psdc-admin/src/main/resources/application-dev.yml +++ b/psdc-admin/src/main/resources/application-dev.yml @@ -76,7 +76,7 @@ spring: # redis 配置 redis: # 地址 - host: 127.0.0.1 + host: 192.168.10.99 # 端口,默认为6379 port: 6379 # 数据库索引 @@ -139,7 +139,7 @@ mqtt: #QOS等级 0, 1, 2 qos: 1 #客户端id 必须唯一 - clientId: psdc-dev + clientId: psdc-dev1234 #连接超时,默认30000 timeOut: 10 #心跳间隔时间,默认3000 diff --git a/psdc-business/src/main/java/com/psdc/entity/PsdcDevicePowerHdata96.java b/psdc-business/src/main/java/com/psdc/entity/PsdcDevicePowerHdata96.java new file mode 100644 index 0000000..2bc516e --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/entity/PsdcDevicePowerHdata96.java @@ -0,0 +1,216 @@ +package com.psdc.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + + /** + * 用户下属设备功率96点表; + * @author : Stone + * @date : 2023-5-9 + */ + @Data + @AllArgsConstructor + @NoArgsConstructor +public class PsdcDevicePowerHdata96 implements Serializable,Cloneable { + + private Integer userId; + + private Integer deviceId; + + private String samDate; + + private Double val1; + + private Double val2; + + private Double val3; + + private Double val4; + + private Double val5; + + private Double val6; + + private Double val7; + + private Double val8; + + private Double val9; + + private Double val10; + + private Double val11; + + private Double val12; + + private Double val13; + + private Double val14; + + private Double val15; + + private Double val16; + + private Double val17; + + private Double val18; + + private Double val19; + + private Double val20; + + private Double val21; + + private Double val22; + + private Double val23; + + private Double val24; + + private Double val25; + + private Double val26; + + private Double val27; + + private Double val28; + + private Double val29; + + private Double val30; + + private Double val31; + + private Double val32; + + private Double val33; + + private Double val34; + + private Double val35; + + private Double val36; + + private Double val37; + + private Double val38; + + private Double val39; + + private Double val40; + + private Double val41; + + private Double val42; + + private Double val43; + + private Double val44; + + private Double val45; + + private Double val46; + + private Double val47; + + private Double val48; + + private Double val49; + + private Double val50; + + private Double val51; + + private Double val52; + + private Double val53; + + private Double val54; + + private Double val55; + + private Double val56; + + private Double val57; + + private Double val58; + + private Double val59; + + private Double val60; + + private Double val61; + + private Double val62; + + private Double val63; + + private Double val64; + + private Double val65; + + private Double val66; + + private Double val67; + + private Double val68; + + private Double val69; + + private Double val70; + + private Double val71; + + private Double val72; + + private Double val73; + + private Double val74; + + private Double val75; + + private Double val76; + + private Double val77; + + private Double val78; + + private Double val79; + + private Double val80; + + private Double val81; + + private Double val82; + + private Double val83; + + private Double val84; + + private Double val85; + + private Double val86; + + private Double val87; + + private Double val88; + + private Double val89; + + private Double val90; + + private Double val91; + + private Double val92; + + private Double val93; + + private Double val94; + + private Double val95; + + private Double val96; + } \ No newline at end of file diff --git a/psdc-business/src/main/java/com/psdc/entity/res/PsdcDevicePowerRes.java b/psdc-business/src/main/java/com/psdc/entity/res/PsdcDevicePowerRes.java new file mode 100644 index 0000000..bb88ae7 --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/entity/res/PsdcDevicePowerRes.java @@ -0,0 +1,30 @@ +package com.psdc.entity.res; + +import com.psdc.entity.PsdcDevicePowerHdata96; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author:戴仕崑 + * @Project:psdc + * @Filename:PsdcDevicePowerRes + * @Date:2023/5/9 16:20 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PsdcDevicePowerRes { + + /** + * 总有功功率 + */ + private Double totp; + /** + * 当前总有功电能 + */ + private Double totwh; + + PsdcDevicePowerHdata96 todayUsePowers; +} diff --git a/psdc-business/src/main/java/com/psdc/entity/res/PsdcThermometerDataRes.java b/psdc-business/src/main/java/com/psdc/entity/res/PsdcThermometerDataRes.java new file mode 100644 index 0000000..c423868 --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/entity/res/PsdcThermometerDataRes.java @@ -0,0 +1,45 @@ +package com.psdc.entity.res; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Author:戴仕崑 + * @Project:psdc + * @Filename:PsdcThermometerDataRes + * @Date:2023/5/9 11:30 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PsdcThermometerDataRes { + + /** 设备id */ + private Integer deviceId ; + /** 设备名称 */ + private String deviceName ; + /** 设备运行状态:1-开启,2-关闭 */ + private Integer deviceRunStatus ; + /** 实时温度 */ + private Double thermometerValue ; + /** 目前实时进水温度 */ + private Double thermometerValueIn ; + /** 目前实时出水温度 */ + private Double thermometerValueOut ; + + /** 当天历史温度集合 */ + private List<Double> tempTodayList ; + /** 当天历史进水温度集合 */ + private List<Double> tempInTodayList ; + /** 当天历史出水温度集合 */ + private List<Double> tempOutTodayList ; + /** 当天记录时间轴 */ + private List<String> timeList ; + /** 今日能耗统计量 */ + private Double todayUseEnergy; + +} diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcControlLogMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcControlLogMapper.java index 4fb398e..7e693ba 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcControlLogMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcControlLogMapper.java @@ -2,6 +2,7 @@ package com.psdc.mapper; import com.psdc.entity.PsdcControlLog; import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; import java.util.List; diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java index 3359a61..dd27688 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java @@ -6,14 +6,16 @@ import com.psdc.entity.PsdcDevice; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Repository; - /** +/** * 设备信息表;(psdc_device)表数据库访问层 * @author : http://www.chiner.pro * @date : 2023-4-23 */ @Mapper +@Repository public interface PsdcDeviceMapper{ /** * 通过ID查询单条数据 @@ -22,6 +24,12 @@ public interface PsdcDeviceMapper{ * @return 实例对象 */ PsdcDevice queryById(Integer deviceId); + + + List<Integer> selMyWorkDevices(@Param(value = "devType") Integer devType, + @Param(value = "userId") Long userId); + + /** * 分页查询指定行数据 * diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcDevicePowerHdata96Mapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcDevicePowerHdata96Mapper.java new file mode 100644 index 0000000..be59595 --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcDevicePowerHdata96Mapper.java @@ -0,0 +1,23 @@ +package com.psdc.mapper; + +import com.psdc.entity.PsdcDevicePowerHdata96; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +/** + * @Author:戴仕崑 + * @Project:psdc + * @Filename:PsdcDevicePowerHdata96Mapper + * @Date:2023/5/9 16:27 + * @Version 1.0 + */ +@Mapper +@Repository +public interface PsdcDevicePowerHdata96Mapper { + + PsdcDevicePowerHdata96 queryById(@Param(value = "userId") Long userId, + @Param(value = "deviceId") Integer deviceId, + @Param(value = "samDate") String samDate); + +} diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricHtdataMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricHtdataMapper.java index aad75fe..0fcbb0a 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricHtdataMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricHtdataMapper.java @@ -18,10 +18,15 @@ public interface PsdcElectricHtdataMapper{ /** * 通过ID查询单条数据 * - * @param electricRtdataId 主键 + * @param electricHtdataId 主键 * @return 实例对象 */ PsdcElectricHtdata queryById(Integer electricHtdataId); + + Double selTodayUseEnergy(@Param(value = "deviceId") Integer deviceId, + @Param(value = "updateTime") String updateTime); + + /** * 分页查询指定行数据 * @@ -54,7 +59,7 @@ public interface PsdcElectricHtdataMapper{ /** * 通过主键删除数据 * - * @param electricRtdataId 主键 + * @param electricHtdataId 主键 * @return 影响行数 */ int deleteById(Integer electricHtdataId); diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricRtdataMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricRtdataMapper.java index eaceb43..3912642 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricRtdataMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcElectricRtdataMapper.java @@ -3,6 +3,7 @@ package com.psdc.mapper; import java.util.List; import com.psdc.entity.PsdcElectricRtdata; +import com.psdc.entity.res.PsdcDevicePowerRes; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; @@ -21,7 +22,7 @@ public interface PsdcElectricRtdataMapper{ * @param electricRtdataId 主键 * @return 实例对象 */ - PsdcElectricRtdata queryById(Integer electricRtdataId); + PsdcDevicePowerRes queryById(@Param("electricRtdataId") Integer electricRtdataId); /** * 分页查询指定行数据 * diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerHtdataMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerHtdataMapper.java index b487438..1d75f7e 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerHtdataMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerHtdataMapper.java @@ -6,14 +6,16 @@ import com.psdc.entity.PsdcThermometerHtdata; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Repository; - /** +/** * 温度历史数据;(psdc_thermometer_htdata)表数据库访问层 * @author : http://www.chiner.pro * @date : 2023-4-23 */ @Mapper +@Repository public interface PsdcThermometerHtdataMapper{ /** * 通过ID查询单条数据 @@ -30,6 +32,15 @@ public interface PsdcThermometerHtdataMapper{ * @return 对象列表 */ List<PsdcThermometerHtdata> queryAllByLimit(PsdcThermometerHtdata psdcThermometerHtdata, @Param("pageable") Pageable pageable); + + + List<Double> selTodayThermometer(@Param(value = "temp") String temp, + @Param(value = "deviceId") Integer deviceId, + @Param(value = "updateTime") String updateTime); + + List<String> selTodayThermometer2(@Param(value = "deviceId") Integer deviceId, + @Param(value = "updateTime") String updateTime); + /** * 统计总行数 * diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerRtdataMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerRtdataMapper.java index 63c0960..aae7553 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerRtdataMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerRtdataMapper.java @@ -2,17 +2,20 @@ package com.psdc.mapper; import java.util.List; import com.psdc.entity.PsdcThermometerRtdata; +import com.psdc.entity.res.PsdcThermometerDataRes; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Repository; - /** +/** * 温度实时数据;(psdc_thermometer_rtdata)表数据库访问层 * @author : http://www.chiner.pro * @date : 2023-4-23 */ @Mapper +@Repository public interface PsdcThermometerRtdataMapper{ /** * 通过ID查询单条数据 @@ -20,7 +23,10 @@ public interface PsdcThermometerRtdataMapper{ * @param thermometerRtdataId 主键 * @return 实例对象 */ - PsdcThermometerRtdata queryById(Integer thermometerRtdataId); + PsdcThermometerDataRes queryById(@Param("thermometerRtdataId") Integer thermometerRtdataId); + + List<PsdcThermometerDataRes> selWenDu(@Param("devType") Integer devType); + /** * 分页查询指定行数据 * diff --git a/psdc-business/src/main/java/com/psdc/service/IPsdcThermometerHtdataService.java b/psdc-business/src/main/java/com/psdc/service/IPsdcThermometerHtdataService.java new file mode 100644 index 0000000..93b816e --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/service/IPsdcThermometerHtdataService.java @@ -0,0 +1,23 @@ +package com.psdc.service; + +import com.psdc.core.domain.AjaxResult; + +import java.util.List; + +/** + * @Author:戴仕崑 + * @Project:psdc + * @Filename:PsdcThermometerHtdataService + * @Date:2023/5/9 11:10 + * @Version 1.0 + */ +public interface IPsdcThermometerHtdataService { + + + AjaxResult selTodayThermometer(); + + AjaxResult sel8WnDu(); + + AjaxResult selTotalElectricityInfo(); + +} diff --git a/psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java b/psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java new file mode 100644 index 0000000..7cfdf9e --- /dev/null +++ b/psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java @@ -0,0 +1,87 @@ +package com.psdc.service.impl; + +import com.psdc.core.domain.AjaxResult; +import com.psdc.entity.PsdcDevicePowerHdata96; +import com.psdc.entity.PsdcElectricRtdata; +import com.psdc.entity.res.PsdcDevicePowerRes; +import com.psdc.entity.res.PsdcThermometerDataRes; +import com.psdc.mapper.*; +import com.psdc.service.IPsdcThermometerHtdataService; +import com.psdc.utils.SecurityUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @Author:戴仕崑 + * @Project:psdc + * @Filename:PsdcThermometerHtdataServiceImpl + * @Date:2023/5/9 11:10 + * @Version 1.0 + */ +@Service +public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataService { + + @Resource + PsdcThermometerRtdataMapper mapper1; + @Resource + PsdcThermometerHtdataMapper mapper2; + @Resource + PsdcElectricHtdataMapper mapper3; + @Resource + PsdcDeviceMapper mapper4; + @Resource + PsdcDevicePowerHdata96Mapper mapper5; + @Resource + PsdcElectricRtdataMapper mapper6; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd"); + + @Override + public AjaxResult selTodayThermometer() { + + long userId = SecurityUtils.getUserId(); + List<Integer> devList = mapper4.selMyWorkDevices(2, userId); + Date date = new Date(); + List<PsdcThermometerDataRes> ary = new ArrayList(); + + for (Integer d : devList) { + + PsdcThermometerDataRes dataRes = mapper1.queryById(d); + List<Double> listIn = mapper2.selTodayThermometer("thermometer_value_in", d, sdf.format(date)); + List<Double> listOut = mapper2.selTodayThermometer("thermometer_value_out", d, sdf.format(date)); + List<Double> listTemp = mapper2.selTodayThermometer("thermometer_value", d, sdf.format(date)); + List<String> times = mapper2.selTodayThermometer2(d, sdf.format(date)); + Double useEnergy = mapper3.selTodayUseEnergy(d, sdf.format(date)); + dataRes.setTimeList(times); + dataRes.setTempTodayList(listTemp); + dataRes.setTempInTodayList(listIn); + dataRes.setTempOutTodayList(listOut); + dataRes.setTodayUseEnergy(useEnergy); + ary.add(dataRes); + } + + AjaxResult r = new AjaxResult(200, "查询成功", ary); + return r; + } + + @Override + public AjaxResult sel8WnDu() { + List<PsdcThermometerDataRes> dataResList = mapper1.selWenDu(1); + return AjaxResult.success(dataResList); + } + + @Override + public AjaxResult selTotalElectricityInfo() { + long userId = SecurityUtils.getUserId(); + PsdcDevicePowerHdata96 hdata96 = mapper5.queryById(userId, 13, sdf2.format(new Date())); + PsdcDevicePowerRes rtdata = mapper6.queryById(13); + rtdata.setTodayUsePowers(hdata96); + return AjaxResult.success(rtdata); + } + + +} diff --git a/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml index 629f0bf..4298bc2 100644 --- a/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml +++ b/psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml @@ -13,6 +13,8 @@ <result property="startTime" column="start_time" /> <result property="deviceStatus" column="device_status" /> <result property="photoUrl" column="photo_url" /> + <result property="deviceRunstatus" column="device_runstatus" /> + <result property="photoUrl" column="photo_url" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> @@ -28,6 +30,18 @@ where device_id = #{deviceId} </select> + <select id="selMyWorkDevices" resultType="java.lang.Integer"> + Select device_id From psdc_device + <where> + <if test="devType != null and devType != ''"> + device_type = #{devType} + </if> + <if test="userId != null and userId != ''"> + And user_id = #{userId} + </if> + </where> + </select> + <!--分页查询指定行数据--> <select id="queryAllByLimit" resultMap="PsdcDeviceMap"> select diff --git a/psdc-business/src/main/resources/mapper/business/PsdcDevicePowerHdata96Mapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcDevicePowerHdata96Mapper.xml new file mode 100644 index 0000000..337f4e5 --- /dev/null +++ b/psdc-business/src/main/resources/mapper/business/PsdcDevicePowerHdata96Mapper.xml @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.psdc.mapper.PsdcDevicePowerHdata96Mapper"> + <resultMap type="com.psdc.entity.PsdcDevicePowerHdata96" id="PsdcDevicePowerHdata96Map"> + <result property="userId" column="user_id" /> + <result property="deviceId" column="device_id" /> + <result property="samDate" column="sam_date" /> + <result property="val1" column="val1" jdbcType="DECIMAL"/> + <result property="val2" column="val2" jdbcType="DECIMAL"/> + <result property="val3" column="val3" jdbcType="DECIMAL"/> + <result property="val4" column="val4" jdbcType="DECIMAL"/> + <result property="val5" column="val5" jdbcType="DECIMAL"/> + <result property="val6" column="val6" jdbcType="DECIMAL"/> + <result property="val7" column="val7" jdbcType="DECIMAL"/> + <result property="val8" column="val8" jdbcType="DECIMAL"/> + <result property="val9" column="val9" jdbcType="DECIMAL"/> + <result property="val10" column="val10" jdbcType="DECIMAL"/> + <result property="val11" column="val11" jdbcType="DECIMAL"/> + <result property="val12" column="val12" jdbcType="DECIMAL"/> + <result property="val13" column="val13" jdbcType="DECIMAL"/> + <result property="val14" column="val14" jdbcType="DECIMAL"/> + <result property="val15" column="val15" jdbcType="DECIMAL"/> + <result property="val16" column="val16" jdbcType="DECIMAL"/> + <result property="val17" column="val17" jdbcType="DECIMAL"/> + <result property="val18" column="val18" jdbcType="DECIMAL"/> + <result property="val19" column="val19" jdbcType="DECIMAL"/> + <result property="val20" column="val20" jdbcType="DECIMAL"/> + <result property="val21" column="val21" jdbcType="DECIMAL"/> + <result property="val22" column="val22" jdbcType="DECIMAL"/> + <result property="val23" column="val23" jdbcType="DECIMAL"/> + <result property="val24" column="val24" jdbcType="DECIMAL"/> + <result property="val25" column="val25" jdbcType="DECIMAL"/> + <result property="val26" column="val26" jdbcType="DECIMAL"/> + <result property="val27" column="val27" jdbcType="DECIMAL"/> + <result property="val28" column="val28" jdbcType="DECIMAL"/> + <result property="val29" column="val29" jdbcType="DECIMAL"/> + <result property="val30" column="val30" jdbcType="DECIMAL"/> + <result property="val31" column="val31" jdbcType="DECIMAL"/> + <result property="val32" column="val32" jdbcType="DECIMAL"/> + <result property="val33" column="val33" jdbcType="DECIMAL"/> + <result property="val34" column="val34" jdbcType="DECIMAL"/> + <result property="val35" column="val35" jdbcType="DECIMAL"/> + <result property="val36" column="val36" jdbcType="DECIMAL"/> + <result property="val37" column="val37" jdbcType="DECIMAL"/> + <result property="val38" column="val38" jdbcType="DECIMAL"/> + <result property="val39" column="val39" jdbcType="DECIMAL"/> + <result property="val40" column="val40" jdbcType="DECIMAL"/> + <result property="val41" column="val41" jdbcType="DECIMAL"/> + <result property="val42" column="val42" jdbcType="DECIMAL"/> + <result property="val43" column="val43" jdbcType="DECIMAL"/> + <result property="val44" column="val44" jdbcType="DECIMAL"/> + <result property="val45" column="val45" jdbcType="DECIMAL"/> + <result property="val46" column="val46" jdbcType="DECIMAL"/> + <result property="val47" column="val47" jdbcType="DECIMAL"/> + <result property="val48" column="val48" jdbcType="DECIMAL"/> + <result property="val49" column="val49" jdbcType="DECIMAL"/> + <result property="val50" column="val50" jdbcType="DECIMAL"/> + <result property="val51" column="val51" jdbcType="DECIMAL"/> + <result property="val52" column="val52" jdbcType="DECIMAL"/> + <result property="val53" column="val53" jdbcType="DECIMAL"/> + <result property="val54" column="val54" jdbcType="DECIMAL"/> + <result property="val55" column="val55" jdbcType="DECIMAL"/> + <result property="val56" column="val56" jdbcType="DECIMAL"/> + <result property="val57" column="val57" jdbcType="DECIMAL"/> + <result property="val58" column="val58" jdbcType="DECIMAL"/> + <result property="val59" column="val59" jdbcType="DECIMAL"/> + <result property="val60" column="val60" jdbcType="DECIMAL"/> + <result property="val61" column="val61" jdbcType="DECIMAL"/> + <result property="val62" column="val62" jdbcType="DECIMAL"/> + <result property="val63" column="val63" jdbcType="DECIMAL"/> + <result property="val64" column="val64" jdbcType="DECIMAL"/> + <result property="val65" column="val65" jdbcType="DECIMAL"/> + <result property="val66" column="val66" jdbcType="DECIMAL"/> + <result property="val67" column="val67" jdbcType="DECIMAL"/> + <result property="val68" column="val68" jdbcType="DECIMAL"/> + <result property="val69" column="val69" jdbcType="DECIMAL"/> + <result property="val70" column="val70" jdbcType="DECIMAL"/> + <result property="val71" column="val71" jdbcType="DECIMAL"/> + <result property="val72" column="val72" jdbcType="DECIMAL"/> + <result property="val73" column="val73" jdbcType="DECIMAL"/> + <result property="val74" column="val74" jdbcType="DECIMAL"/> + <result property="val75" column="val75" jdbcType="DECIMAL"/> + <result property="val76" column="val76" jdbcType="DECIMAL"/> + <result property="val77" column="val77" jdbcType="DECIMAL"/> + <result property="val78" column="val78" jdbcType="DECIMAL"/> + <result property="val79" column="val79" jdbcType="DECIMAL"/> + <result property="val80" column="val80" jdbcType="DECIMAL"/> + <result property="val81" column="val81" jdbcType="DECIMAL"/> + <result property="val82" column="val82" jdbcType="DECIMAL"/> + <result property="val83" column="val83" jdbcType="DECIMAL"/> + <result property="val84" column="val84" jdbcType="DECIMAL"/> + <result property="val85" column="val85" jdbcType="DECIMAL"/> + <result property="val86" column="val86" jdbcType="DECIMAL"/> + <result property="val87" column="val87" jdbcType="DECIMAL"/> + <result property="val88" column="val88" jdbcType="DECIMAL"/> + <result property="val89" column="val89" jdbcType="DECIMAL"/> + <result property="val90" column="val90" jdbcType="DECIMAL"/> + <result property="val91" column="val91" jdbcType="DECIMAL"/> + <result property="val92" column="val92" jdbcType="DECIMAL"/> + <result property="val93" column="val93" jdbcType="DECIMAL"/> + <result property="val94" column="val94" jdbcType="DECIMAL"/> + <result property="val95" column="val95" jdbcType="DECIMAL"/> + <result property="val96" column="val96" jdbcType="DECIMAL"/> + </resultMap> + + <!-- 通过ID查询总电表单条数据 --> + <select id="queryById" resultMap="PsdcDevicePowerHdata96Map"> + Select + user_id,device_id,sam_date,val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11,val12,val13,val14,val15,val16,val17,val18,val19,val20,val21,val22,val23,val24,val25,val26,val27,val28,val29,val30,val31,val32,val33,val34,val35,val36,val37,val38,val39,val40,val41,val42,val43,val44,val45,val46,val47,val48,val49,val50,val51,val52,val53,val54,val55,val56,val57,val58,val59,val60,val61,val62,val63,val64,val65,val66,val67,val68,val69,val70,val71,val72,val73,val74,val75,val76,val77,val78,val79,val80,val81,val82,val83,val84,val85,val86,val87,val88,val89,val90,val91,val92,val93,val94,val95,val96 + From psdc_device_power_hdata96 pdph96 + <where> + <if test="userId != null and userId != ''"> + and user_id = #{userId} + </if> + <if test="deviceId != null and deviceId != ''"> + and device_id = #{deviceId} + </if> + <if test="samDate != null and samDate != ''"> + and sam_date = #{samDate} + </if> + </where> + </select> +</mapper> \ No newline at end of file diff --git a/psdc-business/src/main/resources/mapper/business/PsdcElectricHtdataMapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcElectricHtdataMapper.xml index 4ad5700..f018226 100644 --- a/psdc-business/src/main/resources/mapper/business/PsdcElectricHtdataMapper.xml +++ b/psdc-business/src/main/resources/mapper/business/PsdcElectricHtdataMapper.xml @@ -54,6 +54,18 @@ where electric_htdata_id = #{electricHtdataId} </select> + <select id="selTodayUseEnergy" resultType="java.lang.Double"> + Select SUM(use_deiffen) From psdc_electric_htdata + <where> + <if test="deviceId != null and deviceId != ''"> + device_id = #{deviceId} + </if> + <if test="updateTime != null and updateTime != ''"> + And update_time Like concat('%',#{updateTime},'%') + </if> + </where> + </select> + <!--分页查询指定行数据--> <select id="queryAllByLimit" resultMap="PsdcElectricHtdataMap"> select diff --git a/psdc-business/src/main/resources/mapper/business/PsdcElectricRtdataMapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcElectricRtdataMapper.xml index 9579552..1acf195 100644 --- a/psdc-business/src/main/resources/mapper/business/PsdcElectricRtdataMapper.xml +++ b/psdc-business/src/main/resources/mapper/business/PsdcElectricRtdataMapper.xml @@ -44,13 +44,15 @@ <result property="combqh" column="CombQh" /> </resultMap> + <resultMap id="PsdcElectricRtdataMap2" type="com.psdc.entity.res.PsdcDevicePowerRes"> + <result property="totp" column="TotP" /> + <result property="totwh" column="TotWh" /> + </resultMap> + <!-- 通过ID查询单条数据 --> - <select id="queryById" resultMap="PsdcElectricRtdataMap"> - select - electric_rtdata_id,device_id,update_time,Ua,Ub,Uc,Ia,Ib,Ic,Pa,Pb,Pc,TotP,Qa,Qb,Qc,TotQ,PFa,PFb,PFc,TotPF,SupWh,RtlWh,SupQh,RtlQh,Sa,Sb,Sc,TotS, - TotWh,TotWh_1,TotWh_2,TotWh_3,TotWh_4,HZ,Uab,Ubc,Uca,CombWh,CombQh - from psdc_electric_rtdata - where electric_rtdata_id = #{electricRtdataId} + <select id="queryById" resultMap="PsdcElectricRtdataMap2"> + Select TotP, TotWh From psdc_electric_rtdata + Where device_id = #{electricRtdataId} </select> <!--分页查询指定行数据--> diff --git a/psdc-business/src/main/resources/mapper/business/PsdcThermometerHtdataMapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcThermometerHtdataMapper.xml index ff3c4b8..227bc85 100644 --- a/psdc-business/src/main/resources/mapper/business/PsdcThermometerHtdataMapper.xml +++ b/psdc-business/src/main/resources/mapper/business/PsdcThermometerHtdataMapper.xml @@ -18,11 +18,35 @@ where thermometer_htdata_id = #{thermometerHtdataId} </select> + <select id="selTodayThermometer" resultType="java.lang.Double"> + Select ${temp} From psdc_thermometer_htdata + <where> + <if test="deviceId != null and deviceId != ''"> + device_id = #{deviceId} + </if> + <if test="updateTime != null and updateTime != ''"> + And update_time Like concat('%',#{updateTime},'%') + </if> + </where> + </select> + + <select id="selTodayThermometer2" resultType="java.lang.String"> + Select update_time From psdc_thermometer_htdata + <where> + <if test="deviceId != null and deviceId != ''"> + device_id = #{deviceId} + </if> + <if test="updateTime != null and updateTime != ''"> + And update_time Like concat('%',#{updateTime},'%') + </if> + </where> + </select> + <!--分页查询指定行数据--> <select id="queryAllByLimit" resultMap="PsdcThermometerHtdataMap"> - select + Select thermometer_htdata_id,device_id,thermometer_value,thermometer_value_in,thermometer_value_out,update_time - from psdc_thermometer_htdata + From psdc_thermometer_htdata <where> <if test="thermometerHtdataId != null and thermometerHtdataId != ''"> and thermometer_htdata_id = #{thermometerHtdataId} diff --git a/psdc-business/src/main/resources/mapper/business/PsdcThermometerRtdataMapper.xml b/psdc-business/src/main/resources/mapper/business/PsdcThermometerRtdataMapper.xml index 0619c65..e2e6f51 100644 --- a/psdc-business/src/main/resources/mapper/business/PsdcThermometerRtdataMapper.xml +++ b/psdc-business/src/main/resources/mapper/business/PsdcThermometerRtdataMapper.xml @@ -10,12 +10,27 @@ <result property="updateTime" column="update_time" /> </resultMap> + <resultMap id="PsdcThermometerRtdataMap2" type="com.psdc.entity.res.PsdcThermometerDataRes"> + <result property="deviceId" column="device_id" /> + <result property="deviceName" column="device_name" /> + <result property="deviceRunStatus" column="device_runstatus" /> + <result property="thermometerValue" column="thermometer_value" /> + <result property="thermometerValueIn" column="thermometer_value_in" /> + <result property="thermometerValueOut" column="thermometer_value_out" /> + </resultMap> + <!-- 通过ID查询单条数据 --> - <select id="queryById" resultMap="PsdcThermometerRtdataMap"> - select - thermometer_rtdata_id,device_id,thermometer_value,thermometer_value_in,thermometer_value_out,update_time - from psdc_thermometer_rtdata - where thermometer_rtdata_id = #{thermometerRtdataId} + <select id="queryById" resultMap="PsdcThermometerRtdataMap2"> + Select pd.device_id, pd.device_name, pd.device_runstatus, ptr.thermometer_value, ptr.thermometer_value_in, ptr.thermometer_value_out + From psdc_device pd + Left Join psdc_thermometer_rtdata ptr On ptr.device_id = pd.device_id + Where ptr.device_id = #{thermometerRtdataId} + </select> + + <select id="selWenDu" resultMap="PsdcThermometerRtdataMap2"> + Select pd.device_id, pd.device_name, ptr.thermometer_value From psdc_thermometer_rtdata ptr + Left Join psdc_device pd On pd.device_id = ptr.device_id + Where device_type = ${devType} </select> <!--分页查询指定行数据--> diff --git a/psdc-web/src/main/java/com/psdc/controller/control/ManualControl.java b/psdc-web/src/main/java/com/psdc/controller/control/ManualControl.java index 0d1d086..970cb2b 100644 --- a/psdc-web/src/main/java/com/psdc/controller/control/ManualControl.java +++ b/psdc-web/src/main/java/com/psdc/controller/control/ManualControl.java @@ -24,7 +24,7 @@ public class ManualControl { @GetMapping("/deviceList") public AjaxResult getControlDeviceList() { - return ajax; + return null; } diff --git a/psdc-web/src/main/java/com/psdc/controller/index/Index.java b/psdc-web/src/main/java/com/psdc/controller/index/Index.java index 760e1c9..788b229 100644 --- a/psdc-web/src/main/java/com/psdc/controller/index/Index.java +++ b/psdc-web/src/main/java/com/psdc/controller/index/Index.java @@ -1,4 +1,34 @@ package com.psdc.controller.index; +import com.psdc.core.domain.AjaxResult; +import com.psdc.service.IPsdcThermometerHtdataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/api/indexLook") public class Index { + + @Autowired + IPsdcThermometerHtdataService psdcThermometerHtdataService; + + @RequestMapping(value = "/devicesInfo", method = RequestMethod.GET) + public AjaxResult selData() { + return psdcThermometerHtdataService.selTodayThermometer(); + } + + @RequestMapping(value = "/8wd", method = RequestMethod.GET) + public AjaxResult sel8WenDu() { + return psdcThermometerHtdataService.sel8WnDu(); + } + + @RequestMapping(value = "/zdb", method = RequestMethod.GET) + public AjaxResult selzdb() { + return psdcThermometerHtdataService.selTotalElectricityInfo(); + } + } From 3216851ea0b26ce4a2a0146980147d2f78e81ae8 Mon Sep 17 00:00:00 2001 From: XMnhwj_BackTechnologyDevelopment <3512363680@qq.com> Date: Tue, 9 May 2023 17:26:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?2023-05-09=2017:21:52=20=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A4=A7=E5=B1=8F=E7=9A=84=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/psdc/mapper/PsdcDeviceMapper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java b/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java index 4ddedea..c19c151 100644 --- a/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java +++ b/psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java @@ -15,7 +15,6 @@ import org.springframework.security.access.method.P; * @date : 2023-4-23 */ @Mapper -@Repository public interface PsdcDeviceMapper{ /** * 通过ID查询单条数据