Merge branch 'develop_3' into 'develop_master'

预警导出 和 定时任务

See merge request LiuChao/foton-slrs-system-rest!277
This commit is contained in:
王夏晖
2021-12-09 19:36:43 +08:00
8 changed files with 164 additions and 40 deletions
@@ -38,16 +38,7 @@
<sql id="stand_where">
<if test="idList != null and idList.size() > 0">
warning.ID
IN
<foreach collection="idList" item="id" open="and (" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
<if test="waringEO.standCode != null and waringEO.standCode != ''">
AND trim(replace(CONCAT(
@@ -83,6 +74,92 @@
)
</if>
</sql>
<select id="exportWarning" resultType="com.adc.da.slrs.sarStandWarning.entity.StandWarningEO">
SELECT WARNING_RESULT.* FROM
(
SELECT
<include refid="stand_column"/>
,
attr.CLLX AS
APPLY_TYPE ,
attr
.ZRGCS AS DUTY_ENGINEER ,
NULL AS ITEMS_ID ,
NULL AS ITEMS_NUM , NULL AS ITEMS_NAME ,
NULL AS POLICY_ID ,
NULL AS POLICY_NAME ,
MARK ,
POWER,
attr.XCXSSRQ AS XCXSSRQ ,
attr.ZCCSSRQ AS ZCCSSRQ
FROM sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo on sarInfo.id=warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr on attr.STAND_ID=warning.STAND_ID
<where>
POWER = '1'
AND (MARK = 'stand')
<if test="idList != null and idList.size() > 0">
AND
warning.ID
IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
</where>
UNION ALL
SELECT
<include refid="stand_column"/> ,
items.APPLY_ARCTIC AS APPLY_TYPE ,
items.DUTY_ENGINEER AS DUTY_ENGINEER ,
items.ID AS ITEMS_ID ,
items.ITEMS_NUM ,
items.ITEMS_NAME ,
NULL AS POLICY_ID ,
NULL AS POLICY_NAME ,
MARK ,
POWER,
items.XCXSSRQ AS XCXSSRQ ,
items.ZCCSSRQ AS ZCCSSRQ
FROM
sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo ON sarInfo.id = warning.STAND_ID
LEFT JOIN sar_stand_items AS items ON items.STAND_ID = warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr ON attr.STAND_ID = warning.STAND_ID
<where>
POWER = '1'
AND (MARK = 'item')
<if test="idList != null and idList.size() > 0">
AND
warning.ID
IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
<!-- 每个遍历需要生成的串 -->
#{id}
</foreach>
</if>
</where>
)
WARNING_RESULT
LEFT JOIN
(
SELECT law_id,MIN(SSRQ) SSRQ_MIN FROM warning_date
GROUP BY warning_date.law_id
) warning_date
ON warning_date.law_id = WARNING_RESULT.STAND_ID
ORDER BY warning_date.SSRQ_MIN
</select>
<select id="selectWarningPage" resultMap="resultMap">
SELECT WARNING_RESULT.* FROM
@@ -51,15 +51,23 @@
<select id="getWarningId" resultType="com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO">
SELECT
law_id as STAND_ID,
'-1' AS itemsId,
'stand' AS mark,
'1' as power
law_id AS standId,
item_id AS itemId,
CASE
WHEN item_id = '-1' THEN
'stand'
WHEN
item_id IS NULL THEN
'stand'
ELSE
'item'
END AS mark,
'1' as power
FROM
warning_date AS warning
WHERE
DATE_FORMAT(warning.SSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
UNION
<!-- UNION
SELECT
STAND_ID,
ID AS itemsId,
@@ -70,7 +78,7 @@
WHERE
DATE_FORMAT(item.XCXSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
OR
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d') -->
</select>
@@ -79,25 +87,44 @@
SELECT lawId,timeName,DATE_FORMAT(SSRQ,'%Y-%m-%d') as SSRQ FROM
(
select attr.STAND_ID as lawId,'SSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
select attr.STAND_ID as lawId,'-1' as itemId,'SSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
UNION ALL
UNION ALL
select attr.STAND_ID as lawId,'XCXSSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.XCXSSRQ) - length(replace(attr.SSRQ,',',''))+1)
UNION ALL
select attr.STAND_ID as lawId,'ZCCSSRQ' as timeName,
substring_index(substring_index(attr.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &lt; (length(attr.SSRQ) - length(replace(attr.SSRQ,',',''))+1)
select attr.STAND_ID as lawId,'-1' as itemId,'XCXSSRQ' as timeName,
substring_index(substring_index(attr.SSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.XCXSSRQ) - length(replace(attr.XCXSSRQ,',',''))+1)
UNION ALL
select attr.STAND_ID as lawId,'-1' as itemId,'ZCCSSRQ' as timeName,
substring_index(substring_index(attr.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_attr_info attr
join mysql.help_topic b
on b.help_topic_id &gt; (length(attr.SSRQ) - length(replace(attr.ZCCSSRQ,',',''))+1)
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
substring_index(substring_index(item.ZCCSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_items item
join mysql.help_topic b
on b.help_topic_id &gt; (length(item.ZCCSSRQ) - length(replace(item.ZCCSSRQ,',',''))+1)
UNION All
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
substring_index(substring_index(item.XCXSSRQ,',',b.help_topic_id+1),',',-1) SSRQ
from sar_stand_items item
join mysql.help_topic b
on b.help_topic_id &gt; (length(item.XCXSSRQ) - length(replace(item.XCXSSRQ,',',''))+1)
) as T
WHERE