Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
17a208b661
@ -70,13 +70,13 @@ public class AttachmentController {
|
||||
if (config1==null){
|
||||
bytes1= "没有该Config!".getBytes();
|
||||
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()));
|
||||
if (attachment==null){
|
||||
bytes1= "没有该Attachment!".getBytes();
|
||||
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();
|
||||
out.println(fileUrl);
|
||||
|
@ -9,31 +9,30 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/banners")
|
||||
public class BannersController {
|
||||
@Autowired
|
||||
private BannersService bannersService;
|
||||
|
||||
// 跳转链接
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/jump_url")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/banners/jump_url")
|
||||
public String jump(int id) {
|
||||
return bannersService.Jump_url(id);
|
||||
}
|
||||
|
||||
// 添加banner
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/add_banner")
|
||||
public String add(@RequestBody Banners banners) {
|
||||
@RequestMapping( "/banners/add_banner")
|
||||
public String add(Banners banners) {
|
||||
return bannersService.Add_banner(banners);
|
||||
}
|
||||
|
||||
// 删除banner
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/delete_url")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/banners/delete_url")
|
||||
public String delete(int id) {
|
||||
return bannersService.Delete_banner(id);
|
||||
}
|
||||
|
||||
// 首页显示banner
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/view_banner")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/banners/view_banner")
|
||||
public String view() {
|
||||
return bannersService.View_banner();
|
||||
}
|
||||
|
@ -14,34 +14,34 @@ import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/comment")
|
||||
|
||||
public class CommentController {
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
// 评论功能
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/comment")
|
||||
public String Reply1(@RequestBody Comment comment){
|
||||
@RequestMapping("/comment/comment")
|
||||
public String Reply1(Comment comment){
|
||||
return commentService.Reply1(comment);
|
||||
}
|
||||
|
||||
// 回复功能
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/reply_comment")
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/comment/reply_comment")
|
||||
public String Reply2(@RequestBody Comment comment,int id){
|
||||
return commentService.Reply2(comment,id);
|
||||
}
|
||||
// 删除功能
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/delete_comment")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/comment/delete_comment")
|
||||
public String Delete(int id){
|
||||
return commentService.Delete(id);
|
||||
}
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/addLikeCount")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/comment/addLikeCount")
|
||||
public String addLikeCount(int id){
|
||||
return commentService.AddLikeCount(id);
|
||||
}
|
||||
|
||||
|
||||
// 显示回复
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/view_reply")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/comment/view_reply")
|
||||
public String View_reply(int id){
|
||||
return commentService.View_Reply(id);
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class CommentController {
|
||||
* @param UrlId 博客id
|
||||
* @return 博客的评论信息
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/UrlId")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/comment/UrlId")
|
||||
public ResponseEntity<List<CommentNode>> queryCommentByUrlId (Integer UrlId) {
|
||||
return ResponseEntity.ok(commentService.queryCommentByUrlId(UrlId));
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class CommentController {
|
||||
* @param Id 评论id
|
||||
* @return 评论信息,携带用户信息
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/Id")
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/comment/Id")
|
||||
public ResponseEntity<CommentUser> queryObserveUserById (Integer Id) {
|
||||
return ResponseEntity.ok(commentService.queryCommentUserById(Id));
|
||||
}
|
||||
|
41
src/main/java/com/lovenav/controller/NoticeController.java
Normal file
41
src/main/java/com/lovenav/controller/NoticeController.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.lovenav.controller;
|
||||
|
||||
import com.lovenav.entity.Notice;
|
||||
import com.lovenav.service.CommentService;
|
||||
import com.lovenav.service.NoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class NoticeController {
|
||||
@Autowired
|
||||
private NoticeService noticeService;
|
||||
|
||||
// 增
|
||||
@RequestMapping("/notice/add")
|
||||
public String add(Notice notice){
|
||||
return noticeService.add(notice);
|
||||
}
|
||||
// 删
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/notice/delete")
|
||||
public String delete(int id){
|
||||
return noticeService.delete(id);
|
||||
}
|
||||
// 查
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/notice/select")
|
||||
public String select(){
|
||||
return noticeService.select();
|
||||
}
|
||||
// 改
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/notice/update")
|
||||
public String update(@RequestBody Notice notice){
|
||||
return noticeService.update(notice);
|
||||
}
|
||||
}
|
@ -1,18 +1,26 @@
|
||||
package com.lovenav.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.lovenav.entity.UrlCateList;
|
||||
import com.lovenav.entity.UrlList;
|
||||
import com.lovenav.service.UrlCateListService;
|
||||
import com.lovenav.service.UrlListService;
|
||||
import com.lovenav.utils.UrlCheckUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
public class UrlListController {
|
||||
@Autowired
|
||||
private UrlCheckUtil urlCheckUtil;
|
||||
@Autowired
|
||||
UrlListService urlListService;
|
||||
@Autowired
|
||||
@ -133,4 +141,43 @@ public class UrlListController {
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/admin/weblist/update")
|
||||
public HashMap<String, Object> Update(UrlList urlList){
|
||||
int x = urlListService.update(urlList);
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
if(x == 1){
|
||||
result.put("code", 200);
|
||||
result.put("msg", "更新成功");
|
||||
return result;
|
||||
}else{
|
||||
result.put("code", 500);
|
||||
result.put("msg", "更新失败");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/urlcheck")
|
||||
public String urlcheck(String url) throws MalformedURLException, URISyntaxException {
|
||||
HashMap<String,Object> hashMap = new HashMap<>();
|
||||
if(urlCheckUtil.CheckHttp(url)){
|
||||
String valid = urlCheckUtil.checkUrlConnection(url);
|
||||
String speed = urlCheckUtil.url_speed(url);
|
||||
if(valid.equals("404")){
|
||||
hashMap.put("code",valid);
|
||||
hashMap.put("msg", "https");
|
||||
hashMap.put("speed", 0);
|
||||
}else{
|
||||
hashMap.put("code",valid);
|
||||
hashMap.put("msg", "https");
|
||||
hashMap.put("speed", speed);
|
||||
}
|
||||
return JSON.toJSONString(hashMap);
|
||||
}else{
|
||||
hashMap.put("msg", "http");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.lovenav.dao;
|
||||
|
||||
import com.lovenav.entity.Notice;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface NoticeDao {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
@ -16,4 +20,6 @@ public interface NoticeDao {
|
||||
int updateByPrimaryKeySelective(Notice record);
|
||||
|
||||
int updateByPrimaryKey(Notice record);
|
||||
|
||||
List<Notice> selectAll();
|
||||
}
|
@ -9,6 +9,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class Notice implements Serializable {
|
||||
Notice(){
|
||||
this.noticeStatus = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ -39,5 +43,53 @@ public class Notice implements Serializable {
|
||||
*/
|
||||
private Date createtime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public Byte getNoticeStatus() {
|
||||
return noticeStatus;
|
||||
}
|
||||
|
||||
public void setNoticeStatus(Byte noticeStatus) {
|
||||
this.noticeStatus = noticeStatus;
|
||||
}
|
||||
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
14
src/main/java/com/lovenav/service/NoticeService.java
Normal file
14
src/main/java/com/lovenav/service/NoticeService.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.lovenav.service;
|
||||
|
||||
import com.lovenav.entity.Notice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NoticeService {
|
||||
String add(Notice notice);
|
||||
String delete(int id);
|
||||
String update(Notice notice);
|
||||
String select();
|
||||
|
||||
|
||||
}
|
@ -25,4 +25,7 @@ public interface UrlListService {
|
||||
|
||||
|
||||
public List<UrlList> latestEight();
|
||||
|
||||
|
||||
public int update(UrlList urlList);
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import com.lovenav.entity.Banners;
|
||||
import com.lovenav.service.BannersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
|
||||
@ -31,10 +33,14 @@ public class BannersServiceImpl implements BannersService {
|
||||
// 添加banner
|
||||
@Override
|
||||
public String Add_banner(Banners banners) {
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
banners.setCreatetime(date);
|
||||
int result = bannersDao.insert(banners);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
if(result>0){
|
||||
return JSON.toJSONString(banners);
|
||||
hashMap.put("code",200);
|
||||
hashMap.put("msg","添加成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}else{
|
||||
hashMap.put("code",500);
|
||||
hashMap.put("msg","添加banner失败");
|
||||
|
@ -13,6 +13,9 @@ import io.swagger.models.auth.In;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -25,12 +28,18 @@ public class CommentServiceImpl implements CommentService {
|
||||
// 评论功能
|
||||
@Override
|
||||
public String Reply1(Comment comment){
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
comment.setCommentTime(date);
|
||||
comment.setUpdateTime(date);
|
||||
int result = commentDao.insert(comment);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
if(result > 0){
|
||||
return JSON.toJSONString(comment);
|
||||
hashMap.put("code", 200);
|
||||
hashMap.put("msg", "评论成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
else{
|
||||
hashMap.put("code", 500);
|
||||
hashMap.put("msg", "评论失败");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
package com.lovenav.service.serviceImpl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lovenav.dao.NoticeDao;
|
||||
import com.lovenav.entity.Notice;
|
||||
import com.lovenav.service.NoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class NoticeServiceImpl implements NoticeService {
|
||||
@Autowired
|
||||
private NoticeDao noticeDao;
|
||||
public String add(Notice notice){
|
||||
HashMap<String,Object> hashMap = new HashMap<>();
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
notice.setCreatetime(date);
|
||||
int result = noticeDao.insert(notice);
|
||||
if(result>0){
|
||||
hashMap.put("code",200);
|
||||
hashMap.put("msg","添加成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}else{
|
||||
hashMap.put("code",500);
|
||||
hashMap.put("msg","添加成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
}
|
||||
public String delete(int id){
|
||||
HashMap<String,Object> hashMap = new HashMap<>();
|
||||
int result = noticeDao.deleteByPrimaryKey(id);
|
||||
if(result>0){
|
||||
hashMap.put("code",200);
|
||||
hashMap.put("msg","删除成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}else{
|
||||
hashMap.put("code",500);
|
||||
hashMap.put("msg","删除失败");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
}
|
||||
public String select(){
|
||||
HashMap<String,Object> hashMap = new HashMap<>();
|
||||
List<Notice> result = noticeDao.selectAll();
|
||||
if(result != null){
|
||||
return JSON.toJSONString(result);
|
||||
}else{
|
||||
hashMap.put("code",500);
|
||||
hashMap.put("msg","查找失败");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
}
|
||||
public String update(Notice notice){
|
||||
HashMap<String,Object> hashMap = new HashMap<>();
|
||||
int result = noticeDao.updateByPrimaryKeySelective(notice);
|
||||
if(result > 0){
|
||||
hashMap.put("code",200);
|
||||
hashMap.put("msg","修改成功");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}else{
|
||||
hashMap.put("code",500);
|
||||
hashMap.put("msg","修改失败");
|
||||
return JSON.toJSONString(hashMap);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -23,6 +23,7 @@ public class QRCServiceImpl implements QRCService{
|
||||
private CollectIconListDao collectIconListDao;
|
||||
|
||||
public String QR(Integer url_id) throws Exception {
|
||||
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));
|
||||
@ -40,6 +41,10 @@ public class QRCServiceImpl implements QRCService{
|
||||
}else {
|
||||
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
//// 通过collect的url_id查找网址id对应网址
|
||||
// UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(collect.getUrl_id()));
|
||||
|
@ -23,7 +23,6 @@ public class UrlAccessServiceImpl implements UrlAccessService {
|
||||
}
|
||||
Date date=new Date();
|
||||
urlAccess.setTime(date);
|
||||
urlAccess.setUrlId(2);
|
||||
UrlAccess urlAccess1=urlAccessDao.selectAlreadyExist(urlAccess);
|
||||
if (urlAccess1==null){
|
||||
urlAccess.setViews(1L);
|
||||
|
@ -109,6 +109,6 @@ public class UrlLiserServiceImpl implements UrlListService {
|
||||
|
||||
public List<UrlList> latestEight(){return urlListDao.latestEight(); }
|
||||
|
||||
|
||||
public int update(UrlList urlList){return urlListDao.updateByPrimaryKeySelective(urlList);}
|
||||
|
||||
}
|
||||
|
@ -7,12 +7,15 @@ import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.*;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
@Component
|
||||
public class UrlCheckUtil {
|
||||
|
||||
/**
|
||||
|
@ -95,4 +95,10 @@
|
||||
createtime = #{createtime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from ln_notice
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user