minio增加字段,可配置前端访问地址。endpoint可以继续走局域网ip
This commit is contained in:
parent
a6f28d67eb
commit
bce60310c5
@ -86,7 +86,7 @@ public class MinioFilePlugin implements FilePlugin {
|
|||||||
throw new ServiceException(ResultCode.OSS_DELETE_ERROR, e.getMessage());
|
throw new ServiceException(ResultCode.OSS_DELETE_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
//拼接出可访问的url地址
|
//拼接出可访问的url地址
|
||||||
return ossSetting.getM_endpoint() + "/" + bucket + "/" + key;
|
return ossSetting.getM_frontUrl() + "/" + bucket + "/" + key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,11 @@ public class OssSetting implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String m_endpoint;
|
private String m_endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio 前端请求地址
|
||||||
|
*/
|
||||||
|
private String m_frontUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* minio用户名
|
* minio用户名
|
||||||
*/
|
*/
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package cn.lili.test;
|
|
||||||
|
|
||||||
import cn.lili.modules.order.order.entity.dos.OrderItem;
|
|
||||||
import cn.lili.modules.order.order.service.OrderItemService;
|
|
||||||
import cn.lili.modules.statistics.serviceimpl.OrderStatisticsServiceImpl;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RedisLimiterHelperTest
|
|
||||||
*
|
|
||||||
* @author Chopper
|
|
||||||
* @version v1.0
|
|
||||||
* @since 2020-06-13 12:17
|
|
||||||
*/
|
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
|
||||||
@SpringBootTest
|
|
||||||
public class RedisLimiterHelperTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrderItemService orderItemService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OrderStatisticsServiceImpl orderStatisticsDataService;
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void orderTest() {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testBatchUpdate() {
|
|
||||||
OrderItem orderItem = new OrderItem();
|
|
||||||
orderItem.setId("1356539557729796097");
|
|
||||||
orderItem.setCreateBy("1356539557729796097");
|
|
||||||
|
|
||||||
|
|
||||||
OrderItem orderItem1 = new OrderItem();
|
|
||||||
orderItem1.setId("1356787800921341953");
|
|
||||||
orderItem1.setCreateBy("1356787800921341953");
|
|
||||||
|
|
||||||
|
|
||||||
List<OrderItem> orderItemList = new ArrayList<>();
|
|
||||||
orderItemList.add(orderItem);
|
|
||||||
orderItemList.add(orderItem1);
|
|
||||||
|
|
||||||
orderItemService.updateBatchById(orderItemList);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
package cn.lili.test.script;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
|
||||||
import org.springframework.scripting.support.ResourceScriptSource;
|
|
||||||
import org.springframework.test.annotation.Rollback;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redis 事务测试
|
|
||||||
*
|
|
||||||
* @author Chopper
|
|
||||||
* @version v1.0
|
|
||||||
* @since
|
|
||||||
* 2020-02-22 20:26
|
|
||||||
*/
|
|
||||||
@ExtendWith(SpringExtension.class)
|
|
||||||
@SpringBootTest
|
|
||||||
@Rollback()
|
|
||||||
@ContextConfiguration
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan("cn.lili")
|
|
||||||
public class ScriptTest {
|
|
||||||
@Resource
|
|
||||||
private DefaultRedisScript<Boolean> redisScript;
|
|
||||||
@Resource
|
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void lua() {
|
|
||||||
stringRedisTemplate.opsForValue().set("key_1", "100");
|
|
||||||
stringRedisTemplate.opsForValue().set("key_2", "95");
|
|
||||||
stringRedisTemplate.opsForValue().set("key_3", "90");
|
|
||||||
stringRedisTemplate.opsForValue().set("key_4", "85");
|
|
||||||
List<String> keys = new ArrayList<>();
|
|
||||||
keys.add("key_1");
|
|
||||||
keys.add("key_2");
|
|
||||||
keys.add("key_3");
|
|
||||||
keys.add("key_4");
|
|
||||||
List<String> value = new ArrayList<>();
|
|
||||||
value.add("-1");
|
|
||||||
value.add("-1");
|
|
||||||
value.add("-1");
|
|
||||||
value.add("-1");
|
|
||||||
//启用十个线程
|
|
||||||
for (int i = 0; i <= 10; i++) {
|
|
||||||
//每个线程循环十次
|
|
||||||
Thread thread = new Thread(() -> {
|
|
||||||
for (int i1 = 0; i1 <= 10; i1++) {
|
|
||||||
Boolean execute = stringRedisTemplate.execute(redisScript, keys, value.toArray());
|
|
||||||
System.out.println(Thread.currentThread().getName() + "|" + i1 + "|" + execute);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
thread.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
class LuaConfiguration {
|
|
||||||
@Bean
|
|
||||||
public DefaultRedisScript<Boolean> redisScript() {
|
|
||||||
DefaultRedisScript<Boolean> redisScript = new DefaultRedisScript<>();
|
|
||||||
redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("script/quantity.lua")));
|
|
||||||
redisScript.setResultType(Boolean.class);
|
|
||||||
return redisScript;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user