Merge remote-tracking branch 'origin/feature/temp_fix_punishment_info_' into develop
# Conflicts: # mappings/jobs_once_a_day/punishment_once.hpl
This commit is contained in:
commit
a660754968
1 changed files with 43 additions and 46 deletions
|
|
@ -26,6 +26,49 @@
|
|||
<enabled>Y</enabled>
|
||||
</hop>
|
||||
</order>
|
||||
<transform>
|
||||
<name>Table input 2</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>local_ervu_person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH ugol AS (SELECT ri.recruit_id,
|
||||
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
|
||||
FROM public.recruits_info ri
|
||||
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null')
|
||||
SELECT recruit_id,
|
||||
nakaz ->> 'naimSud' AS authority_name,
|
||||
nakaz ->> 'srokNakaz' AS sentence,
|
||||
nakaz ->> 'adresOrg' AS sentence_place,
|
||||
-- nakaz->>'vidNakaz' AS punishment_code,
|
||||
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
|
||||
nakaz ->> 'vidNakaz' AS punishment_type,
|
||||
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
|
||||
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
|
||||
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
|
||||
string_agg(statiuk_elem::text, ', ') AS law_point,
|
||||
nakaz ->> 'osnOsvob' release_reason
|
||||
FROM ugol
|
||||
LEFT JOIN LATERAL jsonb_path_query(nakaz, '$.statiUK[*]') AS statiuk_elem ON true
|
||||
join public.recruits r ON r.id = ugol.recruit_id AND
|
||||
(r.target_recruitment_id = '${RCRT_C}' or
|
||||
r.current_recruitment_id = '${RCRT_C}')
|
||||
GROUP BY recruit_id, nakaz;</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>464</xloc>
|
||||
<yloc>304</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table output</name>
|
||||
<type>TableOutput</type>
|
||||
|
|
@ -60,52 +103,6 @@
|
|||
<yloc>304</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform>
|
||||
<name>Table input 2</name>
|
||||
<type>TableInput</type>
|
||||
<description/>
|
||||
<distribute>Y</distribute>
|
||||
<custom_distribution/>
|
||||
<copies>1</copies>
|
||||
<partitioning>
|
||||
<method>none</method>
|
||||
<schema_name/>
|
||||
</partitioning>
|
||||
<connection>ervu_person_registry</connection>
|
||||
<execute_each_row>N</execute_each_row>
|
||||
<limit>0</limit>
|
||||
<sql>WITH ugol AS (SELECT ri.recruit_id,
|
||||
jsonb_array_elements(ri.info -> 'svedFL' -> 'svedNakaz' -> 'nakaz') AS nakaz
|
||||
FROM public.recruits_info ri
|
||||
WHERE ri.info -> 'svedFL' -> 'svedNakaz' ->> 'nakaz' != 'null')
|
||||
SELECT recruit_id,
|
||||
nakaz ->> 'naimSud' AS authority_name,
|
||||
nakaz ->> 'srokNakaz' AS sentence,
|
||||
nakaz ->> 'adresOrg' AS sentence_place,
|
||||
-- nakaz->>'vidNakaz' AS punishment_code,
|
||||
nakaz ->> 'naimIzmSrokNakaz' AS sentence_changed,
|
||||
nakaz ->> 'vidNakaz' AS punishment_type,
|
||||
TO_DATE(nakaz ->> 'dataNachSrok', 'YYYY-MM-DD') AS start_date,
|
||||
TO_DATE(nakaz ->> 'dataOsvob', 'YYYY-MM-DD') AS release_date,
|
||||
TO_DATE(nakaz ->> 'dataOsuzhd', 'YYYY-MM-DD') AS sentense_date,
|
||||
nakaz ->> 'ugolovZakon' AS law_point,
|
||||
nakaz ->> 'osnovOsvobozhd' AS release_reason,
|
||||
string_agg(statiuk_elem::text, ', ') AS law_point,
|
||||
nakaz ->> 'osnOsvob' release_reason
|
||||
FROM ugol
|
||||
LEFT JOIN LATERAL jsonb_path_query(nakaz, '$.statiUK[*]') AS statiuk_elem ON true
|
||||
join public.recruits r ON r.id = ugol.recruit_id AND
|
||||
(r.target_recruitment_id = '${RCRT_C}' or
|
||||
r.current_recruitment_id = '${RCRT_C}')
|
||||
GROUP BY recruit_id, nakaz;
|
||||
</sql>
|
||||
<variables_active>Y</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
<xloc>464</xloc>
|
||||
<yloc>304</yloc>
|
||||
</GUI>
|
||||
</transform>
|
||||
<transform_error_handling>
|
||||
</transform_error_handling>
|
||||
<attributes/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue