From 8da7d594941bc59e9be76e0e9c72156a80d8079a Mon Sep 17 00:00:00 2001 From: sjm <2431685932@qq.com> Date: Wed, 27 Dec 2023 14:46:15 +0800 Subject: [PATCH] qrc --- .../com/lovenav/controller/QRCodeController.java | 4 ++-- src/main/java/com/lovenav/service/QRCService.java | 2 +- .../lovenav/service/serviceImpl/QRCServiceImpl.java | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/lovenav/controller/QRCodeController.java b/src/main/java/com/lovenav/controller/QRCodeController.java index 3865f0d..8960af3 100644 --- a/src/main/java/com/lovenav/controller/QRCodeController.java +++ b/src/main/java/com/lovenav/controller/QRCodeController.java @@ -19,7 +19,7 @@ public class QRCodeController { private QRCService qrcService; @RequestMapping(method = RequestMethod.POST, value = "/qrc_return") - public String QRCode(@RequestBody CollectIconList collect) throws Exception { - return qrcService.QR(collect); + public String QRCode(@RequestBody int url_id) throws Exception { + return qrcService.QR(url_id); } } \ No newline at end of file diff --git a/src/main/java/com/lovenav/service/QRCService.java b/src/main/java/com/lovenav/service/QRCService.java index 850cc98..ef2fc4b 100644 --- a/src/main/java/com/lovenav/service/QRCService.java +++ b/src/main/java/com/lovenav/service/QRCService.java @@ -3,5 +3,5 @@ package com.lovenav.service; import com.lovenav.entity.CollectIconList; public interface QRCService { - public String QR(CollectIconList collect) throws Exception; + public String QR(int url_id) throws Exception; } diff --git a/src/main/java/com/lovenav/service/serviceImpl/QRCServiceImpl.java b/src/main/java/com/lovenav/service/serviceImpl/QRCServiceImpl.java index 81dbe1a..efd0d4d 100644 --- a/src/main/java/com/lovenav/service/serviceImpl/QRCServiceImpl.java +++ b/src/main/java/com/lovenav/service/serviceImpl/QRCServiceImpl.java @@ -7,6 +7,7 @@ import com.lovenav.entity.CollectIconList; import com.lovenav.entity.UrlList; import com.lovenav.service.QRCService; import com.lovenav.utils.QRCodeUtil; +import org.jsoup.select.Collector; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,20 +22,20 @@ public class QRCServiceImpl implements QRCService{ @Autowired private CollectIconListDao collectIconListDao; - public String QR(CollectIconList collect) throws Exception { + public String QR(int url_id) throws Exception { String logoPath = "src/main/resources/static/logo/NAV.png"; String destPath = "src/main/resources/static/qr"; - - UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id())); + UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id)); String url = urlList.getUrl(); - String list = collectIconListDao.selectByUrlid(collect.getUrl_id()); - if (list == null && collect.getUrl_id()!=null) { + String list = collectIconListDao.selectByUrlid(url_id); + CollectIconList collect = null; + if (list == null) { String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true)); collect.setQr_url(base64); collectIconListDao.insert(collect); return JSON.toJSONString(base64); }else { - return JSON.toJSONString(collectIconListDao.selectByUrlid(collect.getUrl_id())); + return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id)); } // //// 通过collect的url_id查找网址id对应网址