Sfoglia il codice sorgente

Merge branch 'dev'

魏超 5 anni fa
parent
commit
41a11ebdf1
43 ha cambiato i file con 2578 aggiunte e 25 eliminazioni
  1. 10
    10
      pom.xml
  2. 30
    0
      src/main/java/com/huiju/estateagents/base/BaseController.java
  3. 3
    1
      src/main/java/com/huiju/estateagents/center/sysUser/entity/SysUser.java
  4. 6
    2
      src/main/java/com/huiju/estateagents/channel/sysChannel/controller/SysUserChannelController.java
  5. 22
    0
      src/main/java/com/huiju/estateagents/common/CommConstant.java
  6. 1
    0
      src/main/java/com/huiju/estateagents/controller/TaPersonController.java
  7. 21
    6
      src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java
  8. 2
    2
      src/main/java/com/huiju/estateagents/controller/TaRaiseRecordController.java
  9. 2
    1
      src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java
  10. 218
    0
      src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java
  11. 407
    0
      src/main/java/com/huiju/estateagents/sample/controller/TaH5DemandController.java
  12. 427
    0
      src/main/java/com/huiju/estateagents/sample/controller/TaH5SampleController.java
  13. 188
    0
      src/main/java/com/huiju/estateagents/sample/controller/TaNoticeController.java
  14. 149
    0
      src/main/java/com/huiju/estateagents/sample/controller/TaSampleContactController.java
  15. 106
    0
      src/main/java/com/huiju/estateagents/sample/entity/TaContact.java
  16. 95
    0
      src/main/java/com/huiju/estateagents/sample/entity/TaH5Demand.java
  17. 139
    0
      src/main/java/com/huiju/estateagents/sample/entity/TaH5Sample.java
  18. 85
    0
      src/main/java/com/huiju/estateagents/sample/entity/TaNotice.java
  19. 42
    0
      src/main/java/com/huiju/estateagents/sample/entity/TaSampleContact.java
  20. 22
    0
      src/main/java/com/huiju/estateagents/sample/mapper/TaContactMapper.java
  21. 18
    0
      src/main/java/com/huiju/estateagents/sample/mapper/TaH5DemandMapper.java
  22. 28
    0
      src/main/java/com/huiju/estateagents/sample/mapper/TaH5SampleMapper.java
  23. 49
    0
      src/main/java/com/huiju/estateagents/sample/mapper/TaNoticeMapper.java
  24. 18
    0
      src/main/java/com/huiju/estateagents/sample/mapper/TaSampleContactMapper.java
  25. 29
    0
      src/main/java/com/huiju/estateagents/sample/service/ITaContactService.java
  26. 16
    0
      src/main/java/com/huiju/estateagents/sample/service/ITaH5DemandService.java
  27. 27
    0
      src/main/java/com/huiju/estateagents/sample/service/ITaH5SampleService.java
  28. 51
    0
      src/main/java/com/huiju/estateagents/sample/service/ITaNoticeService.java
  29. 16
    0
      src/main/java/com/huiju/estateagents/sample/service/ITaSampleContactService.java
  30. 61
    0
      src/main/java/com/huiju/estateagents/sample/service/impl/TaContactServiceImpl.java
  31. 20
    0
      src/main/java/com/huiju/estateagents/sample/service/impl/TaH5DemandServiceImpl.java
  32. 38
    0
      src/main/java/com/huiju/estateagents/sample/service/impl/TaH5SampleServiceImpl.java
  33. 83
    0
      src/main/java/com/huiju/estateagents/sample/service/impl/TaNoticeServiceImpl.java
  34. 20
    0
      src/main/java/com/huiju/estateagents/sample/service/impl/TaSampleContactServiceImpl.java
  35. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaRaiseRecordService.java
  36. 14
    0
      src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java
  37. 2
    2
      src/main/java/com/huiju/estateagents/service/impl/TaRaiseRecordServiceImpl.java
  38. 1
    0
      src/main/resources/mapper/TaHousingResourcesMapper.xml
  39. 14
    0
      src/main/resources/mapper/sample/TaContactMapper.xml
  40. 5
    0
      src/main/resources/mapper/sample/TaH5DemandMapper.xml
  41. 36
    0
      src/main/resources/mapper/sample/TaH5SampleMapper.xml
  42. 51
    0
      src/main/resources/mapper/sample/TaNoticeMapper.xml
  43. 5
    0
      src/main/resources/mapper/sample/TaSampleContactMapper.xml

+ 10
- 10
pom.xml Vedi File

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>estateagents</artifactId>
13
-	<version>v3.5.14</version>
13
+	<version>v3.5.16</version>
14 14
 	<name>estateages</name>
15 15
 	<description>置业经纪人</description>
16 16
 
@@ -132,15 +132,15 @@
132 132
 
133 133
 
134 134
 	<profiles>
135
-		<profile>
136
-			<id>dev</id>
137
-			<activation>
138
-				<activeByDefault>true</activeByDefault>
139
-			</activation>
140
-			<properties>
141
-				<profiles.active>dev</profiles.active>
142
-			</properties>
143
-		</profile>
135
+<!--		<profile>-->
136
+<!--			<id>dev</id>-->
137
+<!--			<activation>-->
138
+<!--				<activeByDefault>true</activeByDefault>-->
139
+<!--			</activation>-->
140
+<!--			<properties>-->
141
+<!--				<profiles.active>dev</profiles.active>-->
142
+<!--			</properties>-->
143
+<!--		</profile>-->
144 144
 		<profile>
145 145
 			<id>green</id>
146 146
 			<properties>

+ 30
- 0
src/main/java/com/huiju/estateagents/base/BaseController.java Vedi File

@@ -96,6 +96,36 @@ public class BaseController {
96 96
         return null;
97 97
     }
98 98
 
99
+    /**
100
+     * 获取服务管理后台用户ID
101
+     *
102
+     * @param request
103
+     * @return
104
+     */
105
+    public Integer getSysUserId(HttpServletRequest request) {
106
+
107
+        Map map = JWTUtils.getUserIdAndOrgId(request);
108
+        if (null != map && null != map.get("userId")) {
109
+            return Integer.valueOf(map.get("userId").toString());
110
+        }
111
+        return null;
112
+    }
113
+
114
+    /**
115
+     * 获取服务管理后台用户ID
116
+     *
117
+     * @param request
118
+     * @return
119
+     */
120
+    public String getSysUserName(HttpServletRequest request) {
121
+
122
+        Map map = JWTUtils.getUserIdAndOrgId(request);
123
+        if (null != map && null != map.get("userName")) {
124
+            return map.get("userName") + "";
125
+        }
126
+        return null;
127
+    }
128
+
99 129
     public List<TaPersonBuilding> getTaPersonBuildingListByUserId(HttpServletRequest request) {
100 130
         TaUser taUser = taUserService.getById(getUserId(request));
101 131
         if (taUser == null) {

+ 3
- 1
src/main/java/com/huiju/estateagents/center/sysUser/entity/SysUser.java Vedi File

@@ -26,7 +26,9 @@ public class SysUser implements Serializable {
26 26
     /**
27 27
      * 账户登录
28 28
      */
29
-    @TableId(value = "user_name")
29
+    @TableId(value = "user_id")
30
+    private Integer userId;
31
+
30 32
     private String userName;
31 33
 
32 34
     /**

+ 6
- 2
src/main/java/com/huiju/estateagents/channel/sysChannel/controller/SysUserChannelController.java Vedi File

@@ -111,7 +111,11 @@ public class SysUserChannelController extends BaseController {
111 111
             return ResponseBean.error("用户状态异常", ResponseBean.ERROR_UNAVAILABLE);
112 112
         }
113 113
 
114
-        String token = JWTUtils.newToken(sysUser.getUserName());
114
+        Map map = new HashMap();
115
+        map.put("userName", sysUser.getUserName());
116
+        map.put("userId",sysUser.getUserId());
117
+
118
+        String token = JWTUtils.newTokenByMap(map);
115 119
 
116 120
         //保存token
117 121
         sysTokenService.saveToken(token);
@@ -138,7 +142,7 @@ public class SysUserChannelController extends BaseController {
138 142
      */
139 143
     @RequestMapping(value="/channel/current",method=RequestMethod.GET)
140 144
     public ResponseBean currentChannelUser(HttpServletRequest request){
141
-        String userName = JWTUtils.getSubject(request);
145
+        String userName = getSysUserName(request);
142 146
         QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
143 147
         sysUserQueryWrapper.eq("user_name",userName);
144 148
         sysUserQueryWrapper.eq("type",CommConstant.LOGIN_TYPE_CHANNEL);

+ 22
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java Vedi File

@@ -449,6 +449,12 @@ public class CommConstant {
449 449
      */
450 450
     public static final String MESSAGE_CONTENT_OF_NOTICE = "notice";
451 451
 
452
+    /**
453
+     * 需求通知
454
+     * 必须存在表   td_miniapp_template_type 中
455
+     */
456
+    public static final String MESSAGE_CONTENT_OF_DEMAND = "demand";
457
+
452 458
     /**
453 459
      * 助力通知
454 460
      * 必须存在表   td_miniapp_template_type 中
@@ -716,4 +722,20 @@ public class CommConstant {
716 722
      * 线下缴费
717 723
      */
718 724
     public static final String PAY_TYPE_ONLINE = "onLine";
725
+
726
+    /**
727
+     * 作废状态
728
+     */
729
+    public static final Integer DEMAND_STATUS_INVALID = 4;
730
+
731
+
732
+    /**
733
+     * 已提交
734
+     */
735
+    public static final Integer DEMAND_STATUS_SUBMIT = 1;
736
+
737
+    /**
738
+     * 样例类型H5
739
+     */
740
+    public static final String NOTICE_TYPE_H5 = "H5";
719 741
 }

+ 1
- 0
src/main/java/com/huiju/estateagents/controller/TaPersonController.java Vedi File

@@ -568,6 +568,7 @@ public class TaPersonController extends BaseController {
568 568
         }
569 569
         if (!StringUtils.isEmpty(phone)){
570 570
             person.setTel(phone);
571
+            person.setPhone(phone);
571 572
             if(person.getPersonType().equals(CommConstant.PERSON_REALTY_CONSULTANT)){
572 573
                 TaUser user = taUserService.getById(person.getUserId());
573 574
                 user.setPhone(phone);

+ 21
- 6
src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java Vedi File

@@ -272,14 +272,23 @@ public class TaPersonVisitRecordController extends BaseController {
272 272
     @RequestMapping(value = "/wx/activityVisitRecord", method = RequestMethod.GET)
273 273
     public ResponseBean wxPersonActivityVisitRecordList(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
274 274
                                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
275
-                                                        @RequestParam(value = "personId") String personId,
275
+                                                        @RequestParam(value = "personId", required = false) String personId,
276
+                                                        @RequestParam(value = "userId", required = false) Integer userId,
276 277
                                                         @RequestParam(value = "targetId") String targetId,
277 278
                                                         @RequestParam(value = "eventType") String eventType,
278 279
                                                         HttpServletRequest request) {
279 280
         try {
281
+            QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
282
+            if (userId == null){
283
+                taPersonQueryWrapper.eq("person_id", personId);
284
+            }
285
+            if (personId == null){
286
+                taPersonQueryWrapper.eq("user_id", userId);
287
+            }
288
+            TaPerson taPerson = taPersonService.getOne(taPersonQueryWrapper);
280 289
             //使用分页插件
281 290
             IPage<TaPersonVisitRecord> pg = new Page<>(pageNumber, pageSize);
282
-            IPage<TaPersonVisitRecord> result = iTaPersonVisitRecordService.getWxActivityVisitRecordList(pg, personId, getOrgId(request), targetId, eventType);
291
+            IPage<TaPersonVisitRecord> result = iTaPersonVisitRecordService.getWxActivityVisitRecordList(pg, taPerson.getPersonId(), getOrgId(request), targetId, eventType);
283 292
             return ResponseBean.success(result);
284 293
         } catch (Exception e) {
285 294
             e.printStackTrace();
@@ -300,18 +309,24 @@ public class TaPersonVisitRecordController extends BaseController {
300 309
     @RequestMapping(value = "/wx/shareRecords", method = RequestMethod.GET)
301 310
     public ResponseBean wxShareRecordsByUserId(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
302 311
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
303
-                                               @RequestParam(value = "personId") String personId,
312
+                                               @RequestParam(value = "personId", required = false) String personId,
313
+                                               @RequestParam(value = "userId", required = false) Integer userId,
304 314
                                                HttpServletRequest request) {
305 315
         ResponseBean responseBean = new ResponseBean();
306
-        if (personId == null) {
316
+        if (personId == null && userId == null) {
307 317
             return responseBean;
308 318
         }
309 319
         //使用分页插件
310 320
         IPage<TaConsultantInfo> pg = new Page<>(pageNumber, pageSize);
311 321
         QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
312
-        taPersonQueryWrapper.eq("person_id", personId);
322
+        if (userId == null){
323
+            taPersonQueryWrapper.eq("person_id", personId);
324
+        }
325
+        if (personId == null){
326
+            taPersonQueryWrapper.eq("user_id", userId);
327
+        }
313 328
         TaPerson taPerson = taPersonService.getOne(taPersonQueryWrapper);
314
-        IPage<TaConsultantInfo> result = iTaPersonVisitRecordService.getConsultantShareInfoList(pg, personId);
329
+        IPage<TaConsultantInfo> result = iTaPersonVisitRecordService.getConsultantShareInfoList(pg, taPerson.getPersonId());
315 330
 
316 331
         List<TaConsultantInfo> taConsultantInfos = result.getRecords();
317 332
         taConsultantInfos.forEach(e -> {

+ 2
- 2
src/main/java/com/huiju/estateagents/controller/TaRaiseRecordController.java Vedi File

@@ -226,7 +226,7 @@ public class TaRaiseRecordController extends BaseController {
226 226
 
227 227
                 // 修改房源锁定状态为未锁定
228 228
                 record.setHouseLockingStatus(CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED);
229
-                iTaRaiseRecordService.updateHouseLockingStatus(record.getRaiseRecordId(), CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED);
229
+                iTaRaiseRecordService.updateHouseLockingStatus(record.getRaiseRecordId(), CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED, record.getPersonId());
230 230
 
231 231
                 // 发送订阅消息
232 232
                 iTaRaiseRecordService.sendRaiseMsg(record.getRaiseRecordId(), record.getRaiseId(), "认筹通知", "认筹单已作废", "点击详情查看认筹单", "具体原因查看详情", false);
@@ -277,7 +277,7 @@ public class TaRaiseRecordController extends BaseController {
277 277
 
278 278
                 // 修改房源锁定状态为未锁定
279 279
                 record.setHouseLockingStatus(CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED);
280
-                iTaRaiseRecordService.updateHouseLockingStatus(record.getRaiseRecordId(), CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED);
280
+                iTaRaiseRecordService.updateHouseLockingStatus(record.getRaiseRecordId(), CommConstant.HOUSE_LOCKING_STATUS_UNLOCKED, record.getPersonId());
281 281
 
282 282
                 // 发送订阅消息
283 283
                 iTaRaiseRecordService.sendRaiseMsg(record.getRaiseRecordId(), record.getRaiseId(), "认筹通知", "认筹单已作废", "点击详情查看认筹单", "具体原因查看详情", false);

+ 2
- 1
src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java Vedi File

@@ -97,7 +97,8 @@ public interface TaHousingResourcesMapper extends BaseMapper<TaHousingResources>
97 97
      * @return
98 98
      */
99 99
     Boolean updateHouseLockingStatus(@Param("raiseRecordId") Integer raiseRecordId,
100
-                                     @Param("houseLockingStatus") String houseLockingStatus);
100
+                                     @Param("houseLockingStatus") String houseLockingStatus,
101
+                                     @Param("personId") String personId);
101 102
 
102 103
     /**
103 104
      * 根据房源ID获取房源详情

+ 218
- 0
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java Vedi File

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

+ 407
- 0
src/main/java/com/huiju/estateagents/sample/controller/TaH5DemandController.java Vedi File

@@ -0,0 +1,407 @@
1
+package com.huiju.estateagents.sample.controller;
2
+
3
+import com.alibaba.fastjson.JSONArray;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
+import com.baomidou.mybatisplus.core.metadata.IPage;
7
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
+import com.huiju.estateagents.base.BaseController;
9
+import com.huiju.estateagents.base.ResponseBean;
10
+import com.huiju.estateagents.common.CommConstant;
11
+import com.huiju.estateagents.common.SMSUtils;
12
+import com.huiju.estateagents.common.StringUtils;
13
+import com.huiju.estateagents.entity.SysSmsSetting;
14
+import com.huiju.estateagents.mapper.SysSmsSettingMapper;
15
+import com.huiju.estateagents.sample.entity.TaContact;
16
+import com.huiju.estateagents.sample.entity.TaH5Demand;
17
+import com.huiju.estateagents.sample.entity.TaH5Sample;
18
+import com.huiju.estateagents.sample.entity.TaSampleContact;
19
+import com.huiju.estateagents.sample.service.ITaContactService;
20
+import com.huiju.estateagents.sample.service.ITaH5DemandService;
21
+import com.huiju.estateagents.sample.service.ITaH5SampleService;
22
+import com.huiju.estateagents.sample.service.ITaSampleContactService;
23
+import com.huiju.estateagents.service.ITaOrgService;
24
+import org.apache.poi.ss.formula.functions.T;
25
+import org.omg.CORBA.INTERNAL;
26
+import io.swagger.models.auth.In;
27
+import org.slf4j.Logger;
28
+import org.slf4j.LoggerFactory;
29
+import org.springframework.beans.factory.annotation.Autowired;
30
+import org.springframework.web.bind.annotation.PathVariable;
31
+import org.springframework.web.bind.annotation.RequestBody;
32
+import org.springframework.web.bind.annotation.RequestMapping;
33
+import org.springframework.web.bind.annotation.RequestMethod;
34
+import org.springframework.web.bind.annotation.RequestParam;
35
+import org.springframework.web.bind.annotation.ResponseBody;
36
+import org.springframework.web.bind.annotation.RestController;
37
+
38
+import javax.servlet.http.HttpServletRequest;
39
+import java.time.LocalDateTime;
40
+import java.util.ArrayList;
41
+import java.util.List;
42
+import java.util.HashMap;
43
+import java.util.List;
44
+import java.util.Map;
45
+import java.util.stream.Collectors;
46
+
47
+
48
+/**
49
+ * <p>
50
+    * 需求单表  前端控制器
51
+    * </p>
52
+ *
53
+ * @author fxf
54
+ * @since 2020-03-18
55
+ */
56
+@RestController
57
+@RequestMapping("/api")
58
+public class TaH5DemandController extends BaseController {
59
+
60
+    private final Logger logger = LoggerFactory.getLogger(TaH5DemandController.class);
61
+
62
+    @Autowired
63
+    public ITaH5DemandService iTaH5DemandService;
64
+
65
+    @Autowired
66
+    public ITaH5SampleService iTaH5SampleService;
67
+
68
+    @Autowired
69
+    private ITaSampleContactService iTaSampleContactService;
70
+
71
+    @Autowired
72
+    private ITaContactService taContactService;
73
+
74
+    @Autowired
75
+    private ITaOrgService iTaOrgService;
76
+
77
+    @Autowired
78
+    SysSmsSettingMapper sysSmsSettingMapper;
79
+
80
+    @Autowired
81
+    SMSUtils smsUtils;
82
+
83
+    /**
84
+     * 分页查询列表
85
+     * @param pageNum
86
+     * @param pageSize
87
+     * @return
88
+     */
89
+    @RequestMapping(value="/admin/taH5Demand",method= RequestMethod.GET)
90
+    public ResponseBean taH5DemandList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
91
+                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
92
+                                       @RequestParam(value ="sampleName", required = false) String sampleName,
93
+                                       @RequestParam(value ="orderer", required = false) String orderer,
94
+                                       @RequestParam(value ="phone", required = false) String phone,
95
+                                       @RequestParam(value ="sampleId", required = false) Integer sampleId,
96
+                                       @RequestParam(value ="startCreateDate", required = false) String startCreateDate,
97
+                                       @RequestParam(value ="endCreateDate", required = false) String endCreateDate,
98
+                                       @RequestParam(value ="demandStatus", required = false) String demandStatus,
99
+                                       HttpServletRequest request){
100
+        ResponseBean responseBean = new ResponseBean();
101
+        try {
102
+            //使用分页插件
103
+		    IPage<TaH5Demand> pg = new Page<>(pageNum, pageSize);
104
+            QueryWrapper<TaH5Demand> queryWrapper = new QueryWrapper<>();
105
+            queryWrapper.eq("org_id", getOrgId(request));
106
+            queryWrapper.eq(sampleId != null,"sample_id", sampleId);
107
+            queryWrapper.ne("demand_status", CommConstant.STATUS_DELETE);
108
+            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name", sampleName);
109
+            queryWrapper.like(!StringUtils.isEmpty(orderer),"orderer", orderer);
110
+            queryWrapper.like(!StringUtils.isEmpty(phone),"phone", phone);
111
+            queryWrapper.eq(!StringUtils.isEmpty(demandStatus),"demand_status", demandStatus);
112
+            queryWrapper.gt(!StringUtils.isEmpty(startCreateDate),"create_date", startCreateDate);
113
+            queryWrapper.lt(!StringUtils.isEmpty(endCreateDate),"create_date", endCreateDate);
114
+            queryWrapper.orderByDesc("create_date");
115
+
116
+            IPage<TaH5Demand> result = iTaH5DemandService.page(pg, queryWrapper);
117
+            responseBean.addSuccess(result);
118
+        }catch (Exception e){
119
+            e.printStackTrace();
120
+            logger.error("taH5DemandList -=- {}",e.toString());
121
+            responseBean.addError(e.getMessage());
122
+        }
123
+        return responseBean;
124
+    }
125
+
126
+    /**
127
+     * 保存对象
128
+     * @param taH5Demand 实体对象
129
+     * @return
130
+     */
131
+    @RequestMapping(value="/admin/taH5Demand",method= RequestMethod.POST)
132
+    public ResponseBean taH5DemandAdd(@RequestBody TaH5Demand taH5Demand, HttpServletRequest request){
133
+        ResponseBean responseBean = new ResponseBean();
134
+        try {
135
+            taH5Demand.setOrgId(getOrgId(request));
136
+            taH5Demand.setOrgName(iTaOrgService.getById(getOrgId(request)).getName());
137
+            taH5Demand.setDemandStatus(CommConstant.STATUS_NORMAL);
138
+            taH5Demand.setCreateDate(LocalDateTime.now());
139
+            taH5Demand.setUpdateDate(LocalDateTime.now());
140
+            if (iTaH5DemandService.save(taH5Demand)){
141
+                responseBean.addSuccess(taH5Demand);
142
+            }else {
143
+                responseBean.addError("fail");
144
+            }
145
+            TaH5Sample taH5Sample = iTaH5SampleService.getById(taH5Demand.getSampleId());
146
+            QueryWrapper<TaSampleContact> queryWrapper = new QueryWrapper();
147
+            queryWrapper.eq("sample_id",taH5Sample.getSampleId());
148
+            List<TaSampleContact> sampleContactList = iTaSampleContactService.list(queryWrapper);
149
+            if (sampleContactList.size() > 0) {
150
+                List<TaContact> taContactList = taContactService.list(new QueryWrapper<TaContact>().in("contact_id", sampleContactList.stream().map(TaSampleContact::getContactId).collect(Collectors.toList())));
151
+                taH5Sample.setTaContactList(taContactList);
152
+                String[] smsParams = {taH5Sample.getSampleName(), taH5Demand.getOrderer() + "-" + taH5Demand.getPhone()};
153
+                for (TaContact taContact : taContactList){
154
+                    sendSmsMessage(taContact.getPhone(), CommConstant.MESSAGE_CONTENT_OF_DEMAND, smsParams);
155
+                }
156
+
157
+            }
158
+        }catch (Exception e){
159
+            e.printStackTrace();
160
+            logger.error("taH5DemandAdd -=- {}",e.toString());
161
+            responseBean.addError(e.getMessage());
162
+        }
163
+        return responseBean;
164
+    }
165
+
166
+    /**
167
+     * 根据id删除对象
168
+     * @param id  实体ID
169
+     */
170
+    @ResponseBody
171
+    @RequestMapping(value="/taH5Demand/{id}", method= RequestMethod.DELETE)
172
+    public ResponseBean taH5DemandDelete(@PathVariable Integer id){
173
+        ResponseBean responseBean = new ResponseBean();
174
+        try {
175
+            if(iTaH5DemandService.removeById(id)){
176
+                responseBean.addSuccess("success");
177
+            }else {
178
+                responseBean.addError("fail");
179
+            }
180
+        }catch (Exception e){
181
+            e.printStackTrace();
182
+            logger.error("taH5DemandDelete -=- {}",e.toString());
183
+            responseBean.addError(e.getMessage());
184
+        }
185
+        return responseBean;
186
+    }
187
+
188
+    /**
189
+     * 根据id批量删除对象
190
+     */
191
+    @ResponseBody
192
+    @RequestMapping(value="/admin/batchDelTaH5Demands", method= RequestMethod.PUT)
193
+    public ResponseBean taH5DemandBatchDelete(@RequestBody TaH5Demand taH5Demand){
194
+        ResponseBean responseBean = new ResponseBean();
195
+        List<Integer> demandIds = new ArrayList<>();
196
+        try {
197
+            int successNum = 0;
198
+            int failNum = 0;
199
+            for (TaH5Demand info : taH5Demand.getTaH5Demands()){
200
+                TaH5Demand h5Demand = iTaH5DemandService.getById(info.getDemandId());
201
+                if (CommConstant.DEMAND_STATUS_INVALID.equals(h5Demand.getDemandStatus()) || CommConstant.DEMAND_STATUS_SUBMIT.equals(h5Demand.getDemandStatus())){
202
+                    h5Demand.setDemandStatus(CommConstant.STATUS_DELETE);
203
+                    iTaH5DemandService.updateById(h5Demand);
204
+                    successNum++;
205
+                }else{
206
+                    failNum++;
207
+                }
208
+            }
209
+            Map<String,Object> map = new HashMap<>();
210
+            map.put("successNum",successNum);
211
+            map.put("failNum",failNum);
212
+            responseBean.addSuccess(map);
213
+        }catch (Exception e){
214
+            e.printStackTrace();
215
+            logger.error("taH5DemandDelete -=- {}",e.toString());
216
+            responseBean.addError(e.getMessage());
217
+        }
218
+        return responseBean;
219
+    }
220
+
221
+    /**
222
+     * 修改对象
223
+     * @param id  实体ID
224
+     * @param taH5Demand 实体对象
225
+     * @return
226
+     */
227
+    @RequestMapping(value="/admin/taH5Demand/{id}",method= RequestMethod.PUT)
228
+    public ResponseBean taH5DemandUpdate(@PathVariable Integer id,
229
+                                        @RequestBody TaH5Demand taH5Demand){
230
+        ResponseBean responseBean = new ResponseBean();
231
+        try {
232
+            if (StringUtils.isEmpty(taH5Demand.getDemandContent())){
233
+                responseBean.addError("请填写需求内容");
234
+                return responseBean;
235
+            }
236
+            taH5Demand.setDemandId(id);
237
+            taH5Demand.setUpdateDate(LocalDateTime.now());
238
+            if (iTaH5DemandService.updateById(taH5Demand)){
239
+                responseBean.addSuccess(taH5Demand);
240
+            }else {
241
+                responseBean.addError("fail");
242
+            }
243
+        }catch (Exception e){
244
+            e.printStackTrace();
245
+            logger.error("taH5DemandUpdate -=- {}",e.toString());
246
+            responseBean.addError(e.getMessage());
247
+        }
248
+        return responseBean;
249
+    }
250
+
251
+    /**
252
+     * 根据id查询对象
253
+     * @param id  实体ID
254
+     */
255
+    @RequestMapping(value="/admin/taH5Demand/{id}",method= RequestMethod.GET)
256
+    public ResponseBean taH5DemandGet(@PathVariable Integer id){
257
+        ResponseBean responseBean = new ResponseBean();
258
+        try {
259
+            responseBean.addSuccess(iTaH5DemandService.getById(id));
260
+        }catch (Exception e){
261
+            e.printStackTrace();
262
+            logger.error("taH5DemandDelete -=- {}",e.toString());
263
+            responseBean.addError(e.getMessage());
264
+        }
265
+        return responseBean;
266
+    }
267
+
268
+
269
+    /**
270
+     * 获取h5需求清单
271
+     * @param pageNum
272
+     * @param pageSize
273
+     * @return
274
+     */
275
+    @RequestMapping(value="/channel/taH5Demand",method= RequestMethod.GET)
276
+    public ResponseBean getH5DemandList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
277
+                                        @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
278
+                                        @RequestParam(value ="sampleName",required = false) String sampleName,
279
+                                        @RequestParam(value ="orgName",required = false) String orgName,
280
+                                        @RequestParam(value ="orderer",required = false) String orderer,
281
+                                        @RequestParam(value ="phone",required = false) String phone,
282
+                                        @RequestParam(value ="demandStatus",required = false) Integer demandStatus,
283
+                                        @RequestParam(value ="startCreateDate",required = false) String startCreateDate,
284
+                                        @RequestParam(value ="endCreateDate",required = false) String endCreateDate,
285
+                                       HttpServletRequest request){
286
+        ResponseBean responseBean = new ResponseBean();
287
+        try {
288
+            //使用分页插件
289
+            IPage<TaH5Demand> pg = new Page<>(pageNum, pageSize);
290
+            QueryWrapper<TaH5Demand> queryWrapper = new QueryWrapper<>();
291
+            queryWrapper.like(!StringUtils.isEmpty(sampleName),"sample_name",sampleName);
292
+            queryWrapper.like(!StringUtils.isEmpty(orgName),"org_name",orgName);
293
+            queryWrapper.like(!StringUtils.isEmpty(orderer),"orderer",orderer);
294
+            queryWrapper.like(!StringUtils.isEmpty(phone),"phone",phone);
295
+            queryWrapper.eq(null != demandStatus,"demand_status",demandStatus);
296
+            queryWrapper.ge(!StringUtils.isEmpty(startCreateDate),"date_format(create_date,'%Y-%m-%d')",startCreateDate);
297
+            queryWrapper.le(!StringUtils.isEmpty(endCreateDate),"date_format(create_date,'%Y-%m-%d')",endCreateDate);
298
+            queryWrapper.gt("demand_status", CommConstant.STATUS_DELETE);
299
+            queryWrapper.orderByDesc("create_date");
300
+
301
+            IPage<TaH5Demand> result = iTaH5DemandService.page(pg, queryWrapper);
302
+            responseBean.addSuccess(result);
303
+        }catch (Exception e){
304
+            e.printStackTrace();
305
+            logger.error("taH5DemandList -=- {}",e.toString());
306
+            responseBean.addError(e.getMessage());
307
+        }
308
+        return responseBean;
309
+    }
310
+
311
+
312
+    /**
313
+     * 批量删除需求单
314
+     * @return
315
+     */
316
+    @RequestMapping(value="/channel/taH5Demand/batch",method= RequestMethod.PUT)
317
+    public ResponseBean batchUpdateH5DemandList(@RequestBody String ids,
318
+                                        HttpServletRequest request){
319
+        ResponseBean responseBean = new ResponseBean();
320
+        try {
321
+            int successNum = 0;
322
+            int failNum = 0;
323
+            JSONArray jsonArray = JSONObject.parseObject(ids).getJSONArray("ids");
324
+            for (Object id : jsonArray) {
325
+                TaH5Demand h5Demand = iTaH5DemandService.getById((Integer) id);
326
+                if (CommConstant.DEMAND_STATUS_INVALID.equals(h5Demand.getDemandStatus())){
327
+                    h5Demand.setDemandStatus(CommConstant.STATUS_DELETE);
328
+                    iTaH5DemandService.updateById(h5Demand);
329
+                    successNum++;
330
+                }else{
331
+                    failNum++;
332
+                }
333
+            }
334
+            Map<String,Object> map = new HashMap<>();
335
+            map.put("successNum",successNum);
336
+            map.put("failNum",failNum);
337
+            responseBean.addSuccess(map);
338
+        }catch (Exception e){
339
+            e.printStackTrace();
340
+            logger.error("taH5DemandList -=- {}",e.toString());
341
+            responseBean.addError(e.getMessage());
342
+        }
343
+        return responseBean;
344
+    }
345
+
346
+    /**
347
+     * 获取需求单详情
348
+     * @return
349
+     */
350
+    @RequestMapping(value="/channel/taH5Demand/{id}",method= RequestMethod.GET)
351
+    public ResponseBean getH5Demand(@PathVariable Integer id, HttpServletRequest request){
352
+        ResponseBean responseBean = new ResponseBean();
353
+        try {
354
+            responseBean.addSuccess(iTaH5DemandService.getById(id));
355
+        }catch (Exception e){
356
+            e.printStackTrace();
357
+            logger.error("getH5Demand -=- {}",e.toString());
358
+            responseBean.addError(e.getMessage());
359
+        }
360
+        return responseBean;
361
+    }
362
+
363
+    /**
364
+     * 更新需求单详情
365
+     * @return
366
+     */
367
+    @RequestMapping(value="/channel/taH5Demand/update/{id}",method= RequestMethod.PUT)
368
+    public ResponseBean updateH5Demand(@PathVariable Integer id,@RequestBody TaH5Demand taH5Demand, HttpServletRequest request){
369
+        ResponseBean responseBean = new ResponseBean();
370
+        try {
371
+            taH5Demand.setCreateDate(null);
372
+            taH5Demand.setDemandId(id);
373
+            taH5Demand.setUpdateDate(LocalDateTime.now());
374
+            responseBean.addSuccess(iTaH5DemandService.updateById(taH5Demand));
375
+        }catch (Exception e){
376
+            e.printStackTrace();
377
+            logger.error("getH5Demand -=- {}",e.toString());
378
+            responseBean.addError(e.getMessage());
379
+        }
380
+        return responseBean;
381
+    }
382
+
383
+    private String sendSmsMessage(String tel, String type, String[] params) {
384
+        if (StringUtils.isEmpty(tel) || StringUtils.isEmpty(type)) {
385
+            return "短信发送失败: 没有手机号或者短信模板";
386
+        }
387
+
388
+        QueryWrapper<SysSmsSetting> query = new QueryWrapper<>();
389
+        query.eq("sms_type", type);
390
+        query.eq("status", CommConstant.STATUS_NORMAL);
391
+        query.last("limit 1");
392
+
393
+        SysSmsSetting smsSetting = sysSmsSettingMapper.selectOne(query);
394
+        if (null == smsSetting) {
395
+
396
+            // TODO 写消息发送日志
397
+
398
+            return "没有设置有效的【" + type + "】短信模板";
399
+        }
400
+
401
+        boolean success = smsUtils.sendMessage(smsSetting.getTplCode(), tel, params);
402
+
403
+        // TODO 写消息发送日志
404
+
405
+        return success ? null : "短信发送失败";
406
+    }
407
+}

+ 427
- 0
src/main/java/com/huiju/estateagents/sample/controller/TaH5SampleController.java Vedi File

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

+ 188
- 0
src/main/java/com/huiju/estateagents/sample/controller/TaNoticeController.java Vedi File

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

+ 149
- 0
src/main/java/com/huiju/estateagents/sample/controller/TaSampleContactController.java Vedi File

@@ -0,0 +1,149 @@
1
+package com.huiju.estateagents.sample.controller;
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;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.sample.entity.TaSampleContact;
9
+import com.huiju.estateagents.sample.service.ITaSampleContactService;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.PathVariable;
14
+import org.springframework.web.bind.annotation.RequestBody;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RequestParam;
18
+import org.springframework.web.bind.annotation.ResponseBody;
19
+import org.springframework.web.bind.annotation.RestController;
20
+
21
+/**
22
+ * <p>
23
+    * 样例与联系人关联表  前端控制器
24
+    * </p>
25
+ *
26
+ * @author fxf
27
+ * @since 2020-03-18
28
+ */
29
+@RestController
30
+@RequestMapping("/")
31
+public class TaSampleContactController extends BaseController {
32
+
33
+    private final Logger logger = LoggerFactory.getLogger(TaSampleContactController.class);
34
+
35
+    @Autowired
36
+    public ITaSampleContactService iTaSampleContactService;
37
+
38
+
39
+    /**
40
+     * 分页查询列表
41
+     * @param pageNum
42
+     * @param pageSize
43
+     * @return
44
+     */
45
+    @RequestMapping(value="/taSampleContact",method= RequestMethod.GET)
46
+    public ResponseBean taSampleContactList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
+                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
48
+        ResponseBean responseBean = new ResponseBean();
49
+        try {
50
+            //使用分页插件
51
+		    IPage<TaSampleContact> pg = new Page<>(pageNum, pageSize);
52
+            QueryWrapper<TaSampleContact> queryWrapper = new QueryWrapper<>();
53
+            queryWrapper.orderByDesc("create_date");
54
+
55
+            IPage<TaSampleContact> result = iTaSampleContactService.page(pg, queryWrapper);
56
+            responseBean.addSuccess(result);
57
+        }catch (Exception e){
58
+            e.printStackTrace();
59
+            logger.error("taSampleContactList -=- {}",e.toString());
60
+            responseBean.addError(e.getMessage());
61
+        }
62
+        return responseBean;
63
+    }
64
+
65
+    /**
66
+     * 保存对象
67
+     * @param taSampleContact 实体对象
68
+     * @return
69
+     */
70
+    @RequestMapping(value="/taSampleContact",method= RequestMethod.POST)
71
+    public ResponseBean taSampleContactAdd(@RequestBody TaSampleContact taSampleContact){
72
+        ResponseBean responseBean = new ResponseBean();
73
+        try {
74
+            if (iTaSampleContactService.save(taSampleContact)){
75
+                responseBean.addSuccess(taSampleContact);
76
+            }else {
77
+                responseBean.addError("fail");
78
+            }
79
+        }catch (Exception e){
80
+            e.printStackTrace();
81
+            logger.error("taSampleContactAdd -=- {}",e.toString());
82
+            responseBean.addError(e.getMessage());
83
+        }
84
+        return responseBean;
85
+    }
86
+
87
+    /**
88
+     * 根据id删除对象
89
+     * @param id  实体ID
90
+     */
91
+    @ResponseBody
92
+    @RequestMapping(value="/taSampleContact/{id}", method= RequestMethod.DELETE)
93
+    public ResponseBean taSampleContactDelete(@PathVariable Integer id){
94
+        ResponseBean responseBean = new ResponseBean();
95
+        try {
96
+            if(iTaSampleContactService.removeById(id)){
97
+                responseBean.addSuccess("success");
98
+            }else {
99
+                responseBean.addError("fail");
100
+            }
101
+        }catch (Exception e){
102
+            e.printStackTrace();
103
+            logger.error("taSampleContactDelete -=- {}",e.toString());
104
+            responseBean.addError(e.getMessage());
105
+        }
106
+        return responseBean;
107
+    }
108
+
109
+    /**
110
+     * 修改对象
111
+     * @param id  实体ID
112
+     * @param taSampleContact 实体对象
113
+     * @return
114
+     */
115
+    @RequestMapping(value="/taSampleContact/{id}",method= RequestMethod.PUT)
116
+    public ResponseBean taSampleContactUpdate(@PathVariable Integer id,
117
+                                        @RequestBody TaSampleContact taSampleContact){
118
+        ResponseBean responseBean = new ResponseBean();
119
+        try {
120
+            if (iTaSampleContactService.updateById(taSampleContact)){
121
+                responseBean.addSuccess(taSampleContact);
122
+            }else {
123
+                responseBean.addError("fail");
124
+            }
125
+        }catch (Exception e){
126
+            e.printStackTrace();
127
+            logger.error("taSampleContactUpdate -=- {}",e.toString());
128
+            responseBean.addError(e.getMessage());
129
+        }
130
+        return responseBean;
131
+    }
132
+
133
+    /**
134
+     * 根据id查询对象
135
+     * @param id  实体ID
136
+     */
137
+    @RequestMapping(value="/taSampleContact/{id}",method= RequestMethod.GET)
138
+    public ResponseBean taSampleContactGet(@PathVariable Integer id){
139
+        ResponseBean responseBean = new ResponseBean();
140
+        try {
141
+            responseBean.addSuccess(iTaSampleContactService.getById(id));
142
+        }catch (Exception e){
143
+            e.printStackTrace();
144
+            logger.error("taSampleContactDelete -=- {}",e.toString());
145
+            responseBean.addError(e.getMessage());
146
+        }
147
+        return responseBean;
148
+    }
149
+}

+ 106
- 0
src/main/java/com/huiju/estateagents/sample/entity/TaContact.java Vedi File

@@ -0,0 +1,106 @@
1
+package com.huiju.estateagents.sample.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
4
+import com.baomidou.mybatisplus.annotation.IdType;
5
+import com.baomidou.mybatisplus.annotation.TableField;
6
+import com.baomidou.mybatisplus.annotation.TableId;
7
+import java.time.LocalDateTime;
8
+import java.io.Serializable;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 联系人表 
16
+ * </p>
17
+ *
18
+ * @author fxf
19
+ * @since 2020-03-18
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+public class TaContact implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    /**
29
+     * 联系人id
30
+     */
31
+    @TableId(value = "contact_id", type = IdType.AUTO)
32
+    private Integer contactId;
33
+
34
+    /**
35
+     * 姓名
36
+     */
37
+    private String contactName;
38
+
39
+    /**
40
+     * 性别 1男2女
41
+     */
42
+    private Integer sex;
43
+
44
+    /**
45
+     * 创建时间
46
+     */
47
+    private LocalDateTime createDate;
48
+
49
+    /**
50
+     * 头像
51
+     */
52
+    private String avatar;
53
+
54
+    /**
55
+     * 对外头衔
56
+     */
57
+    private String appellation;
58
+
59
+    /**
60
+     * 固定电话
61
+     */
62
+    private String telephone;
63
+
64
+    /**
65
+     * 手机号
66
+     */
67
+    private String phone;
68
+
69
+    /**
70
+     * 微信号图片
71
+     */
72
+    private String wxCardImg;
73
+
74
+    /**
75
+     * 邮箱
76
+     */
77
+    private String mail;
78
+
79
+    /**
80
+     * 联系地址
81
+     */
82
+    private String address;
83
+
84
+    /**
85
+     * 内部岗位
86
+     */
87
+    private String job;
88
+
89
+    /**
90
+     * 权重
91
+     */
92
+    @TableField(strategy = FieldStrategy.IGNORED)
93
+    private String orderNo;
94
+
95
+    /**
96
+     * 状态 -1删除0作废1有效
97
+     */
98
+    private Integer status;
99
+
100
+    /**
101
+     * 联系人类型 此版本全部固定sample
102
+     */
103
+    private String contactType;
104
+
105
+
106
+}

+ 95
- 0
src/main/java/com/huiju/estateagents/sample/entity/TaH5Demand.java Vedi File

@@ -0,0 +1,95 @@
1
+package com.huiju.estateagents.sample.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.time.LocalDateTime;
7
+import java.io.Serializable;
8
+import java.util.List;
9
+
10
+import lombok.Data;
11
+import lombok.EqualsAndHashCode;
12
+import lombok.experimental.Accessors;
13
+
14
+/**
15
+ * <p>
16
+ * 需求单表 
17
+ * </p>
18
+ *
19
+ * @author fxf
20
+ * @since 2020-03-18
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaH5Demand implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    /**
30
+     * 需求id
31
+     */
32
+    @TableId(value = "demand_id", type = IdType.AUTO)
33
+    private Integer demandId;
34
+
35
+    /**
36
+     * 样例id
37
+     */
38
+    private Integer sampleId;
39
+
40
+    /**
41
+     * 样例名
42
+     */
43
+    private String sampleName;
44
+
45
+    /**
46
+     * 公司id
47
+     */
48
+    private Integer orgId;
49
+
50
+    /**
51
+     * 下单组织
52
+     */
53
+    private String orgName;
54
+
55
+    /**
56
+     * 下单人
57
+     */
58
+    private String orderer;
59
+
60
+    /**
61
+     * 联系方式
62
+     */
63
+    private String phone;
64
+
65
+    /**
66
+     * 需求描述
67
+     */
68
+    private String demandContent;
69
+
70
+    /**
71
+     * 需求单状态 1是已提交2是处理中3是已交付-1是作废
72
+     */
73
+    private Integer demandStatus;
74
+
75
+    /**
76
+     * 创建时间
77
+     */
78
+    private LocalDateTime createDate;
79
+
80
+    /**
81
+     * 更新时间
82
+     */
83
+    private LocalDateTime updateDate;
84
+
85
+    /**
86
+     * 备注
87
+     */
88
+    private String remark;
89
+
90
+    /**
91
+     * 集合对象
92
+     */
93
+    @TableField(exist = false)
94
+    private List<TaH5Demand> taH5Demands;
95
+}

+ 139
- 0
src/main/java/com/huiju/estateagents/sample/entity/TaH5Sample.java Vedi File

@@ -0,0 +1,139 @@
1
+package com.huiju.estateagents.sample.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
4
+import com.baomidou.mybatisplus.annotation.IdType;
5
+import com.baomidou.mybatisplus.annotation.TableField;
6
+import com.baomidou.mybatisplus.annotation.TableId;
7
+
8
+import java.time.LocalDateTime;
9
+import java.io.Serializable;
10
+import java.util.ArrayList;
11
+import java.util.List;
12
+
13
+import lombok.Data;
14
+import lombok.EqualsAndHashCode;
15
+import lombok.experimental.Accessors;
16
+
17
+/**
18
+ * <p>
19
+ * 样例表
20
+ * </p>
21
+ *
22
+ * @author fxf
23
+ * @since 2020-03-18
24
+ */
25
+@Data
26
+@EqualsAndHashCode(callSuper = false)
27
+@Accessors(chain = true)
28
+public class TaH5Sample implements Serializable {
29
+
30
+    private static final long serialVersionUID = 1L;
31
+
32
+    /**
33
+     * 样例id
34
+     */
35
+    @TableId(value = "sample_id", type = IdType.AUTO)
36
+    private Integer sampleId;
37
+
38
+    /**
39
+     * 创建时间
40
+     */
41
+    private LocalDateTime createDate;
42
+
43
+    /**
44
+     * 样例名
45
+     */
46
+    private String sampleName;
47
+
48
+    /**
49
+     * 样例体验链接
50
+     */
51
+    private String sampleTryLink;
52
+
53
+    /**
54
+     * 样例体验二维码/小程序码
55
+     */
56
+    @TableField(strategy = FieldStrategy.IGNORED)
57
+    private String sampleTryCode;
58
+
59
+    /**
60
+     * 封面图
61
+     */
62
+    private String coverImg;
63
+
64
+    /**
65
+     * 发布状态 -1删除0作废1有效
66
+     */
67
+    private Integer status;
68
+
69
+    /**
70
+     * 权重
71
+     */
72
+    @TableField(strategy = FieldStrategy.IGNORED)
73
+    private Integer orderNo;
74
+
75
+    /**
76
+     * 标签 用逗号分隔
77
+     */
78
+    private String tag;
79
+
80
+    /**
81
+     * 样例类型 rich富文本link外部链接
82
+     */
83
+    private String sampleType;
84
+
85
+    /**
86
+     * 样例内容
87
+     */
88
+    private String sampleContent;
89
+
90
+    /**
91
+     * 样例链接
92
+     */
93
+    private String sampleContentLink;
94
+
95
+    /**
96
+     * 标签集合
97
+     */
98
+    @TableField(exist = false)
99
+    private List<String> tags = new ArrayList<>();
100
+
101
+    /**
102
+     * 标签集合
103
+     */
104
+    @TableField(exist = false)
105
+    private List<TaContact> taContactList = new ArrayList<>();
106
+
107
+    /**
108
+     * 修改人
109
+     */
110
+    private Integer updateUser;
111
+
112
+    /**
113
+     * 修改时间
114
+     */
115
+    private LocalDateTime updateDate;
116
+
117
+    /**
118
+     * 新增人
119
+     */
120
+    private Integer addUser;
121
+
122
+    /**
123
+     * 添加人姓名
124
+     */
125
+    @TableField(exist = false)
126
+    private String addUserName;
127
+
128
+    /**
129
+     * 修改人姓名
130
+     */
131
+    @TableField(exist = false)
132
+    private String updateUserName;
133
+
134
+    /**
135
+     * 样例中需求单个数
136
+     */
137
+    @TableField(exist = false)
138
+    private Integer demandNum;
139
+}

+ 85
- 0
src/main/java/com/huiju/estateagents/sample/entity/TaNotice.java Vedi File

@@ -0,0 +1,85 @@
1
+package com.huiju.estateagents.sample.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
4
+import com.baomidou.mybatisplus.annotation.IdType;
5
+import com.baomidou.mybatisplus.annotation.TableField;
6
+import com.baomidou.mybatisplus.annotation.TableId;
7
+
8
+import java.time.LocalDateTime;
9
+import java.io.Serializable;
10
+
11
+import com.fasterxml.jackson.annotation.JsonFormat;
12
+import lombok.Data;
13
+import lombok.EqualsAndHashCode;
14
+import lombok.experimental.Accessors;
15
+
16
+/**
17
+ * <p>
18
+ * 开屏通知
19
+ * </p>
20
+ *
21
+ * @author fxf
22
+ * @since 2020-03-18
23
+ */
24
+@Data
25
+@EqualsAndHashCode(callSuper = false)
26
+@Accessors(chain = true)
27
+public class TaNotice implements Serializable {
28
+
29
+    private static final long serialVersionUID = 1L;
30
+
31
+    /**
32
+     * 通知id
33
+     */
34
+    @TableId(value = "notice_id", type = IdType.AUTO)
35
+    private Integer noticeId;
36
+
37
+    /**
38
+     * 通知标题
39
+     */
40
+    private String title;
41
+
42
+    /**
43
+     * 通知图
44
+     */
45
+    private String noticeImg;
46
+
47
+    /**
48
+     * 关联业务类型 此版本固定sample
49
+     */
50
+    private String targetType;
51
+
52
+    /**
53
+     * 关联业务 此版本固定sample_id
54
+     */
55
+    private Integer targetId;
56
+
57
+    /**
58
+     * 关联业务名
59
+     */
60
+    @TableField(exist = false)
61
+    private String targetName;
62
+
63
+    /**
64
+     * 状态 -1删除0是未发布1是已发布
65
+     */
66
+    private Integer status;
67
+
68
+    /**
69
+     * 创建时间
70
+     */
71
+    private LocalDateTime createDate;
72
+
73
+    /**
74
+     * 自动下架时间 每次查询的时候过滤,并更新status
75
+     */
76
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
77
+    @TableField(strategy = FieldStrategy.IGNORED)
78
+    private LocalDateTime invalidTime;
79
+
80
+    /**
81
+     * 权重
82
+     */
83
+    @TableField(strategy = FieldStrategy.IGNORED)
84
+    private Integer orderNo;
85
+}

+ 42
- 0
src/main/java/com/huiju/estateagents/sample/entity/TaSampleContact.java Vedi File

@@ -0,0 +1,42 @@
1
+package com.huiju.estateagents.sample.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+/**
11
+ * <p>
12
+ * 样例与联系人关联表 
13
+ * </p>
14
+ *
15
+ * @author fxf
16
+ * @since 2020-03-18
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+public class TaSampleContact implements Serializable {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 样例与联系人关联表
27
+     */
28
+    @TableId(value = "sample_contact_id", type = IdType.AUTO)
29
+    private Integer sampleContactId;
30
+
31
+    /**
32
+     * 样例id
33
+     */
34
+    private Integer sampleId;
35
+
36
+    /**
37
+     * 联系人id
38
+     */
39
+    private Integer contactId;
40
+
41
+
42
+}

+ 22
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaContactMapper.java Vedi File

@@ -0,0 +1,22 @@
1
+package com.huiju.estateagents.sample.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.huiju.estateagents.sample.entity.TaContact;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+import org.springframework.stereotype.Component;
9
+
10
+/**
11
+ * <p>
12
+ * 联系人表  Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author fxf
16
+ * @since 2020-03-18
17
+ */
18
+@Mapper
19
+@Component
20
+public interface TaContactMapper extends BaseMapper<TaContact> {
21
+    IPage<TaContact> taContactInfoBySampleId(IPage<TaContact> pg, @Param("id") String id);
22
+}

+ 18
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaH5DemandMapper.java Vedi File

@@ -0,0 +1,18 @@
1
+package com.huiju.estateagents.sample.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.huiju.estateagents.sample.entity.TaH5Demand;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 需求单表  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author fxf
13
+ * @since 2020-03-18
14
+ */
15
+@Mapper
16
+public interface TaH5DemandMapper extends BaseMapper<TaH5Demand> {
17
+
18
+}

+ 28
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaH5SampleMapper.java Vedi File

@@ -0,0 +1,28 @@
1
+package com.huiju.estateagents.sample.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.huiju.estateagents.sample.entity.TaContact;
6
+import com.huiju.estateagents.sample.entity.TaH5Sample;
7
+import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+import org.springframework.stereotype.Component;
10
+
11
+import java.util.List;
12
+
13
+/**
14
+ * <p>
15
+ * 样例表  Mapper 接口
16
+ * </p>
17
+ *
18
+ * @author fxf
19
+ * @since 2020-03-18
20
+ */
21
+@Mapper
22
+@Component
23
+public interface TaH5SampleMapper extends BaseMapper<TaH5Sample> {
24
+
25
+    IPage<TaH5Sample> listH5SampleByCondition(IPage<TaH5Sample> pg, String sampleName);
26
+
27
+    Boolean batchUpdateStatus(@Param("list") List<TaContact> taContactList, @Param("userId") Integer userId);
28
+}

+ 49
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaNoticeMapper.java Vedi File

@@ -0,0 +1,49 @@
1
+package com.huiju.estateagents.sample.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.huiju.estateagents.sample.entity.TaNotice;
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;
11
+
12
+/**
13
+ * <p>
14
+ * 开屏通知  Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author fxf
18
+ * @since 2020-03-18
19
+ */
20
+@Mapper
21
+@Component
22
+public interface TaNoticeMapper extends BaseMapper<TaNotice> {
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);
42
+
43
+    /**
44
+     * 自动下架已过期的开屏通知
45
+     *
46
+     * @return
47
+     */
48
+    Integer updateStatusByInvalidTime();
49
+}

+ 18
- 0
src/main/java/com/huiju/estateagents/sample/mapper/TaSampleContactMapper.java Vedi File

@@ -0,0 +1,18 @@
1
+package com.huiju.estateagents.sample.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.huiju.estateagents.sample.entity.TaSampleContact;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 样例与联系人关联表  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author fxf
13
+ * @since 2020-03-18
14
+ */
15
+@Mapper
16
+public interface TaSampleContactMapper extends BaseMapper<TaSampleContact> {
17
+
18
+}

+ 29
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaContactService.java Vedi File

@@ -0,0 +1,29 @@
1
+package com.huiju.estateagents.sample.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.sample.entity.TaContact;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 联系人表  服务类
13
+ * </p>
14
+ *
15
+ * @author fxf
16
+ * @since 2020-03-18
17
+ */
18
+public interface ITaContactService extends IService<TaContact> {
19
+    IPage<TaContact> taContactInfoBySampleId(String id, Integer pageNum, Integer pageSize);
20
+
21
+    /**
22
+     * 批量删除
23
+     *
24
+     * @param taContactList
25
+     * @param userId
26
+     * @return
27
+     */
28
+    ResponseBean batchDelete(List<TaContact> taContactList, Integer userId);
29
+}

+ 16
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaH5DemandService.java Vedi File

@@ -0,0 +1,16 @@
1
+package com.huiju.estateagents.sample.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.sample.entity.TaH5Demand;
5
+
6
+/**
7
+ * <p>
8
+ * 需求单表  服务类
9
+ * </p>
10
+ *
11
+ * @author fxf
12
+ * @since 2020-03-18
13
+ */
14
+public interface ITaH5DemandService extends IService<TaH5Demand> {
15
+
16
+}

+ 27
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaH5SampleService.java Vedi File

@@ -0,0 +1,27 @@
1
+package com.huiju.estateagents.sample.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
5
+import com.huiju.estateagents.sample.entity.TaH5Sample;
6
+
7
+/**
8
+ * <p>
9
+ * 样例表  服务类
10
+ * </p>
11
+ *
12
+ * @author fxf
13
+ * @since 2020-03-18
14
+ */
15
+public interface ITaH5SampleService extends IService<TaH5Sample> {
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
+
27
+}

+ 51
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaNoticeService.java Vedi File

@@ -0,0 +1,51 @@
1
+package com.huiju.estateagents.sample.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.base.ResponseBean;
5
+import com.huiju.estateagents.sample.entity.TaNotice;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 开屏通知  服务类
13
+ * </p>
14
+ *
15
+ * @author fxf
16
+ * @since 2020-03-18
17
+ */
18
+public interface ITaNoticeService extends IService<TaNotice> {
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);
44
+
45
+    /**
46
+     * 自动下架已过期的开屏通知
47
+     *
48
+     * @return
49
+     */
50
+    Integer updateStatusByInvalidTime();
51
+}

+ 16
- 0
src/main/java/com/huiju/estateagents/sample/service/ITaSampleContactService.java Vedi File

@@ -0,0 +1,16 @@
1
+package com.huiju.estateagents.sample.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.sample.entity.TaSampleContact;
5
+
6
+/**
7
+ * <p>
8
+ * 样例与联系人关联表  服务类
9
+ * </p>
10
+ *
11
+ * @author fxf
12
+ * @since 2020-03-18
13
+ */
14
+public interface ITaSampleContactService extends IService<TaSampleContact> {
15
+
16
+}

+ 61
- 0
src/main/java/com/huiju/estateagents/sample/service/impl/TaContactServiceImpl.java Vedi File

@@ -0,0 +1,61 @@
1
+package com.huiju.estateagents.sample.service.impl;
2
+
3
+
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.sample.entity.TaContact;
10
+import com.huiju.estateagents.sample.mapper.TaContactMapper;
11
+import com.huiju.estateagents.sample.mapper.TaH5SampleMapper;
12
+import com.huiju.estateagents.sample.service.ITaContactService;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Service;
15
+
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
19
+/**
20
+ * <p>
21
+ * 联系人表  服务实现类
22
+ * </p>
23
+ *
24
+ * @author fxf
25
+ * @since 2020-03-18
26
+ */
27
+@Service
28
+public class TaContactServiceImpl extends ServiceImpl<TaContactMapper, TaContact> implements ITaContactService {
29
+
30
+    @Autowired
31
+    private TaContactMapper taContactMapper;
32
+
33
+    @Autowired
34
+    private TaH5SampleMapper taH5SampleMapper;
35
+
36
+    @Override
37
+    public IPage<TaContact> taContactInfoBySampleId(String id, Integer pageNum, Integer pageSize) {
38
+        IPage<TaContact> pg = new Page<>(pageNum, pageSize);
39
+        return taContactMapper.taContactInfoBySampleId(pg, id);
40
+    }
41
+
42
+    @Override
43
+    public ResponseBean batchDelete(List<TaContact> taContactList, Integer userId) {
44
+        ResponseBean responseBean = new ResponseBean();
45
+
46
+        List<TaContact> updateList = new ArrayList<>();
47
+        TaContact newContact;
48
+        for (TaContact taContact : taContactList) {
49
+            newContact = new TaContact();
50
+            newContact.setContactId(taContact.getContactId());
51
+            newContact.setStatus(CommConstant.STATUS_DELETE);
52
+            updateList.add(newContact);
53
+        }
54
+
55
+        // 更新样例表状态
56
+//        taH5SampleMapper.batchUpdateStatus(updateList, userId);
57
+
58
+        responseBean.addSuccess(updateBatchById(updateList));
59
+        return responseBean;
60
+    }
61
+}

+ 20
- 0
src/main/java/com/huiju/estateagents/sample/service/impl/TaH5DemandServiceImpl.java Vedi File

@@ -0,0 +1,20 @@
1
+package com.huiju.estateagents.sample.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.huiju.estateagents.sample.entity.TaH5Demand;
5
+import com.huiju.estateagents.sample.mapper.TaH5DemandMapper;
6
+import com.huiju.estateagents.sample.service.ITaH5DemandService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 需求单表  服务实现类
12
+ * </p>
13
+ *
14
+ * @author fxf
15
+ * @since 2020-03-18
16
+ */
17
+@Service
18
+public class TaH5DemandServiceImpl extends ServiceImpl<TaH5DemandMapper, TaH5Demand> implements ITaH5DemandService {
19
+
20
+}

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

@@ -0,0 +1,38 @@
1
+package com.huiju.estateagents.sample.service.impl;
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;
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;
10
+import com.huiju.estateagents.sample.entity.TaH5Sample;
11
+import com.huiju.estateagents.sample.mapper.TaH5SampleMapper;
12
+import com.huiju.estateagents.sample.service.ITaH5SampleService;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Service;
15
+
16
+/**
17
+ * <p>
18
+ * 样例表  服务实现类
19
+ * </p>
20
+ *
21
+ * @author fxf
22
+ * @since 2020-03-18
23
+ */
24
+@Service
25
+public class TaH5SampleServiceImpl extends ServiceImpl<TaH5SampleMapper, TaH5Sample> implements ITaH5SampleService {
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
+    }
38
+}

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

@@ -0,0 +1,83 @@
1
+package com.huiju.estateagents.sample.service.impl;
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;
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.sample.entity.TaNotice;
10
+import com.huiju.estateagents.sample.mapper.TaNoticeMapper;
11
+import com.huiju.estateagents.sample.service.ITaNoticeService;
12
+import lombok.extern.slf4j.Slf4j;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Service;
15
+
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
19
+/**
20
+ * <p>
21
+ * 开屏通知  服务实现类
22
+ * </p>
23
+ *
24
+ * @author fxf
25
+ * @since 2020-03-18
26
+ */
27
+@Slf4j
28
+@Service
29
+public class TaNoticeServiceImpl extends ServiceImpl<TaNoticeMapper, TaNotice> implements ITaNoticeService {
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
+    }
78
+
79
+    @Override
80
+    public Integer updateStatusByInvalidTime() {
81
+        return taNoticeMapper.updateStatusByInvalidTime();
82
+    }
83
+}

+ 20
- 0
src/main/java/com/huiju/estateagents/sample/service/impl/TaSampleContactServiceImpl.java Vedi File

@@ -0,0 +1,20 @@
1
+package com.huiju.estateagents.sample.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.huiju.estateagents.sample.entity.TaSampleContact;
5
+import com.huiju.estateagents.sample.mapper.TaSampleContactMapper;
6
+import com.huiju.estateagents.sample.service.ITaSampleContactService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 样例与联系人关联表  服务实现类
12
+ * </p>
13
+ *
14
+ * @author fxf
15
+ * @since 2020-03-18
16
+ */
17
+@Service
18
+public class TaSampleContactServiceImpl extends ServiceImpl<TaSampleContactMapper, TaSampleContact> implements ITaSampleContactService {
19
+
20
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaRaiseRecordService.java Vedi File

@@ -101,5 +101,5 @@ public interface ITaRaiseRecordService extends IService<TaRaiseRecord> {
101 101
      * @param houseLockingStatus
102 102
      * @return
103 103
      */
104
-    Boolean updateHouseLockingStatus(Integer raiseRecordId, String houseLockingStatus);
104
+    Boolean updateHouseLockingStatus(Integer raiseRecordId, String houseLockingStatus,String personId);
105 105
 }

+ 14
- 0
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java Vedi File

@@ -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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.center.taUser.entity.TaUser;
9
+import com.huiju.estateagents.center.taUser.service.impl.TaUserServiceImpl;
8 10
 import com.huiju.estateagents.common.CommConstant;
9 11
 import com.huiju.estateagents.common.StringUtils;
10 12
 import com.huiju.estateagents.entity.*;
@@ -97,6 +99,9 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
97 99
     @Autowired
98 100
     private TaRaiseRecordMapper taRaiseRecordMapper;
99 101
 
102
+    @Autowired
103
+    private TaUserServiceImpl taUserService;
104
+
100 105
     /**
101 106
      * 分页获取房源列表
102 107
      *
@@ -671,6 +676,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
671 676
         taRaiseRecordQueryWrapper.eq("raise_record_id", raiseRecordId);
672 677
         TaRaiseRecord raiseRecord = taRaiseRecordMapper.selectOne(taRaiseRecordQueryWrapper);
673 678
 
679
+        TaUser taUser = taUserService.getUserInfoById(userId, orgId);
674 680
         // 更新为锁定状态
675 681
         if ("locked".equals(type)) {
676 682
             // 校验当前房源状态
@@ -692,6 +698,10 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
692 698
             TaRaiseRecord taRaiseRecord = new TaRaiseRecord();
693 699
             taRaiseRecord.setRaiseRecordId(raiseRecordId);
694 700
             taRaiseRecord.setHouseLockingStatus("locked");
701
+            if(taUser != null){
702
+                taRaiseRecord.setUpdateUserName(taUser.getUserName());
703
+            }
704
+            taRaiseRecord.setUpdateDate(LocalDateTime.now());
695 705
             taRaiseRecordMapper.updateById(taRaiseRecord);
696 706
 
697 707
             // 更新关联表状态
@@ -723,6 +733,10 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
723 733
             TaRaiseRecord taRaiseRecord = new TaRaiseRecord();
724 734
             taRaiseRecord.setRaiseRecordId(raiseRecordId);
725 735
             taRaiseRecord.setHouseLockingStatus("unlocked");
736
+            if(taUser != null){
737
+                taRaiseRecord.setUpdateUserName(taUser.getUserName());
738
+            }
739
+            taRaiseRecord.setUpdateDate(LocalDateTime.now());
726 740
             taRaiseRecordMapper.updateById(taRaiseRecord);
727 741
 
728 742
             // 更新关联表状态

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaRaiseRecordServiceImpl.java Vedi File

@@ -316,8 +316,8 @@ public class TaRaiseRecordServiceImpl extends ServiceImpl<TaRaiseRecordMapper, T
316 316
     }
317 317
 
318 318
     @Override
319
-    public Boolean updateHouseLockingStatus(Integer raiseRecordId, String houseLockingStatus) {
319
+    public Boolean updateHouseLockingStatus(Integer raiseRecordId, String houseLockingStatus, String personId) {
320 320
         logger.info("TaRaiseRecordServiceImpl.updateHouseLockingStatus 接收参数:raiseRecordId:{},houseLockingStatus:{}", raiseRecordId, houseLockingStatus);
321
-        return taHousingResourcesMapper.updateHouseLockingStatus(raiseRecordId, houseLockingStatus);
321
+        return taHousingResourcesMapper.updateHouseLockingStatus(raiseRecordId, houseLockingStatus, personId);
322 322
     }
323 323
 }

+ 1
- 0
src/main/resources/mapper/TaHousingResourcesMapper.xml Vedi File

@@ -220,6 +220,7 @@
220 220
             t.update_date = now()
221 221
         WHERE
222 222
             t.house_id IN ( SELECT tr.house_id FROM ta_raise_house tr WHERE tr.raise_record_id = #{raiseRecordId})
223
+            AND t.house_locking_person = #{personId}
223 224
     </update>
224 225
 
225 226
     <select id="getHousingDetailById" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">

+ 14
- 0
src/main/resources/mapper/sample/TaContactMapper.xml Vedi File

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
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.TaContactMapper">
4
+
5
+    <select id="taContactInfoBySampleId" resultType="com.huiju.estateagents.sample.entity.TaContact">
6
+        SELECT
7
+            *
8
+        FROM
9
+            ta_contact t
10
+        WHERE
11
+            t.contact_id IN ( SELECT a.contact_id FROM ta_sample_contact a WHERE a.sample_id = #{id} )
12
+            AND t.`status` = 1
13
+    </select>
14
+</mapper>

+ 5
- 0
src/main/resources/mapper/sample/TaH5DemandMapper.xml Vedi File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
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.TaH5DemandMapper">
4
+
5
+</mapper>

+ 36
- 0
src/main/resources/mapper/sample/TaH5SampleMapper.xml Vedi File

@@ -0,0 +1,36 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
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">
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 sys_user t2 ON t.add_user = t2.user_id
13
+            LEFT JOIN sys_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 desc,
21
+            t.create_date desc
22
+    </select>
23
+
24
+    <update id="batchUpdateStatus">
25
+        UPDATE ta_h5_sample t
26
+            SET t.`status` = - 1,
27
+                t.update_user = #{userId},
28
+                t.update_date = NOW( )
29
+        WHERE
30
+            t.sample_id IN ( SELECT t2.sample_id FROM ta_sample_contact t2 WHERE t2.contact_id IN
31
+        <foreach collection="list" item="record" open="(" close=")" separator=",">
32
+            #{record.contactId}
33
+        </foreach>)
34
+    </update>
35
+
36
+</mapper>

+ 51
- 0
src/main/resources/mapper/sample/TaNoticeMapper.xml Vedi File

@@ -0,0 +1,51 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
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.TaNoticeMapper">
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
+                AND 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 >= NOW( )
40
+        ORDER BY
41
+            t.order_no DESC,
42
+            t.create_date DESC
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>
51
+</mapper>

+ 5
- 0
src/main/resources/mapper/sample/TaSampleContactMapper.xml Vedi File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
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.TaSampleContactMapper">
4
+
5
+</mapper>