some fixes

This commit is contained in:
Fusionshh 2025-10-20 22:48:41 +03:00
parent fee1f124b8
commit 0cdc8cffc6

View file

@ -36,16 +36,6 @@
<to>Abort</to> <to>Abort</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>employer_input</from>
<to>Identify last row in a stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>employer_output</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>employer_output</from> <from>employer_output</from>
<to>Change job status on error</to> <to>Change job status on error</to>
@ -61,16 +51,6 @@
<to>Change job status on success</to> <to>Change job status on success</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop>
<from>Identify last row in a stream</from>
<to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>Identify last row in a stream</from>
<to>filter_non_actual_employers</to>
<enabled>Y</enabled>
</hop>
<hop> <hop>
<from>filter_non_actual_employers</from> <from>filter_non_actual_employers</from>
<to>Update</to> <to>Update</to>
@ -82,18 +62,28 @@
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>employer_output</from> <from>Create job execution record</from>
<to>Block until transforms finish</to> <to>employer_input</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Block until transforms finish</from> <from>employer_output</from>
<to>Filter rows</to> <to>Filter rows</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
<hop> <hop>
<from>Create job execution record</from> <from>employer_input</from>
<to>employer_input</to> <to>Detect empty stream</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>employer_input</from>
<to>filter_non_actual_employers</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>employer_input</from>
<to>employer_output</to>
<enabled>Y</enabled> <enabled>Y</enabled>
</hop> </hop>
</order> </order>
@ -117,28 +107,6 @@
<yloc>448</yloc> <yloc>448</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Block until transforms finish</name>
<type>BlockUntilTransformsFinish</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<transforms>
<transform>
<name>Update</name>
</transform>
</transforms>
<attributes/>
<GUI>
<xloc>1120</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Change job status on error</name> <name>Change job status on error</name>
<type>ExecSql</type> <type>ExecSql</type>
@ -289,24 +257,6 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<yloc>288</yloc> <yloc>288</yloc>
</GUI> </GUI>
</transform> </transform>
<transform>
<name>Identify last row in a stream</name>
<type>DetectLastRow</type>
<description/>
<distribute>N</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<resultfieldname>last_row</resultfieldname>
<attributes/>
<GUI>
<xloc>528</xloc>
<yloc>288</yloc>
</GUI>
</transform>
<transform> <transform>
<name>Update</name> <name>Update</name>
<type>Update</type> <type>Update</type>
@ -346,7 +296,7 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<name>employer_input</name> <name>employer_input</name>
<type>TableInput</type> <type>TableInput</type>
<description/> <description/>
<distribute>Y</distribute> <distribute>N</distribute>
<custom_distribution/> <custom_distribution/>
<copies>1</copies> <copies>1</copies>
<partitioning> <partitioning>
@ -356,66 +306,70 @@ VALUES (DEFAULT, '${JOB_NAME}', 'PROCESSING', DEFAULT, null, '${IDM_ID}');
<connection>ervu-dashboard</connection> <connection>ervu-dashboard</connection>
<execute_each_row>N</execute_each_row> <execute_each_row>N</execute_each_row>
<limit>0</limit> <limit>0</limit>
<sql>with filteredData as (select ri.recruit_id, <sql>with filteredData as (
ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'aktRabotodat' as rabotodat, select ri.recruit_id,
true as actual_employer ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'aktRabotodat' as rabotodat,
from ervu_dashboard.recruits_info ri true as actual_employer,
where ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'aktRabotodat' != 'null' ctid
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) from ervu_dashboard.recruits_info ri
where COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
and (ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'aktRabotodat') &lt;&gt; 'null'
union all union all
select ri.recruit_id, select ri.recruit_id,
ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'predRabotodat' as rabotodat, ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' -> 'predRabotodat' as rabotodat,
false as actual_employer false as actual_employer,
from ervu_dashboard.recruits_info ri ctid
where ri.info -> 'svedFL' -&gt; 'svedRabotodat' -> 'rabotodat' ->> 'predRabotodat' != 'null' from ervu_dashboard.recruits_info ri
AND (ri.current_recruitment_id = '${IDM_ID}' or (ri.current_recruitment_id is null and ri.target_recruitment_id = '${IDM_ID}')) where COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = '${IDM_ID}'
and (ri.info -> 'svedFL' -> 'svedRabotodat' -> 'rabotodat' ->> 'predRabotodat') &lt;&gt; 'null'
) )
select select
fd.recruit_id, fd.recruit_id,
to_date(rabotodat ->> 'dataSved', 'YYYY-MM-DD') as source_update_date, to_date(rabotodat ->> 'dataSved', 'YYYY-MM-DD') as source_update_date,
rabotodat ->> 'id' as source_id, rabotodat ->> 'id' as source_id,
COALESCE(rabotodat -> 'extend' ->> 'status', '0') = '1' as status, COALESCE(rabotodat -> 'extend' ->> 'status', '0') = '1' as status,
rabotodat -> 'extend' ->> 'adresRabotodat' as address, rabotodat -> 'extend' ->> 'adresRabotodat' as address,
rabotodat -> 'extend' ->> 'tipPodrazdRabotodat' as separate_unit_type, rabotodat -> 'extend' ->> 'tipPodrazdRabotodat' as separate_unit_type,
rabotodat -> 'extend' ->> 'adresPodrazdRabotodat' as separate_unit_address, rabotodat -> 'extend' ->> 'adresPodrazdRabotodat' as separate_unit_address,
case case
when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null'
then 'Индивидуальный предприниматель' then 'Индивидуальный предприниматель'
when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' then 'Юридическое лицо' when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' then 'Юридическое лицо'
when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' then 'Глава КФХ' when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' then 'Глава КФХ'
when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' then 'Физическое лицо' when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' then 'Физическое лицо'
end as employer_category_name, end as employer_category_name,
rabotodat -> 'svedYUL' -> 'naimOrg' as name, rabotodat -> 'svedYUL' ->> 'naimOrg' as name,
case case
when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null'
then rabotodat -> 'svedIP' ->> 'innfl' then rabotodat -> 'svedIP' ->> 'innfl'
when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null'
then rabotodat -> 'svedYUL' ->> 'innyul' then rabotodat -> 'svedYUL' ->> 'innyul'
when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null' when rabotodat ->> 'svedGlKFH' is not null and rabotodat ->> 'svedGlKFH' != 'null'
then rabotodat -> 'svedGlKFH' ->> 'innfl' then rabotodat -> 'svedGlKFH' ->> 'innfl'
when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null' when rabotodat ->> 'svedPlatFL' is not null and rabotodat ->> 'svedPlatFL' != 'null'
then rabotodat -> 'svedPlatFL' ->> 'innfl' then rabotodat -> 'svedPlatFL' ->> 'innfl'
end as inn, end as inn,
case case
when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null' when rabotodat ->> 'svedIP' is not null and rabotodat ->> 'svedIP' != 'null'
then rabotodat -> 'extend' -> 'svedYUL' ->> 'ogrn' then rabotodat -> 'extend' -> 'svedYUL' ->> 'ogrn'
when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null'
then rabotodat -> 'svedIP' ->> 'ogrnip' then rabotodat -> 'svedIP' ->> 'ogrnip'
end as ogrn, end as ogrn,
case case
when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null' when rabotodat ->> 'svedYUL' is not null and rabotodat ->> 'svedYUL' != 'null'
then rabotodat -> 'extend' -> 'svedYUL' ->> 'kpp' then rabotodat -> 'extend' -> 'svedYUL' ->> 'kpp'
end as kpp, end as kpp,
coalesce(rabotodat -> 'svedYUL' -> 'extend' ->> 'priznakOpk', '0') = '1' as is_opk_org, coalesce(rabotodat -> 'svedYUL' -> 'extend' ->> 'priznakOpk', '0') = '1' as is_opk_org,
actual_employer, actual_employer,
coalesce(rabotodat -> 'extend' ->> 'statusRabotodat', '0') = '1' as status coalesce(rabotodat -> 'extend' ->&gt; 'statusRabotodat', '0') = '1' as status,
fd.ctid = (select max(ctid) from filteredData) as last_row
from filteredData fd;</sql> from filteredData fd;</sql>
<variables_active>Y</variables_active> <variables_active>Y</variables_active>
<attributes/> <attributes/>
<GUI> <GUI>
<xloc>352</xloc> <xloc>528</xloc>
<yloc>288</yloc> <yloc>288</yloc>
</GUI> </GUI>
</transform> </transform>