qrc
This commit is contained in:
parent
b028f37e48
commit
8da7d59494
@ -19,7 +19,7 @@ public class QRCodeController {
|
|||||||
private QRCService qrcService;
|
private QRCService qrcService;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/qrc_return")
|
@RequestMapping(method = RequestMethod.POST, value = "/qrc_return")
|
||||||
public String QRCode(@RequestBody CollectIconList collect) throws Exception {
|
public String QRCode(@RequestBody int url_id) throws Exception {
|
||||||
return qrcService.QR(collect);
|
return qrcService.QR(url_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,5 +3,5 @@ package com.lovenav.service;
|
|||||||
import com.lovenav.entity.CollectIconList;
|
import com.lovenav.entity.CollectIconList;
|
||||||
|
|
||||||
public interface QRCService {
|
public interface QRCService {
|
||||||
public String QR(CollectIconList collect) throws Exception;
|
public String QR(int url_id) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.lovenav.entity.CollectIconList;
|
|||||||
import com.lovenav.entity.UrlList;
|
import com.lovenav.entity.UrlList;
|
||||||
import com.lovenav.service.QRCService;
|
import com.lovenav.service.QRCService;
|
||||||
import com.lovenav.utils.QRCodeUtil;
|
import com.lovenav.utils.QRCodeUtil;
|
||||||
|
import org.jsoup.select.Collector;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -21,20 +22,20 @@ public class QRCServiceImpl implements QRCService{
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CollectIconListDao collectIconListDao;
|
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 logoPath = "src/main/resources/static/logo/NAV.png";
|
||||||
String destPath = "src/main/resources/static/qr";
|
String destPath = "src/main/resources/static/qr";
|
||||||
|
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id));
|
||||||
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id()));
|
|
||||||
String url = urlList.getUrl();
|
String url = urlList.getUrl();
|
||||||
String list = collectIconListDao.selectByUrlid(collect.getUrl_id());
|
String list = collectIconListDao.selectByUrlid(url_id);
|
||||||
if (list == null && collect.getUrl_id()!=null) {
|
CollectIconList collect = null;
|
||||||
|
if (list == null) {
|
||||||
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
|
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
|
||||||
collect.setQr_url(base64);
|
collect.setQr_url(base64);
|
||||||
collectIconListDao.insert(collect);
|
collectIconListDao.insert(collect);
|
||||||
return JSON.toJSONString(base64);
|
return JSON.toJSONString(base64);
|
||||||
}else {
|
}else {
|
||||||
return JSON.toJSONString(collectIconListDao.selectByUrlid(collect.getUrl_id()));
|
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//// 通过collect的url_id查找网址id对应网址
|
//// 通过collect的url_id查找网址id对应网址
|
||||||
|
Loading…
Reference in New Issue
Block a user