Browse Source

配置缓存处理

master
xyiege 4 years ago
parent
commit
4a83c00405
  1. 6
      pom.xml
  2. 2
      src/main/java/cn/chjyj/szwh/SzwhApplication.java
  3. 5
      src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java
  4. 1
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java
  5. 3
      src/main/resources/application.properties
  6. 40
      src/test/java/cn/chjyj/szwh/service/impl/PayServiceImplTest.java

6
pom.xml

@ -32,7 +32,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- 缓存 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>

2
src/main/java/cn/chjyj/szwh/SzwhApplication.java

@ -2,9 +2,11 @@ package cn.chjyj.szwh;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableCaching
public class SzwhApplication {
public static void main(String[] args) {

5
src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java

@ -240,7 +240,10 @@ public class GoodsController extends BaseController {
String limit = request.getString("limit");
int ilimit = (StringUtils.isBlank(limit)) ? 20 : Integer.valueOf(limit);
String page = request.getString("page");
Integer ipage = StringUtils.isBlank(page) ? 1 : Integer.valueOf(page);
Integer ipage =1;
if(!"null".equals(page) && StringUtils.isNotEmpty(page)){
ipage = Integer.valueOf(page);
}
Map retmap = goodsService.getGoodsByMap(qmap, ipage, ilimit);

1
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -164,6 +164,7 @@ public class GoodsServiceImpl implements GoodsService {
* @param limit 条目
* @return
*/
@Override
public Map<String, Object> getGoodsByMap(Map gmap, int page, int limit) {
Map retmap = new HashMap();

3
src/main/resources/application.properties

@ -26,6 +26,9 @@ spring.redis.jedis.pool.enabled=true
spring.redis.jedis.pool.max-active=8
spring.redis.jedis.pool.max-wait=-1
#缓存处理
spring.cache.type=simple
# 暂使用单机模式进行任务管理
spring.quartz.scheduler-name=szwhQuartz
spring.quartz.job-store-type=memory

40
src/test/java/cn/chjyj/szwh/service/impl/PayServiceImplTest.java

@ -0,0 +1,40 @@
package cn.chjyj.szwh.service.impl;
import cn.chjyj.szwh.service.PayService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class PayServiceImplTest {
@Autowired
private PayService payService;
@Test
public void payComplete() {
}
// 支付完成的处理
@Test
public void payFinishOperate() {
String batchcode ="1670377727385829";
int ii = payService.payFinishOperate(batchcode);
System.out.println(ii);
}
@Test
public void payCallback() {
}
@Test
public void invoiceBuyOperate() {
}
@Test
public void invoiceSellerOperate() {
}
}
Loading…
Cancel
Save