V
V
vitya_brodov2022-04-13 10:30:21
MySQL
vitya_brodov, 2022-04-13 10:30:21

How to do redirect when reading QR in java?

Good afternoon! I have a method that generates a QR code.
How can I make it so that when reading, it automatically redirects to the specified path in the QR?
CODE:

@Override
    public List<QrCodeResponse> getQrCode(String inn) {
        List<Users> users = usersRepository.findByInnEquals(inn);
        List<QrCodeResponse> responseList = new ArrayList<>();
        try {
            users.forEach(user -> {
                byte[] image = qrCodeGenerator.generate("http://localhost:6677/credit-qr/get-info-by-userID?userId=" + user.getId().toString());
                String qrImage = Base64.getEncoder().encodeToString(image);
                QrCodeResponse response = QrCodeResponse.builder().qrImage(qrImage)
                        .name(user.getBrand()).build();
                responseList.add(response);
            });
            return responseList;
        } catch (Exception ex) {
            log.error("Error on getting QR code : {}", ex.getMessage());
            return null;
        }
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2016-09-18
@SmoKE_xD

select goodsid, count(1) cnt
 from goods
 where user_id = userid
group by goodsid
order by cnt desc 
limit 1

D
Dmitry Roo, 2022-04-13
@vitya_brodov

No way.
A QR code is just encrypted text. Nothing more.
Any processing, starting with the conversion from image to text, is performed on the end device.
In some phones, the QR recognizer is built into the standard camera application, in others it is not even there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question