This commit is contained in:
landaiqing 2023-12-27 22:42:18 +08:00
parent b693354748
commit 2c7d7a5d2d

View File

@ -23,23 +23,28 @@ public class QRCServiceImpl implements QRCService{
private CollectIconListDao collectIconListDao; private CollectIconListDao collectIconListDao;
public String QR(Integer url_id) throws Exception { public String QR(Integer url_id) throws Exception {
String logoPath = "src/main/resources/static/logo/NAV.png"; if(url_id!=null){
String destPath = "src/main/resources/static/qr"; String logoPath = "src/main/resources/static/logo/NAV.png";
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id)); String destPath = "src/main/resources/static/qr";
CollectIconList collectIconList = new CollectIconList(); UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id));
String url = urlList.getUrl(); CollectIconList collectIconList = new CollectIconList();
collectIconList.setUrl_id(url_id); String url = urlList.getUrl();
String list = collectIconListDao.selectByUrlid(url_id); collectIconList.setUrl_id(url_id);
if (list == null) { String list = collectIconListDao.selectByUrlid(url_id);
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true)); if (list == null) {
collectIconList.setQr_url(base64); String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
collectIconListDao.insertSelective(collectIconList); collectIconList.setQr_url(base64);
collectIconListDao.insertSelective(collectIconList);
// return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id)); // return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
return JSON.toJSONString(base64); return JSON.toJSONString(base64);
// return null; // return null;
}else { }else {
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id)); return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
}
}else{
return null;
} }
// //
//// 通过collect的url_id查找网址id对应网址 //// 通过collect的url_id查找网址id对应网址
// UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id())); // UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id()));