Browse Source

* 新需求提交

顾绍勇 5 years ago
parent
commit
ae3c43ca3e

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

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

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

149
             }
149
             }
150
             if (taNotice.getTargetId() != null) {
150
             if (taNotice.getTargetId() != null) {
151
                 TaH5Sample taH5Sample = iTaH5SampleService.getById(taNotice.getNoticeId());
151
                 TaH5Sample taH5Sample = iTaH5SampleService.getById(taNotice.getNoticeId());
152
-                if(taH5Sample != null){
152
+                if (taH5Sample != null) {
153
                     taNotice.setTargetName(taH5Sample.getSampleName());
153
                     taNotice.setTargetName(taH5Sample.getSampleName());
154
                 }
154
                 }
155
             }
155
             }

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

3
 import com.baomidou.mybatisplus.annotation.IdType;
3
 import com.baomidou.mybatisplus.annotation.IdType;
4
 import com.baomidou.mybatisplus.annotation.TableField;
4
 import com.baomidou.mybatisplus.annotation.TableField;
5
 import com.baomidou.mybatisplus.annotation.TableId;
5
 import com.baomidou.mybatisplus.annotation.TableId;
6
+
6
 import java.time.LocalDateTime;
7
 import java.time.LocalDateTime;
7
 import java.io.Serializable;
8
 import java.io.Serializable;
8
 import java.util.ArrayList;
9
 import java.util.ArrayList;
14
 
15
 
15
 /**
16
 /**
16
  * <p>
17
  * <p>
17
- * 样例表 
18
+ * 样例表
18
  * </p>
19
  * </p>
19
  *
20
  *
20
  * @author fxf
21
  * @author fxf
99
      */
100
      */
100
     @TableField(exist = false)
101
     @TableField(exist = false)
101
     private List<TaContact> taContactList = new ArrayList<>();
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
      * 权重
77
      * 权重
78
      */
78
      */
79
     private Integer orderNo;
79
     private Integer orderNo;
80
-
81
-
82
 }
80
 }

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

1
 package com.huiju.estateagents.sample.mapper;
1
 package com.huiju.estateagents.sample.mapper;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.springframework.stereotype.Component;
6
 
8
 
7
 /**
9
 /**
8
  * <p>
10
  * <p>
13
  * @since 2020-03-18
15
  * @since 2020-03-18
14
  */
16
  */
15
 @Mapper
17
 @Mapper
18
+@Component
16
 public interface TaH5SampleMapper extends BaseMapper<TaH5Sample> {
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
                                           @Param("type") String type);
38
                                           @Param("type") String type);
39
 
39
 
40
     IPage<TaNotice> listNoticeByConditionForAdmin(IPage<TaNotice> pg,
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
 package com.huiju.estateagents.sample.service;
1
 package com.huiju.estateagents.sample.service;
2
 
2
 
3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5
 
6
 
6
 /**
7
 /**
13
  */
14
  */
14
 public interface ITaH5SampleService extends IService<TaH5Sample> {
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
      * @return
41
      * @return
42
      */
42
      */
43
     ResponseBean batchDelete(List<TaNotice> taNoticeList);
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
 package com.huiju.estateagents.sample.service.impl;
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
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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
 import com.huiju.estateagents.sample.entity.TaH5Sample;
10
 import com.huiju.estateagents.sample.entity.TaH5Sample;
5
 import com.huiju.estateagents.sample.mapper.TaH5SampleMapper;
11
 import com.huiju.estateagents.sample.mapper.TaH5SampleMapper;
6
 import com.huiju.estateagents.sample.service.ITaH5SampleService;
12
 import com.huiju.estateagents.sample.service.ITaH5SampleService;
13
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
8
 
15
 
9
 /**
16
 /**
17
 @Service
24
 @Service
18
 public class TaH5SampleServiceImpl extends ServiceImpl<TaH5SampleMapper, TaH5Sample> implements ITaH5SampleService {
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
         responseBean.addSuccess(updateBatchById(updateList));
75
         responseBean.addSuccess(updateBatchById(updateList));
76
         return responseBean;
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
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.huiju.estateagents.sample.mapper.TaH5SampleMapper">
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
 </mapper>
24
 </mapper>

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

41
             t.order_no DESC,
41
             t.order_no DESC,
42
             t.create_date DESC
42
             t.create_date DESC
43
     </select>
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
 </mapper>
51
 </mapper>