广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package cn.huge.module.hot.controller.wechat;
 
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.hot.domain.po.HotNews;
import cn.huge.module.hot.domain.po.HotVideo;
import cn.huge.module.hot.service.HotNewsService;
import cn.huge.module.hot.service.HotVideoService;
import cn.huge.module.oper.dto.SeCustWechatDTO;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
 
/**
 * @title: 热门资讯表接口api
 * @description: 热门资讯表接口api
 * @company: hugeinfo
 * @author: liyj
 * @time: 2022-04-29 10:12:39
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/wechat/paHotNews")
public class PaHotNewsWechatController {
 
    @Autowired(required = false)
    private HttpServletRequest request;
 
    @Autowired
    private HotNewsService service;
    @Autowired
    private HotVideoService hotVideoService;
 
    /**
    * 获取请求URL参数
    * @return Map<String, Object>
    */
    private Map<String, Object> getParameter(){
        Map<String, Object> terms = Maps.newHashMap();
        // 热门视频编号
        String id = request.getParameter("id");
        if (StringUtils.isNotBlank(id)){
            terms.put("id", id);
        }
        // 关键词
        String keyword = request.getParameter("keyword");
        if (StringUtils.isNotBlank(keyword)){
            terms.put("keyword", keyword);
        }
        // 标题
        String title = request.getParameter("title");
        if (StringUtils.isNotBlank(title)){
            terms.put("title", title);
        }
        // 内容
        String content = request.getParameter("content");
        if (StringUtils.isNotBlank(content)){
            terms.put("content", content);
        }
        // 来源
        String source = request.getParameter("source");
        if (StringUtils.isNotBlank(source)){
            terms.put("source", source);
        }
        // 查看连接
        String showUrl = request.getParameter("showUrl");
        if (StringUtils.isNotBlank(showUrl)){
            terms.put("showUrl", showUrl);
        }
        // 发布时间
        String pushTime = request.getParameter("pushTime");
        if (StringUtils.isNotBlank(pushTime)){
            terms.put("pushTime", pushTime);
        }
        // 播放量
        String playNum = request.getParameter("playNum");
        if (StringUtils.isNotBlank(playNum)){
            terms.put("playNum", playNum);
        }
        // 点赞量
        String goodNum = request.getParameter("goodNum");
        if (StringUtils.isNotBlank(goodNum)){
            terms.put("goodNum", goodNum);
        }
        // 删除状态,1:未删除,2已删除
        String deleteStatus = request.getParameter("deleteStatus");
        if (StringUtils.isNotBlank(deleteStatus)){
            terms.put("deleteStatus", deleteStatus);
        }
        // 客户编号
        String custId = request.getParameter("custId");
        if (StringUtils.isNotBlank(custId)){
            terms.put("custId", custId);
        }
        // 创建时间区间
        String createStart = request.getParameter("createStart");
        String createEnd = request.getParameter("createEnd");
        if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) {
            terms.put("createStart", createStart);
            terms.put("createEnd", createEnd);
        }
        // 更新时间区间
        String updateStart = request.getParameter("updateStart");
        String updateEnd = request.getParameter("updateEnd");
        if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) {
            terms.put("updateStart", updateStart);
            terms.put("updateEnd", updateEnd);
        }
        return terms;
    }
 
    /**
    * 当事人小程序-首页-查询热门资讯
    * @url {ctx}/api/weChat/paHotNews/listShow
    * @return Object
    */
    @GetMapping("/listShow")
    public Object listShow(@RequestParam(value = "appid") String appid) {
        try {
            SeCustWechatDTO seCustWechatDTO = service.getSeCustWechatByAppid(appid);
            // TODO: 2022/4/29 条件
            Map<String, Object> result = Maps.newHashMap();
            Map<String, Object> terms = getParameter();
            terms.put("custId", seCustWechatDTO.getCustId());
            List<HotNews> hotNewsList = service.listTerms(terms);
            result.put("hotNewsList", hotNewsList);
            List<HotVideo> hotVideoList = hotVideoService.listTerms(terms);
            result.put("hotVideoList", hotVideoList);
            return ReturnSucUtils.getRepInfo(result);
        } catch (Exception e) {
            log.error("Controller接口[HotNewsController.listQuery]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
 
}