傅行帆 před 5 roky
rodič
revize
d87c1a4aa8

+ 7
- 0
src/main/java/com/huiju/estateagents/service/ITaBuildingIntentionService.java Zobrazit soubor

@@ -24,4 +24,11 @@ public interface ITaBuildingIntentionService extends IService<TaBuildingIntentio
24 24
      * @return
25 25
      */
26 26
     ResponseBean taBuildingIntentionAddOrUpdate(List<TdBizEvent> tdBizEventsList, String buildingId, Integer orgId);
27
+
28
+    /**
29
+     * 保存楼盘默认值
30
+     * @param orgId
31
+     * @param buildingId
32
+     */
33
+    void saveDefaultIntention(Integer orgId, String buildingId);
27 34
 }

+ 35
- 0
src/main/java/com/huiju/estateagents/service/impl/TaBuildingIntentionServiceImpl.java Zobrazit soubor

@@ -1,14 +1,18 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 5
 import com.huiju.estateagents.base.ResponseBean;
5 6
 import com.huiju.estateagents.entity.TaBuildingIntention;
6 7
 import com.huiju.estateagents.entity.TdBizEvent;
7 8
 import com.huiju.estateagents.mapper.TaBuildingIntentionMapper;
9
+import com.huiju.estateagents.mapper.TdBizEventMapper;
8 10
 import com.huiju.estateagents.service.ITaBuildingIntentionService;
9 11
 import org.springframework.beans.factory.annotation.Autowired;
10 12
 import org.springframework.stereotype.Service;
11 13
 
14
+import java.time.LocalDateTime;
15
+import java.util.ArrayList;
12 16
 import java.util.List;
13 17
 import java.util.stream.Collectors;
14 18
 
@@ -26,6 +30,9 @@ public class TaBuildingIntentionServiceImpl extends ServiceImpl<TaBuildingIntent
26 30
     @Autowired
27 31
     private TaBuildingIntentionMapper taBuildingIntentionMapper;
28 32
 
33
+    @Autowired
34
+    private TdBizEventMapper tdBizEventMapper;
35
+
29 36
     @Override
30 37
     public ResponseBean taBuildingIntentionAddOrUpdate(List<TdBizEvent>tdBizEventsList, String buildingId, Integer orgId) {
31 38
         ResponseBean responseBean = new ResponseBean();
@@ -53,4 +60,32 @@ public class TaBuildingIntentionServiceImpl extends ServiceImpl<TaBuildingIntent
53 60
         responseBean.addSuccess("操作成功!");
54 61
         return responseBean;
55 62
     }
63
+
64
+    /**
65
+     * 保存楼盘默认值
66
+     *
67
+     * @param orgId
68
+     * @param buildingId
69
+     */
70
+    @Override
71
+    public void saveDefaultIntention(Integer orgId, String buildingId) {
72
+        //获取所有的意向值类型
73
+        List<TdBizEvent> tdBizEventList = tdBizEventMapper.selectList(new QueryWrapper<>());
74
+        //构造意向值
75
+        List<TaBuildingIntention> taBuildingIntentions = new ArrayList<>();
76
+        tdBizEventList.forEach(e -> {
77
+            TaBuildingIntention taBuildingIntention = new TaBuildingIntention();
78
+            taBuildingIntention.setIntentionId(e.getIntentionId());
79
+            taBuildingIntention.setEventId(e.getEventId());
80
+            taBuildingIntention.setEventCode(e.getEventCode());
81
+            taBuildingIntention.setEventName(e.getEventName());
82
+            taBuildingIntention.setIntention(1);
83
+            taBuildingIntention.setCreateDate(LocalDateTime.now());
84
+            taBuildingIntention.setBuildingId(buildingId);
85
+            taBuildingIntention.setStatus(1);
86
+            taBuildingIntention.setOrgId(orgId);
87
+            taBuildingIntentions.add(taBuildingIntention);
88
+        });
89
+        this.saveBatch(taBuildingIntentions);
90
+    }
56 91
 }

+ 6
- 4
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Zobrazit soubor

@@ -15,11 +15,8 @@ import com.huiju.estateagents.common.DateUtils;
15 15
 import com.huiju.estateagents.common.StringUtils;
16 16
 import com.huiju.estateagents.entity.*;
17 17
 import com.huiju.estateagents.mapper.*;
18
-import com.huiju.estateagents.service.ITaBuildingMapRelationService;
19
-import com.huiju.estateagents.service.ITaBuildingService;
18
+import com.huiju.estateagents.service.*;
20 19
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
21
-import com.huiju.estateagents.service.TaPosterService;
22
-import com.huiju.estateagents.service.TaShareContentService;
23 20
 import javafx.scene.control.Tab;
24 21
 import org.apache.commons.collections.CollectionUtils;
25 22
 import org.springframework.beans.factory.annotation.Autowired;
@@ -90,6 +87,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
90 87
     @Autowired
91 88
     private ITaBuildingMapRelationService iTaBuildingMapRelationService;
92 89
 
90
+    @Autowired
91
+    public ITaBuildingIntentionService iTaBuildingIntentionService;
92
+
93 93
     @Override
94 94
     public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId,List<TaPersonBuilding> taPersonBuildingList) {
95 95
         Page<TaBuilding> page = new Page<>();
@@ -467,6 +467,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
467 467
             insertBuildingMapRelationBeach(taBuildingMapRelations, building.getBuildingId(), orgId);
468 468
         }
469 469
 
470
+        //添加默认意向值
471
+        iTaBuildingIntentionService.saveDefaultIntention(building.getOrgId(),building.getBuildingId());
470 472
 
471 473
         return ResponseBean.success(building);
472 474
     }