Rev 718 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 718 | Rev 730 | ||
|---|---|---|---|
| Line 5... | Line 5... | ||
| 5 | import java.util.List; |
5 | import java.util.List; |
| 6 | 6 | ||
| 7 | import org.apache.commons.httpclient.util.DateUtil; |
7 | import org.apache.commons.httpclient.util.DateUtil; |
| 8 | import org.primefaces.model.file.UploadedFile; |
8 | import org.primefaces.model.file.UploadedFile; |
| 9 | 9 | ||
| - | 10 | import br.com.ec.core.exception.NegocioException; |
|
| 10 | import br.com.ec.core.util.StringUtil; |
11 | import br.com.ec.core.util.StringUtil; |
| 11 | import br.com.ec.core.util.VerificadorUtil; |
12 | import br.com.ec.core.util.VerificadorUtil; |
| 12 | import br.com.ec.web.util.DataUtil; |
13 | import br.com.ec.web.util.DataUtil; |
| 13 | 14 | ||
| 14 | public class ExtratoAntecipacaoArquivoDTO { |
15 | public class ExtratoAntecipacaoArquivoDTO { |
| Line 133... | Line 134... | ||
| 133 | }
|
134 | }
|
| 134 | */
|
135 | */
|
| 135 | 136 | ||
| 136 | public void extrairDadosArquivo(Date dataAntecipacao) { |
137 | public void extrairDadosArquivo(Date dataAntecipacao) { |
| 137 | List<ExtratoAntecipacaoDTO> extratoAntecipacaoDTOs = new ArrayList<ExtratoAntecipacaoDTO>(); |
138 | List<ExtratoAntecipacaoDTO> extratoAntecipacaoDTOs = new ArrayList<ExtratoAntecipacaoDTO>(); |
| 138 | // setDadosExtratoBancoDTO(new ArrayList<ExtratoBancoDTO>());
|
- | |
| 139 | // getDadosExtratoBancoDTO().addAll(extrairDadosItau(extratosAnexadosAnteriormente));
|
- | |
| 140 | Long sequencial = new Long(1); |
139 | Long sequencial = new Long(1); |
| 141 | for (String linha : this.getLinhasArquivo()) { |
140 | for (String linha : this.getLinhasArquivo()) { |
| 142 | // 10/10/2024;29/08/2024;29/05/2025;R$ 60,00;R$ 60,00;2,30%;R$ 1,38;R$ 58,62;Livre;100,0000%;21769086;-;-;0548980;93849763;ESPACO CASE;81704828;546479******1520;não;-;Crédito;Mastercard;10;9;ITAÚ UNIBANCO S.A.;7951;998611;-;-;antecipada
|
- | |
| 143 | // 10/10/2024;05/08/2024;05/06/2025;R$ 41,50;R$ 41,50;2,30%;R$ 0,95;R$ 40,55;Livre;100,0000%;32994398;-;-;0086277;62449554;ESPACO CASE;81704828;485464******4098;não;-;Crédito;Visa;10;10;ITAÚ UNIBANCO S.A.;7951;998611;-;-;antecipada
|
- | |
| 144 | // System.out.println(linha);
|
- | |
| 145 | String[] dadosSeparados = linha.split(";"); |
141 | String[] dadosSeparados = linha.split(";"); |
| 146 | if (dadosSeparados.length >= 29) { |
142 | if (dadosSeparados.length >= 29) { |
| 147 | if (VerificadorUtil.naoEstaNuloOuVazio(dadosSeparados[2])) { |
143 | if (VerificadorUtil.naoEstaNuloOuVazio(dadosSeparados[2])) { |
| 148 | if (dadosSeparados[29].contains("antecipada")) { |
144 | if (dadosSeparados[29].contains("antecipada")) { |
| 149 | ExtratoAntecipacaoDTO extratoAntecipacaoDTO = new ExtratoAntecipacaoDTO(); |
145 | ExtratoAntecipacaoDTO extratoAntecipacaoDTO = new ExtratoAntecipacaoDTO(); |
| Line 164... | Line 160... | ||
| 164 | extratoAntecipacaoDTO.setBandeira(bandeira); |
160 | extratoAntecipacaoDTO.setBandeira(bandeira); |
| 165 | extratoAntecipacaoDTO.setValorLiquido(valor); |
161 | extratoAntecipacaoDTO.setValorLiquido(valor); |
| 166 | extratoAntecipacaoDTO.setQuantidadeParcelas(new Integer(dadosSeparados[22])); |
162 | extratoAntecipacaoDTO.setQuantidadeParcelas(new Integer(dadosSeparados[22])); |
| 167 | extratoAntecipacaoDTO.setNumeroDaParcela(new Integer(dadosSeparados[23])); |
163 | extratoAntecipacaoDTO.setNumeroDaParcela(new Integer(dadosSeparados[23])); |
| 168 | extratoAntecipacaoDTOs.add(extratoAntecipacaoDTO); |
164 | extratoAntecipacaoDTOs.add(extratoAntecipacaoDTO); |
| 169 | // [20] Débito ou Crédito
|
- | |
| 170 | // [21] Elo, Hipercard, Mastercard, Visa...
|
- | |
| 171 | // [22] Qnt de parcelas
|
- | |
| 172 | // [23] Número da parcela
|
- | |
| 173 | // [29] antecipada 758
|
- | |
| 174 | }
|
165 | }
|
| 175 | }
|
166 | }
|
| 176 | }
|
167 | }
|
| 177 | }
|
168 | }
|
| 178 | 169 | ||
| 179 | StringBuilder sqlConsulta = new StringBuilder(); |
170 | StringBuilder sqlConsulta = new StringBuilder(); |
| 180 | sqlConsulta.append("SELECT new br.com.ec.domain.dto.ParcelaDTO("); |
171 | sqlConsulta.append("SELECT new br.com.ec.domain.dto.ParcelaDTO("); |
| 181 | sqlConsulta.append(ParcelaDTO.CONSULTA_SEM_CATEGORIA_DTO); |
172 | sqlConsulta.append(ParcelaDTO.CONSULTA_SEM_CATEGORIA_DTO); |
| 182 | sqlConsulta.append(") FROM Parcela e "); |
173 | sqlConsulta.append(") FROM Parcela e "); |
| 183 | sqlConsulta.append("WHERE e.indicadorAtivo IS TRUE AND e.dataPagamento IS NULL AND ("); |
174 | sqlConsulta.append("WHERE e.indicadorAtivo IS TRUE AND e.dataPagamento IS NULL AND ("); |
| - | 175 | ||
| - | 176 | if (VerificadorUtil.isListaNulaOuVazia(extratoAntecipacaoDTOs)) { |
|
| - | 177 | throw new NegocioException("PLANILHA SEM ANTECIPAÇÃO ENCONTRADA"); |
|
| - | 178 | }
|
|
| - | 179 | ||
| 184 | for (ExtratoAntecipacaoDTO extratoAntecipacaoDTO : extratoAntecipacaoDTOs) { |
180 | for (ExtratoAntecipacaoDTO extratoAntecipacaoDTO : extratoAntecipacaoDTOs) { |
| 185 | Double valorInicial = extratoAntecipacaoDTO.getValorLiquido() - 0.10; |
181 | Double valorInicial = extratoAntecipacaoDTO.getValorLiquido() - 0.10; |
| 186 | Double valorFinal = extratoAntecipacaoDTO.getValorLiquido() + 0.10; |
182 | Double valorFinal = extratoAntecipacaoDTO.getValorLiquido() + 0.10; |
| 187 | sqlConsulta.append("("); |
183 | sqlConsulta.append("("); |
| 188 | sqlConsulta.append("(e.dataVencimento = '" + DateUtil.formatDate(extratoAntecipacaoDTO.getDataVencimento(), "yyyy-MM-dd") + "' OR "); |
184 | sqlConsulta.append("(e.dataVencimento = '" + DateUtil.formatDate(extratoAntecipacaoDTO.getDataVencimento(), "yyyy-MM-dd") + "' OR "); |
| Line 191... | Line 187... | ||
| 191 | sqlConsulta.append("e.valor >= " + valorInicial + " AND e.valor <= " + valorFinal + " AND "); |
187 | sqlConsulta.append("e.valor >= " + valorInicial + " AND e.valor <= " + valorFinal + " AND "); |
| 192 | sqlConsulta.append("e.observacao LIKE 'CRÉDITO " + extratoAntecipacaoDTO.getNumeroDaParcela() + "/" + extratoAntecipacaoDTO.getQuantidadeParcelas() + "%" + extratoAntecipacaoDTO.getBandeira() + "%') "); |
188 | sqlConsulta.append("e.observacao LIKE 'CRÉDITO " + extratoAntecipacaoDTO.getNumeroDaParcela() + "/" + extratoAntecipacaoDTO.getQuantidadeParcelas() + "%" + extratoAntecipacaoDTO.getBandeira() + "%') "); |
| 193 | sqlConsulta.append("OR "); |
189 | sqlConsulta.append("OR "); |
| 194 | }
|
190 | }
|
| 195 | sqlConsulta.append(")"); |
191 | sqlConsulta.append(")"); |
| 196 | System.out.println(sqlConsulta.toString().replace("OR )", ")")); |
- | |
| 197 | 192 | ||
| 198 | setDadosExtratoAntecipacaoDTOSemConciliacao(extratoAntecipacaoDTOs); |
193 | setDadosExtratoAntecipacaoDTOSemConciliacao(extratoAntecipacaoDTOs); |
| 199 | setSqlConsultaParcelas(sqlConsulta.toString().replace("OR )", ")")); |
194 | setSqlConsultaParcelas(sqlConsulta.toString().replace("OR )", ")")); |
| 200 | }
|
- | |
| 201 | - | ||
| 202 | public void extrairDados(List<ExtratoAntecipacaoArquivoDTO> extratosAnexadosAnteriormente) { |
- | |
| 203 | // if (getTipoExtratoBancarioCsv().equals(TipoExtratoBancarioCsv.EXTRATO_BANCARIO_CSV_ITAU.getValor())) {
|
- | |
| 204 | // setDadosExtratoBancoDTO(new ArrayList<ExtratoBancoDTO>());
|
- | |
| 205 | // getDadosExtratoBancoDTO().addAll(extrairDadosItau(extratosAnexadosAnteriormente));
|
- | |
| 206 | // }
|
- | |
| 207 | }
|
195 | }
|
| 208 | 196 | ||
| 209 | public static void main(String[] args) { |
197 | public static void main(String[] args) { |
| 210 | String valor = "SISPAG PAG TIT BANCO 00"; |
198 | String valor = "SISPAG PAG TIT BANCO 00"; |
| 211 | System.out.println(!valor.contains("SISPAG PAG")); |
199 | System.out.println(!valor.contains("SISPAG PAG")); |
| 212 | }
|
200 | }
|
| 213 | 201 | ||
| 214 | /*
|
- | |
| 215 | private Boolean dadoExtratoBancarioEhNovo(List<AntecipacaoArquivoDTO> extratosAnexadosAnteriormente, ExtratoBancoDTO extratoBancoNovoDTO) {
|
- | |
| 216 | List<ExtratoBancoDTO> extratosAnexados = new ArrayList<ExtratoBancoDTO>();
|
- | |
| 217 | for (AntecipacaoArquivoDTO extratoBancarioArquivoDTO : extratosAnexadosAnteriormente) {
|
- | |
| 218 | if (extratoBancarioArquivoDTO.getContaBancariaDTO().getSequencial().equals(extratoBancoNovoDTO.getContaBancariaDTO().getSequencial())) {
|
- | |
| 219 | extratosAnexados.addAll(extratoBancarioArquivoDTO.getDadosExtratoBancoDTO());
|
- | |
| 220 | break;
|
- | |
| 221 | }
|
- | |
| 222 | }
|
- | |
| 223 | for (ExtratoBancoDTO extratoBancoDTO : extratosAnexados) {
|
- | |
| 224 | if (DataUtils.datasIguais(extratoBancoDTO.getDataLancamento(), extratoBancoNovoDTO.getDataLancamento()) &&
|
- | |
| 225 | extratoBancoDTO.getDescricao().equals(extratoBancoNovoDTO.getDescricao()) &&
|
- | |
| 226 | extratoBancoDTO.getValorTotal().equals(extratoBancoNovoDTO.getValorTotal())) {
|
- | |
| 227 | return false;
|
- | |
| 228 | }
|
- | |
| 229 | }
|
- | |
| 230 | return true;
|
- | |
| 231 | }
|
- | |
| 232 |
|
- | |
| 233 | public void marcarTodosDadosExtrato() {
|
- | |
| 234 | if (VerificadorUtil.naoEstaNuloOuVazio(getDadosExtratoBancoDTO())) {
|
- | |
| 235 | for (ExtratoBancoDTO extratoBancoDTO : getDadosExtratoBancoDTO()) {
|
- | |
| 236 | extratoBancoDTO.setIndicadorCadastrar(true);
|
- | |
| 237 | }
|
- | |
| 238 | }
|
- | |
| 239 | }
|
- | |
| 240 |
|
- | |
| 241 | public void desmarcarTodosDadosExtrato() {
|
- | |
| 242 | if (VerificadorUtil.naoEstaNuloOuVazio(getDadosExtratoBancoDTO())) {
|
- | |
| 243 | for (ExtratoBancoDTO extratoBancoDTO : getDadosExtratoBancoDTO()) {
|
- | |
| 244 | extratoBancoDTO.setIndicadorCadastrar(false);
|
- | |
| 245 | }
|
- | |
| 246 | }
|
- | |
| 247 | }
|
- | |
| 248 | */
|
- | |
| 249 | }
|
202 | }
|