|
|
|
|
@ -21,7 +21,9 @@ |
|
|
|
|
handle_dept, |
|
|
|
|
delay_count, |
|
|
|
|
delay_day, |
|
|
|
|
pc_count) |
|
|
|
|
pc_count, |
|
|
|
|
last_mod_date |
|
|
|
|
) |
|
|
|
|
values (#{nid}, |
|
|
|
|
#{businessId}, |
|
|
|
|
#{name}, |
|
|
|
|
@ -37,7 +39,9 @@ |
|
|
|
|
#{handleDept}, |
|
|
|
|
#{delayCount}, |
|
|
|
|
#{delayDay}, |
|
|
|
|
#{pcCount}) |
|
|
|
|
#{pcCount}, |
|
|
|
|
NOW() |
|
|
|
|
) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<insert id="insertDangerRoad"> |
|
|
|
|
@ -45,11 +49,15 @@ |
|
|
|
|
(nid, |
|
|
|
|
business_id, |
|
|
|
|
section_code, |
|
|
|
|
pc_count) |
|
|
|
|
pc_count, |
|
|
|
|
last_mod_date |
|
|
|
|
) |
|
|
|
|
values (#{nid}, |
|
|
|
|
#{businessId}, |
|
|
|
|
#{sectionCode}, |
|
|
|
|
#{pcCount}) |
|
|
|
|
#{pcCount}, |
|
|
|
|
NOW() |
|
|
|
|
) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<select id="getStatusCounts" resultType="com.hisense.hiatmp.model.common.HighDangerBaseNum"> |
|
|
|
|
@ -59,7 +67,7 @@ |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
@ -69,7 +77,7 @@ |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
@ -79,7 +87,7 @@ |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
@ -89,17 +97,19 @@ |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
SELECT 'Finished' AS status, SUM(CASE WHEN hdb.status = '40' THEN 1 ELSE 0 END) AS count |
|
|
|
|
SELECT 'Finished' AS status, SUM(CASE WHEN hdb.status = '20' THEN 1 ELSE 0 END) AS count |
|
|
|
|
FROM tht_hidden_danger_base hdb |
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
AND tt.operator = #{nuserid} |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
@ -109,55 +119,51 @@ |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
SELECT DISTINCT 'MonthReport' AS status, |
|
|
|
|
SUM(CASE |
|
|
|
|
-- WHEN TO_TIMESTAMP(hdb.pc_end_time, 'DD/MM/YYYY HH24:MI:SS') > |
|
|
|
|
WHEN hdb.pc_end_time > |
|
|
|
|
DATE_TRUNC('MONTH', CURRENT_DATE) THEN 1 |
|
|
|
|
ELSE 0 END) AS count |
|
|
|
|
SELECT DISTINCT 'MonthReport' AS status, count(*) AS count |
|
|
|
|
FROM tht_hidden_danger_base hdb |
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr |
|
|
|
|
ON |
|
|
|
|
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
-- LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
AND tt.operator = #{nuserid} |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
SELECT DISTINCT 'Dying' AS status, |
|
|
|
|
SUM(CASE |
|
|
|
|
WHEN |
|
|
|
|
hdb.pc_end_time > |
|
|
|
|
CURRENT_TIMESTAMP - INTERVAL '3 days' |
|
|
|
|
and |
|
|
|
|
hdb.pc_end_time < |
|
|
|
|
CURRENT_TIMESTAMP |
|
|
|
|
THEN 1 ELSE 0 END) AS count |
|
|
|
|
|
|
|
|
|
SELECT DISTINCT 'Dying' AS status, count(*) AS count |
|
|
|
|
FROM tht_hidden_danger_base hdb |
|
|
|
|
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT' |
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr |
|
|
|
|
ON |
|
|
|
|
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} and hdb.status = '10' |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
<![CDATA[ |
|
|
|
|
AND NOW() >= COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value::INTEGER) - INTERVAL '3 day' |
|
|
|
|
AND NOW() <= COALESCE ( hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value :: INTEGER ) |
|
|
|
|
-- and hdb.status = '10' |
|
|
|
|
]]> |
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
SELECT DISTINCT 'Delay' AS status, |
|
|
|
|
SUM(CASE |
|
|
|
|
WHEN |
|
|
|
|
hdb.pc_end_time > |
|
|
|
|
CURRENT_TIMESTAMP |
|
|
|
|
THEN 1 |
|
|
|
|
ELSE 0 END) AS count |
|
|
|
|
SELECT DISTINCT 'Delay' AS status, count(*) AS count |
|
|
|
|
FROM tht_hidden_danger_base hdb |
|
|
|
|
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT' |
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr |
|
|
|
|
ON |
|
|
|
|
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count |
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid |
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} and hdb.status = '10' |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
<![CDATA[ |
|
|
|
|
AND NOW() >= COALESCE ( hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value :: INTEGER ) |
|
|
|
|
-- and hdb.status = '10' |
|
|
|
|
]]> |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -192,17 +198,22 @@ |
|
|
|
|
<select id="getHigDangerDealt" resultType="com.hisense.hiatmp.model.common.HighDangerBase"> |
|
|
|
|
<![CDATA[ |
|
|
|
|
SELECT CASE |
|
|
|
|
WHEN now() < t1.nearEndTime THEN 9 --正常 |
|
|
|
|
WHEN now() >= t1.nearEndTime AND now() <= t1.planEndTime THEN 2 --临期 |
|
|
|
|
WHEN now() >= t1.planEndTime THEN 1 --超期 |
|
|
|
|
WHEN now() AT TIME ZONE 'Asia/Shanghai' < t1.nearEndTime THEN 9 --正常 |
|
|
|
|
WHEN now() AT TIME ZONE 'Asia/Shanghai' >= t1.nearEndTime AND now() AT TIME ZONE 'Asia/Shanghai' <= t1.planEndTime THEN 2 --临期 |
|
|
|
|
WHEN now() AT TIME ZONE 'Asia/Shanghai' >= t1.planEndTime THEN 1 --超期 |
|
|
|
|
END AS time_status |
|
|
|
|
, t1.* |
|
|
|
|
, EXTRACT(EPOCH FROM NOW() - t1.planEndTime) AS timeDiffEnd |
|
|
|
|
, EXTRACT(EPOCH FROM NOW() - t1.nearEndTime) AS timeDiffStart |
|
|
|
|
-- , EXTRACT(EPOCH FROM NOW() - t1.planEndTime) AS timeDiffEnd |
|
|
|
|
-- , EXTRACT(EPOCH FROM t1.planEndTime - NOW() ) AS timeDiffStart |
|
|
|
|
, floor(EXTRACT(EPOCH FROM(now() AT TIME ZONE 'Asia/Shanghai' - planEndTime))/(1440*60)) delayDay |
|
|
|
|
, ceil(mod(ceil(EXTRACT(EPOCH FROM(now() AT TIME ZONE 'Asia/Shanghai' -planEndTime)))::INTEGER , 1440*60)::FLOAT/3600) delayHour |
|
|
|
|
, floor(EXTRACT(EPOCH FROM(planEndTime -now() AT TIME ZONE 'Asia/Shanghai'))/(1440*60)) nearDay |
|
|
|
|
, ceil(mod(ceil(EXTRACT(EPOCH FROM(planEndTime -now() AT TIME ZONE 'Asia/Shanghai')))::INTEGER , 1440*60)::FLOAT/3600) nearHour |
|
|
|
|
-- , now() - t1.planEndTime as timeDiffEnd |
|
|
|
|
-- , now() - t1.nearEndTime as timeDiffStart |
|
|
|
|
]]> |
|
|
|
|
FROM (SELECT hdb.name |
|
|
|
|
FROM (SELECT hdb.nid |
|
|
|
|
, hdb.name |
|
|
|
|
, hdb.pc_start_time |
|
|
|
|
, hdb.pc_end_time |
|
|
|
|
, hdb.business_id |
|
|
|
|
@ -213,6 +224,9 @@ |
|
|
|
|
, hdb."status" |
|
|
|
|
, hdr.belong_xq |
|
|
|
|
, hdr.xzjd |
|
|
|
|
, et.enumname |
|
|
|
|
, hdb.approve_status |
|
|
|
|
, hdr.section_code |
|
|
|
|
, COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value |
|
|
|
|
::INTEGER) AS planEndTime |
|
|
|
|
, COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value |
|
|
|
|
@ -229,11 +243,26 @@ |
|
|
|
|
AND et.enumvalue = hdb.status |
|
|
|
|
LEFT JOIN bis_section bs ON hdr.section_code = bs.section_code |
|
|
|
|
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT' |
|
|
|
|
WHERE hdb.handle_dept = #{cdepartmentid} |
|
|
|
|
<if test="classification != ''"> |
|
|
|
|
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id |
|
|
|
|
</if> |
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid},'%')) |
|
|
|
|
AND hdb.status = #{status} |
|
|
|
|
<if test="reportDept != ''"> |
|
|
|
|
AND hdb.handle_dept != hdb.report_dept |
|
|
|
|
-- AND nvl(hdb.Approve_Status,'0') in ('0','-1') |
|
|
|
|
<if test="search != null and search != ''"> |
|
|
|
|
AND hdb.name like concat(concat('%',#{search}),'%') |
|
|
|
|
</if> |
|
|
|
|
<if test="classification == 1"> |
|
|
|
|
AND tt.operator = #{nuserId} |
|
|
|
|
</if> |
|
|
|
|
<if test="classification == 2"> |
|
|
|
|
AND tt.title = '隐患上报' |
|
|
|
|
AND tt.operator = #{nuserId} |
|
|
|
|
</if> |
|
|
|
|
<if test="classification == 3"> |
|
|
|
|
AND tt.title != '隐患上报' |
|
|
|
|
AND tt.operator = #{nuserId} |
|
|
|
|
</if> |
|
|
|
|
) t1 |
|
|
|
|
ORDER BY time_status, planEndTime DESC |
|
|
|
|
</select> |
|
|
|
|
@ -315,7 +344,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getRoadInfo" resultType="com.hisense.hiatmp.model.common.HighDangerRoad"> |
|
|
|
|
|
|
|
|
|
SELECT DISTINCT thdb.*, thdr.address, thdr.section_code, thdr.if_cross, thdr.coordinate |
|
|
|
|
from tht_hidden_danger_base thdb |
|
|
|
|
left join tht_hidden_danger_road thdr on thdr.business_id = thdb.business_id |
|
|
|
|
@ -329,8 +357,8 @@ |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<insert id="insertRoad"> |
|
|
|
|
insert into tht_hidden_danger_road (nid, business_id) |
|
|
|
|
values (#{uuid}, #{businessId}) |
|
|
|
|
insert into tht_hidden_danger_road (nid, business_id,last_mod_date) |
|
|
|
|
values (#{uuid}, #{businessId},NOW()) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<select id="getImportDanger" resultType="com.hisense.hiatmp.model.common.ImportDangerDTO"> |
|
|
|
|
@ -350,20 +378,23 @@ |
|
|
|
|
<update id="saveSection"> |
|
|
|
|
update tht_hidden_danger_road thdr |
|
|
|
|
set address = #{address}, |
|
|
|
|
coordinate = #{coordinate} |
|
|
|
|
coordinate = #{coordinate}, |
|
|
|
|
last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
<update id="bindRoad"> |
|
|
|
|
update tht_hidden_danger_road |
|
|
|
|
set section_code = #{sectionCode} |
|
|
|
|
set section_code = #{sectionCode}, |
|
|
|
|
last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId}; |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
<update id="saveCrossing"> |
|
|
|
|
update tht_hidden_danger_road thdr |
|
|
|
|
set address = #{address}, |
|
|
|
|
coordinate = #{coordinate} |
|
|
|
|
coordinate = #{coordinate}, |
|
|
|
|
last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
@ -383,7 +414,7 @@ |
|
|
|
|
|
|
|
|
|
<select id="setApproval" resultType="String"> |
|
|
|
|
UPDATE tht_hidden_danger_base |
|
|
|
|
SET APPROVE_STATUS = 2 |
|
|
|
|
SET APPROVE_STATUS = 2,last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} RETURNING business_id; |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
@ -459,7 +490,8 @@ |
|
|
|
|
#{largeVehicleRate}, |
|
|
|
|
#{nonvehicleTraffic}, |
|
|
|
|
#{lastModeUser}, |
|
|
|
|
#{lastModeDate}) |
|
|
|
|
#{lastModeDate} |
|
|
|
|
) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<update id="updateSectionTraffic"> |
|
|
|
|
@ -472,20 +504,20 @@ |
|
|
|
|
"LARGE_VEHICLE_RATE" = #{largeVehicleRate}, |
|
|
|
|
"NONVEHICLE_TRAFFIC" = #{nonvehicleTraffic}, |
|
|
|
|
"LAST_MOD_USER" = #{lastModeUser}, |
|
|
|
|
"LAST_MOD_DATE" = #{lastModeDate} |
|
|
|
|
"LAST_MOD_DATE" = NOW() |
|
|
|
|
where "BUSINESS_ID" = #{businessId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
<update id="updateTemporary"> |
|
|
|
|
update tht_hidden_danger_base |
|
|
|
|
set status = #{temporary} |
|
|
|
|
set status = #{temporary},last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
<update id="updateDangerRoad"> |
|
|
|
|
update tht_hidden_danger_road |
|
|
|
|
set hd_flag = #{hdFlag} |
|
|
|
|
, pc_end_time = CURRENT_TIMESTAMP |
|
|
|
|
, pc_end_time = CURRENT_TIMESTAMP,last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} |
|
|
|
|
and pc_count = #{pcCount} |
|
|
|
|
</update> |
|
|
|
|
@ -497,15 +529,15 @@ |
|
|
|
|
|
|
|
|
|
<insert id="saveDangerExtra"> |
|
|
|
|
INSERT INTO tht_hidden_danger_road_info (nid, business_id, big_category, small_category, hd_term, hd_desc, |
|
|
|
|
pc_count, hd_pic, hd_info, pc_type) |
|
|
|
|
pc_count, hd_pic, hd_info, pc_type, last_mod_date) |
|
|
|
|
VALUES (#{nid}, #{businessId}, #{bigCategory}, #{smallCategory}, #{hdTerm}, |
|
|
|
|
#{hdDesc}, #{pcCount}, #{hdPic}, #{hdInfo}, #{pcType}) |
|
|
|
|
#{hdDesc}, #{pcCount}, #{hdPic}, #{hdInfo}, #{pcType},NOW()) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="saveRoad"> |
|
|
|
|
insert into bis_road ("road_code", "road_name", "position") |
|
|
|
|
values (#{roadCode}, #{roadName}, #{position}) |
|
|
|
|
insert into bis_road ("road_code", "road_name", "position","last_mod_date") |
|
|
|
|
values (#{roadCode}, #{roadName}, #{position},NOW()) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<delete id="deleteRoadInfo"> |
|
|
|
|
@ -573,14 +605,15 @@ |
|
|
|
|
|
|
|
|
|
<update id="HighDangerSaveStatus"> |
|
|
|
|
update tht_hidden_danger_road |
|
|
|
|
set pc_type = #{pcType} |
|
|
|
|
set pc_type = #{pcType},last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
<update id="updateSectionCommunity"> |
|
|
|
|
update tht_hidden_danger_road |
|
|
|
|
set belong_xq = #{xqcode}, |
|
|
|
|
xzjd = #{jdcode} |
|
|
|
|
xzjd = #{jdcode}, |
|
|
|
|
last_mod_date = NOW() |
|
|
|
|
where business_id = #{businessId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
|