mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 17:15:10 +00:00
fix vacunas
This commit is contained in:
parent
496073053c
commit
27022c75e3
2 changed files with 12 additions and 17 deletions
|
|
@ -61,7 +61,7 @@ public class VacunaController {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Log antes de intentar registrar la vacuna
|
// Log antes de intentar registrar la vacuna
|
||||||
System.out.println("Intentando registrar la vacuna...");
|
System.out.println("Intentando registrar la vacuna..." + vacuna);
|
||||||
|
|
||||||
vacunaService.cargarVacuna(vacuna);
|
vacunaService.cargarVacuna(vacuna);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ import com.code.hyperledger.models.VacunaDto;
|
||||||
import org.hyperledger.fabric.client.*;
|
import org.hyperledger.fabric.client.*;
|
||||||
import org.hyperledger.fabric.client.identity.*;
|
import org.hyperledger.fabric.client.identity.*;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.hyperledger.fabric.client.identity.Signer;
|
|
||||||
import org.hyperledger.fabric.client.identity.Identity;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -102,20 +100,17 @@ public class VacunaService {
|
||||||
|
|
||||||
public void cargarVacuna(Vacuna vacuna)
|
public void cargarVacuna(Vacuna vacuna)
|
||||||
throws CommitStatusException, EndorseException, CommitException, SubmitException {
|
throws CommitStatusException, EndorseException, CommitException, SubmitException {
|
||||||
contract.submitTransaction(
|
try {
|
||||||
"CreateVacuna",
|
System.out.println("Vacuna recibida correctamente (Service)" + vacuna);
|
||||||
vacuna.getId(),
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
vacuna.getIdentifier(),
|
String vacunaJson = objectMapper.writeValueAsString(vacuna);
|
||||||
vacuna.getStatus(),
|
|
||||||
vacuna.getStatusChange(),
|
contract.submitTransaction("CreateVacuna", vacunaJson);
|
||||||
vacuna.getStatusReason(),
|
System.out.println("Vacuna creada correctamente (Service)" + vacunaJson);
|
||||||
vacuna.getVaccinateCode(),
|
} catch (Exception e) {
|
||||||
vacuna.getAdministradedProduct(),
|
System.err.println("Error en submitTransaction: " + e.getMessage());
|
||||||
vacuna.getManufacturer(),
|
e.printStackTrace();
|
||||||
vacuna.getLotNumber(),
|
}
|
||||||
vacuna.getExpirationDate(),
|
|
||||||
vacuna.getPatientDocumentNumber(),
|
|
||||||
vacuna.getReactions());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vacuna obtenerVacuna(String vacunaId) throws GatewayException, IOException {
|
public Vacuna obtenerVacuna(String vacunaId) throws GatewayException, IOException {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue