Browse Source

* bug修复

顾绍勇 5 years ago
parent
commit
e36505f9d3

+ 5
- 3
src/main/java/com/huiju/estateagents/controller/TaHousingResourcesController.java View File

@@ -215,23 +215,25 @@ public class TaHousingResourcesController extends BaseController {
215 215
      * @param startPrice   房源起始价格
216 216
      * @param endPrice     房源结束价格
217 217
      * @param apartmentId  户型ID
218
+     * @param source       来源,raiseChoose 为认筹添加房源来源
218 219
      * @param request
219 220
      * @return
220 221
      * @author gushaoyong
221 222
      */
222 223
     @RequestMapping(value = "/wx/listHousingResources", method = RequestMethod.GET)
223 224
     public ResponseBean listHousingResources(@RequestParam(value = "salesBatchId") String salesBatchId,
224
-                                             String startPrice, String endPrice, String apartmentId,
225
+                                             String startPrice, String endPrice, String apartmentId, String source,
225 226
                                              HttpServletRequest request) {
226 227
         ResponseBean responseBean = new ResponseBean();
227 228
         Integer orgId = getOrgId(request);
229
+        String personId = getPersonId(request);
228 230
 
229 231
         logger.info("TaHouseingResourcesController.listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{}",
230 232
                 orgId, salesBatchId, startPrice, endPrice, apartmentId);
231 233
 
232 234
         try {
233 235
             //获取所有楼房的预选热度和认筹热度
234
-            List<TaHousingResourcesPO> taHousingResourcesPOList = iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId, 1);
236
+            List<TaHousingResourcesPO> taHousingResourcesPOList = iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId, personId, source);
235 237
             //此处处理我的预选,我的认筹,和我的锁定
236 238
             //我的预选记录
237 239
             QueryWrapper<TaPreselectionRecord> taPreselectionRecordQueryWrapper = new QueryWrapper<>();
@@ -293,7 +295,7 @@ public class TaHousingResourcesController extends BaseController {
293 295
         ResponseBean responseBean = new ResponseBean();
294 296
         Integer orgId = getOrgId(request);
295 297
         try {
296
-            responseBean.addSuccess(iTaHousingResourcesService.listHousingResources(orgId, salesBatchId, "", "", "", 0));
298
+            responseBean.addSuccess(iTaHousingResourcesService.listHousingResourcesForCms(orgId, salesBatchId, "", "", "", 0));
297 299
         } catch (Exception e) {
298 300
             logger.error("listHousingResourcesFormCms -=- {}", e);
299 301
             responseBean.addError(e.getMessage());

+ 23
- 6
src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java View File

@@ -31,7 +31,6 @@ public interface TaHousingResourcesMapper extends BaseMapper<TaHousingResources>
31 31
      * @param startPrice
32 32
      * @param endPrice
33 33
      * @param apartmentId
34
-     * @param type         为1只展示已发布的房源
35 34
      * @return
36 35
      */
37 36
     List<TaHousingResourcesPO> listHousingResources(@Param("orgId") Integer orgId,
@@ -39,7 +38,25 @@ public interface TaHousingResourcesMapper extends BaseMapper<TaHousingResources>
39 38
                                                     @Param("startPrice") String startPrice,
40 39
                                                     @Param("endPrice") String endPrice,
41 40
                                                     @Param("apartmentId") String apartmentId,
42
-                                                    @Param("type") Integer type);
41
+                                                    @Param("personId") String personId,
42
+                                                    @Param("source") String source);
43
+
44
+    /**
45
+     * 分页获取房源列表
46
+     *
47
+     * @param salesBatchId
48
+     * @param startPrice
49
+     * @param endPrice
50
+     * @param apartmentId
51
+     * @param type         为1只展示已发布的房源
52
+     * @return
53
+     */
54
+    List<TaHousingResourcesPO> listHousingResourcesForCms(@Param("orgId") Integer orgId,
55
+                                                          @Param("salesBatchId") String salesBatchId,
56
+                                                          @Param("startPrice") String startPrice,
57
+                                                          @Param("endPrice") String endPrice,
58
+                                                          @Param("apartmentId") String apartmentId,
59
+                                                          @Param("type") Integer type);
43 60
 
44 61
     /**
45 62
      * 获取某销售批次下所有房源户型
@@ -125,10 +142,10 @@ public interface TaHousingResourcesMapper extends BaseMapper<TaHousingResources>
125 142
      * @return
126 143
      */
127 144
     Integer batchUpdateHeat(@Param("housingResourcesList") List<TaHousingResources> housingResourcesList,
128
-                                 @Param("heat") Integer heat,
129
-                                 @Param("updateUser") Integer updateUser,
130
-                                 @Param("salesBatchId") Integer salesBatchId,
131
-                                 @Param("orgId") Integer orgId);
145
+                            @Param("heat") Integer heat,
146
+                            @Param("updateUser") Integer updateUser,
147
+                            @Param("salesBatchId") Integer salesBatchId,
148
+                            @Param("orgId") Integer orgId);
132 149
 
133 150
     /**
134 151
      * 根据认筹单ID查询房源列表

+ 13
- 1
src/main/java/com/huiju/estateagents/service/ITaHousingResourcesService.java View File

@@ -29,7 +29,19 @@ public interface ITaHousingResourcesService extends IService<TaHousingResources>
29 29
      * @param type  为1只展示已发布的房源
30 30
      * @return
31 31
      */
32
-    List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type);
32
+    List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId,String personId,String source );
33
+
34
+
35
+    /* 分页获取房源列表-后台管理端
36
+     *
37
+     * @param salesBatchId 销售批次ID
38
+     * @param startPrice
39
+     * @param endPrice
40
+     * @param apartmentId
41
+     * @param type  为1只展示已发布的房源
42
+     * @return
43
+     */
44
+    List<TaHousingResourcesPO> listHousingResourcesForCms(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type);
33 45
 
34 46
     /**
35 47
      * 获取某销售批次下所有房源户型

+ 30
- 12
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java View File

@@ -9,15 +9,9 @@ import com.huiju.estateagents.common.CommConstant;
9 9
 import com.huiju.estateagents.common.StringUtils;
10 10
 import com.huiju.estateagents.entity.*;
11 11
 import com.huiju.estateagents.mapper.*;
12
-import com.huiju.estateagents.mapper.TaApartmentImgMapper;
13
-import com.huiju.estateagents.mapper.TaBuildingImgMapper;
14
-import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
15
-import com.huiju.estateagents.mapper.TaPreselectionRecordMapper;
16 12
 import com.huiju.estateagents.po.BuildingImgPO;
17 13
 import com.huiju.estateagents.po.TaHousingResourcesPO;
18 14
 import com.huiju.estateagents.service.ITaHousingResourcesService;
19
-import com.huiju.estateagents.service.ITaPersonService;
20
-import io.swagger.models.auth.In;
21 15
 import org.apache.commons.collections.CollectionUtils;
22 16
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
23 17
 import org.apache.poi.ss.usermodel.Row;
@@ -107,19 +101,43 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
107 101
      * @param startPrice
108 102
      * @param endPrice
109 103
      * @param apartmentId
104
+     * @return
105
+     */
106
+    @Override
107
+    public List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId,
108
+                                                           String personId, String source) {
109
+        logger.info("listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{},source:{}",
110
+                orgId, salesBatchId, startPrice, endPrice, apartmentId, source);
111
+
112
+        startPrice = StringUtils.isEmpty(startPrice) ? null : startPrice;
113
+        endPrice = StringUtils.isEmpty(endPrice) ? null : endPrice;
114
+
115
+        List<TaHousingResourcesPO> resourcesPOList =
116
+                taHousingResourcesMapper.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId, personId, source);
117
+
118
+        return resourcesPOList;
119
+    }
120
+
121
+    /**
122
+     * 分页获取房源列表-后台管理端
123
+     *
124
+     * @param salesBatchId 销售批次ID
125
+     * @param startPrice
126
+     * @param endPrice
127
+     * @param apartmentId
110 128
      * @param type
111 129
      * @return
112 130
      */
113 131
     @Override
114
-    public List<TaHousingResourcesPO> listHousingResources(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type) {
115
-        logger.info("listHousingResources 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{},type:{}",
132
+    public List<TaHousingResourcesPO> listHousingResourcesForCms(Integer orgId, String salesBatchId, String startPrice, String endPrice, String apartmentId, Integer type) {
133
+        logger.info("listHousingResourcesForCms 接收参数:orgId:{},salesBatchId:{},startPrice:{},endPrice:{},apartmentId:{},type:{}",
116 134
                 orgId, salesBatchId, startPrice, endPrice, apartmentId, type);
117 135
 
118 136
         startPrice = StringUtils.isEmpty(startPrice) ? null : startPrice;
119 137
         endPrice = StringUtils.isEmpty(endPrice) ? null : endPrice;
120 138
 
121 139
         List<TaHousingResourcesPO> resourcesPOList =
122
-                taHousingResourcesMapper.listHousingResources(orgId, salesBatchId, startPrice, endPrice, apartmentId, type);
140
+                taHousingResourcesMapper.listHousingResourcesForCms(orgId, salesBatchId, startPrice, endPrice, apartmentId, type);
123 141
 
124 142
         return resourcesPOList;
125 143
     }
@@ -257,7 +275,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
257 275
         TaRaise taRaise = taRaiseMapper.selectOne(taRaiseQueryWrapper);
258 276
         if (null == taRaise) {
259 277
             resourcesPO.setRaiseBtn(false);
260
-        }else{
278
+        } else {
261 279
             resourcesPO.setTaRaise(taRaise);
262 280
         }
263 281
 
@@ -667,7 +685,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
667 685
                 responseBean.addSuccess(taRaiseHouseService.updateById(raiseHouse));
668 686
                 return responseBean;
669 687
             }
670
-            responseBean.addError("无权操作");
688
+            responseBean.addError("权限不足");
671 689
             return responseBean;
672 690
         }
673 691
 
@@ -693,7 +711,7 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
693 711
                 responseBean.addSuccess(taRaiseHouseService.updateById(raiseHouse));
694 712
                 return responseBean;
695 713
             }
696
-            responseBean.addError("无权操作");
714
+            responseBean.addError("权限不足");
697 715
             return responseBean;
698 716
         }
699 717
         responseBean.addError("fail");

+ 96
- 0
src/main/resources/mapper/TaHousingResourcesMapper.xml View File

@@ -3,6 +3,102 @@
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaHousingResourcesMapper">
4 4
 
5 5
     <select id="listHousingResources" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
6
+        SELECT
7
+        *
8
+        FROM
9
+        (
10
+        SELECT
11
+        t.house_id,
12
+        (
13
+        CASE
14
+        WHEN ( SELECT num_char_extract ( t.term_name, 2 ) + 0 ) = 0 THEN
15
+        ( SELECT num_char_extract ( t.term_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.term_name, 2 ) + 0 )
16
+        END
17
+        ) termNamePre,
18
+        (
19
+        CASE
20
+        WHEN ( SELECT num_char_extract ( t.block_name, 2 ) + 0 ) = 0 THEN
21
+        ( SELECT num_char_extract ( t.block_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.block_name, 2 ) + 0 )
22
+        END
23
+        ) blockNamePre,
24
+        (
25
+        CASE
26
+        WHEN ( SELECT num_char_extract ( t.unit_name, 2 ) + 0 ) = 0 THEN
27
+        ( SELECT num_char_extract ( t.unit_name, 2 ) ) ELSE ( SELECT num_char_extract ( t.unit_name, 2 ) + 0 )
28
+        END
29
+        ) unitNamePre,
30
+        t.building_id,
31
+        t.block_id,
32
+        t.block_name,
33
+        t.sales_batch_id,
34
+        t.unit_id,
35
+        t.unit_name,
36
+        t.floor_id,
37
+        t.floor_name,
38
+        t.room_id,
39
+        t.room_name,
40
+        t.price,
41
+        t.heat,
42
+        t.real_heat,
43
+        t.apartment_id,
44
+        t.`status`,
45
+        t.org_id,
46
+        t2.inside_area,
47
+        t2.building_area,
48
+        t2.apartment_name,
49
+        t3.term_id,
50
+        t.term_name,
51
+        t.raise_heat,
52
+        t.raise_real_heat,
53
+        t.house_locking_status
54
+        FROM
55
+        ta_housing_resources t
56
+        LEFT JOIN ta_building_apartment t2 ON t.apartment_id = t2.apartment_id
57
+        LEFT JOIN ta_building_block t3 ON t.block_id = t3.block_id
58
+        LEFT JOIN ta_sales_batch t4 ON t.sales_batch_id = t4.sales_batch_id
59
+        <if test="source == 'raiseChoose'">
60
+            LEFT JOIN ta_raise_house t5 ON t.house_id = t5.house_id
61
+            LEFT JOIN ta_raise_record t6 ON t6.raise_record_id = t5.raise_record_id
62
+        </if>
63
+        WHERE
64
+        t.sales_batch_id = #{salesBatchId}
65
+        AND t.org_id = #{orgId}
66
+        AND t.`status` > 0
67
+        AND t4.`status` = 1
68
+        <if test = "source == 'raiseChoose'">
69
+            AND ( t6.`status` != 0 OR t6.`status` IS NULL )
70
+            <if test="personId != null and personId != ''">
71
+                AND t6.person_id != #{personId}
72
+            </if>
73
+            AND (t.house_locking_status  != 'locked'
74
+            OR t.house_locking_status IS NULL)
75
+        </if>
76
+        <choose>
77
+            <when test=" endPrice != null and startPrice == null">
78
+                AND t.price &lt;= #{endPrice}
79
+            </when>
80
+            <when test=" startPrice != null and endPrice == null">
81
+                AND t.price &gt;= #{startPrice}
82
+            </when>
83
+            <when test="startPrice != null and endPrice != null ">
84
+                AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
85
+            </when>
86
+            <otherwise>
87
+            </otherwise>
88
+        </choose>
89
+        <if test="apartmentId != null and apartmentId != ''">
90
+            AND t.apartment_id = #{apartmentId}
91
+        </if>
92
+        ) t5
93
+        ORDER BY
94
+        t5.termNamePre,
95
+        t5.blockNamePre,
96
+        t5.unitNamePre,
97
+        ( SELECT num_char_extract ( t5.floor_name, 2 ) + 0 ) DESC,
98
+        ( SELECT num_char_extract ( t5.room_name, 2 ) + 0)
99
+    </select>
100
+
101
+    <select id="listHousingResourcesForCms" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
6 102
         SELECT
7 103
         *
8 104
         FROM