Browse Source

* 新需求提交

顾绍勇 5 years ago
parent
commit
ae3c43ca3e

+ 35
- 0
src/main/java/com/huiju/estateagents/job/NoticeTimeJob.java View File

@@ -0,0 +1,35 @@
1
+package com.huiju.estateagents.job;
2
+
3
+import com.huiju.estateagents.sample.service.ITaNoticeService;
4
+import lombok.extern.slf4j.Slf4j;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.scheduling.annotation.EnableScheduling;
8
+import org.springframework.scheduling.annotation.Scheduled;
9
+import org.springframework.stereotype.Component;
10
+
11
+/**
12
+ * 开屏通知定时任务
13
+ */
14
+@Slf4j
15
+@Component
16
+@Configuration
17
+@EnableScheduling
18
+public class NoticeTimeJob {
19
+
20
+    @Autowired
21
+    private ITaNoticeService taNoticeService;
22
+
23
+    /**
24
+     * 自动下架已过期的开屏通知
25
+     */
26
+    @Scheduled(cron = "* * */6 * * ?")
27
+    public void updateStatusByInvalidTime() {
28
+        log.info("updateStatusByInvalidTime 定时任务 开始");
29
+
30
+        Integer result = taNoticeService.updateStatusByInvalidTime();
31
+
32
+        log.info("updateStatusByInvalidTime 定时任务 结束,共更新{}条数据", result);
33
+    }
34
+
35
+}

+ 109
- 114
src/main/java/com/huiju/estateagents/sample/controller/TaH5SampleController.java View File

@@ -5,10 +5,9 @@ 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;
8 9
 import com.huiju.estateagents.common.StringUtils;
9
-import com.huiju.estateagents.entity.SysAdvancedConfigRelation;
10 10
 import com.huiju.estateagents.sample.entity.TaContact;
11
-import com.huiju.estateagents.common.CommConstant;
12 11
 import com.huiju.estateagents.sample.entity.TaH5Demand;
13 12
 import com.huiju.estateagents.sample.entity.TaH5Sample;
14 13
 import com.huiju.estateagents.sample.entity.TaSampleContact;
@@ -19,13 +18,7 @@ import com.huiju.estateagents.sample.service.ITaSampleContactService;
19 18
 import org.slf4j.Logger;
20 19
 import org.slf4j.LoggerFactory;
21 20
 import org.springframework.beans.factory.annotation.Autowired;
22
-import org.springframework.web.bind.annotation.PathVariable;
23
-import org.springframework.web.bind.annotation.RequestBody;
24
-import org.springframework.web.bind.annotation.RequestMapping;
25
-import org.springframework.web.bind.annotation.RequestMethod;
26
-import org.springframework.web.bind.annotation.RequestParam;
27
-import org.springframework.web.bind.annotation.ResponseBody;
28
-import org.springframework.web.bind.annotation.RestController;
21
+import org.springframework.web.bind.annotation.*;
29 22
 
30 23
 import java.time.LocalDateTime;
31 24
 import java.util.Arrays;
@@ -34,8 +27,8 @@ import java.util.stream.Collectors;
34 27
 
35 28
 /**
36 29
  * <p>
37
-    * 样例表  前端控制器
38
-    * </p>
30
+ * 样例表  前端控制器
31
+ * </p>
39 32
  *
40 33
  * @author fxf
41 34
  * @since 2020-03-18
@@ -60,28 +53,21 @@ public class TaH5SampleController extends BaseController {
60 53
 
61 54
     /**
62 55
      * 分页查询列表
56
+     *
63 57
      * @param pageNum
64 58
      * @param pageSize
65 59
      * @return
66 60
      */
67
-    @RequestMapping(value="/channel/ListH5SampleByCondition",method= RequestMethod.GET)
68
-    public ResponseBean ListH5SampleByCondition(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
69
-                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
70
-                                       String sampleName){
61
+    @RequestMapping(value = "/channel/listH5SampleByCondition", method = RequestMethod.GET)
62
+    public ResponseBean listH5SampleByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
63
+                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
64
+                                                String sampleName) {
71 65
         ResponseBean responseBean = new ResponseBean();
72 66
         try {
73
-            //使用分页插件
74
-		    IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
75
-            QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
76
-            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
77
-            queryWrapper.ne("status", CommConstant.STATUS_DELETE);
78
-            queryWrapper.orderByDesc("order_no","create_date");
79
-
80
-            IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
81
-            responseBean.addSuccess(result);
82
-        }catch (Exception e){
67
+            responseBean = iTaH5SampleService.listH5SampleByCondition(pageNum, pageSize, sampleName);
68
+        } catch (Exception e) {
83 69
             e.printStackTrace();
84
-            logger.error("taH5SampleList -=- {}",e.toString());
70
+            logger.error("ListH5SampleByCondition -=- {}", e.toString());
85 71
             responseBean.addError(e.getMessage());
86 72
         }
87 73
         return responseBean;
@@ -89,30 +75,31 @@ public class TaH5SampleController extends BaseController {
89 75
 
90 76
     /**
91 77
      * 分页查询列表
78
+     *
92 79
      * @param pageNum
93 80
      * @param pageSize
94 81
      * @return
95 82
      */
96
-    @RequestMapping(value="/admin/taH5Sample",method= RequestMethod.GET)
97
-    public ResponseBean taH5SampleList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
98
-                                                @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
99
-                                                @RequestParam(value = "sampleName", required = false) String sampleName,
100
-                                                @RequestParam(value = "tag", required = false) String tag){
83
+    @RequestMapping(value = "/admin/taH5Sample", method = RequestMethod.GET)
84
+    public ResponseBean taH5SampleList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
85
+                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
86
+                                       @RequestParam(value = "sampleName", required = false) String sampleName,
87
+                                       @RequestParam(value = "tag", required = false) String tag) {
101 88
         ResponseBean responseBean = new ResponseBean();
102 89
         try {
103 90
             //使用分页插件
104 91
             IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
105 92
             QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
106
-            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
107
-            queryWrapper.like(!StringUtils.isEmpty(tag),"tag",tag);
93
+            queryWrapper.like(!StringUtils.isEmpty(sampleName), "sample_name", sampleName);
94
+            queryWrapper.like(!StringUtils.isEmpty(tag), "tag", tag);
108 95
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
109
-            queryWrapper.orderByDesc("order_no","create_date");
96
+            queryWrapper.orderByDesc("order_no", "create_date");
110 97
 
111 98
             IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
112 99
             responseBean.addSuccess(result);
113
-        }catch (Exception e){
100
+        } catch (Exception e) {
114 101
             e.printStackTrace();
115
-            logger.error("taH5SampleList -=- {}",e.toString());
102
+            logger.error("taH5SampleList -=- {}", e.toString());
116 103
             responseBean.addError(e.getMessage());
117 104
         }
118 105
         return responseBean;
@@ -120,22 +107,23 @@ public class TaH5SampleController extends BaseController {
120 107
 
121 108
     /**
122 109
      * 保存对象
110
+     *
123 111
      * @param taH5Sample 实体对象
124 112
      * @return
125 113
      */
126
-    @RequestMapping(value="/taH5Sample",method= RequestMethod.POST)
127
-    public ResponseBean taH5SampleAdd(@RequestBody TaH5Sample taH5Sample){
114
+    @RequestMapping(value = "/taH5Sample", method = RequestMethod.POST)
115
+    public ResponseBean taH5SampleAdd(@RequestBody TaH5Sample taH5Sample) {
128 116
         ResponseBean responseBean = new ResponseBean();
129 117
         try {
130
-            if (iTaH5SampleService.save(taH5Sample)){
118
+            if (iTaH5SampleService.save(taH5Sample)) {
131 119
                 responseBean.addSuccess(taH5Sample);
132
-            }else {
120
+            } else {
133 121
                 responseBean.addError("fail");
134 122
             }
135 123
 
136
-        }catch (Exception e){
124
+        } catch (Exception e) {
137 125
             e.printStackTrace();
138
-            logger.error("taH5SampleAdd -=- {}",e.toString());
126
+            logger.error("taH5SampleAdd -=- {}", e.toString());
139 127
             responseBean.addError(e.getMessage());
140 128
         }
141 129
         return responseBean;
@@ -143,21 +131,22 @@ public class TaH5SampleController extends BaseController {
143 131
 
144 132
     /**
145 133
      * 根据id删除对象
146
-     * @param id  实体ID
134
+     *
135
+     * @param id 实体ID
147 136
      */
148 137
     @ResponseBody
149
-    @RequestMapping(value="/taH5Sample/{id}", method= RequestMethod.DELETE)
150
-    public ResponseBean taH5SampleDelete(@PathVariable Integer id){
138
+    @RequestMapping(value = "/taH5Sample/{id}", method = RequestMethod.DELETE)
139
+    public ResponseBean taH5SampleDelete(@PathVariable Integer id) {
151 140
         ResponseBean responseBean = new ResponseBean();
152 141
         try {
153
-            if(iTaH5SampleService.removeById(id)){
142
+            if (iTaH5SampleService.removeById(id)) {
154 143
                 responseBean.addSuccess("success");
155
-            }else {
144
+            } else {
156 145
                 responseBean.addError("fail");
157 146
             }
158
-        }catch (Exception e){
147
+        } catch (Exception e) {
159 148
             e.printStackTrace();
160
-            logger.error("taH5SampleDelete -=- {}",e.toString());
149
+            logger.error("taH5SampleDelete -=- {}", e.toString());
161 150
             responseBean.addError(e.getMessage());
162 151
         }
163 152
         return responseBean;
@@ -165,23 +154,24 @@ public class TaH5SampleController extends BaseController {
165 154
 
166 155
     /**
167 156
      * 修改对象
168
-     * @param id  实体ID
157
+     *
158
+     * @param id         实体ID
169 159
      * @param taH5Sample 实体对象
170 160
      * @return
171 161
      */
172
-    @RequestMapping(value="/taH5Sample/{id}",method= RequestMethod.PUT)
162
+    @RequestMapping(value = "/taH5Sample/{id}", method = RequestMethod.PUT)
173 163
     public ResponseBean taH5SampleUpdate(@PathVariable Integer id,
174
-                                        @RequestBody TaH5Sample taH5Sample){
164
+                                         @RequestBody TaH5Sample taH5Sample) {
175 165
         ResponseBean responseBean = new ResponseBean();
176 166
         try {
177
-            if (iTaH5SampleService.updateById(taH5Sample)){
167
+            if (iTaH5SampleService.updateById(taH5Sample)) {
178 168
                 responseBean.addSuccess(taH5Sample);
179
-            }else {
169
+            } else {
180 170
                 responseBean.addError("fail");
181 171
             }
182
-        }catch (Exception e){
172
+        } catch (Exception e) {
183 173
             e.printStackTrace();
184
-            logger.error("taH5SampleUpdate -=- {}",e.toString());
174
+            logger.error("taH5SampleUpdate -=- {}", e.toString());
185 175
             responseBean.addError(e.getMessage());
186 176
         }
187 177
         return responseBean;
@@ -189,16 +179,17 @@ public class TaH5SampleController extends BaseController {
189 179
 
190 180
     /**
191 181
      * 根据id查询对象
192
-     * @param id  实体ID
182
+     *
183
+     * @param id 实体ID
193 184
      */
194
-    @RequestMapping(value="/admin/taH5Sample/{id}",method= RequestMethod.GET)
195
-    public ResponseBean taH5SampleGet(@PathVariable Integer id){
185
+    @RequestMapping(value = "/admin/taH5Sample/{id}", method = RequestMethod.GET)
186
+    public ResponseBean taH5SampleGet(@PathVariable Integer id) {
196 187
         ResponseBean responseBean = new ResponseBean();
197 188
         try {
198 189
             responseBean.addSuccess(iTaH5SampleService.getById(id));
199
-        }catch (Exception e){
190
+        } catch (Exception e) {
200 191
             e.printStackTrace();
201
-            logger.error("taH5SampleDelete -=- {}",e.toString());
192
+            logger.error("taH5SampleDelete -=- {}", e.toString());
202 193
             responseBean.addError(e.getMessage());
203 194
         }
204 195
         return responseBean;
@@ -207,41 +198,42 @@ public class TaH5SampleController extends BaseController {
207 198
 
208 199
     /**
209 200
      * 分页查询列表
201
+     *
210 202
      * @param pageNum
211 203
      * @param pageSize
212 204
      * @return
213 205
      */
214
-    @RequestMapping(value="/channel/h5Sample/list",method= RequestMethod.GET)
215
-    public ResponseBean geth5SampleList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
216
-                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
217
-                                        @RequestParam(value ="sampleName",required = false) String sampleName,
218
-                                        @RequestParam(value ="tag",required = false) String tag,
219
-                                        @RequestParam(value ="status",required = false) Integer status,
220
-                                        @RequestParam(value ="startCreateDate",required = false) String startCreateDate,
221
-                                        @RequestParam(value ="endCreateDate",required = false) String endCreateDate){
206
+    @RequestMapping(value = "/channel/h5Sample/list", method = RequestMethod.GET)
207
+    public ResponseBean geth5SampleList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
208
+                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
209
+                                        @RequestParam(value = "sampleName", required = false) String sampleName,
210
+                                        @RequestParam(value = "tag", required = false) String tag,
211
+                                        @RequestParam(value = "status", required = false) Integer status,
212
+                                        @RequestParam(value = "startCreateDate", required = false) String startCreateDate,
213
+                                        @RequestParam(value = "endCreateDate", required = false) String endCreateDate) {
222 214
         ResponseBean responseBean = new ResponseBean();
223 215
         try {
224 216
             //使用分页插件
225 217
             IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
226 218
             QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
227
-            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
228
-            queryWrapper.like(!StringUtils.isEmpty(tag),"tag",tag);
229
-            queryWrapper.eq(null != status,"demand_status",status);
230
-            queryWrapper.ge(!StringUtils.isEmpty(startCreateDate),"date_format(create_date,'%Y-%m-%d')",startCreateDate);
231
-            queryWrapper.le(!StringUtils.isEmpty(endCreateDate),"date_format(create_date,'%Y-%m-%d')",endCreateDate);
219
+            queryWrapper.like(!StringUtils.isEmpty(sampleName), "sample_name", sampleName);
220
+            queryWrapper.like(!StringUtils.isEmpty(tag), "tag", tag);
221
+            queryWrapper.eq(null != status, "demand_status", status);
222
+            queryWrapper.ge(!StringUtils.isEmpty(startCreateDate), "date_format(create_date,'%Y-%m-%d')", startCreateDate);
223
+            queryWrapper.le(!StringUtils.isEmpty(endCreateDate), "date_format(create_date,'%Y-%m-%d')", endCreateDate);
232 224
             queryWrapper.gt("status", CommConstant.STATUS_DELETE);
233
-            queryWrapper.orderByDesc("order_no","create_date");
225
+            queryWrapper.orderByDesc("order_no", "create_date");
234 226
 
235 227
             IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
236 228
             result.getRecords().forEach(e -> {
237
-                if (!StringUtils.isEmpty(e.getTag())){
229
+                if (!StringUtils.isEmpty(e.getTag())) {
238 230
                     e.setTags(Arrays.asList(e.getTag().split(",")));
239 231
                 }
240 232
             });
241 233
             responseBean.addSuccess(result);
242
-        }catch (Exception e){
234
+        } catch (Exception e) {
243 235
             e.printStackTrace();
244
-            logger.error("taH5SampleList -=- {}",e.toString());
236
+            logger.error("taH5SampleList -=- {}", e.toString());
245 237
             responseBean.addError(e.getMessage());
246 238
         }
247 239
         return responseBean;
@@ -249,17 +241,18 @@ public class TaH5SampleController extends BaseController {
249 241
 
250 242
     /**
251 243
      * 保存对象
244
+     *
252 245
      * @param taH5Sample 实体对象
253 246
      * @return
254 247
      */
255
-    @RequestMapping(value="/channel/h5Sample/add",method= RequestMethod.POST)
256
-    public ResponseBean AddTaH5Sample(@RequestBody TaH5Sample taH5Sample){
248
+    @RequestMapping(value = "/channel/h5Sample/add", method = RequestMethod.POST)
249
+    public ResponseBean AddTaH5Sample(@RequestBody TaH5Sample taH5Sample) {
257 250
         ResponseBean responseBean = new ResponseBean();
258 251
         try {
259 252
             List<String> tags = taH5Sample.getTags();
260
-            taH5Sample.setTag(String.join(",",tags));
253
+            taH5Sample.setTag(String.join(",", tags));
261 254
             taH5Sample.setCreateDate(LocalDateTime.now());
262
-            if (iTaH5SampleService.save(taH5Sample)){
255
+            if (iTaH5SampleService.save(taH5Sample)) {
263 256
                 List<TaContact> taContactList = taH5Sample.getTaContactList();
264 257
                 taContactList.forEach(e -> {
265 258
                     TaSampleContact taSampleContact = new TaSampleContact();
@@ -268,12 +261,12 @@ public class TaH5SampleController extends BaseController {
268 261
                     iTaSampleContactService.save(taSampleContact);
269 262
                 });
270 263
                 responseBean.addSuccess(taH5Sample);
271
-            }else {
264
+            } else {
272 265
                 responseBean.addError("fail");
273 266
             }
274
-        }catch (Exception e){
267
+        } catch (Exception e) {
275 268
             e.printStackTrace();
276
-            logger.error("taH5SampleAdd -=- {}",e.toString());
269
+            logger.error("taH5SampleAdd -=- {}", e.toString());
277 270
             responseBean.addError(e.getMessage());
278 271
         }
279 272
         return responseBean;
@@ -282,55 +275,56 @@ public class TaH5SampleController extends BaseController {
282 275
 
283 276
     /**
284 277
      * 获取详情
278
+     *
285 279
      * @param
286 280
      * @return
287 281
      */
288
-    @RequestMapping(value="/channel/get/h5Sample/{id}",method= RequestMethod.GET)
289
-    public ResponseBean getTaH5Sample(@PathVariable Integer id){
282
+    @RequestMapping(value = "/channel/get/h5Sample/{id}", method = RequestMethod.GET)
283
+    public ResponseBean getTaH5Sample(@PathVariable Integer id) {
290 284
         ResponseBean responseBean = new ResponseBean();
291 285
         try {
292 286
             TaH5Sample taH5Sample = iTaH5SampleService.getById(id);
293 287
             QueryWrapper<TaSampleContact> queryWrapper = new QueryWrapper();
294
-            queryWrapper.eq("sample_id",taH5Sample.getSampleId());
288
+            queryWrapper.eq("sample_id", taH5Sample.getSampleId());
295 289
             List<TaSampleContact> sampleContactList = iTaSampleContactService.list(queryWrapper);
296
-            if (sampleContactList.size() > 0){
297
-                List<TaContact> taContactList = taContactService.list(new QueryWrapper<TaContact>().in("contact_id",sampleContactList.stream().map(TaSampleContact::getContactId).collect(Collectors.toList())));
290
+            if (sampleContactList.size() > 0) {
291
+                List<TaContact> taContactList = taContactService.list(new QueryWrapper<TaContact>().in("contact_id", sampleContactList.stream().map(TaSampleContact::getContactId).collect(Collectors.toList())));
298 292
                 taH5Sample.setTaContactList(taContactList);
299 293
             }
300
-            if (!StringUtils.isEmpty(taH5Sample.getTag())){
294
+            if (!StringUtils.isEmpty(taH5Sample.getTag())) {
301 295
                 taH5Sample.setTags(Arrays.asList(taH5Sample.getTag().split(",")));
302 296
             }
303 297
             responseBean.addSuccess(taH5Sample);
304
-        }catch (Exception e){
298
+        } catch (Exception e) {
305 299
             e.printStackTrace();
306
-            logger.error("taH5SampleAdd -=- {}",e.toString());
300
+            logger.error("taH5SampleAdd -=- {}", e.toString());
307 301
             responseBean.addError(e.getMessage());
308 302
         }
309 303
         return responseBean;
310 304
     }
311 305
 
312 306
 
313
-
314 307
     /**
315 308
      * 更新对象
309
+     *
316 310
      * @param taH5Sample 实体对象
317 311
      * @return
318 312
      */
319
-    @RequestMapping(value="/channel/update/h5Sample/{id}",method= RequestMethod.PUT)
320
-    public ResponseBean updateTaH5Sample(@PathVariable Integer id,@RequestBody TaH5Sample taH5Sample){
313
+    @RequestMapping(value = "/channel/update/h5Sample/{id}", method = RequestMethod.PUT)
314
+    public ResponseBean updateTaH5Sample(@PathVariable Integer id, @RequestBody TaH5Sample taH5Sample) {
321 315
         ResponseBean responseBean = new ResponseBean();
322 316
         try {
323 317
             taH5Sample.setSampleId(id);
324 318
             List<String> tags = taH5Sample.getTags();
325
-            if (tags.size() > 0){
326
-                taH5Sample.setTag(String.join(",",tags));
327
-            }else{
319
+            if (tags.size() > 0) {
320
+                taH5Sample.setTag(String.join(",", tags));
321
+            } else {
328 322
                 taH5Sample.setTag("");
329 323
             }
330 324
             QueryWrapper<TaSampleContact> taSampleContactQueryWrapper = new QueryWrapper<>();
331
-            taSampleContactQueryWrapper.eq("sample_id",id);
325
+            taSampleContactQueryWrapper.eq("sample_id", id);
332 326
             iTaSampleContactService.remove(taSampleContactQueryWrapper);
333
-            if (iTaH5SampleService.updateById(taH5Sample)){
327
+            if (iTaH5SampleService.updateById(taH5Sample)) {
334 328
                 List<TaContact> taContactList = taH5Sample.getTaContactList();
335 329
                 taContactList.forEach(e -> {
336 330
                     TaSampleContact taSampleContact = new TaSampleContact();
@@ -339,12 +333,12 @@ public class TaH5SampleController extends BaseController {
339 333
                     iTaSampleContactService.save(taSampleContact);
340 334
                 });
341 335
                 responseBean.addSuccess(taH5Sample);
342
-            }else {
336
+            } else {
343 337
                 responseBean.addError("fail");
344 338
             }
345
-        }catch (Exception e){
339
+        } catch (Exception e) {
346 340
             e.printStackTrace();
347
-            logger.error("taH5SampleAdd -=- {}",e.toString());
341
+            logger.error("taH5SampleAdd -=- {}", e.toString());
348 342
             responseBean.addError(e.getMessage());
349 343
         }
350 344
         return responseBean;
@@ -353,30 +347,31 @@ public class TaH5SampleController extends BaseController {
353 347
 
354 348
     /**
355 349
      * 删除sample
350
+     *
356 351
      * @return
357 352
      */
358
-    @RequestMapping(value="/channel/put/h5Sample/{id}",method= RequestMethod.PUT)
359
-    public ResponseBean putTaH5Sample(@PathVariable Integer id){
353
+    @RequestMapping(value = "/channel/put/h5Sample/{id}", method = RequestMethod.PUT)
354
+    public ResponseBean putTaH5Sample(@PathVariable Integer id) {
360 355
         ResponseBean responseBean = new ResponseBean();
361 356
         try {
362 357
             //查看是否有关联的需求单
363 358
             QueryWrapper<TaH5Demand> queryWrapper = new QueryWrapper<>();
364
-            queryWrapper.eq("sample_id",id);
365
-            queryWrapper.gt("demand_status",CommConstant.STATUS_DELETE);
359
+            queryWrapper.eq("sample_id", id);
360
+            queryWrapper.gt("demand_status", CommConstant.STATUS_DELETE);
366 361
             List<TaH5Demand> list = iTaH5DemandService.list(queryWrapper);
367
-            if (list.size() > 0){
368
-                return ResponseBean.error("存在关联的需求单,删除失败!",ResponseBean.ERROR_UNAVAILABLE);
362
+            if (list.size() > 0) {
363
+                return ResponseBean.error("存在关联的需求单,删除失败!", ResponseBean.ERROR_UNAVAILABLE);
369 364
             }
370 365
             TaH5Sample taH5Sample = iTaH5SampleService.getById(id);
371 366
             taH5Sample.setStatus(CommConstant.STATUS_DELETE);
372
-            if (iTaH5SampleService.updateById(taH5Sample)){
367
+            if (iTaH5SampleService.updateById(taH5Sample)) {
373 368
                 responseBean.addSuccess(taH5Sample);
374
-            }else {
369
+            } else {
375 370
                 responseBean.addError("fail");
376 371
             }
377
-        }catch (Exception e){
372
+        } catch (Exception e) {
378 373
             e.printStackTrace();
379
-            logger.error("taH5SampleAdd -=- {}",e.toString());
374
+            logger.error("taH5SampleAdd -=- {}", e.toString());
380 375
             responseBean.addError(e.getMessage());
381 376
         }
382 377
         return responseBean;

+ 1
- 1
src/main/java/com/huiju/estateagents/sample/controller/TaNoticeController.java View File

@@ -149,7 +149,7 @@ public class TaNoticeController extends BaseController {
149 149
             }
150 150
             if (taNotice.getTargetId() != null) {
151 151
                 TaH5Sample taH5Sample = iTaH5SampleService.getById(taNotice.getNoticeId());
152
-                if(taH5Sample != null){
152
+                if (taH5Sample != null) {
153 153
                     taNotice.setTargetName(taH5Sample.getSampleName());
154 154
                 }
155 155
             }

+ 29
- 1
src/main/java/com/huiju/estateagents/sample/entity/TaH5Sample.java View File

@@ -3,6 +3,7 @@ package com.huiju.estateagents.sample.entity;
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4 4
 import com.baomidou.mybatisplus.annotation.TableField;
5 5
 import com.baomidou.mybatisplus.annotation.TableId;
6
+
6 7
 import java.time.LocalDateTime;
7 8
 import java.io.Serializable;
8 9
 import java.util.ArrayList;
@@ -14,7 +15,7 @@ import lombok.experimental.Accessors;
14 15
 
15 16
 /**
16 17
  * <p>
17
- * 样例表 
18
+ * 样例表
18 19
  * </p>
19 20
  *
20 21
  * @author fxf
@@ -99,4 +100,31 @@ public class TaH5Sample implements Serializable {
99 100
      */
100 101
     @TableField(exist = false)
101 102
     private List<TaContact> taContactList = new ArrayList<>();
103
+
104
+    /**
105
+     * 修改人
106
+     */
107
+    private Integer updateUser;
108
+
109
+    /**
110
+     * 修改时间
111
+     */
112
+    private LocalDateTime updateDate;
113
+
114
+    /**
115
+     * 新增人
116
+     */
117
+    private Integer addUser;
118
+
119
+    /**
120
+     * 添加人姓名
121
+     */
122
+    @TableField(exist = false)
123
+    private String addUserName;
124
+
125
+    /**
126
+     * 修改人姓名
127
+     */
128
+    @TableField(exist = false)
129
+    private String updateUserName;
102 130
 }

+ 0
- 2
src/main/java/com/huiju/estateagents/sample/entity/TaNotice.java View File

@@ -77,6 +77,4 @@ public class TaNotice implements Serializable {
77 77
      * 权重
78 78
      */
79 79
     private Integer orderNo;
80
-
81
-
82 80
 }

+ 4
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaH5SampleMapper.java View File

@@ -1,8 +1,10 @@
1 1
 package com.huiju.estateagents.sample.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.springframework.stereotype.Component;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -13,6 +15,8 @@ import org.apache.ibatis.annotations.Mapper;
13 15
  * @since 2020-03-18
14 16
  */
15 17
 @Mapper
18
+@Component
16 19
 public interface TaH5SampleMapper extends BaseMapper<TaH5Sample> {
17 20
 
21
+    IPage<TaH5Sample> listH5SampleByCondition(IPage<TaH5Sample> pg, String sampleName);
18 22
 }

+ 8
- 1
src/main/java/com/huiju/estateagents/sample/mapper/TaNoticeMapper.java View File

@@ -38,5 +38,12 @@ public interface TaNoticeMapper extends BaseMapper<TaNotice> {
38 38
                                           @Param("type") String type);
39 39
 
40 40
     IPage<TaNotice> listNoticeByConditionForAdmin(IPage<TaNotice> pg,
41
-                                          @Param("type") String type);
41
+                                                  @Param("type") String type);
42
+
43
+    /**
44
+     * 自动下架已过期的开屏通知
45
+     *
46
+     * @return
47
+     */
48
+    Integer updateStatusByInvalidTime();
42 49
 }

+ 11
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaH5SampleService.java View File

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.sample.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
4 5
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5 6
 
6 7
 /**
@@ -13,4 +14,14 @@ import com.huiju.estateagents.sample.entity.TaH5Sample;
13 14
  */
14 15
 public interface ITaH5SampleService extends IService<TaH5Sample> {
15 16
 
17
+    /**
18
+     * 条件查询列表
19
+     *
20
+     * @param pageNum
21
+     * @param pageSize
22
+     * @param sampleName
23
+     * @return
24
+     */
25
+    ResponseBean listH5SampleByCondition(Integer pageNum, Integer pageSize, String sampleName);
26
+
16 27
 }

+ 7
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaNoticeService.java View File

@@ -41,4 +41,11 @@ public interface ITaNoticeService extends IService<TaNotice> {
41 41
      * @return
42 42
      */
43 43
     ResponseBean batchDelete(List<TaNotice> taNoticeList);
44
+
45
+    /**
46
+     * 自动下架已过期的开屏通知
47
+     *
48
+     * @return
49
+     */
50
+    Integer updateStatusByInvalidTime();
44 51
 }

+ 18
- 0
src/main/java/com/huiju/estateagents/sample/service/impl/TaH5SampleServiceImpl.java View File

@@ -1,9 +1,16 @@
1 1
 package com.huiju.estateagents.sample.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
9
+import com.huiju.estateagents.common.StringUtils;
4 10
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5 11
 import com.huiju.estateagents.sample.mapper.TaH5SampleMapper;
6 12
 import com.huiju.estateagents.sample.service.ITaH5SampleService;
13
+import org.springframework.beans.factory.annotation.Autowired;
7 14
 import org.springframework.stereotype.Service;
8 15
 
9 16
 /**
@@ -17,4 +24,15 @@ import org.springframework.stereotype.Service;
17 24
 @Service
18 25
 public class TaH5SampleServiceImpl extends ServiceImpl<TaH5SampleMapper, TaH5Sample> implements ITaH5SampleService {
19 26
 
27
+    @Autowired
28
+    private TaH5SampleMapper taH5SampleMapper;
29
+
30
+    @Override
31
+    public ResponseBean listH5SampleByCondition(Integer pageNum, Integer pageSize, String sampleName) {
32
+        ResponseBean responseBean = new ResponseBean();
33
+        IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
34
+        pg = taH5SampleMapper.listH5SampleByCondition(pg, sampleName);
35
+        responseBean.addSuccess(pg);
36
+        return responseBean;
37
+    }
20 38
 }

+ 5
- 0
src/main/java/com/huiju/estateagents/sample/service/impl/TaNoticeServiceImpl.java View File

@@ -75,4 +75,9 @@ public class TaNoticeServiceImpl extends ServiceImpl<TaNoticeMapper, TaNotice> i
75 75
         responseBean.addSuccess(updateBatchById(updateList));
76 76
         return responseBean;
77 77
     }
78
+
79
+    @Override
80
+    public Integer updateStatusByInvalidTime() {
81
+        return taNoticeMapper.updateStatusByInvalidTime();
82
+    }
78 83
 }

+ 19
- 0
src/main/resources/mapper/sample/TaH5SampleMapper.xml View File

@@ -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.huiju.estateagents.sample.mapper.TaH5SampleMapper">
4 4
 
5
+    <select id="listH5SampleByCondition" resultType="com.huiju.estateagents.sample.entity.TaH5Sample">
6
+        SELECT
7
+            t.*,
8
+            t2.user_name addUserName,
9
+            t3.user_name updateUserName
10
+        FROM
11
+            ta_h5_sample t
12
+            LEFT JOIN ta_user t2 ON t.add_user = t2.user_id
13
+            LEFT JOIN ta_user t3 ON t.update_user = t3.user_id
14
+        WHERE
15
+            t.`status` != - 1
16
+            <if test = "sampleName != null and sampleName != ''">
17
+                AND t.sample_name LIKE concat('%',#{sampleName},'%')
18
+            </if>
19
+        ORDER BY
20
+            t.order_no,
21
+            t.create_date
22
+    </select>
23
+
5 24
 </mapper>

+ 7
- 0
src/main/resources/mapper/sample/TaNoticeMapper.xml View File

@@ -41,4 +41,11 @@
41 41
             t.order_no DESC,
42 42
             t.create_date DESC
43 43
     </select>
44
+
45
+    <update id="updateStatusByInvalidTime">
46
+        UPDATE ta_notice t
47
+            SET t.`status` = 0
48
+        WHERE
49
+            t.invalid_time &lt; NOW( )
50
+    </update>
44 51
 </mapper>