瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents into dev

# Conflicts:
#	src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java
#	src/main/java/com/huiju/estateagents/sample/controller/TaH5DemandController.java
#	src/main/java/com/huiju/estateagents/sample/controller/TaH5SampleController.java
魏超 5 年之前
父節點
當前提交
1f8c9f29f9

+ 5
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java 查看文件

@@ -715,4 +715,9 @@ public class CommConstant {
715 715
      * 线下缴费
716 716
      */
717 717
     public static final String PAY_TYPE_ONLINE = "onLine";
718
+
719
+    /**
720
+     * 作废状态
721
+     */
722
+    public static final Integer DEMAND_STATUS_INVALID = 4;
718 723
 }

+ 99
- 37
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java 查看文件

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
9
+import com.huiju.estateagents.common.StringUtils;
8 10
 import com.huiju.estateagents.sample.entity.TaContact;
9 11
 import com.huiju.estateagents.sample.service.ITaContactService;
10 12
 import org.slf4j.Logger;
@@ -18,11 +20,15 @@ import org.springframework.web.bind.annotation.RequestParam;
18 20
 import org.springframework.web.bind.annotation.ResponseBody;
19 21
 import org.springframework.web.bind.annotation.RestController;
20 22
 
23
+import java.time.LocalDateTime;
24
+import java.util.ArrayList;
25
+import java.util.List;
26
+
21 27
 
22 28
 /**
23 29
  * <p>
24
-    * 联系人表  前端控制器
25
-    * </p>
30
+ * 联系人表  前端控制器
31
+ * </p>
26 32
  *
27 33
  * @author fxf
28 34
  * @since 2020-03-18
@@ -38,26 +44,37 @@ public class TaContactController extends BaseController {
38 44
 
39 45
 
40 46
     /**
41
-     * 分页查询列表
47
+     * 条件查询联系人列表
48
+     *
42 49
      * @param pageNum
43 50
      * @param pageSize
51
+     * @param contactName
52
+     * @param telephone
53
+     * @param phone
54
+     * @param job
44 55
      * @return
45 56
      */
46
-    @RequestMapping(value="/admin/taContact",method= RequestMethod.GET)
47
-    public ResponseBean taContactList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
48
-                                      @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
57
+    @RequestMapping(value = "/channel/listContactByCondition", method = RequestMethod.GET)
58
+    public ResponseBean listContactByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
59
+                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
60
+                                               String contactName, String telephone, String phone, String job) {
49 61
         ResponseBean responseBean = new ResponseBean();
50 62
         try {
51 63
             //使用分页插件
52
-		    IPage<TaContact> pg = new Page<>(pageNum, pageSize);
64
+            IPage<TaContact> pg = new Page<>(pageNum, pageSize);
53 65
             QueryWrapper<TaContact> queryWrapper = new QueryWrapper<>();
54
-            queryWrapper.orderByDesc("create_date");
66
+            queryWrapper.like(!StringUtils.isEmpty(contactName),"contact_name", contactName);
67
+            queryWrapper.like(!StringUtils.isEmpty(telephone),"telephone", telephone);
68
+            queryWrapper.like(!StringUtils.isEmpty(phone),"phone", phone);
69
+            queryWrapper.like(!StringUtils.isEmpty(job),"job", job);
70
+            queryWrapper.ne("status", CommConstant.STATUS_DELETE);
71
+            queryWrapper.orderByDesc("order_no", "create_date");
55 72
 
56 73
             IPage<TaContact> result = iTaContactService.page(pg, queryWrapper);
57 74
             responseBean.addSuccess(result);
58
-        }catch (Exception e){
75
+        } catch (Exception e) {
59 76
             e.printStackTrace();
60
-            logger.error("taContactList -=- {}",e.toString());
77
+            logger.error("taContactList -=- {}", e.toString());
61 78
             responseBean.addError(e.getMessage());
62 79
         }
63 80
         return responseBean;
@@ -65,43 +82,51 @@ public class TaContactController extends BaseController {
65 82
 
66 83
     /**
67 84
      * 保存对象
85
+     *
68 86
      * @param taContact 实体对象
69 87
      * @return
70 88
      */
71
-    @RequestMapping(value="/taContact",method= RequestMethod.POST)
72
-    public ResponseBean taContactAdd(@RequestBody TaContact taContact){
89
+    @RequestMapping(value = "/channel/taContact", method = RequestMethod.POST)
90
+    public ResponseBean taContactAdd(@RequestBody TaContact taContact) {
73 91
         ResponseBean responseBean = new ResponseBean();
74 92
         try {
75
-            if (iTaContactService.save(taContact)){
93
+            taContact.setCreateDate(LocalDateTime.now());
94
+            taContact.setStatus(CommConstant.STATUS_NORMAL);
95
+            if (iTaContactService.save(taContact)) {
76 96
                 responseBean.addSuccess(taContact);
77
-            }else {
97
+            } else {
78 98
                 responseBean.addError("fail");
79 99
             }
80
-        }catch (Exception e){
100
+        } catch (Exception e) {
81 101
             e.printStackTrace();
82
-            logger.error("taContactAdd -=- {}",e.toString());
102
+            logger.error("taContactAdd -=- {}", e.toString());
83 103
             responseBean.addError(e.getMessage());
84 104
         }
85 105
         return responseBean;
86 106
     }
87 107
 
88 108
     /**
89
-     * 根据id删除对象
90
-     * @param id  实体ID
109
+     * 批量删除
110
+     *
91 111
      */
92 112
     @ResponseBody
93
-    @RequestMapping(value="/taContact/{id}", method= RequestMethod.DELETE)
94
-    public ResponseBean taContactDelete(@PathVariable Integer id){
113
+    @RequestMapping(value = "/channel/taContact/batchDelete", method = RequestMethod.PUT)
114
+    public ResponseBean batchDelete(@RequestBody List<TaContact> taContactList) {
95 115
         ResponseBean responseBean = new ResponseBean();
96 116
         try {
97
-            if(iTaContactService.removeById(id)){
98
-                responseBean.addSuccess("success");
99
-            }else {
100
-                responseBean.addError("fail");
117
+            List<TaContact> updateList = new ArrayList<>();
118
+            TaContact newContact;
119
+            for (TaContact taContact : taContactList) {
120
+                newContact = new TaContact();
121
+                newContact.setContactId(taContact.getContactId());
122
+                newContact.setStatus(CommConstant.STATUS_DELETE);
123
+                updateList.add(newContact);
101 124
             }
102
-        }catch (Exception e){
125
+
126
+            responseBean.addSuccess(iTaContactService.updateBatchById(updateList));
127
+        } catch (Exception e) {
103 128
             e.printStackTrace();
104
-            logger.error("taContactDelete -=- {}",e.toString());
129
+            logger.error("taContactDelete -=- {}", e.toString());
105 130
             responseBean.addError(e.getMessage());
106 131
         }
107 132
         return responseBean;
@@ -109,23 +134,24 @@ public class TaContactController extends BaseController {
109 134
 
110 135
     /**
111 136
      * 修改对象
112
-     * @param id  实体ID
137
+     *
138
+     * @param id        实体ID
113 139
      * @param taContact 实体对象
114 140
      * @return
115 141
      */
116
-    @RequestMapping(value="/taContact/{id}",method= RequestMethod.PUT)
142
+    @RequestMapping(value = "/channel/taContact/{id}", method = RequestMethod.PUT)
117 143
     public ResponseBean taContactUpdate(@PathVariable Integer id,
118
-                                        @RequestBody TaContact taContact){
144
+                                        @RequestBody TaContact taContact) {
119 145
         ResponseBean responseBean = new ResponseBean();
120 146
         try {
121
-            if (iTaContactService.updateById(taContact)){
147
+            if (iTaContactService.updateById(taContact)) {
122 148
                 responseBean.addSuccess(taContact);
123
-            }else {
149
+            } else {
124 150
                 responseBean.addError("fail");
125 151
             }
126
-        }catch (Exception e){
152
+        } catch (Exception e) {
127 153
             e.printStackTrace();
128
-            logger.error("taContactUpdate -=- {}",e.toString());
154
+            logger.error("taContactUpdate -=- {}", e.toString());
129 155
             responseBean.addError(e.getMessage());
130 156
         }
131 157
         return responseBean;
@@ -133,16 +159,52 @@ public class TaContactController extends BaseController {
133 159
 
134 160
     /**
135 161
      * 根据id查询对象
136
-     * @param id  实体ID
162
+     *
163
+     * @param id 实体ID
137 164
      */
138
-    @RequestMapping(value="/taContact/{id}",method= RequestMethod.GET)
139
-    public ResponseBean taContactGet(@PathVariable Integer id){
165
+    @RequestMapping(value = "/channel/taContact/{id}", method = RequestMethod.GET)
166
+    public ResponseBean taContactGet(@PathVariable Integer id) {
140 167
         ResponseBean responseBean = new ResponseBean();
141 168
         try {
142 169
             responseBean.addSuccess(iTaContactService.getById(id));
170
+        } catch (Exception e) {
171
+            e.printStackTrace();
172
+            logger.error("taContactDelete -=- {}", e.toString());
173
+            responseBean.addError(e.getMessage());
174
+        }
175
+        return responseBean;
176
+    }
177
+
178
+    /**
179
+     * 联系人列表
180
+     * @param pageNum
181
+     * @param pageSize
182
+     * @return
183
+     */
184
+    @RequestMapping(value="/channel/taContact",method= RequestMethod.GET)
185
+    public ResponseBean getContactList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
186
+                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
187
+                                       @RequestParam(value ="contactName",required = false) String contactName,
188
+                                       @RequestParam(value ="telephone",required = false) String telephone,
189
+                                       @RequestParam(value ="phone",required = false) String phone,
190
+                                       @RequestParam(value ="job",required = false) String job){
191
+        ResponseBean responseBean = new ResponseBean();
192
+        try {
193
+            //使用分页插件
194
+            IPage<TaContact> pg = new Page<>(pageNum, pageSize);
195
+            QueryWrapper<TaContact> queryWrapper = new QueryWrapper<>();
196
+            queryWrapper.like(!StringUtils.isEmpty(contactName),"contact_name",contactName);
197
+            queryWrapper.like(!StringUtils.isEmpty(telephone),"telephone",telephone);
198
+            queryWrapper.like(!StringUtils.isEmpty(phone),"phone",phone);
199
+            queryWrapper.like(!StringUtils.isEmpty(job),"job",job);
200
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
201
+            queryWrapper.orderByDesc("order_no","create_date");
202
+
203
+            IPage<TaContact> result = iTaContactService.page(pg, queryWrapper);
204
+            responseBean.addSuccess(result);
143 205
         }catch (Exception e){
144 206
             e.printStackTrace();
145
-            logger.error("taContactDelete -=- {}",e.toString());
207
+            logger.error("taContactList -=- {}",e.toString());
146 208
             responseBean.addError(e.getMessage());
147 209
         }
148 210
         return responseBean;

+ 120
- 0
src/main/java/com/huiju/estateagents/sample/controller/TaH5DemandController.java 查看文件

@@ -1,5 +1,7 @@
1 1
 package com.huiju.estateagents.sample.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONArray;
4
+import com.alibaba.fastjson.JSONObject;
3 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,6 +14,7 @@ import com.huiju.estateagents.sample.service.ITaH5DemandService;
12 14
 import com.huiju.estateagents.service.ITaOrgService;
13 15
 import org.apache.poi.ss.formula.functions.T;
14 16
 import org.omg.CORBA.INTERNAL;
17
+import io.swagger.models.auth.In;
15 18
 import org.slf4j.Logger;
16 19
 import org.slf4j.LoggerFactory;
17 20
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +30,9 @@ import javax.servlet.http.HttpServletRequest;
27 30
 import java.time.LocalDateTime;
28 31
 import java.util.ArrayList;
29 32
 import java.util.List;
33
+import java.util.HashMap;
34
+import java.util.List;
35
+import java.util.Map;
30 36
 
31 37
 
32 38
 /**
@@ -211,4 +217,118 @@ public class TaH5DemandController extends BaseController {
211 217
         }
212 218
         return responseBean;
213 219
     }
220
+
221
+
222
+    /**
223
+     * 获取h5需求清单
224
+     * @param pageNum
225
+     * @param pageSize
226
+     * @return
227
+     */
228
+    @RequestMapping(value="/channel/taH5Demand",method= RequestMethod.GET)
229
+    public ResponseBean getH5DemandList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
230
+                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
231
+                                        @RequestParam(value ="sampleName",required = false) String sampleName,
232
+                                        @RequestParam(value ="orgName",required = false) String orgName,
233
+                                        @RequestParam(value ="orderer",required = false) String orderer,
234
+                                        @RequestParam(value ="phone",required = false) String phone,
235
+                                        @RequestParam(value ="demandStatus",required = false) Integer demandStatus,
236
+                                        @RequestParam(value ="startCreateDate",required = false) String startCreateDate,
237
+                                        @RequestParam(value ="endCreateDate",required = false) String endCreateDate,
238
+                                       HttpServletRequest request){
239
+        ResponseBean responseBean = new ResponseBean();
240
+        try {
241
+            //使用分页插件
242
+            IPage<TaH5Demand> pg = new Page<>(pageNum, pageSize);
243
+            QueryWrapper<TaH5Demand> queryWrapper = new QueryWrapper<>();
244
+            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
245
+            queryWrapper.like(!StringUtils.isEmpty(orgName),"org_name",orgName);
246
+            queryWrapper.like(!StringUtils.isEmpty(orderer),"orderer",orderer);
247
+            queryWrapper.like(!StringUtils.isEmpty(phone),"phone",phone);
248
+            queryWrapper.eq(null != demandStatus,"demand_status",demandStatus);
249
+            queryWrapper.ge(!StringUtils.isEmpty(startCreateDate),"date_format(create_date,'%Y-%m-%d')",startCreateDate);
250
+            queryWrapper.le(!StringUtils.isEmpty(endCreateDate),"date_format(create_date,'%Y-%m-%d')",endCreateDate);
251
+            queryWrapper.gt("demand_status", CommConstant.STATUS_DELETE);
252
+            queryWrapper.orderByDesc("create_date");
253
+
254
+            IPage<TaH5Demand> result = iTaH5DemandService.page(pg, queryWrapper);
255
+            responseBean.addSuccess(result);
256
+        }catch (Exception e){
257
+            e.printStackTrace();
258
+            logger.error("taH5DemandList -=- {}",e.toString());
259
+            responseBean.addError(e.getMessage());
260
+        }
261
+        return responseBean;
262
+    }
263
+
264
+
265
+    /**
266
+     * 批量删除需求单
267
+     * @return
268
+     */
269
+    @RequestMapping(value="/channel/taH5Demand/batch",method= RequestMethod.PUT)
270
+    public ResponseBean batchUpdateH5DemandList(@RequestBody String ids,
271
+                                        HttpServletRequest request){
272
+        ResponseBean responseBean = new ResponseBean();
273
+        try {
274
+            int successNum = 0;
275
+            int failNum = 0;
276
+            JSONArray jsonArray = JSONObject.parseObject(ids).getJSONArray("ids");
277
+            for (Object id : jsonArray) {
278
+                TaH5Demand h5Demand = iTaH5DemandService.getById((Integer) id);
279
+                if (CommConstant.DEMAND_STATUS_INVALID.equals(h5Demand.getDemandStatus())){
280
+                    h5Demand.setDemandStatus(CommConstant.STATUS_DELETE);
281
+                    iTaH5DemandService.updateById(h5Demand);
282
+                    successNum++;
283
+                }else{
284
+                    failNum++;
285
+                }
286
+            }
287
+            Map<String,Object> map = new HashMap<>();
288
+            map.put("successNum",successNum);
289
+            map.put("failNum",failNum);
290
+            responseBean.addSuccess(map);
291
+        }catch (Exception e){
292
+            e.printStackTrace();
293
+            logger.error("taH5DemandList -=- {}",e.toString());
294
+            responseBean.addError(e.getMessage());
295
+        }
296
+        return responseBean;
297
+    }
298
+
299
+    /**
300
+     * 获取需求单详情
301
+     * @return
302
+     */
303
+    @RequestMapping(value="/channel/taH5Demand/{id}",method= RequestMethod.GET)
304
+    public ResponseBean getH5Demand(@PathVariable Integer id, HttpServletRequest request){
305
+        ResponseBean responseBean = new ResponseBean();
306
+        try {
307
+            responseBean.addSuccess(iTaH5DemandService.getById(id));
308
+        }catch (Exception e){
309
+            e.printStackTrace();
310
+            logger.error("getH5Demand -=- {}",e.toString());
311
+            responseBean.addError(e.getMessage());
312
+        }
313
+        return responseBean;
314
+    }
315
+
316
+    /**
317
+     * 更新需求单详情
318
+     * @return
319
+     */
320
+    @RequestMapping(value="/channel/taH5Demand/update/{id}",method= RequestMethod.PUT)
321
+    public ResponseBean updateH5Demand(@PathVariable Integer id,@RequestBody TaH5Demand taH5Demand, HttpServletRequest request){
322
+        ResponseBean responseBean = new ResponseBean();
323
+        try {
324
+            taH5Demand.setDemandId(id);
325
+            taH5Demand.setUpdateDate(LocalDateTime.now());
326
+            responseBean.addSuccess(iTaH5DemandService.updateById(taH5Demand));
327
+        }catch (Exception e){
328
+            e.printStackTrace();
329
+            logger.error("getH5Demand -=- {}",e.toString());
330
+            responseBean.addError(e.getMessage());
331
+        }
332
+        return responseBean;
333
+    }
214 334
 }

+ 76
- 8
src/main/java/com/huiju/estateagents/sample/controller/TaH5SampleController.java 查看文件

@@ -6,8 +6,12 @@ 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 8
 import com.huiju.estateagents.common.StringUtils;
9
+import com.huiju.estateagents.sample.entity.TaContact;
10
+import com.huiju.estateagents.common.CommConstant;
9 11
 import com.huiju.estateagents.sample.entity.TaH5Sample;
12
+import com.huiju.estateagents.sample.entity.TaSampleContact;
10 13
 import com.huiju.estateagents.sample.service.ITaH5SampleService;
14
+import com.huiju.estateagents.sample.service.ITaSampleContactService;
11 15
 import org.slf4j.Logger;
12 16
 import org.slf4j.LoggerFactory;
13 17
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +23,9 @@ import org.springframework.web.bind.annotation.RequestParam;
19 23
 import org.springframework.web.bind.annotation.ResponseBody;
20 24
 import org.springframework.web.bind.annotation.RestController;
21 25
 
26
+import java.time.LocalDateTime;
27
+import java.util.List;
28
+
22 29
 /**
23 30
  * <p>
24 31
     * 样例表  前端控制器
@@ -36,6 +43,8 @@ public class TaH5SampleController extends BaseController {
36 43
     @Autowired
37 44
     public ITaH5SampleService iTaH5SampleService;
38 45
 
46
+    @Autowired
47
+    public ITaSampleContactService iTaSampleContactService;
39 48
 
40 49
     /**
41 50
      * 分页查询列表
@@ -43,20 +52,18 @@ public class TaH5SampleController extends BaseController {
43 52
      * @param pageSize
44 53
      * @return
45 54
      */
46
-    @RequestMapping(value="/admin/taH5Sample",method= RequestMethod.GET)
47
-    public ResponseBean taH5SampleList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
55
+    @RequestMapping(value="/channel/ListH5SampleByCondition",method= RequestMethod.GET)
56
+    public ResponseBean ListH5SampleByCondition(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
48 57
                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
49
-                                       @RequestParam(value ="sampleName", required = false) String sampleName,
50
-                                       @RequestParam(value ="tag", required = false) String tag){
58
+                                       String sampleName){
51 59
         ResponseBean responseBean = new ResponseBean();
52 60
         try {
53 61
             //使用分页插件
54 62
 		    IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
55 63
             QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.like(!StringUtils.isEmpty(sampleName), "sample_name", sampleName);
57
-            queryWrapper.like(!StringUtils.isEmpty(tag), "tag", tag);
58
-            queryWrapper.orderByDesc("order_no");
59
-            queryWrapper.orderByDesc("create_date");
64
+            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
65
+            queryWrapper.ne("status", CommConstant.STATUS_DELETE);
66
+            queryWrapper.orderByDesc("order_no","create_date");
60 67
 
61 68
             IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
62 69
             responseBean.addSuccess(result);
@@ -152,4 +159,65 @@ public class TaH5SampleController extends BaseController {
152 159
         }
153 160
         return responseBean;
154 161
     }
162
+
163
+
164
+    /**
165
+     * 分页查询列表
166
+     * @param pageNum
167
+     * @param pageSize
168
+     * @return
169
+     */
170
+    @RequestMapping(value="/channel/h5Sample/list",method= RequestMethod.GET)
171
+    public ResponseBean geth5SampleList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
172
+                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
173
+                                        String sampleName){
174
+        ResponseBean responseBean = new ResponseBean();
175
+        try {
176
+            //使用分页插件
177
+            IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
178
+            QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
179
+            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
180
+            queryWrapper.orderByDesc("order_no","create_date");
181
+
182
+            IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
183
+            responseBean.addSuccess(result);
184
+        }catch (Exception e){
185
+            e.printStackTrace();
186
+            logger.error("taH5SampleList -=- {}",e.toString());
187
+            responseBean.addError(e.getMessage());
188
+        }
189
+        return responseBean;
190
+    }
191
+
192
+    /**
193
+     * 保存对象
194
+     * @param taH5Sample 实体对象
195
+     * @return
196
+     */
197
+    @RequestMapping(value="/channel/h5Sample/add",method= RequestMethod.POST)
198
+    public ResponseBean AddTaH5Sample(@RequestBody TaH5Sample taH5Sample){
199
+        ResponseBean responseBean = new ResponseBean();
200
+        try {
201
+            List<String> tags = taH5Sample.getTags();
202
+            taH5Sample.setTag(String.join(",",tags));
203
+            taH5Sample.setCreateDate(LocalDateTime.now());
204
+            if (iTaH5SampleService.save(taH5Sample)){
205
+                List<TaContact> taContactList = taH5Sample.getTaContactList();
206
+                taContactList.forEach(e -> {
207
+                    TaSampleContact taSampleContact = new TaSampleContact();
208
+                    taSampleContact.setContactId(e.getContactId());
209
+                    taSampleContact.setSampleId(taH5Sample.getSampleId());
210
+                    iTaSampleContactService.save(taSampleContact);
211
+                });
212
+                responseBean.addSuccess(taH5Sample);
213
+            }else {
214
+                responseBean.addError("fail");
215
+            }
216
+        }catch (Exception e){
217
+            e.printStackTrace();
218
+            logger.error("taH5SampleAdd -=- {}",e.toString());
219
+            responseBean.addError(e.getMessage());
220
+        }
221
+        return responseBean;
222
+    }
155 223
 }

+ 79
- 46
src/main/java/com/huiju/estateagents/sample/controller/TaNoticeController.java 查看文件

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.sample.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -18,16 +19,20 @@ import org.springframework.web.bind.annotation.RequestParam;
18 19
 import org.springframework.web.bind.annotation.ResponseBody;
19 20
 import org.springframework.web.bind.annotation.RestController;
20 21
 
22
+import javax.servlet.http.HttpServletRequest;
23
+import java.time.LocalDateTime;
24
+import java.util.List;
25
+
21 26
 /**
22 27
  * <p>
23
-    * 开屏通知  前端控制器
24
-    * </p>
28
+ * 开屏通知  前端控制器
29
+ * </p>
25 30
  *
26 31
  * @author fxf
27 32
  * @since 2020-03-18
28 33
  */
29 34
 @RestController
30
-@RequestMapping("/")
35
+@RequestMapping("/api")
31 36
 public class TaNoticeController extends BaseController {
32 37
 
33 38
     private final Logger logger = LoggerFactory.getLogger(TaNoticeController.class);
@@ -35,28 +40,30 @@ public class TaNoticeController extends BaseController {
35 40
     @Autowired
36 41
     public ITaNoticeService iTaNoticeService;
37 42
 
38
-
39 43
     /**
40
-     * 分页查询列表
44
+     * 条件查询通知列表
45
+     *
41 46
      * @param pageNum
42 47
      * @param pageSize
48
+     * @param title
49
+     * @param targetType
50
+     * @param targetName
51
+     * @param status
52
+     * @param type       类型
43 53
      * @return
44 54
      */
45
-    @RequestMapping(value="/taNotice",method= RequestMethod.GET)
46
-    public ResponseBean taNoticeList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
-                                     @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
55
+    @RequestMapping(value = "/channel/listNoticeByCondition", method = RequestMethod.GET)
56
+    public ResponseBean listNoticeByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
57
+                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
58
+                                              String title, String targetType, String targetName, Integer status,
59
+                                              String type) {
48 60
         ResponseBean responseBean = new ResponseBean();
49 61
         try {
50
-            //使用分页插件
51
-		    IPage<TaNotice> pg = new Page<>(pageNum, pageSize);
52
-            QueryWrapper<TaNotice> queryWrapper = new QueryWrapper<>();
53
-            queryWrapper.orderByDesc("create_date");
54
-
55
-            IPage<TaNotice> result = iTaNoticeService.page(pg, queryWrapper);
56
-            responseBean.addSuccess(result);
57
-        }catch (Exception e){
62
+            responseBean = iTaNoticeService.listNoticeByCondition(pageNum, pageSize, title, targetType, targetName, status, type);
63
+            logger.info("TaNoticeController.listNoticeByCondition 返回结果:" + JSONObject.toJSONString(responseBean));
64
+        } catch (Exception e) {
58 65
             e.printStackTrace();
59
-            logger.error("taNoticeList -=- {}",e.toString());
66
+            logger.error("taNoticeList -=- {}", e.toString());
60 67
             responseBean.addError(e.getMessage());
61 68
         }
62 69
         return responseBean;
@@ -64,43 +71,43 @@ public class TaNoticeController extends BaseController {
64 71
 
65 72
     /**
66 73
      * 保存对象
74
+     *
67 75
      * @param taNotice 实体对象
68 76
      * @return
69 77
      */
70
-    @RequestMapping(value="/taNotice",method= RequestMethod.POST)
71
-    public ResponseBean taNoticeAdd(@RequestBody TaNotice taNotice){
78
+    @RequestMapping(value = "/channel/taNotice", method = RequestMethod.POST)
79
+    public ResponseBean taNoticeAdd(@RequestBody TaNotice taNotice) {
72 80
         ResponseBean responseBean = new ResponseBean();
73 81
         try {
74
-            if (iTaNoticeService.save(taNotice)){
82
+            taNotice.setCreateDate(LocalDateTime.now());
83
+            if (iTaNoticeService.save(taNotice)) {
75 84
                 responseBean.addSuccess(taNotice);
76
-            }else {
85
+            } else {
77 86
                 responseBean.addError("fail");
78 87
             }
79
-        }catch (Exception e){
88
+        } catch (Exception e) {
80 89
             e.printStackTrace();
81
-            logger.error("taNoticeAdd -=- {}",e.toString());
90
+            logger.error("taNoticeAdd -=- {}", e.toString());
82 91
             responseBean.addError(e.getMessage());
83 92
         }
84 93
         return responseBean;
85 94
     }
86 95
 
87 96
     /**
88
-     * 根据id删除对象
89
-     * @param id  实体ID
97
+     * 批量删除开屏通知
98
+     *
99
+     * @param taNoticeList
90 100
      */
91 101
     @ResponseBody
92
-    @RequestMapping(value="/taNotice/{id}", method= RequestMethod.DELETE)
93
-    public ResponseBean taNoticeDelete(@PathVariable Integer id){
102
+    @RequestMapping(value = "/channel/taNotice/batchDelete", method = RequestMethod.PUT)
103
+    public ResponseBean batchDelete(@RequestBody List<TaNotice> taNoticeList) {
94 104
         ResponseBean responseBean = new ResponseBean();
95 105
         try {
96
-            if(iTaNoticeService.removeById(id)){
97
-                responseBean.addSuccess("success");
98
-            }else {
99
-                responseBean.addError("fail");
100
-            }
101
-        }catch (Exception e){
106
+            responseBean = iTaNoticeService.batchDelete(taNoticeList);
107
+            logger.info("TaNoticeController.taNoticeDelete 返回结果:" + JSONObject.toJSONString(responseBean));
108
+        } catch (Exception e) {
102 109
             e.printStackTrace();
103
-            logger.error("taNoticeDelete -=- {}",e.toString());
110
+            logger.error("taNoticeDelete -=- {}", e.toString());
104 111
             responseBean.addError(e.getMessage());
105 112
         }
106 113
         return responseBean;
@@ -108,23 +115,24 @@ public class TaNoticeController extends BaseController {
108 115
 
109 116
     /**
110 117
      * 修改对象
111
-     * @param id  实体ID
118
+     *
119
+     * @param id       实体ID
112 120
      * @param taNotice 实体对象
113 121
      * @return
114 122
      */
115
-    @RequestMapping(value="/taNotice/{id}",method= RequestMethod.PUT)
123
+    @RequestMapping(value = "/channel/taNotice/{id}", method = RequestMethod.PUT)
116 124
     public ResponseBean taNoticeUpdate(@PathVariable Integer id,
117
-                                        @RequestBody TaNotice taNotice){
125
+                                       @RequestBody TaNotice taNotice) {
118 126
         ResponseBean responseBean = new ResponseBean();
119 127
         try {
120
-            if (iTaNoticeService.updateById(taNotice)){
128
+            if (iTaNoticeService.updateById(taNotice)) {
121 129
                 responseBean.addSuccess(taNotice);
122
-            }else {
130
+            } else {
123 131
                 responseBean.addError("fail");
124 132
             }
125
-        }catch (Exception e){
133
+        } catch (Exception e) {
126 134
             e.printStackTrace();
127
-            logger.error("taNoticeUpdate -=- {}",e.toString());
135
+            logger.error("taNoticeUpdate -=- {}", e.toString());
128 136
             responseBean.addError(e.getMessage());
129 137
         }
130 138
         return responseBean;
@@ -132,16 +140,41 @@ public class TaNoticeController extends BaseController {
132 140
 
133 141
     /**
134 142
      * 根据id查询对象
135
-     * @param id  实体ID
143
+     *
144
+     * @param id 实体ID
136 145
      */
137
-    @RequestMapping(value="/taNotice/{id}",method= RequestMethod.GET)
138
-    public ResponseBean taNoticeGet(@PathVariable Integer id){
146
+    @RequestMapping(value = "/channel/taNotice/{id}", method = RequestMethod.GET)
147
+    public ResponseBean taNoticeGet(@PathVariable Integer id) {
139 148
         ResponseBean responseBean = new ResponseBean();
140 149
         try {
141 150
             responseBean.addSuccess(iTaNoticeService.getById(id));
142
-        }catch (Exception e){
151
+        } catch (Exception e) {
152
+            e.printStackTrace();
153
+            logger.error("taNoticeDelete -=- {}", e.toString());
154
+            responseBean.addError(e.getMessage());
155
+        }
156
+        return responseBean;
157
+    }
158
+
159
+    /**
160
+     * 条件查询通知列表-admin
161
+     *
162
+     * @param pageNum
163
+     * @param pageSize
164
+     * @param type       类型 目前默认 sample
165
+     * @return
166
+     */
167
+    @RequestMapping(value = "/admin/listNoticeByCondition", method = RequestMethod.GET)
168
+    public ResponseBean listNoticeByConditionForAdmin(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
169
+                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
170
+                                              String type) {
171
+        ResponseBean responseBean = new ResponseBean();
172
+        try {
173
+            responseBean = iTaNoticeService.listNoticeByConditionForAdmin(pageNum, pageSize, type);
174
+            logger.info("TaNoticeController.listNoticeByConditionForAdmin 返回结果:" + JSONObject.toJSONString(responseBean));
175
+        } catch (Exception e) {
143 176
             e.printStackTrace();
144
-            logger.error("taNoticeDelete -=- {}",e.toString());
177
+            logger.error("listNoticeByConditionForAdmin -=- {}", e);
145 178
             responseBean.addError(e.getMessage());
146 179
         }
147 180
         return responseBean;

+ 19
- 0
src/main/java/com/huiju/estateagents/sample/entity/TaH5Sample.java 查看文件

@@ -1,9 +1,13 @@
1 1
 package com.huiju.estateagents.sample.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import java.time.LocalDateTime;
6 7
 import java.io.Serializable;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+
7 11
 import lombok.Data;
8 12
 import lombok.EqualsAndHashCode;
9 13
 import lombok.experimental.Accessors;
@@ -79,5 +83,20 @@ public class TaH5Sample implements Serializable {
79 83
      */
80 84
     private String sampleContent;
81 85
 
86
+    /**
87
+     * 样例链接
88
+     */
89
+    private String sampleContentLink;
90
+
91
+    /**
92
+     * 标签集合
93
+     */
94
+    @TableField(exist = false)
95
+    private List<String> tags = new ArrayList<>();
82 96
 
97
+    /**
98
+     * 标签集合
99
+     */
100
+    @TableField(exist = false)
101
+    private List<TaContact> taContactList = new ArrayList<>();
83 102
 }

+ 10
- 1
src/main/java/com/huiju/estateagents/sample/entity/TaNotice.java 查看文件

@@ -1,16 +1,19 @@
1 1
 package com.huiju.estateagents.sample.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
6
+
5 7
 import java.time.LocalDateTime;
6 8
 import java.io.Serializable;
9
+
7 10
 import lombok.Data;
8 11
 import lombok.EqualsAndHashCode;
9 12
 import lombok.experimental.Accessors;
10 13
 
11 14
 /**
12 15
  * <p>
13
- * 开屏通知 
16
+ * 开屏通知
14 17
  * </p>
15 18
  *
16 19
  * @author fxf
@@ -49,6 +52,12 @@ public class TaNotice implements Serializable {
49 52
      */
50 53
     private Integer targetId;
51 54
 
55
+    /**
56
+     * 关联业务名
57
+     */
58
+    @TableField(exist = false)
59
+    private String targetName;
60
+
52 61
     /**
53 62
      * 状态 -1删除0是未发布1是已发布
54 63
      */

+ 24
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaNoticeMapper.java 查看文件

@@ -1,8 +1,13 @@
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.TaNotice;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+import org.springframework.stereotype.Component;
9
+
10
+import java.util.List;
6 11
 
7 12
 /**
8 13
  * <p>
@@ -13,6 +18,25 @@ import org.apache.ibatis.annotations.Mapper;
13 18
  * @since 2020-03-18
14 19
  */
15 20
 @Mapper
21
+@Component
16 22
 public interface TaNoticeMapper extends BaseMapper<TaNotice> {
17 23
 
24
+    /**
25
+     * 条件查询开屏通知
26
+     *
27
+     * @param pg
28
+     * @param title
29
+     * @param targetType
30
+     * @param targetName
31
+     * @param status
32
+     * @return
33
+     */
34
+    IPage<TaNotice> listNoticeByCondition(IPage<TaNotice> pg, @Param("title") String title,
35
+                                          @Param("targetType") String targetType,
36
+                                          @Param("targetName") String targetName,
37
+                                          @Param("status") Integer status,
38
+                                          @Param("type") String type);
39
+
40
+    IPage<TaNotice> listNoticeByConditionForAdmin(IPage<TaNotice> pg,
41
+                                          @Param("type") String type);
18 42
 }

+ 28
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaNoticeService.java 查看文件

@@ -1,7 +1,11 @@
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.TaNotice;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
5 9
 
6 10
 /**
7 11
  * <p>
@@ -13,4 +17,28 @@ import com.huiju.estateagents.sample.entity.TaNotice;
13 17
  */
14 18
 public interface ITaNoticeService extends IService<TaNotice> {
15 19
 
20
+    /**
21
+     * 条件查询开屏通知列表
22
+     *
23
+     * @param pageNum
24
+     * @param pageSize
25
+     * @param title
26
+     * @param targetType
27
+     * @param targetName
28
+     * @param status
29
+     * @param type
30
+     * @return
31
+     */
32
+    ResponseBean listNoticeByCondition(Integer pageNum, Integer pageSize, String title, String targetType, String targetName,
33
+                                       Integer status, String type);
34
+
35
+    ResponseBean listNoticeByConditionForAdmin(Integer pageNum, Integer pageSize, String type);
36
+
37
+    /**
38
+     * 批量删除
39
+     *
40
+     * @param taNoticeList
41
+     * @return
42
+     */
43
+    ResponseBean batchDelete(List<TaNotice> taNoticeList);
16 44
 }

+ 58
- 0
src/main/java/com/huiju/estateagents/sample/service/impl/TaNoticeServiceImpl.java 查看文件

@@ -1,11 +1,21 @@
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;
4 9
 import com.huiju.estateagents.sample.entity.TaNotice;
5 10
 import com.huiju.estateagents.sample.mapper.TaNoticeMapper;
6 11
 import com.huiju.estateagents.sample.service.ITaNoticeService;
12
+import lombok.extern.slf4j.Slf4j;
13
+import org.springframework.beans.factory.annotation.Autowired;
7 14
 import org.springframework.stereotype.Service;
8 15
 
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
9 19
 /**
10 20
  * <p>
11 21
  * 开屏通知  服务实现类
@@ -14,7 +24,55 @@ import org.springframework.stereotype.Service;
14 24
  * @author fxf
15 25
  * @since 2020-03-18
16 26
  */
27
+@Slf4j
17 28
 @Service
18 29
 public class TaNoticeServiceImpl extends ServiceImpl<TaNoticeMapper, TaNotice> implements ITaNoticeService {
19 30
 
31
+    @Autowired
32
+    private TaNoticeMapper taNoticeMapper;
33
+
34
+    @Override
35
+    public ResponseBean listNoticeByCondition(Integer pageNum, Integer pageSize, String title, String targetType, String targetName, Integer status, String type) {
36
+        log.info("TaNoticeServiceImpl.listNoticeByCondition 接收参数:pageNum:{},pageSize:{},title:{},targetType:{},targetName:{},status:{},type:{}",
37
+                pageNum, pageSize, title, targetType, targetName, status, type);
38
+
39
+        ResponseBean responseBean = new ResponseBean();
40
+
41
+        //使用分页插件
42
+        IPage<TaNotice> pg = new Page<>(pageNum, pageSize);
43
+        pg = taNoticeMapper.listNoticeByCondition(pg, title, targetType, targetName, status, type);
44
+        responseBean.addSuccess(pg);
45
+        return responseBean;
46
+    }
47
+
48
+    @Override
49
+    public ResponseBean listNoticeByConditionForAdmin(Integer pageNum, Integer pageSize, String type) {
50
+        log.info("TaNoticeServiceImpl.listNoticeByConditionForAdmin 接收参数:pageNum:{},pageSize:{},type:{}",
51
+                pageNum, pageSize, type);
52
+
53
+        ResponseBean responseBean = new ResponseBean();
54
+
55
+        //使用分页插件
56
+        IPage<TaNotice> pg = new Page<>(pageNum, pageSize);
57
+        pg = taNoticeMapper.listNoticeByConditionForAdmin(pg, type);
58
+        responseBean.addSuccess(pg);
59
+        return responseBean;
60
+    }
61
+
62
+    @Override
63
+    public ResponseBean batchDelete(List<TaNotice> taNoticeList) {
64
+        ResponseBean responseBean = new ResponseBean();
65
+
66
+        List<TaNotice> updateList = new ArrayList<>();
67
+        TaNotice newNotice;
68
+        for (TaNotice taNotice : taNoticeList) {
69
+            newNotice = new TaNotice();
70
+            newNotice.setNoticeId(taNotice.getNoticeId());
71
+            newNotice.setStatus(CommConstant.STATUS_DELETE);
72
+            updateList.add(newNotice);
73
+        }
74
+
75
+        responseBean.addSuccess(updateBatchById(updateList));
76
+        return responseBean;
77
+    }
20 78
 }

+ 38
- 0
src/main/resources/mapper/sample/TaNoticeMapper.xml 查看文件

@@ -2,4 +2,42 @@
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.TaNoticeMapper">
4 4
 
5
+    <select id="listNoticeByCondition" resultType="com.huiju.estateagents.sample.entity.TaNotice">
6
+        SELECT
7
+            t.*,
8
+            t2.sample_name targetName
9
+        FROM
10
+            ta_notice t
11
+            LEFT JOIN ta_h5_sample t2 ON t.target_id = t2.sample_id
12
+        where
13
+            t.`status` != -1
14
+            <if test="title != null and title != ''">
15
+                t.title like CONCAT('%',#{title}, '%')
16
+            </if>
17
+            <if test="targetName != null and targetName != ''">
18
+                AND t2.sample_name like CONCAT('%',#{targetName}, '%')
19
+            </if>
20
+            <if test="targetType != null and targetType != ''">
21
+                AND t.target_type = #{targetType}
22
+            </if>
23
+            <if test="status != null">
24
+                AND t.`status` = #{status}
25
+            </if>
26
+        ORDER BY
27
+            t.order_no DESC,t.create_date DESC
28
+    </select>
29
+
30
+    <select id="listNoticeByConditionForAdmin" resultType="com.huiju.estateagents.sample.entity.TaNotice">
31
+        SELECT
32
+            t.*,
33
+            t2.sample_name targetName
34
+        FROM
35
+            ta_notice t
36
+            LEFT JOIN ta_h5_sample t2 ON t.target_id = t2.sample_id
37
+        where
38
+            t.`status` == 1
39
+            AND t.invalid_time &gt;= NOW( )
40
+        ORDER BY
41
+            t.order_no DESC,t.create_date DESC
42
+    </select>
5 43
 </mapper>