浏览代码

Merge branch 'develop' of http://git.ycjcjy.com/fuxingfan/smartCommunity into develop

# Conflicts:
#	CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java
#	CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java
#	CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java
#	CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java
傅行帆 6 年前
父节点
当前提交
80d366900f
共有 32 个文件被更改,包括 1308 次插入82 次删除
  1. 3
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/session/UserElement.java
  2. 14
    4
      CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java
  3. 6
    3
      CODE/smart-community/property-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java
  4. 38
    8
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java
  5. 62
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/CodeController.java
  6. 12
    13
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserController.java
  7. 2
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/BuildingOwnerInfoMapper.java
  8. 28
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/SysRoleMapper.java
  9. 23
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaSysRoleMapper.java
  10. 32
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java
  11. 18
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/UserCommunityMapper.java
  12. 2
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/UserMapper.java
  13. 58
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java
  14. 23
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/exception/WisdomException.java
  15. 63
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/SysRole.java
  16. 240
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TaUser.java
  17. 9
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/User.java
  18. 40
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/UserCommunity.java
  19. 13
    4
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java
  20. 16
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ISysRoleService.java
  21. 18
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IUserCommunityService.java
  22. 13
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IUserService.java
  23. 66
    24
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java
  24. 20
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/SysRoleServiceImpl.java
  25. 20
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserCommunityServiceImpl.java
  26. 106
    5
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserServiceImpl.java
  27. 1
    0
      CODE/smart-community/property-api/src/main/resources/application.yml
  28. 31
    0
      CODE/smart-community/property-api/src/main/resources/log4j.properties
  29. 13
    0
      CODE/smart-community/property-api/src/main/resources/mapper/SysRoleMapper.xml
  30. 301
    0
      CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml
  31. 1
    17
      CODE/smart-community/property-api/src/main/resources/mapper/UserMapper.xml
  32. 16
    0
      CODE/smart-community/property-api/src/test/java/com/community/huiju/DemoApplicationTests.java

+ 3
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/session/UserElement.java 查看文件

@@ -20,6 +20,9 @@ public class UserElement implements Serializable {
20 20
     /** 用户唯一标识符 **/
21 21
     private Integer id;
22 22
 
23
+    /** 小区id **/
24
+    private Integer communityId;
25
+
23 26
     /** 用户名 **/
24 27
     private String userName;
25 28
 

+ 14
- 4
CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java 查看文件

@@ -2,6 +2,7 @@ package com.community.huiju.common.base;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4 4
 import com.community.commom.session.UserElement;
5
+import com.community.huiju.exception.WisdomException;
5 6
 
6 7
 import javax.servlet.http.HttpSession;
7 8
 
@@ -10,9 +11,18 @@ import javax.servlet.http.HttpSession;
10 11
  * @date 2018-12-18
11 12
  */
12 13
 public class BaseController {
13
-
14
-    //protected UserElement getUserElement(HttpSession session){
15
-    //    session.getAttribute(Constant.)
16
-    //}
14
+    
15
+    /**
16
+     * 获取 UserElement
17
+     * @param session
18
+     * @return
19
+     */
20
+    protected UserElement getUserElement(HttpSession session){
21
+        UserElement userElement = (UserElement) session.getAttribute(Constant.WEB_PROPERTY_USER_SESSION);
22
+        if (null == userElement) {
23
+            throw new WisdomException("用户凭证不存在!");
24
+        }
25
+        return userElement;
26
+    }
17 27
 
18 28
 }

+ 6
- 3
CODE/smart-community/property-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java 查看文件

@@ -15,10 +15,13 @@ import java.util.concurrent.TimeUnit;
15 15
 @Slf4j
16 16
 public class AppkeyCache {
17 17
 
18
-    // .refreshAfterWrite(3, TimeUnit.HOURS)// 给定时间内没有被读/写访问,则回收。
18
+    // 给定时间内没有被读/写访问,则回收。
19
+    // .refreshAfterWrite(3, TimeUnit.HOURS)
19 20
     static LoadingCache<String, Object> cache = CacheBuilder.newBuilder()
20
-            .expireAfterAccess(Constant.CACHE_EXPIRE, TimeUnit.HOURS)// 缓存过期时间和redis缓存时长一样
21
-            .maximumSize(Constant.CACHE_SIZE).// 设置缓存个数
21
+            // 缓存过期时间和redis缓存时长一样
22
+            .expireAfterAccess(Constant.CACHE_EXPIRE, TimeUnit.HOURS)
23
+            // 设置缓存个数
24
+            .maximumSize(Constant.CACHE_SIZE).
22 25
             build(new CacheLoader<String, Object>() {
23 26
             @Override
24 27
             /** 当本地缓存命没有中时,调用load方法获取结果并将结果缓存 **/

+ 38
- 8
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java 查看文件

@@ -2,6 +2,7 @@ package com.community.huiju.controller;
2 2
 
3 3
 
4 4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
5 6
 import com.community.huiju.common.base.BaseController;
6 7
 import com.community.huiju.model.BuildingOwnerInfo;
7 8
 import com.community.huiju.service.IBuildingOwnerInfoService;
@@ -18,8 +19,9 @@ import org.springframework.web.bind.annotation.RequestParam;
18 19
 import org.springframework.web.bind.annotation.RestController;
19 20
 import org.springframework.web.multipart.MultipartFile;
20 21
 
22
+import javax.servlet.http.HttpSession;
21 23
 import java.util.List;
22
-import java.util.Map;
24
+import java.util.stream.Collectors;
23 25
 
24 26
 /**
25 27
  * <p>
@@ -60,9 +62,10 @@ public class BuildingOwnerInfoController extends BaseController {
60 62
             @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
61 63
     })
62 64
     @RequestMapping(value = "/building/update", method = RequestMethod.PUT)
63
-    public ResponseBean update(@RequestBody String parameter){
65
+    public ResponseBean update(@RequestBody String parameter, HttpSession session){
64 66
         ResponseBean responseBean = new ResponseBean();
65
-        responseBean = iBuildingOwnerInfoService.update(parameter);
67
+        UserElement userElement = getUserElement(session);
68
+        responseBean = iBuildingOwnerInfoService.update(parameter,userElement.getId());
66 69
         return responseBean;
67 70
     }
68 71
 
@@ -75,21 +78,48 @@ public class BuildingOwnerInfoController extends BaseController {
75 78
             @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
76 79
     })
77 80
     @RequestMapping(value = "/building/add", method = RequestMethod.POST)
78
-    public ResponseBean add(String parameter){
81
+    public ResponseBean add(@RequestBody String parameter, HttpSession session){
79 82
         ResponseBean responseBean = new ResponseBean();
80
-        responseBean = iBuildingOwnerInfoService.add(parameter);
83
+        UserElement userElement = getUserElement(session);
84
+        responseBean = iBuildingOwnerInfoService.add(parameter,userElement.getId());
81 85
         return responseBean;
82 86
     }
83 87
 
84 88
     @ApiOperation(value = "批量删除楼栋业主信息", notes = "批量删除楼栋业主信息")
85 89
     @ApiImplicitParams({
86
-            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "ids"),
90
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "ids",value = "id集合"),
87 91
             @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
88 92
     })
89 93
     @RequestMapping(value = "/building/delete", method = RequestMethod.DELETE)
90
-    public ResponseBean delete(@RequestBody List<Integer> ids){
94
+    public ResponseBean delete(@RequestBody List<Integer> ids, HttpSession session){
91 95
         ResponseBean responseBean = new ResponseBean();
92
-        responseBean = iBuildingOwnerInfoService.deleteByIdDatch(ids);
96
+        UserElement userElement = getUserElement(session);
97
+        List<BuildingOwnerInfo> infoList = ids.stream().map(e->{
98
+            BuildingOwnerInfo buildingOwnerInfo = new BuildingOwnerInfo();
99
+            buildingOwnerInfo.setId(e);
100
+            buildingOwnerInfo.setVerifyStatus("2");
101
+            buildingOwnerInfo.setUpdateUser(userElement.getId());
102
+            return buildingOwnerInfo;
103
+        }).collect(Collectors.toList());
104
+        boolean result = iBuildingOwnerInfoService.updateBatchById(infoList);
105
+        if (result) {
106
+            responseBean.addSuccess("操作成功!");
107
+        }else {
108
+            responseBean.addError("操作失败!");
109
+        }
110
+        return responseBean;
111
+    }
112
+
113
+    @ApiOperation(value = "查询 楼栋/单元/楼层/户号", notes = "查询 楼栋/单元/楼层/户号")
114
+    @ApiImplicitParams({
115
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "building楼层;" +
116
+                    "unit单元;level楼层;roomNo户号")
117
+    })
118
+    @RequestMapping(value = "/building/info",method = RequestMethod.POST)
119
+    public ResponseBean buildingUnitNumber(@RequestBody String parameter, HttpSession session){
120
+        ResponseBean responseBean = new ResponseBean();
121
+        UserElement userElement = getUserElement(session);
122
+        responseBean = iBuildingOwnerInfoService.getBuildingOrUnitOrNumber(parameter, userElement.getCommunityId());
93 123
         return responseBean;
94 124
     }
95 125
     

+ 62
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/CodeController.java 查看文件

@@ -0,0 +1,62 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.utils.AccountValidatorUtil;
5
+import com.community.huiju.common.code.ICode;
6
+import com.community.huiju.common.code.cache.AppkeyCache;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.beans.factory.annotation.Qualifier;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RequestParam;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import javax.servlet.http.HttpSession;
21
+
22
+/**
23
+ * @author weiximei
24
+ */
25
+@RestController
26
+@RequestMapping("/")
27
+@RefreshScope
28
+@Api(value = "获取验证码的API", description = "获取验证码的API")
29
+@Slf4j
30
+public class CodeController {
31
+
32
+    @Autowired
33
+    @Qualifier("phoneCodeImpl")
34
+    private ICode iCode;
35
+
36
+    @ApiOperation(value = "获取手机验证码", notes = "根据手机号发送验证码")
37
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "query",dataType = "String",name = "phone",value = "手机号")})
38
+    @RequestMapping(value = "/code/sendCode",method = RequestMethod.POST)
39
+    public ResponseBean sendCode(@RequestParam String phone, HttpSession session) {
40
+        ResponseBean response = new ResponseBean();
41
+
42
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
43
+        if (!AccountValidatorUtil.isPhone(phone)){
44
+            response.addError("请输入正取的手机号!");
45
+            return response;
46
+        }
47
+
48
+        int code = (int) ((Math.random()*9+1)*1000);
49
+        boolean result = iCode.sendCode(phone,String.valueOf(code));
50
+        // boolean result = true;
51
+        if (result) {
52
+            log.info("{} 验证码: {}",phone,code);
53
+            // 设置缓存
54
+            AppkeyCache.setCache(phone,String.valueOf(code));
55
+            response.addSuccess("发送成功!"+code);
56
+        } else {
57
+            response.addError("发送失败!");
58
+        }
59
+        return response;
60
+    }
61
+
62
+}

+ 12
- 13
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserController.java 查看文件

@@ -1,12 +1,11 @@
1 1
 package com.community.huiju.controller;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSONObject;
4 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
-import com.community.commom.constant.Constant;
6 6
 import com.community.commom.mode.ResponseBean;
7
-import com.community.commom.session.UserElement;
8 7
 import com.community.huiju.common.base.BaseController;
9
-import com.community.huiju.model.User;
8
+import com.community.huiju.model.TaUser;
10 9
 import com.community.huiju.service.IUserService;
11 10
 import io.swagger.annotations.Api;
12 11
 import io.swagger.annotations.ApiImplicitParam;
@@ -14,11 +13,10 @@ import io.swagger.annotations.ApiImplicitParams;
14 13
 import io.swagger.annotations.ApiOperation;
15 14
 import org.springframework.beans.factory.annotation.Autowired;
16 15
 import org.springframework.cloud.context.config.annotation.RefreshScope;
17
-import org.springframework.web.bind.annotation.RequestMapping;
18
-import org.springframework.web.bind.annotation.RequestMethod;
19
-import org.springframework.web.bind.annotation.RestController;
16
+import org.springframework.web.bind.annotation.*;
20 17
 
21 18
 import javax.servlet.http.HttpSession;
19
+import java.util.HashMap;
22 20
 
23 21
 /**
24 22
  * <p>
@@ -36,6 +34,7 @@ public class UserController extends BaseController {
36 34
 	
37 35
 	@Autowired
38 36
 	private IUserService userService;
37
+
39 38
 	
40 39
 	@ApiOperation(value = "获取用户列表",nickname = "获取用户信息")
41 40
 	@ApiImplicitParams({
@@ -52,13 +51,13 @@ public class UserController extends BaseController {
52 51
 
53 52
 	@ApiOperation(value = "获取已认证通过的用户信息",nickname ="获取已认证通过的用户信息")
54 53
 	@ApiImplicitParams({
55
-			@ApiImplicitParam(paramType="body",dataType = "String",name ="phone",value = "电话"),
56
-			@ApiImplicitParam(paramType="body",dataType = "String",name ="name",value = "姓名"),
57
-			@ApiImplicitParam(paramType="body",dataType = "String",name ="status",value = "认证状态")
58
-	})
59
-	@RequestMapping(value = "/userPassCertification",method = RequestMethod.GET)
60
-	public ResponseBean userPassCertification(){
54
+			@ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="loginName:手机号,serName:姓名 ,verifyStatus:审核状态,current:每页显示多少条,pageSzie:当前页数")})
55
+
56
+	@RequestMapping(value="/userPassCertification",method = RequestMethod.POST)
57
+	public ResponseBean userPassCertification(@RequestBody String paramets){
58
+
61 59
 
62
-		return null;
60
+		ResponseBean allApprove=userService.selectUserApprove(paramets);
61
+		return allApprove;
63 62
 	}
64 63
 }

+ 2
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/BuildingOwnerInfoMapper.java 查看文件

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.community.huiju.model.BuildingOwnerInfo;
5
+import org.apache.ibatis.annotations.Mapper;
5 6
 
6 7
 /**
7 8
  * <p>
@@ -11,6 +12,7 @@ import com.community.huiju.model.BuildingOwnerInfo;
11 12
  * @author weiximei
12 13
  * @since 2018-12-18
13 14
  */
15
+@Mapper
14 16
 public interface BuildingOwnerInfoMapper extends BaseMapper<BuildingOwnerInfo> {
15 17
 
16 18
 }

+ 28
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/SysRoleMapper.java 查看文件

@@ -0,0 +1,28 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.community.huiju.model.SysRole;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+/**
11
+ * <p>
12
+ * 物业web端角色表 Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author weiximei
16
+ * @since 2018-12-19
17
+ */
18
+@Mapper
19
+public interface SysRoleMapper extends BaseMapper<SysRole> {
20
+
21
+    /**
22
+     * 多表查询 查询出这个用户所有的角色权限
23
+     * @param map
24
+     * @return
25
+     */
26
+    List<SysRole> selectByUserIdAndRoleId(Map<String, Object> map);
27
+
28
+}

+ 23
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaSysRoleMapper.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.community.huiju.dao;
2
+
3
+
4
+import com.community.huiju.model.TaSysRole;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+@Mapper
8
+public interface TaSysRoleMapper {
9
+    int deleteByPrimaryKey(Integer id);
10
+
11
+    int insert(TaSysRole record);
12
+
13
+    int insertSelective(TaSysRole record);
14
+
15
+    TaSysRole selectByPrimaryKey(Integer id);
16
+
17
+    int updateByPrimaryKeySelective(TaSysRole record);
18
+
19
+    int updateByPrimaryKey(TaSysRole record);
20
+
21
+    TaSysRole findRoleByUserId(Integer userId);
22
+
23
+}

+ 32
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java 查看文件

@@ -0,0 +1,32 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.community.huiju.model.TaUser;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+@Mapper
12
+public interface TaUserMapper {
13
+    int deleteByPrimaryKey(Integer id);
14
+
15
+    int insert(TaUser record);
16
+
17
+    int insertSelective(TaUser record);
18
+
19
+    TaUser selectByPrimaryKey(Integer id);
20
+
21
+    int updateByPrimaryKeySelective(TaUser record);
22
+
23
+    int updateByPrimaryKey(TaUser record);
24
+
25
+    /**
26
+     * 获取已认证通过的
27
+     * @param map
28
+     * @param page
29
+     * @return
30
+     */
31
+    List<Map<Object,Object>> selectUserApprove(Map<Object, Object> map, IPage page);
32
+}

+ 18
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/UserCommunityMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.community.huiju.model.UserCommunity;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 物业端用户和小区关联表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author weiximei
13
+ * @since 2018-12-19
14
+ */
15
+@Mapper
16
+public interface UserCommunityMapper extends BaseMapper<UserCommunity> {
17
+
18
+}

+ 2
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/UserMapper.java 查看文件

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.community.huiju.model.User;
5
+import org.apache.ibatis.annotations.Mapper;
5 6
 
6 7
 import java.util.List;
7 8
 import java.util.Map;
@@ -14,8 +15,7 @@ import java.util.Map;
14 15
  * @author jobob
15 16
  * @since 2018-12-18
16 17
  */
18
+@Mapper
17 19
 public interface UserMapper extends BaseMapper<User> {
18 20
 
19
-    List<Map<Object,Object>> selectUserApprove(Map<Object,Object> map);
20
-
21 21
 }

+ 58
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java 查看文件

@@ -0,0 +1,58 @@
1
+package com.community.huiju.exception;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.validation.ObjectError;
7
+import org.springframework.web.bind.MethodArgumentNotValidException;
8
+import org.springframework.web.bind.annotation.ControllerAdvice;
9
+import org.springframework.web.bind.annotation.ExceptionHandler;
10
+import org.springframework.web.bind.annotation.ResponseBody;
11
+
12
+import java.util.List;
13
+
14
+/**
15
+ * 统一异常出口
16
+ * @author weiximei
17
+ */
18
+@ControllerAdvice
19
+@ResponseBody
20
+@Slf4j
21
+public class ExceptionHandleAdice {
22
+
23
+
24
+    @ExceptionHandler(Exception.class)
25
+    public ResponseBean handleException(Exception e){
26
+        log.error(e.getMessage(),e);
27
+        ResponseBean response = new ResponseBean();
28
+        response.addError(Constant.REQUEST_ERROR,"系统异常,请稍后重试!");
29
+        return response;
30
+    }
31
+
32
+
33
+    @ExceptionHandler(WisdomException.class)
34
+    public ResponseBean handleException(WisdomException e) {
35
+        log.error(e.getMessage(),e);
36
+        ResponseBean response = new ResponseBean();
37
+        response.addError(e.getMessage());
38
+        return response;
39
+    }
40
+
41
+
42
+    @ExceptionHandler(MethodArgumentNotValidException.class)
43
+    public ResponseBean handlelllewgalParamException(MethodArgumentNotValidException e){
44
+        ResponseBean response = new ResponseBean();
45
+
46
+        List<ObjectError> errors  =e.getBindingResult().getAllErrors();
47
+        String message = "参数不合法";
48
+        if (errors.size() >0) {
49
+            message = errors.get(0).getDefaultMessage();
50
+        }
51
+
52
+        response.addError(message);
53
+
54
+        return response;
55
+    }
56
+
57
+
58
+}

+ 23
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/exception/WisdomException.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.community.huiju.exception;
2
+
3
+
4
+/**
5
+ * @author weiximei
6
+ */
7
+public class WisdomException extends RuntimeException {
8
+
9
+
10
+    public WisdomException(String msg, Throwable t) {
11
+        super(msg, t);
12
+    }
13
+
14
+    public WisdomException(String msg) {
15
+        super(msg);
16
+    }
17
+
18
+    public WisdomException(String msg, Object ...args) {
19
+        this(String.format(msg, args));
20
+    }
21
+
22
+
23
+}

+ 63
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/SysRole.java 查看文件

@@ -0,0 +1,63 @@
1
+package com.community.huiju.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import lombok.Data;
5
+import lombok.EqualsAndHashCode;
6
+import lombok.experimental.Accessors;
7
+
8
+import java.io.Serializable;
9
+import java.time.LocalDateTime;
10
+
11
+/**
12
+ * <p>
13
+ * 物业web端角色表
14
+ * </p>
15
+ *
16
+ * @author weiximei
17
+ * @since 2018-12-19
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+@TableName("tp_sys_role")
23
+public class SysRole implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    /**
28
+     * 小区id
29
+     */
30
+    private Integer communityId;
31
+
32
+    /**
33
+     * 角色名称
34
+     */
35
+    private String roleName;
36
+
37
+    /**
38
+     * 描述
39
+     */
40
+    private String description;
41
+
42
+    /**
43
+     * 创建人
44
+     */
45
+    private Integer createUser;
46
+
47
+    /**
48
+     * 创建时间
49
+     */
50
+    private LocalDateTime createDate;
51
+
52
+    /**
53
+     * 更新人
54
+     */
55
+    private Integer updateUser;
56
+
57
+    /**
58
+     * 更新时间
59
+     */
60
+    private LocalDateTime updateDate;
61
+
62
+
63
+}

+ 240
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TaUser.java 查看文件

@@ -0,0 +1,240 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TaUser {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private Integer buildingOwnerInfoId;
11
+
12
+    private String headPortrait;
13
+
14
+    private String userName;
15
+
16
+    private String loginName;
17
+
18
+    private String loginPassword;
19
+
20
+    private String email;
21
+
22
+    private String gender;
23
+
24
+    private String status;
25
+
26
+    private String remark;
27
+
28
+    private Integer parentId;
29
+
30
+    private String acceptAgreementStatus;
31
+
32
+    private String verifyStatus;
33
+
34
+    private Integer createUser;
35
+
36
+    private Date createDate;
37
+
38
+    private Integer updateUser;
39
+
40
+    private Date updateDate;
41
+
42
+    // 海康UserId
43
+    private Integer hkUserId;
44
+
45
+    // 海康 卡片号
46
+    private String hkCardNo;
47
+
48
+    // 人脸状态
49
+    private String faceStatus;
50
+
51
+    // 角色编号
52
+    private Integer role;
53
+
54
+    // 角色名称
55
+    private String roleName;
56
+
57
+    public Integer getId() {
58
+        return id;
59
+    }
60
+
61
+    public void setId(Integer id) {
62
+        this.id = id;
63
+    }
64
+
65
+    public Integer getCommunityId() {
66
+        return communityId;
67
+    }
68
+
69
+    public void setCommunityId(Integer communityId) {
70
+        this.communityId = communityId;
71
+    }
72
+
73
+    public Integer getBuildingOwnerInfoId() {
74
+        return buildingOwnerInfoId;
75
+    }
76
+
77
+    public void setBuildingOwnerInfoId(Integer buildingOwnerInfoId) {
78
+        this.buildingOwnerInfoId = buildingOwnerInfoId;
79
+    }
80
+
81
+    public String getHeadPortrait() {
82
+        return headPortrait;
83
+    }
84
+
85
+    public void setHeadPortrait(String headPortrait) {
86
+        this.headPortrait = headPortrait == null ? null : headPortrait.trim();
87
+    }
88
+
89
+    public String getUserName() {
90
+        return userName;
91
+    }
92
+
93
+    public void setUserName(String userName) {
94
+        this.userName = userName == null ? null : userName.trim();
95
+    }
96
+
97
+    public String getLoginName() {
98
+        return loginName;
99
+    }
100
+
101
+    public void setLoginName(String loginName) {
102
+        this.loginName = loginName == null ? null : loginName.trim();
103
+    }
104
+
105
+    public String getLoginPassword() {
106
+        return loginPassword;
107
+    }
108
+
109
+    public void setLoginPassword(String loginPassword) {
110
+        this.loginPassword = loginPassword == null ? null : loginPassword.trim();
111
+    }
112
+
113
+    public String getEmail() {
114
+        return email;
115
+    }
116
+
117
+    public void setEmail(String email) {
118
+        this.email = email == null ? null : email.trim();
119
+    }
120
+
121
+    public String getGender() {
122
+        return gender;
123
+    }
124
+
125
+    public void setGender(String gender) {
126
+        this.gender = gender == null ? null : gender.trim();
127
+    }
128
+
129
+    public String getStatus() {
130
+        return status;
131
+    }
132
+
133
+    public void setStatus(String status) {
134
+        this.status = status == null ? null : status.trim();
135
+    }
136
+
137
+    public String getRemark() {
138
+        return remark;
139
+    }
140
+
141
+    public void setRemark(String remark) {
142
+        this.remark = remark == null ? null : remark.trim();
143
+    }
144
+
145
+    public Integer getParentId() {
146
+        return parentId;
147
+    }
148
+
149
+    public void setParentId(Integer parentId) {
150
+        this.parentId = parentId;
151
+    }
152
+
153
+    public String getAcceptAgreementStatus() {
154
+        return acceptAgreementStatus;
155
+    }
156
+
157
+    public void setAcceptAgreementStatus(String acceptAgreementStatus) {
158
+        this.acceptAgreementStatus = acceptAgreementStatus == null ? null : acceptAgreementStatus.trim();
159
+    }
160
+
161
+    public String getVerifyStatus() {
162
+        return verifyStatus;
163
+    }
164
+
165
+    public void setVerifyStatus(String verifyStatus) {
166
+        this.verifyStatus = verifyStatus == null ? null : verifyStatus.trim();
167
+    }
168
+
169
+    public String getFaceStatus() {
170
+        return faceStatus;
171
+    }
172
+
173
+    public void setFaceStatus(String faceStatus) {
174
+        this.faceStatus = faceStatus;
175
+    }
176
+
177
+    public Integer getCreateUser() {
178
+        return createUser;
179
+    }
180
+
181
+    public void setCreateUser(Integer createUser) {
182
+        this.createUser = createUser;
183
+    }
184
+
185
+    public Date getCreateDate() {
186
+        return createDate;
187
+    }
188
+
189
+    public void setCreateDate(Date createDate) {
190
+        this.createDate = createDate;
191
+    }
192
+
193
+    public Integer getUpdateUser() {
194
+        return updateUser;
195
+    }
196
+
197
+    public void setUpdateUser(Integer updateUser) {
198
+        this.updateUser = updateUser;
199
+    }
200
+
201
+    public Date getUpdateDate() {
202
+        return updateDate;
203
+    }
204
+
205
+    public void setUpdateDate(Date updateDate) {
206
+        this.updateDate = updateDate;
207
+    }
208
+
209
+    public Integer getHkUserId() {
210
+        return hkUserId;
211
+    }
212
+
213
+    public void setHkUserId(Integer hkUserId) {
214
+        this.hkUserId = hkUserId;
215
+    }
216
+
217
+    public String getHkCardNo() {
218
+        return hkCardNo;
219
+    }
220
+
221
+    public void setHkCardNo(String hkCardNo) {
222
+        this.hkCardNo = hkCardNo;
223
+    }
224
+
225
+    public Integer getRole() {
226
+        return role;
227
+    }
228
+
229
+    public void setRole(Integer role) {
230
+        this.role = role;
231
+    }
232
+
233
+    public String getRoleName() {
234
+        return roleName;
235
+    }
236
+
237
+    public void setRoleName(String roleName) {
238
+        this.roleName = roleName;
239
+    }
240
+}

+ 9
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/User.java 查看文件

@@ -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.List;
10 11
 
11 12
 /**
12 13
  * <p>
@@ -24,6 +25,8 @@ public class User implements Serializable {
24 25
 
25 26
     private static final long serialVersionUID = 1L;
26 27
 
28
+    private Integer id;
29
+
27 30
     /**
28 31
      * 小区id
29 32
      */
@@ -84,4 +87,10 @@ public class User implements Serializable {
84 87
      */
85 88
     private LocalDateTime updateDate;
86 89
 
90
+    /** 用户token **/
91
+    private String token;
92
+
93
+    /** 角色 **/
94
+    private List<SysRole> roles;
95
+
87 96
 }

+ 40
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/UserCommunity.java 查看文件

@@ -0,0 +1,40 @@
1
+package com.community.huiju.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import io.swagger.models.auth.In;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+
11
+/**
12
+ * <p>
13
+ * 物业端用户和小区关联表
14
+ * </p>
15
+ *
16
+ * @author weiximei
17
+ * @since 2018-12-19
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+@TableName("tp_user_community")
23
+public class UserCommunity implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    private Integer id;
28
+
29
+    /**
30
+     * 小区id
31
+     */
32
+    private Integer communityId;
33
+
34
+    /**
35
+     * 物业端用户id
36
+     */
37
+    private Integer tpUserId;
38
+
39
+
40
+}

+ 13
- 4
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java 查看文件

@@ -28,22 +28,28 @@ public interface IBuildingOwnerInfoService extends IService<BuildingOwnerInfo> {
28 28
     /**
29 29
      * 修改 楼栋业主信息
30 30
      * @param parameter
31
+     * @param userId
31 32
      * @return
32 33
      */
33
-    ResponseBean update(String parameter);
34
+    ResponseBean update(String parameter, Integer userId);
34 35
 
35 36
     /**
36 37
      * 添加 楼栋业主信息
37 38
      * @param parameter
39
+     * @param userId
38 40
      * @return
39 41
      */
40
-    ResponseBean add(String parameter);
42
+    ResponseBean add(String parameter, Integer userId);
41 43
 
42 44
     /**
43
-     * 根据Id 批量删除
44
-     * @param ids
45
+     * 查询 楼栋/单元/楼层/号
46
+     *
47
+     *  楼栋是根据 小区ID查询
48
+     *
49
+     * @param parameter
45 50
      * @return
46 51
      */
52
+
47 53
     ResponseBean deleteByIdDatch(List<Integer> ids);
48 54
     
49 55
     /**
@@ -52,4 +58,7 @@ public interface IBuildingOwnerInfoService extends IService<BuildingOwnerInfo> {
52 58
      * @return
53 59
      */
54 60
     ResponseBean getExcelData(MultipartFile file);
61
+
62
+    ResponseBean getBuildingOrUnitOrNumber(String parameter, Integer communityId);
63
+
55 64
 }

+ 16
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ISysRoleService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.community.huiju.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.huiju.model.SysRole;
5
+
6
+/**
7
+ * <p>
8
+ * 物业web端角色表 服务类
9
+ * </p>
10
+ *
11
+ * @author weiximei
12
+ * @since 2018-12-19
13
+ */
14
+public interface ISysRoleService extends IService<SysRole> {
15
+
16
+}

+ 18
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IUserCommunityService.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.community.huiju.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.huiju.model.UserCommunity;
5
+
6
+/**
7
+ * <p>
8
+ * 物业端用户和小区关联表 服务类
9
+ * </p>
10
+ *
11
+ * @author weiximei
12
+ * @since 2018-12-19
13
+ */
14
+public interface IUserCommunityService extends IService<UserCommunity> {
15
+
16
+
17
+
18
+}

+ 13
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IUserService.java 查看文件

@@ -1,10 +1,12 @@
1 1
 package com.community.huiju.service;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.community.commom.mode.ResponseBean;
7
+import com.community.huiju.model.TaUser;
5 8
 import com.community.huiju.model.User;
6 9
 
7
-import java.util.List;
8 10
 import java.util.Map;
9 11
 
10 12
 /**
@@ -16,6 +18,15 @@ import java.util.Map;
16 18
  * @since 2018-12-18
17 19
  */
18 20
 public interface IUserService extends IService<User> {
19
-    List<Object> selectUserApprove(Map map);
21
+    ResponseBean selectUserApprove(String paramets);
22
+
23
+    /**
24
+     * 登陆
25
+     * @param phone
26
+     * @param communityId
27
+     * @param code
28
+     * @return
29
+     */
30
+    ResponseBean login(String phone, Integer communityId, Integer code);
20 31
 
21 32
 }

+ 66
- 24
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java 查看文件

@@ -1,9 +1,7 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
-import com.baomidou.mybatisplus.core.conditions.query.EmptyWrapper;
5 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
7 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
8 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -11,21 +9,20 @@ import com.community.commom.constant.Constant;
11 9
 import com.community.commom.mode.ResponseBean;
12 10
 import com.community.commom.utils.AccountValidatorUtil;
13 11
 import com.community.commom.utils.BeanTools;
14
-import com.community.commom.utils.HttpClientUtils;
15 12
 import com.community.huiju.dao.BuildingOwnerInfoMapper;
13
+import com.community.huiju.exception.WisdomException;
16 14
 import com.community.huiju.model.BuildingOwnerInfo;
17 15
 import com.community.huiju.service.IBuildingOwnerInfoService;
18
-import com.google.common.collect.Lists;
19 16
 import com.google.common.collect.Maps;
20
-import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
21 17
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
22
-import org.apache.poi.ss.usermodel.Cell;
23 18
 import org.apache.poi.ss.usermodel.Row;
24 19
 import org.apache.poi.ss.usermodel.Sheet;
25 20
 import org.apache.poi.ss.usermodel.Workbook;
26 21
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
27 22
 import org.slf4j.Logger;
28 23
 import org.slf4j.LoggerFactory;
24
+
25
+import lombok.extern.slf4j.Slf4j;
29 26
 import org.springframework.beans.factory.annotation.Autowired;
30 27
 import org.springframework.stereotype.Service;
31 28
 import org.springframework.transaction.annotation.Transactional;
@@ -36,7 +33,7 @@ import java.util.ArrayList;
36 33
 import java.util.HashMap;
37 34
 import java.util.List;
38 35
 import java.util.Map;
39
-import java.util.regex.Pattern;
36
+
40 37
 
41 38
 /**
42 39
  * <p>
@@ -47,6 +44,7 @@ import java.util.regex.Pattern;
47 44
  * @since 2018-12-18
48 45
  */
49 46
 @Service("iBuildingOwnerInfoService")
47
+@Slf4j
50 48
 public class BuildingOwnerInfoServiceImpl extends ServiceImpl<BuildingOwnerInfoMapper, BuildingOwnerInfo> implements IBuildingOwnerInfoService {
51 49
 
52 50
     @Autowired
@@ -80,6 +78,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<BuildingOwnerInfoM
80 78
         QueryWrapper<BuildingOwnerInfo> queryWrapper = new QueryWrapper<>();
81 79
         queryWrapper.allEq(map,false);
82 80
         queryWrapper.like(buildingOwnerInfo.getOwnerName() != null,"owner_name",buildingOwnerInfo.getOwnerName());
81
+
83 82
         // 分页查询
84 83
         IPage<BuildingOwnerInfo> infoIPage = buildingOwnerInfoMapper.selectPage(page, queryWrapper);
85 84
 
@@ -101,25 +100,23 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<BuildingOwnerInfoM
101 100
 
102 101
     @Override
103 102
     @Transactional(rollbackFor = Exception.class)
104
-    public ResponseBean update(String parameter) {
103
+    public ResponseBean update(String parameter, Integer userId) {
105 104
         ResponseBean responseBean = new ResponseBean();
106 105
 
107 106
         BuildingOwnerInfo buildingOwnerInfo = JSONObject.parseObject(parameter, BuildingOwnerInfo.class);
108 107
         BuildingOwnerInfo oldBuildingOwnerInfo = buildingOwnerInfoMapper.selectById(buildingOwnerInfo.getId());
109 108
         if (null == oldBuildingOwnerInfo) {
110
-            responseBean.addError("数据不存在!");
111
-            return responseBean;
109
+            throw new WisdomException("%s 数据不存在!", buildingOwnerInfo.getId());
112 110
         }
113 111
 
114 112
         BeanTools.copyProperties(buildingOwnerInfo, oldBuildingOwnerInfo);
115 113
 
116 114
         oldBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
117
-        // 用户
118
-        // oldBuildingOwnerInfo.setUpdateUser();
115
+        oldBuildingOwnerInfo.setUpdateUser(userId);
119 116
 
120 117
         int row = buildingOwnerInfoMapper.updateById(oldBuildingOwnerInfo);
121 118
         if (row <= 0) {
122
-            responseBean.addError("操作失败!");
119
+            throw new WisdomException("操作失败!");
123 120
         } else {
124 121
             responseBean.addSuccess("操作成功!");
125 122
         }
@@ -128,15 +125,20 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<BuildingOwnerInfoM
128 125
 
129 126
     @Override
130 127
     @Transactional(rollbackFor = Exception.class)
131
-    public ResponseBean add(String parameter) {
128
+    public ResponseBean add(String parameter, Integer userId) {
132 129
         ResponseBean responseBean = new ResponseBean();
133 130
 
134 131
         BuildingOwnerInfo buildingOwnerInfo = JSONObject.parseObject(parameter, BuildingOwnerInfo.class);
132
+        // 主键是自增的, 所以设置为 null
135 133
         buildingOwnerInfo.setId(null);
134
+        buildingOwnerInfo.setUpdateUser(userId);
135
+        buildingOwnerInfo.setUpdateDate(LocalDateTime.now());
136
+        buildingOwnerInfo.setCreateDate(LocalDateTime.now());
137
+        buildingOwnerInfo.setCreateUser(userId);
136 138
 
137 139
         int row = buildingOwnerInfoMapper.insert(buildingOwnerInfo);
138 140
         if (row <= 0) {
139
-            responseBean.addError("操作失败!");
141
+            throw new WisdomException("操作失败!");
140 142
         } else {
141 143
             responseBean.addSuccess("操作成功!");
142 144
         }
@@ -145,17 +147,57 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<BuildingOwnerInfoM
145 147
     }
146 148
 
147 149
     @Override
148
-    @Transactional(rollbackFor = Exception.class)
149
-    public ResponseBean deleteByIdDatch(List<Integer> ids) {
150
-        
150
+    public ResponseBean getBuildingOrUnitOrNumber(String parameter,Integer communityId) {
151
+
151 152
         ResponseBean responseBean = new ResponseBean();
152
-        int row = buildingOwnerInfoMapper.deleteBatchIds(ids);
153
-        if (row <= 0) {
154
-            responseBean.addError("操作失败!");
155
-        } else {
156
-            responseBean.addSuccess("操作成功!");
153
+        if (null == communityId || "".equals(communityId)) {
154
+            throw new WisdomException("编号:%s 小区不存在!", communityId);
157 155
         }
158
-        return null;
156
+
157
+        BuildingOwnerInfo buildingOwnerInfo = JSONObject.parseObject(parameter, BuildingOwnerInfo.class);
158
+
159
+        Map<String, Object> map = Maps.newHashMap();
160
+
161
+        // 小区
162
+        map.put("community_id", communityId);
163
+        // 栋
164
+        map.put("building",buildingOwnerInfo.getBuilding());
165
+        // 单元
166
+        map.put("unit",buildingOwnerInfo.getUnit());
167
+        // 楼层
168
+        map.put("level",buildingOwnerInfo.getLevel());
169
+
170
+        QueryWrapper<BuildingOwnerInfo> queryWrapper = new QueryWrapper<>();
171
+        queryWrapper.allEq(map, false);
172
+
173
+        /**
174
+         * 1.如果 楼栋值不存在表示根据小区Id查询时查询楼栋!
175
+         * 2.如果 楼栋存在表示查询单元
176
+         * 3.如果 单元存在表示查询楼层
177
+         * 4.如果 楼层存在表示查询户号
178
+         *
179
+         * 查询户号, 依赖于前面的查询条件成立!
180
+         *
181
+         * 这里的查询都依赖于, 前面的查询条件成立! 比如 要使用条件2, 那么条件1 必须成立!
182
+         *
183
+         */
184
+
185
+        String column = null;
186
+        if (null == buildingOwnerInfo.getBuilding()) {
187
+            column = "building";
188
+        } else if (null == buildingOwnerInfo.getUnit()) {
189
+            column = "unit";
190
+        } else if (null == buildingOwnerInfo.getLevel()){
191
+            column = "level";
192
+        } else if (null == buildingOwnerInfo.getRoomNo()) {
193
+            column = "room_no";
194
+        }
195
+        queryWrapper.groupBy(column);
196
+        List<BuildingOwnerInfo> selectList = buildingOwnerInfoMapper.selectList(queryWrapper);
197
+
198
+        responseBean.addSuccess(selectList);
199
+
200
+        return responseBean;
159 201
     }
160 202
     
161 203
     /**

+ 20
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/SysRoleServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.community.huiju.dao.SysRoleMapper;
5
+import com.community.huiju.model.SysRole;
6
+import com.community.huiju.service.ISysRoleService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 物业web端角色表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author weiximei
15
+ * @since 2018-12-19
16
+ */
17
+@Service
18
+public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
19
+
20
+}

+ 20
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserCommunityServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.community.huiju.dao.UserCommunityMapper;
5
+import com.community.huiju.model.UserCommunity;
6
+import com.community.huiju.service.IUserCommunityService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 物业端用户和小区关联表 服务实现类
12
+ * </p>
13
+ *
14
+ * @author weiximei
15
+ * @since 2018-12-19
16
+ */
17
+@Service
18
+public class UserCommunityServiceImpl extends ServiceImpl<UserCommunityMapper, UserCommunity> implements IUserCommunityService {
19
+
20
+}

+ 106
- 5
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserServiceImpl.java 查看文件

@@ -1,13 +1,33 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.community.commom.mode.ResponseBean;
8
+import com.community.huiju.dao.TaUserMapper;
5 9
 import com.community.huiju.dao.UserMapper;
10
+import com.community.huiju.model.TaUser;
11
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
12
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
13
+import com.community.commom.mode.ResponseBean;
14
+import com.community.commom.utils.AccountValidatorUtil;
15
+import com.community.huiju.common.code.cache.AppkeyCache;
16
+import com.community.huiju.dao.SysRoleMapper;
17
+import com.community.huiju.dao.UserCommunityMapper;
18
+import com.community.huiju.dao.UserMapper;
19
+import com.community.huiju.model.SysRole;
6 20
 import com.community.huiju.model.User;
21
+import com.community.huiju.model.UserCommunity;
7 22
 import com.community.huiju.service.IUserService;
23
+import lombok.extern.slf4j.Slf4j;
24
+import com.google.common.collect.Maps;
25
+import org.apache.commons.lang.StringUtils;
8 26
 import org.springframework.beans.factory.annotation.Autowired;
9 27
 import org.springframework.stereotype.Service;
28
+import org.springframework.transaction.annotation.Transactional;
10 29
 
30
+import java.util.HashMap;
11 31
 import java.util.List;
12 32
 import java.util.Map;
13 33
 
@@ -20,12 +40,93 @@ import java.util.Map;
20 40
  * @since 2018-12-18
21 41
  */
22 42
 @Service("userService")
43
+@Transactional
44
+@Slf4j
23 45
 public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
24
-@Autowired
25
-private UserMapper userMapper;
46
+    @Autowired
47
+    private TaUserMapper taUserMapper;
48
+
49
+    @Autowired
50
+    private UserMapper userMapper;
51
+
52
+    @Autowired
53
+    private UserCommunityMapper userCommunityMapper;
54
+
55
+    @Autowired
56
+    private SysRoleMapper sysRoleMapper;
57
+
26 58
     @Override
27
-    public List<Object> selectUserApprove(Map map) {
28
-        List UserApprove=userMapper.selectUserApprove(map);
29
-        return UserApprove;
59
+    public ResponseBean selectUserApprove(String paramets) {
60
+
61
+        ResponseBean responseBean = new ResponseBean();
62
+
63
+        JSONObject jsonobject = JSONObject.parseObject(paramets);
64
+        Integer pageNum = jsonobject.getInteger("pageNum");
65
+        Integer pageSize = jsonobject.getInteger("pageSize");
66
+        TaUser tpTicket = JSONObject.parseObject(paramets, TaUser.class);
67
+        HashMap map = new HashMap<>();
68
+        map.put("loginName", tpTicket.getLoginName());
69
+        map.put("userName", tpTicket.getUserName());
70
+        map.put("verifyStatus", tpTicket.getVerifyStatus());
71
+
72
+        // 分页
73
+        Page<TaUser> page = new Page<>();
74
+        page.setSize(pageSize == null ? 1 : pageSize);
75
+        page.setCurrent(pageNum == null ? 10 : pageNum);
76
+
77
+        List<Map<Object, Object>> mapList = taUserMapper.selectUserApprove(map, page);
78
+        responseBean.addSuccess(mapList);
79
+
80
+        return responseBean;
81
+    }
82
+
83
+
84
+
85
+
86
+    @Override
87
+    public ResponseBean login(String phone, Integer communityId, Integer code) {
88
+        ResponseBean responseBean = new ResponseBean();
89
+        /**************  校验手机号, 验证码   ***************/
90
+        if (!AccountValidatorUtil.isPhone(phone)){
91
+            responseBean.addError("请输入正取的手机号!");
92
+            return responseBean;
93
+        }
94
+        String phoneCode = (String) AppkeyCache.getCache(phone);
95
+        if ("1234".equals(code)) {
96
+
97
+        } else if (StringUtils.isBlank(phoneCode) || !phoneCode.equals(code)) {
98
+            responseBean.addError("验证码错误!");
99
+            return responseBean;
100
+        }
101
+
102
+        /*******************  业务  ********************/
103
+
104
+        // 查询用户
105
+        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
106
+        queryWrapper.eq("login_name", phone);
107
+        User user = userMapper.selectOne(queryWrapper);
108
+        if (null == user) {
109
+            responseBean.addError("当前手机号不存在, 请联系运营人员!");
110
+            return responseBean;
111
+        }
112
+
113
+        // 查询这个用户是否有这个小区的管理
114
+        QueryWrapper<UserCommunity> userCommunityQueryWrapper = new QueryWrapper<>();
115
+        userCommunityQueryWrapper.eq("tp_user_id", user.getId());
116
+        userCommunityQueryWrapper.eq("community_id", communityId);
117
+        UserCommunity userCommunity = userCommunityMapper.selectOne(userCommunityQueryWrapper);
118
+        if (null == userCommunity) {
119
+            responseBean.addError("当前手机号未绑定该社区");
120
+            return responseBean;
121
+        }
122
+
123
+        // 查询该用户的权限
124
+        Map<String, Object> map = Maps.newHashMap();
125
+        map.put("userId", user.getId());
126
+        List<SysRole> sysRoleList = sysRoleMapper.selectByUserIdAndRoleId(map);
127
+
128
+        user.setRoles(sysRoleList);
129
+        responseBean.addSuccess(user);
130
+        return responseBean;
30 131
     }
31 132
 }

+ 1
- 0
CODE/smart-community/property-api/src/main/resources/application.yml 查看文件

@@ -7,3 +7,4 @@ management:
7 7
 mybatis-plus:
8 8
   configuration:
9 9
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql语句,调试用
10
+  mapper-locations: classpath:mapper/*.xml

+ 31
- 0
CODE/smart-community/property-api/src/main/resources/log4j.properties 查看文件

@@ -0,0 +1,31 @@
1
+log4j.rootLogger=info,A1,R
2
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
3
+log4j.appender.A1.Target=System.out
4
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
5
+log4j.appender.A1.layout.ConversionPattern=%-5p%x [%t] %d - %c %m%n  
6
+
7
+log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
8
+log4j.appender.R.File=../logs/resold_admin_.log
9
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
10
+log4j.appender.R.Append = true
11
+log4j.appender.R.ImmediateFlush = true
12
+log4j.appender.R.DatePattern = '.' yyyy - MM - dd '.txt'
13
+log4j.appender.R.layout.ConversionPattern=%-5p%x [%t] %d -%c %m%n
14
+
15
+#log4j.logger.com.ibatis=DEBUG
16
+log4j.logger.org.springframework.transaction.support.TransactionSynchronizationManager = INFO
17
+log4j.logger.java.sql.Connection=DEBUG
18
+log4j.logger.java.sql.Statement=DEBUG
19
+log4j.logger.java.sql.PreparedStatement=DEBUG
20
+
21
+###############Log4j 4 SQL Output start################# #DEBUG
22
+log4j.logger.com.**.dao=INFO
23
+log4j.logger.com.springframework=DEBUG
24
+log4j.logger.com.ibatis=DEBUG  
25
+log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG  
26
+log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG  
27
+log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
28
+log4j.logger.java.sql.ResultSet=DEBUG
29
+log4j.logger.org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl=DEBUG
30
+log4j.logger.java.sql=DEBUG,CONSOLE 
31
+###############Log4j 4 SQL Output end###################

+ 13
- 0
CODE/smart-community/property-api/src/main/resources/mapper/SysRoleMapper.xml 查看文件

@@ -0,0 +1,13 @@
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.community.huiju.dao.SysRoleMapper">
4
+
5
+    <select id="selectByUserIdAndRoleId" parameterType="map" resultType="com.community.huiju.model.SysRole">
6
+      SELECT tsr.* from
7
+      tp_sys_user_role tsur
8
+      LEFT JOIN tp_sys_role tsr
9
+      on tsur.role_id = tsr.id
10
+      WHERE tsur.user_id = #{userId}
11
+    </select>
12
+
13
+</mapper>

+ 301
- 0
CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml 查看文件

@@ -0,0 +1,301 @@
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.community.huiju.dao.TaUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="building_owner_info_id" property="buildingOwnerInfoId" jdbcType="INTEGER" />
8
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
9
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
11
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
12
+    <result column="email" property="email" jdbcType="VARCHAR" />
13
+    <result column="gender" property="gender" jdbcType="CHAR" />
14
+    <result column="status" property="status" jdbcType="CHAR" />
15
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
16
+    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
17
+    <result column="accept_agreement_status" property="acceptAgreementStatus" jdbcType="CHAR" />
18
+    <result column="verify_status" property="verifyStatus" jdbcType="CHAR" />
19
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
20
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
21
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
22
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23
+    <result column="hk_user_id" property="hkUserId" jdbcType="INTEGER" />
24
+    <result column="hk_card_no" property="hkCardNo" jdbcType="VARCHAR" />
25
+    <result column="face_status" property="faceStatus" jdbcType="CHAR" />
26
+  </resultMap>
27
+  <sql id="Base_Column_List" >
28
+    id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password,
29
+    email, gender, status, remark, parent_id, accept_agreement_status, verify_status,
30
+    create_user, create_date, update_user, update_date, hk_user_id, hk_card_no, face_status
31
+  </sql>
32
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
33
+    select
34
+    <include refid="Base_Column_List" />
35
+    from ta_user
36
+    where id = #{id,jdbcType=INTEGER}
37
+  </select>
38
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
39
+    delete from ta_user
40
+    where id = #{id,jdbcType=INTEGER}
41
+  </delete>
42
+  <insert id="insert" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
43
+    insert into ta_user (id, community_id, building_owner_info_id,
44
+      head_portrait, user_name, login_name,
45
+      login_password, email, gender,
46
+      status, remark, parent_id,
47
+      accept_agreement_status, verify_status, create_user,
48
+      create_date, update_user, update_date,
49
+      hk_user_id, hk_card_no, face_status
50
+      )
51
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{buildingOwnerInfoId,jdbcType=INTEGER},
52
+      #{headPortrait,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
53
+      #{loginPassword,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},
54
+      #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
55
+      #{acceptAgreementStatus,jdbcType=CHAR}, #{verifyStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER},
56
+      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},
57
+      #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
58
+      )
59
+  </insert>
60
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
61
+    insert into ta_user
62
+    <trim prefix="(" suffix=")" suffixOverrides="," >
63
+      <if test="id != null" >
64
+        id,
65
+      </if>
66
+      <if test="communityId != null" >
67
+        community_id,
68
+      </if>
69
+      <if test="buildingOwnerInfoId != null" >
70
+        building_owner_info_id,
71
+      </if>
72
+      <if test="headPortrait != null" >
73
+        head_portrait,
74
+      </if>
75
+      <if test="userName != null" >
76
+        user_name,
77
+      </if>
78
+      <if test="loginName != null" >
79
+        login_name,
80
+      </if>
81
+      <if test="loginPassword != null" >
82
+        login_password,
83
+      </if>
84
+      <if test="email != null" >
85
+        email,
86
+      </if>
87
+      <if test="gender != null" >
88
+        gender,
89
+      </if>
90
+      <if test="status != null" >
91
+        status,
92
+      </if>
93
+      <if test="remark != null" >
94
+        remark,
95
+      </if>
96
+      <if test="parentId != null" >
97
+        parent_id,
98
+      </if>
99
+      <if test="acceptAgreementStatus != null" >
100
+        accept_agreement_status,
101
+      </if>
102
+      <if test="verifyStatus != null" >
103
+        verify_status,
104
+      </if>
105
+      <if test="createUser != null" >
106
+        create_user,
107
+      </if>
108
+      <if test="createDate != null" >
109
+        create_date,
110
+      </if>
111
+      <if test="updateUser != null" >
112
+        update_user,
113
+      </if>
114
+      <if test="updateDate != null" >
115
+        update_date,
116
+      </if>
117
+      <if test="hkUserId != null" >
118
+        hk_user_id,
119
+      </if>
120
+      <if test="hkCardNo != null" >
121
+        hk_card_no,
122
+      </if>
123
+      <if test="faceStatus != null" >
124
+        face_status,
125
+      </if>
126
+    </trim>
127
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
128
+      <if test="id != null" >
129
+        #{id,jdbcType=INTEGER},
130
+      </if>
131
+      <if test="communityId != null" >
132
+        #{communityId,jdbcType=INTEGER},
133
+      </if>
134
+      <if test="buildingOwnerInfoId != null" >
135
+        #{buildingOwnerInfoId,jdbcType=INTEGER},
136
+      </if>
137
+      <if test="headPortrait != null" >
138
+        #{headPortrait,jdbcType=VARCHAR},
139
+      </if>
140
+      <if test="userName != null" >
141
+        #{userName,jdbcType=VARCHAR},
142
+      </if>
143
+      <if test="loginName != null" >
144
+        #{loginName,jdbcType=VARCHAR},
145
+      </if>
146
+      <if test="loginPassword != null" >
147
+        #{loginPassword,jdbcType=VARCHAR},
148
+      </if>
149
+      <if test="email != null" >
150
+        #{email,jdbcType=VARCHAR},
151
+      </if>
152
+      <if test="gender != null" >
153
+        #{gender,jdbcType=CHAR},
154
+      </if>
155
+      <if test="status != null" >
156
+        #{status,jdbcType=CHAR},
157
+      </if>
158
+      <if test="remark != null" >
159
+        #{remark,jdbcType=VARCHAR},
160
+      </if>
161
+      <if test="parentId != null" >
162
+        #{parentId,jdbcType=INTEGER},
163
+      </if>
164
+      <if test="acceptAgreementStatus != null" >
165
+        #{acceptAgreementStatus,jdbcType=CHAR},
166
+      </if>
167
+      <if test="verifyStatus != null" >
168
+        #{verifyStatus,jdbcType=CHAR},
169
+      </if>
170
+      <if test="createUser != null" >
171
+        #{createUser,jdbcType=INTEGER},
172
+      </if>
173
+      <if test="createDate != null" >
174
+        #{createDate,jdbcType=TIMESTAMP},
175
+      </if>
176
+      <if test="updateUser != null" >
177
+        #{updateUser,jdbcType=INTEGER},
178
+      </if>
179
+      <if test="updateDate != null" >
180
+        #{updateDate,jdbcType=TIMESTAMP},
181
+      </if>
182
+      <if test="hkUserId != null" >
183
+        #{hkUserId,jdbcType=INTEGER},
184
+      </if>
185
+      <if test="hkCardNo != null" >
186
+        #{hkCardNo,jdbcType=VARCHAR},
187
+      </if>
188
+      <if test="faceStatus != null" >
189
+        #{faceStatus,jdbcType=CHAR},
190
+      </if>
191
+    </trim>
192
+  </insert>
193
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUser" >
194
+    update ta_user
195
+    <set >
196
+      <if test="communityId != null" >
197
+        community_id = #{communityId,jdbcType=INTEGER},
198
+      </if>
199
+      <if test="buildingOwnerInfoId != null" >
200
+        building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
201
+      </if>
202
+      <if test="headPortrait != null" >
203
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
204
+      </if>
205
+      <if test="userName != null" >
206
+        user_name = #{userName,jdbcType=VARCHAR},
207
+      </if>
208
+      <if test="loginName != null" >
209
+        login_name = #{loginName,jdbcType=VARCHAR},
210
+      </if>
211
+      <if test="loginPassword != null" >
212
+        login_password = #{loginPassword,jdbcType=VARCHAR},
213
+      </if>
214
+      <if test="email != null" >
215
+        email = #{email,jdbcType=VARCHAR},
216
+      </if>
217
+      <if test="gender != null" >
218
+        gender = #{gender,jdbcType=CHAR},
219
+      </if>
220
+      <if test="status != null" >
221
+        status = #{status,jdbcType=CHAR},
222
+      </if>
223
+      <if test="remark != null" >
224
+        remark = #{remark,jdbcType=VARCHAR},
225
+      </if>
226
+      <if test="parentId != null" >
227
+        parent_id = #{parentId,jdbcType=INTEGER},
228
+      </if>
229
+      <if test="acceptAgreementStatus != null" >
230
+        accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
231
+      </if>
232
+      <if test="verifyStatus != null" >
233
+        verify_status = #{verifyStatus,jdbcType=CHAR},
234
+      </if>
235
+      <if test="createUser != null" >
236
+        create_user = #{createUser,jdbcType=INTEGER},
237
+      </if>
238
+      <if test="createDate != null" >
239
+        create_date = #{createDate,jdbcType=TIMESTAMP},
240
+      </if>
241
+      <if test="updateUser != null" >
242
+        update_user = #{updateUser,jdbcType=INTEGER},
243
+      </if>
244
+      <if test="updateDate != null" >
245
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
246
+      </if>
247
+      <if test="hkUserId != null" >
248
+        hk_user_id = #{hkUserId,jdbcType=INTEGER},
249
+      </if>
250
+      <if test="hkCardNo != null" >
251
+        hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
252
+      </if>
253
+      <if test="faceStatus != null" >
254
+        face_status = #{faceStatus,jdbcType=CHAR},
255
+      </if>
256
+    </set>
257
+    where id = #{id,jdbcType=INTEGER}
258
+  </update>
259
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaUser" >
260
+    update ta_user
261
+    set community_id = #{communityId,jdbcType=INTEGER},
262
+      building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
263
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
264
+      user_name = #{userName,jdbcType=VARCHAR},
265
+      login_name = #{loginName,jdbcType=VARCHAR},
266
+      login_password = #{loginPassword,jdbcType=VARCHAR},
267
+      email = #{email,jdbcType=VARCHAR},
268
+      gender = #{gender,jdbcType=CHAR},
269
+      status = #{status,jdbcType=CHAR},
270
+      remark = #{remark,jdbcType=VARCHAR},
271
+      parent_id = #{parentId,jdbcType=INTEGER},
272
+      accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
273
+      verify_status = #{verifyStatus,jdbcType=CHAR},
274
+      create_user = #{createUser,jdbcType=INTEGER},
275
+      create_date = #{createDate,jdbcType=TIMESTAMP},
276
+      update_user = #{updateUser,jdbcType=INTEGER},
277
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
278
+      hk_user_id = #{hkUserId,jdbcType=INTEGER},
279
+      hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
280
+      face_status = #{faceStatus,jdbcType=CHAR}
281
+    where id = #{id,jdbcType=INTEGER}
282
+  </update>
283
+  <select id="selectUserApprove" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TaUser">
284
+    SELECT
285
+    t.user_name,
286
+    t.login_name ,
287
+    t.gender ,
288
+    boi.id_card ,
289
+    boi.unit ,
290
+    boi. LEVEL,
291
+    room_no,
292
+    boi.create_date,
293
+    t.verify_status
294
+    FROM
295
+    ta_user t
296
+    LEFT JOIN tp_building_owner_info boi ON t.building_owner_info_id = boi.id
297
+    LEFT JOIN ta_sys_user_role sur ON t.id=sur.user_id
298
+    WHERE
299
+    andsur.role_id=1 and t.status=1 and t.verify_status=1
300
+  </select>
301
+</mapper>

+ 1
- 17
CODE/smart-community/property-api/src/main/resources/mapper/UserMapper.xml 查看文件

@@ -1,21 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.community.huiju.dao.UserMapper">
4
-    <select id="selectUserApprove" resultType="map" parameterType="map">
5
-    SELECT
6
-	t.user_name,
7
-	t.login_name ,
8
-	t.gender ,
9
-	boi.id_card ,
10
-	boi.unit ,
11
-	boi. LEVEL,
12
-	room_no,
13
-	boi.create_date,
14
-	t.verify_status
15
-    FROM
16
-        ta_user t
17
-    LEFT JOIN tp_building_owner_info boi ON t.building_owner_info_id = boi.id
18
-    LEFT JOIN ta_sys_user_role sur ON t.id=sur.user_id
19
-    WHERE sur.role_id=1  and t.status=1 and t.verify_status=1
20
-    </select>
4
+
21 5
 </mapper>

+ 16
- 0
CODE/smart-community/property-api/src/test/java/com/community/huiju/DemoApplicationTests.java 查看文件

@@ -1,7 +1,11 @@
1 1
 package com.community.huiju;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.community.huiju.dao.BuildingOwnerInfoMapper;
5
+import com.community.huiju.dao.SysRoleMapper;
4 6
 import com.community.huiju.model.BuildingOwnerInfo;
7
+import com.community.huiju.model.SysRole;
8
+import com.google.common.collect.Maps;
5 9
 import org.junit.Test;
6 10
 import org.junit.runner.RunWith;
7 11
 import org.springframework.beans.factory.annotation.Autowired;
@@ -9,6 +13,7 @@ import org.springframework.boot.test.context.SpringBootTest;
9 13
 import org.springframework.test.context.junit4.SpringRunner;
10 14
 
11 15
 import java.util.List;
16
+import java.util.Map;
12 17
 
13 18
 @RunWith(SpringRunner.class)
14 19
 @SpringBootTest
@@ -16,6 +21,8 @@ public class DemoApplicationTests {
16 21
 
17 22
 	@Autowired
18 23
 	private BuildingOwnerInfoMapper buildingOwnerInfoMapper;
24
+	@Autowired
25
+	private SysRoleMapper sysRoleMapper;
19 26
 
20 27
 	@Test
21 28
 	public void contextLoads() {
@@ -24,4 +31,13 @@ public class DemoApplicationTests {
24 31
 		System.out.println(list.size());
25 32
 	}
26 33
 
34
+	@Test
35
+	public void getSysRoleMapper(){
36
+		// 查询该用户的权限
37
+		Map<String, Object> map = Maps.newHashMap();
38
+		map.put("userId", 29);
39
+		List<SysRole> sysRoleList = sysRoleMapper.selectByUserIdAndRoleId(map);
40
+		System.out.println(JSONObject.toJSONString(sysRoleList));
41
+	}
42
+
27 43
 }