dingxin hace 6 años
padre
commit
4a3585d0d8
Se han modificado 37 ficheros con 1323 adiciones y 128 borrados
  1. 15
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  2. 6
    0
      CODE/smart-community/property-api/pom.xml
  3. 23
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java
  4. 20
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/config/HttpSessionConfig.java
  5. 13
    3
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java
  6. 50
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/CommunitiesController.java
  7. 7
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserController.java
  8. 36
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java
  9. 13
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/ToCommunitiesMapper.java
  10. 4
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java
  11. 2
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/ToCommunities.java
  12. 9
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java
  13. 61
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java
  14. 17
    11
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserServiceImpl.java
  15. 3
    0
      CODE/smart-community/property-api/src/main/resources/application.yml
  16. 7
    0
      CODE/smart-community/property-api/src/main/resources/bootstrap.yml
  17. 318
    0
      CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml
  18. 19
    0
      CODE/smart-community/property-api/src/main/resources/mapper/ToCommunitiesMapper.xml
  19. 19
    1
      CODE/smart-community/property-api/src/main/resources/mapper/TpBuildingOwnerInfoMapper.xml
  20. 12
    0
      CODE/smart-community/property-api/src/test/java/com/community/huiju/DemoApplicationTests.java
  21. 15
    0
      VUECODE/smart-property-manage/src/api/batchImport.js
  22. 34
    0
      VUECODE/smart-property-manage/src/api/buildingOwnerInfo.js
  23. 12
    0
      VUECODE/smart-property-manage/src/api/community.js
  24. 3
    2
      VUECODE/smart-property-manage/src/api/login.js
  25. 30
    30
      VUECODE/smart-property-manage/src/permission.js
  26. 3
    1
      VUECODE/smart-property-manage/src/store/index.js
  27. 10
    2
      VUECODE/smart-property-manage/src/store/modules/batchImport.js
  28. 37
    0
      VUECODE/smart-property-manage/src/store/modules/buildingOwnerInfo.js
  29. 20
    1
      VUECODE/smart-property-manage/src/store/modules/community.js
  30. 4
    3
      VUECODE/smart-property-manage/src/store/modules/user.js
  31. 1
    0
      VUECODE/smart-property-manage/src/utils/request.js
  32. 6
    7
      VUECODE/smart-property-manage/src/views/banner/index.vue
  33. 90
    0
      VUECODE/smart-property-manage/src/views/building/add/index.vue
  34. 64
    35
      VUECODE/smart-property-manage/src/views/building/batch/batchImport.vue
  35. 90
    0
      VUECODE/smart-property-manage/src/views/building/edi/index.vue
  36. 148
    24
      VUECODE/smart-property-manage/src/views/building/index.vue
  37. 102
    1
      VUECODE/smart-property-manage/src/views/login/index.vue

+ 15
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Ver fichero

@@ -173,4 +173,19 @@ public class Constant {
173 173
      */
174 174
     public static final String SUFFIX_2003 = ".xls";
175 175
     public static final String SUFFIX_2007 = ".xlsx";
176
+    
177
+    /**
178
+     * 成功
179
+     */
180
+    public static final String RESPONSE_SUCCESS = "0";
181
+    
182
+    /**
183
+     * 未认证
184
+     */
185
+	public static final String UN_VERIFY_STATUS = "0";
186
+    
187
+    /**
188
+     * 已认证
189
+     */
190
+    public static final String VERIFY_STATUS = "1";
176 191
 }

+ 6
- 0
CODE/smart-community/property-api/pom.xml Ver fichero

@@ -78,6 +78,12 @@
78 78
 			<artifactId>spring-boot-starter-actuator</artifactId>
79 79
 		</dependency>
80 80
 
81
+		<dependency>
82
+			<groupId>org.springframework.session</groupId>
83
+			<artifactId>spring-session-jdbc</artifactId>
84
+			<version>2.0.5.RELEASE</version>
85
+		</dependency>
86
+
81 87
 		<dependency>
82 88
 			<groupId>com.baomidou</groupId>
83 89
 			<artifactId>mybatis-plus-boot-starter</artifactId>

+ 23
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/common/base/BaseController.java Ver fichero

@@ -3,6 +3,8 @@ package com.community.huiju.common.base;
3 3
 import com.community.commom.constant.Constant;
4 4
 import com.community.commom.session.UserElement;
5 5
 import com.community.huiju.exception.WisdomException;
6
+import com.community.huiju.vo.UserVO;
7
+import lombok.extern.slf4j.Slf4j;
6 8
 
7 9
 import javax.servlet.http.HttpSession;
8 10
 
@@ -10,6 +12,7 @@ import javax.servlet.http.HttpSession;
10 12
  * @author FXF
11 13
  * @date 2018-12-18
12 14
  */
15
+@Slf4j
13 16
 public class BaseController {
14 17
     
15 18
     /**
@@ -18,6 +21,7 @@ public class BaseController {
18 21
      * @return
19 22
      */
20 23
     protected UserElement getUserElement(HttpSession session){
24
+        log.info("获取sessionId: {}", session.getId());
21 25
         UserElement userElement = (UserElement) session.getAttribute(Constant.WEB_PROPERTY_USER_SESSION);
22 26
         if (null == userElement) {
23 27
             throw new WisdomException("用户凭证不存在!");
@@ -25,4 +29,23 @@ public class BaseController {
25 29
         return userElement;
26 30
     }
27 31
 
32
+    /**
33
+     * 获取 UserElement
34
+     * @param session
35
+     * @return
36
+     */
37
+    protected void setUserElement(HttpSession session, UserVO userVO){
38
+        log.info("获取sessionId: {}", session.getId());
39
+        UserElement userElement = new UserElement();
40
+        userElement.setId(userVO.getId());
41
+        userElement.setCommunityId(userVO.getCommunityId());
42
+        userElement.setEmail(userVO.getEmail());
43
+        userElement.setLoginName(userVO.getLoginName());
44
+        userElement.setUserName(userVO.getUserName());
45
+        userElement.setStatus(userVO.getStatus());
46
+        userElement.setLoginType(Constant.WEB_LOGIN_TYPE);
47
+
48
+        session.setAttribute(Constant.WEB_PROPERTY_USER_SESSION, userElement);
49
+    }
50
+
28 51
 }

+ 20
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/config/HttpSessionConfig.java Ver fichero

@@ -0,0 +1,20 @@
1
+package com.community.huiju.config;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import org.springframework.session.MapSession;
6
+import org.springframework.session.jdbc.config.annotation.web.http.EnableJdbcHttpSession;
7
+import org.springframework.session.web.http.HeaderHttpSessionIdResolver;
8
+import org.springframework.session.web.http.HttpSessionIdResolver;
9
+
10
+
11
+@Configuration
12
+@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS*48*7)
13
+public class HttpSessionConfig {
14
+
15
+    @Bean
16
+    public HttpSessionIdResolver httpSessionIdResolver() {
17
+        return HeaderHttpSessionIdResolver.xAuthToken();
18
+    }
19
+
20
+}

+ 13
- 3
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java Ver fichero

@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiImplicitParam;
11 11
 import io.swagger.annotations.ApiImplicitParams;
12 12
 import io.swagger.annotations.ApiOperation;
13 13
 import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14 15
 import org.springframework.web.bind.annotation.PostMapping;
15 16
 import org.springframework.web.bind.annotation.RequestBody;
16 17
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -32,6 +33,7 @@ import java.util.stream.Collectors;
32 33
  * @since 2018-12-18
33 34
  */
34 35
 @RestController
36
+@RefreshScope
35 37
 @RequestMapping("/")
36 38
 @Api(value = "楼栋业主资料信息", description = "楼栋业主资料信息 Api")
37 39
 public class BuildingOwnerInfoController extends BaseController {
@@ -113,9 +115,9 @@ public class BuildingOwnerInfoController extends BaseController {
113 115
     @ApiOperation(value = "查询 楼栋/单元/楼层/户号", notes = "查询 楼栋/单元/楼层/户号")
114 116
     @ApiImplicitParams({
115 117
             @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "building楼层;" +
116
-                    "unit单元;level楼层;roomNo户号")
118
+                    "unit单元;level楼层") // ;roomNo户号
117 119
     })
118
-    @RequestMapping(value = "/building/info",method = RequestMethod.POST)
120
+    @RequestMapping(value = "/building/address",method = RequestMethod.POST)
119 121
     public ResponseBean buildingUnitNumber(@RequestBody String parameter, HttpSession session){
120 122
         ResponseBean responseBean = new ResponseBean();
121 123
         UserElement userElement = getUserElement(session);
@@ -130,6 +132,15 @@ public class BuildingOwnerInfoController extends BaseController {
130 132
         responseBean = iBuildingOwnerInfoService.getExcelData(file);
131 133
         return responseBean;
132 134
     }
135
+ 
136
+    @ApiOperation(value = "上传楼栋信息并入库", notes = "上传楼栋信息并入库")
137
+    @PostMapping(value = "/building/submitExcel", consumes = "multipart/*", headers = "content-type=multipart/form-data")
138
+    public ResponseBean submitExcel(@RequestParam("file") MultipartFile file, HttpSession session) {
139
+        ResponseBean responseBean = new ResponseBean();
140
+        UserElement userElement = getUserElement(session);
141
+        responseBean = iBuildingOwnerInfoService.submitExcelData(file,userElement);
142
+        return responseBean;
143
+    }
133 144
 
134 145
     @ApiOperation(value = "获取已认证通过的用户信息",nickname ="获取已认证通过的用户信息")
135 146
     @ApiImplicitParams({
@@ -140,5 +151,4 @@ public class BuildingOwnerInfoController extends BaseController {
140 151
         ResponseBean allApprove=iBuildingOwnerInfoService.selectUserApprove(paramets);
141 152
         return allApprove;
142 153
     }
143
-
144 154
 }

+ 50
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/CommunitiesController.java Ver fichero

@@ -0,0 +1,50 @@
1
+package com.community.huiju.controller;
2
+
3
+
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.huiju.common.base.BaseController;
7
+import com.community.huiju.service.ICommunitiesService;
8
+import com.community.huiju.service.IUserService;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiImplicitParam;
11
+import io.swagger.annotations.ApiImplicitParams;
12
+import io.swagger.annotations.ApiOperation;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RequestMethod;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+/**
21
+ * <p>
22
+ * 所有小区表 前端控制器
23
+ * </p>
24
+ *
25
+ * @author weiximei
26
+ * @since 2018-12-19
27
+ */
28
+@RestController
29
+@RefreshScope
30
+@RequestMapping("/")
31
+@Api(value = "小区Api", description = "小区Api")
32
+public class CommunitiesController extends BaseController {
33
+
34
+    @Autowired
35
+    private IUserService iUserService;
36
+
37
+    @ApiOperation(value = "根据手机号 和 验证码 获取小区列表", notes = "根据手机号 和 验证码 获取小区列表")
38
+    @ApiImplicitParams({
39
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "loginName手机号;code验证码")
40
+    })
41
+    @RequestMapping(value = "/community/user", method = RequestMethod.POST)
42
+    public ResponseBean userCommunity(@RequestBody String parameter){
43
+        ResponseBean responseBean = new ResponseBean();
44
+
45
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
46
+        responseBean = iUserService.userCommunity(jsonObject.getString("loginName"), jsonObject.getString("code"));
47
+        return responseBean;
48
+    }
49
+
50
+}

+ 7
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserController.java Ver fichero

@@ -9,6 +9,7 @@ import com.community.huiju.common.base.BaseController;
9 9
 import com.community.huiju.model.TaUser;
10 10
 import com.community.huiju.model.User;
11 11
 import com.community.huiju.service.IUserService;
12
+import com.community.huiju.vo.UserVO;
12 13
 import io.swagger.annotations.Api;
13 14
 import io.swagger.annotations.ApiImplicitParam;
14 15
 import io.swagger.annotations.ApiImplicitParams;
@@ -55,12 +56,17 @@ public class UserController extends BaseController {
55 56
 			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "loginName手机号;code验证码;communityId小区Id")
56 57
 	})
57 58
 	@RequestMapping(value = "/user/login")
58
-	public ResponseBean login(@RequestBody String parameter){
59
+	public ResponseBean login(@RequestBody String parameter, HttpSession session){
59 60
 		ResponseBean responseBean = new ResponseBean();
60 61
 		JSONObject jsonObject = JSONObject.parseObject(parameter);
61 62
 		responseBean = userService.login(jsonObject.getString("loginName"),
62 63
 				jsonObject.getInteger("communityId"),
63 64
 				jsonObject.getString("code"));
65
+
66
+		UserVO userVO = (UserVO)responseBean.getData();
67
+		setUserElement(session,userVO);
68
+		userVO.setToken(session.getId());
69
+
64 70
 		return responseBean;
65 71
 	}
66 72
 

+ 36
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java Ver fichero

@@ -1,14 +1,48 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
6
+
5 7
 import com.community.huiju.model.TaUser;
6
-import com.community.huiju.tablemodel.TableTaUser;
7 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
9 10
 
10 11
 import java.util.List;
12
+import java.util.Map;
11 13
 
12 14
 @Mapper
15
+
13 16
 public interface TaUserMapper extends BaseMapper<TaUser> {
17
+    int deleteByPrimaryKey(Integer id);
18
+    
19
+    @Override
20
+    int insert(TaUser record);
21
+
22
+    int insertSelective(TaUser record);
23
+
24
+    TaUser selectByPrimaryKey(Integer id);
25
+
26
+    int updateByPrimaryKeySelective(TaUser record);
27
+
28
+    int updateByPrimaryKey(TaUser record);
29
+
30
+    /**
31
+     * 获取已认证通过的
32
+     * @param map
33
+     * @param page
34
+     * @return
35
+     */
36
+    List<Map<Object,Object>> selectUserApprove(Map<Object, Object> map, IPage page);
37
+    
38
+    /**
39
+     * 查看是否有未认证数据
40
+     * @param ownerTel
41
+     * @param communityId
42
+     * @return
43
+     */
44
+    TaUser selectByTel(@Param("loginName") String ownerTel,@Param("communityId") Integer communityId);
45
+    
46
+    int batchUpdate(List<TaUser> updataTaUserList);
47
+
14 48
 }

+ 13
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/ToCommunitiesMapper.java Ver fichero

@@ -2,6 +2,10 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.community.huiju.model.ToCommunities;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Select;
7
+
8
+import java.util.List;
5 9
 
6 10
 /**
7 11
  * <p>
@@ -11,6 +15,15 @@ import com.community.huiju.model.ToCommunities;
11 15
  * @author weiximei
12 16
  * @since 2018-12-19
13 17
  */
18
+@Mapper
14 19
 public interface ToCommunitiesMapper extends BaseMapper<ToCommunities> {
15 20
 
21
+    /**
22
+     * 根据 用户Id 查询出
23
+     * @param userId
24
+     * @return
25
+     */
26
+    @Select("SELECT tc.* FROM tp_user_community tuc LEFT JOIN to_communities tc on tuc.community_id = tc.id WHERE tuc.tp_user_id=#{userId}")
27
+    List<ToCommunities> selectUserById(Integer userId);
28
+
16 29
 }

+ 4
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java Ver fichero

@@ -3,7 +3,6 @@ package com.community.huiju.dao;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.community.huiju.model.TpBuildingOwnerInfo;
6
-import com.community.huiju.tablemodel.TableTaUser;
7 6
 import org.apache.ibatis.annotations.Mapper;
8 7
 import org.apache.ibatis.annotations.Param;
9 8
 
@@ -25,5 +24,8 @@ public interface TpBuildingOwnerInfoMapper extends BaseMapper<TpBuildingOwnerInf
25 24
      * @return
26 25
      */
27 26
     List<TpBuildingOwnerInfo> selectUserApprove(@Param("ownerName") String r , @Param("ownerTel") String ownerTel , Page page);
28
-
27
+    
28
+    int batchInsert(List<TpBuildingOwnerInfo> list);
29
+    
30
+    int batchUpdate(List<TpBuildingOwnerInfo> list);
29 31
 }

+ 2
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/ToCommunities.java Ver fichero

@@ -24,6 +24,8 @@ public class ToCommunities implements Serializable {
24 24
 
25 25
     private static final long serialVersionUID = 1L;
26 26
 
27
+    private Integer id;
28
+
27 29
     /**
28 30
      * 小区名称
29 31
      */

+ 9
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java Ver fichero

@@ -2,6 +2,7 @@ package com.community.huiju.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
5 6
 import com.community.huiju.model.TpBuildingOwnerInfo;
6 7
 import org.springframework.web.multipart.MultipartFile;
7 8
 
@@ -60,5 +61,12 @@ public interface IBuildingOwnerInfoService extends IService<TpBuildingOwnerInfo>
60 61
      * @return
61 62
      */
62 63
     ResponseBean getBuildingOrUnitOrNumber(String parameter, Integer communityId);
63
-
64
+    
65
+    /**
66
+     * 上传excel里面的内容
67
+     * @param file
68
+     * @param userElement
69
+     * @return
70
+     */
71
+    ResponseBean submitExcelData(MultipartFile file, UserElement userElement);
64 72
 }

+ 61
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Ver fichero

@@ -7,11 +7,17 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 8
 import com.community.commom.constant.Constant;
9 9
 import com.community.commom.mode.ResponseBean;
10
+import com.community.commom.session.UserElement;
10 11
 import com.community.commom.utils.AccountValidatorUtil;
11 12
 import com.community.commom.utils.BeanTools;
12
-import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
13
+
14
+import com.community.huiju.dao.TaUserMapper;
13 15
 import com.community.huiju.exception.WisdomException;
16
+import com.community.huiju.model.TaUser;
17
+
18
+import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
14 19
 import com.community.huiju.model.TpBuildingOwnerInfo;
20
+
15 21
 import com.community.huiju.service.IBuildingOwnerInfoService;
16 22
 import com.google.common.collect.Maps;
17 23
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -50,6 +56,9 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
50 56
     @Autowired
51 57
     private TpBuildingOwnerInfoMapper tpBuildingOwnerInfoMapper;
52 58
     
59
+    @Autowired
60
+    private TaUserMapper taUserMapper;
61
+    
53 62
     public static final Logger logger = LoggerFactory.getLogger(BuildingOwnerInfoServiceImpl.class);
54 63
     
55 64
     @Override
@@ -200,6 +209,57 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
200 209
         return responseBean;
201 210
     }
202 211
     
212
+    /**
213
+     * 上传excel里面的内容
214
+     *
215
+     * @param file
216
+     * @param userElement
217
+     * @return
218
+     */
219
+    @Override
220
+    public ResponseBean submitExcelData(MultipartFile file, UserElement userElement) {
221
+        ResponseBean responseBean = new ResponseBean();
222
+        responseBean = getExcelData(file);
223
+        if (!responseBean.getCode().equals(Constant.RESPONSE_SUCCESS)){
224
+            return responseBean;
225
+        }
226
+        //获取要上传的数据
227
+        Map<String,Object> map = (Map<String, Object>) responseBean.getData();
228
+        List<TpBuildingOwnerInfo> list = (List<TpBuildingOwnerInfo>) map.get("list");
229
+        list.stream().forEach(BuildingOwnerInfo -> {
230
+            BuildingOwnerInfo.setCommunityId(userElement.getCommunityId());
231
+            BuildingOwnerInfo.setVerifyStatus(Constant.UN_VERIFY_STATUS);
232
+            BuildingOwnerInfo.setCreateUser(userElement.getId());
233
+            BuildingOwnerInfo.setCreateDate(LocalDateTime.now());
234
+            BuildingOwnerInfo.setUpdateUser(userElement.getId());
235
+            BuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
236
+        });
237
+        //批量插入
238
+	    tpBuildingOwnerInfoMapper.batchInsert(list);
239
+        //判断是否认证过
240
+        List<TpBuildingOwnerInfo> updateList = new ArrayList<TpBuildingOwnerInfo>();
241
+        List<TaUser> updataTaUserList = new ArrayList<TaUser>();
242
+        list.stream().forEach(BuildingOwnerInfo -> {
243
+            TaUser taUser = taUserMapper.selectByTel(BuildingOwnerInfo.getOwnerTel(),BuildingOwnerInfo.getCommunityId());
244
+            if (null != taUser){
245
+                BuildingOwnerInfo.setVerifyStatus(Constant.VERIFY_STATUS);
246
+                updateList.add(BuildingOwnerInfo);
247
+                taUser.setVerifyStatus(Constant.VERIFY_STATUS);
248
+                taUser.setBuildingOwnerInfoId(BuildingOwnerInfo.getId());
249
+                updataTaUserList.add(taUser);
250
+            }
251
+        });
252
+        //批量更新
253
+        if (updateList.size() > 0){
254
+	        tpBuildingOwnerInfoMapper.batchUpdate(updateList);
255
+        }
256
+        if (updataTaUserList.size() > 0){
257
+            taUserMapper.batchUpdate(updataTaUserList);
258
+        }
259
+        responseBean.addSuccess("success");
260
+        return responseBean;
261
+    }
262
+    
203 263
     /**
204 264
      * 根据excel获取相关信息
205 265
      *

+ 17
- 11
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserServiceImpl.java Ver fichero

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.community.commom.mode.ResponseBean;
8
+import com.community.huiju.dao.*;
8 9
 import com.community.huiju.dao.TaUserMapper;
9 10
 import com.community.huiju.dao.UserMapper;
10 11
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -12,17 +13,11 @@ import com.community.commom.utils.AccountValidatorUtil;
12 13
 import com.community.huiju.common.code.cache.AppkeyCache;
13 14
 import com.community.huiju.model.*;
14 15
 import com.community.huiju.exception.WisdomException;
15
-import com.community.huiju.model.TaUser;
16
+import com.community.huiju.model.*;
16 17
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
17 18
 import com.community.commom.utils.AccountValidatorUtil;
18 19
 import com.community.huiju.common.code.cache.AppkeyCache;
19
-import com.community.huiju.dao.TpSysRoleMapper;
20
-import com.community.huiju.dao.TpUserCommunityMapper;
21
-import com.community.huiju.model.TpSysRole;
22
-import com.community.huiju.model.User;
23
-import com.community.huiju.model.TpUserCommunity;
24 20
 import com.community.huiju.service.IUserService;
25
-import com.community.huiju.tablemodel.TableTaUser;
26 21
 import com.community.huiju.vo.UserVO;
27 22
 import lombok.extern.slf4j.Slf4j;
28 23
 import com.google.common.collect.Maps;
@@ -57,6 +52,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
57 52
     @Autowired
58 53
     private TpSysRoleMapper tpSysRoleMapper;
59 54
 
55
+    @Autowired
56
+    private ToCommunitiesMapper toCommunitiesMapper;
57
+
60 58
     @Override
61 59
     public ResponseBean login(String phone, Integer communityId, String code) {
62 60
         ResponseBean responseBean = new ResponseBean();
@@ -64,8 +62,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
64 62
         // 校验
65 63
         checkPhoneAndCode(phone, code);
66 64
 
67
-        /*******************  业务  ********************/
68
-
69 65
         // 查询用户
70 66
         QueryWrapper<User> queryWrapper = new QueryWrapper<>();
71 67
         queryWrapper.eq("login_name", phone);
@@ -102,10 +98,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
102 98
         // 校验
103 99
         checkPhoneAndCode(phone, code);
104 100
 
101
+        // 获取这个用户所管理的小区
102
+        // 查询用户
103
+        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
104
+        queryWrapper.eq("login_name", phone);
105
+        User user = userMapper.selectOne(queryWrapper);
106
+        if (null == user) {
107
+            responseBean.addError("当前手机号不存在, 请联系运营人员!");
108
+            return responseBean;
109
+        }
105 110
 
111
+        List<ToCommunities> toCommunities = toCommunitiesMapper.selectUserById(user.getId());
112
+        responseBean.addSuccess(toCommunities);
106 113
 
107
-
108
-        return null;
114
+        return responseBean;
109 115
     }
110 116
 
111 117
     @Override

+ 3
- 0
CODE/smart-community/property-api/src/main/resources/application.yml Ver fichero

@@ -5,6 +5,9 @@ management:
5 5
         include: refresh,health,info
6 6
 ##mybatis-plus
7 7
 mybatis-plus:
8
+  global-config:
9
+    db-config:
10
+      id-type: auto
8 11
   configuration:
9 12
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql语句,调试用
10 13
   mapper-locations: classpath:mapper/*.xml

+ 7
- 0
CODE/smart-community/property-api/src/main/resources/bootstrap.yml Ver fichero

@@ -12,6 +12,13 @@ spring:
12 12
       discovery:
13 13
         enabled: true
14 14
         serviceId: config-server
15
+  session:
16
+    store-type: jdbc
17
+    servlet:
18
+      multipart:
19
+        max-file-size: 10MB
20
+        max-request-size: 100MB
21
+
15 22
 eureka:
16 23
   client:
17 24
     service-url:

+ 318
- 0
CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml Ver fichero

@@ -1,4 +1,322 @@
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.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
+
302
+  <select id="selectByTel" resultMap="BaseResultMap">
303
+    select
304
+    <include refid="Base_Column_List" />
305
+    from ta_user
306
+    where login_name = #{loginName,jdbcType=VARCHAR}
307
+    and community_id = #{communityId,jdbcType=INTEGER}
308
+    and verify_status = 0
309
+  </select>
310
+
311
+  <update id="batchUpdate" parameterType="java.util.ArrayList">
312
+    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
313
+      update ta_user
314
+      <set>
315
+        verify_status=${item.verifyStatus},
316
+        building_owner_info_id = #{item.buildingOwnerInfoId}
317
+      </set>
318
+      where id = ${item.id}
319
+    </foreach>
320
+  </update>
321
+
4 322
 </mapper>

+ 19
- 0
CODE/smart-community/property-api/src/main/resources/mapper/ToCommunitiesMapper.xml Ver fichero

@@ -2,4 +2,23 @@
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.ToCommunitiesMapper">
4 4
 
5
+    <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.ArrayList">
6
+        insert into tp_building_owner_info(community_id,id_card, building,unit, `level`,
7
+        room_no,owner_name,owner_tel,gender,pair_status,verify_status,create_user,create_date,update_user,update_date)
8
+        VALUES
9
+        <foreach collection="list" item="item" index="index" separator=",">
10
+            (#{item.communityId},#{item.idCard},#{item.building},#{item.unit}, #{item.level},#{item.roomNo},#{item.ownerName},
11
+            #{item.ownerTel},#{item.gender},#{item.pairStatus},#{item.verifyStatus},#{item.createUser},#{item.createDate},#{item.updateUser},#{item.updateDate})
12
+        </foreach>
13
+    </insert>
14
+
15
+    <update id="batchUpdate" parameterType="java.util.ArrayList">
16
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
17
+            update tp_building_owner_info
18
+            <set>
19
+                verify_status=${item.verifyStatus}
20
+            </set>
21
+            where id = ${item.id}
22
+        </foreach>
23
+    </update>
5 24
 </mapper>

+ 19
- 1
CODE/smart-community/property-api/src/main/resources/mapper/TpBuildingOwnerInfoMapper.xml Ver fichero

@@ -23,8 +23,26 @@
23 23
             </if>
24 24
             and tp_building_owner_info.pair_status=1
25 25
         </where>
26
+    </select>
26 27
 
28
+    <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.ArrayList">
29
+        insert into tp_building_owner_info(community_id,id_card, building,unit, `level`,
30
+        room_no,owner_name,owner_tel,gender,pair_status,verify_status,create_user,create_date,update_user,update_date)
31
+        VALUES
32
+        <foreach collection="list" item="item" index="index" separator=",">
33
+            (#{item.communityId},#{item.idCard},#{item.building},#{item.unit}, #{item.level},#{item.roomNo},#{item.ownerName},
34
+            #{item.ownerTel},#{item.gender},#{item.pairStatus},#{item.verifyStatus},#{item.createUser},#{item.createDate},#{item.updateUser},#{item.updateDate})
35
+        </foreach>
36
+    </insert>
27 37
 
28
-    </select>
38
+    <update id="batchUpdate" parameterType="java.util.ArrayList">
39
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
40
+            update tp_building_owner_info
41
+            <set>
42
+                verify_status=${item.verifyStatus}
43
+            </set>
44
+            where id = ${item.id}
45
+        </foreach>
46
+    </update>
29 47
 
30 48
 </mapper>

+ 12
- 0
CODE/smart-community/property-api/src/test/java/com/community/huiju/DemoApplicationTests.java Ver fichero

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.community.huiju.dao.ToCommunitiesMapper;
4 5
 import com.community.huiju.dao.TaUserMapper;
5 6
 import com.community.huiju.dao.TpBuildingOwnerInfoMapper;
6 7
 import com.community.huiju.dao.TpSysRoleMapper;
@@ -25,9 +26,13 @@ public class DemoApplicationTests {
25 26
 	@Autowired
26 27
 	private TpSysRoleMapper tpSysRoleMapper;
27 28
 
29
+	@Autowired
30
+	private ToCommunitiesMapper toCommunitiesMapper;
31
+
28 32
 	@Autowired
29 33
 	private TaUserMapper taUserMapper;
30 34
 
35
+
31 36
 	@Test
32 37
 	public void contextLoads() {
33 38
 
@@ -44,4 +49,11 @@ public class DemoApplicationTests {
44 49
 		System.out.println(JSONObject.toJSONString(tpSysRoleList));
45 50
 	}
46 51
 
52
+	@Test
53
+	public void getUserCommunity(){
54
+		// 查询该用户的权限
55
+		toCommunitiesMapper.selectUserById(29);
56
+	}
57
+
58
+
47 59
 }

+ 15
- 0
VUECODE/smart-property-manage/src/api/batchImport.js Ver fichero

@@ -14,3 +14,18 @@ export function uploadBuildingExcel(query) {
14 14
     })
15 15
   })
16 16
 }
17
+
18
+export function submitBuildingExcel(query) {
19
+  return new Promise((resolve, reject) => {
20
+    request({
21
+      url: '/building/submitExcel',
22
+      method: 'post',
23
+      data: query
24
+    }).then((res) => {
25
+      console.log('out')
26
+      resolve(res)
27
+    }).catch((err) => {
28
+      console.log(err)
29
+    })
30
+  })
31
+}

+ 34
- 0
VUECODE/smart-property-manage/src/api/buildingOwnerInfo.js Ver fichero

@@ -0,0 +1,34 @@
1
+import request from '@/utils/request'
2
+
3
+//  查询 楼栋/单元/楼层/户号
4
+export function buildingAddress(data) {
5
+  const config = {
6
+    url: '/building/address',
7
+    method: 'post',
8
+    data: {
9
+      building: data.building,
10
+      unit: data.unit,
11
+      level: data.level,
12
+      roomNo: data.roomNo
13
+    }
14
+  }
15
+  return request(config)
16
+}
17
+
18
+// 获取楼栋业主信息
19
+export function buildingList(data) {
20
+  return request({
21
+    url: '/building/list',
22
+    method: 'post',
23
+    data: {
24
+      building: data.building,
25
+      unit: data.unit,
26
+      level: data.level,
27
+      roomNo: data.roomNo,
28
+      ownerName: data.ownerName,
29
+      pageNum: data.pageNum,
30
+      pageSize: data.pageSize
31
+    }
32
+  })
33
+}
34
+

+ 12
- 0
VUECODE/smart-property-manage/src/api/community.js Ver fichero

@@ -46,3 +46,15 @@ export function fetchDistrictList(query) {
46 46
     params: { cityId: query }
47 47
   })
48 48
 }
49
+
50
+// 根据 手机号 和 验证码 查询用管理的小区
51
+export function userCommunity(data) {
52
+  return request({
53
+    url: '/community/user',
54
+    method: 'post',
55
+    data: {
56
+      'loginName': data.username,
57
+      'code': data.password
58
+    }
59
+  })
60
+}

+ 3
- 2
VUECODE/smart-property-manage/src/api/login.js Ver fichero

@@ -1,12 +1,13 @@
1 1
 import request from '@/utils/request'
2 2
 
3
-export function login(username, password) {
3
+export function login(username, password, communityId) {
4 4
   const config = {
5 5
     url: '/user/login',
6 6
     method: 'post',
7 7
     data: {
8 8
       'loginName': username,
9
-      'code': password
9
+      'code': password,
10
+      'communityId': communityId
10 11
     }
11 12
   }
12 13
 

+ 30
- 30
VUECODE/smart-property-manage/src/permission.js Ver fichero

@@ -9,36 +9,36 @@ const whiteList = ['/login'] // 不重定向白名单
9 9
 router.beforeEach((to, from, next) => {
10 10
   NProgress.start()
11 11
   console.log('路径: ', to.path)
12
-  // if (getToken()) {
13
-  //   if (to.path === '/login') {
14
-  //     next({ path: '/' })
15
-  //     NProgress.done() // if current page is dashboard will not trigger	afterEach hook, so manually handle it
16
-  //   } else {
17
-  //     if (store.getters.roles.length === 0) {
18
-  //       store.dispatch('GetInfo').then(res => { // 拉取用户信息
19
-  //         next()
20
-  //       }).catch((err) => {
21
-  //         store.dispatch('FedLogOut').then(() => {
22
-  //           Message.error(err || 'Verification failed, please login again')
23
-  //           next({ path: '/' })
24
-  //         })
25
-  //       })
26
-  //     } else {
27
-  //       next()
28
-  //     }
29
-  //   }
30
-  // } else {
31
-  //   // if (to.path === '/') {
32
-  //   //   next(`/login?redirect=${to.path}`)
33
-  //   //   NProgress.done()
34
-  //   // }
35
-  //   if (whiteList.indexOf(to.path) !== -1) {
36
-  //     next()
37
-  //   } else {
38
-  //     next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
39
-  //     NProgress.done()
40
-  //   }
41
-  // }
12
+  if (getToken()) {
13
+    if (to.path === '/login') {
14
+      next({ path: '/' })
15
+      NProgress.done() // if current page is dashboard will not trigger	afterEach hook, so manually handle it
16
+    } else {
17
+      if (store.getters.roles.length === 0) {
18
+        store.dispatch('GetInfo').then(res => { // 拉取用户信息
19
+          next()
20
+        }).catch((err) => {
21
+          store.dispatch('FedLogOut').then(() => {
22
+            Message.error(err || 'Verification failed, please login again')
23
+            next({ path: '/' })
24
+          })
25
+        })
26
+      } else {
27
+        next()
28
+      }
29
+    }
30
+  } else {
31
+    // if (to.path === '/') {
32
+    //   next(`/login?redirect=${to.path}`)
33
+    //   NProgress.done()
34
+    // }
35
+    if (whiteList.indexOf(to.path) !== -1) {
36
+      next()
37
+    } else {
38
+      next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
39
+      NProgress.done()
40
+    }
41
+  }
42 42
   next()
43 43
 })
44 44
 

+ 3
- 1
VUECODE/smart-property-manage/src/store/index.js Ver fichero

@@ -7,6 +7,7 @@ import community from './modules/community'
7 7
 import trunkIndex from './modules/trunkIndex'
8 8
 import batchImport from './modules/batchImport'
9 9
 import getters from './getters'
10
+import buildingOwnerInfo from './modules/buildingOwnerInfo'
10 11
 
11 12
 Vue.use(Vuex)
12 13
 
@@ -17,7 +18,8 @@ const store = new Vuex.Store({
17 18
     community,
18 19
     banner,
19 20
     trunkIndex,
20
-    batchImport
21
+    batchImport,
22
+    buildingOwnerInfo
21 23
   },
22 24
   getters
23 25
 })

+ 10
- 2
VUECODE/smart-property-manage/src/store/modules/batchImport.js Ver fichero

@@ -1,4 +1,4 @@
1
-import { uploadBuildingExcel } from '@/api/batchImport'
1
+import { uploadBuildingExcel, submitBuildingExcel } from '@/api/batchImport'
2 2
 
3 3
 const batchImport = {
4 4
   namespaced: true,
@@ -18,7 +18,6 @@ const batchImport = {
18 18
 
19 19
   actions: {
20 20
     UploadBuildingExcel({ commit }, file) {
21
-      console.log(file)
22 21
       return new Promise((resolve, reject) => {
23 22
         uploadBuildingExcel({ file: file.raw }).then(response => {
24 23
           if (response.code === '0') {
@@ -31,6 +30,15 @@ const batchImport = {
31 30
           reject(error)
32 31
         })
33 32
       })
33
+    },
34
+    SubmitBuildingExcel({ commit }, file) {
35
+      return new Promise((resolve, reject) => {
36
+        submitBuildingExcel({ file: file.raw }).then(response => {
37
+          resolve(response)
38
+        }).catch(error => {
39
+          reject(error)
40
+        })
41
+      })
34 42
     }
35 43
   }
36 44
 }

+ 37
- 0
VUECODE/smart-property-manage/src/store/modules/buildingOwnerInfo.js Ver fichero

@@ -0,0 +1,37 @@
1
+import { buildingAddress, buildingList } from '@/api/buildingOwnerInfo'
2
+
3
+const buildingOwnerInfo = {
4
+  state: {
5
+    list: ''
6
+  },
7
+  mutations: {
8
+    SET_LIST: (data) => {
9
+      this.state.list = data
10
+    }
11
+  },
12
+  actions: {
13
+    BuildingAddress({ commit }, data) { // 查询 楼栋/单元/楼层/户号
14
+      return new Promise((resolve, reject) => {
15
+        buildingAddress(data).then(response => {
16
+          // console.log('查询 楼栋/单元/楼层/户号: ', response)
17
+          resolve(response)
18
+        }).catch(error => {
19
+          reject(error)
20
+        })
21
+      })
22
+    },
23
+    BuildingInfoList({ commit }, data) { // 根据条件查询 楼栋信息库
24
+      return new Promise((resolve, reject) => {
25
+        buildingList(data).then(response => {
26
+          // const data = response.data
27
+          // commit('SET_LIST', data)
28
+          resolve(response)
29
+        }).catch(error => {
30
+          reject(error)
31
+        })
32
+      })
33
+    }
34
+  }
35
+}
36
+
37
+export default buildingOwnerInfo

+ 20
- 1
VUECODE/smart-property-manage/src/store/modules/community.js Ver fichero

@@ -1,4 +1,4 @@
1
-import { fetchList, createCommunity, updateCommunity, fetchProvinceList, fetchCityList, fetchDistrictList } from '@/api/community'
1
+import { fetchList, createCommunity, updateCommunity, fetchProvinceList, fetchCityList, fetchDistrictList, userCommunity } from '@/api/community'
2 2
 
3 3
 const community = {
4 4
   namespaced: true,
@@ -163,6 +163,25 @@ const community = {
163 163
           reject(error)
164 164
         })
165 165
       })
166
+    },
167
+
168
+    /**
169
+     * 根据 用户的 手机号 和 验证码 查询用户管理的小区
170
+     * @param commit
171
+     * @param data
172
+     * @returns {Promise<any>}
173
+     * @constructor
174
+     */
175
+    UserCommunity({ commit }, data) {
176
+      return new Promise((resolve, reject) => {
177
+        userCommunity(data).then(response => {
178
+          const data = response.data
179
+          commit('SET_LIST', data)
180
+          resolve()
181
+        }).catch(error => {
182
+          reject(error)
183
+        })
184
+      })
166 185
     }
167 186
 
168 187
   }

+ 4
- 3
VUECODE/smart-property-manage/src/store/modules/user.js Ver fichero

@@ -30,11 +30,12 @@ const user = {
30 30
 
31 31
   actions: {
32 32
     // 登录
33
-    Login({ commit }, userInfo) {
34
-      const username = userInfo.username.trim()
33
+    Login({ commit }, data) {
34
+      const username = data.username.trim()
35 35
       return new Promise((resolve, reject) => {
36
-        login(username, userInfo.password).then(response => {
36
+        login(username, data.password, data.communityId).then(response => {
37 37
           const data = response.data
38
+          console.log('登陆后的数据的Token', data.token)
38 39
           setToken(data.token)
39 40
           commit('SET_TOKEN', data.token)
40 41
           resolve(response)

+ 1
- 0
VUECODE/smart-property-manage/src/utils/request.js Ver fichero

@@ -14,6 +14,7 @@ service.interceptors.request.use(
14 14
   config => {
15 15
     if (store.getters.token) {
16 16
       config.headers['X-Auth-Token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
17
+      config.headers['Login-Type'] = 'web'
17 18
     }
18 19
     return config
19 20
   },

+ 6
- 7
VUECODE/smart-property-manage/src/views/banner/index.vue Ver fichero

@@ -32,8 +32,7 @@
32 32
       highlight-current-row
33 33
       style="width: 100%; margin-top: 20px;"
34 34
       @selection-change="handleSelectionChange">
35
-      <el-table-column label="选择" type="selection" sortable="custom" align="center" >
36
-      </el-table-column>
35
+      <el-table-column label="选择" type="selection" sortable="custom" align="center" />
37 36
       <el-table-column label="标题" align="center" min-width="250px">
38 37
         <template slot-scope="scope">
39 38
           <!-- <span class="link-type" @click="handleUpdate(scope.row)">{{ scope.row.title }}</span> -->
@@ -144,7 +143,7 @@ export default {
144 143
       },
145 144
       communityQuery: {
146 145
         pageNum: 1,
147
-        pageSize: 200,
146
+        pageSize: 200
148 147
       },
149 148
       importanceOptions: [1, 2, 3],
150 149
       calendarTypeOptions,
@@ -248,9 +247,9 @@ export default {
248 247
       var year = value.getFullYear()
249 248
       var month = value.getMonth() + 1
250 249
       var day = value.getDate()
251
-      var hour = value.getHours()
252
-      var minutes = value.getMinutes()
253
-      var seconds = value.getSeconds()
250
+      // var hour = value.getHours()
251
+      // var minutes = value.getMinutes()
252
+      // var seconds = value.getSeconds()
254 253
       // return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
255 254
       return year + '-' + month + '-' + day
256 255
     },
@@ -270,7 +269,7 @@ export default {
270 269
       this.FetchCommunityList(this.communityQuery).then(() => {
271 270
         this.listLoading = false
272 271
       }).catch(() => {
273
-        this.loading = false
272
+        this.listLoading = false
274 273
         console.log('get list error')
275 274
       })
276 275
     },

+ 90
- 0
VUECODE/smart-property-manage/src/views/building/add/index.vue Ver fichero

@@ -0,0 +1,90 @@
1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
4
+      <el-form-item label="栋" prop="name">
5
+        <el-input v-model="ruleForm.name"/>
6
+      </el-form-item>
7
+      <el-form-item label="单元" prop="region">
8
+        <el-input v-model="ruleForm.name"/>
9
+      </el-form-item>
10
+      <el-form-item label="楼层" required>
11
+        <el-input v-model="ruleForm.name"/>
12
+      </el-form-item>
13
+      <el-form-item label="户号" prop="delivery">
14
+        <el-switch v-model="ruleForm.delivery"/>
15
+      </el-form-item>
16
+      <el-form-item label="业主姓名" prop="type">
17
+        <el-input v-model="ruleForm.name"/>
18
+      </el-form-item>
19
+      <el-form-item label="业主手机号" prop="resource">
20
+        <el-input v-model="ruleForm.name"/>
21
+      </el-form-item>
22
+      <el-form-item>
23
+        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
24
+        <el-button @click="resetForm('ruleForm')">重置</el-button>
25
+      </el-form-item>
26
+    </el-form>
27
+  </div>
28
+</template>
29
+
30
+<script>
31
+export default {
32
+  data() {
33
+    return {
34
+      ruleForm: {
35
+        name: '',
36
+        region: '',
37
+        date1: '',
38
+        date2: '',
39
+        delivery: false,
40
+        type: [],
41
+        resource: '',
42
+        desc: ''
43
+      },
44
+      rules: {
45
+        name: [
46
+          { required: true, message: '请输入活动名称', trigger: 'blur' },
47
+          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
48
+        ],
49
+        region: [
50
+          { required: true, message: '请选择活动区域', trigger: 'change' }
51
+        ],
52
+        date1: [
53
+          { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
54
+        ],
55
+        date2: [
56
+          { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
57
+        ],
58
+        type: [
59
+          { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
60
+        ],
61
+        resource: [
62
+          { required: true, message: '请选择活动资源', trigger: 'change' }
63
+        ],
64
+        desc: [
65
+          { required: true, message: '请填写活动形式', trigger: 'blur' }
66
+        ]
67
+      }
68
+    }
69
+  },
70
+  methods: {
71
+    submitForm(formName) {
72
+      this.$refs[formName].validate((valid) => {
73
+        if (valid) {
74
+          alert('submit!')
75
+        } else {
76
+          console.log('error submit!!')
77
+          return false
78
+        }
79
+      })
80
+    },
81
+    resetForm(formName) {
82
+      this.$refs[formName].resetFields()
83
+    }
84
+  }
85
+}
86
+</script>
87
+
88
+<style scoped>
89
+
90
+</style>

+ 64
- 35
VUECODE/smart-property-manage/src/views/building/batch/batchImport.vue Ver fichero

@@ -3,14 +3,15 @@
3 3
   <div class="root">
4 4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
5 5
       <el-form-item>
6
-        <el-upload :on-preview="handlePreview" :on-change="handleChange" :before-upload="beforeUpload" :limit="1" :on-exceed="handleExceed" :file-list="fileList" class="upload-demo" action="" multiple>
6
+        <el-upload :on-preview="handlePreview" :on-change="handleChange" :before-upload="beforeUpload" :limit="1" :on-exceed="handleExceed" class="upload-demo" action="" multiple>
7 7
           <el-button style="margin-left: 10px;" size="large" type="primary">下载模板</el-button>
8 8
           <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
9 9
           <el-button style="margin-left: 10px;" size="large" type="success" @click="submitUpload">提交</el-button>
10
+          <el-button style="margin-left: 10px;" size="large" type="success" @click="dialogBuildingIndex">取消</el-button>
10 11
         </el-upload>
11 12
       </el-form-item>
12 13
     </el-form>
13
-    <el-table ref="multipleTable" :data="list" border tooltip-effect="dark" style="width: 100%; margin-top: 20px;" @selection-change="handleSelectionChange">
14
+    <el-table ref="multipleTable" :data="list" border tooltip-effect="dark" style="width: 100%; margin-top: 20px;">
14 15
       <el-table-column label="栋">
15 16
         <template slot-scope="scope">{{ scope.row.building }}</template>
16 17
       </el-table-column>
@@ -31,13 +32,13 @@
31 32
       </el-table-column>
32 33
     </el-table>
33 34
     <div class="block">
34
-      <el-pagination :current-page="listQuery.pageNum" :page-sizes="[5, 10, 20, 30]" :page-size="listQuery.pageSize" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange"/>
35
+      <el-pagination :current-page="listQuery.pageNum" :page-sizes="[5, 10, 20, 30]" :page-size="listQuery.pageSize" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
35 36
     </div>
36 37
   </div>
37 38
 </template>
38 39
 
39 40
 <script>
40
-import { mapState, mapActions } from 'vuex'
41
+import { mapState, mapActions } from "vuex";
41 42
 export default {
42 43
   data() {
43 44
     return {
@@ -46,73 +47,101 @@ export default {
46 47
         pageSize: 20
47 48
       },
48 49
       list: [],
50
+      files: null,
49 51
       currentPage4: 4
50
-    }
52
+    };
51 53
   },
52 54
   computed: {
53
-    ...mapState('batchImport', {
55
+    ...mapState("batchImport", {
54 56
       temlist: s => s.temlist,
55 57
       total: s => s.total
56 58
     })
57 59
   },
58 60
   created() {
59
-    console.log(mapActions)
61
+    console.log(mapActions);
60 62
   },
61 63
   methods: {
62
-    ...mapActions('batchImport', ['UploadBuildingExcel']),
64
+    ...mapActions("batchImport", [
65
+      "UploadBuildingExcel",
66
+      "SubmitBuildingExcel"
67
+    ]),
63 68
     handleSizeChange(val) {
64
-      this.listQuery.pageSize = val
65
-      this.getList()
66
-      console.log(`每页 ${val} 条`)
69
+      this.listQuery.pageSize = val;
70
+      this.getList();
71
+      console.log(`每页 ${val} 条`);
67 72
     },
68 73
     handleCurrentChange(val) {
69
-      this.listQuery.pageNum = val
70
-      this.getList()
71
-      console.log(`当前页: ${val}`)
74
+      this.listQuery.pageNum = val;
75
+      this.getList();
76
+      console.log(`当前页: ${val}`);
72 77
     },
73 78
     dialogBatchImport() {
74
-      this.$router.push({ name: 'batch-import' })
79
+      this.$router.push({ name: "batch-import" });
75 80
     },
76 81
     beforeUpload(file) {
77
-      this.files = file
78
-      const extension = file.name.split('.')[1] === 'xls'
79
-      const extension2 = file.name.split('.')[1] === 'xlsx'
82
+      const extension = file.name.split(".")[1] === "xls";
83
+      const extension2 = file.name.split(".")[1] === "xlsx";
80 84
       if (!extension && !extension2) {
81
-        this.$message.warning('上传文件只能是 xls、xlsx格式!')
82
-        return
85
+        this.$message.warning("上传文件只能是 xls、xlsx格式!");
86
+        return;
83 87
       }
84
-      return false // 返回false不会自动上传
88
+      this.files = file;
89
+      return false; // 返回false不会自动上传
85 90
     },
86 91
     handleChange(file) {
87
-      const fileName = file.name
88
-      if (fileName === '') {
89
-        this.$message.warning('请选择要上传的文件!')
90
-        return false
92
+      const fileName = file.name;
93
+      if (fileName === "") {
94
+        this.$message.warning("请选择要上传的文件!");
95
+        return false;
91 96
       }
92 97
       this.UploadBuildingExcel(file)
93 98
         .then(response => {
94
-          console.log('success')
95
-          if (response.code === '1') {
96
-            this.$message.warning(response.message)
99
+          if (response.code === "1") {
100
+            this.$message.warning(response.message);
97 101
           }
98
-          if (response.code === '0') {
99
-            this.$message.success('上传成功')
100
-            this.getList()
102
+          if (response.code === "0") {
103
+            this.$message.success("上传成功");
104
+            this.getList();
101 105
           }
102 106
         })
103 107
         .catch(() => {
104
-          console.log('upload error')
108
+          console.log("upload error");
109
+        });
110
+    },
111
+    submitUpload() {
112
+      if (this.files === null) {
113
+        this.$message.warning("没有需要提交的文件");
114
+        return false;
115
+      }
116
+      let file = {
117
+        raw: this.files
118
+      };
119
+      this.SubmitBuildingExcel(file)
120
+        .then(response => {
121
+          if (response.code === "1") {
122
+            this.$message.warning(response.message);
123
+          }
124
+          if (response.code === "0") {
125
+            this.$message.success("提交成功");
126
+            this.dialogBuildingIndex();
127
+          }
105 128
         })
129
+        .catch(() => {
130
+          console.log("upload error");
131
+        });
106 132
     },
107 133
     getList() {
108 134
       this.list = this.temlist.slice(
109 135
         (this.listQuery.pageNum - 1) * this.listQuery.pageSize,
110 136
         this.listQuery.pageNum * this.listQuery.pageSize
111
-      )
112
-      console.log(this.list)
137
+      );
138
+      console.log(this.list);
139
+    },
140
+    dialogBuildingIndex() {
141
+      this.$router.push({ name: "building-index" });
113 142
     }
114 143
   }
115
-}
144
+};
116 145
 </script>
117 146
 
118 147
 <style scoped>

+ 90
- 0
VUECODE/smart-property-manage/src/views/building/edi/index.vue Ver fichero

@@ -0,0 +1,90 @@
1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
4
+      <el-form-item label="栋" prop="name">
5
+        <el-input v-model="ruleForm.name"/>
6
+      </el-form-item>
7
+      <el-form-item label="单元" prop="region">
8
+        <el-input v-model="ruleForm.name"/>
9
+      </el-form-item>
10
+      <el-form-item label="楼层" required>
11
+        <el-input v-model="ruleForm.name"/>
12
+      </el-form-item>
13
+      <el-form-item label="户号" prop="delivery">
14
+        <el-switch v-model="ruleForm.delivery"/>
15
+      </el-form-item>
16
+      <el-form-item label="业主姓名" prop="type">
17
+        <el-input v-model="ruleForm.name"/>
18
+      </el-form-item>
19
+      <el-form-item label="业主手机号" prop="resource">
20
+        <el-input v-model="ruleForm.name"/>
21
+      </el-form-item>
22
+      <el-form-item>
23
+        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
24
+        <el-button @click="resetForm('ruleForm')">重置</el-button>
25
+      </el-form-item>
26
+    </el-form>
27
+  </div>
28
+</template>
29
+
30
+<script>
31
+export default {
32
+  data() {
33
+    return {
34
+      ruleForm: {
35
+        name: '',
36
+        region: '',
37
+        date1: '',
38
+        date2: '',
39
+        delivery: false,
40
+        type: [],
41
+        resource: '',
42
+        desc: ''
43
+      },
44
+      rules: {
45
+        name: [
46
+          { required: true, message: '请输入活动名称', trigger: 'blur' },
47
+          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
48
+        ],
49
+        region: [
50
+          { required: true, message: '请选择活动区域', trigger: 'change' }
51
+        ],
52
+        date1: [
53
+          { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
54
+        ],
55
+        date2: [
56
+          { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
57
+        ],
58
+        type: [
59
+          { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
60
+        ],
61
+        resource: [
62
+          { required: true, message: '请选择活动资源', trigger: 'change' }
63
+        ],
64
+        desc: [
65
+          { required: true, message: '请填写活动形式', trigger: 'blur' }
66
+        ]
67
+      }
68
+    }
69
+  },
70
+  methods: {
71
+    submitForm(formName) {
72
+      this.$refs[formName].validate((valid) => {
73
+        if (valid) {
74
+          alert('submit!')
75
+        } else {
76
+          console.log('error submit!!')
77
+          return false
78
+        }
79
+      })
80
+    },
81
+    resetForm(formName) {
82
+      this.$refs[formName].resetFields()
83
+    }
84
+  }
85
+}
86
+</script>
87
+
88
+<style scoped>
89
+
90
+</style>

+ 148
- 24
VUECODE/smart-property-manage/src/views/building/index.vue Ver fichero

@@ -3,17 +3,37 @@
3 3
   <div class="root">
4 4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
5 5
       <el-form-item label="楼盘库">
6
-        <el-select placeholder="栋">
6
+        <el-select v-model="listQuery.building" placeholder="栋" @change="buildSelectChange(1)">
7 7
           <el-option label="选择楼栋" value="-1" />
8
+          <el-option
9
+            v-for="item in buildingList"
10
+            :key="item.id"
11
+            :label="item.building"
12
+            :value="item.building"/>
8 13
         </el-select>
9
-        <el-select placeholder="单元">
14
+        <el-select v-model="listQuery.unit" placeholder="单元" @change="buildSelectChange(2)">
10 15
           <el-option label="选择单元" value="-1" />
16
+          <el-option
17
+            v-for="item in unitList"
18
+            :key="item.id"
19
+            :label="item.unit"
20
+            :value="item.unit"/>
11 21
         </el-select>
12
-        <el-select placeholder="楼层">
22
+        <el-select v-model="listQuery.level" placeholder="楼层" @change="buildSelectChange(3)">
13 23
           <el-option label="选择楼层" value="-1" />
24
+          <el-option
25
+            v-for="item in levelList"
26
+            :key="item.id"
27
+            :label="item.level"
28
+            :value="item.level"/>
14 29
         </el-select>
15
-        <el-select placeholder="户号">
30
+        <el-select v-model="listQuery.roomNo" placeholder="户号">
16 31
           <el-option label="选择户号" value="-1" />
32
+          <el-option
33
+            v-for="item in roomNoList"
34
+            :key="item.id"
35
+            :label="item.roomNo"
36
+            :value="item.roomNo"/>
17 37
         </el-select>
18 38
         <el-form-item label="业主名称">
19 39
           <el-input placeholder="业主名称" />
@@ -21,7 +41,7 @@
21 41
       </el-form-item>
22 42
       <el-form-item>
23 43
         <el-button type="info">清空</el-button>
24
-        <el-button type="primary">查询</el-button>
44
+        <el-button type="primary" @click="dataQuery">查询</el-button>
25 45
       </el-form-item>
26 46
     </el-form>
27 47
     <div class="operation">
@@ -35,24 +55,30 @@
35 55
       </div>
36 56
     </div>
37 57
     <el-table
58
+      v-loading="listLoading"
38 59
       ref="multipleTable"
39
-      :data="tableData3"
60
+      :data="buildingInfoLists"
40 61
       border
41 62
       tooltip-effect="dark"
42 63
       style="width: 100%; margin-top: 20px;"
43 64
       @selection-change="handleSelectionChange">
44 65
       <el-table-column type="selection" width="55"/>
45
-      <el-table-column label="日期" width="120">
46
-        <template slot-scope="scope">{{ scope.row.date }}</template>
66
+      <el-table-column prop="building" label="栋" />
67
+      <el-table-column prop="unit" label="单元" />
68
+      <el-table-column prop="level" label="楼层" />
69
+      <el-table-column prop="roomNo" label="户号" />
70
+      <el-table-column prop="ownerName" label="业主姓名"/>
71
+      <el-table-column prop="ownerTel" label="手机号码" />
72
+      <el-table-column prop="pairStatus" label="关联业主状态" >
73
+        <template slot-scope="scope">{{ scope.row.pairStatus === 1 ? '已关联':'未管理' }}</template>
47 74
       </el-table-column>
48
-      <el-table-column prop="name" label="姓名" width="120" />
49
-      <el-table-column prop="address" label="地址" show-overflow-tooltip />
75
+      <el-table-column prop="createDate" label="创建时间" />
50 76
     </el-table>
51 77
     <div class="block">
52 78
       <el-pagination
53
-        :current-page="currentPage4"
54
-        :page-sizes="[100, 200, 300, 400]"
55
-        :page-size="100"
79
+        :current-page="listQuery.pageNum"
80
+        :page-sizes="[10, 20, 50, 100]"
81
+        :page-size="listQuery.pageSize"
56 82
         :total="400"
57 83
         layout="total, sizes, prev, pager, next, jumper"
58 84
         @size-change="handleSizeChange"
@@ -62,23 +88,54 @@
62 88
 </template>
63 89
 
64 90
 <script>
91
+import { mapActions, mapState } from 'vuex'
92
+
65 93
 export default {
66 94
   data() {
67 95
     return {
68
-      listQuery: {},
69
-      tableData3: [{
70
-        date: '2016-05-03',
71
-        name: '王小虎',
72
-        address: '上海市普陀区金沙江路 1518 弄'
73
-      }, {
74
-        date: '2016-05-02',
75
-        name: '王小虎',
76
-        address: '上海市普陀区金沙江路 1518 弄'
77
-      }],
78
-      currentPage4: 4
96
+      listQuery: {
97
+        building: '',
98
+        unit: '',
99
+        level: '',
100
+        roomNo: '',
101
+        ownerName: '',
102
+        pageNum: 1,
103
+        pageSize: 10
104
+      },
105
+      total: '', // 数据总数
106
+      buildingInfoLists: [],
107
+      buildingList: [],
108
+      unitList: [],
109
+      levelList: [],
110
+      roomNoList: [],
111
+      listLoading: true // 加载圈
112
+    }
113
+  },
114
+  computed: {
115
+    ...mapState('buildingOwnerInfo', {
116
+      buildingInfoList: s => s.list
117
+    })
118
+  },
119
+  watch: {
120
+    $route: {
121
+      handler: function(route) {
122
+        this.redirect = route.query && route.query.redirect
123
+      },
124
+      immediate: true
79 125
     }
80 126
   },
127
+  mounted() {
128
+    console.log('获取楼栋')
129
+    // 获取栋
130
+    this.getBuild()
131
+    // 获取数据
132
+    this.dataQuery()
133
+  },
81 134
   methods: {
135
+    ...mapActions('buildingOwnerInfo', [
136
+      'BuildingAddress',
137
+      'BuildingInfoList'
138
+    ]),
82 139
     handleSizeChange(val) {
83 140
       console.log(`每页 ${val} 条`)
84 141
     },
@@ -87,6 +144,73 @@ export default {
87 144
     },
88 145
     dialogBatchImport() {
89 146
       this.$router.push({ name: 'batch-import' })
147
+    },
148
+    handleSelectionChange(data) {
149
+
150
+    },
151
+    getBuild() { // 获取楼栋
152
+      this.listQuery.building = ''
153
+      this.$store.dispatch('BuildingAddress', this.listQuery).then((res) => {
154
+        this.buildingList = res.data
155
+        // console.log(res)
156
+      }).catch(() => {
157
+        console.log('error BuildingAddress')
158
+      })
159
+    },
160
+    getUnit() { // 获取单元
161
+      this.listQuery.unit = ''
162
+      this.$store.dispatch('BuildingAddress', this.listQuery).then((res) => {
163
+        this.unitList = res.data
164
+        console.log(res)
165
+      }).catch(() => {
166
+        console.log('error BuildingAddress')
167
+      })
168
+    },
169
+    getLevel() { // 获取楼层
170
+      this.listQuery.level = ''
171
+      this.$store.dispatch('BuildingAddress', this.listQuery).then((res) => {
172
+        this.levelList = res.data
173
+        console.log(res)
174
+      }).catch(() => {
175
+        console.log('error BuildingAddress')
176
+      })
177
+    },
178
+    getRoomNo() { // 获取户号
179
+      this.listQuery.roomNo = ''
180
+      this.$store.dispatch('BuildingAddress', this.listQuery).then((res) => {
181
+        this.roomNoList = res.data
182
+        console.log(res)
183
+      }).catch(() => {
184
+        console.log('error BuildingAddress')
185
+      })
186
+    },
187
+    buildSelectChange(value) { // select 的 change
188
+      switch (value) {
189
+        case 1: // 查询 单元
190
+          this.getUnit()
191
+          break
192
+        case 2: // 查询 楼层
193
+          this.getLevel()
194
+          break
195
+        case 3: // 查询 户号
196
+          this.getRoomNo()
197
+          break
198
+      }
199
+    },
200
+    dataQuery() { // 查询数据
201
+      this.listLoading = true
202
+      // this.BuildingInfoList(this.listQuery).then((res) => {
203
+      //   this.listLoading = false
204
+      // }).catch(() => {
205
+      //   console.log('get UserCommunity list error')
206
+      // })
207
+      this.$store.dispatch('BuildingInfoList', this.listQuery).then((res) => {
208
+        this.$data.buildingInfoLists = res.data
209
+        this.listLoading = false
210
+      }).catch(() => {
211
+        this.listLoading = false
212
+        console.log('error BuildingInfoList')
213
+      })
90 214
     }
91 215
   }
92 216
 }

+ 102
- 1
VUECODE/smart-property-manage/src/views/login/index.vue Ver fichero

@@ -36,17 +36,36 @@
36 36
               auto-complete="on"
37 37
               placeholder="请输入验证码"
38 38
               @keyup.enter.native="handleLogin"
39
+              @blur.prevent="getUserCommunity"
39 40
             />
40 41
           </el-form-item>
41 42
           <el-button v-if="isCodeNum == false" type="primary" @click="sendCode();">发送验证码</el-button>
42 43
           <el-button v-else type="primary" disabled>{{ codeNum + '秒后重新获取' }}</el-button>
43 44
         </div>
45
+        <div v-show="isCommunityDiv" :class="{selectDiv: isSelectDiv, widSelectDiv: isWidSelectDiv}">
46
+          <el-form-item>
47
+            <div v-if="isSelectCommunity" class="select-community">
48
+              <i class="el-icon-circle-close-outline" style="margin-left: 60px;"/>  当前手机号未绑定任何社区
49
+            </div>
50
+            <div v-else class="select-community" >
51
+              <el-select v-model="loginForm.communityId" placeholder="请选择小区">
52
+                <el-option
53
+                  v-for="item in communityList"
54
+                  :key="item.id"
55
+                  :label="item.communityName"
56
+                  :value="item.id"/>
57
+              </el-select>
58
+            </div>
59
+          </el-form-item>
60
+        </div>
44 61
         <el-button
62
+          v-if="isLoginButton"
45 63
           :loading="loading"
46 64
           type="primary"
47 65
           style="width:100%;"
48 66
           @click.native.prevent="handleLogin"
49 67
         >登录</el-button>
68
+        <el-button v-else type="primary" style="width:100%;" disabled>登录</el-button>
50 69
       </el-form>
51 70
     </div>
52 71
     <span class="bottom-desc">Copyright © 南京荟房网络科技有限公司, All Rights Reserved.</span>
@@ -55,6 +74,7 @@
55 74
 
56 75
 <script>
57 76
 import { isvalidUsername, validatCode } from '@/utils/validate'
77
+import { mapState, mapActions } from 'vuex'
58 78
 
59 79
 export default {
60 80
   name: 'Login',
@@ -74,9 +94,15 @@ export default {
74 94
       }
75 95
     }
76 96
     return {
97
+      isCommunityDiv: false, // 是否显示带有 社区选项的div
98
+      isWidSelectDiv: true,
99
+      isSelectDiv: false,
100
+      isSelectCommunity: false, // 是否显示 社区选项
101
+      isLoginButton: false, // 默认按钮为不可点击
77 102
       loginForm: {
78 103
         username: '',
79
-        password: ''
104
+        password: '',
105
+        communityId: ''
80 106
       },
81 107
       loginRules: {
82 108
         username: [{ required: true, trigger: 'blur', validator: validateUsername }],
@@ -88,6 +114,11 @@ export default {
88 114
       codeNum: 60 // 验证码倒计时 60 秒
89 115
     }
90 116
   },
117
+  computed: {
118
+    ...mapState('community', {
119
+      communityList: s => s.list
120
+    })
121
+  },
91 122
   watch: {
92 123
     $route: {
93 124
       handler: function(route) {
@@ -97,6 +128,9 @@ export default {
97 128
     }
98 129
   },
99 130
   methods: {
131
+    ...mapActions('community', [
132
+      'UserCommunity'
133
+    ]),
100 134
     handleLogin() {
101 135
       this.$refs.loginForm.validate(valid => {
102 136
         if (valid) {
@@ -141,6 +175,62 @@ export default {
141 175
       }).catch(() => {
142 176
         console.log('error sendcode')
143 177
       })
178
+    },
179
+    getUserCommunity() { // 根据用户的手机号和验证码 获取用户的管理的小区
180
+      const loading = this.$loading({
181
+        lock: true,
182
+        text: '请稍后...',
183
+        spinner: 'el-icon-loading',
184
+        background: 'rgba(0, 0, 0, 0.7)'
185
+      })
186
+      this.UserCommunity(this.loginForm).then(() => {
187
+        loading.close()
188
+        this.checkPhoneAndCode()
189
+      }).catch(() => {
190
+        // 提示 当前手机号未绑定任何社区
191
+        // 显示 div
192
+        this.isCommunityDiv = true
193
+        this.isSelectCommunity = true
194
+        this.isWidSelectDiv = false
195
+        this.isSelectDiv = true
196
+        this.isLoginButton = false
197
+        loading.close()
198
+        console.log('get UserCommunity list error')
199
+      })
200
+    },
201
+    checkPhoneAndCode() { // 失去焦点的时候获取 获取用户的管理的小区
202
+      console.log('失去焦点')
203
+      const communitys = this.communityList
204
+      console.log('接收到的数据:', communitys)
205
+      console.log('大小:', communitys.length)
206
+      if (communitys.length === 0) {
207
+        // 提示 当前手机号未绑定任何社区
208
+        // 显示 div
209
+        this.isCommunityDiv = true
210
+        this.isSelectCommunity = true
211
+        this.isWidSelectDiv = false
212
+        this.isSelectDiv = true
213
+        this.isLoginButton = false
214
+      } else if (communitys.length === 1) {
215
+        // 只有一个小区的时候, 默认选中
216
+        // 显示 div
217
+        this.isCommunityDiv = true
218
+        this.isWidSelectDiv = true
219
+        this.isSelectCommunity = false
220
+        this.isWidSelectDiv = true
221
+        this.isSelectDiv = false
222
+        this.isLoginButton = true
223
+        this.loginForm.communityId = communitys[0].id
224
+      } else {
225
+        // 让用户选择
226
+        // 显示 div
227
+        this.isCommunityDiv = true
228
+        this.isWidSelectDiv = true
229
+        this.isSelectCommunity = false
230
+        this.isWidSelectDiv = true
231
+        this.isSelectDiv = false
232
+        this.isLoginButton = true
233
+      }
144 234
     }
145 235
   }
146 236
 }
@@ -195,6 +285,17 @@ $light_gray: #eee;
195 285
     border-radius: 5px;
196 286
     color: #454545;
197 287
   }
288
+  .select-community {
289
+    float: left;
290
+    color: #F56C6C;
291
+  }
292
+  .selectDiv {
293
+    margin-top: 80px;
294
+  }
295
+  .widSelectDiv {
296
+    margin-top: 80px;
297
+    width: 159px;
298
+  }
198 299
 }
199 300
 </style>
200 301