Skip to content

Commit

Permalink
Inicio estrutura cron job transacao
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfl2007 committed Feb 27, 2024
1 parent dabf084 commit 04534fa
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntityHelper } from './../../utils/entity-helper';
import { EntityHelper } from '../../utils/entity-helper';

@Entity()
class DetalheA extends EntityHelper{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ function Entity(): (target: typeof HeaderArquivo) => void | typeof HeaderArquivo
throw new Error("Function not implemented.");
}

function Column(arg0: { arg0: { type: string; }; }): (target: HeaderArquivo, propertyKey: "hr_geracao") => void {
throw new Error("Function not implemented.");
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions src/cnab/entity/transacao-cliente-item.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { EntityHelper } from '../../utils/entity-helper';
@Entity()
class TransacaoClienteItem extends EntityHelper{
id_item_transacao:number;
id_cliente_favorecido:number;
}

function Entity(): (target: typeof TransacaoClienteItem) => void | typeof TransacaoClienteItem {
throw new Error('Function not implemented.');
}
File renamed without changes.
4 changes: 0 additions & 4 deletions src/cnab/entitys/transacao-cliente-item.entity.ts

This file was deleted.

Empty file.
10 changes: 10 additions & 0 deletions src/cnab/listener/transacao.listener.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class TransacaoListener{

private transacaoService:TransacaoService;

//rodar as 09:00 e as 14:00
function JobTransaction(){
transacaoService.insereTransacoes();
}

}
Empty file.
1 change: 1 addition & 0 deletions src/cnab/repository/cliente-favorecido.repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//metodo de insert cliente favorecido
9 changes: 9 additions & 0 deletions src/cnab/repository/pagador.repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Pagador {


function getPagador(tipo:string):Pagador{//Saber se é fase 4 ou CCT pra pegar o pagador
//Se o tipo for CCT pagador 2
//Senao 1

}
}
Empty file.
Empty file.
30 changes: 30 additions & 0 deletions src/cnab/service/cliente-favorecido.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { UsersService } from 'src/users/users.service';
import { ClienteFavorecido } from './../entitys/cliente-favorecido.entity';

class ClienteFavorecidoService{

private clienteFavorecido: ClienteFavorecidoRepository;

private userService: UsersService;

function insertClienteFavorecido(){

// userService.get

for{
//veirificar se o usuario já existe na base
ClienteFavorecido.findByCpfCnj(cpf_cnpj);


// de/para -> user / Cliente

//se não existir

clienteFavorecido.insere();

//Se exitir
ClienteFavorecido.atualiza();
}
}

}
Empty file.
47 changes: 47 additions & 0 deletions src/cnab/service/transacao.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

class TransacaoService{


private transacoesRepository: TransacoesRepository;

private itemTransacaoRepository: ItemTransacoesRepository;

private clienteFavorecidoService: ClienteFavorecidoService;

private pagadorService: PagadorService;

function insereTransacoes(){
//metodo de inserir cliente Favorecido
var listaCliente = clienteFavorecidoService.insere();
//TransacoesFernanda buscar
var transacoesFernanda = buscar;

//percorrer todas a transações e inserir na tabela transacao
for(transacaoFernada : transacoesFernanda) {

//metodo de consultar o pagador
var pagador = pagadorService.getPagador(2):Pagador;
transacao.idPagador = idPagador;
transacao.nome = transacaoFernanda.nome;
//preencher o objeto transacao e inserir na base (id_pagador parte desse obj)

var id_transacao = transacoesRepository.insert(transacao)

//buscar todas as ordens de pagamento por idTransacaoFernanda
var ordensPgto = buscarOrder(transacaoFernada.idTransacaoFernanda);
for(ordemPgto:ordensPgto){

var id_cliente_favorecido = listaCliente.findByCPFCNPJ(ordemPgto.cpf_enpj);
itemTransacao.id_cliente_favorecido = id_cliente_favorecido;
//insere o item detalhamento
itemTransacao.id_transacao = id_transacao;
itemTransacao.idClientFavorecido = idClienteFavorecido;
itemTransacao.dt_transacao = ordemPgto.dt_transacao;

itemTransacaoRepository.insere(itemTransacao);
}

}

}
}

0 comments on commit 04534fa

Please sign in to comment.