mirror of
https://github.com/qiurunze123/miaosha.git
synced 2023-11-19 22:41:03 +08:00
mybatis版本升级
This commit is contained in:
parent
fa6f63948b
commit
64732a8cca
|
@ -13,10 +13,7 @@
|
|||
<name>${project.artifactId}</name>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.sgroschupf</groupId>
|
||||
<artifactId>zkclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
|
|
|
@ -116,20 +116,6 @@ public class SnowflakeIdWorker {
|
|||
return idWorker.nextId();
|
||||
}
|
||||
|
||||
// ==============================Methods==========================================
|
||||
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
long id = idWorker.nextId();
|
||||
System.out.println(Long.toBinaryString(id));
|
||||
System.out.println(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得下一个ID (该方法是线程安全的)
|
||||
*
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.ui.Model;
|
|||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.thymeleaf.context.WebContext;
|
||||
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -58,7 +59,6 @@ public class GoodsController extends BaseController {
|
|||
public String detail2(HttpServletRequest request, HttpServletResponse response, Model model, MiaoshaUser user,
|
||||
@PathVariable("goodsId") long goodsId) {
|
||||
model.addAttribute("user", user);
|
||||
|
||||
//取缓存
|
||||
String html = redisService.get(GoodsKey.getGoodsDetail, "" + goodsId, String.class);
|
||||
if (!StringUtils.isEmpty(html)) {
|
||||
|
@ -75,26 +75,16 @@ public class GoodsController extends BaseController {
|
|||
int miaoshaStatus = 0;
|
||||
int remainSeconds = 0;
|
||||
if (now < startAt) {//秒杀还没开始,倒计时
|
||||
miaoshaStatus = 0;
|
||||
remainSeconds = (int) ((startAt - now) / 1000);
|
||||
} else if (now > endAt) {//秒杀已经结束
|
||||
miaoshaStatus = 2;
|
||||
remainSeconds = -1;
|
||||
} else {//秒杀进行中
|
||||
miaoshaStatus = 1;
|
||||
remainSeconds = 0;
|
||||
}
|
||||
model.addAttribute("miaoshaStatus", miaoshaStatus);
|
||||
model.addAttribute("remainSeconds", remainSeconds);
|
||||
// return "goods_detail";
|
||||
//TODO support spring5
|
||||
// SpringWebContext ctx = new SpringWebContext(request,response,
|
||||
// request.getServletContext(),request.getLocale(), model.asMap(), applicationContext );
|
||||
// html = viewResolver.getTemplateEngine().process("goods_detail", ctx);
|
||||
// if(!StringUtils.isEmpty(html)) {
|
||||
// redisService.set(GoodsKey.getGoodsDetail, ""+goodsId, html);
|
||||
// }
|
||||
return html;
|
||||
return "goods_detail";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,14 +107,12 @@ public class GoodsController extends BaseController {
|
|||
int miaoshaStatus = 0;
|
||||
int remainSeconds = 0;
|
||||
if (now < startAt) {//秒杀还没开始,倒计时
|
||||
miaoshaStatus = 0;
|
||||
remainSeconds = (int) ((startAt - now) / 1000);
|
||||
} else if (now > endAt) {//秒杀已经结束
|
||||
miaoshaStatus = 2;
|
||||
remainSeconds = -1;
|
||||
} else {//秒杀进行中
|
||||
miaoshaStatus = 1;
|
||||
remainSeconds = 0;
|
||||
}
|
||||
GoodsDetailVo vo = new GoodsDetailVo();
|
||||
vo.setGoods(goods);
|
||||
|
|
|
@ -47,12 +47,4 @@ public class DateTimeUtils {
|
|||
return dateTime.toString(STANDARD_FORMAT);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(DateTimeUtils.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
System.out.println(DateTimeUtils.strToDate("2010-01-01 11:11:11", "yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.geekq.miaosha.utils;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author 605162215@qq.com
|
||||
* @date 2018年1月31日 下午4:32:40<br/>
|
||||
*/
|
||||
public class HttpUtil {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
URL url = new URL("http://192.168.220.130/index.html");
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
InputStream in = conn.getInputStream();
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
byte[] buff = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = in.read(buff)) >= 0) {
|
||||
bout.write(buff, 0, len);
|
||||
}
|
||||
in.close();
|
||||
bout.close();
|
||||
byte[] response = bout.toByteArray();
|
||||
System.out.println(new String(response, "UTF-8"));
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,8 +37,4 @@ public class MD5Utils {
|
|||
String dbPass = formPassToDBPass(formPass, saltDB);
|
||||
return dbPass;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(inputPassToDBPass("123456", "1a2b3c4d"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,5 +15,9 @@
|
|||
<groupId>com.geekq.v2</groupId>
|
||||
<artifactId>miaosha-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -29,6 +29,7 @@ public class MiaoshaService {
|
|||
OrderService orderService;
|
||||
@Autowired
|
||||
RedisService redisService;
|
||||
|
||||
@Reference(version = "${demo.service.version}", retries = 3, timeout = 6000)
|
||||
private com.geekq.api.service.GoodsService goodsServiceRpc;
|
||||
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -54,6 +54,11 @@
|
|||
<artifactId>mybatis-paginator</artifactId>
|
||||
<version>${mybatis.paginator.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.32</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
|
@ -127,7 +132,7 @@
|
|||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<version>2.6.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
|
@ -152,12 +157,12 @@
|
|||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.4.6</version>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<version>2.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.spring.boot</groupId>
|
||||
|
@ -181,6 +186,7 @@
|
|||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.27</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
|
Loading…
Reference in New Issue
Block a user