Bläddra i källkod

完成登录,注册

魏熙美 6 år sedan
förälder
incheckning
ac672c73fb
15 ändrade filer med 277 tillägg och 52 borttagningar
  1. 23
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/IBuildingOwnerInfoController.java
  2. 1
    12
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  3. 51
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserVerifyController.java
  4. 11
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysRoleMapper.java
  5. 1
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBuildingMapper.java
  6. 2
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java
  7. 25
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUserVerify.java
  8. 1
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfo.java
  9. 0
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java
  10. 32
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaUserVerifyServicel.java
  11. 15
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoImpl.java
  12. 0
    8
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  13. 108
    8
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserVerifyServicelmpl.java
  14. 1
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TaUserVerifyMapper.xml
  15. 6
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/mode/ResponseBean.java

+ 23
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/IBuildingOwnerInfoController.java Visa fil

@@ -54,4 +54,27 @@ public class IBuildingOwnerInfoController extends BaseController {
54 54
 
55 55
     }
56 56
 
57
+    @RequestMapping(value = "/building/has", method = RequestMethod.GET)
58
+    @ApiOperation(value = "根据 小区、期、楼栋、单元、楼层、户号", notes = "根据 小区、期、楼栋、单元、楼层、户号")
59
+    @ApiImplicitParams({
60
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "phase", value = "期"),
61
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "building", value = "楼栋"),
62
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "unit", value = "单元"),
63
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "level", value = "楼层"),
64
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "roomNo", value = "户号"),
65
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
66
+    })
67
+    public ResponseBean hasBuilding(@RequestParam(value = "phase", required = false) String phase,
68
+                                   @RequestParam(value = "building",required = false) String building,
69
+                                   @RequestParam(value = "unit", required = false) String unit,
70
+                                   @RequestParam(value = "level", required = false) String level,
71
+                                   @RequestParam(value = "roomNo", required = false) String roomNo,
72
+                                   HttpSession session){
73
+
74
+        ResponseBean responseBean = new ResponseBean();
75
+        UserElement userElement = getUserElement(session);
76
+        responseBean = iBuildingOwnerInfo.hasBuild(userElement, phase, building, unit, level, roomNo);
77
+        return responseBean;
78
+    }
79
+
57 80
 }

+ 1
- 12
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java Visa fil

@@ -43,9 +43,8 @@ public class UserController extends BaseController {
43 43
     @ApiImplicitParams({
44 44
             @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName(登陆名(手机号)) code(验证码)")
45 45
     })
46
-    @RequestMapping(value = "/user/login/{communityId}",method = RequestMethod.POST)
46
+    @RequestMapping(value = "/user/login",method = RequestMethod.POST)
47 47
     public ResponseBean login(@RequestBody String parameter,
48
-                              @PathVariable(value = "communityId") String communityId,
49 48
                               HttpSession session){
50 49
         JSONObject jsonObject = JSONObject.parseObject(parameter);
51 50
         ResponseBean responseBean = iTaUserService.login(jsonObject.getString("loginName"),jsonObject.getString("code"));
@@ -249,14 +248,4 @@ public class UserController extends BaseController {
249 248
         return responseBean;
250 249
     }
251 250
 
252
-    @ApiOperation(value = "查看当前用户所有关联房产",notes = "查看当前用户所有关联房产")
253
-    @ApiImplicitParams({
254
-            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
255
-    })
256
-    @RequestMapping(value ="/userhouse" ,method = RequestMethod.GET)
257
-    public ResponseBean userHouseList(HttpSession session){
258
-        UserElement userElement= getUserElement(session);
259
-        ResponseBean responseBean= iTaUserService.userHouseList(userElement);
260
-        return responseBean;
261
-    }
262 251
 }

+ 51
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserVerifyController.java Visa fil

@@ -9,10 +9,7 @@ import io.swagger.annotations.ApiImplicitParam;
9 9
 import io.swagger.annotations.ApiImplicitParams;
10 10
 import io.swagger.annotations.ApiOperation;
11 11
 import org.springframework.beans.factory.annotation.Autowired;
12
-import org.springframework.web.bind.annotation.PathVariable;
13
-import org.springframework.web.bind.annotation.RequestMapping;
14
-import org.springframework.web.bind.annotation.RequestMethod;
15
-import org.springframework.web.bind.annotation.RestController;
12
+import org.springframework.web.bind.annotation.*;
16 13
 
17 14
 import javax.servlet.http.HttpSession;
18 15
 
@@ -30,15 +27,63 @@ public class UserVerifyController extends BaseController {
30 27
     private TaUserVerifyServicel taUserVerifyServicel;
31 28
 
32 29
     @RequestMapping(value = "/user/verify/{userVerifyId}", method = RequestMethod.GET)
33
-    @ApiOperation(value = "获取当前 一个待审核或审核不通过房产")
30
+    @ApiOperation(value = "获取当前 一个待审核或审核不通过房产", notes = "获取当前 一个待审核或审核不通过房产")
34 31
     @ApiImplicitParams({
32
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id"),
35 33
             @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
36 34
     })
37 35
     public ResponseBean getUserVerify(HttpSession session, @PathVariable("userVerifyId") Integer userVerifyId) {
38 36
         UserElement userElement = getUserElement(session);
39
-        ResponseBean responseBean = taUserVerifyServicel.getList(userElement, userVerifyId);
37
+        ResponseBean responseBean = taUserVerifyServicel.getToAuditNotApproved(userElement, userVerifyId);
40 38
         return responseBean;
41 39
     }
42 40
 
41
+    @RequestMapping(value = "/user/verify/add", method = RequestMethod.POST)
42
+    @ApiOperation(value = "添加一个审核的房产", notes = "添加一个审核的房产")
43
+    @ApiImplicitParams({
44
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
45
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "roleName角色名称;phase期;building楼栋;unit单元;level楼层;roomNo户号")
46
+    })
47
+    public ResponseBean addUserVerify(@RequestBody String parameter, HttpSession session) {
48
+        ResponseBean responseBean = new ResponseBean();
49
+        UserElement userElement = getUserElement(session);
50
+        responseBean = taUserVerifyServicel.addUserVerify(userElement, parameter);
51
+        return responseBean;
52
+    }
53
+
54
+    @RequestMapping(value = "/user/verify/delete/{userVerifyId}", method = RequestMethod.DELETE)
55
+    @ApiOperation(value = "删除一个审核的房产", notes = "删除一个审核的房产")
56
+    @ApiImplicitParams({
57
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id"),
58
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
59
+    })
60
+    public ResponseBean deleteUserVerify(@PathVariable("userVerifyId") Integer userVerifyId, HttpSession session) {
61
+        ResponseBean responseBean = new ResponseBean();
62
+        UserElement userElement = getUserElement(session);
63
+        responseBean = taUserVerifyServicel.deleteUserVerify(userVerifyId);
64
+        return responseBean;
65
+    }
66
+
67
+    @RequestMapping(value = "/current_user/verify/delete/{userVerifyId}", method = RequestMethod.DELETE)
68
+    @ApiOperation(value = "删除当前用户 关联的房产", notes = "删除当前用户 关联的房产")
69
+    @ApiImplicitParams({
70
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "userVerifyId", value = "审核房产 id"),
71
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
72
+    })
73
+    public ResponseBean deleteCurrentUserVerify(@PathVariable("userVerifyId") Integer userVerifyId, HttpSession session) {
74
+        ResponseBean responseBean = new ResponseBean();
75
+        UserElement userElement = getUserElement(session);
76
+        responseBean = taUserVerifyServicel.deleteCurrentUserVserify(userElement, userVerifyId);
77
+        return responseBean;
78
+    }
79
+
80
+    @RequestMapping(value = "/user/verify/list", method = RequestMethod.GET)
81
+    @ApiOperation(value = "获取 当前用户关联的房产", notes = "获取 当前用户关联的房产")
82
+    public ResponseBean getByCurrentUser(HttpSession session) {
83
+        ResponseBean responseBean = new ResponseBean();
84
+        UserElement userElement = getUserElement(session);
85
+        responseBean = taUserVerifyServicel.getByCurrentUser(userElement);
86
+        return responseBean;
87
+    }
43 88
 
44 89
 }

+ 11
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysRoleMapper.java Visa fil

@@ -3,6 +3,8 @@ package com.community.huiju.dao;
3 3
 
4 4
 import com.community.huiju.model.TaSysRole;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.ResultMap;
7
+import org.apache.ibatis.annotations.Select;
6 8
 
7 9
 import java.util.List;
8 10
 
@@ -22,4 +24,13 @@ public interface TaSysRoleMapper {
22 24
 
23 25
     TaSysRole findRoleByUserId(Integer userId);
24 26
 
27
+    /**
28
+     * 根据 角色名称 查询
29
+     * @param roleName
30
+     * @return
31
+     */
32
+    @ResultMap("BaseResultMap")
33
+    @Select("select * from ta_sys_role where role_name=#{roleName}")
34
+    TaSysRole selectByRoleName(String roleName);
35
+
25 36
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBuildingMapper.java Visa fil

@@ -32,4 +32,5 @@ public interface TpBuildingMapper {
32 32
      */
33 33
     List<TpBuilding> selectByAddress(Integer communityId,String phase,String building, String unit,String level,String roomNo);
34 34
 
35
+
35 36
 }

+ 2
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java Visa fil

@@ -31,8 +31,6 @@ public interface TpBuildingOwnerInfoMapper {
31 31
     //根据手机号查询当前信息
32 32
     TpBuildingOwnerInfo selectOwnerTel(@Param("ownerTel")String ownerTel);
33 33
 
34
-    @Select("select * from tp_building_owner_info where owner_tel=#{ownerTel}")
35
-    List<TpBuildingOwnerInfo> sellectHouseList(@Param("ownerTel") String ownerTel);
36 34
 
37 35
     /**
38 36
      * 查询当前房产所在的小区
@@ -53,8 +51,9 @@ public interface TpBuildingOwnerInfoMapper {
53 51
     @ResultMap("BaseResultMap")
54 52
     @Select("select * from tp_building_owner_info where community_id=#{communityId}" +
55 53
             " and phase=#{phase} and building=#{building} and unit=#{unit}" +
56
-            " and level=#{level} and room_no=#{roomNo}")
54
+            " and level=#{level} and room_no=#{roomNo} and verify_status=1")
57 55
     TpBuildingOwnerInfo selectCommunityIdAndAddress(@Param("communityId") Integer communityId, @Param("phase") String phase,
58 56
                                                     @Param("building") String building, @Param("unit") String unit,
59 57
                                                     @Param("level") String level, @Param("roomNo") String roomNo);
58
+
60 59
 }

+ 25
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUserVerify.java Visa fil

@@ -42,6 +42,15 @@ public class TaUserVerify {
42 42
      */
43 43
     private String ownerName;
44 44
 
45
+    /**
46
+     * 小区名称
47
+     */
48
+    private String communityName;
49
+
50
+    /**
51
+     * 小区 省市区
52
+     */
53
+    private String communityAddress;
45 54
 
46 55
     public Integer getId() {
47 56
         return id;
@@ -154,4 +163,20 @@ public class TaUserVerify {
154 163
     public void setVerifyName(String verifyName) {
155 164
         this.verifyName = verifyName;
156 165
     }
166
+
167
+    public String getCommunityName() {
168
+        return communityName;
169
+    }
170
+
171
+    public void setCommunityName(String communityName) {
172
+        this.communityName = communityName;
173
+    }
174
+
175
+    public String getCommunityAddress() {
176
+        return communityAddress;
177
+    }
178
+
179
+    public void setCommunityAddress(String communityAddress) {
180
+        this.communityAddress = communityAddress;
181
+    }
157 182
 }

+ 1
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfo.java Visa fil

@@ -26,7 +26,6 @@ public interface IBuildingOwnerInfo {
26 26
 
27 27
     /**
28 28
      * 根据 小区/期/楼栋/单元/楼层/户号
29
-     * @param communityId
30 29
      * @param phase
31 30
      * @param building
32 31
      * @param unit
@@ -34,6 +33,6 @@ public interface IBuildingOwnerInfo {
34 33
      * @param roomNo
35 34
      * @return
36 35
      */
37
-    ResponseBean hasBuild(UserElement userElement,Integer communityId, String phase, String building, String unit, String level, String roomNo);
36
+    ResponseBean hasBuild(UserElement userElement,String phase, String building, String unit, String level, String roomNo);
38 37
 
39 38
 }

+ 0
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java Visa fil

@@ -129,10 +129,4 @@ public interface ITaUserService {
129 129
      */
130 130
     ResponseBean addWelcomeUser(UserElement userElement,TaUser user);
131 131
 
132
-    /**
133
-     * 查看当前用户所有关联房产
134
-     * @param userElement
135
-     * @return
136
-     */
137
-    ResponseBean userHouseList(UserElement userElement);
138 132
 }

+ 32
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaUserVerifyServicel.java Visa fil

@@ -10,11 +10,41 @@ import com.community.commom.session.UserElement;
10 10
 public interface TaUserVerifyServicel {
11 11
 
12 12
     /**
13
-     * 查询 app端用户审核表 的数据
13
+     * 获取当前 一个待审核或审核不通过房产 的数据
14 14
      * @param userElement
15 15
      * @param userVerifyId
16 16
      * @return
17 17
      */
18
-    ResponseBean getList(UserElement userElement, Integer userVerifyId);
18
+    ResponseBean getToAuditNotApproved(UserElement userElement, Integer userVerifyId);
19
+
20
+    /**
21
+     * 添加 一个审核房产
22
+     * @param userElement
23
+     * @param parameter
24
+     * @return
25
+     */
26
+    ResponseBean addUserVerify(UserElement userElement, String parameter);
27
+
28
+    /**
29
+     * 根据id 删除 审核表
30
+     * @param userVerifyId
31
+     * @return
32
+     */
33
+    ResponseBean deleteUserVerify(Integer userVerifyId);
34
+
35
+    /**
36
+     * 获取 当前用户绑定的房产列表
37
+     * @param userElement
38
+     * @return
39
+     */
40
+    ResponseBean getByCurrentUser(UserElement userElement);
41
+
42
+    /**
43
+     * 根据房产id  删除当前用户的房产
44
+     * @param userElement
45
+     * @param userVerifyId
46
+     * @return
47
+     */
48
+    ResponseBean deleteCurrentUserVserify(UserElement userElement, Integer userVerifyId);
19 49
 
20 50
 }

+ 15
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoImpl.java Visa fil

@@ -32,6 +32,9 @@ public class BuildingOwnerInfoImpl implements IBuildingOwnerInfo {
32 32
     @Autowired
33 33
     private TpBuildingMapper tpBuildingMapper;
34 34
 
35
+    @Autowired
36
+    private TpBuildingOwnerInfoMapper tpBuildingOwnerInfoMapper;
37
+
35 38
     @Autowired
36 39
     private TaUserVerifyMapper taUserVerifyMapper;
37 40
 
@@ -45,19 +48,27 @@ public class BuildingOwnerInfoImpl implements IBuildingOwnerInfo {
45 48
     }
46 49
 
47 50
     @Override
48
-    public ResponseBean hasBuild(UserElement userElement, Integer communityId, String phase, String building, String unit, String level, String roomNo) {
51
+    public ResponseBean hasBuild(UserElement userElement,  String phase, String building, String unit, String level, String roomNo) {
49 52
         ResponseBean responseBean = new ResponseBean();
50 53
         // 1.检验该用户关联有没有这个 户号
51
-        // 2.检验这个户号是否关联了 户主
52
-        TaUserVerify taUserVerify = taUserVerifyMapper.selectCommunityAndAddress(userElement.getId(),communityId, phase, building, unit, level, roomNo);
54
+        TaUserVerify taUserVerify = taUserVerifyMapper.selectCommunityAndAddress(userElement.getId(),userElement.getCommunityId(), phase, building, unit, level, roomNo);
53 55
         if (null != taUserVerify) {
54 56
             responseBean.addError("您已关联此房产,无法再次关联!");
55 57
             return responseBean;
56 58
         }
57 59
 
58
-        // TODO 查询出这个户号的业主
60
+        Map<String,Object> result = Maps.newHashMap();
59 61
 
62
+        // 2.检验这个户号是否关联了 户主
63
+        TpBuildingOwnerInfo tpBuildingOwnerInfo = tpBuildingOwnerInfoMapper.selectCommunityIdAndAddress(userElement.getCommunityId(), phase, building, unit, level, roomNo);
64
+        if (null != tpBuildingOwnerInfo) {
65
+            result.put("ownerName",tpBuildingOwnerInfo.getOwnerName());
66
+            result.put("roleName", "OWNER");
67
+            responseBean.addSuccess(result);
68
+            return responseBean;
69
+        }
60 70
 
71
+        responseBean.addError("该房产,暂无审核通过的业主!");
61 72
         return responseBean;
62 73
     }
63 74
 }

+ 0
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Visa fil

@@ -979,12 +979,4 @@ public class TaUserServiceImpl implements ITaUserService {
979 979
         return responseBean;
980 980
     }
981 981
 
982
-    @Override
983
-    public ResponseBean userHouseList(UserElement userElement) {
984
-        ResponseBean response= new ResponseBean();
985
-        /*根据手机号会查询所有小区的多套房产*/
986
-        List<TpBuildingOwnerInfo> tpBuildingOwnerInfo  = tpBuildingOwnerInfoMapper.sellectHouseList(userElement.getLoginName());
987
-        response.addSuccess(tpBuildingOwnerInfo);
988
-        return response;
989
-    }
990 982
 }

+ 108
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserVerifyServicelmpl.java Visa fil

@@ -1,20 +1,18 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSONObject;
4 5
 import com.community.commom.mode.ResponseBean;
5 6
 import com.community.commom.session.UserElement;
6
-import com.community.huiju.dao.TaSysRoleMapper;
7
-import com.community.huiju.dao.TaUserVerifyMapper;
8
-import com.community.huiju.dao.ToCommunitiesMapper;
9
-import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
10
-import com.community.huiju.model.TaSysRole;
11
-import com.community.huiju.model.TaUserVerify;
12
-import com.community.huiju.model.TpBuildingOwnerInfo;
7
+import com.community.huiju.dao.*;
8
+import com.community.huiju.model.*;
13 9
 import com.community.huiju.service.TaUserVerifyServicel;
10
+import com.community.huiju.vo.TaUserVO;
14 11
 import lombok.extern.slf4j.Slf4j;
15 12
 import org.springframework.beans.factory.annotation.Autowired;
16 13
 import org.springframework.stereotype.Service;
17 14
 
15
+import java.util.Date;
18 16
 import java.util.List;
19 17
 
20 18
 /**
@@ -38,8 +36,14 @@ public class TaUserVerifyServicelmpl implements TaUserVerifyServicel {
38 36
     @Autowired
39 37
     private TpBuildingOwnerInfoMapper tpBuildingOwnerInfoMapper;
40 38
 
39
+    @Autowired
40
+    private TaSysRoleMapper taSysRoleMapper;
41
+
42
+    @Autowired
43
+    private SysNationMapper sysNationMapper;
44
+
41 45
     @Override
42
-    public ResponseBean getList(UserElement userElement, Integer userVerifyId) {
46
+    public ResponseBean getToAuditNotApproved(UserElement userElement, Integer userVerifyId) {
43 47
         ResponseBean responseBean = new ResponseBean();
44 48
         TaUserVerify taUserVerify = taUserVerifyMapper.selectByPrimaryKey(userVerifyId);
45 49
         TaSysRole taSysRole = taSysRoleMapper.selectByPrimaryKey(taUserVerify.getRoleId());
@@ -53,4 +57,100 @@ public class TaUserVerifyServicelmpl implements TaUserVerifyServicel {
53 57
         responseBean.addSuccess(taUserVerify);
54 58
         return responseBean;
55 59
     }
60
+
61
+    @Override
62
+    public ResponseBean addUserVerify(UserElement userElement, String parameter) {
63
+        ResponseBean responseBean = new ResponseBean();
64
+
65
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
66
+        TaUserVerify taUserVerify = jsonObject.toJavaObject(TaUserVerify.class);
67
+
68
+        // 通过 角色名称 查询出角色的id
69
+        String roleName = jsonObject.getString("roleName");
70
+        TaSysRole sysRole = taSysRoleMapper.selectByRoleName(roleName);
71
+
72
+        taUserVerify.setRoleId(sysRole.getId());
73
+        taUserVerify.setCommunityId(userElement.getCommunityId());
74
+        taUserVerify.setUserId(userElement.getId());
75
+        taUserVerify.setVerifyStatus("0");
76
+        taUserVerify.setCreateDate(new Date());
77
+
78
+        int rows = taUserVerifyMapper.insertSelective(taUserVerify);
79
+        if (rows <= 0) {
80
+            responseBean.addError("操作失败!");
81
+            return responseBean;
82
+        }
83
+
84
+        responseBean.addSuccess(taUserVerify);
85
+        return responseBean;
86
+    }
87
+
88
+    @Override
89
+    public ResponseBean deleteUserVerify(Integer userVerifyId) {
90
+        ResponseBean responseBean = new ResponseBean();
91
+
92
+        TaUserVerify userVerify = taUserVerifyMapper.selectByPrimaryKey(userVerifyId);
93
+        if ("1".equals(userVerify.getVerifyStatus())) {
94
+            responseBean.addError("已审核通过的房产,无法删除!");
95
+            return responseBean;
96
+        }
97
+
98
+        taUserVerifyMapper.deleteByPrimaryKey(userVerifyId);
99
+        responseBean.addSuccess("操作成功!");
100
+        return responseBean;
101
+    }
102
+
103
+    @Override
104
+    public ResponseBean getByCurrentUser(UserElement userElement) {
105
+        ResponseBean responseBean = new ResponseBean();
106
+
107
+        List<TaUserVerify> userVerifyList = taUserVerifyMapper.selectByUserId(userElement.getId());
108
+        userVerifyList.forEach(e -> {
109
+            // 角色
110
+            TaSysRole taSysRole = taSysRoleMapper.selectByPrimaryKey(e.getRoleId());
111
+            e.setRoleName(taSysRole.getRoleName());
112
+            // 小区名称 、省市区
113
+            setUserVoProperties(e.getCommunityId(), e);
114
+        });
115
+
116
+        responseBean.addSuccess(userVerifyList);
117
+        return responseBean;
118
+    }
119
+
120
+    /**
121
+     * 设置 TaUserVO 的一些信息
122
+     *
123
+     *      小区,省市区
124
+     *
125
+     * @param communityId
126
+     * @param taUserVerify
127
+     */
128
+    private void setUserVoProperties(Integer communityId, TaUserVerify taUserVerify) {
129
+        // 获取小区
130
+        ToCommunities toCommunities = toCommunitiesMapper.selectByPrimaryKey(communityId);
131
+        // 省
132
+        SysNation province = sysNationMapper.selectByPrimaryKey(toCommunities.getProvinceId());
133
+        // 市
134
+        SysNation city = sysNationMapper.selectByPrimaryKey(toCommunities.getCityId());
135
+        // 区
136
+        SysNation district = sysNationMapper.selectByPrimaryKey(toCommunities.getDistrictId());
137
+
138
+        taUserVerify.setCommunityAddress(province.getProvince()+""+city.getCity()+""+district.getDistrict() + toCommunities.getCommunityName());
139
+        taUserVerify.setCommunityName(toCommunities.getCommunityName());
140
+    }
141
+
142
+    @Override
143
+    public ResponseBean deleteCurrentUserVserify(UserElement userElement, Integer userVerifyId) {
144
+        ResponseBean responseBean = new ResponseBean();
145
+
146
+        TaUserVerify userVerify = taUserVerifyMapper.selectByPrimaryKey(userVerifyId);
147
+        if (userElement.getUserVerifyId()  == userVerify.getId()) {
148
+            responseBean.addError("无法删除当前登录的房产!");
149
+            return responseBean;
150
+        }
151
+
152
+        taUserVerifyMapper.deleteByPrimaryKey(userVerifyId);
153
+        responseBean.addSuccess("操作成功!");
154
+        return responseBean;
155
+    }
56 156
 }

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaUserVerifyMapper.xml Visa fil

@@ -191,6 +191,6 @@
191 191
     and building = #{building,jdbcType=VARCHAR}
192 192
     and unit = #{unit,jdbcType=VARCHAR}
193 193
     and level = #{level,jdbcType=VARCHAR}
194
-    and roomNo = #{room_no,jdbcType=VARCHAR}
194
+    and room_no = #{roomNo,jdbcType=VARCHAR}
195 195
   </select>
196 196
 </mapper>

+ 6
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/mode/ResponseBean.java Visa fil

@@ -47,6 +47,12 @@ public class ResponseBean<T> implements Serializable {
47 47
         this.data = data;
48 48
     }
49 49
 
50
+    public void addSuccess(String code, String message, T data) {
51
+        this.code = code;
52
+        this.message = message;
53
+        this.data = data;
54
+    }
55
+
50 56
     public void addSuccess(T data) {
51 57
         this.code = "0";
52 58
         this.message = "成功";