[
{
"operation": "modify-overwrite-beta",
"spec": {
"items": {
"*": {
"CEM": 100,
"idExterno": "=concat('pdvsync-piscofins-', @(1,codTribPisCofins),'-', @(1,dtUltAlt))",
/* JOLT não possui uma função nativa para multiplicar valores. */
/* mas tem como multiplicar usando dessa forma: */
/* https://intercom.help/godigibee/en/articles/4239806-transformations-with-jolt */
"valorInverso": "=divide(1, @(1,CEM))",
"aliquotaPisPercentual": "=divideAndRound(4, @(1,aliquotaPis), @(1,valorInverso))",
"aliquotaCofinsPercentual": "=divideAndRound(4, @(1,aliquotaCofins), @(1,valorInverso))",
/* Percentuais para string */
"aliquotaPisPercentualStr": "=toString(@(1,aliquotaPisPercentual))",
"aliquotaCofinsPercentualStr": "=toString(@(1,aliquotaCofinsPercentual))",
/* Separar as casas decimais pelo o '.' para remover o ponto*/
"aliquotaPisPercentualArr": "=split('\\.',@(1,aliquotaPisPercentualStr))",
"aliquotaCofinsPercentualArr": "=split('\\.',@(1,aliquotaCofinsPercentualStr))",
/*Juntar as casas decimais usando virgula*/
"aliquotaPis": "=join(',', @(1,aliquotaPisPercentualArr))",
"aliquotaCofins": "=join(',', @(1,aliquotaCofinsPercentualArr))"
}
}
}
},
{
"operation": "shift",
"spec": {
"items": {
"*": {
"idExterno": "idExterno",
"cst": ["items[&1].[0].cstPis", "items[&1].[0].cstCofins"],
"aliquotaPis": "items[&1].[0].aliquotaPis",
"aliquotaCofins": "items[&1].[0].aliquotaCofins",
"codTribPisCofins": "items[&1].[0].idRetaguarda"
}
}
}
},
{
"operation": "default",
"spec": {
"_attr_access": "items",
"items[]": {
"*[]": {
"*": {
"idInquilino": "{{ID_INQUILINO}}",
"idProprietario": "{{MASTER_ID_PROPRIETARIO}}",
"loteOrigem": "{{LOTE_ORIGEM}}",
"situacao": 1
}
}
}
}
}
] |