From b7d7bb82334af8574ad2510b9fa2220581e3f9f2 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 19 二月 2025 18:13:36 +0800 Subject: [PATCH] jtt808初始化 --- server/services/src/main/java/com/doumee/core/wx/WxMiniUtilService.java | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/server/services/src/main/java/com/doumee/core/wx/WxMiniUtilService.java b/server/services/src/main/java/com/doumee/core/wx/WxMiniUtilService.java index 68410dc..3800317 100644 --- a/server/services/src/main/java/com/doumee/core/wx/WxMiniUtilService.java +++ b/server/services/src/main/java/com/doumee/core/wx/WxMiniUtilService.java @@ -11,6 +11,7 @@ import com.doumee.core.utils.ImageDesignerUtil; import com.doumee.dao.business.RefundMapper; import com.doumee.dao.business.TransactionsMapper; +import com.doumee.dao.business.model.Bikes; import com.doumee.dao.business.model.Locks; import com.doumee.dao.business.model.Refund; import com.doumee.dao.business.model.Transactions; @@ -290,6 +291,41 @@ e.printStackTrace(); } } + public void generateEbikeWXMiniCode(Bikes bikes, String token, String prePath, String path){ + if(Objects.isNull(token)){ + return; + } + String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+ token; + String release = systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.MINI_PROGRAMME_REALEASE).getCode(); + //鐢熸垚鍥剧墖涓婁紶OSS + Map<String,Object> body = new HashMap<>(); + // 鍦烘櫙鐮侊紝涓庡墠绔害瀹氾紝鏈�缁堟槸闇�瑕佸墠绔В鏋� + body.put("scene", Constants.EBIKE_PREFIX +bikes.getCode() ); + // 姝e紡鐗堜负 "release"锛屼綋楠岀増涓� "trial"锛屽紑鍙戠増涓� "develop"銆傞粯璁ゆ槸姝e紡鐗堛�� +// body.put("env_version", "release"); + body.put("env_version", StringUtils.defaultString(release, "release")); + // 閫忔槑锛屾牴鎹綘鐨勫満鏅嚜琛岃缃産ody鍙傛暟 + body.put("is_hyaline", false); + body.put("check_path", false); + body.put("width", 290); + body.put("page","pages/index/index"); + log.info("=========================================="+url+"\n"+JSONObject.toJSONString(body)); + try { + InputStream inputStream =HttpsUtil.postJson(url,JSONObject.toJSONString(body));; + if (inputStream !=null) { + String nowDate = DateUtil.getNowShortDate(); + String name =Constants.EBIKE_PREFIX+bikes.getCode()+"-"+nowDate+".png"; + String fileName =prePath+path+"/"+name; +// File file = new File(prePath+path,locks.getSiteId()+"-"+locks.getCode()+"-"+nowDate+".png"); +// FileUtils.copyInputStreamToFile(inputStream,file); + if(ImageDesignerUtil.graphicsGenerationIs(bikes.getCode(),inputStream,fileName)){ + bikes.setImgurl(name); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } /** * 鐢熸垚灏忕▼搴忕爜 * https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html -- Gitblit v1.9.3