Rev 195 | Rev 328 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 195 | Rev 291 | ||
|---|---|---|---|
| Line 15... | Line 15... | ||
| 15 | import org.apache.poi.ss.usermodel.Cell; |
15 | import org.apache.poi.ss.usermodel.Cell; |
| 16 | import org.apache.poi.ss.usermodel.Row; |
16 | import org.apache.poi.ss.usermodel.Row; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; |
17 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Service; |
18 | import org.springframework.stereotype.Service; |
| 19 | 19 | ||
| - | 20 | import br.com.ec.core.exception.NegocioException; |
|
| 20 | import br.com.ec.core.generic.AbstractService; |
21 | import br.com.ec.core.generic.AbstractService; |
| 21 | import br.com.ec.core.generic.GenericRepository; |
22 | import br.com.ec.core.generic.GenericRepository; |
| 22 | import br.com.ec.core.util.DataUtils; |
23 | import br.com.ec.core.util.DataUtils; |
| 23 | import br.com.ec.core.util.StringUtil; |
24 | import br.com.ec.core.util.StringUtil; |
| 24 | import br.com.ec.core.util.VerificadorUtil; |
25 | import br.com.ec.core.util.VerificadorUtil; |
| Line 117... | Line 118... | ||
| 117 | Iterator rowIterator = sheet.rowIterator(); |
118 | Iterator rowIterator = sheet.rowIterator(); |
| 118 | while (rowIterator.hasNext()) { |
119 | while (rowIterator.hasNext()) { |
| 119 | Row row = (Row) rowIterator.next(); |
120 | Row row = (Row) rowIterator.next(); |
| 120 | if (row.getRowNum() < 11) { |
121 | if (row.getRowNum() < 11) { |
| 121 | continue; |
122 | continue; |
| 122 | } else if (row.getRowNum() < 52) { |
- | |
| - | 123 | } else { |
|
| 123 | Iterator cellIterator = row.cellIterator(); |
124 | Iterator cellIterator = row.cellIterator(); |
| 124 | Integer codigoFolha = null; |
125 | Integer codigoFolha = null; |
| 125 | while (cellIterator.hasNext()) { |
126 | while (cellIterator.hasNext()) { |
| 126 | Boolean atualizar = true; |
127 | Boolean atualizar = true; |
| 127 | Cell cell = (Cell) cellIterator.next(); |
128 | Cell cell = (Cell) cellIterator.next(); |
| Line 136... | Line 137... | ||
| 136 | }
|
137 | }
|
| 137 | break; |
138 | break; |
| 138 | case 3: |
139 | case 3: |
| 139 | if (atualizar) { |
140 | if (atualizar) { |
| 140 | for (AvaliacaoFuncionario avaliacaoFunc : avaliacao.getParticipantes()) { |
141 | for (AvaliacaoFuncionario avaliacaoFunc : avaliacao.getParticipantes()) { |
| - | 142 | if (VerificadorUtil.estaNulo(avaliacaoFunc.getFuncionario().getCodigoContabilidade())) { |
|
| - | 143 | throw new NegocioException("Participante " + avaliacaoFunc.getFuncionario().getNomeDaPessoa() + " sem código contábil cadastrado"); |
|
| - | 144 | }
|
|
| 141 | if (avaliacaoFunc.getFuncionario().getCodigoContabilidade().equals(codigoFolha)) { |
145 | if (avaliacaoFunc.getFuncionario().getCodigoContabilidade().equals(codigoFolha)) { |
| 142 | String valor = StringUtil.formatarValorComDoisDigitos(avaliacaoFunc.getValorComissao().toString()); |
- | |
| - | 146 | Double valorComissao = avaliacaoFunc.getValorComissao(); |
|
| - | 147 | if (VerificadorUtil.estaNulo(valorComissao)) { |
|
| - | 148 | throw new NegocioException("Obrigatório informar todas as comissões"); |
|
| - | 149 | }
|
|
| - | 150 | String valor = StringUtil.formatarValorComDoisDigitos(valorComissao.toString()); |
|
| 143 | cell.setCellValue(valor.replace(".", ",")); |
151 | cell.setCellValue(valor.replace(".", ",")); |
| 144 | break; |
152 | break; |
| 145 | }
|
153 | }
|
| 146 | }
|
154 | }
|
| 147 | }
|
155 | }
|
| Line 163... | Line 171... | ||
| 163 | arquivo.close(); |
171 | arquivo.close(); |
| 164 | workbook.close(); |
172 | workbook.close(); |
| 165 | }
|
173 | }
|
| 166 | } catch (FileNotFoundException e) { |
174 | } catch (FileNotFoundException e) { |
| 167 | e.printStackTrace(); |
175 | e.printStackTrace(); |
| - | 176 | } catch (NegocioException ne) { |
|
| - | 177 | throw new NegocioException(ne.getMessage()); |
|
| 168 | } catch (Exception e) { |
178 | } catch (Exception e) { |
| 169 | e.printStackTrace(); |
179 | e.printStackTrace(); |
| 170 | }
|
180 | }
|
| 171 | 181 | ||
| 172 | return null; |
182 | return null; |