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;
public String QR(Integer 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(url_id));
CollectIconList collectIconList = new CollectIconList();
String url = urlList.getUrl();
collectIconList.setUrl_id(url_id);
String list = collectIconListDao.selectByUrlid(url_id);
if (list == null) {
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
collectIconList.setQr_url(base64);
collectIconListDao.insertSelective(collectIconList);
if(url_id!=null){
String logoPath = "src/main/resources/static/logo/NAV.png";
String destPath = "src/main/resources/static/qr";
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id));
CollectIconList collectIconList = new CollectIconList();
String url = urlList.getUrl();
collectIconList.setUrl_id(url_id);
String list = collectIconListDao.selectByUrlid(url_id);
if (list == null) {
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
collectIconList.setQr_url(base64);
collectIconListDao.insertSelective(collectIconList);
// return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
return JSON.toJSONString(base64);
return JSON.toJSONString(base64);
// return null;
}else {
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
}else {
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
}
}else{
return null;
}
//
//// 通过collect的url_id查找网址id对应网址
// UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id()));