Revision 35652
Added by Antonis Lempesis over 9 years ago
modules/uoa-goldoa-service/trunk/src/main/java/eu/dnetlib/goldoa/service/RequestManagerImpl.java | ||
---|---|---|
43 | 43 |
String sql = UPDATE_REQUEST; |
44 | 44 |
|
45 | 45 |
if (request.getId() == null) { |
46 |
request.setId(new SimpleDateFormat("YYYY-MM-dd").format(new Date()) + this.getRequestId());
|
|
46 |
request.setId(new SimpleDateFormat("yyyyMMdd-").format(new Date()) + this.getRequestId());
|
|
47 | 47 |
|
48 | 48 |
sql = INSERT_REQUEST; |
49 | 49 |
} |
... | ... | |
99 | 99 |
}; |
100 | 100 |
|
101 | 101 |
private int getRequestId() { |
102 |
return new JdbcTemplate(dataSource).queryForObject("select nextval('request_id_seq')", new RowMapper<Integer>() { |
|
102 |
return new JdbcTemplate(dataSource).queryForObject("select nextval('request_id_seq') as id", new RowMapper<Integer>() {
|
|
103 | 103 |
@Override |
104 | 104 |
public Integer mapRow(ResultSet rs, int rowNum) throws SQLException { |
105 | 105 |
return rs.getInt("id"); |
modules/uoa-goldoa-service/trunk/src/main/java/eu/dnetlib/goldoa/service/InvoiceManagerImpl.java | ||
---|---|---|
21 | 21 |
import java.sql.ResultSet; |
22 | 22 |
import java.sql.SQLException; |
23 | 23 |
import java.sql.Types; |
24 |
import java.util.UUID; |
|
24 | 25 |
|
25 | 26 |
/** |
26 | 27 |
* Created by antleb on 3/21/15. |
... | ... | |
50 | 51 |
|
51 | 52 |
if (invoice.getId() == null) { |
52 | 53 |
invoice.setSource("portal"); |
53 |
invoice.setId("portal::" + DigestUtils.md5Hex(invoice.getNumber() + invoice.getDate().getTime()));
|
|
54 |
invoice.setId("portal::" + UUID.randomUUID().toString());
|
|
54 | 55 |
} |
55 | 56 |
|
56 | 57 |
if (jdbcTemplate.update(UPDATE_INVOICE, new Object[] {invoice.getNumber(), invoice.getDate(), invoice.getSource(), invoice.getId()}, new int[] {Types.VARCHAR, Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR}) == 0) { |
Also available in: Unified diff
- Changed the id creation method for invoices
- Fixed a bug in request id creation