升级支持SpringCloud 2021,Knife4j版本升级
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.macro.mall.config;
|
||||
|
||||
import com.macro.mall.common.config.BaseSwaggerConfig;
|
||||
import com.macro.mall.common.domain.SwaggerProperties;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@@ -24,4 +26,9 @@ public class SwaggerConfig extends BaseSwaggerConfig {
|
||||
.enableSecurity(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
|
||||
return generateBeanPostProcessor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -43,7 +40,7 @@ public class MinioController {
|
||||
@ApiOperation("文件上传")
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public CommonResult upload(@RequestParam("file") MultipartFile file) {
|
||||
public CommonResult upload(@RequestPart("file") MultipartFile file) {
|
||||
try {
|
||||
//创建一个MinIO的Java客户端
|
||||
MinioClient minioClient =MinioClient.builder()
|
||||
|
||||
@@ -82,4 +82,9 @@ public interface UmsAdminService {
|
||||
* 获取当前登录后台用户
|
||||
*/
|
||||
UmsAdmin getCurrentAdmin();
|
||||
|
||||
/**
|
||||
* 获取缓存服务
|
||||
*/
|
||||
UmsAdminCacheService getCacheService();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.macro.mall.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.BCrypt;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.macro.mall.common.api.CommonResult;
|
||||
@@ -52,8 +53,6 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
||||
@Autowired
|
||||
private AuthService authService;
|
||||
@Autowired
|
||||
private UmsAdminCacheService adminCacheService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Override
|
||||
@@ -166,14 +165,14 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
||||
}
|
||||
}
|
||||
int count = adminMapper.updateByPrimaryKeySelective(admin);
|
||||
adminCacheService.delAdmin(id);
|
||||
getCacheService().delAdmin(id);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
int count = adminMapper.deleteByPrimaryKey(id);
|
||||
adminCacheService.delAdmin(id);
|
||||
getCacheService().delAdmin(id);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -227,7 +226,7 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
||||
}
|
||||
umsAdmin.setPassword(BCrypt.hashpw(param.getNewPassword()));
|
||||
adminMapper.updateByPrimaryKey(umsAdmin);
|
||||
adminCacheService.delAdmin(umsAdmin.getId());
|
||||
getCacheService().delAdmin(umsAdmin.getId());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -255,13 +254,18 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
||||
Asserts.fail(ResultCode.UNAUTHORIZED);
|
||||
}
|
||||
UserDto userDto = JSONUtil.toBean(userStr, UserDto.class);
|
||||
UmsAdmin admin = adminCacheService.getAdmin(userDto.getId());
|
||||
UmsAdmin admin = getCacheService().getAdmin(userDto.getId());
|
||||
if(admin!=null){
|
||||
return admin;
|
||||
}else{
|
||||
admin = adminMapper.selectByPrimaryKey(userDto.getId());
|
||||
adminCacheService.setAdmin(admin);
|
||||
getCacheService().setAdmin(admin);
|
||||
return admin;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UmsAdminCacheService getCacheService() {
|
||||
return SpringUtil.getBean(UmsAdminCacheService.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
server:
|
||||
port: 8080
|
||||
spring:
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
druid:
|
||||
@@ -60,13 +63,16 @@ aliyun:
|
||||
dir:
|
||||
prefix: mall/images/ # 上传文件夹路径前缀
|
||||
minio:
|
||||
endpoint: http://192.168.6.132:9090 #MinIO服务所在地址
|
||||
endpoint: http://locahost:9000 #MinIO服务所在地址
|
||||
bucketName: mall #存储桶名称
|
||||
accessKey: minioadmin #访问的key
|
||||
secretKey: minioadmin #访问的秘钥
|
||||
feign:
|
||||
okhttp:
|
||||
enabled: true
|
||||
ribbon:
|
||||
ConnectTimeout: 3000 #服务请求连接超时时间(毫秒)
|
||||
ReadTimeout: 3000 #服务请求处理超时时间(毫秒)
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connectTimeout: 5000
|
||||
readTimeout: 5000
|
||||
loggerLevel: basic
|
||||
@@ -6,22 +6,20 @@ import com.macro.mall.dao.PmsMemberPriceDao;
|
||||
import com.macro.mall.dao.PmsProductDao;
|
||||
import com.macro.mall.dto.PmsProductResult;
|
||||
import com.macro.mall.model.PmsMemberPrice;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@SpringBootTest
|
||||
public class PmsDaoTests {
|
||||
@Autowired
|
||||
@@ -42,7 +40,7 @@ public class PmsDaoTests {
|
||||
list.add(memberPrice);
|
||||
}
|
||||
int count = memberPriceDao.insertList(list);
|
||||
Assert.assertEquals(5,count);
|
||||
assertEquals(5,count);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user