修改登录模块:注册+验证码登录
parent
fcc92f8039
commit
d1a869f092
|
@ -12,7 +12,7 @@ http {
|
|||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
server_name 115.159.78.103;
|
||||
|
||||
location / {
|
||||
root /home/ruoyi/projects/ruoyi-ui;
|
||||
|
|
|
@ -72,7 +72,7 @@ public class TokenController
|
|||
public R<?> register(@RequestBody RegisterBody registerBody)
|
||||
{
|
||||
// 用户注册
|
||||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
||||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword(),registerBody.getPhonenumber(),registerBody.getCode());
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package com.ruoyi.auth.form;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户注册对象
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
|
||||
public class RegisterBody extends LoginBody
|
||||
{
|
||||
|
||||
private String phonenumber;
|
||||
private String code;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class SysLoginService
|
|||
/**
|
||||
* 注册
|
||||
*/
|
||||
public void register(String username, String password)
|
||||
public void register(String username, String password, String phonenumber, String code)
|
||||
{
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password))
|
||||
|
@ -116,6 +116,10 @@ public class SysLoginService
|
|||
// 注册用户信息
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(username);
|
||||
|
||||
sysUser.setPhonenumber(phonenumber);
|
||||
sysUser.setCode(code);
|
||||
|
||||
sysUser.setNickName(username);
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.auth.service;
|
||||
|
||||
import com.ruoyi.system.remote.api.RemoteLogService;
|
||||
import com.ruoyi.system.remote.api.RemoteUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
|
@ -10,6 +11,8 @@ import com.ruoyi.common.core.utils.StringUtils;
|
|||
import com.ruoyi.common.core.utils.ip.IpUtils;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 记录日志方法
|
||||
*
|
||||
|
@ -20,7 +23,6 @@ public class SysRecordLogService
|
|||
{
|
||||
@Autowired
|
||||
private RemoteLogService remoteLogService;
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
|
@ -15,4 +16,9 @@ public class EsDocQueryVo extends EsDocBaseVo{
|
|||
private String keyWord;
|
||||
@ApiModelProperty("分页条件")
|
||||
private PageVo pageVo = new PageVo();
|
||||
|
||||
@ApiModelProperty("检索字段")
|
||||
private List<String> searchFields;
|
||||
@ApiModelProperty("高亮字段,包含在检索字段,不传参则默认检索字段全部高亮")
|
||||
private List<String> highLightFields;
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@ package com.ruoyi.system.remote.api;
|
|||
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||
import com.ruoyi.system.remote.factory.RemoteEsDocFallbackFactory;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -24,4 +26,9 @@ public interface RemoteEsDocService {
|
|||
|
||||
@PostMapping("/queryDocs")
|
||||
public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo);
|
||||
|
||||
|
||||
@PostMapping("/deleteDocs")
|
||||
public R<Boolean> deleteDocsById(@RequestParam(value = "docsId") String docsId);
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,13 @@ public class RemoteEsDocFallbackFactory implements FallbackFactory<RemoteEsDocSe
|
|||
public R queryDocs(EsDocQueryVo esDocInsertVo) {
|
||||
return R.ok(false, "查询失败,请稍后重试");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> deleteDocsById(String docsId) {
|
||||
return R.ok(false, "删除失败,请稍后重试");
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -7,15 +7,13 @@ import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "Es文档管理")
|
||||
//文档相当于mysql中的一行数据,类似DML和DQL
|
||||
public class EsDocController {
|
||||
|
||||
@Autowired
|
||||
|
@ -32,4 +30,22 @@ public class EsDocController {
|
|||
public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo){
|
||||
return esDocService.queryDocs(esDocInsertVo);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/deleteDocs")
|
||||
@ApiOperation("/根据索引名称和文档id删除索引数据")
|
||||
public R<Boolean> deleteDocsById(@RequestParam(value = "docsId") String docsId){
|
||||
return esDocService.deleteDocsById(docsId);
|
||||
}
|
||||
|
||||
|
||||
// TODO 自动补全联想
|
||||
@GetMapping("/querySuggestions/{indexName}")
|
||||
@ApiOperation(value = "自动补全联想")
|
||||
public R querySuggestions(@PathVariable String indexName, @RequestParam("keyWord") String keyWord,@RequestParam("suggestField") String suggestField ){
|
||||
return esDocService.querySuggestions(indexName,keyWord,suggestField);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,19 +2,18 @@ package com.ruoyi.es.controller;
|
|||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.es.service.EsIndexService;
|
||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/esIndex")
|
||||
@Api(value = "ES索引管理",tags = "ES索引管理")
|
||||
// 索引相当于mysql中的库,在es6之后,取消类型(相当于mysql中的表),索引默认只有一个类型-即库表合一 类似DDL
|
||||
public class EsIndexController {
|
||||
|
||||
@Autowired
|
||||
|
@ -73,9 +72,18 @@ public class EsIndexController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/indexGetMapping")
|
||||
@ApiOperation(value = "根据索引名称删除索引")
|
||||
@ApiOperation(value = "根据索引名称获取mapping")
|
||||
public R<Map> indexGetMapping(@RequestParam String indexName) {
|
||||
|
||||
return esIndexService.indexGetMapping(indexName);
|
||||
}
|
||||
/**
|
||||
* 查询所有已创建的索引
|
||||
*/
|
||||
@GetMapping("/queryAllIndex")
|
||||
@ApiOperation(value = "查询所有索引列表")
|
||||
public R<Map> queryAllIndex(@RequestBody EsDocQueryVo esDocInsertVo) {
|
||||
return esIndexService.queryAllIndex(esDocInsertVo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,9 +5,14 @@ import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
|||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface EsDocService {
|
||||
R<Boolean> batchInsertDocs(List<EsDocInsertVo> esDocInsertVo);
|
||||
|
||||
R queryDocs(EsDocQueryVo esDocInsertVo);
|
||||
R<List<Map>> queryDocs(EsDocQueryVo esDocInsertVo);
|
||||
|
||||
R<Boolean> deleteDocsById(String docsId);
|
||||
|
||||
R querySuggestions(String indexName, String keyWord, String suggestField);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.es.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -14,4 +15,6 @@ public interface EsIndexService {
|
|||
R<Boolean> indexCreateWithMapping(String indexName, String indexMapping);
|
||||
|
||||
R<Map> indexGetMapping(String indexName);
|
||||
|
||||
R<Map> queryAllIndex(EsDocQueryVo esDocInsertVo);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
package com.ruoyi.es.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.constant.EsConstant;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.es.service.EsDocService;
|
||||
import com.ruoyi.system.domain.vo.EsDocInsertVo;
|
||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
|
@ -56,7 +62,11 @@ public class EsDocServiceImpl implements EsDocService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public R queryDocs(EsDocQueryVo esDocInsertVo) {
|
||||
public R<List<Map>> queryDocs(EsDocQueryVo esDocInsertVo) {
|
||||
if (StringUtils.isEmpty(esDocInsertVo.getKeyWord())){
|
||||
throw new ServiceException("搜索参数不为空");
|
||||
}
|
||||
|
||||
SearchRequest request = new SearchRequest(esDocInsertVo.getIndexName());
|
||||
//构建查询参数
|
||||
SearchSourceBuilder builder = new SearchSourceBuilder();
|
||||
|
@ -79,4 +89,22 @@ public class EsDocServiceImpl implements EsDocService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> deleteDocsById(String docsId) {
|
||||
DeleteRequest deleteRequest = new DeleteRequest(EsConstant.INDEX_NAME, docsId);
|
||||
try {
|
||||
DeleteResponse deleteResponse = restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
|
||||
return R.ok(true,"删除成功");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R querySuggestions(String indexName, String keyWord, String suggestField) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,19 +4,25 @@ import com.ruoyi.common.core.domain.R;
|
|||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.es.service.EsIndexService;
|
||||
import com.ruoyi.system.domain.vo.EsDocQueryVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
|
||||
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.GetAliasesResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.indices.*;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
@ -115,4 +121,28 @@ public class EsIndexServiceImpl implements EsIndexService {
|
|||
throw new RuntimeException("根据索引名称获取Mapping异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Map> queryAllIndex(EsDocQueryVo esDocInsertVo) {
|
||||
// TODO 关键字查询
|
||||
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
GetAliasesRequest request = new GetAliasesRequest();
|
||||
GetAliasesResponse alias = null;
|
||||
try {
|
||||
alias = restHighLevelClient.indices().getAlias(request, RequestOptions.DEFAULT);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Map<String, Set<AliasMetaData>> map = alias.getAliases();
|
||||
map.forEach((k, v) -> {
|
||||
if (!k.startsWith(".")) {//忽略elasticesearch 默认的
|
||||
Map map1 = new HashMap();
|
||||
map1.put("indexName", k);
|
||||
resultList.add(map1);
|
||||
}
|
||||
});
|
||||
log.info(String.valueOf(resultList));
|
||||
return R.ok((Map) resultList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ruoyi.system.domain;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
|
@ -17,10 +19,13 @@ import com.ruoyi.common.core.xss.Xss;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class SysUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String code;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
|
|
@ -4,9 +4,14 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.crypto.MacSpi;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.system.utils.MsgUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -67,6 +72,9 @@ public class SysUserController extends BaseController
|
|||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
@ -109,7 +117,7 @@ public class SysUserController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
* 获取当前用户信息--登录
|
||||
*/
|
||||
@InnerAuth
|
||||
@GetMapping("/info/{username}")
|
||||
|
@ -139,14 +147,42 @@ public class SysUserController extends BaseController
|
|||
public R<Boolean> register(@RequestBody SysUser sysUser)
|
||||
{
|
||||
String username = sysUser.getUserName();
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
//手机号不为空
|
||||
if (null == sysUser.getPhonenumber()){
|
||||
return R.fail("手机号不能为空");
|
||||
}
|
||||
//判断该手机号是否已进行过注册操作
|
||||
if (redisTemplate.hasKey(sysUser.getPhonenumber())){
|
||||
return R.fail("请在一分钟后再进行操作");
|
||||
}
|
||||
//限制:一个手机号一分钟内只能发送一次注册请求(定时器清除Redis缓存)
|
||||
//将手机号放入Redis缓存
|
||||
redisTemplate.opsForValue().set(sysUser.getPhonenumber(),sysUser.getPhonenumber());
|
||||
|
||||
//TODO 先注释掉该校验,否则无法注册,需要处理获取selectConfigByKey问题
|
||||
/*if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
{
|
||||
return R.fail("当前系统没有开启注册功能!");
|
||||
}
|
||||
}*/
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(username)))
|
||||
{
|
||||
return R.fail("保存用户'" + username + "'失败,注册账号已存在");
|
||||
}
|
||||
//判断手机号是否已被注册
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(sysUser)))
|
||||
{
|
||||
return R.fail("手机号注册'" + sysUser.getPhonenumber() + "'失败,手机号已注册过");
|
||||
}
|
||||
//校验通过:生成验证码并存入Redis缓存
|
||||
String code = RandomStringUtils.random(4);
|
||||
redisTemplate.opsForValue().set("code",code);
|
||||
//发送验证码至手机端
|
||||
MsgUtil.sendMsg(sysUser.getPhonenumber(),code);
|
||||
//判断验证码是否正确
|
||||
if (sysUser.getCode()!=code){
|
||||
return R.fail("验证码错误");
|
||||
}
|
||||
|
||||
return R.ok(userService.registerUser(sysUser));
|
||||
}
|
||||
|
||||
|
@ -324,4 +360,37 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
return AjaxResult.success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 手机号+验证码登录
|
||||
*/
|
||||
@PostMapping("/loginByPhone")
|
||||
public R<LoginUser> info(@RequestBody SysUser sysUser)
|
||||
{
|
||||
SysUser user = userService.selectUserByUserName(sysUser.getPhonenumber());
|
||||
if (StringUtils.isNull(user))
|
||||
{
|
||||
return R.fail("手机号不存在");
|
||||
}
|
||||
if (StringUtils.isNull(user.getCode()))
|
||||
{
|
||||
return R.fail("验证码不能为空");
|
||||
}
|
||||
if (!redisTemplate.opsForValue().get("code").equals(user.getCode())){
|
||||
return R.fail("验证码错误");
|
||||
}
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
LoginUser sysUserVo = new LoginUser();
|
||||
sysUserVo.setSysUser(sysUser);
|
||||
sysUserVo.setRoles(roles);
|
||||
sysUserVo.setPermissions(permissions);
|
||||
return R.ok(sysUserVo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -124,4 +124,6 @@ public interface SysUserMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique(String email);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -203,4 +203,7 @@ public interface ISysUserService
|
|||
* @return 结果
|
||||
*/
|
||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -538,4 +538,6 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return successMsg.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -93,11 +93,11 @@ public class MallProductInfoController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 上架商品
|
||||
* 上架/下架商品
|
||||
*/
|
||||
@GetMapping(value = "/upload/{id}")
|
||||
@ApiOperation("上架商品")
|
||||
public R uploadInfo(@PathVariable("id") Long id,boolean isUpload)
|
||||
public R uploadInfo(@PathVariable("id") String id)
|
||||
{
|
||||
mallProductInfoService.uploadInfo(id);
|
||||
return R.ok();
|
||||
|
|
|
@ -71,7 +71,7 @@ public interface IMallProductInfoService
|
|||
*/
|
||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
||||
|
||||
void uploadInfo(Long id);
|
||||
void uploadInfo(String id);
|
||||
|
||||
/**
|
||||
* 加载商品数据到ES中
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.core.constant.EsConstant;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
|
@ -234,50 +235,59 @@ public class MallProductInfoServiceImpl implements IMallProductInfoService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void uploadInfo(Long id) {
|
||||
//参数校验
|
||||
if (null == id) {
|
||||
throw new ServiceException("商品id不存在");
|
||||
}
|
||||
//查询商品spu信息
|
||||
MallProductInfo mallProductInfo = mallProductInfoMapper.selectMallProductInfoById(id);
|
||||
if (null == mallProductInfo){
|
||||
throw new ServiceException("商品ID"+id+"不存在");
|
||||
}
|
||||
//查找商品skuInfos
|
||||
List<MallProductSkuInfo> mallProductSkuInfos = skuInfoService.selectMallProductSkuInfoList(id);
|
||||
if (CollectionUtils.isEmpty(mallProductSkuInfos)){
|
||||
throw new ServiceException("该商品id"+id+"下不存在sku信息");
|
||||
}
|
||||
//转换
|
||||
List<EsDocInsertVo> esDocInsertVo = transFormData(mallProductInfo,mallProductSkuInfos);
|
||||
remoteEsDocService.batchInsertDocs(null);
|
||||
@Transactional
|
||||
public void uploadInfo(String id) {
|
||||
// 查询商品的spu信息
|
||||
MallProductInfo mallProductInfo = mallProductInfoMapper.selectMallProductInfoById(Long.valueOf(id));
|
||||
|
||||
//TODO 调用ES查询商品是否上架
|
||||
//feignClient.uploadInfo(id,"index");
|
||||
//TODO 查询商品SKU信息
|
||||
// 校验商品信息是否存在
|
||||
if (mallProductInfo == null) {
|
||||
throw new ServiceException("该商品信息不存在");
|
||||
}
|
||||
|
||||
//TODO 封装ES商品信息
|
||||
//TODO 调用ES上架商品
|
||||
// 查询商品的sku信息
|
||||
List<MallProductSkuInfo> mallProductSkuInfos = skuInfoService.selectMallProductSkuInfoList(Long.valueOf(id));
|
||||
|
||||
// 校验sku信息是否为空
|
||||
if (CollectionUtils.isEmpty(mallProductSkuInfos)) {
|
||||
throw new ServiceException("该商品下sku信息不存在");
|
||||
}
|
||||
|
||||
// 切换商品的上下架状态并且在es中删除下架的商品
|
||||
String newStatus = mallProductInfo.getStatus().equals("1") ? "0" : "1";
|
||||
mallProductInfo.setStatus(newStatus);
|
||||
|
||||
//判断该商品是上架状态还是下架状态
|
||||
if (newStatus.equals("1")){
|
||||
//修改该商品状态为上架 并且添加至es
|
||||
mallProductInfoMapper.updateMallProductInfo(mallProductInfo);
|
||||
// 检查商品索引是否存在
|
||||
R<Boolean> indexExit = remoteEsIndexService.indexExit(EsConstant.INDEX_NAME);
|
||||
if (!indexExit.getData()) {
|
||||
throw new ServiceException("该商品索引不存在");
|
||||
}
|
||||
|
||||
//构建es所需要的数据结构
|
||||
List<EsDocInsertVo> esDocInsertVos = builderProductInfo2Es(mallProductInfo,mallProductSkuInfos);
|
||||
//批量插入
|
||||
remoteEsDocService.batchInsertDocs(esDocInsertVos);
|
||||
}else {
|
||||
//修改该商品状态为下架 并且删除es数据
|
||||
mallProductInfoMapper.updateMallProductInfo(mallProductInfo);
|
||||
// 检查商品索引是否存在
|
||||
R<Boolean> indexExit = remoteEsIndexService.indexExit(EsConstant.INDEX_NAME);
|
||||
if (!indexExit.getData()) {
|
||||
throw new ServiceException("该商品索引不存在");
|
||||
}
|
||||
//根据商品spuId查询出skuId 进行es删
|
||||
List<MallProductSkuInfo> skuInfoList = selectMallProductInfoById(Long.valueOf(mallProductInfo.getId())).getSkuInfoList();
|
||||
skuInfoList.stream().forEach(skuInfo->{
|
||||
Long docsId = skuInfo.getId();
|
||||
remoteEsDocService.deleteDocsById(String.valueOf(docsId));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private List<EsDocInsertVo> transFormData(MallProductInfo mallProductInfo, List<MallProductSkuInfo> mallProductSkuInfos) {
|
||||
//构建返回结果集
|
||||
ArrayList<EsDocInsertVo> esDocInsertVos = new ArrayList<>();
|
||||
mallProductSkuInfos.forEach(mallProductSkuInfo -> {
|
||||
EsDocInsertVo esDocInsertVo = new EsDocInsertVo();
|
||||
esDocInsertVo.setId(String.valueOf(mallProductInfo.getId()));
|
||||
esDocInsertVo.setIndexName("mall_product");
|
||||
esDocInsertVo.setTypeName("_doc");
|
||||
//TODO
|
||||
esDocInsertVo.setData(null);
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadingProductInfoToEs() {
|
||||
//查询所有商品信息
|
||||
|
@ -320,4 +330,23 @@ public class MallProductInfoServiceImpl implements IMallProductInfoService {
|
|||
});
|
||||
return esDocInsertVos;
|
||||
}
|
||||
|
||||
private List<EsDocInsertVo> builderProductInfo2Es(MallProductInfo mallProductInfo, List<MallProductSkuInfo> mallProductSkuInfos) {
|
||||
//构建返回结果集
|
||||
ArrayList<EsDocInsertVo> esDocInsertVos = new ArrayList<>();
|
||||
mallProductSkuInfos.forEach(mallProductSkuInfo -> {
|
||||
EsDocInsertVo esDocInsertVo = new EsDocInsertVo();
|
||||
esDocInsertVo.setId(String.valueOf(mallProductInfo.getId()));
|
||||
esDocInsertVo.setIndexName(EsConstant.INDEX_NAME);
|
||||
esDocInsertVo.setTypeName("_doc");
|
||||
//对象转为Map
|
||||
Map<String, Object> data = JSON.parseObject(JSON.toJSONString(mallProductInfo), Map.class);
|
||||
esDocInsertVo.setData(data);
|
||||
//将对象添加进数组
|
||||
esDocInsertVos.add(esDocInsertVo);
|
||||
});
|
||||
return esDocInsertVos;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -119,6 +119,14 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package com.ruoyi.mall.search.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.mall.product.domain.reponse.ProductInfoResponse;
|
||||
import com.ruoyi.mall.search.domain.request.SearchReq;
|
||||
import com.ruoyi.mall.search.es.instance.EsInstance;
|
||||
import com.ruoyi.mall.search.service.SearchService;
|
||||
import com.ruoyi.mall.search.utils.SearchResultUtils;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -16,7 +14,7 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -61,4 +59,11 @@ public class SearchController {
|
|||
model.addAttribute("searchReq",searchReq);
|
||||
return "search";
|
||||
}
|
||||
|
||||
@GetMapping("/suggestion")
|
||||
public R suggestion(@RequestParam String keyWord){
|
||||
return R.ok(searchService.suggestion(keyWord));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,4 +16,7 @@ public interface SearchService {
|
|||
public void syncProductInfo(Long productId);
|
||||
|
||||
void search (SearchReq searchReq);
|
||||
|
||||
|
||||
Object suggestion(String keyWord);
|
||||
}
|
||||
|
|
|
@ -128,4 +128,11 @@ public class SearchServiceImpl implements SearchService {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object suggestion(String keyWord) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -175,12 +175,12 @@ insert into sys_menu values('107', '通知公告', '1', '8', 'notice',
|
|||
insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单');
|
||||
insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单');
|
||||
insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单');
|
||||
insert into sys_menu values('111', 'Sentinel控制台', '2', '3', 'http://localhost:8718', '', '', 0, 0, 'C', '0', '0', 'monitor:sentinel:list', 'sentinel', 'admin', sysdate(), '', null, '流量控制菜单');
|
||||
insert into sys_menu values('112', 'Nacos控制台', '2', '4', 'http://localhost:8848/nacos', '', '', 0, 0, 'C', '0', '0', 'monitor:nacos:list', 'nacos', 'admin', sysdate(), '', null, '服务治理菜单');
|
||||
insert into sys_menu values('113', 'Admin控制台', '2', '5', 'http://localhost:9100/login', '', '', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
|
||||
insert into sys_menu values('111', 'Sentinel控制台', '2', '3', 'http://115.159.78.103:8718', '', '', 0, 0, 'C', '0', '0', 'monitor:sentinel:list', 'sentinel', 'admin', sysdate(), '', null, '流量控制菜单');
|
||||
insert into sys_menu values('112', 'Nacos控制台', '2', '4', 'http://115.159.78.103:8848/nacos', '', '', 0, 0, 'C', '0', '0', 'monitor:nacos:list', 'nacos', 'admin', sysdate(), '', null, '服务治理菜单');
|
||||
insert into sys_menu values('113', 'Admin控制台', '2', '5', 'http://115.159.78.103:9100/login', '', '', 0, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单');
|
||||
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单');
|
||||
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单');
|
||||
insert into sys_menu values('116', '系统接口', '3', '3', 'http://localhost:8080/swagger-ui/index.html', '', '', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
|
||||
insert into sys_menu values('116', '系统接口', '3', '3', 'http://115.159.78.103:8080/swagger-ui/index.html', '', '', 0, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单');
|
||||
-- 三级菜单
|
||||
insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'system/operlog/index', '', 1, 0, 'C', '0', '0', 'system:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单');
|
||||
insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'system/logininfor/index', '', 1, 0, 'C', '0', '0', 'system:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单');
|
||||
|
|
|
@ -34,12 +34,12 @@ CREATE TABLE `config_info` (
|
|||
|
||||
insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema, encrypted_data_key) values
|
||||
(1,'application-dev.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','aaa73b809cfd4d0058893aa13da57806','2020-05-20 12:00:00','2022-04-24 10:26:34','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml',NULL,''),
|
||||
(2,'bawei-gateway-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: bawei-auth\n uri: lb://bawei-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: bawei-gen\n uri: lb://bawei-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: bawei-job\n uri: lb://bawei-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: bawei-system\n uri: lb://bawei-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: bawei-file\n uri: lb://bawei-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /csrf\n','2f5a6b5a4ccf20b5801c5cf842456ec6','2020-05-14 14:17:55','2021-07-30 09:07:14',NULL,'0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml',NULL,''),
|
||||
(3,'bawei-auth-dev.yml','DEFAULT_GROUP','spring: \r\n redis:\r\n host: localhost\r\n port: 6379\r\n password: \r\n','b7354e1eb62c2d846d44a796d9ec6930','2020-11-20 00:00:00','2021-02-28 21:06:58',NULL,'0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml',NULL,''),
|
||||
(2,'bawei-gateway-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: 115.159.78.103\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: bawei-auth\n uri: lb://bawei-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: bawei-gen\n uri: lb://bawei-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: bawei-job\n uri: lb://bawei-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: bawei-system\n uri: lb://bawei-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: bawei-file\n uri: lb://bawei-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /csrf\n','2f5a6b5a4ccf20b5801c5cf842456ec6','2020-05-14 14:17:55','2021-07-30 09:07:14',NULL,'0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml',NULL,''),
|
||||
(3,'bawei-auth-dev.yml','DEFAULT_GROUP','spring: \r\n redis:\r\n host: 115.159.78.103\r\n port: 6379\r\n password: \r\n','b7354e1eb62c2d846d44a796d9ec6930','2020-11-20 00:00:00','2021-02-28 21:06:58',NULL,'0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml',NULL,''),
|
||||
(4,'bawei-monitor-dev.yml','DEFAULT_GROUP','# spring\r\nspring: \r\n security:\r\n user:\r\n name: bawei\r\n password: 123456\r\n boot:\r\n admin:\r\n ui:\r\n title: 若依服务状态监控\r\n','d8997d0707a2fd5d9fc4e8409da38129','2020-11-20 00:00:00','2020-12-21 16:28:07',NULL,'0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml',NULL,''),
|
||||
(5,'bawei-system-dev.yml','DEFAULT_GROUP','# spring配置\r\nspring: \r\n redis:\r\n host: localhost\r\n port: 6379\r\n password: \r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n # 主库数据源\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: password\r\n # 从库数据源\r\n # slave:\r\n # username: \r\n # password: \r\n # url: \r\n # driver-class-name: \r\n # seata: true # 开启seata代理,开启后默认每个数据源都代理,如果某个不需要代理可单独关闭\r\n\r\n# seata配置\r\nseata:\r\n # 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启\r\n enabled: false\r\n # Seata 应用编号,默认为 ${spring.application.name}\r\n application-id: ${spring.application.name}\r\n # Seata 事务组编号,用于 TC 集群名\r\n tx-service-group: ${spring.application.name}-group\r\n # 关闭自动代理\r\n enable-auto-data-source-proxy: false\r\n # 服务配置项\r\n service:\r\n # 虚拟组和分组的映射\r\n vgroup-mapping:\r\n bawei-system-group: default\r\n config:\r\n type: nacos\r\n nacos:\r\n serverAddr: 192.168.211.130:8848\r\n group: SEATA_GROUP\r\n namespace:\r\n registry:\r\n type: nacos\r\n nacos:\r\n application: seata-server\r\n server-addr: 192.168.211.130:8848\r\n namespace:\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.bawei.system\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 系统模块接口文档\r\n license: Powered By bawei\r\n licenseUrl: https://bawei.vip','ac8913dee679e65bb7d482df5f267d4e','2020-11-20 00:00:00','2021-01-27 10:42:25',NULL,'0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml',NULL,''),
|
||||
(6,'bawei-gen-dev.yml','DEFAULT_GROUP','# spring配置\r\nspring: \r\n redis:\r\n host: localhost\r\n port: 6379\r\n password: \r\n datasource: \r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: password\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.bawei.gen.domain\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 代码生成接口文档\r\n license: Powered By bawei\r\n licenseUrl: https://bawei.vip\r\n\r\n# 代码生成\r\ngen: \r\n # 作者\r\n author: bawei\r\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\r\n packageName: com.bawei.system\r\n # 自动去除表前缀,默认是false\r\n autoRemovePre: false\r\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\r\n tablePrefix: sys_\r\n','8c79f64a4cca9b821a03dc8b27a2d8eb','2020-11-20 00:00:00','2021-01-26 10:36:45',NULL,'0:0:0:0:0:0:0:1','','','代码生成','null','null','yaml',NULL,''),
|
||||
(7,'bawei-job-dev.yml','DEFAULT_GROUP','# spring配置\r\nspring: \r\n redis:\r\n host: localhost\r\n port: 6379\r\n password: \r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: password\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.bawei.job.domain\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 定时任务接口文档\r\n license: Powered By bawei\r\n licenseUrl: https://bawei.vip\r\n','d6dfade9a2c93c463ae857cd503cb172','2020-11-20 00:00:00','2021-01-26 10:36:04',NULL,'0:0:0:0:0:0:0:1','','','定时任务','null','null','yaml',NULL,''),
|
||||
(5,'bawei-system-dev.yml','DEFAULT_GROUP','# spring配置\r\nspring: \r\n redis:\r\n host: 115.159.78.103\r\n port: 6379\r\n password: \r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n # 主库数据源\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://115.159.78.103:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: password\r\n # 从库数据源\r\n # slave:\r\n # username: \r\n # password: \r\n # url: \r\n # driver-class-name: \r\n # seata: true # 开启seata代理,开启后默认每个数据源都代理,如果某个不需要代理可单独关闭\r\n\r\n# seata配置\r\nseata:\r\n # 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启\r\n enabled: false\r\n # Seata 应用编号,默认为 ${spring.application.name}\r\n application-id: ${spring.application.name}\r\n # Seata 事务组编号,用于 TC 集群名\r\n tx-service-group: ${spring.application.name}-group\r\n # 关闭自动代理\r\n enable-auto-data-source-proxy: false\r\n # 服务配置项\r\n service:\r\n # 虚拟组和分组的映射\r\n vgroup-mapping:\r\n bawei-system-group: default\r\n config:\r\n type: nacos\r\n nacos:\r\n serverAddr: 192.168.211.130:8848\r\n group: SEATA_GROUP\r\n namespace:\r\n registry:\r\n type: nacos\r\n nacos:\r\n application: seata-server\r\n server-addr: 192.168.211.130:8848\r\n namespace:\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.bawei.system\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 系统模块接口文档\r\n license: Powered By bawei\r\n licenseUrl: https://bawei.vip','ac8913dee679e65bb7d482df5f267d4e','2020-11-20 00:00:00','2021-01-27 10:42:25',NULL,'0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml',NULL,''),
|
||||
(6,'bawei-gen-dev.yml','DEFAULT_GROUP','# spring配置\r\nspring: \r\n redis:\r\n host: 115.159.78.103\r\n port: 6379\r\n password: \r\n datasource: \r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://115.159.78.103:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: password\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.bawei.gen.domain\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 代码生成接口文档\r\n license: Powered By bawei\r\n licenseUrl: https://bawei.vip\r\n\r\n# 代码生成\r\ngen: \r\n # 作者\r\n author: bawei\r\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\r\n packageName: com.bawei.system\r\n # 自动去除表前缀,默认是false\r\n autoRemovePre: false\r\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\r\n tablePrefix: sys_\r\n','8c79f64a4cca9b821a03dc8b27a2d8eb','2020-11-20 00:00:00','2021-01-26 10:36:45',NULL,'0:0:0:0:0:0:0:1','','','代码生成','null','null','yaml',NULL,''),
|
||||
(7,'bawei-job-dev.yml','DEFAULT_GROUP','# spring配置\r\nspring: \r\n redis:\r\n host: 115.159.78.103\r\n port: 6379\r\n password: \r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://115.159.78.103:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: password\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.bawei.job.domain\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 定时任务接口文档\r\n license: Powered By bawei\r\n licenseUrl: https://bawei.vip\r\n','d6dfade9a2c93c463ae857cd503cb172','2020-11-20 00:00:00','2021-01-26 10:36:04',NULL,'0:0:0:0:0:0:0:1','','','定时任务','null','null','yaml',NULL,''),
|
||||
(8,'bawei-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://127.0.0.1:9300\r\n path: D:/bawei/uploadPath\r\n prefix: /statics\r\n\r\n# FastDFS配置\r\nfdfs:\r\n domain: http://8.129.231.12\r\n soTimeout: 3000\r\n connectTimeout: 2000\r\n trackerList: 8.129.231.12:22122\r\n\r\n# Minio配置\r\nminio:\r\n url: http://8.129.231.12:9000\r\n accessKey: minioadmin\r\n secretKey: minioadmin\r\n bucketName: test','5382b93f3d8059d6068c0501fdd41195','2020-11-20 00:00:00','2020-12-21 21:01:59',NULL,'0:0:0:0:0:0:0:1','','','文件服务','null','null','yaml',NULL,''),
|
||||
(9,'sentinel-bawei-gateway','DEFAULT_GROUP','[\r\n {\r\n \"resource\": \"bawei-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"bawei-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"bawei-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"bawei-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]','9f3a3069261598f74220bc47958ec252','2020-11-20 00:00:00','2020-11-20 00:00:00',NULL,'0:0:0:0:0:0:0:1','','','限流策略','null','null','json',NULL,'');
|
||||
|
||||
|
|
Loading…
Reference in New Issue