dingxin 6 年之前
父節點
當前提交
3fcc9286bd

+ 6
- 0
whole-estate/src/main/java/com/example/wholeestate/common/Constant.java 查看文件

21
      * 用户 session
21
      * 用户 session
22
      */
22
      */
23
     public static final String USER_SESSION = "user_session";
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 查看文件

175
     @ApiOperation(value = "根据活动id查询活动报名列表", notes = "根据活动id查询活动报名列表")
175
     @ApiOperation(value = "根据活动id查询活动报名列表", notes = "根据活动id查询活动报名列表")
176
     @ApiImplicitParams({
176
     @ApiImplicitParams({
177
             @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageNum", value = "pageNum第几页"),
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
         ResponseBean responseBean = new ResponseBean();
187
         ResponseBean responseBean = new ResponseBean();
182
-        responseBean = iActivityEnrollService.getActivitySignUpList(activityId, pageNum, pageSize);
188
+        responseBean = iActivityEnrollService.getActivitySignUpList(activityId, pageNum, pageSize, customerName, customerPhone);
183
         return responseBean;
189
         return responseBean;
184
     }
190
     }
185
 
191
 

+ 19
- 8
whole-estate/src/main/java/com/example/wholeestate/controller/BuildingController.java 查看文件

234
         return responseBean;
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
     @ApiImplicitParams({
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 查看文件

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

+ 36
- 5
whole-estate/src/main/java/com/example/wholeestate/controller/CustomerController.java 查看文件

10
 import io.swagger.annotations.ApiImplicitParams;
10
 import io.swagger.annotations.ApiImplicitParams;
11
 import io.swagger.annotations.ApiOperation;
11
 import io.swagger.annotations.ApiOperation;
12
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.beans.propertyeditors.CustomDateEditor;
14
+import org.springframework.web.bind.ServletRequestDataBinder;
13
 import org.springframework.web.bind.annotation.*;
15
 import org.springframework.web.bind.annotation.*;
14
 
16
 
17
+import javax.servlet.http.HttpServletRequest;
15
 import javax.servlet.http.HttpSession;
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
  * <p>
24
  * <p>
26
 @RequestMapping("/")
32
 @RequestMapping("/")
27
 @Api(value = "用户 API", description = "用户 API")
33
 @Api(value = "用户 API", description = "用户 API")
28
 public class CustomerController extends BaseController {
34
 public class CustomerController extends BaseController {
35
+
29
     @Autowired
36
     @Autowired
30
     private ICustomerService iCustomerService;
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
     @ApiOperation(value = "会员列表", notes = "会员列表")
53
     @ApiOperation(value = "会员列表", notes = "会员列表")
33
     @ApiImplicitParams({
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
         return responseBean;
71
         return responseBean;
41
     }
72
     }
42
 
73
 

+ 3
- 6
whole-estate/src/main/java/com/example/wholeestate/dao/ActivityEnrollMapper.java 查看文件

8
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Select;
9
 import org.apache.ibatis.annotations.Select;
10
 
10
 
11
+import java.util.Map;
12
+
11
 /**
13
 /**
12
  * <p>
14
  * <p>
13
  * 活动报名表 Mapper 接口
15
  * 活动报名表 Mapper 接口
24
      * @param activityId
26
      * @param activityId
25
      * @return
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
      * 根据 openid 查询 我参加的活动
32
      * 根据 openid 查询 我参加的活动

+ 1
- 0
whole-estate/src/main/java/com/example/wholeestate/model/Activity.java 查看文件

127
      */
127
      */
128
     @TableField(exist = false)
128
     @TableField(exist = false)
129
     private Integer signUpNumber;
129
     private Integer signUpNumber;
130
+
130
 }
131
 }

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/service/IActivityEnrollService.java 查看文件

21
      * @param pageNum
21
      * @param pageNum
22
      * @return
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
      * 根据 openid 查询. 我的活动记录
27
      * 根据 openid 查询. 我的活动记录

+ 8
- 0
whole-estate/src/main/java/com/example/wholeestate/service/IBuildingService.java 查看文件

89
      * @return
89
      * @return
90
      */
90
      */
91
     ResponseBean appointmentUpdate(String id,String writeoffRemark);
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 查看文件

4
 import com.example.wholeestate.common.resp.ResponseBean;
4
 import com.example.wholeestate.common.resp.ResponseBean;
5
 import com.example.wholeestate.model.Customer;
5
 import com.example.wholeestate.model.Customer;
6
 
6
 
7
+import java.util.Date;
8
+
7
 /**
9
 /**
8
  * <p>
10
  * <p>
9
  *  服务类
11
  *  服务类
16
 
18
 
17
     /**
19
     /**
18
      * 会员列表
20
      * 会员列表
19
-     * @param parameter
20
      * @return
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
      * @param id
26
      * @param id

+ 8
- 4
whole-estate/src/main/java/com/example/wholeestate/service/impl/ActivityEnrollServiceImpl.java 查看文件

17
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.stereotype.Service;
18
 import org.springframework.stereotype.Service;
19
 
19
 
20
+import java.util.Map;
21
+
20
 /**
22
 /**
21
  * <p>
23
  * <p>
22
  * 活动报名表 服务实现类
24
  * 活动报名表 服务实现类
40
     private IdGen idGen = IdGen.get();
42
     private IdGen idGen = IdGen.get();
41
 
43
 
42
     @Override
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
         ResponseBean responseBean = new ResponseBean();
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
         if (null == activity) {
51
         if (null == activity) {
48
             responseBean.addError("活动不存在!");
52
             responseBean.addError("活动不存在!");
49
             return responseBean;
53
             return responseBean;
50
         }
54
         }
51
 
55
 
52
-        Page<Activity> page = new Page<>();
56
+        Page<Map<String, Object>> page = new Page<>();
53
         page.setCurrent(pageNum == null ? 1 : pageNum);
57
         page.setCurrent(pageNum == null ? 1 : pageNum);
54
         page.setSize(pageSize == null ? 10 : pageSize);
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
         responseBean.addSuccess(activityEnrollIPage);
61
         responseBean.addSuccess(activityEnrollIPage);
58
         return responseBean;
62
         return responseBean;

+ 35
- 0
whole-estate/src/main/java/com/example/wholeestate/service/impl/BuildingServiceImpl.java 查看文件

6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.core.metadata.IPage;
7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
+import com.example.wholeestate.common.Constant;
9
 import com.example.wholeestate.common.resp.ResponseBean;
10
 import com.example.wholeestate.common.resp.ResponseBean;
10
 import com.example.wholeestate.common.uuid.IdGen;
11
 import com.example.wholeestate.common.uuid.IdGen;
11
 import com.example.wholeestate.dao.*;
12
 import com.example.wholeestate.dao.*;
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 查看文件

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

+ 1
- 8
whole-estate/src/main/java/com/example/wholeestate/service/impl/CustomerServiceImpl.java 查看文件

38
     private IdGen idGen = IdGen.get();
38
     private IdGen idGen = IdGen.get();
39
 
39
 
40
     @Override
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
         ResponseBean response= new ResponseBean();
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
         Page<Customer> page = new Page<>();
44
         Page<Customer> page = new Page<>();
52
         page.setSize(pageSize == null ? 10 : pageSize);
45
         page.setSize(pageSize == null ? 10 : pageSize);

+ 24
- 0
whole-estate/src/main/resources/mapper/ActivityEnrollMapper.xml 查看文件

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>