update 2021年11月16日18:24:41
parent
beafe4f82f
commit
7a4321c911
|
|
@ -66,6 +66,11 @@
|
||||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.codecentric</groupId>
|
||||||
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.oschina.zcx7878</groupId>
|
<groupId>net.oschina.zcx7878</groupId>
|
||||||
<artifactId>fastdfs-client-java</artifactId>
|
<artifactId>fastdfs-client-java</artifactId>
|
||||||
|
|
@ -80,7 +85,6 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
package com.zhangmeng.admin.manager.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.zhangmeng.admin.manager.service.TagsService;
|
||||||
|
import com.zhangmeng.model.base.baseController.BaseController;
|
||||||
|
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||||
|
import com.zhangmeng.model.dto.query.QueryParams;
|
||||||
|
import com.zhangmeng.model.entity.Tags;
|
||||||
|
import com.zhangmeng.model.vo.Result;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
import tk.mybatis.mapper.entity.Condition;
|
||||||
|
import tk.mybatis.mapper.entity.Example;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangmeng
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2021年8月20日08:44:26
|
||||||
|
*/
|
||||||
|
@Api(tags = "标签管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/tags")
|
||||||
|
public class TagsController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TagsService tagsService;
|
||||||
|
|
||||||
|
@ApiOperation("标签列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result list(String tagName, Integer pageNum, Integer pageSize) {
|
||||||
|
CommonUtil.page_params_verify(pageNum, pageSize); //校验
|
||||||
|
Condition condition = new Condition(Tags.class);
|
||||||
|
Example.Criteria criteria = condition.createCriteria();
|
||||||
|
if (tagName != null && !tagName.equals("")) {
|
||||||
|
criteria.andLike("tagName", "%" + tagName + "%");
|
||||||
|
}
|
||||||
|
PageInfo<Tags> pageInfo = this.tagsService.findByCondition(new QueryParams(pageNum, pageSize, "addTime desc"), true);
|
||||||
|
return this.responseJsonData(pageInfo.getTotal(), pageInfo.getList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("标签保存")
|
||||||
|
@PostMapping("/save")
|
||||||
|
public Result save(@RequestBody @RequestParam Map<String, Object> map) {
|
||||||
|
|
||||||
|
Condition condition = new Condition(Tags.class);
|
||||||
|
Example.Criteria criteria = condition.createCriteria();
|
||||||
|
|
||||||
|
String tagName = CommonUtil.map_get_value(map, "tagName");
|
||||||
|
String tagId = CommonUtil.map_get_value(map, "tagId");
|
||||||
|
Tags tags = null;
|
||||||
|
boolean flag = false;
|
||||||
|
if (tagId == null || tagId.equals("")) {
|
||||||
|
tags = new Tags();
|
||||||
|
flag = true;
|
||||||
|
} else {
|
||||||
|
tags = this.tagsService.findById(Long.parseLong(tagId));
|
||||||
|
}
|
||||||
|
if (tagName != null && !tagName.equals("")) {
|
||||||
|
//判断是否是修改
|
||||||
|
if (flag) {
|
||||||
|
criteria.andEqualTo("tagName", tagName);
|
||||||
|
//查找是否存在
|
||||||
|
List<Tags> tagsList = this.tagsService.findByCondition(condition);
|
||||||
|
if (tagsList.size() > 0) {
|
||||||
|
return this.failure("该标签已经存在,请重新输入!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tags.setTagName(tagName);
|
||||||
|
}
|
||||||
|
String description = CommonUtil.map_get_value(map, "description");
|
||||||
|
if (CommonUtil.isNotNull(description)) {
|
||||||
|
tags.setDescription(description);
|
||||||
|
}
|
||||||
|
String tagType = CommonUtil.map_get_value(map, "tagType");
|
||||||
|
if (CommonUtil.isNotNull(tagType)) {
|
||||||
|
Tags.Type type = CommonUtil.getEnum(tagType, Tags.Type.class);
|
||||||
|
tags.setType(type);
|
||||||
|
}
|
||||||
|
String message = null;
|
||||||
|
if (flag) {
|
||||||
|
message = "保存成功";
|
||||||
|
this.tagsService.save(tags);
|
||||||
|
} else {
|
||||||
|
message = "修改成功";
|
||||||
|
this.tagsService.update(tags);
|
||||||
|
}
|
||||||
|
return this.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据id删除标签")
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public Result delete(String tagId) {
|
||||||
|
if (CommonUtil.isNotNull(tagId)) {
|
||||||
|
this.tagsService.deleteById(Long.parseLong(tagId));
|
||||||
|
}
|
||||||
|
return this.success("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("标签批量删除")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
public Result batchRemove(String ids) {
|
||||||
|
if (CommonUtil.isNotNull(ids)) {
|
||||||
|
this.tagsService.deleteByIds(CommonUtil.firstLastComma(ids));
|
||||||
|
}
|
||||||
|
return success("批量删除成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,23 +4,24 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.zhangmeng.admin.manager.feign.*;
|
import com.zhangmeng.admin.manager.feign.*;
|
||||||
import com.zhangmeng.admin.manager.service.PermissionService;
|
import com.zhangmeng.admin.manager.service.*;
|
||||||
import com.zhangmeng.admin.manager.service.RoleService;
|
|
||||||
import com.zhangmeng.admin.manager.service.SysLogService;
|
|
||||||
import com.zhangmeng.admin.manager.service.UserService;
|
|
||||||
import com.zhangmeng.admin.manager.utils.UserUtil;
|
import com.zhangmeng.admin.manager.utils.UserUtil;
|
||||||
import com.zhangmeng.model.base.baseController.BaseController;
|
import com.zhangmeng.model.base.baseController.BaseController;
|
||||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||||
import com.zhangmeng.model.dto.system.EncryptType;
|
import com.zhangmeng.model.dto.system.EncryptType;
|
||||||
import com.zhangmeng.model.dto.system.Menu;
|
import com.zhangmeng.model.dto.system.Menu;
|
||||||
import com.zhangmeng.model.dto.query.QueryParams;
|
import com.zhangmeng.model.dto.query.QueryParams;
|
||||||
|
import com.zhangmeng.model.dto.system.SysConstant;
|
||||||
import com.zhangmeng.model.entity.*;
|
import com.zhangmeng.model.entity.*;
|
||||||
import com.zhangmeng.model.vo.Result;
|
import com.zhangmeng.model.vo.Result;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cloud.client.ServiceInstance;
|
||||||
|
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
import tk.mybatis.mapper.entity.Condition;
|
import tk.mybatis.mapper.entity.Condition;
|
||||||
import tk.mybatis.mapper.entity.Example;
|
import tk.mybatis.mapper.entity.Example;
|
||||||
|
|
@ -35,6 +36,9 @@ import java.util.*;
|
||||||
@Controller
|
@Controller
|
||||||
public class UrlRequestController extends BaseController {
|
public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoadBalancerClient loadBalancerClient;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserUtil userUtil;
|
private UserUtil userUtil;
|
||||||
|
|
||||||
|
|
@ -65,8 +69,11 @@ public class UrlRequestController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FictionFeign fictionFeign;
|
private FictionFeign fictionFeign;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TagsService tagsService;
|
||||||
|
|
||||||
//跳转首页
|
//跳转首页
|
||||||
@GetMapping({"/login","/"})
|
@GetMapping({"/login"})
|
||||||
public ModelAndView login (){
|
public ModelAndView login (){
|
||||||
return this.jumpPage("admin/login");
|
return this.jumpPage("admin/login");
|
||||||
}
|
}
|
||||||
|
|
@ -347,17 +354,17 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/code/form");
|
return this.jumpPage("admin/code/form");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/mail/index")
|
@GetMapping(SysConstant.mail_prefix + "/index")
|
||||||
public ModelAndView mail_index() {
|
public ModelAndView mail_index() {
|
||||||
return this.jumpPage("admin/mail/list");
|
return this.jumpPage("admin/mail/list");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/mail/add")
|
@GetMapping(SysConstant.mail_prefix + "/add")
|
||||||
public ModelAndView mail_add() {
|
public ModelAndView mail_add() {
|
||||||
return this.jumpPage("admin/mail/add");
|
return this.jumpPage("admin/mail/add");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/mail/edit")
|
@GetMapping(SysConstant.mail_prefix + "/edit")
|
||||||
public ModelAndView mail_edit(String mail_id,Model model) {
|
public ModelAndView mail_edit(String mail_id,Model model) {
|
||||||
if (mail_id != null ){
|
if (mail_id != null ){
|
||||||
Mail mail = this.mailFeign.findById(Long.parseLong(mail_id));
|
Mail mail = this.mailFeign.findById(Long.parseLong(mail_id));
|
||||||
|
|
@ -368,14 +375,12 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/mail/edit");
|
return this.jumpPage("admin/mail/edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@GetMapping(SysConstant.fiction_prefix + "/add")
|
||||||
@GetMapping("/fiction/add")
|
|
||||||
public ModelAndView add() {
|
public ModelAndView add() {
|
||||||
return this.jumpPage("admin/fiction/fiction_add");
|
return this.jumpPage("admin/fiction/fiction_add");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@GetMapping(SysConstant.fiction_prefix + "/chapter/{id}")
|
||||||
@GetMapping("/fiction/chapter/{id}")
|
|
||||||
public ModelAndView chapter(Model model, @PathVariable Long id) {
|
public ModelAndView chapter(Model model, @PathVariable Long id) {
|
||||||
|
|
||||||
Fiction fiction = this.fictionFeign.findById(id);
|
Fiction fiction = this.fictionFeign.findById(id);
|
||||||
|
|
@ -386,8 +391,7 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("xiaoshuo/fiction_chapter");
|
return this.jumpPage("xiaoshuo/fiction_chapter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@GetMapping(SysConstant.fiction_prefix + "/details/{chapter_id}")
|
||||||
@GetMapping("/details/{chapter_id}")
|
|
||||||
public ModelAndView details(Model model, @PathVariable String chapter_id){
|
public ModelAndView details(Model model, @PathVariable String chapter_id){
|
||||||
|
|
||||||
String replace = chapter_id.replace(",", "");
|
String replace = chapter_id.replace(",", "");
|
||||||
|
|
@ -405,8 +409,8 @@ public class UrlRequestController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@GetMapping("/fiction/index")
|
@GetMapping(SysConstant.fiction_prefix + "/index")
|
||||||
public ModelAndView index(Model model, Integer pageNum, Integer pageSize) {
|
public ModelAndView fiction_index(Model model, Integer pageNum, Integer pageSize) {
|
||||||
|
|
||||||
if (pageNum == null || pageSize == null) {
|
if (pageNum == null || pageSize == null) {
|
||||||
pageNum = pageNum == null ? 1 : pageNum;
|
pageNum = pageNum == null ? 1 : pageNum;
|
||||||
|
|
@ -428,16 +432,60 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("xiaoshuo/index");
|
return this.jumpPage("xiaoshuo/index");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/fictionCollection/index")
|
@GetMapping(SysConstant.fictionCollection_prefix + "/index")
|
||||||
public ModelAndView fictionCollection_index() {
|
public ModelAndView fictionCollection_index() {
|
||||||
return this.jumpPage("admin/fiction/fiction_list");
|
return this.jumpPage("admin/fiction/fiction_list");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/fictionCollection/edit")
|
@GetMapping(SysConstant.fictionCollection_prefix + "/edit")
|
||||||
public ModelAndView fictionCollection_edit(@RequestParam("fiction_id") Long fiction_id,Model model){
|
public ModelAndView fictionCollection_edit(@RequestParam("fiction_id") Long fiction_id,Model model){
|
||||||
FictionCollection fictionCollection = this.fictionFeign.findFictionCollectionById(fiction_id);
|
FictionCollection fictionCollection = this.fictionFeign.findFictionCollectionById(fiction_id);
|
||||||
model.addAttribute("fictionCollection",fictionCollection);
|
model.addAttribute("fictionCollection",fictionCollection);
|
||||||
return this.jumpPage("admin/fiction/fiction_edit");
|
return this.jumpPage("admin/fiction/fiction_edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(SysConstant.tags_prefix + "/index")
|
||||||
|
public ModelAndView tags_index() {
|
||||||
|
return this.jumpPage("admin/tags/list");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(SysConstant.tags_prefix + "/add")
|
||||||
|
public ModelAndView tags_add(Model model) {
|
||||||
|
model.addAttribute("tagTypeList", Tags.Type.enumListMap());
|
||||||
|
return this.jumpPage("admin/tags/add");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(SysConstant.tags_prefix + "/edit")
|
||||||
|
public ModelAndView tags_edit(Model model, String tagId) {
|
||||||
|
if (CommonUtil.isNotNull(tagId)) {
|
||||||
|
Tags tags = this.tagsService.findById(Long.parseLong(tagId));
|
||||||
|
model.addAttribute("tags", tags);
|
||||||
|
}
|
||||||
|
model.addAttribute("tagTypeList", Tags.Type.enumListMap());
|
||||||
|
return this.jumpPage("admin/tags/edit");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/zipkin")
|
||||||
|
public RedirectView zipkin_loginPage() {
|
||||||
|
String url = "http://localhost:9411/zipkin/";
|
||||||
|
return new RedirectView(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/sentinel")
|
||||||
|
public RedirectView nacos_loginPage() {
|
||||||
|
String url = "http://localhost:8748/#/login";
|
||||||
|
return new RedirectView(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/boot/admin")
|
||||||
|
public RedirectView boot_admin_loginPage() {
|
||||||
|
ServiceInstance serviceInstance = loadBalancerClient.choose(SysConstant.mystyle_cloud_admin_monitor);
|
||||||
|
if (serviceInstance == null) {
|
||||||
|
throw new RuntimeException("找不到对应的服务");
|
||||||
|
}
|
||||||
|
String path = serviceInstance.getUri().toString();
|
||||||
|
return new RedirectView(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.zhangmeng.admin.manager.dao;
|
||||||
|
import com.zhangmeng.model.base.baseDao.AbstractBaseMapper;
|
||||||
|
import com.zhangmeng.model.entity.Tags;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TagsDao extends AbstractBaseMapper<Tags> {
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,6 @@ public interface FictionFeign {
|
||||||
@GetMapping(SysConstant.mystyle_cloud_fiction_prefix + "/findAllToFiction")
|
@GetMapping(SysConstant.mystyle_cloud_fiction_prefix + "/findAllToFiction")
|
||||||
List<Fiction> findAll();
|
List<Fiction> findAll();
|
||||||
|
|
||||||
@
|
@GetMapping(SysConstant.fictionCollection_prefix + "/findFictionCollectionById")
|
||||||
FictionCollection findFictionCollectionById(@RequestParam("fiction_id") Long fiction_id);
|
FictionCollection findFictionCollectionById(@RequestParam("fiction_id") Long fiction_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.zhangmeng.admin.manager.service;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.base.baseService.BaseService;
|
||||||
|
import com.zhangmeng.model.entity.Tags;
|
||||||
|
|
||||||
|
public interface TagsService extends BaseService<Tags> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.zhangmeng.admin.manager.service.impl;
|
||||||
|
|
||||||
|
import com.zhangmeng.admin.manager.service.TagsService;
|
||||||
|
import com.zhangmeng.model.base.baseService.impl.AbstractBaseServiceImpl;
|
||||||
|
import com.zhangmeng.model.entity.Tags;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TagsServiceImpl extends AbstractBaseServiceImpl<Tags> implements TagsService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -57,7 +57,6 @@ mapper:
|
||||||
mystyle:
|
mystyle:
|
||||||
security:
|
security:
|
||||||
open-api:
|
open-api:
|
||||||
- /
|
|
||||||
- /login
|
- /login
|
||||||
- /favicon.ico # 开放FAVICON
|
- /favicon.ico # 开放FAVICON
|
||||||
- /system/**
|
- /system/**
|
||||||
|
|
@ -71,7 +70,18 @@ mystyle:
|
||||||
- /v3/api-docs
|
- /v3/api-docs
|
||||||
- /doc.html
|
- /doc.html
|
||||||
- /webjars/**
|
- /webjars/**
|
||||||
|
- /actuator/**
|
||||||
|
- /instances/**
|
||||||
verification-code:
|
verification-code:
|
||||||
type: mysql
|
type: mysql
|
||||||
expiration-time: 300
|
expiration-time: 300
|
||||||
redis-key: redis-29b9f4ddcf8072d2f856a67f76957821
|
redis-key: redis-29b9f4ddcf8072d2f856a67f76957821
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: ALWAYS
|
||||||
|
enabled: true
|
||||||
|
|
@ -136,6 +136,18 @@ var fiction_save_url = gate_way_url + "/" + fiction_url + "/fiction/save";
|
||||||
//小说集合列表
|
//小说集合列表
|
||||||
var fictionCollection_list_url = gate_way_url + "/" + fiction_url + "/fictionCollection/list";
|
var fictionCollection_list_url = gate_way_url + "/" + fiction_url + "/fictionCollection/list";
|
||||||
var fictionCollection_add_url = gate_way_url + "/" + admin_manager_url + "/fiction/add" + access_token_url;
|
var fictionCollection_add_url = gate_way_url + "/" + admin_manager_url + "/fiction/add" + access_token_url;
|
||||||
|
//标签列表
|
||||||
|
var tags_list_url = gate_way_url + "/" + admin_manager_url + "/tags/list";
|
||||||
|
//新增标签
|
||||||
|
var tags_add_url = gate_way_url + "/" + admin_manager_url + "/tags/add" + access_token_url;
|
||||||
|
//标签保存
|
||||||
|
var tags_save_url = gate_way_url + "/" + admin_manager_url + "/tags/save";
|
||||||
|
//标签删除
|
||||||
|
var tags_delete_url = gate_way_url + "/" + admin_manager_url;
|
||||||
|
//标签批量删除
|
||||||
|
var tags_batchRemove_url = gate_way_url + "/" + admin_manager_url + "/tags/batchRemove";
|
||||||
|
//标签编辑
|
||||||
|
var tags_edit_url = gate_way_url + "/" + admin_manager_url + "/tags/edit" + access_token_url ;
|
||||||
|
|
||||||
//页面跳转
|
//页面跳转
|
||||||
function postToPage(url, token) {
|
function postToPage(url, token) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>标签添加</title>
|
<title>标签添加</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css" />
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
|
|
@ -51,8 +51,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form','jquery'],function(){
|
layui.use(['form','jquery'],function(){
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
@ -60,9 +61,9 @@
|
||||||
|
|
||||||
form.on('submit(tags-save)', function(data){
|
form.on('submit(tags-save)', function(data){
|
||||||
var obj = data.field;
|
var obj = data.field;
|
||||||
obj['token'] = localStorage.getItem("token");
|
obj['access_token'] = access_token;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:'/tags/save',
|
url:tags_save_url,
|
||||||
data:obj,
|
data:obj,
|
||||||
type:'post',
|
type:'post',
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>分类编辑</title>
|
<title>分类编辑</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css"/>
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
|
|
@ -62,8 +62,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery'], function () {
|
layui.use(['form', 'jquery'], function () {
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
@ -71,9 +72,9 @@
|
||||||
|
|
||||||
form.on('submit(tags-edit)', function (data) {
|
form.on('submit(tags-edit)', function (data) {
|
||||||
var obj = data.field;
|
var obj = data.field;
|
||||||
obj['token'] = localStorage.getItem("token");
|
obj['access_token'] = access_token;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/tags/save',
|
url: tags_save_url,
|
||||||
data: obj,
|
data: obj,
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>分类管理</title>
|
<title>分类管理</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css" />
|
<link rel="stylesheet"
|
||||||
|
href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="pear-container">
|
<body class="pear-container">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
|
|
@ -49,20 +50,24 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="tags-bar">
|
<script type="text/html" id="tags-bar">
|
||||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
|
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
|
||||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
</button>
|
||||||
|
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
|
||||||
|
</button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="tags-enable">
|
<script type="text/html" id="tags-enable">
|
||||||
<input type="checkbox" name="enable" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="tags-enable" checked = "{{ d.enable == 0 ? 'true' : 'false' }}">
|
<input type="checkbox" name="enable" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="tags-enable"
|
||||||
|
checked="{{ d.enable == 0 ? 'true' : 'false' }}">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="tags-addTime">
|
<script type="text/html" id="tags-addTime">
|
||||||
{{layui.util.toDateString(d.addTime, 'yyyy-MM-dd HH:mm:ss')}}
|
{{layui.util.toDateString(d.addTime, 'yyyy-MM-dd HH:mm:ss')}}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'common'], function () {
|
layui.use(['table', 'form', 'jquery', 'common'], function () {
|
||||||
let table = layui.table;
|
let table = layui.table;
|
||||||
|
|
@ -110,11 +115,13 @@
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#tags-table',
|
elem: '#tags-table',
|
||||||
url: '/tags/list',
|
url: tags_list_url,
|
||||||
headers: {token: localStorage.getItem("token")},
|
headers: {
|
||||||
|
access_token: access_token
|
||||||
|
},
|
||||||
page: true,
|
page: true,
|
||||||
cols: cols,
|
cols: cols,
|
||||||
skin: 'line',
|
skin: 'rows',
|
||||||
toolbar: '#tags-toolbar',
|
toolbar: '#tags-toolbar',
|
||||||
defaultToolbar: [{
|
defaultToolbar: [{
|
||||||
title: '刷新',
|
title: '刷新',
|
||||||
|
|
@ -177,7 +184,7 @@
|
||||||
title: '新增',
|
title: '新增',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: [common.isModile() ? '100%' : '900px', common.isModile() ? '100%' : '600px'],
|
area: [common.isModile() ? '100%' : '900px', common.isModile() ? '100%' : '600px'],
|
||||||
content: '/tags/add?token=' + token
|
content: tags_add_url
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -187,7 +194,7 @@
|
||||||
title: '修改',
|
title: '修改',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['900px', '600px'],
|
area: ['900px', '600px'],
|
||||||
content: '/tags/edit?token=' + token + '&tagId=' + obj.data.id
|
content: tags_edit_url + '&tagId=' + obj.data.id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -200,10 +207,10 @@
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
let loading = layer.load();
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/tags/delete",
|
url: tags_delete_url,
|
||||||
data: {
|
data: {
|
||||||
tagId: obj.data['id'],
|
tagId: obj.data['id'],
|
||||||
token:token
|
access_token: access_token
|
||||||
},
|
},
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
@ -245,10 +252,10 @@
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
let loading = layer.load();
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/tags/batchRemove",
|
url: tags_batchRemove_url,
|
||||||
data: {
|
data: {
|
||||||
ids: checkIds,
|
ids: checkIds,
|
||||||
token:token
|
access_token: access_token
|
||||||
},
|
},
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>mystyle-cloud-parent</artifactId>
|
||||||
|
<groupId>com.zhangmeng</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>mystyle-cloud-admin-monitor</artifactId>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>8</source>
|
||||||
|
<target>8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-sleuth</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.codecentric</groupId>
|
||||||
|
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-oauth2</artifactId>
|
||||||
|
<version>2.2.4.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.zhangmeng.monitor;
|
||||||
|
|
||||||
|
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
@EnableAdminServer
|
||||||
|
public class AdminMonitorApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(AdminMonitorApplication.class,args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.zhangmeng.monitor.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||||||
|
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||||||
|
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||||
|
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
|
||||||
|
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 转身的背影在心底里沉沦
|
||||||
|
* @date 2021年9月14日16:45:29
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableResourceServer
|
||||||
|
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)// 激活方法上的PreAuthorize注解
|
||||||
|
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
||||||
|
|
||||||
|
// 公钥
|
||||||
|
private static final String PUBLIC_KEY = "public.key";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 定义JwtTokenStore
|
||||||
|
* @param jwtAccessTokenConverter
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
|
||||||
|
return new JwtTokenStore(jwtAccessTokenConverter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 定义JJwtAccessTokenConverter
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public JwtAccessTokenConverter jwtAccessTokenConverter() {
|
||||||
|
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
|
||||||
|
converter.setVerifierKey(getPubKey()); //秘钥的一部分
|
||||||
|
return converter;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取非对称加密公钥 Key
|
||||||
|
* @return 公钥 Key
|
||||||
|
*/
|
||||||
|
private String getPubKey() {
|
||||||
|
Resource resource = new ClassPathResource(PUBLIC_KEY);
|
||||||
|
try {
|
||||||
|
InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream());
|
||||||
|
BufferedReader br = new BufferedReader(inputStreamReader);
|
||||||
|
return br.lines().collect(Collectors.joining("\n"));
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* SpringSecurity
|
||||||
|
* Http安全配置,对每个到达系统的http请求链接进行校验
|
||||||
|
* @param http
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void configure(HttpSecurity http) throws Exception {
|
||||||
|
http.headers().frameOptions().disable();
|
||||||
|
// 所有请求必须认证通过
|
||||||
|
http.authorizeRequests()
|
||||||
|
// 跨域预检请求
|
||||||
|
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
server:
|
||||||
|
port: 31010
|
||||||
|
spring:
|
||||||
|
boot:
|
||||||
|
admin:
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
application:
|
||||||
|
name: mystyle-cloud-admin-monitor
|
||||||
|
zipkin:
|
||||||
|
sender:
|
||||||
|
type: web
|
||||||
|
base-url: http://localhost:9411/
|
||||||
|
service:
|
||||||
|
name: mystyle-cloud-admin-monitor
|
||||||
|
sleuth:
|
||||||
|
sampler:
|
||||||
|
probability: 1
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAizuj0fBV2+dj4lM3G6efKYvC2czd07BqmzV++E2yBguVks3XWvsW8qlzmG+t1XBCnRFDI/t1Ddc/Jsnlfy4YzRN8otb/Xn6Yz9ACFvZIPGx/q0cqcrgVaR9rSQiSzsGTgUGHNJk8r3A4w9PSSB552Z9s6p5TsWK5ezlfgg+2ANKn1eJ6R/hzajS/B1bTAqYcl9ddo7prneoeAN5LjlMhc2e0cSVgQt8ALP+4x/bTMnDkMjG6R8lnDAxE27B2ZPaLOIOjkUMK+9mZa4RNBoCDG6J/fwPD1NUoVRCbyr/TVaS4EzyhfNK1QW3BlZ0NLSI/SFD3eryKaFQdacJHS31neQIDAQAB-----END PUBLIC KEY-----
|
||||||
|
|
@ -1,7 +1,24 @@
|
||||||
package com.zhangmeng.api.service.fiction;
|
package com.zhangmeng.api.service.fiction;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.entity.FictionCollection;
|
||||||
|
import com.zhangmeng.model.vo.Result;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@Api(tags = "小说集合")
|
@Api(tags = "小说集合")
|
||||||
public interface FictionCollectionControllerApi {
|
public interface FictionCollectionControllerApi {
|
||||||
|
|
||||||
|
@ApiOperation("爬取小说集合")
|
||||||
|
public Result gen();
|
||||||
|
|
||||||
|
@ApiOperation("集合列表")
|
||||||
|
public Result list(String title, Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
@ApiOperation("genFiction")
|
||||||
|
public Result genFiction(String url);
|
||||||
|
|
||||||
|
@ApiOperation("根据获取小说集合详情")
|
||||||
|
public FictionCollection findFictionCollectionById(@RequestParam("fiction_id") Long fiction_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,5 +53,11 @@
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.codecentric</groupId>
|
||||||
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -56,3 +56,14 @@ mystyle:
|
||||||
- /v3/api-docs
|
- /v3/api-docs
|
||||||
- /doc.html
|
- /doc.html
|
||||||
- /webjars/**
|
- /webjars/**
|
||||||
|
- /actuator/**
|
||||||
|
- /instances/**
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: ALWAYS
|
||||||
|
enabled: true
|
||||||
|
|
@ -15,6 +15,7 @@ import org.jsoup.select.Elements;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
@ -33,7 +34,7 @@ public class FictionCollectionController extends BaseController implements Ficti
|
||||||
@Autowired
|
@Autowired
|
||||||
private TianYuXiaoShuoJsoupService tianYuXiaoShuoJsoupService;
|
private TianYuXiaoShuoJsoupService tianYuXiaoShuoJsoupService;
|
||||||
|
|
||||||
@ApiOperation("爬取小说集合")
|
@Override
|
||||||
@GetMapping("/gen")
|
@GetMapping("/gen")
|
||||||
public Result gen() {
|
public Result gen() {
|
||||||
Elements li = tianYuXiaoShuoJsoupService.fiction_collection();
|
Elements li = tianYuXiaoShuoJsoupService.fiction_collection();
|
||||||
|
|
@ -52,7 +53,7 @@ public class FictionCollectionController extends BaseController implements Ficti
|
||||||
return this.success();
|
return this.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("集合列表")
|
@Override
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result list(String title, Integer pageNum, Integer pageSize) {
|
public Result list(String title, Integer pageNum, Integer pageSize) {
|
||||||
Condition condition = new Condition(FictionCollection.class);
|
Condition condition = new Condition(FictionCollection.class);
|
||||||
|
|
@ -63,7 +64,7 @@ public class FictionCollectionController extends BaseController implements Ficti
|
||||||
return this.fictionCollectionService.findByByConditionWithResult(new QueryParams(pageNum, pageSize, condition, "addTime desc"));
|
return this.fictionCollectionService.findByByConditionWithResult(new QueryParams(pageNum, pageSize, condition, "addTime desc"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("genFiction")
|
@Override
|
||||||
@GetMapping("/genFiction")
|
@GetMapping("/genFiction")
|
||||||
public Result genFiction(String url) {
|
public Result genFiction(String url) {
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
|
|
@ -80,4 +81,10 @@ public class FictionCollectionController extends BaseController implements Ficti
|
||||||
}
|
}
|
||||||
return this.success("生成成功");
|
return this.success("生成成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/findFictionCollectionById")
|
||||||
|
public FictionCollection findFictionCollectionById(@RequestParam("fiction_id") Long fiction_id){
|
||||||
|
return this.fictionCollectionService.findById(fiction_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,3 +78,9 @@ spring:
|
||||||
- Path=/mystyle-cloud-fiction/**
|
- Path=/mystyle-cloud-fiction/**
|
||||||
filters:
|
filters:
|
||||||
- StripPrefix=1
|
- StripPrefix=1
|
||||||
|
- id: mystyle-cloud-admin-monitor
|
||||||
|
uri: lb://mystyle-cloud-admin-monitor
|
||||||
|
predicates:
|
||||||
|
- Path=/mystyle-cloud-admin-monitor/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.zhangmeng.model.base.baseController;
|
package com.zhangmeng.model.base.baseController;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.entity.Tags;
|
||||||
import com.zhangmeng.model.vo.Result;
|
import com.zhangmeng.model.vo.Result;
|
||||||
import com.zhangmeng.model.vo.StatusCode;
|
import com.zhangmeng.model.vo.StatusCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BaseController extends ResponseController {
|
public class BaseController extends ResponseController {
|
||||||
|
|
||||||
protected Result success(){
|
protected Result success(){
|
||||||
|
|
@ -28,4 +31,8 @@ public class BaseController extends ResponseController {
|
||||||
protected Result failure(String message,Object data) {
|
protected Result failure(String message,Object data) {
|
||||||
return new Result(false,StatusCode.ERROR,message,data);
|
return new Result(false,StatusCode.ERROR,message,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Result responseJsonData(long total, List list) {
|
||||||
|
return new Result(true,StatusCode.OK,"成功",total,list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -406,4 +406,13 @@ public class CommonUtil {
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void page_params_verify(Integer pageNum, Integer pageSize) {
|
||||||
|
if (pageNum == null) {
|
||||||
|
pageNum = CommonUtil.pageNum;
|
||||||
|
}
|
||||||
|
if (pageSize == null) {
|
||||||
|
pageSize = CommonUtil.pageSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,15 @@ public class SysConstant {
|
||||||
|
|
||||||
public static final String mystyle_cloud_fiction= "mystyle-cloud-fiction";
|
public static final String mystyle_cloud_fiction= "mystyle-cloud-fiction";
|
||||||
|
|
||||||
|
public static final String mystyle_cloud_admin_monitor= "mystyle-cloud-admin-monitor";
|
||||||
|
|
||||||
public static final String mystyle_cloud_fiction_prefix = "/fiction";
|
public static final String mystyle_cloud_fiction_prefix = "/fiction";
|
||||||
|
|
||||||
|
public static final String fictionCollection_prefix = "/fictionCollection";
|
||||||
|
|
||||||
|
public static final String tags_prefix = "/tags";
|
||||||
|
|
||||||
|
public static final String mail_prefix = "/mail";
|
||||||
|
|
||||||
|
public static final String fiction_prefix= "fiction";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.zhangmeng.model.entity;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.base.baseEntity.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhengmeng
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2021年1月7日11:38:42
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Table(name = "tags")
|
||||||
|
public class Tags extends BaseEntity<Long> {
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
Article("文章"),
|
||||||
|
Fiction("小说");
|
||||||
|
|
||||||
|
Type(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String description;//描述
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Map<String,Object>> enumListMap(){
|
||||||
|
Tags.Type[] values = Tags.Type.values();
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (Tags.Type value : values) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String description = value.getDescription();
|
||||||
|
map.put("description",description);
|
||||||
|
map.put("value",value);
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
private String description;//描述
|
||||||
|
|
||||||
|
private Long article_id;//文章的id
|
||||||
|
}
|
||||||
14
pom.xml
14
pom.xml
|
|
@ -33,6 +33,7 @@
|
||||||
<module>mystyle-cloud-quartz</module>
|
<module>mystyle-cloud-quartz</module>
|
||||||
<module>mystyle-cloud-mail</module>
|
<module>mystyle-cloud-mail</module>
|
||||||
<module>mystyle-cloud-fiction</module>
|
<module>mystyle-cloud-fiction</module>
|
||||||
|
<module>mystyle-cloud-admin-monitor</module>
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
@ -265,6 +266,19 @@
|
||||||
<version>${commons-beanutils.version}</version>
|
<version>${commons-beanutils.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.codecentric</groupId>
|
||||||
|
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||||
|
<version>2.5.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.codecentric</groupId>
|
||||||
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
|
<version>2.5.4</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
</project>
|
</project>
|
||||||
Loading…
Reference in New Issue