浏览代码

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/TaH5SampleController.java
傅行帆 5 年前
父节点
当前提交
044ca88969

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

20
 import org.springframework.web.bind.annotation.ResponseBody;
20
 import org.springframework.web.bind.annotation.ResponseBody;
21
 import org.springframework.web.bind.annotation.RestController;
21
 import org.springframework.web.bind.annotation.RestController;
22
 
22
 
23
+import java.time.LocalDateTime;
24
+import java.util.ArrayList;
25
+import java.util.List;
26
+
23
 
27
 
24
 /**
28
 /**
25
  * <p>
29
  * <p>
26
-    * 联系人表  前端控制器
27
-    * </p>
30
+ * 联系人表  前端控制器
31
+ * </p>
28
  *
32
  *
29
  * @author fxf
33
  * @author fxf
30
  * @since 2020-03-18
34
  * @since 2020-03-18
40
 
44
 
41
 
45
 
42
     /**
46
     /**
43
-     * 分页查询列表
47
+     * 条件查询联系人列表
48
+     *
44
      * @param pageNum
49
      * @param pageNum
45
      * @param pageSize
50
      * @param pageSize
51
+     * @param contactName
52
+     * @param telephone
53
+     * @param phone
54
+     * @param job
46
      * @return
55
      * @return
47
      */
56
      */
48
-    @RequestMapping(value="/taContact",method= RequestMethod.GET)
49
-    public ResponseBean taContactList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
50
-                                      @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) {
51
         ResponseBean responseBean = new ResponseBean();
61
         ResponseBean responseBean = new ResponseBean();
52
         try {
62
         try {
53
             //使用分页插件
63
             //使用分页插件
54
-		    IPage<TaContact> pg = new Page<>(pageNum, pageSize);
64
+            IPage<TaContact> pg = new Page<>(pageNum, pageSize);
55
             QueryWrapper<TaContact> queryWrapper = new QueryWrapper<>();
65
             QueryWrapper<TaContact> queryWrapper = new QueryWrapper<>();
56
-            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");
57
 
72
 
58
             IPage<TaContact> result = iTaContactService.page(pg, queryWrapper);
73
             IPage<TaContact> result = iTaContactService.page(pg, queryWrapper);
59
             responseBean.addSuccess(result);
74
             responseBean.addSuccess(result);
60
-        }catch (Exception e){
75
+        } catch (Exception e) {
61
             e.printStackTrace();
76
             e.printStackTrace();
62
-            logger.error("taContactList -=- {}",e.toString());
77
+            logger.error("taContactList -=- {}", e.toString());
63
             responseBean.addError(e.getMessage());
78
             responseBean.addError(e.getMessage());
64
         }
79
         }
65
         return responseBean;
80
         return responseBean;
67
 
82
 
68
     /**
83
     /**
69
      * 保存对象
84
      * 保存对象
85
+     *
70
      * @param taContact 实体对象
86
      * @param taContact 实体对象
71
      * @return
87
      * @return
72
      */
88
      */
73
-    @RequestMapping(value="/taContact",method= RequestMethod.POST)
74
-    public ResponseBean taContactAdd(@RequestBody TaContact taContact){
89
+    @RequestMapping(value = "/channel/taContact", method = RequestMethod.POST)
90
+    public ResponseBean taContactAdd(@RequestBody TaContact taContact) {
75
         ResponseBean responseBean = new ResponseBean();
91
         ResponseBean responseBean = new ResponseBean();
76
         try {
92
         try {
77
-            if (iTaContactService.save(taContact)){
93
+            taContact.setCreateDate(LocalDateTime.now());
94
+            taContact.setStatus(CommConstant.STATUS_NORMAL);
95
+            if (iTaContactService.save(taContact)) {
78
                 responseBean.addSuccess(taContact);
96
                 responseBean.addSuccess(taContact);
79
-            }else {
97
+            } else {
80
                 responseBean.addError("fail");
98
                 responseBean.addError("fail");
81
             }
99
             }
82
-        }catch (Exception e){
100
+        } catch (Exception e) {
83
             e.printStackTrace();
101
             e.printStackTrace();
84
-            logger.error("taContactAdd -=- {}",e.toString());
102
+            logger.error("taContactAdd -=- {}", e.toString());
85
             responseBean.addError(e.getMessage());
103
             responseBean.addError(e.getMessage());
86
         }
104
         }
87
         return responseBean;
105
         return responseBean;
88
     }
106
     }
89
 
107
 
90
     /**
108
     /**
91
-     * 根据id删除对象
92
-     * @param id  实体ID
109
+     * 批量删除
110
+     *
93
      */
111
      */
94
     @ResponseBody
112
     @ResponseBody
95
-    @RequestMapping(value="/taContact/{id}", method= RequestMethod.DELETE)
96
-    public ResponseBean taContactDelete(@PathVariable Integer id){
113
+    @RequestMapping(value = "/channel/taContact/batchDelete", method = RequestMethod.PUT)
114
+    public ResponseBean batchDelete(@RequestBody List<TaContact> taContactList) {
97
         ResponseBean responseBean = new ResponseBean();
115
         ResponseBean responseBean = new ResponseBean();
98
         try {
116
         try {
99
-            if(iTaContactService.removeById(id)){
100
-                responseBean.addSuccess("success");
101
-            }else {
102
-                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);
103
             }
124
             }
104
-        }catch (Exception e){
125
+
126
+            responseBean.addSuccess(iTaContactService.updateBatchById(updateList));
127
+        } catch (Exception e) {
105
             e.printStackTrace();
128
             e.printStackTrace();
106
-            logger.error("taContactDelete -=- {}",e.toString());
129
+            logger.error("taContactDelete -=- {}", e.toString());
107
             responseBean.addError(e.getMessage());
130
             responseBean.addError(e.getMessage());
108
         }
131
         }
109
         return responseBean;
132
         return responseBean;
111
 
134
 
112
     /**
135
     /**
113
      * 修改对象
136
      * 修改对象
114
-     * @param id  实体ID
137
+     *
138
+     * @param id        实体ID
115
      * @param taContact 实体对象
139
      * @param taContact 实体对象
116
      * @return
140
      * @return
117
      */
141
      */
118
-    @RequestMapping(value="/taContact/{id}",method= RequestMethod.PUT)
142
+    @RequestMapping(value = "/channel/taContact/{id}", method = RequestMethod.PUT)
119
     public ResponseBean taContactUpdate(@PathVariable Integer id,
143
     public ResponseBean taContactUpdate(@PathVariable Integer id,
120
-                                        @RequestBody TaContact taContact){
144
+                                        @RequestBody TaContact taContact) {
121
         ResponseBean responseBean = new ResponseBean();
145
         ResponseBean responseBean = new ResponseBean();
122
         try {
146
         try {
123
-            if (iTaContactService.updateById(taContact)){
147
+            if (iTaContactService.updateById(taContact)) {
124
                 responseBean.addSuccess(taContact);
148
                 responseBean.addSuccess(taContact);
125
-            }else {
149
+            } else {
126
                 responseBean.addError("fail");
150
                 responseBean.addError("fail");
127
             }
151
             }
128
-        }catch (Exception e){
152
+        } catch (Exception e) {
129
             e.printStackTrace();
153
             e.printStackTrace();
130
-            logger.error("taContactUpdate -=- {}",e.toString());
154
+            logger.error("taContactUpdate -=- {}", e.toString());
131
             responseBean.addError(e.getMessage());
155
             responseBean.addError(e.getMessage());
132
         }
156
         }
133
         return responseBean;
157
         return responseBean;
135
 
159
 
136
     /**
160
     /**
137
      * 根据id查询对象
161
      * 根据id查询对象
138
-     * @param id  实体ID
162
+     *
163
+     * @param id 实体ID
139
      */
164
      */
140
-    @RequestMapping(value="/taContact/{id}",method= RequestMethod.GET)
141
-    public ResponseBean taContactGet(@PathVariable Integer id){
165
+    @RequestMapping(value = "/channel/taContact/{id}", method = RequestMethod.GET)
166
+    public ResponseBean taContactGet(@PathVariable Integer id) {
142
         ResponseBean responseBean = new ResponseBean();
167
         ResponseBean responseBean = new ResponseBean();
143
         try {
168
         try {
144
             responseBean.addSuccess(iTaContactService.getById(id));
169
             responseBean.addSuccess(iTaContactService.getById(id));
145
-        }catch (Exception e){
170
+        } catch (Exception e) {
146
             e.printStackTrace();
171
             e.printStackTrace();
147
-            logger.error("taContactDelete -=- {}",e.toString());
172
+            logger.error("taContactDelete -=- {}", e.toString());
148
             responseBean.addError(e.getMessage());
173
             responseBean.addError(e.getMessage());
149
         }
174
         }
150
         return responseBean;
175
         return responseBean;

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

7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.common.StringUtils;
8
 import com.huiju.estateagents.common.StringUtils;
9
 import com.huiju.estateagents.sample.entity.TaContact;
9
 import com.huiju.estateagents.sample.entity.TaContact;
10
+import com.huiju.estateagents.common.CommConstant;
10
 import com.huiju.estateagents.sample.entity.TaH5Sample;
11
 import com.huiju.estateagents.sample.entity.TaH5Sample;
11
 import com.huiju.estateagents.sample.entity.TaSampleContact;
12
 import com.huiju.estateagents.sample.entity.TaSampleContact;
12
-import com.huiju.estateagents.sample.service.ITaContactService;
13
 import com.huiju.estateagents.sample.service.ITaH5SampleService;
13
 import com.huiju.estateagents.sample.service.ITaH5SampleService;
14
 import com.huiju.estateagents.sample.service.ITaSampleContactService;
14
 import com.huiju.estateagents.sample.service.ITaSampleContactService;
15
 import org.slf4j.Logger;
15
 import org.slf4j.Logger;
52
      * @param pageSize
52
      * @param pageSize
53
      * @return
53
      * @return
54
      */
54
      */
55
-    @RequestMapping(value="/admin/ListH5SampleByCondition",method= RequestMethod.GET)
55
+    @RequestMapping(value="/channel/ListH5SampleByCondition",method= RequestMethod.GET)
56
     public ResponseBean ListH5SampleByCondition(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56
     public ResponseBean ListH5SampleByCondition(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
57
                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
57
                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
58
                                        String sampleName){
58
                                        String sampleName){
61
             //使用分页插件
61
             //使用分页插件
62
 		    IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
62
 		    IPage<TaH5Sample> pg = new Page<>(pageNum, pageSize);
63
             QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
63
             QueryWrapper<TaH5Sample> queryWrapper = new QueryWrapper<>();
64
-            queryWrapper.like("sample_name",sampleName);
64
+            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
65
+            queryWrapper.ne("status", CommConstant.STATUS_DELETE);
65
             queryWrapper.orderByDesc("order_no","create_date");
66
             queryWrapper.orderByDesc("order_no","create_date");
66
 
67
 
67
             IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);
68
             IPage<TaH5Sample> result = iTaH5SampleService.page(pg, queryWrapper);

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

20
 import org.springframework.web.bind.annotation.RestController;
20
 import org.springframework.web.bind.annotation.RestController;
21
 
21
 
22
 import javax.servlet.http.HttpServletRequest;
22
 import javax.servlet.http.HttpServletRequest;
23
+import java.time.LocalDateTime;
23
 import java.util.List;
24
 import java.util.List;
24
 
25
 
25
 /**
26
 /**
39
     @Autowired
40
     @Autowired
40
     public ITaNoticeService iTaNoticeService;
41
     public ITaNoticeService iTaNoticeService;
41
 
42
 
42
-
43
     /**
43
     /**
44
      * 条件查询通知列表
44
      * 条件查询通知列表
45
      *
45
      *
52
      * @param type       类型
52
      * @param type       类型
53
      * @return
53
      * @return
54
      */
54
      */
55
-    @RequestMapping(value = "/admin/listNoticeByCondition", method = RequestMethod.GET)
55
+    @RequestMapping(value = "/channel/listNoticeByCondition", method = RequestMethod.GET)
56
     public ResponseBean listNoticeByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
56
     public ResponseBean listNoticeByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
57
                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
57
                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
58
                                               String title, String targetType, String targetName, Integer status,
58
                                               String title, String targetType, String targetName, Integer status,
75
      * @param taNotice 实体对象
75
      * @param taNotice 实体对象
76
      * @return
76
      * @return
77
      */
77
      */
78
-    @RequestMapping(value = "/admin/taNotice", method = RequestMethod.POST)
78
+    @RequestMapping(value = "/channel/taNotice", method = RequestMethod.POST)
79
     public ResponseBean taNoticeAdd(@RequestBody TaNotice taNotice) {
79
     public ResponseBean taNoticeAdd(@RequestBody TaNotice taNotice) {
80
         ResponseBean responseBean = new ResponseBean();
80
         ResponseBean responseBean = new ResponseBean();
81
         try {
81
         try {
82
+            taNotice.setCreateDate(LocalDateTime.now());
82
             if (iTaNoticeService.save(taNotice)) {
83
             if (iTaNoticeService.save(taNotice)) {
83
                 responseBean.addSuccess(taNotice);
84
                 responseBean.addSuccess(taNotice);
84
             } else {
85
             } else {
98
      * @param taNoticeList
99
      * @param taNoticeList
99
      */
100
      */
100
     @ResponseBody
101
     @ResponseBody
101
-    @RequestMapping(value = "/admin/taNotice/batchDelete/{id}", method = RequestMethod.DELETE)
102
-    public ResponseBean batchDelete(List<TaNotice> taNoticeList) {
102
+    @RequestMapping(value = "/channel/taNotice/batchDelete", method = RequestMethod.PUT)
103
+    public ResponseBean batchDelete(@RequestBody List<TaNotice> taNoticeList) {
103
         ResponseBean responseBean = new ResponseBean();
104
         ResponseBean responseBean = new ResponseBean();
104
         try {
105
         try {
105
             responseBean = iTaNoticeService.batchDelete(taNoticeList);
106
             responseBean = iTaNoticeService.batchDelete(taNoticeList);
119
      * @param taNotice 实体对象
120
      * @param taNotice 实体对象
120
      * @return
121
      * @return
121
      */
122
      */
122
-    @RequestMapping(value = "/admin/taNotice/{id}", method = RequestMethod.PUT)
123
+    @RequestMapping(value = "/channel/taNotice/{id}", method = RequestMethod.PUT)
123
     public ResponseBean taNoticeUpdate(@PathVariable Integer id,
124
     public ResponseBean taNoticeUpdate(@PathVariable Integer id,
124
                                        @RequestBody TaNotice taNotice) {
125
                                        @RequestBody TaNotice taNotice) {
125
         ResponseBean responseBean = new ResponseBean();
126
         ResponseBean responseBean = new ResponseBean();
142
      *
143
      *
143
      * @param id 实体ID
144
      * @param id 实体ID
144
      */
145
      */
145
-    @RequestMapping(value = "/taNotice/{id}", method = RequestMethod.GET)
146
+    @RequestMapping(value = "/channel/taNotice/{id}", method = RequestMethod.GET)
146
     public ResponseBean taNoticeGet(@PathVariable Integer id) {
147
     public ResponseBean taNoticeGet(@PathVariable Integer id) {
147
         ResponseBean responseBean = new ResponseBean();
148
         ResponseBean responseBean = new ResponseBean();
148
         try {
149
         try {
154
         }
155
         }
155
         return responseBean;
156
         return responseBean;
156
     }
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) {
176
+            e.printStackTrace();
177
+            logger.error("listNoticeByConditionForAdmin -=- {}", e);
178
+            responseBean.addError(e.getMessage());
179
+        }
180
+        return responseBean;
181
+    }
157
 }
182
 }

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

36
                                           @Param("targetName") String targetName,
36
                                           @Param("targetName") String targetName,
37
                                           @Param("status") Integer status,
37
                                           @Param("status") Integer status,
38
                                           @Param("type") String type);
38
                                           @Param("type") String type);
39
+
40
+    IPage<TaNotice> listNoticeByConditionForAdmin(IPage<TaNotice> pg,
41
+                                          @Param("type") String type);
39
 }
42
 }

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

32
     ResponseBean listNoticeByCondition(Integer pageNum, Integer pageSize, String title, String targetType, String targetName,
32
     ResponseBean listNoticeByCondition(Integer pageNum, Integer pageSize, String title, String targetType, String targetName,
33
                                        Integer status, String type);
33
                                        Integer status, String type);
34
 
34
 
35
+    ResponseBean listNoticeByConditionForAdmin(Integer pageNum, Integer pageSize, String type);
36
+
35
     /**
37
     /**
36
      * 批量删除
38
      * 批量删除
37
      *
39
      *

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

45
         return responseBean;
45
         return responseBean;
46
     }
46
     }
47
 
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
+
48
     @Override
62
     @Override
49
     public ResponseBean batchDelete(List<TaNotice> taNoticeList) {
63
     public ResponseBean batchDelete(List<TaNotice> taNoticeList) {
50
         ResponseBean responseBean = new ResponseBean();
64
         ResponseBean responseBean = new ResponseBean();

+ 16
- 2
src/main/resources/mapper/sample/TaNoticeMapper.xml 查看文件

9
         FROM
9
         FROM
10
             ta_notice t
10
             ta_notice t
11
             LEFT JOIN ta_h5_sample t2 ON t.target_id = t2.sample_id
11
             LEFT JOIN ta_h5_sample t2 ON t.target_id = t2.sample_id
12
-        <where>
12
+        where
13
+            t.`status` != -1
13
             <if test="title != null and title != ''">
14
             <if test="title != null and title != ''">
14
                 t.title like CONCAT('%',#{title}, '%')
15
                 t.title like CONCAT('%',#{title}, '%')
15
             </if>
16
             </if>
22
             <if test="status != null">
23
             <if test="status != null">
23
                 AND t.`status` = #{status}
24
                 AND t.`status` = #{status}
24
             </if>
25
             </if>
25
-        </where>
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( )
26
         ORDER BY
40
         ORDER BY
27
             t.order_no DESC,t.create_date DESC
41
             t.order_no DESC,t.create_date DESC
28
     </select>
42
     </select>