From 90e30e1461f48721442d0391e46c2edde170d9e7 Mon Sep 17 00:00:00 2001
From: ustcyc <yincun@163.com>
Date: 星期二, 07 一月 2025 15:04:23 +0800
Subject: [PATCH] 升级架构
---
zhitan-system/target/classes/mapper/basicdata/MeterImplementMapper.xml | 6 ++
zhitan-system/target/classes/mapper/peakvalley/ElectricityPriceDateMapper.xml | 6 ++
zhitan-system/target/classes/mapper/model/EnergyIndexMapper.xml | 22 ++++++-
zhitan-admin/target/classes/application.yml | 11 ++-
zhitan-admin/target/classes/application-dev.yml | 2
zhitan-admin/target/classes/application-prod.yml | 2
zhitan-system/target/classes/mapper/system/SysUserMapper.xml | 9 ++
zhitan-system/target/classes/mapper/peakvalley/ElectricityDataItemMapper.xml | 21 +++++++
zhitan-system/target/classes/mapper/model/ModelNodeMapper.xml | 15 +++-
zhitan-admin/src/main/resources/application.yml | 11 ++-
zhitan-system/target/classes/mapper/dataitem/DataItemMapper.xml | 63 +++++++++++++++++++++
11 files changed, 146 insertions(+), 22 deletions(-)
diff --git a/zhitan-admin/src/main/resources/application.yml b/zhitan-admin/src/main/resources/application.yml
index 210466d..b766372 100644
--- a/zhitan-admin/src/main/resources/application.yml
+++ b/zhitan-admin/src/main/resources/application.yml
@@ -101,8 +101,8 @@
expireTime: 300
mybatis-plus:
-# configuration:
-# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ # configuration:
+ # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
typeAliasesPackage: com.zhitan.**.domain
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
@@ -144,7 +144,7 @@
token: ==
org: org
bucket: bucket
-
+
###################### MQTT #################################
mqtt:
# 鏈嶅姟鍣ㄥ湴鍧�
@@ -156,7 +156,7 @@
# 鐢ㄦ埛鍚�
username: admin
# 瀵嗙爜
- password: 111111
+ password: 1q2w3e4r.
# 杩炴帴瓒呮椂
timeout: 30
# 蹇冭烦妫�娴�
@@ -169,4 +169,5 @@
# false涓哄缓绔嬫寔涔呬細璇�
cleanSession: false
# 鏂紑鍚庨噸鏂拌繛鎺�
- automaticReconnect: true
\ No newline at end of file
+ automaticReconnect: true
+singleLoginUrl: localhost:8090/singleLogin/getInfo
diff --git a/zhitan-admin/target/classes/application-dev.yml b/zhitan-admin/target/classes/application-dev.yml
index c2f6b04..fbf552a 100644
--- a/zhitan-admin/target/classes/application-dev.yml
+++ b/zhitan-admin/target/classes/application-dev.yml
@@ -35,7 +35,7 @@
# 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣
maxEvictableIdleTimeMillis: 900000
# 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁�
- validationQuery: SELECT 1
+ validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
diff --git a/zhitan-admin/target/classes/application-prod.yml b/zhitan-admin/target/classes/application-prod.yml
index 76415bc..2f5a7cb 100644
--- a/zhitan-admin/target/classes/application-prod.yml
+++ b/zhitan-admin/target/classes/application-prod.yml
@@ -6,7 +6,7 @@
druid:
# 涓诲簱鏁版嵁婧�
master:
- url: jdbc:postgresql://127.0.0.1:5432/energy
+ url: jdbc:postgresql://127.0.0.1:5432/energy_ml
username: root
password: 123456
# 浠庡簱鏁版嵁婧�
diff --git a/zhitan-admin/target/classes/application.yml b/zhitan-admin/target/classes/application.yml
index 5e4a0d4..54e3b37 100644
--- a/zhitan-admin/target/classes/application.yml
+++ b/zhitan-admin/target/classes/application.yml
@@ -101,8 +101,8 @@
expireTime: 300
mybatis-plus:
-# configuration:
-# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ # configuration:
+ # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
typeAliasesPackage: com.zhitan.**.domain
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠�
@@ -144,7 +144,7 @@
token: ==
org: org
bucket: bucket
-
+
###################### MQTT #################################
mqtt:
# 鏈嶅姟鍣ㄥ湴鍧�
@@ -156,7 +156,7 @@
# 鐢ㄦ埛鍚�
username: admin
# 瀵嗙爜
- password: 111111
+ password: 1q2w3e4r.
# 杩炴帴瓒呮椂
timeout: 30
# 蹇冭烦妫�娴�
@@ -169,4 +169,5 @@
# false涓哄缓绔嬫寔涔呬細璇�
cleanSession: false
# 鏂紑鍚庨噸鏂拌繛鎺�
- automaticReconnect: true
\ No newline at end of file
+ automaticReconnect: true
+singleLoginUrl: localhost:8090/singleLogin/getInfo
diff --git a/zhitan-system/target/classes/mapper/basicdata/MeterImplementMapper.xml b/zhitan-system/target/classes/mapper/basicdata/MeterImplementMapper.xml
index 2ec89c1..9635b86 100644
--- a/zhitan-system/target/classes/mapper/basicdata/MeterImplementMapper.xml
+++ b/zhitan-system/target/classes/mapper/basicdata/MeterImplementMapper.xml
@@ -127,6 +127,12 @@
JOIN node_index ni ON ni.node_id = nd.node_id
where ni.node_id= #{nodeId} and index_id= #{indexId}
</select>
+ <select id="listMeterImplByInstallLocation" resultType="com.zhitan.basicdata.domain.MeterImplement">
+ <include refid="selectMeterImplementVo"/>
+ <where>
+ installaction_location = #{installactionLocation}
+ </where>
+ </select>
<insert id="insertMeterImplement" parameterType="MeterImplement">
insert into meter_implement
diff --git a/zhitan-system/target/classes/mapper/dataitem/DataItemMapper.xml b/zhitan-system/target/classes/mapper/dataitem/DataItemMapper.xml
index 327e8d1..d64ec15 100644
--- a/zhitan-system/target/classes/mapper/dataitem/DataItemMapper.xml
+++ b/zhitan-system/target/classes/mapper/dataitem/DataItemMapper.xml
@@ -136,4 +136,67 @@
</foreach>
AND time_code = #{timeCode}
</select>
+ <select id="getUpCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission">
+ SELECT
+ di.index_id,
+ di.data_time,
+ di.value,
+ ei.energy_id
+ FROM
+ data_item di
+ JOIN energy_index ei ON di.index_id = ei.index_id
+ WHERE
+ ei.energy_id != '' and
+ di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{indexId})
+ AND di.data_time BETWEEN #{beginTime} AND #{endTime}
+ AND di.time_type = #{timeType}
+ </select>
+ <select id="getMiddleCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission">
+ SELECT
+ di.index_id,
+ di.data_time,
+ CASE
+ WHEN di.time_type = 'MONTH' THEN
+ TO_CHAR( di.create_time, 'MM' )
+ WHEN di.time_type = 'DAY' THEN
+ TO_CHAR( di.create_time, 'DD' )
+ WHEN di.time_type = 'HOUR' THEN
+ TO_CHAR( di.data_time, 'HH' )
+ ELSE TO_CHAR( di.data_time, 'YYMMDD' )
+ END AS dataTimeStr,
+ di.value,
+ ei.energy_id,
+ di.time_type
+ FROM
+ data_item di
+ JOIN energy_index ei ON di.index_id = ei.index_id
+ WHERE
+ di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{indexId})
+ <if test="emissionType !='' and emissionType !=null and emissionType =='allType'">
+ AND ei.energy_id != ''
+ </if>
+ <if test="emissionType !='' and emissionType !=null and emissionType !='allType'">
+ AND ei.energy_id = #{emissionType}
+ </if>
+ AND di.data_time BETWEEN #{beginTime} AND #{endTime}
+ AND di.time_type = #{timeType}
+ </select>
+ <select id="getDownCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission">
+ SELECT
+ di.index_id,
+ di.data_time,
+ di.value,
+ ei.energy_id,
+ mn.name as nodeName
+ FROM
+ model_node mn
+ LEFT JOIN node_index ni ON mn.node_id = ni.node_id
+ LEFT JOIN data_item di ON di.index_id = ni.index_id
+ LEFT JOIN energy_index ei ON di.index_id = ei.index_id
+ WHERE
+ ei.energy_id != ''
+ AND mn.parent_id = #{indexId}
+ AND di.data_time BETWEEN #{beginTime} AND #{endTime}
+ AND di.time_type = #{timeType}
+ </select>
</mapper>
\ No newline at end of file
diff --git a/zhitan-system/target/classes/mapper/model/EnergyIndexMapper.xml b/zhitan-system/target/classes/mapper/model/EnergyIndexMapper.xml
index d38240b..3ea43ac 100644
--- a/zhitan-system/target/classes/mapper/model/EnergyIndexMapper.xml
+++ b/zhitan-system/target/classes/mapper/model/EnergyIndexMapper.xml
@@ -184,7 +184,7 @@
<if test="energyId != null">#{energyId},
</if>
</trim>
-
+
</insert>
<insert id="insertNodeIndex">
insert into node_index (node_id, index_id) values (#{nodeId}, #{indexId});
@@ -331,7 +331,7 @@
and ei.meter_id = me.id
order by ei.order_num
</select>
-
+
<select id="selectEnergyIndexPage" resultMap="EnergyIndexResult">
select ni.index_id, name, code, index_type, remark, unit_id, index_category
from energy_index ei left join node_index ni on ei.index_id = ni.index_id
@@ -346,7 +346,7 @@
</if>
</where>
order by ei.order_num
-
+
</select>
<select id="listIndexByMeterIds" resultType="com.zhitan.model.domain.EnergyIndex">
select ei.index_id,
@@ -363,7 +363,7 @@
from energy_index ei
left join node_index ni on ei.index_id = ni.index_id
<where>
-
+
<if test="nodeId != null and nodeId != ''">and ni.node_id = #{nodeId}</if>
<if test="meterIds != null">
and ei.meter_id in
@@ -377,4 +377,18 @@
<include refid="selectEnergyIndexVo"/>
where code = #{cdoe}
</select>
+ <select id="getIndexByCode" resultType="com.zhitan.model.domain.EnergyIndex">
+ SELECT ei.code,mi.meter_name||'_'||ei.name as name from energy_index ei
+ LEFT JOIN node_device nd on ei.meter_id = nd.device_id
+ LEFT JOIN meter_implement mi on mi."id" = nd.device_id
+ <where>
+ <if test="nodeId != null and nodeId != ''">and nd.node_id = #{nodeId}</if>
+ <if test="code != null and code != ''">
+ and (mi.meter_name like concat('%', #{code}, '%')
+ or ei.code like concat('%', #{code}, '%')
+ or ei.name like concat('%', #{code}, '%')
+ )
+ </if>
+ </where>
+ </select>
</mapper>
diff --git a/zhitan-system/target/classes/mapper/model/ModelNodeMapper.xml b/zhitan-system/target/classes/mapper/model/ModelNodeMapper.xml
index 7fbb5b8..c704454 100644
--- a/zhitan-system/target/classes/mapper/model/ModelNodeMapper.xml
+++ b/zhitan-system/target/classes/mapper/model/ModelNodeMapper.xml
@@ -377,7 +377,7 @@
values (#{nodeId}, #{indexId})
</foreach>
</insert>
-
+
<select id="getModelNodeIndexIdByNodeId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor">
SELECT mn.node_id nodeId,
mn."name" "name",
@@ -386,7 +386,7 @@
FROM "model_node" mn
LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id
LEFT JOIN energy_index ei on ni.index_id = ei.index_id
- WHERE ni.node_id = #{nodeId}
+ WHERE ni.node_id = #{nodeId}
<if test="energyType!=null and energyType!=''">
and ei.energy_id = #{energyType}
</if>
@@ -404,7 +404,7 @@
<select id="getFirstModeNodeInfo" resultType="com.zhitan.model.domain.ModelNode">
<include refid="selectModelNodeVo"/>
where model_code = #{modelCode} AND parent_id is null
- order by order_num
+ order by order_num
</select>
<select id="selectIndexByNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor">
SELECT mn.node_id nodeId,
@@ -414,10 +414,17 @@
FROM "model_node" mn
LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id
left join energy_index ei on ni.index_id = ei.index_id
- WHERE mn.model_code = #{modelCode}
+ <where>
+ mn.model_code = #{modelCode}
AND mn.node_id in
<foreach collection="nodeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
+ <if test="modelCode!=null and modelCode!='' and nodeIds.size>0">
+ and ei.index_type='STATISTIC'
+ </if>
+
+ </where>
+
</select>
</mapper>
diff --git a/zhitan-system/target/classes/mapper/peakvalley/ElectricityDataItemMapper.xml b/zhitan-system/target/classes/mapper/peakvalley/ElectricityDataItemMapper.xml
index 6680811..2676c7d 100644
--- a/zhitan-system/target/classes/mapper/peakvalley/ElectricityDataItemMapper.xml
+++ b/zhitan-system/target/classes/mapper/peakvalley/ElectricityDataItemMapper.xml
@@ -27,5 +27,26 @@
AND (data_time BETWEEN #{startTime} AND #{endTime})
AND time_type = #{timeType}
</select>
+ <select id="getDataStatisticsDeviationAnalysis"
+ resultType="com.zhitan.peakvalley.domain.ElectricityDataItem">
+ SELECT
+ index_code indexCode,
+ time_code timeCode,
+ electricity_type electricityType,
+ data_time dataTime,
+ electricity,
+ "cost",
+ time_type timeType,
+ price,
+ remark
+ FROM
+ "electricity_data_item"
+ WHERE
+ index_id IN
+ <foreach collection="indexIdSet" item="indexId" open="(" separator="," close=")">
+ #{indexId}
+ </foreach>
+ AND time_type = #{timeType}
+ </select>
</mapper>
\ No newline at end of file
diff --git a/zhitan-system/target/classes/mapper/peakvalley/ElectricityPriceDateMapper.xml b/zhitan-system/target/classes/mapper/peakvalley/ElectricityPriceDateMapper.xml
index 9e56581..2672b6b 100644
--- a/zhitan-system/target/classes/mapper/peakvalley/ElectricityPriceDateMapper.xml
+++ b/zhitan-system/target/classes/mapper/peakvalley/ElectricityPriceDateMapper.xml
@@ -80,4 +80,10 @@
#{id}
</foreach>
</delete>
+
+ <select id="selectElectricityPriceDatePageTacticsAll" resultMap="ElectricityPriceDateResult">
+ <include refid="selectElectricityPriceDateVo"/>
+ WHERE begin_date < CURRENT_TIMESTAMP
+ AND end_date > CURRENT_TIMESTAMP
+ </select>
</mapper>
\ No newline at end of file
diff --git a/zhitan-system/target/classes/mapper/system/SysUserMapper.xml b/zhitan-system/target/classes/mapper/system/SysUserMapper.xml
index 965abd8..68e0991 100644
--- a/zhitan-system/target/classes/mapper/system/SysUserMapper.xml
+++ b/zhitan-system/target/classes/mapper/system/SysUserMapper.xml
@@ -23,6 +23,7 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
+ <result property="singleUser" column="single_user"/>
<association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
</resultMap>
@@ -63,6 +64,7 @@
u.create_by,
u.create_time,
u.remark,
+ u.single_user,
d.dept_id,
d.parent_id,
d.ancestors,
@@ -84,7 +86,7 @@
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phone_number, u.password, u.sex,
- u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from
+ u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.single_user, d.dept_name, d.leader from
sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
@@ -147,6 +149,7 @@
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
+ <if test="singleUser != null and singleUser != ''">single_user,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@@ -161,6 +164,7 @@
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
+ <if test="singleUser != null and singleUser != ''">#{singleUser},</if>
now()
)
</insert>
@@ -181,6 +185,7 @@
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
+ <if test="singleUser != null and singleUser != ''">single_user = #{singleUser},</if>
update_time = now()
</set>
where user_id = #{userId}
@@ -219,4 +224,4 @@
</foreach>
</delete>
-</mapper>
+</mapper>
--
Gitblit v1.9.3