| | |
| | | import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest; |
| | | import com.github.binarywang.wxpay.bean.result.WxPayRefundResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import io.netty.handler.codec.base64.Base64Decoder; |
| | | import io.netty.handler.codec.base64.Base64Encoder; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.Response; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import sun.misc.BASE64Decoder; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | |
| | | Response response = client.newCall(request).execute(); |
| | | if (response.isSuccessful()) { |
| | | InputStream inputStream = new ByteArrayInputStream(response.body().bytes()); |
| | | |
| | | // 得到文件大小 |
| | | int i = inputStream.available(); |
| | | byte[] mFileBody = new byte[i]; |
| | | // 读数据 |
| | | inputStream.read(mFileBody); |
| | | locks.setInfo("data:image/Jpeg;base64," + Base64.getEncoder().encodeToString(mFileBody)); |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |