wangfei il y a 6 ans
Parent
révision
7f2e0c3c66

+ 3
- 3
whole-estate/src/main/java/com/example/wholeestate/controller/BuildingController.java Voir le fichier

@@ -301,7 +301,7 @@ public class BuildingController extends BaseController {
301 301
         return responseBean;
302 302
     }
303 303
 
304
-    @RequestMapping(value = "/wx/building/visit", method = RequestMethod.GET)
304
+    @RequestMapping(value = "/wx/building/visit/{id}", method = RequestMethod.POST)
305 305
     @ApiOperation(value = "楼盘访问", notes = "楼盘访问")
306 306
     @ApiImplicitParams({
307 307
             @ApiImplicitParam(paramType = "path", dataTypeClass=String.class, name = "id", value = "楼盘id"),
@@ -317,13 +317,13 @@ public class BuildingController extends BaseController {
317 317
         ResponseBean responseBean = new ResponseBean();
318 318
         if (visitList.size() > 0) {
319 319
             Visit updataVisit = visitList.get(0);
320
-            updataVisit.setVisitDate(LocalDateTime.now());
320
+            updataVisit.setVisitDate(new Date());
321 321
             QueryWrapper<Visit> updateQ = new QueryWrapper<>();
322 322
             updateQ.eq("visit_id", updataVisit.getVisitId());
323 323
             visitMapper.update(updataVisit, updateQ);
324 324
         } else {
325 325
             visit.setVisitId(idGen.nextId()+"");
326
-            visit.setVisitDate(LocalDateTime.now());
326
+            visit.setVisitDate(new Date());
327 327
             visitMapper.insert(visit);
328 328
         }
329 329
         return responseBean;

+ 0
- 2
whole-estate/src/main/java/com/example/wholeestate/controller/CustomerController.java Voir le fichier

@@ -81,6 +81,4 @@ public class CustomerController extends BaseController {
81 81
         ResponseBean  responseBean = iCustomerService.customerSelectId(id);
82 82
         return responseBean;
83 83
     }
84
-
85
-
86 84
 }

+ 3
- 1
whole-estate/src/main/java/com/example/wholeestate/controller/PropagandaController.java Voir le fichier

@@ -68,7 +68,9 @@ public class PropagandaController extends BaseController {
68 68
     })
69 69
     public ResponseBean getById(@PathVariable String propagandaId) {
70 70
         ResponseBean responseBean = new ResponseBean();
71
-        Propaganda propaganda = iPropagandaService.getById(propagandaId);
71
+        QueryWrapper<Propaganda> propagandaQueryWrapper = new QueryWrapper<>();
72
+        propagandaQueryWrapper.eq("propaganda_id",propagandaId);
73
+        Propaganda propaganda = iPropagandaService.getOne(propagandaQueryWrapper);
72 74
         responseBean.addSuccess(propaganda);
73 75
         return responseBean;
74 76
     }

+ 13
- 0
whole-estate/src/main/java/com/example/wholeestate/dao/ActivityEnrollMapper.java Voir le fichier

@@ -8,6 +8,7 @@ import com.example.wholeestate.model.ActivityEnroll;
8 8
 import org.apache.ibatis.annotations.Param;
9 9
 import org.apache.ibatis.annotations.Select;
10 10
 
11
+import java.util.List;
11 12
 import java.util.Map;
12 13
 
13 14
 /**
@@ -41,4 +42,16 @@ public interface ActivityEnrollMapper extends BaseMapper<ActivityEnroll> {
41 42
             "WHERE tacus.openid = #{openid} and tac.status > -1 order by tace.enroll_date desc")
42 43
     IPage<Activity> selectOpenidActivityEnroll(Page page, @Param("openid") String openid);
43 44
 
45
+    /**
46
+     * 根据 openid 查询 我参加的活动
47
+     * @param openid
48
+     * @return
49
+     */
50
+    @Select("SELECT tac.*,tacus.phone as phone,tacus.`name` as name,tacus.customer_name as customerName,tab.building_name AS buildingName FROM ta_activity tac " +
51
+            "RIGHT JOIN ta_activity_enroll tace ON tac.activity_id = tace.activity_id " +
52
+            "LEFT JOIN ta_customer tacus ON tace.customer_id = tacus.customer_id " +
53
+            "LEFT JOIN ta_building tab ON tac.building_id = tab.building_id " +
54
+            "WHERE tacus.openid = #{openid} and tac.status > -1 order by tace.enroll_date desc")
55
+    List<Activity> selectOpenidActivityEnrollList(@Param("openid") String openid);
56
+
44 57
 }

+ 12
- 0
whole-estate/src/main/java/com/example/wholeestate/dao/AppointmentMapper.java Voir le fichier

@@ -7,6 +7,8 @@ import com.example.wholeestate.model.Appointment;
7 7
 import org.apache.ibatis.annotations.Param;
8 8
 import org.apache.ibatis.annotations.Select;
9 9
 
10
+import java.util.List;
11
+
10 12
 /**
11 13
  * <p>
12 14
  * 预约记录表 Mapper 接口
@@ -33,6 +35,16 @@ public interface AppointmentMapper extends BaseMapper<Appointment> {
33 35
             "WHERE tac.openid = #{openid} and taa.status = 1 order by taa.create_date desc")
34 36
     IPage<Appointment> getOpenidAppendableList(Page<Appointment> page, @Param("openid") String openid);
35 37
 
38
+    @Select("SELECT " +
39
+            "taa.*, " +
40
+            "tab.building_name AS buildingName " +
41
+            "FROM " +
42
+            "ta_appointment taa " +
43
+            "LEFT JOIN ta_building tab ON taa.building_id = tab.building_id " +
44
+            "LEFT JOIN ta_customer tac ON taa.customer_id = tac.customer_id " +
45
+            "WHERE tac.openid = #{openid} and taa.status = 1 order by taa.create_date desc")
46
+    List<Appointment> getOpenidAppendables(@Param("openid") String openid);
47
+
36 48
     IPage<Appointment> appendableList(Page page, @Param("buildingId") String buildingId, @Param("username")String username,@Param("phone") String phone,@Param("status") String status);
37 49
 
38 50
 }

+ 16
- 0
whole-estate/src/main/java/com/example/wholeestate/dao/TaCollectionMapper.java Voir le fichier

@@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Delete;
9 9
 import org.apache.ibatis.annotations.Param;
10 10
 import org.apache.ibatis.annotations.Select;
11 11
 
12
+import java.util.List;
13
+
12 14
 /**
13 15
  * <p>
14 16
  * 收藏表 Mapper 接口
@@ -34,6 +36,20 @@ public interface TaCollectionMapper extends BaseMapper<TaCollection> {
34 36
             "WHERE tacu.openid = #{openid} order by tac.create_date desc")
35 37
     IPage<Building> openidCollectionBuilding(Page<Building> page, @Param("openid") String openid);
36 38
 
39
+    /**
40
+     * 根据 openid 查询 收藏楼盘记录
41
+     * @param openid
42
+     * @return
43
+     */
44
+    @Select("SELECT " +
45
+            "tab.* " +
46
+            "FROM " +
47
+            "ta_collection tac " +
48
+            "LEFT JOIN ta_building tab ON tac.building_id = tab.building_id " +
49
+            "LEFT JOIN ta_customer tacu ON tac.customer_id = tacu.customer_id " +
50
+            "WHERE tacu.openid = #{openid} order by tac.create_date desc")
51
+    List<Building> openidCollectionBuildingList(@Param("openid") String openid);
52
+
37 53
     /**
38 54
      * 根据 openid 和 楼盘id 删除收藏列表
39 55
      * @param openid

+ 10
- 0
whole-estate/src/main/java/com/example/wholeestate/model/Building.java Voir le fichier

@@ -109,6 +109,11 @@ public class Building implements Serializable {
109 109
      */
110 110
     private  String marketStatus;
111 111
 
112
+    /**
113
+     * 楼盘区域
114
+     */
115
+    private  String buildingArea;
116
+
112 117
     /**
113 118
      * 排序
114 119
      */
@@ -119,6 +124,11 @@ public class Building implements Serializable {
119 124
      */
120 125
     private  Integer isMain;
121 126
 
127
+
128
+    /**
129
+     * 地址图片
130
+     */
131
+    private  String mapImg;
122 132
     /**
123 133
      * 图片
124 134
      */

+ 20
- 0
whole-estate/src/main/java/com/example/wholeestate/model/Customer.java Voir le fichier

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
5 5
 import java.time.LocalDateTime;
6 6
 import com.baomidou.mybatisplus.annotation.TableField;
7 7
 import java.io.Serializable;
8
+import java.util.List;
9
+
8 10
 import lombok.Data;
9 11
 import lombok.EqualsAndHashCode;
10 12
 import lombok.experimental.Accessors;
@@ -54,4 +56,22 @@ public class Customer implements Serializable {
54 56
      */
55 57
     private Integer hasReg;
56 58
 
59
+    /**
60
+     * 报名的活动
61
+     */
62
+    @TableField(exist = false)
63
+    private List<Activity> Activity;
64
+
65
+    /**
66
+     * 预约记录
67
+     */
68
+    @TableField(exist = false)
69
+    private List<Appointment> Appointment;
70
+
71
+    /**
72
+     * 收藏的楼盘
73
+     */
74
+    @TableField(exist = false)
75
+    private List<Building> CollectionBuilding;
76
+
57 77
 }

+ 2
- 1
whole-estate/src/main/java/com/example/wholeestate/model/Visit.java Voir le fichier

@@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
7 7
 
8 8
 import java.io.Serializable;
9 9
 import java.time.LocalDateTime;
10
+import java.util.Date;
10 11
 
11 12
 /**
12 13
  * <p>
@@ -30,7 +31,7 @@ public class Visit implements Serializable {
30 31
 
31 32
     private String customerName;
32 33
 
33
-    private LocalDateTime visitDate;
34
+    private Date visitDate;
34 35
 
35 36
     private String avatar;
36 37
 

+ 12
- 7
whole-estate/src/main/java/com/example/wholeestate/service/impl/BuildingServiceImpl.java Voir le fichier

@@ -448,13 +448,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
448 448
             BuildingImgQueryWrapper.eq("img_type", "banner");
449 449
             List<BuildingImg> buildingImg = buildingImgMapper.selectList(BuildingImgQueryWrapper);
450 450
             build.setBuildingImg(buildingImg);
451
-
452
-            QueryWrapper<Visit> BuildingVisitQueryWrapper = new QueryWrapper<>();
453
-            BuildingVisitQueryWrapper.eq("visit_type", "building");
454
-            BuildingVisitQueryWrapper.eq("visit_content", build.getBuildingId());
455
-            BuildingVisitQueryWrapper.orderByDesc("visit_date");
456
-            List<Visit> visits = visitMapper.selectList(BuildingVisitQueryWrapper);
457
-            build.setVisits(visits);
458 451
         }
459 452
 
460 453
         responseBean.addSuccess(buildingList);
@@ -478,6 +471,18 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
478 471
             BuildingImgQueryWrapper.eq("img_type", "banner");
479 472
             List<BuildingImg> buildingImg = buildingImgMapper.selectList(BuildingImgQueryWrapper);
480 473
             build.setBuildingImg(buildingImg);
474
+
475
+            QueryWrapper<Visit> BuildingVisitQueryWrapper = new QueryWrapper<>();
476
+            BuildingVisitQueryWrapper.eq("visit_type", "building");
477
+            BuildingVisitQueryWrapper.eq("visit_content", build.getBuildingId());
478
+            BuildingVisitQueryWrapper.orderByDesc("visit_date");
479
+            List<Visit> visits = visitMapper.selectList(BuildingVisitQueryWrapper);
480
+            build.setVisits(visits);
481
+
482
+            QueryWrapper<BuildingTag> buildingTagQueryWrapper = new QueryWrapper<>();
483
+            buildingTagQueryWrapper.eq("building_id", build.getBuildingId());
484
+            List<BuildingTag> buildingTags = buildingTagMapper.selectList(buildingTagQueryWrapper);
485
+            build.setBuildingTag(buildingTags);
481 486
         }
482 487
 
483 488
         responseBean.addSuccess(buildingList);

+ 39
- 1
whole-estate/src/main/java/com/example/wholeestate/service/impl/CustomerServiceImpl.java Voir le fichier

@@ -9,13 +9,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 9
 import com.example.wholeestate.common.Constant;
10 10
 import com.example.wholeestate.common.resp.ResponseBean;
11 11
 import com.example.wholeestate.common.uuid.IdGen;
12
+import com.example.wholeestate.dao.ActivityEnrollMapper;
13
+import com.example.wholeestate.dao.AppointmentMapper;
12 14
 import com.example.wholeestate.dao.CustomerMapper;
13 15
 
16
+import com.example.wholeestate.dao.TaCollectionMapper;
17
+import com.example.wholeestate.model.Activity;
18
+import com.example.wholeestate.model.Appointment;
14 19
 import com.example.wholeestate.model.Customer;
20
+import com.example.wholeestate.model.Building;
15 21
 import com.example.wholeestate.service.ICustomerService;
16 22
 import com.example.wholeestate.utils.BeanTools;
17 23
 import com.example.wholeestate.wx.mini.IWxMini;
18 24
 import org.apache.http.HttpStatus;
25
+import org.checkerframework.checker.units.qual.A;
19 26
 import org.springframework.beans.factory.annotation.Autowired;
20 27
 import org.springframework.stereotype.Service;
21 28
 
@@ -23,7 +30,6 @@ import java.time.LocalDateTime;
23 30
 import java.util.Date;
24 31
 import java.util.HashMap;
25 32
 import java.util.List;
26
-
27 33
 /**
28 34
  * <p>
29 35
  *  服务实现类
@@ -43,6 +49,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
43 49
 
44 50
     private IdGen idGen = IdGen.get();
45 51
 
52
+    @Autowired
53
+    private ActivityEnrollMapper activityEnrollMapper;
54
+
55
+    @Autowired
56
+    private AppointmentMapper appointmentMapper;
57
+
58
+    @Autowired
59
+    private TaCollectionMapper taCollectionMapper;
60
+
46 61
     @Override
47 62
     public ResponseBean customerList(Integer pageNum, Integer pageSize, String phone, Date beginDate, Date endDate, String name , String cardNo) {
48 63
         ResponseBean response= new ResponseBean();
@@ -112,6 +127,18 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
112 127
             return responseBean;
113 128
         }
114 129
 
130
+        // 获取用户报名活动信息
131
+        List<Activity> activitys = activityEnrollMapper.selectOpenidActivityEnrollList(openid);
132
+        customer.setActivity(activitys);
133
+
134
+        // 获取用户预约信息
135
+        List<Appointment> appointments = appointmentMapper.getOpenidAppendables(openid);
136
+        customer.setAppointment(appointments);
137
+
138
+        // 获取用户收藏记录
139
+        List<Building> taCollections = taCollectionMapper.openidCollectionBuildingList(openid);
140
+        customer.setCollectionBuilding(taCollections);
141
+
115 142
         responseBean.addSuccess(customer);
116 143
         return responseBean;
117 144
     }
@@ -125,6 +152,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
125 152
         queryWrapper.eq("openid", openid);
126 153
         Customer customer = customerMapper.selectOne(queryWrapper);
127 154
         if (null != customer) {
155
+            // 获取用户报名活动信息
156
+            List<Activity> activitys = activityEnrollMapper.selectOpenidActivityEnrollList(openid);
157
+            customer.setActivity(activitys);
158
+
159
+            // 获取用户预约信息
160
+            List<Appointment> appointments = appointmentMapper.getOpenidAppendables(openid);
161
+            customer.setAppointment(appointments);
162
+
163
+            // 获取用户收藏记录
164
+            List<Building> taCollections = taCollectionMapper.openidCollectionBuildingList(openid);
165
+            customer.setCollectionBuilding(taCollections);
128 166
             responseBean.addSuccess(customer);
129 167
             return responseBean;
130 168
         }

+ 1
- 1
whole-estate/src/main/resources/application.yml Voir le fichier

@@ -6,7 +6,7 @@ spring:
6 6
   datasource:
7 7
     username: whole-estate
8 8
     password: whole-estate
9
-    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/whole-estate?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
9
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/whole-estate?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
10 10
     driver-class-name: com.mysql.jdbc.Driver
11 11
     initial-size: 10 # 初始化连接数
12 12
     max-active: 20 # 最大连接数