Commit 324bea6b authored by duanruiming's avatar duanruiming

[add] 国产化数据库改造

parent 42929683
...@@ -2,14 +2,16 @@ spring: ...@@ -2,14 +2,16 @@ spring:
cloud: cloud:
nacos: nacos:
config: config:
server-addr: 37.12.182.29:8848 server-addr: 37.8.219.227:28848
file-extension: yaml file-extension: yaml
group: signal group: signal
namespace: signal namespace: signal
username: nacos username: nacos
password: nacos password: Nacos@2025
application: application:
# dubbo启动需要程序名称 # dubbo启动需要程序名称
name: signal-optimize-service name: signal-optimize-service
main: main:
allow-circular-references: true allow-circular-references: true
inforsuite:
license-path: D:\license
\ No newline at end of file
spring:
cloud:
nacos:
config:
server-addr: 37.8.219.227:28848
file-extension: yaml
group: signal
namespace: signal
username: nacos
password: Nacos@2025
application:
# dubbo启动需要程序名称
name: signal-optimize-service
main:
allow-circular-references: true
inforsuite:
license-path: D:\license
spring: spring:
profiles: profiles:
active: dockerCH active: docker
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper"> <mapper namespace="net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper">
<!-- 通用设置 --> <!-- 通用设置 -->
<!-- 通用查询列 --> <!-- 通用查询列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, green_id, dt, insert_time id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, green_id, dt, insert_time
...@@ -10,88 +10,88 @@ ...@@ -10,88 +10,88 @@
<!-- 通用条件列 --> <!-- 通用条件列 -->
<sql id="AnalysisProblemGreenDayByCondition"> <sql id="AnalysisProblemGreenDayByCondition">
<if test="id!=null and id!=''"> <if test="id!=null and id!=''">
AND id = #{id} AND id = #{id}
</if> </if>
<if test="areaId!=null and areaId!=''"> <if test="areaId!=null and areaId!=''">
AND area_id = #{areaId} AND area_id = #{areaId}
</if> </if>
<if test="eventCategory!=null and eventCategory!=''"> <if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory} AND event_category = #{eventCategory}
</if> </if>
<if test="eventType!=null and eventType!=''"> <if test="eventType!=null and eventType!=''">
AND event_type = #{eventType} AND event_type = #{eventType}
</if> </if>
<if test="eventNumber!=null and eventNumber!=''"> <if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber} AND event_number = #{eventNumber}
</if> </if>
<if test="eventTotalTime!=null and eventTotalTime!=''"> <if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime} AND event_total_time = #{eventTotalTime}
</if> </if>
<if test="windowStartTime!=null"> <if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime} AND window_start_time = #{windowStartTime}
</if> </if>
<if test="windowEndTime!=null"> <if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime} AND window_end_time = #{windowEndTime}
</if> </if>
<if test="greenId!=null and greenId!=''"> <if test="greenId!=null and greenId!=''">
AND green_id = #{greenId} AND green_id = #{greenId}
</if> </if>
<if test="dt!=null and dt!=''"> <if test="dt!=null and dt!=''">
AND dt = #{dt} AND dt = #{dt}
</if> </if>
<if test="insertTime!=null"> <if test="insertTime!=null">
AND insert_time = #{insertTime} AND insert_time = #{insertTime}
</if> </if>
</sql> </sql>
<!-- 通用设置列 --> <!-- 通用设置列 -->
<sql id="AnalysisProblemGreenDaySetColumns"> <sql id="AnalysisProblemGreenDaySetColumns">
<if test="areaId!=null and areaId!=''"> <if test="areaId!=null and areaId!=''">
area_id = #{areaId}, area_id = #{areaId},
</if> </if>
<if test="eventCategory!=null and eventCategory!=''"> <if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory}, event_category = #{eventCategory},
</if> </if>
<if test="eventType!=null and eventType!=''"> <if test="eventType!=null and eventType!=''">
event_type = #{eventType}, event_type = #{eventType},
</if> </if>
<if test="eventNumber!=null and eventNumber!=''"> <if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber}, event_number = #{eventNumber},
</if> </if>
<if test="eventTotalTime!=null and eventTotalTime!=''"> <if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime}, event_total_time = #{eventTotalTime},
</if> </if>
<if test="windowStartTime!=null"> <if test="windowStartTime!=null">
window_start_time = #{windowStartTime}, window_start_time = #{windowStartTime},
</if> </if>
<if test="windowEndTime!=null"> <if test="windowEndTime!=null">
window_end_time = #{windowEndTime}, window_end_time = #{windowEndTime},
</if> </if>
<if test="greenId!=null and greenId!=''"> <if test="greenId!=null and greenId!=''">
green_id = #{greenId}, green_id = #{greenId},
</if> </if>
<if test="dt!=null and dt!=''"> <if test="dt!=null and dt!=''">
dt = #{dt}, dt = #{dt},
</if> </if>
<if test="insertTime!=null"> <if test="insertTime!=null">
insert_time = #{insertTime}, insert_time = #{insertTime},
</if> </if>
</sql> </sql>
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="AnalysisProblemGreenDayMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay"> <resultMap id="AnalysisProblemGreenDayMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="area_id" property="areaId"/> <result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/> <result column="event_category" property="eventCategory"/>
<result column="event_type" property="eventType"/> <result column="event_type" property="eventType"/>
<result column="event_number" property="eventNumber"/> <result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/> <result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/> <result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/> <result column="window_end_time" property="windowEndTime"/>
<result column="green_id" property="greenId"/> <result column="green_id" property="greenId"/>
<result column="dt" property="dt"/> <result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/> <result column="insert_time" property="insertTime"/>
</resultMap> </resultMap>
<!-- 查询表t_analysis_problem_green_day所有信息 --> <!-- 查询表t_analysis_problem_green_day所有信息 -->
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<!-- 根据主键id删除表t_analysis_problem_green_day信息 --> <!-- 根据主键id删除表t_analysis_problem_green_day信息 -->
<delete id="deleteAnalysisProblemGreenDayByid"> <delete id="deleteAnalysisProblemGreenDayByid">
DELETE FROM DELETE FROM
t_analysis_problem_green_day t_analysis_problem_green_day
WHERE id=#{id} WHERE id=#{id}
</delete> </delete>
...@@ -138,30 +138,30 @@ ...@@ -138,30 +138,30 @@
<!-- 新增表t_analysis_problem_green_day信息 --> <!-- 新增表t_analysis_problem_green_day信息 -->
<insert id="addAnalysisProblemGreenDay"> <insert id="addAnalysisProblemGreenDay">
INSERT INTO t_analysis_problem_green_day ( INSERT INTO t_analysis_problem_green_day (
id id
,area_id ,area_id
,event_category ,event_category
,event_type ,event_type
,event_number ,event_number
,event_total_time ,event_total_time
,window_start_time ,window_start_time
,window_end_time ,window_end_time
,green_id ,green_id
,dt ,dt
,insert_time ,insert_time
) VALUES ( ) VALUES (
#{id} #{id}
,#{areaId} ,#{areaId}
,#{eventCategory} ,#{eventCategory}
,#{eventType} ,#{eventType}
,#{eventNumber} ,#{eventNumber}
,#{eventTotalTime} ,#{eventTotalTime}
,#{windowStartTime} ,#{windowStartTime}
,#{windowEndTime} ,#{windowEndTime}
,#{greenId} ,#{greenId}
,#{dt} ,#{dt}
,#{insertTime} ,#{insertTime}
) )
</insert> </insert>
<!-- 新增表t_analysis_problem_green_day信息 --> <!-- 新增表t_analysis_problem_green_day信息 -->
...@@ -191,25 +191,25 @@ ...@@ -191,25 +191,25 @@
<insert id="insertAnalysisProblemGreenHour"> <insert id="insertAnalysisProblemGreenHour">
insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time) insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration , select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2, DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now() DATE_FORMAT(now(),'%Y%m%d') as dt , now()
from from
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir (select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
from from
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir (select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (705,706) and a.green_id != '' and a.type in (705,706) and a.green_id != ''
and a.dir is not null and a.dir is not null
and length(a.dir)>2 and length(a.dir)>2
) b ) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> ( INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1 LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d )) d
left join t_greenwave_info e on d.green_id = e.id left join t_greenwave_info e on d.green_id = e.id
group by d.green_id, e.area_id,d.category,d.type,d.dir group by d.green_id, e.area_id,d.category,d.type,d.dir
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
id=VALUES(id), id=VALUES(id),
green_id=VALUES(green_id), green_id=VALUES(green_id),
area_id=VALUES(area_id), area_id=VALUES(area_id),
...@@ -226,53 +226,59 @@ ...@@ -226,53 +226,59 @@
</insert> </insert>
<!-- 根据条件查询表t_analysis_problem_green_day信息 --> <!-- 根据条件查询表t_analysis_problem_green_day信息 -->
<!-- <select id="checkData" resultMap="AnalysisProblemGreenDayMap">-->
<!-- SELECT dt-->
<!-- FROM t_analysis_problem_green_day-->
<!-- WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')-->
<!-- </select>-->
<select id="checkData" resultMap="AnalysisProblemGreenDayMap"> <select id="checkData" resultMap="AnalysisProblemGreenDayMap">
SELECT dt SELECT dt
FROM t_analysis_problem_green_day FROM t_analysis_problem_green_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') WHERE dt = to_char(CURRENT_DATE - INTERVAL '1 day', 'YYYYMMDD') :: INTEGER
</select> </select>
<select id="getListGreenByProblemSum" parameterType="map" resultMap="AnalysisProblemGreenDayMap"> <select id="getListGreenByProblemSum" parameterType="map" resultMap="AnalysisProblemGreenDayMap">
SELECT SELECT
sum(t1.event_number) as event_number, sum(t1.event_number) as event_number,
sum(event_total_time) as event_total_time, sum(event_total_time) as event_total_time,
t1.event_type, t1.event_type,
t2.label as typeName t2.label as typeName
FROM t_analysis_problem_green_day t1 FROM t_analysis_problem_green_day t1
LEFT JOIN t_config_event_category t2 on t1.event_type=t2.event_type LEFT JOIN t_config_event_category t2 on t1.event_type=t2.event_type
WHERE WHERE
1=1 1=1
<if test="startTime!=null and endTime!=''"> <if test="startTime!=null and endTime!=''">
<![CDATA[ <![CDATA[
AND dt>=#{startTime} AND dt<=#{endTime} AND dt>=#{startTime} AND dt<=#{endTime}
]]> ]]>
</if> </if>
<if test="greenId!=null and greenId!=''"> <if test="greenId!=null and greenId!=''">
AND t1.green_id=#{greenId} AND t1.green_id=#{greenId}
</if> </if>
GROUP BY GROUP BY
t1.event_type t1.event_type
</select> </select>
<select id="getListGreenByProblemTrend" parameterType="map" resultMap="AnalysisProblemGreenDayMap"> <select id="getListGreenByProblemTrend" parameterType="map" resultMap="AnalysisProblemGreenDayMap">
SELECT SELECT
dt, dt,
sum( event_number ) AS event_number, sum( event_number ) AS event_number,
sum(event_total_time) As event_total_time, sum(event_total_time) As event_total_time,
t1.event_type, t1.event_type,
t2.label AS typeName t2.label AS typeName
FROM t_analysis_problem_green_day t1 FROM t_analysis_problem_green_day t1
JOIN t_config_event_category t2 ON t1.event_type = t2.event_type JOIN t_config_event_category t2 ON t1.event_type = t2.event_type
WHERE WHERE
1 = 1 1 = 1
<if test="startTime != null and endTime != ''"> <if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime} and dt >= #{startTime} AND dt &lt;= #{endTime}
</if> </if>
<if test="greenId != null and greenId != ''"> <if test="greenId != null and greenId != ''">
and t1.green_id = #{greenId} and t1.green_id = #{greenId}
</if> </if>
GROUP BY dt, t1.event_type GROUP BY dt, t1.event_type
ORDER BY dt ORDER BY dt
</select> </select>
</mapper> </mapper>
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
dt, dt,
dir, dir,
sum(event_number)AS event_number , sum(event_number)AS event_number ,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time , to_char(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
t1.event_type, t1.event_type,
t2.label AS typeName t2.label AS typeName
FROM t_analysis_problem_green_hour t1 FROM t_analysis_problem_green_hour t1
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
and t1.event_type = #{eventType} and t1.event_type = #{eventType}
</if> </if>
GROUP BY GROUP BY
DATE_FORMAT(t1.window_start_time,'%H:%i') to_char(t1.window_start_time,'HH24:MI')
ORDER BY event_number desc ORDER BY event_number desc
limit 2 limit 2
</select> </select>
......
...@@ -5,15 +5,28 @@ ...@@ -5,15 +5,28 @@
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_schedules_plan as a LEFT JOIN t_base_cross_section as b on a.plan_id = b.plan_id LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where a.cross_id = #{crossId} and a.week = #{weekNumber} ORDER BY start_time SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_schedules_plan as a LEFT JOIN t_base_cross_section as b on a.plan_id = b.plan_id LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where a.cross_id = #{crossId} and a.week = #{weekNumber} ORDER BY start_time
</select> </select>
<!-- <select id="getSpecialDate" resultType="java.util.Map">-->
<!-- SELECT DATE_FORMAT(special_date, '%Y-%m-%d %H:%i:%s') AS special_date, plan_id-->
<!-- FROM t_base_cross_schedules_plan-->
<!-- WHERE cross_id = #{crossId}-->
<!-- <if test="endTime != null and endTime != '' and startTime != null and startTime !='' ">-->
<!-- and special_date between #{startTime} and #{endTime}-->
<!-- </if>-->
<!-- AND week = 0-->
<!-- </select>-->
<select id="getSpecialDate" resultType="java.util.Map"> <select id="getSpecialDate" resultType="java.util.Map">
SELECT DATE_FORMAT(special_date, '%Y-%m-%d %H:%i:%s') AS special_date, plan_id SELECT
to_char(special_date, 'YYYY-MM-DD HH24:MI:SS') AS special_date,
plan_id
FROM t_base_cross_schedules_plan FROM t_base_cross_schedules_plan
WHERE cross_id = #{crossId} WHERE cross_id = #{crossId}
<if test="endTime != null and endTime != '' and startTime != null and startTime !='' "> <if test="endTime != null and endTime != '' and startTime != null and startTime !=''">
and special_date between #{startTime} and #{endTime} AND special_date BETWEEN #{startTime}::timestamp AND #{endTime}::timestamp
</if> </if>
AND week = 0 AND week = 0
</select> </select>
<select id="getSpecialByDateScope" resultType="java.util.Map"> <select id="getSpecialByDateScope" resultType="java.util.Map">
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_section as b LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where b.cross_id = #{crossId} and b.plan_id = #{planId} ORDER BY start_time SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_section as b LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where b.cross_id = #{crossId} and b.plan_id = #{planId} ORDER BY start_time
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment