Skip to content

Commit 14f5b2f

Browse files
author
danbai225
committed
.
1 parent 50a9601 commit 14f5b2f

File tree

10 files changed

+398
-243
lines changed

10 files changed

+398
-243
lines changed

.idea/workspace.xml

Lines changed: 363 additions & 230 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/com/danbai/ys/YsApplication.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
import org.springframework.scheduling.annotation.EnableScheduling;
77
import tk.mybatis.spring.annotation.MapperScan;
88

9-
import javax.annotation.PostConstruct;
10-
import java.util.TimeZone;
11-
129
/**
1310
* @author danbai
1411
* @date 2019/10/13

src/main/java/com/danbai/ys/config/RedisConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.danbai.ys.config;
22

3+
34
import com.fasterxml.jackson.annotation.JsonAutoDetect;
45
import com.fasterxml.jackson.annotation.PropertyAccessor;
56
import com.fasterxml.jackson.databind.ObjectMapper;
67
import org.springframework.cache.CacheManager;
78
import org.springframework.cache.annotation.CachingConfigurerSupport;
9+
import org.springframework.cache.annotation.EnableCaching;
810
import org.springframework.context.annotation.Bean;
911
import org.springframework.context.annotation.Configuration;
1012
import org.springframework.data.redis.cache.RedisCacheConfiguration;
@@ -22,6 +24,7 @@
2224
* @author danbai
2325
* @date 2019-10-14 14:36
2426
*/
27+
@EnableCaching
2528
@Configuration
2629
public class RedisConfig extends CachingConfigurerSupport {
2730
/**

src/main/java/com/danbai/ys/controller/MainController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ String indexApi(HttpServletRequest request) {
6464
PageInfo ysbs2 = ysService.getYs("综艺", 1, 12);
6565
PageInfo ysbs3 = ysService.getYs("动漫", 1, 12);
6666
Map<String, Object> map = new HashMap<>(10);
67-
map.put(Ysb.DY, ysbs.getList());
68-
map.put(Ysb.DSJ, ysbs1.getList());
69-
map.put(Ysb.ZY, ysbs2.getList());
70-
map.put(Ysb.DM, ysbs3.getList());
67+
map.put(Ysb.DY, ysService.qcsy(ysbs.getList()));
68+
map.put(Ysb.DSJ, ysService.qcsy(ysbs1.getList()));
69+
map.put(Ysb.ZY, ysService.qcsy(ysbs2.getList()));
70+
map.put(Ysb.DM, ysService.qcsy(ysbs3.getList()));
7171
map.put(Config.GG, adminService.getConfig(Config.GG));
7272
return JSON.toJSONString(map);
7373
}

src/main/java/com/danbai/ys/controller/YsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ String getYsApi(int id, HttpServletRequest request) {
9494
String getTypeYsApi(String type, int page) {
9595
PageInfo page1 = ysService.getYs(type, page, 24);
9696
Map<String, Object> map = new HashMap<>(10);
97-
map.put("list", page1.getList());
97+
map.put("list", ysService.qcsy(page1.getList()));
9898
map.put("zys", page1.getPages());
9999
map.put("page", page);
100100
map.put("total", page1.getTotal());

src/main/java/com/danbai/ys/controller/restful/v1/Ys.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public BaseResult ysOne(@PathVariable int id) {
4848
*/
4949
@GetMapping("/ys/search/{gjc}")
5050
public BaseResult search(@PathVariable String gjc) {
51-
return ResultUtil.success(ysService.selectYsByPm(gjc));
51+
return ResultUtil.success(ysService.qcsy(ysService.selectYsByPm(gjc)));
5252
}
5353

5454
}

src/main/java/com/danbai/ys/scheduler/Scheduler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.danbai.ys.scheduler;
22

3+
34
import com.alibaba.fastjson.JSON;
45
import com.alibaba.fastjson.JSONObject;
56
import com.danbai.ys.async.Dmas;
@@ -12,7 +13,6 @@
1213

1314
import java.util.Set;
1415

15-
1616
/**
1717
* @author danbai
1818
* @date 2019-10-16 18:33
@@ -24,9 +24,8 @@ public class Scheduler {
2424
RedisTemplate redisTemplate;
2525
@Autowired
2626
private Dmas as;
27-
28-
@Scheduled(fixedDelay = 60000)
2927
@Async
28+
@Scheduled(fixedDelay = 60000)
3029
public void cronJobSchedule() {
3130
Set tagids = redisTemplate.opsForSet().members("tagids");
3231
redisTemplate.delete("tagids");

src/main/java/com/danbai/ys/service/YsService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,10 @@ public interface YsService {
135135
* @return List
136136
*/
137137
List<Ysb> getAll();
138+
139+
/**
140+
* 去除首页不需要的数据
141+
* @return
142+
*/
143+
List<Ysb> qcsy(List<Ysb> list);
138144
}

src/main/java/com/danbai/ys/service/impl/YsServiceImpl.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,17 @@ public String getYsDanMu(String pm, int jid, String ysid) {
275275
public List<Ysb> getAll() {
276276
return ysbMapper.selectAll();
277277
}
278+
279+
@Override
280+
public List<Ysb> qcsy(List<Ysb> list) {
281+
List<Ysb> tmp=new ArrayList<>();
282+
//清除掉不需要的数据
283+
for (Ysb y:list) {
284+
y.setGkdz("");
285+
y.setXzdz("");
286+
y.setJs("");
287+
tmp.add(y);
288+
}
289+
return tmp;
290+
}
278291
}

src/test/java/com/danbai/ys/YsApplicationTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import org.junit.Test;
44
import org.junit.runner.RunWith;
5+
import org.springframework.beans.factory.annotation.Autowired;
56
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.data.redis.core.RedisTemplate;
68
import org.springframework.test.context.junit4.SpringRunner;
79

810

@@ -13,8 +15,10 @@
1315
@RunWith(SpringRunner.class)
1416
@SpringBootTest(classes = YsApplication.class)
1517
public class YsApplicationTests {
18+
@Autowired
19+
RedisTemplate redisTemplate;
1620
@Test
1721
public void test() {
18-
22+
System.out.println(redisTemplate.opsForValue().get("gg"));
1923
}
2024
}

0 commit comments

Comments
 (0)