yansen 5 年之前
父節點
當前提交
28f71c3979

+ 2
- 2
pom.xml 查看文件

10
 	</parent>
10
 	</parent>
11
 	<groupId>com.huiju</groupId>
11
 	<groupId>com.huiju</groupId>
12
 	<artifactId>estateagents</artifactId>
12
 	<artifactId>estateagents</artifactId>
13
-	<version>v0.3.2</version>
14
-	<name>estateagents</name>
13
+	<version>v2.5.1</version>
14
+	<name>estateages</name>
15
 	<description>置业经纪人</description>
15
 	<description>置业经纪人</description>
16
 
16
 
17
 	<properties>
17
 	<properties>

+ 36
- 6
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java 查看文件

20
 import javax.servlet.http.HttpServletRequest;
20
 import javax.servlet.http.HttpServletRequest;
21
 import javax.servlet.http.HttpSession;
21
 import javax.servlet.http.HttpSession;
22
 import java.time.LocalDateTime;
22
 import java.time.LocalDateTime;
23
+import java.util.ArrayList;
23
 import java.util.List;
24
 import java.util.List;
24
 
25
 
25
 /**
26
 /**
189
             @RequestParam(defaultValue = "false") Boolean mine,
190
             @RequestParam(defaultValue = "false") Boolean mine,
190
             @RequestParam(required = false) Integer cityId,
191
             @RequestParam(required = false) Integer cityId,
191
             @RequestParam(required = false) String name,
192
             @RequestParam(required = false) String name,
193
+            @RequestParam(required = false) String buildingType, // 项目类型Id
192
             @RequestParam(required = false) String houseType, // 户型
194
             @RequestParam(required = false) String houseType, // 户型
193
-            @RequestParam(required = false) Integer buildingTypeId, // 项目类型Id
194
-            @RequestParam(required = false) Integer minPrice, // 最低价格
195
-            @RequestParam(required = false) Integer maxPrice, // 最高价格
196
-            @RequestParam(required = false) Double minBuildingArea, // 最小面积
197
-            @RequestParam(required = false) Double maxBuildingArea, // 最大面积
195
+            @RequestParam(required = false) String price,   // 价格
196
+            @RequestParam(required = false) String area,    // 面积
197
+//            @RequestParam(required = false) Integer minPrice, // 最低价格
198
+//            @RequestParam(required = false) Integer maxPrice, // 最高价格
199
+//            @RequestParam(required = false) Double minBuildingArea, // 最小面积
200
+//            @RequestParam(required = false) Double maxBuildingArea, // 最大面积
198
             HttpServletRequest request
201
             HttpServletRequest request
199
     ){
202
     ){
200
         List<String> targets = null;
203
         List<String> targets = null;
208
             targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
211
             targets = iTaSaveService.getTargesOfPerson(persons.get(0).getPersonId(), CommConstant.FAVOR_PROJECT);
209
         }
212
         }
210
 
213
 
211
-        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine, houseType, buildingTypeId, minPrice, maxPrice, minBuildingArea, maxBuildingArea);
214
+        String[] buildingTypeList = null != buildingType ? buildingType.split(",") : null;
215
+        String[] houseTypeList = null != houseType ? houseType.split(",") : null;
216
+        List<String[]> priceList = getParamListOf(price);
217
+        List<String[]> areaList = getParamListOf(area);
218
+
219
+        return taBuildingService.getWxBuildingList(pageNum, pageSize, name, targets, cityId,mine, houseTypeList, buildingTypeList, priceList, areaList);
212
     }
220
     }
213
 
221
 
222
+
223
+    /**
224
+     * 先按照 逗号 拆分, 再按照 横线 拆分
225
+     * @param params
226
+     * @return
227
+     */
228
+    private List<String[]> getParamListOf(String params) {
229
+        List<String[]> paramList = new ArrayList<>();
230
+
231
+        if (null == params || "".equals(params.trim())) {
232
+            return paramList;
233
+        }
234
+
235
+        String[] paramsArray = params.split(",");
236
+        for(String param : paramsArray) {
237
+            paramList.add(param.split("-"));
238
+        }
239
+
240
+        return paramList;
241
+    }
242
+
243
+
214
     /**
244
     /**
215
      * 微信推荐楼盘列表
245
      * 微信推荐楼盘列表
216
      * @return
246
      * @return

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java 查看文件

99
     }
99
     }
100
 
100
 
101
     /**
101
     /**
102
-     * 推荐客户
102
+     * 报备客户
103
      * @param paramStr
103
      * @param paramStr
104
      * @param request
104
      * @param request
105
      * @return
105
      * @return

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaSaveController.java 查看文件

12
 
12
 
13
 /**
13
 /**
14
  * <p>
14
  * <p>
15
- * 收藏表  前端控制器
15
+ * 表  前端控制器
16
  * </p>
16
  * </p>
17
  *
17
  *
18
  * @author jobob
18
  * @author jobob

+ 12
- 6
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java 查看文件

62
      * @param name
62
      * @param name
63
      * @param cityId
63
      * @param cityId
64
      * @param targets
64
      * @param targets
65
-     * @param houseType
66
-     * @param buildingTypeId
65
+     * @param houseTypeList
66
+     * @param buildingTypeList
67
+     * @param priceList
68
+     * @param areaList
67
      * @return
69
      * @return
68
      */
70
      */
69
-    IPage<TaBuilding> selectBuildingPage(IPage<TaBuilding> page, @Param("name") String name, @Param("cityId") Integer cityId,
70
-                                         @Param("targets") List<String> targets, @Param("houseType") String houseType, @Param("buildingTypeId") Integer buildingTypeId,
71
-                                         @Param("minPrice") Integer minPrice, @Param("maxPrice") Integer maxPrice,
72
-                                         @Param("minBuildingArea") Double minBuildingArea, @Param("maxBuildingArea") Double maxBuildingArea);
71
+    IPage<TaBuilding> selectBuildingPage(IPage<TaBuilding> page,
72
+                                         @Param("name") String name,
73
+                                         @Param("cityId") Integer cityId,
74
+                                         @Param("targets") List<String> targets,
75
+                                         @Param("houseTypeList") String[] houseTypeList,
76
+                                         @Param("buildingTypeList") String[] buildingTypeList,
77
+                                         @Param("priceList") List<String[]> priceList,
78
+                                         @Param("areaList") List<String[]> areaList);
73
 
79
 
74
 }
80
 }

+ 10
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java 查看文件

117
      * @param pageSize
117
      * @param pageSize
118
      * @param name
118
      * @param name
119
      */
119
      */
120
-    ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId,boolean mine, String houseType, Integer buildingTypeId, Integer minPrice, Integer maxPrice, Double minBuildingArea, Double maxBuildingArea);
120
+    ResponseBean getWxBuildingList(
121
+            Integer pageNum,
122
+            Integer pageSize,
123
+            String name,
124
+            List<String> targets,
125
+            Integer cityId,boolean mine,
126
+            String[] houseTypeList,
127
+            String[] buildingTypeList,
128
+            List<String[]> priceList,
129
+            List<String[]> areaList);
121
 
130
 
122
     /**
131
     /**
123
      * 微信小程序 楼盘列表
132
      * 微信小程序 楼盘列表

+ 17
- 9
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java 查看文件

381
     }
381
     }
382
 
382
 
383
     @Override
383
     @Override
384
-    public ResponseBean getWxBuildingList(Integer pageNum, Integer pageSize, String name, List<String> targets,Integer cityId,boolean mine, String houseType, Integer buildingTypeId, Integer minPrice, Integer maxPrice, Double minBuildingArea, Double maxBuildingArea) {
384
+    public ResponseBean getWxBuildingList(
385
+            Integer pageNum,
386
+            Integer pageSize,
387
+            String name,
388
+            List<String> targets,
389
+            Integer cityId,
390
+            boolean mine,
391
+            String[] houseTypeList,
392
+            String[] buildingTypeList,
393
+            List<String[]> priceList,
394
+            List<String[]> areaList) {
385
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
395
         IPage<TaBuilding> page = new Page<>(pageNum, pageSize);
386
 
396
 
397
+        if(CollectionUtils.isEmpty(targets) && mine){
398
+            return ResponseBean.success(page);
399
+        }
400
+
387
 //        QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
401
 //        QueryWrapper<TaBuilding> buildingQueryWrapper = new QueryWrapper<>();
388
 //        buildingQueryWrapper.nested(null != name && !"".equals(name.trim()), i -> i.like("name", name).or().like("building_name", name));
402
 //        buildingQueryWrapper.nested(null != name && !"".equals(name.trim()), i -> i.like("name", name).or().like("building_name", name));
389
 //        buildingQueryWrapper.eq("status", 1);
403
 //        buildingQueryWrapper.eq("status", 1);
395
 //
409
 //
396
 //        IPage<TaBuilding> result = taBuildingMapper.selectPage(page, buildingQueryWrapper);
410
 //        IPage<TaBuilding> result = taBuildingMapper.selectPage(page, buildingQueryWrapper);
397
 
411
 
398
-        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, houseType,buildingTypeId, minPrice, maxPrice, minBuildingArea, maxBuildingArea);
412
+        IPage<TaBuilding> result = taBuildingMapper.selectBuildingPage(page, name, cityId, targets, houseTypeList, buildingTypeList, priceList, areaList);
399
 
413
 
400
         List<TaBuilding> buildingList = result.getRecords();
414
         List<TaBuilding> buildingList = result.getRecords();
401
         if (CollectionUtils.isNotEmpty(buildingList)) {
415
         if (CollectionUtils.isNotEmpty(buildingList)) {
403
                 getBuildingAttaches(build);
417
                 getBuildingAttaches(build);
404
             }
418
             }
405
         }
419
         }
406
-        if(CollectionUtils.isEmpty(targets) && mine){
407
-            return ResponseBean.success(null);
408
-        }else {
409
-            return ResponseBean.success(result);
410
-        }
411
-
412
-
413
 
420
 
421
+        return ResponseBean.success(result);
414
     }
422
     }
415
 
423
 
416
     private void getBuildingAttaches(TaBuilding build) {
424
     private void getBuildingAttaches(TaBuilding build) {

+ 25
- 23
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java 查看文件

229
         }
229
         }
230
         TaPerson taPerson = taPersons.get(0);
230
         TaPerson taPerson = taPersons.get(0);
231
 
231
 
232
-        String checkResult = checkCustomerParams(params);
233
-        if (null != checkResult) {
234
-            return ResponseBean.error(checkResult, ResponseBean.ERROR_MISSING_PARAMS);
235
-        }
232
+//        String checkResult = checkCustomerParams(params);
233
+//        if (null != checkResult) {
234
+//            return ResponseBean.error(checkResult, ResponseBean.ERROR_MISSING_PARAMS);
235
+//        }
236
 
236
 
237
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
237
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
238
 
238
 
239
-        taRecommendCustomer.setName(params.getString("name"));
240
-        taRecommendCustomer.setPicture(params.getString("picture"));
239
+        taRecommendCustomer.setName(taPerson.getNickname());
240
+        taRecommendCustomer.setPicture(taPerson.getAvatarurl());
241
         taRecommendCustomer.setPhone(params.getString("phone"));
241
         taRecommendCustomer.setPhone(params.getString("phone"));
242
-        taRecommendCustomer.setSex(params.getInteger("sex"));
243
-        taRecommendCustomer.setDescribe(params.getString("describe"));
244
-        taRecommendCustomer.setRealtyConsultant(params.getString("RealtyConsultant"));
242
+        taRecommendCustomer.setSex(null == taPerson.getGender() ? null : ("1".equals(taPerson.getGender()) ? 1 : 2));
243
+//        taRecommendCustomer.setDescribe(params.getString("describe"));
244
+        taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
245
         taRecommendCustomer.setBuildingId(params.getString("buildingId"));
245
         taRecommendCustomer.setBuildingId(params.getString("buildingId"));
246
         taRecommendCustomer.setReportRecommendStatus(CommConstant.REPORTED);
246
         taRecommendCustomer.setReportRecommendStatus(CommConstant.REPORTED);
247
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
247
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
248
         taRecommendCustomer.setReportDate(LocalDateTime.now());
248
         taRecommendCustomer.setReportDate(LocalDateTime.now());
249
 
249
 
250
         // 时间格式 yyyy-MM-dd
250
         // 时间格式 yyyy-MM-dd
251
-        String at = params.getString("appointmentTime");
252
-        if (!StringUtils.isEmpty(at)) {
253
-            taRecommendCustomer.setAppointmentTime(DateUtils.day2LocalDateime(at));
254
-        }
251
+//        String at = params.getString("appointmentTime");
252
+//        if (!StringUtils.isEmpty(at)) {
253
+//            taRecommendCustomer.setAppointmentTime(DateUtils.day2LocalDateime(at));
254
+//        }ni
255
 
255
 
256
 //        taRecommendCustomer.setAppointmentTime((String) params.get("appointmentTime"));
256
 //        taRecommendCustomer.setAppointmentTime((String) params.get("appointmentTime"));
257
-        taRecommendCustomer.setVisiteNum(params.getInteger("visiteNum"));
258
-        taRecommendCustomer.setIntention(params.getString("intention"));
259
-        taRecommendCustomer.setRealtyManageType(params.getString("realtyManageType"));
260
-        taRecommendCustomer.setDemandType(params.getString("demandType"));
261
-        taRecommendCustomer.setPriceRange(params.getString("priceRange"));
262
-        taRecommendCustomer.setEntryType(CommConstant.ENTRY_INPUT);
257
+//        taRecommendCustomer.setVisiteNum(params.getInteger("visiteNum"));
258
+//        taRecommendCustomer.setIntention(params.getString("intention"));
259
+//        taRecommendCustomer.setRealtyManageType(params.getString("realtyManageType"));
260
+//        taRecommendCustomer.setDemandType(params.getString("demandType"));
261
+//        taRecommendCustomer.setPriceRange(params.getString("priceRange"));
262
+        taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
263
         taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
263
         taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
264
+        taRecommendCustomer.setStatus(CommConstant.STATUS_NORMAL + "");
264
 
265
 
265
 
266
 
266
-        String status = params.getString("status");
267
-        if (null == status) status = "1";
268
-        taRecommendCustomer.setStatus(status);
269
-        taRecommendCustomer.setRecommendPerson(taPerson.getPersonId());
267
+//        String status = params.getString("status");
268
+//        if (null == status) status = "1";
269
+//        taRecommendCustomer.setStatus(status);
270
+//        taRecommendCustomer.setRecommendPerson(taPerson.getPersonId());
271
+        taRecommendCustomer.setRecommendPerson(params.getString("realtyConsultant"));
270
 
272
 
271
         // 报备有 10 天有效期
273
         // 报备有 10 天有效期
272
         QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
274
         QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();

+ 49
- 22
src/main/resources/mapper/TaBuildingMapper.xml 查看文件

89
                 <if test="cityId != null">
89
                 <if test="cityId != null">
90
                     AND city_id = #{cityId}
90
                     AND city_id = #{cityId}
91
                 </if>
91
                 </if>
92
-                <if test="buildingTypeId != null">
93
-                    AND building_type = #{buildingTypeId}
94
-                </if>
95
                 <if test="targets != null">
92
                 <if test="targets != null">
96
-                    AND building_id IN (#{targets})
93
+                    AND building_id IN
94
+                    <foreach collection="targets" item="buildingId" open="(" close=")" separator=",">
95
+                        #{buildingId}
96
+                    </foreach>
97
                 </if>
97
                 </if>
98
                 <if test="name != null and name !=''">
98
                 <if test="name != null and name !=''">
99
                     AND `name` LIKE CONCAT('%',#{name},'%')
99
                     AND `name` LIKE CONCAT('%',#{name},'%')
101
                 </if>
101
                 </if>
102
             ) as tb
102
             ) as tb
103
 
103
 
104
-            <if test="minPrice != null or maxPrice != null or buildingTypeId != null">
105
-                INNER JOIN
104
+            <if test="priceList != null or buildingTypeList != null">
105
+                LEFT JOIN
106
                 (
106
                 (
107
                 SELECT * FROM ta_building_project_type
107
                 SELECT * FROM ta_building_project_type
108
                 <trim prefix="where" prefixOverrides="and | or">
108
                 <trim prefix="where" prefixOverrides="and | or">
109
-                    <if test="minPrice != null and maxPrice != null">
110
-                        and price BETWEEN #{minPrice} AND #{maxPrice}
111
-                    </if>
112
-                    <if test="minPrice != null and maxPrice == null">
113
-                        <![CDATA[  and price >= #{minPrice}  ]]>
114
-                    </if>
115
-                    <if test="minPrice == null and maxPrice != null">
116
-                        <![CDATA[  and price <= #{maxPrice}  ]]>
109
+
110
+                    <if test="priceList != null">
111
+                        <foreach collection="priceList" item="priceArr" open="(" close=")" separator=" OR ">
112
+                            (
113
+                                <if test="priceArr[0] != null and priceArr[0] > 0">
114
+                                    <![CDATA[ price >= ${priceArr[0]}  ]]>
115
+                                </if>
116
+                                <if test="priceArr.length > 1 and priceArr[0] != null">
117
+                                    AND
118
+                                </if>
119
+                                <if test="priceArr[1] != null and priceArr[1] > 0">
120
+                                    <![CDATA[ price <= ${priceArr[1]}  ]]>
121
+                                </if>
122
+                            )
123
+                        </foreach>
117
                     </if>
124
                     </if>
118
-                    <if test="buildingTypeId != null">
119
-                        AND building_type_id = #{buildingTypeId}
125
+
126
+                    <if test="buildingTypeList != null">
127
+                        AND building_type_id in
128
+                        <foreach collection="buildingTypeList" item="buildingType" open="(" close=")" separator=",">
129
+                            #{buildingType}
130
+                        </foreach>
120
                     </if>
131
                     </if>
121
                 </trim>
132
                 </trim>
122
                 GROUP BY building_id
133
                 GROUP BY building_id
124
                 AS tbpt ON tb.building_id = tbpt.building_id
135
                 AS tbpt ON tb.building_id = tbpt.building_id
125
             </if>
136
             </if>
126
 
137
 
127
-            <if test="minBuildingArea != null or maxBuildingArea != null or (houseType != null and houseType != '')">
128
-                INNER JOIN
138
+            <if test="areaList != null or houseTypeList != null">
139
+                LEFT JOIN
129
                 (
140
                 (
130
                 SELECT * FROM ta_building_apartment
141
                 SELECT * FROM ta_building_apartment
131
                 <trim prefix="where" prefixOverrides="and | or">
142
                 <trim prefix="where" prefixOverrides="and | or">
132
-                    <if test="minBuildingArea != null and maxBuildingArea != null">
133
-                        and building_area BETWEEN #{minBuildingArea} AND #{maxBuildingArea}
143
+                    <if test="areaList != null">
144
+                        <foreach collection="areaList" item="areaArr" open="(" close=")" separator=" OR ">
145
+                            (
146
+                                <if test="areaArr[0] != null and areaArr[0] > 0">
147
+                                    <![CDATA[ building_area >= ${areaArr[0]}  ]]>
148
+                                </if>
149
+                                <if test="areaArr.length > 1 and areaArr[0] != null">
150
+                                    AND
151
+                                </if>
152
+                                <if test="areaArr[1] != null and areaArr[1] > 0">
153
+                                    <![CDATA[ building_area <= ${areaArr[1]}  ]]>
154
+                                </if>
155
+                            )
156
+                        </foreach>
134
                     </if>
157
                     </if>
135
-                    <if test="houseType != null and houseType != ''">
136
-                        AND house_type = #{houseType}
158
+
159
+                    <if test="houseTypeList != null">
160
+                        AND house_type in
161
+                        <foreach collection="houseTypeList" item="houseType" open="(" close=")" separator=",">
162
+                            #{houseType}
163
+                        </foreach>
137
                     </if>
164
                     </if>
138
                 </trim>
165
                 </trim>
139
                 GROUP BY building_id
166
                 GROUP BY building_id