瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents into dev

魏超 5 年之前
父節點
當前提交
8dc60f923f

+ 8
- 0
src/main/java/com/huiju/estateagents/controller/TaRaiseRecordController.java 查看文件

189
                 record.setInvalidReason(raiseRecord.getInvalidReason());
189
                 record.setInvalidReason(raiseRecord.getInvalidReason());
190
                 record.setUpdateDate(LocalDateTime.now());
190
                 record.setUpdateDate(LocalDateTime.now());
191
                 record.setStatus(0);
191
                 record.setStatus(0);
192
+
193
+                // 更新房源认筹热度
194
+                iTaRaiseRecordService.updateForSubtractRaiseHeat(record.getRaiseRecordId());
195
+
192
                 //发送订阅消息
196
                 //发送订阅消息
193
                 iTaRaiseRecordService.sendRaiseMsg(record.getRaiseRecordId(),record.getRaiseId(),"在线选房认筹通知","认筹单已作废","点击详情查看认筹单","具体原因查看详情",false);
197
                 iTaRaiseRecordService.sendRaiseMsg(record.getRaiseRecordId(),record.getRaiseId(),"在线选房认筹通知","认筹单已作废","点击详情查看认筹单","具体原因查看详情",false);
194
             });
198
             });
232
                 }
236
                 }
233
                 record.setStatus(CommConstant.STATUS_DELETE);
237
                 record.setStatus(CommConstant.STATUS_DELETE);
234
                 record.setUpdateDate(LocalDateTime.now());
238
                 record.setUpdateDate(LocalDateTime.now());
239
+
240
+                // 更新房源认筹热度
241
+                iTaRaiseRecordService.updateForSubtractRaiseHeat(record.getRaiseRecordId());
242
+
235
                 //发送订阅消息
243
                 //发送订阅消息
236
                 iTaRaiseRecordService.sendRaiseMsg(record.getRaiseRecordId(),record.getRaiseId(),"在线选房认筹通知","认筹单已作废","点击详情查看认筹单","具体原因查看详情",false);
244
                 iTaRaiseRecordService.sendRaiseMsg(record.getRaiseRecordId(),record.getRaiseId(),"在线选房认筹通知","认筹单已作废","点击详情查看认筹单","具体原因查看详情",false);
237
             });
245
             });

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/TaHousingResourcesMapper.java 查看文件

84
 
84
 
85
     /**
85
     /**
86
      * 减少认筹热度值
86
      * 减少认筹热度值
87
-     * @param houseId
87
+     * @param raiseRecordId
88
      * @return
88
      * @return
89
      */
89
      */
90
-    Boolean updateForSubtractRaiseHeat(@Param("houseId") Integer houseId);
90
+    Boolean updateForSubtractRaiseHeat(@Param("raiseRecordId") Integer raiseRecordId);
91
 
91
 
92
     /**
92
     /**
93
      * 根据房源ID获取房源详情
93
      * 根据房源ID获取房源详情

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

59
      */
59
      */
60
     ResponseBean batchDeletePreselectRecord(List<TaPreselectionRecord> preselectionRecordList, Integer orgId, Integer userId);
60
     ResponseBean batchDeletePreselectRecord(List<TaPreselectionRecord> preselectionRecordList, Integer orgId, Integer userId);
61
 
61
 
62
-    Boolean updateForSubtractRaiseHeat(Integer houseId);
63
-
64
 }
62
 }

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

85
      * 发送认筹消息
85
      * 发送认筹消息
86
      */
86
      */
87
     void sendRaiseMsg(Integer raiseRecordId, String personId, String title, String result, String reason,String remark, Boolean isSuccess);
87
     void sendRaiseMsg(Integer raiseRecordId, String personId, String title, String result, String reason,String remark, Boolean isSuccess);
88
+
89
+    Boolean updateForSubtractRaiseHeat(Integer raiseRecordId);
88
 }
90
 }

+ 28
- 24
src/main/java/com/huiju/estateagents/service/impl/TaHousingResourcesServiceImpl.java 查看文件

278
             resourcesPO.setRaiseBtn(false);
278
             resourcesPO.setRaiseBtn(false);
279
         } else {
279
         } else {
280
             //有认筹表的情况下判断是否认筹过这个房源
280
             //有认筹表的情况下判断是否认筹过这个房源
281
-            boolean raiseBtnStatus = checkRaiseBtn(taRaise,salesBatchId,personId,houseId,orgId);
281
+            boolean raiseBtnStatus = checkRaiseBtn(taRaise, salesBatchId, personId, houseId, orgId);
282
             resourcesPO.setTaRaise(taRaise);
282
             resourcesPO.setTaRaise(taRaise);
283
         }
283
         }
284
 
284
 
287
 
287
 
288
     /**
288
     /**
289
      * 校验认筹状态的按钮
289
      * 校验认筹状态的按钮
290
+     *
290
      * @param taRaise
291
      * @param taRaise
291
      * @param salesBatchId
292
      * @param salesBatchId
292
      * @param personId
293
      * @param personId
295
      * @return
296
      * @return
296
      */
297
      */
297
     private boolean checkRaiseBtn(TaRaise taRaise, Integer salesBatchId, String personId, Integer houseId, Integer orgId) {
298
     private boolean checkRaiseBtn(TaRaise taRaise, Integer salesBatchId, String personId, Integer houseId, Integer orgId) {
298
-        if (taRaise.getStatus() != CommConstant.STATUS_NORMAL){
299
+        if (taRaise.getStatus() != CommConstant.STATUS_NORMAL) {
299
             return false;
300
             return false;
300
         }
301
         }
301
-        if (taRaise.getNeedPreselection()){
302
+        if (taRaise.getNeedPreselection()) {
302
             //查看是否有当前房源的预选记录
303
             //查看是否有当前房源的预选记录
303
             QueryWrapper<TaPreselectionRecord> preselectionRecordQueryWrapper = new QueryWrapper<>();
304
             QueryWrapper<TaPreselectionRecord> preselectionRecordQueryWrapper = new QueryWrapper<>();
304
-            preselectionRecordQueryWrapper.eq("sales_batch_id",salesBatchId);
305
-            preselectionRecordQueryWrapper.eq("building_id",taRaise.getBuildingId());
306
-            preselectionRecordQueryWrapper.eq("org_id",orgId);
307
-            preselectionRecordQueryWrapper.eq("house_id",houseId);
308
-            preselectionRecordQueryWrapper.eq("person_id",personId);
305
+            preselectionRecordQueryWrapper.eq("sales_batch_id", salesBatchId);
306
+            preselectionRecordQueryWrapper.eq("building_id", taRaise.getBuildingId());
307
+            preselectionRecordQueryWrapper.eq("org_id", orgId);
308
+            preselectionRecordQueryWrapper.eq("house_id", houseId);
309
+            preselectionRecordQueryWrapper.eq("person_id", personId);
309
             TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.selectOne(preselectionRecordQueryWrapper);
310
             TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.selectOne(preselectionRecordQueryWrapper);
310
-            if (null == taPreselectionRecord){
311
+            if (null == taPreselectionRecord) {
311
                 return false;
312
                 return false;
312
             }
313
             }
313
         }
314
         }
316
         LocalDateTime raiseStartTime = taRaise.getRaiseStartTime();
317
         LocalDateTime raiseStartTime = taRaise.getRaiseStartTime();
317
         LocalDateTime raiseEndTime = taRaise.getRaiseEndTime();
318
         LocalDateTime raiseEndTime = taRaise.getRaiseEndTime();
318
         LocalDateTime now = LocalDateTime.now();
319
         LocalDateTime now = LocalDateTime.now();
319
-        if (now.isBefore(raiseStartTime) || now.isAfter(raiseEndTime)){
320
+        if (now.isBefore(raiseStartTime) || now.isAfter(raiseEndTime)) {
320
             return false;
321
             return false;
321
         }
322
         }
322
         //销售批次校验
323
         //销售批次校验
323
         TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(salesBatchId);
324
         TaSalesBatch taSalesBatch = taSalesBatchMapper.selectById(salesBatchId);
324
-        if (taSalesBatch.getStatus() != CommConstant.STATUS_NORMAL){
325
+        if (taSalesBatch.getStatus() != CommConstant.STATUS_NORMAL) {
325
             return false;
326
             return false;
326
         }
327
         }
327
 
328
 
328
         //房源信息
329
         //房源信息
329
         TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseId);
330
         TaHousingResources taHousingResources = taHousingResourcesMapper.selectById(houseId);
330
-        if (taHousingResources.getStatus() != CommConstant.STATUS_NORMAL || CommConstant.HOUSE_LOCKING_STATUS_LOCKED.equals(taHousingResources.getHouseLockingStatus())){
331
+        if (taHousingResources.getStatus() != CommConstant.STATUS_NORMAL || CommConstant.HOUSE_LOCKING_STATUS_LOCKED.equals(taHousingResources.getHouseLockingStatus())) {
331
             return false;
332
             return false;
332
         }
333
         }
333
 
334
 
334
         //查询我的认筹记录表
335
         //查询我的认筹记录表
335
         QueryWrapper<TaRaiseHouse> taRaiseHouseQueryWrapper = new QueryWrapper<>();
336
         QueryWrapper<TaRaiseHouse> taRaiseHouseQueryWrapper = new QueryWrapper<>();
336
-        taRaiseHouseQueryWrapper.eq("org_id",orgId);
337
-        taRaiseHouseQueryWrapper.eq("house_id",houseId);
338
-        taRaiseHouseQueryWrapper.eq("person_id",personId);
337
+        taRaiseHouseQueryWrapper.eq("org_id", orgId);
338
+        taRaiseHouseQueryWrapper.eq("house_id", houseId);
339
+        taRaiseHouseQueryWrapper.eq("person_id", personId);
339
         List<TaRaiseHouse> list = taRaiseHouseService.list(taRaiseHouseQueryWrapper);
340
         List<TaRaiseHouse> list = taRaiseHouseService.list(taRaiseHouseQueryWrapper);
340
-        if (list.size() > 0){
341
+        if (list.size() > 0) {
341
             return false;
342
             return false;
342
         }
343
         }
343
 
344
 
421
         }
422
         }
422
 
423
 
423
         // 更新销售批次里的房源数
424
         // 更新销售批次里的房源数
424
-        taSalesBatchMapper.addSalesNumberById(taHousingResources.getSalesBatchId(),taHousingResources.getOrgId());
425
+        taSalesBatchMapper.addSalesNumberById(taHousingResources.getSalesBatchId(), taHousingResources.getOrgId());
425
 
426
 
426
         // 获取楼盘名称
427
         // 获取楼盘名称
427
         TaBuilding taBuilding = taBuildingMapper.selectById(taHousingResources.getBuildingId());
428
         TaBuilding taBuilding = taBuildingMapper.selectById(taHousingResources.getBuildingId());
724
         personQueryWrapper.eq("person_id", personId);
725
         personQueryWrapper.eq("person_id", personId);
725
         TaPerson person = taPersonService.getOne(personQueryWrapper);
726
         TaPerson person = taPersonService.getOne(personQueryWrapper);
726
         if (person == null) {
727
         if (person == null) {
727
-            responseBean.addError("权限不足");
728
+            logger.info("updateLockingStatus 用户未找到");
729
+            responseBean.addError("fail");
728
             return responseBean;
730
             return responseBean;
729
         }
731
         }
730
 
732
 
731
         // 更新为锁定状态
733
         // 更新为锁定状态
732
         if ("lock".equals(type)) {
734
         if ("lock".equals(type)) {
733
 
735
 
734
-            // 校验当前用户是否有修改权限
735
-            if (StringUtils.isEmpty(po.getLockingPersonId()) && !"locked".equals(po.getHouseLockingStatus())) {
736
+            // 校验当前房源状态
737
+            if (!"locked".equals(po.getHouseLockingStatus())) {
736
                 // 更行房源表状态
738
                 // 更行房源表状态
737
                 TaHousingResources housingResources = new TaHousingResources();
739
                 TaHousingResources housingResources = new TaHousingResources();
738
                 housingResources.setHouseId(po.getHouseId());
740
                 housingResources.setHouseId(po.getHouseId());
739
                 housingResources.setHouseLockingStatus("locked");
741
                 housingResources.setHouseLockingStatus("locked");
742
+                housingResources.setHouseLockingPerson(personId);
740
                 housingResources.setUpdateUser(person.getUserId());
743
                 housingResources.setUpdateUser(person.getUserId());
741
                 housingResources.setUpdateDate(LocalDateTime.now());
744
                 housingResources.setUpdateDate(LocalDateTime.now());
742
                 updateById(housingResources);
745
                 updateById(housingResources);
750
                 responseBean.addSuccess(taRaiseHouseService.updateById(raiseHouse));
753
                 responseBean.addSuccess(taRaiseHouseService.updateById(raiseHouse));
751
                 return responseBean;
754
                 return responseBean;
752
             }
755
             }
753
-            responseBean.addError("权限不足");
756
+            responseBean.addError("当前房源已为锁定状态");
754
             return responseBean;
757
             return responseBean;
755
         }
758
         }
756
 
759
 
757
         // 更新为解锁状态
760
         // 更新为解锁状态
758
         if ("unlock".equals(type)) {
761
         if ("unlock".equals(type)) {
759
 
762
 
760
-            // 校验当前用户是否有修改权限
761
-            if (personId.equals(po.getLockingPersonId()) && "locked".equals(po.getHouseLockingStatus())) {
763
+            // 校验当前房源状态
764
+            if ("locked".equals(po.getHouseLockingStatus())) {
762
                 // 更新房源表状态
765
                 // 更新房源表状态
763
                 TaHousingResources housingResources = new TaHousingResources();
766
                 TaHousingResources housingResources = new TaHousingResources();
764
                 housingResources.setHouseId(po.getHouseId());
767
                 housingResources.setHouseId(po.getHouseId());
765
                 housingResources.setHouseLockingStatus("unlocked");
768
                 housingResources.setHouseLockingStatus("unlocked");
769
+                housingResources.setHouseLockingPerson("");
766
                 housingResources.setUpdateUser(person.getUserId());
770
                 housingResources.setUpdateUser(person.getUserId());
767
                 housingResources.setUpdateDate(LocalDateTime.now());
771
                 housingResources.setUpdateDate(LocalDateTime.now());
768
                 updateById(housingResources);
772
                 updateById(housingResources);
776
                 responseBean.addSuccess(taRaiseHouseService.updateById(raiseHouse));
780
                 responseBean.addSuccess(taRaiseHouseService.updateById(raiseHouse));
777
                 return responseBean;
781
                 return responseBean;
778
             }
782
             }
779
-            responseBean.addError("权限不足");
783
+            responseBean.addError("当前房源已为解锁状态");
780
             return responseBean;
784
             return responseBean;
781
         }
785
         }
782
         responseBean.addError("fail");
786
         responseBean.addError("fail");

+ 0
- 5
src/main/java/com/huiju/estateagents/service/impl/TaPreselectionRecordServiceImpl.java 查看文件

250
         return responseBean;
250
         return responseBean;
251
     }
251
     }
252
 
252
 
253
-    @Override
254
-    public Boolean updateForSubtractRaiseHeat(Integer houseId) {
255
-        return taHousingResourcesMapper.updateForSubtractRaiseHeat(houseId);
256
-    }
257
-
258
     /**
253
     /**
259
      * 发送订阅消息
254
      * 发送订阅消息
260
      *
255
      *

+ 5
- 0
src/main/java/com/huiju/estateagents/service/impl/TaRaiseRecordServiceImpl.java 查看文件

311
             logger.info("sendSubscribeMsg 结束");
311
             logger.info("sendSubscribeMsg 结束");
312
         });
312
         });
313
     }
313
     }
314
+
315
+    @Override
316
+    public Boolean updateForSubtractRaiseHeat(Integer raiseRecordId) {
317
+        return taHousingResourcesMapper.updateForSubtractRaiseHeat(raiseRecordId);
318
+    }
314
 }
319
 }

+ 2
- 2
src/main/resources/mapper/TaHousingResourcesMapper.xml 查看文件

232
 
232
 
233
     <update id="updateForSubtractRaiseHeat" parameterType="java.lang.Integer">
233
     <update id="updateForSubtractRaiseHeat" parameterType="java.lang.Integer">
234
         UPDATE ta_housing_resources t
234
         UPDATE ta_housing_resources t
235
-        SET t.raise_real_heat = IFNULL(t.raise_real_heat, 0) - 1
235
+        SET t.raise_real_heat = IFNULL( t.raise_real_heat, 0 ) - 1
236
         WHERE
236
         WHERE
237
-            t.house_id = #{houseId}
237
+            t.house_id IN ( SELECT tr.house_id FROM ta_raise_house tr WHERE tr.raise_record_id = #{raiseRecordId})
238
             AND t.raise_real_heat > 0
238
             AND t.raise_real_heat > 0
239
     </update>
239
     </update>
240
 
240
 

+ 29
- 41
src/main/resources/mapper/TaPreselectionRecordMapper.xml 查看文件

3
 <mapper namespace="com.huiju.estateagents.mapper.TaPreselectionRecordMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaPreselectionRecordMapper">
4
 
4
 
5
     <select id="listPreselectionRecord" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
5
     <select id="listPreselectionRecord" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
6
-        SELECT
7
-            t3.*,
8
-            t4.building_name,
9
-            t5.`status` saleBatchStatus
10
-        FROM
11
-            (
12
         SELECT
6
         SELECT
13
             t.*,
7
             t.*,
14
             t2.term_name,
8
             t2.term_name,
20
             t2.apartment_id,
14
             t2.apartment_id,
21
             t2.building_id buildingId,
15
             t2.building_id buildingId,
22
             t2.`status` housingStatus,
16
             t2.`status` housingStatus,
23
-            t2.sales_batch_id saleBatchId
17
+            t3.`status` saleBatchStatus
24
         FROM
18
         FROM
25
-            ta_preselection_record t,
26
-            ta_housing_resources t2
19
+            ta_preselection_record t
20
+        LEFT JOIN ta_housing_resources t2 ON t.house_id = t2.house_id
21
+        LEFT JOIN ta_sales_batch t3 ON t.sales_batch_id = t3.sales_batch_id
27
         WHERE
22
         WHERE
28
             t.person_id = #{personId}
23
             t.person_id = #{personId}
29
             AND t.org_id = #{orgId}
24
             AND t.org_id = #{orgId}
30
-            AND t.house_id = t2.house_id
31
-            <if test="buildingId != null and buildingId != ''">
32
-                AND t2.building_id = #{buildingId}
33
-            </if>
34
-            <if test="salesBatchId != null and salesBatchId != ''">
35
-                AND t2.sales_batch_id = #{salesBatchId}
36
-            </if>
37
-            <if test="apartmentId != null and apartmentId != ''">
38
-                AND t2.apartment_id = #{apartmentId}
39
-            </if>
40
-            <if test="houseLockingStatus == 'locked'">
41
-                AND t2.house_locking_status = 'locked'
42
-            </if>
43
-            <if test="houseLockingStatus == 'unlocked'">
44
-                AND ( t2.house_locking_status != 'locked' OR t2.house_locking_status IS NULL )
45
-            </if>
46
-            ) t3
47
-            LEFT JOIN ta_building t4 ON t3.buildingId = t4.building_id
48
-            LEFT JOIN ta_sales_batch t5 ON t3.saleBatchId = t5.sales_batch_id
49
-            left join ta_raise_house t6 on t3.house_id = t6.house_id
50
-        where 1=1
51
-            <if test="customerLocked == 'mine'">
52
-                AND t6.person_id = #{personId}
53
-            </if>
54
-            <if test="customerLocked == 'other'">
55
-                AND t6.person_id != #{personId}
56
-            </if>
57
-          GROUP BY
58
-            t3.preselection_record_id
59
-         ORDER BY
60
-            t3.create_date DESC
61
-
25
+        <if test="customerLocked == 'mine'">
26
+            AND t2.house_locking_person = #{personId}
27
+        </if>
28
+        <if test="customerLocked == 'other'">
29
+            AND t2.house_locking_person != #{personId}
30
+        </if>
31
+        <if test="buildingId != null and buildingId != ''">
32
+            AND t2.building_id = #{buildingId}
33
+        </if>
34
+        <if test="salesBatchId != null and salesBatchId != ''">
35
+            AND t2.sales_batch_id = #{salesBatchId}
36
+        </if>
37
+        <if test="apartmentId != null and apartmentId != ''">
38
+            AND t2.apartment_id = #{apartmentId}
39
+        </if>
40
+        <if test="houseLockingStatus == 'locked'">
41
+            AND t2.house_locking_status = 'locked'
42
+        </if>
43
+        <if test="houseLockingStatus == 'unlocked'">
44
+            AND ( t2.house_locking_status != 'locked' OR t2.house_locking_status IS NULL )
45
+        </if>
46
+        GROUP BY
47
+         t.preselection_record_id
48
+        ORDER BY
49
+          t.create_date DESC
62
     </select>
50
     </select>
63
 
51
 
64
     <select id="getRecordByPersonIdAndHouseId" resultType="com.huiju.estateagents.entity.TaPreselectionRecord">
52
     <select id="getRecordByPersonIdAndHouseId" resultType="com.huiju.estateagents.entity.TaPreselectionRecord">