顾绍勇 5 anni fa
parent
commit
b71898871d

+ 1
- 8
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java Vedi File

@@ -12,13 +12,7 @@ import com.huiju.estateagents.sample.service.ITaContactService;
12 12
 import org.slf4j.Logger;
13 13
 import org.slf4j.LoggerFactory;
14 14
 import org.springframework.beans.factory.annotation.Autowired;
15
-import org.springframework.web.bind.annotation.PathVariable;
16
-import org.springframework.web.bind.annotation.RequestBody;
17
-import org.springframework.web.bind.annotation.RequestMapping;
18
-import org.springframework.web.bind.annotation.RequestMethod;
19
-import org.springframework.web.bind.annotation.RequestParam;
20
-import org.springframework.web.bind.annotation.ResponseBody;
21
-import org.springframework.web.bind.annotation.RestController;
15
+import org.springframework.web.bind.annotation.*;
22 16
 
23 17
 import java.time.LocalDateTime;
24 18
 import java.util.ArrayList;
@@ -122,7 +116,6 @@ public class TaContactController extends BaseController {
122 116
                 newContact.setStatus(CommConstant.STATUS_DELETE);
123 117
                 updateList.add(newContact);
124 118
             }
125
-
126 119
             responseBean.addSuccess(iTaContactService.updateBatchById(updateList));
127 120
         } catch (Exception e) {
128 121
             e.printStackTrace();

+ 22
- 16
src/main/java/com/huiju/estateagents/sample/controller/TaNoticeController.java Vedi File

@@ -1,25 +1,17 @@
1 1
 package com.huiju.estateagents.sample.controller;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.baomidou.mybatisplus.core.metadata.IPage;
6
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 4
 import com.huiju.estateagents.base.BaseController;
8 5
 import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.sample.entity.TaH5Sample;
9 7
 import com.huiju.estateagents.sample.entity.TaNotice;
8
+import com.huiju.estateagents.sample.service.ITaH5SampleService;
10 9
 import com.huiju.estateagents.sample.service.ITaNoticeService;
11 10
 import org.slf4j.Logger;
12 11
 import org.slf4j.LoggerFactory;
13 12
 import org.springframework.beans.factory.annotation.Autowired;
14
-import org.springframework.web.bind.annotation.PathVariable;
15
-import org.springframework.web.bind.annotation.RequestBody;
16
-import org.springframework.web.bind.annotation.RequestMapping;
17
-import org.springframework.web.bind.annotation.RequestMethod;
18
-import org.springframework.web.bind.annotation.RequestParam;
19
-import org.springframework.web.bind.annotation.ResponseBody;
20
-import org.springframework.web.bind.annotation.RestController;
13
+import org.springframework.web.bind.annotation.*;
21 14
 
22
-import javax.servlet.http.HttpServletRequest;
23 15
 import java.time.LocalDateTime;
24 16
 import java.util.List;
25 17
 
@@ -40,6 +32,9 @@ public class TaNoticeController extends BaseController {
40 32
     @Autowired
41 33
     public ITaNoticeService iTaNoticeService;
42 34
 
35
+    @Autowired
36
+    public ITaH5SampleService iTaH5SampleService;
37
+
43 38
     /**
44 39
      * 条件查询通知列表
45 40
      *
@@ -49,7 +44,7 @@ public class TaNoticeController extends BaseController {
49 44
      * @param targetType
50 45
      * @param targetName
51 46
      * @param status
52
-     * @param type       类型
47
+     * @param type       类型 目前默认 sample
53 48
      * @return
54 49
      */
55 50
     @RequestMapping(value = "/channel/listNoticeByCondition", method = RequestMethod.GET)
@@ -147,7 +142,18 @@ public class TaNoticeController extends BaseController {
147 142
     public ResponseBean taNoticeGet(@PathVariable Integer id) {
148 143
         ResponseBean responseBean = new ResponseBean();
149 144
         try {
150
-            responseBean.addSuccess(iTaNoticeService.getById(id));
145
+            TaNotice taNotice = iTaNoticeService.getById(id);
146
+            if (taNotice == null) {
147
+                responseBean.addError("fail");
148
+                return responseBean;
149
+            }
150
+            if (taNotice.getTargetId() != null) {
151
+                TaH5Sample taH5Sample = iTaH5SampleService.getById(taNotice.getNoticeId());
152
+                if(taH5Sample != null){
153
+                    taNotice.setTargetName(taH5Sample.getSampleName());
154
+                }
155
+            }
156
+            responseBean.addSuccess(taNotice);
151 157
         } catch (Exception e) {
152 158
             e.printStackTrace();
153 159
             logger.error("taNoticeDelete -=- {}", e.toString());
@@ -161,13 +167,13 @@ public class TaNoticeController extends BaseController {
161 167
      *
162 168
      * @param pageNum
163 169
      * @param pageSize
164
-     * @param type       类型 目前默认 sample
170
+     * @param type     类型 目前默认 sample
165 171
      * @return
166 172
      */
167 173
     @RequestMapping(value = "/admin/listNoticeByCondition", method = RequestMethod.GET)
168 174
     public ResponseBean listNoticeByConditionForAdmin(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
169
-                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
170
-                                              String type) {
175
+                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
176
+                                                      String type) {
171 177
         ResponseBean responseBean = new ResponseBean();
172 178
         try {
173 179
             responseBean = iTaNoticeService.listNoticeByConditionForAdmin(pageNum, pageSize, type);

+ 5
- 4
src/main/resources/mapper/sample/TaNoticeMapper.xml Vedi File

@@ -34,10 +34,11 @@
34 34
         FROM
35 35
             ta_notice t
36 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 >= NOW( )
37
+        WHERE
38
+            t.`status` = 1
39
+            AND t.invalid_time >= NOW( )
40 40
         ORDER BY
41
-            t.order_no DESC,t.create_date DESC
41
+            t.order_no DESC,
42
+            t.create_date DESC
42 43
     </select>
43 44
 </mapper>