How to convert binary streams into pictures in the background by WeChat Mini Programs

I asked for the mini code at the front end, which returned a pile of garbled codes.
java has found a way to convert binary streams and pictures to each other on the Internet, but the data obtained from the WeChat Mini Programs code interface cannot get the correct picture with this method, and I don"t know where there is a problem.
is there a way to get Mini Program code only at the front end

@RequestMapping("/qrTest")
public Map qrTest(Long hotelId, String appId, String token) {
    RestTemplate rest = new RestTemplate();
    InputStream inputStream = null;
    OutputStream outputStream = null;
    try {
        String url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + token;
        Map<String, Object> param = new HashMap<>();
        param.put("page", "pages/home/home");
        param.put("width", 430);
        param.put("auto_color", false);
        Map<String, Object> line_color = new HashMap<>();
        line_color.put("r", 0);
        line_color.put("g", 0);
        line_color.put("b", 0);
        param.put("line_color", line_color);
        System.out.println("URL:" + param);
        // MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        HttpEntity requestEntity = new HttpEntity(param, headers);
        ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]);
        System.out.println("URL:" + entity.getBody());
        byte[] result = entity.getBody();
        System.out.println("\r\nold:" + Base64.encodeBase64String(result));
        inputStream = new ByteArrayInputStream(result);
        File file = new File("f:/abc.jpg");
        if (!file.exists()) {
            file.createNewFile();
        }
        outputStream = new FileOutputStream(file);
        int len = 0;
        byte[] buf = new byte[1024];
        while ((len = inputStream.read(buf, 0, 1024)) != -1) {
            outputStream.write(buf, 0, len);
        }
        outputStream.flush();
    } catch (Exception e) {
        System.out.println("URL");
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (outputStream != null) {
            try {
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return null;
}

Brother, your path has been written as page

Menu