This commit is contained in:
2023-12-27 16:47:54 +08:00
parent 64173c1afa
commit 9f198edd1e
20 changed files with 110 additions and 65 deletions

View File

@@ -10,10 +10,10 @@ import java.util.HashMap;
import java.util.Map;
public interface AttachmentService {
HashMap<String,String> upload(MultipartFile file,String cate) throws IOException;
HashMap<String,Object> upload(MultipartFile file,String cate) throws IOException;
public HashMap<String,String>storeFile(MultipartFile multipartFile,String cate) throws IOException;
public HashMap<String,String>updateFile(MultipartFile multipartFile,String cate,Config config) throws IOException;
public HashMap<String,Object>storeFile(MultipartFile multipartFile,String cate) throws IOException;
public HashMap<String,Object>updateFile(MultipartFile multipartFile,String cate,Config config) throws IOException;
public Attachment selectAttachment(Long id);

View File

@@ -1,7 +1,8 @@
package com.lovenav.service;
import com.lovenav.entity.CollectIconList;
import org.springframework.web.bind.annotation.RequestBody;
public interface QRCService {
public String QR(int url_id) throws Exception;
public String QR(@RequestBody Integer url_id) throws Exception;
}

View File

@@ -30,13 +30,13 @@ public class AttachmentServiceImpl implements AttachmentService {
AttachmentDao attachmentDao;
@Override
public HashMap<String,String> upload(MultipartFile file,String cate) throws IOException {
HashMap<String, String> map = storeFile(file,cate);
public HashMap<String,Object> upload(MultipartFile file,String cate) throws IOException {
HashMap<String, Object> map = storeFile(file,cate);
return map;
}
@Override
public HashMap<String, String> storeFile(MultipartFile multipartFile,String cate) throws IOException {
HashMap<String,String> map = new HashMap<>();
public HashMap<String, Object> storeFile(MultipartFile multipartFile,String cate) throws IOException {
HashMap<String,Object> map = new HashMap<>();
Attachment attachment=new Attachment();
File path = null;
try {
@@ -70,6 +70,7 @@ public class AttachmentServiceImpl implements AttachmentService {
// attachment.setId(id);
attachmentDao.insertSelective(attachment);
map.put("id", String.valueOf(attachment.getId()));
multipartFile.transferTo(fileUp);
map.put("url", "/img" + relPath);
@@ -83,8 +84,8 @@ public class AttachmentServiceImpl implements AttachmentService {
}
@Override
public HashMap<String, String> updateFile(MultipartFile multipartFile, String cate, Config config) throws IOException {
HashMap<String,String> map = new HashMap<>();
public HashMap<String, Object> updateFile(MultipartFile multipartFile, String cate, Config config) throws IOException {
HashMap<String,Object> map = new HashMap<>();
Attachment attachment=new Attachment();
File path = null;
try {
@@ -119,7 +120,7 @@ public class AttachmentServiceImpl implements AttachmentService {
// attachment.setId(id);
attachmentDao.updateByPrimaryKeySelective(attachment);
// map.put("id", String.valueOf(attachment.getId()));
map.put("msg","更新成功!");
map.put("code",200);
map.put("id", String.valueOf(attachment.getId()));
multipartFile.transferTo(fileUp);
map.put("url", "/img" + relPath);

View File

@@ -22,18 +22,21 @@ public class QRCServiceImpl implements QRCService{
@Autowired
private CollectIconListDao collectIconListDao;
public String QR(int url_id) throws Exception {
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));
String url = urlList.getUrl();
String list = collectIconListDao.selectByUrlid(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(base64);
// return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
// return JSON.toJSONString(base64);
return null;
}else {
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
}

View File

@@ -135,7 +135,7 @@ public class RedisServiceImpl implements RedisService {
if (result.size() > HOT_SEARCH_NUMBER) {
break;
}
System.out.println(valueOperations.get(val));
// System.out.println(valueOperations.get(val));
Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get("search:search-time:"+val)));
//返回最近一个月的数据
if ((now - time) < HOT_SEARCH_TIME) {

View File

@@ -111,7 +111,7 @@ public class UrlCateListServiceImpl implements UrlCateListService {
if(urlCateList.getId() == Integer.valueOf(str)){
int cateNum = CateNumber.get(urlCateList.getName())+1;
CateNumber.put(urlCateList.getName(),cateNum);
System.out.println(urlCateList.getName());
// System.out.println(urlCateList.getName());
break;
}
}
@@ -146,13 +146,11 @@ public class UrlCateListServiceImpl implements UrlCateListService {
int parentId = urlCateList.getId();
for(UrlList urlList : urlLists)
{
if(urlList.getCateId() == parentId)
{
if(!String.valueOf(urlList.getCateId()).equals(parentId+"")) continue ;
JSONObject jsonObject = new JSONObject();
jsonObject.put(urlList.getName(),urlList.getUrl());
jsonArray.add(jsonObject);
break;
}
}
}
return jsonArray;

View File

@@ -117,7 +117,7 @@ public class UserServiceImpl implements UserService {
@Override
public User selectUserAlreadyExist(User user) {
System.out.println(user.getUserEmail());
// System.out.println(user.getUserEmail());
User user1=userDao.selectByEmail(user.getUserEmail());
return user1;
}