dingxin 6 vuotta sitten
vanhempi
commit
3fcc9286bd

+ 6
- 0
whole-estate/src/main/java/com/example/wholeestate/common/Constant.java Näytä tiedosto

@@ -21,4 +21,10 @@ public class Constant {
21 21
      * 用户 session
22 22
      */
23 23
     public static final String USER_SESSION = "user_session";
24
+
25
+    /**
26
+     * 楼盘图片类型 banner
27
+     */
28
+    public static final String BUILDING_IMG_TYPE_BANNER = "banner";
29
+
24 30
 }

+ 9
- 3
whole-estate/src/main/java/com/example/wholeestate/controller/ActivityController.java Näytä tiedosto

@@ -175,11 +175,17 @@ public class ActivityController extends BaseController {
175 175
     @ApiOperation(value = "根据活动id查询活动报名列表", notes = "根据活动id查询活动报名列表")
176 176
     @ApiImplicitParams({
177 177
             @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageNum", value = "pageNum第几页"),
178
-            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageSize", value = "pageSize一页多少行")
178
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageSize", value = "pageSize一页多少行"),
179
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "customerName", value = "客户端用户名"),
180
+            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "customerPhone", value = "客户端用户手机"),
179 181
     })
180
-    public ResponseBean activityEnrollList(@PathVariable("activityId") String activityId, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {
182
+    public ResponseBean activityEnrollList(@PathVariable("activityId") String activityId,
183
+                                           @RequestParam(defaultValue = "1") Integer pageNum,
184
+                                           @RequestParam(defaultValue = "10") Integer pageSize,
185
+                                           @RequestParam(required = false) String customerName,
186
+                                           @RequestParam(required = false) String customerPhone) {
181 187
         ResponseBean responseBean = new ResponseBean();
182
-        responseBean = iActivityEnrollService.getActivitySignUpList(activityId, pageNum, pageSize);
188
+        responseBean = iActivityEnrollService.getActivitySignUpList(activityId, pageNum, pageSize, customerName, customerPhone);
183 189
         return responseBean;
184 190
     }
185 191
 

+ 19
- 8
whole-estate/src/main/java/com/example/wholeestate/controller/BuildingController.java Näytä tiedosto

@@ -234,15 +234,26 @@ public class BuildingController extends BaseController {
234 234
         return responseBean;
235 235
     }
236 236
 
237
-   @ApiOperation(value = "户型列表", notes = "户型列表")
237
+//   @ApiOperation(value = "户型列表", notes = "户型列表")
238
+//    @ApiImplicitParams({
239
+//            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "id", value = "核销id"),
240
+//    })
241
+//    @RequestMapping(value = "/buildingApartment/{id}", method = RequestMethod.GET)
242
+//    public ResponseBean buildingApartmentSelectId(@PathVariable(value = "id") String id,
243
+//                                     @RequestParam("pageSize")Integer pageSize){
244
+//        ResponseBean  responseBean = iBuildingService.buildingApartmentSelectId(id);
245
+//       return responseBean;
246
+//   }
247
+
248
+
249
+    @ApiOperation(value = "微信小程序楼盘列表", notes = "微信小程序楼盘列表")
238 250
     @ApiImplicitParams({
239
-            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "id", value = "核销id"),
251
+
240 252
     })
241
-    @RequestMapping(value = "/buildingApartment/{id}", method = RequestMethod.GET)
242
-    public ResponseBean buildingApartmentSelectId(@PathVariable(value = "id") String id,
243
-                                     @RequestParam("pageSize")Integer pageSize){
244
-        ResponseBean  responseBean = iBuildingService.buildingApartmentSelectId(id);
245
-       return responseBean;
246
-   }
253
+    @RequestMapping(value = "/wx/building/list", method = RequestMethod.GET)
254
+    public ResponseBean getWxBuildingList(){
255
+        ResponseBean  responseBean = iBuildingService.getWxBuildingList();
256
+        return responseBean;
257
+    }
247 258
 
248 259
 }

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/controller/CommentController.java Näytä tiedosto

@@ -93,7 +93,7 @@ public class CommentController extends BaseController {
93 93
     public ResponseBean commentList(@RequestParam(defaultValue = "1") Integer pageNum,
94 94
                                     @RequestParam(defaultValue = "10") Integer pageSize,
95 95
                                     @RequestParam String commentType,
96
-                                    @RequestParam String mainId) {
96
+                                    @RequestParam(required = false) String mainId) {
97 97
         ResponseBean responseBean = new ResponseBean();
98 98
         responseBean = iCommentService.getCommentList(commentType, mainId, pageNum, pageSize);
99 99
         return responseBean;

+ 36
- 5
whole-estate/src/main/java/com/example/wholeestate/controller/CustomerController.java Näytä tiedosto

@@ -10,9 +10,15 @@ import io.swagger.annotations.ApiImplicitParam;
10 10
 import io.swagger.annotations.ApiImplicitParams;
11 11
 import io.swagger.annotations.ApiOperation;
12 12
 import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.beans.propertyeditors.CustomDateEditor;
14
+import org.springframework.web.bind.ServletRequestDataBinder;
13 15
 import org.springframework.web.bind.annotation.*;
14 16
 
17
+import javax.servlet.http.HttpServletRequest;
15 18
 import javax.servlet.http.HttpSession;
19
+import java.text.DateFormat;
20
+import java.text.SimpleDateFormat;
21
+import java.util.Date;
16 22
 
17 23
 /**
18 24
  * <p>
@@ -26,17 +32,42 @@ import javax.servlet.http.HttpSession;
26 32
 @RequestMapping("/")
27 33
 @Api(value = "用户 API", description = "用户 API")
28 34
 public class CustomerController extends BaseController {
35
+
29 36
     @Autowired
30 37
     private ICustomerService iCustomerService;
31 38
 
39
+    /**
40
+     * 自定义方法绑定请求参数的Date类型
41
+     *
42
+     * @param request
43
+     * @param binder
44
+     * @throws Exception
45
+     */
46
+    @InitBinder
47
+    protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
48
+        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
49
+        CustomDateEditor editor = new CustomDateEditor(df, true);//true表示允许为空,false反之
50
+        binder.registerCustomEditor(Date.class, editor);
51
+    }
52
+
32 53
     @ApiOperation(value = "会员列表", notes = "会员列表")
33 54
     @ApiImplicitParams({
34
-            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "pageNum:分页第几页,pageSize:每页长度,phone:手机号,name:姓名,beginDate:开始时间,endDate:结束时间")
55
+            @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "pageNum",value = "pageNum:分页第几页" ),
56
+            @ApiImplicitParam(paramType = "Query",dataType = "Integer",name = "pageSize",value = "pageSize:每页长度"),
57
+            @ApiImplicitParam(paramType = "Query",dataType = "String",name = "phone",value = "phone:别名"),
58
+            @ApiImplicitParam(paramType = "Query",dataType = "String",name = "name",value = "name:名字"),
59
+            @ApiImplicitParam(paramType = "Query",dataType = "Date",name = "beginDate",value = "beginDate:开始时间"),
60
+            @ApiImplicitParam(paramType = "Query",dataType = "Date",name = "endDate",value = "endDate:结束")
35 61
     })
36
-//    @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
37
-    @RequestMapping(value = "/customerList", method = RequestMethod.POST)
38
-    public ResponseBean buildingList(@RequestBody String parameter, HttpSession session){
39
-        ResponseBean  responseBean = iCustomerService.customerList(parameter);
62
+    @RequestMapping(value = "/customerList", method = RequestMethod.GET)
63
+    public ResponseBean buildingList(@RequestBody String parameter,
64
+                                     @RequestParam(value = "pageNum", required = false)Integer pageNum,
65
+                                     @RequestParam(value = "pageSize", required = false)Integer pageSize,
66
+                                     @RequestParam(value = "name", required = false)String name,
67
+                                     @RequestParam(value = "phone", required = false)String phone,
68
+                                     @RequestParam(value = "beginDate", required = false)Date beginDate,
69
+                                     @RequestParam(value = "endDate", required = false)Date endDate){
70
+        ResponseBean  responseBean = iCustomerService.customerList(pageNum,pageSize,phone,beginDate,endDate,name);
40 71
         return responseBean;
41 72
     }
42 73
 

+ 3
- 6
whole-estate/src/main/java/com/example/wholeestate/dao/ActivityEnrollMapper.java Näytä tiedosto

@@ -8,6 +8,8 @@ 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.Map;
12
+
11 13
 /**
12 14
  * <p>
13 15
  * 活动报名表 Mapper 接口
@@ -24,12 +26,7 @@ public interface ActivityEnrollMapper extends BaseMapper<ActivityEnroll> {
24 26
      * @param activityId
25 27
      * @return
26 28
      */
27
-    @Select("SELECT tacus.phone as phone,tacus.`name` as name,tacus.customer_name as customerName,tab.building_name AS buildingName FROM ta_activity tac " +
28
-            "RIGHT JOIN ta_activity_enroll tace ON tac.activity_id = tace.activity_id " +
29
-            "LEFT JOIN ta_customer tacus ON tace.customer_id = tacus.customer_id " +
30
-            "LEFT JOIN ta_building tab ON tac.building_id = tab.building_id " +
31
-            "WHERE tac.activity_id = #{activityId} and tac.status > -1")
32
-    IPage<Activity> selectPageActivityEnroll(Page page, @Param("activityId") String activityId);
29
+    IPage<Map<String, Object>> selectPageActivityEnroll(Page page, @Param("activityId") String activityId, @Param("customerName") String customerName, @Param("customerPhone") String customerPhone);
33 30
 
34 31
     /**
35 32
      * 根据 openid 查询 我参加的活动

+ 1
- 0
whole-estate/src/main/java/com/example/wholeestate/model/Activity.java Näytä tiedosto

@@ -127,4 +127,5 @@ public class Activity implements Serializable {
127 127
      */
128 128
     @TableField(exist = false)
129 129
     private Integer signUpNumber;
130
+
130 131
 }

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/service/IActivityEnrollService.java Näytä tiedosto

@@ -21,7 +21,7 @@ public interface IActivityEnrollService extends IService<ActivityEnroll> {
21 21
      * @param pageNum
22 22
      * @return
23 23
      */
24
-    ResponseBean getActivitySignUpList(String activityId, Integer pageNum, Integer pageSize);
24
+    ResponseBean getActivitySignUpList(String activityId, Integer pageNum, Integer pageSize, String customerName, String customerPhone);
25 25
 
26 26
     /**
27 27
      * 根据 openid 查询. 我的活动记录

+ 8
- 0
whole-estate/src/main/java/com/example/wholeestate/service/IBuildingService.java Näytä tiedosto

@@ -89,4 +89,12 @@ public interface IBuildingService extends IService<Building> {
89 89
      * @return
90 90
      */
91 91
     ResponseBean appointmentUpdate(String id,String writeoffRemark);
92
+
93
+    /**
94
+     * 微信小程序 楼盘列表
95
+     * @return
96
+     */
97
+    ResponseBean getWxBuildingList();
98
+
99
+    ResponseBean getWxBuildingById(String buildingId);
92 100
 }

+ 3
- 3
whole-estate/src/main/java/com/example/wholeestate/service/ICustomerService.java Näytä tiedosto

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.example.wholeestate.common.resp.ResponseBean;
5 5
 import com.example.wholeestate.model.Customer;
6 6
 
7
+import java.util.Date;
8
+
7 9
 /**
8 10
  * <p>
9 11
  *  服务类
@@ -16,11 +18,9 @@ public interface ICustomerService extends IService<Customer> {
16 18
 
17 19
     /**
18 20
      * 会员列表
19
-     * @param parameter
20 21
      * @return
21 22
      */
22
-    ResponseBean customerList(String parameter);
23
-
23
+    ResponseBean customerList(Integer pageNum, Integer pageSize, String phone, Date beginDate, Date endDate, String name);
24 24
     /**
25 25
      * 会员详情
26 26
      * @param id

+ 8
- 4
whole-estate/src/main/java/com/example/wholeestate/service/impl/ActivityEnrollServiceImpl.java Näytä tiedosto

@@ -17,6 +17,8 @@ import com.example.wholeestate.service.IActivityEnrollService;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.stereotype.Service;
19 19
 
20
+import java.util.Map;
21
+
20 22
 /**
21 23
  * <p>
22 24
  * 活动报名表 服务实现类
@@ -40,19 +42,21 @@ public class ActivityEnrollServiceImpl extends ServiceImpl<ActivityEnrollMapper,
40 42
     private IdGen idGen = IdGen.get();
41 43
 
42 44
     @Override
43
-    public ResponseBean getActivitySignUpList(String activityId, Integer pageNum, Integer pageSize) {
45
+    public ResponseBean getActivitySignUpList(String activityId, Integer pageNum, Integer pageSize, String customerName, String customerPhone) {
44 46
         ResponseBean responseBean = new ResponseBean();
45 47
 
46
-        Activity activity = activityMapper.selectById(activityId);
48
+        QueryWrapper<Activity> activityQueryWrapper = new QueryWrapper<>();
49
+        activityQueryWrapper.eq("activity_id", activityId);
50
+        Activity activity = activityMapper.selectOne(activityQueryWrapper);
47 51
         if (null == activity) {
48 52
             responseBean.addError("活动不存在!");
49 53
             return responseBean;
50 54
         }
51 55
 
52
-        Page<Activity> page = new Page<>();
56
+        Page<Map<String, Object>> page = new Page<>();
53 57
         page.setCurrent(pageNum == null ? 1 : pageNum);
54 58
         page.setSize(pageSize == null ? 10 : pageSize);
55
-        IPage<Activity> activityEnrollIPage = activityEnrollMapper.selectPageActivityEnroll(page, activityId);
59
+        IPage<Map<String, Object>> activityEnrollIPage = activityEnrollMapper.selectPageActivityEnroll(page, activityId, customerName, customerPhone);
56 60
 
57 61
         responseBean.addSuccess(activityEnrollIPage);
58 62
         return responseBean;

+ 35
- 0
whole-estate/src/main/java/com/example/wholeestate/service/impl/BuildingServiceImpl.java Näytä tiedosto

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
+import com.example.wholeestate.common.Constant;
9 10
 import com.example.wholeestate.common.resp.ResponseBean;
10 11
 import com.example.wholeestate.common.uuid.IdGen;
11 12
 import com.example.wholeestate.dao.*;
@@ -368,4 +369,38 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
368 369
     }
369 370
 
370 371
 
372
+    @Override
373
+    public ResponseBean getWxBuildingList() {
374
+        ResponseBean responseBean = new ResponseBean();
375
+
376
+        QueryWrapper<Building> buildingQueryWrapper = new QueryWrapper<>();
377
+        List<Building> buildingList = buildingMapper.selectList(buildingQueryWrapper);
378
+        responseBean.addSuccess(buildingList);
379
+
380
+        return responseBean;
381
+    }
382
+
383
+    @Override
384
+    public ResponseBean getWxBuildingById(String buildingId) {
385
+        ResponseBean responseBean = new ResponseBean();
386
+
387
+        // 楼盘信息
388
+        QueryWrapper<Building> buildingQueryWrapper = new QueryWrapper<>();
389
+        buildingQueryWrapper.eq("building_id", buildingId);
390
+        Building building = buildingMapper.selectOne(buildingQueryWrapper);
391
+        if (null == building) {
392
+            responseBean.addError("楼盘不存在!");
393
+            return responseBean;
394
+        }
395
+
396
+        // 楼盘Banner
397
+        QueryWrapper<BuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
398
+        buildingImgQueryWrapper.eq("building_id", building.getBuildingId());
399
+        buildingImgQueryWrapper.eq("img_type", Constant.BUILDING_IMG_TYPE_BANNER);
400
+        buildingImgMapper.selectList(buildingImgQueryWrapper);
401
+
402
+        // 楼盘户型图
403
+
404
+        return responseBean;
405
+    }
371 406
 }

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/service/impl/CommentServiceImpl.java Näytä tiedosto

@@ -78,7 +78,7 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
78 78
 
79 79
         QueryWrapper<Comment> commentQueryWrapper = new QueryWrapper<>();
80 80
         commentQueryWrapper.eq("comment_type", commentType);
81
-        commentQueryWrapper.eq("main_id", mainId);
81
+        commentQueryWrapper.eq(StringUtils.isNotBlank(mainId),"main_id", mainId);
82 82
         IPage<Comment> commentIPage = commentMapper.selectPage(page, commentQueryWrapper);
83 83
 
84 84
         responseBean.addSuccess(commentIPage);

+ 1
- 8
whole-estate/src/main/java/com/example/wholeestate/service/impl/CustomerServiceImpl.java Näytä tiedosto

@@ -38,15 +38,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
38 38
     private IdGen idGen = IdGen.get();
39 39
 
40 40
     @Override
41
-    public ResponseBean customerList(String parameter) {
41
+    public ResponseBean customerList(Integer pageNum, Integer pageSize, String phone, Date beginDate, Date endDate, String name) {
42 42
         ResponseBean response= new ResponseBean();
43
-        JSONObject object= JSONObject.parseObject(parameter);
44
-        Date beginDate = object.getDate("beginDate");
45
-        Date endDate = object.getDate("endDate");
46
-        String phone = object.getString("phone");
47
-        String name = object.getString("name");
48
-        Integer pageNum = object.getInteger("pageNum");
49
-        Integer pageSize = object.getInteger("pageSize");
50 43
 
51 44
         Page<Customer> page = new Page<>();
52 45
         page.setSize(pageSize == null ? 10 : pageSize);

+ 24
- 0
whole-estate/src/main/resources/mapper/ActivityEnrollMapper.xml Näytä tiedosto

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.example.wholeestate.dao.ActivityEnrollMapper">
4
+
5
+    <select id="selectPageActivityEnroll" resultType="map">
6
+        SELECT
7
+          tacus.phone as phone,tacus.`name` as name,tacus.customer_name as customerName,tab.building_name AS buildingName,
8
+          tacus.id_num as idNum, tacus.avatar as avatar, tace.enroll_date as enrollDate
9
+        FROM ta_activity tac
10
+        RIGHT JOIN ta_activity_enroll tace ON tac.activity_id = tace.activity_id
11
+        LEFT JOIN ta_customer tacus ON tace.customer_id = tacus.customer_id
12
+        LEFT JOIN ta_building tab ON tac.building_id = tab.building_id
13
+        <where>
14
+            tac.activity_id = #{activityId} and tac.status > -1
15
+            <if test="customerName != null and customerName !=''">
16
+                and tacus.customer_name like CONCAT('%', #{customerName} , '%')
17
+            </if>
18
+            <if test="customerPhone != null and customerPhone !=''">
19
+                and tacus.phone like CONCAT('%', #{customerPhone} , '%')
20
+            </if>
21
+        </where>
22
+    </select>
23
+
24
+</mapper>