chore: update
Java CI with Maven / test (pull_request) Has been cancelled
Java CI with Maven / build (pull_request) Has been cancelled

This commit is contained in:
TakahashiNg
2026-05-15 13:04:27 +00:00
parent a1637c4889
commit 617257b601
2 changed files with 9 additions and 8 deletions
@@ -6,16 +6,15 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import java.util.UUID;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(configKey = "eatery") @RegisterRestClient(configKey = "account")
@Path(Role.Manager) @Path(Role.Manager)
public interface ManagerController { public interface ManagerController {
@GET @GET
@Path(Role.Manager + "/{id}/payment-qr") @Path("/{id}/payment-qr")
public Response getManagerPaymentQr( public Response getManagerPaymentQr(
@PathParam("id") UUID id, @PathParam("id") String id,
@QueryParam("amount") Long amount, @QueryParam("amount") Long amount,
@QueryParam("cartId") String cartId @QueryParam("cartId") String cartId
); );
@@ -45,7 +45,7 @@ public class CartService {
@Inject @Inject
public CartService(RedisDataSource ds) { public CartService(RedisDataSource ds) {
this.hashCommands = ds.hash(String.class); this.hashCommands = ds.hash(String.class, String.class, String.class);
this.valueCommands = ds.value(String.class); this.valueCommands = ds.value(String.class);
} }
@@ -64,7 +64,7 @@ public class CartService {
String cartId = UUID.randomUUID().toString(); String cartId = UUID.randomUUID().toString();
String redisKey = "cart:" + cartId; String redisKey = "cart:" + cartId;
String ownerId = response.getEntity().toString(); String ownerId = response.readEntity(String.class);
hashCommands.hset( hashCommands.hset(
redisKey, redisKey,
@@ -100,7 +100,6 @@ public class CartService {
Map<String, String> data = hashCommands.hgetall(key); Map<String, String> data = hashCommands.hgetall(key);
Map<String, String> itemPrices = hashCommands.hgetall(priceKey); Map<String, String> itemPrices = hashCommands.hgetall(priceKey);
String managerId = hashCommands.hget(key, "_metadata_eateryManagerId");
if (data.isEmpty()) { if (data.isEmpty()) {
throw new GraphQLException("NotFoundCart"); throw new GraphQLException("NotFoundCart");
@@ -110,6 +109,7 @@ public class CartService {
cart.Id = cartId; cart.Id = cartId;
cart.eateryId = UUID.fromString(data.get("_metadata_eatery")); cart.eateryId = UUID.fromString(data.get("_metadata_eatery"));
String ownerStr = data.get("_metadata_owner"); String ownerStr = data.get("_metadata_owner");
String managerId = data.get("_metadata_eateryManagerId");
cart.userId = "GUEST".equals(ownerStr) ? null : UUID.fromString(ownerStr); cart.userId = "GUEST".equals(ownerStr) ? null : UUID.fromString(ownerStr);
cart.items = new ArrayList<>(); cart.items = new ArrayList<>();
@@ -136,7 +136,7 @@ public class CartService {
try { try {
Response response = managerController.getManagerPaymentQr( Response response = managerController.getManagerPaymentQr(
UUID.fromString(managerId), managerId,
total, total,
cartId.toString() cartId.toString()
); );
@@ -144,6 +144,8 @@ public class CartService {
cart.paymentQrUrl = response.readEntity(String.class); cart.paymentQrUrl = response.readEntity(String.class);
} catch (Exception e) { } catch (Exception e) {
cart.paymentQrUrl = ""; cart.paymentQrUrl = "";
System.out.println(e.getMessage());
} }
return cart; return cart;