|
@@ -5,8 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.huiju.estateagents.base.BaseController;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
|
8
|
+import com.huiju.estateagents.common.CommConstant;
|
|
9
|
+import com.huiju.estateagents.common.JWTUtils;
|
8
|
10
|
import com.huiju.estateagents.entity.TaNews;
|
|
11
|
+import com.huiju.estateagents.entity.TaPerson;
|
9
|
12
|
import com.huiju.estateagents.service.ITaNewsService;
|
|
13
|
+import com.huiju.estateagents.service.ITaPersonService;
|
|
14
|
+import com.huiju.estateagents.service.ITaSaveService;
|
|
15
|
+import org.checkerframework.checker.units.qual.A;
|
10
|
16
|
import org.slf4j.Logger;
|
11
|
17
|
import org.slf4j.LoggerFactory;
|
12
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -18,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
18
|
24
|
import org.springframework.web.bind.annotation.ResponseBody;
|
19
|
25
|
import org.springframework.web.bind.annotation.RestController;
|
20
|
26
|
|
|
27
|
+import javax.servlet.http.HttpServletRequest;
|
|
28
|
+import java.util.List;
|
|
29
|
+
|
21
|
30
|
/**
|
22
|
31
|
* <p>
|
23
|
32
|
* 资讯表 前端控制器
|
|
@@ -35,6 +44,12 @@ public class TaNewsController extends BaseController {
|
35
|
44
|
@Autowired
|
36
|
45
|
public ITaNewsService iTaNewsService;
|
37
|
46
|
|
|
47
|
+ @Autowired
|
|
48
|
+ public ITaPersonService iTaPersonService;
|
|
49
|
+
|
|
50
|
+ @Autowired
|
|
51
|
+ public ITaSaveService iTaSaveService;
|
|
52
|
+
|
38
|
53
|
|
39
|
54
|
/**
|
40
|
55
|
* 分页查询列表
|
|
@@ -61,9 +76,23 @@ public class TaNewsController extends BaseController {
|
61
|
76
|
*/
|
62
|
77
|
@RequestMapping(value="/wx/taNews",method= RequestMethod.GET)
|
63
|
78
|
public ResponseBean wxTaNewsList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
64
|
|
- @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
65
|
|
- ResponseBean responseBean = iTaNewsService.getList(pageNum, pageSize, null, null, null, null);
|
66
|
|
- return responseBean;
|
|
79
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
80
|
+ @RequestParam(defaultValue = "false") Boolean mine,
|
|
81
|
+ HttpServletRequest request
|
|
82
|
+ ){
|
|
83
|
+ List<String> targets = null;
|
|
84
|
+ if (null != mine && mine) {
|
|
85
|
+ String openid = JWTUtils.getSubject(request);
|
|
86
|
+ List<TaPerson> persons = iTaPersonService.getPersonsByOpenId(openid);
|
|
87
|
+ if (null == persons || persons.size() == 0) {
|
|
88
|
+ return ResponseBean.error("当前账户信息异常, 清除缓存重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
89
|
+ }
|
|
90
|
+
|
|
91
|
+ targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_NEWS);
|
|
92
|
+ }
|
|
93
|
+
|
|
94
|
+ IPage<TaNews> results = iTaNewsService.getWxList(pageNum, pageSize, targets);
|
|
95
|
+ return ResponseBean.success(results);
|
67
|
96
|
}
|
68
|
97
|
|
69
|
98
|
/**
|