Merge remote-tracking branch 'origin/master'

This commit is contained in:
sjm 2023-12-28 00:27:30 +08:00
commit b9320ecd9c
4 changed files with 31 additions and 21 deletions

View File

@ -70,13 +70,13 @@ public class AttachmentController {
if (config1==null){ if (config1==null){
bytes1= "没有该Config!".getBytes(); bytes1= "没有该Config!".getBytes();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
return new ResponseEntity<byte[]>(bytes1, headers, HttpStatus.NOT_FOUND); return new ResponseEntity<byte[]>(bytes1, headers, HttpStatus.OK);
} }
Attachment attachment =attachmentService.selectAttachment(Long.valueOf(config1.getValue())); Attachment attachment =attachmentService.selectAttachment(Long.valueOf(config1.getValue()));
if (attachment==null){ if (attachment==null){
bytes1= "没有该Attachment!".getBytes(); bytes1= "没有该Attachment!".getBytes();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
return new ResponseEntity<byte[]>(bytes1, headers, HttpStatus.NOT_FOUND); return new ResponseEntity<byte[]>(bytes1, headers, HttpStatus.OK);
} }
String fileUrl=attachment.getPath()+attachment.getFileName()+attachment.getSuffix(); String fileUrl=attachment.getPath()+attachment.getFileName()+attachment.getSuffix();
out.println(fileUrl); out.println(fileUrl);

View File

@ -29,6 +29,9 @@ public class SearchController {
@RequestMapping("/searchByInput") @RequestMapping("/searchByInput")
public String searchByInput(String searchKey,String userId ) throws IOException { public String searchByInput(String searchKey,String userId ) throws IOException {
if(searchKey == null ){
return setResult(500,"未添加搜索内容");
}
String placeholder = "***"; String placeholder = "***";
//非法敏感词汇判断 //非法敏感词汇判断
SensitiveFilter filter = SensitiveFilter.getInstance(); SensitiveFilter filter = SensitiveFilter.getInstance();
@ -38,7 +41,7 @@ public class SearchController {
//存在非法字符 //存在非法字符
if(n > 0){ if(n > 0){
logger.info("这个人输入了非法字符--> {},不知道他到底要查什么~ userid--> {}",searchKey,1); logger.info("这个人输入了非法字符--> {},不知道他到底要查什么~ userid--> {}",searchKey,1);
return setResult(500,"查询失败"); return setResult(500,"非法搜索");
} }

View File

@ -36,18 +36,20 @@ public class UrlListController {
UrlList urlList = urlListService.selectUrlListByUrlId(Long.valueOf(urlId)); UrlList urlList = urlListService.selectUrlListByUrlId(Long.valueOf(urlId));
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId()); String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId());
String [] parentList = parentString.split(","); String [] parentList = parentString.split(",");
//System.out.println(parentString); System.out.println(parentString);
for(String parent : parentList) for(String parent : parentList)
{ {
if(parent.equals("0")){ if(parent.equals("0")){
continue; continue;
} }
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(parent)); UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(parent));
if(urlCateListService.updateByUrlCateList(urlCateList) == 0) System.out.println(urlCateList);
urlCateList.setUrlNumber(urlCateList.getUrlNumber()-1);
if(String.valueOf(urlCateListService.updateByUrlCateList(urlCateList)).equals("0"))
{ {
flag = 0; flag = 0;
}else{ }else{
flag = 1; flag = urlListService.deleteByPrimaryKey(Long.valueOf(urlId));
} }
} }
if(flag == 1) if(flag == 1)
@ -80,7 +82,7 @@ public class UrlListController {
continue; continue;
} }
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(parent)); UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(parent));
if(urlCateListService.updateByUrlCateList(urlCateList) == 0) if(String.valueOf(urlCateListService.updateByUrlCateList(urlCateList)).equals("0") )
{ {
flag = 0; flag = 0;
}else{ }else{

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()));