| | |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.ID; |
| | | import com.doumee.dao.business.RefundMapper; |
| | | import com.doumee.dao.business.TransactionsMapper; |
| | |
| | | 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.FileUtils; |
| | | 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; |
| | | import java.io.FileOutputStream; |
| | | import java.io.InputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | |
| | | * https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html |
| | | * @return |
| | | */ |
| | | public void generateWXMiniCode(Locks locks,SystemDictData systemDictData){ |
| | | public void generateWXMiniCode(Locks locks,SystemDictData systemDictData,String prePath,String path){ |
| | | |
| | | if(Objects.isNull(systemDictData)){ |
| | | return; |
| | |
| | | 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)); |
| | | String nowDate = DateUtil.getNowShortDate(); |
| | | File file = new File(prePath+path,locks.getSiteId()+"-"+locks.getCode()+"-"+nowDate+".png"); |
| | | FileUtils.copyInputStreamToFile(inputStream,file); |
| | | locks.setInfo(locks.getSiteId()+"-"+locks.getCode()+"-"+nowDate+".png"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |