Your Name 3 年之前
父節點
當前提交
9471ed6b4c

+ 9
- 0
src/main/java/com/yunzhi/marketing/controller/MiniAppController.java 查看文件

@@ -114,6 +114,9 @@ public class MiniAppController extends BaseController {
114 114
     @Autowired
115 115
     public TaChannelService taChannelService;
116 116
 
117
+    @Autowired
118
+    public ISysOrgParamsService iSysOrgParamsService;
119
+
117 120
     /**
118 121
      * 验证接入
119 122
      */
@@ -172,11 +175,17 @@ public class MiniAppController extends BaseController {
172 175
         queryExt.eq("status", CommConstant.STATUS_NORMAL);
173 176
         List<TaCustomImg> taCustomImg = iTaCustomImgService.list(queryExt);
174 177
 
178
+        // 获取系统参数
179
+        QueryWrapper<SysOrgParams> queryParams = new QueryWrapper<>();
180
+        queryParams.eq("org_id", taOrg.getOrgId());
181
+        List<SysOrgParams> sysParamsList = iSysOrgParamsService.list(queryParams);
182
+
175 183
         return ResponseBean.success(new HashMap<String, Object>() {{
176 184
             put("miniapp", taMiniapp);
177 185
             put("org", taOrg);
178 186
             put("cityList", taOrgCityList);
179 187
             put("customImg", taCustomImg);
188
+            put("sysParamsList", sysParamsList);
180 189
         }});
181 190
     }
182 191
 

+ 21
- 8
src/main/java/com/yunzhi/marketing/controller/SysOrgParamsController.java 查看文件

@@ -10,13 +10,10 @@ import com.yunzhi.marketing.base.BaseController;
10 10
 import org.slf4j.Logger;
11 11
 import org.slf4j.LoggerFactory;
12 12
 import org.springframework.beans.factory.annotation.Autowired;
13
-import org.springframework.web.bind.annotation.PathVariable;
14
-import org.springframework.web.bind.annotation.RequestBody;
15
-import org.springframework.web.bind.annotation.RequestMapping;
16
-import org.springframework.web.bind.annotation.RequestMethod;
17
-import org.springframework.web.bind.annotation.RequestParam;
18
-import org.springframework.web.bind.annotation.ResponseBody;
19
-import org.springframework.web.bind.annotation.RestController;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import javax.servlet.http.HttpServletRequest;
16
+import java.util.List;
20 17
 
21 18
 /**
22 19
  * <p>
@@ -27,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
27 24
  * @since 2019-08-01
28 25
  */
29 26
 @RestController
30
-@RequestMapping("/")
27
+@RequestMapping("/api")
31 28
 public class SysOrgParamsController extends BaseController {
32 29
 
33 30
     private final Logger logger = LoggerFactory.getLogger(SysOrgParamsController.class);
@@ -141,4 +138,20 @@ public class SysOrgParamsController extends BaseController {
141 138
         }
142 139
         return responseBean;
143 140
     }
141
+
142
+    /**
143
+     * 小程序获取系统参数
144
+     * @param paramCode
145
+     * @param request
146
+     * @return
147
+     */
148
+    @GetMapping("/wx/sysOrgParams/{paramCode}")
149
+    public ResponseBean wxGetSysParams(@PathVariable String paramCode,
150
+                                       HttpServletRequest request) {
151
+        QueryWrapper<SysOrgParams> queryParams = new QueryWrapper<>();
152
+        queryParams.eq("org_id", getOrgId(request));
153
+        queryParams.eq("param_code", paramCode);
154
+        List<SysOrgParams> sysParamsList = iSysOrgParamsService.list(queryParams);
155
+        return ResponseBean.success(sysParamsList.get(0));
156
+    }
144 157
 }

+ 24
- 8
src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java 查看文件

@@ -2,6 +2,7 @@ package com.yunzhi.marketing.controller;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 6
 import com.yunzhi.marketing.base.BaseController;
6 7
 import com.yunzhi.marketing.base.ResponseBean;
7 8
 import com.yunzhi.marketing.common.CommConstant;
@@ -262,19 +263,21 @@ public class TaLiveActivityController extends BaseController {
262 263
     @RequestMapping(value = "/wx/taLiveActivity", method = RequestMethod.GET)
263 264
     public ResponseBean taLiveActivityListForMiniApp(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
264 265
                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
265
-                                                     String liveActivityTitle,
266
-                                                     String cityId,
267
-                                                     String buildingId,
268
-                                                     Integer status,
269
-                                                     @RequestParam(value = "source", defaultValue = "1") Integer source,
266
+                                                     @RequestParam(value = "cityId", required = false) Integer cityId,
267
+                                                     @RequestParam(value = "buildingId", required = false) String buildingId,
270 268
                                                      @RequestParam(value = "name", required = false) String name,
269
+                                                     @RequestParam(value = "process", required = false) Integer process,
270
+                                                     @RequestParam(value = "newHouse", required = false) Boolean newHouse,
271 271
                                                      HttpServletRequest request) {
272
+        if (process != null) {
273
+            return getPureLiveActivity(pageNum, pageSize, cityId, buildingId, name, process, request);
274
+        }
275
+
272 276
         ResponseBean responseBean = new ResponseBean();
273 277
         try {
274
-            status = status == null ? 1 : status;
275 278
             Integer orgId = getOrgId(request);
276
-            IPage<LiveAndVideoVO> result = iTaLiveActivityService.getWxLiveActivityAndVideo(pageNum, pageSize, orgId,
277
-                    liveActivityTitle, cityId, buildingId, status, name, source);
279
+            IPage<LiveAndVideoVO> pg = new Page<>(pageNum, pageSize);
280
+            IPage<LiveAndVideoVO> result = iTaLiveActivityService.getWxLiveActivityAndVideo(pg, orgId, cityId, buildingId, name, newHouse);
278 281
             responseBean.addSuccess(result);
279 282
 
280 283
         } catch (Exception e) {
@@ -284,4 +287,17 @@ public class TaLiveActivityController extends BaseController {
284 287
         }
285 288
         return responseBean;
286 289
     }
290
+
291
+    private ResponseBean getPureLiveActivity(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
292
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
293
+                                             @RequestParam(value = "cityId", required = false) Integer cityId,
294
+                                             @RequestParam(value = "buildingId", required = false) String buildingId,
295
+                                             @RequestParam(value = "name", required = false) String name,
296
+                                             @RequestParam(value = "process", required = false) Integer process,
297
+                                             HttpServletRequest request) {
298
+
299
+        Integer orgId = getOrgId(request);
300
+        IPage<TaLiveActivity> pg = new Page<>(pageNum, pageSize);
301
+        return ResponseBean.success(iTaLiveActivityService.getWxPureLiveActivityList(pg, orgId, cityId, buildingId, name, process));
302
+    }
287 303
 }

+ 5
- 0
src/main/java/com/yunzhi/marketing/entity/TaLiveActivity.java 查看文件

@@ -172,4 +172,9 @@ public class TaLiveActivity implements Serializable {
172 172
 
173 173
     @TableField(exist = false)
174 174
     private String updateName;
175
+
176
+    /**
177
+     * 是否新房
178
+     */
179
+    private Boolean isNewHouse;
175 180
 }

+ 9
- 4
src/main/java/com/yunzhi/marketing/mapper/TaLiveActivityMapper.java 查看文件

@@ -51,11 +51,16 @@ public interface TaLiveActivityMapper extends BaseMapper<TaLiveActivity> {
51 51
     TaLiveActivity getDetailById(@Param("id")Integer id);
52 52
 
53 53
     IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg,
54
-                                                    @Param("liveActivityTitle")  String liveActivityTitle,
55
-                                                    @Param("cityId") String cityId,
54
+                                                    @Param("cityId") Integer cityId,
56 55
                                                     @Param("buildingId") String buildingId,
57
-                                                    @Param("status") Integer status,
58 56
                                                     @Param("orgId") Integer orgId,
59 57
                                                     @Param("name") String name,
60
-                                                    @Param("source") Integer source);
58
+                                                    @Param("newHouse") Boolean newHouse);
59
+
60
+    IPage<TaLiveActivity> getWxPureLiveActivityList(IPage<TaLiveActivity> pg,
61
+                                                    @Param("cityId") Integer cityId,
62
+                                                    @Param("buildingId") String buildingId,
63
+                                                    @Param("orgId") Integer orgId,
64
+                                                    @Param("name") String name,
65
+                                                    @Param("process") Integer process);
61 66
 }

+ 3
- 6
src/main/java/com/yunzhi/marketing/service/ITaLiveActivityService.java 查看文件

@@ -67,16 +67,13 @@ public interface ITaLiveActivityService extends IService<TaLiveActivity> {
67 67
 
68 68
     /**
69 69
      * 微信小程序查询直播列表
70
-     * @param pageNum
71
-     * @param pageSize
72 70
      * @param orgId
73
-     * @param liveActivityTitle
74 71
      * @param cityId
75 72
      * @param buildingId
76
-     * @param status
77 73
      * @param name
78
-     * @param source
79 74
      * @return
80 75
      */
81
-    IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle, String cityId, String buildingId, Integer status, String name, Integer source);
76
+    IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg, Integer orgId, Integer cityId, String buildingId, String name, Boolean newHouse);
77
+
78
+    IPage<TaLiveActivity> getWxPureLiveActivityList(IPage<TaLiveActivity> pg, Integer orgId, Integer cityId, String buildingId, String name, Integer process);
82 79
 }

+ 8
- 22
src/main/java/com/yunzhi/marketing/service/impl/TaLiveActivityServiceImpl.java 查看文件

@@ -201,35 +201,21 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
201 201
 
202 202
     /**
203 203
      * 微信小程序查询直播列表
204
-     *
205
-     * @param pageNum
206
-     * @param pageSize
204
+     * @param pg
207 205
      * @param orgId
208
-     * @param liveActivityTitle
209 206
      * @param cityId
210 207
      * @param buildingId
211
-     * @param status
212 208
      * @param name
213
-     * @param source
214 209
      * @return
215 210
      */
216 211
     @Override
217
-    public IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle, String cityId, String buildingId, Integer status, String name, Integer source) {
218
-        IPage<LiveAndVideoVO> pg = new Page<>(pageNum, pageSize);
219
-        IPage<LiveAndVideoVO> wxLiveActivityAndVideo = taLiveActivityMapper.getWxLiveActivityAndVideo(pg, liveActivityTitle, cityId, buildingId, status, orgId, name, source);
220
-        List<LiveAndVideoVO> records = wxLiveActivityAndVideo.getRecords();
221
-        records.forEach(e -> {
222
-            if ("live".equals(e.getType())){
223
-                LocalDate now = LocalDate.now();
224
-                if (e.getStartTime().isBefore(now)){
225
-                    e.setKind("notice");
226
-                }else if (e.getStartTime().isBefore(now) && e.getEndTime().isAfter(now)){
227
-                    e.setKind("live");
228
-                }else {
229
-                    e.setKind("end");
230
-                }
231
-            }
232
-        });
212
+    public IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg, Integer orgId, Integer cityId, String buildingId, String name, Boolean newHouse) {
213
+        IPage<LiveAndVideoVO> wxLiveActivityAndVideo = taLiveActivityMapper.getWxLiveActivityAndVideo(pg, cityId, buildingId, orgId, name, newHouse);
233 214
         return wxLiveActivityAndVideo;
234 215
     }
216
+
217
+    @Override
218
+    public IPage<TaLiveActivity> getWxPureLiveActivityList(IPage<TaLiveActivity> pg, Integer orgId, Integer cityId, String buildingId, String name, Integer process) {
219
+        return taLiveActivityMapper.getWxPureLiveActivityList(pg, cityId, buildingId, orgId, name, process);
220
+    }
235 221
 }

+ 13
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/VideoController.java 查看文件

@@ -238,4 +238,17 @@ public class VideoController extends BaseController {
238 238
         return ResponseBean.success(video);
239 239
     }
240 240
 
241
+    @GetMapping("/wx/videoActiveList")
242
+    public ResponseBean getWxVideoActiveList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
243
+                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
244
+                                                     @RequestParam(value = "cityId", required = false) Integer cityId,
245
+                                                     @RequestParam(value = "buildingId", required = false) String buildingId,
246
+                                                     @RequestParam(value = "name", required = false) String name,
247
+                                                     HttpServletRequest request) {
248
+        Integer orgId = getOrgId(request);
249
+        IPage<Video> pg = new Page<>(pageNum, pageSize);
250
+        IPage<Video> result = iVideoService.getWxVideoActiveList(pg, orgId, cityId, buildingId, name);
251
+        return ResponseBean.success(result);
252
+    }
253
+
241 254
 }

+ 4
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/Video.java 查看文件

@@ -118,4 +118,8 @@ public class Video implements Serializable {
118 118
      */
119 119
     private Boolean isPublish;
120 120
 
121
+    /**
122
+     * 是否新房
123
+     */
124
+    private Boolean isNewHouse;
121 125
 }

+ 7
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/VideoMapper.java 查看文件

@@ -1,8 +1,10 @@
1 1
 package com.yunzhi.marketing.xlk.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.yunzhi.marketing.xlk.entity.Video;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -15,4 +17,9 @@ import org.apache.ibatis.annotations.Mapper;
15 17
 @Mapper
16 18
 public interface VideoMapper extends BaseMapper<Video> {
17 19
 
20
+    IPage<Video> getWxVideoActiveList(IPage<Video> pg,
21
+                                      @Param("orgId") Integer orgId,
22
+                                      @Param("cityId") Integer cityId,
23
+                                      @Param("buildingId") String buildingId,
24
+                                      @Param("name") String name);
18 25
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/xlk/service/IVideoService.java 查看文件

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.marketing.xlk.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.baomidou.mybatisplus.extension.service.IService;
4 5
 import com.yunzhi.marketing.xlk.entity.Video;
5 6
 
@@ -13,4 +14,5 @@ import com.yunzhi.marketing.xlk.entity.Video;
13 14
  */
14 15
 public interface IVideoService extends IService<Video> {
15 16
 
17
+    IPage<Video> getWxVideoActiveList(IPage<Video> pg, Integer orgId, Integer cityId, String buildingId, String name);
16 18
 }

+ 8
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/VideoServiceImpl.java 查看文件

@@ -1,9 +1,11 @@
1 1
 package com.yunzhi.marketing.xlk.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 5
 import com.yunzhi.marketing.xlk.entity.Video;
5 6
 import com.yunzhi.marketing.xlk.mapper.VideoMapper;
6 7
 import com.yunzhi.marketing.xlk.service.IVideoService;
8
+import org.springframework.beans.factory.annotation.Autowired;
7 9
 import org.springframework.stereotype.Service;
8 10
 
9 11
 /**
@@ -16,5 +18,11 @@ import org.springframework.stereotype.Service;
16 18
  */
17 19
 @Service
18 20
 public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements IVideoService {
21
+    @Autowired
22
+    VideoMapper videoMapper;
19 23
 
24
+    @Override
25
+    public IPage<Video> getWxVideoActiveList(IPage<Video> pg, Integer orgId, Integer cityId, String buildingId, String name) {
26
+        return videoMapper.getWxVideoActiveList(pg, orgId, cityId, buildingId, name);
27
+    }
20 28
 }

+ 51
- 4
src/main/resources/mapper/TaLiveActivityMapper.xml 查看文件

@@ -85,17 +85,27 @@
85 85
             ta_live_activity t
86 86
             LEFT JOIN ta_building a ON t.building_id = a.building_id
87 87
             LEFT JOIN td_city b ON t.city_id = b.id
88
-            where 1=1
88
+            where t.org_id = #{orgId}
89
+              and t.`status` = 1
89 90
         <if test="name != null and name != ''">
90 91
             and (t.live_activity_title like CONCAT('%', #{name}, '%')
91 92
             or a.building_name like CONCAT('%', #{name}, '%'))
92 93
         </if>
94
+        <if test="cityId != null">
95
+            and (t.city_id is null or t.city_id = #{cityId})
96
+        </if>
97
+        <if test="buildingId != null and buildingId != ''">
98
+            and t.building_id = #{buildingId}
99
+        </if>
100
+        <if test="newHouse">
101
+            and t.is_new_house = #{newHouse}
102
+        </if>
93 103
     UNION
94 104
         SELECT
95 105
             t.video_id as id,
96 106
             t.NAME AS title,
97
-            t.CREATED_TIME AS startTime,
98
-            t.CREATED_TIME AS endTime,
107
+            null AS start_time,
108
+            null AS end_time,
99 109
             t.vide_img as images,
100 110
             a.building_name,
101 111
             b.NAME AS city_name,
@@ -104,10 +114,47 @@
104 114
             xlk_video t
105 115
             LEFT JOIN ta_building a ON t.building_id = a.building_id
106 116
             LEFT JOIN td_city b ON t.city_id = b.id
107
-        where 1=1
117
+        where t.org_id = #{orgId}
118
+            and t.is_publish = 1
108 119
         <if test="name != null and name != ''">
109 120
             and (t.NAME like CONCAT('%', #{name}, '%') or a.building_name like CONCAT('%', #{name}, '%'))
110 121
         </if>
122
+        <if test="cityId != null">
123
+            and (t.city_id is null or t.city_id = #{cityId})
124
+        </if>
125
+        <if test="buildingId != null and buildingId != ''">
126
+            and t.building_id = #{buildingId}
127
+        </if>
128
+        <if test="newHouse">
129
+            and t.is_new_house = #{newHouse}
130
+        </if>
131
+    </select>
132
+    <select id="getWxPureLiveActivityList" resultType="com.yunzhi.marketing.entity.TaLiveActivity">
133
+        SELECT
134
+         t.*
135
+        FROM
136
+        ta_live_activity t
137
+        LEFT JOIN ta_building a ON t.building_id = a.building_id
138
+        LEFT JOIN td_city b ON t.city_id = b.id
139
+        where t.org_id = #{orgId}
140
+        and t.`status` = 1
141
+        <if test="name != null and name != ''">
142
+            and (t.live_activity_title like CONCAT('%', #{name}, '%')
143
+            or a.building_name like CONCAT('%', #{name}, '%'))
144
+        </if>
145
+        <if test="cityId != null">
146
+            and (t.city_id is null or t.city_id = #{cityId})
147
+        </if>
148
+        <if test="buildingId != null and buildingId != ''">
149
+            and t.building_id = #{buildingId}
150
+        </if>
151
+        <if test="process = 1">
152
+            and t.live_start_date &gt; now()
153
+        </if>
154
+        <if test="process = 2">
155
+            and t.live_start_date &lt; now()
156
+            and t.live_end_date &gt; now()
157
+        </if>
111 158
     </select>
112 159
 
113 160
 </mapper>

+ 19
- 0
src/main/resources/mapper/xlk/VideoMapper.xml 查看文件

@@ -2,4 +2,23 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.marketing.xlk.mapper.VideoMapper">
4 4
 
5
+    <select id="getWxVideoActiveList" resultType="com.yunzhi.marketing.xlk.entity.Video">
6
+        SELECT
7
+         t.*
8
+        FROM
9
+        xlk_video t
10
+        LEFT JOIN ta_building a ON t.building_id = a.building_id
11
+        LEFT JOIN td_city b ON t.city_id = b.id
12
+        where t.org_id = #{orgId}
13
+        and t.is_publish = 1
14
+        <if test="name != null and name != ''">
15
+            and (t.NAME like CONCAT('%', #{name}, '%') or a.building_name like CONCAT('%', #{name}, '%'))
16
+        </if>
17
+        <if test="cityId != null">
18
+            and (t.city_id is null or t.city_id = #{cityId})
19
+        </if>
20
+        <if test="buildingId != null and buildingId != ''">
21
+            and t.building_id = #{buildingId}
22
+        </if>
23
+    </select>
5 24
 </mapper>